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 |
|---|---|---|---|---|
untested/x64/oppositeSigns.asm | GabrielRavier/Generic-Assembly-Samples | 0 | 94998 | <gh_stars>0
global _oppositeSigns
global _oppositeSigns64
segment .text align=16
_oppositeSigns:
xor esi, edi
mov eax, esi
shr eax, 31
ret
align 16
_oppositeSigns64:
xor rsi, rdi
shr rsi, 31
setne al
ret |
vendor/stdlib/src/IO.agda | isabella232/Lemmachine | 56 | 9823 | <gh_stars>10-100
------------------------------------------------------------------------
-- IO
------------------------------------------------------------------------
{-# OPTIONS --no-termination-check #-}
module IO where
open import Coinduction
open import Data.Unit
open import Data.String
open import Data.Colist
import Foreign.Haskell as Haskell
import IO.Primitive as Prim
------------------------------------------------------------------------
-- The IO monad
-- One cannot write "infinitely large" computations with the
-- postulated IO monad in IO.Primitive without turning off the
-- termination checker (or going via the FFI, or perhaps abusing
-- something else). The following coinductive deep embedding is
-- introduced to avoid this problem. Possible non-termination is
-- isolated to the run function below.
infixl 1 _>>=_ _>>_
data IO : Set → Set₁ where
lift : ∀ {A} (m : Prim.IO A) → IO A
return : ∀ {A} (x : A) → IO A
_>>=_ : ∀ {A B} (m : ∞₁ (IO A)) (f : (x : A) → ∞₁ (IO B)) → IO B
_>>_ : ∀ {A B} (m₁ : ∞₁ (IO A)) (m₂ : ∞₁ (IO B)) → IO B
-- The use of abstract ensures that the run function will not be
-- unfolded infinitely by the type checker.
abstract
run : ∀ {A} → IO A → Prim.IO A
run (lift m) = m
run (return x) = Prim.return x
run (m >>= f) = Prim._>>=_ (run (♭₁ m )) λ x → run (♭₁ (f x))
run (m₁ >> m₂) = Prim._>>=_ (run (♭₁ m₁)) λ _ → run (♭₁ m₂)
------------------------------------------------------------------------
-- Utilities
-- Because IO A lives in Set₁ I hesitate to define sequence, which
-- would require defining a Set₁ variant of Colist.
mapM : ∀ {A B} → (A → IO B) → Colist A → IO (Colist B)
mapM f [] = return []
mapM f (x ∷ xs) = ♯₁ f x >>= λ y →
♯₁ (♯₁ mapM f (♭ xs) >>= λ ys →
♯₁ return (y ∷ ♯ ys))
-- The reason for not defining mapM′ in terms of mapM is efficiency
-- (the unused results could cause unnecessary memory use).
mapM′ : ∀ {A B} → (A → IO B) → Colist A → IO ⊤
mapM′ f [] = return _
mapM′ f (x ∷ xs) = ♯₁ f x >> ♯₁ mapM′ f (♭ xs)
------------------------------------------------------------------------
-- Simple lazy IO (UTF8-based)
getContents : IO Costring
getContents =
♯₁ lift Prim.getContents >>= λ s →
♯₁ return (Haskell.toColist s)
readFile : String → IO Costring
readFile f =
♯₁ lift (Prim.readFile f) >>= λ s →
♯₁ return (Haskell.toColist s)
writeFile∞ : String → Costring → IO ⊤
writeFile∞ f s =
♯₁ lift (Prim.writeFile f (Haskell.fromColist s)) >>
♯₁ return _
writeFile : String → String → IO ⊤
writeFile f s = writeFile∞ f (toCostring s)
putStr∞ : Costring → IO ⊤
putStr∞ s =
♯₁ lift (Prim.putStr (Haskell.fromColist s)) >>
♯₁ return _
putStr : String → IO ⊤
putStr s = putStr∞ (toCostring s)
putStrLn∞ : Costring → IO ⊤
putStrLn∞ s =
♯₁ lift (Prim.putStrLn (Haskell.fromColist s)) >>
♯₁ return _
putStrLn : String → IO ⊤
putStrLn s = putStrLn∞ (toCostring s)
|
VirtualMachine/Win32/UnitTests/Conditionals/test3_not_2_Boolean.asm | ObjectPascalInterpreter/BookPart_3 | 8 | 16657 | # Test 3, test not operation
pushb true
not
halt
|
source/torrent-trackers.ads | reznikmm/torrent | 4 | 8802 | -- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with League.IRIs;
with League.Strings;
package Torrent.Trackers is
type Announcement_Kind is
(Started, Completed, Stopped, Regular);
function Event_URL
(Tracker : League.IRIs.IRI;
Info_Hash : SHA1;
Peer_Id : SHA1;
Port : Positive;
Uploaded : Ada.Streams.Stream_Element_Count;
Downloaded : Ada.Streams.Stream_Element_Count;
Left : Ada.Streams.Stream_Element_Count;
Event : Announcement_Kind) return League.IRIs.IRI;
-- Construct an URL to request a tracker.
type Response (<>) is tagged private;
function Parse (Data : Ada.Streams.Stream_Element_Array) return Response;
-- Decode tracker's response. Constraint_Error is raised if it fails.
function Is_Failure (Self : Response'Class) return Boolean;
-- If the query failed.
function Failure_Reason
(Self : Response'Class) return League.Strings.Universal_String;
-- A human readable string which explains why the query failed.
function Interval (Self : Response'Class) return Duration;
-- The number of seconds the downloader should wait between regular
-- rerequests.
function Peer_Count (Self : Response'Class) return Natural;
-- Length of peer lists.
function Peer_Id
(Self : Response'Class;
Index : Positive) return SHA1;
-- The peer's self-selected ID
function Peer_Address
(Self : Response'Class;
Index : Positive) return League.Strings.Universal_String;
-- The peer's IP address or DNS name.
function Peer_Port
(Self : Response'Class;
Index : Positive) return Natural;
-- The peer's port number.
private
type Peer is record
Id : SHA1;
Address : League.Strings.Universal_String;
Port : Natural;
end record;
type Peer_Array is array (Positive range <>) of Peer;
type Response (Peer_Count : Natural) is tagged record
Is_Failure : Boolean;
Failure_Reason : League.Strings.Universal_String;
Interval : Duration;
Peers : Peer_Array (1 .. Peer_Count);
end record;
end Torrent.Trackers;
|
disorderly/random_demo_1.adb | jscparker/math_packages | 30 | 18066 | <gh_stars>10-100
-- Demonstrates use of package: Disorderly.Random
with Disorderly.Random; use Disorderly.Random;
with Disorderly.Random.Clock_Entropy;
with Text_io; use text_io;
procedure Random_demo_1 is
X : Random_Int;
Stream_1 : State;
-- Must declare one of these for each desired independent stream of rands.
-- To get successive random nums X from stream_k,
-- you then call Get_Random(X, stream_k);
procedure Pause is
Continue : Character;
begin
new_line; put ("Enter a character to continue: ");
get_immediate (Continue);
new_line;
exception
when others => null;
end Pause;
begin
new_line;
put_line ("The generator needs an initial state before it can create streams");
put_line ("of random numbers. We usually call the state Stream_1. You can");
put_line ("create lots of independent Streams by calling Reset with different");
put_line ("values of the seeds, which are called Initiator1, Initiator2 ... Below");
put_line ("is a series of 12 states created by procedure Reset. The 12 states are");
put_line ("created by setting Initiator1 to 1, 2, 3 ... 12, while keeping ");
put_line ("the other 2 Initiators constant. In fact we only needed to change");
put_line ("Initiator1 by just 1 bit to get a complete change in all four of the");
put_line ("64-bit Integers comprising the state. Each line below shows the four 64 bit");
put_line ("integers of a state. Twelve independent states are printed on 12 lines.");
Pause;
for k in Seed_Random_Int range 1..12 loop
Reset (Stream_1, k, 4444, 55555, 666666);
new_line; put (Formatted_Image (Stream_1));
end loop;
new_line(2);
put_line ("Test functions Image and Value.");
put_line ("Function Image translates the State (an array of 4 Integers) into a String.");
put_line ("Function Value translates the string back to array of 4 Integers.");
put_line ("Do this back and forth, and print the results below. Each string");
put_line ("of 4 numbers (representing a State) should appear twice.");
Pause;
for k in Seed_Random_Int range 1..4 loop
Reset (Stream_1, k, 1, 1, 1);
new_line; put (Formatted_Image (Stream_1));
new_line; put (Formatted_Image (Value (Image (Stream_1))));
new_line;
end loop;
new_line(2);
put_line ("Test of procedure: Clock_Entropy.Reset (Stream_1)");
put_line ("Procedure Clock_Entropy.Reset calls Calendar in an attempt to create");
put_line ("a new and unique initial state each time Clock_Entropy.Reset is called.");
put_line ("Below we call Clock_Entropy.Reset 12 times, in order to get 12 unique");
put_line ("initial states. The 12 initial states (strings of 4 numbers) are printed");
put_line ("on the 12 lines below. If you get the same State twice in a row then the");
put_line ("procedure failed to find a new and unique initial state.");
Pause;
-- up top we wrote: use Disorderly.Random;
-- so we can just call Clock_Entropy.Reset instead of
-- Disorderly.Random.Clock_Entropy.Reset:
new_line;
for k in Seed_Random_Int range 1..12 loop
--Disorderly.Random.Clock_Entropy.Reset (Stream_1);
Clock_Entropy.Reset (Stream_1);
new_line; put (Formatted_Image (Stream_1));
end loop;
new_line(2);
put_line ("Print 8 random nums from Stream_1, the state just initialized.");
Pause;
new_line;
for k in 1..8 loop
Get_Random (X, Stream_1);
new_line; put (Random_Int'Image (X));
end loop;
new_line(2);
put_line ("Final Test");
put_line ("Translate state Integers to a string, and then back to Integer. Do this");
put_line ("back and forth for a long time. If error detected, then report failure.");
Pause;
Clock_Entropy.Reset (Stream_1);
for k in Seed_Random_Int range 1 .. 2**26 loop
Get_Random (X, Stream_1);
if not Are_Equal (Stream_1, Value (Image (Stream_1))) then
raise Program_Error with "FAILURE in Image/Value routines";
end if;
end loop;
new_line; put ("Finished part 1 of the final test.");
for k in Seed_Random_Int range 1 .. 2**22 loop
Reset (Stream_1, k, 1, 1, 1);
if not Are_Equal (Stream_1, Value (Image (Stream_1))) then
raise Program_Error with "FAILURE in Image/Value routines";
end if;
end loop;
new_line; put ("Finished part 2 of the final test.");
for k in Seed_Random_Int range 1 .. 2**20 loop
Clock_Entropy.Reset (Stream_1);
if not Are_Equal (Stream_1, Value (Image (Stream_1))) then
raise Program_Error with "FAILURE in Image/Value routines";
end if;
end loop;
new_line; put ("Finished part 3 of the final test.");
end Random_Demo_1;
|
Kernel/asm/temperature.asm | inesmarca/2TP_SO | 0 | 19502 | <reponame>inesmarca/2TP_SO
GLOBAL getTempTargetInfo
GLOBAL getTempOffsetInfo
getTempTargetInfo:
push rbp
mov rbp,rsp
mov ecx,1A2h; setear la direc de memoria para temperature_status
;rdmsr; me tira la info de la temp en edx:eax
mov eax,0x5640000
mov rsp, rbp
pop rbp
ret
getTempOffsetInfo:
push rbp
mov rbp,rsp
mov ecx,19Ch; setear la direc de memoria para temperature_status
;rdmsr; me tira la info de la temp en edx:eax
mov eax,0x884C2808
mov rsp, rbp
pop rbp
ret |
programs/oeis/033/A033043.asm | neoneye/loda | 22 | 94159 | ; A033043: Sums of distinct powers of 6.
; 0,1,6,7,36,37,42,43,216,217,222,223,252,253,258,259,1296,1297,1302,1303,1332,1333,1338,1339,1512,1513,1518,1519,1548,1549,1554,1555,7776,7777,7782,7783,7812,7813,7818,7819,7992,7993,7998,7999,8028,8029,8034,8035,9072,9073,9078,9079,9108,9109,9114,9115,9288,9289,9294,9295,9324,9325,9330,9331,46656,46657,46662,46663,46692,46693,46698,46699,46872,46873,46878,46879,46908,46909,46914,46915,47952,47953,47958,47959,47988,47989,47994,47995,48168,48169,48174,48175,48204,48205,48210,48211,54432,54433,54438,54439
add $0,8190
seq $0,32927 ; Numbers whose set of base 6 digits is {1,2}.
sub $0,2612138803
|
Engine/Graphics/Codec/DecRLE00.asm | wide-dot/thomson-to8-game-engine | 11 | 170632 | *------------------------------------------------------------------------------*
* *
* Decode RLE image data with transparency *
* <NAME> (01/10/2021) *
* *
*------------------------------------------------------------------------------*
* Data : *
* ------ *
* 00 000000 => end of data *
* 00 nnnnnn => write ptr offset n:1,63 (unsigned) *
* 01 000000 vvvvvvvv => right pixel is transparent, v : byte to add *
* 01 nnnnnn vvvvvvvv => n: nb of byte to repeat (unsigned), value *
* 10 000000 vvvvvvvv => left pixel is transparent, v: byte to add *
* 10 nnnnnn vvvvvvvv ... => n: nb of bytes to write (unsigned), values *
* 11 nnnnnn nnnnnnnn => write ptr offset n:-8192,8191 (14 bits signed) *
* *
* Registers : *
* ----------- *
* y : Ptr to data part 1 *
* u : Ptr to data part 2 *
* glb_screen_location_1 : Ptr to screen part 1 *
* glb_screen_location_2 : Ptr to screen part 2 *
*------------------------------------------------------------------------------*
DecMapAlpha
ldx glb_screen_location_1
stu @end+2
cmpy #0
beq @end ; branch if no data part 1
bra @loop
@l10x
ldb ,y+ ; non-identical bytes
stb ,x+
suba #2
bne @l10x
@loop
lda ,y+ ; new chunk
lsla
bcc @l0x
beq @maskl
bpl @l10x
@l11x
lsla ; 14 bits offset
asra
asra
ldb ,y+
leax d,x
bra @loop
@l0x
beq @end
bmi @l01x
@skip
ldb -1,y ; 6 bits offset
abx
bra @loop
@l01x
anda #%01111111
beq @maskr
ldb ,y+
@repeat
stb ,x+ ; repeat identical bytes
suba #2
bne @repeat
bra @loop
@maskr
ldb #$0f ; write half byte (transparency px on right)
andb ,x
orb ,y+
stb ,x+
bra @loop
@maskl
ldb #$f0 ; write half byte (transparency px on left)
andb ,x
orb ,y+
stb ,x+
bra @loop
@end
ldy #0 ; (dynamic) load next data ptr
beq @rts
ldd #0
std @end+2 ; clear exit flag for second pass
ldx glb_screen_location_2
bra @loop
@rts rts |
agda/Data/Lift.agda | oisdk/combinatorics-paper | 6 | 50 | {-# OPTIONS --cubical --safe #-}
module Data.Lift where
open import Level
record Lift {a} ℓ (A : Type a) : Type (a ℓ⊔ ℓ) where
constructor lift
field lower : A
open Lift public
|
RefactorAgdaEngine/Test/Tests/output/ImportTests/ExtractFunction.agda | omega12345/RefactorAgda | 5 | 15257 | module ImportTests.ExtractFunction where
open import ExtractFunction
open import Data.Nat
open import Data.Bool
checkFunction1 : ℕ
checkFunction1 = function1 2 3
checkFunction2 : ℕ
checkFunction2 = function2 4 true
|
src/main/antlr/SimpleDBGrammar.g4 | zinoviy23/SimpleDB4Java | 0 | 4356 | grammar SimpleDBGrammar;
@parser::members
{
// table for classes
public static final java.util.Set<String> classesSymbolTable = new java.util.HashSet<>();
// table for fields
public static final java.util.Map<String, java.util.Map<String, String>> fieldsSymbolTable = new java.util.HashMap<>();
// table for fields name with first lower case latter
public static final java.util.Map<String, java.util.Set<String>> lowerCaseFieldsSymbolTable = new java.util.HashMap<>();
public static String firstLatterToLowerCase(String str) {
return Character.toLowerCase(str.charAt(0)) + str.substring(1);
}
// class for methods
public static class MethodInfo {
public final String type;
public final String name;
public final boolean isStatic;
public final java.util.LinkedHashMap<String, String> arguments;
public MethodInfo(String type, String name, boolean isStatic, java.util.LinkedHashMap<String, String> arguments) {
this.name = name;
this.type = type;
this.arguments = arguments;
this.isStatic = isStatic;
}
@Override
public String toString() {
return "{type=" + type + ", name=" + name + ", isStatic=" + isStatic + ", arguments=" + arguments +"}";
}
}
// table for methods
public static final java.util.Map<String, java.util.Map<String, MethodInfo>> methodsSymbolTable = new java.util.HashMap<>();
// clears tables
public static void clearSymbolTables() {
classesSymbolTable.clear();
fieldsSymbolTable.clear();
lowerCaseFieldsSymbolTable.clear();
methodsSymbolTable.clear();
}
}
file : fileHeader (classDef)*; // root node
fileHeader : DATABASEKW ID CMDEND; // file header
typeId : ID(LSQBR RSQBR)?; // type inditificator
fieldDef[String className] : typeId a=ID CMDEND
{
if (!fieldsSymbolTable.containsKey($className))
fieldsSymbolTable.put($className, new java.util.LinkedHashMap<>());
if (fieldsSymbolTable.get($className).containsKey($a.text)) {
throw new RuntimeException(String.format("Two fields with same inditificators (%s) in class %s. Line %d",
$a.text, $className, $a.line));
}
fieldsSymbolTable.get($className).put($a.text, $typeId.text);
if (!lowerCaseFieldsSymbolTable.containsKey($className))
lowerCaseFieldsSymbolTable.put($className, new java.util.LinkedHashSet<>());
if (lowerCaseFieldsSymbolTable.get($className).contains(firstLatterToLowerCase($a.text))) {
throw new RuntimeException(String.format("Two fields with same inditificators with first latter in lower case (%s) in class %s. Line %d",
firstLatterToLowerCase($a.text), $className, $a.line));
}
lowerCaseFieldsSymbolTable.get($className).add(firstLatterToLowerCase($a.text));
}; // field definition
classDef : CLASSKW ID LBRACE (fieldDef[$ID.text]|queryDef[$ID.text])* RBRACE {classesSymbolTable.add($ID.text);}; // class definition
unaryExpr : unaryOp expression;
dottedId : ID (LPAR callArgList RPAR)? (DOT dottedId)?; // doted name like System.out.println
arrayElementGetting: (dottedId | array) LSQBR expression RSQBR;
expression : unaryExpr | // expression
arrayElementGetting |
expression (MULT|DIV) expression |
expression (PLUS|MINUS) expression |
expression (LS|GR|LE|GE) expression |
expression (EQ|NOTEQ) expression |
expression AND expression | expression OR expression | dottedId | constant | array |
LPAR expression RPAR;
arrIndexList: expression (COMMA expression)*;
unaryOp: (MINUS|PLUS);
callArgList : | expression (COMMA expression)*; // call arguments
simpleCommand : RETURNKW expression CMDEND | typeId ID ASSIGN expression CMDEND |
ID (ASSIGN|PLUSASSIGN|MINUSASSIGM) expression CMDEND |
dottedId CMDEND; // simple command
blockCommand : forCycle | ifStatement;
command: simpleCommand | blockCommand;
queryDef[String className] : typeId ID LPAR funcArgList RPAR (LEFTARROW expression CMDEND
|
LBRACE command* RBRACE)
{
java.util.LinkedHashMap<String, String> arguments = new java.util.LinkedHashMap<>();
for (int i = 0; i < $funcArgList.ctx.ID().size(); i++) {
if (arguments.containsKey($funcArgList.ctx.ID(i).getText()))
throw new RuntimeException(String.format("Two arguments with same inditificators (%s) in class %s in method %s. Line %d",
$funcArgList.ctx.ID(i).getText(), $className, $ID.text, $ID.line));
arguments.put($funcArgList.ctx.ID(i).getText(), $funcArgList.ctx.typeId(i).getText());
}
if (!methodsSymbolTable.containsKey($className))
methodsSymbolTable.put($className, new java.util.HashMap<>());
if (methodsSymbolTable.get($className).containsKey($ID.text))
throw new RuntimeException(String.format("Two methods with same inditificators (%s) in class %s. Line %d",
$ID.text, $className, $ID.line));
methodsSymbolTable.get($className).put($ID.text, new MethodInfo($typeId.text, $ID.text, true, arguments));
}; // definition of query method
funcArgList : | typeId ID (COMMA typeId ID)*; // arguments
block : command | LBRACE (command)* RBRACE; // block {}
forCycle : FORKW LPAR typeId ID DOUBLEDOT expression RPAR block; // for cycle
ifStatement : IFKW LPAR expression RPAR block (elseBlock)?; // if-else
elseBlock : ELSEKW block; // else block
array : LBRACE arrIndexList RBRACE; // array constant
constant: (BOOLEAN | INT | FLOAT | STRING | NULL);
CMDEND : ';';
DATABASEKW : 'database';
CLASSKW : 'class';
RETURNKW : 'return';
FORKW : 'for';
IFKW: 'if';
ELSEKW : 'else';
LBRACE : '{';
RBRACE : '}';
LPAR : '(';
RPAR : ')';
LSQBR : '[';
RSQBR : ']';
DOT : '.';
PLUS: '+';
PLUSPLUS: '++';
MINUS: '-';
MINUSMINUS: '--';
MULT: '*';
DIV: '/';
LS: '<';
GR: '>';
LE: '<=';
GE: '>=';
EQ: '==';
NOTEQ: '!=';
ASSIGN: '=';
PLUSASSIGN: '+=';
MINUSASSIGM: '-=';
OR: '||';
AND: '&&';
COMMA : ',';
DOUBLEDOT : ':';
LEFTARROW: '->';
BOOLEAN : ('true'|'false');
NULL : 'null';
INT : ('+'|'-')?([1-9][0-9]*|'0');
FLOAT : ('+'|'-')?([1-9][0-9]*|'0')?'.'[0-9]+;
STRING : '"'~["\n\r]*'"';
ID : [a-zA-Z_][a-zA-Z_0-9]*;
SKIP_ : (WS | COMMENT) -> skip;
fragment COMMENT : '//'~[\r\n\f]*;
fragment WS : [ \n\r\t]+;
|
Tests/yasm-regression/svm.asm | 13xforever/x86-assembly-textmate-bundle | 69 | 160736 | [bits 64]
rdtscp ; out: 0f 01 f9
clgi ; out: 0f 01 dd
invlpga ; out: 0f 01 df
invlpga [rax], ecx ; out: 0f 01 df
invlpga [eax], ecx ; out: 67 0f 01 df
;invlpga [ax], ecx ; invalid
skinit ; out: 0f 01 de
;skinit [rax] ; invalid
skinit [eax] ; out: 0f 01 de
stgi ; out: 0f 01 dc
vmload ; out: 0f 01 da
vmload [rax] ; out: 0f 01 da
vmload [eax] ; out: 67 0f 01 da
vmmcall ; out: 0f 01 d9
vmrun ; out: 0f 01 d8
vmrun [rax] ; out: 0f 01 d8
vmrun [eax] ; out: 67 0f 01 d8
vmsave ; out: 0f 01 db
vmsave [rax] ; out: 0f 01 db
vmsave [eax] ; out: 67 0f 01 db
[bits 32]
invlpga ; out: 0f 01 df
invlpga [eax], ecx ; out: 0f 01 df
invlpga [ax], ecx ; out: 67 0f 01 df
skinit ; out: 0f 01 de
skinit [eax] ; out: 0f 01 de
;skinit [ax] ; invalid
vmload ; out: 0f 01 da
vmload [eax] ; out: 0f 01 da
vmload [ax] ; out: 67 0f 01 da
vmrun ; out: 0f 01 d8
vmrun [eax] ; out: 0f 01 d8
vmrun [ax] ; out: 67 0f 01 d8
vmsave ; out: 0f 01 db
vmsave [eax] ; out: 0f 01 db
vmsave [ax] ; out: 67 0f 01 db
|
Tests/IO/NameSpace.e.asm | ShawSumma/Evie | 0 | 11781 | .intel_syntax noprefix
.file 1 "Tests/IO/NameSpace.e" #1 "Tests/IO/NameSpace.e"
.file 2 "Tests/IO/../../STD/STD.e" #2 "Tests/IO/../../STD/STD.e"
.file 3 "Tests/IO/../../STD/Types.e" #3 "Tests/IO/../../STD/Types.e"
.file 4 "Tests/IO/../../STD/Memory.e" #4 "Tests/IO/../../STD/Memory.e"
.file 5 "Tests/IO/../../STD/List.e" #5 "Tests/IO/../../STD/List.e"
.file 6 "Tests/IO/../../STD/String.e" #6 "Tests/IO/../../STD/String.e"
.file 7 "Tests/IO/../../STD/Console.e" #7 "Tests/IO/../../STD/Console.e"
.file 8 "Tests/IO/../../STD/sys.e" #8 "Tests/IO/../../STD/sys.e"
.file 9 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/console.asm.obj" #9 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/console.asm.obj"
.file 10 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/console.asm" #10 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/console.asm"
.file 11 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/math.asm.obj" #11 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/math.asm.obj"
.file 12 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/math.asm" #12 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/math.asm"
.file 13 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/memory.asm.obj" #13 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/memory.asm.obj"
.file 14 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/memory.asm" #14 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/memory.asm"
.file 15 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/system.asm.obj" #15 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/system.asm.obj"
.file 16 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/system.asm" #16 "C:/Users/GabenRTX/.Repos/vivid/Vivid/libv/windows_x64/system.asm"
.file 17 "Tests/IO/../../STD/Win/File.e" #17 "Tests/IO/../../STD/Win/File.e"
Code_Start:
.global _Z4mainv
.global _Z10Start_Testv
.section .text #.text
_Z10Start_Testv_START:
.loc 1 34 1 #1 34 1
_Z10Start_Testv:
.cfi_startproc #
.cfi_def_cfa_offset 16 #16
push rdi #rdi
push rbx #rbx
sub rsp, 40 #.STACK, 40
.loc 1 36 2 #1 36 2
lea rcx, qword ptr [rsp + 0 ] #b_REG0, .STACK_0
mov rcx, rcx #b_TMP_2059745582736, b_REG0
.loc 17 2 36 #17 2 36
add qword ptr [rcx + 0 ], 1 #b_TMP_2059745582736_0, 1
.loc 1 36 2 #1 36 2
mov qword ptr [rsp + 32 ], rcx #.STACK_32, b_TMP_2059745582736
mov rcx, qword ptr [rsp + 32 ] #this_3_REG1, .STACK_32
.loc 1 12 8 #1 12 8
mov dword ptr [rcx + 8 ], 1 #this_3_REG1_8, 1
.loc 1 13 15 #1 13 15
mov dword ptr [rip + Banana_Y ], 2 #.RIP_Banana_Y, 2
jmp Return_Here_3 #Return_Here_3
.loc 1 36 11 #1 36 11
Return_Here_3:
.loc 1 37 12 #1 37 12
lea rcx, qword ptr [rsp + 0 ] #b_REG2, .STACK_0
mov rcx, rcx #b_TMP_2059745594832, b_REG2
.loc 17 2 36 #17 2 36
add qword ptr [rcx + 0 ], 1 #b_TMP_2059745594832_0, 1
.loc 1 37 12 #1 37 12
mov qword ptr [rsp + 16 ], rcx #.STACK_16, b_TMP_2059745594832
mov ebx, dword ptr [rip + Banana_Y ] #Banana_Y_REGISTER, .RIP_Banana_Y
mov rcx, qword ptr [rsp + 16 ] #this_1_REG3, .STACK_16
.loc 1 12 2 #1 12 2
mov ecx, dword ptr [rcx + 8 ] #this_1_REG3_8_REG4, this_1_REG3_8
.loc 1 21 11 #1 21 11
add ebx, ecx #Banana_Y_REGISTER, this_1_REG3_8_REG4
mov ecx, ebx #Return_Value1, Banana_Y_REGISTER
jmp Return_Here_1 #Return_Here_1
.loc 1 37 14 #1 37 14
Return_Here_1:
lea r8, qword ptr [rsp + 0 ] #b_REG5, .STACK_0
mov r8, r8 #b_TMP_2059745613840, b_REG5
.loc 17 2 36 #17 2 36
add qword ptr [r8 + 0 ], 1 #b_TMP_2059745613840_0, 1
.loc 1 37 22 #1 37 22
mov qword ptr [rsp + 24 ], r8 #.STACK_24, b_TMP_2059745613840
mov r8, qword ptr [rsp + 24 ] #this_2_REG6, .STACK_24
.loc 1 15 5 #1 15 5
mov dword ptr [r8 + 8 ], 1 #this_2_REG6_8, 1
mov r8, qword ptr [rsp + 24 ] #this_2_REG7, .STACK_24
.loc 1 12 2 #1 12 2
mov r8d, dword ptr [r8 + 8 ] #this_2_REG7_8_REG8, this_2_REG7_8
.loc 1 16 12 #1 16 12
add r8d, 1 #this_2_REG7_8_REG8, 1
mov r8d, r8d #Return_Value2, this_2_REG7_8_REG8
jmp Return_Here_2 #Return_Here_2
.loc 1 37 24 #1 37 24
Return_Here_2:
mov ecx, ecx #REG_Return_Value19, Return_Value1
add ecx, r8d #REG_Return_Value19, Return_Value2
mov edi, ecx #B_X, REG_Return_Value19
.loc 17 1 8 #17 1 8
mov rcx, qword ptr [rsp + 16 ] #REG_this_1_Parameter41, .STACK_16
call _ZN6Banana10DestructorEP6Banana
mov rcx, qword ptr [rsp + 24 ] #REG_this_2_Parameter18467, .STACK_24
call _ZN6Banana10DestructorEP6Banana
mov ebx, dword ptr [rip + Banana_Y ] #Banana_Y_REGISTER, .RIP_Banana_Y
mov ecx, dword ptr [rip + Apple_Y ] #Apple_Y_REGISTER, .RIP_Apple_Y
.loc 1 38 18 #1 38 18
add ebx, ecx #Banana_Y_REGISTER, Apple_Y_REGISTER
sub ebx, edi #Banana_Y_REGISTER, B_X
mov eax, ebx #Returning_REG12, Banana_Y_REGISTER
add rsp, 40 #.STACK, 40
pop rbx #rbx
pop rdi #rdi
ret #
add rsp, 40 #.STACK, 40
pop rbx #rbx
pop rdi #rdi
ret #
_Z10Start_Testv_END:
.cfi_endproc #
_Z4mainv_START:
.loc 1 41 1 #1 41 1
_Z4mainv:
.cfi_startproc #
.cfi_def_cfa_offset 16 #16
.loc 1 43 2 #1 43 2
mov eax, 1 #Returning_REG0, 1
ret #
ret #
_Z4mainv_END:
.cfi_endproc #
_ZN6Banana10DestructorEP6Banana_START:
.loc 1 8 1 #1 8 1
_ZN6Banana10DestructorEP6Banana:
.cfi_startproc #
.cfi_def_cfa_offset 16 #16
sub rsp, 16 #.STACK, 16
mov qword ptr [rsp + 0 ], rcx #.STACK_0, this
.loc 17 1 1 #17 1 1
if_0:
cmp qword ptr [rsp + 0 ], 0 #.STACK_0, 0
je if_0_END #if_0_END
mov rcx, qword ptr [rsp + 0 ] #this_REG0, .STACK_0
.loc 1 8 1 #1 8 1
mov rcx, qword ptr [rcx + 0 ] #this_REG0_0_REG1, this_REG0_0
.loc 17 1 26 #17 1 26
sub rcx, 1 #this_REG0_0_REG1, 1
cmp rcx, 1 #this_REG0_0_REG1, 1
jge if_0_END #if_0_END
.loc 17 2 19 #17 2 19
mov rcx, qword ptr [rsp + 0 ] #this_TMP_2059745606928, .STACK_0
add qword ptr [rcx + 0 ], 1 #this_TMP_2059745606928_0, 1
mov qword ptr [rsp + 0 ], rcx #.STACK_0, this_TMP_2059745606928
mov rcx, qword ptr [rsp + 0 ] #REG_this2, .STACK_0
mov qword ptr [rsp + 0 ], rcx #.STACK_0, REG_this2
.loc 4 14 2 #4 14 2
mov rcx, qword ptr [rsp + 0 ] #REG_Address_0_Parameter6334, .STACK_0
mov edx, 8 #REG_8_Parameter26500, 8
call _V19internal_deallocatePhx
.loc 17 2 1 #17 2 1
Return_Here_0:
.loc 17 1 11 #17 1 11
mov rcx, qword ptr [rsp + 0 ] #REG_Address_0_Parameter19169, .STACK_0
call _ZN6Banana10DestructorEP6Banana
if_0_END:
add rsp, 16 #.STACK, 16
ret #
_ZN6Banana10DestructorEP6Banana_END:
.cfi_endproc #
Code_End:
.section .data #.data
std_MAX_CONCOLE_BUFFER_LENGHT:
.long 4096 #4096
std_GENERIC_WRITE:
.long 1073741824 #1073741824
std_GENERIC_READ:
.quad 2147483648 #2147483648
std_FILE_SHARE_NONE:
.long 0 #0
std_FILE_SHARE_READ:
.long 1 #1
std_FILE_SHARE_WRITE:
.long 2 #2
std_FILE_SHARE_DELETE:
.long 4 #4
std_CREATE_NEW:
.long 1 #1
std_CREATE_ALWAYS:
.long 2 #2
std_OPEN_EXISTING:
.long 3 #3
std_OPEN_ALWAYS:
.long 4 #4
std_TRUNCATE_EXISTING:
.long 4 #4
std_FILE_ATTRIBUTE_NORMAL:
.long 128 #128
std_FILE_ATTRIBUTE_FOLDER:
.long 16 #16
std_MAXIMUM_PATH_LENGTH:
.long 260 #260
std_ERROR_INSUFFICIENT_BUFFER:
.long 122 #122
std_MINIMUM_PROCESS_FILENAME_LENGTH:
.long 50 #50
Banana_Y:
.long 2 #2
Apple_X:
.long 2 #2
Apple_Y:
.long 3 #3
Apple_Z:
.long 3 #3
.section .debug_abbrev #.debug_abbrev
debug_abbrev:
.byte 1 #1
.byte 17 #17
.byte 1 #1
.byte 37 #37
.byte 14 #14
.byte 19 #19
.byte 5 #5
.byte 3 #3
.byte 14 #14
.byte 16 #16
.byte 23 #23
.byte 27 #27
.byte 14 #14
.byte 17 #17
.byte 1 #1
.byte 18 #18
.byte 6 #6
.byte 0 #0
.byte 0 #0
.byte 2 #2
.byte 36 #36
.byte 0 #0
.byte 3 #3
.byte 8 #8
.byte 62 #62
.byte 11 #11
.byte 11 #11
.byte 7 #7
.byte 58 #58
.byte 11 #11
.byte 59 #59
.byte 11 #11
.byte 0 #0
.byte 0 #0
.byte 3 #3
.byte 52 #52
.byte 0 #0
.byte 56 #56
.byte 5 #5
.byte 3 #3
.byte 8 #8
.byte 58 #58
.byte 11 #11
.byte 59 #59
.byte 11 #11
.byte 73 #73
.byte 19 #19
.byte 0 #0
.byte 0 #0
.byte 4 #4
.byte 2 #2
.byte 1 #1
.byte 54 #54
.byte 11 #11
.byte 3 #3
.byte 8 #8
.byte 11 #11
.byte 7 #7
.byte 58 #58
.byte 11 #11
.byte 59 #59
.byte 11 #11
.byte 0 #0
.byte 0 #0
.byte 5 #5
.byte 46 #46
.byte 0 #0
.byte 17 #17
.byte 1 #1
.byte 18 #18
.byte 6 #6
.byte 64 #64
.byte 24 #24
.byte 3 #3
.byte 8 #8
.byte 58 #58
.byte 11 #11
.byte 59 #59
.byte 11 #11
.byte 0 #0
.byte 0 #0
.byte 6 #6
.byte 46 #46
.byte 1 #1
.byte 17 #17
.byte 1 #1
.byte 18 #18
.byte 6 #6
.byte 64 #64
.byte 24 #24
.byte 3 #3
.byte 8 #8
.byte 58 #58
.byte 11 #11
.byte 59 #59
.byte 11 #11
.byte 73 #73
.byte 19 #19
.byte 0 #0
.byte 0 #0
.byte 7 #7
.byte 46 #46
.byte 1 #1
.byte 17 #17
.byte 1 #1
.byte 18 #18
.byte 6 #6
.byte 64 #64
.byte 24 #24
.byte 3 #3
.byte 8 #8
.byte 58 #58
.byte 11 #11
.byte 59 #59
.byte 11 #11
.byte 0 #0
.byte 0 #0
.byte 8 #8
.byte 46 #46
.byte 1 #1
.byte 17 #17
.byte 1 #1
.byte 18 #18
.byte 6 #6
.byte 64 #64
.byte 24 #24
.byte 110 #110
.byte 8 #8
.byte 3 #3
.byte 8 #8
.byte 58 #58
.byte 11 #11
.byte 59 #59
.byte 11 #11
.byte 63 #63
.byte 25 #25
.byte 0 #0
.byte 0 #0
.byte 9 #9
.byte 52 #52
.byte 0 #0
.byte 2 #2
.byte 24 #24
.byte 3 #3
.byte 8 #8
.byte 58 #58
.byte 11 #11
.byte 59 #59
.byte 11 #11
.byte 73 #73
.byte 19 #19
.byte 0 #0
.byte 0 #0
.byte 10 #10
.byte 46 #46
.byte 0 #0
.byte 17 #17
.byte 1 #1
.byte 18 #18
.byte 6 #6
.byte 64 #64
.byte 24 #24
.byte 110 #110
.byte 8 #8
.byte 3 #3
.byte 8 #8
.byte 58 #58
.byte 11 #11
.byte 59 #59
.byte 11 #11
.byte 63 #63
.byte 25 #25
.byte 0 #0
.byte 0 #0
.byte 11 #11
.byte 5 #5
.byte 0 #0
.byte 2 #2
.byte 24 #24
.byte 3 #3
.byte 8 #8
.byte 58 #58
.byte 11 #11
.byte 59 #59
.byte 11 #11
.byte 73 #73
.byte 19 #19
.byte 0 #0
.byte 0 #0
.byte 12 #12
.byte 2 #2
.byte 0 #0
.byte 54 #54
.byte 11 #11
.byte 3 #3
.byte 8 #8
.byte 11 #11
.byte 7 #7
.byte 58 #58
.byte 11 #11
.byte 59 #59
.byte 11 #11
.byte 0 #0
.byte 0 #0
.byte 0 #0
.section .debug_info #.debug_info
Debug_Info_Start:
.long Debug_Info_End-Debug_Info #Debug_Info_End-Debug_Info
Debug_Info:
.word 4 #4
.secrel32 debug_abbrev #debug_abbrev
.byte 8 #8
.byte 1 #1
.secrel32 .COMPILER_NAME #.COMPILER_NAME
.word 0x29A #0x29A
.secrel32 .FILE_NAME #.FILE_NAME
.secrel32 .LINE_TABLE #.LINE_TABLE
.secrel32 .DIRECTORY #.DIRECTORY
.quad Code_Start #Code_Start
.quad Code_End #Code_End
_char_START:
.byte 2 #2
.asciz "char" #char
.byte 6 #6
.quad 0 #0
.byte 3 #3
.byte 1 #1
_bool_START:
.byte 2 #2
.asciz "bool" #bool
.byte 6 #6
.quad 0 #0
.byte 3 #3
.byte 5 #5
_short_START:
.byte 2 #2
.asciz "short" #short
.byte 5 #5
.quad 0 #0
.byte 3 #3
.byte 9 #9
_int_START:
.byte 2 #2
.asciz "int" #int
.byte 5 #5
.quad 0 #0
.byte 3 #3
.byte 13 #13
_long_START:
.byte 2 #2
.asciz "long" #long
.byte 5 #5
.quad 0 #0
.byte 3 #3
.byte 17 #17
_float_START:
.byte 2 #2
.asciz "float" #float
.byte 4 #4
.quad 0 #0
.byte 3 #3
.byte 21 #21
_double_START:
.byte 2 #2
.asciz "double" #double
.byte 4 #4
.quad 0 #0
.byte 3 #3
.byte 26 #26
_3std_START:
.byte 4 #4
.byte 1 #1
.asciz "std" #std
.quad 0 #0
.byte 5 #5
.byte 1 #1
_6string_START:
.byte 4 #4
.byte 1 #1
.asciz "string" #string
.quad 0 #0
.byte 6 #6
.byte 2 #2
.byte 3 #3
.word 0 #0
.asciz "Characters" #Characters
.byte 6 #6
.byte 3 #3
.long _14____List_char__START-Debug_Info_Start #_14____List_char__START-Debug_Info_Start
.byte 0 #0
_14____List_char__START:
.byte 4 #4
.byte 1 #1
.asciz "____List_char_" #____List_char_
.quad 0 #0
.byte 5 #5
.byte 2 #2
.byte 3 #3
.word 0 #0
.asciz "Capacity" #Capacity
.byte 5 #5
.byte 3 #3
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "Size" #Size
.byte 5 #5
.byte 4 #4
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "Array" #Array
.byte 5 #5
.byte 5 #5
.long _char_START-Debug_Info_Start #_char_START-Debug_Info_Start
.byte 0 #0
.byte 3 #3
.word 0 #0
.asciz "MAX_CONCOLE_BUFFER_LENGHT" #MAX_CONCOLE_BUFFER_LENGHT
.byte 7 #7
.byte 3 #3
.long _long_START-Debug_Info_Start #_long_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "GENERIC_WRITE" #GENERIC_WRITE
.byte 17 #17
.byte 2 #2
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "GENERIC_READ" #GENERIC_READ
.byte 17 #17
.byte 3 #3
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "FILE_SHARE_NONE" #FILE_SHARE_NONE
.byte 17 #17
.byte 5 #5
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "FILE_SHARE_READ" #FILE_SHARE_READ
.byte 17 #17
.byte 6 #6
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "FILE_SHARE_WRITE" #FILE_SHARE_WRITE
.byte 17 #17
.byte 7 #7
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "FILE_SHARE_DELETE" #FILE_SHARE_DELETE
.byte 17 #17
.byte 8 #8
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "CREATE_NEW" #CREATE_NEW
.byte 17 #17
.byte 10 #10
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "CREATE_ALWAYS" #CREATE_ALWAYS
.byte 17 #17
.byte 11 #11
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "OPEN_EXISTING" #OPEN_EXISTING
.byte 17 #17
.byte 12 #12
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "OPEN_ALWAYS" #OPEN_ALWAYS
.byte 17 #17
.byte 13 #13
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "TRUNCATE_EXISTING" #TRUNCATE_EXISTING
.byte 17 #17
.byte 14 #14
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "FILE_ATTRIBUTE_NORMAL" #FILE_ATTRIBUTE_NORMAL
.byte 17 #17
.byte 16 #16
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "FILE_ATTRIBUTE_FOLDER" #FILE_ATTRIBUTE_FOLDER
.byte 17 #17
.byte 17 #17
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "MAXIMUM_PATH_LENGTH" #MAXIMUM_PATH_LENGTH
.byte 17 #17
.byte 19 #19
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "ERROR_INSUFFICIENT_BUFFER" #ERROR_INSUFFICIENT_BUFFER
.byte 17 #17
.byte 21 #21
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "MINIMUM_PROCESS_FILENAME_LENGTH" #MINIMUM_PROCESS_FILENAME_LENGTH
.byte 17 #17
.byte 22 #22
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
_Char_260_START:
.byte 2 #2
.asciz "Char_260" #Char_260
.byte 5 #5
.quad 0 #0
.byte 17 #17
.byte 41 #41
_Char_14_START:
.byte 2 #2
.asciz "Char_14" #Char_14
.byte 5 #5
.quad 0 #0
.byte 17 #17
.byte 45 #45
_12FileIterator_START:
.byte 4 #4
.byte 1 #1
.asciz "FileIterator" #FileIterator
.quad 0 #0
.byte 17 #17
.byte 49 #49
.byte 3 #3
.word 0 #0
.asciz "attributes" #attributes
.byte 17 #17
.byte 50 #50
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "creation_time" #creation_time
.byte 17 #17
.byte 51 #51
.long _long_START-Debug_Info_Start #_long_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "last_access_time" #last_access_time
.byte 17 #17
.byte 52 #52
.long _long_START-Debug_Info_Start #_long_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "last_write_time" #last_write_time
.byte 17 #17
.byte 53 #53
.long _long_START-Debug_Info_Start #_long_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "file_size" #file_size
.byte 17 #17
.byte 54 #54
.long _long_START-Debug_Info_Start #_long_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "reserved" #reserved
.byte 17 #17
.byte 55 #55
.long _long_START-Debug_Info_Start #_long_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "filename" #filename
.byte 17 #17
.byte 56 #56
.long _Char_260_START-Debug_Info_Start #_Char_260_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "alternate_filename" #alternate_filename
.byte 17 #17
.byte 57 #57
.long _Char_14_START-Debug_Info_Start #_Char_14_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "file_type" #file_type
.byte 17 #17
.byte 58 #58
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "creator_type" #creator_type
.byte 17 #17
.byte 59 #59
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "finder_flags" #finder_flags
.byte 17 #17
.byte 60 #60
.long _short_START-Debug_Info_Start #_short_START-Debug_Info_Start
.byte 0 #0
.byte 0 #0
_6Banana_START:
.byte 4 #4
.byte 1 #1
.asciz "Banana" #Banana
.quad 0 #0
.byte 1 #1
.byte 8 #8
.byte 3 #3
.word 0 #0
.asciz "Reference_Count" #Reference_Count
.byte 1 #1
.byte 8 #8
.long _long_START-Debug_Info_Start #_long_START-Debug_Info_Start
.byte 3 #3
.word 8 #8
.asciz "X" #X
.byte 1 #1
.byte 12 #12
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 12 #12
.asciz "Y" #Y
.byte 1 #1
.byte 13 #13
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 0 #0
_5Apple_START:
.byte 4 #4
.byte 1 #1
.asciz "Apple" #Apple
.quad 0 #0
.byte 1 #1
.byte 24 #24
.byte 3 #3
.word 0 #0
.asciz "X" #X
.byte 1 #1
.byte 26 #26
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "Y" #Y
.byte 1 #1
.byte 27 #27
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 3 #3
.word 0 #0
.asciz "Z" #Z
.byte 1 #1
.byte 31 #31
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 0 #0
.byte 8 #8
.quad _Z10Start_Testv_START #_Z10Start_Testv_START
.quad _Z10Start_Testv_END #_Z10Start_Testv_END
.byte 1 #1
.byte 87 #87
.asciz "_Z10Start_Testv" #_Z10Start_Testv
.asciz "Start_Test" #Start_Test
.byte 1 #1
.byte 34 #34
.byte 9 #9
.byte 2 #2
.byte 145 #145
.byte 0 #0
.asciz "b" #b
.byte 1 #1
.byte 36 #36
.long _6Banana_START-Debug_Info_Start #_6Banana_START-Debug_Info_Start
.byte 9 #9
.byte 2 #2
.byte 145 #145
.byte 0 #0
.asciz "B_X" #B_X
.byte 1 #1
.byte 37 #37
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 9 #9
.byte 2 #2
.byte 145 #145
.byte 0 #0
.asciz "Return_Value1" #Return_Value1
.byte 1 #1
.byte 37 #37
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 9 #9
.byte 2 #2
.byte 145 #145
.byte 16 #16
.asciz "this_1" #this_1
.byte 1 #1
.byte 20 #20
.long _6Banana_START-Debug_Info_Start #_6Banana_START-Debug_Info_Start
.byte 9 #9
.byte 2 #2
.byte 145 #145
.byte 0 #0
.asciz "Return_Value2" #Return_Value2
.byte 1 #1
.byte 37 #37
.long _int_START-Debug_Info_Start #_int_START-Debug_Info_Start
.byte 9 #9
.byte 2 #2
.byte 145 #145
.byte 24 #24
.asciz "this_2" #this_2
.byte 1 #1
.byte 14 #14
.long _6Banana_START-Debug_Info_Start #_6Banana_START-Debug_Info_Start
.byte 9 #9
.byte 2 #2
.byte 145 #145
.byte 32 #32
.asciz "this_3" #this_3
.byte 1 #1
.byte 8 #8
.long _6Banana_START-Debug_Info_Start #_6Banana_START-Debug_Info_Start
.byte 9 #9
.byte 2 #2
.byte 145 #145
.byte 0 #0
.asciz "b_TMP_2059745582736" #b_TMP_2059745582736
.byte 1 #1
.byte 36 #36
.long _6Banana_START-Debug_Info_Start #_6Banana_START-Debug_Info_Start
.byte 9 #9
.byte 2 #2
.byte 145 #145
.byte 0 #0
.asciz "b_TMP_2059745594832" #b_TMP_2059745594832
.byte 1 #1
.byte 37 #37
.long _6Banana_START-Debug_Info_Start #_6Banana_START-Debug_Info_Start
.byte 9 #9
.byte 2 #2
.byte 145 #145
.byte 0 #0
.asciz "b_TMP_2059745613840" #b_TMP_2059745613840
.byte 1 #1
.byte 37 #37
.long _6Banana_START-Debug_Info_Start #_6Banana_START-Debug_Info_Start
.byte 0 #0
.byte 10 #10
.quad _Z4mainv_START #_Z4mainv_START
.quad _Z4mainv_END #_Z4mainv_END
.byte 1 #1
.byte 87 #87
.asciz "_Z4mainv" #_Z4mainv
.asciz "main" #main
.byte 1 #1
.byte 41 #41
_26____VIRTUAL_CLASS_char_ptr_START:
.byte 12 #12
.byte 1 #1
.asciz "____VIRTUAL_CLASS_char_ptr" #____VIRTUAL_CLASS_char_ptr
.quad 0 #0
.byte 4 #4
.byte 14 #14
_func_START:
.byte 2 #2
.asciz "func" #func
.byte 5 #5
.quad 0 #0
.byte 1 #1
.byte 1 #1
.byte 0 #0
Debug_Info_End:
.section .debug_str #.debug_str
.COMPILER_NAME:
.asciz "Evie engine 3.0.0 https://github.com/Gabidal/Evie" #Evie engine 3.0.0 https://github.com/Gabidal/Evie
.FILE_NAME:
.asciz "Tests/IO/NameSpace.e" #Tests/IO/NameSpace.e
.DIRECTORY:
.asciz "Tests/IO/" #Tests/IO/
.section .LINE_TABLE #.LINE_TABLE
.LINE_TABLE:
|
programs/oeis/084/A084509.asm | neoneye/loda | 22 | 82280 | ; A084509: Number of ground-state 3-ball juggling sequences of period n.
; 1,1,2,6,24,96,384,1536,6144,24576,98304,393216,1572864,6291456,25165824,100663296,402653184,1610612736,6442450944,25769803776,103079215104,412316860416,1649267441664,6597069766656,26388279066624,105553116266496,422212465065984,1688849860263936,6755399441055744,27021597764222976,108086391056891904,432345564227567616,1729382256910270464,6917529027641081856,27670116110564327424,110680464442257309696,442721857769029238784,1770887431076116955136,7083549724304467820544,28334198897217871282176,113336795588871485128704,453347182355485940514816,1813388729421943762059264,7253554917687775048237056,29014219670751100192948224,116056878683004400771792896,464227514732017603087171584,1856910058928070412348686336,7427640235712281649394745344,29710560942849126597578981376,118842243771396506390315925504,475368975085586025561263702016,1901475900342344102245054808064,7605903601369376408980219232256,30423614405477505635920876929024,121694457621910022543683507716096,486777830487640090174734030864384,1947111321950560360698936123457536,7788445287802241442795744493830144,31153781151208965771182977975320576,124615124604835863084731911901282304,498460498419343452338927647605129216
mov $1,4
pow $1,$0
mul $1,6
div $1,16
mul $1,4
sub $1,4
div $1,4
mul $1,2
div $1,8
add $1,1
mov $0,$1
|
Driver/IFS/DOS/MS7/ms7Utils.asm | steakknife/pcgeos | 504 | 166714 | <reponame>steakknife/pcgeos<filename>Driver/IFS/DOS/MS7/ms7Utils.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(c) Copyright Geoworks 1996. All rights reserved.
GEOWORKS CONFIDENTIAL
PROJECT:
MODULE:
FILE: ms7Utils.asm
AUTHOR: <NAME>, Dec 17, 1996
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 12/17/96 Initial revision
DESCRIPTION:
$Id: ms7Utils.asm,v 1.1 97/04/10 11:55:41 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PathOps segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7MapComponent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Find the first file in the CWD that matches the passed name
by :
1) passedName* (Geos longname)
or
2) ??????passedName* (embedded short name)
CALLED BY: utility
PASS: ds:dx = name of file to find
cx = non-zero if component should be a directory.
CWD lock grabbed and DOS CWD set to the one that should
contain the component.
RETURN: dos7FindData.W32FD_fileName filled with the 256 character
true longname of the file matching.
the short name is found embedded in the long name...
carry set if failure
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 12/20/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7MapComponentFar proc far
call DOS7MapComponent
ret
DOS7MapComponentFar endp
DOS7MapComponent proc near
compType local word push cx
badChars local word
searchType local MSDOS7SearchType
passedName local MSDOS7LongNameType
uses bx,dx,si,di,bp, ds, es
.enter
;
; Assum no error.
;
push ax
;
; Record the start & length of the final path component mapped, for use
; by others who might be interested.
;
segmov es, ds
mov di, dx
LocalStrLength
segmov es, dgroup, ax
mov es:[dosFinalComponent].segment, ds
mov es:[dosFinalComponent].offset, dx
mov es:[dosFinalComponentLength], cx
;
; Set up some local vars.
;
mov ss:[searchType], MSD7ST_long ; long search first
mov ss:[badChars], FALSE ; no bad chars yet
;
; Copy the name before we change it. cx is the length.
;
push cx, es ; str length
mov si, dx ; ds:si <- passed name
segmov es, ss
lea di, ss:[passedName]
rep movsb
pop cx, es
;
; Prepend the * and copy the file name, then append a *.
; cx is the string length.
mov di, offset dos7LongName.MSD7GN_longName
LocalLoadChar ax, '*'
LocalPutChar esdi, ax
mov si, dx ; ds:si <- source
LocalCopyNString
; Append the '*', add a null.
LocalLoadChar ax, '*'
LocalPutChar esdi, ax
LocalClrChar es:[di]
segmov ds, es ; ds, es <- dgroup
mov dx, offset dos7LongName.MSD7GN_longName
; ds:dx <- "*passedName*"
;
; Fix up the string.
;
clr cx ; null teminated string
mov di, dx
call DOS7BadCharReplace
jnz startFind
mov ss:[badChars], TRUE
startFind:
inc dx ; ds:dx <- "passedName*"
;
; Set up for the first find; there may be more.
;
clr bx ; no search handle yet
mov ax, MSDOS7F_FIND_FIRST
findLongName:
;
; Make the call. ds:dx is the file name.
;
mov es:[dos7FindData].W32FD_fileName.MSD7GN_shortName[0], 0
mov di, offset dos7FindData ; es:di <- find data
mov cx, MSDOS7_FIND_FIRST_ATTRS ; 6!
mov si, DOS7_DATE_TIME_MS_DOS_FORMAT
call DOSUtilInt21
jc findLongCleanUp
;
; Need to check the found name against the passed name to make sure
; we have an exact match. We'll have ds:si <- name we're looking for
; es:di <- name we found. Save search handle first.
;
tst bx ; search handle?
jnz cmpLongName
mov bx, ax ; bx <- search handle
cmpLongName:
;
; If there were illegal characters in the name, we have to look
; inside the header.
;
cmp ss:[badChars], TRUE
LONG je dealWithIllegalChars
;
; Must get string length of the found name.
;
mov di, offset dos7FindData.W32FD_fileName.MSD7GN_longName
tst es:[dos7FindData].W32FD_fileName.MSD7GN_shortName[0]
jz getLongLength
clr ax ; signal NON DESTRUCTIVE
call DOS7UnPadLongName ; ax <- length
mov cx, ax
;
; Now compare that many characters.
;
doLongCmp:
mov si, dx ; ds:si <- name
call LocalCmpStringsNoCase
LONG jz success
mov ax, MSDOS7F_FIND_NEXT
jmp findLongName
getLongLength:
push di
LocalStrLength
pop di
jmp doLongCmp
findLongCleanUp:
;
; Clean up from last find first, if needed. (bx would have search han)
;
tst bx
jz prepareShortName
mov ax, MSDOS7F_FIND_CLOSE
call DOSUtilInt21
WARNING_C MSDOS7_FIND_CLOSE_FAILED
clr bx
prepareShortName:
;
; If the name is longer than a DOS name, then there's no reason
; to look for this as a short name. This also sets up cx as the
; number of chars to be space padded if it is short enough.
;
mov ax, es:[dosFinalComponentLength]
mov cx, size MSD7GN_shortName
sub cx, ax ; carry set if name too long
jc finish
;
; Pad the passed name with blanks because that's how it appears in
; the long name.
;
mov dx, offset dos7LongName.MSD7GN_longName
inc dx ; es(ds):dx <- passedname *
mov di, dx ; es:di <- passedName *
add di, ax ; es:di <- *
LocalLoadChar ax, ' '
SBCS < rep stosb >
DBCS < rep stosw >
LocalLoadChar ax, '*'
LocalPutChar esdi, ax
LocalClrChar es:[di]
;
; Make the FindFirst call.
;
dec dx ; ds:dx <- *passed name *
mov di, offset dos7FindData ; es:di <- find data
mov ax, MSDOS7F_FIND_FIRST
clr bx ; no search handle yet
mov ss:[searchType], MSD7ST_short
findShortName:
mov si, DOS7_DATE_TIME_MS_DOS_FORMAT
mov cx, MSDOS7_FIND_FIRST_ATTRS
call DOSUtilInt21
jc finish
; Keep track of the search handle.
tst bx
jnz cmpShortName
mov bx, ax
cmpShortName:
;
; We're only looking for this name as the short component, so...
;
clr ax ; don't actually null
mov di, offset dos7FindData.W32FD_fileName.MSD7GN_shortName
call DOS7UnPadShortName ; ax <- length
mov cx, ax ; cx <- max chars to check
mov si, dx ; ds:si <- *passed name
inc si ; ds:si <- passed name
call LocalCmpStringsNoCase
jz success
;
; Look for the next one,
;
mov ax, MSDOS7F_FIND_NEXT
jmp findShortName
success:
;
; If this is a directory, then we need to CD to it.
;
cmp ss:[compType], DVCT_INTERNAL_DIR
je tryDirChange
;
; Set the geos file flag if appropriate. Subdirs are geos.
;
segmov ds, es
mov di, offset dos7FindData
test es:[di].W32FD_fileAttrs.low.low, mask FA_SUBDIR
jnz setFlag
;
; Native are not.
;
push di
add di, offset W32FD_fileName.MSD7GN_signature
mov si, offset nativeSignature
mov cx, size nativeSignature
repe cmpsb
pop di
jz afterFlag
setFlag:
ornf es:[di].W32FD_fileAttrs.low.low, FA_GEOS_FILE
afterFlag:
;
; We want to set up the the dosNativeFFD.FFD_name to be the dos
; version of the file. This means either the long name or the
; short name, depending on which open succeeded.
;
mov si, offset dos7FindData
mov di, offset dosNativeFFD
call DOS7SetupDTAHack
clc ; signal peace on earth
finish:
pop ax
; FindClose if needed.
pushf
tst bx
jz done
push ax
mov ax, MSDOS7F_FIND_CLOSE
call DOSUtilInt21
WARNING_C MSDOS7_FIND_CLOSE_FAILED
pop ax
done:
popf
jnc exit
mov cx, ss:[compType]
mov ax, ERROR_FILE_NOT_FOUND ; assume s/b file
jcxz exit
mov ax, ERROR_PATH_NOT_FOUND ; s/b dir, so return
exit:
.leave
ret
tryDirChange:
;
; Change to the directory.
;
mov dx, offset dos7FindData.W32FD_fileName.MSD7GN_longName
call DOSInternalSetDir
ERROR_C MSDOS7_CANT_CHANGE_DIR_WHILE_MAPPING
jmp finish
dealWithIllegalChars:
;
; Read the name from the header.
;
push dx, ds
segmov ds, es
mov dx, di ; ds:dx <- fd
mov cx, size GFH_signature+ size GFH_longName
; copy amount
mov si, offset dos7MPHeaderScratch ; es:si <-dst
call DOSVirtOpenGeosFileForHeader
;
; Compare the two names.
;
add si, size GFH_signature ; point to name
mov di, si
mov cx, es:[dosFinalComponentLength]; number to compare
segmov ds, ss
lea si, ss:[passedName] ; es:di <- passed str
call LocalCmpStringsNoCase
pop dx, ds
LONG jz success
mov ax, MSDOS7F_FIND_NEXT
LONG jmp findLongName
DOS7MapComponent endp
; Bad characters are :
; " ' / : < > ? |
; These are replaced with ^
;
LocalDefNLString charTable <'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ !^#$%&^()*+,-.^0123456789^;^=^^@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{^}~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'>
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7BadCharReplace
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Take the string in es:di and replace any illegal DOS
chars with carrots, returning the z flag to indicate
whether or not there were any.
looks at up to (size GeosLongName + size shortName) chars,
stopping as soon as it sees a null.
CALLED BY: utility
PASS: es:di = string to check
RETURN: z flags set if string contained illegal characters.
clear if legal string (unchanged)
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 2/20/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7BadCharReplace proc far
;
; Set up ds:si = es:di for string instructions. If cx is zero then
; we'll look at up to longname+shortname # characters, or until we
; find a null.
;
push bx, cx, ds, si, di
segmov ds, es
mov si, di
push di ; save start for later
mov bx, offset charTable
tst cx
jnz charLoop
mov cx, size MSDOS7LongNameType + size MSDOS7ShortNameType
charLoop:
lodsb ; al <- next char from ds:si
tst al ; end o' string?
jz done
cs:xlatb ; al <- new char
stosb
loop charLoop
done:
;
; Now see if we replaced any characters.
;
mov cx, di ; cx <- end
pop di ; di <- start
sub cx, di ; cx <- length
mov al, '^'
repne scasb
pop bx, cx, ds, si, di
ret
DOS7BadCharReplace endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7RenameFileFromGeosHeader
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Construct a newfile name based on the changed attribute flags.
Rename the file once the name is constructed. This does
the copying from the GeosFileHeader to the long name. Like
dosEnum shme, it only copies the things that have changed.
CALLED BY: DOSVirtWriteChangedExtAttrs
PASS: es:di = GeosFileHeader to rename from
ds:dx = existing long name
si = disk handle
ax = EAMasks to tell us which ones we need to
copy.
RETURN: ds:dx = new long name
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 12/19/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7RenameFileFromGeosHeader proc far
uses ax,bx,cx,dx,si,di,bp,ds
.enter
if ERROR_CHECK
NOFXIP < Assert fptr dsdx >
NOFXIP < Assert fptr esdi >
FXIP< push bx, si >
FXIP< mov bx, ds >
FXIP< mov si, dx >
FXIP< call ECAssertValidFarPointerXIP >
FXIP< mov bx, es >
FXIP< mov si, di >
FXIP< call ECAssertValidFarPointerXIP >
FXIP< pop bx, si >
endif
;
; First copy the whole existing long name to dos7LongName, which
; is the buffer we user for building the new name.
;
push ds, dx ; save source file long name
push es, di ; save GeosFileHeader
mov cx, ds ; save source name seg
call PathOps_LoadVarSegDS
segmov es, ds
mov ds, cx
mov si, dx ; ds:si <- existing name
mov di, offset dos7LongName ; es:di <- build buffer
mov cx, size MSDOS7GeosName
rep movsb
;
; Set up for the header -> name map/copy.
;
mov di, offset dos7LongName ; es:di <- dest name
pop ds, si ; ds:si <- GeosFileHeader
;
; Look through the passed EAMasks to see what to change.
; We have :
; ax <- EAMasks telling us what to copy
; bx <- index for tables based on current attr
; cx <- size of attr to copy
; ds:si <- start of header
; es:di <- start of long file name
clr bx
attrLoop:
shr ax ; carry gets attr bit
jc copyAttr ;
tst ax ; finished?
jz rename
inc bx
inc bx ; next table offset
jmp attrLoop
copyAttr:
mov cx, cs:[attrSizeTable][bx] ; cx <- source size
; Zero size means we don't store this attr in the long name.
jcxz attrLoop
; Set up and call the attrs copy routine.
push di, si ; save offsets
add si, cs:[headerOffsetTable][bx] ; si, header offset
add di, cs:[longnameOffsetTable][bx] ; long name offset
call cs:[attrRoutineTable][bx]
pop di, si
inc bx
inc bx
jmp attrLoop
rename:
;
; Rename the bloody thing. es:di is the rename name.
;
; I don't think we need to do the notify shme here...
;
pop ds, dx ; source name
mov ax, MSDOS7F_RENAME_FILE
call DOSUtilInt21
EC < WARNING_C MSDOS7_RENAME_FROM_HEADER_FAILED >
;
; Copy the new name to the location of the old one.
;
segxchg ds, es
mov si, di
mov di, dx
mov cx, size MSDOS7GeosName
rep movsb
jmp done
stringCopy:
; Just copy cx characters as they are, then space pad the rest.
; This assumes cx is the size in bytes not characters.
push ax
push cx ; source size
mov dx, di ; save current dest offset
charLoop:
lodsb
tst al
jz spacePad
stosb
loop charLoop
spacePad:
sub di, dx
pop cx
sub cx, di
jcxz return
LocalLoadChar ax, ' '
SBCS < rep stosb >
DBCS < rep stosw >
pop ax
return:
retn
mapCopy:
; Convert to ascii and copy.
call DOS7MapBytesToAscii
retn
doNothing:
retn
done:
.leave
ret
attrRoutineTable nptr mapCopy, ; sig
stringCopy, ; longname
mapCopy, ; type
mapCopy, ; flags
mapCopy, ; release
mapCopy, ; protocol
mapCopy, ; token
mapCopy, ; creator
doNothing, ; user notes
doNothing, ; copyright
doNothing, ; no time/date
doNothing, ; password
doNothing, ; desktop
doNothing, ;
doNothing ;
headerOffsetTable word offset GFH_signature,
offset GFH_longName,
offset GFH_type,
offset GFH_flags,
offset GFH_release,
offset GFH_protocol,
offset GFH_token,
offset GFH_creator,
0,
0,
0,
0,
0,
0,
0
longnameOffsetTable word offset MSD7GN_signature,
offset MSD7GN_longName,
offset MSD7GN_type,
offset MSD7GN_flags,
offset MSD7GN_release,
offset MSD7GN_protocol,
offset MSD7GN_token,
offset MSD7GN_creator,
0,
0,
0,
0,
0,
0,
0
attrSizeTable word size GFH_signature,
size GFH_longName,
size GFH_type,
size GFH_flags,
size GFH_release,
size GFH_protocol,
size GFH_token,
size GFH_creator,
0,
0,
0,
0,
0,
0,
0
CheckHack <length attrRoutineTable eq length headerOffsetTable >
CheckHack<length headerOffsetTable eq length longnameOffsetTable>
CheckHack<length longnameOffsetTable eq length attrSizeTable>
DOS7RenameFileFromGeosHeader endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7MapAsciiToBytes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Map cx*2 ascii bytes to the passed buffer. Each ascii
byte becomes a hex nybble.
CALLED BY: utility
PASS: ds:si = source of ascii bytes
es:di = place to build result
cx = number of bytes to _produce_
RETURN: XXXX
DESTROYED: XXXX
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/10/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7MapAsciiToBytes proc far
uses ax, bx
.enter
EC < jcxz error >
NEC < jcxz done >
shl cx ; takes 2 bytes to make one
byteLoop:
;
; Load al with the next character and map it to hex.
;
mov ah, al
lodsb
EC < Assert ge al, '0' >
EC < Assert le al, 'F' >
cmp al, 'A' ; A-F?
jb subZero
sub al, 7
subZero:
sub al, '0'
dec cx ; ready to write a bytes?
test cx, 1
jnz byteLoop
shl ah
shl ah
shl ah
shl ah
or al, ah
stosb
jcxz done
jmp byteLoop
done:
.leave
ret
error:
EC < ERROR MSDOS7_CANT_MAP_ZERO_BYTES >
.unreached
DOS7MapAsciiToBytes endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7MapBytesToAscii
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Map cx bytes from ds:si to ascii double-bytes and
copy them to es:di.
CALLED BY: Utility
PASS: ds:si = source bytes
es:di = destination for mapped bytes
cx = number of bytes to map from the source
(cx*2 needed for the destination).
RETURN: si, di moved past last copied byte
DESTROYED: cx, dx
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/ 8/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7MapBytesToAscii proc near
uses ax, bx
.enter
DBCS < CheckHack 1 eq 2 >
EC < jcxz error >
NEC < jcxz done >
byteLoop:
lodsb
call DOS7MapByteToAscii
loop byteLoop
NEC < done: >
.leave
ret
error:
EC < ERROR MSDOS7_CANT_MAP_ZERO_BYTES >
.unreached
DOS7MapBytesToAscii endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7MapByteToAscii
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Maps ONE hex byte to two ascii chars, putting them in
es:di.
CALLED BY: utility
PASS: al = byte to map
es:di = result buffer
RETURN: es:di = points after result
DESTROYED: ax
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/16/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7MapByteToAscii proc near
;
; Isolate the nybbles.
;
mov ah, al ; al = ah = byte
and al, 0xf0 ; al <- low nybble
shr al
shr al
shr al
shr al
and ah, 0x0f ; ah <- high nybble shifted up
;
; Map the first one.
;
add al, '0' ; assume < 10 (ah)
cmp al, '9' ; is it a-f?
jbe writeByte1
add al, 0x7 ; bump up to a-f
writeByte1:
;
; Write the result, then setup and map the second one.
;
stosb
mov al, ah
add al, '0' ; assume < 10 (ah)
cmp al, '9' ; is it a-f?
jbe writeByte2
add al, 0x7 ; bump up to a-f
writeByte2:
stosb
ret
DOS7MapByteToAscii endp
DOS7GetGeosDOSName proc far
;
; Pass ds:si pointing to an MSDOS7GeosName. ds:si will be
; returned pointing to the short DOS name which can be one of
; two places, depending on what type of file this is.
;
tst ds:[si].MSD7GN_shortName
CheckHack <offset MSD7GN_longName eq 0>
jz done
add si, offset MSD7GN_shortName
done:
ret
DOS7GetGeosDOSName endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7SetupDTAHack
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Hack to maintain the DTA that the rest of the file system
currently depends on. In the final deal, there will be no
DTA; a W32FindEData instead.
CALLED BY:
PASS: ds:si = W32FindData
es:di = FileFindDTA
RETURN: XXXX
DESTROYED: XXXX
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/ 9/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7SetupDTAHack proc far
uses ax,bx,cx,dx,si,di,bp
.enter
if 0
push ds
call SysLockBIOS
segmov ds, es
mov dx, di
mov ah, MSDOS_SET_DTA
call DOSUtilInt21
pop ds
mov ah, MSDOS_FIND_FIRST
mov dx, offset dos7FindData.W32FD_alternateFileName
mov cx, mask FA_HIDDEN or mask FA_SYSTEM or mask FA_SUBDIR
call DOSUtilInt21
call SysUnlockBIOS
endif
; just do attrs, mod time, file size, and name. Hope those
; undocumented fields aren't used...
;name
push si, di
add si, offset W32FD_fileName
call DOS7GetGeosDOSName
add di, FFD_name
mov cx, size FFD_name-1
LocalCopyNString
mov al, 0
stosb
pop si, di
;attrs
mov al, ds:[si].W32FD_fileAttrs.low.low
mov es:[di].FFD_attributes, al
;mod time
mov ax, ds:[si].W32FD_accessed.MSD7DT_time
mov bx, ds:[si].W32FD_accessed.MSD7DT_date
mov es:[di].FFD_modTime, ax
mov es:[di].FFD_modDate, bx
; size
movdw axbx, ds:[si].W32FD_fileSizeLow
movdw es:[di].FFD_fileSize, axbx
.leave
ret
DOS7SetupDTAHack endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7GenerateGeosLongName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a complex long name, consisting of the long name
in dos7LongName, the short name we generate here,
the passed file type, the known signature, and
the known GeodeAttrs (0) for data, which we assume.
CALLED BY: utility
PASS: ds:dx = geos long name
es = dgroup
ax = GeosFileType
ch = FileCreateFlags
RETURN: dos7LongName filled with the created long name.
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 12/23/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
geosSignature char MSDOS7_GEOS_SIGNATURE_ASCII
DOS7GenerateGeosLongName proc near
.enter
;
; Copy the long name and space pad the rest.
;
push ax ; save file type
call DOS7GenerateLongNameCommon
;
; See if we have some mutant native file with ext attrs to deal with.
;
test ch, mask FCF_NATIVE_WITH_EXT_ATTRS
LONG jnz handleNativeWithExtAttrs
;
; Generate the virtual native name. Space pad it.
;
segxchg es, ds ; ds <- dgroup
mov di, dx ; es:di <- long name
LocalStrLength ; cx <- length
mov ds:[dosFinalComponent].high, es
mov ds:[dosFinalComponent].low, dx
mov ds:[dosFinalComponentLength], cx
call DOSVirtGenerateDosName ; ds:dx <- dos7LongName
segmov es, ds
mov di, dx ; es:di <- long name
add di, offset MSD7GN_shortName
common:
LocalStrLength ; cx <-length
dec di ; point to null
mov ax, cx
mov cx, size MSD7GN_shortName
EC < Assert ae cx, ax >
sub cx, ax
DBCS < shr cx >
LocalLoadChar ax, ' '
SBCS < rep stosb >
DBCS < rep stosw >
;
; Convert the file type to ascii and store it at the proper offset.
;
pop ax ; ax <- file type
mov ch, ah
mov di, offset dos7LongName.MSD7GN_type
call DOS7MapByteToAscii
mov al, ch
call DOS7MapByteToAscii
;
; Copy the signature in there, too. Since we're creating the
; file, we use the defined ascii rep of the signature.
;
segmov ds, cs
mov si, offset geosSignature
mov cx, size geosSignature
mov di, offset dos7LongName.MSD7GN_signature
rep movsb
;
; Set the GeodeAttrs to be 0, which means '0000' in ascii land.
;
mov di, offset dos7LongName.MSD7GN_geodeAttrs
mov ax, '00'
stosw
stosw
segmov ds, es
;
; Set the Token and Creator fields to be 0/geoworks.
;
mov di, offset dos7LongName.MSD7GN_token
mov ax, '00'
mov cx, 4
rep stosw
mov di, offset dos7LongName.MSD7GN_creator
mov cx, 4
rep stosw
;
; Is that it?
;
; ...
.leave
ret
handleNativeWithExtAttrs:
push ds
segmov ds, es
mov si, offset dos7LongName
mov di, offset dos7LongName.MSD7GN_shortName
mov cx, size MSD7GN_shortName
rep movsb
mov {byte} es:[di], 0
pop ds
mov di, offset dos7LongName.MSD7GN_shortName
jmp common
DOS7GenerateGeosLongName endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7GenerateNativeLongName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Generate a long name suitable for native naming.
CALLED BY:
PASS: ds:dx = long name
es = dgroup
RETURN: XXXX
DESTROYED: XXXX
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/15/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7GenerateNativeLongName proc near
.enter
push es
segmov es, ds
mov di, dx
LocalStrLength
EC < Assert le, cx, DOS_DOT_FILE_NAME_LENGTH >
pop es
;
; Copy the long name, space pad, and nullify.
;
call DOS7GenerateLongNameCommon
;
; Copy the passed name to the short name too.
;
mov si, dx ; ds:si <- source
mov di, offset dos7LongName.MSD7GN_shortName
rep movsb
;
; And put the ol' native signature in there.
;
push ds
segmov ds, es
mov si, offset nativeSignature
mov di, offset dos7LongName.MSD7GN_signature
mov cx, size nativeSignature
rep movsb
mov al, 0 ; null term after signature.
stosb
pop ds
.leave
ret
DOS7GenerateNativeLongName endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7GenerateLongNameCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Creates the part of the complex long name that is
common to geos and native files, that is :
- space pad the whole thing
- copy the passed geos long name
- put the null in the right place.
Create the thing in dos7LongName in dgroup
CALLED BY: utility
PASS: ds:dx = geos long name
es = dgroup
RETURN: es:di = dos7LongName
DESTROYED: ax, di
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/15/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7GenerateLongNameCommon proc near
uses cx, dx
.enter
;
; Space pad the short name. Then write '0's into the rest.
; (DOS7CopyLongName will space pad the geos longname) Nullit.
;
mov di, offset dos7LongName.MSD7GN_shortName
; es:di <- dest
mov al, ' '
mov cx, size MSD7GN_shortName
rep stosb
mov al, '0'
mov cx, (offset MSD7GN_null) - (offset MSD7GN_signature)
rep stosb
mov es:[dos7LongName].MSD7GN_null, 0
;
; Copy the long name.
;
mov di, offset dos7LongName.MSD7GN_longName
; es:di <- dest
mov si, dx ; ds:si <- source
mov cx, -1 ; signal space pad
call DOS7CopyLongName ; destroys ax
call DOS7BadCharReplace
.leave
ret
DOS7GenerateLongNameCommon endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7RenameGeosFileHeader
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Update the long name stored inside the geos file header.
This does NOT update other attributes stored in the header,
assuming these are current.
CALLED BY: Utility
PASS: es = dgroup
ds:si = pointing to the file to rename. No need to do a
find first, as the long name is in complete form.
Since the geos long name may have illegal charcters in it,
we copy the name from dosFinalComponent to the GeosFileHeader.
(si = disk handle? for directories??????)
RETURN: carry set if failure
clear for succes
DESTROYED: the file name is hosed.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/ 3/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7RenameGeosFileHeader proc far
uses ax,bx,cx,dx,si,di,bp, es
.enter
;
; Allocate a slot in the JFT for us to use.
;
mov bx, NIL
call DOSAllocDosHandleFar
;
; DEAL WITH SUBDIR HERE????
;
;
; Open the file.
;
mov bx, FA_WRITE_ONLY ; bl <- access flags
clr cx ; attributes
clr di ; no alias hint
mov dx, MSDOS7COOA_OPEN ; there's gotta be a better...
mov ax, MSDOS7F_CREATE_OR_OPEN
call DOSUtilInt21 ; ax <- handle
jc errorOpen
;
; Position the file pointer.
;
mov_tr bx, ax ; bx <- file handle
mov dx, offset GFH_longName
clr cx
mov ax, (MSDOS_POS_FILE shl 8) or FILE_POS_START
call DOSUtilInt21
;
; Write out the whole long name.
;
les di, es:[dosFinalComponent]
; ds:di <- source string
push di
LocalStrLength ax ; cx <- length w/o null
pop dx
segmov ds, es
DBCS < shl cx, 1 ; cx <- # of bytes >
mov ah, MSDOS_WRITE_FILE
call DOSUtilInt21
;
; Close the file again, being careful to save any error flag & code
; from the write.
;
pushf
push ax
mov ah, MSDOS_CLOSE_FILE
call DOSUtilInt21
pop ax
popf
errorOpen:
mov bx, NIL ; release the JFT slot (already nilled
; out by DOS itself during the close)
call DOSFreeDosHandleFar
.leave
ret
DOS7RenameGeosFileHeader endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7CopyLongName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copies the long name in ds:si to ed:di, space padding as
desired.
CALLED BY: utility
PASS: ds:si = source ptr
es:di = dest ptr
cx = 0 to null term, non-zero to space pad
RETURN: ptrs unchanged
DESTROYED: ax, cx
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/ 3/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7CopyLongName proc near
uses dx, di, si
.enter
;
; Copy the null terminated string no matter what.
;
mov dx, di ; dx <- start
LocalCopyString
;
; Now space pad if desired.
;
jcxz done
;
; Space pad
;
LocalPrevChar esdi ; pre-null
push di ; save end ptr
sub di, dx ; di <- length of name copied
DBCS < shr di >
mov cx, size MSD7GN_longName
DBCS < shr cx >
sub cx, di ; cx <- num blanks to pad
pop di ; end ptr
LocalLoadChar ax, ' '
SBCS < rep stosb >
DBCS < rep stosw >
done:
.leave
ret
DOS7CopyLongName endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7UnPadLong/ShortName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: slap a null down at the end of the geos long name
!! destructive !!
CALLED BY: utility
PASS: es:di = ptr to long name buffer to null term
ax = non zero to pad the thing (DESTRUCTIVE)
ax = 0 to just get the length, but not add the null
RETURN: buffer nulled after long name
or
ax = length of unpadded string
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/ 3/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7UnPadLongName proc far
uses cx, di, si
.enter
;
; Get to the end of the string.
;
mov si, di ; si, <- start, too
add di, size MSD7GN_longName ; es:di <- end
LocalPrevChar esdi ; point at last char
mov cx, size MSD7GN_longName
call DOS7UnPadName
.leave
ret
DOS7UnPadLongName endp
DOS7UnPadShortName proc far
uses cx, di, si
.enter
;
; Get to the end of the string.
;
mov si, di ; si <- start
add di, size MSD7GN_shortName
LocalPrevChar esdi ; point at last char
mov cx, size MSD7GN_shortName
call DOS7UnPadName
.leave
ret
DOS7UnPadShortName endp
DOS7UnPadName proc near
;
; Null terminates the blank-padded string which ends at es:di.
;
; Pass :
; es:di pointing to end of the string
; es:si pointing to the start of the string
; cx size of the string
; Destroyed :
; di, si
;
; Reverse the direction and find the first non-blank.
;
push ax
INT_OFF
std
LocalLoadChar ax, ' '
DBCS < repe scasw >
SBCS < repe scasb >
DBCS < add di, 4 >
SBCS < inc di >
SBCS < inc di >
sub di, si
DBCS < shr di >
;
; Redirect things and null terminate.
;
cld
INT_ON
;
; Add the null.
;
pop ax
tst ax
jz returnLength
add si, di
LocalClrChar es:[si]
done:
ret
returnLength:
mov ax, di
jmp done
DOS7UnPadName endp
if _SFN_CACHE
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7CachePathForSFN
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Cache the CWD for the passed SFN.
CALLED BY: utility
PASS: bx = SFN for the file
ds = dgroup
RETURN: nothing
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/21/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7CachePathForSFN proc far
uses ax,bx,cx,dx,si,di, es
.enter
;
; Grab the cache block handle.
;
segmov es, ds ; es <- dgroup
mov dx, bx ; dx <- SFN
mov bx, ds:[dos7PathCache]
EC < call ECCheckMemHandle >
call MemLock
mov ds, ax
mov si, offset D7PCH_table ; es:si <- table
shl dx ; words
shl dx
add si, dx ; offset
EC < Assert e ds:[si].OFP_pathString[0], 0 >
;
; Get the CWD.
;
clr dl ; current drive
mov ax, MSDOS7F_GET_CURRENT_DIR
mov di, offset dosPathBuffer ; es:di <- path space
segxchg ds, es
xchg si, di
call DOSUtilInt21
;
; Get the length of the path string and allocate the chunk.
;
segxchg ds, es
xchg si, di
call LocalStringSize ; cx <- size
inc cx ; null !
DBCS < inc cx >
clr al
call LMemAlloc
EC < ERROR_C MSDOS7_CANT_ALLOC_OPEN_FILE_CACHE_SPACE >
;
; Store the chunk handle and copy the path string into the chunk
;
mov ds:[si].OFP_pathString, ax
mov bx, ax ; bx <- chunk handle
mov si, ds:[bx] ; ds:si <- destination
segxchg ds, es
xchg si, di ; all set up
shr cx ; copy words, please
rep movsw
jnc finish
movsb
finish:
;
; Unlock the path cache block.
;
mov bx, ds:[dos7PathCache]
EC < call ECCheckMemHandle >
call MemUnlock
.leave
ret
DOS7CachePathForSFN endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7ClearCacheForSFN
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Clear the cached path info for the passed SFN
CALLED BY: Utility
PASS: bx = SFN for the file
ds = dgroup
RETURN: XXXX
DESTROYED: XXXX
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/21/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7ClearCacheForSFN proc far
uses ax,bx,cx,dx,si,di,bp
.enter
;
; Lock the cache block.
;
push ds ; save dgroup
mov dx, bx ; dx <-SFN
mov bx, ds:[dos7PathCache]
EC < call ECCheckMemHandle >
call MemLock
;
; Point to the proper table entry.
;
mov ds, ax
mov si, offset D7PCH_table
shl dx
shl dx
add si, dx ; ds:si <- entry
;
; Free the chunk
;
clr ax
xchg ax, ds:[si].OFP_pathString
tst ax
jz done
call LMemFree
;
; Unlock the path cache.
;
done:
pop ds
mov bx, ds:[dos7PathCache]
call MemUnlock
.leave
ret
DOS7ClearCacheForSFN endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7GetPathForSFN
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the path associated with the passed SFN, checking to
see if the cached path is the same as DOS's current path.
CALLED BY: utility
PASS: bx = SFN
ds = dgroup
es:di = place to copy the path if different
better be MSDOS7_MAX_PATH_SIZE large
RETURN: es:di = filled
DESTROYED: ?
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 1/22/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7GetPathForSFN proc far
uses bx,cx,si,di
.enter
;
; Point to the proper entry.
;
push ds ; save dgroup
mov dx, bx ; dx <- SFN
mov bx, ds:[dos7PathCache]
EC < call ECCheckMemHandle >
call MemLock
mov ds,ax
mov si, offset D7PCH_table ; ds:si <- table
;
; Access the correct entry.
;
shl dx
shl dx ; 4 words per entry
add si, dx ; ds:si <- entry
mov bx, ds:[si].OFP_pathString ; bx <- chunk handle
EC < tst bx >
EC < ERROR_Z MSDOS7_MISSING_PATH_CACHE_CHUNK_HANDLE >
;
; Copy the string to the buffer
;
mov si, ds:[bx] ; ds:si <- path string
LocalCopyString
;
; Clean and go.
;
pop ds ; dgroup
mov bx, ds:[dos7PathCache] ; bx <- path cach handle
EC < call ECCheckMemHandle >
call MemUnlock
.leave
ret
DOS7GetPathForSFN endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOS7GetIDFromFD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the 32 bit id associated with the file found in the
passed Win32FindData structure. The id is based on the
current path and the embedded dos name (shortName) for the
file.
CALLED BY: Utility
PASS: ds:si = Win32FindData structure
dx = 0 if want to use CWD
else
cxdx = base ID from which to work from
RETURN: cxdx = 32 bit Id
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimw 2/ 3/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOS7GetIDFromFD proc far
scratch local (FILE_LONGNAME_LENGTH+2) dup(char)
scratchLength local word
uses ax, ds, es, si, di
.enter
;
; Copy the short name locally, so we can null terminate it, unless
; it's a directory, in which case we use the geos long name.
; Assume we'll use the short name (ie, it's a file, not a dir)
;
push cx, dx
mov cx, DOS_DOT_FILE_NAME_LENGTH
mov di, offset W32FD_fileName.MSD7GN_shortName
test ds:[si].W32FD_fileAttrs.low.low, mask FA_SUBDIR
jz copyName
; Wrong. Set up for short name. (file)
mov cx, FILE_LONGNAME_LENGTH
mov di, offset W32FD_fileName.MSD7GN_longName
copyName:
mov ss:[scratchLength], cx
add si, di ; ds:si <- pts to name to use
segmov es, ss
lea di, ss:[scratch] ; es:di <- dest buff
;
; Space pad whole the scratch space, and copy.
;
push di
mov al, ' '
rep stosb
pop di
mov cx, ss:[scratchLength]
mov ax, di
rep movsb
;
; We have es:di pointing to the end of the short name area, and
; es:si pointing to the start. Need cx size of field, and we're ready.
;
mov di, ax
add di, ss:[scratchLength]
dec di
mov si, ax
mov cx, ss:[scratchLength]
call DOS7UnPadName
;
; Get the ID for the current path.
;
pop cx, dx
tst dx
jnz calcID
call DOSFileChangeGetCurPathID ; cxdx <- path ID
;
; Use that for the base for generating the file's ID.
;
calcID:
segmov ds, ss
lea si, ss:[scratch]
call DOSFileChangeCalculateIDLow
.leave
ret
DOS7GetIDFromFD endp
endif
PathOps ends
|
programs/oeis/329/A329547.asm | karttu/loda | 0 | 165443 | ; A329547: Number of natural numbers k <= n such that k^k is a square.
; 1,2,2,3,3,4,4,5,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,28,29,29,30,30,31,31,32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,40,40,41,41,42,42,43,43,44,45,46,46,47,47,48,48,49,49,50,50,51,51,52,52,53,53,54,54,55,55,56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,63,64,64,65,66,67,67,68,68,69,69,70,70,71,71,72,72,73,73,74,74,75,75,76,76,77,77,78,78,79,79,80,80,81,81,82,82,83,83,84,84,85,85,86,86,87,87,88,88,89,89,90,91,92,92,93,93,94,94,95,95,96,96,97,97,98,98,99,99,100,100,101,101,102,102,103,103,104,104,105,105,106,106,107,107,108,108,109,109,110,110,111,111,112,112,113,113,114,114,115,115,116,116,117,117,118,118,119,120,121,121,122,122,123,123,124,124,125,125,126,126,127,127,128,128,129,129,130,130,131,131,132,132,133
mov $16,$0
mov $18,$0
add $18,1
lpb $18,1
clr $0,16
mov $0,$16
sub $18,1
sub $0,$18
mov $6,$0
mov $7,$0
lpb $6,7
lpb $0,1
div $0,2
mov $5,$3
mov $6,$3
lpe
mov $0,4
trn $6,$7
sub $7,$3
mov $3,8
add $3,$5
lpe
mov $2,2
trn $7,1
gcd $2,$7
mov $1,$2
sub $1,1
add $17,$1
lpe
mov $1,$17
|
src/Projects/Backup/eu_projects-event_names.adb | fintatarta/eugen | 0 | 26811 | <reponame>fintatarta/eugen<gh_stars>0
with EU_Projects.Identifiers;
package body EU_Projects.Event_Names is
use Identifiers;
function Event_Label (E : Event_Class)
return String
is
begin
case E is
when Start_Time =>
return "start";
when End_Time =>
return "end";
when Duration_Time =>
return "duration";
end case;
end Event_Label;
-------------------
-- Milestone_Var --
-------------------
function Milestone_Var
(Label : Identifiers.Identifier)
return String
is
begin
return Image (Identifier (Label));
end Milestone_Var;
---------------------
-- Deliverable_Var --
---------------------
function Deliverable_Var
(Parent_WP : WPs.WP_Label;
Label : Identifiers.Identifier)
return String
is
begin
return Image (Identifier (Parent_WP))
& "." & Image (Identifier (Label));
end Deliverable_Var;
--------------
-- Task_Var --
--------------
function Task_Var
(Parent_WP : WPs.WP_Label;
Label : Identifiers.Identifier;
Event : Event_Class)
return String
is
begin
return Image (Identifier (Parent_WP))
& "." & Image (Identifier (Label))
& "." & Event_Label (Event);
end Task_Var;
function WP_Var
(Label : WPs.WP_Label;
Event : Event_Class)
return String
is
begin
return Image (Identifier (Label)) & "." & Event_Label (Event);
end WP_Var;
end EU_Projects.Event_Names;
|
Maps/SPACE_02.asm | adkennan/BurgerMayhem | 0 | 171062 | BYTE TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, $FF
MAP_SPACE_02
BYTE TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_WALL_0, TILE_WALL_0, TILE_WALL_2, TILE_WALL_0, TILE_WALL_0, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, $FF
BYTE TILE_VOID, TILE_VOID, TILE_VOID, TILE_WALL_1, TILE_MEAT, TILE_TOMATO, TILE_PLATE, TILE_LETTUCE, TILE_BUN, TILE_WALL_1, TILE_VOID, TILE_VOID, TILE_VOID, $FF
BYTE TILE_VOID, TILE_VOID, TILE_WALL_2, TILE_FLOOR_2, TILE_FLOOR_3, TILE_FLOOR_2, TILE_FLOOR_3, TILE_FLOOR_2, TILE_FLOOR_3, TILE_FLOOR_2, TILE_WALL_2, TILE_VOID, TILE_VOID, $FF
BYTE TILE_VOID, TILE_VOID, TILE_WALL_1, TILE_FLOOR_3, TILE_FLOOR_2, TILE_FLOOR_3, TILE_FLOOR_2, TILE_FLOOR_3, TILE_FLOOR_2, TILE_FLOOR_3, TILE_WALL_1, TILE_VOID, TILE_VOID, $FF
BYTE TILE_VOID, TILE_VOID, TILE_VOID, TILE_WALL_0, TILE_WALL_0, TILE_BLOCKER_1, TILE_BLOCKER_0, TILE_BLOCKER_1, TILE_WALL_0, TILE_WALL_0, TILE_VOID, TILE_VOID, TILE_VOID, $FF
BYTE TILE_VOID, TILE_VOID, TILE_WALL_1, TILE_FLOOR_0, TILE_FLOOR_1, TILE_FLOOR_0, TILE_FLOOR_1, TILE_FLOOR_0, TILE_FLOOR_1, TILE_FLOOR_0, TILE_WALL_1, TILE_VOID, TILE_VOID, $FF
BYTE TILE_VOID, TILE_VOID, TILE_WALL_1, TILE_FLOOR_1, TILE_FLOOR_0, TILE_FLOOR_1, TILE_FLOOR_0, TILE_FLOOR_1, TILE_FLOOR_0, TILE_FLOOR_1, TILE_WALL_1, TILE_VOID, TILE_VOID, $FF
BYTE TILE_VOID, TILE_WALL_1, TILE_VOID, TILE_WALL_0, TILE_STOVE, TILE_BENCH, TILE_SERVE, TILE_BENCH, TILE_CHOP, TILE_WALL_0, TILE_VOID, TILE_WALL_1, TILE_VOID, $FF
BYTE TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, TILE_VOID, $FF
|
alloy4fun_models/trashltl/models/4/PiScAnPFphogrC5Rt.als | Kaixi26/org.alloytools.alloy | 0 | 2835 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idPiScAnPFphogrC5Rt_prop5 {
always (all f:File | eventually no f&File)
}
pred __repair { idPiScAnPFphogrC5Rt_prop5 }
check __repair { idPiScAnPFphogrC5Rt_prop5 <=> prop5o } |
xv6/ls.asm | suriya-1403/suriya-s-XV6 | 2 | 247301 | <reponame>suriya-1403/suriya-s-XV6
_ls: file format elf32-i386
Disassembly of section .text:
00000000 <fmtname>:
#include "user.h"
#include "fs.h"
char*
fmtname(char *path)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 83 ec 14 sub $0x14,%esp
static char buf[DIRSIZ+1];
char *p;
// Find first character after last slash.
for(p=path+strlen(path); p >= path && *p != '/'; p--)
7: 83 ec 0c sub $0xc,%esp
a: ff 75 08 push 0x8(%ebp)
d: e8 c5 03 00 00 call 3d7 <strlen>
12: 83 c4 10 add $0x10,%esp
15: 8b 55 08 mov 0x8(%ebp),%edx
18: 01 d0 add %edx,%eax
1a: 89 45 f4 mov %eax,-0xc(%ebp)
1d: eb 04 jmp 23 <fmtname+0x23>
1f: 83 6d f4 01 subl $0x1,-0xc(%ebp)
23: 8b 45 f4 mov -0xc(%ebp),%eax
26: 3b 45 08 cmp 0x8(%ebp),%eax
29: 72 0a jb 35 <fmtname+0x35>
2b: 8b 45 f4 mov -0xc(%ebp),%eax
2e: 0f b6 00 movzbl (%eax),%eax
31: 3c 2f cmp $0x2f,%al
33: 75 ea jne 1f <fmtname+0x1f>
;
p++;
35: 83 45 f4 01 addl $0x1,-0xc(%ebp)
// Return blank-padded name.
if(strlen(p) >= DIRSIZ)
39: 83 ec 0c sub $0xc,%esp
3c: ff 75 f4 push -0xc(%ebp)
3f: e8 93 03 00 00 call 3d7 <strlen>
44: 83 c4 10 add $0x10,%esp
47: 83 f8 0d cmp $0xd,%eax
4a: 76 05 jbe 51 <fmtname+0x51>
return p;
4c: 8b 45 f4 mov -0xc(%ebp),%eax
4f: eb 60 jmp b1 <fmtname+0xb1>
memmove(buf, p, strlen(p));
51: 83 ec 0c sub $0xc,%esp
54: ff 75 f4 push -0xc(%ebp)
57: e8 7b 03 00 00 call 3d7 <strlen>
5c: 83 c4 10 add $0x10,%esp
5f: 83 ec 04 sub $0x4,%esp
62: 50 push %eax
63: ff 75 f4 push -0xc(%ebp)
66: 68 8c 0b 00 00 push $0xb8c
6b: e8 e4 04 00 00 call 554 <memmove>
70: 83 c4 10 add $0x10,%esp
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
73: 83 ec 0c sub $0xc,%esp
76: ff 75 f4 push -0xc(%ebp)
79: e8 59 03 00 00 call 3d7 <strlen>
7e: 83 c4 10 add $0x10,%esp
81: ba 0e 00 00 00 mov $0xe,%edx
86: 89 d3 mov %edx,%ebx
88: 29 c3 sub %eax,%ebx
8a: 83 ec 0c sub $0xc,%esp
8d: ff 75 f4 push -0xc(%ebp)
90: e8 42 03 00 00 call 3d7 <strlen>
95: 83 c4 10 add $0x10,%esp
98: 05 8c 0b 00 00 add $0xb8c,%eax
9d: 83 ec 04 sub $0x4,%esp
a0: 53 push %ebx
a1: 6a 20 push $0x20
a3: 50 push %eax
a4: e8 55 03 00 00 call 3fe <memset>
a9: 83 c4 10 add $0x10,%esp
return buf;
ac: b8 8c 0b 00 00 mov $0xb8c,%eax
}
b1: 8b 5d fc mov -0x4(%ebp),%ebx
b4: c9 leave
b5: c3 ret
000000b6 <ls>:
void
ls(char *path)
{
b6: 55 push %ebp
b7: 89 e5 mov %esp,%ebp
b9: 57 push %edi
ba: 56 push %esi
bb: 53 push %ebx
bc: 81 ec 3c 02 00 00 sub $0x23c,%esp
// char buffer[100];
int fd;
struct dirent de;
struct stat st;
if((fd = open(path, 0)) < 0){
c2: 83 ec 08 sub $0x8,%esp
c5: 6a 00 push $0x0
c7: ff 75 08 push 0x8(%ebp)
ca: e8 3a 05 00 00 call 609 <open>
cf: 83 c4 10 add $0x10,%esp
d2: 89 45 e4 mov %eax,-0x1c(%ebp)
d5: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
d9: 79 1a jns f5 <ls+0x3f>
printf(2, "ls: cannot open %s\n", path);
db: 83 ec 04 sub $0x4,%esp
de: ff 75 08 push 0x8(%ebp)
e1: 68 24 0b 00 00 push $0xb24
e6: 6a 02 push $0x2
e8: e8 80 06 00 00 call 76d <printf>
ed: 83 c4 10 add $0x10,%esp
return;
f0: e9 e1 01 00 00 jmp 2d6 <ls+0x220>
}
if(fstat(fd, &st) < 0){
f5: 83 ec 08 sub $0x8,%esp
f8: 8d 85 bc fd ff ff lea -0x244(%ebp),%eax
fe: 50 push %eax
ff: ff 75 e4 push -0x1c(%ebp)
102: e8 1a 05 00 00 call 621 <fstat>
107: 83 c4 10 add $0x10,%esp
10a: 85 c0 test %eax,%eax
10c: 79 28 jns 136 <ls+0x80>
printf(2, "ls: cannot stat %s\n", path);
10e: 83 ec 04 sub $0x4,%esp
111: ff 75 08 push 0x8(%ebp)
114: 68 38 0b 00 00 push $0xb38
119: 6a 02 push $0x2
11b: e8 4d 06 00 00 call 76d <printf>
120: 83 c4 10 add $0x10,%esp
close(fd);
123: 83 ec 0c sub $0xc,%esp
126: ff 75 e4 push -0x1c(%ebp)
129: e8 c3 04 00 00 call 5f1 <close>
12e: 83 c4 10 add $0x10,%esp
return;
131: e9 a0 01 00 00 jmp 2d6 <ls+0x220>
}
switch(st.type){
136: 0f b7 85 bc fd ff ff movzwl -0x244(%ebp),%eax
13d: 98 cwtl
13e: 83 f8 01 cmp $0x1,%eax
141: 74 48 je 18b <ls+0xd5>
143: 83 f8 02 cmp $0x2,%eax
146: 0f 85 7c 01 00 00 jne 2c8 <ls+0x212>
case T_FILE:
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
14c: 8b bd cc fd ff ff mov -0x234(%ebp),%edi
152: 8b b5 c4 fd ff ff mov -0x23c(%ebp),%esi
158: 0f b7 85 bc fd ff ff movzwl -0x244(%ebp),%eax
15f: 0f bf d8 movswl %ax,%ebx
162: 83 ec 0c sub $0xc,%esp
165: ff 75 08 push 0x8(%ebp)
168: e8 93 fe ff ff call 0 <fmtname>
16d: 83 c4 10 add $0x10,%esp
170: 83 ec 08 sub $0x8,%esp
173: 57 push %edi
174: 56 push %esi
175: 53 push %ebx
176: 50 push %eax
177: 68 4c 0b 00 00 push $0xb4c
17c: 6a 01 push $0x1
17e: e8 ea 05 00 00 call 76d <printf>
183: 83 c4 20 add $0x20,%esp
break;
186: e9 3d 01 00 00 jmp 2c8 <ls+0x212>
// }
// goto symdir;
case T_DIR:
// symdir:
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
18b: 83 ec 0c sub $0xc,%esp
18e: ff 75 08 push 0x8(%ebp)
191: e8 41 02 00 00 call 3d7 <strlen>
196: 83 c4 10 add $0x10,%esp
199: 83 c0 10 add $0x10,%eax
19c: 3d 00 02 00 00 cmp $0x200,%eax
1a1: 76 17 jbe 1ba <ls+0x104>
printf(1, "ls: path too long\n");
1a3: 83 ec 08 sub $0x8,%esp
1a6: 68 59 0b 00 00 push $0xb59
1ab: 6a 01 push $0x1
1ad: e8 bb 05 00 00 call 76d <printf>
1b2: 83 c4 10 add $0x10,%esp
break;
1b5: e9 0e 01 00 00 jmp 2c8 <ls+0x212>
}
strcpy(buf, path);
1ba: 83 ec 08 sub $0x8,%esp
1bd: ff 75 08 push 0x8(%ebp)
1c0: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax
1c6: 50 push %eax
1c7: e8 9c 01 00 00 call 368 <strcpy>
1cc: 83 c4 10 add $0x10,%esp
p = buf+strlen(buf);
1cf: 83 ec 0c sub $0xc,%esp
1d2: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax
1d8: 50 push %eax
1d9: e8 f9 01 00 00 call 3d7 <strlen>
1de: 83 c4 10 add $0x10,%esp
1e1: 8d 95 e0 fd ff ff lea -0x220(%ebp),%edx
1e7: 01 d0 add %edx,%eax
1e9: 89 45 e0 mov %eax,-0x20(%ebp)
*p++ = '/';
1ec: 8b 45 e0 mov -0x20(%ebp),%eax
1ef: 8d 50 01 lea 0x1(%eax),%edx
1f2: 89 55 e0 mov %edx,-0x20(%ebp)
1f5: c6 00 2f movb $0x2f,(%eax)
while(read(fd, &de, sizeof(de)) == sizeof(de)){
1f8: e9 aa 00 00 00 jmp 2a7 <ls+0x1f1>
if(de.inum == 0)
1fd: 0f b7 85 d0 fd ff ff movzwl -0x230(%ebp),%eax
204: 66 85 c0 test %ax,%ax
207: 75 05 jne 20e <ls+0x158>
continue;
209: e9 99 00 00 00 jmp 2a7 <ls+0x1f1>
memmove(p, de.name, DIRSIZ);
20e: 83 ec 04 sub $0x4,%esp
211: 6a 0e push $0xe
213: 8d 85 d0 fd ff ff lea -0x230(%ebp),%eax
219: 83 c0 02 add $0x2,%eax
21c: 50 push %eax
21d: ff 75 e0 push -0x20(%ebp)
220: e8 2f 03 00 00 call 554 <memmove>
225: 83 c4 10 add $0x10,%esp
p[DIRSIZ] = 0;
228: 8b 45 e0 mov -0x20(%ebp),%eax
22b: 83 c0 0e add $0xe,%eax
22e: c6 00 00 movb $0x0,(%eax)
if(stat(buf, &st) < 0){
231: 83 ec 08 sub $0x8,%esp
234: 8d 85 bc fd ff ff lea -0x244(%ebp),%eax
23a: 50 push %eax
23b: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax
241: 50 push %eax
242: e8 73 02 00 00 call 4ba <stat>
247: 83 c4 10 add $0x10,%esp
24a: 85 c0 test %eax,%eax
24c: 79 1b jns 269 <ls+0x1b3>
printf(1, "ls: cannot stat %s\n", buf);
24e: 83 ec 04 sub $0x4,%esp
251: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax
257: 50 push %eax
258: 68 38 0b 00 00 push $0xb38
25d: 6a 01 push $0x1
25f: e8 09 05 00 00 call 76d <printf>
264: 83 c4 10 add $0x10,%esp
continue;
267: eb 3e jmp 2a7 <ls+0x1f1>
}
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
269: 8b bd cc fd ff ff mov -0x234(%ebp),%edi
26f: 8b b5 c4 fd ff ff mov -0x23c(%ebp),%esi
275: 0f b7 85 bc fd ff ff movzwl -0x244(%ebp),%eax
27c: 0f bf d8 movswl %ax,%ebx
27f: 83 ec 0c sub $0xc,%esp
282: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax
288: 50 push %eax
289: e8 72 fd ff ff call 0 <fmtname>
28e: 83 c4 10 add $0x10,%esp
291: 83 ec 08 sub $0x8,%esp
294: 57 push %edi
295: 56 push %esi
296: 53 push %ebx
297: 50 push %eax
298: 68 4c 0b 00 00 push $0xb4c
29d: 6a 01 push $0x1
29f: e8 c9 04 00 00 call 76d <printf>
2a4: 83 c4 20 add $0x20,%esp
while(read(fd, &de, sizeof(de)) == sizeof(de)){
2a7: 83 ec 04 sub $0x4,%esp
2aa: 6a 10 push $0x10
2ac: 8d 85 d0 fd ff ff lea -0x230(%ebp),%eax
2b2: 50 push %eax
2b3: ff 75 e4 push -0x1c(%ebp)
2b6: e8 26 03 00 00 call 5e1 <read>
2bb: 83 c4 10 add $0x10,%esp
2be: 83 f8 10 cmp $0x10,%eax
2c1: 0f 84 36 ff ff ff je 1fd <ls+0x147>
}
break;
2c7: 90 nop
}
close(fd);
2c8: 83 ec 0c sub $0xc,%esp
2cb: ff 75 e4 push -0x1c(%ebp)
2ce: e8 1e 03 00 00 call 5f1 <close>
2d3: 83 c4 10 add $0x10,%esp
}
2d6: 8d 65 f4 lea -0xc(%ebp),%esp
2d9: 5b pop %ebx
2da: 5e pop %esi
2db: 5f pop %edi
2dc: 5d pop %ebp
2dd: c3 ret
000002de <main>:
int
main(int argc, char *argv[])
{
2de: 8d 4c 24 04 lea 0x4(%esp),%ecx
2e2: 83 e4 f0 and $0xfffffff0,%esp
2e5: ff 71 fc push -0x4(%ecx)
2e8: 55 push %ebp
2e9: 89 e5 mov %esp,%ebp
2eb: 53 push %ebx
2ec: 51 push %ecx
2ed: 83 ec 10 sub $0x10,%esp
2f0: 89 cb mov %ecx,%ebx
int i;
if(argc < 2){
2f2: 83 3b 01 cmpl $0x1,(%ebx)
2f5: 7f 15 jg 30c <main+0x2e>
ls(".");
2f7: 83 ec 0c sub $0xc,%esp
2fa: 68 6c 0b 00 00 push $0xb6c
2ff: e8 b2 fd ff ff call b6 <ls>
304: 83 c4 10 add $0x10,%esp
exit();
307: e8 bd 02 00 00 call 5c9 <exit>
}
for(i=1; i<argc; i++)
30c: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
313: eb 21 jmp 336 <main+0x58>
ls(argv[i]);
315: 8b 45 f4 mov -0xc(%ebp),%eax
318: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
31f: 8b 43 04 mov 0x4(%ebx),%eax
322: 01 d0 add %edx,%eax
324: 8b 00 mov (%eax),%eax
326: 83 ec 0c sub $0xc,%esp
329: 50 push %eax
32a: e8 87 fd ff ff call b6 <ls>
32f: 83 c4 10 add $0x10,%esp
for(i=1; i<argc; i++)
332: 83 45 f4 01 addl $0x1,-0xc(%ebp)
336: 8b 45 f4 mov -0xc(%ebp),%eax
339: 3b 03 cmp (%ebx),%eax
33b: 7c d8 jl 315 <main+0x37>
exit();
33d: e8 87 02 00 00 call 5c9 <exit>
00000342 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
342: 55 push %ebp
343: 89 e5 mov %esp,%ebp
345: 57 push %edi
346: 53 push %ebx
asm volatile("cld; rep stosb" :
347: 8b 4d 08 mov 0x8(%ebp),%ecx
34a: 8b 55 10 mov 0x10(%ebp),%edx
34d: 8b 45 0c mov 0xc(%ebp),%eax
350: 89 cb mov %ecx,%ebx
352: 89 df mov %ebx,%edi
354: 89 d1 mov %edx,%ecx
356: fc cld
357: f3 aa rep stos %al,%es:(%edi)
359: 89 ca mov %ecx,%edx
35b: 89 fb mov %edi,%ebx
35d: 89 5d 08 mov %ebx,0x8(%ebp)
360: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
363: 90 nop
364: 5b pop %ebx
365: 5f pop %edi
366: 5d pop %ebp
367: c3 ret
00000368 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
368: 55 push %ebp
369: 89 e5 mov %esp,%ebp
36b: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
36e: 8b 45 08 mov 0x8(%ebp),%eax
371: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
374: 90 nop
375: 8b 55 0c mov 0xc(%ebp),%edx
378: 8d 42 01 lea 0x1(%edx),%eax
37b: 89 45 0c mov %eax,0xc(%ebp)
37e: 8b 45 08 mov 0x8(%ebp),%eax
381: 8d 48 01 lea 0x1(%eax),%ecx
384: 89 4d 08 mov %ecx,0x8(%ebp)
387: 0f b6 12 movzbl (%edx),%edx
38a: 88 10 mov %dl,(%eax)
38c: 0f b6 00 movzbl (%eax),%eax
38f: 84 c0 test %al,%al
391: 75 e2 jne 375 <strcpy+0xd>
;
return os;
393: 8b 45 fc mov -0x4(%ebp),%eax
}
396: c9 leave
397: c3 ret
00000398 <strcmp>:
int
strcmp(const char *p, const char *q)
{
398: 55 push %ebp
399: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
39b: eb 08 jmp 3a5 <strcmp+0xd>
p++, q++;
39d: 83 45 08 01 addl $0x1,0x8(%ebp)
3a1: 83 45 0c 01 addl $0x1,0xc(%ebp)
while(*p && *p == *q)
3a5: 8b 45 08 mov 0x8(%ebp),%eax
3a8: 0f b6 00 movzbl (%eax),%eax
3ab: 84 c0 test %al,%al
3ad: 74 10 je 3bf <strcmp+0x27>
3af: 8b 45 08 mov 0x8(%ebp),%eax
3b2: 0f b6 10 movzbl (%eax),%edx
3b5: 8b 45 0c mov 0xc(%ebp),%eax
3b8: 0f b6 00 movzbl (%eax),%eax
3bb: 38 c2 cmp %al,%dl
3bd: 74 de je 39d <strcmp+0x5>
return (uchar)*p - (uchar)*q;
3bf: 8b 45 08 mov 0x8(%ebp),%eax
3c2: 0f b6 00 movzbl (%eax),%eax
3c5: 0f b6 d0 movzbl %al,%edx
3c8: 8b 45 0c mov 0xc(%ebp),%eax
3cb: 0f b6 00 movzbl (%eax),%eax
3ce: 0f b6 c8 movzbl %al,%ecx
3d1: 89 d0 mov %edx,%eax
3d3: 29 c8 sub %ecx,%eax
}
3d5: 5d pop %ebp
3d6: c3 ret
000003d7 <strlen>:
uint
strlen(char *s)
{
3d7: 55 push %ebp
3d8: 89 e5 mov %esp,%ebp
3da: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
3dd: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
3e4: eb 04 jmp 3ea <strlen+0x13>
3e6: 83 45 fc 01 addl $0x1,-0x4(%ebp)
3ea: 8b 55 fc mov -0x4(%ebp),%edx
3ed: 8b 45 08 mov 0x8(%ebp),%eax
3f0: 01 d0 add %edx,%eax
3f2: 0f b6 00 movzbl (%eax),%eax
3f5: 84 c0 test %al,%al
3f7: 75 ed jne 3e6 <strlen+0xf>
;
return n;
3f9: 8b 45 fc mov -0x4(%ebp),%eax
}
3fc: c9 leave
3fd: c3 ret
000003fe <memset>:
void*
memset(void *dst, int c, uint n)
{
3fe: 55 push %ebp
3ff: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
401: 8b 45 10 mov 0x10(%ebp),%eax
404: 50 push %eax
405: ff 75 0c push 0xc(%ebp)
408: ff 75 08 push 0x8(%ebp)
40b: e8 32 ff ff ff call 342 <stosb>
410: 83 c4 0c add $0xc,%esp
return dst;
413: 8b 45 08 mov 0x8(%ebp),%eax
}
416: c9 leave
417: c3 ret
00000418 <strchr>:
char*
strchr(const char *s, char c)
{
418: 55 push %ebp
419: 89 e5 mov %esp,%ebp
41b: 83 ec 04 sub $0x4,%esp
41e: 8b 45 0c mov 0xc(%ebp),%eax
421: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
424: eb 14 jmp 43a <strchr+0x22>
if(*s == c)
426: 8b 45 08 mov 0x8(%ebp),%eax
429: 0f b6 00 movzbl (%eax),%eax
42c: 38 45 fc cmp %al,-0x4(%ebp)
42f: 75 05 jne 436 <strchr+0x1e>
return (char*)s;
431: 8b 45 08 mov 0x8(%ebp),%eax
434: eb 13 jmp 449 <strchr+0x31>
for(; *s; s++)
436: 83 45 08 01 addl $0x1,0x8(%ebp)
43a: 8b 45 08 mov 0x8(%ebp),%eax
43d: 0f b6 00 movzbl (%eax),%eax
440: 84 c0 test %al,%al
442: 75 e2 jne 426 <strchr+0xe>
return 0;
444: b8 00 00 00 00 mov $0x0,%eax
}
449: c9 leave
44a: c3 ret
0000044b <gets>:
char*
gets(char *buf, int max)
{
44b: 55 push %ebp
44c: 89 e5 mov %esp,%ebp
44e: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
451: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
458: eb 42 jmp 49c <gets+0x51>
cc = read(0, &c, 1);
45a: 83 ec 04 sub $0x4,%esp
45d: 6a 01 push $0x1
45f: 8d 45 ef lea -0x11(%ebp),%eax
462: 50 push %eax
463: 6a 00 push $0x0
465: e8 77 01 00 00 call 5e1 <read>
46a: 83 c4 10 add $0x10,%esp
46d: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
470: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
474: 7e 33 jle 4a9 <gets+0x5e>
break;
buf[i++] = c;
476: 8b 45 f4 mov -0xc(%ebp),%eax
479: 8d 50 01 lea 0x1(%eax),%edx
47c: 89 55 f4 mov %edx,-0xc(%ebp)
47f: 89 c2 mov %eax,%edx
481: 8b 45 08 mov 0x8(%ebp),%eax
484: 01 c2 add %eax,%edx
486: 0f b6 45 ef movzbl -0x11(%ebp),%eax
48a: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
48c: 0f b6 45 ef movzbl -0x11(%ebp),%eax
490: 3c 0a cmp $0xa,%al
492: 74 16 je 4aa <gets+0x5f>
494: 0f b6 45 ef movzbl -0x11(%ebp),%eax
498: 3c 0d cmp $0xd,%al
49a: 74 0e je 4aa <gets+0x5f>
for(i=0; i+1 < max; ){
49c: 8b 45 f4 mov -0xc(%ebp),%eax
49f: 83 c0 01 add $0x1,%eax
4a2: 39 45 0c cmp %eax,0xc(%ebp)
4a5: 7f b3 jg 45a <gets+0xf>
4a7: eb 01 jmp 4aa <gets+0x5f>
break;
4a9: 90 nop
break;
}
buf[i] = '\0';
4aa: 8b 55 f4 mov -0xc(%ebp),%edx
4ad: 8b 45 08 mov 0x8(%ebp),%eax
4b0: 01 d0 add %edx,%eax
4b2: c6 00 00 movb $0x0,(%eax)
return buf;
4b5: 8b 45 08 mov 0x8(%ebp),%eax
}
4b8: c9 leave
4b9: c3 ret
000004ba <stat>:
int
stat(char *n, struct stat *st)
{
4ba: 55 push %ebp
4bb: 89 e5 mov %esp,%ebp
4bd: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
4c0: 83 ec 08 sub $0x8,%esp
4c3: 6a 00 push $0x0
4c5: ff 75 08 push 0x8(%ebp)
4c8: e8 3c 01 00 00 call 609 <open>
4cd: 83 c4 10 add $0x10,%esp
4d0: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
4d3: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
4d7: 79 07 jns 4e0 <stat+0x26>
return -1;
4d9: b8 ff ff ff ff mov $0xffffffff,%eax
4de: eb 25 jmp 505 <stat+0x4b>
r = fstat(fd, st);
4e0: 83 ec 08 sub $0x8,%esp
4e3: ff 75 0c push 0xc(%ebp)
4e6: ff 75 f4 push -0xc(%ebp)
4e9: e8 33 01 00 00 call 621 <fstat>
4ee: 83 c4 10 add $0x10,%esp
4f1: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
4f4: 83 ec 0c sub $0xc,%esp
4f7: ff 75 f4 push -0xc(%ebp)
4fa: e8 f2 00 00 00 call 5f1 <close>
4ff: 83 c4 10 add $0x10,%esp
return r;
502: 8b 45 f0 mov -0x10(%ebp),%eax
}
505: c9 leave
506: c3 ret
00000507 <atoi>:
int
atoi(const char *s)
{
507: 55 push %ebp
508: 89 e5 mov %esp,%ebp
50a: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
50d: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
514: eb 25 jmp 53b <atoi+0x34>
n = n*10 + *s++ - '0';
516: 8b 55 fc mov -0x4(%ebp),%edx
519: 89 d0 mov %edx,%eax
51b: c1 e0 02 shl $0x2,%eax
51e: 01 d0 add %edx,%eax
520: 01 c0 add %eax,%eax
522: 89 c1 mov %eax,%ecx
524: 8b 45 08 mov 0x8(%ebp),%eax
527: 8d 50 01 lea 0x1(%eax),%edx
52a: 89 55 08 mov %edx,0x8(%ebp)
52d: 0f b6 00 movzbl (%eax),%eax
530: 0f be c0 movsbl %al,%eax
533: 01 c8 add %ecx,%eax
535: 83 e8 30 sub $0x30,%eax
538: 89 45 fc mov %eax,-0x4(%ebp)
while('0' <= *s && *s <= '9')
53b: 8b 45 08 mov 0x8(%ebp),%eax
53e: 0f b6 00 movzbl (%eax),%eax
541: 3c 2f cmp $0x2f,%al
543: 7e 0a jle 54f <atoi+0x48>
545: 8b 45 08 mov 0x8(%ebp),%eax
548: 0f b6 00 movzbl (%eax),%eax
54b: 3c 39 cmp $0x39,%al
54d: 7e c7 jle 516 <atoi+0xf>
return n;
54f: 8b 45 fc mov -0x4(%ebp),%eax
}
552: c9 leave
553: c3 ret
00000554 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
554: 55 push %ebp
555: 89 e5 mov %esp,%ebp
557: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
55a: 8b 45 08 mov 0x8(%ebp),%eax
55d: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
560: 8b 45 0c mov 0xc(%ebp),%eax
563: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
566: eb 17 jmp 57f <memmove+0x2b>
*dst++ = *src++;
568: 8b 55 f8 mov -0x8(%ebp),%edx
56b: 8d 42 01 lea 0x1(%edx),%eax
56e: 89 45 f8 mov %eax,-0x8(%ebp)
571: 8b 45 fc mov -0x4(%ebp),%eax
574: 8d 48 01 lea 0x1(%eax),%ecx
577: 89 4d fc mov %ecx,-0x4(%ebp)
57a: 0f b6 12 movzbl (%edx),%edx
57d: 88 10 mov %dl,(%eax)
while(n-- > 0)
57f: 8b 45 10 mov 0x10(%ebp),%eax
582: 8d 50 ff lea -0x1(%eax),%edx
585: 89 55 10 mov %edx,0x10(%ebp)
588: 85 c0 test %eax,%eax
58a: 7f dc jg 568 <memmove+0x14>
return vdst;
58c: 8b 45 08 mov 0x8(%ebp),%eax
}
58f: c9 leave
590: c3 ret
00000591 <restorer>:
591: 83 c4 0c add $0xc,%esp
594: 5a pop %edx
595: 59 pop %ecx
596: 58 pop %eax
597: c3 ret
00000598 <signal>:
"pop %ecx\n\t"
"pop %eax\n\t"
"ret\n\t");
int signal(int signum, void(*handler)(int))
{
598: 55 push %ebp
599: 89 e5 mov %esp,%ebp
59b: 83 ec 08 sub $0x8,%esp
signal_restorer(restorer);
59e: 83 ec 0c sub $0xc,%esp
5a1: 68 91 05 00 00 push $0x591
5a6: e8 ce 00 00 00 call 679 <signal_restorer>
5ab: 83 c4 10 add $0x10,%esp
return signal_register(signum, handler);
5ae: 83 ec 08 sub $0x8,%esp
5b1: ff 75 0c push 0xc(%ebp)
5b4: ff 75 08 push 0x8(%ebp)
5b7: e8 b5 00 00 00 call 671 <signal_register>
5bc: 83 c4 10 add $0x10,%esp
5bf: c9 leave
5c0: c3 ret
000005c1 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
5c1: b8 01 00 00 00 mov $0x1,%eax
5c6: cd 40 int $0x40
5c8: c3 ret
000005c9 <exit>:
SYSCALL(exit)
5c9: b8 02 00 00 00 mov $0x2,%eax
5ce: cd 40 int $0x40
5d0: c3 ret
000005d1 <wait>:
SYSCALL(wait)
5d1: b8 03 00 00 00 mov $0x3,%eax
5d6: cd 40 int $0x40
5d8: c3 ret
000005d9 <pipe>:
SYSCALL(pipe)
5d9: b8 04 00 00 00 mov $0x4,%eax
5de: cd 40 int $0x40
5e0: c3 ret
000005e1 <read>:
SYSCALL(read)
5e1: b8 05 00 00 00 mov $0x5,%eax
5e6: cd 40 int $0x40
5e8: c3 ret
000005e9 <write>:
SYSCALL(write)
5e9: b8 10 00 00 00 mov $0x10,%eax
5ee: cd 40 int $0x40
5f0: c3 ret
000005f1 <close>:
SYSCALL(close)
5f1: b8 15 00 00 00 mov $0x15,%eax
5f6: cd 40 int $0x40
5f8: c3 ret
000005f9 <kill>:
SYSCALL(kill)
5f9: b8 06 00 00 00 mov $0x6,%eax
5fe: cd 40 int $0x40
600: c3 ret
00000601 <exec>:
SYSCALL(exec)
601: b8 07 00 00 00 mov $0x7,%eax
606: cd 40 int $0x40
608: c3 ret
00000609 <open>:
SYSCALL(open)
609: b8 0f 00 00 00 mov $0xf,%eax
60e: cd 40 int $0x40
610: c3 ret
00000611 <mknod>:
SYSCALL(mknod)
611: b8 11 00 00 00 mov $0x11,%eax
616: cd 40 int $0x40
618: c3 ret
00000619 <unlink>:
SYSCALL(unlink)
619: b8 12 00 00 00 mov $0x12,%eax
61e: cd 40 int $0x40
620: c3 ret
00000621 <fstat>:
SYSCALL(fstat)
621: b8 08 00 00 00 mov $0x8,%eax
626: cd 40 int $0x40
628: c3 ret
00000629 <link>:
SYSCALL(link)
629: b8 13 00 00 00 mov $0x13,%eax
62e: cd 40 int $0x40
630: c3 ret
00000631 <mkdir>:
SYSCALL(mkdir)
631: b8 14 00 00 00 mov $0x14,%eax
636: cd 40 int $0x40
638: c3 ret
00000639 <chdir>:
SYSCALL(chdir)
639: b8 09 00 00 00 mov $0x9,%eax
63e: cd 40 int $0x40
640: c3 ret
00000641 <dup>:
SYSCALL(dup)
641: b8 0a 00 00 00 mov $0xa,%eax
646: cd 40 int $0x40
648: c3 ret
00000649 <getpid>:
SYSCALL(getpid)
649: b8 0b 00 00 00 mov $0xb,%eax
64e: cd 40 int $0x40
650: c3 ret
00000651 <sbrk>:
SYSCALL(sbrk)
651: b8 0c 00 00 00 mov $0xc,%eax
656: cd 40 int $0x40
658: c3 ret
00000659 <sleep>:
SYSCALL(sleep)
659: b8 0d 00 00 00 mov $0xd,%eax
65e: cd 40 int $0x40
660: c3 ret
00000661 <uptime>:
SYSCALL(uptime)
661: b8 0e 00 00 00 mov $0xe,%eax
666: cd 40 int $0x40
668: c3 ret
00000669 <halt>:
SYSCALL(halt)
669: b8 16 00 00 00 mov $0x16,%eax
66e: cd 40 int $0x40
670: c3 ret
00000671 <signal_register>:
SYSCALL(signal_register)
671: b8 17 00 00 00 mov $0x17,%eax
676: cd 40 int $0x40
678: c3 ret
00000679 <signal_restorer>:
SYSCALL(signal_restorer)
679: b8 18 00 00 00 mov $0x18,%eax
67e: cd 40 int $0x40
680: c3 ret
00000681 <mprotect>:
SYSCALL(mprotect)
681: b8 19 00 00 00 mov $0x19,%eax
686: cd 40 int $0x40
688: c3 ret
00000689 <cowfork>:
SYSCALL(cowfork)
689: b8 1a 00 00 00 mov $0x1a,%eax
68e: cd 40 int $0x40
690: c3 ret
00000691 <dsbrk>:
SYSCALL(dsbrk)
691: b8 1b 00 00 00 mov $0x1b,%eax
696: cd 40 int $0x40
698: c3 ret
00000699 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
699: 55 push %ebp
69a: 89 e5 mov %esp,%ebp
69c: 83 ec 18 sub $0x18,%esp
69f: 8b 45 0c mov 0xc(%ebp),%eax
6a2: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
6a5: 83 ec 04 sub $0x4,%esp
6a8: 6a 01 push $0x1
6aa: 8d 45 f4 lea -0xc(%ebp),%eax
6ad: 50 push %eax
6ae: ff 75 08 push 0x8(%ebp)
6b1: e8 33 ff ff ff call 5e9 <write>
6b6: 83 c4 10 add $0x10,%esp
}
6b9: 90 nop
6ba: c9 leave
6bb: c3 ret
000006bc <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
6bc: 55 push %ebp
6bd: 89 e5 mov %esp,%ebp
6bf: 83 ec 28 sub $0x28,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
6c2: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
6c9: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
6cd: 74 17 je 6e6 <printint+0x2a>
6cf: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
6d3: 79 11 jns 6e6 <printint+0x2a>
neg = 1;
6d5: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
6dc: 8b 45 0c mov 0xc(%ebp),%eax
6df: f7 d8 neg %eax
6e1: 89 45 ec mov %eax,-0x14(%ebp)
6e4: eb 06 jmp 6ec <printint+0x30>
} else {
x = xx;
6e6: 8b 45 0c mov 0xc(%ebp),%eax
6e9: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
6ec: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
6f3: 8b 4d 10 mov 0x10(%ebp),%ecx
6f6: 8b 45 ec mov -0x14(%ebp),%eax
6f9: ba 00 00 00 00 mov $0x0,%edx
6fe: f7 f1 div %ecx
700: 89 d1 mov %edx,%ecx
702: 8b 45 f4 mov -0xc(%ebp),%eax
705: 8d 50 01 lea 0x1(%eax),%edx
708: 89 55 f4 mov %edx,-0xc(%ebp)
70b: 0f b6 91 78 0b 00 00 movzbl 0xb78(%ecx),%edx
712: 88 54 05 dc mov %dl,-0x24(%ebp,%eax,1)
}while((x /= base) != 0);
716: 8b 4d 10 mov 0x10(%ebp),%ecx
719: 8b 45 ec mov -0x14(%ebp),%eax
71c: ba 00 00 00 00 mov $0x0,%edx
721: f7 f1 div %ecx
723: 89 45 ec mov %eax,-0x14(%ebp)
726: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
72a: 75 c7 jne 6f3 <printint+0x37>
if(neg)
72c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
730: 74 2d je 75f <printint+0xa3>
buf[i++] = '-';
732: 8b 45 f4 mov -0xc(%ebp),%eax
735: 8d 50 01 lea 0x1(%eax),%edx
738: 89 55 f4 mov %edx,-0xc(%ebp)
73b: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
740: eb 1d jmp 75f <printint+0xa3>
putc(fd, buf[i]);
742: 8d 55 dc lea -0x24(%ebp),%edx
745: 8b 45 f4 mov -0xc(%ebp),%eax
748: 01 d0 add %edx,%eax
74a: 0f b6 00 movzbl (%eax),%eax
74d: 0f be c0 movsbl %al,%eax
750: 83 ec 08 sub $0x8,%esp
753: 50 push %eax
754: ff 75 08 push 0x8(%ebp)
757: e8 3d ff ff ff call 699 <putc>
75c: 83 c4 10 add $0x10,%esp
while(--i >= 0)
75f: 83 6d f4 01 subl $0x1,-0xc(%ebp)
763: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
767: 79 d9 jns 742 <printint+0x86>
}
769: 90 nop
76a: 90 nop
76b: c9 leave
76c: c3 ret
0000076d <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
76d: 55 push %ebp
76e: 89 e5 mov %esp,%ebp
770: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
773: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
77a: 8d 45 0c lea 0xc(%ebp),%eax
77d: 83 c0 04 add $0x4,%eax
780: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
783: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
78a: e9 59 01 00 00 jmp 8e8 <printf+0x17b>
c = fmt[i] & 0xff;
78f: 8b 55 0c mov 0xc(%ebp),%edx
792: 8b 45 f0 mov -0x10(%ebp),%eax
795: 01 d0 add %edx,%eax
797: 0f b6 00 movzbl (%eax),%eax
79a: 0f be c0 movsbl %al,%eax
79d: 25 ff 00 00 00 and $0xff,%eax
7a2: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
7a5: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
7a9: 75 2c jne 7d7 <printf+0x6a>
if(c == '%'){
7ab: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
7af: 75 0c jne 7bd <printf+0x50>
state = '%';
7b1: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
7b8: e9 27 01 00 00 jmp 8e4 <printf+0x177>
} else {
putc(fd, c);
7bd: 8b 45 e4 mov -0x1c(%ebp),%eax
7c0: 0f be c0 movsbl %al,%eax
7c3: 83 ec 08 sub $0x8,%esp
7c6: 50 push %eax
7c7: ff 75 08 push 0x8(%ebp)
7ca: e8 ca fe ff ff call 699 <putc>
7cf: 83 c4 10 add $0x10,%esp
7d2: e9 0d 01 00 00 jmp 8e4 <printf+0x177>
}
} else if(state == '%'){
7d7: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
7db: 0f 85 03 01 00 00 jne 8e4 <printf+0x177>
if(c == 'd'){
7e1: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
7e5: 75 1e jne 805 <printf+0x98>
printint(fd, *ap, 10, 1);
7e7: 8b 45 e8 mov -0x18(%ebp),%eax
7ea: 8b 00 mov (%eax),%eax
7ec: 6a 01 push $0x1
7ee: 6a 0a push $0xa
7f0: 50 push %eax
7f1: ff 75 08 push 0x8(%ebp)
7f4: e8 c3 fe ff ff call 6bc <printint>
7f9: 83 c4 10 add $0x10,%esp
ap++;
7fc: 83 45 e8 04 addl $0x4,-0x18(%ebp)
800: e9 d8 00 00 00 jmp 8dd <printf+0x170>
} else if(c == 'x' || c == 'p'){
805: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
809: 74 06 je 811 <printf+0xa4>
80b: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
80f: 75 1e jne 82f <printf+0xc2>
printint(fd, *ap, 16, 0);
811: 8b 45 e8 mov -0x18(%ebp),%eax
814: 8b 00 mov (%eax),%eax
816: 6a 00 push $0x0
818: 6a 10 push $0x10
81a: 50 push %eax
81b: ff 75 08 push 0x8(%ebp)
81e: e8 99 fe ff ff call 6bc <printint>
823: 83 c4 10 add $0x10,%esp
ap++;
826: 83 45 e8 04 addl $0x4,-0x18(%ebp)
82a: e9 ae 00 00 00 jmp 8dd <printf+0x170>
} else if(c == 's'){
82f: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
833: 75 43 jne 878 <printf+0x10b>
s = (char*)*ap;
835: 8b 45 e8 mov -0x18(%ebp),%eax
838: 8b 00 mov (%eax),%eax
83a: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
83d: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
841: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
845: 75 25 jne 86c <printf+0xff>
s = "(null)";
847: c7 45 f4 6e 0b 00 00 movl $0xb6e,-0xc(%ebp)
while(*s != 0){
84e: eb 1c jmp 86c <printf+0xff>
putc(fd, *s);
850: 8b 45 f4 mov -0xc(%ebp),%eax
853: 0f b6 00 movzbl (%eax),%eax
856: 0f be c0 movsbl %al,%eax
859: 83 ec 08 sub $0x8,%esp
85c: 50 push %eax
85d: ff 75 08 push 0x8(%ebp)
860: e8 34 fe ff ff call 699 <putc>
865: 83 c4 10 add $0x10,%esp
s++;
868: 83 45 f4 01 addl $0x1,-0xc(%ebp)
while(*s != 0){
86c: 8b 45 f4 mov -0xc(%ebp),%eax
86f: 0f b6 00 movzbl (%eax),%eax
872: 84 c0 test %al,%al
874: 75 da jne 850 <printf+0xe3>
876: eb 65 jmp 8dd <printf+0x170>
}
} else if(c == 'c'){
878: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
87c: 75 1d jne 89b <printf+0x12e>
putc(fd, *ap);
87e: 8b 45 e8 mov -0x18(%ebp),%eax
881: 8b 00 mov (%eax),%eax
883: 0f be c0 movsbl %al,%eax
886: 83 ec 08 sub $0x8,%esp
889: 50 push %eax
88a: ff 75 08 push 0x8(%ebp)
88d: e8 07 fe ff ff call 699 <putc>
892: 83 c4 10 add $0x10,%esp
ap++;
895: 83 45 e8 04 addl $0x4,-0x18(%ebp)
899: eb 42 jmp 8dd <printf+0x170>
} else if(c == '%'){
89b: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
89f: 75 17 jne 8b8 <printf+0x14b>
putc(fd, c);
8a1: 8b 45 e4 mov -0x1c(%ebp),%eax
8a4: 0f be c0 movsbl %al,%eax
8a7: 83 ec 08 sub $0x8,%esp
8aa: 50 push %eax
8ab: ff 75 08 push 0x8(%ebp)
8ae: e8 e6 fd ff ff call 699 <putc>
8b3: 83 c4 10 add $0x10,%esp
8b6: eb 25 jmp 8dd <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
8b8: 83 ec 08 sub $0x8,%esp
8bb: 6a 25 push $0x25
8bd: ff 75 08 push 0x8(%ebp)
8c0: e8 d4 fd ff ff call 699 <putc>
8c5: 83 c4 10 add $0x10,%esp
putc(fd, c);
8c8: 8b 45 e4 mov -0x1c(%ebp),%eax
8cb: 0f be c0 movsbl %al,%eax
8ce: 83 ec 08 sub $0x8,%esp
8d1: 50 push %eax
8d2: ff 75 08 push 0x8(%ebp)
8d5: e8 bf fd ff ff call 699 <putc>
8da: 83 c4 10 add $0x10,%esp
}
state = 0;
8dd: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
for(i = 0; fmt[i]; i++){
8e4: 83 45 f0 01 addl $0x1,-0x10(%ebp)
8e8: 8b 55 0c mov 0xc(%ebp),%edx
8eb: 8b 45 f0 mov -0x10(%ebp),%eax
8ee: 01 d0 add %edx,%eax
8f0: 0f b6 00 movzbl (%eax),%eax
8f3: 84 c0 test %al,%al
8f5: 0f 85 94 fe ff ff jne 78f <printf+0x22>
}
}
}
8fb: 90 nop
8fc: 90 nop
8fd: c9 leave
8fe: c3 ret
000008ff <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
8ff: 55 push %ebp
900: 89 e5 mov %esp,%ebp
902: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
905: 8b 45 08 mov 0x8(%ebp),%eax
908: 83 e8 08 sub $0x8,%eax
90b: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
90e: a1 a4 0b 00 00 mov 0xba4,%eax
913: 89 45 fc mov %eax,-0x4(%ebp)
916: eb 24 jmp 93c <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
918: 8b 45 fc mov -0x4(%ebp),%eax
91b: 8b 00 mov (%eax),%eax
91d: 39 45 fc cmp %eax,-0x4(%ebp)
920: 72 12 jb 934 <free+0x35>
922: 8b 45 f8 mov -0x8(%ebp),%eax
925: 3b 45 fc cmp -0x4(%ebp),%eax
928: 77 24 ja 94e <free+0x4f>
92a: 8b 45 fc mov -0x4(%ebp),%eax
92d: 8b 00 mov (%eax),%eax
92f: 39 45 f8 cmp %eax,-0x8(%ebp)
932: 72 1a jb 94e <free+0x4f>
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
934: 8b 45 fc mov -0x4(%ebp),%eax
937: 8b 00 mov (%eax),%eax
939: 89 45 fc mov %eax,-0x4(%ebp)
93c: 8b 45 f8 mov -0x8(%ebp),%eax
93f: 3b 45 fc cmp -0x4(%ebp),%eax
942: 76 d4 jbe 918 <free+0x19>
944: 8b 45 fc mov -0x4(%ebp),%eax
947: 8b 00 mov (%eax),%eax
949: 39 45 f8 cmp %eax,-0x8(%ebp)
94c: 73 ca jae 918 <free+0x19>
break;
if(bp + bp->s.size == p->s.ptr){
94e: 8b 45 f8 mov -0x8(%ebp),%eax
951: 8b 40 04 mov 0x4(%eax),%eax
954: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
95b: 8b 45 f8 mov -0x8(%ebp),%eax
95e: 01 c2 add %eax,%edx
960: 8b 45 fc mov -0x4(%ebp),%eax
963: 8b 00 mov (%eax),%eax
965: 39 c2 cmp %eax,%edx
967: 75 24 jne 98d <free+0x8e>
bp->s.size += p->s.ptr->s.size;
969: 8b 45 f8 mov -0x8(%ebp),%eax
96c: 8b 50 04 mov 0x4(%eax),%edx
96f: 8b 45 fc mov -0x4(%ebp),%eax
972: 8b 00 mov (%eax),%eax
974: 8b 40 04 mov 0x4(%eax),%eax
977: 01 c2 add %eax,%edx
979: 8b 45 f8 mov -0x8(%ebp),%eax
97c: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
97f: 8b 45 fc mov -0x4(%ebp),%eax
982: 8b 00 mov (%eax),%eax
984: 8b 10 mov (%eax),%edx
986: 8b 45 f8 mov -0x8(%ebp),%eax
989: 89 10 mov %edx,(%eax)
98b: eb 0a jmp 997 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
98d: 8b 45 fc mov -0x4(%ebp),%eax
990: 8b 10 mov (%eax),%edx
992: 8b 45 f8 mov -0x8(%ebp),%eax
995: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
997: 8b 45 fc mov -0x4(%ebp),%eax
99a: 8b 40 04 mov 0x4(%eax),%eax
99d: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
9a4: 8b 45 fc mov -0x4(%ebp),%eax
9a7: 01 d0 add %edx,%eax
9a9: 39 45 f8 cmp %eax,-0x8(%ebp)
9ac: 75 20 jne 9ce <free+0xcf>
p->s.size += bp->s.size;
9ae: 8b 45 fc mov -0x4(%ebp),%eax
9b1: 8b 50 04 mov 0x4(%eax),%edx
9b4: 8b 45 f8 mov -0x8(%ebp),%eax
9b7: 8b 40 04 mov 0x4(%eax),%eax
9ba: 01 c2 add %eax,%edx
9bc: 8b 45 fc mov -0x4(%ebp),%eax
9bf: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
9c2: 8b 45 f8 mov -0x8(%ebp),%eax
9c5: 8b 10 mov (%eax),%edx
9c7: 8b 45 fc mov -0x4(%ebp),%eax
9ca: 89 10 mov %edx,(%eax)
9cc: eb 08 jmp 9d6 <free+0xd7>
} else
p->s.ptr = bp;
9ce: 8b 45 fc mov -0x4(%ebp),%eax
9d1: 8b 55 f8 mov -0x8(%ebp),%edx
9d4: 89 10 mov %edx,(%eax)
freep = p;
9d6: 8b 45 fc mov -0x4(%ebp),%eax
9d9: a3 a4 0b 00 00 mov %eax,0xba4
}
9de: 90 nop
9df: c9 leave
9e0: c3 ret
000009e1 <morecore>:
static Header*
morecore(uint nu)
{
9e1: 55 push %ebp
9e2: 89 e5 mov %esp,%ebp
9e4: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
9e7: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
9ee: 77 07 ja 9f7 <morecore+0x16>
nu = 4096;
9f0: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
9f7: 8b 45 08 mov 0x8(%ebp),%eax
9fa: c1 e0 03 shl $0x3,%eax
9fd: 83 ec 0c sub $0xc,%esp
a00: 50 push %eax
a01: e8 4b fc ff ff call 651 <sbrk>
a06: 83 c4 10 add $0x10,%esp
a09: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
a0c: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
a10: 75 07 jne a19 <morecore+0x38>
return 0;
a12: b8 00 00 00 00 mov $0x0,%eax
a17: eb 26 jmp a3f <morecore+0x5e>
hp = (Header*)p;
a19: 8b 45 f4 mov -0xc(%ebp),%eax
a1c: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
a1f: 8b 45 f0 mov -0x10(%ebp),%eax
a22: 8b 55 08 mov 0x8(%ebp),%edx
a25: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
a28: 8b 45 f0 mov -0x10(%ebp),%eax
a2b: 83 c0 08 add $0x8,%eax
a2e: 83 ec 0c sub $0xc,%esp
a31: 50 push %eax
a32: e8 c8 fe ff ff call 8ff <free>
a37: 83 c4 10 add $0x10,%esp
return freep;
a3a: a1 a4 0b 00 00 mov 0xba4,%eax
}
a3f: c9 leave
a40: c3 ret
00000a41 <malloc>:
void*
malloc(uint nbytes)
{
a41: 55 push %ebp
a42: 89 e5 mov %esp,%ebp
a44: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
a47: 8b 45 08 mov 0x8(%ebp),%eax
a4a: 83 c0 07 add $0x7,%eax
a4d: c1 e8 03 shr $0x3,%eax
a50: 83 c0 01 add $0x1,%eax
a53: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
a56: a1 a4 0b 00 00 mov 0xba4,%eax
a5b: 89 45 f0 mov %eax,-0x10(%ebp)
a5e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
a62: 75 23 jne a87 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
a64: c7 45 f0 9c 0b 00 00 movl $0xb9c,-0x10(%ebp)
a6b: 8b 45 f0 mov -0x10(%ebp),%eax
a6e: a3 a4 0b 00 00 mov %eax,0xba4
a73: a1 a4 0b 00 00 mov 0xba4,%eax
a78: a3 9c 0b 00 00 mov %eax,0xb9c
base.s.size = 0;
a7d: c7 05 a0 0b 00 00 00 movl $0x0,0xba0
a84: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
a87: 8b 45 f0 mov -0x10(%ebp),%eax
a8a: 8b 00 mov (%eax),%eax
a8c: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
a8f: 8b 45 f4 mov -0xc(%ebp),%eax
a92: 8b 40 04 mov 0x4(%eax),%eax
a95: 39 45 ec cmp %eax,-0x14(%ebp)
a98: 77 4d ja ae7 <malloc+0xa6>
if(p->s.size == nunits)
a9a: 8b 45 f4 mov -0xc(%ebp),%eax
a9d: 8b 40 04 mov 0x4(%eax),%eax
aa0: 39 45 ec cmp %eax,-0x14(%ebp)
aa3: 75 0c jne ab1 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
aa5: 8b 45 f4 mov -0xc(%ebp),%eax
aa8: 8b 10 mov (%eax),%edx
aaa: 8b 45 f0 mov -0x10(%ebp),%eax
aad: 89 10 mov %edx,(%eax)
aaf: eb 26 jmp ad7 <malloc+0x96>
else {
p->s.size -= nunits;
ab1: 8b 45 f4 mov -0xc(%ebp),%eax
ab4: 8b 40 04 mov 0x4(%eax),%eax
ab7: 2b 45 ec sub -0x14(%ebp),%eax
aba: 89 c2 mov %eax,%edx
abc: 8b 45 f4 mov -0xc(%ebp),%eax
abf: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
ac2: 8b 45 f4 mov -0xc(%ebp),%eax
ac5: 8b 40 04 mov 0x4(%eax),%eax
ac8: c1 e0 03 shl $0x3,%eax
acb: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
ace: 8b 45 f4 mov -0xc(%ebp),%eax
ad1: 8b 55 ec mov -0x14(%ebp),%edx
ad4: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
ad7: 8b 45 f0 mov -0x10(%ebp),%eax
ada: a3 a4 0b 00 00 mov %eax,0xba4
return (void*)(p + 1);
adf: 8b 45 f4 mov -0xc(%ebp),%eax
ae2: 83 c0 08 add $0x8,%eax
ae5: eb 3b jmp b22 <malloc+0xe1>
}
if(p == freep)
ae7: a1 a4 0b 00 00 mov 0xba4,%eax
aec: 39 45 f4 cmp %eax,-0xc(%ebp)
aef: 75 1e jne b0f <malloc+0xce>
if((p = morecore(nunits)) == 0)
af1: 83 ec 0c sub $0xc,%esp
af4: ff 75 ec push -0x14(%ebp)
af7: e8 e5 fe ff ff call 9e1 <morecore>
afc: 83 c4 10 add $0x10,%esp
aff: 89 45 f4 mov %eax,-0xc(%ebp)
b02: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
b06: 75 07 jne b0f <malloc+0xce>
return 0;
b08: b8 00 00 00 00 mov $0x0,%eax
b0d: eb 13 jmp b22 <malloc+0xe1>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
b0f: 8b 45 f4 mov -0xc(%ebp),%eax
b12: 89 45 f0 mov %eax,-0x10(%ebp)
b15: 8b 45 f4 mov -0xc(%ebp),%eax
b18: 8b 00 mov (%eax),%eax
b1a: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
b1d: e9 6d ff ff ff jmp a8f <malloc+0x4e>
}
}
b22: c9 leave
b23: c3 ret
|
oeis/017/A017024.asm | neoneye/loda-programs | 11 | 11039 | <reponame>neoneye/loda-programs
; A017024: a(n) = (7*n + 3)^8.
; 6561,100000000,6975757441,110075314176,852891037441,4347792138496,16815125390625,53459728531456,146830437604321,360040606269696,806460091894081,1677721600000000,3282116715437121,6095689385410816,10828567056280801,18509302102818816,30590228625390625,49077072127303936,76686282021340161,117033789351264256,174859124550883201,256289062500000000,369145194573386401,523300059815673856,731086699811838561,1007766734259732736,1372062286687890625,1846757322198614016,2459374191553118401,3242931408352297216
mul $0,7
add $0,3
pow $0,8
|
reversing/matryoshka/src/gen_rot13.asm | cclauss/fbctf-2019-challenges | 213 | 2524 | <reponame>cclauss/fbctf-2019-challenges
; THIS IS AN AUTOGENERATED FILE
; WARNING: FOR MACOS ONLY
; nasm -f macho64 rot13.asm -o rot13.o && ld -o rot13.macho -macosx_version_min 10.7 -e start rot13.o && ./rot13.macho
BITS 64
section .text
global start
start:
push rbp
mov rbp,rsp
; PRINT OUTPUT
push 0xa203a
mov DWORD [rsp+0x4],0x0
push 0x76207965
mov DWORD [rsp+0x4],0x65756c61
push 0x7475706e
mov DWORD [rsp+0x4],0x6b206120
push 0x61656c50
mov DWORD [rsp+0x4],0x69206573
mov rax, 0x2000004
mov rdi, 0x1
mov rsi, rsp
mov edx, 0x1b
syscall
pop rax
pop rax
pop rax
pop rax
; GET INPUT
mov rax, 0x2000003
mov rdi, 0
lea rsi, [rel key]
mov edx, 27
syscall
; START DECRYPTION
mov r12, 0 ; ; int i = 0;
mov r10w, WORD [rel key]
lea r14, [rel key]
loop1:
cmp r12, 23 ; Length of Answer
jge verify_rot13
movzx ecx, BYTE [r14 + r12] ; c = Answer[i]
cmp ecx, 0x41 ; if c >='A'
jl goto_lowercase
cmp ecx, 0x5a ; if c <='Z'
jg goto_lowercase
add ecx, 0xd ; e = c + ROT
cmp ecx, 0x5a ; if((e = c + ROT) <= 'Z')
jg greater_than
mov BYTE [r14 + r12], cl ; Answer[i] = e;
jmp goto_increment1
greater_than:
movzx ecx, BYTE [r14 + r12]
sub ecx, 0xd ; e = c - ROT
mov BYTE [r14 + r12], cl ; Answer[i] = e;
goto_increment1:
jmp increment
goto_lowercase:
movzx ecx, BYTE [r14 + r12] ; c = Answer[i]
cmp ecx, 0x61 ; 'a' ; if c >='a'
jl neither
cmp ecx, 0x7a ; if c <='z'
jg neither
mov eax, ecx
add eax, 0xd ; e = c + ROT
cmp eax, 0x7a ; if((e= c + ROT) <= 'z')
jg greater_than2
mov cl, al
mov BYTE [r14+r12], cl ; Answer[i] = e;
jmp goto_increment2
greater_than2:
movzx ecx, BYTE [r14 + r12]
sub ecx, 0xd ; e = c - ROT
mov BYTE [r14 + r12], cl ; Answer[i] = e;
goto_increment2:
jmp increment
neither: ; else
movzx ecx, BYTE [r14 + r12] ; c
mov BYTE [r14 + r12], cl ; Answer[i] = c;
increment:
inc r12
jmp loop1
verify_rot13:
xor r8, r8 ; int isSame = 0;
xor r12, r12 ; int i = 0
lea r13, [rel ROT13]
loop2:
cmp r12, 23 ; i < 23
jge exit_loop
movzx ecx, BYTE [r14 + r12] ; Answer[i]
movzx edx, BYTE [r13 + r12] ; final[i]
cmp ecx, edx ; if (final[i] == Answer[i])
jne not_equal
mov r8, 0x1 ; isSame = 1
jmp continue_loop
not_equal:
mov r8, 0x0 ; isSame = 0
jmp exit_loop ; break;
continue_loop:
inc r12
jmp loop2
exit_loop:
cmp r8d, 0x1 ; if (isSame == 1)
jne fail
mov eax, 0x2000004 ; write
mov rdi, 1 ; std out
lea rsi, [rel msg]
mov edx, 21
syscall
xor eax, eax
mov ax, 0x354c ; 0x4d34 ^ 0x354C = 0x7878 (offset of next shellcode)
xor ax, r10w
pop rbp
retn
fail:
mov rax, 0x2000004 ; write
mov rdi, 1 ; std out
lea rsi, [rel msg2]
mov edx, 230
syscall
xor eax, eax
mov rax, 0x2000001 ; exit
mov rdi, 0
syscall
section .data
ROT13: db "4ZberYriryf2TbXrrcTbvat", 10
key: times 27 db 0
msg: db "I believe in you ...", 10
msg2:
db 32,32,32,32,32,70,65,73,76,32,87,72,65,76,69,33,10,10,87,32,32,32,32,32,87,32,32,32,32,32,32,87,32,32,32,32,32,32,32,32,10,87,32,32,32,32,32,32,32,32,87,32,32,87,32,32,32,32,32,87,32,32,32,32,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,39,46,32,32,87,32,32,32,32,32,32,10,32,32,46,45,34,34,45,46,95,32,32,32,32,32,92,32,92,46,45,45,124,32,32,10,32,47,32,32,32,32,32,32,32,34,45,46,46,95,95,41,32,46,45,39,32,32,32,10,124,32,32,32,32,32,95,32,32,32,32,32,32,32,32,32,47,32,32,32,32,32,32,10,92,39,45,46,95,95,44,32,32,32,46,95,95,46,44,39,32,32,32,32,32,32,32,10,32,96,39,45,45,45,45,39,46,95,92,45,45,39,32,32,32,32,32,32,10,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,10
|
programs/oeis/115/A115516.asm | karttu/loda | 0 | 24340 | ; A115516: The mode of the bits of n (using 0 if bimodal).
; 0,1,0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,1,0,1,1,1,0
lpb $0,1
mov $2,$0
cal $2,309074 ; a(0) = 1; a(2*n) = 4*a(n), a(2*n+1) = a(n).
mov $0,$2
sub $0,1
mov $1,3
lpe
div $1,3
|
oeis/048/A048916.asm | neoneye/loda-programs | 11 | 21198 | <filename>oeis/048/A048916.asm
; A048916: Indices of 9-gonal numbers which are also hexagonal.
; Submitted by <NAME>
; 1,10,39025,621946,2517635809,40124201194,162422756519761,2588572715184730,10478541711598202305,166999180107303446986,676012639819623666961969,10773785102854001863647034,43612279434844659538786242721,695059971958523896124021281450,2813602594783555725665631995917585,44841099020158425531691107087795226,181516757756254034650747923045840812929,2892878661491440692792996186537999905674,11710372107073370196674795781713742209360881,186631173922617705834688930446621418826834170
mov $2,$0
div $2,2
mul $2,2
add $0,$2
seq $0,253878 ; Indices of triangular numbers (A000217) which are also centered heptagonal numbers (A069099).
mul $0,8
div $0,56
mul $0,3
add $0,1
|
source/winmm-proxy/winmm-proxy-asm.asm | stmy/obs-win-gamesound | 2 | 21159 | .code
extern winmm_procs:QWORD
CloseDriver_wrapper proc
jmp winmm_procs[0*8]
CloseDriver_wrapper endp
DefDriverProc_wrapper proc
jmp winmm_procs[1*8]
DefDriverProc_wrapper endp
DriverCallback_wrapper proc
jmp winmm_procs[2*8]
DriverCallback_wrapper endp
DrvGetModuleHandle_wrapper proc
jmp winmm_procs[3*8]
DrvGetModuleHandle_wrapper endp
GetDriverModuleHandle_wrapper proc
jmp winmm_procs[4*8]
GetDriverModuleHandle_wrapper endp
OpenDriver_wrapper proc
jmp winmm_procs[5*8]
OpenDriver_wrapper endp
PlaySound_wrapper proc
jmp winmm_procs[6*8]
PlaySound_wrapper endp
PlaySoundA_wrapper proc
jmp winmm_procs[7*8]
PlaySoundA_wrapper endp
PlaySoundW_wrapper proc
jmp winmm_procs[8*8]
PlaySoundW_wrapper endp
SendDriverMessage_wrapper proc
jmp winmm_procs[9*8]
SendDriverMessage_wrapper endp
WOWAppExit_wrapper proc
jmp winmm_procs[10*8]
WOWAppExit_wrapper endp
auxGetDevCapsA_wrapper proc
jmp winmm_procs[11*8]
auxGetDevCapsA_wrapper endp
auxGetDevCapsW_wrapper proc
jmp winmm_procs[12*8]
auxGetDevCapsW_wrapper endp
auxGetNumDevs_wrapper proc
jmp winmm_procs[13*8]
auxGetNumDevs_wrapper endp
auxGetVolume_wrapper proc
jmp winmm_procs[14*8]
auxGetVolume_wrapper endp
auxOutMessage_wrapper proc
jmp winmm_procs[15*8]
auxOutMessage_wrapper endp
auxSetVolume_wrapper proc
jmp winmm_procs[16*8]
auxSetVolume_wrapper endp
joyConfigChanged_wrapper proc
jmp winmm_procs[17*8]
joyConfigChanged_wrapper endp
joyGetDevCapsA_wrapper proc
jmp winmm_procs[18*8]
joyGetDevCapsA_wrapper endp
joyGetDevCapsW_wrapper proc
jmp winmm_procs[19*8]
joyGetDevCapsW_wrapper endp
joyGetNumDevs_wrapper proc
jmp winmm_procs[20*8]
joyGetNumDevs_wrapper endp
joyGetPos_wrapper proc
jmp winmm_procs[21*8]
joyGetPos_wrapper endp
joyGetPosEx_wrapper proc
jmp winmm_procs[22*8]
joyGetPosEx_wrapper endp
joyGetThreshold_wrapper proc
jmp winmm_procs[23*8]
joyGetThreshold_wrapper endp
joyReleaseCapture_wrapper proc
jmp winmm_procs[24*8]
joyReleaseCapture_wrapper endp
joySetCapture_wrapper proc
jmp winmm_procs[25*8]
joySetCapture_wrapper endp
joySetThreshold_wrapper proc
jmp winmm_procs[26*8]
joySetThreshold_wrapper endp
mciDriverNotify_wrapper proc
jmp winmm_procs[27*8]
mciDriverNotify_wrapper endp
mciDriverYield_wrapper proc
jmp winmm_procs[28*8]
mciDriverYield_wrapper endp
mciExecute_wrapper proc
jmp winmm_procs[29*8]
mciExecute_wrapper endp
mciFreeCommandResource_wrapper proc
jmp winmm_procs[30*8]
mciFreeCommandResource_wrapper endp
mciGetCreatorTask_wrapper proc
jmp winmm_procs[31*8]
mciGetCreatorTask_wrapper endp
mciGetDeviceIDA_wrapper proc
jmp winmm_procs[32*8]
mciGetDeviceIDA_wrapper endp
mciGetDeviceIDFromElementIDA_wrapper proc
jmp winmm_procs[33*8]
mciGetDeviceIDFromElementIDA_wrapper endp
mciGetDeviceIDFromElementIDW_wrapper proc
jmp winmm_procs[34*8]
mciGetDeviceIDFromElementIDW_wrapper endp
mciGetDeviceIDW_wrapper proc
jmp winmm_procs[35*8]
mciGetDeviceIDW_wrapper endp
mciGetDriverData_wrapper proc
jmp winmm_procs[36*8]
mciGetDriverData_wrapper endp
mciGetErrorStringA_wrapper proc
jmp winmm_procs[37*8]
mciGetErrorStringA_wrapper endp
mciGetErrorStringW_wrapper proc
jmp winmm_procs[38*8]
mciGetErrorStringW_wrapper endp
mciGetYieldProc_wrapper proc
jmp winmm_procs[39*8]
mciGetYieldProc_wrapper endp
mciLoadCommandResource_wrapper proc
jmp winmm_procs[40*8]
mciLoadCommandResource_wrapper endp
mciSendCommandA_wrapper proc
jmp winmm_procs[41*8]
mciSendCommandA_wrapper endp
mciSendCommandW_wrapper proc
jmp winmm_procs[42*8]
mciSendCommandW_wrapper endp
mciSendStringA_wrapper proc
jmp winmm_procs[43*8]
mciSendStringA_wrapper endp
mciSendStringW_wrapper proc
jmp winmm_procs[44*8]
mciSendStringW_wrapper endp
mciSetDriverData_wrapper proc
jmp winmm_procs[45*8]
mciSetDriverData_wrapper endp
mciSetYieldProc_wrapper proc
jmp winmm_procs[46*8]
mciSetYieldProc_wrapper endp
midiConnect_wrapper proc
jmp winmm_procs[47*8]
midiConnect_wrapper endp
midiDisconnect_wrapper proc
jmp winmm_procs[48*8]
midiDisconnect_wrapper endp
midiInAddBuffer_wrapper proc
jmp winmm_procs[49*8]
midiInAddBuffer_wrapper endp
midiInClose_wrapper proc
jmp winmm_procs[50*8]
midiInClose_wrapper endp
midiInGetDevCapsA_wrapper proc
jmp winmm_procs[51*8]
midiInGetDevCapsA_wrapper endp
midiInGetDevCapsW_wrapper proc
jmp winmm_procs[52*8]
midiInGetDevCapsW_wrapper endp
midiInGetErrorTextA_wrapper proc
jmp winmm_procs[53*8]
midiInGetErrorTextA_wrapper endp
midiInGetErrorTextW_wrapper proc
jmp winmm_procs[54*8]
midiInGetErrorTextW_wrapper endp
midiInGetID_wrapper proc
jmp winmm_procs[55*8]
midiInGetID_wrapper endp
midiInGetNumDevs_wrapper proc
jmp winmm_procs[56*8]
midiInGetNumDevs_wrapper endp
midiInMessage_wrapper proc
jmp winmm_procs[57*8]
midiInMessage_wrapper endp
midiInOpen_wrapper proc
jmp winmm_procs[58*8]
midiInOpen_wrapper endp
midiInPrepareHeader_wrapper proc
jmp winmm_procs[59*8]
midiInPrepareHeader_wrapper endp
midiInReset_wrapper proc
jmp winmm_procs[60*8]
midiInReset_wrapper endp
midiInStart_wrapper proc
jmp winmm_procs[61*8]
midiInStart_wrapper endp
midiInStop_wrapper proc
jmp winmm_procs[62*8]
midiInStop_wrapper endp
midiInUnprepareHeader_wrapper proc
jmp winmm_procs[63*8]
midiInUnprepareHeader_wrapper endp
midiOutCacheDrumPatches_wrapper proc
jmp winmm_procs[64*8]
midiOutCacheDrumPatches_wrapper endp
midiOutCachePatches_wrapper proc
jmp winmm_procs[65*8]
midiOutCachePatches_wrapper endp
midiOutClose_wrapper proc
jmp winmm_procs[66*8]
midiOutClose_wrapper endp
midiOutGetDevCapsA_wrapper proc
jmp winmm_procs[67*8]
midiOutGetDevCapsA_wrapper endp
midiOutGetDevCapsW_wrapper proc
jmp winmm_procs[68*8]
midiOutGetDevCapsW_wrapper endp
midiOutGetErrorTextA_wrapper proc
jmp winmm_procs[69*8]
midiOutGetErrorTextA_wrapper endp
midiOutGetErrorTextW_wrapper proc
jmp winmm_procs[70*8]
midiOutGetErrorTextW_wrapper endp
midiOutGetID_wrapper proc
jmp winmm_procs[71*8]
midiOutGetID_wrapper endp
midiOutGetNumDevs_wrapper proc
jmp winmm_procs[72*8]
midiOutGetNumDevs_wrapper endp
midiOutGetVolume_wrapper proc
jmp winmm_procs[73*8]
midiOutGetVolume_wrapper endp
midiOutLongMsg_wrapper proc
jmp winmm_procs[74*8]
midiOutLongMsg_wrapper endp
midiOutMessage_wrapper proc
jmp winmm_procs[75*8]
midiOutMessage_wrapper endp
midiOutOpen_wrapper proc
jmp winmm_procs[76*8]
midiOutOpen_wrapper endp
midiOutPrepareHeader_wrapper proc
jmp winmm_procs[77*8]
midiOutPrepareHeader_wrapper endp
midiOutReset_wrapper proc
jmp winmm_procs[78*8]
midiOutReset_wrapper endp
midiOutSetVolume_wrapper proc
jmp winmm_procs[79*8]
midiOutSetVolume_wrapper endp
midiOutShortMsg_wrapper proc
jmp winmm_procs[80*8]
midiOutShortMsg_wrapper endp
midiOutUnprepareHeader_wrapper proc
jmp winmm_procs[81*8]
midiOutUnprepareHeader_wrapper endp
midiStreamClose_wrapper proc
jmp winmm_procs[82*8]
midiStreamClose_wrapper endp
midiStreamOpen_wrapper proc
jmp winmm_procs[83*8]
midiStreamOpen_wrapper endp
midiStreamOut_wrapper proc
jmp winmm_procs[84*8]
midiStreamOut_wrapper endp
midiStreamPause_wrapper proc
jmp winmm_procs[85*8]
midiStreamPause_wrapper endp
midiStreamPosition_wrapper proc
jmp winmm_procs[86*8]
midiStreamPosition_wrapper endp
midiStreamProperty_wrapper proc
jmp winmm_procs[87*8]
midiStreamProperty_wrapper endp
midiStreamRestart_wrapper proc
jmp winmm_procs[88*8]
midiStreamRestart_wrapper endp
midiStreamStop_wrapper proc
jmp winmm_procs[89*8]
midiStreamStop_wrapper endp
mixerClose_wrapper proc
jmp winmm_procs[90*8]
mixerClose_wrapper endp
mixerGetControlDetailsA_wrapper proc
jmp winmm_procs[91*8]
mixerGetControlDetailsA_wrapper endp
mixerGetControlDetailsW_wrapper proc
jmp winmm_procs[92*8]
mixerGetControlDetailsW_wrapper endp
mixerGetDevCapsA_wrapper proc
jmp winmm_procs[93*8]
mixerGetDevCapsA_wrapper endp
mixerGetDevCapsW_wrapper proc
jmp winmm_procs[94*8]
mixerGetDevCapsW_wrapper endp
mixerGetID_wrapper proc
jmp winmm_procs[95*8]
mixerGetID_wrapper endp
mixerGetLineControlsA_wrapper proc
jmp winmm_procs[96*8]
mixerGetLineControlsA_wrapper endp
mixerGetLineControlsW_wrapper proc
jmp winmm_procs[97*8]
mixerGetLineControlsW_wrapper endp
mixerGetLineInfoA_wrapper proc
jmp winmm_procs[98*8]
mixerGetLineInfoA_wrapper endp
mixerGetLineInfoW_wrapper proc
jmp winmm_procs[99*8]
mixerGetLineInfoW_wrapper endp
mixerGetNumDevs_wrapper proc
jmp winmm_procs[100*8]
mixerGetNumDevs_wrapper endp
mixerMessage_wrapper proc
jmp winmm_procs[101*8]
mixerMessage_wrapper endp
mixerOpen_wrapper proc
jmp winmm_procs[102*8]
mixerOpen_wrapper endp
mixerSetControlDetails_wrapper proc
jmp winmm_procs[103*8]
mixerSetControlDetails_wrapper endp
mmDrvInstall_wrapper proc
jmp winmm_procs[104*8]
mmDrvInstall_wrapper endp
mmGetCurrentTask_wrapper proc
jmp winmm_procs[105*8]
mmGetCurrentTask_wrapper endp
mmTaskBlock_wrapper proc
jmp winmm_procs[106*8]
mmTaskBlock_wrapper endp
mmTaskCreate_wrapper proc
jmp winmm_procs[107*8]
mmTaskCreate_wrapper endp
mmTaskSignal_wrapper proc
jmp winmm_procs[108*8]
mmTaskSignal_wrapper endp
mmTaskYield_wrapper proc
jmp winmm_procs[109*8]
mmTaskYield_wrapper endp
mmioAdvance_wrapper proc
jmp winmm_procs[110*8]
mmioAdvance_wrapper endp
mmioAscend_wrapper proc
jmp winmm_procs[111*8]
mmioAscend_wrapper endp
mmioClose_wrapper proc
jmp winmm_procs[112*8]
mmioClose_wrapper endp
mmioCreateChunk_wrapper proc
jmp winmm_procs[113*8]
mmioCreateChunk_wrapper endp
mmioDescend_wrapper proc
jmp winmm_procs[114*8]
mmioDescend_wrapper endp
mmioFlush_wrapper proc
jmp winmm_procs[115*8]
mmioFlush_wrapper endp
mmioGetInfo_wrapper proc
jmp winmm_procs[116*8]
mmioGetInfo_wrapper endp
mmioInstallIOProcA_wrapper proc
jmp winmm_procs[117*8]
mmioInstallIOProcA_wrapper endp
mmioInstallIOProcW_wrapper proc
jmp winmm_procs[118*8]
mmioInstallIOProcW_wrapper endp
mmioOpenA_wrapper proc
jmp winmm_procs[119*8]
mmioOpenA_wrapper endp
mmioOpenW_wrapper proc
jmp winmm_procs[120*8]
mmioOpenW_wrapper endp
mmioRead_wrapper proc
jmp winmm_procs[121*8]
mmioRead_wrapper endp
mmioRenameA_wrapper proc
jmp winmm_procs[122*8]
mmioRenameA_wrapper endp
mmioRenameW_wrapper proc
jmp winmm_procs[123*8]
mmioRenameW_wrapper endp
mmioSeek_wrapper proc
jmp winmm_procs[124*8]
mmioSeek_wrapper endp
mmioSendMessage_wrapper proc
jmp winmm_procs[125*8]
mmioSendMessage_wrapper endp
mmioSetBuffer_wrapper proc
jmp winmm_procs[126*8]
mmioSetBuffer_wrapper endp
mmioSetInfo_wrapper proc
jmp winmm_procs[127*8]
mmioSetInfo_wrapper endp
mmioStringToFOURCCA_wrapper proc
jmp winmm_procs[128*8]
mmioStringToFOURCCA_wrapper endp
mmioStringToFOURCCW_wrapper proc
jmp winmm_procs[129*8]
mmioStringToFOURCCW_wrapper endp
mmioWrite_wrapper proc
jmp winmm_procs[130*8]
mmioWrite_wrapper endp
mmsystemGetVersion_wrapper proc
jmp winmm_procs[131*8]
mmsystemGetVersion_wrapper endp
sndPlaySoundA_wrapper proc
jmp winmm_procs[132*8]
sndPlaySoundA_wrapper endp
sndPlaySoundW_wrapper proc
jmp winmm_procs[133*8]
sndPlaySoundW_wrapper endp
timeBeginPeriod_wrapper proc
jmp winmm_procs[134*8]
timeBeginPeriod_wrapper endp
timeEndPeriod_wrapper proc
jmp winmm_procs[135*8]
timeEndPeriod_wrapper endp
timeGetDevCaps_wrapper proc
jmp winmm_procs[136*8]
timeGetDevCaps_wrapper endp
timeGetSystemTime_wrapper proc
jmp winmm_procs[137*8]
timeGetSystemTime_wrapper endp
timeGetTime_wrapper proc
jmp winmm_procs[138*8]
timeGetTime_wrapper endp
timeKillEvent_wrapper proc
jmp winmm_procs[139*8]
timeKillEvent_wrapper endp
timeSetEvent_wrapper proc
jmp winmm_procs[140*8]
timeSetEvent_wrapper endp
waveInAddBuffer_wrapper proc
jmp winmm_procs[141*8]
waveInAddBuffer_wrapper endp
waveInClose_wrapper proc
jmp winmm_procs[142*8]
waveInClose_wrapper endp
waveInGetDevCapsA_wrapper proc
jmp winmm_procs[143*8]
waveInGetDevCapsA_wrapper endp
waveInGetDevCapsW_wrapper proc
jmp winmm_procs[144*8]
waveInGetDevCapsW_wrapper endp
waveInGetErrorTextA_wrapper proc
jmp winmm_procs[145*8]
waveInGetErrorTextA_wrapper endp
waveInGetErrorTextW_wrapper proc
jmp winmm_procs[146*8]
waveInGetErrorTextW_wrapper endp
waveInGetID_wrapper proc
jmp winmm_procs[147*8]
waveInGetID_wrapper endp
waveInGetNumDevs_wrapper proc
jmp winmm_procs[148*8]
waveInGetNumDevs_wrapper endp
waveInGetPosition_wrapper proc
jmp winmm_procs[149*8]
waveInGetPosition_wrapper endp
waveInMessage_wrapper proc
jmp winmm_procs[150*8]
waveInMessage_wrapper endp
waveInOpen_wrapper proc
jmp winmm_procs[151*8]
waveInOpen_wrapper endp
waveInPrepareHeader_wrapper proc
jmp winmm_procs[152*8]
waveInPrepareHeader_wrapper endp
waveInReset_wrapper proc
jmp winmm_procs[153*8]
waveInReset_wrapper endp
waveInStart_wrapper proc
jmp winmm_procs[154*8]
waveInStart_wrapper endp
waveInStop_wrapper proc
jmp winmm_procs[155*8]
waveInStop_wrapper endp
waveInUnprepareHeader_wrapper proc
jmp winmm_procs[156*8]
waveInUnprepareHeader_wrapper endp
waveOutBreakLoop_wrapper proc
jmp winmm_procs[157*8]
waveOutBreakLoop_wrapper endp
waveOutClose_wrapper proc
jmp winmm_procs[158*8]
waveOutClose_wrapper endp
waveOutGetDevCapsA_wrapper proc
jmp winmm_procs[159*8]
waveOutGetDevCapsA_wrapper endp
waveOutGetDevCapsW_wrapper proc
jmp winmm_procs[160*8]
waveOutGetDevCapsW_wrapper endp
waveOutGetErrorTextA_wrapper proc
jmp winmm_procs[161*8]
waveOutGetErrorTextA_wrapper endp
waveOutGetErrorTextW_wrapper proc
jmp winmm_procs[162*8]
waveOutGetErrorTextW_wrapper endp
waveOutGetID_wrapper proc
jmp winmm_procs[163*8]
waveOutGetID_wrapper endp
waveOutGetNumDevs_wrapper proc
jmp winmm_procs[164*8]
waveOutGetNumDevs_wrapper endp
waveOutGetPitch_wrapper proc
jmp winmm_procs[165*8]
waveOutGetPitch_wrapper endp
waveOutGetPlaybackRate_wrapper proc
jmp winmm_procs[166*8]
waveOutGetPlaybackRate_wrapper endp
waveOutGetPosition_wrapper proc
jmp winmm_procs[167*8]
waveOutGetPosition_wrapper endp
waveOutGetVolume_wrapper proc
jmp winmm_procs[168*8]
waveOutGetVolume_wrapper endp
waveOutMessage_wrapper proc
jmp winmm_procs[169*8]
waveOutMessage_wrapper endp
waveOutOpen_wrapper proc
jmp winmm_procs[170*8]
waveOutOpen_wrapper endp
waveOutPause_wrapper proc
jmp winmm_procs[171*8]
waveOutPause_wrapper endp
waveOutPrepareHeader_wrapper proc
jmp winmm_procs[172*8]
waveOutPrepareHeader_wrapper endp
waveOutReset_wrapper proc
jmp winmm_procs[173*8]
waveOutReset_wrapper endp
waveOutRestart_wrapper proc
jmp winmm_procs[174*8]
waveOutRestart_wrapper endp
waveOutSetPitch_wrapper proc
jmp winmm_procs[175*8]
waveOutSetPitch_wrapper endp
waveOutSetPlaybackRate_wrapper proc
jmp winmm_procs[176*8]
waveOutSetPlaybackRate_wrapper endp
waveOutSetVolume_wrapper proc
jmp winmm_procs[177*8]
waveOutSetVolume_wrapper endp
waveOutUnprepareHeader_wrapper proc
jmp winmm_procs[178*8]
waveOutUnprepareHeader_wrapper endp
waveOutWrite_wrapper proc
jmp winmm_procs[179*8]
waveOutWrite_wrapper endp
ExportByOrdinal2 proc
jmp winmm_procs[180*8]
ExportByOrdinal2 endp
end
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48.log_21829_1496.asm | ljhsiun2/medusa | 9 | 176589 | <filename>Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48.log_21829_1496.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x71c4, %r10
nop
nop
nop
nop
nop
add $5832, %r13
mov $0x6162636465666768, %rcx
movq %rcx, %xmm0
vmovups %ymm0, (%r10)
nop
nop
nop
nop
nop
add $51115, %rdx
lea addresses_WC_ht+0x17b44, %r9
and $61486, %rax
mov $0x6162636465666768, %r10
movq %r10, %xmm0
vmovups %ymm0, (%r9)
nop
nop
nop
nop
nop
and %r9, %r9
lea addresses_A_ht+0xff44, %rdx
clflush (%rdx)
nop
nop
nop
and $36660, %r14
movb (%rdx), %al
nop
nop
nop
nop
cmp %r13, %r13
lea addresses_WC_ht+0x79c4, %rcx
nop
xor %r10, %r10
mov $0x6162636465666768, %rax
movq %rax, %xmm4
movups %xmm4, (%rcx)
add %r9, %r9
lea addresses_A_ht+0x31c4, %rsi
lea addresses_UC_ht+0xeb84, %rdi
nop
nop
cmp %r10, %r10
mov $126, %rcx
rep movsw
and %r13, %r13
lea addresses_A_ht+0x10ca4, %rdx
nop
nop
xor %r9, %r9
mov (%rdx), %r10w
cmp $9026, %rsi
lea addresses_D_ht+0xfdc4, %rsi
lea addresses_normal_ht+0xf31c, %rdi
and $5389, %rax
mov $42, %rcx
rep movsq
nop
nop
nop
nop
nop
add $5654, %r9
lea addresses_D_ht+0x148f7, %rsi
nop
nop
nop
nop
add %r14, %r14
mov $0x6162636465666768, %rcx
movq %rcx, %xmm3
vmovups %ymm3, (%rsi)
nop
nop
nop
nop
xor $26335, %r9
lea addresses_WT_ht+0x14484, %rdi
nop
nop
nop
nop
nop
xor %r14, %r14
mov $0x6162636465666768, %rdx
movq %rdx, %xmm0
movups %xmm0, (%rdi)
nop
nop
nop
nop
sub $44728, %r10
lea addresses_D_ht+0x1304, %rdx
dec %rsi
movb $0x61, (%rdx)
nop
nop
nop
nop
sub $49935, %rdi
lea addresses_WC_ht+0x659c, %r13
nop
nop
nop
nop
add %r10, %r10
mov $0x6162636465666768, %rsi
movq %rsi, %xmm0
movups %xmm0, (%r13)
nop
add %r14, %r14
lea addresses_UC_ht+0x1a5c4, %rsi
lea addresses_UC_ht+0xe504, %rdi
clflush (%rdi)
nop
add $31879, %rdx
mov $99, %rcx
rep movsq
nop
nop
nop
nop
nop
inc %r14
lea addresses_normal_ht+0x1c988, %rdi
nop
nop
sub %r9, %r9
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
and $0xffffffffffffffc0, %rdi
movaps %xmm4, (%rdi)
nop
dec %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %rbp
push %rbx
push %rcx
push %rsi
// Load
lea addresses_UC+0x1704, %rbx
nop
nop
nop
dec %r10
mov (%rbx), %rsi
nop
nop
nop
nop
nop
sub %rbp, %rbp
// Store
lea addresses_normal+0xdb3e, %rbp
clflush (%rbp)
nop
nop
nop
nop
and %r14, %r14
mov $0x5152535455565758, %rsi
movq %rsi, %xmm3
vmovups %ymm3, (%rbp)
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %rbx
nop
dec %r14
// Store
lea addresses_A+0x189c4, %r14
nop
nop
nop
sub $1340, %rsi
mov $0x5152535455565758, %r13
movq %r13, %xmm3
movups %xmm3, (%r14)
// Exception!!!
nop
nop
nop
mov (0), %rsi
nop
nop
nop
add $46312, %r10
// Load
lea addresses_normal+0x19bb8, %rbp
nop
nop
nop
nop
xor %r13, %r13
mov (%rbp), %r14
nop
nop
nop
and %rcx, %rcx
// Store
lea addresses_WT+0x13244, %rbx
nop
nop
nop
nop
nop
xor %r14, %r14
movb $0x51, (%rbx)
nop
nop
nop
and $30079, %r10
// Faulty Load
mov $0x5e535000000001c4, %rbp
cmp $7809, %rsi
mov (%rbp), %ebx
lea oracles, %r14
and $0xff, %rbx
shlq $12, %rbx
mov (%r14,%rbx,1), %rbx
pop %rsi
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 1, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 8, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': True, 'congruent': 2, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 7, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
software/hal/hpl/STM32/drivers/debug_stm32f4/stm32-dwt.adb | TUM-EI-RCS/StratoX | 12 | 20580 | <reponame>TUM-EI-RCS/StratoX
-- Data Watchpoint and Trace (DWT) Unit
-- Gives access to cycle counter.
with STM32.Debug; use STM32.Debug;
package body STM32.DWT is
------------
-- Enable --
------------
procedure Enable is
begin
Core_Debug.DEMCR.TRCENA := True;
end Enable;
------------
-- Disable --
------------
procedure Disable is
begin
Core_Debug.DEMCR.TRCENA := False;
end Disable;
--------------------------
-- Enable_Cycle_Counter --
--------------------------
procedure Enable_Cycle_Counter is
begin
Enable;
Core_DWT.DWT_CYCCNT := 0;
Core_DWT.DWT_CTRL.CYCCNTENA := True;
end Enable_Cycle_Counter;
---------------------------
-- Disable_Cycle_Counter --
---------------------------
procedure Disable_Cycle_Counter is
begin
Core_DWT.DWT_CTRL.CYCCNTENA := False;
end Disable_Cycle_Counter;
--------------------------
-- Enable_Sleep_Counter --
--------------------------
procedure Enable_Sleep_Counter is
begin
Enable;
Core_DWT.DWT_SLEEPCNT := 0;
Core_DWT.DWT_CTRL.SLEEPEVTENA := True;
end Enable_Sleep_Counter;
---------------------------
-- Disable_Sleep_Counter --
---------------------------
procedure Disable_Sleep_Counter is
begin
Core_DWT.DWT_CTRL.SLEEPEVTENA := False;
end Disable_Sleep_Counter;
------------------------
-- Read_Cycle_Counter --
------------------------
function Read_Cycle_Counter return Unsigned_32 is
(Unsigned_32 (Core_DWT.DWT_CYCCNT));
------------------------
-- Read_Sleep_Counter --
------------------------
function Read_Sleep_Counter return Unsigned_8 is
(Unsigned_8 (Core_DWT.DWT_SLEEPCNT));
end STM32.DWT;
|
srcs/data/pqueue.asm | gamozolabs/falkervisor_beta | 69 | 27386 | <filename>srcs/data/pqueue.asm
[bits 64]
; rcx -> ID of spinlock to acquire
acquire_spinlock:
push rbx
; Acquire a lock
mov rbx, 1
lock xadd qword [fs:globals.spinlocks_lock + rcx*8], rbx
; Spin until we're the chosen one
.spin:
pause
cmp rbx, qword [fs:globals.spinlocks_release + rcx*8]
jne short .spin
pop rbx
ret
; rcx -> ID of spinlock to release
release_spinlock:
; Release the lock
inc qword [fs:globals.spinlocks_release + rcx*8]
ret
; rbx -> Array of pointers to sort (based on element)
; rcx -> Number of elements in the array
; rdx -> Index of 64-bit signed value to sort by in the pointer
heapsort:
push rcx
push rsi
push rdi
push r8
push r9
call heapify
; end := count - 1
dec rcx
.lewp:
; while end > 0
cmp rcx, 0
jle short .end
; swap(a[end], a[0])
mov r8, qword [rbx + rcx*8]
mov r9, qword [rbx]
mov qword [rbx + rcx*8], r9
mov qword [rbx], r8
dec rcx
mov rsi, 0
mov rdi, rcx
call siftdown
jmp short .lewp
.end:
pop r9
pop r8
pop rdi
pop rsi
pop rcx
ret
; rbx -> Array of pointers to sort (based on element)
; rcx -> Number of elements in the array
; rdx -> Byte index of 64-bit value to sort by in the pointer
heapify:
push rsi
push rdi
; start <- floor((count - 2) / 2)
mov rsi, rcx
sub rsi, 2
shr rsi, 1
; end <- count - 1
mov rdi, rcx
dec rdi
.lewp:
cmp rsi, 0
jl short .end
call siftdown
dec rsi
jmp short .lewp
.end:
pop rdi
pop rsi
ret
; rbx -> Array of pointers to sort (based on element)
; rdx -> Byte index of 64-bit value to sort by in the pointer
; rsi -> 'start'
; rdi -> 'end'
siftdown:
push rsi
push rbp
push r8
push r9
push r10
push r11
.lewp:
; rbp := start * 2 + 1
mov rbp, rsi
shl rbp, 1
add rbp, 1
cmp rbp, rdi
jg short .end
mov r10, rsi
; rbp - child
; rsi - root
; r10 - swap
; r11 - child + 1
mov r8, qword [rbx + r10*8]
mov r8, qword [r8 + rdx]
mov r9, qword [rbx + rbp*8]
; if a[swap] < a[child]
; swap := child
cmp r8, qword [r9 + rdx]
jnl short .no_chillins
; swap := child
mov r10, rbp
.no_chillins:
; child + 1
mov r11, rbp
inc r11
cmp r11, rdi
jg short .right_child_is_not_greater
mov r8, qword [rbx + r10*8]
mov r8, qword [r8 + rdx]
mov r9, qword [rbx + r11*8]
cmp r8, qword [r9 + rdx]
jnl short .right_child_is_not_greater
; swap := child + 1
mov r10, r11
.right_child_is_not_greater:
; if swap == root: return
cmp r10, rsi
je short .end
; swap(root, swap)
mov r8, qword [rbx + rsi*8]
mov r9, qword [rbx + r10*8]
mov qword [rbx + rsi*8], r9
mov qword [rbx + r10*8], r8
; root = swap
mov rsi, r10
jmp short .lewp
.end:
pop r11
pop r10
pop r9
pop r8
pop rbp
pop rsi
ret
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3906c.ada | best08618/asylo | 7 | 6174 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3906c.ada
-- CE3906C.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT PUT FOR ENUMERATION TYPES OUTPUTS THE ENUMERATION
-- LITERAL WITH NO TRAILING OR PRECEDING BLANKS WHEN WIDTH IS
-- NOT SPECIFIED OR IS SPECIFIED TO BE LESS THAN OR EQUAL TO THE
-- LENGTH OF THE STRING. CHECK THAT WHEN WIDTH IS SPECIFIED TO
-- BE GREATER THAN THE LENGTH OF THE STRING, TRAILING BLANKS ARE
-- OUTPUT.
-- APPLICABILITY CRITERIA:
-- THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH SUPPORT
-- TEXT FILES.
-- HISTORY:
-- SPS 10/08/82
-- SPS 01/03/83
-- VKG 01/07/83
-- JBG 02/22/84 CHANGED TO .ADA TEST.
-- TBN 11/10/86 REVISED TEST TO OUTPUT A NON_APPLICABLE
-- RESULT WHEN FILES ARE NOT SUPPORTED.
-- DWC 09/18/87 REMOVED CALL TO CHECKFILE. CLOSED AND REOPENED
-- FILE AND CHECKED CONTENTS OF FILE USING
-- ENUMERATION_IO GETS.
WITH REPORT;
USE REPORT;
WITH TEXT_IO;
USE TEXT_IO;
PROCEDURE CE3906C IS
INCOMPLETE : EXCEPTION;
BEGIN
TEST ("CE3906C", "CHECK THAT ENUMERATION_IO PUT OUTPUTS " &
"ENUMERATION LITERALS CORRECTLY WITH AND " &
"WITHOUT WIDTH PARAMETERS");
DECLARE
FT : FILE_TYPE;
TYPE MOOD IS (ANGRY, HAPPY, BORED, SAD);
X : MOOD := BORED;
PACKAGE MOOD_IO IS NEW ENUMERATION_IO (MOOD);
CH : CHARACTER;
USE MOOD_IO;
BEGIN
BEGIN
CREATE (FT, OUT_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED; TEXT CREATE " &
"WITH OUT_FILE MODE");
RAISE INCOMPLETE;
WHEN NAME_ERROR =>
NOT_APPLICABLE ("NAME_ERROR RAISED; TEXT CREATE " &
"WITH OUT_FILE MODE");
RAISE INCOMPLETE;
END;
DEFAULT_WIDTH := FIELD(IDENT_INT(5));
IF DEFAULT_WIDTH /= FIELD(IDENT_INT(5)) THEN
FAILED ("DEFAULT_WIDTH NOT SET CORRECTLY");
END IF;
PUT (FT, X, 3); -- BORED
X := HAPPY;
NEW_LINE(FT);
PUT (FILE => FT, ITEM => X, WIDTH => 5); -- HAPPY
NEW_LINE (FT);
PUT (FT, SAD, 5); -- SAD
DEFAULT_WIDTH := FIELD(IDENT_INT(6));
PUT (FT, X); -- HAPPY
PUT (FT, SAD, 3); -- SAD
NEW_LINE(FT);
DEFAULT_WIDTH := FIELD(IDENT_INT(2));
PUT (FT, SAD); -- SAD
CLOSE (FT);
BEGIN
OPEN (FT, IN_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED; TEXT OPEN FOR " &
"IN_FILE MODE");
RAISE INCOMPLETE;
END;
GET (FT, X);
IF X /= BORED THEN
FAILED ("BORED NOT READ CORRECTLY");
END IF;
GET (FT, X);
IF X /= HAPPY THEN
FAILED ("HAPPY NOT READ CORRECTLY - 1");
END IF;
SKIP_LINE (FT);
GET (FT, X);
IF X /= SAD THEN
FAILED ("SAD NOT READ CORRECTLY - 1");
END IF;
GET (FT, CH);
IF CH /= ' ' THEN
FAILED ("BLANKS NOT POSITIONED CORRECTLY - 1");
END IF;
GET (FT, CH);
IF CH /= ' ' THEN
FAILED ("BLANKS NOT POSITIONED CORRECTLY - 2");
END IF;
GET (FT, X);
IF X /= HAPPY THEN
FAILED ("HAPPY NOT READ CORRECTLY - 2");
END IF;
GET (FT, CH);
IF CH /= ' ' THEN
FAILED ("BLANKS NOT POSITIONED CORRECTLY - 3");
END IF;
GET (FT, X);
IF X /= SAD THEN
FAILED ("SAD NOT READ CORRECTLY - 2");
END IF;
SKIP_LINE (FT);
GET (FT, X);
IF X /= SAD THEN
FAILED ("SAD NOT READ CORRECTLY - 3");
END IF;
BEGIN
DELETE (FT);
EXCEPTION
WHEN USE_ERROR =>
NULL;
END;
EXCEPTION
WHEN INCOMPLETE =>
NULL;
END;
RESULT;
END CE3906C;
|
alloy4fun_models/trashltl/models/9/AKaF6n2H2BgqyLrR3.als | Kaixi26/org.alloytools.alloy | 0 | 3364 | open main
pred idAKaF6n2H2BgqyLrR3_prop10 {
always Protected = Protected
}
pred __repair { idAKaF6n2H2BgqyLrR3_prop10 }
check __repair { idAKaF6n2H2BgqyLrR3_prop10 <=> prop10o } |
bootloader/bootloader.asm | rojamet/os_0t1 | 0 | 161021 | <reponame>rojamet/os_0t1
; bootloader.asm
; simple bootloader
org 0x7c00
bits 16
start: jmp boot
;; Constants and variable definitions
msg db "Welcome to My Operating System!", 0ah, 0h
msg2 db "This is a breaking line", 0ah, 0h
boot:
cli ; no interrupts
cld ; all that we need to init
call InitCursor
mov si, msg
call Print
mov si, msg2
call Print
hlt ; halt the system
; 512 bytes, clear the rest
; Variables
_CurX db 0
_CurY db 0
InitCursor:
mov bh, 0
mov ah, 3
int 10h
mov [_CurX], dl
mov [_CurY], dh
ret
;**************************************************;
; MovCur ()
; - Moves the cursor on the screen
; dh = Y coordinate
; dl = X coordinate
;**************************************************;
MovCur:
mov bh, 0
mov ah, 2
int 10h
mov [_CurX], dl
mov [_CurY], dh
ret
;**************************************************;
; PutChar ()
; - Prints a character to screen
; AL = Character to print
; BL = text color
; CX = number of times character is display
;**************************************************;
PutChar:
cmp al, 0ah ; if al == '\n'
je lf
mov bh, 0
mov ah, 0ah
int 10h
add [_CurX], cx
mov dl, [_CurX]
mov dh, [_CurY]
call MovCur
ret
lf: ; life feed
mov bh, 0
mov ah, 3
add dh, 1
mov dl, 0
call MovCur
;add [_CurY], cx
;mov cx, 0
;mov [_CurX], cx
;mov dl, [_CurX]
;mov dh, [_CurY]
;call MovCur
ret
;***************************************;
; Prints a string
; DS:SI: 0 terminated string
;***************************************;
Print:
.loop:
lodsb ; load next byte from string from SI to AL
or al, al ; Does AL=0?
jz .done ; Yep, null terminator found-bail out
mov cx, 1
call PutChar
jmp .loop ; Repeat until null terminator found
.done:
ret ; we are done, so return
times 510 - ($-$$) db 0
dw 0xAA55 ; Boot signature
|
data/pokemon/base_stats/pinsir.asm | opiter09/ASM-Machina | 1 | 15423 | db DEX_PINSIR ; pokedex id
db 65, 125, 100, 85, 55
; hp atk def spd spc
db BUG, BUG ; type
db 45 ; catch rate
db 200 ; base exp
INCBIN "gfx/pokemon/front/pinsir.pic", 0, 1 ; sprite dimensions
dw PinsirPicFront, PinsirPicBack
db VICEGRIP, NO_MOVE, NO_MOVE, NO_MOVE ; level 1 learnset
db GROWTH_SLOW ; growth rate
; tm/hm learnset
tmhm SWORDS_DANCE, TOXIC, BODY_SLAM, TAKE_DOWN, DOUBLE_EDGE, \
HYPER_BEAM, SUBMISSION, SEISMIC_TOSS, RAGE, MIMIC, \
DOUBLE_TEAM, BIDE, REST, SUBSTITUTE, CUT, \
STRENGTH
; end
db 0 ; padding
|
test/succeed/InstanceGuessesMeta.agda | larrytheliquid/agda | 0 | 13071 | -- Andreas, 2012-01-10
-- {-# OPTIONS -v tc.constr.findInScope:50 #-}
module InstanceGuessesMeta where
data Bool : Set where
true false : Bool
postulate
D : Bool -> Set
E : Bool -> Set
d : {x : Bool} -> D x
f : {x : Bool}{{ dx : D x }} -> E x
b : E true
b = f -- should succeed
-- Agda is now allowed to solve hidden x in type of d by unification,
-- when searching for inhabitant of D x
|
src/render-shaders.adb | docandrew/troodon | 5 | 20103 | <reponame>docandrew/troodon
with Ada.Text_IO;
with Ada.Exceptions; use Ada.Exceptions;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with System;
with System.Address_Image;
with GL;
with GLext;
with Render;
package body Render.Shaders is
type Symbol is (USELESS) with Size => 64;
---------------------------------------------------------------------------
-- detectShaderVersion
---------------------------------------------------------------------------
procedure detectShaderVersion is
use Interfaces.C.Strings;
glVerMajor : aliased GL.GLint;
glVerMinor : aliased GL.GLint;
begin
Ada.Text_IO.Put_Line ("Troodon: (Shaders) Checking OpenGL and GLSL versions.");
-- Check OpenGL version in use. If it's not high enough, we can't even
-- bother detecting the GLSL version
GL.glGetIntegerv (GLext.GL_MAJOR_VERSION, glVerMajor'Access);
GL.glGetIntegerv (GLext.GL_MINOR_VERSION, glVerMinor'Access);
Ada.Text_IO.Put_Line ("Troodon: (Shaders) Detected OpenGL version" & glVerMajor'Image & "." & glVerMinor'Image);
if glVerMajor <= 2 then
raise ShaderException with "Detected ancient version of OpenGL, too old to " &
"run Troodon. Please upgrade your video drivers or Mesa, or turn on direct rendering " &
"by setting the environment variable LIBGL_ALWAYS_INDIRECT to 0";
end if;
declare
slVerChars : Interfaces.C.Strings.chars_ptr := GL.glGetString (GLext.GL_SHADING_LANGUAGE_VERSION);
begin
if slVerChars = Interfaces.C.Strings.Null_Ptr then
raise ShaderException with "Troodon: (Shaders) Unable to detect GL Shader Language version available. " &
"You may need to upgrade your video drivers, upgrade Mesa, or turn on direct rendering " &
"by setting the environment variable LIBGL_ALWAYS_INDIRECT to 0";
end if;
-- Check GLSL version in use
declare
slVerStr : String := Interfaces.C.Strings.Value (slVerChars);
slMajorVer : Natural := Natural'Value (slVerStr(1..1));
slMinorVer : Natural := Natural'Value (slVerStr(3..3));
begin
Ada.Text_IO.Put_Line ("Detected GLSL version " & slVerStr);
-- Need GLSL 1.3 or better
if slMajorVer <= 1 and slMinorVer < 3 then
raise ShaderException with "Your OpenGL version does not support the shader language version Troodon needs. " &
"You may need to upgrade your video drivers, upgrade Mesa, or turn on direct rendering " &
"by setting the environment variable LIBGL_ALWAYS_INDIRECT to 0";
end if;
end;
end;
end detectShaderVersion;
---------------------------------------------------------------------------
-- printShaderErrors
---------------------------------------------------------------------------
procedure printShaderErrors (obj : GL.GLUint) is
logLen : aliased GL.GLint;
begin
if GLext.glIsShader (obj) = GL.GL_TRUE then
GLext.glGetShaderiv (obj, GLext.GL_INFO_LOG_LENGTH, logLen'Access);
elsif GLext.glIsProgram (obj) = GL.GL_TRUE then
GLext.glGetProgramiv (obj, GLext.GL_INFO_LOG_LENGTH, logLen'Access);
else
Ada.Text_IO.Put_Line ("Troodon: attempted to print errors of a non-shader and non-program GL object");
return;
end if;
if logLen = 0 then
raise Program_Error with "Attempted to print shader/program errors, but no info log present.";
end if;
declare
log : Interfaces.C.char_array(1 .. size_t(logLen));
begin
if GLext.glIsShader (obj) = GL.GL_TRUE then
GLext.glGetShaderInfoLog (shader => obj,
bufSize => logLen,
length => null,
infoLog => log);
else
GLext.glGetProgramInfoLog (program => obj,
bufSize => logLen,
length => null,
infoLog => log);
end if;
Ada.Text_IO.Put_Line (Interfaces.C.To_Ada (log));
end;
end printShaderErrors;
---------------------------------------------------------------------------
-- createShaderProgram
-- Given the addresses of vertex shader and fragment shader source code,
-- and their respective sizes, compile and link these shaders into a shader
-- program. Note that until there's a drawable window, this will fail.
---------------------------------------------------------------------------
function createShaderProgram (vertSource : System.Address;
vertSize : Interfaces.C.size_t;
fragSource : System.Address;
fragSize : Interfaces.C.size_t) return GL.GLuint is
use ASCII;
vertShaderChars : aliased constant Interfaces.C.char_array(1..vertSize) with
Import, Address => vertSource;
fragShaderChars : aliased constant Interfaces.C.char_array(1..fragSize) with
Import, Address => fragSource;
-- Just for printing to console
vertShaderStr : String := To_Ada (vertShaderChars, True);
fragShaderStr : String := To_Ada (fragShaderChars, True);
vertShader : GL.GLuint := GLext.glCreateShader (GLext.GL_VERTEX_SHADER);
fragShader : GL.GLuint := GLext.glCreateShader (GLext.GL_FRAGMENT_SHADER);
-- Needed for compatibility w/ glShaderSource
vertShaderArr : GLext.SourceArray := (1 => vertSource);
fragShaderArr : GLext.SourceArray := (1 => fragSource);
glErr : GL.GLuint;
compileStatus : aliased GL.GLint := GL.GL_FALSE;
linkStatus : aliased GL.GLint := GL.GL_FALSE;
prog : GL.GLuint := 0;
begin
-- Ada.Text_IO.Put_Line (" Vert Shader Size: " & vertSize'Image);
-- Ada.Text_IO.Put_Line (" Vert Shader Addr: " & System.Address_Image(vertSource));
-- Ada.Text_IO.Put_Line (" Loaded Vertex Shader: " & LF & vertShaderStr & LF);
-- Ada.Text_IO.Put_Line (" Frag Shader Size: " & fragSize'Image);
-- Ada.Text_IO.Put_Line (" Frag Shader Addr: " & System.Address_Image(fragSource));
-- Ada.Text_IO.Put_Line (" Loaded Fragment Shader: " & LF & fragShaderStr & LF);
-- Set up Font shaders
-- Easier to call multiple times than set up an array of C strings in Ada
GLext.glShaderSource (shader => vertShader,
count => 1,
string => vertShaderArr,
length => null);
GLext.glShaderSource (shader => fragShader,
count => 1,
string => fragShaderArr,
length => null);
-- Compile shaders
Ada.Text_IO.Put_Line (" Compiling Vertex Shader");
GLext.glCompileShader (vertShader);
GLext.glGetShaderiv (vertShader, GLext.GL_COMPILE_STATUS, compileStatus'Access);
if compileStatus /= GL.GL_TRUE then
Ada.Text_IO.Put_Line ("Troodon: vertex shader compile error, status: " & compileStatus'Image);
printShaderErrors (vertShader);
end if;
Ada.Text_IO.Put_Line (" Compiling Fragment Shader");
GLext.glCompileShader (fragShader);
GLext.glGetShaderiv (fragShader, GLext.GL_COMPILE_STATUS, compileStatus'Access);
if compileStatus /= GL.GL_TRUE then
Ada.Text_IO.Put_Line ("Troodon: fragment shader compile error, status: " & compileStatus'Image);
printShaderErrors (fragShader);
end if;
Ada.Text_IO.Put_Line (" Creating Shader Program");
prog := GLext.glCreateProgram;
if prog = 0 then
glErr := GL.glGetError;
return 0;
end if;
-- Attach shaders to program
Ada.Text_IO.Put_Line (" Attaching Shaders");
GLext.glAttachShader (prog, vertShader);
GLext.glAttachShader (prog, fragShader);
-- Link the program
Ada.Text_IO.Put_Line (" Linking Shader Program");
GLext.glLinkProgram (prog);
GLext.glGetProgramiv (prog, GLext.GL_LINK_STATUS, linkStatus'Access);
if linkStatus /= GL.GL_TRUE then
Ada.Text_IO.Put_Line (" Shader link error, status: " & linkStatus'Image);
printShaderErrors (prog);
return 0;
end if;
GLext.glDeleteShader (vertShader);
GLext.glDeleteShader (fragShader);
return prog;
end createShaderProgram;
---------------------------------------------------------------------------
-- initTextShaders
---------------------------------------------------------------------------
procedure initTextShaders is
use ASCII;
use Interfaces.C;
---------------------------------------------------------------------------
-- Text Vertex Shader
---------------------------------------------------------------------------
text_vertex_shader_start : Symbol with Import;
text_vertex_shader_end : Symbol with Import;
text_vertex_shader_size : Symbol with Import;
textVertexShaderSize : Interfaces.C.size_t with
Import, Address => text_vertex_shader_size'Address;
---------------------------------------------------------------------------
-- Text Fragment Shader
---------------------------------------------------------------------------
text_fragment_shader_start : Symbol with Import;
text_fragment_shader_end : Symbol with Import;
text_fragment_shader_size : Symbol with Import;
textFragmentShaderSize : Interfaces.C.size_t with
Import, Address => text_fragment_shader_size'Address;
begin
-- Ada.Text_IO.Put_Line ("text vert shader size: " & textVertexShaderSize'Image);
-- Ada.Text_IO.Put_Line ("text vert shader addr: " & System.Address_Image(text_vertex_shader_start'Address));
-- Ada.Text_IO.Put_Line ("text frag shader size: " & textFragmentShaderSize'Image);
-- Ada.Text_IO.Put_Line ("text frag shader addr: " & System.Address_Image(text_fragment_shader_start'Address));
textShaderProg := createShaderProgram (vertSource => text_vertex_shader_start'Address,
vertSize => textVertexShaderSize,
fragSource => text_fragment_shader_start'Address,
fragSize => textFragmentShaderSize);
if textShaderProg = 0 then
raise ShaderException with "Unable to load text shaders";
end if;
Ada.Text_IO.Put_Line ("Troodon: Loaded Text Shaders");
-- Get the uniform and attribs from our shaders
textAttribCoord := GLext.glGetAttribLocation (program => textShaderProg,
name => Interfaces.C.To_C ("coord"));
textUniformTex := GLext.glGetUniformLocation (program => textShaderProg,
name => Interfaces.C.To_C ("tex"));
textUniformColor := GLext.glGetUniformLocation (program => textShaderProg,
name => Interfaces.C.To_C ("color"));
textUniformOrtho := GLext.glGetUniformLocation (program => textShaderProg,
name => Interfaces.C.To_C ("ortho"));
textUniformAOnly := GLext.glGetUniformLocation (program => textShaderProg,
name => Interfaces.C.To_C ("alphaOnly"));
if textAttribCoord = -1 or
textUniformTex = -1 or
textUniformColor = -1 or
textUniformOrtho = -1 or
textUniformAOnly = -1 then
raise ShaderException with "Unable to get shader variables from text program.";
end if;
end initTextShaders;
---------------------------------------------------------------------------
-- initCircleShaders
---------------------------------------------------------------------------
procedure initCircleShaders is
---------------------------------------------------------------------------
-- Circle Vertex Shader
---------------------------------------------------------------------------
circle_vertex_shader_start : Symbol with Import;
circle_vertex_shader_end : Symbol with Import;
circle_vertex_shader_size : Symbol with Import;
circleVertexShaderSize : Interfaces.C.size_t with
Import, Address => circle_vertex_shader_size'Address;
---------------------------------------------------------------------------
-- Circle Fragment Shader
---------------------------------------------------------------------------
circle_fragment_shader_start : Symbol with Import;
circle_fragment_shader_end : Symbol with Import;
circle_fragment_shader_size : Symbol with Import;
circleFragmentShaderSize : Interfaces.C.size_t with
Import, Address => circle_fragment_shader_size'Address;
begin
circleShaderProg := createShaderProgram (vertSource => circle_vertex_shader_start'Address,
vertSize => circleVertexShaderSize,
fragSource => circle_fragment_shader_start'Address,
fragSize => circleFragmentShaderSize);
if circleShaderProg = 0 then
raise ShaderException with "Unable to load circle shaders";
end if;
Ada.Text_IO.Put_Line("Troodon: Loaded Circle Shaders");
-- Get the uniform and attribs from our shaders
circleAttribCoord := GLext.glGetAttribLocation (program => circleShaderProg,
name => Interfaces.C.To_C ("coord"));
circleUniformColor := GLext.glGetUniformLocation (program => circleShaderProg,
name => Interfaces.C.To_C ("color"));
circleUniformCenter := GLext.glGetUniformLocation (program => circleShaderProg,
name => Interfaces.C.To_C ("center"));
circleUniformRadius := GLext.glGetUniformLocation (program => circleShaderProg,
name => Interfaces.C.To_C ("radius"));
circleUniformOrtho := GLext.glGetUniformLocation (program => circleShaderProg,
name => Interfaces.C.To_C ("ortho"));
circleUniformScrH := GLext.glGetUniformLocation (program => circleShaderProg,
name => Interfaces.C.To_C ("screenHeight"));
if circleAttribCoord = -1 or
circleUniformColor = -1 or
circleUniformCenter = -1 or
circleUniformRadius = -1 or
circleUniformOrtho = -1 or
circleUniformScrH = -1 then
raise ShaderException with "Unable to get shader variables from circle program.";
end if;
end initCircleShaders;
---------------------------------------------------------------------------
-- initLineShaders
---------------------------------------------------------------------------
procedure initLineShaders is
line_vertex_shader_start : Symbol with Import;
line_vertex_shader_end : Symbol with Import;
line_vertex_shader_size : Symbol with Import;
lineVertexShaderSize : Interfaces.C.size_t with
Import, Address => line_vertex_shader_size'Address;
line_fragment_shader_start : Symbol with Import;
line_fragment_shader_end : Symbol with Import;
line_fragment_shader_size : Symbol with Import;
lineFragmentShaderSize : Interfaces.C.size_t with
Import, Address => line_fragment_shader_size'Address;
begin
lineShaderProg := createShaderProgram (vertSource => line_vertex_shader_start'Address,
vertSize => lineVertexShaderSize,
fragSource => line_fragment_shader_start'Address,
fragSize => lineFragmentShaderSize);
if lineShaderProg = 0 then
raise ShaderException with "Unable to load line shaders";
end if;
Ada.Text_IO.Put_Line("Troodon: Loaded Line Shaders");
lineAttribCoord := GLext.glGetAttribLocation (program => lineShaderProg,
name => Interfaces.C.To_C ("coord"));
lineUniformOrtho := GLext.glGetUniformLocation (program => lineShaderProg,
name => Interfaces.C.To_C ("ortho"));
lineUniformFrom := GLext.glGetUniformLocation (program => lineShaderProg,
name => Interfaces.C.To_C ("lineFrom"));
lineUniformTo := GLext.glGetUniformLocation (program => lineShaderProg,
name => Interfaces.C.To_C ("lineTo"));
lineUniformWidth := GLext.glGetUniformLocation (program => lineShaderProg,
name => Interfaces.C.To_C ("width"));
lineUniformColor := GLext.glGetUniformLocation (program => lineShaderProg,
name => Interfaces.C.To_C ("color"));
lineUniformScrH := GLext.glGetUniformLocation (program => lineShaderProg,
name => Interfaces.C.To_C ("screenHeight"));
lineUniformAA := GLext.glGetUniformLocation (program => lineShaderProg,
name => Interfaces.C.To_C ("antiAliased"));
if lineAttribCoord = -1 or
lineUniformOrtho = -1 or
lineUniformFrom = -1 or
lineUniformTo = -1 or
lineUniformWidth = -1 or
lineUniformColor = -1 or
lineUniformScrH = -1 or
lineUniformAA = -1 then
raise ShaderException with "Unable to get shader variables from line program.";
end if;
end initLineShaders;
---------------------------------------------------------------------------
-- initWinShaders
---------------------------------------------------------------------------
procedure initWinShaders is
win_vertex_shader_start : Symbol with Import;
win_vertex_shader_end : Symbol with Import;
win_vertex_shader_size : Symbol with Import;
winVertexShaderSize : Interfaces.C.size_t with
Import, Address => win_vertex_shader_size'Address;
win_fragment_shader_start : Symbol with Import;
win_fragment_shader_end : Symbol with Import;
win_fragment_shader_size : Symbol with Import;
winFragmentShaderSize : Interfaces.C.size_t with
Import, Address => win_fragment_shader_size'Address;
begin
winShaderProg := createShaderProgram (vertSource => win_vertex_shader_start'Address,
vertSize => winVertexShaderSize,
fragSource => win_fragment_shader_start'Address,
fragSize => winFragmentShaderSize);
if winShaderProg = 0 then
raise ShaderException with "Unable to load window shaders";
end if;
Ada.Text_IO.Put_Line("Troodon: Loaded Window Shaders");
winAttribCoord := GLext.glGetAttribLocation (program => winShaderProg,
name => Interfaces.C.To_C ("coord"));
winUniformOrtho := GLext.glGetUniformLocation (program => winShaderProg,
name => Interfaces.C.To_C ("ortho"));
winUniformTex := GLext.glGetUniformLocation (program => winShaderProg,
name => Interfaces.C.To_C ("tex"));
winUniformAlpha := GLext.glGetUniformLocation (program => winShaderProg,
name => Interfaces.C.To_C ("alpha"));
if winAttribCoord = -1 or
winUniformOrtho = -1 or
winUniformTex = -1 or
winUniformAlpha = -1 then
raise ShaderException with "Unable to get shader variables from win program.";
end if;
end initWinShaders;
---------------------------------------------------------------------------
-- initShadowShaders
---------------------------------------------------------------------------
procedure initShadowShaders is
---------------------------------------------------------------------------
-- Shadow Vertex Shader
---------------------------------------------------------------------------
shadow_vertex_shader_start : Symbol with Import;
shadow_vertex_shader_end : Symbol with Import;
shadow_vertex_shader_size : Symbol with Import;
shadowVertexShaderSize : Interfaces.C.size_t with
Import, Address => shadow_vertex_shader_size'Address;
---------------------------------------------------------------------------
-- Shadow Fragment Shader
---------------------------------------------------------------------------
shadow_fragment_shader_start : Symbol with Import;
shadow_fragment_shader_end : Symbol with Import;
shadow_fragment_shader_size : Symbol with Import;
shadowFragmentShaderSize : Interfaces.C.size_t with
Import, Address => shadow_fragment_shader_size'Address;
begin
shadowShaderProg := createShaderProgram (vertSource => shadow_vertex_shader_start'Address,
vertSize => shadowVertexShaderSize,
fragSource => shadow_fragment_shader_start'Address,
fragSize => shadowFragmentShaderSize);
if shadowShaderProg = 0 then
raise ShaderException with "Unable to load shadow shaders";
end if;
Ada.Text_IO.Put_Line("Troodon: Loaded Shadow Shaders");
-- Get the uniform and attribs from our shaders
shadowAttribCoord := GLext.glGetAttribLocation (program => shadowShaderProg,
name => Interfaces.C.To_C ("coord"));
shadowUniformColor := GLext.glGetUniformLocation (program => shadowShaderProg,
name => Interfaces.C.To_C ("color"));
shadowUniformOrtho := GLext.glGetUniformLocation (program => shadowShaderProg,
name => Interfaces.C.To_C ("ortho"));
shadowUniformShadow := GLext.glGetUniformLocation (program => shadowShaderProg,
name => Interfaces.C.To_C ("shadow"));
shadowUniformScreenH := GLext.glGetUniformLocation (program => shadowShaderProg,
name => Interfaces.C.To_C ("screenHeight"));
if shadowAttribCoord = -1 or
shadowUniformColor = -1 or
shadowUniformOrtho = -1 or
shadowUniformShadow = -1 or
shadowUniformScreenH = -1 then
raise ShaderException with "Unable to get shader variables from shadow program.";
end if;
end initShadowShaders;
---------------------------------------------------------------------------
-- start
---------------------------------------------------------------------------
procedure start is
begin
detectShaderVersion;
initTextShaders;
initCircleShaders;
initLineShaders;
initWinShaders;
initShadowShaders;
end start;
---------------------------------------------------------------------------
-- stop
---------------------------------------------------------------------------
procedure stop is
begin
GLext.glDeleteProgram (textShaderProg);
GLext.glDeleteProgram (circleShaderProg);
GLext.glDeleteProgram (lineShaderProg);
GLext.glDeleteProgram (winShaderProg);
GLext.glDeleteProgram (shadowShaderProg);
end stop;
end Render.Shaders; |
oeis/289/A289949.asm | neoneye/loda-programs | 11 | 88496 | ; A289949: a(n) = Sum_{k=0..n} k!^4.
; 1,2,18,1314,333090,207693090,268946253090,645510228813090,2643553803594573090,17342764866576345933090,173418555892594089945933090,2538940579958951120707545933090,52646414799433780559063261145933090,1503614384819523432725006336630745933090,57762331356940696666882611460103184345933090,2924199666798248221083817384333391879184345933090,191639488050808985199673379098232854263815184345933090,16005869088899297405357446827530847544599230471184345933090
add $0,1
lpb $0
mov $2,$0
sub $0,1
pow $2,4
mul $1,$2
add $1,1
lpe
mov $0,$1
|
ARITHMETIC_16_ALL.asm | apsrcreatix/8086 | 40 | 25127 | <reponame>apsrcreatix/8086<gh_stars>10-100
DATA SEGMENT
N1 DW 1234H
N2 DW 1234H
DATA ENDS
CODE SEGMENT
ASSUME CS : CODE ,DS : DATA
START:
MOV AX,DATA
MOV DS,AX
MOV AX,N1
MOV BX,N2
ADD AX,BX
SUB AX,BX
MUL BX
DIV BX
CODE ENDS
ENDS START |
src/mathutil.ads | Kurinkitos/Twizy-Security | 1 | 21836 | with Types;
use Types;
package Mathutil with SPARK_Mode => On is
function ArcTan(Y : FloatingNumber; X : FloatingNumber) return FloatingNumber
with
Global => null,
Pre => X /= 0.0 and then Y /= 0.0,
Post => ArcTan'Result <= 180.0 and then ArcTan'Result >= (-180.0);
function Sin(X : FloatingNumber) return FloatingNumber
with
Post => Sin'Result >= -1.0 and Sin'Result <= 1.0,
Global => null;
function Cos(X : FloatingNumber) return FloatingNumber
with
Post => Cos'Result >= -1.0 and Cos'Result <= 1.0,
Global => null;
function Tan(X : FloatingNumber) return FloatingNumber
with
Global => null;
function Sin_r(X : FloatingNumber) return FloatingNumber
with
Post => Sin_r'Result >= -1.0 and Sin_r'Result <= 1.0,
Global => null;
function Cos_r(X : FloatingNumber) return FloatingNumber
with
Post => Cos_r'Result >= -1.0 and Cos_r'Result <= 1.0,
Global => null;
function Tan_r(X : FloatingNumber) return FloatingNumber
with
Global => null;
function Sqrt(X : FloatingNumber) return FloatingNumber
with
Global => null,
Pre => X > 0.0,
Post => Sqrt'Result <= X and then Sqrt'Result > 0.0;
end Mathutil;
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-dirval.adb | orb-zhuchen/Orb | 0 | 3109 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . D I R E C T O R I E S . V A L I D I T Y --
-- --
-- B o d y --
-- (Windows Version) --
-- --
-- Copyright (C) 2004-2019, 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is the Windows version of this package
with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
package body Ada.Directories.Validity is
Invalid_Character : constant array (Character) of Boolean :=
(NUL .. US | '\' => True,
'/' | ':' | '*' | '?' => True,
'"' | '<' | '>' | '|' => True,
DEL => True,
others => False);
-- Note that a valid file-name or path-name is implementation defined.
-- To support UTF-8 file and directory names, we do not want to be too
-- restrictive here.
---------------------------------
-- Is_Path_Name_Case_Sensitive --
---------------------------------
function Is_Path_Name_Case_Sensitive return Boolean is
begin
return False;
end Is_Path_Name_Case_Sensitive;
------------------------
-- Is_Valid_Path_Name --
------------------------
function Is_Valid_Path_Name (Name : String) return Boolean is
Start : Positive := Name'First;
Last : Natural;
begin
-- A path name cannot be empty, cannot contain more than 256 characters,
-- cannot contain invalid characters and each directory/file name need
-- to be valid.
if Name'Length = 0 or else Name'Length > 256 then
return False;
else
-- A drive letter may be specified at the beginning
if Name'Length >= 2
and then Name (Start + 1) = ':'
and then
(Name (Start) in 'A' .. 'Z' or else Name (Start) in 'a' .. 'z')
then
Start := Start + 2;
-- A drive letter followed by a colon and followed by nothing or
-- by a relative path is an ambiguous path name on Windows, so we
-- don't accept it.
if Start > Name'Last
or else (Name (Start) /= '/' and then Name (Start) /= '\')
then
return False;
end if;
end if;
loop
-- Look for the start of the next directory or file name
while Start <= Name'Last
and then (Name (Start) = '\' or Name (Start) = '/')
loop
Start := Start + 1;
end loop;
-- If all directories/file names are OK, return True
exit when Start > Name'Last;
Last := Start;
-- Look for the end of the directory/file name
while Last < Name'Last loop
exit when Name (Last + 1) = '\' or Name (Last + 1) = '/';
Last := Last + 1;
end loop;
-- Check if the directory/file name is valid
if not Is_Valid_Simple_Name (Name (Start .. Last)) then
return False;
end if;
-- Move to the next name
Start := Last + 1;
end loop;
end if;
-- If Name follows the rules, it is valid
return True;
end Is_Valid_Path_Name;
--------------------------
-- Is_Valid_Simple_Name --
--------------------------
function Is_Valid_Simple_Name (Name : String) return Boolean is
Only_Spaces : Boolean;
begin
-- A file name cannot be empty, cannot contain more than 256 characters,
-- and cannot contain invalid characters.
if Name'Length = 0 or else Name'Length > 256 then
return False;
-- Name length is OK
else
Only_Spaces := True;
for J in Name'Range loop
if Invalid_Character (Name (J)) then
return False;
elsif Name (J) /= ' ' then
Only_Spaces := False;
end if;
end loop;
-- If no invalid chars, and not all spaces, file name is valid
return not Only_Spaces;
end if;
end Is_Valid_Simple_Name;
-------------
-- Windows --
-------------
function Windows return Boolean is
begin
return True;
end Windows;
end Ada.Directories.Validity;
|
theorems/cw/cohomology/cochainequiv/FirstCoboundary.agda | timjb/HoTT-Agda | 0 | 2115 | {-# OPTIONS --without-K --rewriting #-}
open import HoTT renaming (pt to ⊙pt)
open import homotopy.Bouquet
open import homotopy.FinWedge
open import homotopy.SphereEndomorphism
open import homotopy.DisjointlyPointedSet
open import groups.SphereEndomorphism
open import groups.SumOfSubIndicator
open import groups.DisjointlyPointedSet
open import cw.CW
open import cw.DegreeByProjection
open import cw.FinBoundary
open import cw.FinCW
open import cw.WedgeOfCells
open import cohomology.Theory
module cw.cohomology.cochainequiv.FirstCoboundary (OT : OrdinaryTheory lzero)
(⊙fin-skel : ⊙FinSkeleton 1) where
open OrdinaryTheory OT
open import cohomology.RephraseSubFinCoboundary OT
open import cohomology.SubFinBouquet OT
private
⊙skel = ⊙FinSkeleton-realize ⊙fin-skel
fin-skel = ⊙FinSkeleton.skel ⊙fin-skel
I = AttachedFinSkeleton.numCells fin-skel
skel = ⊙Skeleton.skel ⊙skel
dec = FinSkeleton-has-cells-with-dec-eq fin-skel
ac = FinSkeleton-has-cells-with-choice 0 fin-skel lzero
fin-skel₋₁ = fcw-init fin-skel
ac₋₁ = FinSkeleton-has-cells-with-choice 0 fin-skel₋₁ lzero
endpoint = attaching-last skel
I₋₁ = AttachedFinSkeleton.skel fin-skel
⊙head = ⊙cw-head ⊙skel
pt = ⊙pt ⊙head
open DegreeAtOne skel dec
open import cw.cohomology.WedgeOfCells OT ⊙skel
open import cw.cohomology.reconstructed.TipAndAugment OT (⊙cw-init ⊙skel)
open import cw.cohomology.reconstructed.TipCoboundary OT ⊙skel
open import cw.cohomology.cochainequiv.FirstCoboundaryAbstractDefs OT ⊙fin-skel
abstract
rephrase-cw-co∂-head'-in-degree : ∀ g
→ GroupIso.f (CXₙ/Xₙ₋₁-diag-β ac) (GroupHom.f cw-co∂-head' (GroupIso.g (CX₀-diag-β ac₋₁) g))
∼ λ <I → Group.subsum-r (C2 0) ⊙head-separate
(λ b → Group.exp (C2 0) (g b) (degree <I (fst b)))
rephrase-cw-co∂-head'-in-degree g <I =
GroupIso.f (C-FinBouquet-diag 1 I)
(CEl-fmap 1 (⊙–> (Bouquet-⊙equiv-Xₙ/Xₙ₋₁ skel))
(CEl-fmap 1 ⊙cw-∂-head'-before-Susp
(<– (CEl-Susp 0 ⊙head)
(CEl-fmap 0 (⊙<– (Bouquet-⊙equiv-X ⊙head-is-separable))
(GroupIso.g (C-SubFinBouquet-diag 0 MinusPoint-⊙head-has-choice ⊙head-separate)
g))))) <I
=⟨ ap
(λ g →
GroupIso.f (C-FinBouquet-diag 1 I)
(CEl-fmap 1 (⊙–> (Bouquet-⊙equiv-Xₙ/Xₙ₋₁ skel))
(CEl-fmap 1 ⊙cw-∂-head'-before-Susp g)) <I) $
C-Susp-fmap' 0 (⊙<– (Bouquet-⊙equiv-X (Fin-has-dec-eq pt))) □$ᴳ
(GroupIso.g (C-SubFinBouquet-diag 0 MinusPoint-⊙head-has-choice ⊙head-separate)
g) ⟩
GroupIso.f (C-FinBouquet-diag 1 I)
(CEl-fmap 1 (⊙–> (Bouquet-⊙equiv-Xₙ/Xₙ₋₁ skel))
(CEl-fmap 1 ⊙cw-∂-head'-before-Susp
(CEl-fmap 1 (⊙Susp-fmap (⊙<– (Bouquet-⊙equiv-X ⊙head-is-separable)))
(<– (CEl-Susp 0 (⊙Bouquet (MinusPoint ⊙head) 0))
(GroupIso.g (C-SubFinBouquet-diag 0 MinusPoint-⊙head-has-choice ⊙head-separate)
g))))) <I
=⟨ ap (λ g → GroupIso.f (C-FinBouquet-diag 1 I) g <I) $
∘-CEl-fmap 1 (⊙–> (Bouquet-⊙equiv-Xₙ/Xₙ₋₁ skel)) ⊙cw-∂-head'-before-Susp
(CEl-fmap 1 (⊙Susp-fmap (⊙<– (Bouquet-⊙equiv-X ⊙head-is-separable)))
(<– (CEl-Susp 0 (⊙Bouquet (MinusPoint ⊙head) 0))
(GroupIso.g (C-SubFinBouquet-diag 0 MinusPoint-⊙head-has-choice ⊙head-separate)
g)))
∙ ∘-CEl-fmap 1
(⊙cw-∂-head'-before-Susp ⊙∘ ⊙–> (Bouquet-⊙equiv-Xₙ/Xₙ₋₁ skel))
(⊙Susp-fmap (⊙<– (Bouquet-⊙equiv-X ⊙head-is-separable)))
(<– (CEl-Susp 0 (⊙Bouquet (MinusPoint ⊙head) 0))
(GroupIso.g (C-SubFinBouquet-diag 0 MinusPoint-⊙head-has-choice ⊙head-separate)
g))
∙ ap (λ f → CEl-fmap 1 f
(<– (CEl-Susp 0 (⊙Bouquet (MinusPoint ⊙head) 0))
(GroupIso.g (C-SubFinBouquet-diag 0 MinusPoint-⊙head-has-choice ⊙head-separate)
g)))
(! ⊙function₀'-β) ⟩
GroupIso.f (C-FinBouquet-diag 1 I)
(CEl-fmap 1 ⊙function₀'
(<– (CEl-Susp 0 (⊙Bouquet (MinusPoint ⊙head) 0))
(GroupIso.g (C-SubFinBouquet-diag 0 MinusPoint-⊙head-has-choice ⊙head-separate)
g))) <I
=⟨ rephrase-in-degree 0 {I = I} MinusPoint-⊙head-has-choice
MinusPoint-⊙head-has-dec-eq ⊙head-separate-equiv ⊙function₀' g <I ⟩
Group.subsum-r (C2 0) ⊙head-separate
(λ b → Group.exp (C2 0) (g b)
(⊙SphereS-endo-degree 0
(⊙Susp-fmap (⊙bwproj MinusPoint-⊙head-has-dec-eq b) ⊙∘ ⊙function₀' ⊙∘ ⊙fwin <I)))
=⟨ ap (Group.subsum-r (C2 0) ⊙head-separate)
(λ= λ b → ap (Group.exp (C2 0) (g b)) $
⊙SphereS-endo-degree-base-indep 0
{f = ( ⊙Susp-fmap (⊙bwproj MinusPoint-⊙head-has-dec-eq b)
⊙∘ ⊙function₀'
⊙∘ ⊙fwin <I)}
{g = (Susp-fmap (function₁' <I b) , idp)}
(mega-reduction <I b)) ⟩
Group.subsum-r (C2 0) ⊙head-separate
(λ b → Group.exp (C2 0) (g b)
(⊙SphereS-endo-degree 0
(Susp-fmap (function₁' <I b) , idp)))
=⟨ ap (Group.subsum-r (C2 0) ⊙head-separate)
(λ= λ b → ap (Group.exp (C2 0) (g b)) $
degree-matches <I b) ⟩
Group.subsum-r (C2 0) ⊙head-separate
(λ b → Group.exp (C2 0) (g b)
(degree <I (fst b)))
=∎
abstract
private
degree-true-≠ : ∀ {<I <I₋₁} → (<I₋₁ ≠ endpoint <I true) → degree-true <I <I₋₁ == 0
degree-true-≠ {<I} {<I₋₁} neq with Fin-has-dec-eq <I₋₁ (endpoint <I true)
... | inl eq = ⊥-rec (neq eq)
... | inr _ = idp
degree-true-diag : ∀ <I → degree-true <I (endpoint <I true) == -1
degree-true-diag <I with Fin-has-dec-eq (endpoint <I true) (endpoint <I true)
... | inl _ = idp
... | inr neq = ⊥-rec (neq idp)
sum-degree-true : ∀ <I g → Group.sum (C2 0) (λ <I₋₁ → Group.exp (C2 0) g (degree-true <I <I₋₁)) == Group.inv (C2 0) g
sum-degree-true <I g =
sum-subindicator (C2 0) (λ <I₋₁ → Group.exp (C2 0) g (degree-true <I <I₋₁))
(endpoint <I true) (λ neq → ap (Group.exp (C2 0) g) (degree-true-≠ neq))
∙ ap (Group.exp (C2 0) g) (degree-true-diag <I)
degree-false-≠ : ∀ {<I <I₋₁} → (<I₋₁ ≠ endpoint <I false) → degree-false <I <I₋₁ == 0
degree-false-≠ {<I} {<I₋₁} neq with Fin-has-dec-eq <I₋₁ (endpoint <I false)
... | inl eq = ⊥-rec (neq eq)
... | inr _ = idp
degree-false-diag : ∀ <I → degree-false <I (endpoint <I false) == 1
degree-false-diag <I with Fin-has-dec-eq (endpoint <I false) (endpoint <I false)
... | inl _ = idp
... | inr neq = ⊥-rec (neq idp)
sum-degree-false : ∀ <I g → Group.sum (C2 0) (λ <I₋₁ → Group.exp (C2 0) g (degree-false <I <I₋₁)) == g
sum-degree-false <I g =
sum-subindicator (C2 0) (λ <I₋₁ → Group.exp (C2 0) g (degree-false <I <I₋₁))
(endpoint <I false) (λ neq → ap (Group.exp (C2 0) g) (degree-false-≠ neq))
∙ ap (Group.exp (C2 0) g) (degree-false-diag <I)
sum-degree : ∀ <I g → Group.sum (C2 0) (λ <I₋₁ → Group.exp (C2 0) g (degree <I <I₋₁)) == Group.ident (C2 0)
sum-degree <I g =
ap (Group.sum (C2 0)) (λ= λ <I₋₁ → Group.exp-+ (C2 0) g (degree-true <I <I₋₁) (degree-false <I <I₋₁))
∙ AbGroup.sum-comp (C2-abgroup 0)
(λ <I₋₁ → Group.exp (C2 0) g (degree-true <I <I₋₁))
(λ <I₋₁ → Group.exp (C2 0) g (degree-false <I <I₋₁))
∙ ap2 (Group.comp (C2 0))
(sum-degree-true <I g)
(sum-degree-false <I g)
∙ Group.inv-l (C2 0) g
merge-branches : ∀ (g : Fin I₋₁ → Group.El (C2 0)) (g-pt : g pt == Group.ident (C2 0)) x
→ Coprod-rec (λ _ → Group.ident (C2 0)) (λ b → g (fst b)) (⊙head-separate x)
== g x
merge-branches g g-pt x with Fin-has-dec-eq pt x
merge-branches g g-pt x | inl idp = ! g-pt
merge-branches g g-pt x | inr _ = idp
rephrase-cw-co∂-head-in-degree : ∀ g
→ GroupIso.f (CXₙ/Xₙ₋₁-diag-β ac) (GroupHom.f cw-co∂-head (GroupIso.g (C2×CX₀-diag-β ac₋₁) g))
∼ λ <I → Group.sum (C2 0) (λ <I₋₁ → Group.exp (C2 0) (g <I₋₁) (degree <I <I₋₁))
rephrase-cw-co∂-head-in-degree g <I =
GroupIso.f (CXₙ/Xₙ₋₁-diag-β ac) (GroupHom.f cw-co∂-head' (GroupIso.g (CX₀-diag-β ac₋₁) (snd (diff-and-separate (C2 0) g)))) <I
=⟨ rephrase-cw-co∂-head'-in-degree (snd (diff-and-separate (C2 0) g)) <I ⟩
Group.subsum-r (C2 0) ⊙head-separate
(λ b → Group.exp (C2 0) (Group.diff (C2 0) (g (fst b)) (g pt))
(degree <I (fst b)))
=⟨ ap (Group.sum (C2 0)) (λ= λ <I₋₁ →
merge-branches
(λ <I₋₁ → Group.exp (C2 0) (Group.diff (C2 0) (g <I₋₁) (g pt)) (degree <I <I₋₁))
( ap (λ g → Group.exp (C2 0) g (degree <I pt)) (Group.inv-r (C2 0) (g pt))
∙ Group.exp-ident (C2 0) (degree <I pt))
<I₋₁
∙ AbGroup.exp-comp (C2-abgroup 0) (g <I₋₁) (Group.inv (C2 0) (g pt)) (degree <I <I₋₁)) ⟩
Group.sum (C2 0) (λ <I₋₁ →
Group.comp (C2 0)
(Group.exp (C2 0) (g <I₋₁) (degree <I <I₋₁))
(Group.exp (C2 0) (Group.inv (C2 0) (g pt)) (degree <I <I₋₁)))
=⟨ AbGroup.sum-comp (C2-abgroup 0)
(λ <I₋₁ → Group.exp (C2 0) (g <I₋₁) (degree <I <I₋₁))
(λ <I₋₁ → Group.exp (C2 0) (Group.inv (C2 0) (g pt)) (degree <I <I₋₁)) ⟩
Group.comp (C2 0)
(Group.sum (C2 0) (λ <I₋₁ → Group.exp (C2 0) (g <I₋₁) (degree <I <I₋₁)))
(Group.sum (C2 0) (λ <I₋₁ → Group.exp (C2 0) (Group.inv (C2 0) (g pt)) (degree <I <I₋₁)))
=⟨ ap (Group.comp (C2 0) (Group.sum (C2 0) (λ <I₋₁ → Group.exp (C2 0) (g <I₋₁) (degree <I <I₋₁))))
(sum-degree <I (Group.inv (C2 0) (g pt)))
∙ Group.unit-r (C2 0) _ ⟩
Group.sum (C2 0) (λ <I₋₁ → Group.exp (C2 0) (g <I₋₁) (degree <I <I₋₁))
=∎
|
bb-runtimes/src/s-bcpcst__armvXm.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 2658 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- SYSTEM.BB.CPU_PRIMITIVES.CONTEXT_SWITCH_TRIGGER --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2004 The European Space Agency --
-- Copyright (C) 2017, AdaCore --
-- --
-- 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
-- The port of GNARL to bare board targets was initially developed by the --
-- Real-Time Systems Group at the Technical University of Madrid. --
-- --
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
package System.BB.CPU_Primitives.Context_Switch_Trigger is
pragma Preelaborate;
procedure Initialize_Context_Switch;
-- Procedure that performs the hardware initialization of the context
-- switch features. This procedure will be called by Initialize_CPU, if
-- necessary.
procedure Trigger_Context_Switch;
-- One some platforms, the context switch requires the triggering of an or
-- Trap or an IRQ.
end System.BB.CPU_Primitives.Context_Switch_Trigger;
|
Appl/Tools/ProtoBiffer/protoManager.asm | steakknife/pcgeos | 504 | 11204 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Tools/ProtoBiffer
FILE: protoManager.asm
AUTHOR: <NAME>: July 29, 1991
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 7/29/91 Initial revision
DESCRIPTION:
File to include everything else.
$Id: protoManager.asm,v 1.1 97/04/04 17:15:13 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
;------------------------------------------------------------------------------
; Common include files
;------------------------------------------------------------------------------
include geos.def
include geode.def
include resource.def
include ec.def
include object.def
include system.def
include heap.def
include disk.def
ACCESS_FILE_STRUC = 1 ; for GFH_SIG_1_2 & GFH_SIG_3_4
include fileEnum.def ; for FileEnum()
include Internal/fileStr.def ; for GeosFileHeader
include Internal/fileInt.def ; for FileFullAccessFlags
include Internal/geodeStr.def ; for ExecutableFileHeader
;------------------------------------------------------------------------------
; Common libraries
;------------------------------------------------------------------------------
UseLib ui.def
UseLib Objects/vTextC.def
;------------------------------------------------------------------------------
; Application definitions
;------------------------------------------------------------------------------
include protoConstant.def
include protoMacro.def
include protoVariable.def
;------------------------------------------------------------------------------
; UI definitions
;------------------------------------------------------------------------------
include proto.rdef
;------------------------------------------------------------------------------
; Source code
;------------------------------------------------------------------------------
include protoMain.asm
|
3-mid/impact/source/3d/dynamics/joints/impact-d3-joint-any.ads | charlie5/lace | 20 | 10340 | <reponame>charlie5/lace
-- #include "LinearMath/impact.d3.Vector.h"
-- #include "impact.d3.jacobian_Entry.h"
-- #include "impact.d3.Joint.h"
--
-- class impact.d3.Object.rigid;
with
impact.d3.Object.rigid;
with impact.d3.jacobian_Entry;
package impact.d3.Joint.any
--
-- impact.d3.Joint.any between two rigidbodies each with a pivotpoint that descibes the axis location in local space
--
-- impact.d3.Joint.any can leave any of the 6 degree of freedom 'free' or 'locked'.
-- currently this limit supports rotational motors<br>
--
-- For Linear limits, use impact.d3.Joint.any.setLinearUpperLimit, impact.d3.Joint.any.setLinearLowerLimit. You can
-- set the parameters with the btTranslationalLimitMotor structure accsesible through the impact.d3.Joint.any.getTranslationalLimitMotor method.
-- At this moment translational motors are not supported. May be in the future.
--
-- For Angular limits, use the btRotationalLimitMotor structure for configuring the limit.
-- This is accessible through impact.d3.Joint.any.getLimitMotor method,
-- This brings support for limit parameters and motors.
--
-- Angulars limits have these possible ranges:
--
--
-- AXIS
-- MIN ANGLE
-- MAX ANGLE
--
-- X
-- -PI
-- PI
--
-- Y
-- -PI / 2
-- PI / 2
--
-- Z
-- -PI
-- PI
--
is
use Math;
type Axes is array (1 .. 3) of Vector_3;
-- bt6DofFlags
--
BT_6DOF_FLAGS_CFM_NORM : Flags := 1;
BT_6DOF_FLAGS_CFM_STOP : Flags := 2;
BT_6DOF_FLAGS_ERP_STOP : Flags := 4;
BT_6DOF_FLAGS_AXIS_SHIFT : constant := 3; -- bits per axis
type Item is new impact.d3.Joint.Item with private; -- tbd: bullet makes this class 'limited' (ie provides a private, aborting '=' operator).
---------------------------
--- btRotationalLimitMotor
--
-- Rotation Limit structure for generic joints.
type btRotationLimitMotor is tagged
record
m_loLimit : Real; -- joint limit
m_hiLimit : Real; -- joint limit
m_targetVelocity : Real; -- target motor velocity
m_maxMotorForce : Real; -- max force on motor
m_maxLimitForce : Real; -- max force on limit
m_damping : Real; -- Damping
m_limitSoftness : Real; -- Relaxation factor
m_normalCFM : Real; -- Constraint force mixing factor
m_stopERP : Real; -- Error tolerance factor when joint is at limit
m_stopCFM : Real; -- Constraint force mixing factor when joint is at limit
m_bounce : Real; -- restitution factor
m_enableMotor : Boolean;
-- temporary variables
m_currentLimitError : Real; -- How much is violated this limit
m_currentPosition : Real; -- current value of angle
m_currentLimit : Integer; -- 0=free, 1=at lo limit, 2=at hi limit
m_accumulatedImpulse : Real;
end record;
function to_btRotationLimitMotor return btRotationLimitMotor;
function to_btRotationLimitMotor (Other : in btRotationLimitMotor) return btRotationLimitMotor;
function isLimited (Self : in btRotationLimitMotor) return Boolean;
function needApplyTorques (Self : in btRotationLimitMotor) return Boolean;
function testLimitValue (Self : access btRotationLimitMotor; test_value : in Real) return Integer;
--
-- Calculates error (ie 'm_currentLimit' and 'm_currentLimitError').
function solveAngularLimits (Self : access btRotationLimitMotor; timeStep : in math.Real;
axis : access math.Vector_3;
jacDiagABInv : in math.Real;
body0, body1 : in impact.d3.Object.rigid.view) return math.Real;
--
-- Apply the correction impulses for two bodies.
-- class btRotationalLimitMotor
-- {
-- public:
-- //! limit_parameters
-- //!@{
-- impact.d3.Scalar m_loLimit;//!< joint limit
-- impact.d3.Scalar m_hiLimit;//!< joint limit
-- impact.d3.Scalar m_targetVelocity;//!< target motor velocity
-- impact.d3.Scalar m_maxMotorForce;//!< max force on motor
-- impact.d3.Scalar m_maxLimitForce;//!< max force on limit
-- impact.d3.Scalar m_damping;//!< Damping.
-- impact.d3.Scalar m_limitSoftness;//! Relaxation factor
-- impact.d3.Scalar m_normalCFM;//!< Constraint force mixing factor
-- impact.d3.Scalar m_stopERP;//!< Error tolerance factor when joint is at limit
-- impact.d3.Scalar m_stopCFM;//!< Constraint force mixing factor when joint is at limit
-- impact.d3.Scalar m_bounce;//!< restitution factor
-- bool m_enableMotor;
--
-- //!@}
--
-- //! temp_variables
-- //!@{
-- impact.d3.Scalar m_currentLimitError;//! How much is violated this limit
-- impact.d3.Scalar m_currentPosition; //! current value of angle
-- int m_currentLimit;//!< 0=free, 1=at lo limit, 2=at hi limit
-- impact.d3.Scalar m_accumulatedImpulse;
-- //!@}
-- };
type Angular_Limits is array (1 .. 3) of aliased btRotationLimitMotor;
type Enable_Motor is array (1 .. 3) of Boolean;
type Current_Limit is array (1 .. 3) of Integer;
------------------------------
--- btTranslationalLimitMotor
--
type btTranslationalLimitMotor is tagged
record
m_lowerLimit : Vector_3; -- the constraint lower limits
m_upperLimit : Vector_3; -- the constraint upper limits
m_accumulatedImpulse : Vector_3;
m_limitSoftness : Real; -- Softness for linear limit
m_damping : Real; -- Damping for linear limit
m_restitution : Real; -- Bounce parameter for linear limit
m_normalCFM : Vector_3; -- Constraint force mixing factor
m_stopERP : Vector_3; -- Error tolerance factor when joint is at limit
m_stopCFM : Vector_3; -- Constraint force mixing factor when joint is at limit.
m_enableMotor : Enable_Motor;
m_targetVelocity : Vector_3; -- target motor velocity
m_maxMotorForce : Vector_3; -- max force on motor
m_currentLimitError : Vector_3; -- How much is violated this limit
m_currentLinearDiff : Vector_3; -- Current relative offset of constraint frames
m_currentLimit : Current_Limit; -- 0=free, 1=at lower limit, 2=at upper limit
end record;
function to_btTranslationalLimitMotor return btTranslationalLimitMotor;
function to_btTranslationalLimitMotor (Other : in btTranslationalLimitMotor) return btTranslationalLimitMotor;
function isLimited (Self : in btTranslationalLimitMotor; limitIndex : in Integer) return Boolean;
function needApplyForce (Self : in btTranslationalLimitMotor; limitIndex : in Integer) return Boolean;
function solveLinearAxis (Self : access btTranslationalLimitMotor; timeStep : in math.Real;
jacDiagABInv : in math.Real;
body1 : in impact.d3.Object.rigid.view;
pointInA : in math.Vector_3;
body2 : in impact.d3.Object.rigid.view;
pointInB : in math.Vector_3;
limitIndex : in Integer;
axis_normal_on_a : in math.Vector_3;
anchorPos : in math.Vector_3) return math.Real;
-- class btTranslationalLimitMotor
-- {
-- public:
-- impact.d3.Vector m_lowerLimit;//!< the constraint lower limits
-- impact.d3.Vector m_upperLimit;//!< the constraint upper limits
-- impact.d3.Vector m_accumulatedImpulse;
-- //! Linear_Limit_parameters
-- //!@{
-- impact.d3.Scalar m_limitSoftness;//!< Softness for linear limit
-- impact.d3.Scalar m_damping;//!< Damping for linear limit
-- impact.d3.Scalar m_restitution;//! Bounce parameter for linear limit
-- impact.d3.Vector m_normalCFM;//!< Constraint force mixing factor
-- impact.d3.Vector m_stopERP;//!< Error tolerance factor when joint is at limit
-- impact.d3.Vector m_stopCFM;//!< Constraint force mixing factor when joint is at limit
-- //!@}
-- bool m_enableMotor[3];
-- impact.d3.Vector m_targetVelocity;//!< target motor velocity
-- impact.d3.Vector m_maxMotorForce;//!< max force on motor
-- impact.d3.Vector m_currentLimitError;//! How much is violated this limit
-- impact.d3.Vector m_currentLinearDiff;//! Current relative offset of constraint frames
-- int m_currentLimit[3];//!< 0=free, 1=at lower limit, 2=at upper limit
--
--
-- //! Test limit --- tbd: where is this ported ?
-- /*!
-- - free means upper < lower,
-- - locked means upper == lower
-- - limited means upper > lower
-- - limitIndex: first 3 are linear, next 3 are angular
-- */
-- };
----------------------------
--- impact.d3.Joint.any
--
----------
--- Forge
--
function to_any_Joint (rbA, rbB : in impact.d3.Object.rigid.view;
frameInA, frameInB : in Transform_3d;
useLinearReferenceFrameA : in Boolean ) return Item;
-- impact.d3.Joint.any(impact.d3.Object.rigid& rbA, impact.d3.Object.rigid& rbB, const impact.d3.Transform& frameInA, const impact.d3.Transform& frameInB ,bool useLinearReferenceFrameA);
function to_any_Joint (rbB : in impact.d3.Object.rigid.view;
frameInB : in Transform_3d;
useLinearReferenceFrameB : in Boolean ) return Item;
--
-- Not providing rigidbody A means implicitly using worldspace for body A.
-- impact.d3.Joint.any(impact.d3.Object.rigid& rbB, const impact.d3.Transform& frameInB, bool useLinearReferenceFrameB);
----------------
--- Atttributes
--
overriding procedure setParam (Self : out Item;
num : in impact.d3.Joint.btConstraintParams;
value : in Math.Real;
axis : in Integer := -1);
--
-- Override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5).
-- If no axis is provided, it uses the default axis for this constraint.
-- virtual void setParam(int num, impact.d3.Scalar value, int axis = -1);
overriding function getParam (Self : in Item;
num : in impact.d3.Joint.btConstraintParams;
axis : in Integer := -1) return Math.Real;
--
-- Return the local value of parameter.
-- virtual impact.d3.Scalar getParam(int num, int axis = -1) const;
overriding procedure getInfo1 (Self : in out Item;
info : out impact.d3.Joint.btConstraintInfo1);
-- virtual void getInfo1 (btConstraintInfo1* info);
procedure getInfo1NonVirtual (Self : in out Item;
info : out impact.d3.Joint.btConstraintInfo1);
-- void getInfo1NonVirtual (btConstraintInfo1* info);
overriding procedure getInfo2 (Self : in out Item;
info : out impact.d3.Joint.btConstraintInfo2);
-- virtual void getInfo2 (btConstraintInfo2* info);
procedure getInfo2NonVirtual (Self : in out Item;
info : out impact.d3.Joint.btConstraintInfo2;
transA : in Transform_3d;
transB : in Transform_3d;
linVelA : in Vector_3;
linVelB : in Vector_3;
angVelA : in Vector_3;
angVelB : in Vector_3);
-- void getInfo2NonVirtual (btConstraintInfo2* info,const impact.d3.Transform& transA,const impact.d3.Transform& transB,const impact.d3.Vector& linVelA,const impact.d3.Vector& linVelB,const impact.d3.Vector& angVelA,const impact.d3.Vector& angVelB);
procedure calculateTransforms (Self : in out Item);
-- void calculateTransforms();
procedure calculateTransforms (Self : in out Item;
transA : in Transform_3d;
transB : in Transform_3d);
--
-- Calcs global transform of the offsets.
--
-- Calcs the global transform for the joint offset for body A an B, and also calcs the agle differences between the bodies.
--
-- See also: impact.d3.Joint.any.getCalculatedTransformA, impact.d3.Joint.any.getCalculatedTransformB, impact.d3.Joint.any.calculateAngleInfo
-- void calculateTransforms(const impact.d3.Transform& transA,const impact.d3.Transform& transB);
function getCalculatedTransformA (Self : in Item) return Transform_3d;
--
-- Gets the global transform of the offset for body A
--
-- See also: impact.d3.Joint.any.getFrameOffsetA, impact.d3.Joint.any.getFrameOffsetB, impact.d3.Joint.any.calculateAngleInfo.
-- const impact.d3.Transform & getCalculatedTransformA() const
function getCalculatedTransformB (Self : in Item) return Transform_3d;
--
-- Gets the global transform of the offset for body B
--
-- See also: impact.d3.Joint.any.getFrameOffsetA, impact.d3.Joint.any.getFrameOffsetB, impact.d3.Joint.any.calculateAngleInfo.
-- const impact.d3.Transform & getCalculatedTransformB() const
procedure setFrameOffsetA (Self : in out Item; To : in Transform_3d);
procedure setFrameOffsetB (Self : in out Item; To : in Transform_3d);
function getFrameOffsetA (Self : in Item) return Transform_3d;
-- const impact.d3.Transform & getFrameOffsetA() const
-- {
-- return m_frameInA;
-- }
function getFrameOffsetB (Self : in Item) return Transform_3d;
-- const impact.d3.Transform & getFrameOffsetB() const
-- {
-- return m_frameInB;
-- }
overriding procedure buildJacobian (Self : in out Item);
--
-- Performs Jacobian calculation, and also calculates angle differences and axis.
-- virtual void buildJacobian();
procedure updateRHS (Self : in out Item;
timeStep : in Real);
-- void updateRHS(impact.d3.Scalar timeStep);
function getAxis (Self : in Item;
axis_index : in Integer) return Vector_3;
--
-- Get the rotation axis in global coordinates.
--
-- impact.d3.Joint.any.buildJacobian must be called previously.
-- impact.d3.Vector getAxis(int axis_index) const;
function getRelativePivotPosition (Self : in Item;
axis_index : in Integer) return Real;
--
-- Get the relative position of the constraint pivot
--
-- impact.d3.Joint.any::calculateTransforms() must be called previously.
-- impact.d3.Scalar getRelativePivotPosition(int axis_index) const;
procedure setFrames (Self : in out Item;
frameA : in Transform_3d;
frameB : in Transform_3d);
-- void setFrames(const impact.d3.Transform & frameA, const impact.d3.Transform & frameB);
function getAngle (Self : in Item;
axis_index : in Integer) return Real;
--
-- Get the relative Euler angle.
--
-- impact.d3.Joint.any::calculateTransforms() must be called previously.
-- impact.d3.Scalar getAngle(int axis_index) const;
function testAngularLimitMotor (Self : access Item;
axis_index : in Integer) return Boolean;
--
-- Test angular limit.
--
-- Calculates angular correction and returns true if limit needs to be corrected.
-- impact.d3.Joint.any::calculateTransforms() must be called previously.
-- bool testAngularLimitMotor(int axis_index);
procedure setLinearLowerLimit (Self : in out Item;
linearLower : in Vector_3);
procedure getLinearLowerLimit (Self : in Item;
linearLower : out Vector_3);
procedure setLinearUpperLimit (Self : in out Item;
linearUpper : in Vector_3);
procedure getLinearUpperLimit (Self : in Item;
linearUpper : out Vector_3);
procedure setAngularLowerLimit (Self : in out Item;
angularLower : in Vector_3);
procedure getAngularLowerLimit (Self : in Item;
angularLower : out Vector_3);
procedure setAngularUpperLimit (Self : in out Item;
angularUpper : in Vector_3);
procedure getAngularUpperLimit (Self : in Item;
angularUpper : out Vector_3);
procedure setRotationalLimitMotor (Self : in out Item; index : in Integer; To : in btRotationLimitMotor'Class);
function getRotationalLimitMotor (Self : in Item; index : in Integer) return btRotationLimitMotor'Class;
function getRotationalLimitMotor (Self : access Item; index : in Integer) return access btRotationLimitMotor'Class;
--
-- Retrieves the angular limit information.
-- btRotationalLimitMotor * getRotationalLimitMotor(int index)
-- {
-- return &m_angularLimits[index];
-- }
function getTranslationalLimitMotor (Self : access Item) return access btTranslationalLimitMotor'Class;
--
-- Retrieves the linear limit information
-- btTranslationalLimitMotor * getTranslationalLimitMotor()
-- {
-- return &m_linearLimits;
-- }
--
procedure setLimit (Self : in out Item;
axis : in Integer;
lo : in out Real;
hi : in out Real);
function isLimited (Self : in Item;
limitIndex : in Integer) return Boolean;
procedure calcAnchorPos (Self : in out Item); -- overridable
-- virtual void calcAnchorPos(void);
function get_limit_motor_info2 (Self : in Item;
limot : in btRotationLimitMotor'Class;
transA : in Transform_3d;
transB : in Transform_3d;
linVelA : in Vector_3;
linVelB : in Vector_3;
angVelA : in Vector_3;
angVelB : in Vector_3;
info : in impact.d3.Joint.btConstraintInfo2;
row : in Integer;
ax1 : in Vector_3;
rotational : in Boolean;
rotAllowed : in Boolean := False) return Integer;
-- int get_limit_motor_info2( btRotationalLimitMotor * limot,
-- const impact.d3.Transform& transA,const impact.d3.Transform& transB,const impact.d3.Vector& linVelA,const impact.d3.Vector& linVelB,const impact.d3.Vector& angVelA,const impact.d3.Vector& angVelB,
-- btConstraintInfo2 *info, int row, impact.d3.Vector& ax1, int rotational, int rotAllowed = false);
--- Access for UseFrameOffset.
--
function getUseFrameOffset (Self : in Item) return Boolean;
-- bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; }
procedure setUseFrameOffset (Self : in out Item;
frameOffsetOnOff : in Boolean);
-- void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstraintFrame = frameOffsetOnOff; }
procedure setAxis (Self : in out Item;
axis1 : in Vector_3;
axis2 : in Vector_3);
-- void setAxis( const impact.d3.Vector& axis1, const impact.d3.Vector& axis2);
private
type Item is new impact.d3.Joint.Item with
record
-- relative frames
m_frameInA : Transform_3d; -- the constraint space w.r.t body A
m_frameInB : Transform_3d; -- the constraint space w.r.t body B
-- Jacobians
m_jacLinear : impact.d3.jacobian_Entry.Items (1 .. 3); -- 3 orthogonal linear constraints
m_jacAng : impact.d3.jacobian_Entry.Items (1 .. 3); -- 3 orthogonal angular constraints
m_linearLimits : aliased btTranslationalLimitMotor := to_btTranslationalLimitMotor; -- Linear_Limit_parameters
m_angularLimits : Angular_Limits := (others => to_btRotationLimitMotor); -- hinge_parameters
m_timeStep : Real;
m_calculatedTransformA : Transform_3d;
m_calculatedTransformB : Transform_3d;
m_calculatedAxisAngleDiff : aliased Vector_3;
m_calculatedAxis : Axes;
m_calculatedLinearDiff : Vector_3;
m_factA : Real;
m_factB : Real;
m_hasStaticBody : Boolean;
m_AnchorPos : Vector_3; -- point betwen pivots of bodies A and B to solve linear axes
m_useLinearReferenceFrameA : Boolean;
m_useOffsetForConstraintFrame : Boolean;
m_flags : Flags;
m_useSolveConstraintObsolete : Boolean; -- for backwards compatibility during the transition to 'getInfo/getInfo2'
end record;
-- protected:
--
-- //! relative_frames
-- //!@{
-- impact.d3.Transform m_frameInA;//!< the constraint space w.r.t body A
-- impact.d3.Transform m_frameInB;//!< the constraint space w.r.t body B
-- //!@}
--
-- //! Jacobians
-- //!@{
-- impact.d3.jacobian_Entry m_jacLinear[3];//!< 3 orthogonal linear constraints
-- impact.d3.jacobian_Entry m_jacAng[3];//!< 3 orthogonal angular constraints
-- //!@}
--
-- //! Linear_Limit_parameters
-- //!@{
-- btTranslationalLimitMotor m_linearLimits;
-- //!@}
--
--
-- //! hinge_parameters
-- //!@{
-- btRotationalLimitMotor m_angularLimits[3];
-- //!@}
--
--
-- protected:
-- //! temporal variables
-- //!@{
-- impact.d3.Scalar m_timeStep;
-- impact.d3.Transform m_calculatedTransformA;
-- impact.d3.Transform m_calculatedTransformB;
-- impact.d3.Vector m_calculatedAxisAngleDiff;
-- impact.d3.Vector m_calculatedAxis[3];
-- impact.d3.Vector m_calculatedLinearDiff;
-- impact.d3.Scalar m_factA;
-- impact.d3.Scalar m_factB;
-- bool m_hasStaticBody;
--
-- impact.d3.Vector m_AnchorPos; // point betwen pivots of bodies A and B to solve linear axes
--
-- bool m_useLinearReferenceFrameA;
-- bool m_useOffsetForConstraintFrame;
--
-- int m_flags;
--
--
-- public:
--
-- ///for backwards compatibility during the transition to 'getInfo/getInfo2'
-- bool m_useSolveConstraintObsolete;
function setAngularLimits (Self : access Item;
info : in impact.d3.Joint.btConstraintInfo2;
row_offset : in Integer;
transA : in Transform_3d;
transB : in Transform_3d;
linVelA : in Vector_3;
linVelB : in Vector_3;
angVelA : in Vector_3;
angVelB : in Vector_3) return Integer;
-- int setAngularLimits(btConstraintInfo2 *info, int row_offset,const impact.d3.Transform& transA,const impact.d3.Transform& transB,const impact.d3.Vector& linVelA,const impact.d3.Vector& linVelB,const impact.d3.Vector& angVelA,const impact.d3.Vector& angVelB);
function setLinearLimits (Self : in Item;
info : in impact.d3.Joint.btConstraintInfo2;
row : in Integer;
transA : in Transform_3d;
transB : in Transform_3d;
linVelA : in Vector_3;
linVelB : in Vector_3;
angVelA : in Vector_3;
angVelB : in Vector_3) return Integer;
-- int setLinearLimits(btConstraintInfo2 *info, int row, const impact.d3.Transform& transA,const impact.d3.Transform& transB,const impact.d3.Vector& linVelA,const impact.d3.Vector& linVelB,const impact.d3.Vector& angVelA,const impact.d3.Vector& angVelB);
procedure buildLinearJacobian (Self : in out Item;
jacLinear : out impact.d3.jacobian_Entry.item;
normalWorld : in Vector_3;
pivotAInW : in Vector_3;
pivotBInW : in Vector_3);
-- void buildLinearJacobian(
-- impact.d3.jacobian_Entry & jacLinear,const impact.d3.Vector & normalWorld,
-- const impact.d3.Vector & pivotAInW,const impact.d3.Vector & pivotBInW);
procedure buildAngularJacobian (Self : in out Item;
jacAngular : out impact.d3.jacobian_Entry.Item;
jointAxisW : in Vector_3);
-- void buildAngularJacobian(impact.d3.jacobian_Entry & jacAngular,const impact.d3.Vector & jointAxisW);
procedure calculateLinearInfo (Self : in out Item);
--
-- tests linear limits
-- void calculateLinearInfo();
procedure calculateAngleInfo (Self : in out Item);
--
-- calcs the euler angles between the two bodies.
-- void calculateAngleInfo();
end impact.d3.Joint.any;
|
agda-stdlib-0.9/src/Relation/Binary/EqReasoning.agda | qwe2/try-agda | 1 | 17230 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Convenient syntax for equational reasoning
------------------------------------------------------------------------
-- Example use:
-- n*0≡0 : ∀ n → n * 0 ≡ 0
-- n*0≡0 zero = refl
-- n*0≡0 (suc n) =
-- begin
-- suc n * 0
-- ≈⟨ refl ⟩
-- n * 0 + 0
-- ≈⟨ ... ⟩
-- n * 0
-- ≈⟨ n*0≡0 n ⟩
-- 0
-- ∎
-- Note that some modules contain generalised versions of specific
-- instantiations of this module. For instance, the module ≡-Reasoning
-- in Relation.Binary.PropositionalEquality is recommended for
-- equational reasoning when the underlying equality is
-- Relation.Binary.PropositionalEquality._≡_.
open import Relation.Binary
module Relation.Binary.EqReasoning {s₁ s₂} (S : Setoid s₁ s₂) where
open Setoid S
import Relation.Binary.PreorderReasoning as PreR
open PreR preorder public
renaming ( _∼⟨_⟩_ to _≈⟨_⟩_
; _≈⟨_⟩_ to _≡⟨_⟩_
; _≈⟨⟩_ to _≡⟨⟩_
)
|
source/amf/ocl/amf-internals-tables-ocl_attributes.ads | svn2github/matreshka | 24 | 10318 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.OCL;
with AMF.UML;
with Matreshka.Internals.Strings;
package AMF.Internals.Tables.OCL_Attributes is
function Internal_Get_Argument
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- MessageExp => MessageExp::argument
-- OperationCallExp => OperationCallExp::argument
function Internal_Get_Attribute
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Attribute
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- TupleLiteralPart => TupleLiteralPart::attribute
function Internal_Get_Attribute
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Classifier::attribute
-- BagType => Classifier::attribute
-- CollectionType => Classifier::attribute
-- InvalidType => Classifier::attribute
-- MessageType => Classifier::attribute
-- OrderedSetType => Classifier::attribute
-- SequenceType => Classifier::attribute
-- SetType => Classifier::attribute
-- TemplateParameterType => Classifier::attribute
-- TupleType => Classifier::attribute
-- VoidType => Classifier::attribute
function Internal_Get_Behavior
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Behavior
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- ExpressionInOcl => OpaqueExpression::behavior
function Internal_Get_Body
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Body
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- IterateExp => LoopExp::body
-- IteratorExp => LoopExp::body
function Internal_Get_Body
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_String;
-- ExpressionInOcl => OpaqueExpression::body
function Internal_Get_Body_Expression
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Body_Expression
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- ExpressionInOcl => ExpressionInOcl::bodyExpression
function Internal_Get_Boolean_Symbol
(Self : AMF.Internals.AMF_Element)
return Boolean;
procedure Internal_Set_Boolean_Symbol
(Self : AMF.Internals.AMF_Element;
To : Boolean);
-- BooleanLiteralExp => BooleanLiteralExp::booleanSymbol
function Internal_Get_Called_Operation
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Called_Operation
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- MessageExp => MessageExp::calledOperation
function Internal_Get_Client_Dependency
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => NamedElement::clientDependency
-- AssociationClassCallExp => NamedElement::clientDependency
-- BagType => NamedElement::clientDependency
-- BooleanLiteralExp => NamedElement::clientDependency
-- CollectionItem => NamedElement::clientDependency
-- CollectionLiteralExp => NamedElement::clientDependency
-- CollectionRange => NamedElement::clientDependency
-- CollectionType => NamedElement::clientDependency
-- EnumLiteralExp => NamedElement::clientDependency
-- ExpressionInOcl => NamedElement::clientDependency
-- IfExp => NamedElement::clientDependency
-- IntegerLiteralExp => NamedElement::clientDependency
-- InvalidLiteralExp => NamedElement::clientDependency
-- InvalidType => NamedElement::clientDependency
-- IterateExp => NamedElement::clientDependency
-- IteratorExp => NamedElement::clientDependency
-- LetExp => NamedElement::clientDependency
-- MessageExp => NamedElement::clientDependency
-- MessageType => NamedElement::clientDependency
-- NullLiteralExp => NamedElement::clientDependency
-- OperationCallExp => NamedElement::clientDependency
-- OrderedSetType => NamedElement::clientDependency
-- PropertyCallExp => NamedElement::clientDependency
-- RealLiteralExp => NamedElement::clientDependency
-- SequenceType => NamedElement::clientDependency
-- SetType => NamedElement::clientDependency
-- StateExp => NamedElement::clientDependency
-- StringLiteralExp => NamedElement::clientDependency
-- TemplateParameterType => NamedElement::clientDependency
-- TupleLiteralExp => NamedElement::clientDependency
-- TupleLiteralPart => NamedElement::clientDependency
-- TupleType => NamedElement::clientDependency
-- TypeExp => NamedElement::clientDependency
-- UnlimitedNaturalLiteralExp => NamedElement::clientDependency
-- UnspecifiedValueExp => NamedElement::clientDependency
-- Variable => NamedElement::clientDependency
-- VariableExp => NamedElement::clientDependency
-- VoidType => NamedElement::clientDependency
function Internal_Get_Collaboration_Use
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Classifier::collaborationUse
-- BagType => Classifier::collaborationUse
-- CollectionType => Classifier::collaborationUse
-- InvalidType => Classifier::collaborationUse
-- MessageType => Classifier::collaborationUse
-- OrderedSetType => Classifier::collaborationUse
-- SequenceType => Classifier::collaborationUse
-- SetType => Classifier::collaborationUse
-- TemplateParameterType => Classifier::collaborationUse
-- TupleType => Classifier::collaborationUse
-- VoidType => Classifier::collaborationUse
function Internal_Get_Condition
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Condition
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- IfExp => IfExp::condition
function Internal_Get_Context_Variable
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Context_Variable
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- ExpressionInOcl => ExpressionInOcl::contextVariable
function Internal_Get_Element_Import
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Namespace::elementImport
-- BagType => Namespace::elementImport
-- CollectionType => Namespace::elementImport
-- InvalidType => Namespace::elementImport
-- MessageType => Namespace::elementImport
-- OrderedSetType => Namespace::elementImport
-- SequenceType => Namespace::elementImport
-- SetType => Namespace::elementImport
-- TemplateParameterType => Namespace::elementImport
-- TupleType => Namespace::elementImport
-- VoidType => Namespace::elementImport
function Internal_Get_Element_Type
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Element_Type
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- BagType => CollectionType::elementType
-- CollectionType => CollectionType::elementType
-- OrderedSetType => CollectionType::elementType
-- SequenceType => CollectionType::elementType
-- SetType => CollectionType::elementType
function Internal_Get_Else_Expression
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Else_Expression
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- IfExp => IfExp::elseExpression
function Internal_Get_Feature
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Classifier::feature
-- BagType => Classifier::feature
-- CollectionType => Classifier::feature
-- InvalidType => Classifier::feature
-- MessageType => Classifier::feature
-- OrderedSetType => Classifier::feature
-- SequenceType => Classifier::feature
-- SetType => Classifier::feature
-- TemplateParameterType => Classifier::feature
-- TupleType => Classifier::feature
-- VoidType => Classifier::feature
function Internal_Get_First
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_First
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- CollectionRange => CollectionRange::first
function Internal_Get_General
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Classifier::general
-- BagType => Classifier::general
-- CollectionType => Classifier::general
-- InvalidType => Classifier::general
-- MessageType => Classifier::general
-- OrderedSetType => Classifier::general
-- SequenceType => Classifier::general
-- SetType => Classifier::general
-- TemplateParameterType => Classifier::general
-- TupleType => Classifier::general
-- VoidType => Classifier::general
function Internal_Get_Generalization
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Classifier::generalization
-- BagType => Classifier::generalization
-- CollectionType => Classifier::generalization
-- InvalidType => Classifier::generalization
-- MessageType => Classifier::generalization
-- OrderedSetType => Classifier::generalization
-- SequenceType => Classifier::generalization
-- SetType => Classifier::generalization
-- TemplateParameterType => Classifier::generalization
-- TupleType => Classifier::generalization
-- VoidType => Classifier::generalization
function Internal_Get_Generated_Type
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Generated_Type
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- ExpressionInOcl => ExpressionInOcl::generatedType
function Internal_Get_Imported_Member
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Namespace::importedMember
-- BagType => Namespace::importedMember
-- CollectionType => Namespace::importedMember
-- InvalidType => Namespace::importedMember
-- MessageType => Namespace::importedMember
-- OrderedSetType => Namespace::importedMember
-- SequenceType => Namespace::importedMember
-- SetType => Namespace::importedMember
-- TemplateParameterType => Namespace::importedMember
-- TupleType => Namespace::importedMember
-- VoidType => Namespace::importedMember
function Internal_Get_In
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_In
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- LetExp => LetExp::in
function Internal_Get_Inherited_Member
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Classifier::inheritedMember
-- BagType => Classifier::inheritedMember
-- CollectionType => Classifier::inheritedMember
-- InvalidType => Classifier::inheritedMember
-- MessageType => Classifier::inheritedMember
-- OrderedSetType => Classifier::inheritedMember
-- SequenceType => Classifier::inheritedMember
-- SetType => Classifier::inheritedMember
-- TemplateParameterType => Classifier::inheritedMember
-- TupleType => Classifier::inheritedMember
-- VoidType => Classifier::inheritedMember
function Internal_Get_Init_Expression
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Init_Expression
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- Variable => Variable::initExpression
function Internal_Get_Integer_Symbol
(Self : AMF.Internals.AMF_Element)
return Integer;
procedure Internal_Set_Integer_Symbol
(Self : AMF.Internals.AMF_Element;
To : Integer);
-- IntegerLiteralExp => IntegerLiteralExp::integerSymbol
function Internal_Get_Is_Abstract
(Self : AMF.Internals.AMF_Element)
return Boolean;
procedure Internal_Set_Is_Abstract
(Self : AMF.Internals.AMF_Element;
To : Boolean);
-- AnyType => Classifier::isAbstract
-- BagType => Classifier::isAbstract
-- CollectionType => Classifier::isAbstract
-- InvalidType => Classifier::isAbstract
-- MessageType => Classifier::isAbstract
-- OrderedSetType => Classifier::isAbstract
-- SequenceType => Classifier::isAbstract
-- SetType => Classifier::isAbstract
-- TemplateParameterType => Classifier::isAbstract
-- TupleType => Classifier::isAbstract
-- VoidType => Classifier::isAbstract
function Internal_Get_Is_Final_Specialization
(Self : AMF.Internals.AMF_Element)
return Boolean;
procedure Internal_Set_Is_Final_Specialization
(Self : AMF.Internals.AMF_Element;
To : Boolean);
-- AnyType => Classifier::isFinalSpecialization
-- BagType => Classifier::isFinalSpecialization
-- CollectionType => Classifier::isFinalSpecialization
-- InvalidType => Classifier::isFinalSpecialization
-- MessageType => Classifier::isFinalSpecialization
-- OrderedSetType => Classifier::isFinalSpecialization
-- SequenceType => Classifier::isFinalSpecialization
-- SetType => Classifier::isFinalSpecialization
-- TemplateParameterType => Classifier::isFinalSpecialization
-- TupleType => Classifier::isFinalSpecialization
-- VoidType => Classifier::isFinalSpecialization
function Internal_Get_Is_Leaf
(Self : AMF.Internals.AMF_Element)
return Boolean;
procedure Internal_Set_Is_Leaf
(Self : AMF.Internals.AMF_Element;
To : Boolean);
-- AnyType => RedefinableElement::isLeaf
-- BagType => RedefinableElement::isLeaf
-- CollectionType => RedefinableElement::isLeaf
-- InvalidType => RedefinableElement::isLeaf
-- MessageType => RedefinableElement::isLeaf
-- OrderedSetType => RedefinableElement::isLeaf
-- SequenceType => RedefinableElement::isLeaf
-- SetType => RedefinableElement::isLeaf
-- TemplateParameterType => RedefinableElement::isLeaf
-- TupleType => RedefinableElement::isLeaf
-- VoidType => RedefinableElement::isLeaf
function Internal_Get_Item
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Item
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- CollectionItem => CollectionItem::item
function Internal_Get_Iterator
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- IterateExp => LoopExp::iterator
-- IteratorExp => LoopExp::iterator
function Internal_Get_Kind
(Self : AMF.Internals.AMF_Element)
return AMF.OCL.OCL_Collection_Kind;
procedure Internal_Set_Kind
(Self : AMF.Internals.AMF_Element;
To : AMF.OCL.OCL_Collection_Kind);
-- CollectionLiteralExp => CollectionLiteralExp::kind
function Internal_Get_Language
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_String;
-- ExpressionInOcl => OpaqueExpression::language
function Internal_Get_Last
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Last
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- CollectionRange => CollectionRange::last
function Internal_Get_Member
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Namespace::member
-- BagType => Namespace::member
-- CollectionType => Namespace::member
-- InvalidType => Namespace::member
-- MessageType => Namespace::member
-- OrderedSetType => Namespace::member
-- SequenceType => Namespace::member
-- SetType => Namespace::member
-- TemplateParameterType => Namespace::member
-- TupleType => Namespace::member
-- VoidType => Namespace::member
function Internal_Get_Name
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Name
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- AnyType => NamedElement::name
-- AssociationClassCallExp => NamedElement::name
-- BagType => NamedElement::name
-- BooleanLiteralExp => NamedElement::name
-- CollectionItem => NamedElement::name
-- CollectionLiteralExp => NamedElement::name
-- CollectionRange => NamedElement::name
-- CollectionType => NamedElement::name
-- EnumLiteralExp => NamedElement::name
-- ExpressionInOcl => NamedElement::name
-- IfExp => NamedElement::name
-- IntegerLiteralExp => NamedElement::name
-- InvalidLiteralExp => NamedElement::name
-- InvalidType => NamedElement::name
-- IterateExp => NamedElement::name
-- IteratorExp => NamedElement::name
-- LetExp => NamedElement::name
-- MessageExp => NamedElement::name
-- MessageType => NamedElement::name
-- NullLiteralExp => NamedElement::name
-- OperationCallExp => NamedElement::name
-- OrderedSetType => NamedElement::name
-- PropertyCallExp => NamedElement::name
-- RealLiteralExp => NamedElement::name
-- SequenceType => NamedElement::name
-- SetType => NamedElement::name
-- StateExp => NamedElement::name
-- StringLiteralExp => NamedElement::name
-- TemplateParameterType => NamedElement::name
-- TupleLiteralExp => NamedElement::name
-- TupleLiteralPart => NamedElement::name
-- TupleType => NamedElement::name
-- TypeExp => NamedElement::name
-- UnlimitedNaturalLiteralExp => NamedElement::name
-- UnspecifiedValueExp => NamedElement::name
-- Variable => NamedElement::name
-- VariableExp => NamedElement::name
-- VoidType => NamedElement::name
function Internal_Get_Name_Expression
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Name_Expression
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- AnyType => NamedElement::nameExpression
-- AssociationClassCallExp => NamedElement::nameExpression
-- BagType => NamedElement::nameExpression
-- BooleanLiteralExp => NamedElement::nameExpression
-- CollectionItem => NamedElement::nameExpression
-- CollectionLiteralExp => NamedElement::nameExpression
-- CollectionRange => NamedElement::nameExpression
-- CollectionType => NamedElement::nameExpression
-- EnumLiteralExp => NamedElement::nameExpression
-- ExpressionInOcl => NamedElement::nameExpression
-- IfExp => NamedElement::nameExpression
-- IntegerLiteralExp => NamedElement::nameExpression
-- InvalidLiteralExp => NamedElement::nameExpression
-- InvalidType => NamedElement::nameExpression
-- IterateExp => NamedElement::nameExpression
-- IteratorExp => NamedElement::nameExpression
-- LetExp => NamedElement::nameExpression
-- MessageExp => NamedElement::nameExpression
-- MessageType => NamedElement::nameExpression
-- NullLiteralExp => NamedElement::nameExpression
-- OperationCallExp => NamedElement::nameExpression
-- OrderedSetType => NamedElement::nameExpression
-- PropertyCallExp => NamedElement::nameExpression
-- RealLiteralExp => NamedElement::nameExpression
-- SequenceType => NamedElement::nameExpression
-- SetType => NamedElement::nameExpression
-- StateExp => NamedElement::nameExpression
-- StringLiteralExp => NamedElement::nameExpression
-- TemplateParameterType => NamedElement::nameExpression
-- TupleLiteralExp => NamedElement::nameExpression
-- TupleLiteralPart => NamedElement::nameExpression
-- TupleType => NamedElement::nameExpression
-- TypeExp => NamedElement::nameExpression
-- UnlimitedNaturalLiteralExp => NamedElement::nameExpression
-- UnspecifiedValueExp => NamedElement::nameExpression
-- Variable => NamedElement::nameExpression
-- VariableExp => NamedElement::nameExpression
-- VoidType => NamedElement::nameExpression
function Internal_Get_Namespace
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
-- AnyType => NamedElement::namespace
-- AssociationClassCallExp => NamedElement::namespace
-- BagType => NamedElement::namespace
-- BooleanLiteralExp => NamedElement::namespace
-- CollectionItem => NamedElement::namespace
-- CollectionLiteralExp => NamedElement::namespace
-- CollectionRange => NamedElement::namespace
-- CollectionType => NamedElement::namespace
-- EnumLiteralExp => NamedElement::namespace
-- ExpressionInOcl => NamedElement::namespace
-- IfExp => NamedElement::namespace
-- IntegerLiteralExp => NamedElement::namespace
-- InvalidLiteralExp => NamedElement::namespace
-- InvalidType => NamedElement::namespace
-- IterateExp => NamedElement::namespace
-- IteratorExp => NamedElement::namespace
-- LetExp => NamedElement::namespace
-- MessageExp => NamedElement::namespace
-- MessageType => NamedElement::namespace
-- NullLiteralExp => NamedElement::namespace
-- OperationCallExp => NamedElement::namespace
-- OrderedSetType => NamedElement::namespace
-- PropertyCallExp => NamedElement::namespace
-- RealLiteralExp => NamedElement::namespace
-- SequenceType => NamedElement::namespace
-- SetType => NamedElement::namespace
-- StateExp => NamedElement::namespace
-- StringLiteralExp => NamedElement::namespace
-- TemplateParameterType => NamedElement::namespace
-- TupleLiteralExp => NamedElement::namespace
-- TupleLiteralPart => NamedElement::namespace
-- TupleType => NamedElement::namespace
-- TypeExp => NamedElement::namespace
-- UnlimitedNaturalLiteralExp => NamedElement::namespace
-- UnspecifiedValueExp => NamedElement::namespace
-- Variable => NamedElement::namespace
-- VariableExp => NamedElement::namespace
-- VoidType => NamedElement::namespace
function Internal_Get_Navigation_Source
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Navigation_Source
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- AssociationClassCallExp => NavigationCallExp::navigationSource
-- PropertyCallExp => NavigationCallExp::navigationSource
function Internal_Get_Owned_Attribute
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- BagType => DataType::ownedAttribute
-- CollectionType => DataType::ownedAttribute
-- OrderedSetType => DataType::ownedAttribute
-- SequenceType => DataType::ownedAttribute
-- SetType => DataType::ownedAttribute
-- TupleType => DataType::ownedAttribute
function Internal_Get_Owned_Comment
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Element::ownedComment
-- AssociationClassCallExp => Element::ownedComment
-- BagType => Element::ownedComment
-- BooleanLiteralExp => Element::ownedComment
-- CollectionItem => Element::ownedComment
-- CollectionLiteralExp => Element::ownedComment
-- CollectionRange => Element::ownedComment
-- CollectionType => Element::ownedComment
-- EnumLiteralExp => Element::ownedComment
-- ExpressionInOcl => Element::ownedComment
-- IfExp => Element::ownedComment
-- IntegerLiteralExp => Element::ownedComment
-- InvalidLiteralExp => Element::ownedComment
-- InvalidType => Element::ownedComment
-- IterateExp => Element::ownedComment
-- IteratorExp => Element::ownedComment
-- LetExp => Element::ownedComment
-- MessageExp => Element::ownedComment
-- MessageType => Element::ownedComment
-- NullLiteralExp => Element::ownedComment
-- OperationCallExp => Element::ownedComment
-- OrderedSetType => Element::ownedComment
-- PropertyCallExp => Element::ownedComment
-- RealLiteralExp => Element::ownedComment
-- SequenceType => Element::ownedComment
-- SetType => Element::ownedComment
-- StateExp => Element::ownedComment
-- StringLiteralExp => Element::ownedComment
-- TemplateParameterType => Element::ownedComment
-- TupleLiteralExp => Element::ownedComment
-- TupleLiteralPart => Element::ownedComment
-- TupleType => Element::ownedComment
-- TypeExp => Element::ownedComment
-- UnlimitedNaturalLiteralExp => Element::ownedComment
-- UnspecifiedValueExp => Element::ownedComment
-- Variable => Element::ownedComment
-- VariableExp => Element::ownedComment
-- VoidType => Element::ownedComment
function Internal_Get_Owned_Element
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Element::ownedElement
-- AssociationClassCallExp => Element::ownedElement
-- BagType => Element::ownedElement
-- BooleanLiteralExp => Element::ownedElement
-- CollectionItem => Element::ownedElement
-- CollectionLiteralExp => Element::ownedElement
-- CollectionRange => Element::ownedElement
-- CollectionType => Element::ownedElement
-- EnumLiteralExp => Element::ownedElement
-- ExpressionInOcl => Element::ownedElement
-- IfExp => Element::ownedElement
-- IntegerLiteralExp => Element::ownedElement
-- InvalidLiteralExp => Element::ownedElement
-- InvalidType => Element::ownedElement
-- IterateExp => Element::ownedElement
-- IteratorExp => Element::ownedElement
-- LetExp => Element::ownedElement
-- MessageExp => Element::ownedElement
-- MessageType => Element::ownedElement
-- NullLiteralExp => Element::ownedElement
-- OperationCallExp => Element::ownedElement
-- OrderedSetType => Element::ownedElement
-- PropertyCallExp => Element::ownedElement
-- RealLiteralExp => Element::ownedElement
-- SequenceType => Element::ownedElement
-- SetType => Element::ownedElement
-- StateExp => Element::ownedElement
-- StringLiteralExp => Element::ownedElement
-- TemplateParameterType => Element::ownedElement
-- TupleLiteralExp => Element::ownedElement
-- TupleLiteralPart => Element::ownedElement
-- TupleType => Element::ownedElement
-- TypeExp => Element::ownedElement
-- UnlimitedNaturalLiteralExp => Element::ownedElement
-- UnspecifiedValueExp => Element::ownedElement
-- Variable => Element::ownedElement
-- VariableExp => Element::ownedElement
-- VoidType => Element::ownedElement
function Internal_Get_Owned_Member
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Namespace::ownedMember
-- BagType => Namespace::ownedMember
-- CollectionType => Namespace::ownedMember
-- InvalidType => Namespace::ownedMember
-- MessageType => Namespace::ownedMember
-- OrderedSetType => Namespace::ownedMember
-- SequenceType => Namespace::ownedMember
-- SetType => Namespace::ownedMember
-- TemplateParameterType => Namespace::ownedMember
-- TupleType => Namespace::ownedMember
-- VoidType => Namespace::ownedMember
function Internal_Get_Owned_Operation
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- BagType => DataType::ownedOperation
-- CollectionType => DataType::ownedOperation
-- OrderedSetType => DataType::ownedOperation
-- SequenceType => DataType::ownedOperation
-- SetType => DataType::ownedOperation
-- TupleType => DataType::ownedOperation
function Internal_Get_Owned_Rule
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Namespace::ownedRule
-- BagType => Namespace::ownedRule
-- CollectionType => Namespace::ownedRule
-- InvalidType => Namespace::ownedRule
-- MessageType => Namespace::ownedRule
-- OrderedSetType => Namespace::ownedRule
-- SequenceType => Namespace::ownedRule
-- SetType => Namespace::ownedRule
-- TemplateParameterType => Namespace::ownedRule
-- TupleType => Namespace::ownedRule
-- VoidType => Namespace::ownedRule
function Internal_Get_Owned_Template_Signature
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Owned_Template_Signature
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- AnyType => Classifier::ownedTemplateSignature
-- BagType => Classifier::ownedTemplateSignature
-- CollectionType => Classifier::ownedTemplateSignature
-- InvalidType => Classifier::ownedTemplateSignature
-- MessageType => Classifier::ownedTemplateSignature
-- OrderedSetType => Classifier::ownedTemplateSignature
-- SequenceType => Classifier::ownedTemplateSignature
-- SetType => Classifier::ownedTemplateSignature
-- TemplateParameterType => Classifier::ownedTemplateSignature
-- TupleType => Classifier::ownedTemplateSignature
-- VoidType => Classifier::ownedTemplateSignature
function Internal_Get_Owned_Use_Case
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Classifier::ownedUseCase
-- BagType => Classifier::ownedUseCase
-- CollectionType => Classifier::ownedUseCase
-- InvalidType => Classifier::ownedUseCase
-- MessageType => Classifier::ownedUseCase
-- OrderedSetType => Classifier::ownedUseCase
-- SequenceType => Classifier::ownedUseCase
-- SetType => Classifier::ownedUseCase
-- TemplateParameterType => Classifier::ownedUseCase
-- TupleType => Classifier::ownedUseCase
-- VoidType => Classifier::ownedUseCase
function Internal_Get_Owner
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
-- AnyType => Element::owner
-- AssociationClassCallExp => Element::owner
-- BagType => Element::owner
-- BooleanLiteralExp => Element::owner
-- CollectionItem => Element::owner
-- CollectionLiteralExp => Element::owner
-- CollectionRange => Element::owner
-- CollectionType => Element::owner
-- EnumLiteralExp => Element::owner
-- ExpressionInOcl => Element::owner
-- IfExp => Element::owner
-- IntegerLiteralExp => Element::owner
-- InvalidLiteralExp => Element::owner
-- InvalidType => Element::owner
-- IterateExp => Element::owner
-- IteratorExp => Element::owner
-- LetExp => Element::owner
-- MessageExp => Element::owner
-- MessageType => Element::owner
-- NullLiteralExp => Element::owner
-- OperationCallExp => Element::owner
-- OrderedSetType => Element::owner
-- PropertyCallExp => Element::owner
-- RealLiteralExp => Element::owner
-- SequenceType => Element::owner
-- SetType => Element::owner
-- StateExp => Element::owner
-- StringLiteralExp => Element::owner
-- TemplateParameterType => Element::owner
-- TupleLiteralExp => Element::owner
-- TupleLiteralPart => Element::owner
-- TupleType => Element::owner
-- TypeExp => Element::owner
-- UnlimitedNaturalLiteralExp => Element::owner
-- UnspecifiedValueExp => Element::owner
-- Variable => Element::owner
-- VariableExp => Element::owner
-- VoidType => Element::owner
function Internal_Get_Owning_Template_Parameter
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Owning_Template_Parameter
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- AnyType => ParameterableElement::owningTemplateParameter
-- BagType => ParameterableElement::owningTemplateParameter
-- CollectionType => ParameterableElement::owningTemplateParameter
-- ExpressionInOcl => ParameterableElement::owningTemplateParameter
-- InvalidType => ParameterableElement::owningTemplateParameter
-- MessageType => ParameterableElement::owningTemplateParameter
-- OrderedSetType => ParameterableElement::owningTemplateParameter
-- SequenceType => ParameterableElement::owningTemplateParameter
-- SetType => ParameterableElement::owningTemplateParameter
-- TemplateParameterType => ParameterableElement::owningTemplateParameter
-- TupleType => ParameterableElement::owningTemplateParameter
-- VoidType => ParameterableElement::owningTemplateParameter
function Internal_Get_Package
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Package
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- AnyType => Type::package
-- BagType => Type::package
-- CollectionType => Type::package
-- InvalidType => Type::package
-- MessageType => Type::package
-- OrderedSetType => Type::package
-- SequenceType => Type::package
-- SetType => Type::package
-- TemplateParameterType => Type::package
-- TupleType => Type::package
-- VoidType => Type::package
function Internal_Get_Package_Import
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Namespace::packageImport
-- BagType => Namespace::packageImport
-- CollectionType => Namespace::packageImport
-- InvalidType => Namespace::packageImport
-- MessageType => Namespace::packageImport
-- OrderedSetType => Namespace::packageImport
-- SequenceType => Namespace::packageImport
-- SetType => Namespace::packageImport
-- TemplateParameterType => Namespace::packageImport
-- TupleType => Namespace::packageImport
-- VoidType => Namespace::packageImport
function Internal_Get_Parameter_Variable
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- ExpressionInOcl => ExpressionInOcl::parameterVariable
function Internal_Get_Part
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- CollectionLiteralExp => CollectionLiteralExp::part
-- TupleLiteralExp => TupleLiteralExp::part
function Internal_Get_Powertype_Extent
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Classifier::powertypeExtent
-- BagType => Classifier::powertypeExtent
-- CollectionType => Classifier::powertypeExtent
-- InvalidType => Classifier::powertypeExtent
-- MessageType => Classifier::powertypeExtent
-- OrderedSetType => Classifier::powertypeExtent
-- SequenceType => Classifier::powertypeExtent
-- SetType => Classifier::powertypeExtent
-- TemplateParameterType => Classifier::powertypeExtent
-- TupleType => Classifier::powertypeExtent
-- VoidType => Classifier::powertypeExtent
function Internal_Get_Qualified_Name
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
-- AnyType => NamedElement::qualifiedName
-- AssociationClassCallExp => NamedElement::qualifiedName
-- BagType => NamedElement::qualifiedName
-- BooleanLiteralExp => NamedElement::qualifiedName
-- CollectionItem => NamedElement::qualifiedName
-- CollectionLiteralExp => NamedElement::qualifiedName
-- CollectionRange => NamedElement::qualifiedName
-- CollectionType => NamedElement::qualifiedName
-- EnumLiteralExp => NamedElement::qualifiedName
-- ExpressionInOcl => NamedElement::qualifiedName
-- IfExp => NamedElement::qualifiedName
-- IntegerLiteralExp => NamedElement::qualifiedName
-- InvalidLiteralExp => NamedElement::qualifiedName
-- InvalidType => NamedElement::qualifiedName
-- IterateExp => NamedElement::qualifiedName
-- IteratorExp => NamedElement::qualifiedName
-- LetExp => NamedElement::qualifiedName
-- MessageExp => NamedElement::qualifiedName
-- MessageType => NamedElement::qualifiedName
-- NullLiteralExp => NamedElement::qualifiedName
-- OperationCallExp => NamedElement::qualifiedName
-- OrderedSetType => NamedElement::qualifiedName
-- PropertyCallExp => NamedElement::qualifiedName
-- RealLiteralExp => NamedElement::qualifiedName
-- SequenceType => NamedElement::qualifiedName
-- SetType => NamedElement::qualifiedName
-- StateExp => NamedElement::qualifiedName
-- StringLiteralExp => NamedElement::qualifiedName
-- TemplateParameterType => NamedElement::qualifiedName
-- TupleLiteralExp => NamedElement::qualifiedName
-- TupleLiteralPart => NamedElement::qualifiedName
-- TupleType => NamedElement::qualifiedName
-- TypeExp => NamedElement::qualifiedName
-- UnlimitedNaturalLiteralExp => NamedElement::qualifiedName
-- UnspecifiedValueExp => NamedElement::qualifiedName
-- Variable => NamedElement::qualifiedName
-- VariableExp => NamedElement::qualifiedName
-- VoidType => NamedElement::qualifiedName
function Internal_Get_Qualifier
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AssociationClassCallExp => NavigationCallExp::qualifier
-- PropertyCallExp => NavigationCallExp::qualifier
function Internal_Get_Real_Symbol
(Self : AMF.Internals.AMF_Element)
return AMF.Real;
procedure Internal_Set_Real_Symbol
(Self : AMF.Internals.AMF_Element;
To : AMF.Real);
-- RealLiteralExp => RealLiteralExp::realSymbol
function Internal_Get_Redefined_Classifier
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Classifier::redefinedClassifier
-- BagType => Classifier::redefinedClassifier
-- CollectionType => Classifier::redefinedClassifier
-- InvalidType => Classifier::redefinedClassifier
-- MessageType => Classifier::redefinedClassifier
-- OrderedSetType => Classifier::redefinedClassifier
-- SequenceType => Classifier::redefinedClassifier
-- SetType => Classifier::redefinedClassifier
-- TemplateParameterType => Classifier::redefinedClassifier
-- TupleType => Classifier::redefinedClassifier
-- VoidType => Classifier::redefinedClassifier
function Internal_Get_Redefined_Element
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => RedefinableElement::redefinedElement
-- BagType => RedefinableElement::redefinedElement
-- CollectionType => RedefinableElement::redefinedElement
-- InvalidType => RedefinableElement::redefinedElement
-- MessageType => RedefinableElement::redefinedElement
-- OrderedSetType => RedefinableElement::redefinedElement
-- SequenceType => RedefinableElement::redefinedElement
-- SetType => RedefinableElement::redefinedElement
-- TemplateParameterType => RedefinableElement::redefinedElement
-- TupleType => RedefinableElement::redefinedElement
-- VoidType => RedefinableElement::redefinedElement
function Internal_Get_Redefinition_Context
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => RedefinableElement::redefinitionContext
-- BagType => RedefinableElement::redefinitionContext
-- CollectionType => RedefinableElement::redefinitionContext
-- InvalidType => RedefinableElement::redefinitionContext
-- MessageType => RedefinableElement::redefinitionContext
-- OrderedSetType => RedefinableElement::redefinitionContext
-- SequenceType => RedefinableElement::redefinitionContext
-- SetType => RedefinableElement::redefinitionContext
-- TemplateParameterType => RedefinableElement::redefinitionContext
-- TupleType => RedefinableElement::redefinitionContext
-- VoidType => RedefinableElement::redefinitionContext
function Internal_Get_Referred_Association_Class
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Referred_Association_Class
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- AssociationClassCallExp => AssociationClassCallExp::referredAssociationClass
function Internal_Get_Referred_Enum_Literal
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Referred_Enum_Literal
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- EnumLiteralExp => EnumLiteralExp::referredEnumLiteral
function Internal_Get_Referred_Operation
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Referred_Operation
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- MessageType => MessageType::referredOperation
-- OperationCallExp => OperationCallExp::referredOperation
function Internal_Get_Referred_Property
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Referred_Property
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- PropertyCallExp => PropertyCallExp::referredProperty
function Internal_Get_Referred_Signal
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Referred_Signal
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- MessageType => MessageType::referredSignal
function Internal_Get_Referred_State
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Referred_State
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- StateExp => StateExp::referredState
function Internal_Get_Referred_Type
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Referred_Type
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- TypeExp => TypeExp::referredType
function Internal_Get_Referred_Variable
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Referred_Variable
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- VariableExp => VariableExp::referredVariable
function Internal_Get_Representation
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Representation
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- AnyType => Classifier::representation
-- BagType => Classifier::representation
-- CollectionType => Classifier::representation
-- InvalidType => Classifier::representation
-- MessageType => Classifier::representation
-- OrderedSetType => Classifier::representation
-- SequenceType => Classifier::representation
-- SetType => Classifier::representation
-- TemplateParameterType => Classifier::representation
-- TupleType => Classifier::representation
-- VoidType => Classifier::representation
function Internal_Get_Represented_Parameter
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Represented_Parameter
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- Variable => Variable::representedParameter
function Internal_Get_Result
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
-- ExpressionInOcl => OpaqueExpression::result
-- IterateExp => IterateExp::result
function Internal_Get_Result_Variable
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Result_Variable
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- ExpressionInOcl => ExpressionInOcl::resultVariable
function Internal_Get_Sent_Signal
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Sent_Signal
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- MessageExp => MessageExp::sentSignal
function Internal_Get_Source
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Source
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- AssociationClassCallExp => CallExp::source
-- IterateExp => CallExp::source
-- IteratorExp => CallExp::source
-- OperationCallExp => CallExp::source
-- PropertyCallExp => CallExp::source
function Internal_Get_Specification
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_Specification
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- TemplateParameterType => TemplateParameterType::specification
function Internal_Get_String_Symbol
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access;
procedure Internal_Set_String_Symbol
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access);
-- StringLiteralExp => StringLiteralExp::stringSymbol
function Internal_Get_Substitution
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Classifier::substitution
-- BagType => Classifier::substitution
-- CollectionType => Classifier::substitution
-- InvalidType => Classifier::substitution
-- MessageType => Classifier::substitution
-- OrderedSetType => Classifier::substitution
-- SequenceType => Classifier::substitution
-- SetType => Classifier::substitution
-- TemplateParameterType => Classifier::substitution
-- TupleType => Classifier::substitution
-- VoidType => Classifier::substitution
function Internal_Get_Target
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Target
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- MessageExp => MessageExp::target
function Internal_Get_Template_Binding
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => TemplateableElement::templateBinding
-- BagType => TemplateableElement::templateBinding
-- CollectionType => TemplateableElement::templateBinding
-- InvalidType => TemplateableElement::templateBinding
-- MessageType => TemplateableElement::templateBinding
-- OrderedSetType => TemplateableElement::templateBinding
-- SequenceType => TemplateableElement::templateBinding
-- SetType => TemplateableElement::templateBinding
-- TemplateParameterType => TemplateableElement::templateBinding
-- TupleType => TemplateableElement::templateBinding
-- VoidType => TemplateableElement::templateBinding
function Internal_Get_Template_Parameter
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Template_Parameter
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- AnyType => Classifier::templateParameter
-- BagType => Classifier::templateParameter
-- CollectionType => Classifier::templateParameter
-- ExpressionInOcl => ParameterableElement::templateParameter
-- InvalidType => Classifier::templateParameter
-- MessageType => Classifier::templateParameter
-- OrderedSetType => Classifier::templateParameter
-- SequenceType => Classifier::templateParameter
-- SetType => Classifier::templateParameter
-- TemplateParameterType => Classifier::templateParameter
-- TupleType => Classifier::templateParameter
-- VoidType => Classifier::templateParameter
function Internal_Get_Then_Expression
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Then_Expression
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- IfExp => IfExp::thenExpression
function Internal_Get_Type
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Type
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- AssociationClassCallExp => TypedElement::type
-- BooleanLiteralExp => TypedElement::type
-- CollectionItem => TypedElement::type
-- CollectionLiteralExp => TypedElement::type
-- CollectionRange => TypedElement::type
-- EnumLiteralExp => TypedElement::type
-- ExpressionInOcl => TypedElement::type
-- IfExp => TypedElement::type
-- IntegerLiteralExp => TypedElement::type
-- InvalidLiteralExp => TypedElement::type
-- IterateExp => TypedElement::type
-- IteratorExp => TypedElement::type
-- LetExp => TypedElement::type
-- MessageExp => TypedElement::type
-- NullLiteralExp => TypedElement::type
-- OperationCallExp => TypedElement::type
-- PropertyCallExp => TypedElement::type
-- RealLiteralExp => TypedElement::type
-- StateExp => TypedElement::type
-- StringLiteralExp => TypedElement::type
-- TupleLiteralExp => TypedElement::type
-- TupleLiteralPart => TypedElement::type
-- TypeExp => TypedElement::type
-- UnlimitedNaturalLiteralExp => TypedElement::type
-- UnspecifiedValueExp => TypedElement::type
-- Variable => TypedElement::type
-- VariableExp => TypedElement::type
function Internal_Get_Unlimited_Natural_Symbol
(Self : AMF.Internals.AMF_Element)
return AMF.Unlimited_Natural;
procedure Internal_Set_Unlimited_Natural_Symbol
(Self : AMF.Internals.AMF_Element;
To : AMF.Unlimited_Natural);
-- UnlimitedNaturalLiteralExp => UnlimitedNaturalLiteralExp::unlimitedNaturalSymbol
function Internal_Get_Use_Case
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element;
-- AnyType => Classifier::useCase
-- BagType => Classifier::useCase
-- CollectionType => Classifier::useCase
-- InvalidType => Classifier::useCase
-- MessageType => Classifier::useCase
-- OrderedSetType => Classifier::useCase
-- SequenceType => Classifier::useCase
-- SetType => Classifier::useCase
-- TemplateParameterType => Classifier::useCase
-- TupleType => Classifier::useCase
-- VoidType => Classifier::useCase
function Internal_Get_Variable
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element;
procedure Internal_Set_Variable
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element);
-- LetExp => LetExp::variable
function Internal_Get_Visibility
(Self : AMF.Internals.AMF_Element)
return AMF.UML.Optional_UML_Visibility_Kind;
procedure Internal_Set_Visibility
(Self : AMF.Internals.AMF_Element;
To : AMF.UML.Optional_UML_Visibility_Kind);
-- AnyType => NamedElement::visibility
-- AssociationClassCallExp => NamedElement::visibility
-- BagType => NamedElement::visibility
-- BooleanLiteralExp => NamedElement::visibility
-- CollectionItem => NamedElement::visibility
-- CollectionLiteralExp => NamedElement::visibility
-- CollectionRange => NamedElement::visibility
-- CollectionType => NamedElement::visibility
-- EnumLiteralExp => NamedElement::visibility
-- ExpressionInOcl => NamedElement::visibility
-- IfExp => NamedElement::visibility
-- IntegerLiteralExp => NamedElement::visibility
-- InvalidLiteralExp => NamedElement::visibility
-- InvalidType => NamedElement::visibility
-- IterateExp => NamedElement::visibility
-- IteratorExp => NamedElement::visibility
-- LetExp => NamedElement::visibility
-- MessageExp => NamedElement::visibility
-- MessageType => NamedElement::visibility
-- NullLiteralExp => NamedElement::visibility
-- OperationCallExp => NamedElement::visibility
-- OrderedSetType => NamedElement::visibility
-- PropertyCallExp => NamedElement::visibility
-- RealLiteralExp => NamedElement::visibility
-- SequenceType => NamedElement::visibility
-- SetType => NamedElement::visibility
-- StateExp => NamedElement::visibility
-- StringLiteralExp => NamedElement::visibility
-- TemplateParameterType => NamedElement::visibility
-- TupleLiteralExp => NamedElement::visibility
-- TupleLiteralPart => NamedElement::visibility
-- TupleType => NamedElement::visibility
-- TypeExp => NamedElement::visibility
-- UnlimitedNaturalLiteralExp => NamedElement::visibility
-- UnspecifiedValueExp => NamedElement::visibility
-- Variable => NamedElement::visibility
-- VariableExp => NamedElement::visibility
-- VoidType => NamedElement::visibility
end AMF.Internals.Tables.OCL_Attributes;
|
oeis/330/A330317.asm | neoneye/loda-programs | 11 | 4212 | ; A330317: a(n) = Sum_{i=0..n} r(i)*r(i+1), where r(n) = A004018(n) is the number of ways of writing n as a sum of two squares.
; Submitted by <NAME>
; 4,20,20,20,52,52,52,52,68,100,100,100,100,100,100,100,132,164,164,164,164,164,164,164,164,260,260,260,260,260,260,260,260,260,260,260,292,292,292,292,356,356,356,356,356,356,356,356,356,404,404,404,468,468,468,468,468,468,468,468,468,468,468,468,532,532,532
mov $1,$0
mov $3,$0
add $3,1
lpb $3
mov $0,$1
sub $3,1
sub $0,$3
add $0,1
bin $0,2
seq $0,4018 ; Theta series of square lattice (or number of ways of writing n as a sum of 2 squares). Often denoted by r(n) or r_2(n).
mul $0,4
add $2,$0
lpe
mov $0,$2
|
oeis/305/A305716.asm | neoneye/loda-programs | 11 | 163182 | ; A305716: Order of rowmotion on the divisor lattice for n.
; Submitted by <NAME>(s1)
; 2,3,3,4,3,4,3,5,4,4,3,5,3,4,4,6,3,5,3,5,4,4,3,6,4,4,5,5,3,5,3,7,4,4,4,6,3,4,4,6,3,5,3,5,5,4,3,7,4,5,4,5,3,6,4,6,4,4,3,6,3,4,5,8,4,5,3,5,4,5,3,7,3,4,5,5,4,5,3,7,6,4,3,6,4,4,4,6,3,6,4,5,4,4,4,8,3,5,5,6
lpb $0
seq $0,86436 ; Maximum number of parts possible in a factorization of n; a(1) = 1, and for n > 1, a(n) = A001222(n) = bigomega(n).
mov $1,$0
cmp $0,$2
lpe
mov $0,$1
add $0,2
|
ACH2034/mips-assembly/loop.asm | vitormrts/si-each-usp | 1 | 16350 | ########## LOOP
.text
.globl main
main:
li $a0,0 # inicia o total
li $a1,1 # inicia o contador
loop:
add $a0,$a0,$a1 # adiciona o contador no total
addi $a1,$a1,1 # incrementa o contador
ble $a1,10,loop #verifica se eh menor ou igual a 10. caso sim, continua o loop
li $v0,1 # imprime o resultado
syscall
li $v0,10 # termina
syscall |
Erathostenes-III/obj/b__main.adb | Maxelweb/concurrency-sandbox | 0 | 16953 | <reponame>Maxelweb/concurrency-sandbox<filename>Erathostenes-III/obj/b__main.adb<gh_stars>0
pragma Warnings (Off);
pragma Ada_95;
pragma Source_File_Name (ada_main, Spec_File_Name => "b__main.ads");
pragma Source_File_Name (ada_main, Body_File_Name => "b__main.adb");
pragma Suppress (Overflow_Check);
with System.Restrictions;
with Ada.Exceptions;
package body ada_main is
E073 : Short_Integer; pragma Import (Ada, E073, "system__os_lib_E");
E006 : Short_Integer; pragma Import (Ada, E006, "ada__exceptions_E");
E011 : Short_Integer; pragma Import (Ada, E011, "system__soft_links_E");
E023 : Short_Integer; pragma Import (Ada, E023, "system__exception_table_E");
E038 : Short_Integer; pragma Import (Ada, E038, "ada__containers_E");
E068 : Short_Integer; pragma Import (Ada, E068, "ada__io_exceptions_E");
E053 : Short_Integer; pragma Import (Ada, E053, "ada__strings_E");
E055 : Short_Integer; pragma Import (Ada, E055, "ada__strings__maps_E");
E059 : Short_Integer; pragma Import (Ada, E059, "ada__strings__maps__constants_E");
E043 : Short_Integer; pragma Import (Ada, E043, "interfaces__c_E");
E025 : Short_Integer; pragma Import (Ada, E025, "system__exceptions_E");
E079 : Short_Integer; pragma Import (Ada, E079, "system__object_reader_E");
E048 : Short_Integer; pragma Import (Ada, E048, "system__dwarf_lines_E");
E019 : Short_Integer; pragma Import (Ada, E019, "system__soft_links__initialize_E");
E037 : Short_Integer; pragma Import (Ada, E037, "system__traceback__symbolic_E");
E103 : Short_Integer; pragma Import (Ada, E103, "ada__tags_E");
E101 : Short_Integer; pragma Import (Ada, E101, "ada__streams_E");
E115 : Short_Integer; pragma Import (Ada, E115, "system__file_control_block_E");
E114 : Short_Integer; pragma Import (Ada, E114, "system__finalization_root_E");
E112 : Short_Integer; pragma Import (Ada, E112, "ada__finalization_E");
E111 : Short_Integer; pragma Import (Ada, E111, "system__file_io_E");
E162 : Short_Integer; pragma Import (Ada, E162, "system__task_info_E");
E156 : Short_Integer; pragma Import (Ada, E156, "system__task_primitives__operations_E");
E139 : Short_Integer; pragma Import (Ada, E139, "ada__calendar_E");
E137 : Short_Integer; pragma Import (Ada, E137, "ada__calendar__delays_E");
E196 : Short_Integer; pragma Import (Ada, E196, "ada__real_time_E");
E099 : Short_Integer; pragma Import (Ada, E099, "ada__text_io_E");
E176 : Short_Integer; pragma Import (Ada, E176, "system__tasking__initialization_E");
E184 : Short_Integer; pragma Import (Ada, E184, "system__tasking__protected_objects_E");
E186 : Short_Integer; pragma Import (Ada, E186, "system__tasking__protected_objects__entries_E");
E190 : Short_Integer; pragma Import (Ada, E190, "system__tasking__queuing_E");
E194 : Short_Integer; pragma Import (Ada, E194, "system__tasking__stages_E");
E135 : Short_Integer; pragma Import (Ada, E135, "soe_E");
Sec_Default_Sized_Stacks : array (1 .. 1) of aliased System.Secondary_Stack.SS_Stack (System.Parameters.Runtime_Default_Sec_Stack_Size);
Local_Priority_Specific_Dispatching : constant String := "";
Local_Interrupt_States : constant String := "";
Is_Elaborated : Boolean := False;
procedure finalize_library is
begin
E135 := E135 - 1;
declare
procedure F1;
pragma Import (Ada, F1, "soe__finalize_spec");
begin
F1;
end;
E186 := E186 - 1;
declare
procedure F2;
pragma Import (Ada, F2, "system__tasking__protected_objects__entries__finalize_spec");
begin
F2;
end;
E099 := E099 - 1;
declare
procedure F3;
pragma Import (Ada, F3, "ada__text_io__finalize_spec");
begin
F3;
end;
declare
procedure F4;
pragma Import (Ada, F4, "system__file_io__finalize_body");
begin
E111 := E111 - 1;
F4;
end;
declare
procedure Reraise_Library_Exception_If_Any;
pragma Import (Ada, Reraise_Library_Exception_If_Any, "__gnat_reraise_library_exception_if_any");
begin
Reraise_Library_Exception_If_Any;
end;
end finalize_library;
procedure adafinal is
procedure s_stalib_adafinal;
pragma Import (C, s_stalib_adafinal, "system__standard_library__adafinal");
procedure Runtime_Finalize;
pragma Import (C, Runtime_Finalize, "__gnat_runtime_finalize");
begin
if not Is_Elaborated then
return;
end if;
Is_Elaborated := False;
Runtime_Finalize;
s_stalib_adafinal;
end adafinal;
type No_Param_Proc is access procedure;
pragma Favor_Top_Level (No_Param_Proc);
procedure adainit is
Main_Priority : Integer;
pragma Import (C, Main_Priority, "__gl_main_priority");
Time_Slice_Value : Integer;
pragma Import (C, Time_Slice_Value, "__gl_time_slice_val");
WC_Encoding : Character;
pragma Import (C, WC_Encoding, "__gl_wc_encoding");
Locking_Policy : Character;
pragma Import (C, Locking_Policy, "__gl_locking_policy");
Queuing_Policy : Character;
pragma Import (C, Queuing_Policy, "__gl_queuing_policy");
Task_Dispatching_Policy : Character;
pragma Import (C, Task_Dispatching_Policy, "__gl_task_dispatching_policy");
Priority_Specific_Dispatching : System.Address;
pragma Import (C, Priority_Specific_Dispatching, "__gl_priority_specific_dispatching");
Num_Specific_Dispatching : Integer;
pragma Import (C, Num_Specific_Dispatching, "__gl_num_specific_dispatching");
Main_CPU : Integer;
pragma Import (C, Main_CPU, "__gl_main_cpu");
Interrupt_States : System.Address;
pragma Import (C, Interrupt_States, "__gl_interrupt_states");
Num_Interrupt_States : Integer;
pragma Import (C, Num_Interrupt_States, "__gl_num_interrupt_states");
Unreserve_All_Interrupts : Integer;
pragma Import (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts");
Detect_Blocking : Integer;
pragma Import (C, Detect_Blocking, "__gl_detect_blocking");
Default_Stack_Size : Integer;
pragma Import (C, Default_Stack_Size, "__gl_default_stack_size");
Default_Secondary_Stack_Size : System.Parameters.Size_Type;
pragma Import (C, Default_Secondary_Stack_Size, "__gnat_default_ss_size");
Leap_Seconds_Support : Integer;
pragma Import (C, Leap_Seconds_Support, "__gl_leap_seconds_support");
Bind_Env_Addr : System.Address;
pragma Import (C, Bind_Env_Addr, "__gl_bind_env_addr");
procedure Runtime_Initialize (Install_Handler : Integer);
pragma Import (C, Runtime_Initialize, "__gnat_runtime_initialize");
Finalize_Library_Objects : No_Param_Proc;
pragma Import (C, Finalize_Library_Objects, "__gnat_finalize_library_objects");
Binder_Sec_Stacks_Count : Natural;
pragma Import (Ada, Binder_Sec_Stacks_Count, "__gnat_binder_ss_count");
Default_Sized_SS_Pool : System.Address;
pragma Import (Ada, Default_Sized_SS_Pool, "__gnat_default_ss_pool");
begin
if Is_Elaborated then
return;
end if;
Is_Elaborated := True;
Main_Priority := 0;
Time_Slice_Value := -1;
WC_Encoding := 'b';
Locking_Policy := ' ';
Queuing_Policy := ' ';
Task_Dispatching_Policy := ' ';
System.Restrictions.Run_Time_Restrictions :=
(Set =>
(False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, True, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False),
Value => (0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
Violated =>
(False, False, False, False, True, True, False, False,
False, False, False, True, True, True, True, False,
False, False, True, False, True, True, False, True,
True, False, True, True, True, True, False, False,
False, False, False, True, False, False, True, False,
True, False, False, True, False, True, False, True,
True, False, False, True, False, False, True, False,
False, False, False, True, False, True, True, True,
False, False, True, False, True, True, True, False,
True, True, False, True, True, True, True, False,
False, True, False, False, False, False, True, True,
True, False, False, False),
Count => (0, 0, 0, 0, 1, 1, 1, 0, 0, 0),
Unknown => (False, False, False, False, False, False, True, False, False, False));
Priority_Specific_Dispatching :=
Local_Priority_Specific_Dispatching'Address;
Num_Specific_Dispatching := 0;
Main_CPU := -1;
Interrupt_States := Local_Interrupt_States'Address;
Num_Interrupt_States := 0;
Unreserve_All_Interrupts := 0;
Detect_Blocking := 0;
Default_Stack_Size := -1;
Leap_Seconds_Support := 0;
ada_main'Elab_Body;
Default_Secondary_Stack_Size := System.Parameters.Runtime_Default_Sec_Stack_Size;
Binder_Sec_Stacks_Count := 1;
Default_Sized_SS_Pool := Sec_Default_Sized_Stacks'Address;
Runtime_Initialize (1);
Finalize_Library_Objects := finalize_library'access;
Ada.Exceptions'Elab_Spec;
System.Soft_Links'Elab_Spec;
System.Exception_Table'Elab_Body;
E023 := E023 + 1;
Ada.Containers'Elab_Spec;
E038 := E038 + 1;
Ada.Io_Exceptions'Elab_Spec;
E068 := E068 + 1;
Ada.Strings'Elab_Spec;
E053 := E053 + 1;
Ada.Strings.Maps'Elab_Spec;
E055 := E055 + 1;
Ada.Strings.Maps.Constants'Elab_Spec;
E059 := E059 + 1;
Interfaces.C'Elab_Spec;
E043 := E043 + 1;
System.Exceptions'Elab_Spec;
E025 := E025 + 1;
System.Object_Reader'Elab_Spec;
E079 := E079 + 1;
System.Dwarf_Lines'Elab_Spec;
E048 := E048 + 1;
System.Os_Lib'Elab_Body;
E073 := E073 + 1;
System.Soft_Links.Initialize'Elab_Body;
E019 := E019 + 1;
E011 := E011 + 1;
System.Traceback.Symbolic'Elab_Body;
E037 := E037 + 1;
E006 := E006 + 1;
Ada.Tags'Elab_Spec;
Ada.Tags'Elab_Body;
E103 := E103 + 1;
Ada.Streams'Elab_Spec;
E101 := E101 + 1;
System.File_Control_Block'Elab_Spec;
E115 := E115 + 1;
System.Finalization_Root'Elab_Spec;
E114 := E114 + 1;
Ada.Finalization'Elab_Spec;
E112 := E112 + 1;
System.File_Io'Elab_Body;
E111 := E111 + 1;
System.Task_Info'Elab_Spec;
E162 := E162 + 1;
System.Task_Primitives.Operations'Elab_Body;
E156 := E156 + 1;
Ada.Calendar'Elab_Spec;
Ada.Calendar'Elab_Body;
E139 := E139 + 1;
Ada.Calendar.Delays'Elab_Body;
E137 := E137 + 1;
Ada.Real_Time'Elab_Spec;
Ada.Real_Time'Elab_Body;
E196 := E196 + 1;
Ada.Text_Io'Elab_Spec;
Ada.Text_Io'Elab_Body;
E099 := E099 + 1;
System.Tasking.Initialization'Elab_Body;
E176 := E176 + 1;
System.Tasking.Protected_Objects'Elab_Body;
E184 := E184 + 1;
System.Tasking.Protected_Objects.Entries'Elab_Spec;
E186 := E186 + 1;
System.Tasking.Queuing'Elab_Body;
E190 := E190 + 1;
System.Tasking.Stages'Elab_Body;
E194 := E194 + 1;
Soe'Elab_Spec;
Soe'Elab_Body;
E135 := E135 + 1;
end adainit;
procedure Ada_Main_Program;
pragma Import (Ada, Ada_Main_Program, "_ada_main");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer
is
procedure Initialize (Addr : System.Address);
pragma Import (C, Initialize, "__gnat_initialize");
procedure Finalize;
pragma Import (C, Finalize, "__gnat_finalize");
SEH : aliased array (1 .. 2) of Integer;
Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address;
pragma Volatile (Ensure_Reference);
begin
if gnat_argc = 0 then
gnat_argc := argc;
gnat_argv := argv;
end if;
gnat_envp := envp;
Initialize (SEH'Address);
adainit;
Ada_Main_Program;
adafinal;
Finalize;
return (gnat_exit_status);
end;
-- BEGIN Object file/option list
-- /home/maxelweb/Github/adacore-sandbox/Erathostenes-III/obj/soe.o
-- /home/maxelweb/Github/adacore-sandbox/Erathostenes-III/obj/main.o
-- -L/home/maxelweb/Github/adacore-sandbox/Erathostenes-III/obj/
-- -L/home/maxelweb/Github/adacore-sandbox/Erathostenes-III/obj/
-- -L/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/adalib/
-- -static
-- -lgnarl
-- -lgnat
-- -lrt
-- -lpthread
-- -ldl
-- END Object file/option list
end ada_main;
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce2204b.ada | best08618/asylo | 7 | 20692 | -- CE2204B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT READ AND END_OF_FILE ARE FORBIDDEN FOR SEQUENTIAL
-- FILES OF MODE OUT_FILE.
-- A) CHECK NON-TEMPORARY FILES.
-- APPLICABILITY CRITERIA:
-- THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH SUPPORT
-- THE CREATION OF SEQUENTIAL FILES.
-- HISTORY:
-- DLD 08/17/82
-- SPS 08/24/82
-- SPS 110/9/82
-- JBG 02/22/84 CHANGE TO .ADA TEST.
-- TBN 11/04/86 REVISED TEST TO OUTPUT A NON_APPLICABLE
-- RESULT WHEN FILES ARE NOT SUPPORTED.
-- GMT 07/24/87 SPLIT THIS TEST BY MOVING THE CODE FOR CHECKING
-- TEMPORARY FILES INTO CE2204D.ADA.
WITH REPORT; USE REPORT;
WITH SEQUENTIAL_IO;
PROCEDURE CE2204B IS
BEGIN
TEST ("CE2204B", "FOR A NON-TEMPORARY SEQUENTIAL FILE, CHECK " &
"THAT MODE_ERROR IS RAISED BY READ AND " &
"END_OF_FILE WHEN THE MODE IS OUT_FILE");
DECLARE
PACKAGE SEQ_IO IS NEW SEQUENTIAL_IO (INTEGER);
USE SEQ_IO;
SEQ_FILE : FILE_TYPE;
X : INTEGER;
B : BOOLEAN;
INCOMPLETE : EXCEPTION;
BEGIN
BEGIN
CREATE (SEQ_FILE, OUT_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED ON CREATE - 1");
RAISE INCOMPLETE;
WHEN NAME_ERROR =>
NOT_APPLICABLE ("NAME_ERROR RAISED ON CREATE - 2");
RAISE INCOMPLETE;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED ON CREATE - 3");
RAISE INCOMPLETE;
END;
WRITE (SEQ_FILE, 5);
BEGIN -- THIS IS ONLY
RESET (SEQ_FILE); -- AN ATTEMPT
EXCEPTION -- TO RESET,
WHEN USE_ERROR => -- IF RESET
NULL; -- N/A THEN
END; -- TEST IS
-- NOT AFFECTED.
BEGIN
READ (SEQ_FILE, X);
FAILED ("MODE_ERROR NOT RAISED ON READ - 4");
EXCEPTION
WHEN MODE_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED ON READ - 5");
END;
BEGIN
B := END_OF_FILE (SEQ_FILE);
FAILED ("MODE_ERROR NOT RAISED ON END_OF_FILE - 6");
EXCEPTION
WHEN MODE_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED - END_OF_FILE - 7");
END;
BEGIN
DELETE (SEQ_FILE);
EXCEPTION
WHEN USE_ERROR =>
NULL;
END;
EXCEPTION
WHEN INCOMPLETE =>
NULL;
END;
RESULT;
END CE2204B;
|
Transynther/x86/_processed/AVXALIGN/_ht_zr_/i9-9900K_12_0xca_notsx.log_21829_667.asm | ljhsiun2/medusa | 9 | 6900 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r15
push %r9
push %rbx
push %rdx
push %rsi
lea addresses_A_ht+0x15fa0, %rsi
nop
cmp %r12, %r12
vmovups (%rsi), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %r14
nop
nop
nop
nop
xor %rdx, %rdx
lea addresses_D_ht+0x140a0, %r15
xor %rbx, %rbx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm3
movups %xmm3, (%r15)
xor %rsi, %rsi
lea addresses_WC_ht+0xb710, %r12
nop
nop
nop
nop
nop
dec %r9
mov (%r12), %r14w
nop
nop
nop
and $59246, %r9
lea addresses_WT_ht+0x1c720, %r12
nop
cmp %rbx, %rbx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm2
movups %xmm2, (%r12)
sub %rbx, %rbx
pop %rsi
pop %rdx
pop %rbx
pop %r9
pop %r15
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %rax
push %rbp
push %rbx
push %rdx
push %rsi
// Faulty Load
mov $0x70cf5a00000006a0, %r10
nop
nop
nop
nop
nop
sub $50879, %rsi
vmovntdqa (%r10), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %rdx
lea oracles, %rax
and $0xff, %rdx
shlq $12, %rdx
mov (%rax,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rbx
pop %rbp
pop %rax
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7}}
{'00': 6399, '45': 15430}
45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 00 00 00 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 45 45 45 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 00 00 00 00 00 45 45 45 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45
*/
|
Transynther/x86/_processed/AVXALIGN/_st_4k_sm_/i9-9900K_12_0xca.log_4_1510.asm | ljhsiun2/medusa | 9 | 91477 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xede4, %rsi
lea addresses_normal_ht+0x18b04, %rdi
add %r11, %r11
mov $5, %rcx
rep movsw
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_WC_ht+0x12c84, %rsi
lea addresses_D_ht+0x19704, %rdi
nop
nop
nop
nop
nop
and $42428, %r11
mov $124, %rcx
rep movsl
inc %rbx
lea addresses_WT_ht+0x14304, %r13
nop
and $8728, %rdx
movb (%r13), %cl
nop
xor %rdx, %rdx
lea addresses_D_ht+0x1d3ac, %rbx
clflush (%rbx)
nop
nop
nop
nop
xor %r13, %r13
mov $0x6162636465666768, %rdi
movq %rdi, %xmm2
vmovups %ymm2, (%rbx)
nop
nop
cmp $39764, %rdi
lea addresses_UC_ht+0x2c44, %rdx
nop
nop
nop
nop
add $8049, %rdi
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
vmovups %ymm6, (%rdx)
nop
nop
xor %r11, %r11
lea addresses_WT_ht+0x17b84, %rdi
inc %r13
movw $0x6162, (%rdi)
nop
inc %rdi
lea addresses_A_ht+0x7a14, %rsi
lea addresses_WT_ht+0x51f4, %rdi
nop
nop
nop
inc %r10
mov $30, %rcx
rep movsw
nop
cmp %r11, %r11
lea addresses_D_ht+0x1cd8c, %rbx
nop
nop
xor %r10, %r10
movl $0x61626364, (%rbx)
nop
and $30588, %r11
lea addresses_WT_ht+0x3e54, %rcx
nop
nop
nop
nop
nop
cmp %rdx, %rdx
mov $0x6162636465666768, %r11
movq %r11, %xmm6
movups %xmm6, (%rcx)
nop
and $26222, %r10
lea addresses_D_ht+0xdb2a, %rdx
add %rdi, %rdi
mov (%rdx), %r13
nop
nop
nop
and $8023, %rcx
lea addresses_UC_ht+0xf704, %r13
nop
nop
nop
nop
nop
sub %r11, %r11
movl $0x61626364, (%r13)
nop
nop
and $10686, %rdi
lea addresses_normal_ht+0x4304, %r10
nop
nop
nop
nop
nop
add $19777, %rbx
movw $0x6162, (%r10)
nop
nop
nop
nop
cmp %r11, %r11
lea addresses_WT_ht+0x7ff8, %r11
nop
and %r10, %r10
mov (%r11), %cx
nop
inc %r10
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
// Load
lea addresses_A+0x11304, %rbx
nop
nop
dec %rdi
mov (%rbx), %r11w
nop
nop
nop
nop
nop
and %rbx, %rbx
// Load
lea addresses_A+0x193f4, %r10
nop
nop
nop
and $10825, %rcx
vmovups (%r10), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %rsi
nop
nop
nop
add %r11, %r11
// Store
lea addresses_US+0x6b74, %rax
nop
nop
cmp %r11, %r11
movl $0x51525354, (%rax)
nop
nop
nop
add $2620, %rcx
// Store
mov $0x3fb3d40000000304, %r11
nop
nop
add %rax, %rax
mov $0x5152535455565758, %rdi
movq %rdi, (%r11)
nop
add $11695, %rbx
// Store
lea addresses_UC+0x1ed04, %rdi
nop
nop
nop
inc %rbx
mov $0x5152535455565758, %r10
movq %r10, (%rdi)
cmp $27040, %r11
// Store
lea addresses_PSE+0xd0e4, %rbx
nop
dec %rdi
mov $0x5152535455565758, %r10
movq %r10, (%rbx)
nop
sub $19784, %rax
// Store
lea addresses_UC+0x3cc4, %r11
nop
nop
nop
nop
dec %rcx
mov $0x5152535455565758, %rsi
movq %rsi, %xmm5
vmovups %ymm5, (%r11)
nop
nop
nop
add $53332, %rsi
// Store
lea addresses_WC+0x16e64, %r11
nop
xor $1006, %rbx
mov $0x5152535455565758, %rdi
movq %rdi, %xmm7
movntdq %xmm7, (%r11)
nop
nop
nop
nop
nop
dec %r11
// Store
lea addresses_RW+0x1304, %rdi
nop
nop
xor %rbx, %rbx
mov $0x5152535455565758, %r11
movq %r11, %xmm5
movups %xmm5, (%rdi)
nop
nop
sub %r10, %r10
// Store
lea addresses_PSE+0x4b04, %r10
nop
xor %rcx, %rcx
mov $0x5152535455565758, %rbx
movq %rbx, %xmm0
movaps %xmm0, (%r10)
nop
nop
nop
nop
and %rcx, %rcx
// Faulty Load
lea addresses_RW+0x1304, %rcx
clflush (%rcx)
cmp $47737, %rax
mov (%rcx), %r10w
lea oracles, %rdi
and $0xff, %r10
shlq $12, %r10
mov (%rdi,%r10,1), %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': True, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': True, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': True, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': True, 'type': 'addresses_PSE', 'same': False, 'AVXalign': True, 'congruent': 11}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_RW', 'same': True, 'AVXalign': True, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}, 'dst': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': True, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 4}, 'dst': {'same': True, 'type': 'addresses_WT_ht', 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': True, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': True, 'AVXalign': False, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'58': 4}
58 58 58 58
*/
|
my Projects/LightMeter/lmeter2.asm | simonbrennan/PicMicroASM | 1 | 24721 | <reponame>simonbrennan/PicMicroASM
; **********************************************************
; * Name : <NAME> *
; * Date : 30/08/2003 *
; * Description : Program Reads an analogue value from *
; * an LDR and converts it to a digital *
; * value and is sent to a remote reciever *
; * (PC or PIC) *
; **********************************************************
list p=16F877
include <p16f877.inc>
PCL EQU 02h ; Address of program counter
F EQU 1h ; Result of operation into File
W EQU 0h ; Result of operation into Working Register
Status EQU 03h ; Address of status register
RP0 EQU 05h ; Bit 5 of Status Register
TrisA EQU 85h ; Address of Tristate Buffer A.
TrisC EQU 87h ; Address of Tristate Buffer C.
PortA EQU 05h ; Address of Port A.
Counter EQU 23h ; Stores the status of counter
Adh EQU 1Eh ; High Result of A/D Conversion
Adl EQU 9Eh ; Low Result of A/D Conversion
Adcon1 EQU 9Fh ; Address of Adcon1.
Adcon0 EQU 1Fh ; Analogue Digital Register
GO EQU 02h ; GO/Done bit for Adconverter
TRMT EQU 01h ; Transmit Status Register
Loop1 EQU 20h ; Count variable for the first loop
Loop2 EQU 21h ; Count variable for the second loop
Loop3 EQU 22h ; Count variable for the first loop
temp EQU 27h ; Temporary Variable
Tempreg EQU 28h ; Temp Recieve Register Storage
H_byte equ 29H ; Upper Byte for BCD to Decimal Conversion
L_byte equ 30H ; Lower Byte for BCD to Decimal Conversion
R0 equ 31H ; Result 0 of BCD to Decimal Conversion
R1 equ 32H ; Result 1 of BCD to Decimal Conversion
R2 equ 33H ; Result 2 of BCD to Decimal Conversion
Count equ 34H ; Counter Variable
;Serial Port Registers
TXSTA EQU 98h ; Serial Port Transmit Control Register
SPBRG EQU 99h ; Serial Port Baud Rate Generator Setting Register
TXREG EQU 19h ; Serial Port Transmit register
RCSTA EQU 18h ; Serial Port Receive register
INIT
BSF Status,RP0 ; Switch to Rambank 1
CLRF Adcon1 ; Set all bits on PortA to analogue
BSF Adcon1,7 ; Set ADFM to righthand justification
CLRF TrisA ; Set all bits on trisA to outputs
BSF TrisA,0 ; Set RA0 as input
BSF TrisC,6 ; Set TrisC bit 6 to output
;Serial Port Init
MOVLW 19h ; Set the baud rate to 9600 and brgh=1
MOVWF SPBRG ; //
MOVLW b'00100100' ; Asynchronous, brgh = 1, Transmit enable
MOVWF TXSTA ; //
BCF Status,5 ; Move to Memory Bank 0
MOVLW b'10000000' ; Enable Serial Port
MOVWF RCSTA ; //
;ADcon Init
MOVLW B'10000001' ; Set ADC to Channel 1 (RA1), Switch on ADC, Set Sampling Rate to Fosc/32
MOVWF Adcon0 ; //
START
BSF Adcon0,GO ; Start A/D Conversion
;CALL DELAY ; Short Delay for aquire voltage
BSF STATUS,5 ; Move to bank 1
MOVF Adl,W ; Get Low byte A/D result
BCF STATUS,5 ; Move to bank 0
MOVWF temp ; Save A/D Result in Temporary space
BTFSC temp,7 ; This part of the code is used to shift the A/D result.
BSF H_byte,7 ; We loose the 1 and 2 bits of A/D due to justification.
BTFSC temp,6 ; We must therefore shift the A/D result values two bits to the left
BSF H_byte,6 ; so that the BCD to Decimal conversion is accurate
RLF temp ; //
RLF temp ; //
MOVF temp,W ; //
MOVWF L_byte ; Put A/D value into memory for conversion procedure
CALL CONVERT ; Go and do the conversion
CALL LIGHTRATIO ; Take the result of BCD to DEC conversion and change it to a light meter value
MOVWF Tempreg ; Save Lightratio to temp location
CALL SENDDATA ; Send the value to serial port
GOTO START ; Loop back to start
CONVERT:
; Source code for this conversion courtesy of Microchip
;********************************************************************
; Binary To BCD Conversion Routine
; This routine converts a 16 Bit binary Number to a 5 Digit
; BCD Number. This routine is useful since PIC16C55 & PIC16C57
; have two 8 bit ports and one 4 bit port ( total of 5 BCD digits)
;
; The 16 bit binary number is input in locations H_byte and
; L_byte with the high byte in H_byte.
; The 5 digit BCD number is returned in R0, R1 and R2 with R0
; containing the MSD in its right most nibble.
;
; Performance :
; Program Memory : 35
; Clock Cycles : 885
;
;
; Revision Date:
; 1-13-97 Compatibility with MPASMWIN 1.40
;
;*******************************************************************;
bcf STATUS,0 ; clear the carry bit
movlw D'16'
movwf Count
clrf R0
clrf R1
clrf R2
loop16 rlf L_byte, F
rlf H_byte, F
rlf R2, F
rlf R1, F
rlf R0, F
;
decfsz Count, F
goto adjDEC
RETLW 0
;
adjDEC movlw R2
movwf FSR
call adjBCD
;
movlw R1
movwf FSR
call adjBCD
;
movlw R0
movwf FSR
call adjBCD
;
goto loop16
;
adjBCD movlw 3
addwf 0,W
movwf temp
btfsc temp,3 ; test if result > 7
movwf 0
movlw 30
addwf 0,W
movwf temp
btfsc temp,7 ; test if result > 7
movwf 0 ; save as MSD
RETLW 0
;**************************************************************************************
SENDDATA
MOVF Tempreg,W ; Load up the value to send
MOVWF TXREG ; Transmit A/D value
RETURN ;
LIGHTRATIO
MOVF R1,W ;Use decimal result to get lightmeter setting
ANDLW b'00001111' ;Remove the highest nibble
ADDWF PCL,F ;Return the value for meter display
RETLW B'00000000' ;Decode 0
RETLW B'10000000' ;Decode 1
RETLW B'11000000' ;Decode 2
RETLW B'11100000' ;Decode 3
RETLW B'11110000' ;Decode 4
RETLW B'11111000' ;Decode 5
RETLW B'11111100' ;Decode 6
RETLW B'11111110' ;Decode 7
RETLW B'11111111' ;Decode 8
RETLW B'11111111' ;Decode 9
DELAY
;RETURN ;Used for simulation purposes
MOVLW 05h ;Set delay for 0.5 Second
MOVWF Loop3 ;Set Loop3 to Loop 3 Times
LOOP
DECFSZ Loop1,1 ;Loop 255 times then move to next loop
Goto LOOP ;Go Back to the beginning of the Loop
DECFSZ Loop2,1 ;Loop 255 times then move to next loop
Goto LOOP ;Go Back to the beginning of the Loop
DECFSZ Loop3,1 ;Loop 5 times then move to next loop
Goto LOOP ;Go Back to the beginning of the Loop
RETURN ;Go back and execute instruction after last call
end ;End of Source
|
gcc-gcc-7_3_0-release/gcc/ada/g-spitbo.adb | best08618/asylo | 7 | 7392 | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- G N A T . S P I T B O L --
-- --
-- B o d y --
-- --
-- Copyright (C) 1998-2016, AdaCore --
-- --
-- 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Unbounded.Aux; use Ada.Strings.Unbounded.Aux;
with GNAT.Debug_Utilities; use GNAT.Debug_Utilities;
with GNAT.IO; use GNAT.IO;
with System.String_Hash;
with Ada.Unchecked_Deallocation;
package body GNAT.Spitbol is
---------
-- "&" --
---------
function "&" (Num : Integer; Str : String) return String is
begin
return S (Num) & Str;
end "&";
function "&" (Str : String; Num : Integer) return String is
begin
return Str & S (Num);
end "&";
function "&" (Num : Integer; Str : VString) return VString is
begin
return S (Num) & Str;
end "&";
function "&" (Str : VString; Num : Integer) return VString is
begin
return Str & S (Num);
end "&";
----------
-- Char --
----------
function Char (Num : Natural) return Character is
begin
return Character'Val (Num);
end Char;
----------
-- Lpad --
----------
function Lpad
(Str : VString;
Len : Natural;
Pad : Character := ' ') return VString
is
begin
if Length (Str) >= Len then
return Str;
else
return Tail (Str, Len, Pad);
end if;
end Lpad;
function Lpad
(Str : String;
Len : Natural;
Pad : Character := ' ') return VString
is
begin
if Str'Length >= Len then
return V (Str);
else
declare
R : String (1 .. Len);
begin
for J in 1 .. Len - Str'Length loop
R (J) := Pad;
end loop;
R (Len - Str'Length + 1 .. Len) := Str;
return V (R);
end;
end if;
end Lpad;
procedure Lpad
(Str : in out VString;
Len : Natural;
Pad : Character := ' ')
is
begin
if Length (Str) >= Len then
return;
else
Tail (Str, Len, Pad);
end if;
end Lpad;
-------
-- N --
-------
function N (Str : VString) return Integer is
S : Big_String_Access;
L : Natural;
begin
Get_String (Str, S, L);
return Integer'Value (S (1 .. L));
end N;
--------------------
-- Reverse_String --
--------------------
function Reverse_String (Str : VString) return VString is
S : Big_String_Access;
L : Natural;
begin
Get_String (Str, S, L);
declare
Result : String (1 .. L);
begin
for J in 1 .. L loop
Result (J) := S (L + 1 - J);
end loop;
return V (Result);
end;
end Reverse_String;
function Reverse_String (Str : String) return VString is
Result : String (1 .. Str'Length);
begin
for J in 1 .. Str'Length loop
Result (J) := Str (Str'Last + 1 - J);
end loop;
return V (Result);
end Reverse_String;
procedure Reverse_String (Str : in out VString) is
S : Big_String_Access;
L : Natural;
begin
Get_String (Str, S, L);
declare
Result : String (1 .. L);
begin
for J in 1 .. L loop
Result (J) := S (L + 1 - J);
end loop;
Set_Unbounded_String (Str, Result);
end;
end Reverse_String;
----------
-- Rpad --
----------
function Rpad
(Str : VString;
Len : Natural;
Pad : Character := ' ') return VString
is
begin
if Length (Str) >= Len then
return Str;
else
return Head (Str, Len, Pad);
end if;
end Rpad;
function Rpad
(Str : String;
Len : Natural;
Pad : Character := ' ') return VString
is
begin
if Str'Length >= Len then
return V (Str);
else
declare
R : String (1 .. Len);
begin
for J in Str'Length + 1 .. Len loop
R (J) := Pad;
end loop;
R (1 .. Str'Length) := Str;
return V (R);
end;
end if;
end Rpad;
procedure Rpad
(Str : in out VString;
Len : Natural;
Pad : Character := ' ')
is
begin
if Length (Str) >= Len then
return;
else
Head (Str, Len, Pad);
end if;
end Rpad;
-------
-- S --
-------
function S (Num : Integer) return String is
Buf : String (1 .. 30);
Ptr : Natural := Buf'Last + 1;
Val : Natural := abs (Num);
begin
loop
Ptr := Ptr - 1;
Buf (Ptr) := Character'Val (Val mod 10 + Character'Pos ('0'));
Val := Val / 10;
exit when Val = 0;
end loop;
if Num < 0 then
Ptr := Ptr - 1;
Buf (Ptr) := '-';
end if;
return Buf (Ptr .. Buf'Last);
end S;
------------
-- Substr --
------------
function Substr
(Str : VString;
Start : Positive;
Len : Natural) return VString
is
S : Big_String_Access;
L : Natural;
begin
Get_String (Str, S, L);
if Start > L then
raise Index_Error;
elsif Start + Len - 1 > L then
raise Length_Error;
else
return V (S (Start .. Start + Len - 1));
end if;
end Substr;
function Substr
(Str : String;
Start : Positive;
Len : Natural) return VString
is
begin
if Start > Str'Length then
raise Index_Error;
elsif Start + Len - 1 > Str'Length then
raise Length_Error;
else
return
V (Str (Str'First + Start - 1 .. Str'First + Start + Len - 2));
end if;
end Substr;
-----------
-- Table --
-----------
package body Table is
procedure Free is new
Ada.Unchecked_Deallocation (Hash_Element, Hash_Element_Ptr);
-----------------------
-- Local Subprograms --
-----------------------
function Hash is new System.String_Hash.Hash
(Character, String, Unsigned_32);
------------
-- Adjust --
------------
overriding procedure Adjust (Object : in out Table) is
Ptr1 : Hash_Element_Ptr;
Ptr2 : Hash_Element_Ptr;
begin
for J in Object.Elmts'Range loop
Ptr1 := Object.Elmts (J)'Unrestricted_Access;
if Ptr1.Name /= null then
loop
Ptr1.Name := new String'(Ptr1.Name.all);
exit when Ptr1.Next = null;
Ptr2 := Ptr1.Next;
Ptr1.Next := new Hash_Element'(Ptr2.all);
Ptr1 := Ptr1.Next;
end loop;
end if;
end loop;
end Adjust;
-----------
-- Clear --
-----------
procedure Clear (T : in out Table) is
Ptr1 : Hash_Element_Ptr;
Ptr2 : Hash_Element_Ptr;
begin
for J in T.Elmts'Range loop
if T.Elmts (J).Name /= null then
Free (T.Elmts (J).Name);
T.Elmts (J).Value := Null_Value;
Ptr1 := T.Elmts (J).Next;
T.Elmts (J).Next := null;
while Ptr1 /= null loop
Ptr2 := Ptr1.Next;
Free (Ptr1.Name);
Free (Ptr1);
Ptr1 := Ptr2;
end loop;
end if;
end loop;
end Clear;
----------------------
-- Convert_To_Array --
----------------------
function Convert_To_Array (T : Table) return Table_Array is
Num_Elmts : Natural := 0;
Elmt : Hash_Element_Ptr;
begin
for J in T.Elmts'Range loop
Elmt := T.Elmts (J)'Unrestricted_Access;
if Elmt.Name /= null then
loop
Num_Elmts := Num_Elmts + 1;
Elmt := Elmt.Next;
exit when Elmt = null;
end loop;
end if;
end loop;
declare
TA : Table_Array (1 .. Num_Elmts);
P : Natural := 1;
begin
for J in T.Elmts'Range loop
Elmt := T.Elmts (J)'Unrestricted_Access;
if Elmt.Name /= null then
loop
Set_Unbounded_String (TA (P).Name, Elmt.Name.all);
TA (P).Value := Elmt.Value;
P := P + 1;
Elmt := Elmt.Next;
exit when Elmt = null;
end loop;
end if;
end loop;
return TA;
end;
end Convert_To_Array;
----------
-- Copy --
----------
procedure Copy (From : Table; To : in out Table) is
Elmt : Hash_Element_Ptr;
begin
Clear (To);
for J in From.Elmts'Range loop
Elmt := From.Elmts (J)'Unrestricted_Access;
if Elmt.Name /= null then
loop
Set (To, Elmt.Name.all, Elmt.Value);
Elmt := Elmt.Next;
exit when Elmt = null;
end loop;
end if;
end loop;
end Copy;
------------
-- Delete --
------------
procedure Delete (T : in out Table; Name : Character) is
begin
Delete (T, String'(1 => Name));
end Delete;
procedure Delete (T : in out Table; Name : VString) is
S : Big_String_Access;
L : Natural;
begin
Get_String (Name, S, L);
Delete (T, S (1 .. L));
end Delete;
procedure Delete (T : in out Table; Name : String) is
Slot : constant Unsigned_32 := Hash (Name) mod T.N + 1;
Elmt : Hash_Element_Ptr := T.Elmts (Slot)'Unrestricted_Access;
Next : Hash_Element_Ptr;
begin
if Elmt.Name = null then
null;
elsif Elmt.Name.all = Name then
Free (Elmt.Name);
if Elmt.Next = null then
Elmt.Value := Null_Value;
return;
else
Next := Elmt.Next;
Elmt.Name := Next.Name;
Elmt.Value := Next.Value;
Elmt.Next := Next.Next;
Free (Next);
return;
end if;
else
loop
Next := Elmt.Next;
if Next = null then
return;
elsif Next.Name.all = Name then
Free (Next.Name);
Elmt.Next := Next.Next;
Free (Next);
return;
else
Elmt := Next;
end if;
end loop;
end if;
end Delete;
----------
-- Dump --
----------
procedure Dump (T : Table; Str : String := "Table") is
Num_Elmts : Natural := 0;
Elmt : Hash_Element_Ptr;
begin
for J in T.Elmts'Range loop
Elmt := T.Elmts (J)'Unrestricted_Access;
if Elmt.Name /= null then
loop
Num_Elmts := Num_Elmts + 1;
Put_Line
(Str & '<' & Image (Elmt.Name.all) & "> = " &
Img (Elmt.Value));
Elmt := Elmt.Next;
exit when Elmt = null;
end loop;
end if;
end loop;
if Num_Elmts = 0 then
Put_Line (Str & " is empty");
end if;
end Dump;
procedure Dump (T : Table_Array; Str : String := "Table_Array") is
begin
if T'Length = 0 then
Put_Line (Str & " is empty");
else
for J in T'Range loop
Put_Line
(Str & '(' & Image (To_String (T (J).Name)) & ") = " &
Img (T (J).Value));
end loop;
end if;
end Dump;
--------------
-- Finalize --
--------------
overriding procedure Finalize (Object : in out Table) is
Ptr1 : Hash_Element_Ptr;
Ptr2 : Hash_Element_Ptr;
begin
for J in Object.Elmts'Range loop
Ptr1 := Object.Elmts (J).Next;
Free (Object.Elmts (J).Name);
while Ptr1 /= null loop
Ptr2 := Ptr1.Next;
Free (Ptr1.Name);
Free (Ptr1);
Ptr1 := Ptr2;
end loop;
end loop;
end Finalize;
---------
-- Get --
---------
function Get (T : Table; Name : Character) return Value_Type is
begin
return Get (T, String'(1 => Name));
end Get;
function Get (T : Table; Name : VString) return Value_Type is
S : Big_String_Access;
L : Natural;
begin
Get_String (Name, S, L);
return Get (T, S (1 .. L));
end Get;
function Get (T : Table; Name : String) return Value_Type is
Slot : constant Unsigned_32 := Hash (Name) mod T.N + 1;
Elmt : Hash_Element_Ptr := T.Elmts (Slot)'Unrestricted_Access;
begin
if Elmt.Name = null then
return Null_Value;
else
loop
if Name = Elmt.Name.all then
return Elmt.Value;
else
Elmt := Elmt.Next;
if Elmt = null then
return Null_Value;
end if;
end if;
end loop;
end if;
end Get;
-------------
-- Present --
-------------
function Present (T : Table; Name : Character) return Boolean is
begin
return Present (T, String'(1 => Name));
end Present;
function Present (T : Table; Name : VString) return Boolean is
S : Big_String_Access;
L : Natural;
begin
Get_String (Name, S, L);
return Present (T, S (1 .. L));
end Present;
function Present (T : Table; Name : String) return Boolean is
Slot : constant Unsigned_32 := Hash (Name) mod T.N + 1;
Elmt : Hash_Element_Ptr := T.Elmts (Slot)'Unrestricted_Access;
begin
if Elmt.Name = null then
return False;
else
loop
if Name = Elmt.Name.all then
return True;
else
Elmt := Elmt.Next;
if Elmt = null then
return False;
end if;
end if;
end loop;
end if;
end Present;
---------
-- Set --
---------
procedure Set (T : in out Table; Name : VString; Value : Value_Type) is
S : Big_String_Access;
L : Natural;
begin
Get_String (Name, S, L);
Set (T, S (1 .. L), Value);
end Set;
procedure Set (T : in out Table; Name : Character; Value : Value_Type) is
begin
Set (T, String'(1 => Name), Value);
end Set;
procedure Set
(T : in out Table;
Name : String;
Value : Value_Type)
is
begin
if Value = Null_Value then
Delete (T, Name);
else
declare
Slot : constant Unsigned_32 := Hash (Name) mod T.N + 1;
Elmt : Hash_Element_Ptr := T.Elmts (Slot)'Unrestricted_Access;
subtype String1 is String (1 .. Name'Length);
begin
if Elmt.Name = null then
Elmt.Name := new String'(String1 (Name));
Elmt.Value := Value;
return;
else
loop
if Name = Elmt.Name.all then
Elmt.Value := Value;
return;
elsif Elmt.Next = null then
Elmt.Next := new Hash_Element'(
Name => new String'(String1 (Name)),
Value => Value,
Next => null);
return;
else
Elmt := Elmt.Next;
end if;
end loop;
end if;
end;
end if;
end Set;
end Table;
----------
-- Trim --
----------
function Trim (Str : VString) return VString is
begin
return Trim (Str, Right);
end Trim;
function Trim (Str : String) return VString is
begin
for J in reverse Str'Range loop
if Str (J) /= ' ' then
return V (Str (Str'First .. J));
end if;
end loop;
return Nul;
end Trim;
procedure Trim (Str : in out VString) is
begin
Trim (Str, Right);
end Trim;
-------
-- V --
-------
function V (Num : Integer) return VString is
Buf : String (1 .. 30);
Ptr : Natural := Buf'Last + 1;
Val : Natural := abs (Num);
begin
loop
Ptr := Ptr - 1;
Buf (Ptr) := Character'Val (Val mod 10 + Character'Pos ('0'));
Val := Val / 10;
exit when Val = 0;
end loop;
if Num < 0 then
Ptr := Ptr - 1;
Buf (Ptr) := '-';
end if;
return V (Buf (Ptr .. Buf'Last));
end V;
end GNAT.Spitbol;
|
projects/07/StackArithmetic/StackTest/StackTest.asm | theapi/nand2tetris | 0 | 19896 | <reponame>theapi/nand2tetris<gh_stars>0
// init to SP pointing to 256
@256
D=A
@SP
M=D
// constant
@17
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@17
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// eq
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // y
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M-D // x-y
@eq_true0
D;JEQ // jump if D == 0
D=0 // false
@eq_end1
0;JMP // jump to eq_end
(eq_true0)
D=-1 // true
(eq_end1)
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@17
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@16
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// eq
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // y
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M-D // x-y
@eq_true2
D;JEQ // jump if D == 0
D=0 // false
@eq_end3
0;JMP // jump to eq_end
(eq_true2)
D=-1 // true
(eq_end3)
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@16
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@17
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// eq
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // y
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M-D // x-y
@eq_true4
D;JEQ // jump if D == 0
D=0 // false
@eq_end5
0;JMP // jump to eq_end
(eq_true4)
D=-1 // true
(eq_end5)
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@892
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@891
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// gt
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // y
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M-D // x-y
@lt_true6
D;JLT // jump if D < 0
D=0 // false
@lt_end7
0;JMP // jump to lt_end
(lt_true6)
D=-1 // true
(lt_end7)
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@891
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@892
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// gt
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // y
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M-D // x-y
@lt_true8
D;JLT // jump if D < 0
D=0 // false
@lt_end9
0;JMP // jump to lt_end
(lt_true8)
D=-1 // true
(lt_end9)
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@891
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@891
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// gt
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // y
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M-D // x-y
@lt_true10
D;JLT // jump if D < 0
D=0 // false
@lt_end11
0;JMP // jump to lt_end
(lt_true10)
D=-1 // true
(lt_end11)
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@32767
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@32766
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// gt
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // y
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M-D // x-y
@gt_true12
D;JGT // jump if D > 0
D=0 // false
@gt_end13
0;JMP // jump to gt_end
(gt_true12)
D=-1 // true
(gt_end13)
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@32766
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@32767
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// gt
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // y
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M-D // x-y
@gt_true14
D;JGT // jump if D > 0
D=0 // false
@gt_end15
0;JMP // jump to gt_end
(gt_true14)
D=-1 // true
(gt_end15)
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@32766
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@32766
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// gt
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // y
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M-D // x-y
@gt_true16
D;JGT // jump if D > 0
D=0 // false
@gt_end17
0;JMP // jump to gt_end
(gt_true16)
D=-1 // true
(gt_end17)
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@57
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@31
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@53
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// add
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // the last entered value
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=D+M // x+y
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@112
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// sub
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // the last entered value
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M-D // x-y
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// neg
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=-D // -y
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// and
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // the last entered value
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=D&M // x And y
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// constant
@82
D=A // Store the numeric value in D
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// or
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=M // the last entered value
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=D|M // x Or y
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
// not
// POP
@SP
M=M-1 // decrement (pop) the stack pointer
A=M // set the address to where the SP is pointing
D=!D // !y
// PUSH
@SP
A=M // set the address to where the SP is pointing
M=D // store the value in the stack
@SP
M=M+1 // Advance the stack pointer
|
hidecpu2/samples/sort.asm | mmastrac/oblivious-cpu | 14 | 26798 | <reponame>mmastrac/oblivious-cpu
# Bubble sort
# r0: cmp/swap index
# r1: count
# r2: tmp swap space
# r3: swap count
start:
mov r3, 0 # swap count
mov r0, list # cmp/swap index
mov r1, [len] # count
sub r1, 2
loop:
mov r2, [r0] # r2<-a
cmp r2, [r0+1] # cmp w/b
blte noswap
swap r2, [r0+1] # b<->r2
swap r2, [r0] # r2<->a
add r3, 1
noswap:
add r0, 1
loop r1, loop
# Can use this instead of cmp/bne since it'll work the same
# way if we don't care about it after
loop r3, start
done:
mov r1, 99
mov [len], r1
halt
marker1:
data 99
len:
data 5
marker2:
data 99
list:
data 6, 5, 4, 9, 5
|
oeis/074/A074571.asm | neoneye/loda-programs | 11 | 3272 | ; A074571: a(n) = 5^n + 6^n + 7^n.
; Submitted by <NAME>(s2)
; 3,18,110,684,4322,27708,179930,1181604,7835042,52384428,352707050,2388951924,16262210162,111170407548,762690752570,5248264072644,36206628367682,250320112885068,1733788251844490,12027328411711764,83543792169315602,580959651881864988,4043826938216270810,28170398492089597284,196379217363663421922,1369796930917771555308,9559552181946717279530,66743303313208673217204,466164731662189395614642,3256937673614891715524028,22761345532987606924278650,159106482166043284155019524,1112409618418232434152581762
mov $3,$0
seq $0,74520 ; 1^n + 6^n + 7^n.
add $0,6
mov $2,5
pow $2,$3
add $0,$2
sub $0,7
|
alloy4fun_models/trainstlt/models/2/Kx2HuafDZdeZxkFXB.als | Kaixi26/org.alloytools.alloy | 0 | 2531 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idKx2HuafDZdeZxkFXB_prop3 {
always no prox
}
pred __repair { idKx2HuafDZdeZxkFXB_prop3 }
check __repair { idKx2HuafDZdeZxkFXB_prop3 <=> prop3o } |
test/interaction/Issue2447e.agda | shlevy/agda | 1,989 | 3849 | <gh_stars>1000+
-- Note that, at the time of writing, Agda does /not/ cache interfaces
-- if an internal error is encountered (at least in some cases).
import Issue2447.Internal-error
|
leddriver8bit.asm | brainsmoke/softpwmpdk | 1 | 21339 |
.module softpwmpdk
.include "pdk.asm"
.include "settings.asm"
.include "uart.asm"
.include "softpwm8.asm"
.area DATA (ABS)
.org 0x00
bufstart:
buf1: .ds 1
buf2: .ds 1
buf3: .ds 1
buf_: .ds (BUFSIZE - 3)
bufend:
val1: .ds 1
val2: .ds 1
val3: .ds 1
off1: .ds 1
off2: .ds 1
off3: .ds 1
cycle1: .ds 1
cycle2: .ds 1
cycle3: .ds 1
out: .ds 1
data: .ds 1
reset_count: .ds 1
wait_count: .ds 1
bit_count: .ds 1
buf_index: .ds 1
buf_index_high: .ds 1 ; needs to be zero
stream_index: .ds 1
index_const: .ds 1
; word aligned
p_lo: .ds 1
p_hi: .ds 1
.area CODE (ABS)
.org 0x00
; pull mosfets low first
clock_4mhz
;
; ________ ________
; ________0000000011111111222222223333333344444444555555556666666677777777
; /\ /\
; 1/8 baud 9 1/2 baud
; sample start bit (avg) sample stop bit (avg)
;
;baud = 19200
;start_wait = 6
;bit_wait = 4
;check_interval = 3*17
;cycles = (.5+start_wait+8*bit_wait)*check_interval
;t = 9.5/baud
;freq = cycles/t
;print(freq)
;
FREQ=3968337
easypdk_calibrate FREQ, 3300
mov a, #( (1<<CHANNEL1) | (1<<CHANNEL2) | (1<<CHANNEL3) )
mov pac, a
mov a, #0
mov pa, a
find_settings settings p_lo
read_settings index_const
softpwm_init
uart_init
u_idle:
softpwm
uart_idle u_idle, u_countdown, u_reset
u_reset:
softpwm
uart_reset u_idle
u_countdown:
softpwm
uart_countdown u_countdown, u_sample, u_stop_bit
u_sample:
softpwm
uart_sample u_countdown
u_stop_bit:
softpwm
uart_stop_bit u_store, u_stop_bit
u_store:
softpwm
uart_store u_idle
settings:
;.rept 256
;nop
;.endm
mov a, #INDEX
; update index by nopping (0x0000) out this instruction and appending a new mov, #NEW_INDEX
;
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cc/cc1308a.ada | best08618/asylo | 7 | 3786 | -- CC1308A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT FORMAL SUBPROGRAM PARAMETERS MAY OVERLOAD EACH OTHER
-- AND OTHER VISIBLE SUBPROGRAMS AND ENUMERATION LITERALS WITHIN AND
-- OUTSIDE OF THE GENERIC UNIT.
-- HISTORY:
-- DAT 09/08/81 CREATED ORIGINAL TEST.
-- SPS 10/26/82
-- SPS 02/09/83
-- BCB 08/09/88 REPLACED THE OLD TEST WITH A VERSION BASED ON
-- AIG 6.6/T2.
WITH REPORT; USE REPORT;
PROCEDURE CC1308A IS
TYPE ENUM IS (F1,F2,F3,F4,F5,F6,F7);
FUNCTION F1 (X : INTEGER) RETURN INTEGER IS
BEGIN
RETURN 2*X;
END F1;
PROCEDURE F1 (X : IN OUT INTEGER) IS
BEGIN
X := 3*X;
END F1;
PROCEDURE F2 (Y : IN OUT INTEGER; Z : IN OUT BOOLEAN) IS
BEGIN
Y := 2*Y;
Z := NOT Z;
END F2;
PROCEDURE F2 (Y : IN OUT INTEGER) IS
BEGIN
Y := 3*Y;
END F2;
PROCEDURE F3 (B : BOOLEAN := FALSE; A : IN OUT INTEGER) IS
BEGIN
A := 2*A;
END F3;
PROCEDURE F3 (A : IN OUT INTEGER) IS
BEGIN
A := 3*A;
END F3;
PROCEDURE F4 (C : IN OUT INTEGER) IS
BEGIN
C := 2*C;
END F4;
PROCEDURE F4 (C : IN OUT BOOLEAN) IS
BEGIN
C := NOT C;
END F4;
PROCEDURE F5 (D : IN OUT INTEGER; E : IN OUT BOOLEAN) IS
BEGIN
D := 2*D;
E := NOT E;
END F5;
PROCEDURE F5 (E : IN OUT BOOLEAN; D : IN OUT INTEGER) IS
BEGIN
E := NOT E;
D := 3*D;
END F5;
FUNCTION F6 (G : INTEGER) RETURN INTEGER IS
BEGIN
RETURN 2*G;
END F6;
FUNCTION F6 (G : INTEGER) RETURN BOOLEAN IS
BEGIN
RETURN TRUE;
END F6;
FUNCTION F7 RETURN INTEGER IS
BEGIN
RETURN 25;
END F7;
FUNCTION F7 RETURN BOOLEAN IS
BEGIN
RETURN FALSE;
END F7;
BEGIN
TEST ("CC1308A", "CHECK THAT FORMAL SUBPROGRAM PARAMETERS MAY " &
"OVERLOAD EACH OTHER AND OTHER VISIBLE " &
"SUBPROGRAMS AND ENUMERATION LITERALS WITHIN " &
"AND OUTSIDE OF THE GENERIC UNIT");
DECLARE
GENERIC
WITH FUNCTION F1 (X : INTEGER) RETURN INTEGER;
WITH PROCEDURE F1 (X : IN OUT INTEGER);
WITH PROCEDURE F2 (Y : IN OUT INTEGER;
Z : IN OUT BOOLEAN);
WITH PROCEDURE F2 (Y : IN OUT INTEGER);
WITH PROCEDURE F3 (B : BOOLEAN := FALSE;
A : IN OUT INTEGER);
WITH PROCEDURE F3 (A : IN OUT INTEGER);
WITH PROCEDURE F4 (C : IN OUT INTEGER);
WITH PROCEDURE F4 (C : IN OUT BOOLEAN);
WITH PROCEDURE F5 (D : IN OUT INTEGER;
E : IN OUT BOOLEAN);
WITH PROCEDURE F5 (E : IN OUT BOOLEAN;
D : IN OUT INTEGER);
WITH FUNCTION F6 (G : INTEGER) RETURN INTEGER;
WITH FUNCTION F6 (G : INTEGER) RETURN BOOLEAN;
WITH FUNCTION F7 RETURN INTEGER;
WITH FUNCTION F7 RETURN BOOLEAN;
PACKAGE P IS
TYPE EN IS (F1,F2,F3,F4,F5,F6,F7);
END P;
PACKAGE BODY P IS
X1, X2, Y1, Y2, A1, A2, C1, D1, D2, G1
: INTEGER := IDENT_INT(5);
VAL : INTEGER := IDENT_INT(0);
Z1, B1, C2, E1, E2, BOOL : BOOLEAN := IDENT_BOOL(FALSE);
BEGIN
VAL := F1(X1);
IF NOT EQUAL(VAL,10) THEN
FAILED ("CASE 1 - WRONG VALUE RETURNED FROM " &
"FUNCTION");
END IF;
F1(X2);
IF NOT EQUAL(X2,15) THEN
FAILED ("CASE 1 - WRONG VALUE ASSIGNED INSIDE " &
"PROCEDURE");
END IF;
F2(Y1,Z1);
IF NOT EQUAL(Y1,10) OR Z1 /= TRUE THEN
FAILED ("CASE 2 - WRONG VALUES ASSIGNED INSIDE " &
"PROCEDURE");
END IF;
F2(Y2);
IF NOT EQUAL(Y2,15) THEN
FAILED ("CASE 2 - WRONG VALUE ASSIGNED INSIDE " &
"PROCEDURE");
END IF;
F3(B1,A1);
IF NOT EQUAL(A1,10) OR B1 /= FALSE THEN
FAILED ("CASE 3 - WRONG VALUES ASSIGNED INSIDE " &
"PROCEDURE");
END IF;
F3(A2);
IF NOT EQUAL(A2,15) THEN
FAILED ("CASE 3 - WRONG VALUE ASSIGNED INSIDE " &
"PROCEDURE");
END IF;
F4(C1);
IF NOT EQUAL(C1,10) THEN
FAILED ("CASE 4 - WRONG VALUE ASSIGNED INSIDE " &
"PROCEDURE - BASE TYPE INTEGER");
END IF;
F4(C2);
IF C2 /= TRUE THEN
FAILED ("CASE 4 - WRONG VALUE ASSIGNED INSIDE " &
"PROCEDURE - BASE TYPE BOOLEAN");
END IF;
F5(D1,E1);
IF NOT EQUAL(D1,10) OR E1 /= TRUE THEN
FAILED ("CASE 5 - WRONG VALUES ASSIGNED INSIDE " &
"PROCEDURE - ORDER WAS INTEGER, BOOLEAN");
END IF;
F5(E2,D2);
IF E2 /= TRUE OR NOT EQUAL(D2,15) THEN
FAILED ("CASE 5 - WRONG VALUES ASSIGNED INSIDE " &
"PROCEDURE - ORDER WAS BOOLEAN, INTEGER");
END IF;
VAL := F6(G1);
IF NOT EQUAL(VAL,10) THEN
FAILED ("CASE 6 - WRONG VALUE RETURNED FROM " &
"FUNCTION - TYPE INTEGER");
END IF;
BOOL := F6(G1);
IF BOOL /= TRUE THEN
FAILED ("CASE 6 - WRONG VALUE RETURNED FROM " &
"FUNCTION - TYPE BOOLEAN");
END IF;
VAL := F7;
IF NOT EQUAL(VAL,25) THEN
FAILED ("CASE 7 - WRONG VALUE RETURNED FROM " &
"PARAMETERLESS FUNCTION - TYPE INTEGER");
END IF;
BOOL := F7;
IF BOOL /= FALSE THEN
FAILED ("CASE 7 - WRONG VALUE RETURNED FROM " &
"PARAMETERLESS FUNCTION - TYPE BOOLEAN");
END IF;
END P;
PACKAGE NEW_P IS NEW P (F1, F1, F2, F2, F3, F3,
F4, F4, F5, F5, F6, F6, F7, F7);
BEGIN
NULL;
END;
RESULT;
END CC1308A;
|
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_audio_gstaudiosrc_h.ads | persan/A-gst | 1 | 12646 | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib.Values;
with System;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstbaseaudiosrc_h;
-- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstringbuffer_h;
with glib;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstaudiosrc_h is
-- unsupported macro: GST_TYPE_AUDIO_SRC (gst_audio_src_get_type())
-- arg-macro: function GST_AUDIO_SRC (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SRC,GstAudioSrc);
-- arg-macro: function GST_AUDIO_SRC_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SRC,GstAudioSrcClass);
-- arg-macro: function GST_AUDIO_SRC_GET_CLASS (obj)
-- return G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SRC,GstAudioSrcClass);
-- arg-macro: function GST_IS_AUDIO_SRC (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SRC);
-- arg-macro: function GST_IS_AUDIO_SRC_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SRC);
-- GStreamer
-- * Copyright (C) 1999,2000 <NAME> <<EMAIL>>
-- * 2005 <NAME> <<EMAIL>>
-- *
-- * gstaudiosrc.h:
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
type GstAudioSrc;
type u_GstAudioSrc_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstAudioSrc is u_GstAudioSrc; -- gst/audio/gstaudiosrc.h:38
type GstAudioSrcClass;
type u_GstAudioSrcClass_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstAudioSrcClass is u_GstAudioSrcClass; -- gst/audio/gstaudiosrc.h:39
--*
-- * GstAudioSrc:
-- *
-- * Base class for simple audio sources.
--
type GstAudioSrc is record
element : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstbaseaudiosrc_h.GstBaseAudioSrc; -- gst/audio/gstaudiosrc.h:47
thread : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread; -- gst/audio/gstaudiosrc.h:50
u_gst_reserved : u_GstAudioSrc_u_gst_reserved_array; -- gst/audio/gstaudiosrc.h:53
end record;
pragma Convention (C_Pass_By_Copy, GstAudioSrc); -- gst/audio/gstaudiosrc.h:46
--< private >
-- with LOCK
--< private >
--*
-- * GstAudioSrcClass:
-- * @parent_class: the parent class.
-- * @open: open the device with the specified caps
-- * @prepare: configure device with format
-- * @unprepare: undo the configuration
-- * @close: close the device
-- * @read: read samples to the audio device
-- * @delay: the number of samples queued in the device
-- * @reset: unblock a read to the device and reset.
-- *
-- * #GstAudioSrc class. Override the vmethod to implement
-- * functionality.
--
type GstAudioSrcClass is record
parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstbaseaudiosrc_h.GstBaseAudioSrcClass; -- gst/audio/gstaudiosrc.h:71
open : access function (arg1 : access GstAudioSrc) return GLIB.gboolean; -- gst/audio/gstaudiosrc.h:76
prepare : access function (arg1 : access GstAudioSrc; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstringbuffer_h.GstRingBufferSpec) return GLIB.gboolean; -- gst/audio/gstaudiosrc.h:78
unprepare : access function (arg1 : access GstAudioSrc) return GLIB.gboolean; -- gst/audio/gstaudiosrc.h:80
close : access function (arg1 : access GstAudioSrc) return GLIB.gboolean; -- gst/audio/gstaudiosrc.h:82
read : access function
(arg1 : access GstAudioSrc;
arg2 : System.Address;
arg3 : GLIB.guint) return GLIB.guint; -- gst/audio/gstaudiosrc.h:84
c_delay : access function (arg1 : access GstAudioSrc) return GLIB.guint; -- gst/audio/gstaudiosrc.h:86
reset : access procedure (arg1 : access GstAudioSrc); -- gst/audio/gstaudiosrc.h:88
u_gst_reserved : u_GstAudioSrcClass_u_gst_reserved_array; -- gst/audio/gstaudiosrc.h:91
end record;
pragma Convention (C_Pass_By_Copy, GstAudioSrcClass); -- gst/audio/gstaudiosrc.h:70
-- vtable
-- open the device with given specs
-- prepare resources and state to operate with the given specs
-- undo anything that was done in prepare()
-- close the device
-- read samples from the device
-- get number of samples queued in the device
-- reset the audio device, unblock from a write
--< private >
function gst_audio_src_get_type return GLIB.GType; -- gst/audio/gstaudiosrc.h:94
pragma Import (C, gst_audio_src_get_type, "gst_audio_src_get_type");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_audio_gstaudiosrc_h;
|
src/kernel/kernel_entry.asm | RoyShulman/OS | 1 | 97555 | <gh_stars>1-10
; Small file to make sure when jumping to kernel code we will jump to main
; This code will always be at the start address of where we load our kernel
[bits 32]
[extern main]
call main
jmp $
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1750.asm | ljhsiun2/medusa | 9 | 13790 | <filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1750.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r15
push %r8
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x152cb, %rsi
lea addresses_UC_ht+0xeecb, %rdi
nop
nop
and %r8, %r8
mov $91, %rcx
rep movsw
nop
xor $46506, %rbx
lea addresses_WC_ht+0x105cb, %rcx
clflush (%rcx)
nop
nop
xor %r15, %r15
movw $0x6162, (%rcx)
dec %rsi
lea addresses_A_ht+0x118fb, %rbx
nop
xor %rsi, %rsi
movb (%rbx), %r15b
nop
and %r15, %r15
lea addresses_A_ht+0x19ccb, %rdi
nop
nop
nop
sub $35377, %r15
movups (%rdi), %xmm1
vpextrq $1, %xmm1, %r8
nop
cmp $63780, %r8
lea addresses_normal_ht+0x10e83, %rsi
lea addresses_D_ht+0xbdcb, %rdi
nop
nop
nop
cmp $55333, %rax
mov $75, %rcx
rep movsb
and $4324, %rsi
lea addresses_D_ht+0x12e92, %rdi
nop
nop
nop
nop
nop
xor $22520, %rcx
movups (%rdi), %xmm0
vpextrq $0, %xmm0, %rbx
nop
nop
nop
sub $47591, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %rax
push %rbp
push %rbx
push %rdx
// Store
lea addresses_normal+0x114cb, %r15
and $63421, %rdx
movw $0x5152, (%r15)
nop
nop
nop
nop
nop
and %r15, %r15
// Faulty Load
lea addresses_normal+0x114cb, %r13
nop
nop
nop
and %rbx, %rbx
movups (%r13), %xmm4
vpextrq $1, %xmm4, %r15
lea oracles, %rax
and $0xff, %r15
shlq $12, %r15
mov (%rax,%r15,1), %r15
pop %rdx
pop %rbx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal', 'congruent': 0}}
{'dst': {'same': True, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_normal', 'congruent': 0}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WC_ht', 'congruent': 5}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A_ht', 'congruent': 2}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_A_ht', 'congruent': 10}}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 0}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
gyak/gyak1-2/nalattk.adb | balintsoos/LearnAda | 0 | 20119 | <filename>gyak/gyak1-2/nalattk.adb
with Ada.Integer_Text_IO;
procedure nAlattK is
N, K : Positive;
Result : Positive := 1;
begin
Ada.Integer_Text_IO.Get( N ); -- Constraint_Error!
Ada.Integer_Text_IO.Get( K );
for I in 1..K loop
Result := Result * (N - I + 1) / I;
end loop;
Ada.Integer_Text_IO.Put( Result );
end nAlattK;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/raise_ce.adb | best08618/asylo | 7 | 21963 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/raise_ce.adb
procedure Raise_CE is
begin
raise Constraint_Error;
end;
|
programs/oeis/279/A279766.asm | neoneye/loda | 22 | 104094 | ; A279766: Number of odd digits in the decimal expansions of integers 1 to n.
; 0,1,1,2,2,3,3,4,4,5,6,8,9,11,12,14,15,17,18,20,20,21,21,22,22,23,23,24,24,25,26,28,29,31,32,34,35,37,38,40,40,41,41,42,42,43,43,44,44,45,46,48,49,51,52,54,55,57,58,60,60,61,61,62,62,63,63,64,64,65,66,68,69,71,72,74,75,77,78,80,80,81,81,82,82,83,83,84,84,85,86,88,89,91,92,94,95,97,98,100
mov $3,$0
mov $4,$0
lpb $3
mov $0,$4
sub $3,1
sub $0,$3
mov $5,0
lpb $0
mov $2,$0
div $0,10
mod $2,2
add $5,$2
lpe
add $1,$5
lpe
mov $0,$1
|
test/interaction/Issue3687.agda | shlevy/agda | 1,989 | 11562 | <reponame>shlevy/agda
-- Andreas, 2019-04-10, issue #3687, name mayhem when printing module contents (C-c C-o)
-- {-# OPTIONS -v interaction.contents.record:20 #-}
record Cat : Set₁ where
field
Obj : Set
Hom : (A B : Obj) → Set
Eq : ∀{A B} (f g : Hom A B) → Set
id : (A : Obj) → Hom A A
comp : ∀{A B C} (f : Hom B C) (g : Hom A B) → Hom A C
record Functor (C1 C2 : Cat) : Set where
record FunEq {C D : Cat} (F G : Functor C D) : Set₁ where
field
eqMap : ∀{c d} (f g : Cat.Hom C c d) (eq : Cat.Eq C f g) → Set
test : ∀ C D (F G : Functor C D) → FunEq F G
FunEq.eqMap (test C D F G) f g f=g = {!D!} -- C-c C-o
-- In the output, the names are completely garbled:
-- Names
-- Obj : Set
-- Hom : f=g → f=g → Set
-- Eq : {A B : g} → f=g A B → f=g A B → Set
-- id : (A : f) → g A A
-- comp : {A B : d} {C = C₁ : d} → f B C₁ → f A B → f A C₁
-- test/interaction$ make AGDA_BIN=agda-2.5.1.1 Issue3687.cmp
|
programs/oeis/077/A077868.asm | neoneye/loda | 22 | 179233 | ; A077868: Expansion of (1-x)^(-1)/(1-x-x^3).
; 1,2,3,5,8,12,18,27,40,59,87,128,188,276,405,594,871,1277,1872,2744,4022,5895,8640,12663,18559,27200,39864,58424,85625,125490,183915,269541,395032,578948,848490,1243523,1822472,2670963,3914487,5736960,8407924,12322412
mov $2,$0
lpb $2
mov $0,$3
add $1,1
sub $2,1
mov $3,$4
mov $4,$1
add $1,$0
lpe
add $1,1
mov $0,$1
|
src/ado-drivers-connections.ads | Letractively/ada-ado | 0 | 11177 | <filename>src/ado-drivers-connections.ads
-----------------------------------------------------------------------
-- ADO Drivers -- Database Drivers
-- Copyright (C) 2010, 2011, 2012 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Finalization;
with ADO.Statements;
with ADO.Schemas;
with Util.Properties;
with Util.Strings;
-- The <b>ADO.Drivers</b> package represents the database driver that will create
-- database connections and provide the database specific implementation.
package ADO.Drivers.Connections is
use ADO.Statements;
type Driver is abstract tagged limited private;
type Driver_Access is access all Driver'Class;
-- ------------------------------
-- Database connection implementation
-- ------------------------------
--
type Database_Connection is abstract new Ada.Finalization.Limited_Controlled with record
Count : Natural := 0;
Ident : String (1 .. 8) := (others => ' ');
end record;
type Database_Connection_Access is access all Database_Connection'Class;
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Query_Statement_Access is abstract;
function Create_Statement (Database : in Database_Connection;
Query : in String)
return Query_Statement_Access is abstract;
-- Create a delete statement.
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Delete_Statement_Access is abstract;
-- Create an insert statement.
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Insert_Statement_Access is abstract;
-- Create an update statement.
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Update_Statement_Access is abstract;
-- Start a transaction.
procedure Begin_Transaction (Database : in out Database_Connection) is abstract;
-- Commit the current transaction.
procedure Commit (Database : in out Database_Connection) is abstract;
-- Rollback the current transaction.
procedure Rollback (Database : in out Database_Connection) is abstract;
-- Load the database schema definition for the current database.
procedure Load_Schema (Database : in Database_Connection;
Schema : out ADO.Schemas.Schema_Definition) is abstract;
-- Get the database driver which manages this connection.
function Get_Driver (Database : in Database_Connection)
return Driver_Access is abstract;
-- Closes the database connection
procedure Close (Database : in out Database_Connection) is abstract;
-- ------------------------------
-- The database configuration properties
-- ------------------------------
type Configuration is new Ada.Finalization.Controlled with private;
type Configuration_Access is access all Configuration'Class;
-- Set the connection URL to connect to the database.
-- The driver connection is a string of the form:
--
-- driver://[host][:port]/[database][?property1][=value1]...
--
-- If the string is invalid or if the driver cannot be found,
-- the Connection_Error exception is raised.
procedure Set_Connection (Controller : in out Configuration;
URI : in String);
-- Set a property on the datasource for the driver.
-- The driver can retrieve the property to configure and open
-- the database connection.
procedure Set_Property (Controller : in out Configuration;
Name : in String;
Value : in String);
-- Get a property from the data source configuration.
-- If the property does not exist, an empty string is returned.
function Get_Property (Controller : in Configuration;
Name : in String) return String;
-- Get the server hostname.
function Get_Server (Controller : in Configuration) return String;
-- Get the server port.
function Get_Port (Controller : in Configuration) return Integer;
-- Get the database name.
function Get_Database (Controller : in Configuration) return String;
-- Create a new connection using the configuration parameters.
procedure Create_Connection (Config : in Configuration'Class;
Result : out Database_Connection_Access);
-- ------------------------------
-- Database Driver
-- ------------------------------
-- Create a new connection using the configuration parameters.
procedure Create_Connection (D : in out Driver;
Config : in Configuration'Class;
Result : out Database_Connection_Access) is abstract;
-- Get the driver unique index.
function Get_Driver_Index (D : in Driver) return Driver_Index;
-- Get the driver name.
function Get_Driver_Name (D : in Driver) return String;
-- Register a database driver.
procedure Register (Driver : in Driver_Access);
-- Get a database driver given its name.
function Get_Driver (Name : in String) return Driver_Access;
private
type Driver is abstract new Ada.Finalization.Limited_Controlled with record
Name : Util.Strings.Name_Access;
Index : Driver_Index;
end record;
type Configuration is new Ada.Finalization.Controlled with record
URI : Unbounded_String := Null_Unbounded_String;
Server : Unbounded_String := Null_Unbounded_String;
Port : Integer := 0;
Database : Unbounded_String := Null_Unbounded_String;
Properties : Util.Properties.Manager;
Driver : Driver_Access;
end record;
end ADO.Drivers.Connections;
|
firehog/ncurses/Ada95/samples/sample-menu_demo.adb | KipodAfterFree/KAF-2019-FireHog | 0 | 7989 | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Menu_Demo --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: <NAME> <<EMAIL>> 1996
-- Version Control
-- $Revision: 1.7 $
-- Binding Version 00.93
------------------------------------------------------------------------------
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus;
with Terminal_Interface.Curses.Menus.Menu_User_Data;
with Terminal_Interface.Curses.Menus.Item_User_Data;
with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
with Sample.Manifest; use Sample.Manifest;
with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
with Sample.Keyboard_Handler; use Sample.Keyboard_Handler;
with Sample.Menu_Demo.Handler;
with Sample.Helpers; use Sample.Helpers;
with Sample.Explanation; use Sample.Explanation;
package body Sample.Menu_Demo is
package Spacing_Demo is
procedure Spacing_Test;
end Spacing_Demo;
package body Spacing_Demo is
procedure Spacing_Test
is
function My_Driver (M : Menu;
K : Key_Code;
P : Panel) return Boolean;
procedure Set_Option_Key;
procedure Set_Select_Key;
procedure Set_Description_Key;
procedure Set_Hide_Key;
package Mh is new Sample.Menu_Demo.Handler (My_Driver);
I : Item_Array_Access := new Item_Array'
(New_Item ("January", "31 Days"),
New_Item ("February", "28/29 Days"),
New_Item ("March", "31 Days"),
New_Item ("April", "30 Days"),
New_Item ("May", "31 Days"),
New_Item ("June", "30 Days"),
New_Item ("July", "31 Days"),
New_Item ("August", "31 Days"),
New_Item ("September", "30 Days"),
New_Item ("October", "31 Days"),
New_Item ("November", "30 Days"),
New_Item ("December", "31 Days"),
Null_Item);
M : Menu := New_Menu (I);
Flip_State : Boolean := True;
Hide_Long : Boolean := False;
type Format_Code is (Four_By_1, Four_By_2, Four_By_3);
type Operations is (Flip, Reorder, Reformat, Reselect, Describe);
type Change is array (Operations) of Boolean;
pragma Pack (Change);
No_Change : constant Change := Change'(others => False);
Current_Format : Format_Code := Four_By_1;
To_Change : Change := No_Change;
function My_Driver (M : Menu;
K : Key_Code;
P : Panel) return Boolean
is
begin
To_Change := No_Change;
if K in User_Key_Code'Range then
if K = QUIT then
return True;
end if;
end if;
if K in Special_Key_Code'Range then
case K is
when Key_F4 =>
To_Change (Flip) := True;
return True;
when Key_F5 =>
To_Change (Reformat) := True;
Current_Format := Four_By_1;
return True;
when Key_F6 =>
To_Change (Reformat) := True;
Current_Format := Four_By_2;
return True;
when Key_F7 =>
To_Change (Reformat) := True;
Current_Format := Four_By_3;
return True;
when Key_F8 =>
To_Change (Reorder) := True;
return True;
when Key_F9 =>
To_Change (Reselect) := True;
return True;
when Key_F10 =>
if Current_Format /= Four_By_3 then
To_Change (Describe) := True;
return True;
else
return False;
end if;
when Key_F11 =>
Hide_Long := not Hide_Long;
declare
O : Item_Option_Set;
begin
for J in I'Range loop
Get_Options (I (J), O);
O.Selectable := True;
if Hide_Long then
case J is
when 1 | 3 | 5 | 7 | 8 | 10 | 12 =>
O.Selectable := False;
when others => null;
end case;
end if;
Set_Options (I (J), O);
end loop;
end;
return False;
when others => null;
end case;
end if;
return False;
end My_Driver;
procedure Set_Option_Key
is
O : Menu_Option_Set;
begin
if Current_Format = Four_By_1 then
Set_Soft_Label_Key (8, "");
else
Get_Options (M, O);
if O.Row_Major_Order then
Set_Soft_Label_Key (8, "O-Col");
else
Set_Soft_Label_Key (8, "O-Row");
end if;
end if;
Refresh_Soft_Label_Keys_Without_Update;
end Set_Option_Key;
procedure Set_Select_Key
is
O : Menu_Option_Set;
begin
Get_Options (M, O);
if O.One_Valued then
Set_Soft_Label_Key (9, "Multi");
else
Set_Soft_Label_Key (9, "Singl");
end if;
Refresh_Soft_Label_Keys_Without_Update;
end Set_Select_Key;
procedure Set_Description_Key
is
O : Menu_Option_Set;
begin
if Current_Format = Four_By_3 then
Set_Soft_Label_Key (10, "");
else
Get_Options (M, O);
if O.Show_Descriptions then
Set_Soft_Label_Key (10, "-Desc");
else
Set_Soft_Label_Key (10, "+Desc");
end if;
end if;
Refresh_Soft_Label_Keys_Without_Update;
end Set_Description_Key;
procedure Set_Hide_Key
is
begin
if Hide_Long then
Set_Soft_Label_Key (11, "Enab");
else
Set_Soft_Label_Key (11, "Disab");
end if;
Refresh_Soft_Label_Keys_Without_Update;
end Set_Hide_Key;
begin
Push_Environment ("MENU01");
Notepad ("MENU-PAD01");
Default_Labels;
Set_Soft_Label_Key (4, "Flip");
Set_Soft_Label_Key (5, "4x1");
Set_Soft_Label_Key (6, "4x2");
Set_Soft_Label_Key (7, "4x3");
Set_Option_Key;
Set_Select_Key;
Set_Description_Key;
Set_Hide_Key;
Set_Format (M, 4, 1);
loop
Mh.Drive_Me (M);
exit when To_Change = No_Change;
if To_Change (Flip) then
if Flip_State then
Flip_State := False;
Set_Spacing (M, 3, 2, 0);
else
Flip_State := True;
Set_Spacing (M);
end if;
elsif To_Change (Reformat) then
case Current_Format is
when Four_By_1 => Set_Format (M, 4, 1);
when Four_By_2 => Set_Format (M, 4, 2);
when Four_By_3 =>
declare
O : Menu_Option_Set;
begin
Get_Options (M, O);
O.Show_Descriptions := False;
Set_Options (M, O);
Set_Format (M, 4, 3);
end;
end case;
Set_Option_Key;
Set_Description_Key;
elsif To_Change (Reorder) then
declare
O : Menu_Option_Set;
begin
Get_Options (M, O);
O.Row_Major_Order := not O.Row_Major_Order;
Set_Options (M, O);
Set_Option_Key;
end;
elsif To_Change (Reselect) then
declare
O : Menu_Option_Set;
begin
Get_Options (M, O);
O.One_Valued := not O.One_Valued;
Set_Options (M, O);
Set_Select_Key;
end;
elsif To_Change (Describe) then
declare
O : Menu_Option_Set;
begin
Get_Options (M, O);
O.Show_Descriptions := not O.Show_Descriptions;
Set_Options (M, O);
Set_Description_Key;
end;
else
null;
end if;
end loop;
Set_Spacing (M);
Flip_State := True;
Pop_Environment;
Delete (M);
Free (I, True);
end Spacing_Test;
end Spacing_Demo;
procedure Demo
is
-- We use this datatype only to test the instantiation of
-- the Menu_User_Data generic package. No functionality
-- behind it.
type User_Data is new Integer;
type User_Data_Access is access User_Data;
-- Those packages are only instantiated to test the usability.
-- No real functionality is shown in the demo.
package MUD is new Menu_User_Data (User_Data, User_Data_Access);
package IUD is new Item_User_Data (User_Data, User_Data_Access);
function My_Driver (M : Menu;
K : Key_Code;
P : Panel) return Boolean;
package Mh is new Sample.Menu_Demo.Handler (My_Driver);
Itm : Item_Array_Access := new Item_Array'
(New_Item ("Menu Layout Options"),
New_Item ("Demo of Hook functions"),
Null_Item);
M : Menu := New_Menu (Itm);
U1 : User_Data_Access := new User_Data'(4711);
U2 : User_Data_Access;
U3 : User_Data_Access := new User_Data'(4712);
U4 : User_Data_Access;
function My_Driver (M : Menu;
K : Key_Code;
P : Panel) return Boolean
is
Idx : constant Positive := Get_Index (Current (M));
begin
if K in User_Key_Code'Range then
if K = QUIT then
return True;
elsif K = SELECT_ITEM then
if Idx in Itm'Range then
Hide (P);
Update_Panels;
end if;
case Idx is
when 1 => Spacing_Demo.Spacing_Test;
when others => Not_Implemented;
end case;
if Idx in Itm'Range then
Top (P);
Show (P);
Update_Panels;
Update_Screen;
end if;
end if;
end if;
return False;
end My_Driver;
begin
Push_Environment ("MENU00");
Notepad ("MENU-PAD00");
Default_Labels;
Refresh_Soft_Label_Keys_Without_Update;
Set_Pad_Character (M, '|');
MUD.Set_User_Data (M, U1);
IUD.Set_User_Data (Itm (1), U3);
Mh.Drive_Me (M);
MUD.Get_User_Data (M, U2);
pragma Assert (U1 = U2 and U1.all = 4711);
IUD.Get_User_Data (Itm (1), U4);
pragma Assert (U3 = U4 and U3.all = 4712);
Pop_Environment;
Delete (M);
Free (Itm, True);
end Demo;
end Sample.Menu_Demo;
|
libsrc/z80_crt0s/crt0/l_lneg.asm | andydansby/z88dk-mk2 | 1 | 171743 | ; Z88 Small C+ Run time Library
; Moved functions over to proper libdefs
; To make startup code smaller and neater!
;
; 6/9/98 djm
XLIB l_lneg
; HL = !HL
; set carry if result true
.l_lneg
ld a,h
or l
ret nz
scf
ret
; ld a,h
; or l
; jr z,l_lneg1
; ld hl,0
; and a ;reset c (already done by or l)
; ret
;.l_lneg1
; inc l
; scf
; ret
|
programs/oeis/083/A083683.asm | neoneye/loda | 22 | 176786 | <filename>programs/oeis/083/A083683.asm
; A083683: a(n) = 11*2^n + 1.
; 12,23,45,89,177,353,705,1409,2817,5633,11265,22529,45057,90113,180225,360449,720897,1441793,2883585,5767169,11534337,23068673,46137345,92274689,184549377,369098753,738197505,1476395009,2952790017,5905580033,11811160065,23622320129,47244640257,94489280513,188978561025,377957122049,755914244097,1511828488193,3023656976385,6047313952769,12094627905537,24189255811073,48378511622145,96757023244289,193514046488577,387028092977153,774056185954305,1548112371908609,3096224743817217,6192449487634433,12384898975268865,24769797950537729,49539595901075457,99079191802150913,198158383604301825,396316767208603649,792633534417207297,1585267068834414593,3170534137668829185,6341068275337658369,12682136550675316737,25364273101350633473,50728546202701266945,101457092405402533889,202914184810805067777,405828369621610135553,811656739243220271105,1623313478486440542209,3246626956972881084417,6493253913945762168833,12986507827891524337665,25973015655783048675329,51946031311566097350657,103892062623132194701313,207784125246264389402625,415568250492528778805249,831136500985057557610497,1662273001970115115220993,3324546003940230230441985,6649092007880460460883969,13298184015760920921767937,26596368031521841843535873,53192736063043683687071745,106385472126087367374143489,212770944252174734748286977,425541888504349469496573953,851083777008698938993147905,1702167554017397877986295809,3404335108034795755972591617,6808670216069591511945183233,13617340432139183023890366465,27234680864278366047780732929,54469361728556732095561465857,108938723457113464191122931713,217877446914226928382245863425,435754893828453856764491726849,871509787656907713528983453697,1743019575313815427057966907393,3486039150627630854115933814785,6972078301255261708231867629569
mov $1,2
pow $1,$0
mul $1,11
add $1,1
mov $0,$1
|
disorderly/gcd_8bytes_1.adb | jscparker/math_packages | 30 | 7422 |
with Disorderly.Random; use Disorderly.Random;
with Disorderly.Random.Clock_Entropy;
with Chi_Gaussian_CDF;
with text_io; use text_io;
-- translated from Marsaglia, Tsang diehard suite.
procedure gcd_8bytes_1 is
Bits_per_Random_Word : constant := 61;
-- Must set this correctly here. There's no way to check this.
Stream_1 : Disorderly.Random.State;
-- Create a stream of Random numbers
-- by initializing this after the begin, w/ a call to Reset_with_Calendar
type Real is digits 15;
package Chi_Analysis is new Chi_Gaussian_CDF (Real); use Chi_Analysis;
type Unsigned_64 is mod 2**64;
type Statistical_Data is array (Unsigned_64 range <>) of Real;
-- Greatest Common Divisor Count test.
--
-- 1st test counts No of occurances of GCD's calculated for pairs of Rands:
Span_of_GCD_Count_Test : constant := 100;
subtype GCD_Count_Test_Range is Unsigned_64 range 1 .. Span_of_GCD_Count_Test;
subtype GCD_Counts is Statistical_Data (GCD_Count_Test_Range);
True_DOF_for_GCD_Count_Test : constant := Span_of_GCD_Count_Test - 1;
-- Greatest Common Divisor Iterations test.
--
-- 2nd test counts No of Iterations required to find GCD of a pair of Rands:
subtype GCD_Iterations_Test_Range is Unsigned_64 range 7..57;
subtype GCD_Iterations_Stats is Statistical_Data (GCD_Iterations_Test_Range);
True_DOF_for_Iterations_Test : constant := 50;
type Permissable_Range_of_Bits_per_Word is range 61..64;
Probability_of_GCD_Iterations : constant array(Permissable_Range_of_Bits_per_Word)
of GCD_Iterations_Stats :=
--61bit, 1.5 * 2^40 sample_size
((
3.60634420876918E-11, 1.84113362237163E-10, 9.27526422816774E-10,
4.18462466610514E-09, 1.79804729945634E-08, 7.02996697762738E-08,
2.50987637707073E-07, 8.29602156401328E-07, 2.54719381463592E-06,
7.29226651500263E-06, 1.95308024083953E-05, 4.90890664008001E-05,
1.16038067220791E-04, 2.58472948031419E-04, 5.43582520786794E-04,
1.08110812383846E-03, 2.03641299373450E-03, 3.63780116996445E-03,
6.16967723370813E-03, 9.94544514548540E-03, 1.52515013444075E-02,
2.22684802100285E-02, 3.09799653111006E-02, 4.10936488194199E-02,
5.20026693911464E-02, 6.28131812491515E-02, 7.24521456393869E-02,
7.98344028653051E-02, 8.40652918002730E-02, 8.46145726650518E-02,
8.14282151139038E-02, 7.49344837759449E-02, 6.59512901418012E-02,
5.55169851045914E-02, 4.47006642858943E-02, 3.44248149624985E-02,
2.53562087328527E-02, 1.78608364057373E-02, 1.20299972414100E-02,
7.74637900821804E-03, 4.76738610228969E-03, 2.80356488466445E-03,
1.57480260911499E-03, 8.44672639884622E-04, 4.32374513247455E-04,
2.11148911267114E-04, 9.83079048835308E-05, 4.36203933887831E-05,
1.84285277298287E-05, 7.40598087482478E-06, 4.38173035787338E-06
),
--62bit, 1.25 * 2^40 sample_size
(
1.0e-11, 1.0e-10, 1.0e-09,
3.12356860376894E-09, 1.07153027784079E-08, 4.23540768679231E-08,
1.53834844240919E-07, 5.18621527589858E-07, 1.62184005603194E-06,
4.72031460958533E-06, 1.28798790683504E-05, 3.29731628880836E-05,
7.93799634266179E-05, 1.80152335087769E-04, 3.86169017292559E-04,
7.83033167681424E-04, 1.50444347600569E-03, 2.74219085113145E-03,
4.74746785839670E-03, 7.81447832123376E-03, 1.22424124856480E-02,
1.82686513180670E-02, 2.59868027780612E-02, 3.52614222552802E-02,
4.56673437729478E-02, 5.64818627550267E-02, 6.67421547936101E-02,
7.53817606542725E-02, 8.14047969237436E-02, 8.40791420108871E-02,
8.30774562251463E-02, 7.85453180062177E-02, 7.10665999366029E-02,
6.15405520489730E-02, 5.10077870050736E-02, 4.04669900148292E-02,
3.07284356771561E-02, 2.23318681637466E-02, 1.55313623552502E-02,
1.03353681937733E-02, 6.57944859049166E-03, 4.00580784917111E-03,
2.33198539935984E-03, 1.29759441624628E-03, 6.89835629600566E-04,
3.50286864704685E-04, 1.69781225849874E-04, 7.85187381552532E-05,
3.46313805493992E-05, 1.45411046105437E-05, 9.24259074963629E-06
),
--63bit
(
1.0e-11, 1.0e-10, 1.0e-09,
1.84718373930082E-09, 6.40193320577964E-09, 2.55613485933282E-08,
9.43073246162385E-08, 3.22844243783039E-07, 1.02684680314269E-06,
3.04464447253850E-06, 8.45538488647435E-06, 2.20202909986256E-05,
5.39864840902737E-05, 1.24805929772265E-04, 2.72558390861377E-04,
5.63293603590864E-04, 1.10343044616456E-03, 2.05119602287595E-03,
3.62303316342150E-03, 6.08702397312300E-03, 9.73696121127432E-03,
1.48417563932526E-02, 2.15752666608751E-02, 2.99300470460366E-02,
3.96473091677763E-02, 5.01783137979146E-02, 6.07052047053003E-02,
7.02302970366873E-02, 7.77271460929115E-02, 8.23192137850128E-02,
8.34508585840013E-02, 8.09940879425994E-02, 7.52742528147792E-02,
6.69985561098656E-02, 5.71142716544273E-02, 4.66340440261774E-02,
3.64706130903869E-02, 2.73180850017525E-02, 1.95966771325402E-02,
1.34618205693187E-02, 8.85359909625550E-03, 5.57415191451582E-03,
3.35856920628430E-03, 1.93597860015871E-03, 1.06730554853129E-03,
5.62642482691444E-04, 2.83431539173762E-04, 1.36380568619643E-04,
6.26575392743689E-05, 2.74562980848714E-05, 1.87182404260966E-05
),
--64bit
(
1.0e-11, 1.0e-10, 1.0e-09,
1.04345316584739E-09, 3.79978802003380E-09, 1.54057084324045E-08,
5.78617295508997E-08, 2.00539862918150E-07, 6.48949814300674E-07,
1.95518324390933E-06, 5.52275103271111E-06, 1.46452957172490E-05,
3.65230218449142E-05, 8.59657468633183E-05, 1.91198751215577E-04,
4.02582168842653E-04, 8.03587449586808E-04, 1.52299020523464E-03,
2.74339848013672E-03, 4.70193459930467E-03, 7.67594423026215E-03,
1.19457277723591E-02, 1.77364065986088E-02, 2.51409167733881E-02,
3.40445156152176E-02, 4.40656369518870E-02, 5.45457989380035E-02,
6.45975542736172E-02, 7.32208271168525E-02, 7.94619972674910E-02,
8.25876607805387E-02, 8.22245617538202E-02, 7.84341962288130E-02,
7.16953611735031E-02, 6.28069448083503E-02, 5.27326066778591E-02,
4.24344945974250E-02, 3.27284291460981E-02, 2.41922337119225E-02,
1.71370716094518E-02, 1.16315170244181E-02, 7.56359276545279E-03,
4.71090568017745E-03, 2.80972215655816E-03, 1.60432155716990E-03,
8.76614772803603E-04, 4.58251069641038E-04, 2.29045271690766E-04,
1.09453786394119E-04, 4.99610013018052E-05, 3.64976355437345E-05)
);
-- 2^64 distr based on 1.25 * 2^40 sample size
---------------------------------
-- Get_Chi_Statistic_and_P_val --
---------------------------------
procedure Get_Chi_Statistic_and_P_val
(Probability_Distribution : in Statistical_Data;
Observed_Count : in Statistical_Data;
True_Degrees_of_Freedom : in Positive;
Sample_Size : in Unsigned_64;
Chi_squared : out Real;
P_val, P_val_Variance : out Real)
is
Expected_Count, Sum : Real;
begin
Sum := 0.0;
for i in Probability_Distribution'Range loop
Expected_Count := Probability_Distribution(i) * Real (Sample_Size);
Sum := Sum + (Observed_Count(i) - Expected_Count)**2 / Expected_Count;
end loop;
Chi_squared := Sum;
P_val := Chi_Squared_CDF (Real (True_Degrees_of_Freedom), Chi_squared);
P_val_Variance := (P_val-0.5)**2;
end Get_Chi_Statistic_and_P_val;
------------------------------
-- Greatest_Common_Divisors --
------------------------------
-- from diehard.
-- GCD Test, uses pairs of Rand's: u and v
-- where pairs = Sample_Size.
-- ***Requires uniform rands on 0..2**No_of_Bits_in_Test-1.***
procedure Greatest_Common_Divisors
(Sample_Size : in Unsigned_64;
Count_of_GCD_Iterations : out GCD_Iterations_Stats) is
Observed_Count_of_GCDs : GCD_Counts;
s, e : Real;
p99, chi99,variance_p99 : Real;
ave_chi99, ave_p99, ave_variance_p99 : Real := 0.0;
p, chi, variance_p : Real;
ave_p, ave_chi, ave_variance_p : Real := 0.0;
k : Unsigned_64;
u, v, w : Unsigned_64;
u0, v0 : Random_Int;
No_of_Samples : constant Integer := 2**20;
begin
Observed_Count_of_GCDs := (others => 0.0);
Count_of_GCD_Iterations := (others => 0.0);
Outer: for j in 1..No_of_Samples loop
Observed_Count_of_GCDs := (others => 0.0);
Count_of_GCD_Iterations := (others => 0.0);
for i in Unsigned_64 range 1 .. Sample_Size loop
Get_Pair: loop
Get_Random (u0, Stream_1);
Get_Random (v0, Stream_1);
u := Unsigned_64 (u0);
v := Unsigned_64 (v0);
exit Get_Pair when (u > 0 and then v > 0);
end loop Get_Pair;
k := 0;
Euclid: loop
w := u mod v;
u := v;
v := w;
k := k + 1;
exit Euclid when v = 0;
end loop Euclid;
-- k is Observed number of Iterations to obtain greatest common divisor (GCD).
-- u is the greatest common divisor (GCD).
if k < Count_of_GCD_Iterations'First then
k := Count_of_GCD_Iterations'First;
end if;
if k > Count_of_GCD_Iterations'Last then
k := Count_of_GCD_Iterations'Last;
end if;
Count_of_GCD_Iterations(k) := Count_of_GCD_Iterations(k)+1.0;
if u > Observed_Count_of_GCDs'Last then
u := Observed_Count_of_GCDs'Last;
end if;
if u < Observed_Count_of_GCDs'First then
u := Observed_Count_of_GCDs'First;
end if;
Observed_Count_of_GCDs(u) := Observed_Count_of_GCDs(u) + 1.0;
end loop;
Get_Chi_Statistic_and_P_val
(Probability_Distribution => Probability_of_GCD_Iterations (Bits_per_Random_Word),
Observed_Count => Count_of_GCD_Iterations,
True_Degrees_of_Freedom => True_DOF_for_Iterations_Test,
Sample_Size => Sample_Size,
Chi_squared => chi,
P_val => p,
P_val_Variance => variance_p);
ave_chi := ave_chi + chi;
ave_p := ave_p + p;
ave_variance_p := ave_variance_p + variance_p;
-- on range 1..99 distribution seems to be: (0.607926 + 6.0e-8 * i) / i^2
-- theoretical value, with inf number of bits: 0.60792710 / i^2
--
-- e := Real (Sample_Size) * 0.6081842 / Real (i)**2;--asymptotically, i = 5410
p99 := 0.0;
variance_p99 := 0.0;
--e := Real (Sample_Size) * 0.61097691e-2; -- in theory, p >> 2**32
e := Real (Sample_Size) * 0.61097e-2; -- I get 0.61097e-2
chi99 := (Observed_Count_of_GCDs(GCD_Count_Test_Range'Last) - e)**2 / e;
for i in GCD_Count_Test_Range'First .. GCD_Count_Test_Range'Last-1 loop
e := Real (Sample_Size) * (0.607926 + 6.0E-8 * Real (i)) / Real (i)**2;
s := (Observed_Count_of_GCDs(i) - e)**2 / e;
chi99 := chi99 + s;
end loop;
p99 := Chi_Squared_CDF (Real(True_DOF_for_GCD_Count_Test), chi99);
variance_p99 := (p99-0.5)**2;
ave_chi99 := ave_chi99 + chi99;
ave_p99 := ave_p99 + p99;
ave_variance_p99 := ave_variance_p99 + variance_p99;
new_line(1);
put("Test"); put (Integer'Image(j));
put(". Chi^2 (47 dof), ave p-val, and ave normalized variance of GCD iterations:");
new_line;
put(" ");
put (Real'Image (chi));
put (Real'Image (ave_p / Real(j)));
put (Real'Image (ave_variance_p / (Real(j)*(0.25/3.0)))); -- should -> 1.0
new_line(1);
put(" Chi^2 (99 dof), ave p-val, and ave normalized variance of GCD's:");
new_line;
put(" ");
put (Real'Image (chi99));
put (Real'Image (ave_p99 / Real(j)));
put (Real'Image (ave_variance_p99 / (Real(j)*(0.25/3.0))));
end loop Outer;
end Greatest_Common_Divisors;
begin
Disorderly.Random.Clock_Entropy.Reset (Stream_1);
-- The state of the generator is Stream_1. (Starts up a random stream.)
test: declare
Sample_Size : constant Unsigned_64 := 2**35; -- turn way up to best see failure
-- 2**35 Sample_Size is OK, chi squared wise.
-- 2**36 Sample_Size is unimpeachable.
-- 2**37 Sample_Size is gd stnd tst. Tks mny hrs!
Full_Sample_Size : Real;
Sample_Iteration_Stats : GCD_Iterations_Stats;
Full_Iteration_Stats : GCD_Iterations_Stats := (others => 0.0);
begin
for i in 1..2**16 loop
Greatest_Common_Divisors (Sample_Size, Sample_Iteration_Stats);
Full_Sample_Size := Real(i)*Real(Sample_Size);
for k in Full_Iteration_Stats'Range loop
Full_Iteration_Stats(k) := Full_Iteration_Stats(k) + Sample_Iteration_Stats(k);
end loop;
new_line;
for k in Full_Iteration_Stats'Range loop
if (Integer(k)-Integer(Full_Iteration_Stats'First)) mod 3 = 0 then
new_line;
end if;
put (Real'Image (Full_Iteration_Stats(k) / Full_Sample_Size)); put (",");
end loop;
new_line;
end loop;
end test;
end;
|
Task/Sum-digits-of-an-integer/Ada/sum-digits-of-an-integer.ada | LaudateCorpus1/RosettaCodeData | 1 | 18677 | with Ada.Integer_Text_IO;
procedure Sum_Digits is
-- sums the digits of an integer (in whatever base)
-- outputs the sum (in base 10)
function Sum_Of_Digits(N: Natural; Base: Natural := 10) return Natural is
Sum: Natural := 0;
Val: Natural := N;
begin
while Val > 0 loop
Sum := Sum + (Val mod Base);
Val := Val / Base;
end loop;
return Sum;
end Sum_Of_Digits;
use Ada.Integer_Text_IO;
begin -- main procedure Sum_Digits
Put(Sum_OF_Digits(1)); -- 1
Put(Sum_OF_Digits(12345)); -- 15
Put(Sum_OF_Digits(123045)); -- 15
Put(Sum_OF_Digits(123045, 50)); -- 104
Put(Sum_OF_Digits(16#fe#, 10)); -- 11
Put(Sum_OF_Digits(16#fe#, 16)); -- 29
Put(Sum_OF_Digits(16#f0e#, 16)); -- 29
end Sum_Digits;
|
lib/types/PushoutFlattening.agda | UlrikBuchholtz/HoTT-Agda | 1 | 11258 | {-# OPTIONS --without-K #-}
open import lib.Basics
open import lib.types.Pi
open import lib.types.Sigma
open import lib.types.Span
open import lib.types.Paths
import lib.types.Generic1HIT as Generic1HIT
open import lib.types.Pushout
module lib.types.PushoutFlattening {i} {j} {k} {d : Span {i} {j} {k}} where
open Span d renaming (f to g; g to h)
module PushoutRecType {l} (left* : A → Type l) (right* : B → Type l)
(glue* : (c : C) → left* (g c) ≃ right* (h c)) where
open PushoutRec left* right* (ua ∘ glue*) public
abstract
coe-glue-β : (c : C) (a : left* (g c))
→ coe (ap f (glue c)) a == –> (glue* c) a
coe-glue-β c a =
coe (ap f (glue c)) a =⟨ glue-β c |in-ctx (λ u → coe u a) ⟩
coe (ua (glue* c)) a =⟨ coe-β (glue* c) a ⟩
–> (glue* c) a ∎
coe!-glue-β : (c : C) (b : right* (h c))
→ coe! (ap f (glue c)) b == <– (glue* c) b
coe!-glue-β c b =
coe! (ap f (glue c)) b =⟨ glue-β c |in-ctx (λ u → coe! u b) ⟩
coe! (ua (glue* c)) b =⟨ coe!-β (glue* c) b ⟩
<– (glue* c) b ∎
↓-glue-out : (c : C) {a : left* (g c)} {b : right* (h c)}
→ a == b [ f ↓ glue c ]
→ –> (glue* c) a == b
↓-glue-out c {a} {b} p =
–> (glue* c) a =⟨ ! (coe-glue-β c a) ⟩
coe (ap f (glue c)) a =⟨ to-transp p ⟩
b ∎
↓-glue-in : (c : C) {a : left* (g c)} {b : right* (h c)}
→ –> (glue* c) a == b
→ a == b [ f ↓ glue c ]
↓-glue-in c {a} {b} p = from-transp f (glue c) (coe-glue-β c a ∙ p)
private
module _ where
fA : Type _
fA = Σ A left*
fB : Type _
fB = Σ B right*
fC : Type _
fC = Σ C (left* ∘ g)
fg : fC → fA
fg (c , c') = (g c , c')
fh : fC → fB
fh (c , c') = (h c , –> (glue* c) c')
f-d : Span
f-d = span fA fB fC fg fh
flattening : Σ (Pushout d) f == Pushout f-d
flattening = Σ= p p' ∙ q ∙ r ∙ s where
module G = PushoutGeneric {d = d}
P-cc : Coprod A B → Type _
P-cc (inl a) = left* a
P-cc (inr b) = right* b
module P = G.RecType P-cc glue*
import lib.types.Flattening as Flattening
module FlatteningPushout = Flattening
(Coprod A B) C (inl ∘ g) (inr ∘ h) P-cc glue*
open FlatteningPushout public hiding (flattening-equiv; module P)
p-equiv : Pushout d ≃ G.T
p-equiv = G.generic-pushout
p : Pushout d == G.T
p = ua p-equiv
p' : f == P.f [ (λ X → (X → Type _)) ↓ p ]
p' = ↓-app→cst-in (λ {t} {t'} q →
Pushout-elim {P = λ t → f t == P.f (–> p-equiv t)}
(λ a → idp) (λ b → idp)
(λ c → ↓-='-in
(ap (P.f ∘ (–> p-equiv)) (glue c) =⟨ ap-∘ P.f (–> p-equiv) (glue c) ⟩
ap P.f (ap (–> p-equiv) (glue c)) =⟨ G.To.glue-β c |in-ctx ap P.f ⟩
ap P.f (pp c) =⟨ P.pp-β c ⟩
ua (glue* c) =⟨ ! (glue-β c) ⟩
ap f (glue c) ∎))
t ∙ ap P.f (↓-idf-ua-out _ q))
--
module fG' = Generic1HIT At Bt ft gt
q : Σ G.T P.f == fG'.T
q = ua FlatteningPushout.flattening-equiv
--
{-
This part is basically [Generic1HIT=] applied to the flattening lemma
for coproducts. Maybe it would make sense to refactor it that way.
-}
module fG = PushoutGeneric {d = f-d}
r : fG'.T == fG.T
r = ua (equiv to from to-from from-to) where
to-cc : At → fG.T
to-cc (inl a , a') = fG.cc (inl (a , a'))
to-cc (inr b , b') = fG.cc (inr (b , b'))
module To = fG'.Rec to-cc fG.pp
to : fG'.T → fG.T
to = To.f
from-cc : Coprod fA fB → fG'.T
from-cc (inl (a , a')) = fG'.cc (inl a , a')
from-cc (inr (b , b')) = fG'.cc (inr b , b')
module From = fG.Rec from-cc fG'.pp
from : fG.T → fG'.T
from = From.f
abstract
to-from : (x : fG.T) → to (from x) == x
to-from = fG.elim to-from-cc to-from-pp where
to-from-cc : (x : Coprod fA fB)
→ to (from (fG.cc x)) == fG.cc x
to-from-cc (inl _) = idp
to-from-cc (inr _) = idp
to-from-pp : (c : fC)
→ idp == idp [ (λ x → to (from x) == x) ↓ fG.pp c ]
to-from-pp c = ↓-∘=idf-in to from
(ap to (ap from (fG.pp c)) =⟨ From.pp-β c |in-ctx ap to ⟩
ap to (fG'.pp c) =⟨ To.pp-β c ⟩
fG.pp c ∎)
from-to : (x : fG'.T) → from (to x) == x
from-to = fG'.elim from-to-cc from-to-pp where
from-to-cc : (a : At) → from (to (fG'.cc a)) == fG'.cc a
from-to-cc (inl _ , _) = idp
from-to-cc (inr _ , _) = idp
from-to-pp : (b : Bt)
→ idp == idp [ (λ x → from (to x) == x) ↓ fG'.pp b ]
from-to-pp b = ↓-∘=idf-in from to
(ap from (ap to (fG'.pp b)) =⟨ To.pp-β b |in-ctx ap from ⟩
ap from (fG.pp b) =⟨ From.pp-β b ⟩
fG'.pp b ∎)
--
s : fG.T == Pushout f-d
s = ! (ua fG.generic-pushout)
|
llvm/test/tools/llvm-ml/reserved_words_conflict.asm | mkinsner/llvm | 2,338 | 167843 | <gh_stars>1000+
; RUN: llvm-ml -filetype=s %s /Fo - | FileCheck %s
.code
t1:
call dword ptr [eax]
; CHECK-LABEL: t1:
; CHECK-NEXT: call
t2 dword 5
; CHECK-LABEL: t2:
; CHECK-NEXT: .long 5
END
|
linux32/lesson20.asm | mashingan/notes-asmtutor | 1 | 29283 | format ELF executable 3
entry start
include 'procs.inc'
segment readable
childMsg db 'This is the child process', 0h
parentMsg db 'This is the parent process', 0h
segment readable executable
start:
mov eax, 2 ; SYS_FORK (kernel opcode 2)
int 80h
cmp eax, 0 ; if eax is zero, we are in the child process
jnz .parent ; jump to child if eax is zero
.child:
mov eax, childMsg
call sprintLF
call quitProgram
.parent:
mov eax, parentMsg
call sprintLF
call quitProgram
|
Source Codes Testing/subtractnbytenos.asm | aravindvnair99/emu8086 | 11 | 174025 | ;<NAME>
;BL.EN.U4CSE17003
;Subtract 2 3 byte numbers
.MODEL small
.STACK
.DATA
N db 3h
n1 db 40h,22h,01h
n2 db 22h,0F1h,02h
sum db ?
.CODE
.STARTUP
mov cx,00h
mov cl,N
clc ;clears flag value
addition: mov al,n1[si]
mov ah,n2[si]
sbb al,00h
clc
sub al,ah
mov sum[di],al
inc si
inc di
loop addition
.EXIT
END
|
awa/src/awa-modules.adb | Letractively/ada-awa | 0 | 4370 | <gh_stars>0
-----------------------------------------------------------------------
-- awa -- Ada Web Application
-- Copyright (C) 2009, 2010, 2011, 2012 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Requests;
with ASF.Responses;
with ASF.Server;
with Ada.IO_Exceptions;
with Util.Files;
with Util.Properties;
with EL.Contexts.Default;
with AWA.Modules.Reader;
with AWA.Applications;
package body AWA.Modules is
-- ------------------------------
-- Get the module name
-- ------------------------------
function Get_Name (Plugin : in Module) return String is
begin
return To_String (Plugin.Name);
end Get_Name;
-- ------------------------------
-- Get the base URI for this module
-- ------------------------------
function Get_URI (Plugin : in Module) return String is
begin
return To_String (Plugin.URI);
end Get_URI;
-- ------------------------------
-- Get the application in which this module is registered.
-- ------------------------------
function Get_Application (Plugin : in Module) return Application_Access is
begin
return Plugin.App;
end Get_Application;
-- ------------------------------
-- Get the module configuration property identified by the name.
-- If the configuration property does not exist, returns the default value.
-- ------------------------------
function Get_Config (Plugin : Module;
Name : String;
Default : String := "") return String is
begin
return Plugin.Config.Get (Name, Default);
end Get_Config;
-- ------------------------------
-- Get the module configuration property identified by the name.
-- If the configuration property does not exist, returns the default value.
-- ------------------------------
function Get_Config (Plugin : in Module;
Name : in String;
Default : in Integer := -1) return Integer is
Value : constant String := Plugin.Config.Get (Name, Integer'Image (Default));
begin
return Integer'Value (Value);
exception
when Constraint_Error =>
return Default;
end Get_Config;
-- ------------------------------
-- Get the module configuration property identified by the <tt>Config</tt> parameter.
-- If the property does not exist, the default configuration value is returned.
-- ------------------------------
function Get_Config (Plugin : in Module;
Config : in ASF.Applications.Config_Param) return String is
begin
return Plugin.Config.Get (Config);
end Get_Config;
-- ------------------------------
-- Send the event to the module
-- ------------------------------
procedure Send_Event (Plugin : in Module;
Content : in AWA.Events.Module_Event'Class) is
begin
Plugin.App.Send_Event (Content);
end Send_Event;
-- ------------------------------
-- Find the module with the given name
-- ------------------------------
function Find_Module (Plugin : Module;
Name : String) return Module_Access is
begin
if Plugin.Registry = null then
return null;
end if;
return Find_By_Name (Plugin.Registry.all, Name);
end Find_Module;
-- ------------------------------
-- Register under the given name a function to create the bean instance when
-- it is accessed for a first time. The scope defines the scope of the bean.
-- bean
-- ------------------------------
procedure Register (Plugin : in out Module;
Name : in String;
Bind : in ASF.Beans.Class_Binding_Access) is
begin
Plugin.App.Register_Class (Name, Bind);
end Register;
-- ------------------------------
-- Finalize the module.
-- ------------------------------
overriding
procedure Finalize (Plugin : in out Module) is
begin
null;
end Finalize;
procedure Initialize (Manager : in out Module_Manager;
Module : in AWA.Modules.Module'Class) is
begin
Manager.Module := Module.Self;
end Initialize;
function Get_Value (Manager : in Module_Manager;
Name : in String) return Util.Beans.Objects.Object is
pragma Unreferenced (Manager, Name);
begin
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- Module manager
--
-- ------------------------------
-- Get the database connection for reading
-- ------------------------------
function Get_Session (Manager : Module_Manager)
return ADO.Sessions.Session is
begin
return Manager.Module.Get_Session;
end Get_Session;
-- ------------------------------
-- Get the database connection for writing
-- ------------------------------
function Get_Master_Session (Manager : Module_Manager)
return ADO.Sessions.Master_Session is
begin
return Manager.Module.Get_Master_Session;
end Get_Master_Session;
-- ------------------------------
-- Send the event to the module. The module identified by <b>To</b> is
-- found and the event is posted on its event channel.
-- ------------------------------
procedure Send_Event (Manager : in Module_Manager;
Content : in AWA.Events.Module_Event'Class) is
begin
Manager.Module.Send_Event (Content);
end Send_Event;
procedure Initialize (Plugin : in out Module;
App : in Application_Access;
Props : in ASF.Applications.Config) is
pragma Unreferenced (Props);
begin
Plugin.Self := Plugin'Unchecked_Access;
Plugin.App := App;
end Initialize;
-- ------------------------------
-- Initialize the registry
-- ------------------------------
procedure Initialize (Registry : in out Module_Registry;
Config : in ASF.Applications.Config) is
begin
Registry.Config := Config;
end Initialize;
-- ------------------------------
-- Register the module in the registry.
-- ------------------------------
procedure Register (Registry : in Module_Registry_Access;
App : in Application_Access;
Plugin : in Module_Access;
Name : in String;
URI : in String) is
procedure Copy (Params : in Util.Properties.Manager'Class);
procedure Copy (Params : in Util.Properties.Manager'Class) is
begin
Plugin.Config.Copy (From => Params, Prefix => Name & ".", Strip => True);
end Copy;
Paths : constant String := Registry.Config.Get (Applications.P_Module_Dir.P);
begin
Log.Info ("Register module '{0}' under URI '{1}'", Name, URI);
if Plugin.Registry /= null then
Log.Error ("Module '{0}' is already attached to a registry", Name);
raise Program_Error with "Module '" & Name & "' already registered";
end if;
Plugin.App := App;
Plugin.Registry := Registry;
Plugin.Name := To_Unbounded_String (Name);
Plugin.URI := To_Unbounded_String (URI);
Plugin.Registry.Name_Map.Insert (Name, Plugin);
if URI /= "" then
Plugin.Registry.URI_Map.Insert (URI, Plugin);
end if;
-- Load the module configuration file
Log.Debug ("Module search path: {0}", Paths);
declare
Base : constant String := Name & ".properties";
Path : constant String := Util.Files.Find_File_Path (Base, Paths);
begin
Plugin.Config.Load_Properties (Path => Path, Prefix => Name & ".", Strip => True);
exception
when Ada.IO_Exceptions.Name_Error =>
Log.Info ("Module configuration file '{0}' does not exist", Path);
end;
Plugin.Initialize (App, Plugin.Config);
-- Read the module XML configuration file if there is one.
declare
Base : constant String := Plugin.Config.Get ("config", Name & ".xml");
Path : constant String := Util.Files.Find_File_Path (Base, Paths);
Ctx : aliased EL.Contexts.Default.Default_Context;
begin
AWA.Modules.Reader.Read_Configuration (Plugin.all, Path, Ctx'Unchecked_Access);
exception
when Ada.IO_Exceptions.Name_Error =>
Log.Warn ("Module configuration file '{0}' does not exist", Path);
end;
-- Override the module configuration with the application configuration
App.Get_Init_Parameters (Copy'Access);
Plugin.Configure (Plugin.Config);
exception
when Constraint_Error =>
Log.Error ("Another module is already registered "
& "under name '{0}' or URI '{1}'", Name, URI);
raise;
end Register;
-- ------------------------------
-- Find the module with the given name
-- ------------------------------
function Find_By_Name (Registry : Module_Registry;
Name : String) return Module_Access is
Pos : constant Module_Maps.Cursor := Module_Maps.Find (Registry.Name_Map, Name);
begin
if Module_Maps.Has_Element (Pos) then
return Module_Maps.Element (Pos);
end if;
return null;
end Find_By_Name;
-- ------------------------------
-- Find the module mapped to a given URI
-- ------------------------------
function Find_By_URI (Registry : Module_Registry;
URI : String) return Module_Access is
Pos : constant Module_Maps.Cursor := Module_Maps.Find (Registry.URI_Map, URI);
begin
if Module_Maps.Has_Element (Pos) then
return Module_Maps.Element (Pos);
end if;
return null;
end Find_By_URI;
-- ------------------------------
-- Iterate over the modules that have been registered and execute the <b>Process</b>
-- procedure on each of the module instance.
-- ------------------------------
procedure Iterate (Registry : in Module_Registry;
Process : access procedure (Plugin : in out Module'Class)) is
Iter : Module_Maps.Cursor := Registry.Name_Map.First;
begin
while Module_Maps.Has_Element (Iter) loop
Process (Module_Maps.Element (Iter).all);
Module_Maps.Next (Iter);
end loop;
end Iterate;
-- ------------------------------
-- Get the database connection for reading
-- ------------------------------
function Get_Session (Manager : Module)
return ADO.Sessions.Session is
begin
return Manager.App.Get_Session;
end Get_Session;
-- ------------------------------
-- Get the database connection for writing
-- ------------------------------
function Get_Master_Session (Manager : Module)
return ADO.Sessions.Master_Session is
begin
return Manager.App.Get_Master_Session;
end Get_Master_Session;
-- ------------------------------
-- Add a listener to the module listner list. The module will invoke the listner
-- depending on events or actions that occur in the module.
-- ------------------------------
procedure Add_Listener (Into : in out Module;
Item : in Util.Listeners.Listener_Access) is
begin
Util.Listeners.Add_Listener (Into.Listeners, Item);
end Add_Listener;
-- ------------------------------
-- Remove a listener from the module listener list.
-- ------------------------------
procedure Remove_Listener (Into : in out Module;
Item : in Util.Listeners.Listener_Access) is
begin
Util.Listeners.Remove_Listener (Into.Listeners, Item);
end Remove_Listener;
-- Get per request manager => look in Request
-- Get per session manager => look in Request.Get_Session
-- Get per application manager => look in Application
-- Get per pool manager => look in pool attached to Application
function Get_Manager return Manager_Type_Access is
procedure Process (Request : in out ASF.Requests.Request'Class;
Response : in out ASF.Responses.Response'Class);
Value : Util.Beans.Objects.Object;
procedure Process (Request : in out ASF.Requests.Request'Class;
Response : in out ASF.Responses.Response'Class) is
pragma Unreferenced (Response);
begin
Value := Request.Get_Attribute (Name);
if Util.Beans.Objects.Is_Null (Value) then
declare
M : constant Manager_Type_Access := new Manager_Type;
begin
Value := Util.Beans.Objects.To_Object (M.all'Unchecked_Access);
Request.Set_Attribute (Name, Value);
end;
end if;
end Process;
begin
ASF.Server.Update_Context (Process'Access);
if Util.Beans.Objects.Is_Null (Value) then
return null;
end if;
declare
B : constant access Util.Beans.Basic.Readonly_Bean'Class
:= Util.Beans.Objects.To_Bean (Value);
begin
if not (B.all in Manager_Type'Class) then
return null;
end if;
return Manager_Type'Class (B.all)'Unchecked_Access;
end;
end Get_Manager;
end AWA.Modules;
|
programs/oeis/076/A076121.asm | karttu/loda | 1 | 241642 | ; A076121: Complete list of possible cribbage hands.
; 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,28,29
mov $1,$0
sub $1,7
trn $1,7
div $1,5
pow $1,2
add $1,$0
|
programs/oeis/296/A296953.asm | neoneye/loda | 22 | 101860 | <gh_stars>10-100
; A296953: Number of bisymmetric, quasitrivial, and order-preserving binary operations on the n-element set {1,...,n}.
; 0,1,4,10,22,46,94,190,382,766,1534,3070,6142,12286,24574,49150,98302,196606,393214,786430,1572862,3145726,6291454,12582910,25165822,50331646,100663294,201326590,402653182,805306366,1610612734,3221225470,6442450942,12884901886
mov $1,2
pow $1,$0
sub $1,1
mul $1,3
div $1,2
mov $0,$1
|
.emacs.d/elpa/wisi-2.1.1/sal-gen_bounded_definite_vectors-gen_image.adb | caqg/linux-home | 0 | 26175 | -- Abstract :
--
-- See spec.
--
-- Copyright (C) 2018 Free Software Foundation, Inc.
--
-- This library is free software; you can redistribute it and/or modify it
-- under terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any later
-- version. This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- As a special exception under Section 7 of GPL version 3, you are granted
-- additional permissions described in the GCC Runtime Library Exception,
-- version 3.1, as published by the Free Software Foundation.
pragma License (Modified_GPL);
function SAL.Gen_Bounded_Definite_Vectors.Gen_Image (Item : in Vector) return String
is
use all type SAL.Base_Peek_Type;
use Ada.Strings;
use Ada.Strings.Unbounded;
Result : Unbounded_String := To_Unbounded_String ("(");
Last : Base_Peek_Type := To_Peek_Index (Item.Last);
begin
for I in Item.Elements (1 .. Last) loop
Result := Result &
((if Trim
then Fixed.Trim (Element_Image (Item.Elements (I)), Left)
else Element_Image (Item.Elements (I)));
if I /= Last then
Result := Result & ", ";
end if;
end loop;
Result := Result & ")";
return To_String (Result);
end SAL.Gen_Bounded_Definite_Vectors.Gen_Image;
|
alloy4fun_models/trashltl/models/11/Nvnj2pEy6ApHYggSa.als | Kaixi26/org.alloytools.alloy | 0 | 3420 | open main
pred idNvnj2pEy6ApHYggSa_prop12 {
always all f:File | eventually f in Trash implies f in Trash
}
pred __repair { idNvnj2pEy6ApHYggSa_prop12 }
check __repair { idNvnj2pEy6ApHYggSa_prop12 <=> prop12o } |
src/spawn_manager.adb | persan/spawn-manager | 1 | 22375 | package body Spawn_Manager is
---------------------
-- Is_Exit_Message --
---------------------
function Is_Exit_Message (Request : Spawn_Request) return Boolean is
begin
return Request.Spawn_Type = Terminate_Server;
end Is_Exit_Message;
function WIFEXITED (Stat_Val : Status_Kind) return Boolean is
begin
return (Stat_Val and 16#FF_FF_FF_00#) = 0;
end WIFEXITED;
function WEXITSTATUS (Stat_Val : Status_Kind) return Integer is
begin
return Integer (Shift_Right (Stat_Val and 16#0000_FF_00#, 8));
end WEXITSTATUS;
-- function WIFSIGNALED (Stat_Val : Status_Kind) return Boolean is
-- pragma Unreferenced (Stat_Val);
-- begin
-- return False ; -- (((Stat_Val and 16#7F#) +1);
-- end WIFSIGNALED;
-- function WTERMSIG (Stat_Val : Status_Kind) return Boolean is
-- pragma Unreferenced (Stat_Val);
-- begin
-- return False;
-- end WTERMSIG;
-- function WIFSTOPPED (Stat_Val : Status_Kind) return Boolean is
-- begin
-- return (Stat_Val and 16#FF#) = 16#7F#;
-- end WIFSTOPPED;
-- pragma Unreferenced (WIFSTOPPED);
-- function WSTOPSIG (Stat_Val : Status_Kind) return Integer is
-- pragma Unreferenced (Stat_Val);
-- begin
-- return 0;
-- end WSTOPSIG;
-- pragma Unreferenced (WSTOPSIG);
function WIFCONTINUED (Stat_Val : Status_Kind) return Boolean is
begin
return Stat_Val = 16#FF_FF#;
end WIFCONTINUED;
end Spawn_Manager;
|
Task/MD5-Implementation/Ada/md5-implementation-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 16171 | package MD5 is
type Int32 is mod 2 ** 32;
type MD5_Hash is array (1 .. 4) of Int32;
function MD5 (Input : String) return MD5_Hash;
-- 32 hexadecimal characters + '0x' prefix
subtype MD5_String is String (1 .. 34);
function To_String (Item : MD5_Hash) return MD5_String;
end MD5;
|
src/mainmenu.asm | jardafis/CastleEscape | 1 | 245261 | extern _attribEdit
extern _tile0
extern _tileAttr
IF _ZXN
extern clearTilemap
ENDIF
extern defineKeys
extern keyboardScan
extern kjPresent
extern newGame
extern readKempston
extern wyz_play_song
extern wyz_player_stop
extern rand
extern setAttrHi
extern setAttr
extern mainmenuScreen
extern dzx0_standard
public mainMenu
public waitReleaseKey
public flickerMenu
IF !_ZXN
section CODE_5
ELSE
section CODE_2
ENDIF
#include "defs.inc"
;
; Display the game main menu. Options to configure and start
; the game are on this screen.
;
mainMenu:
border 1
;
; Start main menu song
;
di
call wyz_player_stop
ld a, MAIN_MENU_MUSIC
call wyz_play_song
ei
;
; Page in the main menu screen
;
bank mainmenuScreen>>16
halt
; Fill the screen with paper and innk the same color
ld hl, SCREEN_ATTR_START
ld de, SCREEN_ATTR_START+1
ld (hl), PAPER_BLUE|INK_BLUE
ld bc, SCREEN_ATTR_LENGTH-1
ldir
displayScreen:
IF _ZXN
call clearTilemap
ENDIF
; Uncompress the menu screen
ld hl, mainmenuScreen
ld de, SCREEN_START
call dzx0_standard
; Clear the lightning by setting paper and ink colors the same
ld a, PAPER_BLUE|INK_BLUE
ld hl, lightningAttribs+3
call setFlicker
ld hl, lightningAttribs2+3
call setFlicker
getKey:
halt
call flickerMenu
call keyboardScan ; Read the keyboard
jr nz, keyPressed ; Process key press
ld a, (kjPresent) ; Check if the kempston joystick
or a ; is present, if not
jr z, getKey ; continue polling.
ld e, 0 ; No direction keys pressed
call readKempston ; Read the joystick
ld a, e ; Check if fire has been pressed
and JUMP
jr z, getKey ; If not, continue polling
ld a, '0' ; Force '0'
jr jumpPressed
keyPressed:
call waitReleaseKey
jumpPressed:
cp '0'
jr z, play
cp '1'
call z, defineKeys
IFDEF ATTRIB_EDIT
cp '2'
jr z, attribEdit
ENDIF
jp displayScreen
;
; Wait for a key to be released and animate the menu items.
;
; Input:
; hl - Pointer to the lantern list
;
; Notes:
; 'af' is preserved.
waitReleaseKey:
push af
releaseKey:
call keyboardScan ; Read the keyboard
jr nz, releaseKey ; Key is being pressed
pop af
ret
IFDEF ATTRIB_EDIT
;
; Wrapper to call attribute edit function in 'C'
;
attribEdit:
ld hl, _tile0
push hl
ld hl, _tileAttr
push hl
bcall _attribEdit
pop hl
pop hl
jp mainMenu
ENDIF
play:
call newGame
jp mainMenu
flickerMenu:
ld hl, lightAttribs
call doFlicker
ld hl, lightAttribs2
call doFlicker
ld hl, lightningAttribs
call doFlicker
ld hl, lightningAttribs2
call doFlicker
ret
;
; Flicker attributes
;
; Used to flicker lightning and lights on the main menu
;
; Input:
; hl - Pointer to the flicker table.
;
; Output:
; None.
;
doFlicker:
ld a, (hl)
dec a
jr nz, skipRand
push hl
nextRand:
call rand
ld a, l
and 0x7f
jr z, nextRand
pop hl
skipRand:
ld (hl), a ; Count
inc hl
cp 4
jr c, flicker
ld a, (hl) ; Off color
inc hl
inc hl
call setFlicker
ret
flicker:
inc hl
ld a, (hl) ; On color
inc hl
setFlicker:
ld b, (hl) ; Table size
inc hl
nextAttrib:
push bc
ld b, (hl)
inc hl
ld c, (hl)
inc hl
; Check which screen bank is being used
ld d, a
ld a, (currentBank)
and %0001000
ld a, d
push af
call z, setAttr
pop af
push af
call nz, setAttrHi
pop af
pop bc
djnz nextAttrib
ret
IF !_ZXN
section DATA_5
ELSE
section DATA_2
ENDIF
lightningAttribs:
db 0x00
db PAPER_BLUE|INK_BLUE ; Off
db PAPER_BLUE|INK_WHITE ; On
db (lightningAttribsEnd-lightningAttribs-4)/2
db 0, 18, 0, 19
db 1, 18, 1, 19, 1, 20
db 2, 18, 2, 19, 2, 20, 2, 21
db 3, 19, 3, 20, 3, 21
db 4, 19, 4, 21
db 5, 19, 5, 20, 5, 21
db 6, 19, 6, 20
db 7, 19, 7, 20, 7, 21
db 8, 18, 8, 19, 8, 20, 8, 21
db 9, 18, 9, 20
db 10, 18, 10, 20
lightningAttribsEnd:
lightningAttribs2:
db 0x10
db PAPER_BLUE|INK_BLUE ; Off
db PAPER_BLUE|INK_WHITE ; On
db (lightningAttribsEnd2-lightningAttribs2-4)/2
db 6, 0
db 7, 0
db 8, 0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8, 6, 8, 7, 8, 8, 8, 9
db 9, 2, 9, 3, 9, 4, 9, 5, 9, 8
db 10, 2, 10, 5, 10, 6, 10, 7
db 11, 1, 11, 2, 11, 3, 11, 6
db 12, 3, 12, 4
db 13, 3, 13, 4
db 14, 3
lightningAttribsEnd2:
lightAttribs:
db 0x20
db PAPER_BLACK|INK_YELLOW|BRIGHT
db PAPER_BLACK|INK_BLACK
db (lightAttribsEnd-lightAttribs-4)/2
db 15, 29
lightAttribsEnd:
lightAttribs2:
db 0x30
db PAPER_BLACK|INK_YELLOW|BRIGHT
db PAPER_BLACK|INK_BLACK
db (lightAttribsEnd2-lightAttribs2-4)/2
db 12, 12
db 12, 13
lightAttribsEnd2:
|
_lessons/03-alloy-intro/code/family-2.als | HanielB/2021.1-fm | 0 | 3657 | <reponame>HanielB/2021.1-fm
---------------- Signatures ----------------
abstract sig Person {
children: set Person,
siblings: set Person
}
sig Man, Woman extends Person {}
sig Married in Person {
spouse: one Married
}
---------------- Functions ----------------
-- Define the parents relation as an auxiliary one
fun parents [] : Person -> Person { ~children }
---------------- Facts ----------------
fact {
-- No person can be their own ancestor
no p: Person | p in p.^parents
-- No person can have more than one father or mother
all p: Person | (lone (p.parents & Man)) and (lone (p.parents & Woman))
-- A person P's siblings are those people with the same parents as P (excluding P)
all p: Person | p.siblings = {q: Person | p.parents = q.parents} - p
-- Each married man (woman) has a wife (husband)
all p: Married | let s = p.spouse |
(p in Man implies s in Woman) and
(p in Woman implies s in Man)
-- A spouse can't be a sibling
no p: Married | p.spouse in p.siblings
}
----------------------------------------
/* Create an instance with at most three atoms in every top-level signature
* (in this case just Person)
*/
run {} for 3
|
stack/stack.ads | zorodc/true-libs | 0 | 4709 | <reponame>zorodc/true-libs<filename>stack/stack.ads<gh_stars>0
pragma SPARK_Mode(On);
generic
type Thing is private;
Basic:in Thing;
package Stack is
subtype Count is Natural;
subtype Index is Count range 1 .. Count'Last;
type Stack (Max_Capacity : Count) is private;
type Store is array (Index range<>) of Thing;
-- "Models": For peeking into internals in the spec.
function Buffer (S : Stack) return Store with Ghost; -- Underlying buffer.
function Pushes (S : Stack) return Count with Ghost; -- # of items pushed.
-----------------------
-- Primary interface --
-----------------------
function Has_Space (S : Stack) return Boolean;
function Has_Items (S : Stack) return Boolean;
function Top (S : in Stack) return Thing
with Pre => Has_Items (S),
Post => Top'Result = Buffer (S)(Pushes (S));
procedure Pop (S : in out Stack)
with Pre => Has_Items (S),
Post => Has_Space (S) and Pushes (S) = Pushes (S)'Old -1
and Buffer (S) = Buffer (S)'Old (1..Pushes(S));
procedure Put (S : in out Stack; E : Thing)
with Pre => Has_Space (S),
Post => Has_Items (S) and Pushes (S) = Pushes (S)'Old + 1
and Buffer (S) = Buffer (S)'Old & E;
private
type Stack (Max_Capacity : Count) is record
Elements : Store (1 .. Max_Capacity) := (others => Basic);
Quantity : Count := 0; -- ^ UNNEEDED
end record
with Dynamic_Predicate => (Stack.Quantity <= Stack.Max_Capacity);
function Has_Items(S: Stack) return Boolean is (S.Quantity > 0);
function Has_Space(S: Stack) return Boolean is (S.Quantity < S.Max_Capacity);
function Buffer (S: Stack) return Store is (S.Elements(1 .. S.Quantity));
function Pushes (S: Stack) return Count is (S.Quantity );
end Stack;
|
oeis/308/A308598.asm | neoneye/loda-programs | 11 | 90652 | ; A308598: The smaller term of the pair (a(n), a(n+1)) is always prime and in each pair there is a composite number; a(1) = 2 and the sequence is always extended with the smallest integer not yet present and not leading to a contradiction.
; Submitted by <NAME>(s3)
; 2,4,3,6,5,8,7,12,11,14,13,18,17,20,19,24,23,30,29,32,31,38,37,42,41,44,43,48,47,54,53,60,59,62,61,68,67,72,71,74,73,80,79,84,83,90,89,98,97,102,101,104,103,108,107,110,109,114,113,128,127,132,131,138,137,140,139,150,149
mov $1,$0
mov $2,-2
gcd $2,$0
seq $0,173919 ; Numbers that are prime or one less than a prime.
mod $1,2
add $0,$1
trn $0,$2
add $0,2
|
agda-stdlib/src/Data/List/Fresh.agda | DreamLinuxer/popl21-artifact | 5 | 14952 | <filename>agda-stdlib/src/Data/List/Fresh.agda<gh_stars>1-10
------------------------------------------------------------------------
-- The Agda standard library
--
-- Fresh lists, a proof relevant variant of Catarina Coquand's contexts in
-- "A Formalised Proof of the Soundness and Completeness of a Simply Typed
-- Lambda-Calculus with Explicit Substitutions"
------------------------------------------------------------------------
-- See README.Data.List.Fresh and README.Data.Trie.NonDependent for
-- examples of how to use fresh lists.
{-# OPTIONS --without-K --safe #-}
module Data.List.Fresh where
open import Level using (Level; _⊔_; Lift)
open import Data.Bool.Base using (true; false)
open import Data.Unit.Base
open import Data.Product using (∃; _×_; _,_; -,_; proj₁; proj₂)
open import Data.List.Relation.Unary.All using (All; []; _∷_)
open import Data.List.Relation.Unary.AllPairs using (AllPairs; []; _∷_)
open import Data.Maybe.Base as Maybe using (Maybe; just; nothing)
open import Data.Nat.Base using (ℕ; zero; suc)
open import Function using (_∘′_; flip; id; _on_)
open import Relation.Nullary using (does)
open import Relation.Unary as U using (Pred)
open import Relation.Binary as B using (Rel)
open import Relation.Nary
private
variable
a b p r s : Level
A : Set a
B : Set b
------------------------------------------------------------------------
-- Basic type
-- If we pick an R such that (R a b) means that a is different from b
-- then we have a list of distinct values.
module _ {a} (A : Set a) (R : Rel A r) where
data List# : Set (a ⊔ r)
fresh : (a : A) (as : List#) → Set r
data List# where
[] : List#
cons : (a : A) (as : List#) → fresh a as → List#
-- Whenever R can be reconstructed by η-expansion (e.g. because it is
-- the erasure ⌊_⌋ of a decidable predicate, cf. Relation.Nary) or we
-- do not care about the proof, it is convenient to get back list syntax.
-- We use a different symbol to avoid conflict when importing both Data.List
-- and Data.List.Fresh.
infixr 5 _∷#_
pattern _∷#_ x xs = cons x xs _
fresh a [] = Lift _ ⊤
fresh a (x ∷# xs) = R a x × fresh a xs
-- Convenient notation for freshness making A and R implicit parameters
infix 5 _#_
_#_ : {R : Rel A r} (a : A) (as : List# A R) → Set r
_#_ = fresh _ _
------------------------------------------------------------------------
-- Operations for modifying fresh lists
module _ {R : Rel A r} {S : Rel B s} (f : A → B) (R⇒S : ∀[ R ⇒ (S on f) ]) where
map : List# A R → List# B S
map-# : ∀ {a} as → a # as → f a # map as
map [] = []
map (cons a as ps) = cons (f a) (map as) (map-# as ps)
map-# [] _ = _
map-# (a ∷# as) (p , ps) = R⇒S p , map-# as ps
module _ {R : Rel B r} (f : A → B) where
map₁ : List# A (R on f) → List# B R
map₁ = map f id
module _ {R : Rel A r} {S : Rel A s} (R⇒S : ∀[ R ⇒ S ]) where
map₂ : List# A R → List# A S
map₂ = map id R⇒S
------------------------------------------------------------------------
-- Views
data Empty {A : Set a} {R : Rel A r} : List# A R → Set (a ⊔ r) where
[] : Empty []
data NonEmpty {A : Set a} {R : Rel A r} : List# A R → Set (a ⊔ r) where
cons : ∀ x xs pr → NonEmpty (cons x xs pr)
------------------------------------------------------------------------
-- Operations for reducing fresh lists
length : {R : Rel A r} → List# A R → ℕ
length [] = 0
length (_ ∷# xs) = suc (length xs)
------------------------------------------------------------------------
-- Operations for constructing fresh lists
pattern [_] a = a ∷# []
fromMaybe : {R : Rel A r} → Maybe A → List# A R
fromMaybe nothing = []
fromMaybe (just a) = [ a ]
module _ {R : Rel A r} (R-refl : B.Reflexive R) where
replicate : ℕ → A → List# A R
replicate-# : (n : ℕ) (a : A) → a # replicate n a
replicate zero a = []
replicate (suc n) a = cons a (replicate n a) (replicate-# n a)
replicate-# zero a = _
replicate-# (suc n) a = R-refl , replicate-# n a
------------------------------------------------------------------------
-- Operations for deconstructing fresh lists
uncons : {R : Rel A r} → List# A R → Maybe (A × List# A R)
uncons [] = nothing
uncons (a ∷# as) = just (a , as)
head : {R : Rel A r} → List# A R → Maybe A
head = Maybe.map proj₁ ∘′ uncons
tail : {R : Rel A r} → List# A R → Maybe (List# A R)
tail = Maybe.map proj₂ ∘′ uncons
take : {R : Rel A r} → ℕ → List# A R → List# A R
take-# : {R : Rel A r} → ∀ n a (as : List# A R) → a # as → a # take n as
take zero xs = []
take (suc n) [] = []
take (suc n) (cons a as ps) = cons a (take n as) (take-# n a as ps)
take-# zero a xs _ = _
take-# (suc n) a [] ps = _
take-# (suc n) a (x ∷# xs) (p , ps) = p , take-# n a xs ps
drop : {R : Rel A r} → ℕ → List# A R → List# A R
drop zero as = as
drop (suc n) [] = []
drop (suc n) (a ∷# as) = drop n as
module _ {P : Pred A p} (P? : U.Decidable P) where
takeWhile : {R : Rel A r} → List# A R → List# A R
takeWhile-# : ∀ {R : Rel A r} a (as : List# A R) → a # as → a # takeWhile as
takeWhile [] = []
takeWhile (cons a as ps) with does (P? a)
... | true = cons a (takeWhile as) (takeWhile-# a as ps)
... | false = []
takeWhile-# a [] _ = _
takeWhile-# a (x ∷# xs) (p , ps) with does (P? x)
... | true = p , takeWhile-# a xs ps
... | false = _
dropWhile : {R : Rel A r} → List# A R → List# A R
dropWhile [] = []
dropWhile aas@(a ∷# as) with does (P? a)
... | true = dropWhile as
... | false = aas
filter : {R : Rel A r} → List# A R → List# A R
filter-# : ∀ {R : Rel A r} a (as : List# A R) → a # as → a # filter as
filter [] = []
filter (cons a as ps) with does (P? a)
... | true = cons a (filter as) (filter-# a as ps)
... | false = filter as
filter-# a [] _ = _
filter-# a (x ∷# xs) (p , ps) with does (P? x)
... | true = p , filter-# a xs ps
... | false = filter-# a xs ps
------------------------------------------------------------------------
-- Relationship to List and AllPairs
toList : {R : Rel A r} → List# A R → ∃ (AllPairs R)
toAll : ∀ {R : Rel A r} {a} as → fresh A R a as → All (R a) (proj₁ (toList as))
toList [] = -, []
toList (cons x xs ps) = -, toAll xs ps ∷ proj₂ (toList xs)
toAll [] ps = []
toAll (a ∷# as) (p , ps) = p ∷ toAll as ps
fromList : ∀ {R : Rel A r} {xs} → AllPairs R xs → List# A R
fromList-# : ∀ {R : Rel A r} {x xs} (ps : AllPairs R xs) →
All (R x) xs → x # fromList ps
fromList [] = []
fromList (r ∷ rs) = cons _ (fromList rs) (fromList-# rs r)
fromList-# [] _ = _
fromList-# (p ∷ ps) (r ∷ rs) = r , fromList-# ps rs
|
src/buttons_clock.asm | grantperry/elec342-alarm-clock | 0 | 93659 | button_clock_actions:
cpi r16, (1<<2)
breq button_clock_action_inc_display_counter
cpi r16, (1<<1)
breq button_clock_action_select
cpi r16, (1<<0)
breq button_clock_action_increment
rjmp button_clock_action_finished
button_clock_action_inc_display_counter:
rcall display_inc_counter
rjmp button_clock_action_finished
button_clock_action_select:
rcall button_clock_select
rjmp button_clock_action_finished
button_clock_action_increment:
rcall button_clock_increment
button_clock_action_invalid:
button_clock_action_finished:
ret
button_clock_select:
push r16
rcall getSelect
tst r16
breq button_clock_select_no_selected
cpi r16, (1<<5) ; terminate if currently ...10000
breq button_clock_select_term
clc ; rol uses carry. so clear it.
rol r16
rjmp button_clock_select_set
button_clock_select_no_selected:
ldi r16, 1
rjmp button_clock_select_set
button_clock_select_term:
clr r16
button_clock_select_set:
rcall setSelect
ldi r16, 0xFF ; reset the display for all fiels to show.
rcall setFlashSelect
pop r16
ret
button_clock_increment:
rcall getSelect
cpi r16, (1<<0)
breq inc_clock_hour
cpi r16, (1<<1)
breq inc_clock_min
cpi r16, (1<<2)
breq inc_clock_day
cpi r16, (1<<3)
breq inc_clock_month
cpi r16, (1<<4)
breq inc_clock_year
cpi r16, (1<<5)
breq inc_clock_1224
rjmp inc_clock_end
inc_clock_min:
rcall getMin
inc r16
cpi r16, 60
brge inc_clock_min_of
rjmp inc_clock_min_end
inc_clock_min_of:
clr r16
inc_clock_min_end:
rcall setMin
clr r16
rcall setSeconds
rjmp inc_clock_end_time
inc_clock_hour:
rcall getHour
inc r16
cpi r16, 24
brge inc_clock_hour_of
rjmp inc_clock_hour_end
inc_clock_hour_of:
clr r16
inc_clock_hour_end:
rcall setHour
rjmp inc_clock_end_time
inc_clock_day:
rcall logic_clock_day_inc
rjmp inc_clock_end_date
inc_clock_month:
rcall getMonth
inc r16
cpi r16, 13 ; 12 months resetting to 1
brge inc_clock_month_of
rjmp inc_clock_month_end
inc_clock_month_of:
ldi r16, 1
inc_clock_month_end:
rcall setMonth
rjmp inc_clock_end_date
inc_clock_year:
rcall getYear
inc r16
cpi r16, 99
breq inc_clock_year_of
rjmp inc_clock_year_end
inc_clock_year_of:
clr r16
inc_clock_year_end:
rcall setYear
rjmp inc_clock_end_date
inc_clock_1224:
rcall toggleState1224
rjmp inc_clock_end_time
inc_clock_end_time:
inc_clock_end_date:
inc_clock_end:
rcall display_update
ret
toggle_alarm_setter:
ret |
libsrc/psg/spectrum/set_psg_callee.asm | grancier/z180 | 0 | 84886 | <reponame>grancier/z180
;
; ZX Spectrum specific routines
; by <NAME>, Fall 2013
;
; int set_psg(int reg, int val);
;
; Play a sound by PSG
;
;
; $Id: set_psg_callee.asm,v 1.5 2017/01/02 23:57:08 aralbrec Exp $
;
SECTION code_clib
PUBLIC set_psg_callee
PUBLIC _set_psg_callee
EXTERN __psg_select_and_read_port
EXTERN __psg_write_port
PUBLIC ASMDISP_SET_PSG_CALLEE
set_psg_callee:
_set_psg_callee:
pop hl
pop de
ex (sp),hl
.asmentry
ld bc,(__psg_select_and_read_port)
out (c),l
ld bc,(__psg_write_port)
out (c),e
ret
DEFC ASMDISP_SET_PSG_CALLEE = # asmentry - set_psg_callee
|
libs/Multiplatform_ReadJoystickKeypressHandler.asm | CurlyPaul/cpc-z80-poc | 0 | 5910 | ; Learn Multi platform Z80 Assembly Programming... With Vampires!
;Please see my website at www.chibiakumas.com/z80/
;for the 'textbook', useful resources and video tutorials
;File Read Controls
;Version V1.0
;Date 2018/7/6
;Content This function reads in input from the Key and Joystick input, and compares it to a defined 'keymap'
;----------------------------------------------------------------------------------------------
ifdef UseSampleKeymap ;Sample keymap for all systems
align32
KeyMap equ KeyMap2+16 ;wsad bnm p
KeyMap2: ;Default controls (joystick)
ifdef BuildCPC
db &F7,&03,&7f,&05,&ef,&09,&df,&09,&f7,&09,&fB,&09,&fd,&09,&fe,&09 ;p2-pause,f3,f2,f1,r,l,d,u
db &f7,&03,&bf,&04,&bf,&05,&bf,&06,&df,&07,&df,&08,&ef,&07,&f7,&07 ;p1-pause,f3,f2,f1,r,l,d,u
endif
ifdef BuildENT
db &ef,&09,&bf,&08,&df,&0a,&bf,&0a,&fe,&0a,&fd,&0a,&fb,&0a,&f7,&0a
db &ef,&09,&fe,&08,&fe,&00,&fb,&00,&f7,&01,&bf,&01,&df,&01,&bf,&02
endif
ifdef BuildZXS
db &fe,&05,&fe,&07,&fe,&06,&ef,&08,&fe,&08,&fd,&08,&fb,&08,&f7,&08
db &fe,&0f,&fb,&07,&f7,&07,&ef,&07,&fb,&01,&fe,&01,&fd,&01,&fd,&02
endif
ifdef BuildMSX
db &df,&04,&fe,&08,&ef,&0c,&df,&0c,&f7,&0c,&fb,&0c,&fd,&0c,&fe,&0c
db &df,&04,&fb,&04,&f7,&04,&7f,&02,&fd,&03,&bf,&02,&fe,&05,&ef,&05
endif
ifdef BuildTI8
db &f7,&05,&fb,&05,&fd,&05,&fe,&05,&fb,&04,&fb,&02,&fd,&03,&f7,&03
db &bf,&05,&7f,&00,&bf,&00,&df,&00,&fb,&06,&fd,&06,&fe,&06,&f7,&06
endif
ifdef BuildSAM
db &FE,&05,&Fe,&07,&FE,&06,&FE,&04,&F7,&04,&EF,&04,&FB,&04,&FD,&04
db &FE,&05,&FB,&07,&F7,&07,&EF,&07,&FB,&01,&FE,&01,&FD,&01,&FD,&02
endif
ifdef BuildCLX
db &Fd,&07,&F7,&02,&F7,&09,&F7,&04,&DF,&09,&FB,&09,&DF,&00,&EF,&00
db &Fd,&07,&F7,&02,&F7,&09,&F7,&04,&DF,&09,&FB,&09,&DF,&00,&EF,&00
endif
endif
KeyboardScanner_WaitForKey:
call KeyboardScanner_ScanForOne ;Call the keyscanner
cp 255 ;No keys pressed?
jr z,KeyboardScanner_WaitForKey
ret
KeyboardScanner_ScanForOne:
call KeyboardScanner_Read ;Read the keymap
ld b,KeyboardScanner_LineCount ;Number of lines depends on system - systems like the speccy has 3 unused bis (567)
ld c,0
ld hl,KeyboardScanner_KeyPresses
KeyboardScanner_WaitForKey_Check:
ld a,(hl)
cp 255
ret nz ;Return if we found a line that had a key pressed
inc hl
inc c
djnz KeyboardScanner_WaitForKey_Check
ret ;if we got here, none of the keys were pressed.
Player_ReadControlsDual: ; Read Controls
call KeyboardScanner_Read ;Read hardware keypresses
call Player_ReadControls2
ld l,c ;Player 2 controls
push hl
call Player_ReadControls
pop hl
ld h,c ;Player 1 controls
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Player_ReadControls2:
ld hl,KeyMap2 ;p2 keymap
jr Player_ReadControlsB
Player_ReadControls:
ld hl,KeyMap ;p1 keymap
Player_ReadControlsB: ; We compare the keypresses to the 8 key map,
ld b,&08 ; and store the result as a single byte
; when 2player support is done, we will do this twice one for
Player_Handler_ReadNext: ; each controller
push bc
ld d,(hl) ;Bitmap
inc hl
ld a,(hl) ;line num
inc hl
push hl
ld hl,KeyboardScanner_KeyPresses
add l
ld l,a ;We're relying on this being byte aligned.
ld a,(hl)
or d
inc a ;see if A is 255!
jr nz,Player_Handler_notPressed
scf ;set C to 1 (the previous OR made it 0)
Player_Handler_notPressed:
pop hl
pop bc
rl c ;Shift the new bit in
djnz Player_Handler_ReadNext
ld a,c
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ifdef JOY_NoReconfigureControls
ConfigureControls:
ld b,8*2 ;8 buttons, 2 players
ConfigureControls_Nextkey:
ifdef BuildCPC
ld a,30*6 ;Delay is longer on CPC due to faster interrupts
else
ifdef BuildCLX
ld a,100
else
ld a,30
endif
endif
ifndef BuildCLX
ei
endif
ConfigureControls_Delay:
ifndef BuildCLX
halt ;Cant halt on camputers lynx
else
ld h,255
CamputersDelay:
;push af
;pop af
dec h
jr nz,CamputersDelay
;di
endif
dec a
jr nz,ConfigureControls_Delay
push bc
ld hl,KeyName
ld a,b ;B=key number
dec a
add a ;2 bytes per key
ld d,0
ld e,a
add hl,de ;get offset to key string address
ld c,(hl) ;get the description of the key
inc hl
ld b,(hl) ;get the description of the key
push de
push bc
ifdef BuildTI8
call CLS
endif
ld hl,KeyMapString0 ;Print 'Press key for'
call PrintString
pop hl ;Get the name of the key in HL
call PrintString
call KeyboardScanner_WaitForKey ;Wait for a keypress
pop de
ld hl,KeyMap2 ;Read the keymap
add hl,de ;add keynumber (x2) to keymap
push de
ld (hl),a ;Bitmask
inc hl
ld (hl),c ;Line number
pop de
pop bc
call NewLine
ifdef KeyboardScanner_OnePlayerOnly
dec b
ld a,8
cp b
jp nz,ConfigureControls_Nextkey
else
djnz ConfigureControls_Nextkey
endif
ret
KeyName: ;Stringmap for keysnames - order is important!
defw KeyMapString8b
defw KeyMapString7b
defw KeyMapString6b
defw KeyMapString5b
defw KeyMapString4b
defw KeyMapString3b
defw KeyMapString2b
defw KeyMapString1b
defw KeyMapString8
defw KeyMapString7
defw KeyMapString6
defw KeyMapString5
defw KeyMapString4
defw KeyMapString3
defw KeyMapString2
defw KeyMapString1
KeyMapString0: db "PRESS KEY FOR:",255
KeyMapString8: db "P1-PAUSE",255
KeyMapString7: db "P1-SBOMB",255
KeyMapString6: db "P1-FIRER",255
KeyMapString5: db "P1-FIREL",255
KeyMapString4: db "P1-RIGHT",255
KeyMapString3: db "P1-LEFT",255
KeyMapString2: db "P1-DOWN",255
KeyMapString1: db "P1-UP",255
KeyMapString8b: db "P2-PAUSE",255
KeyMapString7b: db "P2-SBOMB",255
KeyMapString6b: db "P2-FIRER",255
KeyMapString5b: db "P2-FIREL",255
KeyMapString4b: db "P2-RIGHT",255
KeyMapString3b: db "P2-LEFT",255
KeyMapString2b: db "P2-DOWN",255
KeyMapString1b: db "P2-UP",255
endif
|
data/wildPokemon/mansion1.asm | etdv-thevoid/pokemon-rgb-enhanced | 1 | 165304 | MansionMons1:
db $0A
IF DEF(_RED)
db 32,KOFFING
db 30,KOFFING
db 34,RATICATE
db 30,RATICATE
db 34,GROWLITHE
db 31,VENOMOTH
db 30,GRIMER
db 33,VENOMOTH
db 37,WEEZING
db 39,MUK
ELSE
db 32,GRIMER
db 30,GRIMER
db 34,RATICATE
db 30,RATICATE
db 34,VULPIX
db 31,VENOMOTH
db 30,KOFFING
db 33,VENOMOTH
db 37,MUK
db 39,WEEZING
ENDC
db $00
|
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_21829_1442.asm | ljhsiun2/medusa | 9 | 162107 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x1ecdf, %rsi
lea addresses_A_ht+0x80e9, %rdi
nop
dec %r9
mov $8, %rcx
rep movsq
inc %r10
lea addresses_WT_ht+0x1e2c9, %rax
nop
nop
sub %rbp, %rbp
mov $0x6162636465666768, %rdi
movq %rdi, (%rax)
nop
nop
nop
nop
nop
xor $10990, %rcx
lea addresses_WT_ht+0x127f9, %rdi
nop
nop
nop
nop
nop
and %rsi, %rsi
mov $0x6162636465666768, %r9
movq %r9, (%rdi)
sub %r9, %r9
lea addresses_D_ht+0x334f, %r9
dec %rdi
mov (%r9), %rsi
nop
add $14970, %rcx
lea addresses_UC_ht+0x1b039, %rsi
nop
nop
nop
nop
nop
cmp $42464, %r9
mov (%rsi), %r10w
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_UC_ht+0x37e9, %rax
nop
nop
nop
nop
and $53718, %rsi
mov $0x6162636465666768, %r9
movq %r9, %xmm0
and $0xffffffffffffffc0, %rax
movaps %xmm0, (%rax)
nop
nop
nop
nop
nop
inc %rdi
lea addresses_normal_ht+0x190b7, %rax
nop
nop
nop
xor $44958, %r9
movl $0x61626364, (%rax)
nop
nop
nop
nop
cmp %rbp, %rbp
lea addresses_UC_ht+0x10d44, %r9
sub $41049, %rax
movl $0x61626364, (%r9)
nop
nop
nop
nop
nop
and $45743, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r15
push %rax
push %rcx
push %rdx
push %rsi
// Store
lea addresses_WC+0x172b1, %rcx
nop
nop
nop
nop
and $28757, %r15
movl $0x51525354, (%rcx)
add %r11, %r11
// Store
lea addresses_D+0x1dc9, %rax
nop
xor %rsi, %rsi
mov $0x5152535455565758, %rcx
movq %rcx, (%rax)
and %r12, %r12
// Store
lea addresses_D+0x1dc9, %r11
nop
nop
nop
nop
nop
add $20057, %r15
mov $0x5152535455565758, %rcx
movq %rcx, %xmm6
vmovups %ymm6, (%r11)
nop
nop
nop
sub $18081, %r12
// Store
lea addresses_A+0x1b285, %rsi
nop
nop
and %rdx, %rdx
mov $0x5152535455565758, %r11
movq %r11, %xmm5
movups %xmm5, (%rsi)
nop
nop
nop
nop
nop
and $25119, %r11
// Store
lea addresses_PSE+0xb9c9, %rax
nop
cmp $31250, %rsi
movb $0x51, (%rax)
nop
nop
inc %r15
// Store
mov $0x809, %r11
xor $24912, %rcx
movl $0x51525354, (%r11)
nop
nop
nop
sub $2010, %rdx
// Faulty Load
lea addresses_D+0x1dc9, %rdx
cmp $41537, %r15
movups (%rdx), %xmm6
vpextrq $1, %xmm6, %r12
lea oracles, %rdx
and $0xff, %r12
shlq $12, %r12
mov (%rdx,%r12,1), %r12
pop %rsi
pop %rdx
pop %rcx
pop %rax
pop %r15
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Transynther/x86/_processed/NONE/_st_/i7-7700_9_0x48.log_556_1611.asm | ljhsiun2/medusa | 9 | 80471 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r8
push %r9
push %rbp
push %rbx
lea addresses_WT_ht+0xcafa, %r9
nop
nop
cmp %rbx, %rbx
mov $0x6162636465666768, %r13
movq %r13, %xmm2
and $0xffffffffffffffc0, %r9
vmovntdq %ymm2, (%r9)
nop
nop
nop
xor %r11, %r11
lea addresses_A_ht+0x7cfa, %r8
nop
nop
nop
add %r9, %r9
movb $0x61, (%r8)
nop
nop
and $22955, %rbp
lea addresses_D_ht+0x174, %r9
nop
nop
nop
nop
add $21774, %rbp
mov $0x6162636465666768, %r13
movq %r13, (%r9)
add $11806, %r9
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r8
push %rbp
push %rcx
push %rdx
// Store
lea addresses_RW+0xe8fa, %r15
xor %rbp, %rbp
mov $0x5152535455565758, %rdx
movq %rdx, (%r15)
nop
nop
nop
nop
dec %r15
// Store
lea addresses_PSE+0x1e258, %r14
nop
nop
nop
nop
nop
dec %r8
movw $0x5152, (%r14)
nop
nop
cmp $35145, %r8
// Store
lea addresses_WC+0x26fa, %rdx
nop
nop
nop
nop
nop
cmp %rcx, %rcx
movl $0x51525354, (%rdx)
xor %r8, %r8
// Store
mov $0x65def000000006fa, %rdx
nop
nop
nop
nop
nop
cmp %r12, %r12
movl $0x51525354, (%rdx)
nop
nop
add $46783, %r8
// Faulty Load
lea addresses_WT+0x18fa, %rbp
dec %r12
mov (%rbp), %r14w
lea oracles, %r8
and $0xff, %r14
shlq $12, %r14
mov (%r8,%r14,1), %r14
pop %rdx
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': True, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 7, 'size': 32, 'same': True, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}}
{'58': 556}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
src/Prelude/Fractional.agda | L-TChen/agda-prelude | 111 | 10542 | <reponame>L-TChen/agda-prelude
module Prelude.Fractional where
open import Agda.Primitive
record Fractional {a} (A : Set a) : Set (lsuc a) where
infixl 7 _/_
field
Constraint : A → A → Set a
_/_ : (x y : A) {{_ : Constraint x y}} → A
NoConstraint : Set a
NoConstraint = ∀ {x y} → Constraint x y
open Fractional {{...}} using (_/_) public
{-# DISPLAY Fractional._/_ _ x y = x / y #-}
|
alloy4fun_models/trashltl/models/0/EMz6E2zDEyB6JkAdX.als | Kaixi26/org.alloytools.alloy | 0 | 970 | <gh_stars>0
open main
pred idEMz6E2zDEyB6JkAdX_prop1 {
no Trash and no (Protected & Trash)
}
pred __repair { idEMz6E2zDEyB6JkAdX_prop1 }
check __repair { idEMz6E2zDEyB6JkAdX_prop1 <=> prop1o } |
Appl/Games/CWord/cwordVictory.asm | steakknife/pcgeos | 504 | 2559 | <reponame>steakknife/pcgeos
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Geoworks 1994 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: cwordVictory.asm
AUTHOR: <NAME>, Sep 26, 1994
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Steve 9/26/94 Initial revision
DESCRIPTION:
$Id: cwordVictory.asm,v 1.1 97/04/04 15:14:22 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
; State for the random-number generator. This beast comes from the
; BSD random-number generator, which is supposed to be random in all 31
; bits it produces...
;
RAND_DEG equ 31
RAND_SEP equ 3
RAND_MULT equ 1103515245
RAND_ADD equ 12345
idata segment
frontPtr nptr.dword randTbl[(RAND_SEP+1)*dword]
rearPtr nptr.dword randTbl[1*dword]
endPtr nptr.dword randTbl[(RAND_DEG+1)*dword]
randTbl dword 3, ; generator type
0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342,
0xde3b81e0, 0xdf0a6fb5, 0xf103bc02, 0x48f340fb,
0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd,
0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86,
0xda672e2a, 0x1588ca88, 0xe369735d, 0x904f35f7,
0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc,
0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b,
0xf5ad9d0e, 0x8999220b, 0x27fb47b9
idata ends
CwordVictoryCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GameSeedRandom
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Seed the random number generator, using 128 bytes of state
CALLED BY:
PASS: dx:ax = initial seed
RETURN: nothing
DESTROYED: dx, ax
PSEUDO CODE/STRATEGY:
state[0] = seed;
for (i = 1; i < RAND_DEG; i++) {
state[i] = 1103515245*state[i-1] + 12345;
}
frontPtr = &state[RAND_SEP];
rearPtr = &state[0];
for (i = 0; i < 10*RAND_DEG; i++) {
GameRandom();
}
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 4/14/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GameSeedRandom proc far
uses si, di, bx, cx, ds
.enter
mov bx, handle dgroup ;Do this so there is no segment
call MemDerefDS ; relocs to dgroup (so the
; dgroup resource is
; discardable on XIP platforms)
mov di, offset (randTbl[1*dword])
mov cx, RAND_DEG-1
seedLoop:
mov ({dword}ds:[di]).low, ax
mov ({dword}ds:[di]).high, dx
add di, size dword
;
; Perform a 32-bit unsigned multiply by RAND_MULT, leaving the result
; in si:bx:
;
; h mh ml l
;ax*low(RAND_MULT) x x
;dx*low(RAND_MULT) x x
;ax*high(RAND_MULT) x x
;dx*high(RAND_MULT) x x
;
; The highest two words are discarded, which means we don't even have
; to multiply dx by high(RAND_MULT).
;
push ax
push dx
mov dx, RAND_MULT AND 0xffff
mul dx
xchg bx, ax ; bx <- low(result)
mov si, dx ; si <- partial high(result)
pop ax ; ax <- original dx
mov dx, RAND_MULT AND 0xffff
mul dx
add si, ax ; high(result) += low(dx*low(RAND_MULT))
pop ax ; ax <- original ax
mov dx, RAND_MULT / 65536
mul dx
add si, ax ; high(result)+=low(high(RAND_MULT)*ax)
;
; Place result in the proper registers and add in the additive factor.
;
mov dx, si
mov ax, bx
add ax, RAND_ADD
adc dx, 0
loop seedLoop
;
; Store the final result.
;
mov ({dword}ds:[di]).low, ax
mov ({dword}ds:[di]).high, dx
;
; Initialize the pointers.
;
mov ds:[frontPtr], offset (randTbl[(RAND_SEP+1)*dword])
mov ds:[rearPtr], offset (randTbl[1*dword])
;
; Now randomize the state according to the degree of the
; polynomial we're using.
;
mov cx, 10*RAND_DEG
initLoop:
mov dx, 0xffff
call GameRandom
loop initLoop
.leave
ret
GameSeedRandom endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GameRandom
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return a random number
CALLED BY: GLOBAL
PASS: dx = max for returned value
RETURN: dx = number between 0 and max-1
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
We assume we're using a type 3 random number generator here,
so the code looks like this:
*frontPtr += *rearPtr;
i = (*frontPtr >> 1)&0x7fffffff;
if (++frontPtr >= endPtr) {
frontPtr = state;
rearPtr += 1;
} else if (++rearPtr >= endPtr) {
rearPtr = state;
}
return(i % DL);
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 3/25/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GameRandom proc far
uses ds, cx, si, di, ax, bx
.enter
mov bx, handle dgroup ;Do this so there is no segment
call MemDerefDS ; relocs to dgroup (so the
; dgroup resource is
; discardable on XIP platforms)
mov si, ds:[frontPtr]
mov di, ds:[rearPtr]
mov ax, ({dword}ds:[di]).low
mov cx, ({dword}ds:[di]).high
add ax, ({dword}ds:[si]).low
adc cx, ({dword}ds:[si]).high
mov ({dword}ds:[si]).low, ax
mov ({dword}ds:[si]).high, cx
shr cx
rcr ax
add si, size dword
add di, size dword
cmp si, ds:[endPtr]
jb adjustRear
mov si, offset (randTbl[1*dword])
jmp storePtrs
adjustRear:
cmp di, ds:[endPtr]
jb storePtrs
mov di, offset (randTbl[1*dword])
storePtrs:
mov ds:[frontPtr], si
mov ds:[rearPtr], di
mov cx, dx ; ignore high word, to avoid painful
; divide. Since all the bits are
; random, we just make do with the
; low sixteen, thereby avoiding
; quotient-too-large faults
clr dx
div cx
.leave
ret
GameRandom endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardPlaySound
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Play a sound.
CALLED BY: BoardVerify, BoardVerifyWord
PASS: nothing
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Call WavPlayInitSound for the sound
REVISION HISTORY:
Name Date Description
---- ---- -----------
DH 3/15/2000 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
; These constants match those used in the [sound] section.
SOUND_CWORD_CHECK_OK equ 0
BoardPlaySound proc near
uses ax, bx, cx, dx, di, es
soundToken local GeodeToken
.enter
; Retrieve our GeodeToken.
segmov es, ss, ax
lea di, soundToken
mov bx, handle 0 ; bx <- app geode token
mov ax, GGIT_TOKEN_ID
call GeodeGetInfo
; Play the sound.
mov bx, SOUND_CWORD_CHECK_OK
mov cx, es
mov dx, di
call WavPlayInitSound
.leave
ret
BoardPlaySound endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardVerify
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Verify all the user letters in non-empty cells and
give feedback of the results to the user.
Also reset HWR macro if in PEN mode.
CALLED BY: MSG_CWORD_BOARD_VERIFY
PASS: *ds:si = CwordBoardClass object
ds:di = CwordBoardClass instance data
ds:bx = CwordBoardClass object (same as *ds:si)
es = segment of CwordBoardClass
ax = message #
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JL 7/25/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardVerify method dynamic CwordBoardClass,
MSG_CWORD_BOARD_VERIFY
uses ax, cx, dx, bp
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
;;;;;;;;
cmp ds:[di].CBI_system, ST_PEN
jne dontReset
call BoardGestureResetMacroProcFar
dontReset:
call BoardPlaySound
mov dx,ds:[di].CBI_engine
tst dx
jz done
call EngineCheckForAllCellsCorrect
jnc success
call EngineVerifyAllCells
call BoardAnimateVerify
call EngineCheckForAllCellsFilled
jnc allFilled
enableDisable:
call CwordEnableDisableClearXSquares
done:
.leave
ret
allFilled:
; If no wrong cells on screen, then do something about it
;
call BoardDetermineIfWrongCellOnScreen
jc enableDisable
call BoardGetWrongCellOnScreen
jmp enableDisable
success:
call BoardFoolinAround
mov bx,handle CompletedInteraction
mov si,offset CompletedInteraction
mov ax,MSG_GEN_INTERACTION_INITIATE
mov di,mask MF_FIXUP_DS
call ObjMessage
jmp done
BoardVerify endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardFoolinAround
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Do cool stuff to celebrate the completion of the puzzle
CALLED BY: BoardVerify
PASS: *ds:si - Board
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/22/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardFoolinAround proc near
uses ax,cx,dx,bp,es,bx
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
;;;;;;;;
call TimerGetCount
call GameSeedRandom
mov bx,handle CwordStrings
call MemLock
mov es,ax
mov dx,length coolTextOffsets
call GameRandom
shl dx ;word size table
add dx,offset coolTextOffsets
mov bx,dx ;offset into table
mov bx,cs:[bx] ;chunk of text from table
mov bx,es:[bx] ;offset of text from chunk
call BoardFadeInCoolString
mov bx,handle CwordStrings
call MemUnlock
call BoardDoShootingStars
call BoardFadeOutScreen
mov ax,MSG_VIS_INVALIDATE
call ObjCallInstanceNoLock
.leave
ret
coolTextOffsets word \
offset CoolText,
offset FinisText,
offset RadText,
offset DoneText,
offset YesText
BoardFoolinAround endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardEnumerateCells
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Call call back routine for each cell. Process left to right
on first row then right to left and so on.
CALLED BY: UTILITY
PASS: *ds:si - Board
di - offset to near routine in segment cs
cx,bp - data to pass to call back
PASSED to call back
*ds:si - Board
dx - engine token
bx - cell token
cx,bp - data passed to BoardEnumerateCells
RETURN:
carry clear - enumerated all cells
ax - destroyed
carry set - enumeration stopped
ax - cell number that stopped
DESTROYED:
see RETURN
PSEUDO CODE/STRATEGY:
call back routine returning carry stops enumeration
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/20/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardEnumerateCells proc near
class CwordBoardClass
uses dx,bx
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
;;;;;;;;
GetInstanceDataPtrDSBX CwordBoard_offset
mov dx,ds:[bx].CBI_engine
clr bx ;initial
makeCall:
call di
mov ax,bx ;cell token
jc done
leftToRight:
call EngineGetNextCellTokenInRowFar
cmp bx,ENGINE_GRID_EDGE
je rightToLeftStart
call di
mov ax,bx ;cell token
jc done
jmp leftToRight
rightToLeftStart:
call EngineGetNextCellTokenInColumnFar
cmp bx,ENGINE_GRID_EDGE
je doneNoTermination
call di
mov ax,bx ;cell token
jc done
rightToLeft:
call EngineGetPrevCellTokenInRowFar
cmp bx,ENGINE_GRID_EDGE
je leftToRightStart
call di
mov ax,bx ;cell token
jc done
jmp rightToLeft
done:
.leave
ret
doneNoTermination:
clc
jmp done
leftToRightStart:
call EngineGetNextCellTokenInColumnFar
cmp bx,ENGINE_GRID_EDGE
je doneNoTermination
jmp makeCall
BoardEnumerateCells endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardEnumerateCellsInWord
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Call call back routine for each cell in the word
CALLED BY: UTILITY
PASS: *ds:si - Board
bx - Direction
ax - CellToken
di - offset to near routine in segment cs
cx,bp - data to pass to call back
PASSED to call back
*ds:si - Board
dx - engine token
bx - cell token
cx,bp - data passed to BoardEnumerateCellsInWord
RETURN:
carry clear - enumerated all cells
ax - destroyed
carry set - enumeration stopped
ax - cell number that stopped
DESTROYED:
see RETURN
PSEUDO CODE/STRATEGY:
call back routine returning carry stops enumeration
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/20/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardEnumerateCellsInWord proc near
class CwordBoardClass
uses cx,dx,bx
passedBP local word push bp
passedCX local word push cx
lastToken local word
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
;;;;;;;;
mov cx,bx ;direction
GetInstanceDataPtrDSBX CwordBoard_offset
mov dx,ds:[bx].CBI_engine
call BoardMapWordToFirstNLastCellsFar
mov lastToken,bx
mov bx,ax ;first cell
makeCall:
push bp,cx ;locals, direction
mov cx,passedCX
mov bp,passedBP
call di
mov ax,bx ;current cell
pop bp,cx ;locals, direction
jc doneWithTermination
cmp ax,lastToken
je doneNoTermination
cmp cx, ACROSS
je nextRow
call EngineGetNextCellTokenInColumnFar
jmp makeCall
doneNoTermination:
clc
done:
.leave
ret
doneWithTermination:
stc
jmp done
nextRow:
call EngineGetNextCellTokenInRowFar
mov ax,bx ;next cell
jmp makeCall
BoardEnumerateCellsInWord endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardGetWrongCellOnScreen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Find a wrong cell and make sure it is visible and select it.
CALLED BY: BoardVerify
PASS:
*ds:si - Board
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/20/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardGetWrongCellOnScreen proc near
class CwordBoardClass
uses di,dx
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
;;;;;;;;
GetInstanceDataPtrDSDI CwordBoard_offset
mov dx,ds:[di].CBI_engine
call EngineFindFirstWrongCell
jnc done
call BoardMoveSelectedSquare
done:
.leave
ret
BoardGetWrongCellOnScreen endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardGetEmptyCellOnScreen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See message defintion
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object
es - segment of CwordBoardClass
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 10/ 5/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardGetEmptyCellOnScreen method dynamic CwordBoardClass,
MSG_CWORD_BOARD_FIND_EMPTY_CELL
uses ax,dx
.enter
mov dx,ds:[di].CBI_engine
tst dx
jz done
call EngineFindFirstEmptyCell
jnc done
call BoardMoveSelectedSquare
done:
.leave
ret
BoardGetEmptyCellOnScreen endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardClearPuzzle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See message defintion
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object
es - segment of CwordBoardClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 10/ 5/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardClearPuzzle method dynamic CwordBoardClass,
MSG_CWORD_BOARD_CLEAR_PUZZLE
uses ax,dx
.enter
cmp ds:[di].CBI_system, ST_PEN
jne dontReset
call BoardGestureResetMacroProcFar
dontReset:
mov dx,ds:[di].CBI_engine
tst dx
jz done
call EngineClearAllCells
mov ax,MSG_VIS_INVALIDATE
call ObjCallInstanceNoLock
call CwordEnableDisableClearXSquares
done:
.leave
ret
BoardClearPuzzle endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardClearXCells
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See message defintion
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object
es - segment of CwordBoardClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 10/ 5/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardClearXCells method dynamic CwordBoardClass,
MSG_CWORD_BOARD_CLEAR_X_CELLS
uses ax,dx
.enter
cmp ds:[di].CBI_system, ST_PEN
jne dontReset
call BoardGestureResetMacroProcFar
dontReset:
mov dx,ds:[di].CBI_engine
tst dx
jz done
call EngineClearWrongCells
mov ax,MSG_VIS_INVALIDATE
call ObjCallInstanceNoLock
call CwordEnableDisableClearXSquares
done:
.leave
ret
BoardClearXCells endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardDetermineIfWrongCellOnScreen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Enumerate through the cells and determine if any of the
wrong cells are currently visible.
CALLED BY:
PASS:
*ds:si - Board
RETURN:
stc - yes
clc - no
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/20/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardDetermineIfWrongCellOnScreen proc far
class CwordBoardClass
uses ax,di
visibleRect local Rectangle
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
;;;;;;;;
GetInstanceDataPtrDSDI CwordBoard_offset
mov ax,ds:[di].CBI_cellWidth
shr ax,1
; Make sure a reasonable portion of the wrong cell
; is visible
;
call BoardGetVisibleRect
add visibleRect.R_left,ax
add visibleRect.R_top,ax
sub visibleRect.R_right,ax
sub visibleRect.R_bottom,ax
mov di,offset BoardIsWrongCellOnScreenCallback
call BoardEnumerateCells
.leave
ret
BoardDetermineIfWrongCellOnScreen endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardIsWrongCellOnScreenCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if cell is wrong and on screen
CALLED BY: BoardEnumerateCells
PASS:
*ds:si - Board
dx - engine token
bx - cell token
cx,bp - data passed to BoardEnumerateCells
RETURN:
clc - if cell is not wrong or not on screen
stc - if cell is wrong and on screen
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/20/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardIsWrongCellOnScreenCallback proc near
uses ax,bx,cx,dx
visibleRect local Rectangle
.enter inherit
;;; Verify argument(s)
Assert ObjectBoard dssi
Assert CellTokenType bx
Assert EngineTokenType dx
;;;;;;;;
mov ax,bx ;cell token
call EngineGetCellFlagsFar
test cl,mask CF_WRONG
jz dontStop
mov cx,ax ;cell token
call BoardGetCellBounds
cmp ax,visibleRect.R_right
jg dontStop
cmp cx,visibleRect.R_left
jl dontStop
cmp bx,visibleRect.R_bottom
jg dontStop
cmp dx,visibleRect.R_top
jge stopIt
dontStop:
clc
done:
.leave
ret
stopIt:
stc
jmp done
BoardIsWrongCellOnScreenCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardAnimateVerify
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Highlight each cell and the verify it, drawing
the slashed if it is wrong.
CALLED BY:
PASS: *ds:si - CwordBoardClass object
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/25/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardAnimateVerify proc far
class CwordBoardClass
uses ax,cx,bx,dx,di
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
;;;;;;;;
call BoardGetGStateDI
BoardEraseHiLites
GetInstanceDataPtrDSBX CwordBoard_offset
mov dx,ds:[bx].CBI_engine
call EngineFindFirstWrongCell
jc atLeastOneWrongCell
call BoardFlashOK
enumerate:
mov cx,di ;gstate
mov di,offset BoardRedrawWrongCellCallback
call BoardEnumerateCells
mov di,cx ;gstate
BoardDrawHiLites
call GrDestroyState
.leave
ret
atLeastOneWrongCell:
call GrGetWinBounds
call BoardFlashRect
jmp enumerate
BoardAnimateVerify endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardVerifyWord
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See message defintion
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object
es - segment of CwordBoardClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 10/ 5/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardVerifyWord method dynamic CwordBoardClass,
MSG_CWORD_BOARD_VERIFY_WORD
uses ax,cx,dx,bp
.enter
cmp ds:[di].CBI_system, ST_PEN
jne dontReset
call BoardGestureResetMacroProcFar
dontReset:
call BoardPlaySound
call BoardGetGStateDI
BoardEraseHiLites
GetInstanceDataPtrDSBX CwordBoard_offset
mov ax,ds:[bx].CBI_cell
mov cx,ds:[bx].CBI_direction
push ax,cx ;cell, direction
call BoardMapWordToFirstNLastCellsFar
call BoardGetBoundsForFirstNLastCellsFar
call BoardFlashRect
pop ax,bx ;cell, direction
mov cx,di ;gstate
mov di,offset BoardRedrawWrongCellCallback
call BoardEnumerateCellsInWord
mov di,cx ;gstate
BoardDrawHiLites
call GrDestroyState
call CwordEnableDisableClearXSquares
.leave
ret
BoardVerifyWord endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardFlashRect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Tempoarily invert a rectangle
CALLED BY: BoardAnimateVerify
BoardVerifyWord
PASS: di - Gstate Handle
ax,bx,cx,dx - rectangle
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 10/ 5/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardFlashRect proc near
uses ax
.enter
push ax
mov al,MM_INVERT
call GrSetMixMode
pop ax
call GrFillRect
push ax
mov ax,15
call TimerSleep
pop ax
call GrFillRect
mov al,MM_COPY
call GrSetMixMode
.leave
ret
BoardFlashRect endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardRedrawWrongCellCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: If the letter is wrong then draw slashed in it.
CALLED BY: BoardEnumerateCells
PASS:
*ds:si - CwordBoardClass object
dx - engine token
bx - cell token
cx - gstate
RETURN:
ax - passed cell token
DESTROYED:
clc - to keep enumerating
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/25/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardRedrawWrongCellCallback proc near
uses ax,cx,dx,di
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
Assert gstate cx
Assert CellTokenType bx
Assert EngineTokenType dx
;;;;;;;;
mov di,cx ;gstate
mov ax,bx ;cell token
call EngineVerifyCell
jc itsWrong
done:
clc
.leave
ret
itsWrong:
call BoardRedrawCellFar
jmp done
BoardRedrawWrongCellCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardFadeInCoolString
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Slowly fade out board and fade in the string
CALLED BY:
PASS:
*ds:si - Board
es:bx - null terminated cool string
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CoolStringStruc struc
CSS_stringOffset word
CSS_textPos Point
CSS_textSize Point ;width, height
CSS_scaleX WWFixed
CSS_scaleY WWFixed
CoolStringStruc ends
BoardFadeInCoolString proc far
class CwordBoardClass
uses ax,bx,cx,dx,di,si,bp,ds
coolLocals local CoolStringStruc
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
Assert nullTerminatedAscii esbx
;;;;;;;;
mov coolLocals.CSS_stringOffset, bx
call BoardCreateGStateForCoolString
GetInstanceDataPtrDSBX CwordBoard_offset
cmp ds:[bx].CBI_drawOptions, mask DO_COLOR
jz 10$
mov ax, C_BLUE or (CF_INDEX shl 8)
call GrSetTextColor
10$:
call BoardCalcCoolStringBounds
call BoardShiftCoolStringBounds
call BoardCalcCoolScaleFactor
call BoardTranslateScaleCoolString
mov si,offset FadeMask1
again:
push si ;fade offset
mov al, SDM_CUSTOM or mask SDM_INVERSE
segmov ds,cs ;segment of fades
call GrSetAreaMask
call GrSetTextMask
; Fade out board. Making sure that it is slightly larger than
; window
;
mov ax,-1
mov bx,-1
mov cx,coolLocals.CSS_textSize.P_x
inc cx
mov dx,coolLocals.CSS_textSize.P_y
inc dx
call GrFillRect
; Fade in cool
;
clr ax,bx ;position
clr cx ;null termed
segmov ds,es ;string segment
mov si,coolLocals.CSS_stringOffset
call GrDrawText
pop si
add si, (FadeMask16-FadeMask15)
cmp si, offset FadeMask16
jbe again
call GrDestroyState
.leave
ret
BoardFadeInCoolString endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardFlashOK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Flash an OK in the puzzle area
CALLED BY: BoardAnimateVerify
PASS:
*ds:si - Board
di - gstate
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 10/28/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardFlashOK proc near
uses ax,bx,cx,di,si,ds,es
coolLocals local CoolStringStruc
ForceRef coolLocals
.enter
Assert ObjectBoard dssi
segmov es,cs
mov bx,offset okText
mov coolLocals.CSS_stringOffset,bx
call BoardCreateGStateForCoolString
mov al,MM_INVERT
call GrSetMixMode
call BoardCalcCoolStringBounds
call BoardShiftCoolStringBounds
call BoardCalcCoolScaleFactor
call BoardTranslateScaleCoolString
call GrGetWinBounds
call GrFillRect
clr ax,bx ;position
clr cx ;null termed
segmov ds,cs
mov si,offset okText
call GrDrawText
mov ax,15
call TimerSleep
clr ax ;x pos
call GrDrawText
call GrGetWinBounds
call GrFillRect
call GrDestroyState
.leave
ret
BoardFlashOK endp
okText char "OK",0
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardFadeOutScreen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Slowly fade out screen
CALLED BY:
PASS:
*ds:si - Board
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardFadeOutScreen proc far
uses ax,bx,cx,dx,di,si,bp,ds
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
;;;;;;;;
call BoardCreateGStateForCoolString
mov si,offset FadeMask1
again:
mov al, SDM_CUSTOM or mask SDM_INVERSE
segmov ds,cs ;segment of fades
call GrSetAreaMask
call GrGetWinBounds
call GrFillRect
add si, (FadeMask16-FadeMask15)
cmp si, offset FadeMask16
jbe again
call GrDestroyState
.leave
ret
BoardFadeOutScreen endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardTranslateScaleCoolString
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Apply translation and scale in stack frame to gstate
CALLED BY: BoardFadeInCoolString
PASS:
di - gstate
bp - inherited stack frame
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 10/28/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardTranslateScaleCoolString proc near
uses dx,cx,bx,ax
.enter inherit BoardFadeInCoolString
Assert gstate di
mov dx,coolLocals.CSS_textPos.P_x
mov bx,coolLocals.CSS_textPos.P_y
clr ax,cx
call GrApplyTranslation
movwwf dxcx,coolLocals.CSS_scaleX
movwwf bxax,coolLocals.CSS_scaleY
call GrApplyScale
.leave
ret
BoardTranslateScaleCoolString endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardCalcCoolStringBounds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calculate the bounds of the text string
CALLED BY: BoardFadeInCoolString
PASS:
di - gstate
bp - inherited stack frame
coolLocals.CSS_stringOffset
es - string segment
RETURN:
textPos and textSize in stack frame
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/22/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardCalcCoolStringBounds proc near
uses ax,bx,cx,dx,ds,si
.enter inherit BoardFadeInCoolString
;;; Verify argument(s)
Assert gstate di
;;;;;;;;
segmov ds,es
mov si,coolLocals.CSS_stringOffset
Assert nullTerminatedAscii dssi
clr ax,bx ;position
call GrGetTextBounds
mov coolLocals.CSS_textPos.P_x,ax
mov coolLocals.CSS_textPos.P_y,bx
sub cx,ax
mov coolLocals.CSS_textSize.P_x,cx
sub dx,bx
mov coolLocals.CSS_textSize.P_y,dx
.leave
ret
BoardCalcCoolStringBounds endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardShiftCoolStringBounds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Shift textPos so that text will be drawn at upper left
of window
CALLED BY: BoardFadeInCoolString
PASS: di - Gstate
bp - inherited stack frame
textPos
RETURN:
textPos changed
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/22/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardShiftCoolStringBounds proc near
uses ax,bx,cx,dx
.enter inherit BoardFadeInCoolString
;;; Verify argument(s)
Assert gstate di
;;;;;;;;
call GrGetWinBounds
sub ax,coolLocals.CSS_textPos.P_x
mov coolLocals.CSS_textPos.P_x,ax
sub bx,coolLocals.CSS_textPos.P_y
mov coolLocals.CSS_textPos.P_y,bx
.leave
ret
BoardShiftCoolStringBounds endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardCalcCoolScaleFactor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calc scale factor from text size to window size
CALLED BY: BoardFadeInCoolString
PASS: di - Gstate
bp - inherited stack frame
textSize
RETURN:
scaleX, scaleY
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/22/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardCalcCoolScaleFactor proc near
uses ax,bx,cx,dx
.enter inherit BoardFadeInCoolString
;;; Verify argument(s)
Assert gstate di
;;;;;;;;
call GrGetWinBounds
sub cx,ax ;window width
mov dx,cx
mov bx,coolLocals.CSS_textSize.P_x
clr ax,cx
call GrSDivWWFixed
movwwf coolLocals.CSS_scaleX,dxcx
call GrGetWinBounds
sub dx,bx ;window height
mov bx,coolLocals.CSS_textSize.P_y
clr ax,cx
call GrSDivWWFixed
movwwf coolLocals.CSS_scaleY,dxcx
.leave
ret
BoardCalcCoolScaleFactor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardCreateGStateForCoolString
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a gstate for drawing the COOL string into
CALLED BY: BoardFadeInCoolString
PASS:
*ds:si - Board
RETURN:
di - gstate
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/22/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardCreateGStateForCoolString proc near
uses ax,cx,dx,bp
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
;;;;;;;;
mov ax,MSG_VIS_VUP_CREATE_GSTATE
call ObjCallInstanceNoLock
mov di,bp
mov al,mask TM_DRAW_ACCENT
clr ah
call GrSetTextMode
mov ax, C_WHITE or (CF_INDEX shl 8)
call GrSetAreaColor
mov cx,BOARD_TEXT_FONT
clr dx,ax
call GrSetFont
mov al,mask TS_BOLD
clr ah
call GrSetTextStyle
mov al,FW_MAXIMUM
call GrSetFontWeight
.leave
ret
BoardCreateGStateForCoolString endp
FadeMask1 label byte
db 11111101b
db 11111111b
db 11011111b
db 11111111b
db 10111111b
db 11111011b
db 11111111b
db 11111111b
db 11111111b
db 11101111b
db 11111111b
db 11111110b
db 01111111b
db 11111111b
db 11011111b
db 11111111b
db 11101111b
db 11111111b
db 11110111b
db 11111111b
db 11111111b
db 01111111b
db 11111111b
db 11111101b
db 11111111b
db 11111101b
db 11111111b
db 11110111b
db 11111111b
db 11111111b
db 10111111b
db 11101111b
db 11111110b
db 11111111b
db 11111101b
db 11111111b
db 11111111b
db 10111111b
db 11111111b
db 11110111b
db 11011111b
db 11111111b
db 01111111b
db 11111111b
db 11111111b
db 11011111b
db 11111111b
db 11111011b
db 11111111b
db 11111110b
db 11111111b
db 11101111b
db 11011111b
db 11111111b
db 11111101b
db 11111111b
db 11111111b
db 01111111b
db 11111111b
db 10111111b
db 11101111b
db 11111111b
db 11110111b
db 11111111b
db 11111011b
db 10111111b
db 11111111b
db 11111111b
db 11110111b
db 11111111b
db 11101111b
db 11111111b
db 11111111b
db 11110111b
db 11111111b
db 01111111b
db 11111111b
db 11111111b
db 11111011b
db 11011111b
db 10111111b
db 11111011b
db 11111111b
db 11111101b
db 11111101b
db 11111111b
db 11111110b
db 11111111b
db 11111111b
db 11111111b
db 10111111b
db 11111111b
db 11111111b
db 11111101b
db 11111111b
db 10111111b
db 11111111b
db 11011111b
db 11111111b
db 11111011b
db 11111110b
db 11111111b
db 01111111b
db 11111110b
db 01111111b
db 11111111b
db 11111110b
db 11111111b
db 11111111b
db 11101111b
db 11111111b
db 11111111b
FadeMask15 label byte
db 11110111b
db 11111111b
db 11101111b
db 11111111b
db 11111011b
db 11111110b
db 11111111b
db 11111111b
FadeMask16 label byte
db 11111111b
db 11111111b
db 11111011b
db 11011111b
db 11111111b
db 11110111b
db 11111111b
db 01111111b
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardDoShootingStars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY:
PASS:
RETURN:
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardDoShootingStars proc far
uses ax,cx,dx,di,si
.enter
Assert ObjectBoard dssi
call BoardGetGStateDI
mov al,MM_INVERT
call GrSetMixMode
call ParticleArrayCreate
jc destroyState
; Always start with at least one star.
;
call ShootingStarCreate
; Choose random number of stars to eventually create
;
mov dx,MAX_STARS_CREATED
mov cx,MIN_STARS_CREATED
call BoardChooseRandom
mov bx,dx
dec bx
again:
call ParticleDraw
mov ax,3
call TimerSleep
call ParticleAdvance
call ParticleCleanup
tst bx ;stars left to create
jz checkForNoParticles
; Maybe create new star, but always continue because
; there are stars left to create.
;
mov ax,PERCENT_CHANCE_OF_NEW_STAR
call BoardPercentageChance
jnc again ;jmp if don't create star
call ShootingStarCreate
dec bx
jmp again
checkForNoParticles:
call ChunkArrayGetCount
tst cx
jnz again
mov ax,si
call LMemFree
destroyState:
call GrDestroyState
.leave
ret
BoardDoShootingStars endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardPercentageChance
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Generate percentage chance event
CALLED BY:
PASS:
ax - 0-100 percentage chance
RETURN:
carry clear - didn't happen
carry set - happened
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardPercentageChance proc near
uses dx
.enter
mov dx,100
call GameRandom
inc dx ;100-1 range
cmp ax,dx
jge itHappened
clc
done:
.leave
ret
itHappened:
stc
jmp done
BoardPercentageChance endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ParticleArrayCreate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create chunk array for particles
CALLED BY: BoardDoShootingStars
PASS:
ds - segment of object block
RETURN:
clc - array created
si - chunk handle of chunk array
stc - array not created
si - destroyed
DESTROYED:
see RETURN
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ParticleArrayCreate proc near
uses cx,dx
.enter
clr al
clr cx,si
mov bx,size Particle
call ChunkArrayCreate
.leave
ret
ParticleArrayCreate endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ShootingStarCreate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a shooting start chunk array element
CALLED BY:
PASS:
*ds:si - chunk array
di - gstate to window to draw shooting stars
RETURN:
clc - particle created
ax - element
stc - particle not created
ax - destroyed
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ShootingStarCreate proc near
uses bx,cx,dx
initData local ParticleInit
.enter
Assert ChunkArray dssi
Assert gstate di
mov dx,MAX_SPARK_PROB
mov cx,MIN_SPARK_PROB
call BoardChooseRandom
mov initData.PI_sparkProb,dl
; Choose gravity.
;
mov dx,MAX_STAR_VERT_GRAVITY_INT
mov cx,MIN_STAR_VERT_GRAVITY_INT
mov bx,MAX_STAR_VERT_GRAVITY_FRAC
mov ax,MIN_STAR_VERT_GRAVITY_FRAC
call ParticleChooseVelocity
movwwf initData.PI_gravity.PF_y,dxax
clrwwf initData.PI_gravity.PF_x
; Choose vertical velocity. Always negative so stars
; start out shooting upwards.
;
mov dx,MAX_STAR_VERT_VELOCITY_INT
mov cx,MIN_STAR_VERT_VELOCITY_INT
mov bx,MAX_STAR_VERT_VELOCITY_FRAC
mov ax,MIN_STAR_VERT_VELOCITY_FRAC
call ParticleChooseVelocity
negwwf dxax ;always start up
movwwf initData.PI_velocity.PF_y,dxax
; Choose horiz velocity
;
mov dx,MAX_STAR_HORIZ_VELOCITY_INT
mov cx,MIN_STAR_HORIZ_VELOCITY_INT
mov bx,MAX_STAR_HORIZ_VELOCITY_FRAC
mov ax,MIN_STAR_HORIZ_VELOCITY_FRAC
call ParticleChooseVelocity
movwwf initData.PI_velocity.PF_x,dxax
; Choose left or right side of window and switch velocity
; direction if starting from the right side
;
call GrGetWinBounds
mov dx,2
call GameRandom
tst dx
je gotSide ;using left
mov ax,cx
negwwf initData.PI_velocity.PF_x
negwwf initData.PI_gravity.PF_x
gotSide:
mov initData.PI_position.P_x,ax
; Choose vertical position in top 75% of screen
;
call GrGetWinBounds
sub dx,bx ;win height
mov ax,dx ;win height
shr ax ;50% win height
shr ax ;25% win height
sub dx,ax ;range = 75% win height
call GameRandom
add dx,bx ;down from top
mov initData.PI_position.P_y,dx
mov initData.PI_width,STAR_WIDTH
mov initData.PI_height,STAR_HEIGHT
call ParticleCreate
.leave
ret
ShootingStarCreate endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ParticleChooseVelocity
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calc random velocity
CALLED BY: ShootingStartCreate
PASS:
dx - max int
cx - min int
bx - max frac
ax - min frac
RETURN:
dx:ax - WWFixed velocity
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ParticleChooseVelocity proc near
.enter
push dx,cx ;max int,min int
movdw dxcx,bxax ;max frac, min frac
call BoardChooseRandom
mov ax,dx ;frac
pop dx,cx ;max int, min int
call BoardChooseRandom
.leave
ret
ParticleChooseVelocity endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BoardChooseRandom
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Choose random number in range
CALLED BY:
PASS:
dx - max
cx - min
RETURN:
dx
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BoardChooseRandom proc near
.enter
EC< cmp dx,cx >
EC< ERROR_B 255 >
sub dx,cx ;sub min to get range
inc dx
call GameRandom
add dx,cx ;add min
.leave
ret
BoardChooseRandom endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ParticleCreate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a new particle in the chunk array
CALLED BY: ShootingStarCreate
PASS:
*ds:si - chunk array
bp - inherited stack frame
RETURN:
clc - particle created
ax - element
stc - particle not created
ax - destroyed
DESTROYED:
see RETURN
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ParticleCreate proc near
uses cx,dx,di
initData local ParticleInit
.enter inherit
call ChunkArrayAppend
jc done
clr dx
mov cx, initData.PI_position.P_x
movdw ds:[di].P_curPosition.PF_x,cxdx
mov cx, initData.PI_position.P_y
movdw ds:[di].P_curPosition.PF_y,cxdx
movdw cxdx, initData.PI_velocity.PF_x
movdw ds:[di].P_velocity.PF_x,cxdx
movdw cxdx, initData.PI_velocity.PF_y
movdw ds:[di].P_velocity.PF_y,cxdx
movdw cxdx, initData.PI_gravity.PF_x
movdw ds:[di].P_gravity.PF_x,cxdx
movdw cxdx, initData.PI_gravity.PF_y
movdw ds:[di].P_gravity.PF_y,cxdx
mov cl, initData.PI_sparkProb
mov ds:[di].P_sparkProb,cl
mov cl, initData.PI_width
mov ds:[di].P_width,cl
mov cl, initData.PI_height
mov ds:[di].P_height,cl
clr ds:[di].P_info
clc
done:
.leave
ret
ParticleCreate endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ParticleDraw
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Draw all particles in the passed particle array
CALLED BY:
PASS:
*ds:si - particle chunk array
di - gstate
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ParticleDraw proc near
uses bx,di,bp
.enter
Assert gstate di
Assert ChunkArray dssi
mov bp,di ;gstate
mov bx,cs
mov di,offset ParticleDrawCallback
call ChunkArrayEnum
.leave
ret
ParticleDraw endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ParticleDrawCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Draw the particle if not already drawn
CALLED BY: ChunkArrayEnum
PASS: ds:di - particle
bp - gstate
RETURN:
carry clear
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ParticleDrawCallback proc far
uses di,ax,bx,cx,dx,bp
.enter
Assert gstate bp
; Draw at new position
;
BitSet ds:[di].P_info, PI_DRAWN
movwwf axcx,ds:[di].P_curPosition.PF_x
rndwwf axcx
movwwf bxcx,ds:[di].P_curPosition.PF_y
rndwwf bxcx
cmp ax,ds:[bp].P_lastDrawnPosition.P_x
je checkNoChange
drawNew:
mov cl,ds:[di].P_width
mov ch,ds:[di].P_height
xchg di,bp ;gstate,offset
call DrawAParticle
; Save just drawn position and Erase at old position if initialized
;
xchg ax,ds:[bp].P_lastDrawnPosition.P_x
xchg bx,ds:[bp].P_lastDrawnPosition.P_y
test ds:[bp].P_info, mask PI_LAST_DRAWN_INITIALIZED
jz initLastDrawn
call DrawAParticle
initLastDrawn:
BitSet ds:[bp].P_info, PI_LAST_DRAWN_INITIALIZED
done:
clc
.leave
ret
checkNoChange:
cmp bx,ds:[bp].P_lastDrawnPosition.P_y
jne drawNew
jmp done
ParticleDrawCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DrawAParticle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY:
PASS:
di - gstate
ax - x
bx - y
cl - width
ch - height
RETURN:
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DrawAParticle proc near
uses cx,dx
.enter
mov dl,ch ;height
clr ch,dh ;high byte of width and height
add cx,ax
add dx,bx
call GrFillRect
.leave
ret
DrawAParticle endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ParticleEraseCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Erase the particle if it is drawn
CALLED BY: ChunkArrayEnum
PASS: ds:di - particle
bp - gstate
RETURN:
carry clear
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ParticleEraseCallback proc far
uses di,ax,bx,cx
.enter
Assert gstate bp
test ds:[di].P_info,mask PI_DRAWN
jz done
test ds:[di].P_info,mask PI_LAST_DRAWN_INITIALIZED
jz done
BitClr ds:[di].P_info,PI_DRAWN
mov ax,ds:[di].P_lastDrawnPosition.P_x
mov bx,ds:[di].P_lastDrawnPosition.P_y
mov cl,ds:[di].P_width
mov ch,ds:[di].P_height
mov di,bp
call DrawAParticle
done:
clc
.leave
ret
ParticleEraseCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ParticleAdvance
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Advance all particles in the passed particle array
CALLED BY:
PASS:
*ds:si - particle chunk array
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ParticleAdvance proc near
uses bx,di,bp
.enter
Assert ChunkArray dssi
mov bx,cs
mov di,offset ParticleAdvanceCallback
call ChunkArrayEnum
.leave
ret
ParticleAdvance endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ParticleAdvanceCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Advance the particle
CALLED BY: ChunkArrayEnum
PASS: ds:di - particle
RETURN:
carry clear
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ParticleAdvanceCallback proc far
uses di,bx,ax
.enter
; Treat x gravity as drag in opposite direction of
; velocity
;
movwwf bxax,ds:[di].P_velocity.PF_x
addwwf ds:[di].P_curPosition.PF_x,bxax
tst bx
movwwf bxax,ds:[di].P_gravity.PF_x
js 10$
negwwf bxax
10$:
addwwf ds:[di].P_velocity.PF_x,bxax
; Treat y gravity as gravity, increasing downward velocity
;
movwwf bxax,ds:[di].P_velocity.PF_y
addwwf ds:[di].P_curPosition.PF_y,bxax
movwwf bxax,ds:[di].P_gravity.PF_y
addwwf ds:[di].P_velocity.PF_y,bxax
clr ah
mov al,ds:[di].P_sparkProb
call BoardPercentageChance
jc makeSpark
done:
clc
.leave
ret
makeSpark:
call SparkCreate
jmp done
ParticleAdvanceCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SparkCreate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a spark chunk array element. Append it so that
it will have moved away from the original before the
next drawing operation
CALLED BY:
PASS:
*ds:si - chunk array
ds:di - source particle
RETURN:
clc - particle created
ax - element
stc - particle not created
ax - destroyed
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SparkCreate proc near
uses ax,bx,cx,dx
initData local ParticleInit
.enter
Assert ChunkArray dssi
; Spark gets same position
;
movwwf cxdx,ds:[di].P_curPosition.PF_x
rndwwf cxdx
mov initData.PI_position.P_x,cx
movwwf cxdx,ds:[di].P_curPosition.PF_y
rndwwf cxdx
mov initData.PI_position.P_y,cx
; no babies
;
clr initData.PI_sparkProb
; Give spark random y gravity bigger than source and
; a small x gravity opposite in direction to velocity
;
mov dx,MAX_STAR_TO_SPARK_GRAVITY_INCREASE_INT
mov bx,MAX_STAR_TO_SPARK_GRAVITY_INCREASE_FRAC
mov cx,MIN_STAR_TO_SPARK_GRAVITY_INCREASE_INT
mov ax,MIN_STAR_TO_SPARK_GRAVITY_INCREASE_FRAC
call ParticleChooseVelocity
addwwf dxax,ds:[di].P_gravity.PF_y
movwwf initData.PI_gravity.PF_y,dxax
mov dx,MAX_SPARK_HORIZ_DRAG_INT
mov cx,MIN_SPARK_HORIZ_DRAG_INT
mov bx,MAX_SPARK_HORIZ_DRAG_FRAC
mov ax,MIN_SPARK_HORIZ_DRAG_FRAC
call ParticleChooseVelocity
movwwf initData.PI_gravity.PF_x,dxax
; Modify the velocity half of the max increase either up
; or down.
;
mov bx,MAX_STAR_TO_SPARK_VERT_VELOCITY_INCREASE_FRAC
mov dx,MAX_STAR_TO_SPARK_VERT_VELOCITY_INCREASE_INT
clr ax,cx
call ParticleChooseVelocity
sub dx,MAX_STAR_TO_SPARK_VERT_VELOCITY_INCREASE_HALF; sub half from
addwwf dxax,ds:[di].P_velocity.PF_y
movwwf initData.PI_velocity.PF_y,dxax
; Give small horiz velocity in same direction
;
mov dx,MAX_SPARK_HORIZ_VELOCITY_INT
mov cx,MIN_SPARK_HORIZ_VELOCITY_INT
mov bx,MAX_SPARK_HORIZ_VELOCITY_FRAC
mov ax,MIN_SPARK_HORIZ_VELOCITY_FRAC
call ParticleChooseVelocity
tst ds:[di].P_velocity.PF_x.WWF_int
jns 20$
negwwf dxax
20$:
movwwf initData.PI_velocity.PF_x,dxax
mov dx,SPARK_MAX_WIDTH
mov cx,SPARK_MIN_WIDTH
call BoardChooseRandom
mov initData.PI_width,dl
mov dx,SPARK_MAX_HEIGHT
mov cx,SPARK_MIN_HEIGHT
call BoardChooseRandom
mov initData.PI_height,dl
call ParticleCreate
.leave
ret
SparkCreate endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ParticleCleanup
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Delete all particles no longer on the screen
CALLED BY:
PASS:
*ds:si - particle chunk array
di - gstate
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ParticleCleanup proc near
uses bx,di,bp
.enter
Assert ChunkArray dssi
Assert gstate di
call GrGetWinBounds
mov bp,di ;gstate
mov bx,cs
mov di,offset ParticleCleanupCallback
call ChunkArrayEnum
.leave
ret
ParticleCleanup endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ParticleCleanupCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Erase and delete this particle if it has gone off the
left, right or bottom of screen
CALLED BY: ChunkArrayEnum
PASS: ds:di - particle
ax - left
cx - right
dx - bottom
bp - gstate
RETURN:
carry clear
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ParticleCleanupCallback proc far
uses di
.enter
Assert gstate bp
cmp ax,ds:[di].P_curPosition.PF_x.WWF_int
jg cleanup
cmp cx,ds:[di].P_curPosition.PF_x.WWF_int
jl cleanup
cmp dx,ds:[di].P_curPosition.PF_y.WWF_int
jl cleanup
done:
clc
.leave
ret
cleanup:
call ParticleEraseCallback
call ChunkArrayDelete
jmp done
ParticleCleanupCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CwordEnableDisableClearXSquares
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: If there are any wrong squares in the puzzle then
enable Clear X Squares
CALLED BY: UTILITY
PASS: *ds:si - Board
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 11/ 8/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CwordEnableDisableClearXSquares proc far
class CwordBoardClass
uses ax,bx,cx,dx,si,di,bp
.enter
;;; Verify argument(s)
Assert ObjectBoard dssi
;;;;;;;;
GetInstanceDataPtrDSBX CwordBoard_offset
mov dx,ds:[bx].CBI_engine
tst dx
jz notEnabled
call EngineFindFirstWrongCell
jnc notEnabled
mov ax,MSG_GEN_SET_ENABLED
sendMessage:
mov bx,handle ClearXButton
mov si,offset ClearXButton
mov di,mask MF_FIXUP_DS
mov dl, VUM_NOW
call ObjMessage
.leave
ret
notEnabled:
mov ax,MSG_GEN_SET_NOT_ENABLED
jmp sendMessage
CwordEnableDisableClearXSquares endp
CwordVictoryCode ends
|
untested/x64/mulDiv.asm | GabrielRavier/Generic-Assembly-Samples | 0 | 95148 | <filename>untested/x64/mulDiv.asm
global _MulDiv
segment .text align=16
_MulDiv:
movsx rax, edi
movsx rsi, esi
movsx rcx, edx
imul rax, rsi
xor edx, edx
div rcx
ret |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.