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 |
|---|---|---|---|---|
alloy4fun_models/trashltl/models/16/eEBMRPZZA3LskGFXg.als | Kaixi26/org.alloytools.alloy | 0 | 1884 | open main
pred ideEBMRPZZA3LskGFXg_prop17 {
always File' = File - File & Trash
}
pred __repair { ideEBMRPZZA3LskGFXg_prop17 }
check __repair { ideEBMRPZZA3LskGFXg_prop17 <=> prop17o } |
LICENSE.agda | boystrange/FairSubtypingAgda | 4 | 6285 | <filename>LICENSE.agda
-- MIT License
-- Copyright (c) 2021 <NAME> and <NAME>
-- Permission is hereby granted, free of charge, to any person
-- obtaining a copy of this software and associated documentation
-- files (the "Software"), to deal in the Software without
-- restriction, including without limitation the rights to use,
-- copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following
-- conditions:
-- The above copyright notice and this permission notice shall be
-- included in all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-- OTHER DEALINGS IN THE SOFTWARE.
|
src/main/antlr/KismetLexer.g4 | astralarya/kismet-antlr | 0 | 6824 | // Kismet Grammar
lexer grammar KismetLexer;
// Lexer
LBRACE : '{' ;
RBRACE : '}' ;
LBRACKET : '[' ;
RBRACKET : ']' ;
LPAREN : '(' ;
RPAREN : ')' ;
SEMICOLON : ';' ;
COMMA : ',' ;
ASSIGN : '=' ;
ELLIPSIS : '...' ;
DOT : '.' ;
NOT : '!' ;
PLUS : '+' ;
MINUS : '-' ;
TIMES : '*' ;
DIV : '/' ;
IDIV : '//' ;
MOD : '%' ;
GT : '>' ;
LT : '<' ;
GTE : '>=' | '≥' ;
LTE : '<=' | '≤' ;
EQ : '==' ;
NEQ : '!=' | '≠' ;
AND : '&&' ;
OR : '||' ;
POW : '^' ;
DIE : 'd' | 'D' ;
ROLL
: DIE ('0' .. '9')+
;
TRUE : 'true' ;
FALSE : 'false' ;
NULL : 'null' ;
UNDEFINED : 'undefined' ;
STRING
: '"' DOUBLE_QUOTE_CHAR* '"'
| '\'' SINGLE_QUOTE_CHAR* '\''
;
fragment DOUBLE_QUOTE_CHAR
: ~["\\\r\n]
| ESCAPE_SEQUENCE
;
fragment SINGLE_QUOTE_CHAR
: ~['\\\r\n]
| ESCAPE_SEQUENCE
;
fragment ESCAPE_SEQUENCE
: '\\' ~[\r\n]
;
ID
: ID_START ID_CHAR*
;
fragment ID_START
: [a-zA-Z_]
;
fragment ID_CHAR
: ID_START | [0-9]
;
DECIMAL
: DECIMAL_START DECIMAL_CHAR*
;
fragment DECIMAL_START
: [0-9]
;
fragment DECIMAL_CHAR
: DECIMAL_START | '_'
;
HEXADECIMAL
: HEXADECIMAL_START HEXADECIMAL_CHAR+
;
fragment HEXADECIMAL_START
: '0x'
| '0X'
;
fragment HEXADECIMAL_CHAR
: [0-9a-fA-F] | '_'
;
BINARY
: BINARY_START BINARY_CHAR+
;
fragment BINARY_START
: '0b'
| '0B'
;
fragment BINARY_CHAR
: [01_]
;
FLOAT
: FLOAT_PART (('e' | 'E') SIGN? FLOAT_PART)?
;
fragment FLOAT_PART
: DECIMAL '.' DECIMAL?
| DECIMAL? '.' DECIMAL
;
fragment SIGN
: ('+' | '-')
;
NEWLINE
: '\n'
;
WHITESPACE
: [ \r\t]+ -> skip
;
|
oeis/098/A098695.asm | neoneye/loda-programs | 11 | 86068 | ; A098695: a(n) = 2^(n(n-1)/2) * Product_{k=1..n} k!.
; Submitted by <NAME>
; 1,1,4,96,18432,35389440,815372697600,263006617337856000,1357366631815981301760000,126095668058466123464363212800000,234278891648287676839670388023623680000000
mov $1,1
mov $2,2
mov $4,23
lpb $0
mov $3,$2
add $2,1
mul $4,$1
lpb $3
mov $3,30
cmp $4,5
lpe
sub $0,1
add $2,1
mul $1,$2
lpe
mov $0,$4
div $0,23
|
source/RASCAL-WimpTask.adb | bracke/Meaning | 0 | 29792 | --------------------------------------------------------------------------------
-- --
-- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers. --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU Lesser General Public --
-- License as published by the Free Software Foundation; either --
-- version 2.1 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- Lesser General Public License for more details. --
-- --
-- You should have received a copy of the GNU Lesser General Public --
-- License along with this library; if not, write to the Free Software --
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --
-- --
--------------------------------------------------------------------------------
-- $Author$
-- $Date$
-- $Revision$
with RASCAL.Utility; use RASCAL.Utility;
with RASCAL.MessageTrans; use RASCAL.MessageTrans;
with RASCAL.Memory; use RASCAL.Memory;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Interfaces.C; use Interfaces.C;
with System.Storage_Elements; use System.Storage_Elements;
with Kernel; use Kernel;
with Reporter;
package body RASCAL.WimpTask is
--
procedure Initialise (The : in out Wimp_Task_Class) is
Wimp_Initialise : constant := 16#400C0#;
Register : aliased Kernel.swi_regs;
Error : oserror_access;
begin
-- Initialise Task
Register.R (0) := int (350);
Register.R (1) := 16#4B534154#;
Register.R (2) := int (To_Integer (Get_Name (The)'address));
Register.R (3) := int (To_Integer (The.Messages (0)'address));
Error := Kernel.SWI (Wimp_Initialise, Register'access, Register'access);
if Error /= null then
pragma Debug(Reporter.Report("WimpTask.Initialise: " & To_Ada(Error.ErrMess)));
OS.Raise_Error(Error);
raise Unable_To_Initialise_WimpTask;
else
Set_Status (The, true);
Set_Task_Handle (The, Task_Handle_Type (Register.R (1)));
Set_Wimp_Version (The, Wimp_Version_Type (Register.R (0)));
Get_Message_Block(The).all(5) := 1;
The.Error.all.Msg_Handle:=Get_Message_Block(The);
The.Error.all.Task_Name :=U(Get_Name(The));
end if;
end Initialise;
--
procedure Initialise (The : in out ToolBox_Task_Class) is
ToolBox_Initialise : constant := 16#44ECF#;
Register : aliased Kernel.swi_regs;
Path : String(To_String(The.Res_Path)'first..To_String(The.Res_Path)'last+1):= To_String(The.Res_Path) & Character'Val(0);
M : Messages_List_Pointer := Get_Messages(The);
Error : oserror_access;
begin
if Length(The.Res_Path) = 0 then
raise No_Toolbox_Res_Path;
end if;
-- Init task
Register.R(0) := int(0);
Register.R(1) := int(350);
Register.R(2) := Adr_To_Int(M.all'Address);
Register.R(3) := Adr_To_Int(The.TB_Wanted_Events.all'Address);
Register.R(4) := Adr_To_Int(Path'Address);
Register.R(5) := Adr_To_Int(Get_Message_Block(The).all'Address);
Register.R(6) := Adr_To_Int(The.TB_Block.all'Address);
Error := Kernel.Swi (ToolBox_Initialise, Register'Access, Register'Access);
if Error /= null then
pragma Debug(Reporter.Report("ToolboxTask.Initialise: " & To_Ada(Error.errmess)));
OS.Raise_Error(Error);
raise Unable_Initialise_ToolboxTask;
else
Set_Status (The,true);
Get_Message_Block (The).all(5) := 1;
Set_Wimp_Version (The,Wimp_Version_Type(Register.R(0)));
Set_Task_Handle (The,Task_Handle_Type(Register.R(1)));
Set_Sprite_Area (The,System_Sprite_Pointer(Int_To_Adr(Register.R(2))));
Set_Name (Wimp_Task_Class(The),
MessageTrans.Lookup("_TaskName" & Character'Val(0),
Get_Message_Block(Wimp_Task_Class(The))));
Get_Error (Wimp_Task_Class(The)).all.Msg_Handle := Get_Message_Block(Wimp_Task_Class(The));
Get_Error (Wimp_Task_Class(The)).all.Task_Name := U(Get_Name(Wimp_Task_Class(The)));
end if;
end Initialise;
--
procedure Single_Poll (The : in out Wimp_Task_Class'Class;
Mask: in Integer := 0) is
Block : Wimp_Block_Pointer := Get_Wimp_Block(The);
Wimp_Poll : constant := 16#400C7#;
Register : aliased Kernel.swi_regs;
Reason_Code : integer;
Error : oserror_access;
begin
Register.R (0) := int(Mask);
Register.R (1) := int (To_Integer (The.Wimp_Block (0)'Address));
Error := Kernel.SWI (Wimp_Poll, Register'Access, Register'Access);
if Error = null then
Reason_Code := integer (Register.R (0));
case Reason_Code is
when 17 | 18 | 19 => Dispatch (The,Message_Event_Code_Type (The.Wimp_Block (4)));
when 16#200# => Dispatch (Toolbox_Task_Class(The),Toolbox_Event_Code_Type(Block(2)));
when others => Dispatch (The, Reason_Event_Code_Type (Reason_Code),
Wimp_Handle_Type (The.Wimp_Block (0)),
Icon_Handle_Type (The.Wimp_Block (1)));
end case;
else
pragma Debug(Reporter.Report("WimpTask.SinglePoll: " & To_Ada(Error.errmess)));
OS.Raise_Error(Error);
end if;
end Single_Poll;
--
procedure Poll (The : in out Wimp_Task_Class'Class) is
Wimp_Poll : constant := 16#400C7#;
Wimp_PollIdle : constant := 16#400E1#;
Register : aliased Kernel.swi_regs;
Reason_code : integer;
Block : Wimp_Block_Pointer := Get_Wimp_Block(The);
Error : oserror_access;
i : HandlerList.Position;
Listener : Event_Pointer;
begin
while Get_Status(The) loop
while not IsEmpty(The.Deleted_Events.all) loop
i := First (The.Deleted_Events.all);
Listener := Retrieve (The.Deleted_Events.all,i);
case Listener.all.Kind is
when Wimp => Remove_WimpListener (The,Listener);
when Message => Remove_MessageListener (The,Listener);
when others => raise Unknown_Deleted_Event;
end case;
Delete (The.Deleted_Events.all,i);
end loop;
Register.R(0) := int(Get_Poll_Mask(The));
Register.R(1) := Adr_To_Int(Block.all(0)'Address);
if The.WakeUpTime = 0 then
Error := Kernel.swi (Wimp_Poll, Register'Access, Register'Access);
else
Register.R(2) := int(The.WakeUpTime);
Error := Kernel.swi (Wimp_PollIdle, Register'Access, Register'Access);
end if;
if Error = null then
Reason_Code := integer(Register.R(0));
case Reason_Code is
when 17 | 18 | 19 => Dispatch(The,Message_Event_Code_Type(Block(4)));
when 16#200# => Dispatch(ToolBox_Task_Class(The),Toolbox_Event_Code_Type(Block(2)));
when others => Dispatch(The,Reason_Event_Code_Type(Reason_Code),Wimp_Handle_Type(Block(0)),Icon_Handle_Type(Block(1)));
end case;
else
pragma Debug(Reporter.Report("WimpTask.Poll: " & To_Ada(Error.errmess)));
OS.Raise_Error(Error);
end if;
end loop;
end Poll;
-- Event handling
procedure Add_Listener (The : in out Wimp_Task_Class'Class;
Listener : in Event_Pointer) is
begin
case Listener.all.Kind is
when Wimp => Add_WimpListener (The,Listener);
when Message => Add_MessageListener (The,Listener);
when Others => Add_ToolboxListener (Toolbox_Task_Class(The),Listener);
end case;
end Add_Listener;
--
procedure Remove_Listener (The : in out Wimp_Task_Class'Class;
Listener : in Event_Pointer) is
begin
case Listener.all.Kind is
when Wimp | Message => AddToRear(The.Deleted_Events.all,Listener);
when Others => raise Remove_Event_Is_Toolbox_Event;
end case;
end Remove_Listener;
--
procedure Add_ToolboxListener (The : in out ToolBox_Task_Class'Class;
Listener : in Event_Pointer) is
Handlers : HandlerList.ListPointer;
Reason_Code : Toolbox_Event_Code_Type := Toolbox_EventListener(Listener.all).Event_Code;
Block : Wimp_Block_Pointer := Get_Wimp_Block(The);
begin
if Get_Status(The) then
raise TB_Event_Added_After_Task_Init;
end if;
-- Initialise ID_Block pointer
Toolbox_EventListener(Listener.all).ID_Block := The.TB_Block;
-- Update Event pointer
Memory.PutWord(Adr_To_Integer (Block.all'Address),
ToolBox_EventListener(Listener.all).ID_Block'Address,4);
Handlers := Find_Handler(The,Reason_Code) ;
if Handlers = null then
Handlers := new HandlerList.List(integer(Reason_Code),-1,-1);
AddToRear(The.TB_Event_Handlers.all,Handlers);
The.TB_Wanted_Events(Number_of_Toolbox_Events) := integer(Reason_Code);
Number_of_Toolbox_Events := Number_of_Toolbox_Events + 1;
end if;
AddToRear(Handlers.all,Listener);
end Add_ToolboxListener;
--
procedure Add_WimpListener (The : in out Wimp_Task_Class'Class;
Listener : in Event_Pointer) is
Handlers : HandlerList.ListPointer;
Reason_Code : Reason_Event_Code_Type :=
Wimp_EventListener (Listener.all).Event_Code;
Block : Wimp_Block_Pointer := Get_Wimp_Block(The);
begin
-- Initialise Event pointer
Memory.PutWord(Adr_To_Integer (Block.all'Address),
Wimp_EventListener(Listener.all).Icon'Address,4);
Handlers := Find_Handler (The, Reason_Code);
if Handlers = null then
Handlers := new HandlerList.List (integer (Reason_Code), -1, -1);
AddToRear (The.Events.all, Handlers);
case Reason_Code is
when Reason_Event_NullReason | Reason_Event_RedrawWindow |
Reason_Event_PointerLeavingWindow | Reason_Event_PointerEnteringWindow |
Reason_Event_MouseClick | Reason_Event_KeyPressed | Reason_Event_LoseCaret |
Reason_Event_GainCaret | Reason_Event_PollWordNonZero |
Reason_Event_UserMessage | Reason_Event_UserMessageRecorded |
Reason_Event_UserMessageAcknowledge | 22 | 23 | 24 => Change_Mask (The, 2**integer (Reason_Code), false);
when others => null;
end case;
end if;
AddToRear (Handlers.all, Listener);
end Add_WimpListener;
--
procedure Remove_WimpListener (The : in out Wimp_Task_Class'Class;
Listener : in Event_Pointer) is
Handlers : HandlerList.ListPointer;
Handler : Event_Pointer;
i : HandlerList.Position;
Reason_Code : Reason_Event_Code_Type :=
Wimp_EventListener (Listener.all).Event_Code;
begin
Handlers := Find_Handler (The, Reason_Code);
if Handlers /= null then
if not IsEmpty (Handlers.all) then
i := First (Handlers.all);
loop
Handler := Retrieve (Handlers.all, i);
if Handler.all = Listener.all then
Delete (Handlers.all, i);
exit;
end if;
exit when IsLast (Handlers.all, i);
GoAhead (Handlers.all, i);
end loop;
end if;
-- Remove reason if there are no handlers
if IsEmpty (Handlers.all) then
-- Update mask
Change_Mask (The, 2**integer (Reason_Code));
Delete_Handler(The,Handlers);
end if;
end if;
end Remove_WimpListener;
--
procedure Add_MessageListener (The : in out Wimp_Task_Class'Class;
Listener : in Event_Pointer) is
Handlers : HandlerList.ListPointer;
Buffer : array (1 .. 2) of integer;
Wimp_AddMessages : constant := 16#400F6#;
Register : aliased Kernel.swi_regs;
Block : Wimp_Block_Pointer := Get_Wimp_Block(The);
Reason_Code : Message_Event_Code_Type
:= Message_EventListener (Listener.all).Event_Code;
begin
-- Initialise event pointer
Memory.PutWord(Adr_To_Integer (Block.all'Address),
Message_EventListener(Listener.all).Event_Code'Address,4);
Handlers := Find_Handler (The, Reason_Code);
if Handlers = null then
Handlers := new HandlerList.List (integer (Reason_Code), -1, -1);
AddToRear (The.Msg_Events.all, Handlers);
The.Messages (Number_Of_Messages) := integer (Reason_Code);
-- Ensure message '0' is the last message in the array.
if (Number_Of_Messages > 0) and then
(The.Messages (Number_Of_Messages-1) = 0) then
The.Messages (Number_Of_Messages-1) := The.Messages (Number_Of_Messages);
The.Messages (Number_Of_Messages) := 0;
end if;
Number_Of_Messages := Number_Of_Messages + 1;
-- If task is running...
if Get_Status (The) then
Buffer (1) := integer (Reason_Code);
Buffer (2) := 0;
Register.R (0) := int (To_Integer (Buffer (1)'Address));
Kernel.SWI (Wimp_AddMessages, Register'Access, Register'Access);
end if;
end if;
AddToRear (Handlers.all, Listener);
end Add_MessageListener;
--
procedure Remove_MessageListener (The : in out Wimp_Task_Class'Class;
Listener : in Event_Pointer) is
List : HandlerList.ListPointer;
Handler : Event_Pointer;
Buffer : array (1 .. 2) of integer;
Wimp_RemoveMessages : constant := 16#400F7#;
Register : aliased Kernel.swi_regs;
i : HandlerList.Position;
Reason_Code : Message_Event_Code_Type
:= Message_EventListener (Listener.all).Event_Code;
begin
List := Find_Handler (The, Reason_Code);
if List /= null then
if not IsEmpty (List.all) then
i := First (List.all);
loop
Handler := Retrieve (List.all, i);
if Handler.all = Listener.all then
Delete (List.all, i);
exit;
end if;
exit when IsLast (List.all, i);
GoAhead (List.all, i);
end loop;
end if;
-- Remove message if there are no handlers
if IsEmpty (List.all) then
Buffer (1) := integer (Reason_Code);
Buffer (2) := 0;
Register.R (0) := int (To_Integer (Buffer (1)'Address));
Kernel.SWI (Wimp_RemoveMessages, Register'Access,
Register'Access);
Delete_Handler(The,List);
end if;
end if;
end Remove_MessageListener;
--
procedure Dispatch (The : in out Wimp_Task_Class'Class;
Reason_Code : in Reason_Event_Code_Type;
Window : in Wimp_Handle_Type;
Icon : in Icon_Handle_Type) is
Handlers : HandlerList.ListPointer;
Handler : Event_Pointer;
i : HandlerList.Position;
W : Wimp_Handle_Type;
Ic : Icon_Handle_Type;
begin
Handlers := Find_Handler (The, Reason_Code);
if Handlers /= null then
if not IsEmpty (Handlers.all) then
i := First (Handlers.all);
loop
Handler := Retrieve (Handlers.all, i);
W := Wimp_EventListener (Handler.all).Window;
Ic := Wimp_EventListener (Handler.all).Icon;
if (W = Window or W = -1) then
if (Ic = Icon or Ic = -1) then
Handle (Handler.all);
end if;
end if;
exit when IsLast (Handlers.all, i);
GoAhead (Handlers.all, i);
end loop;
end if;
end if;
end Dispatch;
--
procedure Dispatch (The : in out Wimp_Task_Class'Class;
Reason_Code : in Message_Event_Code_Type) is
List : HandlerList.ListPointer;
Handler : Event_Pointer;
i : HandlerList.Position;
begin
List := Find_Handler (The, Reason_Code);
if List /= null then
if not IsEmpty (List.all) then
i := First (List.all);
loop
Handler := Retrieve (List.all, i);
Handle (Handler.all);
exit when IsLast (List.all, i);
GoAhead (List.all, i);
end loop;
end if;
end if;
end Dispatch;
--
procedure Dispatch (The : in out ToolBox_Task_Class;
Reason_Code : in ToolBox_Event_Code_Type) is
Object : constant Object_ID := Get_Self_Id(The);
Component : constant Component_ID := Get_Self_Component(The);
Handlers : HandlerList.ListPointer;
Handler : Event_Pointer;
I : HandlerList.Position;
O : Object_ID;
C : Component_ID;
begin
Handlers := Find_Handler(The,Reason_Code);
if Handlers /= null then
if not IsEmpty(Handlers.all) then
I := First(Handlers.all);
loop
Handler := Retrieve(Handlers.all,I);
O := Object_ID(ToolBox_EventListener(Handler.all).Object);
C := Component_ID(ToolBox_EventListener(Handler.all).Component);
if (O = Object or O = -1) then
if (C = Component or C = -1) then
Handle(Handler.all);
end if;
end if;
exit when IsLast(Handlers.all,I);
GoAhead(Handlers.all,I);
end loop;
end if;
end if;
end Dispatch;
--
function Find_Handler (The : in ToolBox_Task_Class;
Reason_Code : in ToolBox_Event_Code_Type) return HandlerList.ListPointer is
i : List.Position;
Handlers : HandlerList.ListPointer;
begin
if not IsEmpty(The.TB_Event_Handlers.all) then
i := First(The.TB_Event_Handlers.all);
loop
Handlers := Retrieve(The.TB_Event_Handlers.all,i);
if Get_Event_Code(Handlers.all) = integer(Reason_Code) then
return Handlers;
end if;
exit when IsLast(The.TB_Event_Handlers.all,i);
GoAhead(The.TB_Event_Handlers.all,i);
end loop;
end if;
return null;
end Find_Handler;
-- Get methods
function Get_Message_Block (The : in Wimp_Task_Class'Class)
return Messages_Handle_Type is
begin
return The.Msg_Block;
end Get_Message_Block;
--
function Get_Wimp_Version (The : in Wimp_Task_Class'Class)
return Wimp_Version_Type is
begin
return The.Wimp_Nr;
end Get_Wimp_Version;
--
function Get_Task_Handle (The : in Wimp_Task_Class'Class)
return Task_Handle_Type is
begin
return The.Task_Handle;
end Get_Task_Handle;
--
function Get_Name (The : in Wimp_Task_Class'Class) return String is
begin
return To_String(The.Task_Name);
end Get_Name;
--
function Get_Wimp_Block (The : in Wimp_Task_Class'Class)
return Wimp_Block_Pointer is
begin
return The.Wimp_Block;
end Get_Wimp_Block;
--
function Get_Status (The : in Wimp_Task_Class'Class)
return Task_Status_Type is
begin
return The.Continue;
end Get_Status;
--
function Get_Poll_Mask (The : in Wimp_Task_Class'Class)
return Poll_Mask_Type is
begin
return The.Mask;
end Get_Poll_Mask;
--
function Get_WakeUp_Time (The : in Wimp_Task_Class'Class) return Integer is
begin
return The.WakeUpTime;
end Get_WakeUp_Time;
--
function Get_Error (The : in Wimp_Task_Class'Class) return Error.Error_Pointer is
begin
return The.Error;
end Get_Error;
--
function Get_Resources_Path (The : in ToolBox_Task_Class) return String is
begin
return To_String(The.Res_Path);
end Get_Resources_Path;
--
function Get_Self_Id (The : in ToolBox_Task_Class) return Object_ID is
begin
return The.TB_Block.all.Self_Id;
end Get_Self_Id;
--
function Get_Self_Component (The : in ToolBox_Task_Class) return Component_ID is
begin
return The.TB_Block.all.Self_Component;
end Get_Self_Component;
--
function Get_Parent_Id (The : in ToolBox_Task_Class) return Object_ID is
begin
return The.TB_Block.all.Parent_Id;
end Get_Parent_Id;
--
function Get_Parent_Component (The : in ToolBox_Task_Class) return Component_ID is
begin
return The.TB_Block.all.Parent_Component;
end Get_Parent_Component;
--
function Get_Ancestor_Id (The : in ToolBox_Task_Class) return Object_ID is
begin
return The.TB_Block.all.Ancestor_Id;
end Get_Ancestor_Id;
--
function Get_Ancestor_Component (The : in ToolBox_Task_Class) return Component_ID is
begin
return The.TB_Block.all.Ancestor_Component;
end Get_Ancestor_Component;
--
function Get_Sprite_Area (The : in ToolBox_Task_Class) return System_Sprite_Pointer is
begin
return The.Sprite_Area;
end Get_Sprite_Area;
-- Set methods
procedure Set_Resources_Path (The : in out ToolBox_Task_Class;
Path : in String) is
begin
The.Res_Path := To_Unbounded_String(Path);
end Set_Resources_Path;
--
procedure Set_Sprite_Area (The : in out ToolBox_Task_Class;
Area: in System_Sprite_Pointer) is
begin
The.Sprite_Area:=Area;
end Set_Sprite_Area;
--
procedure Set_Wimp_Version (The : in out Wimp_Task_Class'Class;
Nr : in Wimp_Version_Type) is
begin
The.Wimp_Nr := Nr;
end Set_Wimp_Version;
--
procedure Set_Task_Handle (The : in out Wimp_Task_Class'Class;
Handle : in Task_Handle_Type) is
begin
The.Task_Handle := Handle;
end Set_Task_Handle;
--
procedure Set_Name (The : in out Wimp_Task_Class'Class;
Name : in String) is
begin
The.Task_Name := To_Unbounded_String (Name);
end Set_Name;
--
procedure Set_Status (The : in out Wimp_Task_Class'Class;
Status : in Task_Status_Type) is
begin
The.Continue := Status;
end Set_Status;
--
procedure Set_Poll_Mask (The : in out Wimp_Task_Class'Class;
Poll_Mask : in Poll_Mask_Type) is
begin
The.Mask := Poll_Mask;
end Set_Poll_Mask;
--
procedure Set_WakeUp_Time (The : in out Wimp_Task_Class'Class;
Time : in Integer) is
begin
The.WakeUpTime := Time;
end Set_WakeUp_Time;
--
function Get_Messages (The : in Wimp_Task_Class'Class)
return Messages_List_Pointer is
begin
return The.Messages;
end Get_Messages;
-- Misc
function Find_Handler (The : in Wimp_Task_Class'Class;
Reason_Code : in Reason_Event_Code_Type)
return HandlerList.ListPointer is
i : List.Position;
Handlers : HandlerList.ListPointer;
begin
if not IsEmpty (The.Events.all) then
i := First (The.Events.all);
loop
Handlers := Retrieve (The.Events.all, i);
if Get_Event_Code (Handlers.all) = integer (Reason_Code) then
return Handlers;
end if;
exit when IsLast (The.Events.all, i);
GoAhead (The.Events.all, i);
end loop;
end if;
return null;
end Find_Handler;
--
function Find_Handler (The : in Wimp_Task_Class'Class;
Message_Code : in Message_Event_Code_Type)
return HandlerList.ListPointer is
i : List.Position;
Handlers : HandlerList.ListPointer;
begin
if not IsEmpty (The.Msg_Events.all) then
i := First (The.Msg_Events.all);
loop
Handlers := Retrieve (The.Msg_Events.all, i);
if Get_Event_Code (Handlers.all) = integer (Message_Code) then
return Handlers;
end if;
exit when IsLast (The.Msg_Events.all, i);
GoAhead (The.Msg_Events.all, i);
end loop;
end if;
return null;
end Find_Handler;
--
procedure Delete_Handler (The : in Wimp_Task_Class'Class;
Events : in HandlerList.ListPointer) is
i : List.Position;
Handlers : HandlerList.ListPointer;
begin
if not IsEmpty (The.Events.all) then
i := First (The.Events.all);
loop
Handlers := Retrieve (The.Events.all, i);
if Handlers = Events then
Delete (The.Events.all,i);
exit;
end if;
exit when IsLast (The.Events.all, i);
GoAhead (The.Events.all, i);
end loop;
end if;
end Delete_Handler;
--
procedure Change_Mask (The : in out Wimp_Task_Class'Class;
Value : in unsigned;
Set : in Boolean := true) is
New_Mask : Poll_Mask_Type := Get_Poll_Mask (The);
begin
if Set then
New_Mask := New_Mask or Value;
else
New_Mask := New_Mask and (not Value);
end if;
Set_Poll_Mask (The, New_Mask);
end Change_Mask;
--
procedure Set_Error (The : in out Wimp_Task_Class'Class;
E : in Error_Pointer) is
begin
The.Error := E;
end Set_Error;
--
procedure Report_ID_Block (The : in ToolBox_Task_Class) is
begin
pragma Debug(Reporter.Report("Ancestor_ID: " & intstr(integer(The.TB_Block.all.Ancestor_ID))));
null; pragma Debug(Reporter.Report("Ancestor_Component: " & intstr(integer(The.TB_Block.all.Ancestor_Component))));
pragma Debug(Reporter.Report("Parent_ID: " & intstr(integer(The.TB_Block.all.Parent_ID))));
pragma Debug(Reporter.Report("Parent_Component: " & intstr(integer(The.TB_Block.all.Parent_Component))));
pragma Debug(Reporter.Report("Self_ID: " & intstr(integer(The.TB_Block.all.Self_ID))));
pragma Debug(Reporter.Report("Self_Component: " & intstr(integer(The.TB_Block.all.Self_Component))));
end Report_ID_Block;
--
end RASCAL.WimpTask;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1633.asm | ljhsiun2/medusa | 9 | 172139 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r15
push %r8
push %r9
push %rsi
lea addresses_A_ht+0x18f59, %r8
nop
nop
nop
nop
sub %r9, %r9
movb $0x61, (%r8)
nop
nop
nop
cmp %rsi, %rsi
pop %rsi
pop %r9
pop %r8
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_normal+0xa70f, %rsi
lea addresses_RW+0x1f92f, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
inc %rdx
mov $93, %rcx
rep movsb
nop
dec %rcx
// Faulty Load
lea addresses_PSE+0x9a2f, %rsi
nop
nop
cmp $58679, %r11
movb (%rsi), %r8b
lea oracles, %r11
and $0xff, %r8
shlq $12, %r8
mov (%r11,%r8,1), %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_PSE', 'congruent': 0}}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_RW'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_normal'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_PSE', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A_ht', 'congruent': 1}, 'OP': 'STOR'}
{'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
*/
|
theorems/homotopy/EilenbergMacLaneFunctor.agda | AntoineAllioux/HoTT-Agda | 294 | 15611 | {-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import homotopy.EM1HSpace
open import homotopy.EilenbergMacLane
open import homotopy.EilenbergMacLane1
open import homotopy.EM1HSpace
open import homotopy.EM1HSpaceAssoc
module homotopy.EilenbergMacLaneFunctor where
open EMExplicit
module _ {i j} {G : Group i} {H : Group j} (φ : G →ᴳ H) where
private
module φ = GroupHom φ
EM₁-fmap-hom : G →ᴳ Ω^S-group 0 (⊙EM₁ H)
EM₁-fmap-hom = group-hom f f-preserves-comp
where
f : Group.El G → embase' H == embase
f g = emloop (φ.f g)
f-preserves-comp : ∀ g₁ g₂ → f (Group.comp G g₁ g₂) == f g₁ ∙ f g₂
f-preserves-comp g₁ g₂ =
emloop (φ.f (Group.comp G g₁ g₂))
=⟨ ap emloop (φ.pres-comp g₁ g₂) ⟩
emloop (Group.comp H (φ.f g₁) (φ.f g₂))
=⟨ emloop-comp' H (φ.f g₁) (φ.f g₂) ⟩
emloop (φ.f g₁) ∙ emloop (φ.f g₂) =∎
module EM₁FmapRec =
EM₁Level₁Rec {G = G} {C = EM₁ H}
{{EM₁-level₁ H {⟨-2⟩}}}
embase
EM₁-fmap-hom
abstract
EM₁-fmap : EM₁ G → EM₁ H
EM₁-fmap = EM₁FmapRec.f
EM₁-fmap-embase-β : EM₁-fmap embase ↦ embase
EM₁-fmap-embase-β = EM₁FmapRec.embase-β
{-# REWRITE EM₁-fmap-embase-β #-}
EM₁-fmap-emloop-β : ∀ g → ap EM₁-fmap (emloop g) == emloop (φ.f g)
EM₁-fmap-emloop-β = EM₁FmapRec.emloop-β
⊙EM₁-fmap : ⊙EM₁ G ⊙→ ⊙EM₁ H
⊙EM₁-fmap = EM₁-fmap , idp
module _ {i j k} {G : Group i} {H : Group j} {K : Group k} (ψ : H →ᴳ K) (φ : G →ᴳ H) where
EM₁-fmap-∘ : EM₁-fmap (ψ ∘ᴳ φ) ∼ EM₁-fmap ψ ∘ EM₁-fmap φ
EM₁-fmap-∘ =
EM₁-set-elim
{P = λ x → EM₁-fmap (ψ ∘ᴳ φ) x == EM₁-fmap ψ (EM₁-fmap φ x)}
{{λ x → has-level-apply (EM₁-level₁ K) _ _}}
idp $
λ g → ↓-='-in' $
ap (EM₁-fmap ψ ∘ EM₁-fmap φ) (emloop g)
=⟨ ap-∘ (EM₁-fmap ψ) (EM₁-fmap φ) (emloop g) ⟩
ap (EM₁-fmap ψ) (ap (EM₁-fmap φ) (emloop g))
=⟨ ap (ap (EM₁-fmap ψ)) (EM₁-fmap-emloop-β φ g) ⟩
ap (EM₁-fmap ψ) (emloop (GroupHom.f φ g))
=⟨ EM₁-fmap-emloop-β ψ (GroupHom.f φ g) ⟩
emloop (GroupHom.f (ψ ∘ᴳ φ) g)
=⟨ ! (EM₁-fmap-emloop-β (ψ ∘ᴳ φ) g) ⟩
ap (EM₁-fmap (ψ ∘ᴳ φ)) (emloop g) =∎
⊙EM₁-fmap-∘ : ⊙EM₁-fmap (ψ ∘ᴳ φ) ⊙∼ ⊙EM₁-fmap ψ ⊙∘ ⊙EM₁-fmap φ
⊙EM₁-fmap-∘ = EM₁-fmap-∘ , idp
module _ {i} (G : Group i) where
EM₁-fmap-idhom : EM₁-fmap (idhom G) ∼ idf (EM₁ G)
EM₁-fmap-idhom =
EM₁-set-elim
{P = λ x → EM₁-fmap (idhom G) x == x}
{{λ x → has-level-apply (EM₁-level₁ G) (EM₁-fmap (idhom G) x) x}}
idp $
λ g → ↓-='-in' $ ! $
ap (EM₁-fmap (idhom G)) (emloop g)
=⟨ EM₁-fmap-emloop-β (idhom G) g ⟩
emloop g
=⟨ ! (ap-idf (emloop g)) ⟩
ap (idf (EM₁ G)) (emloop g) =∎
⊙EM₁-fmap-idhom : ⊙EM₁-fmap (idhom G) ⊙∼ ⊙idf (⊙EM₁ G)
⊙EM₁-fmap-idhom = EM₁-fmap-idhom , idp
module _ {i j} (G : Group i) (H : Group j) where
EM₁-fmap-cst-hom : EM₁-fmap (cst-hom {G = G} {H = H}) ∼ cst embase
EM₁-fmap-cst-hom =
EM₁-set-elim
{P = λ x → EM₁-fmap cst-hom x == embase}
{{λ x → has-level-apply (EM₁-level₁ H) (EM₁-fmap cst-hom x) embase}}
idp $
λ g → ↓-app=cst-in' $ ! $
ap (EM₁-fmap cst-hom) (emloop g)
=⟨ EM₁-fmap-emloop-β cst-hom g ⟩
emloop (Group.ident H)
=⟨ emloop-ident ⟩
idp =∎
⊙EM₁-fmap-cst-hom : ⊙EM₁-fmap (cst-hom {G = G} {H = H}) ⊙∼ ⊙cst
⊙EM₁-fmap-cst-hom = EM₁-fmap-cst-hom , idp
module _ {i j} (G : AbGroup i) (H : AbGroup j) (φ : G →ᴬᴳ H) where
⊙EM-fmap : ∀ n → ⊙EM G n ⊙→ ⊙EM H n
⊙EM-fmap = EMImplicitMap.⊙EM-fmap (⊙EM₁-fmap φ) (EM₁HSpace.H-⊙EM₁ G) (EM₁HSpace.H-⊙EM₁ H)
EM-fmap : ∀ n → EM G n → EM H n
EM-fmap n = fst (⊙EM-fmap n)
module _ {i} (G H : AbGroup i) (φ : AbGroup.grp G →ᴳ AbGroup.grp H) where
private
module SN = SpectrumNatural
{X = ⊙EM₁ (AbGroup.grp G)} {Y = ⊙EM₁ (AbGroup.grp H)}
(⊙EM₁-fmap φ)
{{EM₁-conn}} {{EM₁-conn}}
{{EM₁-level₁ (AbGroup.grp G)}} {{EM₁-level₁ (AbGroup.grp H)}}
(EM₁HSpace.H-⊙EM₁ G) (EM₁HSpace.H-⊙EM₁ H)
abstract
{-
checking this definition is very slow for some
mysterious reason (unification maybe?)
-}
⊙–>-spectrum-natural : ∀ (n : ℕ)
→ ⊙–> (spectrum H n) ◃⊙∘
⊙Ω-fmap (⊙EM-fmap G H φ (S n)) ◃⊙idf
=⊙∘
⊙EM-fmap G H φ n ◃⊙∘
⊙–> (spectrum G n) ◃⊙idf
⊙–>-spectrum-natural n =
⊙–> (spectrum H n) ◃⊙∘
⊙Ω-fmap (⊙EM-fmap G H φ (S n)) ◃⊙idf
=⊙∘₁⟨ 0 & 1 & ap ⊙–> (spectrum-def H n) ⟩
⊙–> (Spectrum.spectrum H n) ◃⊙∘
⊙Ω-fmap (⊙EM-fmap G H φ (S n)) ◃⊙idf
=⊙∘⟨ SN.⊙–>-spectrum-natural n ⟩
⊙EM-fmap G H φ n ◃⊙∘
⊙–> (Spectrum.spectrum G n) ◃⊙idf
=⊙∘₁⟨ 1 & 1 & ap ⊙–> (! (spectrum-def G n)) ⟩
⊙EM-fmap G H φ n ◃⊙∘
⊙–> (spectrum G n) ◃⊙idf ∎⊙∘
{-
derived from `⊙–>-spectrum-natural` instead of from
`SN.⊙<–-spectrum-natural n` since that circumvents
the slowness issue for this definition.
-}
⊙<–-spectrum-natural : ∀ (n : ℕ)
→ ⊙<– (spectrum H n) ◃⊙∘
⊙EM-fmap G H φ n ◃⊙idf
=⊙∘
⊙Ω-fmap (⊙EM-fmap G H φ (S n)) ◃⊙∘
⊙<– (spectrum G n) ◃⊙idf
⊙<–-spectrum-natural n =
⊙<– (spectrum H n) ◃⊙∘
⊙EM-fmap G H φ n ◃⊙idf
=⊙∘⟨ 2 & 0 & !⊙∘ $ ⊙<–-inv-r-=⊙∘ (spectrum G n) ⟩
⊙<– (spectrum H n) ◃⊙∘
⊙EM-fmap G H φ n ◃⊙∘
⊙–> (spectrum G n) ◃⊙∘
⊙<– (spectrum G n) ◃⊙idf
=⊙∘⟨ 1 & 2 & !⊙∘ $ ⊙–>-spectrum-natural n ⟩
⊙<– (spectrum H n) ◃⊙∘
⊙–> (spectrum H n) ◃⊙∘
⊙Ω-fmap (⊙EM-fmap G H φ (S n)) ◃⊙∘
⊙<– (spectrum G n) ◃⊙idf
=⊙∘⟨ 0 & 2 & ⊙<–-inv-l-=⊙∘ (spectrum H n) ⟩
⊙Ω-fmap (⊙EM-fmap G H φ (S n)) ◃⊙∘
⊙<– (spectrum G n) ◃⊙idf ∎⊙∘
module _ {i j k} (G : AbGroup i) (H : AbGroup j) (K : AbGroup k) (ψ : H →ᴬᴳ K) (φ : G →ᴬᴳ H) where
private
module G = AbGroup G
module H = AbGroup H
module K = AbGroup K
⊙EM-fmap-∘ : ∀ n → ⊙EM-fmap G K (ψ ∘ᴳ φ) n == ⊙EM-fmap H K ψ n ⊙∘ ⊙EM-fmap G H φ n
⊙EM-fmap-∘ O =
⊙Ω-fmap (⊙EM₁-fmap (ψ ∘ᴳ φ))
=⟨ ap ⊙Ω-fmap (⊙λ= (⊙EM₁-fmap-∘ ψ φ)) ⟩
⊙Ω-fmap (⊙EM₁-fmap ψ ⊙∘ ⊙EM₁-fmap φ)
=⟨ ⊙Ω-fmap-∘ (⊙EM₁-fmap ψ) (⊙EM₁-fmap φ) ⟩
⊙Ω-fmap (⊙EM₁-fmap ψ) ⊙∘ ⊙Ω-fmap (⊙EM₁-fmap φ) =∎
⊙EM-fmap-∘ (S n) =
⊙Trunc-fmap (⊙Susp^-fmap n (⊙EM₁-fmap (ψ ∘ᴳ φ)))
=⟨ ap (⊙Trunc-fmap ∘ ⊙Susp^-fmap n) (⊙λ= (⊙EM₁-fmap-∘ ψ φ)) ⟩
⊙Trunc-fmap (⊙Susp^-fmap n (⊙EM₁-fmap ψ ⊙∘ ⊙EM₁-fmap φ))
=⟨ ap ⊙Trunc-fmap (⊙Susp^-fmap-∘ n (⊙EM₁-fmap ψ) (⊙EM₁-fmap φ)) ⟩
⊙Trunc-fmap (⊙Susp^-fmap n (⊙EM₁-fmap ψ) ⊙∘ ⊙Susp^-fmap n (⊙EM₁-fmap φ))
=⟨ ! (⊙λ= (⊙Trunc-fmap-⊙∘ (⊙Susp^-fmap n (⊙EM₁-fmap ψ)) (⊙Susp^-fmap n (⊙EM₁-fmap φ)))) ⟩
⊙Trunc-fmap (⊙Susp^-fmap n (⊙EM₁-fmap ψ)) ⊙∘ ⊙Trunc-fmap (⊙Susp^-fmap n (⊙EM₁-fmap φ)) =∎
EM-fmap-∘ : ∀ n → EM-fmap G K (ψ ∘ᴳ φ) n == EM-fmap H K ψ n ∘ EM-fmap G H φ n
EM-fmap-∘ n = ap fst (⊙EM-fmap-∘ n)
module _ {i} (G : AbGroup i) where
private
module G = AbGroup G
open EM₁HSpace G using (mult; mult-emloop-β)
EM₁-neg : EM₁ G.grp → EM₁ G.grp
EM₁-neg = EM₁-fmap (inv-hom G)
⊙EM₁-neg : ⊙EM₁ G.grp ⊙→ ⊙EM₁ G.grp
⊙EM₁-neg = ⊙EM₁-fmap (inv-hom G)
abstract
EM₁-neg-emloop-β : ∀ g → ap EM₁-neg (emloop g) == ! (emloop g)
EM₁-neg-emloop-β g =
ap EM₁-neg (emloop g)
=⟨ EM₁-fmap-emloop-β (inv-hom G) g ⟩
emloop (G.inv g)
=⟨ emloop-inv g ⟩
! (emloop g) =∎
EM₁-neg-! : ∀ (p : embase' G.grp == embase)
→ ap EM₁-neg p == ! p
EM₁-neg-! p =
transport (λ q → ap EM₁-neg q == ! q)
(<–-inv-r (emloop-equiv G.grp) p) $
EM₁-neg-emloop-β (<– (emloop-equiv G.grp) p)
⊙Ω-fmap-⊙EM₁-neg : ⊙Ω-fmap ⊙EM₁-neg == ⊙Ω-!
⊙Ω-fmap-⊙EM₁-neg = ⊙λ=' EM₁-neg-! $ prop-has-all-paths-↓
{{has-level-apply (has-level-apply (EM₁-level₁ G.grp {n = -2}) _ _) _ _}}
EM₁-neg-inv-l : ∀ (x : EM₁ G.grp)
→ mult (EM₁-neg x) x == embase
EM₁-neg-inv-l =
EM₁-set-elim
{P = λ x → mult (EM₁-neg x) x == embase}
{{λ x → has-level-apply (EM₁-level₁ G.grp) _ _}}
idp $ λ g →
↓-='-in-=ₛ $ !ₛ $
ap (λ x → mult (EM₁-neg x) x) (emloop g) ◃∙
idp ◃∎
=ₛ⟨ 1 & 1 & expand [] ⟩
ap (λ x → mult (EM₁-neg x) x) (emloop g) ◃∎
=ₛ₁⟨ ! (ap2-diag (λ x y → mult (EM₁-neg x) y) (emloop g)) ⟩
ap2 (λ x y → mult (EM₁-neg x) y) (emloop g) (emloop g) ◃∎
=ₛ⟨ ap2-out (λ x y → mult (EM₁-neg x) y) (emloop g) (emloop g) ⟩
ap (λ x → mult (EM₁-neg x) embase) (emloop g) ◃∙
ap (λ y → y) (emloop g) ◃∎
=ₛ₁⟨ 1 & 1 & ap-idf (emloop g) ⟩
ap (λ x → mult (EM₁-neg x) embase) (emloop g) ◃∙
emloop g ◃∎
=ₛ₁⟨ 0 & 1 & ap-∘ (λ x → mult x embase) EM₁-neg (emloop g) ⟩
ap (λ x → mult x embase) (ap EM₁-neg (emloop g)) ◃∙
emloop g ◃∎
=ₛ₁⟨ 0 & 1 & ap (ap (λ x → mult x embase)) (EM₁-neg-emloop-β g) ⟩
ap (λ x → mult x embase) (! (emloop g)) ◃∙
emloop g ◃∎
=ₛ₁⟨ 0 & 1 & ap-! (λ x → mult x embase) (emloop g) ⟩
! (ap (λ x → mult x embase) (emloop g)) ◃∙
emloop g ◃∎
=ₛ₁⟨ 0 & 1 & ap ! (mult-emloop-β g embase) ⟩
! (emloop g) ◃∙
emloop g ◃∎
=ₛ₁⟨ !-inv-l (emloop g) ⟩
idp ◃∎
=ₛ₁⟨ 1 & 0 & ! (ap-cst embase (emloop g)) ⟩
idp ◃∙
ap (cst embase) (emloop g) ◃∎ ∎ₛ
EM₁-neg-inv-r : ∀ (x : EM₁ G.grp)
→ mult x (EM₁-neg x) == embase
EM₁-neg-inv-r =
EM₁-set-elim
{P = λ x → mult x (EM₁-neg x) == embase}
{{λ x → has-level-apply (EM₁-level₁ G.grp) _ _}}
idp $ λ g →
↓-='-in-=ₛ $ !ₛ $
ap (λ x → mult x (EM₁-neg x)) (emloop g) ◃∙
idp ◃∎
=ₛ⟨ 1 & 1 & expand [] ⟩
ap (λ x → mult x (EM₁-neg x)) (emloop g) ◃∎
=ₛ₁⟨ ! (ap2-diag (λ x y → mult x (EM₁-neg y)) (emloop g)) ⟩
ap2 (λ x y → mult x (EM₁-neg y)) (emloop g) (emloop g) ◃∎
=ₛ⟨ ap2-out (λ x y → mult x (EM₁-neg y)) (emloop g) (emloop g) ⟩
ap (λ x → mult x embase) (emloop g) ◃∙
ap EM₁-neg (emloop g) ◃∎
=ₛ₁⟨ 0 & 1 & mult-emloop-β g embase ⟩
emloop g ◃∙
ap EM₁-neg (emloop g) ◃∎
=ₛ₁⟨ 1 & 1 & EM₁-neg-emloop-β g ⟩
emloop g ◃∙
! (emloop g) ◃∎
=ₛ₁⟨ !-inv-r (emloop g) ⟩
idp ◃∎
=ₛ₁⟨ 1 & 0 & ! (ap-cst embase (emloop g)) ⟩
idp ◃∙
ap (λ _ → embase) (emloop g) ◃∎ ∎ₛ
EM-neg : ∀ (n : ℕ) → EM G n → EM G n
EM-neg n = EM-fmap G G (inv-hom G) n
⊙EM-neg : ∀ (n : ℕ) → ⊙EM G n ⊙→ ⊙EM G n
⊙EM-neg n = ⊙EM-fmap G G (inv-hom G) n
private
-- superseded by Susp-flip-EM-neg
EM-neg-2=Trunc-fmap-Susp-flip : EM-neg 2 ∼ Trunc-fmap Susp-flip
EM-neg-2=Trunc-fmap-Susp-flip =
Trunc-elim {{λ t → =-preserves-level (EM-level G 2)}} $
Susp-elim
{P = λ s → EM-neg 2 [ s ]₂ == Trunc-fmap Susp-flip [ s ]₂}
(ap [_]₂ (merid embase))
(ap [_]₂ (! (merid embase))) $
λ x → ↓-='-in-=ₛ $
ap [_]₂ (merid embase) ◃∙
ap (Trunc-fmap Susp-flip ∘ [_]₂) (merid x) ◃∎
=ₛ₁⟨ 1 & 1 & ap-∘ [_]₂ Susp-flip (merid x) ⟩
ap [_]₂ (merid embase) ◃∙
ap [_]₂ (ap Susp-flip (merid x)) ◃∎
=ₛ₁⟨ 1 & 1 & ap (ap [_]₂) (SuspFlip.merid-β x) ⟩
ap [_]₂ (merid embase) ◃∙
ap [_]₂ (! (merid x)) ◃∎
=ₛ₁⟨ 0 & 1 & ap (ap [_]₂) (! (!-! (merid embase))) ⟩
ap [_]₂ (! (! (merid embase))) ◃∙
ap [_]₂ (! (merid x)) ◃∎
=ₛ⟨ ap-seq-=ₛ [_]₂ (∙-!-seq (merid x ◃∙ ! (merid embase) ◃∎)) ⟩
ap [_]₂ (! (η x)) ◃∎
=ₛ₁⟨ ap-! [_]₂ (η x) ⟩
! (ap [_]₂ (η x)) ◃∎
=ₛ₁⟨ cancels-inverse (ap [_]₂ (η x)) (ap [_]₂ (η (EM₁-neg x))) $
ap [_]₂ (η x) ∙ ap [_]₂ (η (EM₁-neg x))
=⟨ ∙-ap [_]₂ (η x) (η (EM₁-neg x)) ⟩
ap [_]₂ (η x ∙ η (EM₁-neg x))
=⟨ ap (<– (=ₜ-equiv [ north ]₂ [ north ]₂)) $
! $ comp x (EM₁-neg x) ⟩
ap [_]₂ (η (mult x (EM₁-neg x)))
=⟨ ap (ap [_]₂ ∘ η) (EM₁-neg-inv-r x) ⟩
ap [_]₂ (η embase)
=⟨ ap (ap [_]₂) (!-inv-r (merid embase)) ⟩
idp =∎ ⟩
ap [_]₂ (η (EM₁-neg x)) ◃∎
=ₛ⟨ ap-seq-∙ [_]₂ (merid (EM₁-neg x) ◃∙ ! (merid embase) ◃∎) ⟩
ap [_]₂ (merid (EM₁-neg x)) ◃∙
ap [_]₂ (! (merid embase)) ◃∎
=ₛ₁⟨ 0 & 1 & ap (ap [_]₂) (! (SuspFmap.merid-β EM₁-neg x)) ⟩
ap [_]₂ (ap (Susp-fmap EM₁-neg) (merid x)) ◃∙
ap [_]₂ (! (merid embase)) ◃∎
=ₛ₁⟨ 0 & 1 & ∘-ap [_]₂ (Susp-fmap EM₁-neg) (merid x) ⟩
ap (EM-neg 2 ∘ [_]₂) (merid x) ◃∙
ap [_]₂ (! (merid embase)) ◃∎ ∎ₛ
where
open EM₁HSpaceAssoc G using (η; H-⊙EM₁; H-⊙EM₁-assoc; H-EM₁-assoc-coh-unit-l-r-pentagon)
open import homotopy.Pi2HSuspCompose H-⊙EM₁ H-⊙EM₁-assoc H-EM₁-assoc-coh-unit-l-r-pentagon
using (comp)
cancels-inverse : ∀ {i} {A : Type i} {x y : A}
(p : x == y) (q : y == x) → p ∙ q == idp → ! p == q
cancels-inverse p@idp q@.idp idp = idp
⊙EM-neg-2=⊙Trunc-fmap-⊙Susp-flip : ⊙EM-neg 2 == ⊙Trunc-fmap (⊙Susp-flip (⊙EM₁ G.grp))
⊙EM-neg-2=⊙Trunc-fmap-⊙Susp-flip =
⊙λ=' {X = ⊙EM G 2} {Y = ⊙EM G 2} EM-neg-2=Trunc-fmap-Susp-flip $
↓-idf=cst-in $
=ₛ-out $ !ₛ $
ap [_]₂ (merid embase) ◃∙
ap [_]₂ (! (merid embase)) ◃∎
=ₛ⟨ ap-seq-=ₛ [_]₂ (seq-!-inv-r (merid (embase' G.grp) ◃∎)) ⟩
[] ∎ₛ
⊙to-alt-EM : ∀ n → ⊙EM G (S (S n)) ⊙≃ ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ n (⊙EM G 2))
⊙to-alt-EM n =
(⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ⊙⁻¹ ⊙∘e
⊙coe-equiv (ap (⊙Trunc (⟨ n ⟩₋₂ +2+ 2)) (! (⊙Susp^-+ n 1))) ⊙∘e
⊙coe-equiv (ap (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n)) ⊙∘e
⊙coe-equiv (ap (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂))
⊙–>-⊙to-alt-EM : ∀ n →
⊙–> (⊙to-alt-EM n) ◃⊙idf
=⊙∘
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙idf
⊙–>-⊙to-alt-EM n =
⊙–> (⊙to-alt-EM n) ◃⊙idf
=⊙∘⟨ =⊙∘-in idp ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙coe (ap (⊙Trunc (⟨ n ⟩₋₂ +2+ 2)) (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙coe (ap (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n)) ◃⊙∘
⊙coe (ap (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂)) ◃⊙idf
=⊙∘₁⟨ 1 & 1 & ! (⊙transport-⊙coe (⊙Trunc (⟨ n ⟩₋₂ +2+ 2)) (! (⊙Susp^-+ n 1))) ∙
⊙transport-⊙Trunc (! (⊙Susp^-+ n 1)) ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙coe (ap (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n)) ◃⊙∘
⊙coe (ap (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂)) ◃⊙idf
=⊙∘₁⟨ 2 & 1 & ! $ ⊙transport-⊙coe (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ◃⊙∘
⊙coe (ap (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂)) ◃⊙idf
=⊙∘₁⟨ 3 & 1 & ! $ ⊙transport-⊙coe (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙idf ∎⊙∘
⊙EM-neg=⊙Trunc-fmap-⊙Susp-flip : ∀ (n : ℕ)
→ ⊙EM-neg (S (S n)) == ⊙Trunc-fmap (⊙Susp-flip (⊙Susp^ n (⊙EM₁ G.grp)))
⊙EM-neg=⊙Trunc-fmap-⊙Susp-flip n =
equiv-is-inj
(post⊙∘-is-equiv (⊙to-alt-EM n))
(⊙EM-neg (S (S n)))
(⊙Trunc-fmap (⊙Susp-flip (⊙Susp^ n (⊙EM₁ G.grp)))) $
=⊙∘-out {fs = ⊙–> (⊙to-alt-EM n) ◃⊙∘ ⊙EM-neg (S (S n)) ◃⊙idf}
{gs = ⊙–> (⊙to-alt-EM n) ◃⊙∘ ⊙Trunc-fmap (⊙Susp-flip (⊙Susp^ n (⊙EM₁ G.grp))) ◃⊙idf} $
⊙–> (⊙to-alt-EM n) ◃⊙∘
⊙EM-neg (S (S n)) ◃⊙idf
=⊙∘⟨ 0 & 1 & ⊙–>-⊙to-alt-EM n ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙∘
⊙EM-neg (S (S n)) ◃⊙idf
=⊙∘⟨ 3 & 2 & !⊙∘ $ ⊙transport-natural-=⊙∘
(+2+-comm 2 ⟨ n ⟩₋₂)
(λ k → ⊙Trunc-fmap {n = k} (⊙Susp^-fmap (S n) ⊙EM₁-neg)) ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ◃⊙∘
⊙Trunc-fmap (⊙Susp^-fmap (S n) ⊙EM₁-neg) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙idf
=⊙∘⟨ 2 & 2 & !⊙∘ $ ⊙transport-natural-=⊙∘
(+-comm 1 n)
(λ l → ⊙Trunc-fmap (⊙Susp^-fmap l ⊙EM₁-neg)) ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙Trunc-fmap (⊙Susp^-fmap (n + 1) ⊙EM₁-neg) ◃⊙∘
⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙idf
=⊙∘⟨ 1 & 2 & ⊙Trunc-fmap-seq-=⊙∘ $
=⊙∘-in {fs = ⊙coe (! (⊙Susp^-+ n 1)) ◃⊙∘ ⊙Susp^-fmap (n + 1) ⊙EM₁-neg ◃⊙idf}
{gs = ⊙Susp^-fmap n (⊙Susp-fmap EM₁-neg) ◃⊙∘ ⊙coe (! (⊙Susp^-+ n 1)) ◃⊙idf} $
! $ ⊙Susp^-+-natural' n 1 ⊙EM₁-neg ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap (⊙Susp^-fmap n (⊙Susp-fmap EM₁-neg)) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙idf
=⊙∘⟨ 0 & 2 & ⊙Susp^-⊙Trunc-equiv-natural' (⊙Susp-fmap EM₁-neg) 2 n ⟩
⊙Trunc-fmap (⊙Susp^-fmap n (⊙EM-neg 2)) ◃⊙∘
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙idf
=⊙∘₁⟨ 0 & 1 & ap (⊙Trunc-fmap ∘ ⊙Susp^-fmap n) $
⊙EM-neg-2=⊙Trunc-fmap-⊙Susp-flip ⟩
⊙Trunc-fmap (⊙Susp^-fmap n (⊙Trunc-fmap (⊙Susp-flip (⊙EM₁ G.grp)))) ◃⊙∘
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙idf
=⊙∘⟨ 0 & 2 & !⊙∘ $ ⊙Susp^-⊙Trunc-equiv-natural' (⊙Susp-flip _) 2 n ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap (⊙Susp^-fmap n (⊙Susp-flip (⊙EM₁ G.grp))) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙idf
=⊙∘₁⟨ 3 & 1 & p ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap (⊙Susp^-fmap n (⊙Susp-flip (⊙EM₁ G.grp))) ◃⊙∘
⊙Trunc-fmap {n = ⟨ n ⟩₋₂ +2+ 2} (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙Trunc-fmap (⊙coe (ap (λ l → ⊙Susp^ l (⊙EM₁ G.grp)) (+-comm 1 n))) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙idf
=⊙∘⟨ 1 & 3 & ⊙Trunc-fmap-seq-=⊙∘ $
⊙Susp^-fmap n (⊙Susp-flip (⊙EM₁ G.grp)) ◃⊙∘
⊙coe (! (⊙Susp^-+ n 1)) ◃⊙∘
⊙coe (ap (λ l → ⊙Susp^ l (⊙EM₁ G.grp)) (+-comm 1 n)) ◃⊙idf
=⊙∘⟨ 3 & 0 & ⊙contract ⟩
⊙Susp^-fmap n (⊙Susp-flip (⊙EM₁ G.grp)) ◃⊙∘
⊙coe (! (⊙Susp^-+ n 1)) ◃⊙∘
⊙coe (ap (λ l → ⊙Susp^ l (⊙EM₁ G.grp)) (+-comm 1 n)) ◃⊙∘
⊙coe (⊙Susp^-+ 1 n {⊙EM₁ G.grp}) ◃⊙idf
=⊙∘⟨ 1 & 3 & !⊙∘ $ ⊙coe-seq-∙ (⊙Susp^-comm-seq 1 n) ⟩
⊙Susp^-fmap n (⊙Susp-flip (⊙EM₁ G.grp)) ◃⊙∘
⊙coe (⊙Susp^-comm 1 n) ◃⊙idf
=⊙∘⟨ ⊙Susp^-comm-flip 0 n (⊙EM₁ G.grp) ⟩
⊙coe (⊙Susp^-comm 1 n) ◃⊙∘
⊙Susp-flip (⊙Susp^ 0 (⊙Susp^ n (⊙EM₁ G.grp))) ◃⊙idf
=⊙∘⟨ 0 & 1 & ⊙coe-seq-∙ (⊙Susp^-comm-seq 1 n) ⟩
⊙coe (! (⊙Susp^-+ n 1)) ◃⊙∘
⊙coe (ap (λ l → ⊙Susp^ l (⊙EM₁ G.grp)) (+-comm 1 n)) ◃⊙∘
⊙coe (⊙Susp^-+ 1 n {⊙EM₁ G.grp}) ◃⊙∘
⊙Susp-flip (⊙Susp^ 0 (⊙Susp^ n (⊙EM₁ G.grp))) ◃⊙idf
=⊙∘⟨ 2 & 1 & ⊙expand ⊙idf-seq ⟩
⊙coe (! (⊙Susp^-+ n 1)) ◃⊙∘
⊙coe (ap (λ l → ⊙Susp^ l (⊙EM₁ G.grp)) (+-comm 1 n)) ◃⊙∘
⊙Susp-flip (⊙Susp^ 0 (⊙Susp^ n (⊙EM₁ G.grp))) ◃⊙idf ∎⊙∘ ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙Trunc-fmap (⊙coe (ap (λ l → ⊙Susp^ l (⊙EM₁ G.grp)) (+-comm 1 n))) ◃⊙∘
⊙Trunc-fmap (⊙Susp-flip (⊙Susp^ n (⊙EM₁ G.grp))) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙idf
=⊙∘⟨ 3 & 2 & ⊙transport-natural-=⊙∘
(+2+-comm 2 ⟨ n ⟩₋₂)
(λ k → ⊙Trunc-fmap {n = k} (⊙Susp-flip (⊙Susp^ n (⊙EM₁ G.grp)))) ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙Trunc-fmap (⊙coe (ap (λ l → ⊙Susp^ l (⊙EM₁ G.grp)) (+-comm 1 n))) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙∘
⊙Trunc-fmap (⊙Susp-flip (⊙Susp^ n (⊙EM₁ G.grp))) ◃⊙idf
=⊙∘₁⟨ 2 & 1 & ! p ⟩
⊙<– (⊙Susp^-⊙Trunc-equiv (⊙Susp (EM₁ G.grp)) 2 n) ◃⊙∘
⊙Trunc-fmap (⊙coe (! (⊙Susp^-+ n 1))) ◃⊙∘
⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ◃⊙∘
⊙transport (λ k → ⊙Trunc k (⊙Susp^ (S n) (⊙EM₁ G.grp))) (+2+-comm 2 ⟨ n ⟩₋₂) ◃⊙∘
⊙Trunc-fmap (⊙Susp-flip (⊙Susp^ n (⊙EM₁ G.grp))) ◃⊙idf
=⊙∘⟨ 0 & 4 & !⊙∘ $ ⊙–>-⊙to-alt-EM n ⟩
⊙–> (⊙to-alt-EM n) ◃⊙∘
⊙Trunc-fmap (⊙Susp-flip (⊙Susp^ n (⊙EM₁ G.grp))) ◃⊙idf ∎⊙∘
where
p : ⊙transport (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ==
⊙Trunc-fmap (⊙coe (ap (λ l → ⊙Susp^ l (⊙EM₁ G.grp)) (+-comm 1 n)))
p =
⊙transport-⊙coe (λ l → ⊙Trunc (⟨ n ⟩₋₂ +2+ 2) (⊙Susp^ l (⊙EM₁ G.grp))) (+-comm 1 n) ∙
ap ⊙coe (ap-∘ (⊙Trunc (⟨ n ⟩₋₂ +2+ 2)) (λ l → ⊙Susp^ l (⊙EM₁ G.grp)) (+-comm 1 n)) ∙
! (⊙transport-⊙coe (⊙Trunc (⟨ n ⟩₋₂ +2+ 2)) (ap (λ l → ⊙Susp^ l (⊙EM₁ G.grp)) (+-comm 1 n))) ∙
⊙transport-⊙Trunc (ap (λ l → ⊙Susp^ l (⊙EM₁ G.grp)) (+-comm 1 n))
module _ {i} (G : AbGroup i) where
private
module G = AbGroup G
⊙EM-fmap-idhom : ∀ (n : ℕ)
→ ⊙EM-fmap G G (idhom G.grp) n == ⊙idf (⊙EM G n)
⊙EM-fmap-idhom O =
⊙Ω-fmap (⊙EM₁-fmap (idhom G.grp))
=⟨ ap ⊙Ω-fmap (⊙λ= (⊙EM₁-fmap-idhom G.grp)) ⟩
⊙Ω-fmap (⊙idf (⊙EM₁ G.grp))
=⟨ ⊙Ω-fmap-idf ⟩
⊙idf _ =∎
⊙EM-fmap-idhom (S n) =
⊙Trunc-fmap (⊙Susp^-fmap n (⊙EM₁-fmap (idhom G.grp)))
=⟨ ap (⊙Trunc-fmap ∘ ⊙Susp^-fmap n) (⊙λ= (⊙EM₁-fmap-idhom G.grp)) ⟩
⊙Trunc-fmap (⊙Susp^-fmap n (⊙idf (⊙EM₁ G.grp)))
=⟨ ap ⊙Trunc-fmap (=⊙∘-out (⊙Susp^-fmap-idf n (⊙EM₁ G.grp))) ⟩
⊙Trunc-fmap (⊙idf (⊙Susp^ n (⊙EM₁ G.grp)))
=⟨ ⊙λ= ⊙Trunc-fmap-⊙idf ⟩
⊙idf _ =∎
EM-fmap-idhom : ∀ (n : ℕ)
→ EM-fmap G G (idhom G.grp) n == idf (EM G n)
EM-fmap-idhom n = ap fst (⊙EM-fmap-idhom n)
module _ {i} {j} (G : AbGroup i) (H : AbGroup j) where
⊙EM-fmap-cst-hom : ∀ (n : ℕ)
→ ⊙EM-fmap G H cst-hom n == ⊙cst
⊙EM-fmap-cst-hom O =
⊙Ω-fmap (⊙EM₁-fmap cst-hom)
=⟨ ap ⊙Ω-fmap (⊙λ= (⊙EM₁-fmap-cst-hom (AbGroup.grp G) (AbGroup.grp H))) ⟩
⊙Ω-fmap ⊙cst
=⟨ ⊙Ω-fmap-cst ⟩
⊙cst =∎
⊙EM-fmap-cst-hom (S n) =
⊙Trunc-fmap (⊙Susp^-fmap n (⊙EM₁-fmap cst-hom))
=⟨ ap (⊙Trunc-fmap ∘ ⊙Susp^-fmap n) (⊙λ= (⊙EM₁-fmap-cst-hom (AbGroup.grp G) (AbGroup.grp H))) ⟩
⊙Trunc-fmap (⊙Susp^-fmap n ⊙cst)
=⟨ ap ⊙Trunc-fmap (⊙Susp^-fmap-cst n) ⟩
⊙Trunc-fmap ⊙cst
=⟨ ⊙λ= ⊙Trunc-fmap-cst ⟩
⊙cst =∎
EM-fmap-cst-hom : ∀ (n : ℕ)
→ EM-fmap G H cst-hom n == cst (pt (⊙EM H n))
EM-fmap-cst-hom n = ap fst (⊙EM-fmap-cst-hom n)
transport-EM : ∀ {i} {G H : AbGroup i}
(p : G == H) (n : ℕ)
→ transport (λ K → EM K n) p == EM-fmap G H (coeᴬᴳ p) n
transport-EM {G = G} idp n = ! $
EM-fmap G G (coeᴳ idp) n
=⟨ ap (λ φ → EM-fmap G G φ n) (coeᴳ-idp (AbGroup.grp G)) ⟩
EM-fmap G G (idhom (AbGroup.grp G)) n
=⟨ EM-fmap-idhom G n ⟩
idf (EM G n) =∎
transport-EM-uaᴬᴳ : ∀ {i} (G H : AbGroup i)
(iso : G ≃ᴬᴳ H) (n : ℕ)
→ transport (λ K → EM K n) (uaᴬᴳ G H iso) == EM-fmap G H (–>ᴳ iso) n
transport-EM-uaᴬᴳ G H iso n =
transport (λ K → EM K n) (uaᴬᴳ G H iso)
=⟨ transport-EM (uaᴬᴳ G H iso) n ⟩
EM-fmap G H (coeᴬᴳ (uaᴬᴳ G H iso)) n
=⟨ ap (λ p → EM-fmap G H p n) (coeᴬᴳ-β G H iso) ⟩
EM-fmap G H (–>ᴳ iso) n =∎
⊙transport-⊙EM : ∀ {i} {G H : AbGroup i}
(p : G == H) (n : ℕ)
→ ⊙transport (λ K → ⊙EM K n) p == ⊙EM-fmap G H (coeᴬᴳ p) n
⊙transport-⊙EM {G = G} p@idp n = ! $
⊙EM-fmap G G (coeᴳ idp) n
=⟨ ap (λ φ → ⊙EM-fmap G G φ n) (coeᴳ-idp (AbGroup.grp G)) ⟩
⊙EM-fmap G G (idhom (AbGroup.grp G)) n
=⟨ ⊙EM-fmap-idhom G n ⟩
⊙idf (⊙EM G n) =∎
⊙transport-⊙EM-uaᴬᴳ : ∀ {i} (G H : AbGroup i)
(iso : G ≃ᴬᴳ H) (n : ℕ)
→ ⊙transport (λ K → ⊙EM K n) (uaᴬᴳ G H iso) == ⊙EM-fmap G H (–>ᴳ iso) n
⊙transport-⊙EM-uaᴬᴳ G H iso n =
⊙transport (λ K → ⊙EM K n) (uaᴬᴳ G H iso)
=⟨ ⊙transport-⊙EM (uaᴬᴳ G H iso) n ⟩
⊙EM-fmap G H (coeᴬᴳ (uaᴬᴳ G H iso)) n
=⟨ ap (λ p → ⊙EM-fmap G H p n) (coeᴬᴳ-β G H iso) ⟩
⊙EM-fmap G H (–>ᴳ iso) n =∎
|
firmware/data.asm | ddomurad/avrVideoCard | 0 | 169496 | <gh_stars>0
.include "./glyphs/glyphs1.asm"
; .include "./glyphs/der_rouge.asm"
; .include "./glyphs/glyphs2.asm"
; .include "./glyphs/glyphs3.asm"
; .include "./glyphs/glyphs4.asm"
; .include "./glyphs/glyphs5.asm"
; .include "./glyphs/glyphs6.asm"
; .include "./glyphs/glyphs7a.asm"
; .include "./glyphs/glyphs7b.asm"
; .include "./glyphs/glyphs8.asm"
; .include "./glyphs/glyphs9.asm"
; .include "./glyphs/glyphs10.asm"
.dseg
glyphs_ptr: .byte 58*62
inv_ptr: .byte 58*8
glyphs_set_ptr: .byte 1
displ_color_ptr: .byte 1
ext_cmd_params_ptr: .byte 5 |
programs/oeis/053/A053735.asm | karttu/loda | 0 | 82735 | <reponame>karttu/loda<filename>programs/oeis/053/A053735.asm
; A053735: Sum of digits of (n written in base 3).
; 0,1,2,1,2,3,2,3,4,1,2,3,2,3,4,3,4,5,2,3,4,3,4,5,4,5,6,1,2,3,2,3,4,3,4,5,2,3,4,3,4,5,4,5,6,3,4,5,4,5,6,5,6,7,2,3,4,3,4,5,4,5,6,3,4,5,4,5,6,5,6,7,4,5,6,5,6,7,6,7,8,1,2,3,2,3,4,3,4,5,2,3,4,3,4,5,4,5,6,3,4,5,4,5,6,5,6,7,2,3,4,3,4,5,4,5,6,3,4,5,4,5,6,5,6,7,4,5,6,5,6,7,6,7,8,3,4,5,4,5,6,5,6,7,4,5,6,5,6,7,6,7,8,5,6,7,6,7,8,7,8,9,2,3,4,3,4,5,4,5,6,3,4,5,4,5,6,5,6,7,4,5,6,5,6,7,6,7,8,3,4,5,4,5,6,5,6,7,4,5,6,5,6,7,6,7,8,5,6,7,6,7,8,7,8,9,4,5,6,5,6,7,6,7,8,5,6,7,6,7,8,7,8,9,6,7,8,7,8,9,8,9,10,1,2,3,2,3,4,3
mov $1,7
mov $2,$0
mov $3,$0
mov $4,6
mov $5,3
lpb $2,1
sub $1,3
add $1,$3
lpb $1,1
div $3,$5
sub $1,$3
sub $1,$3
lpe
add $1,3
mov $2,6
sub $2,$4
lpe
sub $1,7
|
code/selection_sort.asm | Masrt200/asm-disasm | 0 | 169931 | ; Selection sort in Assembly
; <NAME>
; 25-05-21
; OP program success
SECTION .data
SYS_EXIT equ 60
EXIT_SUCCESS equ 0
;list1 dw 55,11,20,36,84,7,40
;len1 dw 7
list2 dw 26, 23, 50, 85, 45, 90, 65, 18, 87, 92, 34, 97, 65, 91, 33,2
len2 dw 16
avg dw 0
min dw 0
max dw 0
med dw 0
sum dw 0
;list3 dw 15, 80, 72, 52, 49, 15, 29, 7, 72
;len3 dw 9
SECTION .text
global _start
global sort
sort:
push rbp ; pushing rbp to stack
mov rbp,rsp ; using rbp as a reference
sub rsp,4 ; make space for local variables
push r12 ; prologue
; we can start accessing value from rbp+16 if they are on the stack
;and rdp minus how much we sub rsp if we made space for local variables
mov byte [rbp-0x4],0 ; count i ;; byte takes on address size
mov byte [rbp-0x3],0 ; count j
mov r12,0 ; i for looping
loop1:
mov r10w ,word [rdi+2*r12] ; small
mov byte [rbp-0x4],r12b ; r11=index
mov r9,r12 ; r9=j
loop2:
cmp word [rdi+2*r9],r10w
jge else
mov r10w, word [rdi+2*r9]
mov byte [rbp-0x4],r9b
else:
inc r9
cmp r9,rsi
jl loop2
mov r8w, word [rdi+2*r12]
mov r11b, byte [rbp-0x4]
mov word [rdi+2*r11], r8w
mov word [rdi+2*r12], r10w
inc r12
cmp r12,rsi
jl loop1
pop r12
mov rsp,rbp ; clear locals
pop rbp
ret
global stat
stat: ; (list,len,min,max,sum,avg,median)
push rbp
mov rbp,rsp
push r12
;median is at rbp+16
;minimum
mov r12w, word [rdi]
mov word [rdx], r12w
;maximum
dec rsi
mov r12w, word [rdi+2*rsi]
mov word [rcx],r12w
inc rsi
;; SUM
mov eax,0
mov r12,0
sum_loo:
add ax,word [rdi+2*r12]
inc r12
cmp r12,rsi
jl sum_loo
mov word [r8],ax
cwd
;; average
idiv si
mov word [r9],ax
;;median
mov rdx,0
mov rax,rsi
mov r12,2
div r12
cmp rdx,0
jne odd
mov r12w, word [rdi+2*rax]
dec rax
add r12w, word [rdi+2*rax]
mov rdx,0
mov rax,r12
mov r12,2
div r12
mov r11, qword [rbp+16]
mov word [r11],ax
jmp done
odd:
mov r12w, word [rdi+2*rax]
mov r11, qword [rbp+16]
mov word [r11], r12w
done:
pop r12
pop rbp
ret
_start:
mov rdi,list2
mov si, word[len2]
call sort
mov rdx,min
mov rcx,max
mov r8,sum
mov r9,avg
push med
call stat
last:
mov rax, SYS_EXIT
mov rdi, EXIT_SUCCESS
syscall |
initcode.asm | dylsugar/cs461_hw6 | 0 | 8892 |
initcode.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <start>:
#include "traps.h"
# exec(init, argv)
.global start
start:
mov $init, %rdi
0: 48 c7 c7 00 00 00 00 mov $0x0,%rdi
mov $argv, %rsi
7: 48 c7 c6 00 00 00 00 mov $0x0,%rsi
mov $SYS_exec, %rax
e: 48 c7 c0 07 00 00 00 mov $0x7,%rax
syscall
15: 0f 05 syscall
0000000000000017 <exit>:
# for(;;) exit();
exit:
mov $SYS_exit, %rax
17: 48 c7 c0 02 00 00 00 mov $0x2,%rax
syscall
1e: 0f 05 syscall
jmp exit
20: eb f5 jmp 17 <exit>
0000000000000022 <init>:
22: 2f (bad)
23: 69 6e 69 74 00 00 0f imul $0xf000074,0x69(%rsi),%ebp
2a: 1f (bad)
...
000000000000002c <argv>:
...
|
colombian_direction_grammar.g4 | jeanpah/colombian_address_autocomplete | 0 | 2137 | <filename>colombian_direction_grammar.g4
grammar colombian_direction_grammar;
addess : STARTS S2 CONST BIS? S2 NUMBERSYMBOL S2 CONST BIS? S2 DASHSYMBOL S2 CONST (S2 extra)?;
extra:
ENDERS |
ENDERS S2 complement (S2 complement)* |
complement (S2 complement)*;
complement : UNITY S2 WORD;
CONST:[0-9]+[a-z]?;
BIS: 'BIS';
WORD : '"' .+? '"';
UNITY:'Administraci\u00F3n' |
'Aeropuerto' |
'Agrupaci\u00F3n' |
'Altillo' |
'Apartamento' |
'Barrio' |
'Bloque' |
'Bodega' |
'Bulevar' |
'Casa' |
'C\u00E9lula' |
'Centro Comercial' |
'Circular' |
'Circunvalar' |
'Ciudadela' |
'Conjunto Residencial' |
'Consultorio' |
'Cuentas Corridas' |
'Deposito' |
'Deposito S\u00F3tano' |
'Edificio' |
'Entrada' |
'Esquina' |
'Etapa' |
'Estaci\u00F3n' |
'Exterior' |
'Finca' |
'Garaje' |
'Garaje S\u00F3tano' |
'Interior' |
'Kil\u00F3metro' |
'Local' |
'Local Mezzanine' |
'Lote' |
'Manzana' |
'Mezzanine' |
'M\u00F3dulo' |
'Oficina' |
'Parque' |
'Parqueadero' |
'Pasaje' |
'Paseo' |
'Peatonal' |
'Pent-House' |
'Piso' |
'Planta' |
'Predio' |
'Porter00EDa' |
'Puesto' |
'Round Point' |
'Semis\u00F3tano' |
'S\u00F3tano' |
'Sector' |
'Suite' |
'Supermanzana' |
'Terraza' |
'Torre' |
'Troncal' |
'Unidad' |
'Unidad Residencial' |
'Urbanizaci\u00F3n' |
'Variante' |
'V\u00EDa' |
'Zona';
ENDERS:
'Este' |
'Norte' |
'Oeste' |
'Sur';
STARTS :
'Avenida Calle' |
'Avenida Carrera' |
'Calle' |
'Carrera' |
'Carretera' |
'Diagonal' |
'Transversal';
INCOMPLETESTARTS:
'Autopista' |
'Avenida';
S2: S+;
S : ' ';
NUMBERSYMBOL : '#';
DASHSYMBOL : '-';
WS : [\t\r\n]+ -> skip ; // skip spaces, tabs, newlines |
examples/ada/successeur/launch.adb | rewriting/tom | 36 | 17828 | with Ada.Text_IO; use Ada.Text_IO;
with Successeur; use Successeur;
procedure launch is
begin
Put_Line ("2+3 =" & Integer'Image(plus(2, 3)));
end Launch;
|
src/unison/test/problematic/Mips/speed/gcc.insn-output.output_51.asm | Patstrom/disUnison | 88 | 17272 | <reponame>Patstrom/disUnison
.text
.abicalls
.section .mdebug.abi32,"",@progbits
.nan legacy
.file "gcc.insn-output.output_51.ll"
.text
.hidden output_51
.globl output_51
.align 2
.type output_51,@function
.set nomicromips
.set nomips16
.ent output_51
output_51: # @output_51
.frame $sp,32,$ra
.mask 0x80030000,-4
.fmask 0x00000000,0
.set noreorder
.set nomacro
.set noat
# BB#0:
lui $2, %hi(_gp_disp)
addiu $2, $2, %lo(_gp_disp)
addiu $sp, $sp, -32
sw $ra, 28($sp) # 4-byte Folded Spill
sw $17, 24($sp) # 4-byte Folded Spill
sw $16, 20($sp) # 4-byte Folded Spill
addu $16, $2, $25
move $17, $5
lw $25, %call16(get_attr_type)($16)
move $4, $17
jalr $25
move $gp, $16
addiu $1, $zero, 8
bne $2, $1, $BB0_2
nop
# BB#1:
lw $2, %got(.str.2014)($16)
b $BB0_3
nop
$BB0_2:
lw $25, %call16(get_attr_mode)($16)
move $4, $17
jalr $25
move $gp, $16
xori $1, $2, 4
addiu $2, $16, %got(.str.75)
addiu $3, $16, %got(.str.2015)
movz $2, $3, $1
lw $2, 0($2)
$BB0_3:
lw $16, 20($sp) # 4-byte Folded Reload
lw $17, 24($sp) # 4-byte Folded Reload
lw $ra, 28($sp) # 4-byte Folded Reload
jr $ra
addiu $sp, $sp, 32
.set at
.set macro
.set reorder
.end output_51
$func_end0:
.size output_51, ($func_end0)-output_51
.hidden .str.75
.hidden .str.2014
.hidden .str.2015
.ident "clang version 3.8.0 (http://llvm.org/git/clang.git 2d49f0a0ae8366964a93e3b7b26e29679bee7160) (http://llvm.org/git/llvm.git 60bc66b44837125843b58ed3e0fd2e6bb948d839)"
.section ".note.GNU-stack","",@progbits
.text
|
src/test/ref/examples/c64/multiplexer/simple-multiplexer.asm | jbrandwood/kickc | 2 | 13802 | <filename>src/test/ref/examples/c64/multiplexer/simple-multiplexer.asm
// A simple usage of the flexible sprite multiplexer routine
/// @file
/// Commodore 64 Registers and Constants
/// @file
/// The MOS 6526 Complex Interface Adapter (CIA)
///
/// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Commodore 64 PRG executable file
.file [name="simple-multiplexer.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
/// $D011 Control Register #1 Bit#7: RST8 9th Bit for $D012 Rasterline counter
.const VICII_RST8 = $80
/// $D011 Control Register #1 Bit#4: DEN Switch VIC-II output on/off
.const VICII_DEN = $10
/// $D011 Control Register #1 Bit#3: RSEL Switch betweem 25 or 24 visible rows
/// RSEL| Display window height | First line | Last line
/// ----+--------------------------+-------------+----------
/// 0 | 24 text lines/192 pixels | 55 ($37) | 246 ($f6)
/// 1 | 25 text lines/200 pixels | 51 ($33) | 250 ($fa)
.const VICII_RSEL = 8
/// The colors of the C64
.const BLACK = 0
.const GREEN = 5
// The number of sprites in the multiplexer
.const PLEX_COUNT = $20
.const OFFSET_STRUCT_MOS6569_VICII_SPRITES_ENABLE = $15
.const OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
.const OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = $20
/// Sprite X position register for sprite #0
.label SPRITES_XPOS = $d000
/// Sprite Y position register for sprite #0
.label SPRITES_YPOS = $d001
/// Sprite X position MSB register
.label SPRITES_XMSB = $d010
/// Sprite colors register for sprite #0
.label SPRITES_COLOR = $d027
/// $D011 Control Register #1
/// @see #VICII_CONTROL1
.label D011 = $d011
/// The VIC-II MOS 6567/6569
.label VICII = $d000
// Location of screen & sprites
.label SCREEN = $400
// The address of the sprite pointers on the current screen (screen+0x3f8).
.label PLEX_SCREEN_PTR = $c
// The index in the PLEX tables of the next sprite to show
.label plex_show_idx = 7
// The index the next sprite to use for showing (sprites are used round-robin)
.label plex_sprite_idx = 8
// The MSB bit of the next sprite to use for showing
.label plex_sprite_msb = 6
// The index of the sprite that is free next. Since sprites are used round-robin this moves forward each time a sprite is shown.
.label plex_free_next = 9
.segment Code
__start: {
// char* volatile PLEX_SCREEN_PTR = (char*)0x400+0x3f8
lda #<$400+$3f8
sta.z PLEX_SCREEN_PTR
lda #>$400+$3f8
sta.z PLEX_SCREEN_PTR+1
// volatile char plex_show_idx=0
lda #0
sta.z plex_show_idx
// volatile char plex_sprite_idx=0
sta.z plex_sprite_idx
// volatile char plex_sprite_msb=1
lda #1
sta.z plex_sprite_msb
// volatile char plex_free_next = 0
lda #0
sta.z plex_free_next
jsr main
rts
}
main: {
// asm
sei
// init()
jsr init
// loop()
jsr loop
// }
rts
}
// Initialize the program
init: {
// Set the x-positions & pointers
.label xp = $a
// *D011 = VICII_DEN | VICII_RSEL | 3
lda #VICII_DEN|VICII_RSEL|3
sta D011
// plexInit(SCREEN)
// Initialize the multiplexer
jsr plexInit
lda #<$20
sta.z xp
lda #>$20
sta.z xp+1
ldx #0
__b1:
// PLEX_PTR[sx] = (char)(SPRITE/$40)
lda #$ff&SPRITE/$40
sta PLEX_PTR,x
// PLEX_XPOS[sx] = xp
txa
asl
tay
lda.z xp
sta PLEX_XPOS,y
lda.z xp+1
sta PLEX_XPOS+1,y
// xp += 9
lda #9
clc
adc.z xp
sta.z xp
bcc !+
inc.z xp+1
!:
// for(char sx: 0..PLEX_COUNT-1)
inx
cpx #PLEX_COUNT-1+1
bne __b1
// VICII->SPRITES_ENABLE = $ff
// Enable & initialize sprites
lda #$ff
sta VICII+OFFSET_STRUCT_MOS6569_VICII_SPRITES_ENABLE
ldx #0
__b3:
// SPRITES_COLOR[ss] = GREEN
lda #GREEN
sta SPRITES_COLOR,x
// for(char ss: 0..7)
inx
cpx #8
bne __b3
// }
rts
}
// The raster loop
loop: {
// The current index into the y-sine
.label sin_idx = $e
.label ss = 5
lda #0
sta.z sin_idx
__b2:
// while(VICII->RASTER!=$ff)
lda #$ff
cmp VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
bne __b2
// (VICII->BORDER_COLOR)++;
inc VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
ldx.z sin_idx
ldy #0
__b4:
// PLEX_YPOS[sy] = YSIN[y_idx]
lda YSIN,x
sta PLEX_YPOS,y
// y_idx += 8
txa
axs #-[8]
// for(char sy: 0..PLEX_COUNT-1)
iny
cpy #PLEX_COUNT-1+1
bne __b4
// sin_idx +=1
inc.z sin_idx
// (VICII->BORDER_COLOR)++;
inc VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
// plexSort()
jsr plexSort
// VICII->BORDER_COLOR = BLACK
lda #BLACK
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
__b6:
// *D011&VICII_RST8
lda #VICII_RST8
and D011
// while((*D011&VICII_RST8)!=0)
cmp #0
bne __b6
lda #0
sta.z ss
// Show the sprites
__b7:
// VICII->BORDER_COLOR = BLACK
lda #BLACK
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
// return PLEX_FREE_YPOS[plex_free_next];
ldy.z plex_free_next
lda PLEX_FREE_YPOS,y
__b8:
// while(VICII->RASTER<rasterY)
cmp VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
beq !+
bcs __b8
!:
// (VICII->BORDER_COLOR)++;
inc VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
// plexShowSprite()
jsr plexShowSprite
// for( char ss: 0..PLEX_COUNT-1)
inc.z ss
lda #PLEX_COUNT-1+1
cmp.z ss
bne __b7
// VICII->BORDER_COLOR = BLACK
lda #BLACK
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
jmp __b2
}
// Initialize the multiplexer data structures
// void plexInit(char *screen)
plexInit: {
// PLEX_SCREEN_PTR = screen+0x3f8
lda #<SCREEN+$3f8
sta.z PLEX_SCREEN_PTR
lda #>SCREEN+$3f8
sta.z PLEX_SCREEN_PTR+1
ldx #0
__b1:
// PLEX_SORTED_IDX[i] = i
txa
sta PLEX_SORTED_IDX,x
// for(char i: 0..PLEX_COUNT-1)
inx
cpx #PLEX_COUNT-1+1
bne __b1
// }
rts
}
// Ensure that the indices in PLEX_SORTED_IDX is sorted based on the y-positions in PLEX_YPOS
// Assumes that the positions are nearly sorted already (as each sprite just moves a bit)
// Uses an insertion sort:
// 1. Moves a marker (m) from the start to end of the array. Every time the marker moves forward all elements before the marker are sorted correctly.
// 2a. If the next element after the marker is larger that the current element
// the marker can be moved forwards (as the sorting is correct).
// 2b. If the next element after the marker is smaller than the current element:
// elements before the marker are shifted right one at a time until encountering one smaller than the current one.
// It is then inserted at the spot. Now the marker can move forward.
plexSort: {
.label nxt_idx = 4
.label nxt_y = 3
.label m = 2
lda #0
sta.z m
__b1:
// char nxt_idx = PLEX_SORTED_IDX[m+1]
ldy.z m
lda PLEX_SORTED_IDX+1,y
sta.z nxt_idx
// char nxt_y = PLEX_YPOS[nxt_idx]
tay
lda PLEX_YPOS,y
sta.z nxt_y
// if(nxt_y<PLEX_YPOS[PLEX_SORTED_IDX[m]])
ldx.z m
ldy PLEX_SORTED_IDX,x
cmp PLEX_YPOS,y
bcs __b2
__b3:
// PLEX_SORTED_IDX[s+1] = PLEX_SORTED_IDX[s]
lda PLEX_SORTED_IDX,x
sta PLEX_SORTED_IDX+1,x
// s--;
dex
// while((s!=0xff) && (nxt_y<PLEX_YPOS[PLEX_SORTED_IDX[s]]))
cpx #$ff
beq __b4
lda.z nxt_y
ldy PLEX_SORTED_IDX,x
cmp PLEX_YPOS,y
bcc __b3
__b4:
// s++;
inx
// PLEX_SORTED_IDX[s] = nxt_idx
lda.z nxt_idx
sta PLEX_SORTED_IDX,x
__b2:
// for(char m: 0..PLEX_COUNT-2)
inc.z m
lda #PLEX_COUNT-2+1
cmp.z m
bne __b1
// plex_show_idx = 0
// Prepare for showing the sprites
lda #0
sta.z plex_show_idx
// plex_sprite_idx = 0
sta.z plex_sprite_idx
// plex_sprite_msb = 1
lda #1
sta.z plex_sprite_msb
ldx #0
plexFreePrepare1___b1:
// PLEX_FREE_YPOS[s] = 0
lda #0
sta PLEX_FREE_YPOS,x
// for( char s: 0..7)
inx
cpx #8
bne plexFreePrepare1___b1
// plex_free_next = 0
sta.z plex_free_next
// }
rts
}
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
.label plex_sprite_idx2 = 2
// char plex_sprite_idx2 = plex_sprite_idx*2
lda.z plex_sprite_idx
asl
sta.z plex_sprite_idx2
// char ypos = PLEX_YPOS[PLEX_SORTED_IDX[plex_show_idx]]
ldx.z plex_show_idx
ldy PLEX_SORTED_IDX,x
lda PLEX_YPOS,y
// SPRITES_YPOS[plex_sprite_idx2] = ypos
ldy.z plex_sprite_idx2
sta SPRITES_YPOS,y
// ypos+22
clc
adc #$16
// PLEX_FREE_YPOS[plex_free_next] = ypos+22
ldy.z plex_free_next
sta PLEX_FREE_YPOS,y
// plex_free_next+1
ldx.z plex_free_next
inx
// (plex_free_next+1)&7
txa
and #7
// plex_free_next = (plex_free_next+1)&7
sta.z plex_free_next
// PLEX_SCREEN_PTR[plex_sprite_idx] = PLEX_PTR[PLEX_SORTED_IDX[plex_show_idx]]
ldx.z plex_show_idx
ldy PLEX_SORTED_IDX,x
lda PLEX_PTR,y
ldy.z plex_sprite_idx
sta (PLEX_SCREEN_PTR),y
// char xpos_idx = PLEX_SORTED_IDX[plex_show_idx]
ldy.z plex_show_idx
lda PLEX_SORTED_IDX,y
// SPRITES_XPOS[plex_sprite_idx2] = (char)PLEX_XPOS[xpos_idx]
asl
tax
ldy.z plex_sprite_idx2
lda PLEX_XPOS,x
sta SPRITES_XPOS,y
// BYTE1(PLEX_XPOS[xpos_idx])
lda PLEX_XPOS+1,x
// if(BYTE1(PLEX_XPOS[xpos_idx])!=0)
cmp #0
bne __b1
// 0xff^plex_sprite_msb
lda #$ff
eor.z plex_sprite_msb
// *SPRITES_XMSB &= (0xff^plex_sprite_msb)
and SPRITES_XMSB
sta SPRITES_XMSB
__b2:
// plex_sprite_idx+1
ldx.z plex_sprite_idx
inx
// (plex_sprite_idx+1)&7
txa
and #7
// plex_sprite_idx = (plex_sprite_idx+1)&7
sta.z plex_sprite_idx
// plex_show_idx++;
inc.z plex_show_idx
// plex_sprite_msb <<=1
asl.z plex_sprite_msb
// if(plex_sprite_msb==0)
lda.z plex_sprite_msb
bne __breturn
// plex_sprite_msb = 1
lda #1
sta.z plex_sprite_msb
__breturn:
// }
rts
__b1:
// *SPRITES_XMSB |= plex_sprite_msb
lda SPRITES_XMSB
ora.z plex_sprite_msb
sta SPRITES_XMSB
jmp __b2
}
.segment Data
// The x-positions of the multiplexer sprites (0x000-0x1ff)
PLEX_XPOS: .fill 2*PLEX_COUNT, 0
// The y-positions of the multiplexer sprites.
PLEX_YPOS: .fill PLEX_COUNT, 0
// The sprite pointers for the multiplexed sprites
PLEX_PTR: .fill PLEX_COUNT, 0
// Indexes of the plex-sprites sorted by sprite y-position. Each call to plexSort() will fix the sorting if changes to the Y-positions have ruined it.
PLEX_SORTED_IDX: .fill PLEX_COUNT, 0
// Contains the Y-position where each sprite is free again. PLEX_FREE_YPOS[s] holds the Y-position where sprite s is free to use again.
PLEX_FREE_YPOS: .fill 8, 0
.align $100
YSIN:
.var min = 50
.var max = 250-21
.var ampl = max-min;
.for(var i=0;i<256;i++)
.byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))
.pc = $2000 "SPRITE"
SPRITE:
.var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
.for (var y=0; y<21; y++)
.for (var x=0;x<3; x++)
.byte pic.getSinglecolorByte(x,y)
|
programs/oeis/315/A315034.asm | karttu/loda | 0 | 87028 | <gh_stars>0
; A315034: Coordination sequence Gal.6.323.2 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,5,9,15,19,25,29,35,39,45,49,54,59,63,69,73,79,83,89,93,99,103,108,113,117,123,127,133,137,143,147,153,157,162,167,171,177,181,187,191,197,201,207,211,216,221,225,231,235,241
mov $10,$0
mov $12,$0
add $12,1
lpb $12,1
mov $0,$10
sub $12,1
sub $0,$12
mov $6,$0
mov $8,2
lpb $8,1
clr $0,6
mov $0,$6
sub $8,1
add $0,$8
sub $0,1
mul $0,2
add $1,$0
mov $2,$1
cal $2,314194 ; Coordination sequence Gal.6.625.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
add $2,6
mov $1,$2
mov $9,$8
lpb $9,1
mov $7,$1
sub $9,1
lpe
lpe
lpb $6,1
mov $6,0
sub $7,$1
lpe
mov $1,$7
sub $1,6
add $11,$1
lpe
mov $1,$11
|
lib/scripts/check_state.itunes.applescript | swdotcom/music | 11 | 4369 | if application "iTunes" is running then
return true
else
return false
end if |
initramfs/src/init/main.asm | lodvaer/YHBT | 2 | 172161 | ;; /sbin/init
SYS_WRITE = 1
stdout = 1
use64
org 2000000h
start:
xchg bx, bx
mov rdi, stdout
mov rsi, txt
mov rdx, txt.length
mov rax, SYS_WRITE
syscall
.loop:
rep nop
jmp .loop
txt: db '"Hello, world!" from luserspace!', 10
txt.length = $ - txt
; vim: ts=8 sw=8 syn=fasm
|
oeis/214/A214283.asm | neoneye/loda-programs | 11 | 17906 | ; A214283: Smallest Euler characteristic of a downset on an n-dimensional cube.
; 0,-1,-2,-3,-4,-10,-20,-35,-56,-126,-252,-462,-792,-1716,-3432,-6435,-11440,-24310,-48620,-92378,-167960,-352716,-705432,-1352078,-2496144,-5200300,-10400600,-20058300,-37442160,-77558760,-155117520,-300540195,-565722720,-1166803110,-2333606220,-4537567650,-8597496600,-17672631900,-35345263800,-68923264410,-131282408400,-269128937220,-538257874440,-1052049481860,-2012616400080,-4116715363800,-8233430727600,-16123801841550,-30957699535776,-63205303218876,-126410606437752,-247959266474052
seq $0,6481 ; Euler characteristics of polytopes.
sub $1,$0
add $1,1
mov $0,$1
|
oeis/142/A142180.asm | neoneye/loda-programs | 11 | 167159 | ; A142180: Primes congruent to 35 mod 39.
; Submitted by <NAME>
; 113,191,269,347,503,659,971,1049,1283,1361,1439,1907,2063,2141,2297,2531,2609,2687,2843,2999,3389,3467,3623,3701,3779,4013,4091,4481,4637,4793,4871,5261,5417,5573,5651,5807,6197,6353,6899,6977,7211,7523,7757,8069,8147,8537,8693,8849,9161,9239,9473,9551,9629,9941,10253,10331,10487,10799,11423,11579,11657,11813,11969,12203,12281,12437,12671,12983,13217,13451,13763,13841,13997,14153,14387,14543,14621,14699,15401,15791,16103,16493,16649,16883,17117,17351,18131,18287,18443,18521,18911,19301,19379
mov $1,19
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $1,2
sub $2,2
mov $3,$1
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,41
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mul $1,2
mov $0,$1
sub $0,81
|
Scripts Pack Source Items/Scripts Pack/Finder/Show POSIX Path.applescript | Phorofor/ScriptsPack.macOS | 1 | 1612 | <gh_stars>1-10
# Scripts Pack - Tweak various preference variables in macOS
# <Phorofor, https://github.com/Phorofor/>
-- Will show path of folder on the title bar instead the name of the folder (POISX Path)
-- Show POSIX Path for Finder
-- Versions compatible: --
-- Preference Identifier: com.apple.finder
-- Preference Key: _FXShowPosixPathInTitle
-- Preference location: ~/Library/Preferences/com.apple.finder.plist
-- Default value (boolean): NO
set vC to "com.apple.finder _FXShowPosixPathInTitle"
set toggleBut to "Show"
set tZ to "show the full path "
set sTz to "TRUE"
set bT to "You've decided to show only the current folders name in the windows of the Finder title bars."
try
set prValue to do shell script "defaults read " & vC
if prValue = "1" then
set psValue to "The Finder will show the full POISX path in the title bar."
set toggleBut to "Hide"
set tZ to "not show the full path"
set sTz to "FALSE"
set bT to "You've decided to show the full path in Finder's title bar."
else
set psValue to "The Finder will only show the current folder name in its title bar."
end if
on error
set psValue to "The full path of folders are not shown by default."
end try
display alert "Would you like Finder to " & tZ & " of a folder in the title bar of windows instead of just the folder name?" message "Instead of showing the name of a folder in the Finder's title bar, it will show the full path so you can enter the path manually (e.g. the Macintosh HD will be display as ''/'' when the POISX Path is shown.)" & return & return & psValue buttons {"Cancel", "Clear", toggleBut} default button 3 cancel button 1
set the button_pressed to the button returned of the result
-- Don't show Finder path in title bar (default setting)
if the button_pressed is toggleBut then
do shell script "defaults write " & vC & " -bool " & sTz
else
-- Show Finder path in title bar
do shell script "defaults delete " & vC
end if
tell application "System Events" to (name of every process)
if the result contains "Finder" then
tell application "Finder"
display alert "Finder - Restart to see changes" message bT & " Your changes will take effect when you restart Finder. Would you like to do that now?" buttons ["Restart Later", "Restart Finder"] cancel button 1 default button 2
do shell script "killall Finder"
end tell
else
display alert "Finder - Changes Applied" message bT & ". The next time you open Finder you'll be able to see the changes."
end if |
src/EqBool.agda | mckeankylej/agda-ring-solver | 36 | 14372 | {-# OPTIONS --without-K --safe #-}
module EqBool where
open import Data.Bool
record HasEqBool {a} (A : Set a) : Set a where
field _==_ : A → A → Bool
open HasEqBool ⦃ ... ⦄ public
open import Data.List as List using (List; _∷_; [])
==[] : ∀ {a} {A : Set a} → ⦃ _ : HasEqBool A ⦄ → List A → List A → Bool
==[] [] [] = true
==[] [] (x ∷ ys) = false
==[] (x ∷ xs) [] = false
==[] (x ∷ xs) (y ∷ ys) = x == y ∧ ==[] xs ys
instance
eqList : ∀ {a} {A : Set a} → ⦃ _ : HasEqBool A ⦄ → HasEqBool (List A)
_==_ ⦃ eqList ⦄ = ==[]
open import Data.Nat using (ℕ)
instance
eqNat : HasEqBool ℕ
_==_ ⦃ eqNat ⦄ = Agda.Builtin.Nat._==_
where import Agda.Builtin.Nat
instance
eqBool : HasEqBool Bool
_==_ ⦃ eqBool ⦄ false false = true
_==_ ⦃ eqBool ⦄ false true = false
_==_ ⦃ eqBool ⦄ true y = y
open import Data.String using (String)
instance
eqString : HasEqBool String
_==_ ⦃ eqString ⦄ = Data.String._==_
where import Data.String
|
test/Succeed/Issue2558.agda | shlevy/agda | 2 | 12830 | -- Andreas, 2017-04-28, issue #2558 reported by <NAME>
-- Size solver assumed invariants that do not hold.
open import Common.Size
data Con (i : Size) : Set where
c : {j : Size< i} → Con i -- needed
postulate
Tms : {i j : Size} → Con i → Con j → Set
Ty : (i : Size) {j : Size< i} → Con j → Set
sub : ∀{i}{j k : Size< i} {l : Size< j} {Γ : Con k} {Δ : Con l} →
Tms Γ Δ → Ty j Δ → Ty i Γ
P : ∀{A : Set} (a : A) → Set
[][]T : {i : Size} {j : Size< i} {k : Size< ↑ i} {l : Size< ↑ (↑ i)}
{Γ : Con l} {Δ : Con k} {Σ : Con j} {A : Ty i Σ} →
(δ : Tms Δ Σ) →
(σ : Tms Γ Δ) → -- Γ needed
P (sub σ (sub δ A)) -- sub σ needed
-- Should pass
|
programs/oeis/173/A173044.asm | neoneye/loda | 22 | 94838 | <filename>programs/oeis/173/A173044.asm<gh_stars>10-100
; A173044: Product plus sum of five consecutive nonnegative numbers.
; 10,135,740,2545,6750,15155,30280,55485,95090,154495,240300,360425,524230,742635,1028240,1395445,1860570,2441975,3160180,4037985,5100590,6375715,7893720,9687725,11793730,14250735,17100860,20389465,24165270,28480475,33390880,38956005,45239210,52307815,60233220,69091025,78961150,89927955,102080360,115511965,130321170,146611295,164490700,184072905,205476710,228826315,254251440,281887445,311875450,344362455,379501460,417451585,458378190,502452995,549854200,600766605,655381730,713897935,776520540,843461945,914941750,991186875,1072431680,1158918085,1250895690,1348621895,1452362020,1562389425,1678985630,1802440435,1933052040,2071127165,2216981170,2370938175,2533331180,2704502185,2884802310,3074591915,3274240720,3484127925,3704642330,3936182455,4179156660,4433983265,4701090670,4980917475,5273912600,5580535405,5901255810,6236554415,6586922620,6952862745,7334888150,7733523355,8149304160,8582777765,9034502890,9505049895,9995000900,10504949905
mov $2,$0
seq $0,158874 ; a(n) = (n + 4)*(n + 3)*(n + 2)*(n + 1)*n / 5 = 24*A000389(n+4).
add $0,$2
mul $0,5
add $0,10
|
PIC/parity_checker.asm | StxGuy/EmbeddedSystems | 0 | 10245 | ;-----------------------------;
; PARITY CHECKER FOR PIC ;
; ;
; Por: Prof. <NAME> ;
; 26/Ago/2020 ;
;-----------------------------;
list p = 16f877a ; Specify processor
include <p16f877a.inc> ; Include mapping
mem equ 0x20 ; byte to be tested
counter equ 0x21 ; counter
loopc equ 0x22 ; loop counter
org 0x00 ; Program starts at 0x00
goto INICIO
INICIO: banksel 0x00 ; Select Bank #0
movlw 0x06 ; W = number
movwf mem ; [0x20] = number
clrf counter ; counter = 0
movlw 0x08 ; loopc = 8
movwf loopc
LOOP: rrf mem,1 ; number >> 1 through carry
btfsc STATUS,C
incf counter,1
decfsz loopc,1 ; loopc --;
goto LOOP
END
|
projects/04/mult/mult.asm | zoenolan/NAND2Tetris | 0 | 80674 | <gh_stars>0
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by <NAME>, MIT Press.
// File name: projects/04/Mult.asm
// Multiplies R0 and R1 and stores the result in R2.
// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)
// Zero the sum
@R2
M=0
// Set the counter
@R3
M=1
(LOOP)
@R3
D=M
@R0
D=D-M
@END
D;JGT // If (R3-R0) > 0 goto END
@R1
D=M // D = R1
@R2
M=D+M // R2 = R2 + R1
@R3 // R3 = R3 + 1
M=M+1
@LOOP
0;JMP // Goto LOOP
// End of program
(END)
@END
0;JMP // Infinite loop
|
oeis/281/A281166.asm | neoneye/loda-programs | 11 | 175158 | <gh_stars>10-100
; A281166: a(n) = 3*a(n-1) - 3*a(n-2) + 2*a(n-3) for n>2, a(0)=a(1)=1, a(2)=3.
; Submitted by <NAME>(s1.)
; 1,1,3,8,17,33,64,127,255,512,1025,2049,4096,8191,16383,32768,65537,131073,262144,524287,1048575,2097152,4194305,8388609,16777216,33554431,67108863,134217728,268435457,536870913,1073741824,2147483647,4294967295,8589934592,17179869185,34359738369,68719476736,137438953471,274877906943,549755813888,1099511627777,2199023255553,4398046511104,8796093022207,17592186044415,35184372088832,70368744177665,140737488355329,281474976710656,562949953421311,1125899906842623,2251799813685248,4503599627370497
mov $2,1
mov $4,1
lpb $0
sub $0,1
add $2,2
add $1,$2
sub $1,3
add $2,$4
sub $2,1
mov $4,$3
add $3,$1
lpe
mov $0,$3
add $0,1
|
src/gui.input.keyboard_scan.asm | defame-demogroup/c64_plasmatoy2 | 0 | 165051 | <filename>src/gui.input.keyboard_scan.asm
#importonce
/******************************************************************
ZERO PAGE
******************************************************************/
.const ScanResult = $50 // 8 bytes
.const BufferNew = $58 // 3 bytes
.const KeyQuantity = $5b // 1 byte
.const NonAlphaFlagX = $5c // 1 byte
.const NonAlphaFlagY = $5d // 1 byte
.const TempZP = $5e // 1 byte
.const SimultaneousKeys = $5f // 1 byte
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keyboard IO Routine
~~~~~~~~~~~~~~~~~~~
By: TWW/CTR
Preparatory Settings
~~~~~~~~~~~~~~~~~~~~
None
Destroys
~~~~~~~~
Accumulator
X-Register
Y-Register
Carry / Zero / Negative
$dc00
$dc01
$50-$5f
Footprint
~~~~~~~~~
#$206 Bytes
Information
~~~~~~~~~~~
The routine uses "2 Key rollower" or up to 3 if the key-combination doesen't induce shadowing.
If 2 or 3 keys are pressed simultaneously (within 1 scan) a "No Activity" state has to occur before new valid keys are returned.
RESTORE is not detectable and must be handled by NMI IRQ.
SHIFT LOCK is not detected due to unreliability.
Usage
~~~~~
Example Code:
jsr ReadKeyboard
bcs NoValidInput
stx TempX
sty TempY
cmp #$ff
beq NoNewAphanumericKey
// Check A for Alphanumeric keys
sta $0400
NoNewAphanumericKey:
// Check X & Y for Non-Alphanumeric Keys
ldx TempX
ldy TempY
stx $0401
sty $0402
NoValidInput: // This may be substituted for an errorhandler if needed.
Returned
~~~~~~~~
+=================================================+
| Returned in Accumulator |
+===========+===========+=============+===========+
| $00 - @ | $10 - p | $20 - SPC | $30 - 0 |
| $01 - a | $11 - q | $21 - | $31 - 1 |
| $02 - b | $12 - r | $22 - | $32 - 2 |
| $03 - c | $13 - s | $23 - | $33 - 3 |
| $04 - d | $14 - t | $24 - | $34 - 4 |
| $05 - e | $15 - u | $25 - | $35 - 5 |
| $06 - f | $16 - v | $26 - | $36 - 6 |
| $07 - g | $17 - w | $27 - | $37 - 7 |
| $08 - h | $18 - x | $28 - | $38 - 8 |
| $09 - i | $19 - y | $29 - | $39 - 9 |
| $0a - j | $1a - z | $2a - * | $3a - : |
| $0b - k | $1b - | $2b - + | $3b - ; |
| $0c - l | $1c - £ | $2c - , | $3c - |
| $0d - m | $1d - | $2d - - | $3d - = |
| $0e - n | $1e - ^ | $2e - . | $3e - |
| $0f - o | $1f - <- | $2f - / | $3f - |
+-----------+-----------+-------------+-----------+
+================================================================================
| Return in X-Register |
+=========+=========+=========+=========+=========+=========+=========+=========+
| Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
+---------+---------+---------+---------+---------+---------+---------+---------+
| CRSR UD | F5 | F3 | F1 | F7 | CRSR RL | RETURN |INST/DEL |
+---------+---------+---------+---------+---------+---------+---------+---------+
+================================================================================
| Return in Y-Register |
+=========+=========+=========+=========+=========+=========+=========+=========+
| Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
+---------+---------+---------+---------+---------+---------+---------+---------+
|RUN STOP | L-SHIFT | C= | R-SHIFT |CLR/HOME | CTRL | | |
+---------+---------+---------+---------+---------+---------+---------+---------+
CARRY:
- Set = Error Condition (Check A for code):
A = #$01 => No keyboard activity is detected.
A = #$02 => Control Port #1 Activity is detected.
A = #$03 => Key Shadowing / Ghosting is detected.
A = #$04 => 2 or 3 new keys is detected within one scan
A = #$05 => Awaiting "No Activity" state
- Clear = Valid input
A = #$ff => No new Alphanumeric Keys detected (some key(s) being held down AND/OR some Non-Alphanumeric key is causing valid return).
A <> #$ff => New Alphanumeric Key returned. Non-Alphanumeric keys may also be returned in X or Y Register
Issues/ToDo:
~~~~~~~~~~~~
- None
Improvements:
~~~~~~~~~~~~~
- Replace the subroutine with a pseudocommand and account for speedcode parameter (Memory vs. Cycles).
- Shorten the routine / Optimize if possible.
History:
~~~~~~~~
V2.5 - New test tool.
Added return of error codes.
Fixed a bug causing Buffer Overflow.
Fixed a bug in Non Alphanumerical Flags from 2.0.
V2.1 - Shortened the source by adding .for loops & Updated the header and some comments.
Added "simultaneous keypress" check.
V2.0 - Added return of non-Alphanumeric keys into X & Y-Registers.
Small optimizations here and there.
V1.1 - Unrolled code to make it faster and optimized other parts of it.
Removed SHIFT LOCK scanning.
V1.0 - First Working Version along with test tool.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
.pc = * "Keyboard Scan Routine"
// Operational Variables
.var MaxKeyRollover = 3
ReadKeyboard:
jmp Main
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Routine for Scanning a Matrix Row
KeyInRow:
asl
bcs *+5
jsr KeyFound
.for (var i = 0 ; i < 7 ; i++) {
inx
asl
bcs *+5
jsr KeyFound
}
rts
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Routine for handling: Key Found
KeyFound:
stx TempZP
dec KeyQuantity
bmi OverFlow
ldy KeyTable,x
ldx KeyQuantity
sty BufferNew,x
ldx TempZP
rts
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Routine for handling: Overflow
OverFlow:
pla // Dirty hack to handle 2 layers of JSR
pla
pla
pla
// Don't manipulate last legal buffer as the routine will fix itself once it gets valid input again.
lda #$03
sec
rts
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Exit Routine for: No Activity
NoActivityDetected:
// Exit With A = #$01, Carry Set & Reset BufferOld.
lda #$00
sta SimultaneousAlphanumericKeysFlag // Clear the too many keys flag once a "no activity" state is detected.
stx BufferOld
stx BufferOld+1
stx BufferOld+2
sec
lda #$01
rts
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Exit Routine for Control Port Activity
ControlPort:
// Exit with A = #$02, Carry Set. Keep BufferOld to verify input after Control Port activity ceases
sec
lda #$02
rts
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Configure Data Direction Registers
Main:
ldx #$ff
stx $dc02 // Port A - Output
ldy #$00
sty $dc03 // Port B - Input
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Check for Port Activity
sty $dc00 // Connect all Keyboard Rows
cpx $dc01
beq NoActivityDetected
lda SimultaneousAlphanumericKeysFlag
beq !+
// Waiting for all keys to be released before accepting new input.
lda #$05
sec
rts
!:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Check for Control Port #1 Activity
stx $dc00 // Disconnect all Keyboard Rows
cpx $dc01 // Only Control Port activity will be detected
bne ControlPort
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Scan Keyboard Matrix
lda #%11111110
sta $dc00
ldy $dc01
sty ScanResult+7
sec
.for (var i = 6 ; i > -1 ; i--) {
rol
sta $dc00
ldy $dc01
sty ScanResult+i
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Check for Control Port #1 Activity (again)
stx $dc00 // Disconnect all Keyboard Rows
cpx $dc01 // Only Control Port activity will be detected
bne ControlPort
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Initialize Buffer, Flags and Max Keys
// Reset current read buffer
stx BufferNew
stx BufferNew+1
stx BufferNew+2
// Reset Non-AlphaNumeric Flag
inx
stx NonAlphaFlagY
// Set max keys allowed before ignoring result
lda #MaxKeyRollover
sta KeyQuantity
// Counter to check for simultaneous alphanumeric key-presses
lda #$fe
sta SimultaneousKeys
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Check and flag Non Alphanumeric Keys
lda ScanResult+6
eor #$ff
and #%10000000 // Left Shift
lsr
sta NonAlphaFlagY
lda ScanResult+0
eor #$ff
and #%10100100 // RUN STOP - C= - CTRL
ora NonAlphaFlagY
sta NonAlphaFlagY
lda ScanResult+1
eor #$ff
and #%00011000 // Right SHIFT - CLR HOME
ora NonAlphaFlagY
sta NonAlphaFlagY
lda ScanResult+7 // The rest
eor #$ff
sta NonAlphaFlagX
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Check for pressed key(s)
lda ScanResult+7
cmp #$ff
beq *+5
jsr KeyInRow
.for (var i = 6 ; i > -1 ; i--) {
ldx #[7-i]*8
lda ScanResult+i
beq *+5
jsr KeyInRow
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Key Scan Completed
// Put any new key (not in old scan) into buffer
ldx #MaxKeyRollover-1
!: lda BufferNew,x
cmp #$ff
beq Exist // Handle 'null' values
cmp BufferOld
beq Exist
cmp BufferOld+1
beq Exist
cmp BufferOld+2
beq Exist
// New Key Detected
inc BufferQuantity
ldy BufferQuantity
sta Buffer,y
// Keep track of how many new Alphanumeric keys are detected
inc SimultaneousKeys
beq TooManyNewKeys
Exist:
dex
bpl !-
// Anything in Buffer?
ldy BufferQuantity
bmi BufferEmpty
// Yes: Then return it and tidy up the buffer
dec BufferQuantity
lda Buffer
ldx Buffer+1
stx Buffer
ldx Buffer+2
stx Buffer+1
jmp Return
BufferEmpty: // No new Alphanumeric keys to handle.
lda #$ff
Return: // A is preset
clc
// Copy BufferNew to BufferOld
ldx BufferNew
stx BufferOld
ldx BufferNew+1
stx BufferOld+1
ldx BufferNew+2
stx BufferOld+2
// Handle Non Alphanumeric Keys
ldx NonAlphaFlagX
ldy NonAlphaFlagY
rts
TooManyNewKeys:
sec
lda #$ff
sta BufferQuantity
sta SimultaneousAlphanumericKeysFlag
lda #$04
rts
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
KeyTable:
.byte $ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff // CRSR DOWN, F5, F3, F1, F7, CRSR RIGHT, RETURN, INST DEL
.byte $ff, $05, $13, $1a, $34, $01, $17, $33 // LEFT SHIFT, "E", "S", "Z", "4", "A", "W", "3"
.byte $18, $14, $06, $03, $36, $04, $12, $35 // "X", "T", "F", "C", "6", "D", "R", "5"
.byte $16, $15, $08, $02, $38, $07, $19, $37 // "V", "U", "H", "B", "8", "G", "Y", "7"
.byte $0e, $0f, $0b, $0d, $30, $0a, $09, $39 // "N", "O" (Oscar), "K", "M", "0" (Zero), "J", "I", "9"
.byte $2c, $00, $3a, $2e, $2d, $0c, $10, $2b // ",", "@", ":", ".", "-", "L", "P", "+"
.byte $2f, $1e, $3d, $ff, $ff, $3b, $2a, $1c // "/", "^", "=", RIGHT SHIFT, HOME, ";", "*", "£"
.byte $ff, $11, $ff, $20, $32, $ff, $1f, $31 // RUN STOP, "Q", "C=" (CMD), " " (SPC), "2", "CTRL", "<-", "1"
BufferOld:
.byte $ff, $ff, $ff
Buffer:
.byte $ff, $ff, $ff, $ff
BufferQuantity:
.byte $ff
SimultaneousAlphanumericKeysFlag:
.byte $00
|
test/Fail/Issue1137.agda | shlevy/agda | 3 | 13843 | <filename>test/Fail/Issue1137.agda
-- We ban termination pragmas inside `where` clauses.
module Issue1137 where
postulate
A : Set
a : A
foo : A
foo = bar
where
{-# TERMINATING #-}
bar : A
bar = bar
|
slae64/module1/part22/main.asm | Bigsby/slae | 0 | 163162 | <filename>slae64/module1/part22/main.asm<gh_stars>0
global _start
section .text
_start:
; Memory to memory
cld ; clear direction flag
lea rsi, [message]
lea rdi, [copy]
movsq
cld
lea rsi, [message]
; Clear destination
xor rax, rax
mov qword [copy], rax
lea rdi, [copy]
mov rcx, len
rep movsb
; Register to memory
mov rax, 0x0123456789abcdef
lea rdi, [var1]
stosq
; Memory to register
xor rax, rax
lea rsi, [var1]
lodsq
mov rax, 0x3c
mov rdi, 0
syscall
section .data
message: db "Hello, Bigsby", 0xa
mLen equ ($-message)
section .bss
copy: resb len
var1: resb 8
|
programs/oeis/186/A186539.asm | karttu/loda | 0 | 162 | ; A186539: Adjusted joint rank sequence of (f(i)) and (g(j)) with f(i) before g(j) when f(i)=g(j), where f(i)=i^2 and g(j)=-2+3j^2. Complement of A186540.
; 1,3,4,6,7,9,11,12,14,15,17,18,20,22,23,25,26,28,29,31,33,34,36,37,39,41,42,44,45,47,48,50,52,53,55,56,58,59,61,63,64,66,67,69,70,72,74,75,77,78,80,82,83,85,86,88,89,91,93,94,96,97,99,100,102,104,105,107,108,110,111,113,115,116,118,119,121,123,124,126,127,129,130,132,134,135,137,138,140,141,143,145,146,148,149,151,153,154,156,157
mov $4,$0
add $0,1
pow $0,2
mov $3,1
mov $5,60
lpb $0,1
sub $0,1
sub $0,$3
trn $0,1
mov $1,1
add $3,6
add $5,2
lpe
mul $1,$5
sub $1,61
mov $2,$4
mul $2,2
add $1,$2
div $1,2
add $1,1
|
libsrc/stdio/ansi/ts2068/f_ansi_dline.asm | meesokim/z88dk | 0 | 82095 | ;
; Spectrum C Library
;
; ANSI Video handling for ZX Spectrum
;
; Clean a text line
;
; <NAME> - Apr. 2000
;
; in: A = text row number
;
;
; $Id: f_ansi_dline.asm,v 1.2 2015/01/19 01:33:19 pauloscustodio Exp $
;
PUBLIC ansi_del_line
.ansi_del_line
; push af
and 24
ld d,a
pop af
push af
and 7
rrca
rrca
rrca
ld e,a
ld hl,16384
add hl,de ;Line address in HL
ld d,h
ld e,l
inc de
ld b,8
.loop_dl
push bc
push hl
push de
ld (hl),0
ld bc,31
ldir
;second display
set 5,d
ld bc,32
lddr
pop de
pop hl
inc d
inc h
pop bc
djnz loop_dl
; pop af
; ld d,0
; ld e,a
; rr e
; rr d
; rr e
; rr d
; rr e
; rr d
; ld hl,22528
; add hl,de
; ld d,h
; ld e,l
; inc de
; ld a,(23693) ; Use the default attributes
; ld (hl),a
; ld bc,31
; ldir
; ret
|
Borland/CBuilder5/Source/RTL/source/cstrings/qstrcat.asm | TrevorDArcyEvans/DivingMagpieSoftware | 1 | 173461 | <reponame>TrevorDArcyEvans/DivingMagpieSoftware
;[]-----------------------------------------------------------------[]
;| QSTRCAT.ASM -- appends one string to another (quick version) |
;[]-----------------------------------------------------------------[]
DWALIGN equ 1 ; set to 1 to enable dword-aligning of string
;
; C/C++ Run Time Library - Version 10.0
;
; Copyright (c) 1991, 2000 by Inprise Corporation
; All Rights Reserved.
;
; $Revision: 9.0 $
include RULES.ASI
; Segments Definitions
Header@
;-----------------------------------------------------------------------
;
;Name __strcat__ - appends one string to another
;
;Usage char *__strcat__(char *dest, const char *src);
;
;Prototype in string.h
;
;Description __strcat__ appends a copy of src to the end of dest. The
; length of the resulting string is strlen(dest) +
; strlen(src).
;
; NOTE: this is the "quick" version of strcat; it cheats
; by fetching 32-bit words, which can GP fault if the
; src string is near the end of a memory region and DWALIGN
; is not enabled above.
;Return value returns dest
;
;-----------------------------------------------------------------------
Code_seg@
Func@ __strcat__, public, _RTLENTRYF, <pointer dest>, <pointer src>
Link@ edi
mov edi,dest ; get dest string
mov ecx,-1
xor al,al ; search for null at end of dest string
cld
repne scasb ; scan one character past null
dec edi ; edi points to terminating null in dest
mov ecx, src ; get source string
if DWALIGN
mov eax, ecx
and eax, 3
jmp jmptab[eax*4]
jmptab dd offset FLAT:fetch
dd offset FLAT:fetch3
dd offset FLAT:fetch2
dd offset FLAT:fetch1
; Copy three bytes
fetch3:
mov al, [ecx]
or al, al
je return0
mov [edi], al
add ecx, 1
add edi, 1
; Copy two bytes
fetch2:
mov al, [ecx]
or al, al
je return0
mov [edi], al
add ecx, 1
add edi, 1
; Copy one byte
fetch1:
mov al, [ecx]
or al, al
je return0
mov [edi], al
add ecx, 1
add edi, 1
; jmp fetch
endif ; DWALIGN
fetch:
mov eax, [ecx] ; get four bytes from source
or al, al ; check byte 0 for null
jz return0
or ah, ah ; check byte 1 for null
jz return1
test eax, 000ff0000h ; check byte 2 for null
jz return2
test eax, 0ff000000h ; check byte 3 for null
jz return3
mov [edi], eax
add ecx, 4
add edi, 4
jmp fetch
return3:
mov [edi], eax ; copy bytes 0-3
mov eax, dest ; return dest
Unlink@ edi
Return@
return2:
mov [edi], ax ; copy bytes 0-2
mov byte ptr [edi+2], 0
mov eax, dest ; return dest
Unlink@ edi
Return@
return1:
mov [edi], ax ; copy bytes 0-1
mov eax, dest ; return dest
Unlink@ edi
Return@
return0:
mov [edi], al ; copy byte 0
mov eax, dest ; return dest
Unlink@ edi
Return@
EndFunc@ __strcat__
Code_EndS@
end
|
Cubical/Homotopy/Group/LES.agda | thomas-lamiaux/cubical | 1 | 15764 | <reponame>thomas-lamiaux/cubical<filename>Cubical/Homotopy/Group/LES.agda
{-# OPTIONS --safe --experimental-lossy-unification #-}
{-
This file contains:
1. The long exact sequence of loop spaces Ωⁿ (fib f) → Ωⁿ A → Ωⁿ B
2. The long exact sequence of homotopy groups πₙ(fib f) → πₙ A → πₙ B
3. Some lemmas relating the map in the sequence to maps using the
other definition of πₙ (maps from Sⁿ)
-}
module Cubical.Homotopy.Group.LES where
open import Cubical.Homotopy.Loopspace
open import Cubical.Homotopy.Group.Base
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Pointed
open import Cubical.Foundations.Pointed.Homogeneous
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.GroupoidLaws renaming (assoc to ∙assoc)
open import Cubical.Foundations.Path
open import Cubical.Foundations.Isomorphism
open Iso
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Function
open import Cubical.HITs.SetTruncation
renaming (rec to sRec
; elim to sElim ; elim2 to sElim2
; map to sMap)
open import Cubical.HITs.PropositionalTruncation
renaming (rec to pRec)
open import Cubical.Data.Sigma
open import Cubical.Data.Nat
open import Cubical.Algebra.Group
open import Cubical.Algebra.Group.Morphisms
open import Cubical.Algebra.Group.MorphismProperties
open import Cubical.Algebra.Group.GroupPath
-- We will need an explicitly defined equivalence
-- (PathP (λ i → p i ≡ y) q q) ≃ (sym q ∙∙ p ∙∙ q ≡ refl)
-- This is given by →∙∙lCancel below
module _ {ℓ : Level} {A : Type ℓ} {x y : A} (p : x ≡ x) (q : x ≡ y) where
→∙∙lCancel-fill : PathP (λ i → p i ≡ y) q q → I → I → I → A
→∙∙lCancel-fill PP k i j =
hfill (λ k → λ {(i = i0) → doubleCompPath-filler (sym q) p q k j
; (i = i1) → y
; (j = i0) → q (i ∨ k)
; (j = i1) → q (i ∨ k)})
(inS (PP j i))
k
←∙∙lCancel-fill : sym q ∙∙ p ∙∙ q ≡ refl → I → I → I → A
←∙∙lCancel-fill PP k i j =
hfill (λ k → λ {(i = i0) → q (j ∨ ~ k)
; (i = i1) → q (j ∨ ~ k)
; (j = i0) → doubleCompPath-filler (sym q) p q (~ k) i
; (j = i1) → y})
(inS (PP j i))
k
→∙∙lCancel : PathP (λ i → p i ≡ y) q q → sym q ∙∙ p ∙∙ q ≡ refl
→∙∙lCancel PP i j = →∙∙lCancel-fill PP i1 i j
←∙∙lCancel : sym q ∙∙ p ∙∙ q ≡ refl → PathP (λ i → p i ≡ y) q q
←∙∙lCancel PP i j = ←∙∙lCancel-fill PP i1 i j
←∙∙lCancel→∙∙lCancel : (PP : PathP (λ i → p i ≡ y) q q)
→ ←∙∙lCancel (→∙∙lCancel PP) ≡ PP
←∙∙lCancel→∙∙lCancel PP r i j =
hcomp (λ k → λ {(r = i0) → ←∙∙lCancel-fill (→∙∙lCancel PP) k i j
; (r = i1) → PP i j
; (j = i0) → doubleCompPath-filler (sym q) p q (~ k ∧ ~ r) i
; (j = i1) → y
; (i = i0) → q (j ∨ ~ k ∧ ~ r)
; (i = i1) → q (j ∨ ~ k ∧ ~ r)})
(hcomp (λ k → λ {(r = i0) → →∙∙lCancel-fill PP k j i
; (r = i1) → PP i j
; (j = i0) → doubleCompPath-filler (sym q) p q (k ∧ ~ r) i
; (j = i1) → y
; (i = i0) → q (j ∨ k ∧ ~ r)
; (i = i1) → q (j ∨ k ∧ ~ r)})
(PP i j))
→∙∙lCancel←∙∙lCancel : (PP : sym q ∙∙ p ∙∙ q ≡ refl)
→ →∙∙lCancel (←∙∙lCancel PP) ≡ PP
→∙∙lCancel←∙∙lCancel PP r i j =
hcomp (λ k → λ {(r = i0) → →∙∙lCancel-fill (←∙∙lCancel PP) k i j
; (r = i1) → PP i j
; (j = i0) → q (i ∨ k ∨ r)
; (j = i1) → q (i ∨ k ∨ r)
; (i = i0) → doubleCompPath-filler (sym q) p q (r ∨ k) j
; (i = i1) → y})
(hcomp (λ k → λ {(r = i0) → ←∙∙lCancel-fill PP k j i
; (r = i1) → PP i j
; (j = i0) → q (i ∨ r ∨ ~ k)
; (j = i1) → q (i ∨ r ∨ ~ k)
; (i = i0) → doubleCompPath-filler (sym q) p q (r ∨ ~ k) j
; (i = i1) → y})
(PP i j))
←∙∙lCancel-refl-refl :
{ℓ : Level} {A : Type ℓ} {x : A} (p : refl {x = x} ≡ refl)
→ ←∙∙lCancel {x = x} {y = x} refl refl (sym (rUnit refl) ∙ p)
≡ flipSquare p
←∙∙lCancel-refl-refl p k i j =
hcomp (λ r → λ { (i = i0) → p i0 i0
; (i = i1) → p i0 i0
; (j = i0) → rUnit (λ _ → p i0 i0) (~ r) i
; (j = i1) → p i0 i0
; (k = i0) → ←∙∙lCancel-fill refl refl (sym (rUnit refl) ∙ p) r i j
; (k = i1) → compPath-filler' (sym (rUnit refl)) p (~ r) j i})
((sym (rUnit refl) ∙ p) j i)
{- We need an iso Ω(fib f) ≅ fib(Ω f) -}
ΩFibreIso : {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'} (f : A →∙ B)
→ Iso (typ (Ω (fiber (fst f) (pt B) , (pt A) , snd f)))
(fiber (Ω→ f .fst) refl)
fun (ΩFibreIso f) p = (cong fst p) ,
→∙∙lCancel (cong (fst f) (cong fst p)) (snd f)
(cong snd p)
fst (inv (ΩFibreIso f) (p , q) i) = p i
snd (inv (ΩFibreIso f) (p , q) i) = ←∙∙lCancel (cong (fst f) p) (snd f) q i
rightInv (ΩFibreIso f) (p , q) = ΣPathP (refl , →∙∙lCancel←∙∙lCancel _ _ q)
fst (leftInv (ΩFibreIso f) p i j) = fst (p j)
snd (leftInv (ΩFibreIso f) p i j) k =
←∙∙lCancel→∙∙lCancel _ _ (cong snd p) i j k
{- Some homomorphism properties of the above iso -}
ΩFibreIsopres∙fst : {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'} (f : A →∙ B)
→ (p q : (typ (Ω (fiber (fst f) (pt B) , (pt A) , snd f))))
→ fst (fun (ΩFibreIso f) (p ∙ q))
≡ fst (fun (ΩFibreIso f) p) ∙ fst (fun (ΩFibreIso f) q)
ΩFibreIsopres∙fst f p q = cong-∙ fst p q
ΩFibreIso⁻pres∙snd : {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'}
(f : A →∙ B) (p q : typ (Ω (Ω B)))
→ inv (ΩFibreIso f) (refl , (Ω→ f .snd ∙ p ∙ q))
≡ inv (ΩFibreIso f) (refl , Ω→ f .snd ∙ p)
∙ inv (ΩFibreIso f) (refl , Ω→ f .snd ∙ q)
ΩFibreIso⁻pres∙snd {A = A} {B = B}=
→∙J (λ b₀ f → (p q : typ (Ω (Ω (fst B , b₀))))
→ inv (ΩFibreIso f) (refl , (Ω→ f .snd ∙ p ∙ q))
≡ inv (ΩFibreIso f) (refl , Ω→ f .snd ∙ p)
∙ inv (ΩFibreIso f) (refl , Ω→ f .snd ∙ q))
ind
where
ind : (f : typ A → typ B) (p q : typ (Ω (Ω (fst B , f (pt A)))))
→ inv (ΩFibreIso (f , refl)) (refl , (sym (rUnit refl) ∙ p ∙ q))
≡ inv (ΩFibreIso (f , refl)) (refl , sym (rUnit refl) ∙ p)
∙ inv (ΩFibreIso (f , refl)) (refl , sym (rUnit refl) ∙ q)
fst (ind f p q i j) =
(rUnit refl
∙ sym (cong-∙ fst
(inv (ΩFibreIso (f , refl)) (refl , sym (rUnit refl) ∙ p))
(inv (ΩFibreIso (f , refl)) (refl , sym (rUnit refl) ∙ q)))) i j
snd (ind f p q i j) k =
hcomp (λ r
→ λ {(i = i0) → ←∙∙lCancel-refl-refl (p ∙ q) (~ r) j k --
; (i = i1) →
snd (compPath-filler
(inv (ΩFibreIso (f , refl))
(refl , sym (rUnit refl) ∙ p))
(inv (ΩFibreIso (f , refl))
(refl , sym (rUnit refl) ∙ q)) r j) k
; (j = i0) → f (snd A)
; (j = i1) → snd (inv (ΩFibreIso (f , refl))
(refl , sym (rUnit refl) ∙ q) (r ∨ ~ i)) k
; (k = i0) → main r i j
; (k = i1) → f (snd A)})
(hcomp (λ r → λ {(i = i0) → (p ∙ q) k j
; (i = i1) → ←∙∙lCancel-refl-refl p (~ r) j k
; (j = i0) → f (snd A)
; (j = i1) → ←∙∙lCancel-refl-refl q (~ r) (~ i) k
; (k = i0) → f (pt A)
; (k = i1) → f (snd A)})
(hcomp (λ r → λ {(i = i0) → (compPath-filler' p q r) k j
; (i = i1) → p (k ∨ ~ r) j
; (j = i0) → f (snd A)
; (j = i1) → q k (~ i)
; (k = i0) → p (k ∨ ~ r) j
; (k = i1) → f (snd A)})
(q k (~ i ∧ j))))
where
P = (inv (ΩFibreIso (f , refl)) (refl , sym (rUnit refl) ∙ p))
Q = (inv (ΩFibreIso (f , refl)) (refl , sym (rUnit refl) ∙ q))
main : I → I → I → fst B
main r i j =
hcomp (λ k → λ {(i = i0) → f (snd A)
; (i = i1) → f (fst (compPath-filler P Q (r ∨ ~ k) j))
; (j = i0) → f (snd A)
; (j = i1) → f (snd A)
; (r = i0) → f (fst (compPath-filler P Q (i ∧ ~ k) j))
; (r = i1) → f ((rUnit refl ∙ sym (cong-∙ fst P Q)) i j)})
(hcomp (λ k → λ {(i = i0) → f (rUnit (λ _ → pt A) (~ k ∧ r) j)
; (i = i1) → f (fst ((P ∙ Q) j))
; (j = i0) → f (snd A)
; (j = i1) → f (snd A)
; (r = i0) → f (fst (compPath-filler P Q i j))
; (r = i1) → f ((compPath-filler' (rUnit refl)
(sym (cong-∙ fst P Q)) k) i j)})
(hcomp (λ k → λ {(i = i0) → f (rUnit (λ _ → pt A) (k ∧ r) j)
; (i = i1) → f (fst (compPath-filler P Q k j))
; (j = i0) → f (snd A)
; (j = i1) → f (snd A)
; (r = i0) → f (fst (compPath-filler P Q (i ∧ k) j))
; (r = i1) → f ((cong-∙∙-filler fst refl P Q) k (~ i) j)})
(f (snd A))))
ΩFibreIso∙ : {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'} (f : A →∙ B)
→ Iso.fun (ΩFibreIso f) refl ≡ (refl , (∙∙lCancel (snd f)))
ΩFibreIso∙ {A = A} {B = B} =
→∙J (λ b f → Iso.fun (ΩFibreIso f) refl ≡ (refl , (∙∙lCancel (snd f))))
λ f → ΣPathP (refl , help f)
where
help : (f : fst A → fst B) →
→∙∙lCancel (λ i → f (snd A)) refl (λ i → refl)
≡ ∙∙lCancel refl
help f i j r =
hcomp (λ k → λ {(i = i0) →
→∙∙lCancel-fill (λ _ → f (snd A)) refl refl k j r
; (i = i1) → ∙∙lCancel-fill (λ _ → f (snd A)) j r k
; (j = i0) → rUnit (λ _ → f (snd A)) k r
; (j = i1) → f (snd A)
; (r = i1) → f (snd A)
; (r = i0) → f (snd A)})
(f (snd A))
ΩFibreIso⁻∙ : {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'} (f : A →∙ B)
→ Iso.inv (ΩFibreIso f) (refl , (∙∙lCancel (snd f))) ≡ refl
ΩFibreIso⁻∙ f =
cong (Iso.inv (ΩFibreIso f)) (sym (ΩFibreIso∙ f)) ∙ leftInv (ΩFibreIso f) refl
{- Ωⁿ (fib f) ≃∙ fib (Ωⁿ f) -}
Ω^Fibre≃∙ : {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'} (n : ℕ) (f : A →∙ B)
→ ((Ω^ n) (fiber (fst f) (pt B) , (pt A) , snd f))
≃∙ ((fiber (Ω^→ n f .fst) (snd ((Ω^ n) B)))
, (snd ((Ω^ n) A)) , (Ω^→ n f .snd))
Ω^Fibre≃∙ zero f = (idEquiv _) , refl
Ω^Fibre≃∙ (suc n) f =
compEquiv∙
(Ω≃∙ (Ω^Fibre≃∙ n f))
((isoToEquiv (ΩFibreIso (Ω^→ n f))) , ΩFibreIso∙ (Ω^→ n f))
{- Its inverse iso directly defined -}
Ω^Fibre≃∙⁻ : {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'}
(n : ℕ) (f : A →∙ B)
→ ((fiber (Ω^→ n f .fst) (snd ((Ω^ n) B)))
, (snd ((Ω^ n) A)) , (Ω^→ n f .snd))
≃∙ ((Ω^ n) (fiber (fst f) (pt B) , (pt A) , snd f))
Ω^Fibre≃∙⁻ zero f = (idEquiv _) , refl
Ω^Fibre≃∙⁻ (suc n) f =
compEquiv∙
((isoToEquiv (invIso (ΩFibreIso (Ω^→ n f))))
, (ΩFibreIso⁻∙ (Ω^→ n f)))
(Ω≃∙ (Ω^Fibre≃∙⁻ n f))
isHomogeneousΩ^→fib : {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'}
(n : ℕ) (f : A →∙ B)
→ isHomogeneous
((fiber (Ω^→ (suc n) f .fst) (snd ((Ω^ (suc n)) B)))
, (snd ((Ω^ (suc n)) A)) , (Ω^→ (suc n) f .snd))
isHomogeneousΩ^→fib n f =
subst isHomogeneous (ua∙ ((fst (Ω^Fibre≃∙ (suc n) f)))
(snd (Ω^Fibre≃∙ (suc n) f)))
(isHomogeneousPath _ _)
Ω^Fibre≃∙sect : {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'}
(n : ℕ) (f : A →∙ B)
→ (≃∙map (Ω^Fibre≃∙⁻ n f) ∘∙ ≃∙map (Ω^Fibre≃∙ n f))
≡ idfun∙ _
Ω^Fibre≃∙sect zero f = ΣPathP (refl , (sym (rUnit refl)))
Ω^Fibre≃∙sect (suc n) f =
→∙Homogeneous≡ (isHomogeneousPath _ _)
(funExt
λ p → cong (fst (fst (Ω≃∙ (Ω^Fibre≃∙⁻ n f))))
(leftInv (ΩFibreIso (Ω^→ n f))
((fst (fst (Ω≃∙ (Ω^Fibre≃∙ n f))) p)))
∙ sym (Ω→∘ (≃∙map (Ω^Fibre≃∙⁻ n f))
(≃∙map (Ω^Fibre≃∙ n f)) p)
∙ (λ i → (Ω→ (Ω^Fibre≃∙sect n f i)) .fst p)
∙ sym (rUnit p))
Ω^Fibre≃∙retr : {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'}
(n : ℕ) (f : A →∙ B)
→ (≃∙map (Ω^Fibre≃∙ n f) ∘∙ ≃∙map (Ω^Fibre≃∙⁻ n f))
≡ idfun∙ _
Ω^Fibre≃∙retr zero f = ΣPathP (refl , (sym (rUnit refl)))
Ω^Fibre≃∙retr (suc n) f =
→∙Homogeneous≡ (isHomogeneousΩ^→fib n f)
(funExt (λ p →
cong (fun (ΩFibreIso (Ω^→ n f)))
((sym (Ω→∘ (≃∙map (Ω^Fibre≃∙ n f))
(≃∙map (Ω^Fibre≃∙⁻ n f))
(inv (ΩFibreIso (Ω^→ n f)) p)))
∙ (λ i → Ω→ (Ω^Fibre≃∙retr n f i) .fst (inv (ΩFibreIso (Ω^→ n f)) p))
∙ sym (rUnit (inv (ΩFibreIso (Ω^→ n f)) p)))
∙ rightInv (ΩFibreIso (Ω^→ n f)) p))
Ω^Fibre≃∙' : {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'}
(n : ℕ) (f : A →∙ B)
→ ((Ω^ n) (fiber (fst f) (pt B) , (pt A) , snd f))
≃∙ ((fiber (Ω^→ n f .fst) (snd ((Ω^ n) B)))
, (snd ((Ω^ n) A)) , (Ω^→ n f .snd))
Ω^Fibre≃∙' zero f = idEquiv _ , refl
Ω^Fibre≃∙' (suc zero) f =
(isoToEquiv (ΩFibreIso (Ω^→ zero f))) , ΩFibreIso∙ (Ω^→ zero f)
Ω^Fibre≃∙' (suc (suc n)) f =
compEquiv∙
(Ω≃∙ (Ω^Fibre≃∙ (suc n) f))
((isoToEquiv (ΩFibreIso (Ω^→ (suc n) f))) , ΩFibreIso∙ (Ω^→ (suc n) f))
-- The long exact sequence of loop spaces.
module ΩLES {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'} (f : A →∙ B) where
{- Fibre of f -}
fibf : Pointed _
fibf = fiber (fst f) (pt B) , (pt A , snd f)
{- Fibre of Ωⁿ f -}
fibΩ^f : (n : ℕ) → Pointed _
fst (fibΩ^f n) = fiber (Ω^→ n f .fst) (snd ((Ω^ n) B))
snd (fibΩ^f n) = (snd ((Ω^ n) A)) , (Ω^→ n f .snd)
Ω^fibf : (n : ℕ) → Pointed _
Ω^fibf n = (Ω^ n) fibf
{- Helper function fib (Ωⁿ f) → Ωⁿ A -}
fibΩ^f→A : (n : ℕ) → fibΩ^f n →∙ (Ω^ n) A
fst (fibΩ^f→A n) = fst
snd (fibΩ^f→A n) = refl
{- The main function Ωⁿ(fib f) → Ωⁿ A, which is just the composition
Ωⁿ(fib f) ≃ fib (Ωⁿ f) → Ωⁿ A, where the last function is
fibΩ^f→A. Hence most proofs will concern fibΩ^f→A, since it is easier to
work with. -}
Ω^fibf→A : (n : ℕ) → Ω^fibf n →∙ (Ω^ n) A
Ω^fibf→A n = fibΩ^f→A n ∘∙ ≃∙map (Ω^Fibre≃∙ n f)
{- The function preserves path composition -}
Ω^fibf→A-pres∙ : (n : ℕ) → (p q : Ω^fibf (suc n) .fst)
→ Ω^fibf→A (suc n) .fst (p ∙ q)
≡ Ω^fibf→A (suc n) .fst p
∙ Ω^fibf→A (suc n) .fst q
Ω^fibf→A-pres∙ n p q =
cong (fst (fibΩ^f→A (suc n)))
(cong (fun (ΩFibreIso (Ω^→ n f)))
(Ω→pres∙ (≃∙map (Ω^Fibre≃∙ n f)) p q))
∙ ΩFibreIsopres∙fst (Ω^→ n f)
(fst (Ω→ (≃∙map (Ω^Fibre≃∙ n f))) p)
(fst (Ω→ (≃∙map (Ω^Fibre≃∙ n f))) q)
{- The function Ωⁿ A → Ωⁿ B -}
A→B : (n : ℕ) → (Ω^ n) A →∙ (Ω^ n) B
A→B n = Ω^→ n f
{- It preserves path composition -}
A→B-pres∙ : (n : ℕ) → (p q : typ ((Ω^ (suc n)) A))
→ fst (A→B (suc n)) (p ∙ q)
≡ fst (A→B (suc n)) p ∙ fst (A→B (suc n)) q
A→B-pres∙ n p q = Ω^→pres∙ f n p q
{- Helper function Ωⁿ⁺¹ B → fib (Ωⁿ f) -}
ΩB→fibΩ^f : (n : ℕ) → ((Ω^ (suc n)) B) →∙ fibΩ^f n
fst (ΩB→fibΩ^f n) x = (snd ((Ω^ n) A)) , (Ω^→ n f .snd ∙ x)
snd (ΩB→fibΩ^f n) = ΣPathP (refl , (sym (rUnit _)))
{- The main function Ωⁿ⁺¹ B → Ωⁿ (fib f),
factoring through the above function -}
ΩB→Ω^fibf : (n : ℕ) → (Ω^ (suc n)) B →∙ Ω^fibf n
ΩB→Ω^fibf n =
(≃∙map (Ω^Fibre≃∙⁻ n f))
∘∙ ΩB→fibΩ^f n
{- It preserves path composition -}
ΩB→Ω^fibf-pres∙ : (n : ℕ) → (p q : typ ((Ω^ (2 + n)) B))
→ fst (ΩB→Ω^fibf (suc n)) (p ∙ q)
≡ fst (ΩB→Ω^fibf (suc n)) p ∙ fst (ΩB→Ω^fibf (suc n)) q
ΩB→Ω^fibf-pres∙ n p q =
cong (fst (fst (Ω^Fibre≃∙⁻ (suc n) f)))
refl
∙ cong (fst (fst (Ω≃∙ (Ω^Fibre≃∙⁻ n f))))
(cong (fun (invIso (ΩFibreIso (Ω^→ n f))))
(λ _ → snd ((Ω^ suc n) A) , Ω^→ (suc n) f .snd ∙ p ∙ q))
∙ cong (fst (fst (Ω≃∙ (Ω^Fibre≃∙⁻ n f))))
(ΩFibreIso⁻pres∙snd (Ω^→ n f) p q)
∙ Ω≃∙pres∙ (Ω^Fibre≃∙⁻ n f)
(inv (ΩFibreIso (Ω^→ n f)) (refl , Ω→ (Ω^→ n f) .snd ∙ p))
(inv (ΩFibreIso (Ω^→ n f)) (refl , Ω→ (Ω^→ n f) .snd ∙ q))
{- Hence we have our sequence
... → Ωⁿ⁺¹B → Ωⁿ(fib f) → Ωⁿ A → Ωⁿ B → ... (*)
We first prove the exactness properties for the helper functions
ΩB→fibΩ^f and fibΩ^f→A, and then deduce exactness of the whole sequence
by noting that the functions in (*) are just ΩB→fibΩ^f, fibΩ^f→A but
composed with equivalences
-}
private
Im-fibΩ^f→A⊂Ker-A→B : (n : ℕ) (x : _)
→ isInIm∙ (fibΩ^f→A n) x
→ isInKer∙ (A→B n) x
Im-fibΩ^f→A⊂Ker-A→B n x =
uncurry λ p → J (λ x _ → isInKer∙ (A→B n) x)
(snd p)
Ker-fibΩ^f→A⊂Im-ΩB→fibΩ^f : (n : ℕ) (x : _)
→ isInKer∙ (fibΩ^f→A n) x
→ isInIm∙ (ΩB→fibΩ^f n) x
Ker-fibΩ^f→A⊂Im-ΩB→fibΩ^f n x ker =
(sym (Ω^→ n f .snd)
∙ cong (Ω^→ n f .fst) (sym ker) ∙ snd x) , ΣPathP ((sym ker) ,
((∙assoc (Ω^→ n f .snd)
(sym (Ω^→ n f .snd))
(sym (cong (Ω^→ n f .fst) ker) ∙ snd x)
∙∙ cong (_∙ (sym (cong (Ω^→ n f .fst) ker) ∙ snd x))
(rCancel (Ω^→ n f .snd))
∙∙ sym (lUnit (sym (cong (Ω^→ n f .fst) ker) ∙ snd x)))
◁ (λ i j → compPath-filler'
(cong (Ω^→ n f .fst) (sym ker)) (snd x) (~ i) j)))
Im-A→B⊂Ker-ΩB→fibΩ^f : (n : ℕ) (x : fst (((Ω^ (suc n)) B)))
→ isInIm∙ (A→B (suc n)) x
→ isInKer∙ (ΩB→fibΩ^f n) x
Im-A→B⊂Ker-ΩB→fibΩ^f n x =
uncurry λ p
→ J (λ x _ → isInKer∙ (ΩB→fibΩ^f n) x)
(ΣPathP (p , (((λ i → (λ j → Ω^→ n f .snd (j ∧ ~ i))
∙ ((λ j → Ω^→ n f .snd (~ j ∧ ~ i))
∙∙ cong (Ω^→ n f .fst) p
∙∙ Ω^→ n f .snd))
∙ sym (lUnit (cong (Ω^→ n f .fst) p ∙ Ω^→ n f .snd)))
◁ λ i j → compPath-filler'
(cong (Ω^→ n f .fst) p) (Ω^→ n f .snd) (~ i) j)))
Ker-ΩB→fibΩ^f⊂Im-A→B : (n : ℕ) (x : fst (((Ω^ (suc n)) B)))
→ isInKer∙ (ΩB→fibΩ^f n) x
→ isInIm∙ (A→B (suc n)) x
fst (Ker-ΩB→fibΩ^f⊂Im-A→B n x inker) = cong fst inker
snd (Ker-ΩB→fibΩ^f⊂Im-A→B n x inker) = lem
where
lem : fst (A→B (suc n)) (λ i → fst (inker i)) ≡ x
lem i j =
hcomp (λ k → λ { (i = i0) → doubleCompPath-filler
(sym (snd (Ω^→ n f)))
((λ i → Ω^→ n f .fst (fst (inker i))))
(snd (Ω^→ n f)) k j
; (i = i1) → compPath-filler' (Ω^→ n f .snd) x (~ k) j
; (j = i0) → snd (Ω^→ n f) k
; (j = i1) → snd (Ω^→ n f) (k ∨ i)})
(hcomp (λ k → λ { (i = i0) → (snd (inker j)) (~ k)
; (i = i1) → ((Ω^→ n f .snd) ∙ x) (j ∨ ~ k)
; (j = i0) → ((Ω^→ n f .snd) ∙ x) (~ k)
; (j = i1) → snd (Ω^→ n f) (i ∨ ~ k)})
(snd ((Ω^ n) B)))
{- Finally, we get exactness of the sequence
we are interested in -}
Im-Ω^fibf→A⊂Ker-A→B : (n : ℕ) (x : _)
→ isInIm∙ (Ω^fibf→A n) x
→ isInKer∙ (A→B n) x
Im-Ω^fibf→A⊂Ker-A→B n x x₁ =
Im-fibΩ^f→A⊂Ker-A→B n x
(((fst (fst (Ω^Fibre≃∙ n f))) (fst x₁))
, snd x₁)
Ker-A→B⊂Im-Ω^fibf→A : (n : ℕ) (x : _)
→ isInKer∙ (A→B n) x
→ isInIm∙ (Ω^fibf→A n) x
Ker-A→B⊂Im-Ω^fibf→A n x ker =
invEq (fst (Ω^Fibre≃∙ n f)) (x , ker)
, (cong fst (secEq (fst (Ω^Fibre≃∙ n f)) (x , ker)))
Ker-Ω^fibf→A⊂Im-ΩB→Ω^fibf : (n : ℕ) (x : _)
→ isInKer∙ (Ω^fibf→A n) x
→ isInIm∙ (ΩB→Ω^fibf n) x
Ker-Ω^fibf→A⊂Im-ΩB→Ω^fibf n x p =
fst r
, cong (fst ((fst (Ω^Fibre≃∙⁻ n f)))) (snd r)
∙ funExt⁻ (cong fst (Ω^Fibre≃∙sect n f)) x
where
r : isInIm∙ (ΩB→fibΩ^f n) (fst (fst (Ω^Fibre≃∙ n f)) x)
r = Ker-fibΩ^f→A⊂Im-ΩB→fibΩ^f n (fst (fst (Ω^Fibre≃∙ n f)) x) p
Im-ΩB→Ω^fibf⊂Ker-Ω^fibf→A : (n : ℕ) (x : _)
→ isInIm∙ (ΩB→Ω^fibf n) x
→ isInKer∙ (Ω^fibf→A n) x
Im-ΩB→Ω^fibf⊂Ker-Ω^fibf→A n x =
uncurry λ p →
J (λ x _ → isInKer∙ (Ω^fibf→A n) x)
(cong (fst (fibΩ^f→A n))
(funExt⁻ (cong fst (Ω^Fibre≃∙retr n f)) _))
Im-A→B⊂Ker-ΩB→Ω^fibf : (n : ℕ) (x : fst (((Ω^ (suc n)) B)))
→ isInIm∙ (A→B (suc n)) x
→ isInKer∙ (ΩB→Ω^fibf n) x
Im-A→B⊂Ker-ΩB→Ω^fibf n x p =
cong (fst ((fst (Ω^Fibre≃∙⁻ n f))))
(Im-A→B⊂Ker-ΩB→fibΩ^f n x p)
∙ snd (Ω^Fibre≃∙⁻ n f)
Ker-ΩB→Ω^fibf⊂Im-A→B : (n : ℕ) (x : fst (((Ω^ (suc n)) B)))
→ isInKer∙ (ΩB→Ω^fibf n) x
→ isInIm∙ (A→B (suc n)) x
Ker-ΩB→Ω^fibf⊂Im-A→B n x p =
Ker-ΩB→fibΩ^f⊂Im-A→B n x
(funExt⁻ (cong fst (sym (Ω^Fibre≃∙retr n f))) (ΩB→fibΩ^f n .fst x)
∙ cong (fst (fst (Ω^Fibre≃∙ n f))) p
∙ snd (Ω^Fibre≃∙ n f))
{- Some useful lemmas for converting the above sequence a
a sequence of homotopy groups -}
module setTruncLemmas {ℓ ℓ' ℓ'' : Level}
{A : Pointed ℓ} {B : Pointed ℓ'} {C : Pointed ℓ''}
(n m l : ℕ)
(f : (Ω ((Ω^ n) A)) →∙ (Ω ((Ω^ m) B)))
(g : (Ω ((Ω^ m) B)) →∙ (Ω ((Ω^ l) C)))
(e₁ : IsGroupHom (snd (πGr n A)) (sMap (fst f)) (snd (πGr m B)))
(e₂ : IsGroupHom (snd (πGr m B)) (sMap (fst g)) (snd (πGr l C))) where
ker⊂im : ((x : typ (Ω ((Ω^ m) B))) → isInKer∙ g x → isInIm∙ f x)
→ (x : π (suc m) B) → isInKer (_ , e₂) x → isInIm (_ , e₁) x
ker⊂im ind =
sElim (λ _ → isSetΠ λ _ → isProp→isSet squash₁)
λ p ker →
pRec squash₁
(λ ker∙ → ∣ ∣ ind p ker∙ .fst ∣₂ , cong ∣_∣₂ (ind p ker∙ .snd) ∣₁ )
(fun PathIdTrunc₀Iso ker)
im⊂ker : ((x : typ (Ω ((Ω^ m) B))) → isInIm∙ f x → isInKer∙ g x)
→ (x : π (suc m) B) → isInIm (_ , e₁) x → isInKer (_ , e₂) x
im⊂ker ind =
sElim (λ _ → isSetΠ λ _ → isSetPathImplicit)
λ p →
pRec (squash₂ _ _)
(uncurry (sElim (λ _ → isSetΠ λ _ → isSetPathImplicit)
λ a q → pRec (squash₂ _ _)
(λ q → cong ∣_∣₂ (ind p (a , q)))
(fun PathIdTrunc₀Iso q)))
{- The long exact sequence of homotopy groups -}
module πLES {ℓ ℓ' : Level} {A : Pointed ℓ} {B : Pointed ℓ'} (f : A →∙ B) where
module Ωs = ΩLES f
open Ωs renaming (A→B to A→B')
fib = fibf
fib→A : (n : ℕ) → GroupHom (πGr n fib) (πGr n A)
fst (fib→A n) = sMap (fst (Ω^fibf→A (suc n)))
snd (fib→A n) =
makeIsGroupHom
(sElim2 (λ _ _ → isSetPathImplicit)
λ p q → cong ∣_∣₂ (Ω^fibf→A-pres∙ n p q))
A→B : (n : ℕ) → GroupHom (πGr n A) (πGr n B)
fst (A→B n) = sMap (fst (A→B' (suc n)))
snd (A→B n) =
makeIsGroupHom
(sElim2 (λ _ _ → isSetPathImplicit)
λ g h → cong ∣_∣₂ (Ω^→pres∙ f n g h))
B→fib : (n : ℕ) → GroupHom (πGr (suc n) B) (πGr n fib)
fst (B→fib n) = sMap (fst (ΩB→Ω^fibf (suc n)))
snd (B→fib n) =
makeIsGroupHom
(sElim2
(λ _ _ → isSetPathImplicit)
λ p q → cong ∣_∣₂ (ΩB→Ω^fibf-pres∙ n p q))
Ker-A→B⊂Im-fib→A : (n : ℕ) (x : π (suc n) A)
→ isInKer (A→B n) x
→ isInIm (fib→A n) x
Ker-A→B⊂Im-fib→A n =
setTruncLemmas.ker⊂im n n n
(Ω^fibf→A (suc n)) (A→B' (suc n))
(snd (fib→A n)) (snd (A→B n))
(Ker-A→B⊂Im-Ω^fibf→A (suc n))
Im-fib→A⊂Ker-A→B : (n : ℕ) (x : π (suc n) A)
→ isInIm (fib→A n) x
→ isInKer (A→B n) x
Im-fib→A⊂Ker-A→B n =
setTruncLemmas.im⊂ker n n n
(Ω^fibf→A (suc n)) (A→B' (suc n))
(snd (fib→A n)) (snd (A→B n))
(Im-Ω^fibf→A⊂Ker-A→B (suc n))
Ker-fib→A⊂Im-B→fib : (n : ℕ) (x : π (suc n) fib)
→ isInKer (fib→A n) x
→ isInIm (B→fib n) x
Ker-fib→A⊂Im-B→fib n =
setTruncLemmas.ker⊂im (suc n) n n
(ΩB→Ω^fibf (suc n)) (Ω^fibf→A (suc n))
(snd (B→fib n)) (snd (fib→A n))
(Ker-Ω^fibf→A⊂Im-ΩB→Ω^fibf (suc n))
Im-B→fib⊂Ker-fib→A : (n : ℕ) (x : π (suc n) fib)
→ isInIm (B→fib n) x
→ isInKer (fib→A n) x
Im-B→fib⊂Ker-fib→A n =
setTruncLemmas.im⊂ker (suc n) n n
(ΩB→Ω^fibf (suc n)) (Ω^fibf→A (suc n))
(snd (B→fib n)) (snd (fib→A n))
(Im-ΩB→Ω^fibf⊂Ker-Ω^fibf→A (suc n))
Im-A→B⊂Ker-B→fib : (n : ℕ) (x : π (suc (suc n)) B)
→ isInIm (A→B (suc n)) x
→ isInKer (B→fib n) x
Im-A→B⊂Ker-B→fib n =
setTruncLemmas.im⊂ker (suc n) (suc n) n
(A→B' (suc (suc n))) (ΩB→Ω^fibf (suc n))
(snd (A→B (suc n))) (snd (B→fib n))
(Im-A→B⊂Ker-ΩB→Ω^fibf (suc n))
Ker-B→fib⊂Im-A→B : (n : ℕ) (x : π (suc (suc n)) B)
→ isInKer (B→fib n) x
→ isInIm (A→B (suc n)) x
Ker-B→fib⊂Im-A→B n =
setTruncLemmas.ker⊂im (suc n) (suc n) n
(A→B' (suc (suc n))) (ΩB→Ω^fibf (suc n))
(snd (A→B (suc n))) (snd (B→fib n))
(Ker-ΩB→Ω^fibf⊂Im-A→B (suc n))
{- We prove that the map Ωⁿ(fib f) → Ωⁿ A indeed is just the map
Ωⁿ fst -}
private
Ω^fibf→A-ind : ∀ {ℓ ℓ'} {A : Pointed ℓ} {B : Pointed ℓ'} (n : ℕ) (f : A →∙ B)
→ ΩLES.Ω^fibf→A f (suc n) ≡ Ω→ (ΩLES.Ω^fibf→A f n)
Ω^fibf→A-ind {A = A} {B = B} n f =
(λ _ → πLES.Ωs.fibΩ^f→A f (suc n)
∘∙ ≃∙map (Ω^Fibre≃∙ (suc n) f))
∙ →∙Homogeneous≡ (isHomogeneousPath _ _)
(funExt λ p →
(λ j → cong fst (Ω→ (≃∙map (Ω^Fibre≃∙ n f)) .fst p))
∙ rUnit ((λ i → fst
(Ω→ (≃∙map (Ω^Fibre≃∙ n f)) .fst p i)))
∙ sym (Ω→∘ (πLES.Ωs.fibΩ^f→A f n) (≃∙map (Ω^Fibre≃∙ n f)) p))
Ω^fibf→A≡ : ∀ {ℓ ℓ'} {A : Pointed ℓ} {B : Pointed ℓ'} (n : ℕ) (f : A →∙ B)
→ ΩLES.Ω^fibf→A f n ≡ Ω^→ n (fst , refl)
Ω^fibf→A≡ zero f = ΣPathP (refl , (sym (lUnit refl)))
Ω^fibf→A≡ (suc n) f = Ω^fibf→A-ind n f ∙ cong Ω→ (Ω^fibf→A≡ n f)
{- We now get a nice characterisation of the functions in the induced LES
of homotopy groups defined using (Sⁿ →∙ A) -}
π∘∙A→B-PathP : ∀ {ℓ ℓ'} {A : Pointed ℓ} {B : Pointed ℓ'} (n : ℕ) (f : A →∙ B)
→ PathP (λ i → GroupHomπ≅π'PathP A B n i)
(πLES.A→B f n)
(π'∘∙Hom n f)
π∘∙A→B-PathP n f =
toPathP (Σ≡Prop (λ _ → isPropIsGroupHom _ _) (π'∘∙Hom'≡π'∘∙fun n f))
π∘∙fib→A-PathP : ∀ {ℓ ℓ'} {A : Pointed ℓ} {B : Pointed ℓ'} (n : ℕ) (f : A →∙ B)
→ PathP (λ i → GroupHomπ≅π'PathP (ΩLES.fibf f) A n i)
(πLES.fib→A f n)
(π'∘∙Hom n (fst , refl))
π∘∙fib→A-PathP {A = A} {B = B} n f =
toPathP (Σ≡Prop (λ _ → isPropIsGroupHom _ _)
(cong (transport
(λ i → (fst (GroupPath _ _)
(GroupIso→GroupEquiv (π'Gr≅πGr n (ΩLES.fibf f))) (~ i)) .fst
→ (fst (GroupPath _ _)
(GroupIso→GroupEquiv (π'Gr≅πGr n A)) (~ i)) .fst))
lem
∙ π'∘∙Hom'≡π'∘∙fun n (fst , refl)))
where
lem : πLES.fib→A f n .fst ≡ sMap (Ω^→ (suc n) (fst , refl) .fst)
lem = cong sMap (cong fst (Ω^fibf→A≡ (suc n) f))
|
oeis/044/A044748.asm | neoneye/loda-programs | 11 | 3405 | <reponame>neoneye/loda-programs
; A044748: Numbers n such that string 3,5 occurs in the base 10 representation of n but not of n+1.
; Submitted by <NAME>
; 35,135,235,335,359,435,535,635,735,835,935,1035,1135,1235,1335,1359,1435,1535,1635,1735,1835,1935,2035,2135,2235,2335,2359,2435,2535,2635,2735,2835,2935,3035,3135,3235,3335,3359,3435
add $0,3
mul $0,10
mov $1,$0
add $0,7
div $0,11
mul $0,22
add $0,34
sub $1,5
div $1,11
sub $1,1
mul $1,26
add $0,$1
add $0,$1
add $0,$1
div $0,4
sub $0,44
mul $0,4
add $0,35
|
programs/oeis/317/A317255.asm | neoneye/loda | 22 | 88379 | ; A317255: a(n) = 149836681069944461 + (n-1)*1723457117682300.
; 149836681069944461,151560138187626761,153283595305309061,155007052422991361,156730509540673661,158453966658355961,160177423776038261,161900880893720561,163624338011402861,165347795129085161,167071252246767461,168794709364449761,170518166482132061
mul $0,1723457117682300
add $0,149836681069944461
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1620.asm | ljhsiun2/medusa | 9 | 81896 | <filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1620.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r13
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xb648, %rbx
nop
nop
nop
nop
sub $45508, %r11
mov (%rbx), %r9w
nop
and %r13, %r13
lea addresses_D_ht+0xb478, %r12
nop
nop
nop
nop
add $12892, %r10
movups (%r12), %xmm6
vpextrq $1, %xmm6, %rdx
nop
nop
nop
nop
add %r9, %r9
lea addresses_A_ht+0x1dd62, %r13
nop
nop
and $44732, %rdx
movw $0x6162, (%r13)
sub $23852, %r9
lea addresses_WT_ht+0x5878, %r11
nop
nop
nop
nop
dec %r9
movb (%r11), %bl
xor %rdx, %rdx
lea addresses_UC_ht+0x13478, %r11
nop
xor %r12, %r12
movb (%r11), %r10b
nop
add $8211, %r12
lea addresses_UC_ht+0x8878, %rsi
lea addresses_D_ht+0x11a7b, %rdi
nop
nop
sub %rbx, %rbx
mov $25, %rcx
rep movsl
xor %rdi, %rdi
lea addresses_A_ht+0x1cf8, %rbx
nop
nop
nop
nop
nop
mfence
movb $0x61, (%rbx)
nop
nop
inc %rbx
lea addresses_WC_ht+0x4478, %rsi
lea addresses_normal_ht+0x6d78, %rdi
xor %r12, %r12
mov $59, %rcx
rep movsb
sub %rdx, %rdx
lea addresses_normal_ht+0x1a278, %r11
nop
nop
nop
add %r10, %r10
movl $0x61626364, (%r11)
nop
nop
add %r11, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r13
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %rax
push %rbp
push %rbx
push %rcx
push %rsi
// Store
lea addresses_normal+0x138b6, %rbx
nop
nop
nop
nop
nop
xor %rsi, %rsi
movw $0x5152, (%rbx)
nop
nop
nop
nop
sub %r15, %r15
// Faulty Load
lea addresses_RW+0x18078, %r13
nop
nop
cmp $43943, %rax
vmovups (%r13), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %rsi
lea oracles, %rax
and $0xff, %rsi
shlq $12, %rsi
mov (%rax,%rsi,1), %rsi
pop %rsi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': True, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': True, 'AVXalign': True, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 9}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'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
*/
|
gcc-gcc-7_3_0-release/gcc/ada/s-veboop.ads | best08618/asylo | 7 | 28349 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . V E C T O R S . B O O L E A N _ O P E R A T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2002-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains functions for runtime operations on boolean vectors
package System.Vectors.Boolean_Operations is
pragma Pure;
-- Although in general the boolean operations on arrays of booleans are
-- identical to operations on arrays of unsigned words of the same size,
-- for the "not" operator this is not the case as False is typically
-- represented by 0 and true by 1.
function "not" (Item : Vectors.Vector) return Vectors.Vector;
-- The three boolean operations "nand", "nor" and "nxor" are needed
-- for cases where the compiler moves boolean array operations into
-- the body of the loop that iterates over the array elements.
-- Note the following equivalences:
-- (not X) or (not Y) = not (X and Y) = Nand (X, Y)
-- (not X) and (not Y) = not (X or Y) = Nor (X, Y)
-- (not X) xor (not Y) = X xor Y
-- X xor (not Y) = not (X xor Y) = Nxor (X, Y)
function Nand (Left, Right : Boolean) return Boolean;
function Nor (Left, Right : Boolean) return Boolean;
function Nxor (Left, Right : Boolean) return Boolean;
function Nand (Left, Right : Vectors.Vector) return Vectors.Vector;
function Nor (Left, Right : Vectors.Vector) return Vectors.Vector;
function Nxor (Left, Right : Vectors.Vector) return Vectors.Vector;
pragma Inline_Always ("not");
pragma Inline_Always (Nand);
pragma Inline_Always (Nor);
pragma Inline_Always (Nxor);
end System.Vectors.Boolean_Operations;
|
oeis/338/A338720.asm | neoneye/loda-programs | 11 | 247612 | <filename>oeis/338/A338720.asm
; A338720: Define b(1)=1 and for n>1, b(n)=n/b(n-1); then a(n) = nearest integer to b(n).
; Submitted by <NAME>
; 1,2,2,3,2,3,2,4,2,4,3,4,3,5,3,5,3,5,4,6,4,6,4,6,4,6,4,7,4,7,4,7,5,7,5,8,5,8,5,8,5,8,5,8,5,9,5,9,6,9,6,9,6,9,6,9,6,10,6,10,6,10,6,10,6,10,7,10,7,11,7,11,7,11,7,11,7,11,7,11,7,11,7,12,7,12,7
add $0,1
mov $1,1
mov $2,1
lpb $0
mul $1,$0
add $3,$0
sub $0,2
add $1,$2
sub $3,1
mul $2,$3
trn $3,$1
lpe
div $1,$2
div $1,2
mov $0,$1
add $0,1
|
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0.log_21829_1286.asm | ljhsiun2/medusa | 9 | 13670 | <filename>Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0.log_21829_1286.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x19799, %rsi
lea addresses_normal_ht+0x10119, %rdi
nop
sub $23623, %r12
mov $59, %rcx
rep movsl
nop
nop
nop
nop
and $54695, %r9
lea addresses_WT_ht+0x1eb71, %r9
nop
nop
cmp $34657, %rbp
movups (%r9), %xmm2
vpextrq $1, %xmm2, %rcx
xor %r12, %r12
lea addresses_WT_ht+0x5399, %rsi
lea addresses_D_ht+0x521, %rdi
nop
nop
nop
xor %r10, %r10
mov $59, %rcx
rep movsb
nop
add %rcx, %rcx
lea addresses_A_ht+0x5c95, %rsi
lea addresses_UC_ht+0x3a59, %rdi
clflush (%rdi)
nop
nop
sub %r10, %r10
mov $10, %rcx
rep movsl
nop
nop
nop
nop
nop
sub $57249, %rbp
lea addresses_WT_ht+0x319, %rbp
clflush (%rbp)
nop
dec %r12
movw $0x6162, (%rbp)
nop
nop
nop
add %r10, %r10
lea addresses_UC_ht+0x1a979, %r10
nop
add %rsi, %rsi
movb (%r10), %r9b
nop
nop
nop
nop
dec %rbp
lea addresses_WC_ht+0x7949, %rsi
lea addresses_WC_ht+0x179a9, %rdi
nop
nop
cmp $17481, %r11
mov $87, %rcx
rep movsw
nop
nop
nop
cmp %rsi, %rsi
lea addresses_D_ht+0x6ca9, %rsi
lea addresses_WT_ht+0x1af99, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
dec %r9
mov $120, %rcx
rep movsl
nop
nop
nop
nop
add %r12, %r12
lea addresses_D_ht+0x1e65, %rdi
clflush (%rdi)
nop
nop
nop
add %r11, %r11
mov $0x6162636465666768, %r12
movq %r12, (%rdi)
dec %rbp
lea addresses_WT_ht+0xdc59, %rdi
nop
nop
nop
add $29905, %rsi
vmovups (%rdi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %r11
nop
nop
nop
add $14895, %r11
lea addresses_WC_ht+0xe45d, %rdi
nop
nop
and $46150, %rbp
mov (%rdi), %r9
nop
nop
nop
nop
nop
sub %r10, %r10
lea addresses_WT_ht+0x1af19, %rbp
and %r11, %r11
mov $0x6162636465666768, %rdi
movq %rdi, %xmm0
vmovups %ymm0, (%rbp)
nop
nop
xor %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r8
push %r9
push %rax
push %rbp
push %rsi
// Load
lea addresses_D+0x16469, %r9
nop
nop
nop
sub $48549, %rsi
mov (%r9), %r10d
nop
nop
nop
nop
nop
cmp %r9, %r9
// Load
lea addresses_RW+0xbe39, %rbp
nop
nop
dec %rax
movaps (%rbp), %xmm0
vpextrq $0, %xmm0, %r10
nop
and %r11, %r11
// Faulty Load
lea addresses_US+0x7f99, %rbp
nop
nop
nop
nop
nop
and %rax, %rax
mov (%rbp), %r11d
lea oracles, %r9
and $0xff, %r11
shlq $12, %r11
mov (%r9,%r11,1), %r11
pop %rsi
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_D', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_RW', 'AVXalign': True, 'size': 16}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'same': True, 'congruent': 10, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}}
{'src': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 2}}
{'src': {'NT': False, 'same': True, 'congruent': 3, 'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 1}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}}
{'src': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}}
{'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 4, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}}
{'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
*/
|
P2/matrix.asm | alxzzhou/BUAA_CO_2020 | 1 | 167744 | .data
matrix1: .space 256
matrix2: .space 256
sp: .asciiz " "
enter: .asciiz "\n"
.macro index(%dest,%n,%row,%col) #index start from 0
#multu %row,%n
#mflo %dest
sll %dest,%row,3
add %dest,%dest,%col
sll %dest,%dest,2
.end_macro
.macro getdata(%t)
li $v0,5
syscall
move %t,$v0
.end_macro
.macro free(%s)
li %s,0
.end_macro
# s0=n
.text
getdata($s0)
free($t0)
multu $s0,$s0
mflo $s7
read1:
beq $t0,$s7,read1_end
getdata($t1) #save temp in t1
div $t0,$s0
mfhi $t2 #remainder t2 (col)
mflo $t3 #quotient t3 (row)
index($t4,$s0,$t3,$t2) #get adress
sw $t1,matrix1($t4)
addi $t0,$t0,1
j read1
read1_end:
free($t0)
read2:
beq $t0,$s7,read2_end
getdata($t1) #save temp in t1
div $t0,$s0
mfhi $t2 #remainder t2 (col)
mflo $t3 #quotient t3 (row)
index($t4,$s0,$t3,$t2) #get adress
sw $t1,matrix2($t4)
addi $t0,$t0,1
j read2
read2_end:
free($t0)
free($t1)
free($t2)
free($t3)
free($t4)
matrix_1:
beq $t0,$s0,matrix1_end #counter t0
free($t1)
matrix_2:
beq $t1,$s0,matrix2_end #counter t1
index($t2,$s0,$t0,$0) #t2 is head of row t0
index($t3,$s0,$0,$t1) #t3 is head of col t1
free($t4)
matrix_3:
beq $t4,$s0,matrix3_end #counter t4
lw $s1,matrix1($t2)
lw $s2,matrix2($t3)
multu $s1,$s2
mflo $t5 #t5 is temp reg of elements multiplied
add $a0,$a0,$t5 #a0 is result matrix's element
add $t2,$t2,4 #shift row element
add $t3,$t3,32 #shift col element
addi $t4,$t4,1
j matrix_3
matrix3_end:
li $v0,1
syscall
la $a0,sp
li $v0,4
syscall
free($t4)
free($a0)
free($t5)
addi $t1,$t1,1
j matrix_2
matrix2_end:
free($a0)
li $v0,4
la $a0,enter
syscall
free($a0)
addi $t0,$t0,1
j matrix_1
matrix1_end:
li $v0,10
syscall
|
libsrc/_DEVELOPMENT/adt/p_list/z80/asm_p_list_push_back.asm | meesokim/z88dk | 0 | 240564 | <gh_stars>0
; ===============================================================
; Jan 2014
; ===============================================================
;
; void *p_list_push_back(p_list_t *list, void *item)
;
; Add item to the back of the list.
;
; ===============================================================
SECTION code_adt_p_list
PUBLIC asm_p_list_push_back
EXTERN asm_p_forward_list_push_front, asm_p_forward_list_insert_after
asm_p_list_push_back:
; enter : hl = p_list_t *list
; de = void *item
;
; exit : hl = void *item
; z flag set if item is now sole occupant of list
;
; uses : af, de, hl
inc de
inc de ; de = & item->prev
inc hl
inc hl ; hl = & list->tail
call asm_p_forward_list_push_front
; hl = & item->prev
; de = & list->tail
; z flag set if list was empty
jr z, list_empty
ld e,(hl)
inc hl
ld d,(hl)
dec hl
list_empty:
dec de
dec de
dec hl
dec hl
ex de,hl
; de = & item->next
; hl = & item->prev->next or & list->head
jp asm_p_forward_list_insert_after
|
Scripts Pack Source Items/Scripts Pack/Dock/List View Like Grid View.applescript | Phorofor/ScriptsPack.macOS | 1 | 507 | <gh_stars>1-10
# Scripts Pack - Tweak various preference variables in macOS
# <Phorofor, https://github.com/Phorofor/>
-- Changes the list view style in the stacks to grid view like style when opened from a stack.
-- List View Like Grid View for the Dock
-- Versions compatible:
-- Preference Identifier: com.apple.dock
-- Preference Key: use-new-list-stack
-- Preference location: ~/Library/Preferences/com.apple.dock.plist
-- Default value (boolean): YES
set toggleBut to "Use Grid View List Style" as string
set tZ to "grid view style for the list stacks?" as string
set sTz to "yes" as string
set bT to "You've decided to switch to the grid style view for the list stacks."
try
set prValue to do shell script "defaults read com.apple.dock use-new-list-stack -bool"
if prValue = "1" then
set psValue to "List grid view style stacks is enabled. The icons are larger and acts like grid view." as string
set toggleBut to "Use Classic View List Style" as string
set tZ to "classic grid view style stacks?" as string
set sTz to "no" as string
set bT to "You've decided to switch to the classic grid view style for the list view stacks."
else
set psValue to "The list stack grid view style isn't enabled. You're using the classic list view style." as string
end if
on error
set psValue to "The classic list view style is always enabled by default." as string
end try
display alert "Would you like the list view in stacks to appear like the " & tZ message "When grid view style is set, it uses a list view like grid view's style, the icons are larger if the setting is chosen." & return & return & psValue buttons {"Cancel", "Clear", toggleBut} default button 3 cancel button 1
if the button returned of the result is toggleBut then
do shell script "defaults write com.apple.dock use-new-list-stack -bool " & sTz
else
do shell script "defaults delete com.apple.dock use-new-list-stack"
set bT to "You've decided to clear the preference."
end if
tell application "System Events" to (name of every process)
if the result contains "Dock" then
tell application "System Events"
display alert "Dock - Restart to see changes" message bT & " The Dock needs to be restarted before the changes can take effect. Click 'OK' to restart the Dock. The Dashboard will close when Dock is restarted, go to the Dashboard after the Dock is restarted to reload it again. All active application windows will pop open." buttons {"Cancel", "OK"} cancel button 1 default button 2
end tell
end if
do shell script "killall Dock" |
libsrc/gfx/common/pen_up.asm | ahjelm/z88dk | 640 | 166527 | ;
; Turtle graphics library
; Stefano - 11/2017
;
; $Id: pen_up.asm $
;
SECTION code_graphics
PUBLIC pen_up
PUBLIC _pen_up
EXTERN __pen
.pen_up
._pen_up
ld hl,__pen
ld a,127
and (hl)
ld (hl),a
ret
|
data/pokemon/base_stats/gligar.asm | Dev727/ancientplatinum | 2 | 161096 | db 0 ; species ID placeholder
db 65, 75, 105, 85, 35, 65
; hp atk def spd sat sdf
db GROUND, FLYING ; type
db 60 ; catch rate
db 108 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F50 ; gender ratio
db 100 ; unknown 1
db 20 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/gligar/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_MEDIUM_SLOW ; growth rate
dn EGG_BUG, EGG_BUG ; egg groups
; tm/hm learnset
tmhm HEADBUTT, CURSE, TOXIC, ROCK_SMASH, HIDDEN_POWER, SUNNY_DAY, SNORE, PROTECT, ENDURE, FRUSTRATION, IRON_TAIL, RETURN, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, SLUDGE_BOMB, SANDSTORM, SWIFT, DETECT, REST, ATTRACT, THIEF, FURY_CUTTER, CUT, STRENGTH
; end
|
programs/oeis/187/A187329.asm | neoneye/loda | 22 | 10068 | <reponame>neoneye/loda
; A187329: Floor((3-sqrt(5))n).
; 0,0,1,2,3,3,4,5,6,6,7,8,9,9,10,11,12,12,13,14,15,16,16,17,18,19,19,20,21,22,22,23,24,25,25,26,27,28,29,29,30,31,32,32,33,34,35,35,36,37,38,38,39,40,41,42,42,43,44,45,45,46,47,48,48,49,50,51,51,52,53,54,55,55,56,57,58,58,59,60,61,61,62,63,64,64,65,66,67,67,68,69,70,71,71,72,73,74,74,75
mov $2,$0
mul $2,54
add $0,$2
div $0,72
|
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_848.asm | ljhsiun2/medusa | 9 | 22972 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x7b56, %r9
nop
nop
inc %rsi
vmovups (%r9), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %rbx
nop
nop
nop
sub %rcx, %rcx
lea addresses_WT_ht+0x10a46, %r9
nop
sub $26227, %r13
movb $0x61, (%r9)
xor %rcx, %rcx
lea addresses_UC_ht+0xd48c, %r13
sub $64256, %rsi
mov $0x6162636465666768, %r11
movq %r11, (%r13)
nop
xor $23744, %rsi
lea addresses_WT_ht+0x9356, %r9
nop
nop
xor %r12, %r12
mov (%r9), %r11d
nop
nop
cmp $64857, %rbx
lea addresses_normal_ht+0x8656, %rsi
lea addresses_UC_ht+0x1544e, %rdi
nop
nop
nop
nop
dec %rbx
mov $94, %rcx
rep movsq
nop
nop
nop
nop
sub $50244, %r9
lea addresses_UC_ht+0x1595e, %rdi
dec %r9
mov (%rdi), %r12d
nop
nop
nop
nop
cmp $11929, %r11
lea addresses_UC_ht+0x1656, %rcx
nop
nop
sub $27010, %r13
mov $0x6162636465666768, %rdi
movq %rdi, %xmm7
and $0xffffffffffffffc0, %rcx
movntdq %xmm7, (%rcx)
nop
nop
cmp %r13, %r13
lea addresses_A_ht+0x196b6, %rsi
lea addresses_normal_ht+0x1a256, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
sub %r11, %r11
mov $89, %rcx
rep movsw
nop
sub %r12, %r12
lea addresses_normal_ht+0x1d656, %rsi
nop
nop
and %r9, %r9
mov $0x6162636465666768, %r13
movq %r13, (%rsi)
nop
nop
nop
nop
xor $30818, %r11
lea addresses_A_ht+0x1056, %r12
nop
add $60731, %r11
mov $0x6162636465666768, %rbx
movq %rbx, (%r12)
nop
inc %rcx
lea addresses_normal_ht+0x4656, %r12
clflush (%r12)
nop
xor %r9, %r9
movups (%r12), %xmm1
vpextrq $0, %xmm1, %rdi
nop
nop
xor %rbx, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r15
push %rax
push %rcx
// Store
lea addresses_normal+0xa256, %rax
nop
nop
nop
sub $61792, %r10
movb $0x51, (%rax)
nop
nop
nop
sub %r11, %r11
// Faulty Load
lea addresses_WC+0xd656, %rax
xor %r15, %r15
vmovups (%rax), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %r13
lea oracles, %rcx
and $0xff, %r13
shlq $12, %r13
mov (%rcx,%r13,1), %r13
pop %rcx
pop %rax
pop %r15
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 8}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': True, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, '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
*/
|
src/kernel.asm | jwse2/MijnOS | 0 | 99682 | [BITS 16]
; [ORG SEG_KERNEL]
jmp near kernel
%include "src/const.inc"
msg_success db "Kernel has been loaded...", 0Dh, 0Ah, 0
cmd_bin db 'CMD BIN', 0
cmd_error db 'Could not load CMD.bin', 0Dh, 0Ah, 0
kernel_var dw 512
test_err db 'Test failed', 0Dh, 0Ah, 0
test_var times 32 db 0
test_name db 'ABCDEFGHEXT',0
;===============================================
; Entry point of the kernel module.
;===============================================
kernel:
mov ax,cs
mov ds,ax
mov es,ax
mov gs,ax ; NOTE: This is used for interrupt calls
add ax,400h ; 16kb
mov ss,ax
mov sp,4000h ; 16kb
; Indicator that we lsuccesfully loaded the kernel
mov si,msg_success
call print
%ifndef TESTING
; Regular operations
.clear:
call register_interrupts
call exec_cmd
%else
; Catches and displays the pressed key(s)
.keypress:
mov ah,00h
int 16h
movzx ax,al
call print_hex
call print_newline
jmp .keypress
%endif
jmp $
;===============================================
; [Internal]
; Starts the execution of the CMD program.
;===============================================
exec_cmd:
push ds
push es
push si
push di
push bx
;mov ds,ds
mov si,cmd_bin
mov bx,SEG_CMD
mov es,bx
xor di,di
call fat_loadFile
test ax,ax
jne .error
.success:
call SEG_CMD:0
jmp .return
.error:
mov si,cmd_error
call print
.return:
pop bx
pop di
pop si
pop es
pop ds
ret
;===============================================
; [Internal]
; Registers the interrupts.
;===============================================
register_interrupts:
push si
mov si,kernel_interrupts
mov ax,70h
call set_interrupt
pop si
ret
set_interrupt:
push es
push bx
mov bx,0 ; Segment ZERO
mov es,bx
mov bx,ax
shl bx,2
mov word [es:bx],si ; Function
mov word [es:bx+2],cs ; Segment
pop bx
pop es
ret
;===============================================
; [External]
; Set ax and than call int 70h. The input and
; output differs per request made.
;===============================================
kernel_interrupts:
push gs
push bx
mov bx,SEG_KERNEL ; Fail-safe
mov gs,bx
pop bx
cmp ax,INT_LOAD_FILE
je .loadFile
cmp ax,INT_READ_FILE
je .readFile
cmp ax,INT_WRITE_FILE
je .writeFile
cmp ax,INT_EXEC_PROGRAM
je .execProgram
cmp ax,INT_GPU_GRAPHICS
je .gpuGraphics
cmp ax,INT_GPU_TEXT
je .gpuText
cmp ax,INT_KEYPRESS
je .getChar
cmp ax,INT_GET_CURSOR_POS
je .getCursorPos
cmp ax,INT_SET_CURSOR_POS
je .setCursorPos
cmp ax,INT_DRAW_PIXEL
je .drawPixel
cmp ax,INT_DRAW_BUFFER
je .drawBuffer
cmp ax,INT_CLEAR_SCREEN
je .clearScreen
cmp ax,INT_PRINT_STRING
je .printString
cmp ax,INT_PRINT_HEX
je .printHex
cmp ax,INT_PRINT_CHAR
je .printChar
cmp ax,INT_PRINT_NEWLINE
je .printNewLine
cmp ax,INT_PRINTN_STRING
je .printNString
cmp ax,INT_PRINT_COLORED
je .printColored
.return:
pop gs
iret
; short ax loadFile( void * es:di , char * ds:si )
; short ax loadFile( void * dest, char * error )
.loadFile:
push bx
mov bx,cx
call fat_loadFile
mov word [ds:bx],ax
pop bx
jmp .return
; Reads a file into memory
; In:
; [ds:si] - File_name
; [es:di] - File_data
; cx - Maximum number of bytes
; Out:
; ax - File_size (-1 if error)
.readFile:
push bp
mov bp,sp
sub sp,4
mov word [bp-2],0FFFFh
mov word [bp-4],cx
.ro_size:
call fat_getFileSize
cmp ax,0FFFFh
je .ro_error0 ; error
cmp ax,word [bp-4]
ja .ro_error1 ; prevent buffer overflow
mov word [bp-2],ax
.ro_read:
call fat_loadFile
test ax,ax
jne .ro_error2 ; error
.ro_return:
mov ax,word [bp-2]
mov sp,bp
pop bp
jmp .return
.ro_error0:
mov word [bp-2],0FFFFh
jmp .ro_return
.ro_error1:
mov word [bp-2],0FFFEh
jmp .ro_return
.ro_error2:
mov word [bp-2],0FFFDh
jmp .ro_return
; Writes to a file
; [ds:si] File_name
; [es:di] File_data
; cx File_size
.writeFile:
push ds ; preserve
push es
push si
push di
push cx
push cx ; parameters are altered
push di ; so we can not pop them
push es ; off the stack to get
push si ; their original values
push ds ; back
call fat_writeFile2
add sp,10
pop cx ; restore
pop di
pop si
pop es
pop ds
jmp .return
; void ax execProgram( char * ds:si )
.execProgram:
; NOTE:
; Impossible as is, thus cmd should load
; it to the proper address and boot from
; that point onwards.
jmp .return
; void func(void)
.gpuGraphics:
push ax
mov ah,0
mov al,13h ; VGA / 16-colors / 320x200
int 10h
pop ax
jmp .return
; void func(void)
.gpuText:
push ax
mov ah,0
mov al,03h ; Text / 16-colors / 80x25
int 10h
pop ax
jmp .return
; short ax getChar( void )
.getChar:
mov ah,00h
int 16h
movzx ax,al
jmp .return
; ax, cx, dx
.getCursorPos:
mov bh,0
mov ah,3
int 10h
jmp .return
; NULL
.setCursorPos:
mov ah,2
mov bh,0
;mov dh,byte [row]
;mov dl,byte [column]
int 10h
jmp .return
; ax = INT_DRAW_PIXEL
; bx = color
; cx = x-pos
; dx = y-pos
.drawPixel:
push ax
push bx
mov ah,0Ch
mov al,bl
xor bx,bx
int 10h
pop bx
pop ax
jmp .return
; ax = INT_DRAW_BUFFER
; es:bx = source buffer
.drawBuffer: ; TODO:
pusha
push ds
push es
; Offsets
mov si,bx
xor di,di
; Setup the new segments
mov bx,es ; Source buffer
mov ds,bx
mov bx,0A000h ; Video memory
mov es,bx
; The count
mov cx,(160*100) ; All the pixels
rep movsb
pop es
pop ds
popa
jmp .return
; void clearScreen( void )
.clearScreen:
push ax
mov al,3
mov ah,0
int 10h
pop ax
jmp .return ; Cleared using video reset
; push ax ; Clearing using \r\n
; push bx
; xor ax,ax
; xor bx,bx
; mov bh,0
; mov ah,2
; mov dh,24 ; HEIGHT: 25-characters
; mov dl,79 ; WIDTH : 80-characters
; int 10h
; pop bx
; pop ax
; push cx
; mov cx,25
;.continue:
; call print_newline
; loop .continue
; pop cx
; jmp .return
; void printString( char * ds:si )
.printString:
call print
jmp .return
; void printHex( short cx )
.printHex:
mov ax,cx
call print_hex
jmp .return
; void printChar( char cl )
.printChar:
pusha
mov bh,0
mov bl,7
mov ax,cx
call print_char
popa
jmp .return
; void printNewLine( void )
.printNewLine:
call print_newline
jmp .return
; void printNString( char * ds:si, short cx )
.printNString:
call printn
jmp .return
.printColored:
pusha
mov ax,cx
mov cx,1
mov bh,0
call print_colored
popa
jmp .return
;===========
; DEPENDENCIES
;===========
%include "src/kernel/std.inc"
%include "src/kernel/fat12.inc"
%include "src/kernel/tests.inc"
;===========
; test_data
;===========
data_name db 'COPY01 TXT',0
data_buff times 510 db 1
.cluster1 times 4 db 2
data_size dw $-data_buff
|
src/arch/socs/stm32f429/Ada/soc-syscfg.ads | wookey-project/ewok-legacy | 0 | 16074 | --
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- 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 soc.layout;
with soc.gpio;
with system;
package soc.syscfg
with spark_mode => off
is
--------------------------------------------------
-- SYSCFG memory remap register (SYSCFG_MEMRMP) --
--------------------------------------------------
type t_SYSCFG_MEMRMP is record
MEM_MODE : bits_3;
reserved_3_7 : bits_5;
FB_MODE : bit;
reserved_9 : bit;
SWP_FMC : bits_2;
reserved_12_15 : bits_4;
reserved_16_31 : unsigned_16;
end record
with volatile_full_access, size => 32;
for t_SYSCFG_MEMRMP use record
MEM_MODE at 0 range 0 .. 2;
reserved_3_7 at 0 range 3 .. 7;
FB_MODE at 0 range 8 .. 8;
reserved_9 at 0 range 9 .. 9;
SWP_FMC at 0 range 10 .. 11;
reserved_12_15 at 0 range 12 .. 15;
reserved_16_31 at 0 range 16 .. 31;
end record;
----------------------------------------------------------------
-- SYSCFG peripheral mode configuration register (SYSCFG_PMC) --
----------------------------------------------------------------
type t_SYSCFG_PMC is record
reserved_0_15 : unsigned_16;
ADC1DC2 : bit;
ADC2DC2 : bit;
ADC3DC2 : bit;
reserved_19_22 : bits_4;
MII_RMII_SEL : bit;
reserved_24_31 : byte;
end record
with volatile_full_access, size => 32;
for t_SYSCFG_PMC use record
reserved_0_15 at 0 range 0 .. 15;
ADC1DC2 at 0 range 16 .. 16;
ADC2DC2 at 0 range 17 .. 17;
ADC3DC2 at 0 range 18 .. 18;
reserved_19_22 at 0 range 19 .. 22;
MII_RMII_SEL at 0 range 23 .. 23;
reserved_24_31 at 0 range 24 .. 31;
end record;
------------------------------------------------------------------------
-- SYSCFG external interrupt configuration registers (SYSCFG_EXTICRx) --
------------------------------------------------------------------------
type t_exticr_list is
array (soc.gpio.t_gpio_pin_index range <>) of soc.gpio.t_gpio_port_index
with pack;
type t_SYSCFG_EXTICR1 is record
exti : t_exticr_list (0 .. 3);
reserved : short;
end record
with pack, size => 32, volatile_full_access;
type t_SYSCFG_EXTICR2 is record
exti : t_exticr_list (4 .. 7);
reserved : short;
end record
with pack, size => 32, volatile_full_access;
type t_SYSCFG_EXTICR3 is record
exti : t_exticr_list (8 .. 11);
reserved : short;
end record
with pack, size => 32, volatile_full_access;
type t_SYSCFG_EXTICR4 is record
exti : t_exticr_list (12 .. 15);
reserved : short;
end record
with pack, size => 32, volatile_full_access;
-------------------------------------------------------
-- Compensation cell control register (SYSCFG_CMPCR) --
-------------------------------------------------------
type t_SYSCFG_CMPCR is record
CMP_PD : bit;
reserved_1_6 : bits_6;
READY : bit;
reserved_8_15 : byte;
reserved_16_31 : unsigned_16;
end record
with volatile_full_access, size => 32;
for t_SYSCFG_CMPCR use record
CMP_PD at 0 range 0 .. 0;
reserved_1_6 at 0 range 1 .. 6;
READY at 0 range 7 .. 7;
reserved_8_15 at 0 range 8 .. 15;
reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------------
-- SYSCFG peripheral --
-----------------------
type t_SYSCFG_periph is record
MEMRMP : t_SYSCFG_MEMRMP;
PMC : t_SYSCFG_PMC;
EXTICR1 : t_SYSCFG_EXTICR1;
EXTICR2 : t_SYSCFG_EXTICR2;
EXTICR3 : t_SYSCFG_EXTICR3;
EXTICR4 : t_SYSCFG_EXTICR4;
CMPCR : t_SYSCFG_CMPCR;
end record
with volatile;
for t_SYSCFG_periph use record
MEMRMP at 16#00# range 0 .. 31;
PMC at 16#04# range 0 .. 31;
EXTICR1 at 16#08# range 0 .. 31;
EXTICR2 at 16#0C# range 0 .. 31;
EXTICR3 at 16#10# range 0 .. 31;
EXTICR4 at 16#14# range 0 .. 31;
CMPCR at 16#20# range 0 .. 31;
end record;
SYSCFG : t_SYSCFG_periph
with
import,
volatile,
address => system'to_address (soc.layout.SYSCFG_BASE); -- 0x40013800
function get_exti_port
(pin : soc.gpio.t_gpio_pin_index)
return soc.gpio.t_gpio_port_index;
procedure set_exti_port
(pin : in soc.gpio.t_gpio_pin_index;
port : in soc.gpio.t_gpio_port_index);
end soc.syscfg;
|
src/drivers/sercom_u2201/sam-sercom-usart.adb | Fabien-Chouteau/samd51-hal | 1 | 16109 | <gh_stars>1-10
pragma Ada_2012;
package body SAM.SERCOM.USART is
---------------
-- Configure --
---------------
procedure Configure (This : in out USART_Device;
Baud : UInt16;
MSB_First : Boolean;
TX_Fall_RX_Rise : Boolean;
Parity : Boolean;
Synchronous_Com : Boolean;
RXPO : Pad_Id;
TXPO : Pad_Id;
Run_In_Standby : Boolean)
is
begin
This.Reset;
This.Periph.SERCOM_USART.CTRLA :=
(MODE => 1, -- USART with internal clock
RUNSTDBY => Run_In_Standby,
TXPO => UInt2 (TXPO),
RXPO => UInt2 (RXPO),
FORM => (if Parity then 1 else 0),
CMODE => Synchronous_Com,
CPOL => TX_Fall_RX_Rise,
DORD => not MSB_First,
others => <>);
This.Periph.SERCOM_USART.BAUD := Baud;
This.Config_Done := True;
end Configure;
---------------------
-- Enable_Receiver --
---------------------
procedure Enable_Receiver (This : in out USART_Device) is
begin
This.Periph.SERCOM_USART.CTRLB.RXEN := True;
end Enable_Receiver;
----------------------
-- Disable_Receiver --
----------------------
procedure Disable_Receiver (This : in out USART_Device) is
begin
This.Periph.SERCOM_USART.CTRLB.RXEN := False;
end Disable_Receiver;
------------------------
-- Enable_Transmitter --
------------------------
procedure Enable_Transmitter (This : in out USART_Device) is
begin
This.Periph.SERCOM_USART.CTRLB.TXEN := True;
end Enable_Transmitter;
-------------------------
-- Disable_Transmitter --
-------------------------
procedure Disable_Transmitter (This : in out USART_Device) is
begin
This.Periph.SERCOM_USART.CTRLB.TXEN := False;
end Disable_Transmitter;
------------------
-- Data_Address --
------------------
function Data_Address (This : USART_Device) return System.Address is
begin
return This.Periph.SERCOM_USART.DATA'Address;
end Data_Address;
---------------
-- Data_Size --
---------------
function Data_Size (Port : USART_Device) return UART_Data_Size is
begin
return HAL.UART.Data_Size_8b;
end Data_Size;
--------------
-- Transmit --
--------------
overriding
procedure Transmit (This : in out USART_Device;
Data : HAL.UART.UART_Data_8b;
Status : out HAL.UART.UART_Status;
Timeout : Natural := 1_000)
is
begin
for Elt of Data loop
This.Periph.SERCOM_USART.DATA := UInt32 (Elt);
while not This.Periph.SERCOM_USART.INTFLAG.DRE loop
null;
end loop;
end loop;
Status := Ok;
end Transmit;
--------------
-- Transmit --
--------------
overriding
procedure Transmit (This : in out USART_Device;
Data : HAL.UART.UART_Data_9b;
Status : out HAL.UART.UART_Status;
Timeout : Natural := 1_000)
is
begin
raise Program_Error with "Unimplemented procedure Transmit";
end Transmit;
-------------
-- Receive --
-------------
overriding
procedure Receive (This : in out USART_Device;
Data : out HAL.UART.UART_Data_8b;
Status : out HAL.UART.UART_Status;
Timeout : Natural := 1_000)
is
begin
for Elt of Data loop
while not This.Periph.SERCOM_USART.INTFLAG.RXC loop
null;
end loop;
Elt := UInt8 (This.Periph.SERCOM_USART.DATA);
end loop;
Status := Ok;
end Receive;
-------------
-- Receive --
-------------
overriding
procedure Receive (This : in out USART_Device;
Data : out HAL.UART.UART_Data_9b;
Status : out HAL.UART.UART_Status;
Timeout : Natural := 1_000)
is
begin
raise Program_Error with "Unimplemented procedure Receive";
end Receive;
end SAM.SERCOM.USART;
|
oeis/216/A216985.asm | neoneye/loda-programs | 11 | 16484 | ; A216985: Number of city-block distance 1, pressure limit 2 movements in an n X 2 array with each element moving exactly one horizontally or vertically, no element acquiring more than two neighbors, and without 2-loops.
; Submitted by <NAME>
; 0,2,14,80,436,2346,12578,67368,360720,1931306,10340030,55359176,296385268,1586804322,8495522018,45483800496,243513709632,1303737284978,6980021408654,37370028005408,200073740644948,1071165953874618,5734868039323202,30703656431035800,164382948617216400,880082600480515802,4711835322239698814,25226486799970465880,135058972300116487636,723086260223320919346,3871299557662168512578,20726379533925407801568,110966046978741658917120,594096212603525110718306,3180705444949926252575630
lpb $0
sub $0,1
add $2,2
sub $3,$4
add $3,$2
add $3,$2
add $4,$2
add $2,$3
add $2,$3
lpe
mov $0,$4
|
lib/types/Pointed.agda | danbornside/HoTT-Agda | 0 | 6495 | {-# OPTIONS --without-K #-}
open import lib.Basics
open import lib.types.Paths
open import lib.types.Pi
open import lib.types.Sigma
module lib.types.Pointed where
Ptd : ∀ i → Type (lsucc i)
Ptd i = Σ (Type i) (λ A → A)
Ptd₀ = Ptd lzero
⊙[_,_] : ∀ {i} (A : Type i) (a : A) → Ptd i
⊙[_,_] = _,_
_⊙→_ : ∀ {i j} → Ptd i → Ptd j → Ptd (lmax i j)
(A , a₀) ⊙→ (B , b₀) = ⊙[ Σ (A → B) (λ f → f a₀ == b₀) , ((λ _ → b₀), idp) ]
infixr 0 _⊙→_
_⊙×_ : ∀ {i j} → Ptd i → Ptd j → Ptd (lmax i j)
(A , a₀) ⊙× (B , b₀) = (A × B , (a₀ , b₀))
⊙fst : ∀ {i j} {X : Ptd i} {Y : Ptd j} → fst (X ⊙× Y ⊙→ X)
⊙fst = (fst , idp)
⊙snd : ∀ {i j} {X : Ptd i} {Y : Ptd j} → fst (X ⊙× Y ⊙→ Y)
⊙snd = (snd , idp)
⊙diag : ∀ {i} {X : Ptd i} → fst (X ⊙→ X ⊙× X)
⊙diag = ((λ x → (x , x)) , idp)
pair⊙→ : ∀ {i j k l} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} {W : Ptd l}
→ fst (X ⊙→ Y) → fst (Z ⊙→ W)
→ fst ((X ⊙× Z) ⊙→ (Y ⊙× W))
pair⊙→ (f , fpt) (g , gpt) =
((λ {(x , z) → (f x , g z)}) , pair×= fpt gpt)
infixr 4 _⊙∘_
⊙idf : ∀ {i} (X : Ptd i) → fst (X ⊙→ X)
⊙idf A = ((λ x → x) , idp)
⊙cst : ∀ {i j} {X : Ptd i} {Y : Ptd j} → fst (X ⊙→ Y)
⊙cst {Y = Y} = ((λ x → snd Y) , idp)
_⊙∘_ : ∀ {i j k} {X : Ptd i} {Y : Ptd j} {Z : Ptd k}
(g : fst (Y ⊙→ Z)) (f : fst (X ⊙→ Y)) → fst (X ⊙→ Z)
(g , gpt) ⊙∘ (f , fpt) = (g ∘ f) , (ap g fpt ∙ gpt)
⊙∘-unit-l : ∀ {i j} {X : Ptd i} {Y : Ptd j} (f : fst (X ⊙→ Y))
→ ⊙idf Y ⊙∘ f == f
⊙∘-unit-l (f , idp) = idp
⊙∘-assoc : ∀ {i j k l} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} {W : Ptd l}
(h : fst (Z ⊙→ W)) (g : fst (Y ⊙→ Z)) (f : fst (X ⊙→ Y))
→ ((h ⊙∘ g) ⊙∘ f) == (h ⊙∘ (g ⊙∘ f))
⊙∘-assoc (h , hpt) (g , gpt) (f , fpt) = pair= idp (lemma fpt gpt hpt)
where
lemma : ∀ {x₁ x₂} (fpt : x₁ == x₂) → ∀ gpt → ∀ hpt →
ap (h ∘ g) fpt ∙ ap h gpt ∙ hpt == ap h (ap g fpt ∙ gpt) ∙ hpt
lemma idp gpt hpt = idp
{- Obtaining equality of pointed types from an equivalence -}
⊙ua : ∀ {i} {A B : Type i} {a₀ : A} {b₀ : B}
(e : A ≃ B) → –> e a₀ == b₀ → ⊙[ A , a₀ ] == ⊙[ B , b₀ ]
⊙ua e p = pair= (ua e) (↓-idf-ua-in e p)
{- ⊙→ preserves hlevel -}
⊙→-level : ∀ {i j} {X : Ptd i} {Y : Ptd j} {n : ℕ₋₂}
→ has-level n (fst Y) → has-level n (fst (X ⊙→ Y))
⊙→-level pY = Σ-level (Π-level (λ _ → pY)) (λ _ → =-preserves-level _ pY)
{- function extensionality for pointed functions -}
⊙λ= : ∀ {i j} {X : Ptd i} {Y : Ptd j} {f g : fst (X ⊙→ Y)}
(p : ∀ x → fst f x == fst g x) (α : snd f == p (snd X) ∙ snd g)
→ f == g
⊙λ= {g = g} p α =
pair= (λ= p) (↓-app=cst-in (α ∙ ap (λ w → w ∙ snd g) (! (app=-β p _))))
{- Obtaining pointed maps from an pointed equivalence -}
module _ {i j} {X : Ptd i} {Y : Ptd j} (e : fst X ≃ fst Y)
(p : –> e (snd X) == snd Y) where
⊙–> : fst (X ⊙→ Y)
⊙–> = (–> e , p)
⊙<– : fst (Y ⊙→ X)
⊙<– = (<– e , ap (<– e) (! p) ∙ <–-inv-l e (snd X))
|
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0x48.log_21829_2372.asm | ljhsiun2/medusa | 9 | 101896 | <filename>Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0x48.log_21829_2372.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r14
push %r15
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x1b068, %r10
nop
nop
nop
nop
nop
add $82, %r13
mov (%r10), %rbp
nop
nop
nop
nop
cmp %rdx, %rdx
lea addresses_WC_ht+0x18f32, %r15
nop
sub $5550, %r14
movb (%r15), %r10b
nop
nop
and %r13, %r13
lea addresses_WC_ht+0x17edc, %r10
nop
nop
nop
nop
sub %r11, %r11
vmovups (%r10), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %r15
nop
nop
nop
add %rdx, %rdx
lea addresses_WC_ht+0x8502, %r14
nop
nop
nop
nop
nop
and %r13, %r13
mov $0x6162636465666768, %rdx
movq %rdx, %xmm6
and $0xffffffffffffffc0, %r14
movntdq %xmm6, (%r14)
nop
nop
sub $40203, %r13
lea addresses_A_ht+0x882, %r15
nop
nop
nop
xor %r11, %r11
movw $0x6162, (%r15)
nop
nop
cmp $30846, %r13
lea addresses_UC_ht+0x74a2, %r11
nop
nop
nop
nop
nop
sub $32036, %r14
mov $0x6162636465666768, %rdx
movq %rdx, (%r11)
cmp $29959, %rdx
lea addresses_WC_ht+0x11a2, %r13
nop
nop
nop
nop
nop
dec %r15
mov (%r13), %edx
nop
nop
nop
and $21261, %rdx
lea addresses_UC_ht+0x16a1a, %rsi
lea addresses_WC_ht+0x12ca2, %rdi
clflush (%rsi)
sub %r14, %r14
mov $114, %rcx
rep movsq
nop
inc %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r14
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %rax
push %rcx
push %rdi
push %rdx
// Faulty Load
mov $0xca2, %r11
nop
inc %rax
movaps (%r11), %xmm3
vpextrq $1, %xmm3, %rdx
lea oracles, %r14
and $0xff, %rdx
shlq $12, %rdx
mov (%r14,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': True, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': True, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 1, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': True, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'08': 3, '48': 14, 'ec': 3, 'ff': 1, '00': 21808}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
core/HoTT.agda | timjb/HoTT-Agda | 0 | 17035 | <gh_stars>0
{-# OPTIONS --without-K --rewriting #-}
module HoTT where
open import lib.Basics public
open import lib.Equivalence2 public
open import lib.NConnected public
open import lib.NType2 public
open import lib.Relation2 public
open import lib.Function2 public
open import lib.cubical.Cubical public
open import lib.types.Types public
open import lib.groups.Groups public
open import lib.groupoids.Groupoids public
open import lib.modalities.Modalities public
{-
To use coinduction in the form of [∞], [♭] and [♯] you can do:
open import HoTT
open Coinduction
You can also use coinductive records and copatterns instead, that’s prettier
(see experimental/GlobularTypes.agda for an example)
-}
module Coinduction where
open import lib.Coinduction public
-- deprecated operators
module _ where
infix 15 _∎
_∎ = _=∎
conn-elim = conn-extend
conn-elim-β = conn-extend-β
conn-elim-general = conn-extend-general
conn-intro = conn-in
if_then_else_ : ∀ {i} {A : Type i}
→ Bool → A → A → A
if true then t else e = t
if false then t else e = e
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0_notsx.log_21829_867.asm | ljhsiun2/medusa | 9 | 104580 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x1ba58, %rbp
and %r13, %r13
mov $0x6162636465666768, %rcx
movq %rcx, %xmm2
movups %xmm2, (%rbp)
nop
cmp $2597, %r11
lea addresses_WT_ht+0x1de58, %rdx
nop
nop
xor $20066, %rdi
mov (%rdx), %r15d
nop
nop
dec %rbp
lea addresses_WC_ht+0xd258, %rsi
lea addresses_UC_ht+0x55c4, %rdi
nop
nop
nop
inc %r15
mov $27, %rcx
rep movsq
nop
nop
nop
nop
nop
and $5637, %rbp
lea addresses_UC_ht+0xaad8, %rsi
lea addresses_WT_ht+0x19f58, %rdi
nop
nop
nop
add %r15, %r15
mov $71, %rcx
rep movsq
nop
nop
nop
nop
nop
inc %r13
lea addresses_UC_ht+0x18e58, %rsi
lea addresses_UC_ht+0x2658, %rdi
clflush (%rdi)
xor $60426, %rbp
mov $39, %rcx
rep movsl
nop
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_WC_ht+0x1cdb8, %rsi
lea addresses_UC_ht+0x14e58, %rdi
add %rbp, %rbp
mov $37, %rcx
rep movsw
nop
nop
nop
nop
nop
dec %r13
lea addresses_WC_ht+0x12658, %r13
sub %rdi, %rdi
mov (%r13), %r15d
nop
cmp %rsi, %rsi
lea addresses_UC_ht+0x1210e, %rbp
nop
nop
lfence
mov $0x6162636465666768, %r11
movq %r11, %xmm5
movups %xmm5, (%rbp)
nop
nop
nop
inc %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
// Faulty Load
lea addresses_UC+0x8658, %r9
nop
sub %r10, %r10
movb (%r9), %r13b
lea oracles, %rcx
and $0xff, %r13
shlq $12, %r13
mov (%rcx,%r13,1), %r13
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 1, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': True}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': True}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 1}}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
data/pokemon/base_stats/tauros.asm | Karkino/KarkCrystal16 | 0 | 18595 | db 0 ; species ID placeholder
db 75, 100, 95, 110, 40, 70
; hp atk def spd sat sdf
db NORMAL, NORMAL ; type
db 45 ; catch rate
db 211 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F0 ; gender ratio
db 100 ; unknown 1
db 20 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/tauros/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_SLOW ; growth rate
dn EGG_GROUND, EGG_GROUND ; egg groups
; tm/hm learnset
tmhm HEADBUTT, CURSE, TOXIC, ZAP_CANNON, ROCK_SMASH, SUNNY_DAY, SNORE, BLIZZARD, HYPER_BEAM, ICY_WIND, PROTECT, IRON_HEAD, THUNDER, EARTHQUAKE, RETURN, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, FIRE_BLAST, PURSUIT, REST, ATTRACT, SURF, STRENGTH, FLAMETHROWER, THUNDERBOLT, ICE_BEAM
; end
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_399.asm | ljhsiun2/medusa | 9 | 90733 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xe2a2, %r10
nop
nop
nop
nop
sub %r12, %r12
vmovups (%r10), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %rbp
nop
nop
cmp %rsi, %rsi
lea addresses_UC_ht+0xd092, %rsi
lea addresses_normal_ht+0x1702a, %rdi
nop
lfence
mov $54, %rcx
rep movsb
nop
add $31356, %r10
lea addresses_WC_ht+0x35a2, %r10
nop
inc %rbp
movb (%r10), %cl
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_WC_ht+0x15a82, %rsi
lea addresses_UC_ht+0x101ca, %rdi
nop
nop
inc %r15
mov $115, %rcx
rep movsb
nop
sub $60326, %rcx
lea addresses_WC_ht+0x1a122, %rcx
dec %rsi
mov $0x6162636465666768, %r12
movq %r12, %xmm0
movups %xmm0, (%rcx)
add $59676, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %rbp
push %rbx
push %rcx
push %rdi
// Faulty Load
lea addresses_WC+0x18f22, %rbp
nop
nop
nop
nop
dec %rcx
mov (%rbp), %ebx
lea oracles, %rbp
and $0xff, %rbx
shlq $12, %rbx
mov (%rbp,%rbx,1), %rbx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
spec/linux_spi_spidev_h.ads | 0xA1/pi-spi | 0 | 18088 | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with asm_generic_int_ll64_h;
package linux_spi_spidev_h is
-- unsupported macro: SPI_CPHA 0x01
-- unsupported macro: SPI_CPOL 0x02
-- unsupported macro: SPI_MODE_0 (0|0)
-- unsupported macro: SPI_MODE_1 (0|SPI_CPHA)
-- unsupported macro: SPI_MODE_2 (SPI_CPOL|0)
-- unsupported macro: SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
-- unsupported macro: SPI_CS_HIGH 0x04
-- unsupported macro: SPI_LSB_FIRST 0x08
-- unsupported macro: SPI_3WIRE 0x10
-- unsupported macro: SPI_LOOP 0x20
-- unsupported macro: SPI_NO_CS 0x40
-- unsupported macro: SPI_READY 0x80
-- unsupported macro: SPI_TX_DUAL 0x100
-- unsupported macro: SPI_TX_QUAD 0x200
-- unsupported macro: SPI_RX_DUAL 0x400
-- unsupported macro: SPI_RX_QUAD 0x800
SPI_IOC_MAGIC : aliased constant Character := 'k'; -- /usr/include/linux/spi/spidev.h:54
-- arg-macro: function SPI_MSGSIZE ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0
-- return (((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0;
-- arg-macro: procedure SPI_IOC_MESSAGE _IOW(SPI_IOC_MAGIC, 0, char(SPI_MSGSIZE(N)))
-- _IOW(SPI_IOC_MAGIC, 0, char(SPI_MSGSIZE(N)))
-- unsupported macro: SPI_IOC_RD_MODE _IOR(SPI_IOC_MAGIC, 1, __u8)
-- unsupported macro: SPI_IOC_WR_MODE _IOW(SPI_IOC_MAGIC, 1, __u8)
-- unsupported macro: SPI_IOC_RD_LSB_FIRST _IOR(SPI_IOC_MAGIC, 2, __u8)
-- unsupported macro: SPI_IOC_WR_LSB_FIRST _IOW(SPI_IOC_MAGIC, 2, __u8)
-- unsupported macro: SPI_IOC_RD_BITS_PER_WORD _IOR(SPI_IOC_MAGIC, 3, __u8)
-- unsupported macro: SPI_IOC_WR_BITS_PER_WORD _IOW(SPI_IOC_MAGIC, 3, __u8)
-- unsupported macro: SPI_IOC_RD_MAX_SPEED_HZ _IOR(SPI_IOC_MAGIC, 4, __u32)
-- unsupported macro: SPI_IOC_WR_MAX_SPEED_HZ _IOW(SPI_IOC_MAGIC, 4, __u32)
-- unsupported macro: SPI_IOC_RD_MODE32 _IOR(SPI_IOC_MAGIC, 5, __u32)
-- unsupported macro: SPI_IOC_WR_MODE32 _IOW(SPI_IOC_MAGIC, 5, __u32)
-- * include/linux/spi/spidev.h
-- *
-- * Copyright (C) 2006 SWAPP
-- * <NAME> <<EMAIL>>
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * This program is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- * GNU General Public License for more details.
-- *
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
--
-- User space versions of kernel symbols for SPI clocking modes,
-- * matching <linux/spi/spi.h>
--
-----------------------------------------------------------------------------
-- IOCTL commands
--*
-- * struct spi_ioc_transfer - describes a single SPI transfer
-- * @tx_buf: Holds pointer to userspace buffer with transmit data, or null.
-- * If no data is provided, zeroes are shifted out.
-- * @rx_buf: Holds pointer to userspace buffer for receive data, or null.
-- * @len: Length of tx and rx buffers, in bytes.
-- * @speed_hz: Temporary override of the device's bitrate.
-- * @bits_per_word: Temporary override of the device's wordsize.
-- * @delay_usecs: If nonzero, how long to delay after the last bit transfer
-- * before optionally deselecting the device before the next transfer.
-- * @cs_change: True to deselect device before starting the next transfer.
-- *
-- * This structure is mapped directly to the kernel spi_transfer structure;
-- * the fields have the same meanings, except of course that the pointers
-- * are in a different address space (and may be of different sizes in some
-- * cases, such as 32-bit i386 userspace over a 64-bit x86_64 kernel).
-- * Zero-initialize the structure, including currently unused fields, to
-- * accommodate potential future updates.
-- *
-- * SPI_IOC_MESSAGE gives userspace the equivalent of kernel spi_sync().
-- * Pass it an array of related transfers, they'll execute together.
-- * Each transfer may be half duplex (either direction) or full duplex.
-- *
-- * struct spi_ioc_transfer mesg[4];
-- * ...
-- * status = ioctl(fd, SPI_IOC_MESSAGE(4), mesg);
-- *
-- * So for example one transfer might send a nine bit command (right aligned
-- * in a 16-bit word), the next could read a block of 8-bit data before
-- * terminating that command by temporarily deselecting the chip; the next
-- * could send a different nine bit command (re-selecting the chip), and the
-- * last transfer might write some register values.
--
type spi_ioc_transfer is record
tx_buf : aliased asm_generic_int_ll64_h.uu_u64; -- /usr/include/linux/spi/spidev.h:90
rx_buf : aliased asm_generic_int_ll64_h.uu_u64; -- /usr/include/linux/spi/spidev.h:91
len : aliased asm_generic_int_ll64_h.uu_u32; -- /usr/include/linux/spi/spidev.h:93
speed_hz : aliased asm_generic_int_ll64_h.uu_u32; -- /usr/include/linux/spi/spidev.h:94
delay_usecs : aliased asm_generic_int_ll64_h.uu_u16; -- /usr/include/linux/spi/spidev.h:96
bits_per_word : aliased asm_generic_int_ll64_h.uu_u8; -- /usr/include/linux/spi/spidev.h:97
cs_change : aliased asm_generic_int_ll64_h.uu_u8; -- /usr/include/linux/spi/spidev.h:98
tx_nbits : aliased asm_generic_int_ll64_h.uu_u8; -- /usr/include/linux/spi/spidev.h:99
rx_nbits : aliased asm_generic_int_ll64_h.uu_u8; -- /usr/include/linux/spi/spidev.h:100
pad : aliased asm_generic_int_ll64_h.uu_u16; -- /usr/include/linux/spi/spidev.h:101
end record;
pragma Convention (C_Pass_By_Copy, spi_ioc_transfer); -- /usr/include/linux/spi/spidev.h:89
-- If the contents of 'struct spi_ioc_transfer' ever change
-- * incompatibly, then the ioctl number (currently 0) must change;
-- * ioctls with constant size fields get a bit more in the way of
-- * error checking than ones (like this) where that field varies.
-- *
-- * NOTE: struct layout is the same in 64bit and 32bit userspace.
--
-- not all platforms use <asm-generic/ioctl.h> or _IOC_TYPECHECK() ...
-- Read / Write of SPI mode (SPI_MODE_0..SPI_MODE_3) (limited to 8 bits)
-- Read / Write SPI bit justification
-- Read / Write SPI device word length (1..N)
-- Read / Write SPI device default max speed hz
-- Read / Write of the SPI mode field
end linux_spi_spidev_h;
|
alloy4fun_models/trashltl/models/5/2tbqDXXw4PoEpSSMo.als | Kaixi26/org.alloytools.alloy | 0 | 2237 | <filename>alloy4fun_models/trashltl/models/5/2tbqDXXw4PoEpSSMo.als
open main
pred id2tbqDXXw4PoEpSSMo_prop6 {
always File in Trash
}
pred __repair { id2tbqDXXw4PoEpSSMo_prop6 }
check __repair { id2tbqDXXw4PoEpSSMo_prop6 <=> prop6o } |
tests/avr_sources/test.asm | DannyHavenith/avrgo | 1 | 169142 | LDD r0, Y+1
LDD r1, Y+2
|
rtcClock2.asm | electrickery/RTC-MPF-I | 0 | 15299 | ; RTC & CTC demo program for MicroProfessor MPF-I(B)
; Based on Zilog Z80 Family Data Book, January 1989, p 366
; by fjkraan@electrickery 2022-01-28
; z80asm version (https://github.com/udo-munk/z80pack/tree/master/z80asm)
; This program assumes a CTC at port 40h and the standard MPF-I(B) hex
; display.
; MPF-I CPU clock: 1.79 MHz. A prescaler of 256 and a time constant of 84
; and a division of again 83 in the ISR results in a counter update
; interval of approx. 1 s.
; RTCCLOCK version 0.3, 2022-02-05
; Memory organisation
RAM: EQU 1980h
ROM: EQU 2200h
RAMSIZ: EQU 90h
; CTC ports
CTCBASE:EQU 40h
CTC0: EQU CTCBASE + 0 ;CTC 0 PORT
CTC1: EQU CTCBASE + 1 ;CTC 1 PORT
CTC2: EQU CTCBASE + 2 ;CTC 2 PORT
CTC3: EQU CTCBASE + 3 ;CTC 3 PORT
LITES: EQU 0C0h ;LIGHT PORT for debug
; CTC Constants
CCW: EQU 1
INTEN: EQU 80h ; Interrupt enable
CTRMODE:EQU 40h ; Counter mode
P256: EQU 20h ; Prescaler 256
RISEDO: EQU 10h ; Rising Edge Trigger
PSTRT: EQU 8 ; Trigger by CLK/TRG
TCLOAD: EQU 4 ; Time constant in following byte load (TIME)
RESET: EQU 2 ; Software Reset
TIMER: EQU 84 ; CTC TIMER VALUE
COUNTER:EQU 83 ; ISR COUNT value
; PIO ports
PIOBASE:EQU 080h
PIODA: EQU PIOBASE + 0 ; DATA PORT OF PIO CHANNEL A; address & control: output
R_ADCT: EQU PIODA
PIODB: EQU PIOBASE + 1 ; DATA PORT OF PIO CHANNEL B; data read/write: input & output
R_DATA: EQU PIODB
PIOCA: EQU PIOBASE + 2 ; CONTROL PORT OF PIO CHANNEL A; address & control: output
R_ACDR: EQU PIOCA
PIOCB: EQU PIOBASE + 3 ; CONTROL PORT OF PIO CHANNEL B; data read/write: input & output
R_DDRR: EQU PIOCB ; rtc data port direction register
; PIO Constants
PIODW: EQU 00001111b ; mode 0: output
PIODR: EQU 01001111b ; mode 1: input
PIOICW: EQU 00000111b ; Interrupt Control Word: disable interrupt
PIOIDW: EQU 00000011b ; Interrupt Disable Word: disable interrupt
; Z80 PIO bits to MSM5832 RTC pin mapping
RTCHOLD EQU 010h
RTCREAD EQU 020h
RTCWRIT EQU 040h
RTCDMSK EQU 00Fh ; RTC address mask
RTCNORD EQU RTCREAD ^ 0FFh
RTCNOWR EQU RTCWRIT ^ 0FFh
; masks in dual BCD mode as used in READ_C and WRITE_C
RTC_MIM EQU 01111111b ; minute mask
RTC_AM EQU 00000000b ;
RTC_PM EQU 01000000b ; the PM clock bit
RTC_12h EQU 00000000b ;
RTC_24h EQU 10000000b ; the 24 hour clock bit in dual BCD mode
RTC_HRM EQU (RTC_PM | RTC_24h) ^ 0FFh ; reverse mask for the extra bits
RTC_lpy EQU 01000000b ; leap year flag for Feb 29, D2 > bit 6
RTC_DYM EQU RTC_lpy ^ 0FFh ; reverse mask
RTC_MNM EQU 00011111b ; month mask
; MSM5832 registers: most values use two addresses, but not the day-in-week
SC1AD: EQU 0 ; second
MI1AD: EQU 2 ; minute
HR1AD: EQU 4 ; hour, HR10AD uses D2 for AM/PM, D3 for 12/24 hour clock
WDAD: EQU 6 ; day-in-week
DY1AD: EQU 7 ; day-in month
MO1AD: EQU 9 ; month
YR1AD: EQU 11 ; year in century
; DJNZ = (13 Tstates) * W150C + 8 T states. (152,5 us + 4.5 us) = 157 us
W150C: EQU 21 ; ~150us at 1.79 MHz
; Monitor ROM routines
SCAN: EQU 05FEh ;
SCAN1: EQU 0624h ; input: (IX), output: carry & A
HEX7SEG:EQU 0678h ; input: A (2 * BCD), output (HL). HL+2
; RAM organisation
ORG RAM
MANBUF: ; buffer to store BCD values when manually setting time and date
DEFB 00 ; seconds MANBUF+0
DEFB 00 ; minutes MANBUF+1
DEFB 00 ; hours MANBUF+2
DEFB 00 ; day-of-week
DEFB 00 ; days MANBUF+4
DEFB 00 ; months MANBUF+5
DEFB 00 ; years MANBUF+6
RTCBUF: ; data here stored as binary
DEFB 00 ; seconds RTCBUF+0
DEFB 00 ; minutes RTCBUF+1
DEFB 00 ; hours RTCBUF+2
DEFB 00 ; day-of-week
DEFB 00 ; days RTCBUF+4
DEFB 00 ; months RTCBUF+5
DEFB 00 ; years RTCBUF+6
DISPBUF: ; six digits, from right to left
DEFW 0000 ; seconds / years
DEFW 0000 ; minutes / months
DEFW 0000 ; hours / days
DEFS 64 ;STACK AREA
STAK: EQU $
COUNT: DEFS 1 ;ICT COUNT VALUE
SECFLAG:DEFS 1 ; second boundary flag, triggers RTCBUF update
RTCRDFL:DEFS 1 ; clock update from RTC flag, triggers READ_C call
POINTON:DEFS 1 ; point on right digit on flag, used to flag an RTC access
POINTBT:EQU 01000000b ; the point is bit 6. UM, p37
MROFFS: EQU RTCBUF - MANBUF ; This offset is handy with LD (IX+MROFFS),A
RB_SC: EQU RTCBUF + 0
RB_MI: EQU RTCBUF + 1
RB_HR: EQU RTCBUF + 2
;; *** MAIN PROGRAM ***
ORG ROM
JP BEGIN
SETRTC:
CALL SETRBUF
RST 0
GETRTC:
CALL READ_C
RST 0
ORG $ & 0FFF0h | 10h
INTVEC:
DEFW ICTC0
DEFW ICTC1
DEFW ICTC2
DEFW ICTC3
BEGIN:
LD SP,STAK ;INIT SP
IM 2 ;VECTOR INTERRUPT MODE
LD A,INTVEC / 256 ;UPPER VECTOR BYTE
LD I,A
CALL INIT ;INIT DEVICES (CTC & memory)
LD A, 1
LD (RTCRDFL), A ; trigger RTC read
EI ;ALLOW INTERRUPTS
LOOP:
LD A, (SECFLAG)
CP 1
LD A, 0 ; clear secflag, regardless of state
LD (SECFLAG), A
JP NZ, NO_SEC ; part below only once per second
LD A, (RTCRDFL)
CP 1
JR NZ, NO_RTC ;
CALL READ_C
NO_RTC: ; no RTC access
CALL UPDTIME
NO_SEC: ; no second passed
CALL DSP ; Show time on display
JR LOOP ;LOOP FOREVER
INIT:
; PIO Channel pre-config
LD A, PIOIDW
OUT (PIOCA), A ; channel A interrupt disable
OUT (PIOCB), B ; channel B interrupt disable
; PIO Channel A final configuration, address & control port
LD A, 0h
OUT (R_ADCT), A ; zero addr/ctrl before setting output mode
LD A, PIODW
OUT (R_ACDR), A ; addr/ctrl port, channel A output mode
; PIO Channel B initial configuration, data port
LD A, 0h
OUT (R_ADCT), A ; zero data before setting output mode
LD A, PIODR
OUT (R_DDRR), A ; data port, channel B input mode
; CTC0 init
LD A, INTEN + P256 + TCLOAD + RESET + CCW
OUT (CTC0), A ;SET CTC MODE
LD A, TIMER
OUT (CTC0), A ;SET TIME CONSTANT
LD A, INTVEC & 11111110b
OUT (CTC0), A ;SET VECTOR VALUE
LD A, COUNTER ;INIT COUNTER VALUE
LD (COUNT), A
XOR A
LD (SECFLAG), A
; display memory init
LD (DISPBUF), A ; clear display buffer
LD (DISPBUF + 1), A
LD (DISPBUF + 2), A
LD (DISPBUF + 3), A
LD (DISPBUF + 4), A
LD (DISPBUF + 5), A
LD A, 01010101b
OUT (LITES), A
RET
UPDTIME:
; update seconds up to 60
; update minutes up to 60 when seconds == 60, reset seconds
; update hours up to 24 when minutes == 60, reset minutes
; update date when hours == 24, reset hours
; ....
LD A, (RB_SC)
INC A
CP 60
JR Z, UT_S0
LD (RB_SC), A
JR UPDDONE
UT_S0:
LD A, 0
LD (RB_SC), A ; set seconds to zero
LD A, (RB_MI)
INC A ; update minutes
CP 60
JR Z, UT_M0
LD (RB_MI), A
JR UPDDONE
UT_M0:
LD A, 1
LD (RTCRDFL), A ; set flag to trigger RTC read
LD A, 0
LD (RB_MI), A ; set minutes to zero
LD A, (RB_HR)
INC A ; update hours
CP 24
JR Z, UT_H0
LD (RB_HR), A
JR UPDDONE
UT_H0: ; date update not implemented yet;
LD A, 0
LD (RB_HR), A ; set hours to zero
UPDDONE:
RET
DSP:
LD HL, DISPBUF ; point to rightmost value
LD BC, RTCBUF
LD A, (BC)
CALL BIN2BCD
CALL HEX7SEG
CALL POINTM
INC BC ; points to minutes value
LD A, (BC)
CALL BIN2BCD
CALL HEX7SEG
INC BC ; points to hours value
LD A, (BC)
CALL BIN2BCD
CALL HEX7SEG
LD IX, DISPBUF
CALL SCAN1 ; call ROM display routine
RET
POINTM:
PUSH AF
LD A, (POINTON)
ADD A, 0
JR Z, PNTMNOT
LD A, (DISPBUF)
OR POINTBT
LD (DISPBUF), A
PNTMNOT:
POP AF
RET
READ_C:
LD A, 1
LD (POINTON), A ; set flag for the rightmost display dot
LD A, PIODR
OUT (R_DDRR), A ; data port, channel B input mode
LD A, RTCHOLD
OUT (R_ADCT), A ; assert HOLD
CALL WAIT150u
LD HL, RTCBUF
LD A, SC1AD ; second nibbles
CALL RD2NIB
CALL BCD2BIN
LD (HL), A ; store in buffer
INC HL
LD A, MI1AD ; minute nibbles
CALL RD2NIB
AND RTC_MIM
CALL BCD2BIN
LD (HL), A ; store in buffer
OUT (LITES), A ; debug
INC HL
LD A, HR1AD
CALL RD2NIB ; hour nibbles
AND RTC_HRM ; mask off PM & 24h bits
CALL BCD2BIN
LD (HL), A ; store in buffer
INC HL
LD A, WDAD ; week-day nibble
CALL RD1NIB
LD (HL), A ; store in buffer
INC HL
LD A, DY1AD ; day-of month nibbles
CALL RD2NIB
AND RTC_DYM ; mask leap year flag
CALL BCD2BIN
LD (HL), A ; store in buffer
INC HL
LD A, MO1AD ; month nibbles
CALL RD2NIB
CALL BCD2BIN
LD (HL), A ; store in buffer
INC HL
LD A, YR1AD ; year in century nibbles
CALL RD2NIB
CALL BCD2BIN
LD (HL), A ; store in buffer
LD A, 0
OUT (R_ADCT), A ; de-assert HOLD
RET
RD1NIB: ; read one nibble, expects RTC address in A,
PUSH BC
OR RTCHOLD
LD C, A ; keep address + HOLD
OUT (R_ADCT), A ; address + HOLD out
OR RTCHOLD | RTCREAD
OUT (R_ADCT), A ; address + HOLD + READ out
IN A, (R_DATA) ; data in
AND RTCDMSK ; mask upper nibble
LD B, A ; keep value from RTC
LD A, C
OUT (R_ADCT), A ; address + HOLD out
LD A, B
POP BC
RET
RD2NIB: ; read two consecutive nibbles, expects
; first RTC address in A
PUSH BC
LD B, A ; keep address
CALL RD1NIB
LD C, A ; keep lower nibble
LD A, B ; restore address
INC A ; point to next
CALL RD1NIB
RLC A ; shift to upper nibble
RLC A
RLC A
RLC A
OR C ; combine nibbles
POP BC
RET
WRITE_R:
CALL WRITE_C
RST 0
WRITE_C:
LD A, PIODW
OUT (R_DDRR), A ; data port, channel B output mode
LD A, RTCHOLD
OUT (R_ADCT), A
CALL WAIT150u
LD HL, RB_SC
LD A, (HL)
CALL BIN2BCD
LD B, A
LD A, SC1AD | RTCHOLD ; second nibbles
CALL WR2NIB
INC HL ; RB_MI
LD A, (HL)
CALL BIN2BCD
LD B, A
LD A, MI1AD | RTCHOLD ; minute nibbles
CALL WR2NIB
INC HL ; RB_HR
LD A, (HL)
CALL CALCPM
CALL BIN2BCD
OR C ; add the 24 hour and optional PM clock bits
LD B, A
LD A, HR1AD | RTCHOLD
CALL WR2NIB ; hour nibbles
INC HL
LD A, (HL)
CALL BIN2BCD
LD B, A
LD A, WDAD | RTCHOLD ; day-of-week nibble
CALL WR1NIB
INC HL
LD A, (HL)
CALL BIN2BCD
LD B, A
LD A, DY1AD | RTCHOLD
CALL WR2NIB ; day-of-month nibbles
INC HL
LD A, (HL)
CALL BIN2BCD
LD B, A
LD A, MO1AD | RTCHOLD
CALL WR2NIB ; month nibbles
INC HL
LD A, (HL)
CALL BIN2BCD
LD B, A
LD A, YR1AD | RTCHOLD
CALL WR2NIB ; year-in-century nibbles
LD A, 0
OUT (R_ADCT), A ; de-assert HOLD
LD A, PIODR
OUT (R_DDRR), A ; data port, channel B input mode
RET
WR1NIB: ; write a nibble from (HL) to RTC
OUT (R_ADCT), A ; address & hold out
LD C, R_DATA
OUT (C), B ; data out
OR RTCWRIT
OUT (R_ADCT), A ; assert write
AND RTCNOWR
OUT (R_ADCT), A ; de-assert write
RET
WR2NIB: ; write nibbles from (HL) and (HL+1) to RTC
PUSH AF ; save RTC address
CALL WR1NIB
POP AF ; restore RTC address
INC A ; point to next 10's address, HOLD not effected
RRC B
RRC B
RRC B
RRC B
CALL WR1NIB
RET
CALCPM:
PUSH AF
LD C, RTC_24h ; preset for AM pattern
CP 12
JR C, CPLOW
LD C, RTC_24h | RTC_PM ; override with PB pattern
CPLOW:
POP AF
RET
WAIT150u:
PUSH AF
PUSH BC
LD B, W150C
W150LP:
DJNZ W150LP ; Wait
POP BC
POP AF
RET
BCD2BIN:
; input; A contains 2 BCD digits - MSN and LSN
; output; A contains a binary value
PUSH BC
PUSH AF
AND 0F0h ; create MSN value only
RRCA
LD C, A ; keep MSN * 8
RRCA
RRCA
ADD A, C ; add MSN * 2 to MSN * 8
LD C, A ; keep the MSN * 10
POP AF
AND 00Fh ; create LSN value only
ADD A, C ; create complete binary value
POP BC
RET
BIN2BCD:
; input; A contains a binary value less than 100 (MSNb & LSNb)
; output; A contains two BCD digits - MSN and LSN
PUSH BC
LD B, 0 ; start with zero MSB
BI2BLP SUB 10
JP C, BI2BRY ; done counting 10s
INC B
JR BI2BLP ; continue until A < 10
BI2BRY ADD A, 10 ; compensate
RLC B ; move 10s to upper nibble
RLC B
RLC B
RLC B
ADD A, B ; merge nibbles
POP BC
RET
SETRBUF:
LD IX, MANBUF ; point to RTCBUF seconds
LD A, (IX + 0) ; load from MANBUF seconds
CALL BCD2BIN
LD (IX + MROFFS), A ; store to RTCBUF seconds
INC IX
LD A, (IX + 0) ; minutes
CALL BCD2BIN
LD (IX + MROFFS), A ;
INC IX
LD A, (IX + 0) ; hours
CALL BCD2BIN
LD (IX + MROFFS), A ;
INC IX
LD A, (IX + 0) ; day of week
CALL BCD2BIN
LD (IX + MROFFS), A ;
INC IX
LD A, (IX + 0) ; day of month
CALL BCD2BIN
LD (IX + MROFFS), A ;
INC IX
LD A, (IX + 0) ; months
CALL BCD2BIN
LD (IX + MROFFS), A ;
INC IX
LD A, (IX + 0) ; years
CALL BCD2BIN
LD (IX + MROFFS), A ;
INC IX
CALL WRITE_C
; RST 0 ; return to monitor
; JP READ_C
RET
; INTERRUPT SERVICE ROUTINES
ICTC1:
ICTC2:
ICTC3:
EI
RETI ;DUMMY ROUTINES
ICTC0:
PUSH AF
LD A, (COUNT) ;CHANGE TIMER COUNT
DEC A
LD (COUNT), A
CP 0
JR NZ, IC0DONE ; (COUNT) not yet zero, exit ISR
LD A, COUNTER ;ELSE, RESET COUNTER VALUE
LD (COUNT), A
LD A, 1
LD (SECFLAG), A
IC0DONE:
POP AF
EI
RETI
END
|
code/decoder.asm | corollari/BaaCL | 1 | 96010 |
;ax=byte counter
;bx=tree pointer
;cx=text pointer
;dl=byte holder
;dh=shift counter
%define len 290 ; <-- REWORK (check if it works and change const dinamically)
%define text $512
mov ax, encoded ; encoded tag should be in output/encoded.asm
mv cx, text
mv dh, $7
mov bh, 0x7C
; while(ax<len(encoded)):
startloop:
cmp ax,len+encoded
jge display ; Check if the order used in cmp is correct (jump if ax>=len), display tag should be in display.asm
mov bx,root
innerloop:
cmp dh, $7
jne shift
mov dl,[ax]
inc ax
mov dh, $0
jmp aftershift
shift:
shr dl, $1
inc dh
aftershift:
;bx=[bx+dx&&1]
and dl, $1
jnz else
and [bx+2], ~1
mov bl, [bx]
jmp afterelse
else:
and [bx+2], ~2
mov bl, [bx+1]
afterelse:
jnz innerloop
mov [cx],bx
inc cx
jmp startloop
|
Models/Car System module/CarSystem003/CarSystem003HighBeam.asm | fmselab/ABZ2020CaseStudyInAsmeta | 0 | 24449 | <reponame>fmselab/ABZ2020CaseStudyInAsmeta
//Third refinement of Adaptive Exterior Light and Speed Control System
//Hight Beam
//from ELS-30 to ELS-38
module CarSystem003HighBeam
import ../../StandardLibrary
import CarSystem003Domains
import ../CarSystem002/CarSystem002Functions
export *
signature:
enum domain CameraState = {CAMERA_READY | CAMERA_DIRTY | CAMERA_NOTREADY} // Camera state
enum domain CruiseControlMode = {CCM0 | CCM1 | CCM2}
enum domain PitmanArmForthBack = {BACKWARD | FORWARD | NEUTRAL_FB} // Pitman arm positions - horizontal position
domain HighBeamMotor subsetof Integer // High beam illumination distance
//0=65,1=100,2 = 120, 3 = 140, 4 = 160, 5= 180, 6 = 200, 7=220, etc. See table at page 23.
// FUNCTIONS
monitored cameraState: CameraState // Camera state: ready, dirty or not ready
monitored oncomingTraffic: Boolean // Camera signal to detect oncoming vehicles. True -> vehicles oncoming, False -> no vehicles
monitored pitmanArmForthBack: PitmanArmForthBack // Position of the pitman arm - horizontal position
monitored cruiseControlMode: CruiseControlMode // State of cruise control
controlled highBeamOn: Boolean // High beam headlights (left and right) are on (True) or not (False)
controlled highBeamRange: HighBeamRange // High beam luminous strenght
controlled highBeamMotor: HighBeamMotor // Control the high beam illumination - 20m step size
//controlled lightRotarySwitchPrevious: LightSwitch // Position of the light rotary switch in the previous state
controlled pitmanArmForthBackPrevious: PitmanArmForthBack // Position of the pitman arm - horizontal position - in the previous state
controlled setVehicleSpeed: CurrentSpeed // Desired speed in case an adaptive cruise control is part of the vehicle
derived adaptiveHighBeamActivated: Boolean
derived adaptiveHighBeamDeactivated: Boolean
derived headlampFlasherActivated: Boolean //Temporary activation of the high beam (without engaging, so-called flasher)
derived headlampFlasherDeactivated: Boolean
derived headlampFixedActivated: Boolean //Fixed activation of the high beam
derived headlampFixedDeactivated: Boolean
derived drivesFasterThan: Prod(CurrentSpeed,Integer) -> Boolean
derived lightIlluminationDistance: CurrentSpeed -> HighBeamMotor
derived luminousStrength: CurrentSpeed -> HighBeamRange
derived calculateSpeed: CurrentSpeed
static percentageHBM: Integer -> HighBeamMotor
definitions:
// DOMAIN DEFINITIONS
domain HighBeamMotor = {0..14}
// FUNCTION DEFINITIONS
//Formulas for graphs in Figure 7 and 8 (as "reverse engineered")
//Figure 7
//f(x) = x^2.2 * 0.0025 + 95 if x <= 171
//f(x) = 300 if x > 171
//Figure 8
//f(x) = (7*x+60)/9
function percentageHBM($x in Integer) =
if $x <= 65 then 0
else if $x <= 100 then 1
else if $x <= 120 then 2
else if $x <= 140 then 3
else if $x <= 160 then 4
else if $x <= 180 then 5
else if $x <= 200 then 6
else if $x <= 220 then 7
else if $x <= 240 then 8
else if $x <= 260 then 9
else if $x <= 280 then 10
else if $x <= 300 then 11
else if $x <= 320 then 12
else if $x <= 340 then 13
else if $x <= 360 then 14
endif endif endif endif endif endif endif endif endif endif endif endif endif endif endif
//ELS-36
//Formulas for graphs in Figure 7 and 8 (as "reverse engineered")
function lightIlluminationDistance($y in CurrentSpeed) =
let ($x = $y/10) in
if ($x <= 171.0 ) then percentageHBM(rtoi($x * $x * 2.0 * 0.00025 + 95.0))
else 11 //300 m
endif
endlet
function luminousStrength($x in CurrentSpeed) =
if $x <= 1200 then rtoi((7*$x/10 + 60.0)/9.0)
else 100
endif
//ELS-37 If an adaptive cruise control is part of the vehicle, the light illumination distance is not calculated upon the actual
//vehicle speed but the target speed provided by the advanced cruise control.
function calculateSpeed =
if (cruiseControlMode=CCM2) then setVehicleSpeed
else currentSpeed
endif
function drivesFasterThan($speed in CurrentSpeed, $x in Integer) =
$speed >= $x //faster than $x km/h
//ELS32 If the light rotary switch is in position Auto, the adaptive high beam is activated by moving the pitman arm to the back
function adaptiveHighBeamActivated =
(lightRotarySwitch = AUTO and engineOn(keyState) and pitmanArmForthBack = BACKWARD)
//ELS-38 If the pitman arm is moved again in the horizontal neutral position, the adaptive high beam headlight is deactivated.
function adaptiveHighBeamDeactivated =
(lightRotarySwitch = AUTO and pitmanArmForthBack = NEUTRAL_FB and pitmanArmForthBackPrevious = BACKWARD)
function headlampFlasherActivated =
(pitmanArmForthBack = FORWARD and pitmanArmForthBackPrevious = NEUTRAL_FB)
function headlampFlasherDeactivated =
(pitmanArmForthBack = NEUTRAL_FB and pitmanArmForthBackPrevious = FORWARD)
function headlampFixedActivated =
(pitmanArmForthBack = BACKWARD and lightRotarySwitch = ON and (keyState = KEYINSERTED or engineOn(keyState)))
function headlampFixedDeactivated =
//( (pitmanArmForthBack = NEUTRAL_FB and pitmanArmForthBackPrevious = BACKWARD and lightRotarySwitch = ON) or lightRotarySwitch = OFF or keyState = NOKEYINSERTED)
( (pitmanArmForthBack = NEUTRAL_FB and pitmanArmForthBackPrevious = BACKWARD and lightRotarySwitch = ON) or
((lightRotarySwitch = OFF or keyState = NOKEYINSERTED) and not headlampFlasherActivated))
macro rule r_set_high_beam_headlights($v in Boolean, $d in HighBeamMotor, $l in HighBeamRange) =
par
highBeamOn := $v
highBeamMotor := $d
highBeamRange := $l
endpar
macro rule r_Manual_high_beam_headlights =
par
//ELS-30
if headlampFlasherActivated then
r_set_high_beam_headlights[true,14,100] //max illumination area 360m, 100% luminous strenght (percentage)
endif
//ELS-30-31
if headlampFlasherDeactivated or headlampFixedDeactivated then
highBeamOn := false
endif
//ELS-31
if headlampFixedActivated then
r_set_high_beam_headlights[true,7,100] //illumination area of 220m, 100% luminous strenght (percentage)
endif
endpar
//ELS-33 @E_MAPE_HBH
//Sets the values, as calculated by the planner, for the lighting high beam actuators: highBeamOn to activate and deactivate the high beam,
//highBeamRange to control the high beam luminous, and highBeamMotor to control the high beam illumination distance.
macro rule r_Execute_HBH ($setHighBeam in Boolean, $setHighBeamMotor in HighBeamMotor, $setHighBeamRange in HighBeamRange) =
r_set_high_beam_headlights[$setHighBeam,$setHighBeamMotor,$setHighBeamRange]
//ELS-33 @P_MAPE_HBH
//Plans street illumination according to the characteristic curves for light illumination distance and for luminous strength
//depending on the vehicle speed
macro rule r_IncreasingPlan_HBH =
let ($d = lightIlluminationDistance(calculateSpeed), $l = luminousStrength(calculateSpeed)) in
r_Execute_HBH[true,$d,$l]
endlet
//ELS-34 @P_MAPE_HBH
//Reduce street illumination by reducing the area of illumination to 65 meters by an adjustment of the headlight position
//as well as by reduction of the luminous strength to 30%.
//depending on the vehicle speed
macro rule r_DecreasingPlan_HBH =
r_Execute_HBH[true,30,0]
//ELS-33-34-35 @MA_MAPE_HBH
//All MAPE computations of the MAPE loop are executed within one single ASM-step machine.
//Note that we do not model the time constraints ('within 2 seconds', 'within 0.5 seconds')
macro rule r_Monitor_Analyze_HBH =
if adaptiveHighBeamActivated then
par
if drivesFasterThan(currentSpeed,300) and not oncomingTraffic then //ELS-33 ELS-35 (checks if adaptation is necessary)
//the street should be illuminated accordingly
r_IncreasingPlan_HBH[]
endif
if oncomingTraffic then //ELS-34 (checks if adaptation is necessary)
//an activated high beam headlight is reduced to low beam headlight.
r_DecreasingPlan_HBH[]
endif
endpar
endif
macro rule r_MAPE_HBH = //MAPE loop may start and stop
par
r_Monitor_Analyze_HBH[]
if adaptiveHighBeamDeactivated then highBeamOn := false endif //ELS-38 If the pitman arm is moved again in the horizontal neutral position, //the adaptive high beam headlight is deactivated.
endpar
macro rule r_HighBeam =
par
pitmanArmForthBackPrevious := pitmanArmForthBack
r_Manual_high_beam_headlights[]
r_MAPE_HBH[]
endpar
|
libsrc/graphics/drawbox.asm | grancier/z180 | 0 | 18790 | <filename>libsrc/graphics/drawbox.asm
SECTION code_clib
PUBLIC drawbox
EXTERN plotpixel
;
; $Id: drawbox.asm,v 1.6 2016/04/13 21:09:09 dom Exp $
;
; ***********************************************************************
;
; Clear specified graphics area in map.
; Generic version
;
; <NAME> - March 2002
;
;
; IN: HL = (x,y)
; BC = (width,heigth)
;
.drawbox
push bc
push hl
; -- Vertical lines --
push hl
ld a,h
add a,b
ret c ; overflow ?
dec a
ld h,a
pop de
.rowloop
push bc
push hl
push de
ld de, p_RET1
push de
jp (ix) ; execute PLOT at (h,l)
.p_RET1
pop de
pop hl
inc l
ex de,hl
push hl
push de
ld de, p_RET2
push de
jp (ix) ; execute PLOT at (h,l)
.p_RET2
pop de
pop hl
inc l
ex de,hl
pop bc
dec c
jr nz,rowloop
pop hl
pop bc
; -- Horizontal lines --
push hl
ld a,l
add a,c
ret c ; overflow ?
dec a
ld l,a
pop de
.vrowloop
push bc
push hl
push de
ld de, p_RET3
push de
jp (ix) ; execute PLOT at (h,l)
.p_RET3
pop de
pop hl
inc h
ex de,hl
push hl
push de
ld de, p_RET4
push de
jp (ix) ; execute PLOT at (h,l)
.p_RET4
pop de
pop hl
inc h
ex de,hl
pop bc
djnz vrowloop
ret
|
smallbinaries/Dockerfile.nasm | ldemailly/experimental | 0 | 96388 | <reponame>ldemailly/experimental
FROM alpine:3.6
RUN apk update && apk add nasm gcc musl-dev make
# RUN apk add libc-dev
WORKDIR /exp
COPY . .
|
Appl/GeoCalc/Document/documentChart.asm | steakknife/pcgeos | 504 | 4173 | <reponame>steakknife/pcgeos
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: documentChart.asm
AUTHOR: <NAME>
METHODS:
Name Description
---- -----------
FUNCTIONS:
Scope Name Description
----- ---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 12/26/91 Initial version.
DESCRIPTION:
$Id: documentChart.asm,v 1.1 97/04/04 15:48:06 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
|
source/oasis/program-elements-object_declarations.ads | reznikmm/gela | 0 | 4624 | -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Declarations;
with Program.Elements.Defining_Identifiers;
with Program.Lexical_Elements;
with Program.Elements.Definitions;
with Program.Elements.Expressions;
with Program.Elements.Aspect_Specifications;
package Program.Elements.Object_Declarations is
pragma Pure (Program.Elements.Object_Declarations);
type Object_Declaration is
limited interface and Program.Elements.Declarations.Declaration;
type Object_Declaration_Access is access all Object_Declaration'Class
with Storage_Size => 0;
not overriding function Names
(Self : Object_Declaration)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Vector_Access is abstract;
not overriding function Object_Subtype
(Self : Object_Declaration)
return not null Program.Elements.Definitions.Definition_Access
is abstract;
not overriding function Initialization_Expression
(Self : Object_Declaration)
return Program.Elements.Expressions.Expression_Access is abstract;
not overriding function Aspects
(Self : Object_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access is abstract;
not overriding function Has_Aliased
(Self : Object_Declaration)
return Boolean is abstract;
not overriding function Has_Constant
(Self : Object_Declaration)
return Boolean is abstract;
type Object_Declaration_Text is limited interface;
type Object_Declaration_Text_Access is
access all Object_Declaration_Text'Class with Storage_Size => 0;
not overriding function To_Object_Declaration_Text
(Self : in out Object_Declaration)
return Object_Declaration_Text_Access is abstract;
not overriding function Colon_Token
(Self : Object_Declaration_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Aliased_Token
(Self : Object_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Constant_Token
(Self : Object_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Assignment_Token
(Self : Object_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function With_Token
(Self : Object_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Semicolon_Token
(Self : Object_Declaration_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Object_Declarations;
|
oeis/076/A076339.asm | neoneye/loda-programs | 11 | 173556 | <gh_stars>10-100
; A076339: Primes of the form 512*k+1.
; Submitted by <NAME>
; 7681,10753,11777,12289,13313,15361,17921,18433,19457,23041,25601,26113,32257,36353,37889,39937,40961,45569,50177,51713,58369,59393,61441,64513,65537,67073,70657,76289,76801,79873,80897,81409,83969,84481,86017,87041,87553,95233,96769,101377,102913,112129,113153,114689,115201,118273,119297,119809,120833,125441,133121,133633,136193,138241,143873,147457,151553,153089,155137,158209,159233,161281,163841,168449,170497,176129,176641,183809,184321,187393,188417,202753,211457,211969,216577,219649,220673
mov $1,35
mov $2,$0
add $2,6
pow $2,2
lpb $2
add $1,24
sub $2,1
mov $3,$1
add $1,4
add $3,5
mul $3,8
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,36
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
sub $0,995
mul $0,8
add $0,7681
|
src/agda/FRP/JS/DOM.agda | agda/agda-frp-js | 63 | 14373 | open import FRP.JS.Bool using ( Bool )
open import FRP.JS.RSet using ( RSet ; ⟦_⟧ ; ⟨_⟩ ; _⇒_ )
open import FRP.JS.Behaviour using ( Beh ; map2 )
open import FRP.JS.Event using ( Evt ; ∅ ; _∪_ ; map )
open import FRP.JS.Product using ( _∧_ ; _,_ )
open import FRP.JS.String using ( String )
module FRP.JS.DOM where
infixr 2 _≟*_
infixr 4 _++_ _+++_
postulate
Mouse Keyboard : RSet
EventType : RSet → Set
click : EventType Mouse
press : EventType Keyboard
{-# COMPILED_JS click "click" #-}
{-# COMPILED_JS press "press" #-}
postulate
DOW : Set
unattached : DOW
left right : DOW → DOW
child : String → DOW → DOW
events : ∀ {A} → EventType A → DOW → ⟦ Evt A ⟧
{-# COMPILED_JS unattached require("agda.frp").unattached() #-}
{-# COMPILED_JS left function(w) { return w.left(); } #-}
{-# COMPILED_JS right function(w) { return w.right(); } #-}
{-# COMPILED_JS child function(a) { return function(w) { return w.child(a); }; } #-}
{-# COMPILED_JS events function(A) { return function(t) { return function(w) { return function(s) { return w.events(t); }; }; }; } #-}
postulate
DOM : DOW → RSet
text : ∀ {w} → ⟦ Beh ⟨ String ⟩ ⇒ Beh (DOM w) ⟧
attr : ∀ {w} → String → ⟦ Beh ⟨ String ⟩ ⇒ Beh (DOM w) ⟧
element : ∀ a {w} → ⟦ Beh (DOM (child a w)) ⇒ Beh (DOM w) ⟧
[] : ∀ {w} → ⟦ Beh (DOM w) ⟧
_++_ : ∀ {w} → ⟦ Beh (DOM (left w)) ⇒ Beh (DOM (right w)) ⇒ Beh (DOM w) ⟧
{-# COMPILED_JS attr function(w) { return function(k) { return function(s) { return function(b) { return b.attribute(k); }; }; }; } #-}
{-# COMPILED_JS text function(w) { return function(s) { return function(b) { return b.text(); }; }; } #-}
{-# COMPILED_JS element function(a) { return function(w) { return function(s) { return function(b) { return w.element(a,b); }; }; }; } #-}
{-# COMPILED_JS [] function(w) { return require("agda.frp").empty; } #-}
{-# COMPILED_JS _++_ function(w) { return function(s) { return function(a) { return function(b) { return a.concat(b); }; }; }; } #-}
listen : ∀ {A w} → EventType A → ⟦ Beh (DOM w) ⇒ Evt A ⟧
listen {A} {w} t b = events t w
{-# COMPILED_JS listen function(A) { return function(w) { return function(t) { return function(s) { return function(b) { return w.events(t); }; }; }; }; } #-}
private
postulate
_≟_ : ∀ {w} → ⟦ DOM w ⇒ DOM w ⇒ ⟨ Bool ⟩ ⟧
{-# COMPILED_JS _≟_ function(w) { return function(s) { return function(a) { return function(b) { return a.equals(b); }; }; }; } #-}
_≟*_ : ∀ {w} → ⟦ Beh (DOM w) ⇒ Beh (DOM w) ⇒ Beh ⟨ Bool ⟩ ⟧
_≟*_ = map2 _≟_
[+] : ∀ {A w} → ⟦ Beh (DOM w) ∧ Evt A ⟧
[+] = ([] , ∅)
_+++_ : ∀ {A w} → ⟦ (Beh (DOM (left w)) ∧ Evt A) ⇒ (Beh (DOM (right w)) ∧ Evt A) ⇒ (Beh (DOM w) ∧ Evt A) ⟧
(dom₁ , evt₁) +++ (dom₂ , evt₂) = ((dom₁ ++ dom₂) , (evt₁ ∪ evt₂))
text+ : ∀ {A w} → ⟦ Beh ⟨ String ⟩ ⇒ (Beh (DOM w) ∧ Evt A) ⟧
text+ msg = (text msg , ∅)
attr+ : ∀ {A w} → String → ⟦ Beh ⟨ String ⟩ ⇒ (Beh (DOM w) ∧ Evt A) ⟧
attr+ key val = (attr key val , ∅)
element+ : ∀ a {A w} → ⟦ (Beh (DOM (child a w)) ∧ Evt A) ⇒ (Beh (DOM w) ∧ Evt A) ⟧
element+ a (dom , evt) = (element a dom , evt)
listen+ : ∀ {A B w} → EventType A → ⟦ A ⇒ B ⟧ → ⟦ (Beh (DOM w) ∧ Evt B) ⇒ (Beh (DOM w) ∧ Evt B) ⟧
listen+ t f (dom , evt) = (dom , map f (listen t dom) ∪ evt)
|
src/examples/Rejuvenation_Workshop/src/count_subprogram.ads | selroc/Renaissance-Ada | 1 | 10125 | package Count_Subprogram is
procedure P2A (x, y : Integer);
procedure P2B (x : Integer; y : Integer);
procedure P4A (k, l, m, n : Integer);
procedure P4B (k : Integer; l : Integer; m : Integer; n : Integer);
procedure P3A (x, y, z : Integer);
procedure P3B (x, y : Integer; z : Integer);
procedure P3C (x : Integer; y, z : Integer);
procedure P3D (x : Integer; y : Integer; z : Integer);
procedure P3E (x, y, z : Integer) is null;
procedure P3F (x : Integer; y : Integer; z : Integer) is null;
procedure P3G (x : Integer := 0; y : Integer := 1; z : Integer := 2);
procedure P3H (x, y, z : Integer := 0);
procedure P3I (x, y, z : in Integer);
procedure P3J (x, y, z : in out Integer);
procedure P3K (x, y, z : out Integer);
procedure P3L (x, y, z : Integer) renames P3A;
procedure P3M (a, b, c : Integer) renames P3A;
generic
type Element_T is private;
procedure P3N (x, y, z : Element_T);
generic
type Element_T is private;
procedure P3O (x : Element_T; y : Element_T; z : Element_T);
generic
with procedure P3P (x, y, z : Integer);
with procedure P3Q (x : Integer; y : Integer; z : Integer);
package My_Package is
end My_Package;
type Callback_Procedure_A is access procedure (x, y, z : Integer);
type Callback_Procedure_B is access procedure (x : Integer; y : Integer; z : Integer);
procedure S1 (Call_Back : access procedure (x, y, z : Integer));
procedure S2 (Call_Back : access procedure (x : Integer; y : Integer; z : Integer));
function F3A (x, y, z : Integer) return Integer is (x + y + z);
function F3B (x : Integer; y : Integer; z : Integer) return Integer is (x + y + z);
function F3Z (x, y, z : Integer) return Integer;
private
function F3Z (x, y, z : Integer) return Integer is (x + y + z);
end Count_Subprogram;
|
src/geste-physics.ads | Fabien-Chouteau/GESTE | 13 | 742 | ------------------------------------------------------------------------------
-- --
-- GESTE --
-- --
-- Copyright (C) 2018 <NAME> --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. 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. --
-- --
------------------------------------------------------------------------------
with GESTE.Maths_Types; use GESTE.Maths_Types;
package GESTE.Physics is
type Object is tagged limited private;
procedure Step (This : in out Object;
Elapsed : Value);
-- Compute the new state (acceleration, speed, position) of the object given
-- the time elapsed since last call to Step.
function Mass (This : Object) return Value;
-- Current mass of the object
procedure Set_Mass (This : in out Object;
M : Value);
-- Set the mass of the object
function Position (This : Object) return GESTE.Maths_Types.Point;
-- Current position of the object
procedure Set_Position (This : in out Object;
P : GESTE.Maths_Types.Point);
-- Set the position of the object. This is recomended only for initilization
-- (or teleportation :). During normal operation the position should be
-- computed from the speed in the Step procedure.
function Angle (This : Object) return Value;
-- Current angle of the object
procedure Set_Angle (This : in out Object;
Angle : Value);
-- Set the angle of the object
function Direction (This : Object) return Vect;
-- Return a normalized vector of where the object is pointing. This vector
-- is computed from the Angle of the object.
function Speed (This : Object) return Vect;
-- Current speed vecto of the object
procedure Set_Speed (This : in out Object;
S : Vect);
-- Set the speed of the object. This is recomended only for initilization.
-- During normal operation the speed should be computed from the
-- acceleration in the Step procedure.
function Acceleration (This : Object) return Vect;
-- Current acceleration vector of the object
procedure Set_Acceleration (This : in out Object;
A : Vect);
-- Set the acceleration of the object. This is recomended only for
-- initilization. During normal operation the acceleration should
-- be computed from the forces in the Step procedure.
function Force (This : Object) return Vect;
-- Sum of the current forces applied to the object. This is cleared during a
-- during call to Step.
procedure Apply_Force (This : in out Object;
F : Vect);
-- Apply a force vector to the object
procedure Apply_Gravity (This : in out Object;
G : Value := 9.51);
-- Gravity helper procedure. Applies a G * Mass downwards force vector
private
type Hit_Box_Kind is (None, Rectangle, Rect_Borders, Circle, Line);
type Hit_Box_Type (Kind : Hit_Box_Kind := Rectangle) is record
case Kind is
when None =>
null;
when Rectangle | Rect_Borders =>
Width : Value;
Height : Value;
when Circle =>
Radius : Value;
when Line =>
End_X_Offset : Value;
End_Y_Offset : Value;
end case;
end record;
procedure Set_Hit_Box (This : in out Object; Box : Hit_Box_Type);
function Hit_Box (This : Object) return Hit_Box_Type;
function Collide (This : Object; Obj : Object'Class) return Boolean;
-- Return True of two objects colide with each other
type Object is tagged limited record
Box : Hit_Box_Type := (Kind => None);
P : GESTE.Maths_Types.Point := Origin;
M : Value := 0.0;
S : Vect := No_Speed;
A : Vect := No_Acceleration;
F : Vect := No_Force;
Angle : Value := 0.0;
end record;
end GESTE.Physics;
|
src/core/obs/t01.asm | Hiroshi123/bin_tools | 0 | 166546 | <filename>src/core/obs/t01.asm
global __get_ntdll_handle_64
global __get_ntdll_handle_64_end
global __enumerate_import_table_2
global __enumerate_import_table_2_end
global __enumerate_export_table_2
global __enumerate_export_table_2_end
section .text
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
__get_ntdll_handle_64:
;;; mov rax, [fs:0x30] for 32bit
mov rax,[gs:0x60 ]
mov rax,[rax+0x18]
mov rax,[rax+0x10]
mov rax,[rax+0x0 ]
mov rax,[rax+0x30]
ret
__get_ntdll_handle_64_end:
nop
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
__enumerate_import_table_2:
call _get_ldr_data_table_entry_1
mov rcx,[rax+0x30]
call _get_import_entry_from_handle_1
;; let 3rd 2nd
mov r8,rdx
;; set 2nd argument
mov rdx,rax
call _enumerate_import_table_3
;; mov rax,[rax]
ret
_get_import_entry_from_handle_1:
mov rax,rcx
mov rbx,0
mov ebx,[rax+0x3c]
add ebx,0x90
;; add rax,0x18 + 0x70
mov ebx,[rax+rbx]
add rax,rbx
ret
_get_ldr_data_table_entry_1:
mov rax,[gs:0x60]
;;; access peb_led_data
mov rax,[rax+0x18]
;;; in load order module list
mov rax,[rax+0x10]
jmp _get_ldr_data_table_entry_1._l1
._l0:
mov rax,[rax+0x0]
dec rcx
._l1:
cmp rcx,0
jne _get_ldr_data_table_entry_1._l0
ret
enu_get_ldr_data_table_entry_1:
mov rax,[gs:0x60]
;; access peb_led_data
mov rax,[rax+0x18]
;; in load order module list
mov rax,[rax+0x10]
jmp _get_ldr_data_table_entry_1._l1
._l0:
mov rax,[rax+0x0]
dec rcx
._l1:
cmp rcx,0
jne _get_ldr_data_table_entry_1._l0
ret
;;; ; 1st :: base address
;;; ; 2nd ;; import entry
;;; ; 3rd :: pointer to callback
_enumerate_import_table_3:
;;; base of module
mov r13,rcx
;;; heads of import table
mov r14,rdx
;;; call back address
mov r15,r8
;;; ; ;;;;;;;;; start to read each value of import descripor
._l0:
;;; import name table entry
mov rdi,0
mov edi,[r14+0x00]
;;; add module base
add rdi,r13
;;; import address table entry
mov rsi,0
mov esi,[r14+0x10]
;;; add module base
add rsi,r13
mov rbx,0
mov ebx,[r14+0x0c]
mov r12,rbx
add r12,r13
._l1:
;;; import name table
mov r8,[rdi]
add r8,r13
add r8,0x2
;;; import address table
mov r9,[rsi]
add r9,r13
add r9,0x2
;;; if import address table & import name table points to same address,
;;; it means this is the end of an import address & name table on
;;; an image import descriptor.
cmp r8,r9
je _enumerate_import_table_3._l2
mov rdx,r12
mov rcx,r14
sub rsp,0x20
call r15
add rsp,0x20
;;; increment import address table & import name table
add qword rdi,0x8
add qword rsi,0x8
jmp _enumerate_import_table_3._l1
._l2:
add r14,0x14
;;; the end of import descriptor table is null
cmp qword [r14],0
jne _enumerate_import_table_3._l0
._l3:
ret
;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
__enumerate_import_table_2_end:
__enumerate_export_table_2:
call _get_ldr_data_table_entry_1
mov rcx,[rax+0x30]
call _get_export_entry_from_handle_1
;;; let 3rd 2nd
mov r8,rdx
;;; set 2nd argument
mov rdx,rax
call _enumerate_export_table_3
ret
_get_export_entry_from_handle_1:
mov rax,rcx
mov rbx,0
mov ebx,[rax+0x3c]
add ebx,0x88
;; add rax,0x18 + 0x70
mov ebx,[rax+rbx]
add rax,rbx
ret
_enumerate_export_table_3:
;;; r13 == module_base
mov rsi,rcx
;;; head of entry directory
mov rdi,rdx
mov rax,0
;;; entry directory heads + 0x20 is the first export name table
mov eax,[rdi+0x20]
add rax,rsi
;;; r12 == index
mov r12,0
;;; r15 [pointer to callback]
mov r15,r8
;;; head of export name table
mov r14,rax
;;; r13 == number of entry on name index table
mov rbx,0
mov ebx,[rdi+0x18]
mov r13,rbx
._l0:
;;; 1st argument
mov rcx,rsi
;;; 2nd arugment
mov rdx,rdi
;;; 3rd argument[function address]
mov r8,r12
call _get_faddr_by_index_3
;;; as callee volatile rdi & rsi,
;;; original value needs to be reset here.
mov rdi,rdx
mov rsi,rcx
;; 2nd arg
mov rdx,rax
mov rbx,0
mov ebx,[r14+r12*4]
add rbx,rsi
;; 1st arg
mov rcx,rbx
sub rsp,0x20
call r15
add rsp,0x20
add r12,1
cmp r12,r13
jne _enumerate_export_table_3._l0
mov rax,rbx
ret
;;; ; 3 argument
;;; ; 1st[rcx] :: base address of the module
;;; ; 2nd[rdx] :: base address of export entry directory
;;; ; 3rd[r8 ] :: function index
;;; ; return value[rax] :: function address
_get_faddr_by_index_3:
mov rdi,0
mov rsi,0
;;; directory entry + 0x1c (address of functions,[4byte])
mov edi,[rdx+0x1c]
;;; directory entry + 0x24 (address of ordinals [4byte])
mov esi,[rdx+0x24]
;;; add module base as they are relative.
add rdi,rcx
add rsi,rcx
;;; from function index to function ordinal
shl r8,1
mov rbx,0
mov bx,[rsi+r8]
;;; from function ordinal to function address
shl rbx,2
mov rax,0
mov eax,[rdi+rbx]
add rax,rcx
;;;
ret
__enumerate_export_table_2_end: |
4-high/gel/source/joint/gel-hinge_joint.adb | charlie5/lace | 20 | 10810 | <reponame>charlie5/lace
with
physics.Object,
ada.unchecked_Deallocation;
package body gel.hinge_Joint
is
use gel.Joint;
procedure define (Self : access Item; in_Space : in std_physics.Space.view;
Sprite_A, Sprite_B : access gel.Sprite.item'Class;
pivot_Axis : in Vector_3;
pivot_Anchor : in Vector_3)
is
pivot_in_A : constant Vector_3 := (pivot_Anchor - Sprite_A.Site);
pivot_in_B : constant Vector_3 := (pivot_Anchor - Sprite_B.Site);
the_Axis : constant Vector_3 := pivot_Axis;
begin
Self.define (in_Space,
Sprite_A, Sprite_B,
the_Axis,
pivot_in_A, pivot_in_B,
low_Limit => to_Radians (-180.0),
high_Limit => to_Radians ( 180.0),
collide_Conected => False);
end define;
procedure define (Self : access Item; in_Space : in std_physics.Space.view;
Sprite_A, Sprite_B : access gel.Sprite.item'Class;
pivot_Axis : in Vector_3)
is
Midpoint : constant Vector_3 := (Sprite_A.Site + Sprite_B.Site) / 2.0;
begin
Self.define (in_Space,
Sprite_A,
Sprite_B,
pivot_Axis,
pivot_anchor => Midpoint);
end define;
procedure define (Self : access Item; in_Space : in std_physics.Space.view;
Sprite_A, Sprite_B : access gel.Sprite.item'Class;
Frame_A, Frame_B : in Matrix_4x4;
low_Limit : in Real := to_Radians (-180.0);
high_Limit : in Real := to_Radians ( 180.0);
collide_Conected : in Boolean)
is
A_Frame : constant Matrix_4x4 := Frame_A;
B_Frame : constant Matrix_4x4 := Frame_B;
type Joint_cast is access all gel.Joint.item;
sprite_A_Solid,
sprite_B_Solid : std_physics.Object.view;
begin
if Sprite_A = null
or Sprite_B = null
then
raise Error with "Sprite is null.";
end if;
sprite_A_Solid := std_physics.Object.view (Sprite_A.Solid);
sprite_B_Solid := std_physics.Object.view (Sprite_B.Solid);
joint.define (Joint_cast (Self), Sprite_A, Sprite_B); -- Define base class.
Self.Physics := in_Space.new_hinge_Joint (sprite_A_Solid, sprite_B_Solid,
A_Frame, B_Frame,
low_Limit, high_Limit,
collide_Conected);
end define;
procedure define (Self : access Item; in_Space : in std_physics.Space.view;
Sprite_A : access gel.Sprite.item'Class;
Frame_A : in Matrix_4x4)
is
type Joint_cast is access all gel.Joint.item;
A_Frame : constant Matrix_4x4 := Frame_A;
sprite_A_Solid : std_physics.Object.view;
begin
joint.define (Joint_cast (Self), Sprite_A, null); -- Define base class.
sprite_A_Solid := std_physics.Object.view (Sprite_A.Solid);
Self.Physics := in_Space.new_hinge_Joint (sprite_A_Solid,
A_Frame);
end define;
procedure define (Self : access Item; in_Space : in std_physics.Space.view;
Sprite_A,
Sprite_B : access gel.Sprite.item'Class;
pivot_Axis : in Vector_3;
Anchor_in_A,
Anchor_in_B : in Vector_3;
low_Limit,
high_Limit : in Real;
collide_Conected : in Boolean)
is
type Joint_cast is access all gel.Joint.item;
sprite_A_Solid,
sprite_B_Solid : std_physics.Object.view;
begin
if Sprite_A = null
or Sprite_B = null
then
raise Error with "Attempt to join a null sprite.";
end if;
sprite_A_Solid := std_physics.Object.view (Sprite_A.Solid);
sprite_B_Solid := std_physics.Object.view (Sprite_B.Solid);
Joint.define (Joint_cast (Self), Sprite_A, Sprite_B); -- Define base class.
Self.Physics := in_Space.new_hinge_Joint (sprite_A_Solid, sprite_B_Solid,
Anchor_in_A, Anchor_in_B,
pivot_Axis,
low_Limit, high_Limit,
collide_Conected);
end define;
overriding
procedure destroy (Self : in out Item)
is
my_Physics : std_physics.Joint.view := std_physics.Joint.view (Self.Physics);
procedure deallocate is new ada.unchecked_Deallocation (std_physics.Joint.item'Class,
std_physics.Joint.view);
begin
my_Physics.destruct;
deallocate (my_Physics);
Self.Physics := null;
end destroy;
--------------
--- Attributes
--
overriding
function Degrees_of_freedom (Self : in Item) return joint.degree_of_Freedom
is
pragma unreferenced (Self);
begin
return 1;
end Degrees_of_freedom;
function Angle (Self : in Item'Class) return Real
is
begin
raise Error with "TODO";
return 0.0;
end Angle;
overriding
function Frame_A (Self : in Item) return Matrix_4x4
is
begin
return Self.Physics.Frame_A;
end Frame_A;
overriding
function Frame_B (Self : in Item) return Matrix_4x4
is
begin
return Self.Physics.Frame_B;
end Frame_B;
overriding
procedure Frame_A_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.Physics.Frame_A_is (Now);
end Frame_A_is;
overriding
procedure Frame_B_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.Physics.Frame_B_is (Now);
end Frame_B_is;
overriding
function Physics (Self : in Item) return joint.Physics_view
is
begin
return Joint.Physics_view (Self.Physics);
end Physics;
----------------
--- Joint Limits
--
procedure Limits_are (Self : in out Item'Class; Low, High : in Real;
Softness : in Real := 0.9;
bias_Factor : in Real := 0.3;
relaxation_Factor : in Real := 1.0)
is
begin
Self.low_Bound := Low;
Self.high_Bound := High;
Self.Softness := Softness;
Self.bias_Factor := bias_Factor;
Self.relaxation_Factor := relaxation_Factor;
end Limits_are;
procedure apply_Limits (Self : in out Item)
is
begin
Self.Physics.Limits_are (Self.low_Bound,
Self.high_Bound,
Self.Softness,
Self.bias_Factor,
Self.relaxation_Factor);
end apply_Limits;
-- Bounds - limits the range of motion for a Degree of freedom.
--
overriding
function low_Bound (Self : access Item; for_Degree : in joint.Degree_of_freedom) return Real
is
use type joint.Degree_of_freedom;
begin
if for_Degree /= Revolve then
raise Error with "Invalid degree of freedom:" & for_Degree'Image;
end if;
return Self.low_Bound;
end low_Bound;
overriding
procedure low_Bound_is (Self : access Item; for_Degree : in joint.Degree_of_freedom;
Now : in Real)
is
use type joint.Degree_of_freedom;
begin
if for_Degree /= Revolve then
raise Error with "Invalid degree of freedom:" & for_Degree'Image;
end if;
Self.low_Bound := Now;
Self.apply_Limits;
end low_Bound_is;
overriding
function high_Bound (Self : access Item; for_Degree : in joint.Degree_of_freedom) return Real
is
use type joint.Degree_of_freedom;
begin
if for_Degree /= Revolve then
raise Error with "Invalid degree of freedom:" & for_Degree'Image;
end if;
return Self.high_Bound;
end high_Bound;
overriding
procedure high_Bound_is (Self : access Item; for_Degree : in joint.Degree_of_freedom;
Now : in Real)
is
use type joint.Degree_of_freedom;
Span : Real := abs (Now) * 2.0;
begin
if for_Degree /= Revolve then
raise Error with "Invalid degree of freedom:" & for_Degree'Image;
end if;
Self.high_Bound := Now;
Self.apply_Limits;
end high_Bound_is;
overriding
function Extent (Self : in Item; for_Degree : in Degree_of_freedom) return Real
is
use type joint.Degree_of_freedom;
begin
if for_Degree /= Revolve then
raise Error with "Invalid degree of freedom:" & for_Degree'Image;
end if;
return Self.Angle;
end Extent;
overriding
function is_Bound (Self : in Item; for_Degree : in joint.Degree_of_freedom) return Boolean
is
begin
return Self.Physics.is_Limited (for_Degree);
end is_Bound;
overriding
procedure Velocity_is (Self : in Item; for_Degree : in joint.Degree_of_freedom;
Now : in Real)
is
begin
self.Physics.Velocity_is (Now, for_Degree);
end Velocity_is;
end gel.hinge_Joint;
|
src/transistor_acsweep_3.als | hemmerling/spice-schaltungssimulation | 0 | 1229 | <filename>src/transistor_acsweep_3.als
* Schematics Aliases *
.ALIASES
R_RC RC(1=$N_0002 2=$N_0001 )
Q_T1 T1(c=$N_0002 b=$N_0003 e=$N_0004 )
R_R2 R2(1=0 2=$N_0003 )
V_VB VB(+=$N_0001 -=0 )
R_R1 R1(1=$N_0003 2=$N_0001 )
R_RE RE(1=0 2=$N_0004 )
V_Vin Vin(+=$N_0005 -=0 )
C_C2 C2(1=$N_0002 2=$N_0006 )
R_RL RL(1=0 2=$N_0006 )
C_C1 C1(1=$N_0005 2=$N_0003 )
.ENDALIASES
|
src/main/antlr4/org/gu/dcore/antlr4/QUERY.g4 | sharpen70/Drewer | 0 | 1546 | <reponame>sharpen70/Drewer<gh_stars>0
grammar QUERY;
/*
* Parser Rules
*/
query : ansVar ':-' atomset '.' EOF ;
ansVar : '?' '(' terms ')' | '?()';
atomset : atom | atom ',' atomset ;
atom : predicate | predicate '(' terms ')' ;
terms : term | term ',' terms ;
term : BRACKETED | DESCRIPTION | STRING;
predicate : BRACKETED | DESCRIPTION ;
/*
* Lexer Rules
*/
BRACKETED : '<' (~[>])+ '>' ;
DESCRIPTION : [a-zA-Z][a-zA-Z0-9_#:/'.''~'-]* ;
STRING : '"' (~["])+ '"' ;
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines.
|
oeis/083/A083550.asm | neoneye/loda-programs | 11 | 101041 | <reponame>neoneye/loda-programs
; A083550: Product of 2 consecutive prime differences of two successive terms of A001223.
; Submitted by <NAME>
; 2,4,8,8,8,8,8,24,12,12,24,8,8,24,36,12,12,24,8,12,24,24,48,32,8,8,8,8,56,56,24,12,20,20,12,36,24,24,36,12,20,20,8,8,24,144,48,8,8,24,12,20,60,36,36,12,12,24,8,20,140,56,8,8,56,84,60,20,8,24,48,48,36,24,24,48,32,32,80,20,20,20,12,24,24,48,32,8,8,48,96,32,32,32,24,72,24,36,108,60
mov $3,2
mov $4,$0
lpb $3
mov $0,$4
div $3,2
add $0,$3
seq $0,1223 ; Prime gaps: differences between consecutive primes.
add $2,$3
mul $2,$0
lpe
mov $0,$2
|
src/STLC/Syntax.agda | mietek/coquand-kovacs | 0 | 6334 | <reponame>mietek/coquand-kovacs
module STLC.Syntax where
open import Prelude public
--------------------------------------------------------------------------------
-- Types
infixr 7 _⇒_
data 𝒯 : Set
where
⎵ : 𝒯
_⇒_ : (A B : 𝒯) → 𝒯
--------------------------------------------------------------------------------
-- Contexts
data 𝒞 : Set
where
∅ : 𝒞
_,_ : (Γ : 𝒞) (A : 𝒯) → 𝒞
length : 𝒞 → Nat
length ∅ = zero
length (Γ , x) = suc (length Γ)
lookup : (Γ : 𝒞) (i : Nat) {{_ : True (length Γ >? i)}} → 𝒯
lookup ∅ i {{()}}
lookup (Γ , A) zero {{yes}} = A
lookup (Γ , B) (suc i) {{p}} = lookup Γ i
-- Variables
infix 4 _∋_
data _∋_ : 𝒞 → 𝒯 → Set
where
zero : ∀ {Γ A} → Γ , A ∋ A
suc : ∀ {Γ A B} → (i : Γ ∋ A)
→ Γ , B ∋ A
Nat→∋ : ∀ {Γ} → (i : Nat) {{_ : True (length Γ >? i)}}
→ Γ ∋ lookup Γ i
Nat→∋ {Γ = ∅} i {{()}}
Nat→∋ {Γ = Γ , A} zero {{yes}} = zero
Nat→∋ {Γ = Γ , B} (suc i) {{p}} = suc (Nat→∋ i)
instance
num∋ : ∀ {Γ A} → Number (Γ ∋ A)
num∋ {Γ} {A} =
record
{ Constraint = λ i → Σ (True (length Γ >? i))
(λ p → lookup Γ i {{p}} ≡ A)
; fromNat = λ { i {{p , refl}} → Nat→∋ i }
}
--------------------------------------------------------------------------------
-- Terms
infix 3 _⊢_
data _⊢_ : 𝒞 → 𝒯 → Set
where
𝓋 : ∀ {Γ A} → (i : Γ ∋ A)
→ Γ ⊢ A
ƛ : ∀ {Γ A B} → (M : Γ , A ⊢ B)
→ Γ ⊢ A ⇒ B
_∙_ : ∀ {Γ A B} → (M : Γ ⊢ A ⇒ B) (N : Γ ⊢ A)
→ Γ ⊢ B
instance
num⊢ : ∀ {Γ A} → Number (Γ ⊢ A)
num⊢ {Γ} {A} =
record
{ Constraint = λ i → Σ (True (length Γ >? i))
(λ p → lookup Γ i {{p}} ≡ A)
; fromNat = λ { i {{p , refl}} → 𝓋 (Nat→∋ i) }
}
--------------------------------------------------------------------------------
-- Normal forms
mutual
infix 3 _⊢ⁿᶠ_
data _⊢ⁿᶠ_ : 𝒞 → 𝒯 → Set where
ƛ : ∀ {Γ A B} → (M : Γ , A ⊢ⁿᶠ B)
→ Γ ⊢ⁿᶠ A ⇒ B
ne : ∀ {Γ} → (M : Γ ⊢ⁿᵉ ⎵)
→ Γ ⊢ⁿᶠ ⎵
infix 3 _⊢ⁿᵉ_
data _⊢ⁿᵉ_ : 𝒞 → 𝒯 → Set where
𝓋 : ∀ {Γ A} → (i : Γ ∋ A)
→ Γ ⊢ⁿᵉ A
_∙_ : ∀ {Γ A B} → (M : Γ ⊢ⁿᵉ A ⇒ B) (N : Γ ⊢ⁿᶠ A)
→ Γ ⊢ⁿᵉ B
instance
num⊢ⁿᵉ : ∀ {Γ A} → Number (Γ ⊢ⁿᵉ A)
num⊢ⁿᵉ {Γ} {A} =
record
{ Constraint = λ i → Σ (True (length Γ >? i))
(λ p → lookup Γ i {{p}} ≡ A)
; fromNat = λ { i {{p , refl}} → 𝓋 (Nat→∋ i) }
}
--------------------------------------------------------------------------------
|
alloy4fun_models/trashltl/models/7/zDd7TBYXzxmvZZhkK.als | Kaixi26/org.alloytools.alloy | 0 | 1001 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idzDd7TBYXzxmvZZhkK_prop8 {
always (all f,f2:File | f->f2 in link implies eventually ( f in Trash and f2 in Trash))
}
pred __repair { idzDd7TBYXzxmvZZhkK_prop8 }
check __repair { idzDd7TBYXzxmvZZhkK_prop8 <=> prop8o } |
test/Fail/ModuleDefinedInOtherFile.agda | shlevy/agda | 1,989 | 16825 | <reponame>shlevy/agda<gh_stars>1000+
module ModuleDefinedInOtherFile where
import Imports.B
|
Hardware/keyboard.asm | ped7g/EliteNext | 0 | 92709 | <reponame>ped7g/EliteNext
;
; $FEFE;65278 V, C, X, Z, Caps Shifts 4 3 2 1 0
; $FDFE;65022 G, F, D, S, A 9 8 7 6 5
; $FBFE;64510 T, R, E, W, Q 14 13 12 11 10
; $F7FE;63486 5, 4, 3, 2, 1 19 18 17 16 15
; $EFFE;61438 6, 7, 8, 9, 0 24 23 22 23 20
; $DFFE;57342 Y, U, I, O, P 29 28 27 26 25
; $BFFE;49150 H, J, K, L, Enter 34 33 32 31 30
; $7FFE;32766 B, N, M, Symbol Shift, Space 39 38 37 36 35
;
; Keyboard
;
; 0 1 2 3 4 5 6 7 8 9
; VK_CAPS, VK_Z, VK_X, VK_C, VK_V, VK_A, VK_S, VK_D, VK_F, VK_G
; 10 11 12 13 14 15 16 17 18 19
; VK_Q, VK_W, VK_E, VK_R, VK_T, VK_1, VK_2, VK_3, VK_4, VK_5
; 20 21 22 23 24 25 26 27 28 29
; VK_0 VK_9, VK_8, VK_7, VK_6, VK_P , VK_O, VK_I, VK_U, VK_Y
; 30 31 32 33 34 35 36 37 38 39
; VK_ENTER VK_L, VK_K, VK_J, VK_H, VK_SPACE VK_SYM, VK_M, VK_N, VK_B
;
; Default map
;-----------------------------------------------------------------------------------------------------------------------------------
; 0 1 2 3 4 5 6 7 8 9
; VK_CAPS VK_Z VK_X, VK_C, VK_V, VK_A VK_S, VK_D, VK_F, VK_G
; GameSkip Equip SelLCargo Climb Decelerate Recentre FireM HomeCursor
; Find System
;-----------------------------------------------------------------------------------------------------------------------------------
; 10 11 12 13 14 15 16 17 18 19
; VK_Q VK_W, VK_E, VK_R, VK_T, VK_1 VK_2 VK_3 VK_4 VK_5
; Dive Accelerate ECM UnarmMissile TargetM FrontV AftV LeftV RightV GalacticChart
;-----------------------------------------------------------------------------------------------------------------------------------
; 20 Accel 22 23 24 25 26 27 28 29
; VK_0 VK_9, VK_8, VK_7, VK_6, VK_P , VK_O, VK_I, VK_U, VK_Y
; EscapePod Inventory Status MarketPrices LocalChart RollRight RolLLeft EnergyBomb Quit
; PlanetData PauseGame SaveGame
;-----------------------------------------------------------------------------------------------------------------------------------
; 30 31 32 33 34 Right 36 37 EnergyBomb 39
; VK_ENTER VK_L, VK_K, VK_J, VK_H, VK_SPACE VK_SYM, VK_M, VK_N, VK_B
; Launch Distance Hyperspace Laser DockComp BuyCargo
; ResumeGame
; You can read address to check keystate by address KeyboardMap + c_Pressed corresponding key. There is also an addr_ helper too
c_Pressed_Front equ 0 * 2
c_Pressed_Aft equ 1 * 2
c_Pressed_Left equ 2 * 2
c_Pressed_Right equ 3 * 2
c_Pressed_RollLeft equ 4 * 2
c_Pressed_RollRight equ 5 * 2
c_Pressed_Dive equ 6 * 2
c_Pressed_Climb equ 7 * 2
c_Pressed_Accellerate equ 8 * 2
c_Pressed_Decellerate equ 9 * 2
c_Pressed_FireLaser equ 10 * 2
c_Pressed_TargetMissle equ 11 * 2
c_Pressed_FireMissile equ 12 * 2
c_Pressed_UnarmMissile equ 13 * 2
c_Pressed_ECM equ 14 * 2
c_Pressed_EnergyBomb equ 15 * 2
c_Pressed_EscapePod equ 16 * 2
c_Pressed_DockingComp equ 17 * 2
c_Pressed_Hyperspace equ 18 * 2
c_Pressed_Distance equ 19 * 2
c_Pressed_HomeCursor equ 20 * 2
c_Pressed_Launch equ 21 * 2
c_Pressed_BuyCargo equ 22 * 2
c_Pressed_SellCargo equ 23 * 2
c_Pressed_Equip equ 24 * 2
c_Pressed_GalacticChrt equ 25 * 2
c_Pressed_LocalChart equ 26 * 2
c_Pressed_MarketPrices equ 27 * 2
c_Pressed_Status equ 28 * 2
c_Pressed_Inventory equ 29 * 2
c_Pressed_GameSkip equ 30 * 2
c_Pressed_Save equ 31 * 2
c_Pressed_Freeze equ 32 * 2
c_Pressed_Resume equ 33 * 2
c_Pressed_Recentre equ 34 * 2
c_Pressed_Quit equ 35 * 2
c_Pressed_PlanetData equ 36 * 2
c_Pressed_CursorUp equ 37 * 2
c_Pressed_CursorDown equ 38 * 2
c_Pressed_Find equ 39 * 2
; half row 1
VK_CAPS equ 0
VK_Z equ 1
VK_X equ 2
VK_C equ 3
VK_V equ 4
; half row 2
VK_A equ 5
VK_S equ 6
VK_D equ 7
VK_F equ 8
VK_G equ 9
; half row 3
VK_Q equ 10
VK_W equ 11
VK_E equ 12
VK_R equ 13
VK_T equ 14
; half row 4
VK_1 equ 15
VK_2 equ 16
VK_3 equ 17
VK_4 equ 18
VK_5 equ 19
; half row 5
VK_0 equ 20
VK_9 equ 21
VK_8 equ 22
VK_7 equ 23
VK_6 equ 24
; half row 6
VK_P equ 25
VK_O equ 26
VK_I equ 27
VK_U equ 28
VK_Y equ 29
; half row 7
VK_ENTER equ 30
VK_L equ 31
VK_K equ 32
VK_J equ 33
VK_H equ 34
; half row 8
VK_SPACE equ 35
VK_SYM equ 36
VK_M equ 37
VK_N equ 38
VK_B equ 39
;KeyboardMapping
KeyCode_Front equ VK_1
KeyCode_Aft equ VK_2
KeyCode_Left equ VK_3
KeyCode_Right equ VK_4
KeyCode_RollLeft equ VK_O
KeyCode_RollRight equ VK_P
KeyCode_Dive equ VK_Q
KeyCode_Climb equ VK_A
KeyCode_Accellerate equ VK_W
KeyCode_Decellerate equ VK_S
KeyCode_FireLaser equ VK_SPACE
KeyCode_TargetMissle equ VK_T
KeyCode_FireMissile equ VK_F
KeyCode_Find equ VK_F
KeyCode_UnarmMissile equ VK_R
KeyCode_ECM equ VK_E
KeyCode_EnergyBomb equ VK_U
KeyCode_EscapePod equ VK_CAPS
KeyCode_DockingComp equ VK_N
KeyCode_Hyperspace equ VK_H
KeyCode_Distance equ VK_J
KeyCode_HomeCursor equ VK_G
KeyCode_Launch equ VK_L
KeyCode_BuyCargo equ VK_B
KeyCode_SellCargo equ VK_V
KeyCode_Equip equ VK_C
KeyCode_GalacticChrt equ VK_5
KeyCode_LocalChart equ VK_6
KeyCode_MarketPrices equ VK_7
KeyCode_Status equ VK_8
KeyCode_Inventory equ VK_9
KeyCode_GameSkip equ VK_Z
KeyCode_Save equ VK_O
KeyCode_Freeze equ VK_B
KeyCode_Resume equ VK_L
KeyCode_Recentre equ VK_D
KeyCode_Quit equ VK_Y
KeyCode_PlanetData equ VK_0
KeyCode_CursorUp equ VK_Q
KeyCode_CursorDown equ VK_A
Keys DS 40
c_KeyBoardLen equ $ - Keys
RawKeys DS 8
KeyAddrTab DW $FEFE, $FDFE, $FBFE, $F7FE, $EFFE, $DFFE, $BFFE, $7FFE
; Now keyboard map lists each game key and the corresponding address in the Keys table to get the value. This way redefining keys is just a case
; of updating this table with the respective location to look up
; key list sequence is in table above
KeyboardMap DW Keys+KeyCode_Front ,Keys+KeyCode_Aft ,Keys+KeyCode_Left ,Keys+KeyCode_Right ,Keys+KeyCode_RollLeft
DW Keys+KeyCode_RollRight ,Keys+KeyCode_Dive ,Keys+KeyCode_Climb ,Keys+KeyCode_Accellerate ,Keys+KeyCode_Decellerate
DW Keys+KeyCode_FireLaser ,Keys+KeyCode_TargetMissle ,Keys+KeyCode_FireMissile ,Keys+KeyCode_UnarmMissile ,Keys+KeyCode_ECM
DW Keys+KeyCode_EnergyBomb ,Keys+KeyCode_EscapePod ,Keys+KeyCode_DockingComp ,Keys+KeyCode_Hyperspace ,Keys+KeyCode_Distance
DW Keys+KeyCode_HomeCursor ,Keys+KeyCode_Launch ,Keys+KeyCode_BuyCargo ,Keys+KeyCode_SellCargo ,Keys+KeyCode_Equip
DW Keys+KeyCode_GalacticChrt ,Keys+KeyCode_LocalChart ,Keys+KeyCode_MarketPrices ,Keys+KeyCode_Status ,Keys+KeyCode_Inventory
DW Keys+KeyCode_GameSkip ,Keys+KeyCode_Save ,Keys+KeyCode_Freeze ,Keys+KeyCode_Resume ,Keys+KeyCode_Recentre
DW Keys+KeyCode_Quit ,Keys+KeyCode_PlanetData ,Keys+KeyCode_CursorUp ,Keys+KeyCode_CursorDown ,Keys+KeyCode_Find
ASCII_Map: DB "#","Z","X","C","V"
DB "A","S","D","F","G"
DB "Q","W","E","R","T"
DB "1","2","3","4","5"
DB "0","9","8","7","6"
DB "P","O","I","U","Y"
DB ">","L","K","J","H"
DB " ","^","M","N","B"
addr_Pressed_Front equ KeyboardMap+c_Pressed_Front
addr_Pressed_Aft equ KeyboardMap+c_Pressed_Aft
addr_Pressed_Left equ KeyboardMap+c_Pressed_Left
addr_Pressed_Right equ KeyboardMap+c_Pressed_Right
addr_Pressed_RollLeft equ KeyboardMap+c_Pressed_RollLeft
addr_Pressed_RollRight equ KeyboardMap+c_Pressed_RollRight
addr_Pressed_Dive equ KeyboardMap+c_Pressed_Dive
addr_Pressed_Climb equ KeyboardMap+c_Pressed_Climb
addr_Pressed_Accellerate equ KeyboardMap+c_Pressed_Accellerate
addr_Pressed_Decellerate equ KeyboardMap+c_Pressed_Decellerate
addr_Pressed_FireLaser equ KeyboardMap+c_Pressed_FireLaser
addr_Pressed_TargetMissle equ KeyboardMap+c_Pressed_TargetMissle
addr_Pressed_FireMissile equ KeyboardMap+c_Pressed_FireMissile
addr_Pressed_UnarmMissile equ KeyboardMap+c_Pressed_UnarmMissile
addr_Pressed_ECM equ KeyboardMap+c_Pressed_ECM
addr_Pressed_EnergyBomb equ KeyboardMap+c_Pressed_EnergyBomb
addr_Pressed_EscapePod equ KeyboardMap+c_Pressed_EscapePod
addr_Pressed_DockingComp equ KeyboardMap+c_Pressed_DockingComp
addr_Pressed_Hyperspace equ KeyboardMap+c_Pressed_Hyperspace
addr_Pressed_Distance equ KeyboardMap+c_Pressed_Distance
addr_Pressed_HomeCursor equ KeyboardMap+c_Pressed_HomeCursor
addr_Pressed_Launch equ KeyboardMap+c_Pressed_Launch
addr_Pressed_BuyCargo equ KeyboardMap+c_Pressed_BuyCargo
addr_Pressed_SellCargo equ KeyboardMap+c_Pressed_SellCargo
addr_Pressed_Equip equ KeyboardMap+c_Pressed_Equip
addr_Pressed_GalacticChrt equ KeyboardMap+c_Pressed_GalacticChrt
addr_Pressed_LocalChart equ KeyboardMap+c_Pressed_LocalChart
addr_Pressed_MarketPrices equ KeyboardMap+c_Pressed_MarketPrices
addr_Pressed_Status equ KeyboardMap+c_Pressed_Status
addr_Pressed_Inventory equ KeyboardMap+c_Pressed_Inventory
addr_Pressed_GameSkip equ KeyboardMap+c_Pressed_GameSkip
addr_Pressed_Save equ KeyboardMap+c_Pressed_Save
addr_Pressed_Freeze equ KeyboardMap+c_Pressed_Freeze
addr_Pressed_Resume equ KeyboardMap+c_Pressed_Resume
addr_Pressed_Recentre equ KeyboardMap+c_Pressed_Recentre
addr_Pressed_Quit equ KeyboardMap+c_Pressed_Quit
addr_Pressed_PlanetData equ KeyboardMap+c_Pressed_PlanetData
addr_Pressed_CursorUp equ KeyboardMap+c_Pressed_CursorUp
addr_Pressed_CursorDown equ KeyboardMap+c_Pressed_CursorDown
addr_Pressed_Find equ KeyboardMap+c_Pressed_Find
MIsKeyPressed: MACRO keyaddress, misstarget
ld hl,(keyaddress)
ld a,(hl)
IfAIsZeroGoto misstarget
ENDM
init_keyboard: ld hl,Keys
ld de, c_KeyBoardLen
ld a,0
call memfill_dma
ret
scan_keyboard: ld hl,RawKeys
ld de,KeyAddrTab
xor a
ld iyl,8
ld ix,Keys
.PortReadLoop: ld a,(de) ; Set up BC as port to read
ld c,a
inc de
ld a,(de)
ld b,a
inc de
in a,(c) ; read port to a
ld (hl),a ; set raw keys to value
inc hl ; and ready for next element
ld b,5 ; loop all bits (there are only 5 keys to a group)
.ProcessBitsLoop: bit 0,a ; is bit set
jr z,.SetKeyPressed
ex af,af'
xor a
jp .SetKey
jr nz,.SkipKeySet
.SetKeyPressed: ex af,af'
ld a,(ix+0)
inc a
and $3 ; so bit 0 set is pressed, bit 1 set is repeat pressed, i.e. 0 = no, 1 = yes 2,3 = held
.SetKey: ld (ix+0),a ; Key Pressed
ex af,af'
.SkipKeySet: inc ix ; move to next key
srl a ; move next key into bit 0
djnz .ProcessBitsLoop ; Process all key group bits
dec iyl
jr nz,.PortReadLoop ; Read next input port
ret
GetKeyStateAddressDE: MACRO
ld hl,KeyboardMap ; work our address to read from
add hl,a
ld a,(hl)
ld e,a
inc hl
ld a,(hl)
ld d,a ; now de = address in keypress list
ENDM
; call with a = c_Pressed key, will then read mapping
wait_for_key_a_press: GetKeyStateAddressDE
push de
wait_for_key_press_loop: call scan_keyboard
pop hl ; get key address into hl
push hl
ld a,(hl)
JumpIfANENusng 1,wait_for_key_press_loop ; will also loop if held down when entering this routine
pop hl ; tidy up rogue push, less t states than detecting if we want to push or not
ret
wait_for_key_a_held: GetKeyStateAddressDE
push de
wait_for_key_a_held_loop: call scan_keyboard
pop hl
push hl
ld a,(hl)
JumpIfALTNusng 2,wait_for_key_a_held_loop
pop hl
ret
get_key_a_state: GetKeyStateAddressDE ; reads a mapped key and sets a to key staus, e.g. 0 1 or >=2 DOES NOT SCAN KEYBOARD
ex de,hl
ld a,(hl) ; a = keystate
ret
force_key_press: GetKeyStateAddressDE
ex de,hl
ld a,1
ld (hl),a
ret
; returns z is set if c_ key is pressed
is_key_pressed: GetKeyStateAddressDE
ex de,hl
ld a,(hl) ; a = keystate
cp 1
ret
; returns z is set if c_ key is held
is_key_held: GetKeyStateAddressDE
ex de,hl
ld a,(hl) ; a = keystate
and 2 ; clear out bit 1 which elimiates state 3, so it can now be 2 (held) or 0 (not pressed or one off)
cp 2
ret
is_any_key_pressed:
ld hl,Keys
ld b,40
ld c,0
.KeyReadLoop:
ld a,(hl)
cp 1
jp z,.KeyPressed
inc hl
inc c
djnz .KeyReadLoop
ld a,$FF
ret
.KeyPressed:
ld a,c
ret
is_any_key_held:
ld hl,Keys
ld b,40
ld c,0
.KeyReadLoop:
ld a,(hl)
and 2 ; clear out bit 1 which elimiates state 3, so it can now be 2 (held) or 0 (not pressed or one off)
cp 2
jp z,.KeyPressed
inc hl
inc c
djnz .KeyReadLoop
ld a,$FF
ret
.KeyPressed:
ld a,c
ret
InputString DS 30 ; used for a 30 character input buffer
DB 0 ; end of string marker as a safety
InputCursor DB 0
EnterPressed DB 0 ; zero notpressed FF pressed
InputChanged DB 0
InputLimit EQU 20
keyboard_copy_input_to_de:
ld hl,InputString
ld a,(InputCursor)
cp 0
jr z,.NoString
ld c,a
ld b,0
ldir
.NoString
ld a,0
ld (de),a
ret
initInputText:
xor a
ld (InputCursor),a
ld (EnterPressed),a
ld (InputChanged),a
ld hl,InputString
ld b,30
.wipeloop:
ld (hl),a
inc hl
djnz .wipeloop
ret
InputName: xor a
ld (InputChanged),a
call is_any_key_pressed
cp $FF
ret z
.KeyPressed:
ld c,a
ld a,(InputCursor) ; No key so we can now look at if we are at the end of the buffer
cp InputLimit ; move to variable later and then cp (hl)
jr z,.DeleteOrEnterOnly ;
ld hl,ASCII_Map
ld a,c
add hl,a
ld a,(hl)
cp "A"
jr nc,.AlphaPressed
.DeleteOrEnterOnly ; CAPS and Symbol act as delete for now
cp "0" ; if 0 was preseed check caps shift too
jr z,.CheckShiftDelete ; for now we will ignore the shift and just assume delete
cp ">" ; ENTER
jr z,.EnterPressed
cp "#" ; CAPS
jr z,.CapsPressed
cp "^" ; SYMBOLSHIFT
jr z,.SymbolPressed
cp " " ; space
jr z,.SpacePressed
ret
.AlphaPressed:
ld b,a
ld a,(InputCursor)
ld c,a
ld hl,InputString
add hl,a
ld a,b
ld (hl),b
ld a,c
ld hl,InputCursor
inc (hl)
ld a,$FF
ld (InputChanged),a
ret
.EnterPressed:
ld a,(InputCursor)
inc a
ld hl,InputString
add hl,a
xor a
ld (hl),a
dec a
ld (EnterPressed),a
ld (InputChanged),a
ret
.CheckShiftDelete:
.CapsPressed: ; act as a delete key for now
.SymbolPressed:
.SpacePressed:
ld a,(InputCursor)
cp 0
ret z
dec a
ld (InputCursor),a
ld hl,InputString
add hl,a
xor a
ld (hl),a
ld a,$FF
ld (InputChanged),a
ret
MovementKeyTest:
;DBG1:jp dbg1
;dbx1:
xor a
ld (CursorKeysPressed),a
ld a,(MenuIdMax)
and $FC
jr nz,CursorKeys
ClimbDiveKeys:
ld hl,(addr_Pressed_Climb)
ld a,(hl)
IfAIsZeroGoto ScanDiveKey
ld a,(CursorKeysPressed)
or $80
ld (CursorKeysPressed),a
jp ScanLeftKey
ScanDiveKey:
ld hl,(addr_Pressed_Dive)
ld a,(hl)
IfAIsZeroGoto ScanLeftKey
ld a,(CursorKeysPressed)
or $40
ld (CursorKeysPressed),a
jp ScanLeftKey
CursorKeys:
ld hl,(addr_Pressed_CursorUp)
ld a,(hl)
IfAIsZeroGoto ScanCursorDownKey
ld a,(CursorKeysPressed)
or $80
ld (CursorKeysPressed),a
jp ScanLeftKey
ScanCursorDownKey
ld hl,(addr_Pressed_CursorDown)
ld a,(hl)
IfAIsZeroGoto ScanLeftKey
ld a,(CursorKeysPressed)
or $40
ld (CursorKeysPressed),a
ScanLeftKey:
ld hl,(addr_Pressed_RollLeft)
ld a,(hl)
IfAIsZeroGoto ScanRightKey
ld a,(CursorKeysPressed)
or $20
ld (CursorKeysPressed),a
ret
ScanRightKey:
ld hl,(addr_Pressed_RollRight)
ld a,(hl)
IfAIsZeroGoto ScanHomeKey
ld a,(CursorKeysPressed)
or $10
ld (CursorKeysPressed),a
ret
ScanHomeKey:
ld hl,(addr_Pressed_HomeCursor)
ld a,(hl)
IfAIsZeroGoto ScanRecentreKey
ld a,(CursorKeysPressed)
or $08
ld (CursorKeysPressed),a
ret
ScanRecentreKey:
ld hl,(addr_Pressed_Recentre)
ld a,(hl)
ReturnIfAIsZero
ld a,(CursorKeysPressed)
or $04
ld (CursorKeysPressed),a
ret
|
v2.0/source/msdos/dosseg.asm | neozeed/MS-DOS | 7 | 6104 | ;
; segment ordering for MSDOS
;
CONSTANTS SEGMENT BYTE PUBLIC 'CONST'
CONSTANTS ENDS
DATA SEGMENT BYTE PUBLIC 'DATA'
DATA ENDS
CODE SEGMENT BYTE PUBLIC 'CODE'
CODE ENDS
LAST SEGMENT BYTE PUBLIC 'LAST'
LAST ENDS
DOSGROUP GROUP CODE,CONSTANTS,DATA,LAST
|
programs/oeis/010/A010735.asm | neoneye/loda | 22 | 27457 | ; A010735: Period 2: repeat (9,10).
; 9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10,9,10
mod $0,2
add $0,9
|
agda-stdlib/src/Data/String/Properties.agda | DreamLinuxer/popl21-artifact | 5 | 15035 | <gh_stars>1-10
------------------------------------------------------------------------
-- The Agda standard library
--
-- Properties of operations on strings
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.String.Properties where
open import Data.Bool.Base using (Bool)
import Data.Char.Properties as Charₚ
import Data.List.Properties as Listₚ
import Data.List.Relation.Binary.Pointwise as Pointwise
import Data.List.Relation.Binary.Lex.Strict as StrictLex
open import Data.String.Base
open import Function
open import Relation.Nullary using (yes; no)
open import Relation.Nullary.Decidable using (map′; isYes)
open import Relation.Binary
open import Relation.Binary.PropositionalEquality.Core
import Relation.Binary.Construct.On as On
import Relation.Binary.PropositionalEquality as PropEq
------------------------------------------------------------------------
-- Primitive properties
open import Agda.Builtin.String.Properties public
renaming ( primStringToListInjective to toList-injective)
------------------------------------------------------------------------
-- Properties of _≈_
≈⇒≡ : _≈_ ⇒ _≡_
≈⇒≡ = toList-injective _ _
∘ Pointwise.Pointwise-≡⇒≡
∘ Pointwise.map Charₚ.≈⇒≡
≈-reflexive : _≡_ ⇒ _≈_
≈-reflexive = Pointwise.map Charₚ.≈-reflexive
∘ Pointwise.≡⇒Pointwise-≡
∘ cong toList
≈-refl : Reflexive _≈_
≈-refl {x} = ≈-reflexive {x} {x} refl
≈-sym : Symmetric _≈_
≈-sym = Pointwise.symmetric (λ {i j} → Charₚ.≈-sym {i} {j})
≈-trans : Transitive _≈_
≈-trans = Pointwise.transitive (λ {i j k} → Charₚ.≈-trans {i} {j} {k})
≈-subst : ∀ {ℓ} → Substitutive _≈_ ℓ
≈-subst P x≈y p = subst P (≈⇒≡ x≈y) p
infix 4 _≈?_
_≈?_ : Decidable _≈_
x ≈? y = Pointwise.decidable Charₚ._≈?_ (toList x) (toList y)
≈-isEquivalence : IsEquivalence _≈_
≈-isEquivalence = record
{ refl = λ {i} → ≈-refl {i}
; sym = λ {i j} → ≈-sym {i} {j}
; trans = λ {i j k} → ≈-trans {i} {j} {k}
}
≈-setoid : Setoid _ _
≈-setoid = record
{ isEquivalence = ≈-isEquivalence
}
≈-isDecEquivalence : IsDecEquivalence _≈_
≈-isDecEquivalence = record
{ isEquivalence = ≈-isEquivalence
; _≟_ = _≈?_
}
≈-decSetoid : DecSetoid _ _
≈-decSetoid = record
{ isDecEquivalence = ≈-isDecEquivalence
}
-----------------------------------------------------------------------
-- Properties of _≡_
infix 4 _≟_
_≟_ : Decidable _≡_
x ≟ y = map′ ≈⇒≡ ≈-reflexive $ x ≈? y
≡-setoid : Setoid _ _
≡-setoid = PropEq.setoid String
≡-decSetoid : DecSetoid _ _
≡-decSetoid = PropEq.decSetoid _≟_
------------------------------------------------------------------------
-- Properties of _<_
infix 4 _<?_
_<?_ : Decidable _<_
x <? y = StrictLex.<-decidable Charₚ._≈?_ Charₚ._<?_ (toList x) (toList y)
<-isStrictPartialOrder-≈ : IsStrictPartialOrder _≈_ _<_
<-isStrictPartialOrder-≈ =
On.isStrictPartialOrder
toList
(StrictLex.<-isStrictPartialOrder Charₚ.<-isStrictPartialOrder-≈)
<-isStrictTotalOrder-≈ : IsStrictTotalOrder _≈_ _<_
<-isStrictTotalOrder-≈ =
On.isStrictTotalOrder
toList
(StrictLex.<-isStrictTotalOrder Charₚ.<-isStrictTotalOrder-≈)
<-strictPartialOrder-≈ : StrictPartialOrder _ _ _
<-strictPartialOrder-≈ =
On.strictPartialOrder
(StrictLex.<-strictPartialOrder Charₚ.<-strictPartialOrder-≈)
toList
<-strictTotalOrder-≈ : StrictTotalOrder _ _ _
<-strictTotalOrder-≈ =
On.strictTotalOrder
(StrictLex.<-strictTotalOrder Charₚ.<-strictTotalOrder-≈)
toList
------------------------------------------------------------------------
-- Alternative Boolean equality test.
--
-- Why is the definition _==_ = primStringEquality not used? One
-- reason is that the present definition can sometimes improve type
-- inference, at least with the version of Agda that is current at the
-- time of writing: see unit-test below.
infix 4 _==_
_==_ : String → String → Bool
s₁ == s₂ = isYes (s₁ ≟ s₂)
private
-- The following unit test does not type-check (at the time of
-- writing) if _==_ is replaced by primStringEquality.
data P : (String → Bool) → Set where
p : (c : String) → P (_==_ c)
unit-test : P (_==_ "")
unit-test = p _
-- Version 1.1
setoid = ≡-setoid
{-# WARNING_ON_USAGE setoid
"Warning: setoid was deprecated in v1.1.
Please use ≡-setoid instead."
#-}
decSetoid = ≡-decSetoid
{-# WARNING_ON_USAGE decSetoid
"Warning: decSetoid was deprecated in v1.1.
Please use ≡-decSetoid instead."
#-}
strictTotalOrder = <-strictTotalOrder-≈
{-# WARNING_ON_USAGE strictTotalOrder
"Warning: strictTotalOrder was deprecated in v1.1.
Please use <-strictTotalOrder-≈ instead."
#-}
|
kCoproc.asm | satadriver/LiunuxOS_t | 0 | 167454 | .386p
Kernel Segment public para use32
assume cs:Kernel
__kCoProcessorProc proc
pushad
push ds
push es
mov ax,rwData32Seg
mov ds,ax
mov es,ax
mov ebx,KernelData
shl ebx,4
cmp dword ptr ds:[ebx + offset _kCoprocessor],0
jz __kCoProcessorProcEnd
call dword ptr ds:[ebx + offset _kCoprocessor]
jmp __kCoProcessorProcEnd
cmp dword ptr ds:[ebx + _kException],0
jz __kCoProcessorProcEnd
push dword ptr 4dh
push esp
call dword ptr ds:[ebx+_kException]
add esp,8
jmp __kCoProcessorProcEnd
mov ebp,esp
add ebp,32
push dword ptr ICW2_SLAVE_INT_NO + 5
push dword ptr 0
push dword ptr [ebp]
push dword ptr [ebp + 4]
push dword ptr [ebp + 8]
test dword ptr [ebp + 4],3
jz _kCoProcKernelModeInt
push dword ptr [ebp + 12]
push dword ptr [ebp + 16]
jmp _kCoProcShowExpInfo
_kCoProcKernelModeInt:
push dword ptr 0
push dword ptr 0
_kCoProcShowExpInfo:
call __exceptionInfo
add esp,28
__kCoProcessorProcEnd:
;clts
;wait
;finit
;FNCLEX
mov al,0
out 0f0h,al
in al,0f0h
mov al,20h
out 0a0h,al
out 20h,al
pop es
pop ds
popad
iretd
__kCoProcessorProc endp
Kernel ends
;整数 (CPU) 和 FPU 是相互独立的单元,因此,在执行整数和系统指令的同时可以执行浮点指令。这个功能被称为并行性(concurrency),当发生未屏蔽的浮点异常时,
;它可能是个潜在的问题。反之,已屏蔽异常则不成问题,因为,FPU 总是可以完成当前操作并保存结果。
;发生未屏蔽异常时,中断当前的浮点指令,FPU 发异常事件信号。当下一条浮点指令或 FWAIT(WAIT) 指令将要执行时,FPU 检查待处理的异常。如果发现有这样的异常,FPU 就调用浮点异常处理程序(子程序)。
;如果引发异常的浮点指令后面跟的是整数或系统指令,情况又会是怎样的呢?很遗憾,指令不会检查待处理异常,它们会立即执行。
;假设第一条指令将其输出送入一个内存操作数,而第二条指令又要修改同一个内存操作数,那么异常处理程序就不能正确执行。示例如下:
;设置 WAIT 和 FWAIT 指令是为了在执行下一条指令之前,强制处理器检查待处理且未屏蔽的浮点异常。
;这两条指令中的任一条都可以解决这种潜在的同步问题,直到异常处理程序结束,才执行 INC 指令。 |
src/lib/rng.asm | NEPETAISCUTE/simon-gameboy | 1 | 19320 | <gh_stars>1-10
;
; Pseudorandom number generator
;
; Copyright 2018, 2020 <NAME>
;
; This software is provided 'as-is', without any express or implied
; warranty. In no event will the authors be held liable for any damages
; arising from the use of this software.
;
; Permission is granted to anyone to use this software for any purpose,
; including commercial applications, and to alter it and redistribute it
; freely, subject to the following restrictions:
;
; 1. The origin of this software must not be misrepresented; you must not
; claim that you wrote the original software. If you use this software
; in a product, an acknowledgment in the product documentation would be
; appreciated but is not required.
; 2. Altered source versions must be plainly marked as such, and must not be
; misrepresented as being the original software.
; 3. This notice may not be removed or altered from any source distribution.
;
section "rand_ram",WRAM0
randstate: ds 4
; The formula is
; x[i + 1] = (x[i] + 0xB3) * 0x01010101
; or equivalently
; x[i + 1] = x[i] * 0x01010101 + 0xB3B3B3B3
; Prior to cc65 commit 3994fee595 it was
; x[i + 1] = x[i] * 0x01010101 + 0x31415927
section "rand",ROM0
;;
; Generates a pseudorandom 16-bit integer in BC
; using the LCG formula from cc65 rand():
; x[i + 1] = x[i] * 0x01010101 + 0xB3B3B3B3
; @return A=B=state bits 31-24 (which have the best entropy),
; C=state bits 23-16, DHL trashed
rand::
; Add 0xB3 then multiply by 0x01010101
ld hl, randstate+0
ld a, [hl]
add a, $B3
ld [hl+], a
adc a, [hl]
ld [hl+], a
adc a, [hl]
ld [hl+], a
ld c, a
adc a, [hl]
ld [hl], a
ld b, a
ret
;;
; Sets the random seed to BC.
; C expects startup code to behave as if srand(1) was called.
; AHL trashed
srand::
ld hl,randstate+3
xor a
ld [hl-],a
ld [hl-],a
ld a,b
ld [hl-],a
ld [hl],c
ret
;
; According to tools/rand.py, after srand(1) then ten rand() calls,
; first ten BC results should be
; b4b4 85d1 8e08 9b0d 2d92
; 794b 64eb 8a25 35ab 6731
; Verify this with SHOW_RNG in placeholder.z80
|
tools/yasm/tests/nasm/sizes2.asm | fasttr-org/ftr | 0 | 92458 | aaa
aad 500
aad 10
aad 0xFF
aad 0
here:
idiv al
idiv ax
idiv eax
idiv byte [0]
idiv dword [eax]
|
main.asm | lanquemar/C64_Demo | 1 | 169494 | <gh_stars>1-10
*=$1000
;
; CONSTANTS
;
SCREEN_BORDER_COLOR = $D020
CONTROL_REGISTER_1 = $D011
CONTROL_REGISTER_2 = $D016
MEMORY_SETUP_REGISTER = $D018
SCREEN_COLOR_MEMORY_BEGIN = $08
SCREEN_COLOR_MEMORY_END = $0C
SCREEN_PIXELS_MEMORY_BEGIN = $20
SCREEN_PIXELS_MEMORY_END = $40
COLOR_BLACK = $0
COLOR_BLUE = $6
;
; INITIALISATION
;
; Set border color to black
lda #COLOR_BLACK
sta SCREEN_BORDER_COLOR
; Setup Standard Bitmap Mode
lda CONTROL_REGISTER_1
and #%10111111 ; Clear bit 6 ECM
ora #%00100000 ; Set bit 5 BMM
sta CONTROL_REGISTER_1
lda CONTROL_REGISTER_2 ; Control Register 2
and #%11101111 ; Clear bit 4 MCM
sta CONTROL_REGISTER_2
; Change bitmap memory location
lda #%00101000 ; Set Screen Block to 7; Bitmap Block to 1
sta MEMORY_SETUP_REGISTER
;
; PROGRAM
;
; Turn off pixels of all screen
ldx #SCREEN_PIXELS_MEMORY_BEGIN
clear_screen_pixels
stx proc_write_256_bytes__loop+2
; Push registers on stack
pha
txa
pha
; Call procedure
lda #$0
jsr proc_write_256_bytes
; Pull registers from stack
pla
tax
pla
inx
cpx #SCREEN_PIXELS_MEMORY_END
bne clear_screen_pixels
; Setup pixel colors of all screen
ldx #SCREEN_COLOR_MEMORY_BEGIN
clean_screen_colors
stx proc_write_256_bytes__loop+2
; Push registers on stack
pha
txa
pha
; Call procedure
lda #COLOR_BLUE
jsr proc_write_256_bytes
; Pull registers from stack
pla
tax
pla
inx
cpx #SCREEN_COLOR_MEMORY_END
bne clean_screen_colors
;
; DEINITIALISATION
;
; Exit
rts ; returns to calling procedure
;
; PROCEDURES
;
; Write value REG(A) to the 256 bytes located at
; address (proc_write_256_bytes__loop + 2)
proc_write_256_bytes
ldx #0
proc_write_256_bytes__loop
sta $0100,X ; dummy value: prevent assembler to optimize instruction
inx
cpx #$00
bne proc_write_256_bytes__loop
rts |
libsrc/_DEVELOPMENT/threads/mutex/z80/asm_spinlock_release.asm | meesokim/z88dk | 0 | 170139 |
SECTION code_threads_mutex
PUBLIC asm_spinlock_release
asm_spinlock_release:
; enter : hl = & spinlock
;
; exit : hl = & spinlock
;
; uses : none
ld (hl),$fe ; atomic operation
ret
|
Task/Permutations/AppleScript/permutations-2.applescript | LaudateCorpus1/RosettaCodeData | 1 | 4218 | <reponame>LaudateCorpus1/RosettaCodeData
to DoPermutations(aList, n)
--> Heaps's algorithm (Permutation by interchanging pairs)
if n = 1 then
tell (a reference to PermList) to copy aList to its end
-- or: copy aList as text (for concatenated results)
else
repeat with i from 1 to n
DoPermutations(aList, n - 1)
if n mod 2 = 0 then -- n is even
tell aList to set [item i, item n] to [item n, item i] -- swaps items i and n of aList
else
tell aList to set [item 1, item n] to [item n, item 1] -- swaps items 1 and n of aList
end if
end repeat
end if
return (a reference to PermList) as list
end DoPermutations
--> Example 1 (list of words)
set [SourceList, PermList] to [{"Good", "Johnny", "Be"}, {}]
DoPermutations(SourceList, SourceList's length)
--> result (value of PermList)
{{"Good", "Johnny", "Be"}, {"Johnny", "Good", "Be"}, {"Be", "Good", "Johnny"}, ¬
{"Good", "Be", "Johnny"}, {"Johnny", "Be", "Good"}, {"Be", "Johnny", "Good"}}
--> Example 2 (characters with concatenated results)
set [SourceList, PermList] to [{"X", "Y", "Z"}, {}]
DoPermutations(SourceList, SourceList's length)
--> result (value of PermList)
{"XYZ", "YXZ", "ZXY", "XZY", "YZX", "ZYX"}
--> Example 3 (Integers)
set [SourceList, Permlist] to [{1, 2, 3}, {}]
DoPermutations(SourceList, SourceList's length)
--> result (value of Permlist)
{{1, 2, 3}, {2, 1, 3}, {3, 1, 2}, {1, 3, 2}, {2, 3, 1}, {3, 2, 1}}
--> Example 4 (Integers with concatenated results)
set [SourceList, Permlist] to [{1, 2, 3}, {}]
DoPermutations(SourceList, SourceList's length)
--> result (value of Permlist)
{"123", "213", "312", "132", "231", "321"}
|
archs/exec_ppc.als | graymalkin/memalloy | 0 | 4345 | <reponame>graymalkin/memalloy
module exec_ppc[E]
open exec_H[E]
sig Exec_PPC extends Exec_H {
SYNC, LWSYNC, EIEIO, ISYNC : set E
}{
SYNC + LWSYNC + EIEIO + ISYNC in F
disj [ISYNC, LWSYNC + EIEIO]
SYNC = LWSYNC & EIEIO
}
one sig rm_ISYNC extends PTag {}
one sig rm_SYNC extends PTag {}
one sig rm_LWSYNC extends PTag {}
one sig rm_EIEIO extends PTag {}
fun ISYNC[e:PTag->E, X:Exec_PPC] : set E {
X.ISYNC - e[rm_EV] - e[rm_ISYNC] }
fun SYNC[e:PTag->E, X:Exec_PPC] : set E {
X.SYNC - e[rm_EV] - e[rm_SYNC] - e[rm_LWSYNC] - e[rm_EIEIO] }
fun LWSYNC[e:PTag->E, X:Exec_PPC] : set E {
X.LWSYNC - e[rm_EV] - e[rm_LWSYNC] }
fun EIEIO[e:PTag->E, X:Exec_PPC] : set E {
X.EIEIO - e[rm_EV] - e[rm_EIEIO] }
fun isync[e:PTag->E, X:Exec_PPC] : E->E { addsb[e,X,ISYNC[e,X]] }
fun sync[e:PTag->E, X:Exec_PPC] : E->E { addsb[e,X,SYNC[e,X]] }
fun lwsync[e:PTag->E, X:Exec_PPC] : E->E { addsb[e,X,LWSYNC[e,X]] }
fun eieio[e:PTag->E, X:Exec_PPC] : E->E { addsb[e,X,EIEIO[e,X]] }
|
open_mail.scpt | cmccomb/outlook-applescript | 1 | 4608 | tell application "Microsoft Outlook"
activate
set mail_open to false
repeat with this_window in main windows
if view of this_window is mail view then
set mail_open to true
end if
end repeat
if mail_open is false then
make new main window
set view of the first main window to mail view
end if
end tell
|
test/Fail/Issue5029.agda | cruhland/agda | 1,989 | 2886 | {-# OPTIONS --safe -W noTerminationIssue #-}
data ⊥ : Set where
bad : ⊥
bad = bad
|
programs/oeis/218/A218723.asm | neoneye/loda | 22 | 17576 | ; A218723: a(n) = (256^n-1)/255.
; 0,1,257,65793,16843009,4311810305,1103823438081,282578800148737,72340172838076673,18519084246547628289,4740885567116192841985,1213666705181745367548161,310698676526526814092329217,79538861190790864407636279553,20361948464842461288354887565569,5212658806999670089818851216785665
mov $1,256
pow $1,$0
div $1,255
mov $0,$1
|
data/blocks-def.asm | GSoftwareDevelopment/Mole | 2 | 103097 | ; block definitions
; #0
; width & height
.by 02 03
; data
.by 02 00 ; X.
.by 05 04 ; XX
.by 05 00 ; X.
; #1
.by 03 02
.by 02 04 04 ; XXX
.by 00 05 00 ; .X.
; #2
.by 03 02
.by 00 02 00 ; .X.
.by 02 03 04 ; XXX
; #3
.by 02 03
.by 00 02 ; .X
.by 02 03 ; XX
.by 00 05 ; .X
; #4
.by 03 02
.by 00 02 04 ; .XX
.by 02 03 00 ; XX.
; #5
.by 03 02
.by 02 04 00 ; XX.
.by 00 05 04 ; .XX
; #6
.by 02 03
.by 00 02 ; .X
.by 02 03 ; XX
.by 05 00 ; X.
; #7
.by 02 03
.by 02 00 ; X.
.by 05 04 ; XX
.by 00 05 ; .X
; #8
.by 02 02
.by 02 04 ; XX
.by 05 03 ; XX
.by 00 00 ; ..
; #9
.by 02 03
.by 02 04 ; XX
.by 05 00 ; X.
.by 05 00 ; X.
; #10
.by 03 02
.by 02 04 04 ; XXX
.by 00 00 05 ; ..X
; #11
.by 02 03
.by 00 02 ; .X
.by 00 05 ; .X
.by 02 03 ; XX
; #12
.by 03 02
.by 02 00 00 ; X..
.by 05 04 04 ; XXX
; #13
.by 02 03
.by 02 04 ; XX
.by 00 05 ; .X
.by 00 05 ; .X
; #14
.by 03 02
.by 00 00 02 ; ..X
.by 02 04 03 ; XXX
; #15
.by 02 03
.by 02 00 ; X.
.by 05 00 ; X.
.by 05 04 ; XX
; #16
.by 03 02
.by 02 04 04 ; XXX
.by 05 00 00 ; X..
; #17 - coin
.by 01 01
.by 27
.by 00 00 00 00 00
|
src/apsepp-abstract_test_suite.ads | thierr26/ada-apsepp | 0 | 4440 | <filename>src/apsepp-abstract_test_suite.ads
-- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
with Apsepp.Test_Node_Class.Suite_Stub; use Apsepp.Test_Node_Class.Suite_Stub;
use Apsepp.Test_Node_Class;
package Apsepp.Abstract_Test_Suite is
subtype Test_Node_Array is Apsepp.Test_Node_Class.Test_Node_Array;
type Test_Suite is abstract limited new Test_Suite_Stub with private;
not overriding
function Child_Array (Obj : Test_Suite) return Test_Node_Array
is abstract;
overriding
function Child_Count (Obj : Test_Suite) return Test_Node_Count
is (Test_Suite'Class (Obj).Child_Array'Length);
overriding
function Child (Obj : Test_Suite;
K : Test_Node_Index) return Test_Node_Access
is (Test_Suite'Class (Obj).Child_Array (K));
overriding
function Routine (Obj : Test_Suite;
K : Test_Routine_Index) return Test_Routine;
procedure Run_Body (Obj : Test_Node_Interfa'Class;
Outcome : out Test_Outcome;
Kind : Run_Kind;
Cond : not null access function return Boolean)
renames Test_Node_Class.Suite_Stub.Run_Body;
private
type Test_Suite is abstract limited new Test_Suite_Stub with null record;
end Apsepp.Abstract_Test_Suite;
|
lib/target/msx/classic/msx_crt0.asm | ahjelm/z88dk | 640 | 93221 |
MODULE msx_crt0
defc crt0 = 1
INCLUDE "zcc_opt.def"
EXTERN _main
PUBLIC cleanup
PUBLIC l_dcal
PUBLIC msxbios
defc CONSOLE_COLUMNS = 32
defc CONSOLE_ROWS = 24
defc __CPU_CLOCK = 3580000
IF (!DEFINED_startup || (startup=1))
INCLUDE "target/msx/classic/ram.asm"
ENDIF
IF startup = 2
INCLUDE "target/msx/classic/msxdos.asm"
ENDIF
IF startup = 3
INCLUDE "target/msx/classic/rom.asm"
ENDIF
SECTION code_clib
; Safe BIOS call
msxbios:
ld iy,($FCC0) ; slot address of BIOS ROM
call 001Ch ; CALSLT
ei ; make sure interrupts are enabled
ret
|
Borland/CBuilder5/Source/RTL/source/math/div.asm | TrevorDArcyEvans/DivingMagpieSoftware | 1 | 167697 | ;[]-----------------------------------------------------------------[]
;| DIV.ASM -- integer division |
;[]-----------------------------------------------------------------[]
;
; C/C++ Run Time Library - Version 10.0
;
; Copyright (c) 1991, 2000 by Inprise Corporation
; All Rights Reserved.
;
; $Revision: 9.0 $
include RULES.ASI
; Segments Definitions
Header@
; Definition of div_t must match that in stdlib.h
div_t STRUC
quot dd ?
rem dd ?
div_t ENDS
;-----------------------------------------------------------------------
;
;Name div - integer division
; ldiv - long integer division
;
;Usage div_t div(int numer, int denom);
; ldiv_t ldiv(long numer, long denom);
;
;Prototype in stdlib.h
;
;Description div computes the quotient and remainder of the division of
; the numerator "numer" by the denominator "denom". If the
; result cannot be represented, the behavior is undefined.
;
; ldiv is similar, except that it operates on long integers.
;
;Return value div returns a structure of type div_t, comprising both the
; quotient and the remainder. ldiv returns a similar structure
; of type ldiv_t, whose members are long integers.
;
;-----------------------------------------------------------------------
Code_seg@
Func@ ldiv, _EXPFUNC, _RTLENTRY, <pointer retval>,<long numer>,<long denom>
; drop into div -- long is the same size as int
EndFunc@ ldiv
Func@ div, _EXPFUNC, _RTLENTRY, <pointer retval>,<int numer>,<int denom>
Link@
mov eax,numer ; get numerator
cdq ; convert to quadword EDX:EAX
idiv dword ptr denom ; EAX = quotient, EDX = remainder
mov ecx,retval ; get pointer to return value
mov [ecx].quot, eax ; fill in the div_t structure
mov [ecx].rem, edx
mov eax, ecx ; return pointer to ret. value
Unlink@
Return@
EndFunc@ div
Code_EndS@
end
|
text/TextModifier.applescript | GitSyncApp/applescripts | 6 | 4114 | <reponame>GitSyncApp/applescripts
(*
* Example : StringModifier's replaceText("Let it be known that [company] is responsible for any damage" & " any employee causes during [company]'s activity while in the conference.", "[company]", "Disny inc") -- this will then replace all instances of [company] with Disny inc
* Todo: is the original text also edited?
*)
on replace_text(the_text, match, replacement)
set text item delimiters to match
set temporary_list to text items of the_text
set text item delimiters to replacement
set finished_form to temporary_list as text
set text item delimiters to ""
return finished_form
end replace_text
(*
* Modifies the original array
* TD you may aswell return the original array for chaining purposes
*)
on wrap_every_text_item(text_items, wrap)
repeat with i from 1 to (length of text_items)
set item i of text_items to wrap_text(item i of text_items, wrap)
end repeat
end wrap_every_text_item
(*
* Does not modify the original string
*)
on wrap_text(the_text, wrap)
return wrap & the_text & wrap
end wrap_text
(*
* returns the text in all lower case
*)
on lower_case(the_text)
set upper to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set lower to "abcdefghijklmnopqrstuvwxyz"
return Util's translate_chars(the_text, upper, lower)
end lower_case
(*
* returns the text in all upper case
*)
on upper_case(the_text)
set lower to "abcdefghijklmnopqrstuvwxyz"
set upper to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
return Util's translate_chars(the_text, lower, upper)
end upper_case
(*
* Capitalize a text, returning only the first letter uppercased
*)
on capitalize_text(the_text)
set firstChar to upper_case(first character of the_text)
set otherChars to lower_case(characters 2 thru -1 of the_text)
return firstChar & otherChars
end capitalize_text
(*
* removes trim string from the right side of the text
* Note: you can also do something like this: text 2 thru (length of the_text) of the_text
*)
on left_side_strip(the_text, trim_string)
set x to count trim_string
try
repeat while the_text begins with the trim_string
set the_text to characters (x + 1) thru -1 of the_text as text
end repeat
on error
return ""
end try
return the_text
end left_side_strip
(*
* removes trim string from the right side of the text
* Note: you can also do something like this: text 1 thru ((length of the_text) - 1) of the_text
*)
on right_side_strip(the_text, trim_string)
set x to count trim_string
try
repeat while the_text ends with the trim_string
set the_text to characters 1 thru -(x + 1) of the_text as text
end repeat
on error
return ""
end try
return the_text
end right_side_strip
(*
* removes trim string from the left and right side of the text
*)
on left_and_right_side_strip(the_text, trim_string)
set the_text to left_side_strip(the_text, trim_string)
set the_text to right_side_strip(the_text, trim_string)
return the_text
end left_and_right_side_strip
script Util
(*
* Translate characters of a text
* Note: Pass the From and To tables as strings (same lenght!)
*)
on translate_chars(the_text, from_chars, to_chars)
set the newText to ""
if (count from_chars) is not equal to (count to_chars) then
error "translate_chars: From/To strings have different lenght"
end if
repeat with char in the_text
set newChar to char
set x to offset of char in the from_chars
if x is not 0 then set newChar to character x of the to_chars
set newText to newText & newChar
end repeat
return the newText
end translate_chars
end script |
C/LoDosLib/critsect.asm | p-k-p/SysToolsLib | 232 | 8309 | page ,132
;*****************************************************************************;
; ;
; FILE NAME: critsect.asm ;
; ;
; DESCRIPTION: Critical section management routines under Windows VMM ;
; ;
; NOTES: ;
; ;
; HISTORY: ;
; 1995/08/25 JFL Created this file. ;
; ;
; (c) Copyright 1995-2017 Hewlett Packard Enterprise Development LP ;
; Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 ;
;*****************************************************************************;
INCLUDE ADEFINE.INC ; For the segment definitions
.CODE
;-----------------------------------------------------------------------------;
; ;
; Function: BeginCriticalSection ;
; ;
; Description: Prevent VMM from switching virtual machines ;
; ;
; Parameters: None ;
; ;
; Returns: None ;
; ;
; Notes: ;
; ;
; Regs altered: AX. ;
; ;
; History: ;
; ;
; 1995/08/02 JFL Created this routine ;
; ;
;-----------------------------------------------------------------------------;
CFASTPROC BeginCriticalSection
mov ax, 1681H
int 2FH
ret
ENDCFASTPROC BeginCriticalSection
;-----------------------------------------------------------------------------;
; ;
; Function: EndCriticalSection ;
; ;
; Description: Authorize VMM to switch virtual machines again ;
; ;
; Parameters: None ;
; ;
; Returns: None ;
; ;
; Notes: ;
; ;
; Regs altered: AX. ;
; ;
; History: ;
; ;
; 1995/08/02 JFL Created this routine ;
; ;
;-----------------------------------------------------------------------------;
CFASTPROC EndCriticalSection
mov ax, 1682H
int 2FH
ret
ENDCFASTPROC EndCriticalSection
END
|
memsim-master/src/distribution.adb | strenkml/EE368 | 0 | 29539 | <filename>memsim-master/src/distribution.adb<gh_stars>0
with Ada.Text_IO; use Ada.Text_IO;
package body Distribution is
min_size : constant Address_Type := 4096;
procedure Set_Seed(dist : in out Distribution_Type;
seed : in Integer) is
begin
RNG.Reset(dist.generator, seed);
end Set_Seed;
procedure Insert(dist : in out Distribution_Type;
address : in Address_Type;
size : in Positive) is
function Check_Overlap(a, b : Range_Type) return Boolean is
a1 : constant Address_Type := a.start;
a2 : constant Address_Type := a1 + Address_Type(a.size) + min_size;
b1 : constant Address_Type := b.start;
b2 : constant Address_Type := b1 + Address_Type(b.size) + min_size;
begin
-- a1 b1 a2
-- b1 a1 b2
return (a1 <= b1 and b1 <= a2) or (b1 <= a1 and a1 <= b2);
end Check_Overlap;
procedure Extend_Range(r : in out Range_Type;
o : in Range_Type) is
r_end : constant Address_Type := r.start + Address_Type(r.size);
o_end : constant Address_Type := o.start + Address_Type(o.size);
begin
r.start := Address_Type'Min(r.start, o.start);
if o_end > r_end then
r.size := r.size + Positive(o_end - r_end);
end if;
end Extend_Range;
begin
-- Check if this address already exists.
for i in 1 .. Integer(dist.ranges.Length) loop
declare
r : Range_Type := dist.ranges.Element(i);
rsize : constant Address_Type := Address_Type(r.size);
rend : constant Address_Type := r.start + rsize;
begin
if address >= r.start and address < rend + min_size then
if address + Address_Type(size) > rend then
-- This address extends the range.
r.size := Positive(address + Address_Type(size) - r.start);
dist.ranges.Replace_Element(i, r);
end if;
return;
end if;
end;
end loop;
-- This is a new range.
declare
r : Range_Type := Range_Type'(address, size);
begin
-- Coalesce ranges with the new range.
-- We start at the end of the vector to avoid moving stuff.
for i in reverse 1 .. Integer(dist.ranges.Length) loop
declare
other : constant Range_Type := dist.ranges.Element(i);
begin
if Check_Overlap(r, other) then
Extend_Range(r, other);
dist.ranges.Delete(i);
end if;
end;
end loop;
-- Insert a new range.
dist.ranges.Append(r);
end;
end Insert;
procedure Push_Limit(dist : in out Distribution_Type;
lower : in Address_Type;
upper : in Address_Type) is
l : constant Limit_Type := Limit_Type'(trans => null,
lower => lower,
upper => upper);
begin
dist.limits.Append(l);
end Push_Limit;
procedure Pop_Limit(dist : in out Distribution_Type) is
begin
dist.limits.Delete_Last;
end Pop_Limit;
procedure Push_Transform(dist : in out Distribution_Type;
trans : in Applicative_Pointer) is
l : constant Limit_Type := Limit_Type'(trans => trans,
lower => 0,
upper => 0);
begin
dist.limits.Append(l);
end Push_Transform;
procedure Pop_Transform(dist : in out Distribution_Type) is
begin
dist.limits.Delete_Last;
end Pop_Transform;
function Get_Weighted_Value(dist : Distribution_Type;
start : Address_Type;
size : Positive;
alignment : Positive) return Address_Type is
addr : Address_Type := start;
nsize : Natural := size;
begin
loop
if nsize <= alignment then
return addr;
end if;
case RNG.Random(dist.generator) mod 8 is
when 0 => -- Use the first address.
return addr;
when 1 => -- Use the last address.
return addr + Address_Type(nsize - alignment);
when 2 .. 4 => -- Lower half of the range.
nsize := (nsize + 1) / 2;
when others => -- Upper half of the range.
addr := addr + Address_Type(nsize / 2);
nsize := (nsize + 1) / 2;
end case;
end loop;
end Get_Weighted_Value;
function Random_Address(dist : Distribution_Type;
alignment : Positive) return Address_Type is
r : Range_Type;
addr : Address_Type;
valid : Boolean;
count : Natural;
begin
-- We make multiple attempts to pick a valid address, otherwise
-- we settle for any address even if it is not valid.
-- It is possible that no valid addresses exist.
count := 100;
loop
-- Select a random range.
declare
i : Natural := RNG.Random(dist.generator);
begin
i := i mod Natural(dist.ranges.Length);
r := dist.ranges.Element(i + 1);
end;
-- Select an address in the range.
addr := Get_Weighted_Value(dist, r.start, r.size, alignment);
-- Transform the address and check validity.
valid := True;
for i in 1 .. Integer(dist.limits.Length) loop
declare
l : constant Limit_Type := dist.limits.Element(i);
begin
if l.trans /= null then
addr := Apply(l.trans.all, addr, True);
elsif addr < l.lower or addr > l.upper then
valid := False;
end if;
end;
end loop;
-- Enforce alignment.
-- This could push the addres outside of the range.
addr := addr - (addr mod Address_Type(alignment));
-- Exit if we have a valid address or exceeded the
-- max number of iterations.
count := count - 1;
exit when valid or count = 0;
end loop;
return addr;
end Random_Address;
function Random(dist : Distribution_Type) return Natural is
begin
return RNG.Random(dist.generator);
end Random;
procedure Print(dist : in Distribution_Type) is
size : Natural := 0;
begin
Put_Line("Ranges:");
for i in 1 .. Integer(dist.ranges.Length) loop
Put_Line(" " & Address_Type'Image(dist.ranges.Element(i).start) &
": " & Natural'Image(dist.ranges.Element(i).size));
size := size + dist.ranges.Element(i).size;
end loop;
Put_Line("Size: " & Natural'Image(size));
end Print;
end Distribution;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.