max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
source/asis/asis-gela-utils.adb | faelys/gela-asis | 4 | 4515 | ------------------------------------------------------------------------------
-- <NAME> A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $:
with XASIS.Utils;
with Asis.Elements;
with Asis.Statements;
with Asis.Definitions;
with Asis.Declarations;
with Asis.Gela.Classes;
with Asis.Gela.Element_Utils;
package body Asis.Gela.Utils is
function Direct_Name (Name : Asis.Defining_Name) return Asis.Program_Text
renames XASIS.Utils.Direct_Name;
function Has_Name
(Element : Asis.Defining_Name;
Direct_Name : Asis.Program_Text) return Boolean
renames XASIS.Utils.Has_Name;
function Overloadable
(Element : Asis.Defining_Name) return Boolean
renames XASIS.Utils.Overloadable;
function Parent_Declaration
(Element : Asis.Element) return Asis.Declaration
renames XASIS.Utils.Parent_Declaration;
use Asis;
use Asis.Gela.Classes;
function Get_Parameter_Profile
(Def : Asis.Element)
return Asis.Parameter_Specification_List;
function Get_Result_Profile
(Def : Asis.Element;
Place : Asis.Element) return Type_Info;
function In_List
(List : Asis.Element_List;
Declaration : Asis.Declaration) return Boolean;
--------------------
-- Are_Homographs --
--------------------
function Are_Homographs
(Left : Asis.Defining_Name;
Right : Asis.Defining_Name;
Place : Asis.Element)
return Boolean
is
begin
pragma Assert (Elements.Element_Kind (Left) = A_Defining_Name and
Elements.Element_Kind (Right) = A_Defining_Name,
"Unexpected element in Direct_Name");
if Has_Name (Left, Direct_Name (Right)) then
if Overloadable (Left) and then Overloadable (Right) then
return Are_Type_Conformant (Left, Right, Place);
else
return True;
end if;
else
return False;
end if;
end Are_Homographs;
-------------------------
-- Are_Type_Conformant --
-------------------------
function Are_Type_Conformant
(Left : Asis.Element;
Right : Asis.Element;
Place : Asis.Element;
Right_Is_Prefixed_View : Boolean := False)
return Boolean
is
use Asis.Elements;
function Equal_Designated_Types (Left, Right : Type_Info) return Boolean
is
D_Left, D_Right : Type_Info;
begin
if not Is_Anonymous_Access (Left) or else
not Is_Anonymous_Access (Right) or else
(Is_Subprogram_Access (Left) xor Is_Subprogram_Access (Right))
then
return False;
end if;
if Is_Subprogram_Access (Left) then
return Destinated_Are_Type_Conformant (Left, Right);
else
D_Left := Destination_Type (Left);
D_Right := Destination_Type (Right);
return D_Left = D_Right;
end if;
end Equal_Designated_Types;
Left_Result : Type_Info := Get_Result_Profile (Left, Place);
Right_Result : Type_Info := Get_Result_Profile (Right, Place);
begin
if Is_Not_Type (Left_Result) and not Is_Not_Type (Right_Result) then
return False;
elsif not Is_Not_Type (Left_Result) and Is_Not_Type (Right_Result) then
return False;
elsif not Is_Not_Type (Left_Result)
and then not Is_Not_Type (Right_Result)
and then not Is_Equal (Left_Result, Right_Result)
and then not Equal_Designated_Types (Left_Result, Right_Result)
then
return False;
end if;
declare
use Asis.Declarations;
Left_Profile : Asis.Parameter_Specification_List :=
Get_Parameter_Profile (Left);
Right_Profile : Asis.Parameter_Specification_List :=
Get_Parameter_Profile (Right);
Left_Param : Asis.ASIS_Natural := 0;
Left_Names : Asis.ASIS_Natural := 0;
Right_Param : Asis.ASIS_Natural := 0;
Right_Names : Asis.ASIS_Integer := 0;
Exit_Loop : Boolean := False;
Left_Type : Type_Info;
Right_Type : Type_Info;
Left_Trait : Asis.Trait_Kinds;
Right_Trait : Asis.Trait_Kinds;
begin
if Right_Is_Prefixed_View then
Right_Names := -1;
end if;
loop
if Left_Names = 0 then
Left_Param := Left_Param + 1;
if Left_Param in Left_Profile'Range then
Left_Names := Names (Left_Profile (Left_Param))'Length;
Left_Trait := Trait_Kind (Left_Profile (Left_Param));
Left_Type :=
Type_Of_Declaration (Left_Profile (Left_Param), Place);
else
Exit_Loop := True;
end if;
end if;
while Right_Names <= 0 loop
Right_Param := Right_Param + 1;
if Right_Param in Right_Profile'Range then
Right_Names := Right_Names +
Names (Right_Profile (Right_Param))'Length;
Right_Trait := Trait_Kind (Right_Profile (Right_Param));
Right_Type :=
Type_Of_Declaration (Right_Profile (Right_Param), Place);
else
Exit_Loop := True;
exit;
end if;
end loop;
exit when Exit_Loop;
if Left_Trait /= Right_Trait then
return False;
end if;
if not Is_Equal (Left_Type, Right_Type) and then
not Equal_Designated_Types (Left_Type, Right_Type)
then
return False;
end if;
Left_Names := Left_Names - 1;
Right_Names := Right_Names - 1;
end loop;
if Left_Names = 0 and Right_Names = 0 then
return True;
else
return False;
end if;
end;
end Are_Type_Conformant;
---------------------------
-- Get_Parameter_Profile --
---------------------------
function Get_Parameter_Profile
(Def : Asis.Element)
return Asis.Parameter_Specification_List
is
use Asis.Elements;
use Asis.Definitions;
use Asis.Declarations;
Decl : Asis.Declaration := Enclosing_Element (Def);
Kind : Asis.Declaration_Kinds := Declaration_Kind (Decl);
Tipe : Asis.Definition;
begin
if Definition_Kind (Def) = An_Access_Definition then
return Access_To_Subprogram_Parameter_Profile (Def);
end if;
case Kind is
when A_Function_Declaration |
A_Procedure_Declaration |
A_Function_Body_Declaration |
A_Procedure_Body_Declaration |
A_Function_Body_Stub |
A_Procedure_Body_Stub |
A_Function_Renaming_Declaration |
A_Procedure_Renaming_Declaration |
An_Entry_Declaration |
A_Formal_Function_Declaration |
A_Formal_Procedure_Declaration =>
return Parameter_Profile (Decl);
when A_Generic_Function_Renaming_Declaration |
A_Generic_Procedure_Renaming_Declaration |
A_Function_Instantiation |
A_Procedure_Instantiation =>
declare
Unwind : constant Asis.Declaration :=
Corresponding_Declaration (Decl);
Name : constant Asis.Defining_Name_List := Names (Unwind);
begin
return Get_Parameter_Profile (Name (1));
end;
when An_Ordinary_Type_Declaration =>
Tipe := Type_Declaration_View (Decl);
case Access_Type_Kind (Tipe) is
when Access_To_Subprogram_Definition =>
return Access_To_Subprogram_Parameter_Profile (Tipe);
when others =>
return Nil_Element_List;
end case;
when A_Variable_Declaration |
A_Constant_Declaration |
A_Component_Declaration |
A_Discriminant_Specification |
A_Parameter_Specification |
A_Formal_Object_Declaration =>
declare
Def : constant Asis.Definition :=
Object_Declaration_Subtype (Decl);
begin
case Access_Definition_Kind (Def) is
when An_Anonymous_Access_To_Procedure |
An_Anonymous_Access_To_Protected_Procedure |
An_Anonymous_Access_To_Function |
An_Anonymous_Access_To_Protected_Function
=>
return Access_To_Subprogram_Parameter_Profile (Def);
when others =>
return Nil_Element_List;
end case;
end;
when Not_A_Declaration =>
if Statement_Kind (Decl) = An_Accept_Statement then
return Statements.Accept_Parameters (Decl);
else
return Nil_Element_List;
end if;
when others =>
return Nil_Element_List;
end case;
end Get_Parameter_Profile;
------------------------
-- Get_Result_Profile --
------------------------
function Get_Result_Profile
(Def : Asis.Element;
Place : Asis.Element)
return Type_Info
is
use Asis.Elements;
use Asis.Definitions;
use Asis.Declarations;
Decl : Asis.Declaration := Enclosing_Element (Def);
Kind : Asis.Declaration_Kinds := Declaration_Kind (Decl);
Tipe : Asis.Definition;
begin
if Definition_Kind (Def) = An_Access_Definition then
if Access_Definition_Kind (Def) in An_Anonymous_Access_To_Function ..
An_Anonymous_Access_To_Protected_Function
then
return Type_From_Indication
(Access_To_Function_Result_Subtype (Def), Place);
else
return Not_A_Type;
end if;
end if;
case Kind is
when A_Function_Declaration |
A_Function_Body_Declaration |
A_Function_Body_Stub |
A_Function_Renaming_Declaration |
A_Generic_Function_Declaration |
A_Formal_Function_Declaration =>
return Type_From_Indication (Result_Subtype (Decl), Place);
when An_Enumeration_Literal_Specification =>
return Type_Of_Declaration (Decl, Place);
when A_Generic_Function_Renaming_Declaration |
A_Function_Instantiation =>
declare
Unwind : constant Asis.Declaration :=
Corresponding_Declaration (Decl);
Name : constant Asis.Defining_Name_List := Names (Unwind);
begin
return Get_Result_Profile (Name (1), Place);
end;
when An_Ordinary_Type_Declaration =>
Tipe := Type_Declaration_View (Decl);
case Access_Type_Kind (Tipe) is
when An_Access_To_Function | An_Access_To_Protected_Function =>
return Type_From_Indication
(Access_To_Function_Result_Subtype (Tipe), Place);
when others =>
return Not_A_Type;
end case;
when A_Variable_Declaration |
A_Constant_Declaration |
A_Component_Declaration |
A_Discriminant_Specification |
A_Parameter_Specification |
A_Formal_Object_Declaration =>
declare
Def : constant Asis.Definition :=
Object_Declaration_Subtype (Decl);
begin
case Access_Definition_Kind (Def) is
when An_Anonymous_Access_To_Function |
An_Anonymous_Access_To_Protected_Function =>
return Type_From_Indication
(Access_To_Function_Result_Subtype (Def), Place);
when others =>
return Not_A_Type;
end case;
end;
when others =>
return Not_A_Type;
end case;
end Get_Result_Profile;
-------------
-- In_List --
-------------
function In_List
(List : Asis.Element_List;
Declaration : Asis.Declaration) return Boolean is
begin
for I in List'Range loop
if Asis.Elements.Is_Equal (List (I), Declaration) then
return True;
end if;
end loop;
return False;
end In_List;
-----------------------
-- In_Context_Clause --
-----------------------
function In_Context_Clause (Clause : Asis.Clause) return Boolean is
use Asis.Elements;
Unit : Asis.Compilation_Unit := Enclosing_Compilation_Unit (Clause);
List : Asis.Element_List := Context_Clause_Elements (Unit);
begin
return In_List (List, Clause);
end In_Context_Clause;
---------------------
-- In_Visible_Part --
---------------------
function In_Visible_Part
(Declaration : Asis.Declaration) return Boolean
is
use Asis;
use Asis.Elements;
use Asis.Declarations;
use Asis.Definitions;
Parent : Asis.Declaration := Parent_Declaration (Declaration);
Parent_Kind : Asis.Declaration_Kinds := Declaration_Kind (Parent);
Decl_Kind : Asis.Declaration_Kinds := Declaration_Kind (Declaration);
Expr : Asis.Expression;
begin
case Parent_Kind is
when Asis.A_Procedure_Declaration |
Asis.A_Function_Declaration |
Asis.A_Procedure_Body_Declaration |
Asis.A_Function_Body_Declaration |
Asis.A_Procedure_Renaming_Declaration |
Asis.A_Function_Renaming_Declaration |
Asis.An_Entry_Declaration =>
return Decl_Kind = Asis.A_Parameter_Specification;
when Asis.An_Ordinary_Type_Declaration =>
return Decl_Kind = Asis.A_Discriminant_Specification or
Decl_Kind = Asis.A_Component_Declaration or
Decl_Kind = Asis.An_Enumeration_Literal_Specification;
when Asis.A_Generic_Function_Declaration |
Asis.A_Generic_Procedure_Declaration =>
return In_List (Generic_Formal_Part (Parent), Declaration) or
Decl_Kind = Asis.A_Parameter_Specification;
when Asis.A_Generic_Package_Declaration =>
return In_List (Generic_Formal_Part (Parent), Declaration) or
In_List (Visible_Part_Declarative_Items (Parent), Declaration);
when Asis.A_Package_Declaration =>
if Is_Part_Of_Instance (Parent) then
if Decl_Kind in A_Formal_Declaration then
Expr := Element_Utils.Generic_Actual (Declaration);
if Expression_Kind (Expr) = A_Box_Expression then
return True;
end if;
end if;
end if;
return In_List
(Visible_Part_Declarative_Items (Parent), Declaration);
when Asis.A_Single_Task_Declaration |
Asis.A_Single_Protected_Declaration =>
declare
Def : Asis.Definition := Object_Declaration_View (Parent);
begin
return In_List (Visible_Part_Items (Def), Declaration);
end;
when Asis.A_Task_Type_Declaration |
Asis.A_Protected_Type_Declaration =>
declare
Def : Asis.Definition := Type_Declaration_View (Parent);
D : Asis.Definition := Discriminant_Part (Parent);
begin
return In_List (Visible_Part_Items (Def), Declaration) or else
(Definition_Kind (D) = A_Known_Discriminant_Part and then
In_List (Discriminants (D), Declaration));
end;
when others =>
return False;
end case;
end In_Visible_Part;
---------------------
-- Is_Limited_Type --
---------------------
function Is_Limited_Type (Tipe : Asis.Definition) return Boolean is
use Asis.Elements;
begin
case Definition_Kind (Tipe) is
when A_Private_Type_Definition |
A_Tagged_Private_Type_Definition
=>
return Has_Limited (Tipe);
when others =>
null;
end case;
case Type_Kind (Tipe) is
when A_Derived_Type_Definition |
A_Derived_Record_Extension_Definition |
A_Record_Type_Definition |
A_Tagged_Record_Type_Definition
=>
case Trait_Kind (Tipe) is
when A_Limited_Trait |
A_Limited_Private_Trait |
An_Abstract_Limited_Trait |
An_Abstract_Limited_Private_Trait =>
return True;
when others =>
return False;
end case;
when An_Interface_Type_Definition =>
return Interface_Kind (Tipe) /= An_Ordinary_Interface;
when others =>
null;
end case;
case Formal_Type_Kind (Tipe) is
when A_Formal_Private_Type_Definition |
A_Formal_Tagged_Private_Type_Definition =>
case Trait_Kind (Tipe) is
when A_Limited_Trait |
A_Limited_Private_Trait |
An_Abstract_Limited_Trait |
An_Abstract_Limited_Private_Trait =>
return True;
when others =>
return False;
end case;
when A_Formal_Interface_Type_Definition =>
return Interface_Kind (Tipe) /= An_Ordinary_Interface;
when others =>
null;
end case;
return False;
end Is_Limited_Type;
---------------------
-- Walk_Components --
---------------------
procedure Walk_Components
(Item : Asis.Element;
Continue : out Boolean)
is
use Asis.Elements;
use Asis.Declarations;
use Asis.Definitions;
Walk_Error : exception;
begin
case Element_Kind (Item) is
-- when An_Expression =>
-- Walk_Components (To_Type (Item).Declaration, Continue);
when A_Declaration =>
case Declaration_Kind (Item) is
when An_Incomplete_Type_Declaration =>
declare
Discr : Asis.Element := Discriminant_Part (Item);
begin
if not Is_Nil (Discr) then
Walk_Components (Discr, Continue);
if not Continue then
return;
end if;
end if;
end;
when An_Ordinary_Type_Declaration
| A_Task_Type_Declaration
| A_Protected_Type_Declaration
| A_Private_Type_Declaration
| A_Private_Extension_Declaration
| A_Formal_Type_Declaration =>
declare
Discr : Asis.Element := Discriminant_Part (Item);
View : Asis.Element := Type_Declaration_View (Item);
begin
if not Is_Nil (Discr) then
Walk_Components (Discr, Continue);
if not Continue then
return;
end if;
end if;
Walk_Components (View, Continue);
end;
when A_Discriminant_Specification | A_Component_Declaration =>
Walk_Component (Item, Continue);
when others =>
raise Walk_Error;
end case;
when A_Definition =>
case Definition_Kind (Item) is
when A_Subtype_Indication =>
declare
-- Get type view and walk it's declaration
Def : constant Asis.Definition :=
Get_Type_Def (Type_From_Indication (Item, Place));
begin
Walk_Components
(Enclosing_Element (Def),
Continue);
end;
when A_Type_Definition =>
case Type_Kind (Item) is
when A_Derived_Record_Extension_Definition =>
Walk_Components
(Asis.Definitions.Parent_Subtype_Indication (Item),
Continue);
if not Continue then
return;
end if;
Walk_Components
(Asis.Definitions.Record_Definition (Item),
Continue);
when A_Derived_Type_Definition =>
Walk_Components
(Asis.Definitions.Parent_Subtype_Indication (Item),
Continue);
when A_Record_Type_Definition |
A_Tagged_Record_Type_Definition =>
Walk_Components
(Asis.Definitions.Record_Definition (Item),
Continue);
when An_Interface_Type_Definition =>
Continue := True;
when others =>
raise Walk_Error;
end case;
when A_Record_Definition | A_Variant =>
if Definition_Kind (Item) = A_Variant then
Walk_Variant (Item, Continue);
if not Continue then
Continue := True;
return;
end if;
end if;
declare
List : Asis.Record_Component_List :=
Record_Components (Item);
begin
for I in List'Range loop
case Element_Kind (List (I)) is
when A_Declaration | A_Definition =>
Walk_Components (List (I), Continue);
when others =>
raise Walk_Error;
end case;
if not Continue then
return;
end if;
end loop;
end;
when A_Variant_Part =>
declare
List : Asis.Variant_List := Variants (Item);
begin
for I in List'Range loop
Walk_Components (List (I), Continue);
if not Continue then
return;
end if;
end loop;
end;
when A_Known_Discriminant_Part =>
declare
List : Asis.Discriminant_Specification_List :=
Discriminants (Item);
begin
for I in List'Range loop
Walk_Components (List (I), Continue);
if not Continue then
return;
end if;
end loop;
end;
when A_Null_Record_Definition
| A_Null_Component
| A_Private_Type_Definition
| A_Tagged_Private_Type_Definition
| A_Private_Extension_Definition
| A_Task_Definition
| A_Protected_Definition
| A_Formal_Type_Definition
| An_Unknown_Discriminant_Part
=>
Continue := True;
when others =>
raise Walk_Error;
end case;
when others =>
raise Walk_Error;
end case;
end Walk_Components;
end Asis.Gela.Utils;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of the <NAME>, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
|
teste.por.asm | jeanpimentel/fsm66 | 0 | 93930 | <reponame>jeanpimentel/fsm66
.text
.globl main
main:
subu $sp, $sp, 32
sw $ra, 20($sp)
sw $fp, 16($sp)
addiu $fp, $sp, 28
la $t0, global_i # NAME
li $t1, 0
add $t0, $t0, $t1
# iniciando caller
subu $sp, $sp, 24
li $t1, 3
sw $t1, 4($sp)
addiu $sp, $sp, 24
jal subprog_fatorial
move $t1, $v0
sw $t1, 0($t0) # MOVE MEM-Exp
li $v0, 4 # IMPRIMA
la $a0, LITERAL_7
syscall
la $t0, global_i # NAME
li $t1, 0
add $t0, $t0, $t1
lw $t0, 0($t0) # MEM
li $v0, 1 # IMPRIMA
move $a0, $t0
syscall
li $v0, 4 # IMPRIMA
la $a0, LITERAL_6
syscall
li $v0, 4 # IMPRIMA
la $a0, LITERAL_5
syscall
# iniciando caller
subu $sp, $sp, 24
li $t0, 5
sw $t0, 4($sp)
addiu $sp, $sp, 24
jal subprog_fatorial
move $t0, $v0
li $v0, 1 # IMPRIMA
move $a0, $t0
syscall
li $v0, 4 # IMPRIMA
la $a0, LITERAL_4
syscall
li $v0, 4 # IMPRIMA
la $a0, LITERAL_3
syscall
# iniciando caller
subu $sp, $sp, 24
# iniciando caller
subu $sp, $sp, 24
li $t0, 3
sw $t0, 4($sp)
addiu $sp, $sp, 24
jal subprog_fatorial
move $t0, $v0
sw $t0, 4($sp)
addiu $sp, $sp, 24
jal subprog_fatorial
move $t0, $v0
li $v0, 1 # IMPRIMA
move $a0, $t0
syscall
li $v0, 4 # IMPRIMA
la $a0, LITERAL_2
syscall
li $v0, 4 # IMPRIMA
la $a0, LITERAL_1
syscall
lw $ra, 20($sp)
lw $fp, 16($sp)
addiu $sp, $sp, 32
jr $ra
.text
.globl subprog_fatorial
subprog_fatorial:
# Callee - Prologo
subu $sp, $sp, 124
sw $ra, 0($sp)
sw $fp, 4($sp)
addiu $fp, $sp, 100
sw $t0, 8($sp)
sw $t1, 12($sp)
sw $t2, 16($sp)
sw $t3, 20($sp)
sw $t4, 24($sp)
sw $t5, 28($sp)
sw $t6, 32($sp)
sw $t7, 36($sp)
sw $t8, 40($sp)
sw $t9, 44($sp)
sw $s0, 48($sp)
sw $s1, 52($sp)
sw $s2, 56($sp)
sw $s3, 60($sp)
sw $s4, 64($sp)
sw $s5, 68($sp)
sw $s6, 72($sp)
sw $s7, 76($sp)
li $t1, 1
move $s6, $t1
li $t3, 4
add $t2, $fp, $t3
lw $t2, 0($t2) # MEM
li $t3, 1
ble $t2, $t3, VERDADEIRO_12
jr FALSO_13
FALSO_13:
li $t3, 0
move $s6, $t3
VERDADEIRO_12:
li $t4, 0
bne $s6, $t4, ENTAO_10
jr SENAO_9
ENTAO_10:
li $t4, 1
move $v0, $t4
jr FIMSE_11
SENAO_9:
li $t7, 4
add $t6, $fp, $t7
lw $t6, 0($t6) # MEM
# iniciando caller
subu $sp, $sp, 24
li $t9, 4
add $t8, $fp, $t9
lw $t8, 0($t8) # MEM
li $t9, 1
sub $t8, $t8, $t9
sw $t8, 4($sp)
addiu $sp, $sp, 24
jal subprog_fatorial
move $t8, $v0
mul $t6, $t6, $t8
move $v0, $t6
FIMSE_11:
lw $ra, 0($sp)
lw $fp, 4($sp)
lw $t0, 8($sp)
lw $t1, 12($sp)
lw $t2, 16($sp)
lw $t3, 20($sp)
lw $t4, 24($sp)
lw $t5, 28($sp)
lw $t6, 32($sp)
lw $t7, 36($sp)
lw $t8, 40($sp)
lw $t9, 44($sp)
lw $s0, 48($sp)
lw $s1, 52($sp)
lw $s2, 56($sp)
lw $s3, 60($sp)
lw $s4, 64($sp)
lw $s5, 68($sp)
lw $s6, 72($sp)
lw $s7, 76($sp)
addiu $sp, $sp, 124
jr $ra
.data
.globl global_i
global_i:
.word 0
.rdata
LITERAL_7:
.asciiz "Fatorial: 3! = "
.rdata
LITERAL_6:
.asciiz "\n"
.rdata
LITERAL_5:
.asciiz "Fatorial: 5! = "
.rdata
LITERAL_4:
.asciiz "\n"
.rdata
LITERAL_3:
.asciiz "Fatorial: (3!)! = "
.rdata
LITERAL_2:
.asciiz "\n"
.rdata
LITERAL_1:
.asciiz "\nFim do programa!"
|
src/asm/kentry.asm | krzem5/Assembly-64bit_OS_Kernel | 0 | 582 | %define STACKSIZE 0x4000
section .entry
bits 64
global _start_e
extern imain
_start_e equ (_start)
_start:
mov rbp, (stack+STACKSIZE)
mov rsp, rbp
call imain
cli
._s_loop:
hlt
jmp ._s_loop
section .bss
align 32
stack:
resb STACKSIZE
|
programs/oeis/021/A021053.asm | neoneye/loda | 22 | 166152 | ; A021053: Decimal expansion of 1/49.
; 0,2,0,4,0,8,1,6,3,2,6,5,3,0,6,1,2,2,4,4,8,9,7,9,5,9,1,8,3,6,7,3,4,6,9,3,8,7,7,5,5,1,0,2,0,4,0,8,1,6,3,2,6,5,3,0,6,1,2,2,4,4,8,9,7,9,5,9,1,8,3,6,7,3,4,6,9,3,8,7,7,5,5,1,0,2,0,4,0,8,1,6,3,2,6,5,3,0,6
add $0,5
mov $1,10
pow $1,$0
sub $1,6
mul $1,9
div $1,21
add $1,4
div $1,84
mod $1,10
mov $0,$1
|
README/DependentlyTyped/Equality-checker.agda | nad/dependently-typed-syntax | 5 | 15364 | ------------------------------------------------------------------------
-- Various equality checkers (some complete, all sound)
------------------------------------------------------------------------
import Axiom.Extensionality.Propositional as E
import Level
open import Data.Universe
-- The code makes use of the assumption that propositional equality of
-- functions is extensional.
module README.DependentlyTyped.Equality-checker
(Uni₀ : Universe Level.zero Level.zero)
(ext : E.Extensionality Level.zero Level.zero)
where
open import Category.Monad
open import Data.Maybe
import Data.Maybe.Categorical as Maybe
open import Data.Product
open import Function hiding (_∋_) renaming (const to k)
import README.DependentlyTyped.NBE as NBE; open NBE Uni₀ ext
import README.DependentlyTyped.NormalForm as NF; open NF Uni₀
import README.DependentlyTyped.Term as Term; open Term Uni₀
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open import Relation.Nullary as Dec using (Dec; yes)
import Relation.Nullary.Decidable as Dec
open import Relation.Nullary.Product
open P.≡-Reasoning
open RawMonadZero (Maybe.monadZero {f = Level.zero})
-- Decides if two "atomic type proofs" are equal.
infix 4 _≟-atomic-type_
_≟-atomic-type_ :
∀ {Γ σ} (σ′₁ σ′₂ : Γ ⊢ σ atomic-type) → Dec (σ′₁ ≡ σ′₂)
⋆ ≟-atomic-type ⋆ = yes P.refl
el ≟-atomic-type el = yes P.refl
mutual
private
-- A helper lemma.
helper-lemma :
∀ {Γ₁ sp₁₁ sp₂₁ σ₁}
(t₁₁ : Γ₁ ⊢ π sp₁₁ sp₂₁ , σ₁ ⟨ ne ⟩) (t₂₁ : Γ₁ ⊢ fst σ₁ ⟨ no ⟩)
{Γ₂ sp₁₂ sp₂₂ σ₂}
(t₁₂ : Γ₂ ⊢ π sp₁₂ sp₂₂ , σ₂ ⟨ ne ⟩) (t₂₂ : Γ₂ ⊢ fst σ₂ ⟨ no ⟩) →
t₁₁ · t₂₁ ≅-⊢n t₁₂ · t₂₂ → t₁₁ ≅-⊢n t₁₂ × t₂₁ ≅-⊢n t₂₂
helper-lemma _ _ ._ ._ P.refl = P.refl , P.refl
-- Decides if two neutral terms are identical. Note that the terms
-- must have the same context, but they do not need to have the same
-- type.
infix 4 _≟-⊢ne_
_≟-⊢ne_ : ∀ {Γ σ₁} (t₁ : Γ ⊢ σ₁ ⟨ ne ⟩)
{σ₂} (t₂ : Γ ⊢ σ₂ ⟨ ne ⟩) →
Dec (t₁ ≅-⊢n t₂)
var x₁ ≟-⊢ne var x₂ = Dec.map′ var-n-cong helper (x₁ ≟-∋ x₂)
where
helper : ∀ {Γ₁ σ₁} {x₁ : Γ₁ ∋ σ₁}
{Γ₂ σ₂} {x₂ : Γ₂ ∋ σ₂} →
var x₁ ≅-⊢n var x₂ → x₁ ≅-∋ x₂
helper P.refl = P.refl
t₁₁ · t₂₁ ≟-⊢ne t₁₂ · t₂₂ with t₁₁ ≟-⊢ne t₁₂
... | Dec.no neq = Dec.no (neq ∘ proj₁ ∘ helper-lemma _ t₂₁ _ t₂₂)
... | yes eq = Dec.map′
(·n-cong eq)
(proj₂ ∘ helper-lemma t₁₁ _ t₁₂ _)
(t₂₁ ≟-⊢no t₂₂ [ fst-cong $ indexed-type-cong $ helper eq ])
where
helper : ∀ {Γ₁ σ₁} {t₁ : Γ₁ ⊢ σ₁ ⟨ ne ⟩}
{Γ₂ σ₂} {t₂ : Γ₂ ⊢ σ₂ ⟨ ne ⟩} →
t₁ ≅-⊢n t₂ → σ₁ ≅-Type σ₂
helper P.refl = P.refl
var _ ≟-⊢ne _ · _ = Dec.no λ ()
_ · _ ≟-⊢ne var _ = Dec.no λ ()
-- Decides if two normal forms are identical. Note that the terms
-- must have the same type.
infix 4 _≟-⊢no_[_]
_≟-⊢no_[_] : ∀ {Γ₁ σ₁} (t₁ : Γ₁ ⊢ σ₁ ⟨ no ⟩)
{Γ₂ σ₂} (t₂ : Γ₂ ⊢ σ₂ ⟨ no ⟩) →
σ₁ ≅-Type σ₂ → Dec (t₁ ≅-⊢n t₂)
ne σ′₁ t₁ ≟-⊢no ne σ′₂ t₂ [ P.refl ] = ne≟ne σ′₁ σ′₂ (t₁ ≟-⊢ne t₂)
where
ne≟ne : ∀ {Γ σ} {t₁ t₂ : Γ ⊢ σ ⟨ ne ⟩}
(σ′₁ : Γ ⊢ σ atomic-type) (σ′₂ : Γ ⊢ σ atomic-type) →
Dec (t₁ ≅-⊢n t₂) → Dec (ne σ′₁ t₁ ≅-⊢n ne σ′₂ t₂)
ne≟ne ⋆ ⋆ (yes P.refl) = yes P.refl
ne≟ne el el (yes P.refl) = yes P.refl
ne≟ne _ _ (Dec.no neq) = Dec.no (neq ∘ helper)
where
helper :
∀ {Γ₁ σ₁ σ′₁} {t₁ : Γ₁ ⊢ σ₁ ⟨ ne ⟩}
{Γ₂ σ₂ σ′₂} {t₂ : Γ₂ ⊢ σ₂ ⟨ ne ⟩} →
ne σ′₁ t₁ ≅-⊢n ne σ′₂ t₂ → t₁ ≅-⊢n t₂
helper P.refl = P.refl
ƛ t₁ ≟-⊢no ƛ t₂ [ eq ] =
Dec.map′ ƛn-cong helper
(t₁ ≟-⊢no t₂ [ snd-cong $ indexed-type-cong eq ])
where
helper :
∀ {Γ₁ σ₁ τ₁} {t₁ : Γ₁ ▻ σ₁ ⊢ τ₁ ⟨ no ⟩}
{Γ₂ σ₂ τ₂} {t₂ : Γ₂ ▻ σ₂ ⊢ τ₂ ⟨ no ⟩} →
ƛ t₁ ≅-⊢n ƛ t₂ → t₁ ≅-⊢n t₂
helper P.refl = P.refl
ne _ _ ≟-⊢no ƛ _ [ _ ] = Dec.no λ ()
ƛ _ ≟-⊢no ne _ _ [ _ ] = Dec.no λ ()
-- Tries to prove that two terms have the same semantics. The terms
-- must have the same type.
⟦_⟧≟⟦_⟧ : ∀ {Γ σ} (t₁ t₂ : Γ ⊢ σ) →
Maybe (⟦ t₁ ⟧ ≅-Value ⟦ t₂ ⟧)
⟦ t₁ ⟧≟⟦ t₂ ⟧ with normalise t₁ ≟-⊢no normalise t₂ [ P.refl ]
... | Dec.no _ = ∅
... | yes eq = return (begin
[ ⟦ t₁ ⟧ ] ≡⟨ normalise-lemma t₁ ⟩
[ ⟦ normalise t₁ ⟧n ] ≡⟨ ⟦⟧n-cong eq ⟩
[ ⟦ normalise t₂ ⟧n ] ≡⟨ P.sym $ normalise-lemma t₂ ⟩
[ ⟦ t₂ ⟧ ] ∎)
-- Tries to prove that two semantic types are equal, given
-- corresponding syntactic types. The types must have the same
-- context.
infix 4 _≟-Type_
_≟-Type_ : ∀ {Γ σ₁} (σ₁′ : Γ ⊢ σ₁ type)
{σ₂} (σ₂′ : Γ ⊢ σ₂ type) →
Maybe (σ₁ ≅-Type σ₂)
⋆ ≟-Type ⋆ = return P.refl
el t₁ ≟-Type el t₂ = helper <$> ⟦ t₁ ⟧≟⟦ t₂ ⟧
where
helper : ∀ {Γ₁} {v₁ : Value Γ₁ (⋆ , _)}
{Γ₂} {v₂ : Value Γ₂ (⋆ , _)} →
v₁ ≅-Value v₂ → (el , v₁) ≅-Type (el , v₂)
helper P.refl = P.refl
π σ′₁ τ′₁ ≟-Type π σ′₂ τ′₂ = helper τ′₁ τ′₂ =<< σ′₁ ≟-Type σ′₂
where
helper :
∀ {Γ₁ σ₁ τ₁} (τ′₁ : Γ₁ ▻ σ₁ ⊢ τ₁ type)
{Γ₂ σ₂ τ₂} (τ′₂ : Γ₂ ▻ σ₂ ⊢ τ₂ type) →
σ₁ ≅-Type σ₂ → Maybe (Type-π σ₁ τ₁ ≅-Type Type-π σ₂ τ₂)
helper τ′₁ τ′₂ P.refl = Type-π-cong <$> (τ′₁ ≟-Type τ′₂)
_ ≟-Type _ = ∅
|
CODE/TESTB/TESTB.asm | mspeculatrix/Zolatron64 | 0 | 168907 | <gh_stars>0
; Code for Zolatron 64 6502-based microcomputer.
;
; GitHub: https://github.com/mspeculatrix/Zolatron64/
; Blog: https://mansfield-devine.com/speculatrix/category/projects/zolatron/
;
; Written for the Beebasm assembler
; Assemble with:
; beebasm -v -i TESTB.asm
CPU 1 ; use 65C02 instruction set
BARLED = $0230 ; for the bar LED display
BARLED_L = BARLED
BARLED_H = BARLED + 1
INCLUDE "../../LIB/cfg_main.asm"
INCLUDE "../../LIB/cfg_page_0.asm"
; PAGE 1 is the STACK
INCLUDE "../../LIB/cfg_page_2.asm"
; PAGE 3 is used for STDIN & STDOUT buffers, plus indexes
INCLUDE "../../LIB/cfg_page_4.asm"
INCLUDE "../../LIB/cfg_VIAC.asm"
ORG USR_PAGE
.startcode
sei ; don't interrupt me yet
cld ; we don' need no steenkin' BCD
ldx #$ff ; set stack pointer to $01FF - only need to set the
txs ; LSB, as MSB is assumed to be $01
lda #0
sta PRG_EXIT_CODE
cli
stz VIAC_PORTA
stz VIAC_PORTB
stz BARLED_L
stz BARLED_H
jsr OSLCDCLS
.main
lda #'A'
jsr OSLCDCH
jsr OSWRCH
lda #'B'
jsr OSLCDCH
jsr OSWRCH
lda #'C'
jsr OSLCDCH
jsr OSWRCH
lda #' '
jsr OSWRCH
jsr OSWRSBUF
lda #CHR_LINEEND
jsr OSWRCH
LOAD_MSG welcome_msg
jsr OSWRMSG
lda #CHR_LINEEND
jsr OSWRCH
jsr OSLCDMSG
LOAD_MSG second_msg
jsr OSWRMSG
jsr OSLCDMSG
; inc BARLED_L
; bne main_loop
; inc BARLED_H
;.main_loop
; lda BARLED_L
; sta VIAC_PORTA
; lda BARLED_H
; sta VIAC_PORTB
; cmp #255
; beq chk_lowbyte
;.continue
; jsr barled_delay
; jmp main
;.chk_lowbyte
; lda BARLED_L
; cmp #255
; beq prog_end
; jmp continue
.prog_end
jmp OSSFTRST
;.barled_delay
; ldx #2
;.barled_delay_x_loop
; ldy #255
;.barled_delay_y_loop
; nop
; dey
; bne barled_delay_y_loop
; dex
; bne barled_delay_x_loop
; rts
.welcome_msg
equs "This is a new test", 0
.second_msg
equs "A second message", 0
.endcode
SAVE "../bin/TESTB.BIN", startcode, endcode
|
src/parser/javap/Javap.g4 | wizawu/1c | 126 | 3743 | <reponame>wizawu/1c
grammar Javap;
// https://github.com/antlr/antlr4/blob/master/tool-testsuite/test/org/antlr/v4/test/tool/Java.g4
compilationUnit
: (sourceDeclaration | classOrInterface)* EOF?
;
sourceDeclaration
: 'Compiled from' '"' .*? '"'
;
classOrInterface
: classDeclaration
| interfaceDeclaration
;
classDeclaration
: classModifier* 'class' type
('extends' type)?
('implements' typeList)?
classBody
;
interfaceDeclaration
: interfaceModifier* 'interface' type
('extends' typeList)?
interfaceBody
;
classModifier
: 'public'
| 'private'
| 'protected'
| 'abstract'
| 'final'
;
interfaceModifier
: 'public'
| 'private'
| 'protected'
;
typeList
: type ((','|', ') type)*
;
type
: (packageName '.')? Identifier typeArguments? subType?
;
subType
: '.' Identifier typeArguments?
;
packageName
: Identifier ('.' Identifier)*
;
typeArguments
: arrayBrackets+
| '<' typeArgument ((','|', ') typeArgument)* '>' arrayBrackets*
;
typeArgument
: type
| Identifier 'extends' type ('&' type)*
| '?' 'extends' type ('&' type)*
| '?' 'super' type
| '?'
;
Identifier
: [a-zA-Z$_] [a-zA-Z$_0-9]*
;
classBody
: '{' classMember* '}'
;
interfaceBody
: '{' interfaceMember* '}'
;
modifier
: 'abstract'
| 'default'
| 'final'
| 'native'
| 'private'
| 'protected'
| 'public'
| 'static'
| 'strictfp'
| 'synchronized'
| 'transient'
| 'volatile'
;
classMember
: constructorDeclaration
| fieldDeclaration
| methodDeclaration
| 'static' '{}' ';'
;
interfaceMember
: fieldDeclaration
| methodDeclaration
| 'static' '{}' ';'
;
constructorDeclaration
: modifier* typeArguments? type '(' methodArguments ')' throwsException? ';'
;
fieldDeclaration
: modifier* type Identifier ';'
;
methodDeclaration
: modifier* typeArguments? type Identifier '(' methodArguments ')' throwsException? ';'
;
throwsException
: 'throws' typeList
;
varargs
: type '...'
;
methodArguments
: typeList?
| typeList (','|', ') varargs
| varargs
;
arrayBrackets
: '[]'
;
WS
: [ \t\r\n]+ -> skip
;
|
_anim/Wall of Lava.asm | kodishmediacenter/msu-md-sonic | 9 | 100780 | <gh_stars>1-10
; ---------------------------------------------------------------------------
; Animation script - advancing wall of lava (MZ)
; ---------------------------------------------------------------------------
Ani_LWall: dc.w @wall-Ani_LWall
@wall: dc.b 9, 0, 1, 2, 3, afEnd
even |
Task/Hamming-numbers/Ada/hamming-numbers-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 110 | <filename>Task/Hamming-numbers/Ada/hamming-numbers-1.ada
with Ada.Text_IO;
procedure Hamming is
generic
type Int_Type is private;
Zero : Int_Type;
One : Int_Type;
Two : Int_Type;
Three : Int_Type;
Five : Int_Type;
with function "mod" (Left, Right : Int_Type) return Int_Type is <>;
with function "/" (Left, Right : Int_Type) return Int_Type is <>;
with function "+" (Left, Right : Int_Type) return Int_Type is <>;
function Get_Hamming (Position : Positive) return Int_Type;
function Get_Hamming (Position : Positive) return Int_Type is
function Is_Hamming (Number : Int_Type) return Boolean is
Temporary : Int_Type := Number;
begin
while Temporary mod Two = Zero loop
Temporary := Temporary / Two;
end loop;
while Temporary mod Three = Zero loop
Temporary := Temporary / Three;
end loop;
while Temporary mod Five = Zero loop
Temporary := Temporary / Five;
end loop;
return Temporary = One;
end Is_Hamming;
Result : Int_Type := One;
Previous : Positive := 1;
begin
while Previous /= Position loop
Result := Result + One;
if Is_Hamming (Result) then
Previous := Previous + 1;
end if;
end loop;
return Result;
end Get_Hamming;
-- up to 2**32 - 1
function Integer_Get_Hamming is new Get_Hamming
(Int_Type => Integer,
Zero => 0,
One => 1,
Two => 2,
Three => 3,
Five => 5);
-- up to 2**64 - 1
function Long_Long_Integer_Get_Hamming is new Get_Hamming
(Int_Type => Long_Long_Integer,
Zero => 0,
One => 1,
Two => 2,
Three => 3,
Five => 5);
begin
Ada.Text_IO.Put ("1) First 20 Hamming numbers: ");
for I in 1 .. 20 loop
Ada.Text_IO.Put (Integer'Image (Integer_Get_Hamming (I)));
end loop;
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("2) 1_691st Hamming number: " &
Integer'Image (Integer_Get_Hamming (1_691)));
-- even Long_Long_Integer overflows here
Ada.Text_IO.Put_Line ("3) 1_000_000st Hamming number: " &
Long_Long_Integer'Image (Long_Long_Integer_Get_Hamming (1_000_000)));
end Hamming;
|
src/VMTranslator/fixtures/StackArithmetic/StackTest/StackTest.raw.asm | tuzmusic/HackManager | 1 | 241970 | @17 // ** 1: push constant 17 **
D=A // store the current address as a value
@SP // >> push constant value (17) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@17 // ** 2: push constant 17 **
D=A // store the current address as a value
@SP // >> push constant value (17) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 3: eq ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
D=M-D // store X-Y in D for comparison
@IF_TRUE_0
D;JEQ // perform comparison: eq
@SP
A=M // move to top of stack
M=0
@END_IF_0
0;JMP
@SP
A=M // move to top of stack
M=-1
@SP // increment stack pointer
M=M+1 -
@17 // ** 4: push constant 17 **
D=A // store the current address as a value
@SP // >> push constant value (17) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@16 // ** 5: push constant 16 **
D=A // store the current address as a value
@SP // >> push constant value (16) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 6: eq ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
D=M-D // store X-Y in D for comparison
@IF_TRUE_1
D;JEQ // perform comparison: eq
@SP
A=M // move to top of stack
M=0
@END_IF_1
0;JMP
@SP
A=M // move to top of stack
M=-1
@SP // increment stack pointer
M=M+1 -
@16 // ** 7: push constant 16 **
D=A // store the current address as a value
@SP // >> push constant value (16) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@17 // ** 8: push constant 17 **
D=A // store the current address as a value
@SP // >> push constant value (17) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 9: eq ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
D=M-D // store X-Y in D for comparison
@IF_TRUE_2
D;JEQ // perform comparison: eq
@SP
A=M // move to top of stack
M=0
@END_IF_2
0;JMP
@SP
A=M // move to top of stack
M=-1
@SP // increment stack pointer
M=M+1 -
@892 // ** 10: push constant 892 **
D=A // store the current address as a value
@SP // >> push constant value (892) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@891 // ** 11: push constant 891 **
D=A // store the current address as a value
@SP // >> push constant value (891) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 12: lt ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
D=M-D // store X-Y in D for comparison
@IF_TRUE_3
D;JLT // perform comparison: lt
@SP
A=M // move to top of stack
M=0
@END_IF_3
0;JMP
@SP
A=M // move to top of stack
M=-1
@SP // increment stack pointer
M=M+1 -
@891 // ** 13: push constant 891 **
D=A // store the current address as a value
@SP // >> push constant value (891) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@892 // ** 14: push constant 892 **
D=A // store the current address as a value
@SP // >> push constant value (892) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 15: lt ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
D=M-D // store X-Y in D for comparison
@IF_TRUE_4
D;JLT // perform comparison: lt
@SP
A=M // move to top of stack
M=0
@END_IF_4
0;JMP
@SP
A=M // move to top of stack
M=-1
@SP // increment stack pointer
M=M+1 -
@891 // ** 16: push constant 891 **
D=A // store the current address as a value
@SP // >> push constant value (891) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@891 // ** 17: push constant 891 **
D=A // store the current address as a value
@SP // >> push constant value (891) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 18: lt ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
D=M-D // store X-Y in D for comparison
@IF_TRUE_5
D;JLT // perform comparison: lt
@SP
A=M // move to top of stack
M=0
@END_IF_5
0;JMP
@SP
A=M // move to top of stack
M=-1
@SP // increment stack pointer
M=M+1 -
@32767 // ** 19: push constant 32767 **
D=A // store the current address as a value
@SP // >> push constant value (32767) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@32766 // ** 20: push constant 32766 **
D=A // store the current address as a value
@SP // >> push constant value (32766) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 21: gt ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
D=M-D // store X-Y in D for comparison
@IF_TRUE_6
D;JGT // perform comparison: gt
@SP
A=M // move to top of stack
M=0
@END_IF_6
0;JMP
@SP
A=M // move to top of stack
M=-1
@SP // increment stack pointer
M=M+1 -
@32766 // ** 22: push constant 32766 **
D=A // store the current address as a value
@SP // >> push constant value (32766) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@32767 // ** 23: push constant 32767 **
D=A // store the current address as a value
@SP // >> push constant value (32767) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 24: gt ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
D=M-D // store X-Y in D for comparison
@IF_TRUE_7
D;JGT // perform comparison: gt
@SP
A=M // move to top of stack
M=0
@END_IF_7
0;JMP
@SP
A=M // move to top of stack
M=-1
@SP // increment stack pointer
M=M+1 -
@32766 // ** 25: push constant 32766 **
D=A // store the current address as a value
@SP // >> push constant value (32766) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@32766 // ** 26: push constant 32766 **
D=A // store the current address as a value
@SP // >> push constant value (32766) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 27: gt ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
D=M-D // store X-Y in D for comparison
@IF_TRUE_8
D;JGT // perform comparison: gt
@SP
A=M // move to top of stack
M=0
@END_IF_8
0;JMP
@SP
A=M // move to top of stack
M=-1
@SP // increment stack pointer
M=M+1 -
@57 // ** 28: push constant 57 **
D=A // store the current address as a value
@SP // >> push constant value (57) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@31 // ** 29: push constant 31 **
D=A // store the current address as a value
@SP // >> push constant value (31) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@53 // ** 30: push constant 53 **
D=A // store the current address as a value
@SP // >> push constant value (53) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 31: add ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
M=M+D // perform binary operation: add
@SP // increment stack pointer
M=M+1 -
@112 // ** 32: push constant 112 **
D=A // store the current address as a value
@SP // >> push constant value (112) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 33: sub ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
M=M-D // perform binary operation: sub -
@SP // ** 34: neg ** ("pop" X (SP decremented above))
A=M // PREPARE X (prep X "into" M)
M=-M // perform unary operation: neg -
@SP // ** 35: and ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
M=D&M // perform binary operation: and
@SP // increment stack pointer
M=M+1 -
@82 // ** 36: push constant 82 **
D=A // store the current address as a value
@SP // >> push constant value (82) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 37: or ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
M=M|D // perform binary operation: or -
@SP // ** 38: not ** ("pop" X (SP decremented above))
A=M // PREPARE X (prep X "into" M)
M=!M // perform unary operation: not
@SP // increment stack pointer |
STEPPER CONTROL 3.0.asm | vishnuajith/PIC-18-Example-Codes | 0 | 170854 | <reponame>vishnuajith/PIC-18-Example-Codes<gh_stars>0
;////////////////////////////////////////////////////
;// STEPPER MOTOR CONTROL USING BLUETOOTH //
;// //
;// MPMC SPECIAL PROJECT //
;// //
;// Author : <NAME> //
;// //
;////////////////////////////////////////////////////
;****************************************************************************
;* Description : Special Project done for MPMC Course ,Topic is controlling
;* of Stepper motor using an android app trough bluetooth.Project Uses
;* UART to receive data from app. App was made on MIT App Inventor.
;* Changing direction and speed control was possible.
;****************************************************************************
#INCLUDE<p18f452.inc>
CONFIG WDT = OFF, OSCS=OFF, OSC=HS
; VARIABLES
; STEP
; TMR1HV
; TMR1LV
STEP EQU 50H
TMR1HV EQU 51H
TMR1LV EQU 52H
UART EQU 53H
ORG 0
GOTO MAIN
ORG 8
BTFSC PIR1,RCIF
GOTO RC_INT
RETFIE
; PINS
; STEP RD0
; DIR RD1
; RX RC7
ORG 100
MAIN BSF TRISC,RC7
BSF INTCON,GIE
BSF INTCON,PEIE
;31 FOR 9600BPS IS AT SPBRG = 0x1F
MOVLW D'31'
MOVWF SPBRG ;SP BAUD RATE GENERATOR
BSF RCSTA,SPEN
BSF RCSTA,CREN
;INTERUPT
BCF PIR1,RCIF
BSF PIE1,RCIE
MOVLW 088
MOVWF TMR1HV
MOVLW 053
MOVWF TMR1LV
BCF TRISD,RD0
BCF TRISD,RD1
REPEAT CALL TMR_CONF
CALL ROTATE
BRA REPEAT
TMR_CONF MOVLW 0 ;TIMER 1 CONFIGURE
MOVWF T1CON
MOVFF TMR1HV,TMR1H
MOVFF TMR1LV,TMR1L
BCF PIR1,TMR1IF
BCF PIE1,TMR1IE
RETURN
ROTATE MOVLW D'200' ;200*1.8 = 360 DEGREE = 1 ROTATION
MOVWF STEP
LOOP BSF PORTD,RD0;STEP SETTED
BSF T1CON,TMR1ON
L2 BTFSS PIR1,TMR1IF
BRA L2
CALL TMR_CONF
BCF PORTD,RD0;STEP CLEARED
BSF T1CON,TMR1ON
L1 BTFSS PIR1,TMR1IF
BRA L1
CALL TMR_CONF
DECF STEP,F
BNZ ROTATE
RC_INT MOVFF RCREG,UART ; UART = 1,2,4 DIR,SP+,SP+ RESPECTIVELY
BTFSC UART,0
BRA CH_DIR
BTFSC UART,1
BRA CH_SP_INC
BTFSC UART,2
BRA CH_SP_DEC
BCF PIR1,RCIF
RETFIE
CH_DIR BTG PORTD,RD1
BCF PIR1,RCIF
RETFIE
CH_SP_INC BCF T1CON,TMR1ON; DECREASE TIMER DELAY
MOVLW 10
ADDWF TMR1HV
MOVFF TMR1HV,TMR1H
MOVFF TMR1LV,TMR1L
BCF PIR1,TMR1IF
BCF PIE1,TMR1IE;;
BSF T1CON,TMR1ON
BCF INTCON,INT0IF
BCF PIR1,RCIF
RETFIE
CH_SP_DEC BCF T1CON,TMR1ON; INCREASE TIMER DELAY
MOVLW 10
SUBWF TMR1HV,F
MOVFF TMR1HV,TMR1H
MOVFF TMR1LV,TMR1L
BCF PIR1,TMR1IF
BCF PIE1,TMR1IE;;
BSF T1CON,TMR1ON
BCF INTCON,INT0IF
BCF PIR1,RCIF
RETFIE
END |
libsrc/graphics/oz/swapgfxbk.asm | jpoikela/z88dk | 640 | 162797 | ;
; Sharp OZ family port (graphics routines)
; <NAME> - Aug 2002
;
; Page the graphics bank in/out - used by all gfx functions
; Simply does a swap...
;
;
; $Id: swapgfxbk.asm,v 1.4 2017-01-02 22:57:58 aralbrec Exp $
;
PUBLIC swapgfxbk
PUBLIC _swapgfxbk
PUBLIC swapgfxbk1
PUBLIC _swapgfxbk1
EXTERN ozactivepage
;.iysave defw 0
.swapgfxbk
._swapgfxbk
push bc
ld bc,(ozactivepage)
ld a,c
out (3),a
ld a,b
out (4),a
pop bc
; ld (iysave),iy
ret
.swapgfxbk1
._swapgfxbk1
ld a,7
out (3),a
ld a,4
out (4),a ;; page in proper second page
; ld iy,(iysave)
ret
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_62.asm | ljhsiun2/medusa | 9 | 97620 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r8
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xa198, %r12
nop
nop
nop
nop
add %rdi, %rdi
mov $0x6162636465666768, %rax
movq %rax, %xmm4
movups %xmm4, (%r12)
nop
cmp $29144, %rbp
lea addresses_WC_ht+0x1ec68, %rsi
lea addresses_WC_ht+0xc968, %rdi
nop
nop
cmp $17360, %r9
mov $59, %rcx
rep movsb
nop
nop
nop
inc %r12
lea addresses_D_ht+0x2625, %rsi
lea addresses_A_ht+0x1a7a8, %rdi
clflush (%rsi)
cmp $8964, %r8
mov $102, %rcx
rep movsb
add $3376, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r9
push %rcx
// Faulty Load
lea addresses_RW+0x1e468, %rcx
nop
nop
nop
nop
dec %r13
mov (%rcx), %r12w
lea oracles, %r9
and $0xff, %r12
shlq $12, %r12
mov (%r9,%r12,1), %r12
pop %rcx
pop %r9
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
Micro_Processor_Lab/6a-StringEquality/StringEquality.asm | MohithGowdaHR/PES-Engineering-Lab-Programs | 0 | 90818 | <reponame>MohithGowdaHR/PES-Engineering-Lab-Programs
; Assembly Level Program 6a
; Read two strings, store them in locations STR1 and STR2. Check whether they are equal or not and display appropriated messages. Also display the length of the stored strings.
.model SMALL
.data
BUF1 dB 20d
LEN1 dB ?
STR1 dB 20d DUP(0)
BUF2 dB 20d
LEN2 dB ?
STR2 dB 20d DUP(0)
MSG1 dB 10, 13, 'Enter String 1: $'
MSG2 dB 10, 13, 'Enter String 2: $'
MSG3 dB 10, 13, 'Length of String 1: $'
MSG4 dB 10, 13, 'Length of String 2: $'
MSG5 dB 10, 13, 'Strings are Equal!$'
MSG6 dB 10, 13, 'Strings are Not Equal!$'
.code
; Initialize Data & Extra Segment
MOV AX, @DATA
MOV DS, AX
MOV ES, AX
; Display Message
LEA DX, MSG1
MOV AH, 09h
INT 21h
; Read String from Keyboard
READSTR BUF1
; Display Message
LEA DX, MSG2
MOV AH, 09h
INT 21h
; Read String from Keyboard
READSTR BUF2
; Display Message
LEA DX, MSG3
MOV AH, 09h
INT 21h
; Display Length of First String
MOV AL, LEN1
ADD AL, 30h
MOV AH, 02h
INT 21h
; Display Message
LEA DX, MSG4
MOV AH, 09h
INT 21h
; Display Length of Second String
MOV AL, LEN2
ADD AL, 30h
MOV AH, 02h
INT 21h
; Compare Size of Both Strings
MOV CL, LEN1
CMP CL, LEN2
JNE NotEqual
; Point SI to First Position of STR1
LEA SI, STR1
; Point DI to First Position of STR2
LEA DI, STR2
; Clear and Set Counter Register
MOV CH, 00h
MOV CL, LEN1
; Clear Direction Flag
CLD
; Repeatedly Compare String Byte-by-Byte
REPE CMPSB
JE Equal
NotEqual:
; Display Message
LEA DX, MSG6
MOV AH, 09h
INT 21h
JMP Exit
Equal:
; Display Message
LEA DX, MSG5
MOV AH, 09h
INT 21h
Exit:
; Terminate the Program
MOV AH, 4Ch
INT 21h
END |
audio/sfx/intro_whoosh.asm | opiter09/ASM-Machina | 1 | 6302 | <gh_stars>1-10
SFX_Intro_Whoosh_Ch8:
noise_note 4, 2, -4, 32
noise_note 3, 10, 0, 32
noise_note 3, 11, 0, 33
noise_note 3, 12, 0, 34
noise_note 15, 13, 2, 36
sound_ret
|
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_1489.asm | ljhsiun2/medusa | 9 | 82413 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %rax
push %rbx
push %rcx
// Faulty Load
mov $0x3c6bb10000000539, %rcx
nop
nop
nop
xor %r14, %r14
mov (%rcx), %ax
lea oracles, %rbx
and $0xff, %rax
shlq $12, %rax
mov (%rbx,%rax,1), %rax
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/common/trendy_terminal-environments.adb | pyjarrett/archaic_terminal | 3 | 8914 | -------------------------------------------------------------------------------
-- Copyright 2021, The Trendy Terminal Developers (see AUTHORS file)
-- 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 Trendy_Terminal.Platform;
package body Trendy_Terminal.Environments is
function Is_Available(Self : Environment) return Boolean is (Self.Initialized);
overriding
procedure Initialize (Self : in out Environment) is
begin
Self.Initialized := Trendy_Terminal.Platform.Init;
end Initialize;
overriding
procedure Finalize(Self : in out Environment) is
begin
if Self.Initialized then
Trendy_Terminal.Platform.Shutdown;
end if;
end Finalize;
end Trendy_Terminal.Environments;
|
alloy4fun_models/trashltl/models/16/ZcZoZqQkJ93eW6Q3k.als | Kaixi26/org.alloytools.alloy | 0 | 2135 | open main
pred idZcZoZqQkJ93eW6Q3k_prop17 {
all f: File |always (eventually f in Trash releases f' not in File)
}
pred __repair { idZcZoZqQkJ93eW6Q3k_prop17 }
check __repair { idZcZoZqQkJ93eW6Q3k_prop17 <=> prop17o } |
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1873.asm | ljhsiun2/medusa | 9 | 244908 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1ac24, %rsi
lea addresses_WC_ht+0x1bf84, %rdi
nop
nop
nop
nop
nop
inc %rbp
mov $10, %rcx
rep movsb
nop
nop
and %r12, %r12
lea addresses_A_ht+0x1cd24, %r15
nop
nop
nop
nop
nop
cmp %r12, %r12
mov $0x6162636465666768, %rbp
movq %rbp, (%r15)
xor %r15, %r15
lea addresses_D_ht+0xeb24, %rsi
lea addresses_normal_ht+0x98a4, %rdi
nop
nop
nop
nop
sub $21840, %r13
mov $58, %rcx
rep movsq
add $3940, %rcx
lea addresses_UC_ht+0x4624, %rdi
sub $53478, %r12
mov (%rdi), %r13d
nop
nop
nop
add %r15, %r15
lea addresses_normal_ht+0xe7a4, %rsi
nop
nop
nop
nop
nop
inc %r12
vmovups (%rsi), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %rcx
nop
nop
and %r12, %r12
lea addresses_normal_ht+0xa24, %rdi
nop
nop
xor %rbp, %rbp
mov (%rdi), %r12
nop
nop
nop
nop
cmp %r13, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r8
push %rax
push %rcx
push %rsi
// Store
lea addresses_RW+0x4204, %r8
nop
nop
nop
cmp $64469, %r15
movw $0x5152, (%r8)
cmp $36555, %rsi
// Store
mov $0x724, %r8
sub $29407, %rax
mov $0x5152535455565758, %r15
movq %r15, %xmm6
movups %xmm6, (%r8)
nop
nop
nop
add %r14, %r14
// Store
lea addresses_US+0x10ca8, %rax
nop
nop
nop
nop
nop
xor $45434, %r12
mov $0x5152535455565758, %r15
movq %r15, %xmm5
movups %xmm5, (%rax)
nop
nop
nop
dec %rax
// Load
mov $0x23a85400000001a4, %r14
dec %rcx
movaps (%r14), %xmm3
vpextrq $0, %xmm3, %r8
nop
nop
nop
nop
nop
sub $12185, %r14
// Faulty Load
lea addresses_normal+0xae24, %r14
clflush (%r14)
nop
add %rsi, %rsi
mov (%r14), %rcx
lea oracles, %rax
and $0xff, %rcx
shlq $12, %rcx
mov (%rax,%rcx,1), %rcx
pop %rsi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 2}}
{'src': {'type': 'addresses_NC', 'AVXalign': True, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
programs/oeis/186/A186330.asm | karttu/loda | 1 | 19749 | ; A186330: Adjusted joint rank sequence of (f(i)) and (g(j)) with f(i) after g(j) when f(i)=g(j), where f and g are the pentagonal numbers and the hexagonal numbers. Complement of A186331.
; 2,3,5,7,9,11,13,15,16,18,20,22,24,26,28,29,31,33,35,37,39,41,43,44,46,48,50,52,54,56,57,59,61,63,65,67,69,71,72,74,76,78,80,82,84,85,87,89,91,93,95,97,99,100,102,104,106,108,110,112,113,115,117,119,121,123,125,126,128,130,132,134,136,138,140,141,143,145,147,149,151,153,154,156,158,160,162,164,166,168,169,171,173,175,177,179,181,182,184,186
mov $1,$0
mul $1,97
div $1,52
add $1,1
mul $1,2
sub $1,2
div $1,2
add $1,2
|
msp430x2/msp430g2452/svd/msp430_svd-flash.ads | ekoeppen/MSP430_Generic_Ada_Drivers | 0 | 10729 | -- This spec has been automatically generated from out.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
-- Flash
package MSP430_SVD.FLASH is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- FLASH Control 1
type FCTL1_Register is record
-- unspecified
Reserved_0_0 : MSP430_SVD.Bit := 16#0#;
-- Enable bit for Flash segment erase
ERASE : MSP430_SVD.Bit := 16#0#;
-- Enable bit for Flash mass erase
MERAS : MSP430_SVD.Bit := 16#0#;
-- unspecified
Reserved_3_5 : MSP430_SVD.UInt3 := 16#0#;
-- Enable bit for Flash write
WRT : MSP430_SVD.Bit := 16#0#;
-- Enable bit for Flash segment write
BLKWRT : MSP430_SVD.Bit := 16#0#;
-- unspecified
Reserved_8_15 : MSP430_SVD.Byte := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 16,
Bit_Order => System.Low_Order_First;
for FCTL1_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ERASE at 0 range 1 .. 1;
MERAS at 0 range 2 .. 2;
Reserved_3_5 at 0 range 3 .. 5;
WRT at 0 range 6 .. 6;
BLKWRT at 0 range 7 .. 7;
Reserved_8_15 at 0 range 8 .. 15;
end record;
-- FCTL2_FN array
type FCTL2_FN_Field_Array is array (0 .. 5) of MSP430_SVD.Bit
with Component_Size => 1, Size => 6;
-- Type definition for FCTL2_FN
type FCTL2_FN_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FN as a value
Val : MSP430_SVD.UInt6;
when True =>
-- FN as an array
Arr : FCTL2_FN_Field_Array;
end case;
end record
with Unchecked_Union, Size => 6;
for FCTL2_FN_Field use record
Val at 0 range 0 .. 5;
Arr at 0 range 0 .. 5;
end record;
-- Flash clock select 0 */ /* to distinguish from USART SSELx
type FCTL2_FSSEL_Field is
(-- Flash clock select: 0 - ACLK
Fssel_0,
-- Flash clock select: 1 - MCLK
Fssel_1,
-- Flash clock select: 2 - SMCLK
Fssel_2,
-- Flash clock select: 3 - SMCLK
Fssel_3)
with Size => 2;
for FCTL2_FSSEL_Field use
(Fssel_0 => 0,
Fssel_1 => 1,
Fssel_2 => 2,
Fssel_3 => 3);
-- FLASH Control 2
type FCTL2_Register is record
-- Divide Flash clock by 1 to 64 using FN0 to FN5 according to:
FN : FCTL2_FN_Field := (As_Array => False, Val => 16#0#);
-- Flash clock select 0 */ /* to distinguish from USART SSELx
FSSEL : FCTL2_FSSEL_Field := MSP430_SVD.FLASH.Fssel_0;
-- unspecified
Reserved_8_15 : MSP430_SVD.Byte := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 16,
Bit_Order => System.Low_Order_First;
for FCTL2_Register use record
FN at 0 range 0 .. 5;
FSSEL at 0 range 6 .. 7;
Reserved_8_15 at 0 range 8 .. 15;
end record;
-- FLASH Control 3
type FCTL3_Register is record
-- Flash busy: 1
BUSY : MSP430_SVD.Bit := 16#0#;
-- Flash Key violation flag
KEYV : MSP430_SVD.Bit := 16#0#;
-- Flash Access violation flag
ACCVIFG : MSP430_SVD.Bit := 16#0#;
-- Wait flag for segment write
WAIT : MSP430_SVD.Bit := 16#0#;
-- Lock bit: 1 - Flash is locked (read only)
LOCK : MSP430_SVD.Bit := 16#0#;
-- Flash Emergency Exit
EMEX : MSP430_SVD.Bit := 16#0#;
-- Segment A Lock bit: read = 1 - Segment is locked (read only)
LOCKA : MSP430_SVD.Bit := 16#0#;
-- Last Program or Erase failed
FAIL : MSP430_SVD.Bit := 16#0#;
-- unspecified
Reserved_8_15 : MSP430_SVD.Byte := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 16,
Bit_Order => System.Low_Order_First;
for FCTL3_Register use record
BUSY at 0 range 0 .. 0;
KEYV at 0 range 1 .. 1;
ACCVIFG at 0 range 2 .. 2;
WAIT at 0 range 3 .. 3;
LOCK at 0 range 4 .. 4;
EMEX at 0 range 5 .. 5;
LOCKA at 0 range 6 .. 6;
FAIL at 0 range 7 .. 7;
Reserved_8_15 at 0 range 8 .. 15;
end record;
-----------------
-- Peripherals --
-----------------
-- Flash
type FLASH_Peripheral is record
-- FLASH Control 1
FCTL1 : aliased FCTL1_Register;
-- FLASH Control 2
FCTL2 : aliased FCTL2_Register;
-- FLASH Control 3
FCTL3 : aliased FCTL3_Register;
end record
with Volatile;
for FLASH_Peripheral use record
FCTL1 at 16#0# range 0 .. 15;
FCTL2 at 16#2# range 0 .. 15;
FCTL3 at 16#4# range 0 .. 15;
end record;
-- Flash
FLASH_Periph : aliased FLASH_Peripheral
with Import, Address => FLASH_Base;
end MSP430_SVD.FLASH;
|
src/kPLingua/Input/Grammar/KpLingua.g4 | Kernel-P-Systems/kPWorkbench | 1 | 3832 | <reponame>Kernel-P-Systems/kPWorkbench<gh_stars>1-10
/* The ANTLRv4 grammar for kPLingua language */
grammar KpLingua;
@parser::members
{
protected const int EOF = Eof;
}
@lexer::members
{
protected const int EOF = Eof;
protected const int HIDDEN = Hidden;
}
tokens {
}
// Grammar rules for parsing the kPLingua language
kPsystem
: statement* EOF
;
statement
: typeDefinition | instantiation | link
;
typeDefinition
: 'type' Identifier '{' ruleSet? '}'
;
ruleSet
: executionStrategy+
;
executionStrategy
: sequenceExecutionStrategy | choiceExecutionStrategy | maxExecutionStrategy | arbitraryExecutionStrategy
;
sequenceExecutionStrategy
: rule+
;
choiceExecutionStrategy
: 'choice' '{' rule* '}'
;
maxExecutionStrategy
: 'max' '{' rule* '}'
;
arbitraryExecutionStrategy
: 'arbitrary' '{' rule* '}'
;
rule
: (guard ':')? nonEmptyMultiset '->' ruleRightHandSide '.'
;
ruleRightHandSide
: emptyMultiset
| ruleMultiset (',' ruleMultiset)*
| division+
| dissolution
| linkCreation
| linkDestruction
;
ruleMultiset
: nonEmptyMultiset | targetedMultiset
;
guard
: andGuardExpression ('|' andGuardExpression)*
;
andGuardExpression
: guardOperand ('&' guardOperand)*
;
guardOperand
: RelationalOperator? nonEmptyMultiset
| '(' guard ')'
;
emptyMultiset
: '{' '}'
;
multisetAtom
: Multiplicity? Identifier
;
nonEmptyMultiset
: multisetAtom (',' multisetAtom)*
;
typeReference
: '(' Identifier ')'
;
targetedMultiset
: (multisetAtom | '{' nonEmptyMultiset '}') typeReference
;
linkCreation
: '-' typeReference
;
linkDestruction
: '\\-' typeReference
;
dissolution
: '#'
;
division
: '[' nonEmptyMultiset? ']' typeReference?
;
instance
: Identifier? (emptyMultiset | '{' nonEmptyMultiset '}') typeReference
;
instantiation
: instance (',' instance)* '.'
;
link
: linkOperand ('-' linkOperand)+ '.'
;
linkOperand
: instance | Identifier | linkWildcardOperand
;
linkWildcardOperand
: '*' typeReference
;
Identifier
: Letter Alphanumeric*
;
RelationalOperator
: '>=' | '<=' | '>' | '<' | '=' | '!'
;
Multiplicity
: '0' | '1'..'9' '0'..'9'*
;
fragment Alphanumeric
: Letter | ('0'..'9') | ('_')
;
fragment Letter
: '\u0024'
| '\u0041'..'\u005a'
| '\u005f'
| '\u0061'..'\u007a'
| '\u00c0'..'\u00d6'
| '\u00d8'..'\u00f6'
| '\u00f8'..'\u00ff'
| '\u0100'..'\u1fff'
| '\u3040'..'\u318f'
| '\u3300'..'\u337f'
| '\u3400'..'\u3d2d'
| '\u4e00'..'\u9fff'
| '\uf900'..'\ufaff'
;
Ws
: [ \r\t\u000C\n]+ -> channel(HIDDEN)
;
Comment
: '/*' .*? '*/' -> channel(HIDDEN)
;
LineComment
: '//' ~[\r\n]* -> channel(HIDDEN)
;
|
ttt.asm | egtzori/ttt | 0 | 21073 | <reponame>egtzori/ttt<gh_stars>0
[bits 16] ; tell assembler that working in real mode(16 bit mode)
[org 0x7c00] ; organize from 0x7C00 memory location where BIOS will load us
start:
; cls
mov ax, 0xb800
push ax
mov es, ax
xor di, di
mov cx, 0x07d0
mov ax, 0x0000
rep stosw
pop ax
mov ds, ax
mov bl, '0' ;; init turn
mov [turn], bl
draw:
mov ax, 0xb800
mov es, ax
mov word [0], 0x0731
mov word [2], 0x087C ; |
mov word [4], 0x0732
mov word [6], 0x087C ; |
mov word [8], 0x0733
mov word [160], 0x082D
mov word [162], 0x082B ; +
mov word [164], 0x082D
mov word [166], 0x082B ; +
mov word [168], 0x082D
mov word [320], 0x0734
mov word [322], 0x087C ; |
mov word [324], 0x0735
mov word [326], 0x087C ; |
mov word [328], 0x0736
mov word [480], 0x082D
mov word [482], 0x082B ; +
mov word [484], 0x082D
mov word [486], 0x082B ; +
mov word [488], 0x082D
mov word [640], 0x0737
mov word [642], 0x087C ; |
mov word [644], 0x0738
mov word [646], 0x087C ; |
mov word [648], 0x0739
;;;;;;;;
playmore:
mov bx, 0x0458; 'X'
call play
mov bx, 0x024F; 'O'
call play
jmp playmore
play:
call getnum; key in al, player in bx
; mov dx, ax
cbw
mov ch, 3
div ch
mov cl, ah ; rem
shl cl, 2
cbw ; al into ax
push cx ; save cause mul will destroy it
mov cx, 320
mul cx
pop cx
xor ch,ch
add ax, cx
mov si, ax
mov cx, word [si]
cmp cl, 0x40 ; check if number (already played this cell)
jnc play
mov word [si], bx
; lea ax, [ax + ax*2]
; mov dx, [bx + 2*ax]
mov cx, bx
shl cx, 1
add cx, bx; = cx*3
;; check win
; lines 1-3
mov ax, word [0]
add ax, word [4]
add ax, word [8]
cmp ax, cx
jz winner
mov ax, word [320]
add ax, word [324]
add ax, word [328]
cmp ax, cx
jz winner
mov ax, word [640]
add ax, word [644]
add ax, word [648]
cmp ax, cx
jz winner
;columns 1-3
mov ax, word [0]
add ax, word [320]
add ax, word [640]
cmp ax, cx
jz winner
mov ax, word [4]
add ax, word [324]
add ax, word [644]
cmp ax, cx
jz winner
mov ax, word [8]
add ax, word [328]
add ax, word [648]
cmp ax, cx
jz winner
;2 diagonals, first top left to bottom right
mov ax, word [0]
add ax, word [324]
add ax, word [648]
cmp ax, cx
jz winner
mov ax, word [8]
add ax, word [324]
add ax, word [640]
cmp ax, cx
jz winner
mov bl, [turn] ;; check tie
inc bl
cmp bl, '9'
je tie
mov [turn],bl
ret
winner: ; win symbol + color in bx
mov di, 0x14
mov ah, bh ; color
mov al, 'W'
stosw
mov al, 'i'
stosw
mov al, 'n'
stosw
mov al, 'n'
stosw
mov al, 'e'
stosw
mov al, 'r'
stosw
inc di
inc di
mov ax, bx
stosw
waitkey_and_reboot:
mov ah, 0 ; wait for key
int 0x16
db 0EAh ; machine language to jump to FFFF:0000 (reboot)
dw 0000h
dw 0FFFFh
tie:
mov di, 0x14
mov ax, 0x0254
stosw
mov al, 'i'
stosw
mov al, 'e'
stosw
jmp waitkey_and_reboot
getnum: ; accepts 1..9
mov ah, 0 ; wait for key
int 0x16
sub al,0x31 ; Subtract code for ASCII digit 1
jc getnum ; Is it less than? Wait for another key
cmp al,0x09 ; Comparison with 9
jnc getnum ; Is it greater than or equal to? Wait
ret;
turn equ 0x30
times (510 - ($ - $$)) db 0x00 ;set 512 BS
dw 0xAA55
|
3-Assemble(80x86)/lab-3/task1.asm | ftxj/4th-Semester | 0 | 7123 | .386
STACK SEGMENT USE16 STACK
DB 256 DUP(0)
STACK ENDS
DATA SEGMENT USE16
N EQU 5
T EQU 16
STU DB N DUP('TEMPVALUE',0,80,90,95,?,?,?)
RANK DW N DUP(0)
PUT0 DB 0AH,0DH,15 DUP(0)
DB 'MENU',0AH,0DH,0AH,0DH,6 DUP(0)
DB '1.Logging the data of student',27h,'name and grades.',0AH,0DH,6 DUP(0)
DB '2.Calculate the average.',0AH,0DH,6 DUP(0)
DB '3.Calculate the rankings.',0AH,0DH,6 DUP(0)
DB '4.Output report card.',0AH,0DH,6 DUP(0)
DB '5.Exits program.',6 DUP(0)
PUT1 DB 0AH,0DH,6 DUP(0),'$'
PUT2 DB 'Please input the number of function to choose:',0AH,0DH,6 DUP(0),'$'
PUT3 DB 'INPUT ERROR!Please input again:',0AH,0DH,6 DUP(0),'$'
SPUT1 DB 0AH,0DH,0AH,0DH,6 DUP(0),'This is SUB1:Logging!',0AH,0DH,6 DUP(0),'Please enter the serail number of the student want to modify:(Only 1-5!)',0AH,0DH,6 DUP(0),'$'
SP1_1 DB 0AH,0DH,6 DUP(0),'INPUT ERROR!Please input again:',0AH,0DH,6 DUP(0),'$'
SP1_2 DB 0AH,0DH,6 DUP(0),'Please enter the name of student',0AH,0DH,6 DUP(0),'$'
SP1_3 DB 0AH,0DH,6 DUP(0),'Please enter the Chinese grade(Only 0-100)',0AH,0DH,6 DUP(0),'$'
SP1_4 DB 0AH,0DH,6 DUP(0),'Please enter the Math grade(Only 0-100)',0AH,0DH,6 DUP(0),'$'
SP1_5 DB 0AH,0DH,6 DUP(0),'Please enter the English grade(Only 0-100)',0AH,0DH,6 DUP(0),'$'
SP1_6 DB 0AH,0DH,6 DUP(0),'Enter succeed!plause any key to the menu',0AH,0DH,6 DUP(0),'$'
SPUT2 DB 0AH,0DH,6 DUP(0),'This is SUB2.:Calculate!',0AH,0DH,'$'
SP2_1 DB 0AH,0DH,0AH,0DH,6 DUP(0),'Calculate succeed!plause any key to the menu',0AH,0DH,6 DUP(0),'$'
SPUT3 DB 0AH,0DH,0AH,0DH,6 DUP(0),'This is SUB3.:Rank!',0AH,0DH,'$'
SPUT4 DB 0AH,0DH,0AH,0DH,6 DUP(0),'This is SUB4.:Put!',0AH,0DH,'$'
SPUT5 DB 0AH,0DH,0AH,0DH,6 DUP(0),'This is SUB5.:Exit!',0AH,0DH,6 DUP(0)
DB 'Aborting...','$'
IN_PUT DB 11;Input buffer memory area
COUNT DB ?;the length of input
DB 11 DUP(0);the content of input
DATA ENDS
CODE SEGMENT USE16
ASSUME CS: CODE, DS: DATA, SS: STACK
START: MOV AX,DATA
MOV DS,AX
MOV ES,AX
MOV AX,STACK
MOV SS,AX
MOV SP,0100H
;宏指令的定义
IO MACRO A,B
LEA DX,A
MOV AH,B
INT 21H
ENDM
JMP MENU;jump to the menu
;********************************************
;选择1=录入学生姓名和各科考试成绩,2=计算平均分,3=计算排名,4=输出成绩单,5=程序退出。
MENU:
MOV AX,0003H;清屏
INT 10H
IO PUT0,9;输出提示符
IO PUT2,9
INP: IO PUT0,1;输入选择
IO PUT1,9
;程序跳转
CMP AL,'1'
JE SUB1
CMP AL,'2'
JE SUB2
CMP AL,'3'
JE SUB3
CMP AL,'4'
JE SUB4
CMP AL,'5'
JE SUB5
MOV AX,0003H
INT 10H
IO PUT0,9;输出提示符
IO PUT3,9
JMP INP
;********************************************
OVER: MOV AH,4CH;end the program
INT 21H
;********************************************
SUB1: MOV AX,0003H;清屏
INT 10H
IO SPUT1,9;输出提示符
S1_1: IO SPUT1,1;输入选择->AL!!!
MOV AH,0
PUSH AX
CMP AL,'1';序号合法
JB S1ERR
CMP AL,'5'
JA S1ERR
S1_2: IO SP1_2,9;输出提示姓名
IO IN_PUT,10;输入学生姓名
LEA BX,IN_PUT;输入为回车则重新提示输入
MOVZX AX,BYTE PTR DS:[BX+1]
CMP AX,0
JE S1_2
ADD BX,AX
S1_3: CMP AX,10;空白置零
JNB S1_4
INC AX
MOV BYTE PTR DS:[BX+2],0
JMP S1_3
S1_4:;字符串移动
POP AX
SUB AX,31H
MOV DL,T
MUL DL
LEA DI,STU
ADD DI,AX
LEA SI,IN_PUT
ADD SI,2
MOV CX,10
CLD
REP MOVSB
;输入学生语文成绩
S1_5: IO SP1_3,9
IO IN_PUT,10
LEA BX,COUNT
MOVZX AX,BYTE PTR DS:[BX]
CMP AX,4;输入合法
JAE S1_5
CMP AX,3
JNE S1_6
MOV EAX,DWORD PTR 1[BX]
CMP EAX,0D303031H
JNE S1_5
MOV BYTE PTR [DI],100
S1_6: MOV AX,WORD PTR 1[BX]
MOV DL,AH
MOV DH,10
AND AX,0FFH
SUB AX,30H
MUL DH
MOV DH,0
SUB DX,30H
ADD AX,DX
MOV BYTE PTR [DI],AL
INC DI
;输入学生数学成绩
S1_7: IO SP1_4,9
IO IN_PUT,10
LEA BX,COUNT
MOVZX AX,BYTE PTR DS:[BX]
CMP AX,4;输入合法
JAE S1_7
CMP AX,3
JNE S1_8
MOV EAX,DWORD PTR 1[BX]
CMP EAX,0D303031H
JNE S1_7
MOV BYTE PTR [DI],100
S1_8: MOV AX,WORD PTR 1[BX]
MOV DL,AH
MOV DH,10
AND AX,0FFH
SUB AX,30H
MUL DH
MOV DH,0
SUB DX,30H
ADD AX,DX
MOV BYTE PTR [DI],AL
INC DI
;输入学生英语成绩
S1_9: IO SP1_5,9
IO IN_PUT,10
LEA BX,COUNT
MOVZX AX,BYTE PTR DS:[BX]
CMP AX,4;输入合法
JAE S1_9
CMP AX,3
JNE S1_10
MOV EAX,DWORD PTR 1[BX]
CMP EAX,0D303031H
JNE S1_9
MOV BYTE PTR [DI],100
S1_10: MOV AX,WORD PTR 1[BX]
MOV DL,AH
MOV DH,10
AND AX,0FFH
SUB AX,30H
MUL DH
MOV DH,0
SUB DX,30H
ADD AX,DX
MOV BYTE PTR [DI],AL
INC DI
IO SP1_6,9
IO SP1_6,1
JMP MENU
S1ERR: IO SP1_1,9
JMP S1_1
;********************************************
SUB2:;计算平均分
MOV AX,0003H;清屏
INT 10H
IO SPUT2,9;输出提示符
MOV CX,N
LEA EBX,STU
S00: PUSH EBX
MOV DWORD PTR EAX,DS:[EBX+10];the grade -> AL
SHL EAX,1
MOVZX DX,AL
SHL DX,1
MOVZX BX,AH
ADD BX,DX
SHR EAX,17
XOR AH,AH
ADD AX,BX
MOV BL,7
DIV BL
POP EBX
ADD EBX,T
MOV DS:[EBX-3],AL;restore the average grade
LOOP S00
IO SP1_6,9
IO SP1_6,1
JMP MENU
;********************************************
SUB3: ;计算排名
MOV AX,0003H;清屏
INT 10H
IO SPUT3,9;输出提示符
;录入首地址至RANK
MOV CX,N
LEA DX,STU
LEA BX,RANK
SP3_1: MOV WORD PTR [BX],DX
ADD DX,T
ADD BX,2
LOOP SP3_1
;任意键退出
IO SP1_6,9
IO SP1_6,1
JMP MENU
;********************************************
SUB4:
MOV AX,0003H;清屏
INT 10H
;输出提示符
IO SPUT4,9
;任意键退出
IO SP1_6,9
IO SP1_6,1
JMP MENU
;********************************************
SUB5: MOV AX,0003H;清屏
INT 10H
;输出提示符
IO SPUT5,9
MOV CX,2
DELAY: PUSH CX
;1s延迟
mov cx,0fh
mov dx,4240h ; 1 秒的延时
mov ah,86h
int 15h
POP CX
LOOP DELAY
JMP OVER
CODE ENDS
END START
|
Lab6/main6.asm | YuriySavchenko/Assembler | 0 | 5813 | <filename>Lab6/main6.asm
format ELF executable 3
include 'print.asm'
include 'module.asm'
include 'longop.asm'
entry start
segment readable executable
start:
push buff
push value
push 768
call StrHex_MY
print buff, 768
print clr, 2
push numBuff
push number
push 32
call StrHex_MY
print numBuff, 64
print clr, 2
xor ecx, ecx
mov ecx, count
.cycle:
push value
push number
call SHR_LONGOP_PROC
dec dword [count]
jnz .cycle
push buff
push value
push 768
call StrHex_MY
print buff, 768
print clr, 2
push numBuff
push number
push 32
call StrHex_MY
mov eax, 1
mov ebx, 0
int 0x80
segment readable writeable
value dd 24 dup (3)
number dd 4
count dd 4
buff db 768 dup(0)
numBuff db 64 dup(0)
clr db 13, 10
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_505.asm | ljhsiun2/medusa | 9 | 12215 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x77a1, %r13
clflush (%r13)
nop
nop
nop
nop
sub %rax, %rax
movb $0x61, (%r13)
nop
nop
nop
nop
dec %rsi
lea addresses_D_ht+0x5f19, %rsi
lea addresses_A_ht+0x3fd9, %rdi
clflush (%rdi)
nop
nop
nop
xor $34008, %r8
mov $115, %rcx
rep movsw
cmp %r8, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %r9
push %rbp
push %rcx
push %rsi
// Store
lea addresses_WT+0x18ad9, %r13
nop
nop
nop
sub $63057, %r9
movw $0x5152, (%r13)
nop
nop
xor $5448, %r13
// Store
lea addresses_PSE+0x1bd0d, %rcx
nop
xor %rsi, %rsi
movw $0x5152, (%rcx)
nop
nop
nop
nop
nop
cmp %r9, %r9
// Load
lea addresses_RW+0x180d9, %rcx
and $24864, %r12
vmovups (%rcx), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %r8
nop
nop
nop
nop
and %rcx, %rcx
// Store
lea addresses_WC+0x13929, %r13
nop
nop
nop
nop
nop
dec %r12
mov $0x5152535455565758, %rcx
movq %rcx, (%r13)
and $14054, %rcx
// Store
lea addresses_PSE+0x1d459, %r13
and %rsi, %rsi
mov $0x5152535455565758, %r8
movq %r8, (%r13)
nop
nop
nop
nop
nop
and %r8, %r8
// Store
lea addresses_normal+0x5ac7, %rbp
nop
add %r9, %r9
movb $0x51, (%rbp)
nop
nop
nop
nop
add $1697, %r12
// Store
lea addresses_WT+0x18159, %rsi
nop
nop
nop
nop
sub %rcx, %rcx
movb $0x51, (%rsi)
nop
cmp %rsi, %rsi
// Faulty Load
lea addresses_D+0xc4d9, %rbp
add %r13, %r13
mov (%rbp), %r12d
lea oracles, %r9
and $0xff, %r12
shlq $12, %r12
mov (%r9,%r12,1), %r12
pop %rsi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_WT', 'size': 2, 'AVXalign': True}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_PSE', 'size': 2, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_RW', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WC', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_PSE', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_normal', 'size': 1, 'AVXalign': True}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WT', 'size': 1, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
src/Data/Fin/Subset/Properties/Dec.agda | tizmd/agda-finitary | 0 | 12897 | {-# OPTIONS --safe --without-K #-}
module Data.Fin.Subset.Properties.Dec where
open import Data.Nat as ℕ
open import Data.Fin as Fin
open import Data.Empty using (⊥-elim)
open import Data.Fin.Subset
open import Data.Fin.Subset.Dec
open import Data.Fin.Subset.Properties using (⊆⊤; p⊆p∪q; q⊆p∪q ; p∩q⊆p ; p∩q⊆q ; ⊆-poset)
open import Relation.Nullary
open import Relation.Binary
open import Relation.Binary.PropositionalEquality
open import Relation.Unary renaming (Decidable to Decidable₁) using ()
open import Data.Vec
open import Function using (_∘_)
open import Function.Equivalence using (_⇔_ ; equivalence)
open import Relation.Nullary.Negation using (¬?)
subset¬⊆∁subset : ∀ {n}{p} {P : Fin n → Set p}(P? : Decidable₁ P) → subset (¬? ∘ P?) ⊆ ∁ (subset P?)
subset¬⊆∁subset {zero} P? ()
subset¬⊆∁subset {suc n} P? x∈s with P? (# 0)
subset¬⊆∁subset {suc n} P? here | no ¬p0 = here
subset¬⊆∁subset {suc n} P? (there x∈s) | no ¬p0 = there (subset¬⊆∁subset (P? ∘ suc) x∈s)
subset¬⊆∁subset {suc n} P? (there x∈s) | yes p0 = there (subset¬⊆∁subset (P? ∘ suc) x∈s)
∁subset⊆subset¬ : ∀ {n}{p}{P : Fin n → Set p}(P? : Decidable₁ P) → ∁ (subset P?) ⊆ subset (¬? ∘ P?)
∁subset⊆subset¬ {zero} P? ()
∁subset⊆subset¬ {suc n} P? x∈s with P? (# 0)
∁subset⊆subset¬ {suc n} P? here | no ¬p0 = here
∁subset⊆subset¬ {suc n} P? (there x∈s) | yes p0 = there (∁subset⊆subset¬ (P? ∘ suc) x∈s)
∁subset⊆subset¬ {suc n} P? (there x∈s) | no ¬p0 = there (∁subset⊆subset¬ (P? ∘ suc) x∈s)
subset¬≡∁subset : ∀ {n}{p}{P : Fin n → Set p}(P? : Decidable₁ P) → subset (¬? ∘ P?) ≡ ∁ (subset P?)
subset¬≡∁subset {n} P? = ⊆-antisym (subset¬⊆∁subset P?) (∁subset⊆subset¬ P?)
where
open Poset (⊆-poset n) renaming (antisym to ⊆-antisym) using ()
∈subset⁺ : ∀ {n}{p}{P : Fin n → Set p}(P? : Decidable₁ P){x} → P x → x ∈ subset P?
∈subset⁺ {zero} P? {()} Px
∈subset⁺ {suc n} P? {x} Px with P? (# 0)
∈subset⁺ {suc n} P? {zero} Px | yes p0 = here
∈subset⁺ {suc n} P? {suc x} Px | yes p0 = there (∈subset⁺ (P? ∘ suc) Px)
∈subset⁺ {suc n} P? {zero} Px | no ¬p0 = ⊥-elim (¬p0 Px)
∈subset⁺ {suc n} P? {suc x} Px | no ¬p0 = there (∈subset⁺ (P? ∘ suc) Px)
∈subset⁻ : ∀ {n}{p} {P : Fin n → Set p}(P? : Decidable₁ P){x} → x ∈ subset P? → P x
∈subset⁻ {zero} P? {()} x∈s
∈subset⁻ {suc n} P? {x} x∈s with P? (# 0)
∈subset⁻ {suc n} P? {zero} here | yes p0 = p0
∈subset⁻ {suc n} P? {suc x} (there x∈s) | yes p0 = ∈subset⁻ (P? ∘ suc) x∈s
∈subset⁻ {suc n} P? {.(suc _)} (there x∈s) | no ¬p0 = ∈subset⁻ (P? ∘ suc) x∈s
⇔∈subset : ∀ {n}{p}{P : Fin n → Set p}(P? : Decidable₁ P) {x} → x ∈ subset P? ⇔ P x
⇔∈subset P? = equivalence (∈subset⁻ P?) (∈subset⁺ P?)
∈∁subset⁺ : ∀ {n}{p}{P : Fin n → Set p}(P? : Decidable₁ P){x} → ¬ P x → x ∈ ∁ (subset P?)
∈∁subset⁺ P? = subset¬⊆∁subset P? ∘ (∈subset⁺ (¬? ∘ P? ))
∈∁subset⁻ : ∀ {n}{p}{P : Fin n → Set p}(P? : Decidable₁ P){x} → x ∈ ∁ (subset P?) → ¬ P x
∈∁subset⁻ P? = ∈subset⁻ (¬? ∘ P?) ∘ ∁subset⊆subset¬ P?
⇔∈∁subset : ∀ {n}{p}{P : Fin n → Set p}(P? : Decidable₁ P) {x} → x ∈ ∁ (subset P?) ⇔ (¬ P x)
⇔∈∁subset P? = equivalence (∈∁subset⁻ P?) (∈∁subset⁺ P?)
|
test/Fail/Issue2576MissingData.agda | shlevy/agda | 1,989 | 6197 | <reponame>shlevy/agda
module _ (A : Set) where
data A where
|
programs/oeis/095/A095248.asm | karttu/loda | 0 | 172699 | <gh_stars>0
; A095248: a(n) = least k > 0 such that n-th partial sum is divisible by n if and only if n is not prime.
; 1,2,1,4,1,3,1,3,2,2,1,3,1,3,2,2,1,3,1,3,2,2,1,3,2,2,2,2,1,3,1,3,2,2,2,2,1,3,2,2,1,3,1,3,2,2,1,3,2,2,2,2,1,3,2,2,2,2,1,3,1,3,2,2,2,2,1,3,2,2,1,3,1,3,2,2,2,2,1,3,2,2,1,3,2,2,2,2,1,3,2,2,2,2,2,2,1,3,2,2,1,3,1,3,2,2,1,3,1,3,2,2,1,3,2,2,2,2,2,2,2,2,2,2,2,2,1,3,2,2,1,3,2,2,2,2,1,3,1,3,2,2,2,2,2,2,2,2,1,3,1,3,2,2,2,2,1,3,2,2,2,2,1,3,2,2,1,3,2,2,2,2,1,3,2,2,2,2,1,3,1,3,2,2,2,2,2,2,2,2,1,3,1,3,2,2,1,3,1,3,2,2,2,2,2,2,2,2,2,2,1,3,2,2,2,2,2,2,2,2,2,2,1,3,2,2,1,3,1,3,2,2,1,3,2,2,2,2,1,3,1,3,2,2,2,2,2,2,2,2
mov $31,$0
mov $33,2
lpb $33,1
mov $0,$31
sub $33,1
add $0,$33
sub $0,1
mov $27,$0
mov $29,2
lpb $29,1
clr $0,27
mov $0,$27
sub $29,1
add $0,$29
sub $0,1
cal $0,333996 ; Number of composite numbers in the triangular n X n multiplication table.
add $3,2
mov $5,$0
mul $0,2
mov $26,$5
cmp $26,0
add $5,$26
mod $3,$5
lpb $5,1
sub $0,$3
div $0,2
mov $5,$3
lpe
mov $1,$0
mov $30,$29
lpb $30,1
mov $28,$1
sub $30,1
lpe
lpe
lpb $27,1
mov $27,0
sub $28,$1
lpe
mov $1,$28
mov $34,$33
lpb $34,1
mov $32,$1
sub $34,1
lpe
lpe
lpb $31,1
mov $31,0
sub $32,$1
lpe
mov $1,$32
add $1,1
|
src/LibraBFT/Base/Util.agda | LaudateCorpus1/bft-consensus-agda | 4 | 12684 | {- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2021, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import Level using (0ℓ)
open import Data.String
-- This module defines utility functions to help working on proofs.
module LibraBFT.Base.Util where
-- These should obviously not be used in any legitimate proof. They are just for convenience when
-- we want to avoid importing a module with open holes while working on something else.
-- This variant allows a comment to be attached conveniently
obm-dangerous-magic' : ∀ {ℓ} {A : Set ℓ} → String → A
obm-dangerous-magic' {ℓ} {A} _ = magic
where postulate magic : A
obm-dangerous-magic! : ∀ {ℓ} {A : Set ℓ} → A
obm-dangerous-magic! {ℓ} {A} = obm-dangerous-magic' ""
|
programs/oeis/157/A157371.asm | neoneye/loda | 22 | 247442 | <reponame>neoneye/loda
; A157371: a(n) = (n+1)*(9-9*n+5*n^2-n^3).
; 9,8,9,0,-55,-216,-567,-1216,-2295,-3960,-6391,-9792,-14391,-20440,-28215,-38016,-50167,-65016,-82935,-104320,-129591,-159192,-193591,-233280,-278775,-330616,-389367,-455616,-529975,-613080,-705591,-808192,-921591,-1046520,-1183735,-1334016,-1498167,-1677016,-1871415,-2082240,-2310391,-2556792,-2822391,-3108160,-3415095,-3744216,-4096567,-4473216,-4875255,-5303800,-5759991,-6244992,-6759991,-7306200,-7884855,-8497216,-9144567,-9828216,-10549495,-11309760,-12110391,-12952792,-13838391,-14768640,-15745015,-16769016,-17842167,-18966016,-20142135,-21372120,-22657591,-24000192,-25401591,-26863480,-28387575,-29975616,-31629367,-33350616,-35141175,-37002880,-38937591,-40947192,-43033591,-45198720,-47444535,-49773016,-52186167,-54686016,-57274615,-59954040,-62726391,-65593792,-68558391,-71622360,-74787895,-78057216,-81432567,-84916216,-88510455,-92217600
sub $0,1
pow $0,2
sub $0,1
pow $0,2
sub $0,9
sub $1,$0
mov $0,$1
|
alloy4fun_models/trashltl/models/4/YyfNaSNzzmz5dji4m.als | Kaixi26/org.alloytools.alloy | 0 | 759 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idYyfNaSNzzmz5dji4m_prop5 {
some f : File - Protected | f not in Trash and eventually f in Trash
}
pred __repair { idYyfNaSNzzmz5dji4m_prop5 }
check __repair { idYyfNaSNzzmz5dji4m_prop5 <=> prop5o } |
lib/ending.asm | cppchriscpp/waddles-the-duck | 0 | 103411 | <gh_stars>0
/*
* WARNING: This file is the eptimome of deadline-induced bad practice.. while this definitely works,
* it is far from elegant code, and is probably hard to read. You're welcome to use it as an example,
* but I strongly suggest looking elsewhere. You have been warned.
*/
.macro draw_nametable name
set_ppu_addr $2000
store #<(name), tempAddr
store #>(name), tempAddr+1
jsr PKB_unpackblk
.endmacro
.macro draw_sprites name
jsr clear_sprites
store #<(name), tempAddr
store #>(name), tempAddr+1
jsr draw_title_sprites_origin
.endmacro
.macro draw_full_screen screen, sprites
jsr vblank_wait
jsr disable_all
jsr vblank_wait
jsr sound_update
draw_nametable screen
draw_sprites sprites
reset_ppu_scrolling_and_ctrl
jsr vblank_wait
jsr enable_all
jsr sound_update
.endmacro
; Why have estimated stats when you can put the real ones in?
draw_real_credits_numbers:
write_string .sprintf("% 6d", BUILD), $22f8
write_string .sprintf("% 6d", CODE_LINE_COUNT), $2318
write_string .sprintf("% 6d", COMMIT_COUNT), $2358
rts
.macro draw_ending_screen num
draw_full_screen .ident(.concat("ending_tile_", .string(num))), .ident(.concat("ending_sprites_", .string(num)))
.endmacro
.macro draw_good_ending_screen num
draw_full_screen .ident(.concat("good_ending_tile_", .string(num))), .ident(.concat("good_ending_sprites_", .string(num)))
.endmacro
.macro draw_ending_text_only num
draw_full_screen .ident(.concat("ending_tile_", .string(num))), .ident(.concat("ending_sprites_", .string(num)))
.endmacro
show_good_ending:
lda #SONG_GOOD_ENDING
jsr music_play
lda #1
jsr music_pause
lda #SFX_WARP
ldx #FT_SFX_CH0
jsr sfx_play
jsr disable_all
lda #%11001000
sta ppuCtrlBuffer
lda #0
sta scrollX
sta scrollY
reset_ppu_scrolling_and_ctrl
lda #MENU_PALETTE_ID
sta currentPalette
lda #$0f
sta currentBackgroundColorOverride
lda #0 ; High-resolution timer for events... tempe = lo, tempf = hi
sta tempe
sta tempf
jsr vblank_wait
set_ppu_addr $3f00
lda #$0f
ldx #0
@loop_pal:
sta PPU_DATA
inx
cpx #32
bne @loop_pal
draw_good_ending_screen 1
reset_ppu_scrolling_and_ctrl
jsr vblank_wait
jsr vblank_wait
jsr enable_all
@loop:
jsr sound_update
jsr read_controller
jsr draw_title_sprites
inc tempe
lda #0
cmp tempe
bne @no_increment
inc tempf
@no_increment:
jsr vblank_wait
bne16 100, tempe, @not_firstfade
jsr do_menu_fade_in
@not_firstfade:
bne16 689, tempe, @not_1st_fadeout
jsr do_menu_fade_out
@not_1st_fadeout:
; Look up where in the cycle we are and if we need to take action.
bne16 690, tempe, @not_2nd
draw_good_ending_screen 2
@not_2nd:
bne16 720, tempe, @not_2nd_fadein
jsr do_menu_fade_in
lda #0
jsr music_pause
@not_2nd_fadein:
bne16 1449, tempe, @not_2nd_fadeout
jsr do_menu_fade_out
@not_2nd_fadeout:
bne16 1450, tempe, @not_3rd
draw_good_ending_screen 3
@not_3rd:
bne16 1480, tempe, @not_3rd_fadein
jsr do_menu_fade_in
@not_3rd_fadein:
bne16 2109, tempe, @not_3rd_fadeout
jsr do_menu_fade_out
@not_3rd_fadeout:
bne16 2110, tempe, @not_4th
draw_good_ending_screen 4
@not_4th:
bne16 2140, tempe, @not_4th_fadein
jsr do_menu_fade_in
@not_4th_fadein:
bne16 2849, tempe, @not_4th_fadeout
jsr do_menu_fade_out
@not_4th_fadeout:
bne16 2850, tempe, @not_5th
draw_good_ending_screen 5
@not_5th:
bne16 2880, tempe, @not_5th_fadein
jsr do_menu_fade_in
@not_5th_fadein:
bne16 3509, tempe, @not_5th_fadeout
jsr do_menu_fade_out
@not_5th_fadeout:
bne16 3510, tempe, @not_credits_1
jsr disable_all
jsr vblank_wait
jsr sound_update
draw_nametable credits_tile_1
jsr draw_real_credits_numbers
reset_ppu_scrolling_and_ctrl
jsr clear_sprites
jsr vblank_wait
jsr sound_update
jsr enable_all
@not_credits_1:
bne16 3540, tempe, @not_credits_1_fadein
jsr do_menu_fade_in
@not_credits_1_fadein:
bne16 4269, tempe, @not_credits_1_fadeout
jsr do_menu_fade_out
@not_credits_1_fadeout:
bne16 4270, tempe, @not_credits_2
jsr disable_all
jsr vblank_wait
jsr sound_update
draw_nametable credits_tile_2
reset_ppu_scrolling_and_ctrl
jsr vblank_wait
jsr sound_update
jsr enable_all
@not_credits_2:
bne16 4300, tempe, @not_credits_2_fadein
jsr do_menu_fade_in
@not_credits_2_fadein:
bne16 5029, tempe, @not_credits_2_fadeout
jsr do_menu_fade_out
@not_credits_2_fadeout:
bne16 5030, tempe, @not_the_end
jsr disable_all
jsr vblank_wait
jsr sound_update
draw_nametable the_end_tile
reset_ppu_scrolling_and_ctrl
draw_sprites the_end_sprites
jsr vblank_wait
jsr sound_update
jsr enable_all
@not_the_end:
bne16 5060, tempe, @not_the_end_fade_in
jsr do_menu_fade_in
@not_the_end_fade_in:
bcs16 5040, tempe, @no_input
; Once you get to the end, hit start to continue
lda ctrlButtons
and #CONTROLLER_START
cmp #0
beq @no_input
jmp reset ; Welp, it was nice knowing you...
@no_input:
jmp @loop
show_bad_ending:
lda #SONG_BAD_ENDING
jsr music_play
lda #1
jsr music_pause
lda #SFX_WARP
ldx #FT_SFX_CH0
jsr sfx_play
lda #%11001000
sta ppuCtrlBuffer
lda #0
sta scrollX
sta scrollY
reset_ppu_scrolling_and_ctrl
lda #MENU_PALETTE_ID
sta currentPalette
lda #$0f
sta currentBackgroundColorOverride
lda #0 ; High-resolution timer for events... tempe = lo, tempf = hi
sta tempe
sta tempf
jsr vblank_wait
set_ppu_addr $3f00
lda #$0f
ldx #0
@loop_pal:
sta PPU_DATA
inx
cpx #32
bne @loop_pal
draw_ending_screen 1
reset_ppu_scrolling_and_ctrl
jsr vblank_wait
jsr vblank_wait
jsr enable_all
@loop:
jsr sound_update
jsr read_controller
jsr draw_title_sprites
inc tempe
lda #0
cmp tempe
bne @no_increment
inc tempf
@no_increment:
jsr vblank_wait
bne16 100, tempe, @not_musica
jsr do_menu_fade_in
lda #0
jsr music_pause
@not_musica:
bne16 689, tempe, @not_1st_fadeout
jsr do_menu_fade_out
@not_1st_fadeout:
; Look up where in the cycle we are and if we need to take action.
bne16 690, tempe, @not_2nd
draw_ending_screen 2
@not_2nd:
bne16 720, tempe, @not_2nd_fadein
jsr do_menu_fade_in
@not_2nd_fadein:
bne16 1449, tempe, @not_2nd_fadeout
jsr do_menu_fade_out
@not_2nd_fadeout:
bne16 1450, tempe, @not_3rd
draw_ending_screen 3
@not_3rd:
bne16 1480, tempe, @not_3rd_fadein
jsr do_menu_fade_in
@not_3rd_fadein:
bne16 2109, tempe, @not_3rd_fadeout
jsr do_menu_fade_out
@not_3rd_fadeout:
bne16 2110, tempe, @not_4th
draw_ending_screen 4
@not_4th:
bne16 2140, tempe, @not_4th_fadein
jsr do_menu_fade_in
@not_4th_fadein:
bne16 2849, tempe, @not_4th_fadeout
jsr do_menu_fade_out
@not_4th_fadeout:
bne16 2850, tempe, @not_5th
draw_ending_screen 5
@not_5th:
bne16 2880, tempe, @not_5th_fadein
jsr do_menu_fade_in
@not_5th_fadein:
bne16 3509, tempe, @not_5th_fadeout
jsr do_menu_fade_out
@not_5th_fadeout:
bne16 3510, tempe, @not_credits_1
jsr disable_all
jsr vblank_wait
jsr sound_update
draw_nametable credits_tile_1
jsr draw_real_credits_numbers
reset_ppu_scrolling_and_ctrl
jsr clear_sprites
jsr vblank_wait
jsr sound_update
jsr enable_all
@not_credits_1:
bne16 3540, tempe, @not_credits_1_fadein
jsr do_menu_fade_in
@not_credits_1_fadein:
bne16 4269, tempe, @not_credits_1_fadeout
jsr do_menu_fade_out
@not_credits_1_fadeout:
bne16 4270, tempe, @not_credits_2
jsr disable_all
jsr vblank_wait
jsr sound_update
draw_nametable credits_tile_2
reset_ppu_scrolling_and_ctrl
jsr vblank_wait
jsr sound_update
jsr enable_all
@not_credits_2:
bne16 4300, tempe, @not_credits_2_fadein
jsr do_menu_fade_in
@not_credits_2_fadein:
bne16 5029, tempe, @not_credits_2_fadeout
jsr do_menu_fade_out
@not_credits_2_fadeout:
bne16 5030, tempe, @not_the_end
jsr disable_all
jsr vblank_wait
jsr sound_update
draw_nametable the_end_question_tile
reset_ppu_scrolling_and_ctrl
jsr vblank_wait
jsr sound_update
jsr enable_all
@not_the_end:
bne16 5060, tempe, @not_the_end_fade_in
jsr do_menu_fade_in
@not_the_end_fade_in:
bcs16 5040, tempe, @no_input
; Once you get to the end, hit start to continue
lda ctrlButtons
and #CONTROLLER_START
cmp #0
beq @no_input
jmp reset ; Welp, it was nice knowing you...
@no_input:
jmp @loop
ending_tile_1:
.incbin "graphics/processed/bad_ending_0.nam.pkb"
ending_sprites_1:
.scope ENDING_SPRITE_0
DX1 = 60
DY1 = 48
.byte DY1, $c0, 0, DX1, DY1, $c1, 0, DX1+8, DY1, $c2, 0, DX1+16
.byte DY1+8, $d0, 0, DX1, DY1+8, $d1, 0, DX1+8, DY1+8, $d2, 0, DX1+16
DX2 = 160
DY2 = 48
.byte DY2, $c2, $40, DX2, DY2, $c1, $40, DX2+8, DY2, $c0, $40, DX2+16
.byte DY2+8, $d2, $40, DX2, DY2+8, $d1, $40, DX2+8, DY2+8, $d0, $40, DX2+16
DX3 = 190
DY3 = 68
.byte DY3, $c8, $40, DX3, DY3, $c7, $40, DX3+8, DY3, $c6, $40, DX3+16
.byte DY3+8, $d8, $40, DX3, DY3+8, $d7, $40, DX3+8, DY3+8, $d6, $40, DX3+16
.byte $ff
.byte $ff
.endscope
ending_tile_2:
.incbin "graphics/processed/bad_ending_1.nam.pkb"
ending_sprites_2:
ending_sprites_3:
ending_sprites_4:
.scope ENDING_SPRITE_1
DX1 = 60
DY1 = 48
.byte DY1, $c0, 0, DX1, DY1, $c1, 0, DX1+8, DY1, $c2, 0, DX1+16
.byte DY1+8, $d0, 0, DX1, DY1+8, $d1, 0, DX1+8, DY1+8, $d2, 0, DX1+16
DX2 = 90
DY2 = 38
.byte DY2, $c2, $40, DX2, DY2, $c1, $40, DX2+8, DY2, $c0, $40, DX2+16
.byte DY2+8, $d2, $40, DX2, DY2+8, $d1, $40, DX2+8, DY2+8, $d0, $40, DX2+16
DX3 = 90
DY3 = 62
.byte DY3, $c2, $40, DX3, DY3, $c1, $40, DX3+8, DY3, $c0, $40, DX3+16
.byte DY3+8, $d2, $40, DX3, DY3+8, $d1, $40, DX3+8, DY3+8, $d0, $40, DX3+16
.byte $ff
.endscope
ending_sprites_5:
.scope ENDING_SPRITE_5
DX1 = 100
DY1 = 48
.byte DY1, $c0, 0, DX1, DY1, $c1, 0, DX1+8, DY1, $c2, 0, DX1+16
.byte DY1+8, $d0, 0, DX1, DY1+8, $d1, 0, DX1+8, DY1+8, $d2, 0, DX1+16
.byte $ff
.endscope
ending_tile_3:
.incbin "graphics/processed/bad_ending_2.nam.pkb"
ending_tile_4:
.incbin "graphics/processed/bad_ending_3.nam.pkb"
ending_tile_5:
.incbin "graphics/processed/bad_ending_4.nam.pkb"
credits_tile_1:
.incbin "graphics/processed/credits_0.nam.pkb"
credits_tile_2:
.incbin "graphics/processed/credits_1.nam.pkb"
the_end_tile:
.incbin "graphics/processed/the_end.nam.pkb"
the_end_question_tile:
.incbin "graphics/processed/the_end_question.nam.pkb"
good_ending_tile_1:
.incbin "graphics/processed/good_ending_0.nam.pkb"
good_ending_tile_2:
.incbin "graphics/processed/good_ending_1.nam.pkb"
good_ending_tile_3:
.incbin "graphics/processed/good_ending_2.nam.pkb"
good_ending_tile_4:
.incbin "graphics/processed/good_ending_3.nam.pkb"
good_ending_tile_5:
.incbin "graphics/processed/good_ending_4.nam.pkb"
good_ending_sprites_1:
.byte $ff
good_ending_sprites_2:
good_ending_sprites_3:
good_ending_sprites_4:
.scope GOOD_ENDING_SPRITE_1
DX1 = 65
DY1 = 48
.byte DY1, $c0, 0, DX1, DY1, $c1, 0, DX1+8, DY1, $c2, 0, DX1+16
.byte DY1+8, $d0, 0, DX1, DY1+8, $d1, 0, DX1+8, DY1+8, $d2, 0, DX1+16
DX2 = 89
DY2 = 48
.byte DY2, $c2, $40, DX2, DY2, $c1, $40, DX2+8, DY2, $c0, $40, DX2+16
.byte DY2+8, $d2, $40, DX2, DY2+8, $d1, $40, DX2+8, DY2+8, $d0, $40, DX2+16
DX3 = 71
DY3 = 38
.byte DY3, $c4, 0, DX3, DY3, $c5, 0, DX3+8
DX4 = 71
DY4 = 68
.byte DY4, $c5, $40, DX4, DY4, $c4, $40, DX4+8
DX5 = 49
DY5 = 52
.byte DY5, $c4, 0, DX5, DY5, $c5, 0, DX5+8
.byte $ff
.endscope
good_ending_sprites_5:
.scope GOOD_ENDING_SPRITE_2
DX1 = 60
DY1 = 48
.byte DY1, $c0, 0, DX1, DY1, $c1, 0, DX1+8, DY1, $c2, 0, DX1+16
.byte DY1+8, $d0, 0, DX1, DY1+8, $d1, 0, DX1+8, DY1+8, $d2, 0, DX1+16
DX2 = 160
DY2 = 48
.byte DY2, $c2, $40, DX2, DY2, $c1, $40, DX2+8, DY2, $c0, $40, DX2+16
.byte DY2+8, $d2, $40, DX2, DY2+8, $d1, $40, DX2+8, DY2+8, $d0, $40, DX2+16
DX3 = 90
DY3 = 40
.byte DY3, $c4, 0, DX3, DY3, $c5, 0, DX3+8
DX4 = 140
DY4 = 40
.byte DY4, $c5, $40, DX4, DY4, $c4, $40, DX4+8
DX5 = 120
DY5 = 60
.byte DY5, $c4, 0, DX5, DY5, $c5, 0, DX5+8
.byte $ff
.endscope
the_end_sprites:
.scope THE_END_SPRITES
DX1 = 60
DY1 = 136
.byte DY1, $c0, 0, DX1, DY1, $c1, 0, DX1+8, DY1, $c2, 0, DX1+16
.byte DY1+8, $d0, 0, DX1, DY1+8, $d1, 0, DX1+8, DY1+8, $d2, 0, DX1+16
DX2 = 160
DY2 = 136
.byte DY2, $c2, $40, DX2, DY2, $c1, $40, DX2+8, DY2, $c0, $40, DX2+16
.byte DY2+8, $d2, $40, DX2, DY2+8, $d1, $40, DX2+8, DY2+8, $d0, $40, DX2+16
DX3 = 90
DY3 = 128
.byte DY3, $c4, 0, DX3, DY3, $c5, 0, DX3+8
DX4 = 140
DY4 = 128
.byte DY4, $c5, $40, DX4, DY4, $c4, $40, DX4+8
DX5 = 120
DY5 = 148
.byte DY5, $c4, 0, DX5, DY5, $c5, 0, DX5+8
.byte $ff
.endscope |
util/cv/dosrt.asm | olifink/smsqe | 0 | 175491 | ; Convert DOS time to real time V0.00 1993 <NAME>
section cv
xdef cv_dosrt
xref cv_mnths
;+++
; Convert DOS time to real time
;
; d1 cr dos time / real time
; status return 0
;---
cv_dosrt
drt.reg reg d2/d3
move.l d1,d0
beq.s drt_rts
movem.l drt.reg,-(sp)
swap d1 ; work on day
move.w d1,d2
lsr.w #8,d2
lsr.w #1,d2 ; year since 1980
move.w d2,d0 ; keep it
mulu #365,d0 ; day
lsr.w #2,d2
add.w d0,d2 ; corrector for leap year
moveq #%11111,d0
and.w d1,d0
add.w d0,d2 ; + day
move.w #%111100000,d0
and.w d1,d0
lsr.w #4,d0
move.w cv_mnths-2(pc,d0.w),d0
add.w d0,d2 ; + start of month
and.w #%11111100000,d1 ; 2 lsbits of year + month
cmp.w #%00001000000,d1 ; January / February in leap year
bgt.s drt_base ; ... no
subq.w #1,d2 ; yes, we've gone too far
drt_base
add.w #19*365+4,d2 ; adjust base to 1961
; the day is done, now the time
swap d1
move.w #%1111100000000000,d0
and.w d1,d0 ; hours * 64 * 32
move.w d0,d3
lsr.w #4,d0 ; hours * 4 * 32
sub.w d0,d3 ; hours * 60 * 32
move.w #%11111100000,d0
and.w d1,d0 ; minutes * 32
add.w d0,d3 ; ((hours * 60) + minutes) * 32
move.w d3,d0
lsr.w #4,d0 ; ... * 2
sub.w d0,d3 ; ((hours * 60) + minutes) * 30
and.l #%11111,d1
add.w d3,d1 ; time of day in 2 second units
mulu #24*60*30,d2 ; date in 2 second units
add.l d2,d1
add.l d1,d1 ; real time
moveq #0,d0
movem.l (sp)+,drt.reg
drt_rts
rts
end
|
test/asset/agda-stdlib-1.0/Algebra/Properties/Group.agda | omega12345/agda-mode | 0 | 6494 | <gh_stars>0
------------------------------------------------------------------------
-- The Agda standard library
--
-- Some derivable properties
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Algebra
module Algebra.Properties.Group {g₁ g₂} (G : Group g₁ g₂) where
open Group G
open import Algebra.FunctionProperties _≈_
open import Relation.Binary.Reasoning.Setoid setoid
open import Function
open import Data.Product
⁻¹-involutive : ∀ x → x ⁻¹ ⁻¹ ≈ x
⁻¹-involutive x = begin
x ⁻¹ ⁻¹ ≈⟨ sym $ identityʳ _ ⟩
x ⁻¹ ⁻¹ ∙ ε ≈⟨ ∙-congˡ $ sym (inverseˡ _) ⟩
x ⁻¹ ⁻¹ ∙ (x ⁻¹ ∙ x) ≈⟨ sym $ assoc _ _ _ ⟩
x ⁻¹ ⁻¹ ∙ x ⁻¹ ∙ x ≈⟨ ∙-congʳ $ inverseˡ _ ⟩
ε ∙ x ≈⟨ identityˡ _ ⟩
x ∎
private
left-helper : ∀ x y → x ≈ (x ∙ y) ∙ y ⁻¹
left-helper x y = begin
x ≈⟨ sym (identityʳ x) ⟩
x ∙ ε ≈⟨ ∙-congˡ $ sym (inverseʳ y) ⟩
x ∙ (y ∙ y ⁻¹) ≈⟨ sym (assoc x y (y ⁻¹)) ⟩
(x ∙ y) ∙ y ⁻¹ ∎
right-helper : ∀ x y → y ≈ x ⁻¹ ∙ (x ∙ y)
right-helper x y = begin
y ≈⟨ sym (identityˡ y) ⟩
ε ∙ y ≈⟨ ∙-congʳ $ sym (inverseˡ x) ⟩
(x ⁻¹ ∙ x) ∙ y ≈⟨ assoc (x ⁻¹) x y ⟩
x ⁻¹ ∙ (x ∙ y) ∎
left-identity-unique : ∀ x y → x ∙ y ≈ y → x ≈ ε
left-identity-unique x y eq = begin
x ≈⟨ left-helper x y ⟩
(x ∙ y) ∙ y ⁻¹ ≈⟨ ∙-congʳ eq ⟩
y ∙ y ⁻¹ ≈⟨ inverseʳ y ⟩
ε ∎
right-identity-unique : ∀ x y → x ∙ y ≈ x → y ≈ ε
right-identity-unique x y eq = begin
y ≈⟨ right-helper x y ⟩
x ⁻¹ ∙ (x ∙ y) ≈⟨ refl ⟨ ∙-cong ⟩ eq ⟩
x ⁻¹ ∙ x ≈⟨ inverseˡ x ⟩
ε ∎
identity-unique : ∀ {x} → Identity x _∙_ → x ≈ ε
identity-unique {x} id = left-identity-unique x x (proj₂ id x)
left-inverse-unique : ∀ x y → x ∙ y ≈ ε → x ≈ y ⁻¹
left-inverse-unique x y eq = begin
x ≈⟨ left-helper x y ⟩
(x ∙ y) ∙ y ⁻¹ ≈⟨ ∙-congʳ eq ⟩
ε ∙ y ⁻¹ ≈⟨ identityˡ (y ⁻¹) ⟩
y ⁻¹ ∎
right-inverse-unique : ∀ x y → x ∙ y ≈ ε → y ≈ x ⁻¹
right-inverse-unique x y eq = begin
y ≈⟨ sym (⁻¹-involutive y) ⟩
y ⁻¹ ⁻¹ ≈⟨ ⁻¹-cong (sym (left-inverse-unique x y eq)) ⟩
x ⁻¹ ∎
|
programs/oeis/130/A130822.asm | karttu/loda | 0 | 22810 | <gh_stars>0
; A130822: Two 1's, one 2, four 3's, three 4's ...
; 1,1,2,3,3,3,3,4,4,4,5,5,5,5,5,5,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12
trn $0,1
mov $1,1
lpb $0,1
trn $0,$1
add $1,$0
add $1,$0
add $1,2
mov $2,$0
add $0,1
sub $1,$0
mov $0,$2
trn $0,1
sub $1,$0
trn $0,$1
lpe
|
legacy-core/src/test/resources/dm/TST-ForeignKeyChanges.ads | greifentor/archimedes-legacy | 0 | 29272 | <Diagramm>
<AdditionalSQLCode>
<SQLCode>
<AdditionalSQLCodePostChanging></AdditionalSQLCodePostChanging>
<AdditionalSQLCodePostReducing></AdditionalSQLCodePostReducing>
<AdditionalSQLCodePreChanging></AdditionalSQLCodePreChanging>
<AdditionalSQLCodePreExtending></AdditionalSQLCodePreExtending>
</SQLCode>
</AdditionalSQLCode>
<Colors>
<Anzahl>23</Anzahl>
<Color0>
<B>255</B>
<G>0</G>
<Name>blau</Name>
<R>0</R>
</Color0>
<Color1>
<B>221</B>
<G>212</G>
<Name>blaugrau</Name>
<R>175</R>
</Color1>
<Color10>
<B>192</B>
<G>192</G>
<Name>hellgrau</Name>
<R>192</R>
</Color10>
<Color11>
<B>255</B>
<G>0</G>
<Name>kamesinrot</Name>
<R>255</R>
</Color11>
<Color12>
<B>0</B>
<G>200</G>
<Name>orange</Name>
<R>255</R>
</Color12>
<Color13>
<B>255</B>
<G>247</G>
<Name>pastell-blau</Name>
<R>211</R>
</Color13>
<Color14>
<B>186</B>
<G>245</G>
<Name>pastell-gelb</Name>
<R>255</R>
</Color14>
<Color15>
<B>234</B>
<G>255</G>
<Name>pastell-gr&uuml;n</Name>
<R>211</R>
</Color15>
<Color16>
<B>255</B>
<G>211</G>
<Name>pastell-lila</Name>
<R>244</R>
</Color16>
<Color17>
<B>191</B>
<G>165</G>
<Name>pastell-rot</Name>
<R>244</R>
</Color17>
<Color18>
<B>175</B>
<G>175</G>
<Name>pink</Name>
<R>255</R>
</Color18>
<Color19>
<B>0</B>
<G>0</G>
<Name>rot</Name>
<R>255</R>
</Color19>
<Color2>
<B>61</B>
<G>125</G>
<Name>braun</Name>
<R>170</R>
</Color2>
<Color20>
<B>0</B>
<G>0</G>
<Name>schwarz</Name>
<R>0</R>
</Color20>
<Color21>
<B>255</B>
<G>255</G>
<Name>t&uuml;rkis</Name>
<R>0</R>
</Color21>
<Color22>
<B>255</B>
<G>255</G>
<Name>wei&szlig;</Name>
<R>255</R>
</Color22>
<Color3>
<B>64</B>
<G>64</G>
<Name>dunkelgrau</Name>
<R>64</R>
</Color3>
<Color4>
<B>84</B>
<G>132</G>
<Name>dunkelgr&uuml;n</Name>
<R>94</R>
</Color4>
<Color5>
<B>0</B>
<G>255</G>
<Name>gelb</Name>
<R>255</R>
</Color5>
<Color6>
<B>0</B>
<G>225</G>
<Name>goldgelb</Name>
<R>255</R>
</Color6>
<Color7>
<B>128</B>
<G>128</G>
<Name>grau</Name>
<R>128</R>
</Color7>
<Color8>
<B>0</B>
<G>255</G>
<Name>gr&uuml;n</Name>
<R>0</R>
</Color8>
<Color9>
<B>255</B>
<G>212</G>
<Name>hellblau</Name>
<R>191</R>
</Color9>
</Colors>
<ComplexIndices>
<IndexCount>0</IndexCount>
</ComplexIndices>
<DataSource>
<Import>
<DBName></DBName>
<Description></Description>
<Domains>false</Domains>
<Driver></Driver>
<Name></Name>
<Referenzen>false</Referenzen>
<User></User>
</Import>
</DataSource>
<DatabaseConnections>
<Count>2</Count>
<DatabaseConnection0>
<DBExecMode>POSTGRESQL</DBExecMode>
<Driver>org.postgresql.Driver</Driver>
<Name>Test-DB (Postgre)</Name>
<Quote>"</Quote>
<SetDomains>false</SetDomains>
<SetNotNull>true</SetNotNull>
<SetReferences>true</SetReferences>
<URL>jdbc:postgresql://mykene/TEST_OLI_ISIS_2</URL>
<UserName>op1</UserName>
</DatabaseConnection0>
<DatabaseConnection1>
<DBExecMode>HSQL</DBExecMode>
<Driver>org.hsqldb.jdbcDriver</Driver>
<Name>Test-DB (HSQL)</Name>
<Quote>"</Quote>
<SetDomains>false</SetDomains>
<SetNotNull>true</SetNotNull>
<SetReferences>true</SetReferences>
<URL>jdbc:hsqldb:unittests/db/tst</URL>
<UserName>sa</UserName>
</DatabaseConnection1>
</DatabaseConnections>
<DefaultComment>
<Anzahl>0</Anzahl>
</DefaultComment>
<Domains>
<Anzahl>4</Anzahl>
<Domain0>
<Datatype>-5</Datatype>
<History></History>
<Initialwert>NULL</Initialwert>
<Kommentar></Kommentar>
<Length>0</Length>
<NKS>0</NKS>
<Name>Ident</Name>
<Parameters></Parameters>
</Domain0>
<Domain1>
<Datatype>12</Datatype>
<History></History>
<Initialwert>NULL</Initialwert>
<Kommentar></Kommentar>
<Length>500</Length>
<NKS>0</NKS>
<Name>LongName</Name>
<Parameters></Parameters>
</Domain1>
<Domain2>
<Datatype>12</Datatype>
<History></History>
<Initialwert>NULL</Initialwert>
<Kommentar></Kommentar>
<Length>200</Length>
<NKS>0</NKS>
<Name>Name</Name>
<Parameters></Parameters>
</Domain2>
<Domain3>
<Datatype>2</Datatype>
<History></History>
<Initialwert>NULL</Initialwert>
<Kommentar></Kommentar>
<Length>8</Length>
<NKS>2</NKS>
<Name>Price</Name>
<Parameters></Parameters>
</Domain3>
</Domains>
<Factories>
<Object>archimedes.legacy.scheme.DefaultObjectFactory</Object>
</Factories>
<Pages>
<PerColumn>5</PerColumn>
<PerRow>10</PerRow>
</Pages>
<Parameter>
<AdditionalSQLScriptListener></AdditionalSQLScriptListener>
<Applicationname></Applicationname>
<AufgehobeneAusblenden>false</AufgehobeneAusblenden>
<Autor>&lt;null&gt;</Autor>
<Basepackagename></Basepackagename>
<CodeFactoryClassName></CodeFactoryClassName>
<Codebasispfad>.\</Codebasispfad>
<DBVersionDBVersionColumn></DBVersionDBVersionColumn>
<DBVersionDescriptionColumn></DBVersionDescriptionColumn>
<DBVersionTablename></DBVersionTablename>
<History></History>
<Kommentar>&lt;null&gt;</Kommentar>
<Name>TST</Name>
<Optionen>
<Anzahl>0</Anzahl>
</Optionen>
<PflichtfelderMarkieren>false</PflichtfelderMarkieren>
<ReferenzierteSpaltenAnzeigen>true</ReferenzierteSpaltenAnzeigen>
<RelationColorExternalTables>hellgrau</RelationColorExternalTables>
<RelationColorRegular>schwarz</RelationColorRegular>
<SchemaName>TST</SchemaName>
<Schriftgroessen>
<Tabelleninhalte>12</Tabelleninhalte>
<Ueberschriften>24</Ueberschriften>
<Untertitel>12</Untertitel>
</Schriftgroessen>
<Scripte>
<AfterWrite>&lt;null&gt;</AfterWrite>
</Scripte>
<TechnischeFelderAusgrauen>false</TechnischeFelderAusgrauen>
<TransienteFelderAusgrauen>false</TransienteFelderAusgrauen>
<UdschebtiBaseClassName></UdschebtiBaseClassName>
<Version>1</Version>
<Versionsdatum>08.12.2015</Versionsdatum>
<Versionskommentar>&lt;null&gt;</Versionskommentar>
</Parameter>
<Sequences>
<Count>0</Count>
</Sequences>
<Stereotype>
<Anzahl>0</Anzahl>
</Stereotype>
<Tabellen>
<Anzahl>2</Anzahl>
<Tabelle0>
<Aufgehoben>false</Aufgehoben>
<Codegenerator>
<AuswahlMembers>
<Anzahl>0</Anzahl>
</AuswahlMembers>
<CompareMembers>
<Anzahl>0</Anzahl>
</CompareMembers>
<Equalsmembers>
<Anzahl>0</Anzahl>
</Equalsmembers>
<HashCodeMembers>
<Anzahl>0</Anzahl>
</HashCodeMembers>
<NReferenzen>
<Anzahl>0</Anzahl>
</NReferenzen>
<OrderMembers>
<Anzahl>0</Anzahl>
</OrderMembers>
<ToComboStringMembers>
<Anzahl>0</Anzahl>
</ToComboStringMembers>
<ToStringMembers>
<Anzahl>0</Anzahl>
</ToStringMembers>
</Codegenerator>
<ExternalTable>false</ExternalTable>
<Farben>
<Hintergrund>wei&szlig;</Hintergrund>
<Schrift>schwarz</Schrift>
</Farben>
<FirstGenerationDone>false</FirstGenerationDone>
<History>@changed OLI - Added.$BR$@changed OLI - Added column: Id.</History>
<InDevelopment>false</InDevelopment>
<Kommentar></Kommentar>
<NMRelation>false</NMRelation>
<Name>Author</Name>
<Options>
<Count>0</Count>
</Options>
<Panels>
<Anzahl>1</Anzahl>
<Panel0>
<PanelClass></PanelClass>
<PanelNumber>0</PanelNumber>
<TabMnemonic>1</TabMnemonic>
<TabTitle>1.Daten</TabTitle>
<TabToolTipText>Hier können Sie die Daten des Objekt warten</TabToolTipText>
</Panel0>
</Panels>
<Spalten>
<Anzahl>4</Anzahl>
<Codegenerator>
<ActiveInApplication>false</ActiveInApplication>
<AdditionalCreateConstraints></AdditionalCreateConstraints>
<Codegeneratoroptionen></Codegeneratoroptionen>
<Codeverzeichnis>.</Codeverzeichnis>
<Codieren>true</Codieren>
<DynamicCode>true</DynamicCode>
<Inherited>false</Inherited>
<Kontextname></Kontextname>
<UniqueFormula></UniqueFormula>
</Codegenerator>
<Spalte0>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>true</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar></Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Author</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>true</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<SequenceForKeyGeneration></SequenceForKeyGeneration>
<SuppressForeignKeyConstraints>false</SuppressForeignKeyConstraints>
<TechnicalField>false</TechnicalField>
<Transient>false</Transient>
<Unique>false</Unique>
</Spalte0>
<Spalte1>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Name</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue>'n/a'</IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar></Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Address</Name>
<NotNull>true</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<SequenceForKeyGeneration></SequenceForKeyGeneration>
<SuppressForeignKeyConstraints>false</SuppressForeignKeyConstraints>
<TechnicalField>false</TechnicalField>
<Transient>false</Transient>
<Unique>false</Unique>
</Spalte1>
<Spalte2>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar></Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>AuthorId</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<SequenceForKeyGeneration></SequenceForKeyGeneration>
<SuppressForeignKeyConstraints>false</SuppressForeignKeyConstraints>
<TechnicalField>false</TechnicalField>
<Transient>false</Transient>
<Unique>true</Unique>
</Spalte2>
<Spalte3>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Name</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar></Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Name</Name>
<NotNull>true</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<SequenceForKeyGeneration></SequenceForKeyGeneration>
<SuppressForeignKeyConstraints>false</SuppressForeignKeyConstraints>
<TechnicalField>false</TechnicalField>
<Transient>false</Transient>
<Unique>false</Unique>
</Spalte3>
</Spalten>
<Stereotype>
<Anzahl>0</Anzahl>
</Stereotype>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Name>Main</Name>
<X>150</X>
<Y>150</Y>
</View0>
</Views>
</Tabelle0>
<Tabelle1>
<Aufgehoben>false</Aufgehoben>
<Codegenerator>
<AuswahlMembers>
<Anzahl>0</Anzahl>
</AuswahlMembers>
<CompareMembers>
<Anzahl>0</Anzahl>
</CompareMembers>
<Equalsmembers>
<Anzahl>0</Anzahl>
</Equalsmembers>
<HashCodeMembers>
<Anzahl>0</Anzahl>
</HashCodeMembers>
<NReferenzen>
<Anzahl>0</Anzahl>
</NReferenzen>
<OrderMembers>
<Anzahl>0</Anzahl>
</OrderMembers>
<ToComboStringMembers>
<Anzahl>0</Anzahl>
</ToComboStringMembers>
<ToStringMembers>
<Anzahl>0</Anzahl>
</ToStringMembers>
</Codegenerator>
<ExternalTable>false</ExternalTable>
<Farben>
<Hintergrund>wei&szlig;</Hintergrund>
<Schrift>schwarz</Schrift>
</Farben>
<FirstGenerationDone>false</FirstGenerationDone>
<History>@changed OLI - Added.</History>
<InDevelopment>false</InDevelopment>
<Kommentar></Kommentar>
<NMRelation>false</NMRelation>
<Name>Book</Name>
<Options>
<Count>0</Count>
</Options>
<Panels>
<Anzahl>1</Anzahl>
<Panel0>
<PanelClass></PanelClass>
<PanelNumber>0</PanelNumber>
<TabMnemonic>1</TabMnemonic>
<TabTitle>1.Daten</TabTitle>
<TabToolTipText>Hier können Sie die Daten des Objekt warten</TabToolTipText>
</Panel0>
</Panels>
<Spalten>
<Anzahl>3</Anzahl>
<Codegenerator>
<ActiveInApplication>false</ActiveInApplication>
<AdditionalCreateConstraints></AdditionalCreateConstraints>
<Codegeneratoroptionen></Codegeneratoroptionen>
<Codeverzeichnis>.</Codeverzeichnis>
<Codieren>true</Codieren>
<DynamicCode>true</DynamicCode>
<Inherited>false</Inherited>
<Kontextname></Kontextname>
<UniqueFormula></UniqueFormula>
</Codegenerator>
<Spalte0>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>true</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar></Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Book</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>true</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<SequenceForKeyGeneration></SequenceForKeyGeneration>
<SuppressForeignKeyConstraints>false</SuppressForeignKeyConstraints>
<TechnicalField>false</TechnicalField>
<Transient>false</Transient>
<Unique>false</Unique>
</Spalte0>
<Spalte1>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>Ident</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>true</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar></Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Author</Name>
<NotNull>true</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<Referenz>
<Direction0>UP</Direction0>
<Direction1>DOWN</Direction1>
<Offset0>50</Offset0>
<Offset1>50</Offset1>
<Spalte>Author</Spalte>
<Tabelle>Author</Tabelle>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Direction0>UP</Direction0>
<Direction1>DOWN</Direction1>
<Name>Main</Name>
<Offset0>50</Offset0>
<Offset1>50</Offset1>
<Points>
<Anzahl>0</Anzahl>
</Points>
</View0>
</Views>
</Referenz>
<RemovedStateField>false</RemovedStateField>
<SequenceForKeyGeneration></SequenceForKeyGeneration>
<SuppressForeignKeyConstraints>false</SuppressForeignKeyConstraints>
<TechnicalField>false</TechnicalField>
<Transient>false</Transient>
<Unique>false</Unique>
</Spalte1>
<Spalte2>
<AlterInBatch>false</AlterInBatch>
<Aufgehoben>false</Aufgehoben>
<CanBeReferenced>false</CanBeReferenced>
<Disabled>false</Disabled>
<Domain>LongName</Domain>
<Editordescriptor>
<Editormember>false</Editormember>
<LabelText></LabelText>
<MaxCharacters>0</MaxCharacters>
<Mnemonic></Mnemonic>
<Position>0</Position>
<ReferenceWeight>keine</ReferenceWeight>
<RessourceIdentifier></RessourceIdentifier>
<ToolTipText></ToolTipText>
</Editordescriptor>
<ForeignKey>false</ForeignKey>
<Global>false</Global>
<GlobalId>false</GlobalId>
<HideReference>false</HideReference>
<History>@changed OLI - Added.</History>
<IndexSearchMember>false</IndexSearchMember>
<Indexed>false</Indexed>
<IndividualDefaultValue></IndividualDefaultValue>
<Kodiert>false</Kodiert>
<Kommentar></Kommentar>
<Konsistenz>
<Writeablemember>false</Writeablemember>
</Konsistenz>
<LastModificationField>false</LastModificationField>
<ListItemField>false</ListItemField>
<Name>Title</Name>
<NotNull>false</NotNull>
<PanelNumber>0</PanelNumber>
<Parameter></Parameter>
<PrimaryKey>false</PrimaryKey>
<RemovedStateField>false</RemovedStateField>
<SequenceForKeyGeneration></SequenceForKeyGeneration>
<SuppressForeignKeyConstraints>false</SuppressForeignKeyConstraints>
<TechnicalField>false</TechnicalField>
<Transient>false</Transient>
<Unique>false</Unique>
</Spalte2>
</Spalten>
<Stereotype>
<Anzahl>0</Anzahl>
</Stereotype>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Name>Main</Name>
<X>150</X>
<Y>375</Y>
</View0>
</Views>
</Tabelle1>
</Tabellen>
<Views>
<Anzahl>1</Anzahl>
<View0>
<Beschreibung>Diese Sicht beinhaltet alle Tabellen des Schemas</Beschreibung>
<Name>Main</Name>
<ReferenzierteSpaltenAnzeigen>true</ReferenzierteSpaltenAnzeigen>
<Tabelle0>Author</Tabelle0>
<Tabellenanzahl>1</Tabellenanzahl>
<TechnischeSpaltenVerstecken>false</TechnischeSpaltenVerstecken>
</View0>
</Views>
</Diagramm>
|
FormalAnalyzer/models/apps/NotifyMeasILeaveThatILeftItOpen.als | Mohannadcse/IoTCOM_BehavioralRuleExtractor | 0 | 2568 | module app_NotifyMeasILeaveThatILeftItOpen
open IoTBottomUp as base
open cap_runIn
open cap_now
open cap_presenceSensor
open cap_contactSensor
one sig app_NotifyMeasILeaveThatILeftItOpen extends IoTApp {
departer : one cap_presenceSensor,
contact : one cap_contactSensor,
state : one cap_state,
} {
rules = r
//capabilities = departer + contact + state
}
one sig cap_state extends cap_runIn {} {
attributes = cap_state_attr + cap_runIn_attr
}
abstract sig cap_state_attr extends Attribute {}
abstract sig r extends Rule {}
one sig r0 extends r {}{
triggers = r0_trig
conditions = r0_cond
commands = r0_comm
}
abstract sig r0_trig extends Trigger {}
one sig r0_trig0 extends r0_trig {} {
capabilities = app_NotifyMeasILeaveThatILeftItOpen.departer
attribute = cap_presenceSensor_attr_presence
no value
}
abstract sig r0_cond extends Condition {}
one sig r0_cond0 extends r0_cond {} {
capabilities = app_NotifyMeasILeaveThatILeftItOpen.departer
attribute = cap_presenceSensor_attr_presence
value = cap_presenceSensor_attr_presence_val_not_present
}
abstract sig r0_comm extends Command {}
one sig r0_comm0 extends r0_comm {} {
capability = app_NotifyMeasILeaveThatILeftItOpen.state
attribute = cap_runIn_attr_runIn
value = cap_runIn_attr_runIn_val_on
}
|
Práticas/MARS-MIPS/Prática MARS 2018-2/ElementosIguais.asm | CCP-UFV/INF251 | 0 | 95724 | lw $t1,0($gp) # Elemento procurado
lw $t2,4($gp) # Resultado
addi $t3,$gp,12 # Contador
lw $t4,0($t3) # Elemento A[i]
b loop
loop:
lw $t4,0($t3)
beqz $t4,FIM
addi $t3,$t3,4
beq $t1,$t4,incrementa
j loop
incrementa:
addi $t2,$t2,1
b loop
FIM: |
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca_notsx.log_83_41.asm | ljhsiun2/medusa | 9 | 99995 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0xd438, %rsi
lea addresses_D_ht+0x5290, %rdi
nop
nop
nop
nop
nop
cmp $13855, %rbp
mov $12, %rcx
rep movsb
nop
nop
sub $32310, %r10
lea addresses_D_ht+0x71fa, %rdx
clflush (%rdx)
nop
nop
nop
nop
nop
and $6232, %r14
movb $0x61, (%rdx)
sub %rbp, %rbp
lea addresses_UC_ht+0x18ff8, %rsi
lea addresses_WC_ht+0x176f8, %rdi
nop
nop
xor $39323, %rdx
mov $110, %rcx
rep movsw
xor $42419, %rdx
lea addresses_WT_ht+0x1b798, %rsi
lea addresses_WT_ht+0x1d878, %rdi
nop
nop
nop
nop
nop
xor $61590, %r9
mov $127, %rcx
rep movsb
nop
nop
add %r9, %r9
lea addresses_D_ht+0x113f8, %rsi
lea addresses_normal_ht+0x17778, %rdi
nop
nop
inc %r9
mov $112, %rcx
rep movsb
nop
nop
and $18244, %rcx
lea addresses_normal_ht+0x93d4, %r10
nop
nop
nop
nop
nop
cmp %rcx, %rcx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm4
vmovups %ymm4, (%r10)
nop
nop
nop
xor %rsi, %rsi
lea addresses_normal_ht+0x1aff8, %rdi
nop
xor $7499, %r14
movl $0x61626364, (%rdi)
nop
nop
nop
nop
add %r10, %r10
lea addresses_A_ht+0x1b738, %rdi
nop
nop
nop
nop
nop
xor $62075, %r10
movw $0x6162, (%rdi)
nop
nop
nop
nop
sub $3551, %rsi
lea addresses_WT_ht+0xb278, %rsi
lea addresses_normal_ht+0xbe28, %rdi
nop
and $7486, %rbp
mov $120, %rcx
rep movsb
sub %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r8
push %r9
push %rax
push %rdx
push %rsi
// Store
mov $0x6a7e950000000df8, %r8
nop
nop
nop
sub $11710, %rax
movw $0x5152, (%r8)
nop
nop
nop
add %r14, %r14
// Faulty Load
lea addresses_WT+0x15ff8, %rdx
nop
xor $10845, %r9
mov (%rdx), %esi
lea oracles, %r12
and $0xff, %rsi
shlq $12, %rsi
mov (%r12,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rax
pop %r9
pop %r8
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}}
{'39': 83}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
Cubical/Algebra/CommRing/Localisation/InvertingElements.agda | Schippmunk/cubical | 0 | 786 | <gh_stars>0
-- In this file we consider the special of localising at a single
-- element f : R (or rather the set of powers of f). This is also
-- known as inverting f.
{-# OPTIONS --cubical --no-import-sorts --safe --experimental-lossy-unification #-}
module Cubical.Algebra.CommRing.Localisation.InvertingElements where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Powerset
open import Cubical.Foundations.Transport
open import Cubical.Functions.FunExtEquiv
import Cubical.Data.Empty as ⊥
open import Cubical.Data.Bool
open import Cubical.Data.Nat renaming ( _+_ to _+ℕ_ ; _·_ to _·ℕ_
; +-comm to +ℕ-comm ; +-assoc to +ℕ-assoc
; ·-assoc to ·ℕ-assoc ; ·-comm to ·ℕ-comm)
open import Cubical.Data.Vec
open import Cubical.Data.Sigma.Base
open import Cubical.Data.Sigma.Properties
open import Cubical.Data.FinData
open import Cubical.Relation.Nullary
open import Cubical.Relation.Binary
open import Cubical.Algebra.Group
open import Cubical.Algebra.AbGroup
open import Cubical.Algebra.Monoid
open import Cubical.Algebra.Ring
open import Cubical.Algebra.CommRing
open import Cubical.Algebra.CommRing.Localisation.Base
open import Cubical.Algebra.CommRing.Localisation.UniversalProperty
open import Cubical.HITs.SetQuotients as SQ
open import Cubical.HITs.PropositionalTruncation as PT
open Iso
private
variable
ℓ ℓ' : Level
A : Type ℓ
module _(R' : CommRing {ℓ}) where
open isMultClosedSubset
private R = R' .fst
-- open CommRingStr ⦃...⦄
open CommRingStr (R' .snd)
open Exponentiation R'
[_ⁿ|n≥0] : R → ℙ R
[ f ⁿ|n≥0] g = (∃[ n ∈ ℕ ] g ≡ f ^ n) , propTruncIsProp
-- Σ[ n ∈ ℕ ] (s ≡ f ^ n) × (∀ m → s ≡ f ^ m → n ≤ m) maybe better, this isProp:
-- (n,s≡fⁿ,p) (m,s≡fᵐ,q) then n≤m by p and m≤n by q => n≡m
powersFormMultClosedSubset : (f : R) → isMultClosedSubset R' [ f ⁿ|n≥0]
powersFormMultClosedSubset f .containsOne = ∣ zero , refl ∣
powersFormMultClosedSubset f .multClosed =
PT.map2 λ (m , p) (n , q) → (m +ℕ n) , (λ i → (p i) · (q i)) ∙ ·-of-^-is-^-of-+ f m n
R[1/_] : R → Type ℓ
R[1/ f ] = Loc.S⁻¹R R' [ f ⁿ|n≥0] (powersFormMultClosedSubset f)
R[1/_]AsCommRing : R → CommRing {ℓ}
R[1/ f ]AsCommRing = Loc.S⁻¹RAsCommRing R' [ f ⁿ|n≥0] (powersFormMultClosedSubset f)
-- A useful lemma: (gⁿ/1)≡(g/1)ⁿ in R[1/f]
^-respects-/1 : {f g : R} (n : ℕ) → [ (g ^ n) , 1r , ∣ 0 , (λ _ → 1r) ∣ ] ≡
Exponentiation._^_ R[1/ f ]AsCommRing [ g , 1r , powersFormMultClosedSubset _ .containsOne ] n
^-respects-/1 zero = refl
^-respects-/1 {f} {g} (suc n) = eq/ _ _ ( (1r , powersFormMultClosedSubset f .containsOne)
, cong (1r · (g · (g ^ n)) ·_) (·-lid 1r))
∙ cong (CommRingStr._·_ (R[1/ f ]AsCommRing .snd)
[ g , 1r , powersFormMultClosedSubset f .containsOne ]) (^-respects-/1 n)
-- A slight improvement for eliminating into propositions
InvElPropElim : {f : R} {P : R[1/ f ] → Type ℓ'}
→ (∀ x → isProp (P x))
→ (∀ (r : R) (n : ℕ) → P [ r , (f ^ n) , ∣ n , refl ∣ ])
----------------------------------------------------------
→ (∀ x → P x)
InvElPropElim {f = f} {P = P} PisProp base = elimProp (λ _ → PisProp _) []-case
where
S[f] = Loc.S R' [ f ⁿ|n≥0] (powersFormMultClosedSubset f)
[]-case : (a : R × S[f]) → P [ a ]
[]-case (r , s , s∈S[f]) = PT.rec (PisProp _) Σhelper s∈S[f]
where
Σhelper : Σ[ n ∈ ℕ ] s ≡ f ^ n → P [ r , s , s∈S[f] ]
Σhelper (n , p) = subst P (cong [_] (≡-× refl (Σ≡Prop (λ _ → propTruncIsProp) (sym p)))) (base r n)
|
inser.asm | Dhoulnoun/Proj_Calcasm | 1 | 165289 | <filename>inser.asm
;________________________________________________________________________________________________________________________
; cette marco ecris un caractere dans AL et avance
insert MACRO car
PUSH AX
MOV AL, car
MOV AH, 0Eh
INT 10h
POP AX
ENDM
;________________________________________________________________________________________________________________________
|
llvm-gcc-4.2-2.9/gcc/ada/a-ztgeau.ads | vidkidz/crossbridge | 1 | 21643 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ W I D E _ T E X T _ I O . G E N E R I C _ A U X --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains a set of auxiliary routines used by Wide_Wide_Text_IO
-- generic children, including for reading and writing numeric strings.
-- Note: although this is the Wide version of the package, the interface here
-- is still in terms of Character and String rather than Wide_Wide_Character
-- and Wide_Wide_String, since all numeric strings are composed entirely of
-- characters in the range of type Standard.Character, and the basic
-- conversion routines work with Character rather than Wide_Wide_Character.
package Ada.Wide_Wide_Text_IO.Generic_Aux is
-- Note: for all the Load routines, File indicates the file to be read,
-- Buf is the string into which data is stored, Ptr is the index of the
-- last character stored so far, and is updated if additional characters
-- are stored. Data_Error is raised if the input overflows Buf. The only
-- Load routines that do a file status check are Load_Skip and Load_Width
-- so one of these two routines must be called first.
procedure Check_End_Of_Field
(Buf : String;
Stop : Integer;
Ptr : Integer;
Width : Field);
-- This routine is used after doing a get operations on a numeric value.
-- Buf is the string being scanned, and Stop is the last character of
-- the field being scanned. Ptr is as set by the call to the scan routine
-- that scanned out the numeric value, i.e. it points one past the last
-- character scanned, and Width is the width parameter from the Get call.
--
-- There are two cases, if Width is non-zero, then a check is made that
-- the remainder of the field is all blanks. If Width is zero, then it
-- means that the scan routine scanned out only part of the field. We
-- have already scanned out the field that the ACVC tests seem to expect
-- us to read (even if it does not follow the syntax of the type being
-- scanned, e.g. allowing negative exponents in integers, and underscores
-- at the end of the string), so we just raise Data_Error.
procedure Check_On_One_Line (File : File_Type; Length : Integer);
-- Check to see if item of length Integer characters can fit on
-- current line. Call New_Line if not, first checking that the
-- line length can accommodate Length characters, raise Layout_Error
-- if item is too large for a single line.
function Is_Blank (C : Character) return Boolean;
-- Determines if C is a blank (space or tab)
procedure Load_Width
(File : File_Type;
Width : Field;
Buf : out String;
Ptr : in out Integer);
-- Loads exactly Width characters, unless a line mark is encountered first
procedure Load_Skip (File : File_Type);
-- Skips leading blanks and line and page marks, if the end of file is
-- read without finding a non-blank character, then End_Error is raised.
-- Note: a blank is defined as a space or horizontal tab (RM A.10.6(5)).
procedure Load
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Char : Character;
Loaded : out Boolean);
-- If next character is Char, loads it, otherwise no characters are loaded
-- Loaded is set to indicate whether or not the character was found.
procedure Load
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Char : Character);
-- Same as above, but no indication if character is loaded
procedure Load
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Char1 : Character;
Char2 : Character;
Loaded : out Boolean);
-- If next character is Char1 or Char2, loads it, otherwise no characters
-- are loaded. Loaded is set to indicate whether or not one of the two
-- characters was found.
procedure Load
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Char1 : Character;
Char2 : Character);
-- Same as above, but no indication if character is loaded
procedure Load_Digits
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Loaded : out Boolean);
-- Loads a sequence of zero or more decimal digits. Loaded is set if
-- at least one digit is loaded.
procedure Load_Digits
(File : File_Type;
Buf : out String;
Ptr : in out Integer);
-- Same as above, but no indication if character is loaded
procedure Load_Extended_Digits
(File : File_Type;
Buf : out String;
Ptr : in out Integer;
Loaded : out Boolean);
-- Like Load_Digits, but also allows extended digits a-f and A-F
procedure Load_Extended_Digits
(File : File_Type;
Buf : out String;
Ptr : in out Integer);
-- Same as above, but no indication if character is loaded
procedure Put_Item (File : File_Type; Str : String);
-- This routine is like Wide_Wide_Text_IO.Put, except that it checks for
-- overflow of bounded lines, as described in (RM A.10.6(8)). It is used
-- for all output of numeric values and of enumeration values. Note that
-- the buffer is of type String. Put_Item deals with converting this to
-- Wide_Wide_Characters as required.
procedure Store_Char
(File : File_Type;
ch : Integer;
Buf : out String;
Ptr : in out Integer);
-- Store a single character in buffer, checking for overflow and
-- adjusting the column number in the file to reflect the fact
-- that a character has been acquired from the input stream.
-- The pos value of the character to store is in ch on entry.
procedure String_Skip (Str : String; Ptr : out Integer);
-- Used in the Get from string procedures to skip leading blanks in the
-- string. Ptr is set to the index of the first non-blank. If the string
-- is all blanks, then the excption End_Error is raised, Note that blank
-- is defined as a space or horizontal tab (RM A.10.6(5)).
procedure Ungetc (ch : Integer; File : File_Type);
-- Pushes back character into stream, using ungetc. The caller has
-- checked that the file is in read status. Device_Error is raised
-- if the character cannot be pushed back. An attempt to push back
-- an end of file (EOF) is ignored.
private
pragma Inline (Is_Blank);
end Ada.Wide_Wide_Text_IO.Generic_Aux;
|
nasm assembly/library/put and get str in matrix.asm | AI-Factor-y/NASM-library | 0 | 94032 |
put_string_in_loc:
;; i in eax ( loc of string in 2d matrix)
;; base address of matric in ecx
;; base address of string to be put in matrix is : ebx
;; string to put in ebx be in ecx reg
section .text
push rax
push rbx
push rdx
push rcx
mov cx, word[row_size]
mul cx
pop rcx
add ecx,eax
call strcpy
pop rdx
pop rbx
pop rax
ret
string_at_location:
;; i in eax ( loc of string in 2d matrix)
;; string will be in str_at_loc variable
;; use strcpy to copy string from str_at_loc variable
section .bss
str_at_loc: resb 100
section .text
push rax
push rbx
push rcx
push rdx
push rbx
mov bx, word[row_size]
mul bx
pop rbx
add ebx,eax
mov ecx,str_at_loc
call strcpy
pop rdx
pop rcx
pop rbx
pop rax
ret
strcpy:
;; copies contents of string ebx to string ecx
;; strcpy(ecx,ebx)
;; string 1 is ebx string 2 is ecx
;; ecx string changes and becomes same as ebx
section .text
push rax
push rbx
push rdx
strcpy_loop_1:
mov dl,byte[ebx]
mov byte[ecx],dl
cmp dl,0
je exit_strcpy_loop_1
inc ebx
inc ecx
jmp strcpy_loop_1
exit_strcpy_loop_1:
pop rdx
pop rcx
pop rax
ret
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_883_1068.asm | ljhsiun2/medusa | 9 | 80429 | <filename>Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_883_1068.asm
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %r9
push %rax
push %rdi
push %rdx
// Load
lea addresses_A+0x32b7, %rax
nop
nop
nop
xor $8117, %r13
movups (%rax), %xmm1
vpextrq $1, %xmm1, %rdx
nop
nop
nop
nop
dec %rdx
// Faulty Load
lea addresses_D+0xf157, %r10
nop
nop
xor %r8, %r8
vmovups (%r10), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %r9
lea oracles, %r13
and $0xff, %r9
shlq $12, %r9
mov (%r13,%r9,1), %r9
pop %rdx
pop %rdi
pop %rax
pop %r9
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'36': 883}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
src/Properties/StepCloseWait.agda | peterthiemann/definitional-session | 9 | 6158 | -- P: (vcd) <E[send c v]> | <F[recv d]> --> (vcd) <E[c]> | <F[(d,v)]>
-- P: (vcd) <E[close c]> | <F[wait d]> --> (vcd) <E[()]> | <F[()]>
module Properties.StepCloseWait where
open import Data.Maybe hiding (All)
open import Data.List
open import Data.List.All
open import Data.Product
open import Data.Sum
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Typing
open import Syntax
open import Global
open import Channel
open import Values
open import Session
open import Schedule
open import ProcessSyntax
open import ProcessRun
open import Properties.Base
mkclose : ∀ {Φ} → Expr (TUnit ∷ Φ) TUnit → Expr (TChan send! ∷ Φ) TUnit
mkclose = λ e → letbind (left (split-all-right _)) (close (here [])) e
mkwait : ∀ {Φ} → Expr (TUnit ∷ Φ) TUnit → Expr (TChan send? ∷ Φ) TUnit
mkwait = λ e → letbind (left (split-all-right _)) (wait (here [])) e
module General where
mklhs : ∀ {Φ Φ₁ Φ₂}
→ Split Φ Φ₁ Φ₂
→ Expr (TUnit ∷ Φ₁) TUnit
→ Expr (TUnit ∷ Φ₂) TUnit
→ Proc Φ
mklhs sp e f =
res (delay send!)
(par (left (rght sp))
(exp (mkclose e)) (exp (mkwait f)))
mkrhs : ∀ {Φ Φ₁ Φ₂}
→ Split Φ Φ₁ Φ₂
→ Expr (TUnit ∷ Φ₁) TUnit
→ Expr (TUnit ∷ Φ₂) TUnit
→ Proc Φ
mkrhs sp e f =
par sp (exp (letbind (split-all-right _) (unit []) e))
(exp (letbind (split-all-right _) (unit []) f))
-- obviously true, but requires a nasty inductive proof
postulate
weaken2-ident : ∀ {G Φ} (ϱ : VEnv G Φ) → weaken2-venv [] [] ϱ ≡ ϱ
postulate
weaken1-ident : ∀ {G Φ} (ϱ : VEnv G Φ) → weaken1-venv [] ϱ ≡ ϱ
reductionT : Set
reductionT =
∀ { Φ Φ₁ Φ₂ }
(sp : Split Φ Φ₁ Φ₂)
(ϱ : VEnv [] Φ)
(p : ∃ λ ϱ₁ → ∃ λ ϱ₂ →
split-env sp (lift-venv ϱ) ≡ (((nothing ∷ []) , (nothing ∷ [])) , (ss-both ss-[]) , ϱ₁ , ϱ₂))
(e : Expr (TUnit ∷ Φ₁) TUnit)
(f : Expr (TUnit ∷ Φ₂) TUnit) →
let lhs = (runProc [] (mklhs sp e f) ϱ) in
let rhs = (runProc [] (mkrhs sp e f) ϱ) in
one-step lhs ≡
(Closed , nothing ∷ proj₁ rhs , lift-threadpool (proj₂ rhs))
reduction : reductionT
reduction{Φ}{Φ₁}{Φ₂} sp ϱ p e f
with ssplit-refl-left-inactive []
... | G' , ina-G' , ss-GG'
with split-env-lemma-2 sp ϱ
... | ϱ₁ , ϱ₂ , spe== , sp==
rewrite spe== | sp==
with ssplit-compose{just (send! , POSNEG) ∷ []} (ss-posneg ss-[]) (ss-left ss-[])
... | ssc
rewrite split-env-right-lemma ϱ₁
with ssplit-compose{just (send! , POSNEG) ∷ []} (ss-left ss-[]) (ss-left ss-[])
... | ssc-ll
rewrite split-env-right-lemma ϱ₂
with ssplit-compose2 (ss-both ss-[]) (ss-both ss-[])
... | ssc2
rewrite weaken2-ident (lift-venv ϱ₁)
| split-rotate-lemma {Φ₁}
| split-rotate-lemma {Φ₂}
| split-env-right-lemma0 ϱ₁
| split-env-right-lemma0 ϱ₂
| weaken2-ident ϱ₁
| weaken1-ident (lift-venv ϱ₂)
| weaken1-ident ϱ₂
= refl
module ClosedWithContext where
mklhs : Expr (TUnit ∷ []) TUnit
→ Expr (TUnit ∷ []) TUnit
→ Proc []
mklhs e f =
res (delay send!)
(par (left (rght []))
(exp (mkclose e)) (exp (mkwait f)))
mkrhs : Expr (TUnit ∷ []) TUnit
→ Expr (TUnit ∷ []) TUnit
→ Proc []
mkrhs e f =
par [] (exp (letbind [] (unit []) e))
(exp (letbind [] (unit []) f))
reduction :
(e f : Expr (TUnit ∷ []) TUnit) →
let lhs = (runProc [] (mklhs e f) (vnil []-inactive)) in
let rhs = (runProc [] (mkrhs e f) (vnil []-inactive)) in
one-step lhs ≡
(Closed , nothing ∷ proj₁ rhs , lift-threadpool (proj₂ rhs))
reduction e f
with ssplit-refl-left-inactive []
... | G' , ina-G' , ss-GG'
= refl
|
programs/oeis/145/A145577.asm | jmorken/loda | 1 | 29806 | <reponame>jmorken/loda
; A145577: A045944 mod 9. Period 9: repeat 0,5,7,6,2,4,3,8,1.
; 0,5,7,6,2,4,3,8,1,0,5,7,6,2,4,3,8,1,0,5,7,6,2,4,3,8,1,0,5,7,6,2,4,3,8,1
mov $1,$0
mul $1,12
add $1,2
mul $0,$1
lpb $0
mod $0,9
lpe
mov $1,$0
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca_notsx.log_21829_2014.asm | ljhsiun2/medusa | 9 | 100392 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca_notsx.log_21829_2014.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0xd854, %rsi
lea addresses_D_ht+0x13074, %rdi
nop
nop
xor $39483, %rbp
mov $60, %rcx
rep movsl
nop
nop
nop
sub $25679, %rdx
lea addresses_normal_ht+0x8df4, %r9
nop
nop
nop
sub $36197, %r11
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
and $0xffffffffffffffc0, %r9
movntdq %xmm4, (%r9)
nop
nop
nop
xor $47947, %r11
lea addresses_WC_ht+0xaed4, %rsi
lea addresses_UC_ht+0x1a854, %rdi
clflush (%rdi)
nop
nop
nop
nop
xor %r8, %r8
mov $102, %rcx
rep movsq
nop
nop
nop
sub %rdi, %rdi
lea addresses_D_ht+0x1a054, %rsi
lea addresses_WC_ht+0x6817, %rdi
clflush (%rsi)
nop
nop
nop
nop
cmp $32113, %r9
mov $126, %rcx
rep movsl
nop
nop
nop
nop
nop
inc %rcx
lea addresses_WT_ht+0x11c54, %rcx
nop
nop
nop
nop
nop
dec %r11
movl $0x61626364, (%rcx)
nop
nop
add $3028, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_A+0x6bd4, %r12
nop
nop
and %rdi, %rdi
mov $0x5152535455565758, %rdx
movq %rdx, %xmm0
vmovups %ymm0, (%r12)
nop
nop
nop
sub $9373, %rsi
// Store
lea addresses_D+0x1854, %rbx
nop
nop
nop
nop
and $60447, %r9
mov $0x5152535455565758, %rcx
movq %rcx, %xmm6
movups %xmm6, (%rbx)
nop
dec %rcx
// REPMOV
lea addresses_UC+0x195d4, %rsi
lea addresses_PSE+0x19636, %rdi
clflush (%rsi)
nop
nop
sub %r8, %r8
mov $103, %rcx
rep movsw
nop
nop
nop
add $45814, %r9
// Faulty Load
lea addresses_normal+0x1a854, %rcx
nop
nop
nop
cmp %rbx, %rbx
vmovntdqa (%rcx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %rdx
lea oracles, %r12
and $0xff, %rdx
shlq $12, %rdx
mov (%r12,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_UC'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_PSE'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}, 'dst': {'same': True, 'congruent': 10, 'type': 'addresses_UC_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10}}
{'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
*/
|
Microsoft Word for Windows Version 1.1a/Word 1.1a CHM Distribution/Opus/asm/index2n.asm | lborgav/Historical-Source-Codes | 7 | 2858 | <filename>Microsoft Word for Windows Version 1.1a/Word 1.1a CHM Distribution/Opus/asm/index2n.asm<gh_stars>1-10
include w2.inc
include noxport.inc
include consts.inc
include structs.inc
createSeg index2_PCODE,index2,byte,public,CODE
; DEBUGGING DECLARATIONS
ifdef DEBUG
midIndex2n equ 34 ; module ID, for native asserts
endif
; EXTERNAL FUNCTIONS
externFP <N_WCompSzSrt>
externFP <ReloadSb>
ifdef DEBUG
externFP <AssertProcForNative>
externFP <S_WCompSzSrt>
endif ;DEBUG
sBegin data
; EXTERNALS
externW mpsbps
; #ifdef DEBUG
ifdef DEBUG
externW vcComps
externW wFillBlock
; #endif /* DEBUG */
endif
sEnd data
; CODE SEGMENT _INDEX2
sBegin index2
assumes cs,index2
assumes ds,dgroup
assumes ss,dgroup
;-------------------------------------------------------------------------
; WCompRgchIndex(hpch1, cch1, hpch2, cch2)
;-------------------------------------------------------------------------
;/* W C O M P R G C H I N D E X */
;/* Routine to compare RGCH1 and RGCH2
; Return:
; 0 if rgch1 = rgch2
; negative if rgch1 < rgch2
; positive if rgch1 > rgch2
; This routine is case-insensitive
; soft hyphens are ignored in the comparison
;*/
; %%Function:WCompRgchIndex %%Owner:BRADV
;HANDNATIVE int WCompRgchIndex(hpch1, cch1, hpch2, cch2)
;char HUGE *hpch1, HUGE *hpch2;
;int cch1, cch2;
;{
; char *pch;
; char HUGE *hpchLim;
; char sz1[cchMaxEntry+2];
; char sz2[cchMaxEntry+2];
cProc N_WCompRgchIndex,<PUBLIC,FAR,ATOMIC>,<si,di>
ParmD hpch1
OFFBP_hpch1 = -4
ParmW cch1
OFFBP_cch1 = -6
ParmD hpch2
OFFBP_hpch2 = -10
ParmW cch2
OFFBP_cch2 = -12
LocalV sz1,<cchMaxEntry+2>
LocalV sz2,<cchMaxEntry+2>
cBegin
; Debug(++vcComps);
ifdef DEBUG
inc [vcComps]
endif ;DEBUG
; Assert(cch1 < cchMaxEntry);
; for (pch = sz1, hpchLim = hpch1 + cch1;
; hpch1 < hpchLim; hpch1++)
; {
; if (*hpch1 != chNonReqHyphen)
; *pch++ = *hpch1;
; }
; *pch = 0;
lea si,[sz1]
push si ;argument for WCompSzSrt
lea di,[hpch1]
call WCRI01
; Assert(cch2 < cchMaxEntry);
; for (pch = sz2, hpchLim = hpch2 + cch2;
; hpch2 < hpchLim; hpch2++)
; {
; if (*hpch2 != chNonReqHyphen)
; *pch++ = *hpch2;
; }
; *pch = 0;
lea si,[sz2]
push si ;argument for WCompSzSrt
lea di,[hpch2]
call WCRI01
; return (WCompSzSrt(sz1, sz2, fFalse /* not case sensitive */));
errnz <fFalse>
xor ax,ax
push ax
ifdef DEBUG
cCall S_WCompSzSrt,<>
else ;not DEBUG
cCall N_WCompSzSrt,<>
endif ;DEBUG
;}
cEnd
WCRI01:
; Assert(cch < cchMaxEntry);
ifdef DEBUG
errnz <OFFBP_hpch1 - OFFBP_cch1 - 2>
errnz <OFFBP_hpch2 - OFFBP_cch2 - 2>
cmp wptr [di+(OFFBP_cch1 - OFFBP_hpch1)],cchMaxEntry
jb WCRI02
push ax
push bx
push cx
push dx
mov ax,midIndex2n
mov bx,1001 ; label # for native assert
cCall AssertProcForNative, <ax, bx>
pop dx
pop cx
pop bx
pop ax
WCRI02:
endif ;DEBUG
; for (pch = sz, hpchLim = hpch + cch;
; hpch < hpchLim; hpch++)
; {
; if (*hpch != chNonReqHyphen)
; *pch++ = *hpch;
; }
mov bx,[di+2] ;get SEG_hpch
shl bx,1
mov ax,mpsbps[bx]
mov es,ax
shr ax,1
jc WCRI03
; reload sb trashes ax, cx, and dx
cCall ReloadSb,<>
ifdef DEBUG
mov ax,[wFillBlock]
mov bx,[wFillBlock]
mov cx,[wFillBlock]
mov dx,[wFillBlock]
endif ;DEBUG
WCRI03:
errnz <OFFBP_hpch1 - OFFBP_cch1 - 2>
errnz <OFFBP_hpch2 - OFFBP_cch2 - 2>
mov cx,[di+(OFFBP_cch1 - OFFBP_hpch1)]
mov di,[di] ;get OFF_hpch
mov al,chNonReqHyphen
WCRI04:
mov dx,di
repne scasb ;look for chNonReqHyphen
push cx
push di
push es
pop ds
push ss
pop es
mov cx,di
mov di,si
mov si,dx
jne WCRI05 ;if we found a chNonReqHyphen, don't copy it
dec cx
WCRI05:
sub cx,dx
rep movsb ;copy up to the chNonReqHyphen or end of rgch
mov si,di
push ds
pop es
push ss
pop ds
pop di
pop cx
or cx,cx ;more characters in rgch?
jne WCRI04 ;yes - look for more chNonReqHyphens
; *pch = 0;
mov bptr [si],0
ret
; End of WCompRgchIndex
sEnd index2
end
|
alloy4fun_models/trainstlt/models/4/w34dYjtDjzZ9jD3vW.als | Kaixi26/org.alloytools.alloy | 0 | 203 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idw34dYjtDjzZ9jD3vW_prop5 {
always pos in pos'
}
pred __repair { idw34dYjtDjzZ9jD3vW_prop5 }
check __repair { idw34dYjtDjzZ9jD3vW_prop5 <=> prop5o } |
bb-runtimes/x86_64/src/i-x86_64-exception_handler.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 14709 | <filename>bb-runtimes/x86_64/src/i-x86_64-exception_handler.ads
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- I N T E R F A C E S . X 8 6 _ 6 4 --
-- --
-- S p e c --
-- --
-- Copyright (C) 2020, 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. --
-- --
------------------------------------------------------------------------------
with Interfaces;
with System.BB.CPU_Specific;
with System.BB.Interrupts;
package Interfaces.X86_64.Exception_Handler is
package SBC renames System.BB.CPU_Specific;
package SBI renames System.BB.Interrupts;
procedure Fatal_Exception (ID : SBI.Interrupt_ID; Code : SBC.Error_Code)
with Export, External_Name => "__gnat_fatal_exception";
end Interfaces.X86_64.Exception_Handler;
|
SceneMax.g4 | scenemax3d/grammar | 0 | 3038 | <reponame>scenemax3d/grammar
//
grammar SceneMax;
@header {
package com.abware.scenemaxlang.parser;
}
prog
: (program_statements) EOF
;
program_statements : (statement ';'?)* ;
statement
: define_resource # defResource
| define_sphere # defSphere
| define_box # defBox
| define_group # defineGroup
| debug_statement # debugStatement
| define_variable # defVar
| modify_variable # modifyVar
| skybox_actions # skyBoxActions
| screen_actions # screenActions
| scene_actions # sceneActions
| terrain_actions # terrainActions
| function_statement # functionStatement
| action_statement # actionStatement
| do_block # doBlock
| function_invocation # functionInvocation
| declare_variable # declareVariable
| if_statement # ifStatement
| collision # collisionStatement
| check_static # checkStaticStatement
| input # inputStatement
| print_statement # printStatement
| wait_statement # waitStatement
| wait_for_statement # waitForStatement
| stop_statement # stopBlock
| return_statement # returnStatement
| play_sound # playSound
| audio_play # audioPlay
| audio_stop # audioStop
| water_actions # waterActions
| particle_system_actions # particleSystemActions
| chase_camera_actions # chaseCameraActions
| attach_camera_actions # attachCameraActions
| csharp_invoke # csharpInvoke
| using_resource # usingResource
| light_actions # lightActions
| add_external_code #addExternalCode
| channel_draw_statement # channelDraw
| mini_map_actions # miniMapActions
| for_each_statement # forEachStatement
;
add_external_code : Add file_name (',' file_name)* Code ;
file_name : QUOTED_STRING ;
debug_statement : Debug '.' debug_actions ;
debug_actions : debug_on | debug_off ;
debug_on : On ;
debug_off : Off ;
play_sound : Play Sound res_var_decl Loop? ;
audio_play : Audio '.' Play string_expr Loop? ;
audio_stop : Audio '.' Stop string_expr ;
mini_map_actions : Minimap '.' show_or_hide (Having minimap_options)? ;
show_or_hide : Show | Hide ;
minimap_options : minimap_option (And minimap_option)* ;
minimap_option : height_attr | unisize_attr | pos_2d_attr | follow_entity ;
height_attr : Height Equals? logical_expression ;
unisize_attr : Size Equals? logical_expression ;
follow_entity : Follow var_decl ;
light_actions : Lights '.' Add light_options ;
light_options : light_probe ;
light_probe : Probe QUOTED_STRING (Having print_pos_attr)? ;
input : go_condition? When input_source input_action on_entity? do_block ;
input_source : KeyA | KeyB | KeyC | KeyD | KeyE | KeyF | KeyG | KeyH | KeyI | KeyJ | KeyK | KeyL | KeyM | KeyN | KeyO |
KeyP | KeyQ | KeyR | KeyS | KeyT | KeyU | KeyV | KeyW | KeyX | KeyY | KeyZ | KeySPACE |
KeyLeft | KeyRight | KeyUp | KeyDown | KeyDel |
Key0 | Key1 | Key2 | Key3 | Key4 | Key5 | Key6 | Key7 | Key8 | Key9 |
MouseLeft | MouseRight ;
input_action: is_pressed_action ;
is_pressed_action : Is Pressed Once? ;
on_entity : On res_var_decl ;
return_statement : Return ;
stop_statement : Stop ;
wait_statement : Wait logical_expression Seconds ;
wait_for_statement : Wait For wait_for_options;
wait_for_options : wait_for_input | wait_for_expression ;
wait_for_input : input_source To Be Pressed ;
wait_for_expression : logical_expression ;
using_resource : Using resource_declaration (And resource_declaration)* ;
resource_declaration : res_var_decl (',' res_var_decl)* (Sprite | Model | Audio) ;
channel_draw_statement : res_var_decl '.' Draw sprite_name (Having channel_draw_attrs)? ;
channel_draw_attrs : channel_draw_attr (And channel_draw_attr)* ;
channel_draw_attr : pos_2d_attr | frame_attr | size_2d_attr;
sprite_name : res_var_decl | Clear ;
frame_attr : Frames logical_expression ;
size_2d_attr : Size '(' width_size ',' height_size ')' ;
print_statement : res_var_decl '.' Print print_text_expr (Having print_attr (And print_attr)*)? ;
print_text_expr : logical_expression ;
print_attr : print_color_attr | print_pos_attr | print_font_size_attr | print_append_attr | print_font_attr ;
print_append_attr : Append ;
print_font_size_attr : Size Equals? logical_expression ;
print_color_attr : Color Equals? SystemColor ;
print_font_attr : Font Equals? QUOTED_STRING ;
print_pos_attr : Pos Equals? '(' (pos_axes | pos_entity) ')' ;
pos_2d_attr : Pos '(' pos_axes_2d ')' ;
pos_axes_2d : print_pos_x ',' print_pos_y ;
pos_axes : print_pos_x ',' print_pos_y ',' print_pos_z ;
pos_entity : var_decl collision_joint_1? ;
print_pos_x : logical_expression ;
print_pos_y : logical_expression ;
print_pos_z : logical_expression ;
if_statement : IF '('? logical_expression ')'? Then? do_block (else_if_expr)* (else_expr)?;
else_if_expr : (ELSE IF '('? logical_expression ')'? Then? do_block) ;
else_expr : ELSE do_block ;
// LOGICAL EXPRESSIONS
logical_expression
: booleanAndExpression ( OR booleanAndExpression )*
;
booleanAndExpression
: relationalExpression ( AND relationalExpression )*
;
//equalityExpression
// : relationalExpression ( (EQUALS | NOTEQUALS) relationalExpression)*
// ;
relationalExpression
: additiveExpression ( (LT | LTEQ | GT | GTEQ | EQUALS | NOTEQUALS) additiveExpression)*
;
additiveExpression
: multiplicativeExpression ( (PLUS | MINUS) multiplicativeExpression )*
;
multiplicativeExpression
: unaryExpression (( MULT | DIV | MOD ) unaryExpression)*
;
unaryExpression
: (NOT)? primaryExpression
;
primaryExpression
: '(' logical_expression ')'
| value
;
value :
number_expr
| QUOTED_STRING
| DATETIME
| BOOLEAN
| var_decl
| variable_field
| variable_data_field
| function_value
| csharp_register
| calc_distance_value
| calc_angle_value
;
calc_angle_value : Angle '(' first_object ',' second_object ')' ;
calc_distance_value : Distance '(' first_object ',' second_object ')' ;
first_object : var_decl ;
second_object : var_decl ;
function_value : (var_decl '.')? java_func_name '(' (logical_expression ((',' logical_expression)*) )? ')' ;
variable_data_field : var_decl '.' Data '.' field_name ;
field_name : ID ;
variable_field : var_decl '.' var_field ;
var_field : X | Y | Z | RX | RY | RZ | Hit | AnimPercent ;
// THE LANGUAGE SYNTAX
declare_variable : Var variable_name_and_assignemt (',' variable_name_and_assignemt)* ;
variable_name_and_assignemt : res_var_decl (Equals logical_expression)? ;
java_assignment_decl : Equals java_assignment_expr ;
java_assignment_expr : logical_expression ;
string_expr : QUOTED_STRING ;
java_func_name : Jump | res_var_decl ;
define_resource
: define_sprite_implicit # defSpriteImplicit
| define_sprite_implicit # defSpriteImplicit
;
for_each_statement : For Each entity_type? '(' var_decl ')' (for_each_having_expr)? do_block ;
entity_type : Model | Sprite | Sphere | Box ;
for_each_having_expr : Having for_each_having_attr (And for_each_having_attr)* ;
for_each_having_attr : for_each_name_attr ;
for_each_name_attr : Name string_comparators? QUOTED_STRING ;
string_comparators : Contains ;
function_statement : Function? go_condition? java_func_name (func_variables)? Equals do_block ;
function_invocation : (Run | Call) java_func_name (func_invok_variables)? (every_time_expr)? (async_expr)? ;
every_time_expr : Every logical_expression Seconds ;
func_variables : '(' res_var_decl (',' res_var_decl)* ')' ;
func_invok_variables : '(' logical_expression (',' logical_expression)* ')' ;
do_block : go_condition? (Do | '{') (amount_of_times_expr)? (async_expr)? program_statements end_do_block ;
amount_of_times_expr : logical_expression times_or_seconds ;
end_do_block : End Do | '}' ;
//define_terrain : res_var_decl isa_expr 'terrain' From file_var_decl ;
define_group : res_var_decl Belongs To The group_name Group ;
group_name : ID ;
define_sphere: res_var_decl isa_expr Collider? Static? Sphere (sphere_having_expr)? ;
define_box: res_var_decl isa_expr Collider? Static? Box (box_having_expr)? ;
define_sprite_implicit : var_decl isa_expr res_var_decl Sprite (sprite_having_expr)? ;
define_variable : var_decl isa_expr Dynamic? Static? dynamic_model_type Vehicle? (scene_entity_having_expr)? ;
dynamic_model_type : res_var_decl | dynamic_model_type_name ;
dynamic_model_type_name : '(' logical_expression ')' ;
scene_entity_having_expr : (Having model_attributes) ;
model_attributes : model_attr (And model_attr)* ;
model_attr : print_pos_attr | init_rotate_attr | init_joints_attr |
init_turn_attr | init_scale_attr | init_mass_attr | init_static_attr | init_hidden_attr | shadow_mode_attr | calibration_attr |
collision_shape_attr;
collision_shape_attr : Collision Shape collision_shape_options ;
collision_shape_options : Box | Boxes ;
calibration_attr : Calibrate '(' pos_axes ')' ;
shadow_mode_attr : Shadow Mode shadow_mode_options ;
shadow_mode_options : Cast | Receive | On ;
init_hidden_attr : Hidden ;
init_static_attr : Static Equals? True ;
init_joints_attr : Joints Equals? '(' QUOTED_STRING (',' QUOTED_STRING)* ')' ;
init_turn_attr : Turn turn_dir? turn_degrees ;
init_rotate_attr : Rotate Equals? '(' (rot_axes | rot_entity) ')' ;
rot_axes : rotate_x ',' rotate_y ',' rotate_z ;
rot_entity : var_decl ;
rotate_x : logical_expression ;
rotate_y : logical_expression ;
rotate_z : logical_expression ;
init_scale_attr : Scale Equals? logical_expression ;
init_mass_attr : Mass Equals? logical_expression ;
modify_variable : var_decl java_assignment_decl ;
from_file_expr : From file_var_decl ;
particle_system_actions : Effects '.' particle_system_effect '.' particle_system_action (async_expr)? ;
particle_system_effect: Flash | Explosion | Debris | Spark | SmokeTrail | ShockWave | Fire |
Flame | Destination | Gradient | Orbital | TimeOrbit;
particle_system_action : particle_system_action_show ;
particle_system_action_show : Show (particle_system_having_expr)? ;
particle_system_having_expr : Having particle_system_attributes ;
particle_system_attributes : particle_system_attr (And particle_system_attr)* ;
particle_system_attr : print_pos_attr | psys_attr_start_size |
psys_attr_end_size | psys_attr_gravity |
psys_attr_duration | psys_attr_radius | psys_attr_emissions | psys_attr_attach_to ;
psys_attr_attach_to : Attach To var_decl ;
psys_attr_start_size : Start Size Equals? logical_expression ;
psys_attr_end_size : End Size Equals? logical_expression ;
psys_attr_gravity : Gravity Equals? '(' vector_x ',' vector_y ',' vector_z ')' ;
psys_attr_duration : Duration Equals? logical_expression ;
psys_attr_radius : Radius Equals? logical_expression ;
psys_attr_emissions : Emissions '(' emissions_per_second ',' particles_per_emission ')' ;
emissions_per_second : logical_expression ;
particles_per_emission : logical_expression ;
vector_x : logical_expression ;
vector_y : logical_expression ;
vector_z : logical_expression ;
water_actions : Water '.' water_action ;
water_action : water_action_show ;
water_action_show : Show (water_having_expr)? ;
water_having_expr : Having water_attributes ;
water_attributes : water_attr (And water_attr)* ;
water_attr : print_pos_attr | water_strength_attr | water_wave_speed_attr | water_depth_attr | water_plane_size_attr ;
water_strength_attr : Strength Equals logical_expression ;
water_wave_speed_attr : Speed Equals logical_expression ;
water_depth_attr : Depth Equals logical_expression ;
water_plane_size_attr : Size Equals width_height_size ;
width_height_size : '(' width_size ',' height_size ')' ;
width_size : logical_expression ;
height_size : logical_expression ;
scene_actions : Scene '.' scene_action ;
scene_action : scene_action_pause | scene_action_resume ;
scene_action_pause : Pause ;
scene_action_resume : Resume ;
screen_actions : Screen '.' screen_action ;
screen_action : mode_full | mode_window ;
mode_full : Mode Full ;
mode_window : Mode Window ;
csharp_invoke : (csharp_register Equals)? CS '.' valid_java_class_name '.' java_func_name func_invok_variables? ;
csharp_register : CS '.' res_var_decl (',' res_var_decl)* ;
skybox_actions : SkyBox '.' skybox_action ;
skybox_action : skybox_action_show | skybox_action_hide | skybox_setup ;
skybox_setup : solar_system_setup_options ;
solar_system_setup_options : solar_system_option (',' solar_system_option)* ;
skybox_action_show : Show (solar_system | regular_skybox) ;
regular_skybox : QUOTED_STRING ;
solar_system : Solar System solar_system_having_expr? ;
solar_system_having_expr : Having solar_system_having_options ;
solar_system_having_options : solar_system_option (And solar_system_option)* ;
solar_system_option : cloud_flattening | cloudiness | hour_of_day ;
hour_of_day : Hour Equals? logical_expression ;
cloud_flattening : Cloud Flattening Equals? logical_expression ;
cloudiness : Cloudiness Equals? logical_expression ;
skybox_action_hide : Hide ;
terrain_actions : Terrain '.' terrain_action ;
terrain_action : terrain_action_show | terrain_action_hide ;
terrain_action_show : Show logical_expression ;
terrain_action_hide : Hide ;
attach_camera_actions : Camera '.' attach_camera_action ;
attach_camera_action : attach_camera_action_start | attach_camera_action_stop ;
attach_camera_action_start : Attach To var_decl attach_camera_having_expr? ;
attach_camera_having_expr : Having attach_camera_having_options ;
attach_camera_having_options : attach_camera_having_option (And attach_camera_having_option)* ;
attach_camera_having_option : print_pos_attr ;
attach_camera_action_stop : Attach Stop ;
chase_camera_actions : Camera '.' chase_camera_action ;
chase_camera_action : chase_camera_action_stop | chase_camera_action_chase ;
chase_camera_action_chase : Chase var_decl chase_cam_having_expr? ;
chase_cam_having_expr : Having chase_cam_options ;
chase_cam_options : chase_cam_option (And chase_cam_option)* ;
chase_cam_option : chase_cam_option_trailing
| chase_cam_option_vertical_rotation
| chase_cam_option_horizontal_rotation
| chase_cam_option_rotation_speed
| chase_cam_option_max_distance
| chase_cam_option_min_distance ;
chase_cam_option_vertical_rotation : Vertical Rotation Equals? logical_expression ;
chase_cam_option_horizontal_rotation : Horizontal Rotation Equals? logical_expression ;
chase_cam_option_trailing : Trailing Equals? (True|False) ;
chase_cam_option_rotation_speed : Rotation Speed Equals? logical_expression ;
chase_cam_option_max_distance : Max Distance Equals? logical_expression ;
chase_cam_option_min_distance : Min Distance Equals? logical_expression ;
chase_camera_action_stop : Chase Stop ;
detach_parent : var_decl '.' Detach From Parent ;
attach_to : var_decl '.' Attach To var_decl ('.' joint_name)? attach_to_having_expr? ;
joint_name : QUOTED_STRING ;
attach_to_having_expr : Having attach_to_options ;
attach_to_options : attach_to_having_option (And attach_to_having_option)* ;
attach_to_having_option : print_pos_attr | init_rotate_attr ;
// Action statements
action_statement : action_operation (async_expr)? ;
async_expr : Async ;
action_operation
: rotate # rotateStatement
| rotate_to # rotateToStatement
| record # recordStatement
| turn_verbal # turnStatement
| turn_verbal_to # turnVerbalTo
| roll_verbal # rollStatement
| rotate_reset # rotateReset
| move # moveStatement
| move_verbal # moveVerbalStatement
| move_to # moveTo
| directional_move # directionalMove
| pos # posStatement
| mass # massStatement
| velocity # velocityStatement
| angular_velocity # angularVelocity
| restitution # restitutionStatement
| friction # frictionStatement
| scale # scaleStatement
| switch_mode # modeStatement
| clear_modes # clearModes
| detach_parent # dettachParent
| play # playStatement
| hide # hideStatement
| kill # killStatement
| show # showStatement
| delete # deleteStatement
| animate # animateStatement
| animate_short # animateShortStatement
| stop # stopStatement
| user_data # userDataStatement
| ray_check # rayCheckStatement
| attach_to # attachTo
| accelerate # accelerateStatement
| steer # steerStatement
| brake # brakeStatement
| turbo # turboStatement
| reset_vehicle # resetStatement
| vehicle_setup # vehicleSetup
| vehicle_input_setup # vehicleInputSetup
| vehicle_engine_setup # vehicleEngineSetup
| character_actions # characterActions
| set_material_action # setMaterialAction
;
check_static: When var_decl Is Static For logical_expression Seconds do_block ;
collision : go_condition? When var_decl collision_joint_1? Collides With var_decl collision_joint_2? do_block ;
collision_joint_1 : ('.' QUOTED_STRING) ;
collision_joint_2 : ('.' QUOTED_STRING) ;
stop : var_decl '.' Stop ;
rotate : var_decl '.' Rotate '(' (axis_expr (',' axis_expr)*) ')' In speed_expr ;
rotate_to : var_decl '.' Rotate To '(' axis_name logical_expression ')' In speed_expr ;
axis_name : X | Y | Z ;
record : var_decl '.' Record record_actions ;
record_actions : record_transitions | record_commands | record_stop | record_save ;
record_transitions : Transitions every_time_expr ;
record_commands : Commands ;
record_stop : Stop ;
record_save : Save QUOTED_STRING ;
turn_verbal : var_decl '.' Turn turn_dir? turn_degrees In speed_expr ;
turn_dir : Left | Right | Forward | Backward ;
turn_degrees : logical_expression ;
roll_verbal : var_decl '.' Roll turn_dir turn_degrees In speed_expr ;
turn_verbal_to : var_decl '.' Look At move_to_target (In speed_expr)? ;
rotate_reset : var_decl '.' Rotate '(' print_pos_x ',' print_pos_y ',' print_pos_z ')' ;
accelerate : var_decl '.' Accelerate logical_expression ;
steer : var_decl '.' Steer logical_expression ;
brake : var_decl '.' Brake logical_expression ;
turbo : var_decl '.' Turbo '(' print_pos_x ',' print_pos_y ',' print_pos_z ')' ;
reset_vehicle : var_decl '.' Reset ;
vehicle_input_setup : var_decl '.' Input (on_off_options | vehicle_input_setup_options) ;
on_off_options : On | Off ;
vehicle_input_setup_options : vehicle_input_option (',' vehicle_input_option)* ;
vehicle_input_option : vehicle_action Equals input_source ;
vehicle_action : Start | Forward | Break | Reverse | Left | Right | Horn | Reset ;
vehicle_engine_setup : var_decl '.' Engine '.' engine_options ;
engine_options : engine_power_option | engine_breaking_option | engine_action_start_off ;
engine_action_start_off : Start | Off ;
engine_power_option : Power Equals? logical_expression ;
engine_breaking_option : Breaking Equals? logical_expression ;
vehicle_setup : var_decl '.' vehicle_side '.' vehicle_setup_options ;
vehicle_side : Front | Rear ;
vehicle_setup_options : vehicle_option (',' vehicle_option)* ;
vehicle_option : vehicle_friction_option | vehicle_suspension_option ;
vehicle_friction_option : Friction Equals logical_expression ;
vehicle_suspension_option : Suspension '.' specific_suspension_options ;
specific_suspension_options : specific_suspension_option (',' specific_suspension_option)* ;
specific_suspension_option : specific_suspension_opt_compression
| specific_suspension_opt_damping
| specific_suspension_opt_stiffness
| specific_suspension_opt_length ;
specific_suspension_opt_compression : Compression Equals logical_expression ;
specific_suspension_opt_damping : Damping Equals logical_expression ;
specific_suspension_opt_stiffness : Stiffness Equals logical_expression ;
specific_suspension_opt_length : Length Equals logical_expression ;
move : var_decl '.' Move '(' (axis_expr (',' axis_expr)*) ')' In speed_expr ;
move_to : var_decl '.' Move To move_to_target ('+' logical_expression)? In speed_expr looking_at_expr? ;
move_to_target : ('(' ID ')') | ('(' pos_axes ')') | position_statement ;
position_statement : '(' var_decl dir_statement* ')' ;
dir_statement : dir_verb logical_expression ;
dir_verb : Forward | Backward | Left | Right | Up | Down;
looking_at_expr : Looking At position_statement ;
move_verbal : var_decl '.' Move move_direction logical_expression In speed_expr ;
directional_move : var_decl '.' Move move_direction logical_expression (For logical_expression Seconds)? ;
move_direction : Forward | Backward | Left | Right | Up | Down ;
scale : var_decl '.' Scale Equals? logical_expression ;
pos : var_decl '.' Pos '(' (pos_axes | pos_entity | position_statement) ')' ;
mass : var_decl '.' Mass Equals? logical_expression ;
user_data : var_decl '.' Data '.' field_name Equals logical_expression ;
velocity : var_decl '.' Velocity Equals? logical_expression ;
angular_velocity : var_decl '.' Angular Velocity Equals? logical_expression ;
friction : var_decl '.' Friction Equals? logical_expression ;
restitution : var_decl '.' Restitution Equals? logical_expression ;
set_material_action : var_decl '.' Material Equals logical_expression ;
ray_check : IF '('? var_decl '.' Ray Check ')'? ray_check_from? Then? do_block ;
ray_check_from : From '(' (pos_axes | pos_entity) ')' ;
clear_modes : var_decl '.' Clear clear_modes_options ;
clear_modes_options : clear_mode_option (And clear_mode_option)* ;
clear_mode_option : character_mode ;
character_mode : Character Mode ;
switch_mode : var_decl '.' Switch To switch_options ;
switch_options : switch_to_character | switch_to_rigid_body | switch_to_ragdoll | switch_to_kinematic | switch_to_floating;
switch_to_character : Character Mode (Having character_mode_attributes)? ;
character_mode_attributes : character_mode_attribute (And character_mode_attribute)* ;
character_mode_attribute : scalar_gravity ;
scalar_gravity : Gravity Equals? logical_expression ;
switch_to_rigid_body : Rigid Body Mode;
switch_to_ragdoll : RagDoll Mode;
switch_to_kinematic : Kinematic Mode;
switch_to_floating : Floating Mode;
//switch_to_car : Car ;
character_actions : var_decl '.' Character '.' character_action ;
character_action : character_action_jump ;
character_action_jump : Jump speed_of_expr? ;
kill : var_decl '.' Kill ;
play : var_decl '.' Play '(' frames_expr (In speed_expr)? ')' play_duration_strategy? ;
hide : var_decl '.' Hide show_options? ;
show : var_decl '.' Show show_options? ;
show_options : show_axis_option | Wireframe | show_info_option | Speedo | Tacho | show_joints_option | Outline;
show_joints_option : Joints (Having show_joints_attributes)? ;
show_joints_attributes : show_joints_attribute (And show_joints_attribute )* ;
show_joints_attribute : scalar_size_attr ;
scalar_size_attr : Size Equals logical_expression ;
show_info_option : Info (Having show_info_attributes)? ;
show_info_attributes : show_info_attribute (And show_info_attribute )* ;
show_info_attribute : file_attr ;
file_attr : File Equals? QUOTED_STRING ;
show_axis_option : Axis X? Y? Z? ;
delete : var_decl '.' Delete ;
animate : var_decl '.' Animation animation_attr (And animation_attr)* ;
animation_attr : anim_attr_speed ;
anim_attr_speed : Speed Equals? logical_expression speed_for_seconds? when_frames_above?;
speed_for_seconds : For logical_expression Seconds ;
when_frames_above : When Frames '>' logical_expression ;
animate_short : go_condition? var_decl '.' (anim_expr (Then anim_expr)*) Loop? ;
go_condition : '[' logical_expression ']' ;
///////////////////////////////////////////////////////////////////////////
play_duration_strategy : for_time_expr | Once | play_duration_loop_strategy ;
play_duration_loop_strategy : Loop (number Times)? ;
times_or_seconds : Times | Seconds ;
box_having_expr: (Having box_attributes) ;
box_attributes : box_attr (And box_attr)* ;
box_attr : model_attr | box_specific_attr ;
box_specific_attr : material_attr | volume_size_attr ;
volume_size_attr : Size Equals? '(' size_x ',' size_y ',' size_z ')' ;
size_x : logical_expression ;
size_y : logical_expression ;
size_z : logical_expression ;
sphere_having_expr : (Having sphere_attributes) ;
sphere_attributes : sphere_attr (And sphere_attr)* ;
sphere_attr : model_attr | sphere_specific_attr ;
sphere_specific_attr : material_attr | radius_attr ;
material_attr : Material Equals? logical_expression ;
radius_attr : Radius Equals? logical_expression ;
sprite_having_expr : (Having sprite_attributes) ; //rows_def And cols_def
sprite_attributes : sprite_attr (And sprite_attr)* ;
sprite_attr : rows_def | cols_def | print_pos_attr | init_scale_attr | billboard_attr ;
rows_def : Rows '=' number ;
cols_def : Cols '=' number ;
billboard_attr : Billboard Equals? True ;
anim_expr : animation_name (speed_of_expr)? ;
speed_of_expr : (At Speed Of logical_expression) ;
animation_name : (ID | QUOTED_STRING) ;
speed_expr : logical_expression Seconds ;
for_time_expr : (For logical_expression Seconds) ;
frames_expr: (Frames? from_frame To to_frame) ;
from_frame : logical_expression ;
to_frame : logical_expression ;
axis_expr : axis_id number_sign? logical_expression ;
axis_id : X | Y | Z ;
//res_type_expr : Model | Sprite ;
isa_expr : IsA | IsAn ;
var_decl : ID | Camera ;
res_var_decl : ID ;
valid_java_class_name : ID ;
file_var_decl : ID ;
number_expr : number_sign? number ;
number_sign : PLUS | MINUS ;
number: DecimalDigit ('.' DecimalDigit)? ;
Axis : 'Axis' | 'axis' ;
X : 'X' | 'x' ;
Y : 'Y' | 'y' ;
Z : 'Z' | 'z' ;
RX : 'Rx' | 'RX' | 'rx' ;
RY : 'Ry' | 'RY' | 'ry' ;
RZ : 'Rz' | 'RZ' | 'rz' ;
Hit : 'Hit' | 'hit' ;
AnimPercent : 'anim_percent' ;
True : 'True' | 'true' ;
False : 'False' | 'false' ;
IF : 'if' | 'If' ;
ELSE : 'else' | 'Else' ;
Once : 'once' | 'Once' ;
Times : 'times' | 'Times' ;
End : 'end' | 'End' ;
Do : 'do' | 'Do' ;
Loop : 'loop' | 'Loop' ;
Async : 'async' | 'Async' ;
IsA : 'is a' | 'Is a' | 'is A' | 'Is A' ;
IsAn : 'is an' | 'Is an' | 'is An' | 'Is An' ;
//Is : 'is' | 'Is' ;
//A : 'a' | 'A' | 'an' | 'An' ;
Material : 'Material' | 'material' ;
Radius : 'Radius' | 'radius' ;
Emissions : 'Emissions' | 'emissions' ;
Sphere : 'Sphere' | 'sphere' ;
Box : 'Box' | 'box' ;
Boxes : 'Boxes' | 'boxes' ;
Collision : 'Collision' | 'collision' ;
Shape : 'Shape' | 'shape' ;
Effects : 'Effects' | 'effects' ;
Flash : 'Flash' | 'flash' ;
Explosion : 'Explosion' | 'explosion' ;
Debris : 'Debris' | 'debris' ;
Spark : 'Spark' | 'spark' ;
SmokeTrail : 'Smoketrail' | 'smoketrail' ;
ShockWave : 'Shockwave' | 'shockwave' ;
Fire : 'Fire' | 'fire' ;
Flame : 'Flame' | 'flame' ;
Destination : 'Destination' | 'destination' ;
Gradient : 'Gradient' | 'gradient' ;
Orbital : 'Orbital' | 'orbital' ;
TimeOrbit : 'TimeOrbit' | 'timeOrbit' ;
Start : 'Start' | 'start' ;
Gravity : 'Gravity' | 'gravity' ;
Duration : 'Duration' | 'duration' ;
Water : 'Water' | 'water' ;
Strength : 'Strength' | 'strength' ;
Depth : 'Depth' | 'depth' ;
Terrain : 'Terrain' | 'terrain' ;
Camera : 'Camera' | 'camera' ;
Chase : 'Chase' | 'chase' ;
Trailing : 'Trailing' | 'trailing' ;
Vertical : 'Vertical' | 'vertical' ;
Horizontal : 'Horizontal' | 'horizontal' ;
Rotation : 'Rotation' | 'rotation' ;
Max : 'Max' | 'max' ;
Min : 'Min' | 'min' ;
Distance : 'Distance' | 'distance' ;
Angle : 'Angle' | 'angle' ;
Parent : 'Parent' | 'parent' ;
Detach : 'Detach' | 'detach' ;
Attach : 'Attach' | 'attach' ;
Draw : 'Draw' | 'draw' ;
Debug : 'debug' | 'Debug' ;
On : 'on' | 'On' ;
Off : 'off' | 'Off' ;
Calibrate : 'Calibrate' | 'calibrate' ;
Shadow : 'Shadow' | 'shadow' ;
Cast : 'Cast' | 'cast' ;
Receive : 'Receive' | 'receive' ;
CS : 'c#' | 'C#' | 'csharp' | 'CSharp' ;
SkyBox : 'Skybox' | 'skybox' ;
Solar : 'Solar' | 'solar' ;
System : 'System' | 'system' ;
Cloud : 'Cloud' | 'cloud' ;
Flattening : 'Flattening' | 'flattening' ;
Cloudiness : 'Cloudiness' | 'cloudiness' ;
Billboard : 'Billboard' | 'billboard' ;
Model : 'Model' | 'model' ;
Sprite : 'Sprite' | 'sprite' ;
From : 'From' | 'from' ;
Having : 'having' | 'Having' | ':' ;
For: 'for' | 'For' ;
Contains: 'Contains' | 'contains' ;
Each: 'Each' | 'each' ;
Name: 'Name' | 'name' ;
Joints : 'Joints' | 'joints' ;
Dynamic : 'Dynamic' | 'dynamic' ;
Static : 'Static' | 'static' ;
Collider : 'Collider' | 'collider' ;
Hidden : 'Hidden' | 'hidden' ;
Where : 'where' | 'Where' ;
And : 'and' | 'And' ;
In : 'in' | 'In' ;
Then : 'then' | 'Then' ;
Rows : 'rows' | 'Rows' ;
Cols : 'cols' | 'Cols' ;
To: 'to' | 'To' ;
Be : 'Be' | 'be' ;
Frames : 'frames' | 'Frames' | 'frame' | 'Frame' ;
Seconds : 'seconds' | 'Seconds' | 'second' | 'Second' ;
Wait : 'Wait' | 'wait' ;
Using : 'Using' | 'using' ;
At : 'at' | 'At' ;
Speed : 'speed' | 'Speed' ;
Of : 'of' | 'Of' ;
Rotate : 'Rotate' | 'rotate' ;
Scale : 'Scale' | 'scale' ;
Mass : 'Mass' | 'mass' ;
Velocity : 'Velocity' | 'velocity' ;
Angular : 'Angular' | 'angular' ;
Restitution : 'Restitution' | 'restitution' ;
Data : 'Data' | 'data' ;
Move : 'Move' | 'move' ;
Belongs : 'Belongs' | 'belongs' ;
The : 'The' | 'the' ;
Group : 'Group' | 'group' ;
Look : 'Look' | 'look' ;
Looking : 'Looking' | 'looking' ;
Roll : 'Roll' | 'roll' ;
Turn : 'Turn' | 'turn' ;
Forward : 'Forward' | 'forward' ;
Backward : 'Backward' | 'backward' ;
Left : 'Left' | 'left' ;
Right : 'Right' | 'right' ;
Up : 'Up' | 'up' ;
Down : 'Down' | 'down' ;
Code : 'Code' | 'code' ;
Light : 'Light' | 'light' ;
Lights : 'Lights' | 'lights' ;
Add : 'Add' | 'add' ;
Probe : 'Probe' | 'probe' ;
Minimap : 'Minimap' | 'minimap' ;
Play : 'Play' | 'play' ;
Sound : 'Sound' | 'sound' ;
Audio : 'Audio' | 'audio' ;
Hide : 'Hide' | 'hide' ;
Kill : 'Kill' | 'kill' ;
Show : 'Show' | 'show' ;
Hour : 'Hour' | 'hour' ;
Wireframe : 'Wireframe' | 'wireframe' ;
Info : 'Info' | 'info' ;
Speedo : 'Speedo' | 'speedo' ;
Tacho : 'Tacho' | 'tacho' ;
Outline : 'Outline' | 'outline' ;
Delete : 'Delete' | 'delete' ;
Accelerate : 'Accelerate' | 'accelerate' ;
Steer : 'Steer' | 'steer' ;
Brake : 'Brake' | 'brake';
Turbo : 'Turbo' | 'turbo' ;
Reset : 'Reset' | 'reset' ;
Front : 'Front' | 'front' ;
Rear : 'Rear' | 'rear' ;
Input : 'Input' | 'input' ;
Reverse : 'Reverse' | 'reverse' ;
Break : 'Break' | 'break' ;
HandBrake : 'HandBrake' | 'handbrake' | 'Handbrake' | 'handBrake' ;
Horn : 'Horn' | 'horn' ;
Engine : 'Engine' | 'engine' ;
Power : 'Power' | 'power' ;
Breaking : 'Breaking' | 'breaking' ;
Friction : 'Friction' | 'friction' ;
Suspension : 'Suspension' | 'suspension' ;
Compression : 'Compression' | 'compression' ;
Damping : 'Damping' | 'damping' ;
Stiffness : 'Stiffness' | 'stiffness' ;
Length : 'Length' | 'length' ;
Stop : 'Stop' | 'stop' ;
Return : 'Return' | 'return' ;
Animate : 'Animate' | 'animate';
Animation : 'Animation' | 'animation' ;
Print : 'Print' | 'print' ;
Append : 'Append' | 'append' ;
Color : 'Color' | 'color' ;
Font : 'Font' | 'font' ;
SystemColor : Red | Green | Blue | White | Black | Brown | Cyan |
Gray | DarkGray | Green | LightGray | Magenta | Orange | Pink | Yellow ;
Red : 'Red' | 'red' ;
Green : 'Green' | 'green' ;
Blue : 'Blue' | 'blue' ;
White : 'White' | 'white' ;
Black: 'Black' | 'black' ;
Brown: 'Brown' | 'brown' ;
Cyan: 'Cyan' | 'cyan' ;
Gray: 'Gray' | 'gray' ;
DarkGray : 'DarkGray' | 'darkGray' | 'darkgray' ;
LightGray : 'LightGray' | 'lightGray' | 'lightgray' ;
Magenta : 'Magenta' | 'magenta' ;
Orange : 'Orange' | 'orange' ;
Pink : 'Pink' | 'pink' ;
Yellow : 'Yellow' | 'yellow' ;
Ray : 'Ray' | 'ray' ;
Check : 'Check' | 'check' ;
Pos : 'Pos' | 'pos' ;
Size : 'Size' | 'size' ;
Height : 'Height' | 'height' ;
Follow : 'Follow' | 'follow' ;
File : 'File' | 'file' ;
Clear : 'Clear' | 'clear' ;
Switch : 'Switch' | 'switch' ;
//Car : 'Car' | 'car' ;
Vehicle : 'Vehicle' | 'vehicle' ;
Character : 'Character' | 'character' ;
Jump : 'Jump' | 'jump' ;
RagDoll : 'Ragdoll' | 'ragdoll' ;
Kinematic : 'Kinematic' | 'kinematic' ;
Floating : 'Floating' | 'floating' ;
Rigid : 'Rigid' | 'rigid' ;
Body : 'Body' | 'body' ;
Screen : 'Screen' | 'screen' ;
Scene : 'Scene' | 'scene' ;
Pause : 'Pause' | 'pause' ;
Resume : 'Resume' | 'resume' ;
Record : 'Record' | 'record' ;
Transitions : 'Transitions' | 'transitions' ;
Commands : 'Commands' | 'commands' ;
Save : 'Save' | 'save' ;
Mode : 'Mode' | 'mode' ;
Full : 'Full' | 'full' ;
Window : 'Window' | 'window' ;
//Scope : 'public' | 'Public' | 'private' | 'Private' ;
Class : 'class' | 'Class' ;
Function : 'Function' | 'function' ;
Run : 'Run' | 'run' ;
Call : 'Call' | 'call' ;
Every : 'Every' | 'every' ;
Extends : 'extends' | 'Extends' ;
//Void : 'void' ;
//Int : 'int' | 'Int';
//String : 'String' ;
//Float : 'float' ;
Var : 'Var' | 'var' ;
Equals : '=' ;
New : 'new' ;
When : 'When' | 'when' ;
Collides : 'Collides' | 'collides' ;
With : 'With' | 'with' ;
/////////////////////////////////// LOGICAL EXPRESSION TOKENS /////////////////
OR : '||' | 'or' | 'Or';
AND : '&&' | And ;
EQUALS
: '==';
NOTEQUALS
: '!=' | '<>';
LT : '<';
LTEQ : '<=';
GT : '>';
GTEQ : '>=';
PLUS : '+';
MINUS : '-';
MULT : '*';
DIV : '/';
MOD : '%';
NOT : '!' | 'not' | 'Not';
//INTEGER
// : '-'? ('0'..'9')+
// ;
//FLOAT
// : '-'? ('0'..'9')+ '.' ('0'..'9')+
// ;
//STRING
// : '\'' (~ '\'' )* '\''
// ;
DATETIME
: '#' (~ '#' )* '#'
;
BOOLEAN
: 'true'
| 'false'
;
KeyA : 'key a' | 'Key a' | 'key A' | 'Key A';
KeyB : 'key b' | 'Key b' | 'key B' | 'Key B';
KeyC : 'key c' | 'Key c' | 'key C' | 'Key C';
KeyD : 'key d' | 'Key d' | 'key D' | 'Key D';
KeyE : 'key e' | 'Key e' | 'key E' | 'Key E';
KeyF : 'key f' | 'Key f' | 'key F' | 'Key F';
KeyG : 'key g' | 'Key g' | 'key G' | 'Key G';
KeyH : 'key h' | 'Key h' | 'key H' | 'Key H';
KeyI : 'key i' | 'Key i' | 'key I' | 'Key I';
KeyJ : 'key j' | 'Key j' | 'key J' | 'Key J';
KeyK : 'key k' | 'Key k' | 'key K' | 'Key K';
KeyL : 'key l' | 'Key l' | 'key L' | 'Key L';
KeyM : 'key m' | 'Key m' | 'key M' | 'Key M';
KeyN : 'key n' | 'Key n' | 'key N' | 'Key N';
KeyO : 'key o' | 'Key o' | 'key O' | 'Key O';
KeyP : 'key p' | 'Key p' | 'key P' | 'Key P';
KeyQ : 'key q' | 'Key q' | 'key Q' | 'Key Q';
KeyR : 'key r' | 'Key r' | 'key R' | 'Key R';
KeyS : 'key s' | 'Key s' | 'key S' | 'Key S';
KeyT : 'key t' | 'Key t' | 'key T' | 'Key T';
KeyU : 'key u' | 'Key u' | 'key U' | 'Key U';
KeyV : 'key v' | 'Key v' | 'key V' | 'Key V';
KeyW : 'key w' | 'Key w' | 'key W' | 'Key W';
KeyX : 'key x' | 'Key x' | 'key X' | 'Key X';
KeyY : 'key y' | 'Key y' | 'key Y' | 'Key Y';
KeyZ : 'key z' | 'Key z' | 'key Z' | 'Key Z';
Key0 : 'key 0' | 'Key 0' ;
Key1 : 'key 1' | 'Key 1' ;
Key2 : 'key 2' | 'Key 2' ;
Key3 : 'key 3' | 'Key 3' ;
Key4 : 'key 4' | 'Key 4' ;
Key5 : 'key 5' | 'Key 5' ;
Key6 : 'key 6' | 'Key 6' ;
Key7 : 'key 7' | 'Key 7' ;
Key8 : 'key 8' | 'Key 8' ;
Key9 : 'key 9' | 'Key 9' ;
MouseLeft : 'mouse left' | 'Mouse left' | 'mouse Left' | 'Mouse Left' ;
MouseRight : 'mouse right' | 'Mouse right' | 'mouse Right' | 'Mouse Right' ;
KeyDel : 'key del' | 'Key del' | 'key Del' | 'Key Del' ;
KeySPACE : 'key space' | 'Key space' | 'key Space' | 'Key Space';
KeyLeft : 'key left' | 'Key left' | 'key Left' | 'Key Left';
KeyRight : 'key right' | 'Key right' | 'key Right' | 'Key Right';
KeyUp : 'key up' | 'Key up' | 'key Up' | 'Key Up';
KeyDown : 'key down' | 'Key down' | 'key Down' | 'Key Down';
Is : 'Is' | 'is' ;
Pressed : 'Pressed' | 'pressed' ;
//////////////////////////////////////////////
//NumberSign : [+-] ;
DecimalDigit : [0-9]+ ;
ID : [a-zA-Z_$][a-zA-Z_$0-9]* ;
fragment ESCAPED_QUOTE : '\\"';
QUOTED_STRING : '"' ( ESCAPED_QUOTE | ~('\n'|'\r') )*? '"';
// : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
WS : [ \r\n\t] + -> channel (HIDDEN) ;
LINE_COMMENT : '//' ~[\r\n]* -> skip ;
BlockComment : '/*' .*? '*/' -> skip ; |
print/outlib.asm | exucutional/study_asm | 0 | 13359 | ;------------------outlib.asm-----------------------
section .data
buff times 256 db 0
section .code
;------------------------------------------------
;Name: axoutdec
;Entry: rax = number
;Exit:
;Destr: rax, rbx, rcx, rdx, rdi, rsi
;------------------------------------------------
axoutdec:
push rbp
mov rbp, rsp
mov rcx, 0
mov rdi, buff
mov rbx, 10d
divoutd:
mov rdx, 0
div rbx
add rdx, '0'
push rdx
inc rcx
cmp rax, 0
jne divoutd
mov rdx, rcx ;length
decbuffwrite:
pop rax
cld ;di ahead
stosb
loop decbuffwrite
mov rax, 1 ;sys_write
mov rsi, buff ;string
mov rdi, 1 ;file descriptor
syscall
pop rbp
ret
;------------------------------------------------
;Name: axouthex
;Entry: ax = number
;Exit:
;Destr: rax, rbx, rcx, rdx, rdi, rsi
;------------------------------------------------
axouthex:
push rbp
mov rbp, rsp
mov rcx, 0
mov rdi, buff
divouth:
mov rbx, 000Fh
and rbx, rax
shr ax, 4
cmp rbx, 10d
jge notnum
add rbx, '0'
jmp next
notnum:
sub rbx, 10d
add rbx, 'a'
next:
push rbx
inc rcx
cmp ax, 0
jne divouth
mov rdx, rcx
hexbuffwrite:
pop rax
cld ;di ahead
stosb
loop hexbuffwrite
mov rax, 1 ;sys_write
mov rsi, buff ;string
mov rdi, 1 ;file descriptor
syscall
pop rbp
ret
;------------------------------------------------
;Name: axoutbin
;Entry: ax = number
;Exit:
;Destr: rax, rbx, rcx, rdx, rdi, rsi
;------------------------------------------------
axoutbin:
push rbp
mov rbp, rsp
mov rcx, 0
mov rdi, buff
divoutb:
mov rbx, 0001h
and rbx, rax
add rbx, '0'
push rbx
shr rax, 1
inc rcx
cmp rax, 0
jne divoutb
mov rdx, rcx
binbuffwrite:
pop rax
cld ;di ahead
stosb
loop hexbuffwrite
mov rax, 1 ;sys_write
mov rsi, buff ;string
mov rdi, 1 ;file descriptor
syscall
pop rbp
ret
|
oeis/084/A084773.asm | neoneye/loda-programs | 11 | 12688 | ; A084773: Coefficients of 1/sqrt(1-12*x+4*x^2); also, a(n) is the central coefficient of (1+6x+8x^2)^n.
; Submitted by <NAME>
; 1,6,52,504,5136,53856,575296,6225792,68026624,748832256,8291791872,92255680512,1030537089024,11550176206848,129824329777152,1462841567576064,16518691986407424,186887008999047168,2117944490818011136,24038305911245635584,273199990096465494016,3108768242420517175296,35414245789835924078592,403838032953160608251904,4609342278338599437991936,52655127146721792655097856,601982103040884946486951936,6887191686805272094322982912,78848542482761579175214055424,903270208971802400115828719616
mov $1,$0
mov $0,2
pow $0,$1
seq $1,1850 ; Central Delannoy numbers: a(n) = Sum_{k=0..n} C(n,k)*C(n+k,k).
mul $1,$0
mov $0,$1
|
awesome/c_cpp/cpp-cheat/gcc/ada/main.adb | liujiamingustc/phd | 3 | 10436 | <filename>awesome/c_cpp/cpp-cheat/gcc/ada/main.adb
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
Put_Line ("hello world");
end Main;
|
src/tokens.adb | aeszter/lox-spark | 6 | 11952 | package body Tokens with SPARK_Mode is
function New_Token
(Kind : Token_Kind;
Lexeme : String;
Line : Positive)
return Token
is
begin
return Token'(Kind => Kind,
Lexeme => L_Strings.To_Bounded_String (Lexeme),
Line => Line);
end New_Token;
function To_String (T : Token) return String is
begin
return To_String (T.Kind) & L_Strings.To_String (T.Lexeme);
end To_String;
function To_String (T : Token_Kind) return String is
Image : constant String := Token_Kind'Image (T);
Result : constant String (1 .. Image'Length) := Image;
begin
if Result'Length < 100 then
return Result;
else
return Result (Result'First .. Result'First + 99);
end if;
end To_String;
end Tokens;
|
tables/crc32k-table256.asm | dougmasten/crc32-6x09 | 6 | 15666 | <filename>tables/crc32k-table256.asm
; crc32k-table256.asm
; Polynomial - $eb31d82e
fqb $00000000,$9695c4ca,$fb4839c9,$6dddfd03,$20f3c3cf,$b6660705,$dbbbfa06,$4d2e3ecc
fqb $41e7879e,$d7724354,$baafbe57,$2c3a7a9d,$61144451,$f781809b,$9a5c7d98,$0cc9b952
fqb $83cf0f3c,$155acbf6,$788736f5,$ee12f23f,$a33cccf3,$35a90839,$5874f53a,$cee131f0
fqb $c22888a2,$54bd4c68,$3960b16b,$aff575a1,$e2db4b6d,$744e8fa7,$199372a4,$8f06b66e
fqb $d1fdae25,$47686aef,$2ab597ec,$bc205326,$f10e6dea,$679ba920,$0a465423,$9cd390e9
fqb $901a29bb,$068fed71,$6b521072,$fdc7d4b8,$b0e9ea74,$267c2ebe,$4ba1d3bd,$dd341777
fqb $5232a119,$c4a765d3,$a97a98d0,$3fef5c1a,$72c162d6,$e454a61c,$89895b1f,$1f1c9fd5
fqb $13d52687,$8540e24d,$e89d1f4e,$7e08db84,$3326e548,$a5b32182,$c86edc81,$5efb184b
fqb $7598ec17,$e30d28dd,$8ed0d5de,$18451114,$556b2fd8,$c3feeb12,$ae231611,$38b6d2db
fqb $347f6b89,$a2eaaf43,$cf375240,$59a2968a,$148ca846,$82196c8c,$efc4918f,$79515545
fqb $f657e32b,$60c227e1,$0d1fdae2,$9b8a1e28,$d6a420e4,$4031e42e,$2dec192d,$bb79dde7
fqb $b7b064b5,$2125a07f,$4cf85d7c,$da6d99b6,$9743a77a,$01d663b0,$6c0b9eb3,$fa9e5a79
fqb $a4654232,$32f086f8,$5f2d7bfb,$c9b8bf31,$849681fd,$12034537,$7fdeb834,$e94b7cfe
fqb $e582c5ac,$73170166,$1ecafc65,$885f38af,$c5710663,$53e4c2a9,$3e393faa,$a8acfb60
fqb $27aa4d0e,$b13f89c4,$dce274c7,$4a77b00d,$07598ec1,$91cc4a0b,$fc11b708,$6a8473c2
fqb $664dca90,$f0d80e5a,$9d05f359,$0b903793,$46be095f,$d02bcd95,$bdf63096,$2b63f45c
fqb $eb31d82e,$7da41ce4,$1079e1e7,$86ec252d,$cbc21be1,$5d57df2b,$308a2228,$a61fe6e2
fqb $aad65fb0,$3c439b7a,$519e6679,$c70ba2b3,$8a259c7f,$1cb058b5,$716da5b6,$e7f8617c
fqb $68fed712,$fe6b13d8,$93b6eedb,$05232a11,$480d14dd,$de98d017,$b3452d14,$25d0e9de
fqb $2919508c,$bf8c9446,$d2516945,$44c4ad8f,$09ea9343,$9f7f5789,$f2a2aa8a,$64376e40
fqb $3acc760b,$ac59b2c1,$c1844fc2,$57118b08,$1a3fb5c4,$8caa710e,$e1778c0d,$77e248c7
fqb $7b2bf195,$edbe355f,$8063c85c,$16f60c96,$5bd8325a,$cd4df690,$a0900b93,$3605cf59
fqb $b9037937,$2f96bdfd,$424b40fe,$d4de8434,$99f0baf8,$0f657e32,$62b88331,$f42d47fb
fqb $f8e4fea9,$6e713a63,$03acc760,$953903aa,$d8173d66,$4e82f9ac,$235f04af,$b5cac065
fqb $9ea93439,$083cf0f3,$65e10df0,$f374c93a,$be5af7f6,$28cf333c,$4512ce3f,$d3870af5
fqb $df4eb3a7,$49db776d,$24068a6e,$b2934ea4,$ffbd7068,$6928b4a2,$04f549a1,$92608d6b
fqb $1d663b05,$8bf3ffcf,$e62e02cc,$70bbc606,$3d95f8ca,$ab003c00,$c6ddc103,$504805c9
fqb $5c81bc9b,$ca147851,$a7c98552,$315c4198,$7c727f54,$eae7bb9e,$873a469d,$11af8257
fqb $4f549a1c,$d9c15ed6,$b41ca3d5,$2289671f,$6fa759d3,$f9329d19,$94ef601a,$027aa4d0
fqb $0eb31d82,$9826d948,$f5fb244b,$636ee081,$2e40de4d,$b8d51a87,$d508e784,$439d234e
fqb $cc9b9520,$5a0e51ea,$37d3ace9,$a1466823,$ec6856ef,$7afd9225,$17206f26,$81b5abec
fqb $8d7c12be,$1be9d674,$76342b77,$e0a1efbd,$ad8fd171,$3b1a15bb,$56c7e8b8,$c0522c72
|
oeis/036/A036580.asm | neoneye/loda-programs | 11 | 174183 | <filename>oeis/036/A036580.asm
; A036580: Ternary Thue-Morse sequence: closed under a->abc, b->ac, c->b.
; Submitted by <NAME>
; 0,1,2,0,2,1,0,1,2,1,0,2,0,1,2,0,2,1,0,2,0,1,2,1,0,1,2,0,2,1,0,1,2,1,0,2,0,1,2,1,0,1,2,0,2,1,0,2,0,1,2,0,2,1,0,1,2,1,0,2,0,1,2,0,2,1,0,2,0,1,2,1,0,1,2,0,2,1,0,2,0,1,2,0,2,1,0,1,2,1,0,2,0,1,2,1,0,1,2
seq $0,36585 ; Ternary Thue-Morse sequence: closed under a->abc, b->ac, c->b.
mul $0,-1
add $0,3
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca_notsx.log_21829_1116.asm | ljhsiun2/medusa | 9 | 4768 | <filename>Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca_notsx.log_21829_1116.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xcf6d, %rdi
nop
nop
xor %r13, %r13
mov (%rdi), %rbp
nop
nop
nop
nop
nop
add $57088, %r9
lea addresses_WC_ht+0x1d1fd, %rsi
lea addresses_WC_ht+0x59d5, %rdi
nop
nop
xor $28404, %r8
mov $21, %rcx
rep movsw
nop
nop
nop
nop
sub $55446, %rbp
lea addresses_WC_ht+0x73f5, %rsi
lea addresses_UC_ht+0x1263d, %rdi
nop
nop
nop
nop
add %r9, %r9
mov $5, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $59475, %r9
lea addresses_UC_ht+0x3047, %rsi
lea addresses_D_ht+0x1033d, %rdi
nop
nop
nop
xor %rbp, %rbp
mov $50, %rcx
rep movsq
nop
xor %rdi, %rdi
lea addresses_normal_ht+0x110ed, %r13
nop
nop
nop
nop
xor $9878, %rcx
movb $0x61, (%r13)
nop
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_D_ht+0x13bfd, %r9
nop
nop
nop
nop
and %r13, %r13
mov (%r9), %ebp
nop
nop
dec %r8
lea addresses_WT_ht+0xa73d, %r8
nop
nop
nop
nop
inc %rdi
movups (%r8), %xmm5
vpextrq $0, %xmm5, %rbp
nop
nop
inc %r8
lea addresses_A_ht+0x1031d, %rsi
lea addresses_A_ht+0x1cb3d, %rdi
nop
nop
nop
nop
nop
add $50053, %r10
mov $6, %rcx
rep movsl
inc %r13
lea addresses_normal_ht+0xab3d, %rsi
lea addresses_WC_ht+0x1787d, %rdi
dec %r13
mov $100, %rcx
rep movsl
sub $27888, %r9
lea addresses_A_ht+0x2a1b, %rsi
nop
nop
nop
nop
and $32416, %r10
mov $0x6162636465666768, %rdi
movq %rdi, (%rsi)
nop
nop
nop
nop
xor %r13, %r13
lea addresses_WT_ht+0x1a33d, %r13
nop
nop
nop
nop
nop
sub %rbp, %rbp
mov (%r13), %r8w
nop
nop
nop
cmp $14566, %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_RW+0x1c9d2, %rsi
lea addresses_WC+0x12c33, %rdi
clflush (%rsi)
nop
nop
and $20819, %rbx
mov $19, %rcx
rep movsb
nop
nop
nop
xor $22440, %rbx
// Store
lea addresses_A+0x140cd, %r15
nop
nop
dec %r13
mov $0x5152535455565758, %rsi
movq %rsi, %xmm2
movups %xmm2, (%r15)
nop
nop
nop
nop
and %rcx, %rcx
// Load
lea addresses_PSE+0x1cfbe, %rbx
nop
nop
nop
nop
nop
xor $54400, %rcx
mov (%rbx), %r13
nop
nop
nop
nop
nop
add $44788, %rbx
// Store
lea addresses_UC+0x15b3d, %rbx
nop
nop
nop
nop
and %r13, %r13
mov $0x5152535455565758, %r15
movq %r15, %xmm7
vmovups %ymm7, (%rbx)
xor %r13, %r13
// Store
lea addresses_normal+0x1c9f5, %rcx
and %rbx, %rbx
mov $0x5152535455565758, %rdi
movq %rdi, (%rcx)
nop
nop
nop
nop
nop
sub $64921, %r13
// Store
lea addresses_A+0x1e3d, %rbp
xor $58974, %rcx
mov $0x5152535455565758, %r13
movq %r13, %xmm1
and $0xffffffffffffffc0, %rbp
movntdq %xmm1, (%rbp)
cmp $48741, %rdi
// Store
lea addresses_UC+0x1453d, %rbx
nop
nop
nop
cmp $35054, %rdi
movb $0x51, (%rbx)
nop
nop
nop
nop
inc %rcx
// Faulty Load
lea addresses_UC+0x15b3d, %rcx
nop
nop
cmp %rdi, %rdi
mov (%rcx), %rsi
lea oracles, %r13
and $0xff, %rsi
shlq $12, %rsi
mov (%r13,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_WC'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'src': {'NT': True, 'AVXalign': True, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 7, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 9, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 11, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
smsq/qpc/ip/init.asm | olifink/smsqe | 0 | 171747 | ; IP initialisation V1.00 2004 <NAME>
section ip
xdef ip_init
xref.l ip_vers
xref ip_io
xref ip_open
xref ip_close
xref ip_cnam
xref iou_idset
xref iou_idlk
include 'dev8_mac_vec'
include 'dev8_keys_iod'
include 'dev8_smsq_qpc_keys'
include 'dev8_smsq_qpc_ip_data'
;+++
; Initialise IP devices.
;
; status return standard
;---
ip_init
dc.w qpc.ipcla ; close all previous sockets
lea ip_link,a3
jsr iou_idset ; setup IP linkage
jmp iou_idlk ; and link in
ip_link
dc.l ipd_end+iod.sqhd
dc.l 1<<iod..ssr+1<<iod..scn ; serial and name
novec ; no servers
novec
novec
vec ip_io ; but a full set of opens
vec ip_open
vec ip_close
vec ip_cnam ; name
end
|
alloy4fun_models/trashltl/models/3/TuwaxqAH9GK9LsaF6.als | Kaixi26/org.alloytools.alloy | 0 | 618 | open main
pred idTuwaxqAH9GK9LsaF6_prop4 {
some f: File | eventually f in Trash
}
pred __repair { idTuwaxqAH9GK9LsaF6_prop4 }
check __repair { idTuwaxqAH9GK9LsaF6_prop4 <=> prop4o } |
runtime-only.agda | heades/AUGL | 0 | 8990 | {- In some cases you may want to block certain terms from being
evaluated by Agda at compile time. I found I needed to do this
when generating large terms intended for evaluation at run-time only.
You can use the runtime-only function for this. If its first
argument is tt, then we will use a postulate runtime-identity
to block Agda's compile-time evaluation. Otherwise, we will
not block compile-time evaluation. -}
module runtime-only where
open import bool
postulate
runtime-identity : ∀{A : Set} → A → A
{-# COMPILED runtime-identity (\ _ x -> x ) #-}
runtime-only : ∀{A : Set} → 𝔹 → A → A
runtime-only ff = λ x → x
runtime-only tt = runtime-identity |
books/pc-assembly-language/linux-ex/j-prime.asm | kruschk/learning | 1 | 95385 | %include "asm_io.inc"
segment .data
Message db "Find primes up to: ", 0
segment .bss
Limit resd 1 ; find primes up to this limit
Guess resd 1 ; the current guess for the prime
segment .text
global asm_main
asm_main:
enter 0, 0 ;setup routine
pusha
mov eax, Message ; move pointer to message into eax register
call print_string ; print Message
call read_int ; scanf("%u", &limit); (read int into eax)
mov [Limit], eax
mov eax, 2 ; printf("2\n");
call print_int
call print_nl
mov eax, 3 ; printf("3\n");
call print_int
call print_nl
mov dword [Guess], 5 ; Guess = 5;
while_limit: ; while (Guess < Limit)
mov eax, [Guess]
cmp eax, [Limit]
jnbe end_while_limit ; use jnbe since numbers are unsigned
mov ebx, 3 ; ebx is factor = 3;
while_factor:
mov eax, ebx
mul eax ; edx:eax = eax*eax
jo end_while_factor ; if answer won't fit in eax alone
cmp eax, [Guess]
jnb end_while_factor ; if !(factor*factor < guess)
mov eax, [Guess]
mov edx, 0
div ebx ; edx = edx:eax % ebx
cmp edx, 0
je end_while_factor ; if !(guess % factor != 0)
add ebx, 2 ; factor += 2;
jmp while_factor
end_while_factor:
je end_if ; if !(guess % factor != 0)
mov eax, [Guess] ; printf("%u\n:)
call print_int
call print_nl
end_if:
add dword [Guess], 2 ; guess += 2
jmp while_limit
end_while_limit:
popa
mov eax, 0 ; return back to C
leave
ret
|
smsq/sms/alhp.asm | olifink/smsqe | 0 | 174042 | ; Allocate in heap V2.01 1986 <NAME> QJUMP
section sms
xdef sms_alhp
xref mem_alhp ; allocate in heap
xref sms_rte ; return
include 'dev8_keys_psf'
;+++
; d0 0 or out of memory
; d1 cr space required / space allocated
; a0 cr ptr to free space link / base address of area allocated
; a6 (trap entry) base address for a0
;
; all other registers preserved
;---
sms_alhp
move.l psf_a6(a7),d7 ; base address
add.l d7,a0 ; ... make absolute
bsr.l mem_alhp ; allocate
sub.l d7,a0 ; ... make relative
bra.l sms_rte
end
|
source/asis/spec/annex_g/ada-numerics-generic_complex_elementary_functions.ads | faelys/gela-asis | 4 | 18054 | <reponame>faelys/gela-asis<gh_stars>1-10
------------------------------------------------------------------------------
-- A d a r u n - t i m e s p e c i f i c a t i o n --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of ada.ads file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
with Ada.Numerics.Generic_Complex_Types;
generic
with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (<>);
package Ada.Numerics.Generic_Complex_Elementary_Functions is
pragma Pure (Generic_Complex_Elementary_Functions);
function Sqrt (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Log (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Exp (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Exp (X : in Complex_Types.Imaginary) return Complex_Types.Complex;
function "**" (Left : in Complex_Types.Complex;
Right : in Complex_Types.Complex)
return Complex_Types.Complex;
function "**" (Left : in Complex_Types.Complex;
Right : in Complex_Types.Real'Base)
return Complex_Types.Complex;
function "**" (Left : in Complex_Types.Real'Base;
Right : in Complex_Types.Complex)
return Complex_Types.Complex;
function Sin (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Cos (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Tan (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Cot (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Arcsin (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arccos (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arctan (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arccot (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Sinh (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Cosh (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Tanh (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Coth (X : in Complex_Types.Complex) return Complex_Types.Complex;
function Arcsinh (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arccosh (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arctanh (X : in Complex_Types.Complex)
return Complex_Types.Complex;
function Arccoth (X : in Complex_Types.Complex)
return Complex_Types.Complex;
end Ada.Numerics.Generic_Complex_Elementary_Functions;
|
Appl/Art/Decks/GeoDeck/LCSpade7.asm | steakknife/pcgeos | 504 | 11582 | <reponame>steakknife/pcgeos<filename>Appl/Art/Decks/GeoDeck/LCSpade7.asm
LCSpade7 label byte
word C_BLACK
Bitmap <71,100,BMC_PACKBITS,BMF_MONO>
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0x01, 0x0f, 0xf8, 0xfa, 0x00
db 0x01, 0x0f, 0xf8, 0xfa, 0x00
db 0x01, 0x0c, 0x18, 0xfa, 0x00
db 0x01, 0x0c, 0x38, 0xfa, 0x00
db 0x01, 0x00, 0x30, 0xfa, 0x00
db 0x01, 0x00, 0x60, 0xfa, 0x00
db 0x01, 0x00, 0x60, 0xfa, 0x00
db 0x05, 0x00, 0xc0, 0x00, 0x80, 0x00, 0x02, 0xfe,
0x00
db 0x05, 0x00, 0xc0, 0x01, 0xc0, 0x00, 0x07, 0xfe,
0x00
db 0x08, 0x01, 0x80, 0x03, 0xe0, 0x00, 0x0f, 0x80,
0x00, 0x00
db 0x08, 0x01, 0x80, 0x06, 0xf0, 0x00, 0x1b, 0xc0,
0x00, 0x00
db 0x08, 0x01, 0x80, 0x0d, 0xf8, 0x00, 0x37, 0xe0,
0x00, 0x00
db 0x08, 0x01, 0x80, 0x1b, 0xfc, 0x00, 0x6f, 0xf0,
0x00, 0x00
db 0x08, 0x01, 0x80, 0x17, 0xfc, 0x00, 0x5f, 0xf0,
0x00, 0x00
db 0x08, 0x01, 0x80, 0x3f, 0xfe, 0x00, 0xff, 0xf8,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0xff, 0xf8,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0xff, 0xf8,
0x00, 0x00
db 0x08, 0x00, 0x80, 0x3f, 0xfe, 0x00, 0xff, 0xf8,
0x00, 0x00
db 0x08, 0x01, 0xc0, 0x1e, 0xbc, 0x00, 0x7a, 0xf0,
0x00, 0x00
db 0x05, 0x02, 0xe0, 0x01, 0xc0, 0x00, 0x07, 0xfe,
0x00
db 0x08, 0x05, 0xf0, 0x03, 0xe0, 0x00, 0x0f, 0x80,
0x00, 0x00
db 0x01, 0x0b, 0xf8, 0xfa, 0x00
db 0x01, 0x0f, 0xf8, 0xfa, 0x00
db 0x04, 0x0f, 0xf8, 0x00, 0x00, 0x10, 0xfd, 0x00
db 0x04, 0x06, 0xb0, 0x00, 0x00, 0x38, 0xfd, 0x00
db 0x04, 0x01, 0xc0, 0x00, 0x00, 0x7c, 0xfd, 0x00
db 0x04, 0x03, 0xe0, 0x00, 0x00, 0xde, 0xfd, 0x00
db 0xfe, 0x00, 0x01, 0x01, 0xbf, 0xfd, 0x00
db 0xfe, 0x00, 0x02, 0x03, 0x7f, 0x80, 0xfe, 0x00
db 0xfe, 0x00, 0x02, 0x02, 0xff, 0x80, 0xfe, 0x00
db 0xfe, 0x00, 0x02, 0x07, 0xff, 0xc0, 0xfe, 0x00
db 0xfe, 0x00, 0x02, 0x07, 0xff, 0xc0, 0xfe, 0x00
db 0xfe, 0x00, 0x02, 0x07, 0xff, 0xc0, 0xfe, 0x00
db 0xfe, 0x00, 0x02, 0x07, 0xff, 0xc0, 0xfe, 0x00
db 0xfe, 0x00, 0x02, 0x03, 0xd7, 0x80, 0xfe, 0x00
db 0xfd, 0x00, 0x00, 0x38, 0xfd, 0x00
db 0xfd, 0x00, 0x00, 0x7c, 0xfd, 0x00
db 0xf8, 0x00
db 0xfe, 0x00, 0x02, 0x80, 0x00, 0x02, 0xfe, 0x00
db 0x05, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x07, 0xfe,
0x00
db 0x08, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x0f, 0x80,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x06, 0xf0, 0x00, 0x1b, 0xc0,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x0d, 0xf8, 0x00, 0x37, 0xe0,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x1b, 0xfc, 0x00, 0x6f, 0xf0,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x17, 0xfc, 0x00, 0x5f, 0xf0,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0xff, 0xf8,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0xff, 0xf8,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0xff, 0xf8,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0xff, 0xf8,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x1e, 0xbc, 0x00, 0x7a, 0xf0,
0x00, 0x00
db 0x05, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x07, 0xfe,
0x00
db 0x08, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x0f, 0x80,
0x00, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xfa, 0x00, 0x01, 0x0f, 0x80
db 0xfa, 0x00, 0x01, 0x07, 0x00
db 0xfa, 0x00, 0x01, 0x1a, 0xc0
db 0xfa, 0x00, 0x01, 0x2f, 0x60
db 0xfa, 0x00, 0x01, 0x3f, 0xe0
db 0xfa, 0x00, 0x01, 0x3f, 0xe0
db 0x08, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x0f, 0x80,
0x1f, 0xc0
db 0x08, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x07, 0x00,
0x0f, 0x80
db 0x08, 0x00, 0x00, 0x1e, 0xbc, 0x00, 0x7a, 0xf0,
0x07, 0x00
db 0x08, 0x00, 0x00, 0x37, 0xf6, 0x00, 0xdf, 0xd8,
0x02, 0x00
db 0x08, 0x00, 0x00, 0x2f, 0xee, 0x00, 0xbf, 0xb8,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0xff, 0xf8,
0x00, 0x00
db 0x08, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0xff, 0xf8,
0x03, 0x00
db 0x08, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x7f, 0xf0,
0x03, 0x00
db 0x08, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x7f, 0xf0,
0x03, 0x00
db 0x08, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x3f, 0xe0,
0x03, 0x00
db 0x08, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x1f, 0xc0,
0x03, 0x00
db 0x08, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x0f, 0x80,
0x03, 0x00
db 0x08, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x07, 0x00,
0x06, 0x00
db 0xfe, 0x00, 0x05, 0x80, 0x00, 0x02, 0x00, 0x06,
0x00
db 0xfa, 0x00, 0x01, 0x0c, 0x00
db 0xfa, 0x00, 0x01, 0x0c, 0x00
db 0xfa, 0x00, 0x01, 0x18, 0x00
db 0xfa, 0x00, 0x01, 0x38, 0x60
db 0xfa, 0x00, 0x01, 0x30, 0x60
db 0xfa, 0x00, 0x01, 0x3f, 0xe0
db 0xfa, 0x00, 0x01, 0x3f, 0xe0
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
db 0xf8, 0x00
|
libc/arch/call.asm | nop-os/nop | 9 | 85273 | <reponame>nop-os/nop<filename>libc/arch/call.asm<gh_stars>1-10
global nop_call
nop_call:
mov esi, [esp + 4]
mov eax, [esp + 8]
mov ebx, [esp + 12]
mov ecx, [esp + 16]
mov edx, [esp + 20]
mov edi, [esp + 24]
int 0x30
ret
|
gcc-gcc-7_3_0-release/gcc/ada/exp_smem.adb | best08618/asylo | 7 | 1396 | <gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ S M E M --
-- --
-- B o d y --
-- --
-- Copyright (C) 1998-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Einfo; use Einfo;
with Elists; use Elists;
with Exp_Ch7; use Exp_Ch7;
with Exp_Ch9; use Exp_Ch9;
with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
with Nmake; use Nmake;
with Namet; use Namet;
with Nlists; use Nlists;
with Rtsfind; use Rtsfind;
with Sem; use Sem;
with Sem_Aux; use Sem_Aux;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Stringt; use Stringt;
with Tbuild; use Tbuild;
package body Exp_Smem is
Insert_Node : Node_Id;
-- Node after which a write call is to be inserted
-----------------------
-- Local Subprograms --
-----------------------
procedure Add_Read (N : Node_Id; Call : Node_Id := Empty);
-- Insert a Shared_Var_ROpen call for variable before node N, unless
-- Call is a call to an init-proc, in which case the call is inserted
-- after Call.
procedure Add_Write_After (N : Node_Id);
-- Insert a Shared_Var_WOpen call for variable after the node Insert_Node,
-- as recorded by On_Lhs_Of_Assignment (where it points to the assignment
-- statement) or Is_Out_Actual (where it points to the subprogram call).
-- When Insert_Node is a function call, establish a transient scope around
-- the expression, and insert the write as an after-action of the transient
-- scope.
procedure Build_Full_Name (E : Entity_Id; N : out String_Id);
-- Build the fully qualified string name of a shared variable
function On_Lhs_Of_Assignment (N : Node_Id) return Boolean;
-- Determines if N is on the left hand of the assignment. This means that
-- either it is a simple variable, or it is a record or array variable with
-- a corresponding selected or indexed component on the left side of an
-- assignment. If the result is True, then Insert_Node is set to point
-- to the assignment
function Is_Out_Actual (N : Node_Id) return Boolean;
-- In a similar manner, this function determines if N appears as an OUT
-- or IN OUT parameter to a procedure call. If the result is True, then
-- Insert_Node is set to point to the call.
function Build_Shared_Var_Proc_Call
(Loc : Source_Ptr;
E : Node_Id;
N : Name_Id) return Node_Id;
-- Build a call to support procedure N for shared object E (provided by the
-- instance of System.Shared_Storage.Shared_Var_Procs associated to E).
--------------------------------
-- Build_Shared_Var_Proc_Call --
--------------------------------
function Build_Shared_Var_Proc_Call
(Loc : Source_Ptr;
E : Entity_Id;
N : Name_Id) return Node_Id
is
begin
return Make_Procedure_Call_Statement (Loc,
Name => Make_Selected_Component (Loc,
Prefix =>
New_Occurrence_Of (Shared_Var_Procs_Instance (E), Loc),
Selector_Name => Make_Identifier (Loc, N)));
end Build_Shared_Var_Proc_Call;
--------------
-- Add_Read --
--------------
procedure Add_Read (N : Node_Id; Call : Node_Id := Empty) is
Loc : constant Source_Ptr := Sloc (N);
Ent : constant Node_Id := Entity (N);
SVC : Node_Id;
begin
if Present (Shared_Var_Procs_Instance (Ent)) then
SVC := Build_Shared_Var_Proc_Call (Loc, Ent, Name_Read);
if Present (Call) and then Is_Init_Proc (Name (Call)) then
Insert_After_And_Analyze (Call, SVC);
else
Insert_Action (N, SVC);
end if;
end if;
end Add_Read;
-------------------------------
-- Add_Shared_Var_Lock_Procs --
-------------------------------
procedure Add_Shared_Var_Lock_Procs (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Obj : constant Entity_Id := Entity (Expression (First_Actual (N)));
Vnm : String_Id;
Vid : Entity_Id;
Vde : Node_Id;
Aft : constant List_Id := New_List;
In_Transient : constant Boolean := Scope_Is_Transient;
function Build_Shared_Var_Lock_Call (RE : RE_Id) return Node_Id;
-- Return a procedure call statement for lock proc RTE
--------------------------------
-- Build_Shared_Var_Lock_Call --
--------------------------------
function Build_Shared_Var_Lock_Call (RE : RE_Id) return Node_Id is
begin
return
Make_Procedure_Call_Statement (Loc,
Name =>
New_Occurrence_Of (RTE (RE), Loc),
Parameter_Associations =>
New_List (New_Occurrence_Of (Vid, Loc)));
end Build_Shared_Var_Lock_Call;
-- Start of processing for Add_Shared_Var_Lock_Procs
begin
-- Discussion of transient scopes: we need to have a transient scope
-- to hold the required lock/unlock actions. Either the current scope
-- is transient, in which case we reuse it, or we establish a new
-- transient scope. If this is a function call with unconstrained
-- return type, we can't introduce a transient scope here (because
-- Wrap_Transient_Expression would need to declare a temporary with
-- the unconstrained type outside of the transient block), but in that
-- case we know that we have already established one at an outer level
-- for secondary stack management purposes.
-- If the lock/read/write/unlock actions for this object have already
-- been emitted in the current scope, no need to perform them anew.
if In_Transient
and then Contains (Scope_Stack.Table (Scope_Stack.Last)
.Locked_Shared_Objects,
Obj)
then
return;
end if;
Build_Full_Name (Obj, Vnm);
-- Declare a constant string to hold the name of the shared object.
-- Note that this must occur outside of the transient scope, as the
-- scope's finalizer needs to have access to this object. Also, it
-- appears that GIGI does not support elaborating string literal
-- subtypes in transient scopes.
Vid := Make_Temporary (Loc, 'N', Obj);
Vde :=
Make_Object_Declaration (Loc,
Defining_Identifier => Vid,
Constant_Present => True,
Object_Definition => New_Occurrence_Of (Standard_String, Loc),
Expression => Make_String_Literal (Loc, Vnm));
-- Already in a transient scope. Make sure that we insert Vde outside
-- that scope.
if In_Transient then
Insert_Before_And_Analyze (Node_To_Be_Wrapped, Vde);
-- Not in a transient scope yet: insert Vde as an action on N prior to
-- establishing one.
else
Insert_Action (N, Vde);
Establish_Transient_Scope (N, Sec_Stack => False);
end if;
-- Mark object as locked in the current (transient) scope
Append_New_Elmt
(Obj,
To => Scope_Stack.Table (Scope_Stack.Last).Locked_Shared_Objects);
-- First insert the Lock call before
Insert_Action (N, Build_Shared_Var_Lock_Call (RE_Shared_Var_Lock));
-- Now, right after the Lock, insert a call to read the object
Insert_Action (N, Build_Shared_Var_Proc_Call (Loc, Obj, Name_Read));
-- For a procedure call only, insert the call to write the object prior
-- to unlocking.
if Nkind (N) = N_Procedure_Call_Statement then
Append_To (Aft, Build_Shared_Var_Proc_Call (Loc, Obj, Name_Write));
end if;
-- Finally insert the Unlock call
Append_To (Aft, Build_Shared_Var_Lock_Call (RE_Shared_Var_Unlock));
-- Store cleanup actions in transient scope
Store_Cleanup_Actions_In_Scope (Aft);
-- If we have established a transient scope here, wrap it now
if not In_Transient then
if Nkind (N) = N_Procedure_Call_Statement then
Wrap_Transient_Statement (N);
else
Wrap_Transient_Expression (N);
end if;
end if;
end Add_Shared_Var_Lock_Procs;
---------------------
-- Add_Write_After --
---------------------
procedure Add_Write_After (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Ent : constant Entity_Id := Entity (N);
Par : constant Node_Id := Insert_Node;
begin
if Present (Shared_Var_Procs_Instance (Ent)) then
if Nkind (Insert_Node) = N_Function_Call then
Establish_Transient_Scope (Insert_Node, Sec_Stack => False);
Store_After_Actions_In_Scope (New_List (
Build_Shared_Var_Proc_Call (Loc, Ent, Name_Write)));
else
Insert_After_And_Analyze (Par,
Build_Shared_Var_Proc_Call (Loc, Ent, Name_Write));
end if;
end if;
end Add_Write_After;
---------------------
-- Build_Full_Name --
---------------------
procedure Build_Full_Name (E : Entity_Id; N : out String_Id) is
procedure Build_Name (E : Entity_Id);
-- This is a recursive routine used to construct the fully qualified
-- string name of the package corresponding to the shared variable.
----------------
-- Build_Name --
----------------
procedure Build_Name (E : Entity_Id) is
begin
if Scope (E) /= Standard_Standard then
Build_Name (Scope (E));
Store_String_Char ('.');
end if;
Get_Decoded_Name_String (Chars (E));
Store_String_Chars (Name_Buffer (1 .. Name_Len));
end Build_Name;
-- Start of processing for Build_Full_Name
begin
Start_String;
Build_Name (E);
N := End_String;
end Build_Full_Name;
------------------------------------
-- Expand_Shared_Passive_Variable --
------------------------------------
procedure Expand_Shared_Passive_Variable (N : Node_Id) is
Typ : constant Entity_Id := Etype (N);
begin
-- Nothing to do for protected or limited objects
if Is_Limited_Type (Typ) or else Is_Concurrent_Type (Typ) then
return;
-- If we are on the left hand side of an assignment, then we add the
-- write call after the assignment.
elsif On_Lhs_Of_Assignment (N) then
Add_Write_After (N);
-- If we are a parameter for an out or in out formal, then in general
-- we do:
-- read
-- call
-- write
-- but in the special case of a call to an init proc, we need to first
-- call the init proc (to set discriminants), then read (to possibly
-- set other components), then write (to record the updated components
-- to the backing store):
-- init-proc-call
-- read
-- write
elsif Is_Out_Actual (N) then
-- Note: For an init proc call, Add_Read inserts just after the
-- call node, and we want to have first the read, then the write,
-- so we need to first Add_Write_After, then Add_Read.
Add_Write_After (N);
Add_Read (N, Call => Insert_Node);
-- All other cases are simple reads
else
Add_Read (N);
end if;
end Expand_Shared_Passive_Variable;
-------------------
-- Is_Out_Actual --
-------------------
function Is_Out_Actual (N : Node_Id) return Boolean is
Formal : Entity_Id;
Call : Node_Id;
begin
Find_Actual (N, Formal, Call);
if No (Formal) then
return False;
else
if Ekind_In (Formal, E_Out_Parameter, E_In_Out_Parameter) then
Insert_Node := Call;
return True;
else
return False;
end if;
end if;
end Is_Out_Actual;
---------------------------
-- Make_Shared_Var_Procs --
---------------------------
function Make_Shared_Var_Procs (N : Node_Id) return Node_Id is
Loc : constant Source_Ptr := Sloc (N);
Ent : constant Entity_Id := Defining_Identifier (N);
Typ : constant Entity_Id := Etype (Ent);
Vnm : String_Id;
Obj : Node_Id;
Obj_Typ : Entity_Id;
After : constant Node_Id := Next (N);
-- Node located right after N originally (after insertion of the SV
-- procs this node is right after the last inserted node).
SVP_Instance : constant Entity_Id := Make_Defining_Identifier (Loc,
Chars => New_External_Name (Chars (Ent), 'G'));
-- Instance of Shared_Storage.Shared_Var_Procs associated with Ent
Instantiation : Node_Id;
-- Package instantiation node for SVP_Instance
-- Start of processing for Make_Shared_Var_Procs
begin
Build_Full_Name (Ent, Vnm);
-- We turn off Shared_Passive during construction and analysis of the
-- generic package instantiation, to avoid improper attempts to process
-- the variable references within these instantiation.
Set_Is_Shared_Passive (Ent, False);
-- Construct generic package instantiation
-- package varG is new Shared_Var_Procs (typ, var, "pkg.var");
Obj := New_Occurrence_Of (Ent, Loc);
Obj_Typ := Typ;
if Is_Concurrent_Type (Typ) then
Obj := Convert_Concurrent (N => Obj, Typ => Typ);
Obj_Typ := Corresponding_Record_Type (Typ);
end if;
Instantiation :=
Make_Package_Instantiation (Loc,
Defining_Unit_Name => SVP_Instance,
Name =>
New_Occurrence_Of (RTE (RE_Shared_Var_Procs), Loc),
Generic_Associations => New_List (
Make_Generic_Association (Loc,
Explicit_Generic_Actual_Parameter =>
New_Occurrence_Of (Obj_Typ, Loc)),
Make_Generic_Association (Loc,
Explicit_Generic_Actual_Parameter => Obj),
Make_Generic_Association (Loc,
Explicit_Generic_Actual_Parameter =>
Make_String_Literal (Loc, Vnm))));
Insert_After_And_Analyze (N, Instantiation);
Set_Is_Shared_Passive (Ent, True);
Set_Shared_Var_Procs_Instance
(Ent, Defining_Entity (Instance_Spec (Instantiation)));
-- Return last node before After
declare
Nod : Node_Id := Next (N);
begin
while Next (Nod) /= After loop
Nod := Next (Nod);
end loop;
return Nod;
end;
end Make_Shared_Var_Procs;
--------------------------
-- On_Lhs_Of_Assignment --
--------------------------
function On_Lhs_Of_Assignment (N : Node_Id) return Boolean is
P : constant Node_Id := Parent (N);
begin
if Nkind (P) = N_Assignment_Statement then
if N = Name (P) then
Insert_Node := P;
return True;
else
return False;
end if;
elsif Nkind_In (P, N_Indexed_Component, N_Selected_Component)
and then N = Prefix (P)
then
return On_Lhs_Of_Assignment (P);
else
return False;
end if;
end On_Lhs_Of_Assignment;
end Exp_Smem;
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_724.asm | ljhsiun2/medusa | 9 | 85310 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_724.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r15
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x14d33, %rsi
lea addresses_normal_ht+0xd9b3, %rdi
nop
add %rax, %rax
mov $25, %rcx
rep movsl
nop
nop
nop
nop
nop
and %r15, %r15
lea addresses_UC_ht+0x12d83, %r11
cmp $53776, %r10
mov $0x6162636465666768, %rax
movq %rax, %xmm0
movups %xmm0, (%r11)
nop
add %rsi, %rsi
lea addresses_D_ht+0x11db3, %r15
nop
nop
nop
nop
inc %rdi
mov (%r15), %r11d
nop
nop
nop
nop
xor $56388, %rsi
lea addresses_A_ht+0x8753, %rsi
lea addresses_WT_ht+0x65b3, %rdi
sub %r14, %r14
mov $83, %rcx
rep movsl
nop
nop
nop
nop
cmp %rsi, %rsi
lea addresses_WT_ht+0x7bb3, %r14
nop
nop
nop
nop
sub $34410, %rcx
movb $0x61, (%r14)
and %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %r9
push %rax
push %rbp
push %rdx
// Faulty Load
lea addresses_PSE+0xdb3, %r8
nop
xor $41280, %rdx
mov (%r8), %rbp
lea oracles, %r9
and $0xff, %rbp
shlq $12, %rbp
mov (%r9,%rbp,1), %rbp
pop %rdx
pop %rbp
pop %rax
pop %r9
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
programs/oeis/049/A049853.asm | jmorken/loda | 1 | 91749 | <reponame>jmorken/loda
; A049853: a(n) = a(n-1) + Sum_{k=0..n-3} a(k) for n >= 2, a(0)=1, a(1)=2.
; 1,2,2,3,6,11,19,33,58,102,179,314,551,967,1697,2978,5226,9171,16094,28243,49563,86977,152634,267854,470051,824882,1447567,2540303,4457921,7823106,13728594,24092003,42278518,74193627,130200739,228486369,400965626,703645622,1234811987,2166943978,3802721591,6673311191,11710844769,20551099938,36064666298,63289077427,111064588494,194904765859,342034020651,600227863937,1053326473082,1848459102878,3243819596611,5692506563426,9989652633119,17530618299423,30764090529153,53987215392002,94740958554274,166258792245699,291763841329126,512009848966827,898514648850227,1576783290062753,2767061780242106,4855854919271686,8521431348364019
mov $1,1
mov $3,2
lpb $0
sub $0,1
add $2,$1
add $1,$3
sub $1,$2
add $3,$2
lpe
|
src/databases-utilities.adb | skordal/databases | 0 | 26697 | -- Databases - A simple database library for Ada applications
-- (c) <NAME> 2019 <<EMAIL>>
-- Report bugs and issues on <https://github.com/skordal/databases/issues>
-- vim:ts=3:sw=3:et:si:sta
package body Databases.Utilities is
function Execute (Database : in Databases.Database_Access; Statement : in String)
return Databases.Statement_Execution_Status
is
Prepared : Databases.Prepared_Statement_Access := Database.Prepare (Statement);
Retval : constant Databases.Statement_Execution_Status := Prepared.Execute;
begin
Databases.Free (Prepared);
return Retval;
end Execute;
end Databases.Utilities;
|
programs/oeis/073/A073552.asm | karttu/loda | 1 | 89032 | <gh_stars>1-10
; A073552: Duplicate of A067275.
; 0,1,7,67,667,6667,66667,666667,6666667,66666667,666666667,6666666667,66666666667,666666666667,6666666666667,66666666666667,666666666666667,6666666666666667
lpb $0,1
sub $3,1
add $1,$3
mul $1,2
sub $0,1
mov $2,$1
mov $3,$2
add $1,1
add $1,$2
add $3,$1
lpe
mov $1,$3
|
src/main/antlr4/org/optionmetrics/ztools/zlite/ZLiteParser.g4 | dhait/zlite | 0 | 6266 | /*
* Copyright (c) 2017, <NAME>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
parser grammar ZLiteParser;
options {tokenVocab = ZLiteLexer; }
// A zlite document consists of a series of blocks
root : block* EOF;
// A block can be regular text, a directive, a section header, or z notation
block : text
| zblock
| zsection
| directive
;
// In text mode (the default mode), and text is recognized.
text : ( anyText | paragraph) +
;
anyText : ANY_TEXT+ ;
paragraph : PARAGRAPH ;
// A zblock starts with a zedBlock. This puts the lexer into Z mode
zblock : zedBlock | axiomBlock | genBlock | schemaBlock ;
// Z mode rules
zedBlock : BEGIN_ZED z_expression* END_ZED;
axiomBlock : BEGIN_AXIOM z_expression* END_AXIOM;
genBlock : BEGIN_GEN z_expression* END_GEN;
schemaBlock: BEGIN_SCHEMA z_expression* END_SCHEMA;
z_expression : z_expression Z_CARET z_expression
| z_expression Z_UNDERSCORE z_expression
| Z_LBRACE z_expression* Z_RBRACE
| z_hardspace
| Z_COMMAND
| Z_ALPHANUM
| Z_SYMBOLS
;
z_hardspace : Z_INTERWORD_SPACE
| Z_THIN_SPACE
| Z_MEDIUM_SPACE
| Z_THICK_SPACE
| Z_NEWLINE
| Z_TABSTOP
| Z_ALSO
| Z_NEWPAGE
;
// A sectionHeader begins with zSectionStart. This puts the lexer into Section mode.
zsection : BEGIN_SECTION S_SECTION S_NAME (S_PARENTS s_parents)? END_SECTION;
s_parents : S_NAME ( S_COMMA S_NAME)* ;
// a directive begins with %%. This puts the lexer into Directive mode.
directive : zinclude
| zchar
| zword
;
zinclude : ZINCLUDE D_RESOURCE D_NL;
zchar : (ZCHAR | ZINCHAR | ZPRECHAR | ZPOSTCHAR) D_COMMAND D_UNICODE D_NL
;
zword : ZWORD D_COMMAND d_expression+ D_NL ;
d_expression : d_expression D_CARET d_expression
| d_expression D_UNDERSCORE d_expression
| D_LBRACE z_expression* D_RBRACE
| d_hardspace
| D_COMMAND
| D_ALPHANUM
;
d_hardspace : D_INTERWORD_SPACE
| D_THIN_SPACE
| D_MEDIUM_SPACE
| D_THICK_SPACE
| D_NEWLINE
| D_TABSTOP
| D_ALSO
| D_NEWPAGE
;
|
.emacs.d/elpa/wisi-3.1.3/wisitoken-to_tree_sitter.adb | caqg/linux-home | 0 | 11909 | <gh_stars>0
-- Abstract :
--
-- Translate a wisitoken grammar file to a tree-sitter grammar file.
--
-- References:
--
-- [1] tree-sitter grammar: https://tree-sitter.github.io/tree-sitter/creating-parsers#the-grammar-dsl
--
-- Copyright (C) 2020 <NAME> All Rights Reserved.
--
-- This library is free software; you can redistribute it and/or modify it
-- under terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any later
-- version. This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.
pragma License (GPL);
with Ada.Command_Line;
with Ada.Directories;
with Ada.Exceptions;
with Ada.Strings.Fixed;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Traceback.Symbolic;
with WisiToken.Syntax_Trees.LR_Utils;
with WisiToken.Parse.LR.Parser_No_Recover;
with WisiToken.Syntax_Trees;
with WisiToken.Text_IO_Trace;
with WisiToken_Grammar_Runtime;
with Wisitoken_Grammar_Actions; use Wisitoken_Grammar_Actions;
with Wisitoken_Grammar_Main;
procedure WisiToken.To_Tree_Sitter
is
procedure Put_Usage
is begin
Put_Line ("wisitoken-to_tree_sitter [--verbosity <level] <wisitoken grammar file> <language_name>");
end Put_Usage;
procedure Print_Tree_Sitter
(Data : in WisiToken_Grammar_Runtime.User_Data_Type;
Tree : in Syntax_Trees.Tree;
Output_File_Name : in String;
Language_Name : in String)
is
use WisiToken.Syntax_Trees;
File : File_Type;
-- Local specs
procedure Put_RHS_Item_List (Node : in Valid_Node_Index; First : in Boolean)
with Pre => Tree.ID (Node) = +rhs_item_list_ID;
-- Local bodies
function Get_Text (Tree_Index : in Valid_Node_Index) return String
is
function Strip_Delimiters (Tree_Index : in Valid_Node_Index) return String
is
Region : Buffer_Region renames Data.Terminals.all (Tree.Terminal (Tree_Index)).Byte_Region;
begin
if -Tree.ID (Tree_Index) in RAW_CODE_ID | REGEXP_ID | ACTION_ID then
-- Strip delimiters. We don't strip leading/trailing spaces to preserve indent.
return Data.Grammar_Lexer.Buffer_Text ((Region.First + 2, Region.Last - 2));
-- We don't strip string delimiters; tree-setter can use the same ones.
else
return Data.Grammar_Lexer.Buffer_Text (Region);
end if;
end Strip_Delimiters;
begin
case Tree.Label (Tree_Index) is
when Shared_Terminal =>
return Strip_Delimiters (Tree_Index);
when Virtual_Terminal =>
-- Terminal keyword inserted during tree edit. We could check for
-- Identifier, but that will be caught later.
return Image (Tree.ID (Tree_Index), Wisitoken_Grammar_Actions.Descriptor);
when Virtual_Identifier =>
raise SAL.Programmer_Error;
when Nonterm =>
declare
use all type Ada.Strings.Unbounded.Unbounded_String;
Result : Ada.Strings.Unbounded.Unbounded_String;
Tree_Indices : constant Valid_Node_Index_Array := Tree.Get_Terminals (Tree_Index);
Need_Space : Boolean := False;
begin
for Tree_Index of Tree_Indices loop
Result := Result & (if Need_Space then " " else "") &
Get_Text (Tree_Index);
Need_Space := True;
end loop;
return -Result;
end;
end case;
end Get_Text;
procedure Not_Translated (Label : in String; Node : in Valid_Node_Index)
is begin
New_Line (File);
Put (File, "// " & Label & ": not translated: " & Node_Index'Image (Node) & ":" &
Tree.Image (Node, Wisitoken_Grammar_Actions.Descriptor, Include_Children => True));
end Not_Translated;
procedure Put_RHS_Alternative_List (Node : in Valid_Node_Index; First : in Boolean)
with Pre => Tree.ID (Node) = +rhs_alternative_list_ID
is begin
case Tree.RHS_Index (Node) is
when 0 =>
-- If only alternative, don't need "choice()".
Put_RHS_Item_List (Tree.Child (Node, 1), First => True);
when 1 =>
if First then
Put (File, "choice(");
end if;
Put_RHS_Alternative_List (Tree.Child (Node, 1), First => False);
Put (File, ", ");
Put_RHS_Item_List (Tree.Child (Node, 3), First => True);
if First then
Put (File, ")");
end if;
when others =>
Not_Translated ("Put_RHS_Alternative_List", Node);
end case;
end Put_RHS_Alternative_List;
procedure Put_RHS_Optional_Item (Node : in Valid_Node_Index)
with Pre => Tree.ID (Node) = +rhs_optional_item_ID
is begin
Put (File, "optional(");
case Tree.RHS_Index (Node) is
when 0 | 1 =>
Put_RHS_Alternative_List (Tree.Child (Node, 2), First => True);
when 2 =>
Put (File, "$." & Get_Text (Tree.Child (Node, 1)));
when 3 =>
-- STRING_LITERAL_2
Put (File, Get_Text (Tree.Child (Node, 1)));
when others =>
Not_Translated ("Put_RHS_Optional_Item", Node);
end case;
Put (File, ")");
end Put_RHS_Optional_Item;
procedure Put_RHS_Multiple_Item (Node : in Valid_Node_Index)
with Pre => Tree.ID (Node) = +rhs_multiple_item_ID
is begin
case Tree.RHS_Index (Node) is
when 0 | 3 =>
Put (File, "repeat(");
Put_RHS_Alternative_List (Tree.Child (Node, 2), First => True);
Put (File, ")");
when 1 | 2 =>
Put (File, "repeat1(");
Put_RHS_Alternative_List (Tree.Child (Node, 2), First => True);
Put (File, ")");
when 4 =>
Put (File, "repeat1(");
Put (File, "$." & Get_Text (Tree.Child (Node, 1)));
Put (File, ")");
when 5 =>
Put (File, "repeat(");
Put (File, "$." & Get_Text (Tree.Child (Node, 1)));
Put (File, ")");
when others =>
Not_Translated ("Put_RHS_Multiple_Item", Node);
end case;
end Put_RHS_Multiple_Item;
procedure Put_RHS_Group_Item (Node : in Valid_Node_Index)
with Pre => Tree.ID (Node) = +rhs_group_item_ID
is begin
Not_Translated ("Put_RHS_Group_Item", Node); -- maybe just plain ()?
end Put_RHS_Group_Item;
procedure Put_RHS_Item (Node : in Valid_Node_Index)
with Pre => Tree.ID (Node) = +rhs_item_ID
is begin
case Tree.RHS_Index (Node) is
when 0 =>
declare
use WisiToken_Grammar_Runtime;
Ident : constant String := Get_Text (Node);
Decl : constant Node_Index := Find_Declaration (Data, Tree, Ident);
begin
if Decl = Invalid_Node_Index then
Raise_Programmer_Error ("decl for '" & Ident & "' not found", Data, Tree, Node);
elsif Tree.ID (Decl) = +nonterminal_ID then
Put (File, "$." & Get_Text (Tree.Child (Decl, 1)));
else
case Tree.RHS_Index (Decl) is
when 0 =>
case To_Token_Enum (Tree.ID (Tree.Child (Tree.Child (Decl, 2), 1))) is
when KEYWORD_ID =>
Put (File, Get_Text (Tree.Child (Decl, 4)));
when NON_GRAMMAR_ID =>
Not_Translated ("put_rhs_item", Node);
when Wisitoken_Grammar_Actions.TOKEN_ID =>
declare
use WisiToken.Syntax_Trees.LR_Utils;
Iter : constant Syntax_Trees.LR_Utils.Iterator :=
Iterate (Data, Tree, Tree.Child (Decl, 4), +declaration_item_ID);
Item : constant Valid_Node_Index :=
Tree.Child (Syntax_Trees.LR_Utils.Node (First (Iter)), 1);
begin
case To_Token_Enum (Tree.ID (Item)) is
when REGEXP_ID =>
Put (File, "$." & Ident);
when STRING_LITERAL_1_ID | STRING_LITERAL_2_ID =>
-- FIXME: case insensitive?
Put (File, Get_Text (Item));
when others =>
Not_Translated ("put_rhs_item ident token", Node);
end case;
end;
when others =>
Not_Translated ("put_rhs_item ident", Node);
end case;
when others =>
Not_Translated ("put_rhs_item 0", Node);
end case;
end if;
end;
when 1 =>
-- STRING_LITERAL_2
Put (File, Get_Text (Node));
when 2 =>
-- ignore attribute
null;
when 3 =>
Put_RHS_Optional_Item (Tree.Child (Node, 1));
when 4 =>
Put_RHS_Multiple_Item (Tree.Child (Node, 1));
when 5 =>
Put_RHS_Group_Item (Tree.Child (Node, 1));
when others =>
Not_Translated ("Put_RHS_Item", Node);
end case;
end Put_RHS_Item;
procedure Put_RHS_Element (Node : in Valid_Node_Index)
with Pre => Tree.ID (Node) = +rhs_element_ID
is begin
case Tree.RHS_Index (Node) is
when 0 =>
Put_RHS_Item (Tree.Child (Node, 1));
when 1 =>
-- Ignore the label
Put_RHS_Item (Tree.Child (Node, 3));
when others =>
Not_Translated ("Put_RHS_Element", Node);
end case;
end Put_RHS_Element;
procedure Put_RHS_Item_List (Node : in Valid_Node_Index; First : in Boolean)
is
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
if Children'Length = 1 then
Put_RHS_Element (Children (1));
else
if First then
Put (File, "seq(");
end if;
Put_RHS_Item_List (Children (1), First => False);
Put (File, ", ");
Put_RHS_Element (Children (2));
if First then
Put (File, ")");
end if;
end if;
end Put_RHS_Item_List;
procedure Put_RHS (Node : in Valid_Node_Index)
with Pre => Tree.ID (Node) = +rhs_ID
is begin
case Tree.RHS_Index (Node) is
when 0 =>
Put (File, "/* empty */,");
when 1 .. 3 =>
Put_RHS_Item_List (Tree.Child (Node, 1), First => True);
-- ignore actions
when others =>
Not_Translated ("put_rhs", Node);
end case;
end Put_RHS;
procedure Put_RHS_List (Node : in Valid_Node_Index; First : in Boolean)
with Pre => Tree.ID (Node) = +rhs_list_ID
is
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
case Tree.RHS_Index (Node) is
when 0 =>
Put_RHS (Children (1));
when 1 =>
if First then
Put (File, "choice(");
end if;
Put_RHS_List (Children (1), First => False);
Put (File, ",");
Put_RHS (Children (3));
if First then
Put (File, ")");
end if;
when others =>
Not_Translated ("Put_RHS_List", Node);
end case;
end Put_RHS_List;
procedure Process_Node (Node : in Valid_Node_Index)
is begin
case To_Token_Enum (Tree.ID (Node)) is
-- Enum_Token_ID alphabetical order
when compilation_unit_ID =>
Process_Node (Tree.Child (Node, 1));
when compilation_unit_list_ID =>
declare
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
case To_Token_Enum (Tree.ID (Children (1))) is
when compilation_unit_list_ID =>
Process_Node (Children (1));
Process_Node (Children (2));
when compilation_unit_ID =>
Process_Node (Children (1));
when others =>
raise SAL.Programmer_Error;
end case;
end;
when declaration_ID =>
case Tree.RHS_Index (Node) is
when 0 =>
if Tree.ID (Tree.Child (Tree.Child (Node, 2), 1)) = +Wisitoken_Grammar_Actions.TOKEN_ID then
declare
use Ada.Strings;
use Ada.Strings.Fixed;
use WisiToken.Syntax_Trees.LR_Utils;
Name : constant String := Get_Text (Tree.Child (Node, 3));
Iter : constant Syntax_Trees.LR_Utils.Iterator :=
WisiToken_Grammar_Runtime.Iterate (Data, Tree, Tree.Child (Node, 4), +declaration_item_ID);
Item : constant Valid_Node_Index :=
Tree.Child (Syntax_Trees.LR_Utils.Node (First (Iter)), 1);
begin
case To_Token_Enum (Tree.ID (Item)) is
when REGEXP_ID =>
Put_Line (File, Name & ": $ => /" & Trim (Get_Text (Item), Both) & "/,");
when others =>
null;
end case;
end;
end if;
when others =>
null;
end case;
when nonterminal_ID =>
declare
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
Put (File, Get_Text (Children (1)) & ": $ => ");
Put_RHS_List (Children (3), First => True);
Put_Line (File, ",");
end;
when wisitoken_accept_ID =>
Process_Node (Tree.Child (Node, 1));
when others =>
raise SAL.Not_Implemented with Image (Tree.ID (Node), Wisitoken_Grammar_Actions.Descriptor);
end case;
end Process_Node;
begin
Create (File, Out_File, Output_File_Name);
Put_Line (File, "// generated from " & Data.Grammar_Lexer.File_Name & " -*- buffer-read-only:t -*-");
-- FIXME: copy copyright, license?
Put_Line (File, "module.exports = grammar({");
Put_Line (File, " name: '" & Language_Name & "',");
Put_Line (File, " rules: {");
Process_Node (Tree.Root);
Put_Line (File, " }");
Put_Line (File, "});");
Close (File);
end Print_Tree_Sitter;
Trace : aliased WisiToken.Text_IO_Trace.Trace (Wisitoken_Grammar_Actions.Descriptor'Access);
Input_Data : aliased WisiToken_Grammar_Runtime.User_Data_Type;
Grammar_Parser : WisiToken.Parse.LR.Parser_No_Recover.Parser;
Input_File_Name : Ada.Strings.Unbounded.Unbounded_String;
Language_Name : Ada.Strings.Unbounded.Unbounded_String;
begin
Wisitoken_Grammar_Main.Create_Parser
(Parser => Grammar_Parser,
Trace => Trace'Unchecked_Access,
User_Data => Input_Data'Unchecked_Access);
declare
use Ada.Command_Line;
Arg : Integer := 1;
begin
if not (Argument_Count in 1 .. 4) then
Put_Usage;
Set_Exit_Status (Failure);
return;
end if;
loop
exit when Arg > Argument_Count;
if Argument (Arg) = "--verbosity" then
Arg := Arg + 1;
Trace_Generate_EBNF := Integer'Value (Argument (Arg));
Arg := Arg + 1;
else
exit;
end if;
end loop;
-- no more options
Input_File_Name := +Argument (Arg);
Arg := Arg + 1;
Language_Name := +Argument (Arg);
end;
begin
Grammar_Parser.Lexer.Reset_With_File (-Input_File_Name);
exception
when Ada.Text_IO.Name_Error | Ada.Text_IO.Use_Error =>
raise Ada.Text_IO.Name_Error with "input file '" & (-Input_File_Name) & "' could not be opened.";
end;
begin
Grammar_Parser.Parse;
exception
when WisiToken.Syntax_Error =>
Grammar_Parser.Put_Errors;
raise;
end;
Grammar_Parser.Execute_Actions;
declare
use Ada.Directories;
Output_File_Name : constant String := Base_Name (-Input_File_Name) & ".js";
Tree : WisiToken.Syntax_Trees.Tree renames Grammar_Parser.Parsers.First_State_Ref.Tree;
begin
if Trace_Generate_EBNF > Outline then
Put_Line ("'" & (-Input_File_Name) & "' => '" & Output_File_Name & "'");
end if;
if Trace_Generate_EBNF > Detail then
Put_Line ("wisitoken tree:");
Tree.Print_Tree (Wisitoken_Grammar_Actions.Descriptor);
Ada.Text_IO.New_Line;
end if;
Print_Tree_Sitter (Input_Data, Tree, Output_File_Name, -Language_Name);
end;
exception
when WisiToken.Syntax_Error | WisiToken.Parse_Error =>
-- error message already output
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
when E : others =>
declare
use Ada.Exceptions;
use Ada.Command_Line;
begin
Put_Line (Standard_Error, Exception_Name (E) & ": " & Exception_Message (E));
Put_Line (Standard_Error, GNAT.Traceback.Symbolic.Symbolic_Traceback (E));
Set_Exit_Status (Failure);
end;
end WisiToken.To_Tree_Sitter;
|
software/pcx86/bdsrc/dos/handle.asm | fatman2021/basicdos | 59 | 90724 | ;
; BASIC-DOS Handle Services
;
; @author <NAME> <<EMAIL>>
; @copyright (c) 2020-2021 <NAME>
; @license MIT <https://basicdos.com/LICENSE.txt>
;
; This file is part of PCjs, a computer emulation software project at pcjs.org
;
include macros.inc
include disk.inc
include dev.inc
include devapi.inc
include dos.inc
include dosapi.inc
DOS segment word public 'CODE'
EXTNEAR <dev_request,scb_release>
EXTNEAR <chk_devname,chk_filename>
EXTNEAR <get_bpb,get_psp,find_cln,get_cln>
EXTNEAR <msc_sigctrlc,msc_readctrlc>
EXTBYTE <scb_locked>
EXTWORD <scb_active>
EXTLONG <sfb_table>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; hdl_open (REG_AH = 3Dh)
;
; Inputs:
; REG_AL = mode (see MODE_*)
; REG_DS:REG_DX -> name of device/file
;
; Outputs:
; On success, carry clear, REG_AX = PFH (or SFH if no active PSP)
; On failure, carry set, REG_AX = error code
;
DEFPROC hdl_open,DOS
call pfh_alloc ; ES:DI = free handle entry
ASSUME ES:NOTHING
jc ho9
push di ; save free handle entry
mov bl,[bp].REG_AL ; BL = mode
mov si,[bp].REG_DX
mov ds,[bp].REG_DS ; DS:SI = name of device/file
ASSUME DS:NOTHING
call sfb_open
pop di ; restore handle entry
jc ho9
call pfh_set ; update handle entry
ho9: mov [bp].REG_AX,ax ; update REG_AX and return CARRY
ret
ENDPROC hdl_open
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; hdl_close (REG_AH = 3Eh)
;
; Inputs:
; REG_BX = PFH (Process File Handle)
;
; Outputs:
; On success, carry clear
; On failure, carry set, REG_AX = error code
;
DEFPROC hdl_close,DOS
mov bx,[bp].REG_BX ; BX = Process File Handle
call pfh_close
jnc hc9
mov [bp].REG_AX,ax ; update REG_AX and return CARRY
hc9: ret
ENDPROC hdl_close
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; hdl_read (REG_AH = 3Fh)
;
; Inputs:
; REG_BX = handle
; REG_CX = byte count
; REG_DS:REG_DX -> data buffer
;
; Outputs:
; On success, REG_AX = bytes read, carry clear
; On failure, REG_AX = error code, carry set
;
DEFPROC hdl_read,DOS
mov bx,[bp].REG_BX ; BX = PFH ("handle")
call sfb_get ; BX -> SFB
jc hr8
mov cx,[bp].REG_CX ; CX = byte count
mov es,[bp].REG_DS
mov dx,[bp].REG_DX ; ES:DX -> data buffer
mov al,IO_COOKED
call sfb_read
hr8: mov [bp].REG_AX,ax ; update REG_AX and return CARRY
hr9: ret
ENDPROC hdl_read
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; hdl_write (REG_AH = 40h)
;
; Inputs:
; REG_BX = handle
; REG_CX = byte count
; REG_DS:REG_DX -> data buffer
;
; Outputs:
; On success, REG_AX = bytes written, carry clear
; On failure, REG_AX = error code, carry set
;
DEFPROC hdl_write,DOS
mov bx,[bp].REG_BX ; BX = PFH ("handle")
call sfb_get ; BX -> SFB
jc hw8
mov cx,[bp].REG_CX ; CX = byte count
mov si,[bp].REG_DX
mov ds,[bp].REG_DS ; DS:SI = data to write
ASSUME DS:NOTHING
mov al,IO_COOKED
call sfb_write
jnc hw9
hw8: mov [bp].REG_AX,ax ; update REG_AX and return CARRY
hw9: ret
ENDPROC hdl_write
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; hdl_seek (REG_AH = 42h)
;
; Inputs:
; REG_BX = handle
; REG_AL = method (ie, SEEK_BEG, SEEK_CUR, or SEEK_END)
; REG_CX:REG_DX = distance, in bytes
;
; Outputs:
; On success, carry clear, REG_DX:REG_AX = new file location
; On failure, carry set, REG_AX = error code
;
DEFPROC hdl_seek,DOS
mov bx,[bp].REG_BX ; BX = PFH ("handle")
call sfb_get
jc hs8
mov ax,[bp].REG_AX ; AL = method
mov cx,[bp].REG_CX ; CX:DX = distance
mov dx,[bp].REG_DX
call sfb_seek ; BX -> SFB
jc hs8
mov [bp].REG_AX,dx
mov [bp].REG_DX,cx ; REG_DX:REG_AX = new CX:DX
jmp short hs9
hs8: mov [bp].REG_AX,ax ; update REG_AX and return CARRY
hs9: ret
ENDPROC hdl_seek
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; hdl_ioctl (REG_AH = 44h)
;
; Inputs:
; REG_AL = sub-function code (see IOCTL_* in devapi.inc)
; REG_BX = handle
; REG_CX = IOCTL-specific data
; REG_DX = IOCTL-specific data
; REG_DS:REG_SI -> optional IOCTL-specific data
;
; Outputs:
; On success, carry clear, REG_DX = result
; On failure, carry set, REG_AX = error code
;
DEFPROC hdl_ioctl,DOS
push ax
mov bx,[bp].REG_BX ; BX = PFH ("handle")
call sfb_get
pop ax
jc hs8 ; return error in REG_AX
les di,[bx].SFB_DEVICE ; ES:DI -> driver
mov bx,[bx].SFB_CONTEXT ; BX = context
xchg bx,dx ; DX = context, BX = REG_DX
mov ah,DDC_IOCTLIN
mov ds,[bp].REG_DS ; in case DS:SI is required as well
ASSUME DS:NOTHING
call dev_request
jc hs8 ; return error in REG_AX
mov [bp].REG_DX,dx ; REG_DX = result
;
; TODO: PC DOS 2.00 apparently returns the result in REG_AX as well as REG_DX.
; If we wish to do the same, then xchg ax,dx and jmp hs8. However, there's no
; need if no one depended on that behavior.
;
ret
ENDPROC hdl_ioctl
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; sfb_open
;
; Inputs:
; BL = mode (see MODE_*)
; DS:SI -> name of device/file
;
; Outputs:
; On success, BX -> SFB, DX = context (if any), carry clear
; On failure, AX = error code, carry set
;
; Modifies:
; AX, BX, CX, DX, DI
;
DEFPROC sfb_open,DOS
ASSUMES <DS,NOTHING>,<ES,NOTHING>
sub ax,ax ; AH = 0 (filename), AL = attributes
DEFLBL sfb_open_fcb,near
LOCK_SCB
push si
push ds
push es
call chk_devname ; is it a device name?
jnc so1 ; yes
call chk_filename ; is it a disk filename?
jnc so1a ; yes
so9a: mov ax,ERR_NOFILE
jmp so9 ; no
so1: mov ax,DDC_OPEN SHL 8 ; ES:DI -> driver
sub dx,dx ; no initial context
call dev_request ; issue the DDC_OPEN request
jc so9a ; failed (TODO: map device error?)
mov al,-1 ; no drive # for devices
so1a: push ds ;
push si ; save DIRENT at DS:SI (if any)
;
; Although the primary goal here is to find a free SFB, a matching SFB
; will suffice if it's for a context-less device (ie, not a file).
;
so2: push cs
pop ds
ASSUME DS:DOS
mov ah,bl ; save mode in AH
mov cx,es ; CX:DI is driver, DX is context
mov si,[sfb_table].OFF
sub bx,bx ; use BX to remember a free SFB
so3: test dx,dx ; any context?
jnz so4 ; yes, check next SFB
cmp [si].SFB_DEVICE.SEG,cx
jne so4 ; check next SFB
cmp [si].SFB_DEVICE.OFF,di
jne so4 ; check next SFB
cmp [si].SFB_CONTEXT,dx ; context-less device?
je so7 ; yes, this SFB will suffice
so4: test bx,bx ; are we still looking for a free SFB?
jnz so5 ; no
cmp [si].SFB_REFS,bl ; is this one free?
jne so5 ; no
mov bx,si ; yes, remember it
so5: add si,size SFB
cmp si,[sfb_table].SEG
jb so3 ; keep checking
pop si
pop ds
test bx,bx ; was there a free SFB?
jz so8 ; no, tell the driver sorry
push di
push es
push cs
pop es
ASSUME ES:DOS
mov di,bx ; ES:DI -> SFB (a superset of DIRENT)
test al,al ; was a DIRENT provided?
jl so5a ; no
mov cx,size DIRENT SHR 1
rep movsw ; copy the DIRENT into the SFB
jmp short so5b
;
; There's no DIRENT for a device, so let's copy DDH.DDH_NAME to SFB_NAME
; and zero the rest of the DIRENT space in the SFB.
;
so5a: pop ds
pop si ; DS:SI -> DDH
push si
push ds
add si,offset DDH_NAME
mov cx,size DDH_NAME SHR 1
rep movsw
push ax
xchg ax,cx
mov cx,(size DIRENT - size DDH_NAME) SHR 1
rep stosw
pop ax
so5b: pop es
ASSUME ES:NOTHING
pop di
so6: push cs
pop ds
ASSUME DS:DOS
DBGINIT STRUCT,[bx],SFB
mov [bx].SFB_DEVICE.OFF,di
mov [bx].SFB_DEVICE.SEG,es
mov [bx].SFB_CONTEXT,dx ; set DRIVE (AL) and MODE (AH) next
mov word ptr [bx].SFB_DRIVE,ax
sub ax,ax
mov [bx].SFB_REFS,1 ; one handle reference initially
mov [bx].SFB_CURPOS.LOW,ax ; zero the initial file position
mov [bx].SFB_CURPOS.HIW,ax
mov [bx].SFB_CURCLN,dx ; initial position cluster
mov [bx].SFB_FLAGS,al ; zero flags
jmp short so9 ; return new SFB
so7: pop ax ; throw away any DIRENT on the stack
pop ax
mov bx,si ; return matching SFB
inc [bx].SFB_REFS
jmp short so9
so8: test al,al ; did we issue DDC_OPEN?
jge so8a ; no
mov ax,DDC_CLOSE SHL 8 ; ES:DI -> driver, DX = context
call dev_request ; issue the DDC_CLOSE request
so8a: mov ax,ERR_NOHANDLE
stc ; return no SFB (and BX is zero)
so9: pop es
pop ds
pop si
ASSUME DS:NOTHING,ES:NOTHING
UNLOCK_SCB
ret
ENDPROC sfb_open
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; sfb_read
;
; Inputs:
; AL = I/O mode
; BX -> SFB
; CX = byte count
; ES:DX -> data buffer
;
; Outputs:
; On success, carry clear, AX = bytes read
; On failure, carry set, AX = error code
;
; Modifies:
; AX, BX, CX, DX, SI, DI
;
DEFPROC sfb_read,DOS
ASSUMES <DS,DOS>,<ES,NOTHING>
mov ah,[bx].SFB_DRIVE
test ah,ah
jge sr0
jmp sr8 ; character device
sr0: LOCK_SCB
mov word ptr [bp].TMP_AX,0 ; use TMP_AX to accumulate bytes read
mov [bp].TMP_ES,es
mov [bp].TMP_DX,dx
mov dl,ah ; DL = drive #
call get_bpb ; DI -> BPB if no error
jnc sr0a
jmp sr6
;
; As a preliminary matter, make sure the requested number of bytes doesn't
; exceed the current file size; if it does, reduce it.
;
sr0a: mov ax,[bx].SFB_SIZE.LOW
mov dx,[bx].SFB_SIZE.HIW
sub ax,[bx].SFB_CURPOS.LOW
sbb dx,[bx].SFB_CURPOS.HIW
jnb sr0b
sub ax,ax ; no data available
cwd
sr0b: test dx,dx ; lots of data ahead?
jnz sr1 ; yes
cmp cx,ax
jbe sr1
mov cx,ax ; CX reduced
;
; Next, convert CURPOS into cluster # and cluster offset. That's simplified
; if there's a valid CURCLN (which must be in sync with CURPOS if present);
; otherwise, we'll have to walk the cluster chain to find the correct cluster #.
;
sr1: mov dx,[bx].SFB_CURCLN
test dx,dx
jnz sr1a
call find_cln ; find cluster # for CURPOS
mov [bx].SFB_CURCLN,dx
sr1a: mov dx,[bx].SFB_CURPOS.LOW
mov ax,[di].BPB_CLUSBYTES
dec ax
and dx,ax ; DX = offset within current cluster
push bx ; save SFB pointer
push di ; save BPB pointer
push es
mov bx,[bx].SFB_CURCLN
DPRINTF 'f',<"Reading cluster %#05x...\r\n">,bx
sub bx,2
jb sr3 ; invalid cluster #
xchg ax,cx ; save CX
mov cl,[di].BPB_CLUSLOG2
shl bx,cl
xchg ax,cx ; restore CX
add bx,[di].BPB_LBADATA ; BX = LBA
;
; We're almost ready to read, except for the byte count in CX, which must be
; limited to whatever's in the current cluster.
;
push cx ; save byte count
mov ax,[di].BPB_CLUSBYTES
sub ax,dx ; AX = bytes available in cluster
cmp cx,ax ; if CX <= AX, we're fine
jbe sr2
mov cx,ax ; reduce CX
sr2: mov ah,DDC_READ
mov al,[di].BPB_DRIVE
les di,[di].BPB_DEVICE
ASSUME ES:NOTHING
push ds
mov si,[bp].TMP_DX
mov ds,[bp].TMP_ES ; DS:SI -> data buffer
ASSUME DS:NOTHING
call dev_request
pop ds
ASSUME DS:DOS
mov dx,cx ; DX = bytes read (assuming no error)
pop cx ; restore byte count
sr3: pop es
pop di ; BPB pointer restored
pop bx ; SFB pointer restored
jc sr6
;
; Time for some bookkeeping: adjust the SFB's CURPOS by DX.
;
add [bx].SFB_CURPOS.LOW,dx
adc [bx].SFB_CURPOS.HIW,0
add [bp].TMP_AX,dx ; update accumulation of bytes read
add [bp].TMP_DX,dx ; update data buffer offset
ASSERT NC
;
; We're now obliged to determine whether or not we've exhausted the current
; cluster, because if we have, then we MUST zero SFB_CURCLN.
;
mov ax,[di].BPB_CLUSBYTES
dec ax
test [bx].SFB_CURPOS.LOW,ax ; is CURPOS at a cluster boundary?
jnz sr4 ; no
push dx
sub dx,dx
xchg dx,[bx].SFB_CURCLN ; yes, get next cluster
call get_cln
xchg ax,dx
pop dx
jc sr6
mov [bx].SFB_CURCLN,ax
sr4: sub cx,dx ; have we exhausted the read count yet?
jbe sr5
jmp sr1a ; no, keep reading clusters
sr5: ASSERT NC
mov ax,[bp].TMP_AX
sr6: UNLOCK_SCB
jmp short sr9
sr7: jmp msc_sigctrlc
sr8: push ds
push es
mov ah,DDC_READ
push es
mov si,dx
les di,[bx].SFB_DEVICE
mov dx,[bx].SFB_CONTEXT
pop ds
ASSUME DS:NOTHING ; DS:SI -> data buffer (from ES:DX)
mov bl,al ; BL = I/O mode
call dev_request ; issue the DDC_READ request
jc sr8a
;
; If the driver is a STDIN device, and the I/O request was not "raw", then
; we need to check the returned data for CTRLC and signal it appropriately.
;
test ax,ax ; any bytes returned?
jz sr8a ; no
test es:[di].DDH_ATTR,DDATTR_STDIN
jz sr8a
ASSERT IO_RAW,EQ,0
test bl,bl ; IO_RAW (or IO_DIRECT) request?
jle sr8a ; yes
cmp byte ptr [si],CHR_CTRLC
je sr7
clc
sr8a: pop es
pop ds
ASSUME DS:DOS
sr9: ret
ENDPROC sfb_read
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; sfb_seek
;
; Inputs:
; AL = SEEK method (ie, SEEK_BEG, SEEK_CUR, or SEEK_END)
; BX -> SFB
; CX:DX = distance, in bytes
;
; Outputs:
; On success, carry clear, new position in CX:DX
;
; Modifies:
; AX, CX, DX (although technically SEEK_BEG doesn't change CX:DX)
;
DEFPROC sfb_seek,DOS
ASSUMES <DS,DOS>,<ES,NOTHING>
push si
sub si,si
mov [bx].SFB_CURCLN,si ; invalidate SFB_CURCLN
;
; Check the method against the middle value (SEEK_CUR). It's presumed to
; be SEEK_BEG if less than and SEEK_END if greater than. Unlike PC DOS, we
; don't return an error if the method isn't EXACTLY one of those values.
;
cmp al,SEEK_CUR
mov ax,si ; SI:AX = offset for SEEK_BEG
jl ss7
mov ax,[bx].SFB_CURPOS.LOW
mov si,[bx].SFB_CURPOS.HIW ; SI:AX = offset for SEEK_CUR
je ss7
mov ax,[bx].SFB_SIZE.LOW
mov si,[bx].SFB_SIZE.HIW ; SI:AX = offset for SEEK_END
ss7: add dx,ax
adc cx,si
mov [bx].SFB_CURPOS.LOW,dx
mov [bx].SFB_CURPOS.HIW,cx
;
; TODO: Technically, we'll return an error of sorts if the addition resulted
; in an overflow (ie, carry set). However, no error code has been assigned to
; that condition, and I'm not sure PC DOS considered that an error.
;
pop si
ret
ENDPROC sfb_seek
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; sfb_write
;
; Inputs:
; AL = I/O mode
; BX -> SFB
; CX = byte count
; DS:SI -> data buffer
;
; Outputs:
; On success, carry clear
; On failure, AX = error code, carry set
;
; Modifies:
; AX, BX, DX, DI, ES
;
DEFPROC sfb_write,DOS
ASSUMES <DS,NOTHING>,<ES,NOTHING>
cmp cs:[bx].SFB_DRIVE,0
jl sw7
stc ; no writes to block devices (yet)
jmp short sw9
sw7: mov ah,DDC_WRITE
les di,cs:[bx].SFB_DEVICE
mov dx,cs:[bx].SFB_CONTEXT
;
; If the driver is a STDOUT device, and the I/O request was not "raw", then
; we need to check for a CTRLC signal.
;
test es:[di].DDH_ATTR,DDATTR_STDOUT
jz sw8
ASSERT IO_RAW,EQ,0
test al,al ; IO_RAW (or IO_DIRECT) request?
jle sw8 ; yes
mov bx,cs:[scb_active]
ASSERT STRUCT,cs:[bx],SCB
cmp cs:[bx].SCB_CTRLC_ACT,0
je sw8
push cs
pop ds
jmp msc_readctrlc
sw8: call dev_request ; issue the DDC_WRITE request
sw9: ret
ENDPROC sfb_write
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; sfb_close
;
; Decrement the handle reference count, and if zero, close the device
; (if it's a device handle), mark the SFB unused, and mark any PFH as unused.
;
; Inputs:
; BX -> SFB
; SI = PFH, -1 if none
;
; Outputs:
; Carry clear if success
;
; Modifies:
; AX, DX, DI, ES
;
DEFPROC sfb_close,DOS
LOCK_SCB
dec [bx].SFB_REFS
jnz sc8
mov al,[bx].SFB_DRIVE ; did we issue a DDC_OPEN?
test al,al ; for this SFB?
jge sc7 ; no
les di,[bx].SFB_DEVICE ; ES:DI -> driver
mov dx,[bx].SFB_CONTEXT ; DX = context
mov ax,DDC_CLOSE SHL 8 ;
call dev_request ; issue the DDC_CLOSE request
sc7: sub ax,ax
mov [bx].SFB_DEVICE.OFF,ax
mov [bx].SFB_DEVICE.SEG,ax ; mark SFB as unused
sc8: test si,si ; valid PFH?
jl sc9 ; no
call get_psp ; if we're called by sysinit
jz sc9 ; there may be no valid PSP yet
push ds
mov ds,ax
ASSUME DS:NOTHING
mov ds:[PSP_PFT][si],SFH_NONE
pop ds
ASSUME DS:DOS
sc9: UNLOCK_SCB
ret
ENDPROC sfb_close
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; sfb_get
;
; Inputs:
; BX = handle (PFH)
;
; Outputs:
; On success, BX -> SFB, carry clear
; On failure, AX = ERR_BADHANDLE, carry set
;
; Modifies:
; AX, BX
;
DEFPROC sfb_get,DOS
ASSUMES <DS,DOS>,<ES,NOTHING>
call get_psp ; if there's no PSP yet
jz sg1 ; then BX must an SFH, not a PFH
cmp bl,size PSP_PFT ; is the PFH within PFT bounds?
jae sg8 ; no
push ds
mov ds,ax
mov bl,ds:[PSP_PFT][bx] ; BL = SFH
pop ds
DEFLBL sfb_from_sfh,near
ASSUMES <DS,NOTHING>,<ES,NOTHING>
sg1: mov al,size SFB ; convert SFH to SFB
mul bl
add ax,[sfb_table].OFF
cmp ax,[sfb_table].SEG ; is the SFB valid?
xchg bx,ax ; BX -> SFB
jae sg8
cmp cs:[bx].SFB_REFS,0 ; is the SFB open?
jne sg9 ; yes (carry clear)
sg8: mov ax,ERR_BADHANDLE
stc
sg9: ret
ENDPROC sfb_get
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; sfb_find_fcb
;
; Inputs:
; CX:DX = address of FCB
;
; Outputs:
; On success, carry clear, BX -> SFB
; On failure, carry set
;
; Modifies:
; BX
;
DEFPROC sfb_find_fcb,DOS
ASSUMES <DS,DOS>,<ES,NOTHING>
mov bx,[sfb_table].OFF
sff1: test [bx].SFB_FLAGS,SFBF_FCB
jz sff8
cmp [bx].SFB_FCB.OFF,dx
jne sff8
cmp [bx].SFB_FCB.SEG,cx
je sff9
sff8: add bx,size SFB
cmp bx,[sfb_table].SEG
jb sff1
stc
sff9: ret
ENDPROC sfb_find_fcb
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; pfh_alloc
;
; Inputs:
; None
;
; Outputs:
; On success, ES:DI -> PFT, carry clear (DI will be zero if no PSP)
; On failure, AX = ERR_NOHANDLE, carry set
;
; Modifies:
; AX, BX, CX, DI, ES
;
DEFPROC pfh_alloc,DOS
ASSUMES <DS,DOS>,<ES,NOTHING>
call get_psp ; get the current PSP
xchg di,ax ; if we're called by sysinit
jz pa9 ; there may be no valid PSP yet
mov es,di ; find a free handle entry
mov al,SFH_NONE ; AL = 0FFh (indicates unused entry)
mov cx,size PSP_PFT
mov di,offset PSP_PFT
repne scasb
jne pa8 ; if no entry, return error w/carry set
dec di ; rewind to entry
jmp short pa9
pa8: mov ax,ERR_NOHANDLE
stc
pa9: ret
ENDPROC pfh_alloc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; pfh_set
;
; This returns a PFT # (aka PFH or Process File Handle) if pfh_alloc found
; a valid PSP; otherwise, it returns the SFB # (aka SFH or System File Handle).
;
; Inputs:
; BX -> SFB
; ES:DI -> PFT
;
; Outputs:
; FT updated, AX = PFH or SFH (see above), carry clear
;
; Modifies:
; AX, BX, CX, DI
;
DEFPROC pfh_set,DOS
ASSUMES <DS,NOTHING>,<ES,NOTHING>
xchg ax,bx ; AX = SFB address
sub ax,[sfb_table].OFF
mov cl,size SFB
div cl ; AL = SFB # (from SFB address)
ASSERT Z,<test ah,ah> ; assert that the remainder is zero
test di,di ; did we find a free PFT entry?
jz ps9 ; no
stosb ; yes, store SFB # in the PFT entry
sub di,offset PSP_PFT + 1 ; convert PFT entry into PFH
xchg ax,di ; AX = handle
ps9: ret
ENDPROC pfh_set
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; pfh_close
;
; Close the process file handle in BX.
;
; Inputs:
; BX = handle (PFH)
;
; Outputs:
; On success, carry clear
; On failure, carry set, REG_AX = error code
;
; Modifies:
; AX, DX
;
DEFPROC pfh_close,DOS
ASSUMES <DS,DOS>,<ES,NOTHING>
push bx
push si
mov si,bx ; SI = PFH
call sfb_get
jc pc9
push di
push es
call sfb_close ; BX -> SFB, SI = PFH
pop es
pop di
pc9: pop si
pop bx
ret
ENDPROC pfh_close
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; sfh_add_ref
;
; Inputs:
; AL = SFH
; AH = # refs
;
; Modifies:
; None
;
DEFPROC sfh_add_ref,DOS
ASSUMES <DS,NOTHING>,<ES,NOTHING>
push bx
mov bl,al
push ax
call sfb_from_sfh
pop ax
jc sha9
add cs:[bx].SFB_REFS,ah
ASSERT NC
sha9: pop bx
ret
ENDPROC sfh_add_ref
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; sfh_close
;
; Close the system file handle in BX.
;
; Inputs:
; BX = handle (SFH)
;
; Outputs:
; On success, carry clear
; On failure, carry set, REG_AX = error code
;
; Modifies:
; AX, DX
;
DEFPROC sfh_close,DOS
ASSUMES <DS,DOS>,<ES,NOTHING>
push bx
push si
call sfb_from_sfh
jc shc9
push di
push es
mov si,-1 ; no PFH
call sfb_close ; BX -> SFB
pop es
pop di
shc9: pop si
pop bx
ret
ENDPROC sfh_close
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; sfh_context
;
; Inputs:
; AL = SFH
;
; Outputs:
; AX = context (carry clear), zero if none (carry set)
;
; Modifies:
; AX
;
DEFPROC sfh_context,DOS
ASSUMES <DS,DOS>,<ES,NOTHING>
push bx
mov bl,al
call sfb_from_sfh
mov ax,0
jc shx9
mov ax,[bx].SFB_CONTEXT
shx9: pop bx
ret
ENDPROC sfh_context
DOS ends
end
|
Transynther/x86/_processed/NC/_ht_st_zr_un_/i9-9900K_12_0xca_notsx.log_21829_987.asm | ljhsiun2/medusa | 9 | 1435 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %rsi
lea addresses_A_ht+0x4390, %rsi
nop
xor %r14, %r14
mov (%rsi), %r11
nop
nop
inc %r11
pop %rsi
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %r8
push %r9
push %rbp
// Store
lea addresses_A+0x7790, %r8
nop
xor %r13, %r13
mov $0x5152535455565758, %r11
movq %r11, %xmm5
vmovups %ymm5, (%r8)
nop
nop
xor $54937, %r10
// Store
lea addresses_WT+0x19ffe, %r13
nop
nop
nop
nop
xor %r14, %r14
mov $0x5152535455565758, %r11
movq %r11, %xmm1
vmovups %ymm1, (%r13)
add %r9, %r9
// Store
lea addresses_normal+0x19390, %r9
nop
nop
nop
nop
nop
inc %rbp
movw $0x5152, (%r9)
nop
nop
nop
nop
xor $54611, %r8
// Faulty Load
mov $0x7d32050000000390, %r8
nop
nop
nop
nop
dec %r9
mov (%r8), %r10
lea oracles, %r8
and $0xff, %r10
shlq $12, %r10
mov (%r8,%r10,1), %r10
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10}}
{'62': 1, '60': 687, '52': 17454, '00': 3687}
62 52 52 00 52 52 52 52 52 52 60 00 52 52 52 52 52 52 52 00 52 52 52 52 00 52 52 52 52 52 60 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 00 52 52 52 52 00 00 52 52 52 52 00 52 00 52 52 52 00 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 00 52 00 52 52 52 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 60 52 52 52 52 52 60 00 52 00 52 52 52 52 52 52 52 52 00 52 52 52 52 60 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 00 00 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 00 52 52 52 52 52 52 60 52 52 00 52 52 52 52 52 52 52 00 52 00 52 00 52 00 52 00 60 00 52 60 52 52 52 52 52 52 52 52 52 52 52 00 52 60 00 52 00 52 00 52 52 52 52 52 00 60 00 52 00 52 52 52 52 52 52 52 00 52 52 00 52 52 52 00 52 52 00 52 52 00 00 52 52 52 00 00 60 00 00 00 60 00 52 00 52 00 52 52 60 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 60 52 52 52 52 52 60 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 00 52 52 52 52 52 00 52 60 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 60 60 52 00 00 60 52 52 52 52 52 52 52 52 52 52 52 52 52 60 52 52 52 52 00 52 52 52 00 52 52 52 00 52 52 60 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 00 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 60 52 52 00 60 52 52 52 52 52 52 52 52 00 52 00 60 52 00 52 60 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 00 00 52 52 00 52 00 52 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 00 52 52 52 00 52 52 00 52 60 52 52 00 52 60 52 00 52 00 52 52 52 60 52 60 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 00 52 00 52 52 52 52 52 52 60 52 52 00 52 52 00 52 52 52 52 00 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 52 52 52 00 52 52 52 00 52 52 60 52 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 52 00 52 52 52 52 00 52 52 52 52 52 00 52 00 52 52 00 52 52 00 52 52 52 00 52 00 52 52 52 52 52 00 52 52 00 52 52 00 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 00 52 52 52 52 00 52 52 52 00 52 00 52 00 52 52 52 52 00 52 52 52 52 00 52 00 52 52 52 52 52 00 00 00 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 00 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 60 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 60 52 00 52 52 52 52 52 52 52 52 52 52 52 52 60 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 52 52 00 52 52 00 52 60 00 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 52 52 00 52 00 00 52 00 52 52 52 52 52 60 52 52 00 52 52 52 60 52 52 52 52 52 52 52 52 52 60 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 60 52 52 52 52 52 52 52
*/
|
oeis/244/A244741.asm | neoneye/loda-programs | 11 | 21870 | <filename>oeis/244/A244741.asm
; A244741: Numbers k such that (prime(k) mod 5) == 2 (mod 3).
; Submitted by <NAME>
; 1,4,7,12,15,19,25,28,31,33,37,39,45,49,55,59,63,66,68,69,73,78,88,91,93,101,102,106,107,111,113,118,123,129,134,138,139,144,148,151,154,155,159,161,163,165,168,181,184,187,195,199,203,206,211,214,217,219,225,229,236,247,251,253,258,259,260,262,265,272,275,277,283,285,288,292,300,302,306,307,315,322,329,332,336,340,342,348,350,352,359,361,363,365,367,375,380,383,384,388
seq $0,45380 ; Primes congruent to 2 mod 5.
sub $0,2
seq $0,230980 ; Number of primes <= n, starting at n=0.
add $0,1
|
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/___slong2h_callee.asm | ahjelm/z88dk | 640 | 101187 | <gh_stars>100-1000
SECTION code_fp_math16
PUBLIC ___slong2h_callee
PUBLIC _f16_i32_fastcall
EXTERN cm16_sdcc___slong2h_callee
EXTERN cm16_sdcc___slong2h_fastcall
defc ___slong2h_callee = cm16_sdcc___slong2h_callee
defc _f16_i32_fastcall = cm16_sdcc___slong2h_fastcall
|
testsuite/import_name_clash/test_a.ads | mgrojo/protobuf | 0 | 3865 | <gh_stars>0
package Test_A is end;
|
source/calendar/required/a-retide.adb | ytomino/drake | 33 | 3521 | with System.Native_Real_Time;
package body Ada.Real_Time.Delays is
procedure Delay_Until (T : Time) is
begin
System.Native_Real_Time.Delay_Until (
System.Native_Real_Time.To_Native_Time (Duration (T)));
end Delay_Until;
function To_Duration (T : Time) return Duration is
begin
return Duration (T);
end To_Duration;
end Ada.Real_Time.Delays;
|
CSE312/HW1/src/Factorize.asm | abdcelik/GTU | 2 | 173115 | .data
msg.comma: .asciiz ","
msg.newline: .asciiz "\n"
msg.get: .asciiz "Please enter a positive integer: "
msg.error: .asciiz "Error! Given integer must be positive!\n"
.text
.globl main
main:
getPosInt:
la $a0, msg.get
addiu $v0, $zero, 4
syscall # print message
addiu $v0, $zero, 5
syscall # get integer from user
slt $t0, $zero, $v0
bne $t0, $zero, Exit
la $a0, msg.error
addiu $v0, $zero, 4
syscall # print error message
j getPosInt
Exit:
addu $a0, $zero, $v0
jal factorize
addiu $v0, $zero, 10
syscall # terminate execution
# $a0 -> given number
factorize:
addiu $t0, $zero, 1 # $t0 = 0
addu $t1, $zero, $a0 # $t1 = num
factorizeLoop:
slt $t2, $t1, $t0
bne $t2, $zero, factorizeReturn
div $t1, $t0
mfhi $t2
bne $t2, $zero, factorizeExit
addu $a0, $zero, $t0
addiu $v0, $zero, 1
syscall # print factor
beq $t1, $t0, factorizeLast
la $a0, msg.comma
addiu $v0, $zero, 4
syscall # print comma character
j factorizeExit
factorizeLast:
la $a0, msg.newline
addiu $v0, $zero, 4
syscall #print newline character
factorizeExit:
addiu $t0, $t0, 1
j factorizeLoop
factorizeReturn:
jr $ra |
AdaToolsTests/Func.ads | gitter-badger/Ada-tools | 0 | 5252 | <reponame>gitter-badger/Ada-tools<filename>AdaToolsTests/Func.ads<gh_stars>0
function Func return Integer; |
programs/oeis/190/A190091.asm | karttu/loda | 0 | 105172 | <filename>programs/oeis/190/A190091.asm<gh_stars>0
; A190091: Number of rhombuses on a (n+1) X 3 grid.
; 2,6,10,15,20,26,32,39,46,54,62,71,80,90,100,111,122,134,146,159,172,186,200,215,230,246,262,279,296,314,332,351,370,390,410,431,452,474,496,519,542,566,590,615,640,666,692,719,746,774,802,831,860,890,920,951,982,1014,1046,1079,1112,1146,1180,1215,1250,1286,1322,1359,1396,1434,1472,1511,1550,1590,1630,1671,1712,1754,1796,1839,1882,1926,1970,2015,2060,2106,2152,2199,2246,2294,2342,2391,2440,2490,2540,2591,2642,2694,2746,2799,2852,2906,2960,3015,3070,3126,3182,3239,3296,3354,3412,3471,3530,3590,3650,3711,3772,3834,3896,3959,4022,4086,4150,4215,4280,4346,4412,4479,4546,4614,4682,4751,4820,4890,4960,5031,5102,5174,5246,5319,5392,5466,5540,5615,5690,5766,5842,5919,5996,6074,6152,6231,6310,6390,6470,6551,6632,6714,6796,6879,6962,7046,7130,7215,7300,7386,7472,7559,7646,7734,7822,7911,8000,8090,8180,8271,8362,8454,8546,8639,8732,8826,8920,9015,9110,9206,9302,9399,9496,9594,9692,9791,9890,9990,10090,10191,10292,10394,10496,10599
add $0,7
mov $1,$0
pow $1,2
div $1,4
sub $1,10
|
asm/Z80/DecodeLZS.asm | mbaze/bzpack | 4 | 23634 | ; Copyright (c) 2017, <NAME>
; This code is released under the terms of the BSD 2-Clause License.
; LZS decoder (18 bytes excluding initialization).
; The decoder assumes reverse order. We can omit the end of stream
; marker if we let the last literal overwrite opcodes after LDDR.
ld hl,SrcAddr
ld de,DstAddr
ld b,0 ; Ideally this value should be "reused".
MainLoop ld c,(hl)
dec hl
srl c
; ret z ; Option to include the end of stream marker.
; inc c ; Option to increase length to 128.
jr c,CopyBytes
push hl
ld l,(hl)
ld h,b
add hl,de
; inc hl ; Option to increase offset to 256.
CopyBytes lddr
jr c,MainLoop
pop hl
dec hl
jr MainLoop
|
libsrc/_DEVELOPMENT/stdio/c/sdcc_iy/fgetpos_unlocked.asm | jpoikela/z88dk | 640 | 100674 | <gh_stars>100-1000
; int fgetpos_unlocked(FILE *stream, fpos_t *pos)
SECTION code_clib
SECTION code_stdio
PUBLIC _fgetpos_unlocked
EXTERN asm_fgetpos_unlocked
_fgetpos_unlocked:
pop af
pop ix
pop hl
push hl
push hl
push af
jp asm_fgetpos_unlocked
|
src/main/antlr/Filter.g4 | mehmetatas/dev-db | 0 | 2684 | grammar Filter;
expression
: LPAREN expression RPAREN #parenExpression
| left=expression op=EQ right=expression #eqExpression
| left=expression op=NEQ right=expression #neqExpression
| left=expression op=LT right=expression #ltExpression
| left=expression op=LTE right=expression #lteExpression
| left=expression op=GT right=expression #gtExpression
| left=expression op=GTE right=expression #gteExpression
| left=expression op=IN right=array #inExpression
| left=expression op=AND right=expression #andExpression
| left=expression op=OR right=expression #orExpression
| IDENTIFIER ('.' IDENTIFIER)* #identifierExpression
| value #valueExpression
;
array
: LBRACKET (value? | (value (COMMA value)+)) RBRACKET;
value
: NUMBER #numberExpression
| STRING #stringExpression
| BOOL #boolExpression
| NULL #nullExpression
| DATE #dateExpression
| DATETIME #dateTimeExpression
| array #arrayExpression
;
fragment DIGIT : [0-9];
fragment DIGIT2 : DIGIT DIGIT;
fragment DIGIT3 : DIGIT DIGIT DIGIT;
fragment DIGIT4 : DIGIT DIGIT DIGIT DIGIT;
fragment TIME : DIGIT2 ':' DIGIT2 ':' DIGIT2 ('.' DIGIT3)?;
fragment ITEM : (NULL | STRING | NUMBER | BOOL | DATE | DATETIME);
AND : '&';
OR : '|';
EQ : '=';
NEQ : '!=';
LT : '<';
LTE : '<=';
GT : '>';
GTE : '>=';
IN : 'in';
LPAREN : '(';
RPAREN : ')';
LBRACKET : '[';
RBRACKET : ']';
COMMA : ',';
NUMBER : '-'? DIGIT+ ( '.' DIGIT+ )?;
STRING : '"' ('\\"' | ~'"')* '"';
BOOL : 'true' | 'false';
NULL : 'null';
DATE : '@' DIGIT4 '-' DIGIT2 '-' DIGIT2;
DATETIME : DATE ' ' TIME;
IDENTIFIER : [a-zA-Z_] [a-zA-Z_0-9]*;
WS : [ \r\t\u000C\n]+ -> skip; |
programs/oeis/118/A118358.asm | neoneye/loda | 22 | 22283 | ; A118358: Records in A086793.
; 5,9,11,12,13,15,16,17,18,19,20,21,22
mov $1,7
add $1,$0
mul $1,$0
add $0,1
div $1,$0
add $1,5
mov $0,$1
|
examples/elfobj/writemsg.asm | scientech-com-ua/case | 17 | 178229 |
format ELF
section '.text' executable
public writemsg
writemsg:
mov ecx,esi
find_end:
lodsb
or al,al
jnz find_end
mov edx,esi
sub edx,ecx
mov eax,4
mov ebx,1
int 0x80
ret
|
programs/oeis/121/A121200.asm | karttu/loda | 1 | 81431 | <reponame>karttu/loda
; A121200: 2n+7^n+5^n.
; 2,14,78,474,3034,19942,133286,901682,6155442,42306750,292240894,2026154890,14085427850,98109713558,684326588502,4778079088098,33385518460258,233393453440366,1632228295176110,11417968671701306
mov $1,1
mul $1,$0
mov $2,$0
cal $0,155634 ; 7^n + 5^n - 1.
add $1,2
add $0,$1
mov $1,$0
sub $1,1
add $1,$2
|
ANTLRTestProjects/antbased/Grammars/grammar/imports/ImportedCombinedGrammar.g4 | timboudreau/ANTLR4-Plugins-for-NetBeans | 1 | 372 | /************************************************************
* Normally, it is not allowed to import a cobined grammar, *
* even in a combined grammar. *
************************************************************/
grammar ImportedCombinedGrammar; // line comment
rule1: T;
T : 'a'; |
oeis/021/A021167.asm | neoneye/loda-programs | 11 | 1742 | ; A021167: Decimal expansion of 1/163.
; Submitted by <NAME>(s1.)
; 0,0,6,1,3,4,9,6,9,3,2,5,1,5,3,3,7,4,2,3,3,1,2,8,8,3,4,3,5,5,8,2,8,2,2,0,8,5,8,8,9,5,7,0,5,5,2,1,4,7,2,3,9,2,6,3,8,0,3,6,8,0,9,8,1,5,9,5,0,9,2,0,2,4,5,3,9,8,7,7,3,0,0,6,1,3,4,9,6,9,3,2,5,1,5,3,3,7,4
add $0,1
mov $1,10
pow $1,$0
div $1,163
mov $0,$1
mod $0,10
|
src/test/asm/foo/bar/pe_gui.asm | dykstrom/fasm-ant | 0 | 9865 | <reponame>dykstrom/fasm-ant
format pe gui 4.0
include 'win32a.inc'
invoke MessageBoxA,0,message,title,MB_ICONQUESTION+MB_YESNO
invoke ExitProcess,0
message db 'Can you see this message box?',0
title db 'Question',0
data import
library kernel32,'KERNEL32.DLL',user32,'USER32.DLL'
import kernel32,ExitProcess,'ExitProcess'
import user32,MessageBoxA,'MessageBoxA'
end data
|
programs/oeis/171/A171525.asm | neoneye/loda | 22 | 242157 | <reponame>neoneye/loda
; A171525: Numerator of (n-th noncomposite/n).
; 1,1,1,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227
trn $0,2
seq $0,140475 ; 1 along with primes greater than 3.
|
exercises/fasl6soal3.asm | amirshnll/assembly-exercises | 4 | 96338 | <reponame>amirshnll/assembly-exercises<gh_stars>1-10
; multi-segment executable file template.
data segment
; add your data here!
pkey db "press any key...$"
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
; add your code here
mov ax, 65535
for1:
cmp ax, 0
je endfor1
dec ax
jmp for1
endfor1:
lea dx, pkey
mov ah, 9
int 21h ; output string at ds:dx
; wait for any key....
mov ah, 1
int 21h
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.
|
alloy4fun_models/trainstlt/models/6/hvesXMXCrCBffhM9q.als | Kaixi26/org.alloytools.alloy | 0 | 1822 | <gh_stars>0
open main
pred idhvesXMXCrCBffhM9q_prop7 {
all t : Train | eventually always no t.pos
}
pred __repair { idhvesXMXCrCBffhM9q_prop7 }
check __repair { idhvesXMXCrCBffhM9q_prop7 <=> prop7o } |
Renamings.agda | danelahman/aeff-agda | 4 | 12760 | <filename>Renamings.agda
open import AEff
open import EffectAnnotations
open import Types hiding (``)
open import Relation.Binary.PropositionalEquality hiding ([_] ; Extensionality)
--open ≡-Reasoning
module Renamings where
-- SET OF RENAMINGS BETWEEN CONTEXTS
Ren : Ctx → Ctx → Set
Ren Γ Γ' = {X : VType} → X ∈ Γ → X ∈ Γ'
-- IDENTITY, COMPOSITION, AND EXCHANGE RENAMINGS
id-ren : {Γ : Ctx} → Ren Γ Γ
id-ren {X} x = x
comp-ren : {Γ Γ' Γ'' : Ctx} → Ren Γ' Γ'' → Ren Γ Γ' → Ren Γ Γ''
comp-ren f g x = f (g x)
exchange : {Γ : Ctx} {X Y : VType} → Ren (Γ ∷ X ∷ Y) (Γ ∷ Y ∷ X)
exchange Hd = Tl Hd
exchange (Tl Hd) = Hd
exchange (Tl (Tl x)) = Tl (Tl x)
-- WEAKENING OF RENAMINGS
wk₁ : {Γ : Ctx} {X : VType} → Ren Γ (Γ ∷ X)
wk₁ = Tl
wk₂ : {Γ Γ' : Ctx} {X : VType} → Ren Γ Γ' → Ren (Γ ∷ X) (Γ' ∷ X)
wk₂ f Hd = Hd
wk₂ f (Tl v) = Tl (f v)
wk₃ : {Γ : Ctx} {X Y Z : VType} → Ren (Γ ∷ Y ∷ Z) (Γ ∷ X ∷ Y ∷ Z)
wk₃ Hd = Hd
wk₃ (Tl Hd) = Tl Hd
wk₃ (Tl (Tl x)) = Tl (Tl (Tl x))
-- ACTION OF RENAMING ON WELL-TYPED VALUES AND COMPUTATIONS
mutual
V-rename : {X : VType} {Γ Γ' : Ctx} → Ren Γ Γ' → Γ ⊢V⦂ X → Γ' ⊢V⦂ X
V-rename f (` x) = ` f x
V-rename f (`` c) = `` c
V-rename f (ƛ M) = ƛ (M-rename (wk₂ f) M)
V-rename f ⟨ V ⟩ = ⟨ V-rename f V ⟩
M-rename : {C : CType} {Γ Γ' : Ctx} → Ren Γ Γ' → Γ ⊢M⦂ C → Γ' ⊢M⦂ C
M-rename f (return V) =
return (V-rename f V)
M-rename f (let= M `in N) =
let= M-rename f M `in M-rename (wk₂ f) N
M-rename f (letrec M `in N) =
letrec M-rename (wk₂ (wk₂ f)) M `in M-rename (wk₂ f) N
M-rename f (V · W) =
V-rename f V · V-rename f W
M-rename f (↑ op p V M) =
↑ op p (V-rename f V) (M-rename f M)
M-rename f (↓ op V M) =
↓ op (V-rename f V) (M-rename f M)
M-rename f (promise op ∣ p ↦ M `in N) =
promise op ∣ p ↦ M-rename (wk₂ f) M `in M-rename (wk₂ f) N
M-rename f (await V until M) =
await (V-rename f V) until (M-rename (wk₂ f) M)
M-rename f (coerce p q M) =
coerce p q (M-rename f M)
-- ACTION OF RENAMING ON WELL-TYPED PROCESSES
P-rename : {o : O} {PP : PType o} {Γ Γ' : Ctx} → Ren Γ Γ' → Γ ⊢P⦂ PP → Γ' ⊢P⦂ PP
P-rename f (run M) =
run (M-rename f M)
P-rename f (P ∥ Q) =
P-rename f P ∥ P-rename f Q
P-rename f (↑ op p V P) =
↑ op p (V-rename f V) (P-rename f P)
P-rename f (↓ op V P) =
↓ op (V-rename f V) (P-rename f P)
|
code/Forec/t45.asm | KongoHuster/assembly-exercise | 1 | 163606 | <gh_stars>1-10
;; last edit date: 2016/11/24
;; author: Forec
;; LICENSE
;; Copyright (c) 2015-2017, Forec <<EMAIL>>
;; Permission to use, copy, modify, and/or distribute this code for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
title forec_t45
code segment
assume cs:code
start:
mov cx, 0aaaah ;; 10101010 10101010 -> 11001100 11001100
mov ax, cx
mov bx, cx
mov cx, 8h
loop1:
shr ah, 01h
jc hzero
or bx, 0001h
jmp checkL
hzero:
and bx, 0fffeh
checkL:
shl bx, 01h
shr al, 01h
jc lzero
or bx, 01h
jmp continueLoop
lzero:
and bx, 0fffeh
continueLoop:
cmp cx, 01h
jz quit
shl bx, 01h
loop loop1
quit:
mov cx, bx
mov ah, 4ch
int 21h
code ends
end start |
tests/testthat/asm/hello0.asm | jonocarroll/r64 | 5 | 9820 | *=$0801
.byte $0c, $08, $0a, $00, $9e, $20
.byte $32, $30, $38, $30, $00, $00
.byte $00
*=$0820
ldx #$00
loop lda message,x
and #$3f
sta $0400,x
inx
cpx #$0c
bne loop
rts
message
.text "Hello World!"
|
alloy4fun_models/trashltl/models/10/yYAtSAgvGkmZBASgy.als | Kaixi26/org.alloytools.alloy | 0 | 14 | open main
pred idyYAtSAgvGkmZBASgy_prop11 {
some File after File in Protected
}
pred __repair { idyYAtSAgvGkmZBASgy_prop11 }
check __repair { idyYAtSAgvGkmZBASgy_prop11 <=> prop11o } |
programs/oeis/040/A040423.asm | neoneye/loda | 22 | 242613 | ; A040423: Continued fraction for sqrt(445).
; 21,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10,1,1,10,42,10
seq $0,10217 ; Continued fraction for sqrt(173).
seq $0,7092 ; Numbers in base 6.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.