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 |
|---|---|---|---|---|
alloy/tp7/tube.als | motapinto/feup-mfes | 0 | 3658 | <gh_stars>0
/*
* Adapted from Exercise A.1.11 on page 236 of
* Software Abstractions, by <NAME>
*
* In this exercise, you'll write some constraints about a simplified version
* of the railway lines of the London Underground, or "tube". (You can find the
* real thing at http://tube.tfl.gov.uk/.) There are three lines shown: the
* Jubilee line running north to south from Stanmore; the Central line running
* west to east to Epping; and the Circle line running clockwise through Baker
* Street.
*
* A simplified portion of the tube is shown below
*
* Stanmore (jubilee line)
* x
* |
* | Baker Street (circle line)
* - x -
* / | \
* / | \
* | | | Epping (central line)
* -----------------|-------x
* | | |
* \ | /
* \ | /
* -----
* |
* |
*
* You are given the following relations:
*
* - Station:
* the set of all stations
*
* - JubileeStation, CentralStation, CircleStation:
* for each line, a subset of Station
*
* - jubliee, central, circle:
* binary relations relating stations on each line to one another if they
* are directly connected
*
* - Stanmore, BakerStreet, Epping
* singleton subsets of Station for individual stations
*
* Formalize each of the following statements using the Alloy logic in the
* model as indicated below.
* a) named stations are on exactly the lines as shown in graphic
* b) no station (including those unnamed) is on all three lines
* c) the Circle line forms a circle
* d) Jubilee is a straight line starting at Stanmore
* e) there's a station between Stanmore and BakerStreet
* f) it is possible to travel from BakerStreet to Epping
*/
sig Station {}
sig JubileeStation in Station {
jubilee: set JubileeStation
}
sig CentralStation in Station {
central: set CentralStation
}
sig CircleStation in Station {
circle: set CircleStation
}
one sig Stanmore, BakerStreet, Epping extends Station {}
fact {
// write the corresponding constraint below each statement
// a) named stations are on exactly the lines as shown in graphic
Stanmore in (JubileeStation - CentralStation) - CircleStation
BakerStreet in (JubileeStation & CircleStation) - CentralStation
Epping in (CentralStation - JubileeStation) - CircleStation
// b) no station (including those unnamed) is on all three lines
no (JubileeStation & CentralStation & CircleStation)
// c) the Circle line forms a circle
all s: CircleStation {
one s.circle
CircleStation in s.^circle
}
// d) Jubilee is a straight line starting at Stanmore
JubileeStation in Stanmore.*jubilee
all s: JubileeStation {
lone s.jubilee
s not in s.^jubilee
}
// e) there's a station between Stanmore and BakerStreet
let reach = ^jubilee | some Stanmore.reach & reach.BakerStreet
// f) it is possible to travel from BakerStreet to Epping
Epping in BakerStreet.^(jubilee + central + circle)
}
pred show {}
run show for 6
|
src/sys/encoders/util-encoders.ads | RREE/ada-util | 60 | 22853 | -----------------------------------------------------------------------
-- util-encoders -- Encode/Decode streams and strings from one format to another
-- Copyright (C) 2009, 2010, 2011, 2012, 2016, 2017, 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Streams;
with Ada.Finalization;
with Interfaces;
-- === Encoder and Decoders ===
-- The <b>Util.Encoders</b> package defines the <b>Encoder</b> and <b>Decode</b> objects
-- which provide a mechanism to transform a stream from one format into
-- another format.
--
-- ==== Simple encoding and decoding ====
--
package Util.Encoders is
pragma Preelaborate;
use Ada.Streams;
Not_Supported : exception;
Encoding_Error : exception;
-- Encoder/decoder for Base64 (RFC 4648)
BASE_64 : constant String := "base64";
-- Encoder/decoder for Base64 (RFC 4648) using the URL alphabet
-- (+ and / are replaced by - and _)
BASE_64_URL : constant String := "base64url";
-- Encoder/decoder for Base16 (RFC 4648)
BASE_16 : constant String := "base16";
HEX : constant String := "hex";
-- Encoder for SHA1 (RFC 3174)
HASH_SHA1 : constant String := "sha1";
-- ------------------------------
-- Secret key
-- ------------------------------
-- A secret key of the given length, it cannot be copied and is safely erased.
subtype Key_Length is Stream_Element_Offset range 1 .. Stream_Element_Offset'Last;
type Secret_Key (Length : Key_Length) is limited private;
-- Create the secret key from the password string.
function Create (Password : in String) return Secret_Key
with Pre => Password'Length > 0, Post => Create'Result.Length = Password'Length;
procedure Create (Password : in String;
Key : out Secret_Key)
with Pre => Password'Length > 0, Post => Key.Length = Password'Length;
procedure Create (Password : in Stream_Element_Array;
Key : out Secret_Key)
with Pre => Password'Length > 0, Post => Key.Length = Password'Length;
-- ------------------------------
-- Encoder context object
-- ------------------------------
-- The <b>Encoder</b> provides operations to encode and decode
-- strings or stream of data from one format to another.
-- The <b>Encoded</b> contains two <b>Transformer</b>
-- which either <i>encodes</i> or <i>decodes</i> the stream.
type Encoder is tagged limited private;
-- Encodes the input string <b>Data</b> using the transformation
-- rules provided by the <b>E</b> encoder.
--
-- Returns the encoded string.
--
-- Raises the <b>Encoding_Error</b> exception if the source string
-- cannot be encoded.
-- Raises the <b>Not_Supported</b> exception if the encoding is not
-- supported.
function Encode (E : in Encoder;
Data : in String) return String;
function Encode_Binary (E : in Encoder;
Data : in Ada.Streams.Stream_Element_Array) return String;
function Encode_Unsigned_16 (E : in Encoder;
Value : in Interfaces.Unsigned_16) return String;
function Encode_Unsigned_32 (E : in Encoder;
Value : in Interfaces.Unsigned_32) return String;
function Encode_Unsigned_64 (E : in Encoder;
Value : in Interfaces.Unsigned_64) return String;
-- Create the encoder object for the specified encoding format.
function Create (Name : in String) return Encoder;
type Decoder is tagged limited private;
-- Decodes the input string <b>Data</b> using the transformation
-- rules provided by the <b>E</b> encoder.
--
-- Returns the encoded string.
--
-- Raises the <b>Encoding_Error</b> exception if the source string
-- cannot be decoded.
-- Raises the <b>Not_Supported</b> exception if the decoding is not
-- supported.
function Decode (E : in Decoder;
Data : in String) return String;
function Decode_Binary (E : in Decoder;
Data : in String) return Ada.Streams.Stream_Element_Array;
-- Create the decoder object for the specified encoding format.
function Create (Name : in String) return Decoder;
-- ------------------------------
-- Stream Transformation interface
-- ------------------------------
-- The <b>Transformer</b> interface defines the operation to transform
-- a stream from one data format to another.
type Transformer is limited interface;
type Transformer_Access is access all Transformer'Class;
-- Transform the input array represented by <b>Data</b> into
-- the output array <b>Into</b>. The transformation made by
-- the object can be of any nature (Hex encoding, Base64 encoding,
-- Hex decoding, Base64 decoding, encryption, compression, ...).
--
-- If the transformer does not have enough room to write the result,
-- it must return in <b>Encoded</b> the index of the last encoded
-- position in the <b>Data</b> array.
--
-- The transformer returns in <b>Last</b> the last valid position
-- in the output array <b>Into</b>.
--
-- The <b>Encoding_Error</b> exception is raised if the input
-- array cannot be transformed.
procedure Transform (E : in out Transformer;
Data : in Ada.Streams.Stream_Element_Array;
Into : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Encoded : out Ada.Streams.Stream_Element_Offset) is abstract;
-- Finish encoding the input array.
procedure Finish (E : in out Transformer;
Into : in out Ada.Streams.Stream_Element_Array;
Last : in out Ada.Streams.Stream_Element_Offset) is null;
-- Transform the input string <b>Data</b> using the transformation
-- rules provided by the <b>E</b> transformer.
--
-- Returns the transformed string.
--
-- Raises the <b>Encoding_Error</b> exception if the source string
-- cannot be transformed
function Transform (E : in out Transformer'Class;
Data : in String) return String;
-- Transform the input string <b>Data</b> using the transformation
-- rules provided by the <b>E</b> transformer.
--
-- Returns the transformed string.
--
-- Raises the <b>Encoding_Error</b> exception if the source string
-- cannot be transformed
function Transform (E : in out Transformer'Class;
Data : in Ada.Streams.Stream_Element_Array) return String;
function Transform (E : in out Transformer'Class;
Data : in Ada.Streams.Stream_Element_Array)
return Ada.Streams.Stream_Element_Array;
-- Transform the input string <b>Data</b> using the transformation
-- rules provided by the <b>E</b> transformer and return the data in
-- the <b>Into</b> array, setting <b>Last</b> to the last index.
--
-- Raises the <b>Encoding_Error</b> exception if the source string
-- cannot be transformed
procedure Transform (E : in out Transformer'Class;
Data : in String;
Into : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
-- Encode the value represented by <tt>Val</tt> in the stream array <tt>Into</tt> starting
-- at position <tt>Pos</tt> in that array. The value is encoded using LEB128 format, 7-bits
-- at a time until all non zero bits are written. The <tt>Last</tt> parameter is updated
-- to indicate the position of the last valid byte written in <tt>Into</tt>.
procedure Encode_LEB128 (Into : in out Ada.Streams.Stream_Element_Array;
Pos : in Ada.Streams.Stream_Element_Offset;
Val : in Interfaces.Unsigned_64;
Last : out Ada.Streams.Stream_Element_Offset);
-- Decode from the byte array <tt>From</tt> the value represented as LEB128 format starting
-- at position <tt>Pos</tt> in that array. After decoding, the <tt>Last</tt> index is updated
-- to indicate the last position in the byte array.
procedure Decode_LEB128 (From : in Ada.Streams.Stream_Element_Array;
Pos : in Ada.Streams.Stream_Element_Offset;
Val : out Interfaces.Unsigned_64;
Last : out Ada.Streams.Stream_Element_Offset);
private
use Ada.Finalization;
type Secret_Key (Length : Key_Length) is limited new Limited_Controlled with record
Secret : Ada.Streams.Stream_Element_Array (1 .. Length) := (others => 0);
end record;
overriding
procedure Finalize (Object : in out Secret_Key);
-- Transform the input data into the target string.
procedure Convert (E : in out Transformer'Class;
Data : in Ada.Streams.Stream_Element_Array;
Into : out String);
type Encoder is limited new Limited_Controlled with record
Encode : Transformer_Access := null;
end record;
-- Delete the transformers
overriding
procedure Finalize (E : in out Encoder);
type Decoder is limited new Limited_Controlled with record
Decode : Transformer_Access := null;
end record;
-- Delete the transformers
overriding
procedure Finalize (E : in out Decoder);
end Util.Encoders;
|
libpal/intel_64bit_systemv_nasm/vmcall_kvm.asm | mars-research/pal | 26 | 169965 | bits 64
default rel
section .text
global pal_execute_vmcall_kvm
pal_execute_vmcall_kvm :
push rbx
mov rax, rdi
mov rbx, rsi
xchg rcx, rdx
mov rsi, r8
vmcall
pop rbx
ret
|
test/LaTeXAndHTML/succeed/Σ.agda | L-TChen/agda | 0 | 4198 | module Σ where
A : Set₁
A = Set
|
programs/oeis/014/A014038.asm | neoneye/loda | 22 | 8083 | <gh_stars>10-100
; A014038: Inverse of 29th cyclotomic polynomial.
; 1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0
sub $1,$0
mod $1,29
pow $1,$1
mov $0,$1
|
test/Fail/Issue3606.agda | shlevy/agda | 1,989 | 8466 |
postulate
A : Set
P : A → Set
record ΣAP : Set where
no-eta-equality
field
fst : A
snd : P fst
open ΣAP
test : (x : ΣAP) → P (fst x)
test x = snd {!!}
|
orka/src/orka/implementation/orka-cameras.adb | onox/orka | 52 | 16890 | <gh_stars>10-100
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.Transforms.Doubles.Quaternions;
package body Orka.Cameras is
function Projection_Matrix (Object : Camera_Lens) return Transforms.Matrix4 is
Width : constant GL.Types.Single := GL.Types.Single (Object.Width);
Height : constant GL.Types.Single := GL.Types.Single (Object.Height);
use type GL.Types.Single;
begin
if Object.Reversed_Z then
return Transforms.Infinite_Perspective_Reversed_Z (Object.FOV, Width / Height, 0.1);
else
return Transforms.Infinite_Perspective (Object.FOV, Width / Height, 0.1);
end if;
end Projection_Matrix;
-----------------------------------------------------------------------------
procedure Set_Input_Scale
(Object : in out Camera;
X, Y, Z : GL.Types.Double) is
begin
Object.Scale := (X, Y, Z, 0.0);
end Set_Input_Scale;
procedure Set_Up_Direction
(Object : in out Camera;
Direction : Vector4) is
begin
Object.Up := Direction;
end Set_Up_Direction;
function Lens (Object : Camera) return Camera_Lens is (Object.Lens);
procedure Set_Lens (Object : in out Camera; Lens : Camera_Lens) is
begin
Object.Lens := Lens;
end Set_Lens;
procedure Set_Position
(Object : in out First_Person_Camera;
Position : Vector4) is
begin
Object.Position := Position;
end Set_Position;
overriding
procedure Look_At
(Object : in out Third_Person_Camera;
Target : Behaviors.Behavior_Ptr) is
begin
Object.Target := Target;
end Look_At;
-----------------------------------------------------------------------------
overriding
function View_Position (Object : First_Person_Camera) return Vector4 is
(Object.Position);
overriding
function Target_Position (Object : Third_Person_Camera) return Vector4 is
(Object.Target.Position);
-----------------------------------------------------------------------------
function Create_Lens
(Width, Height : Positive;
FOV : GL.Types.Single;
Context : Contexts.Context'Class) return Camera_Lens is
begin
return
(Width => Width,
Height => Height,
FOV => FOV,
Reversed_Z => Context.Enabled (Contexts.Reversed_Z));
end Create_Lens;
function Projection_Matrix (Object : Camera) return Transforms.Matrix4 is
(Projection_Matrix (Object.Lens));
function Look_At (Target, Camera, Up_World : Vector4) return Matrix4 is
use Orka.Transforms.Doubles.Vectors;
Forward : constant Vector4
:= Normalize ((Target - Camera));
Side : constant Vector4 := Normalize (Cross (Forward, Up_World));
Up : constant Vector4 := Cross (Side, Forward);
begin
return
((Side (X), Up (X), -Forward (X), 0.0),
(Side (Y), Up (Y), -Forward (Y), 0.0),
(Side (Z), Up (Z), -Forward (Z), 0.0),
(0.0, 0.0, 0.0, 1.0));
end Look_At;
function Rotate_To_Up (Object : Camera'Class) return Matrix4 is
package Quaternions renames Orka.Transforms.Doubles.Quaternions;
use Orka.Transforms.Doubles.Matrices;
begin
return R (Vector4 (Quaternions.R (Y_Axis, Object.Up)));
end Rotate_To_Up;
protected body Change_Updater is
procedure Set (Value : Vector4) is
use Orka.Transforms.Doubles.Vectors;
begin
Change := Change + Value;
Is_Set := True;
end Set;
procedure Get (Value : in out Vector4) is
use Orka.Transforms.Doubles.Vectors;
use type Vector4;
begin
Value (X) := Change (X);
Value (Y) := Change (Y);
Value (Z) := Change (Z);
Value (W) := Change (W);
if Is_Set then
Change := (0.0, 0.0, 0.0, 0.0);
end if;
end Get;
end Change_Updater;
end Orka.Cameras;
|
src/decadriver.ads | SALLYPEMDAS/DW1000 | 9 | 23490 | <reponame>SALLYPEMDAS/DW1000
-------------------------------------------------------------------------------
-- Copyright (c) 2019 <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.
-------------------------------------------------------------------------------
with Ada.Real_Time;
with Ada.Synchronous_Task_Control;
with DecaDriver_Config;
with DW1000.BSP;
with DW1000.Driver; use DW1000.Driver;
with DW1000.Register_Types; use DW1000.Register_Types;
with DW1000.System_Time; use DW1000.System_Time;
with DW1000.Types; use DW1000.Types;
-- @summary
-- High-level Ravenscar driver for typical usage of the DW1000.
--
-- @description
-- This driver provides a high-level API for configuring and using the DW1000.
--
-- This driver consists of three protected objects:
-- * Driver: Provides general configuration for the DW1000.
-- * Receiver: Provides functionality for receiving packets.
-- * Transmitter: Provides functionality for transmitting packets.
--
-- Before the DW1000 can be used, it must be initialized and configured.
-- This is done using the Driver.Initialize and Driver.Configure procedures.
-- The Initialize procedure initializes the DW1000 and, if specified by the
-- user, loads certain values from the DW1000 OTP memory, such as the antenna
-- delay. Below is an example of initializing the DW1000 and driver:
--
-- DecaDriver.Core.Driver.Initialize (Load_Antenna_Delay => True,
-- Load_XTAL_Trim => True,
-- Load_Tx_Power_Levels => True,
-- Load_UCode_From_ROM => True);
--
-- After the DW1000 has been initialized, it can be set to a specific
-- configuration (UWB channel, PRF, preamble code, etc...) using the Configure
-- procedure. Below is an example of configuring the DW1000:
--
-- DecaDriver.Core.Driver.Configure (DecaDriver.Configuration_Type'
-- (Channel => 1,
-- PRF => DW1000.Driver.PRF_64MHz,
-- Tx_Preamble_Length => DW1000.Driver.PLEN_1024,
-- Tx_PAC => DW1000.Driver.PAC_32,
-- Tx_Preamble_Code => 9,
-- Rx_Preamble_Code => 9,
-- Use_Nonstandard_SFD => False,
-- Data_Rate => DW1000.Driver.Data_Rate_850k,
-- PHR_Mode => DW1000.Driver.Standard_Frames,
-- Enable_Smart_Power => True));
--
-- Note that some configuration parameters use values that are defined in the
-- package DW1000.Driver.
--
-- If the transmitter is to be used, then the transmit power must be
-- configured to ensure that the DW1000 transmits at a suitable power level
-- within the -41.3 dBm/MHz regulatory limit. The transmit power depends on
-- the UWB channel and PRF that has been configured, as well as the specific
-- RF circuitry and antenna that is being used.
--
-- Furthermore, the DW1000 supports two modes of transmit power: manual
-- transmit power and smart transmit power. In the manual transmit power mode
-- the power for the SHR and PHR portions of the physical frame are configured
-- independently. In the smart transmit power mode different levels of
-- transmit power can be configured for different physical frame lengths;
-- shorter frames can be configured to transmit at a higher power.
--
-- The power level is configured using a combination of a coarse gain and fine
-- gain values. The coarse gain permits the range 0.0 .. 18.0 dB in steps of
-- 3 dB, and the fine gain permits the range 0.0 .. 15.5 dB in steps of
--- 0.5 dB. The coarse gain output can also be disabled.
--
-- Below is an example of configuring the DW1000 to operate in manual
-- transmit power mode, with the SHR and PHR portions of the frame configured
-- to transmit with a total gain of 19.5 dBm:
--
-- DecaDriver.Tx.Transmitter.Configure_Tx_Power
-- (Smart_Tx_Power_Enabled => False,
-- Boost_SHR => (Coarse_Gain_Enabled => True,
-- Coarse_Gain => 9.0,
-- Fine_Gain => 10.5),
-- Boost_PHR => (Coarse_Gain_Enabled => True,
-- Coarse_Gain => 9.0,
-- Fine_Gain => 10.5));
--
-- Since the transmit power is different for each hardware design this driver
-- cannot automatically configure the correct transmit power. The host
-- application must define the power to use for each UWB channel and PRF.
-- The package EVB1000_Tx_Power defines reference values, suitable for use
-- with the DecaWave EVB1000 evaluation boards using the 0 dBi antenna.
--
-- Once the driver is initialized and configured then packets can be sent
-- and received. Sending a packet is split into the following steps:
-- 1. Write the data into the DW1000 transmit buffer.
-- 2. Set the frame length information.
-- 3. Start the transmission.
--
-- Below is an example of sending a zeroized packet of 10 bytes:
--
-- declare
-- Data : DW1000.Types.Byte_Array(1 .. 10) := (others => 0);
-- begin
-- DecaDriver.Tx.Transmitter.Set_Tx_Data (Data => Data,
-- Offset => 0);
-- DecaDriver.Tx.Transmitter.Set_Tx_Frame_Length
-- (Length => Data'Length,
-- Offset => 0);
-- DecaDriver.Tx.Transmitter.Start_Tx_Immediate (Rx_After_Tx => False);
-- end;
--
-- Note that the receiver can be automatically enabled by the DW1000 after the
-- transmission has completed. This feature is enabled by setting Rx_After_Tx
-- to True when calling Start_Tx_Immediate.
--
-- To wait for the transmission to be completed, you can wait using the
-- Wait_For_Tx_Complete entry. This entry will block until the DW1000 signals
-- to the driver that the transmission has been completed. An example is shown
-- below:
--
-- DecaDriver.Tx.Transmitter.Wait_For_Tx_Complete;
--
-- Packets can only be received when the receiver is enabled. To enable the
-- receiver immediately (without delay), then use the
-- Receiver.Start_Rx_Immediate procedure. Then, to block until a packet is
-- received, use the Receiver.Wait entry. An example of waiting for a packet
-- is shown below:
--
-- declare
-- Frame_Data : DW1000.Types.Byte_Array (DecaDriver.Frame_Length_Number);
-- Length : DW1000.Types.Frame_Length_Number;
-- Timestamp : DW1000.System_Time.Fine_System_Time;
-- Error : DecaDriver.Rx.Rx_Errors;
-- Overrun : Boolean;
-- begin
-- DecaDriver.Rx.Receiver.Start_Rx_Immediate;
-- DecaDriver.Rx.Receiver.Wait (Frame => Frame_Data,
-- Length => Length,
-- Timestamp => Timestamp,
-- Error => Error,
-- Overrun => Overrun);
--
-- if Error = DecaDriver.Rx.No_Error then
-- -- No error occurred
-- else
-- -- An error occurred during packet reception.
-- end if;
--
-- if Overrun then
-- -- A packet was received before this packet, but it was dropped
-- -- because there was no free space in the receive queue.
-- end if;
-- end;
--
-- During packet reception it is possible for several different types of error
-- to occur. The Receiver driver can be configured to ignore certain errors,
-- so that the Wait entry will only wait for valid frames to be received.
-- To configure which errors are filtered, use the Driver.Configure_Errors
-- procedure. An example of using this procedure to disable all receive error
-- notifications (only wait for valid packets) is shown below:
--
-- DecaDriver.Core.Driver.Configure_Errors (Frame_Timeout => False,
-- SFD_Timeout => False,
-- PHR_Error => False,
-- RS_Error => False,
-- FCS_Error => False);
--
-- By default, all errors are suppressed so that the Receiver.Wait entry will
-- only capture frames that are received without errors.
--
-- It is possible to enable the transmitter or receiver at a specific time,
-- rather than starting the transmission/reception immediately. This is known
-- as the "delayed tx/rx" feature. Typically, this is used to enable the
-- transmitter or receiver after a delay relative to a previous transmission
-- or reception. Below is an example of waiting for a packet to be received,
-- and then transmitting the received packet 10 milliseconds after the packet
-- was received:
--
-- declare
-- Frame_Data : DW1000.Types.Byte_Array (DecaDriver.Frame_Length_Number);
-- Length : DW1000.Types.Frame_Length_Number;
-- Rx_Time : DW1000.System_Time.Fine_System_Time;
-- Error : DecaDriver.Rx.Rx_Errors;
-- Overrun : Boolean;
--
-- Tx_Time : DW1000.System_Time.Coarse_System_Time;
-- Tx_Result : DW1000.Driver.Result_Codes;
-- begin
-- -- Wait for a packet
-- DecaDriver.Rx.Receiver.Start_Rx_Immediate;
-- DecaDriver.Rx.Receiver.Wait (Frame => Frame_Data,
-- Length => Length,
-- Timestamp => Rx_Time,
-- Error => Error,
-- Overrun => Overrun);
--
-- if Error = DecaDriver.Rx.No_Error then
-- -- Compute the transmit time (10 ms after the receive time)
-- Tx_Time :=
-- DW1000.System_Time.To_Coarse_System_Time
-- (DW1000.System_Time.System_Time_Offset (Rx_Time, 0.01));
--
-- -- Configure the time at which the transmitter should be enabled
-- DecaDriver.Tx.Transmitter.Set_Delayed_Tx_Time (Time => Tx_Time);
--
-- -- Begin the delayed transmission
-- DecaDriver.Tx.Transmitter.Start_Tx_Delayed
-- (Rx_After_Tx => False,
-- Result => Tx_Result);
--
-- if Result = DW1000.Driver.Success then
-- -- The delayed transmission was configured successfully.
-- else
-- -- Delayed transmit failed. The transmit time is already passed
-- end if;
-- end if;
-- end;
--
-- The delayed transmission can fail if the target transmit time has already
-- passed when Transmitter.Start_Tx_Delayed is called. E.g. in the above
-- example, the delayed transmit will fail if Start_Tx_Delayed is called after
-- the 10 ms delay has already passed. This can happen in cases such as the
-- task being blocked for too long by a higher-priority task.
package DecaDriver
with SPARK_Mode => On
is
Tx_Complete_Flag : Ada.Synchronous_Task_Control.Suspension_Object;
-- This is set to False by the DecaDriver each time a transmit operation is
-- started (Start_Tx_Immediate or Start_Tx_Delayed). It is then set to
-- True when the packet has been transmitted.
--
-- A task can block on this flag to wait until a packet has finished
-- transmitting. Here's an example which starts transmitting a packet, then
-- waits for the transmit to finish.
--
-- DecaDriver.Driver.Start_Tx_Immediate (False, False);
-- Suspend_Until_True (DecaDriver.Tx_Complete_Flag);
type Configuration_Type is record
Channel : DW1000.Driver.Channel_Number;
PRF : DW1000.Driver.PRF_Type;
Tx_Preamble_Length : DW1000.Driver.Preamble_Lengths;
Rx_PAC : DW1000.Driver.Preamble_Acq_Chunk_Length;
Tx_Preamble_Code : DW1000.Driver.Preamble_Code_Number;
Rx_Preamble_Code : DW1000.Driver.Preamble_Code_Number;
Use_Nonstandard_SFD : Boolean;
Data_Rate : DW1000.Driver.Data_Rates;
PHR_Mode : DW1000.Driver.Physical_Header_Modes;
SFD_Timeout : DW1000.Driver.SFD_Timeout_Number;
end record;
type Rx_Status_Type is
(No_Error,
Frame_Timeout,
Preamble_Timeout,
SFD_Timeout,
PHR_Error,
RS_Error,
FCS_Error);
-- Receiver status / error codes.
type Frame_Info_Type is record
RX_TIME_Reg : RX_TIME_Type := (others => <>);
RX_FINFO_Reg : RX_FINFO_Type := (others => <>);
RX_FQUAL_Reg : RX_FQUAL_Type := (others => <>);
RXPACC_NOSAT_Reg : RXPACC_NOSAT_Type := (others => 0);
RX_TTCKI_Reg : RX_TTCKI_Type := (others => <>);
RX_TTCKO_Reg : RX_TTCKO_Type := (others => <>);
SFD_LENGTH : Bits_8 := 0;
Non_Standard_SFD : Boolean := False;
end record;
-- Stores metadata about received frames.
--
-- This stores a snapshot from various registers after a packet is
-- received. Information can be derived from these registers, such as
-- the estimated receive signal strength indication (RSSI), the
-- receive timestamp, etc...
subtype Frame_Length_Number is Natural
range 0 .. DecaDriver_Config.Maximum_Receive_Frame_Length;
-------------------------
-- Utility Functions --
-------------------------
function Receive_Timestamp (Frame_Info : in Frame_Info_Type)
return Fine_System_Time;
-- Get the corrected timestamp for the time of packet reception.
--
-- This timestamp marks the time at which the start of frame delimiter
-- (SFD) part of the physical frame was received by the DW1000. It is
-- used for the time-of-flight ranging algorithms.
function Receive_Signal_Power (Frame_Info : in Frame_Info_Type)
return Float
with Post => Receive_Signal_Power'Result in -166.90 .. -14.43;
-- Get the estimated receive signal power in dBm.
function First_Path_Signal_Power (Frame_Info : in Frame_Info_Type)
return Float
with Post => First_Path_Signal_Power'Result in -218.07 .. -12.66;
-- Get the estimated first path power in dBm.
function Transmitter_Clock_Offset (Frame_Info : in Frame_Info_Type)
return Long_Float
with Post => Transmitter_Clock_Offset'Result in -1.0 .. 1.0;
-- Calculate the clock offset between the receiver's and transmitter's
-- clocks.
--
-- Since the transmitter and receiver radios are clocked by their own
-- crystals, there can be a slight variation between the crystals'
-- frequencies. This function provides a measure of the offset
-- between this receiver and the remote transmitter clocks.
--
-- @param Frame_Info The frame information record for the received frame.
--
-- @return The computed clock offset. A positive value indicates that the
-- transmitter's clock is running faster than the receiver's clock, and
-- a negative value indicates that the transmitter's clock is running
-- slower than the receiver's clock. For example, a value of 7.014E-06
-- indicates that the transmitter is faster by 7 ppm. Likewise, a value
-- of -5.045E-06 indicates that the transmitter's clock is slower by
-- 5 ppm.
------------------------------
-- Implementation details --
------------------------------
-- These definitions are not expected to be useful to user applications.
package Implementation is
type Rx_Frame_Type is record
Length : Frame_Length_Number := 0;
Frame : Byte_Array (1 .. Frame_Length_Number'Last) := (others => 0);
Frame_Info : Frame_Info_Type := (others => <>);
Status : Rx_Status_Type := No_Error;
Overrun : Boolean := False;
end record
with Predicate =>
(if Status /= No_Error then Length = 0);
type Rx_Frame_Queue_Index is mod DecaDriver_Config.Receiver_Queue_Length;
subtype Rx_Frame_Queue_Count is Natural range 0 .. DecaDriver_Config.Receiver_Queue_Length;
type Rx_Frame_Queue_Type is
array (Rx_Frame_Queue_Index)
of Rx_Frame_Type;
end Implementation;
--------------
-- Driver --
--------------
protected Driver
with Interrupt_Priority => DecaDriver_Config.Driver_Priority
is
procedure Initialize (Load_Antenna_Delay : in Boolean;
Load_XTAL_Trim : in Boolean;
Load_UCode_From_ROM : in Boolean)
with Global => (In_Out => DW1000.BSP.Device_State,
Input => Ada.Real_Time.Clock_Time),
Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State,
Driver,
Load_Antenna_Delay,
Load_XTAL_Trim,
Load_UCode_From_ROM),
Driver =>+ (DW1000.BSP.Device_State,
Load_Antenna_Delay,
Load_XTAL_Trim,
Load_UCode_From_ROM),
null => Ada.Real_Time.Clock_Time);
-- Initialize the DecaDriver and DW1000.
--
-- If Load_Antenna_Delay is True then the antenna delay is read from the
-- DW1000 OTP memory and is stored in this DecaDriver. The antenna delay
-- is applied when the Configure procedure is called.
--
-- If Load_XTAL_Trim is True then the XTAL trim is read from the DW1000
-- OTP memory and is stored in this DecaDriver. The XTAL trim is applied
-- when the Configure procedure is called.
--
-- If Load_Tx_Power_Levels is True then the transmit power levels are
-- read from the DW1000 OTP memory and is stored in this DecaDriver. The
-- transmit power levels are applied when the Configure procedure is
-- called, based on the specific configuration (channel & PRF).
--
-- If Load_UCode_From_ROM is True then the LDE microcode is loaded from
-- the DW1000's ROM into the DW1000's RAM. This is necessary for the LDE
-- algorithm to operate. If this is False then the LDE algorithm is
-- disabled and is not run when packets are received.
procedure Configure (Config : in Configuration_Type)
with Global => (In_Out => DW1000.BSP.Device_State),
Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State,
Config,
Driver),
Driver =>+ Config);
-- Configure the DW1000 for a specific channel, PRF, preamble, etc...
procedure Configure_Errors (Enable_Frame_Timeout : in Boolean;
Enable_SFD_Timeout : in Boolean;
Enable_PHR_Error : in Boolean;
Enable_RS_Error : in Boolean;
Enable_FCS_Error : in Boolean)
with Global => null,
Depends => (Driver =>+ (Enable_Frame_Timeout,
Enable_SFD_Timeout,
Enable_PHR_Error,
Enable_RS_Error,
Enable_FCS_Error));
-- Configure which error notifications are enabled.
--
-- @param Frame_Timeout Set to True if error notifications should be
-- given for frame timeout events. When False, the frame timeout
-- event is ignored.
--
-- @param SFD_Timeout Set to True if error notifications should be
-- given for SFD timeout events. When False, the SFD timeout
-- event is ignored.
--
-- @param PHR_Error Set to True if error notifications should be
-- given for physical header error events. When False, the physical
-- header errors are ignored.
--
-- @param RS_Error Set to True if error notifications should be
-- given when a frame could not be decoded because an uncorrectable
-- error was detected in the Reed-Solomon decoder. When False, the
-- Reed-Solomon decoding errors are ignored.
--
-- @param FCS_Error Set to True if error notifications should be
-- given for packets with an invalid FCS. When False, then FCS errors
-- are ignored.
procedure Force_Tx_Rx_Off
with Global => (In_Out => (DW1000.BSP.Device_State, Tx_Complete_Flag)),
Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State,
Driver => Driver,
Tx_Complete_Flag =>+ null);
-- Switch off the transmitter and receiver.
--
-- This will abort any reception or transmission currently in progress.
function Get_Part_ID return Bits_32;
function Get_Lot_ID return Bits_32;
function PHR_Mode return DW1000.Driver.Physical_Header_Modes
with Depends => (PHR_Mode'Result => Driver);
procedure Start_Tx_Immediate (Rx_After_Tx : in Boolean;
Auto_Append_FCS : in Boolean)
with Global => (In_Out => (DW1000.BSP.Device_State, Tx_Complete_Flag)),
Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State,
Rx_After_Tx,
Auto_Append_FCS),
Driver => Driver,
Tx_Complete_Flag =>+ null);
-- Start a transmission of a packet immediate (without a delay).
--
-- The packet data is set by calling Set_Tx_Data to program the data
-- into the DW1000's transmit buffer.
--
-- The frame length information must be set before calling Start_Tx
-- by calling Set_Tx_Frame_Length.
--
-- If Rx_After_Tx is set to True then the receiver is automatically
-- enabled after the transmission is completed.
--
-- If Auto_Append_FCS is set to True then the DW1000 will automatically
-- calculate and append the 2-byte frame check sequence (FCS) to the
-- transmitted frame.
procedure Start_Tx_Delayed
(Rx_After_Tx : in Boolean;
Result : out DW1000.Driver.Result_Type)
with Global => (In_Out => (DW1000.BSP.Device_State, Tx_Complete_Flag)),
Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State,
Rx_After_Tx),
Result => (DW1000.BSP.Device_State,
Rx_After_Tx),
Driver =>+ null,
Tx_Complete_Flag =>+ (Rx_After_Tx,
DW1000.BSP.Device_State));
-- Start a delayed transmission of a packet.
--
-- The packet data is set by calling Set_Tx_Data to program the data
-- into the DW1000's transmit buffer.
--
-- The frame length information must be set before calling Start_Tx
-- by calling Set_Tx_Frame_Length.
--
-- If Rx_After_Tx is set to True then the receiver is automatically
-- enabled after the transmission is completed.
--
-- Note that the time at which the packet should be transmitted must be
-- set before calling Start_Tx_Delayed, by using the Set_Tx_Time
-- procedure.
entry Rx_Wait (Frame : in out Byte_Array;
Length : out Frame_Length_Number;
Frame_Info : out Frame_Info_Type;
Status : out Rx_Status_Type;
Overrun : out Boolean)
with Depends => (Frame =>+ Driver,
Frame_Info => Driver,
Length => Driver,
Driver => Driver,
Status => Driver,
Overrun => Driver),
Pre => Frame'Length > 0,
Post => (if Status /= No_Error then Length = 0);
-- Waits for a frame to be received, or an error. When a frame is
-- received (or if one has been previously received and is waiting to be
-- read) then the frame's content and size are copied to the Frame and
-- Length arguments.
--
-- If any of the enabled errors occurs (e.g. an FCS error is detected)
-- then the Status argument is set to specify the type of receive error
-- that occurred, Length is set to 0, and the contents of the Frame
-- array are unmodified.
--
-- If no error occurs (Status is set to No_Error) then the frame
-- contents are copied to the Frame array, and Length is set to the
-- length of the frame (in bytes). If the Frame array is too small to
-- store the received frame then the frame's contents are truncated, but
-- the Length argument still reflects the frame's true size.
--
-- If the Frame array is larger than the received frame then the extra
-- bytes in the Frame array are unmodified.
--
-- When a valid frame is successfully received information about the
-- received frame is copied to the Frame_Info output parameter. This
-- information can be used to calculate various values about the
-- received frame, such as the estimated receive signal power and the
-- clock offset between the transmitter and receiver.
--
-- @param Frame If a frame has been successfully received
-- (Status = No_Error) then the contents of the frame are copied to
-- this array. If this array is too small to store the entire
-- frame then the frame is truncated.
--
-- @param Length The length of the received frame in bytes. If the frame
-- was received successfully then this value is a natural number
-- (a frame length of 0 is possible). Otherwise, if an error occurred
-- then this value is set to 0 always.
--
-- @param Frame_Info When a frame is successfully received information
-- about the received frame is stored in this output parameter, and
-- can be used to calculate various information about the frame, such
-- as the estimated receive signal power, and the clock offset
-- between the transmitter and receiver.
--
-- @param Status Indicates whether or not a frame was successfully
-- received. If a frame was successfully received then this parameter
-- is set to No_Error. Otherwise, if an error occurred then Status
-- indicates the cause of the error (e.g. an invalid FCS).
--
-- @param Overrun Indicates whether or not an overrun condition has
-- occurred. This output parameter is set to True when one or more
-- frames have been dropped before the reception of this frame, due
-- to insufficient buffer space.
function Pending_Frames_Count return Natural
with Post => (Pending_Frames_Count'Result
<= DecaDriver_Config.Receiver_Queue_Length);
-- Returns the number of received frames that are waiting to be read.
procedure Discard_Pending_Frames
with Depends => (Driver => Driver);
-- Discard any pending frames that have been received, but have not yet
-- been read.
procedure Start_Rx_Immediate
with Global => (In_Out => DW1000.BSP.Device_State),
Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State,
Driver => Driver);
-- Turn on the receiver immediately (without delay).
procedure Start_Rx_Delayed (Result : out Result_Type)
with Global => (In_Out => DW1000.BSP.Device_State),
Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State,
Result => DW1000.BSP.Device_State,
Driver => Driver);
-- Turn on the receiver at the configured delay time.
--
-- The time at which the receiver should be enabled is programmed
-- using the Set_Delayed_Rx_Time procedure, which must be called before
-- calling this procedure.
private
procedure Frame_Received
with Global => (In_Out => DW1000.BSP.Device_State),
Depends => (DW1000.BSP.Device_State =>+ Driver,
Driver =>+ DW1000.BSP.Device_State);
-- Reads a received frame from the DW1000.
--
procedure Receive_Error (Result : in Rx_Status_Type)
with Depends => (Driver =>+ Result),
Pre => Result /= No_Error;
procedure DW1000_IRQ
with Attach_Handler => DecaDriver_Config.DW1000_IRQ_Id,
Global => (In_Out => (DW1000.BSP.Device_State, Tx_Complete_Flag)),
Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State,
Driver),
Driver => (DW1000.BSP.Device_State,
Driver),
Tx_Complete_Flag =>+ DW1000.BSP.Device_State);
-- DW1000 IRQ handler.
--
-- This performs functionality for packet reception and transmission.
pragma Annotate (GNATprove, False_Positive,
"this interrupt might be reserved",
"The interrupt is assumed to not be reserved");
---------------------------
-- Configuration Items --
---------------------------
Part_ID : Bits_32 := 0;
Lot_ID : Bits_32 := 0;
Antenna_Delay_PRF_64 : Antenna_Delay_Time := 0.0;
Antenna_Delay_PRF_16 : Antenna_Delay_Time := 0.0;
XTAL_Trim : FS_XTALT_Field := 2#1_0000#;
Long_Frames : Boolean := False;
SYS_CFG_Reg : SYS_CFG_Type := SYS_CFG_Type'
(PHR_MODE => Standard_Frames_Mode,
others => <>);
Use_OTP_XTAL_Trim : Boolean := False;
Use_OTP_Antenna_Delay : Boolean := False;
Detect_Frame_Timeout : Boolean := True;
Detect_SFD_Timeout : Boolean := True;
Detect_PHR_Error : Boolean := True;
Detect_RS_Error : Boolean := True;
Detect_FCS_Error : Boolean := True;
------------------------------
-- Packet Reception Queue --
------------------------------
Frame_Queue : Implementation.Rx_Frame_Queue_Type
:= (others => (Length => 0,
Frame => (others => 0),
Frame_Info => (RX_TIME_Reg => (others => <>),
RX_FINFO_Reg => (others => <>),
RX_FQUAL_Reg => (others => <>),
RXPACC_NOSAT_Reg => (others => 0),
RX_TTCKI_Reg => (others => <>),
RX_TTCKO_Reg => (others => <>),
SFD_LENGTH => 0,
Non_Standard_SFD => False),
Status => No_Error,
Overrun => False));
-- Cyclic buffer for storing received frames, read from the DW1000.
Queue_Head : Implementation.Rx_Frame_Queue_Index
:= Implementation.Rx_Frame_Queue_Index'Last;
Rx_Count : Implementation.Rx_Frame_Queue_Count := 0;
Overrun_Occurred : Boolean := False;
Frame_Ready : Boolean := False;
end Driver;
end DecaDriver;
|
programs/oeis/033/A033397.asm | neoneye/loda | 22 | 19902 | ; A033397: a(n) = floor(77/n).
; 77,38,25,19,15,12,11,9,8,7,7,6,5,5,5,4,4,4,4,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
add $0,1
mov $1,77
div $1,$0
mov $0,$1
|
source/TextEdit.popclipext/TextEdit.applescript | cnstntn-kndrtv/PopClip-Extensions | 1,262 | 2356 | <reponame>cnstntn-kndrtv/PopClip-Extensions
tell application "TextEdit"
activate
set theDocument to make new document
set text of theDocument to "{popclip text}"
end tell |
programs/oeis/289/A289721.asm | neoneye/loda | 22 | 166274 | ; A289721: Let a(0)=1. Then a(n) = sums of consecutive strings of positive integers of length 3*n, starting with the integer 2.
; 1,9,45,135,306,585,999,1575,2340,3321,4545,6039,7830,9945,12411,15255,18504,22185,26325,30951,36090,41769,48015,54855,62316,70425,79209,88695,98910,109881,121635,134199,147600,161865,177021,193095,210114,228105,247095,267111,288180,310329,333585,357975,383526,410265,438219,467415,497880,529641,562725,597159,632970,670185,708831,748935,790524,833625,878265,924471,972270,1021689,1072755,1125495,1179936,1236105,1294029,1353735,1415250,1478601,1543815,1610919,1679940,1750905,1823841,1898775,1975734,2054745,2135835,2219031,2304360,2391849,2481525,2573415,2667546,2763945,2862639,2963655,3067020,3172761,3280905,3391479,3504510,3620025,3738051,3858615,3981744,4107465,4235805,4366791
seq $0,81583 ; Third row of Pascal-(1,2,1) array A081577.
trn $0,2
add $0,1
|
src/fot/FOTC/Program/GCD/Total/CorrectnessProofI.agda | asr/fotc | 11 | 16795 | <filename>src/fot/FOTC/Program/GCD/Total/CorrectnessProofI.agda
------------------------------------------------------------------------------
-- The gcd program is correct
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- This module proves the correctness of the gcd program using
-- the Euclid's algorithm.
module FOTC.Program.GCD.Total.CorrectnessProofI where
open import FOTC.Base
open import FOTC.Data.Nat.Type
open import FOTC.Program.GCD.Total.CommonDivisorI using ( gcdCD )
open import FOTC.Program.GCD.Total.Definitions using ( gcdSpec )
open import FOTC.Program.GCD.Total.DivisibleI using ( gcdDivisible )
open import FOTC.Program.GCD.Total.GCD using ( gcd )
------------------------------------------------------------------------------
-- The gcd is correct.
gcdCorrect : ∀ {m n} → N m → N n → gcdSpec m n (gcd m n)
gcdCorrect Nm Nn = gcdCD Nm Nn , gcdDivisible Nm Nn
|
Structure/Setoid/Proofs.agda | Lolirofle/stuff-in-agda | 6 | 11809 | <filename>Structure/Setoid/Proofs.agda
module Structure.Setoid.Proofs where
import Lvl
open import Functional
open import Logic
open import Logic.Propositional
open import Structure.Setoid
open import Structure.Function
open import Structure.Relator.Equivalence
open import Structure.Relator.Properties
{-
module _ where
private variable ℓ ℓ₁ ℓ₂ ℓ₃ : Level
private variable A B : Type{ℓ}
private variable P : Stmt{ℓ}
Choice : (A → B → Stmt{ℓ}) → Stmt
Choice{A = A}{B = B}(_▫_) = (∀{x} → ∃(y ↦ x ▫ y)) → (∃{Obj = A → B}(f ↦ ∀{x} → (x ▫ f(x))))
module _ ⦃ choice : ∀{ℓ₁ ℓ₂ ℓ₃}{A : Type{ℓ₁}}{B : Type{ℓ₂}}{_▫_ : A → B → Stmt{ℓ₃}} → Choice(_▫_) ⦄ where
open import Data.Boolean
open import Structure.Relator.Properties
open import Structure.Relator.Properties.Proofs
open import Relator.Equals.Proofs.Equiv
thing : Stmt{ℓ} → Bool → Bool → Stmt
thing P a b = (a ≡ b) ∨ P
thing-functionallyTotal : ∀{x} → ∃(y ↦ thing P x y)
thing-functionallyTotal {x = x} = [∃]-intro x ⦃ [∨]-introₗ (reflexivity(_≡_)) ⦄
thing-choice : ∃(f ↦ ∀{x} → thing(P) x (f(x)))
thing-choice {P = P} = choice{_▫_ = thing P} thing-functionallyTotal
instance
thing-reflexivity : Reflexivity(thing(P))
Reflexivity.proof thing-reflexivity = [∨]-introₗ(reflexivity(_≡_))
instance
thing-symmetry : Symmetry(thing(P))
Symmetry.proof thing-symmetry = [∨]-elim2 (symmetry(_≡_)) id
instance
thing-transitivity : Transitivity(thing(P))
Transitivity.proof thing-transitivity ([∨]-introₗ xy) ([∨]-introₗ yz) = [∨]-introₗ (transitivity(_) xy yz)
Transitivity.proof thing-transitivity ([∨]-introₗ xy) ([∨]-introᵣ p) = [∨]-introᵣ p
Transitivity.proof thing-transitivity ([∨]-introᵣ p) _ = [∨]-introᵣ p
thing-ext : let ([∃]-intro f) = thing-choice{P = P} in ∀{a b} → thing(P) a b → (f(a) ≡ f(b))
thing-ext ([∨]-introₗ ab) = congruence₁([∃]-witness thing-choice) ab
thing-ext {a = a} {b = b} ([∨]-introᵣ p) = {!!}
thing-eq : let ([∃]-intro f) = thing-choice{P = P} in (P ↔ (f(𝐹) ≡ f(𝑇)))
_⨯_.left (thing-eq {P = P}) ft with [∃]-proof (thing-choice{P = P}){𝐹}
_⨯_.left (thing-eq {P = P}) ft | [∨]-introₗ ff = [∨]-syllogismₗ ([∃]-proof (thing-choice{P = P}){𝑇}) ((symmetry(_≢_) ⦃ negated-symmetry ⦄ ∘ [↔]-to-[←] [≢][𝑇]-is-[𝐹] ∘ symmetry(_≡_)) (transitivity(_≡_) ff ft))
_⨯_.left (thing-eq {P = P}) ft | [∨]-introᵣ p = p
_⨯_.right (thing-eq {P = P}) p = thing-ext ([∨]-introᵣ p)
bool-eq-classical : Classical₂ {X = Bool} (_≡_)
choice-to-classical : Classical(P)
excluded-middle ⦃ choice-to-classical {P = P} ⦄ with excluded-middle ⦃ bool-eq-classical {[∃]-witness (thing-choice{P = P}) 𝐹} {[∃]-witness (thing-choice{P = P}) 𝑇} ⦄
excluded-middle ⦃ choice-to-classical {P = P} ⦄ | [∨]-introₗ ft = [∨]-introₗ ([↔]-to-[←] thing-eq ft)
excluded-middle ⦃ choice-to-classical {P = P} ⦄ | [∨]-introᵣ nft = [∨]-introᵣ (nft ∘ [↔]-to-[→] thing-eq)
module _ ⦃ classical : ∀{ℓ}{P : Stmt{ℓ}} → Classical(P) ⦄ where
proof-irrelevance : ∀{p₁ p₂ : P} → (p₁ ≡ p₂)
proof-irrelevance with excluded-middle
proof-irrelevance {P = P}{p₁}{p₂} | [∨]-introₗ p = {!!}
proof-irrelevance {P = P}{p₁}{p₂} | [∨]-introᵣ np = [⊥]-elim(np p₁)
-}
|
programs/oeis/335/A335063.asm | jmorken/loda | 1 | 2413 | <reponame>jmorken/loda
; A335063: a(n) = Sum_{k=0..n} (binomial(n,k) mod 2) * k.
; 0,1,2,6,4,10,12,28,8,18,20,44,24,52,56,120,16,34,36,76,40,84,88,184,48,100,104,216,112,232,240,496,32,66,68,140,72,148,152,312,80,164,168,344,176,360,368,752,96,196,200,408,208,424,432,880,224,456,464,944,480,976,992,2016,64,130,132,268,136,276,280,568,144,292,296,600,304,616,624,1264,160,324,328,664,336,680,688,1392,352,712,720,1456,736,1488,1504,3040,192,388,392,792,400,808,816,1648,416,840,848,1712,864,1744,1760,3552,448,904,912,1840,928,1872,1888,3808,960,1936,1952,3936,1984,4000,4032,8128,128,258,260,524,264,532,536,1080,272,548,552,1112,560,1128,1136,2288,288,580,584,1176,592,1192,1200,2416,608,1224,1232,2480,1248,2512,2528,5088,320,644,648,1304,656,1320,1328,2672,672,1352,1360,2736,1376,2768,2784,5600,704,1416,1424,2864,1440,2896,2912,5856,1472,2960,2976,5984,3008,6048,6080,12224,384,772,776,1560,784,1576,1584,3184,800,1608,1616,3248,1632,3280,3296,6624,832,1672,1680,3376,1696,3408,3424,6880,1728,3472,3488,7008,3520,7072,7104,14272,896,1800,1808,3632,1824,3664,3680,7392,1856,3728,3744,7520,3776,7584,7616,15296,1920,3856,3872,7776,3904,7840,7872,15808,3968,7968
mov $2,$0
mov $3,$0
lpb $0
div $2,2
sub $0,$2
lpe
lpb $0
sub $0,1
mov $1,2
mul $3,2
add $1,$3
lpe
sub $1,1
div $1,2
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cd/cd1c03a.ada | best08618/asylo | 7 | 12263 | -- CD1C03A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT THE SIZE OF A DERIVED TYPE IS INHERITED FROM THE
-- PARENT IF THE SIZE OF THE PARENT WAS DETERMINED BY A SIZE
-- CLAUSE.
-- HISTORY:
-- JET 09/16/87 CREATED ORIGINAL TEST.
-- DHH 03/30/89 CHANGED SPECIFIED_SIZE TO 5, ADDED CHECK ON
-- REPRESENTATION CLAUSES, AND CHANGED THE TEST
-- EXTENSION FROM '.DEP' TO '.ADA'.
WITH REPORT; USE REPORT;
WITH LENGTH_CHECK; -- CONTAINS A CALL TO 'FAILED'.
PROCEDURE CD1C03A IS
SPECIFIED_SIZE : CONSTANT := 5;
TYPE PARENT_TYPE IS RANGE -8 .. 7;
FOR PARENT_TYPE'SIZE USE SPECIFIED_SIZE;
PT : PARENT_TYPE := -7;
TYPE DERIVED_TYPE IS NEW PARENT_TYPE;
DT : DERIVED_TYPE := -7;
PROCEDURE CHECK_1 IS NEW LENGTH_CHECK (DERIVED_TYPE);
PROCEDURE CHECK_2 IS NEW LENGTH_CHECK (PARENT_TYPE);
BEGIN
TEST("CD1C03A", "CHECK THAT THE SIZE OF A DERIVED TYPE IS " &
"INHERITED FROM THE PARENT IF THE SIZE OF " &
"THE PARENT WAS DETERMINED BY A SIZE CLAUSE");
IF PARENT_TYPE'SIZE /= IDENT_INT (SPECIFIED_SIZE) THEN
FAILED ("PARENT_TYPE'SIZE /= " &
INTEGER'IMAGE(SPECIFIED_SIZE) &
". ACTUAL SIZE IS" &
INTEGER'IMAGE(PARENT_TYPE'SIZE));
END IF;
IF DERIVED_TYPE'SIZE /= IDENT_INT (SPECIFIED_SIZE) THEN
FAILED ("DERIVED_TYPE'SIZE /= " &
INTEGER'IMAGE(SPECIFIED_SIZE) &
". ACTUAL SIZE IS" &
INTEGER'IMAGE(DERIVED_TYPE'SIZE));
END IF;
IF DT'SIZE < IDENT_INT (SPECIFIED_SIZE) THEN
FAILED ("DT'SIZE SHOULD NOT BE LESS THAN" &
INTEGER'IMAGE(SPECIFIED_SIZE) &
". ACTUAL SIZE IS" &
INTEGER'IMAGE(DT'SIZE));
END IF;
CHECK_1 (DT, 5, "DERIVED_TYPE");
CHECK_2 (PT, 5, "PARENT_TYPE");
RESULT;
END CD1C03A;
|
Win32/Win32.Beagle/SMTPMessage.asm | fengjixuchui/Family | 3 | 96558 | ; Format e-mail message
; #########################################################################
.data
szSysDate db "ddd',' dd MMM yyyy ",0
szSysTime db "HH:mm:ss ",0
szTimeFmt db "%03i%02i",0
szTokens db " ",0
MsgHeader db 'Date: %s',13,10
db 'To: "%s" <%s>',13,10
db 'From: "%s" <%s>',13,10
db 'Subject: %s',13,10
db 'Message-ID: <%s%s>',13,10
db 'MIME-Version: 1.0',13,10
;db 'X-Priority: 1 (Highest)',13,10
db 'Content-Type: multipart/mixed;',13,10
db ' boundary="--------%s"',13,10,13,10,0
TxtHeader db '----------%s',13,10
db 'Content-Type: text/html; charset="us-ascii"',13,10
db "Content-Transfer-Encoding: 7bit",13,10,13,10,0
ImgPassHeader db '----------%s',13,10
db 'Content-Type: %s; name="%s.%s"',13,10
db "Content-Transfer-Encoding: base64",13,10
db 'Content-Disposition: attachment; filename="%s.%s"',13,10
db 'Content-ID: <%s.%s>',13,10,13,10,0
ZipHeader db '----------%s',13,10
db 'Content-Type: application/octet-stream; name="%s%s"',13,10
db "Content-Transfer-Encoding: base64",13,10
db 'Content-Disposition: attachment; filename="%s%s"',13,10,13,10,0
ZipBoundaryHdr db 13,10,13,10,"----------%s--",13,10,13,10,".",13,10,0
szEmailEnd db ".",13,10,0
szCRLF db "<br>",13,10,0
szTextCRLF db 13,10,0
IFDEF TESTVERSION
szTestSaveFmt db "C:\EmailsOut\%s.msg",0
ENDIF
szHTMLStart db '<html><body>',13,10,0
szHTMLEnd db '</body></html>',13,10,13,10,0
szPassImg db '<img src="cid:%s.%s"><br>',13,10,0
szPassOnlyFmt db "Password: %s",0
db "Pass - %s",0
db "Password - %s",0,0
dwPassOnlyFmt dd 0
szSubjs2 db "Re: Msg reply",0
db "Re: Hello",0
db "Re: Yahoo!",0
db "Re: Thank you!",0
db "Re: Thanks :)",0
db "RE: Text message",0
db "Re: Document",0
db "Incoming message",0
db "Re: Incoming Message",0
db "RE: Incoming Msg",0
db "RE: Message Notify",0
db "Notification",0
db "Changes..",0
db "Update",0
db "Fax Message",0
db "Protected message",0
db "RE: Protected message",0
db "Forum notify",0
db "Site changes",0
db "Re: Hi",0
db "Encrypted document",0,0
dwSubjsCount2 dd 0
szMsgs2 db "Read the attach.<br><br>",13,10,13,10,0
db "Your file is attached.<br><br>",13,10,13,10,0
db "More info is in attach<br><br>",13,10,13,10,0
db "See attach.<br><br>",13,10,13,10,0
db "Please, have a look at the attached file.<br>",13,10,13,10,0
db "Your document is attached.<br><br>",13,10,13,10,0
db "Please, read the document.<br><br>",13,10,13,10,0
db "Attach tells everything.<br><br>",13,10,13,10,0
db "Attached file tells everything.<br><br>",13,10,13,10,0
db "Check attached file for details.<br><br>",13,10,13,10,0
db "Check attached file.<br><br>",13,10,13,10,0
db "Pay attention at the attach.<br><br>",13,10,13,10,0
db "See the attached file for details.<br><br>",13,10,13,10,0
db "Message is in attach<br><br>",13,10,13,10,0
db "Here is the file.<br><br>",13,10,13,10,0,0
dwMsgsCount2 dd 0
szExts db ".ini",0
db ".cfg",0
db ".txt",0
db ".vxd",0
db ".def",0
db ".dll",0,0
dwExtsCount dd 0
szPasses db 13,10,'<br>For security reasons attached file is password protected. The password is <img src="cid:%s.%s"><br>',13,10,0
db 13,10,'<br>For security purposes the attached file is password protected. Password -- <img src="cid:%s.%s"><br>',13,10,0
db 13,10,'<br>Note: Use password <img src="cid:%s.%s"> to open archive.<br>',13,10,0
db 13,10,'<br>Attached file is protected with the password for security reasons. Password is <img src="cid:%s.%s"><br>',13,10,0
db 13,10,'<br>In order to read the attach you have to use the following password: <img src="cid:%s.%s"><br>',13,10,0
db 13,10,'<br>Archive password: <img src="cid:%s.%s"><br>',13,10,0
db 13,10,'<br>Password - <img src="cid:%s.%s"><br>',13,10,0
db 13,10,'<br>Password: <img src="cid:%s.%s"><br>',13,10,0,0
dwPassesCount dd 0
szNames db "Information",0
db "Details",0
db "text_document",0
db "Updates",0
db "Readme",0
db "Document",0
db "Info",0
db "Details",0
db "MoreInfo",0
db "Message",0,0
dwNamesCount dd 0
szSrcAttachName db "Sources",0
szSrcAttachExt db ".zip",0
.code
; Valid email rfc time (GMT based)
GenEmailTime proc lpszStr: DWORD
LOCAL lpTimeBuf[31]: BYTE
LOCAL SysTime: SYSTEMTIME
LOCAL lpTimeZone: TIME_ZONE_INFORMATION
invoke GetLocalTime, addr SysTime
invoke GetDateFormat, LANG_ENGLISH, 0, addr SysTime, offset szSysDate, addr lpTimeBuf, 30
invoke lstrcpy, lpszStr, addr lpTimeBuf
invoke GetTimeFormat, LANG_ENGLISH, TIME_FORCE24HOURFORMAT, addr SysTime, offset szSysTime, addr lpTimeBuf, 30
invoke lstrcat, lpszStr, addr lpTimeBuf
invoke GetTimeZoneInformation, addr lpTimeZone
mov eax, lpTimeZone.Bias
neg eax
cdq
mov ecx, 60
idiv ecx
test edx, edx
jge @F
neg edx
@@:
invoke wsprintf, addr lpTimeBuf, offset szTimeFmt, eax, edx
.IF lpTimeBuf[0] == '0'
mov lpTimeBuf[0], '+'
.ENDIF
invoke lstrcat, lpszStr, addr lpTimeBuf
ret
GenEmailTime endp
; Format email RFC headers
EmailFormatHeader proc To1, To2, From1, From2, Boundary, Subject, szOut: DWORD
LOCAL lpRandTemp[30]: BYTE
LOCAL lpDate[50]: BYTE
invoke ZeroMemory, addr lpRandTemp, 30
invoke GetRandomID, addr lpRandTemp, 19
invoke GenEmailTime, addr lpDate
invoke StrRChr, To2, NULL, '@'
.IF eax
xchg eax, edx
invoke wsprintf, szOut, offset MsgHeader, addr lpDate, To1, To2, From1, From2, Subject, addr lpRandTemp, edx, Boundary
.ENDIF
ret
EmailFormatHeader endp
; Choose random string in array
EmailRandomCommon proc uses edi ebx szStrs, lpdwCount: DWORD
LOCAL cnt: DWORD
mov ebx, lpdwCount
.IF !dword ptr[ebx]
cld
xor eax, eax
mov edi, szStrs
@next:
or ecx, -1
repnz scasb
inc dword ptr[ebx]
cmp byte ptr[edi], 0
jnz @next
.ENDIF
mov cnt, 0
invoke Rand, dword ptr[ebx]
mov cnt, eax
mov edi, szStrs
xor eax, eax
@next2:
.IF cnt == 0
mov eax, edi
ret
.ELSE
or ecx, -1
cld
repnz scasb
dec cnt
jmp @next2
.ENDIF
ret
EmailRandomCommon endp
; Choose random subject
EmailRandomSubject2 proc
invoke EmailRandomCommon, offset szSubjs2, addr dwSubjsCount2
ret
EmailRandomSubject2 endp
; Choose random message body
EmailRandomMsg2 proc
invoke EmailRandomCommon, offset szMsgs2, addr dwMsgsCount2
ret
EmailRandomMsg2 endp
; Choose random name
EmailRandomName proc
invoke EmailRandomCommon, offset szNames, addr dwNamesCount
ret
EmailRandomName endp
; Choose password fmt
EmailRandomPass proc
invoke EmailRandomCommon, offset szPasses, addr dwPassesCount
ret
EmailRandomPass endp
; Choose random password text
EmailRandomPassOnlyFmt proc
invoke EmailRandomCommon, offset szPassOnlyFmt, addr dwPassOnlyFmt
ret
EmailRandomPassOnlyFmt endp
; Choose random extension
EmailRandomExt proc
invoke EmailRandomCommon, offset szExts, addr dwExtsCount
ret
EmailRandomExt endp
; Safe string randomizer initialization
EmailRandInit proc
invoke EmailRandomSubject2
invoke EmailRandomMsg2
invoke EmailRandomName
invoke EmailRandomPass
invoke EmailRandomPassOnlyFmt
invoke EmailRandomExt
ret
EmailRandInit endp
CreateMessageContent2 proc uses esi ebx PassName, PassExt, Boundary: DWORD
invoke GlobalAlloc, GPTR, 20000
mov ebx, eax
invoke GlobalAlloc, GPTR, 5000
mov esi, eax
; Body
invoke EmailRandomMsg2
invoke lstrcpy, ebx, eax
mov eax, offset szZipPassBuff
.IF byte ptr[eax]
invoke EmailRandomPass
invoke wsprintf, esi, eax, PassName, PassExt
invoke lstrcat, ebx, esi
invoke lstrcat, ebx, offset szCRLF
.ELSE
invoke lstrcat, ebx, offset szCRLF
.ENDIF
; Free temp buffer
invoke GlobalFree, esi
mov eax, ebx
ret
CreateMessageContent2 endp
CreateMessagePassImg proc uses ebx PassName, PassExt: DWORD
invoke GlobalAlloc, GPTR, 20000
mov ebx, eax
invoke wsprintf, ebx, offset szPassImg, PassName, PassExt
mov eax, ebx
ret
CreateMessagePassImg endp
; Simple mutation routine
MutateMessage proc uses edi ebx lpMsg, stream: DWORD
LOCAL _first: DWORD
LOCAL _str: DWORD
invoke GlobalAlloc, GPTR, 5000
mov _str, eax
mov _first, 0
mov edi, lpMsg
@tokenize:
cld
mov edx, edi
@l:
.IF (byte ptr[edi] != 0) && (byte ptr[edi] != " ")
inc edi
jmp @l
.ENDIF
mov bl, byte ptr[edi]
mov byte ptr[edi], 0
invoke lstrcpy, _str, edx
mov byte ptr[edi], bl
.IF !_first
mov _first, 1
.ELSE
invoke Rand, 4
.IF !eax
coinvoke stream, IStream, Write, offset szTokens, 1, NULL
.ENDIF
coinvoke stream, IStream, Write, offset szTokens, 1, NULL
.ENDIF
invoke lstrlen, _str
coinvoke stream, IStream, Write, _str, eax, NULL
inc edi
cmp byte ptr[edi-1], 0
jnz @tokenize
invoke GlobalFree, _str
ret
MutateMessage endp
; Make first letter uppercased
UpperEmailSrvLetter proc lpEmail: DWORD
mov eax, lpEmail
push eax
movzx eax, byte ptr[eax]
invoke CharUpper, eax
pop edx
mov byte ptr[edx], al
ret
UpperEmailSrvLetter endp
; Rip username from e-mail address (<EMAIL> -> User)
EmailGetName proc uses esi edi lpEmail, lpOut: DWORD
invoke StrChrI, lpEmail, '@'
.IF eax
sub eax, lpEmail
inc eax
invoke lstrcpyn, lpOut, lpEmail, eax
mov edi, lpOut
@l:
.IF (!byte ptr[edi]) || (byte ptr[edi] == '_') || ((byte ptr[edi] >= '0') && (byte ptr[edi] <= '9'))
mov byte ptr[edi], 0
.ELSE
inc edi
jmp @l
.ENDIF
invoke UpperEmailSrvLetter, lpOut
.ENDIF
ret
EmailGetName endp
; Create message, return IStream ptr
EmailFormatMessage proc From, To: DWORD
LOCAL szSubject: DWORD
LOCAL stream: DWORD
LOCAL lpBoundary[150]: BYTE
LOCAL lpPassName[20]: BYTE
LOCAL szHeader: DWORD
LOCAL szMessage: DWORD
LOCAL FromName: DWORD
LOCAL ToName: DWORD
invoke GlobalAlloc, GPTR, 1024
mov FromName, eax
invoke EmailGetName, From, eax
invoke GlobalAlloc, GPTR, 1024
mov ToName, eax
invoke EmailGetName, To, eax
invoke EmailRandomSubject2
mov szSubject, eax
invoke StreamCreate, addr stream
invoke GlobalAlloc, GPTR, 8192
mov szHeader, eax
; Generate boundary
invoke ZeroMemory, addr lpBoundary, 30
invoke GetRandomID, addr lpBoundary, 20
; Generate password filename
invoke ZeroMemory, addr lpPassName, 20
invoke GetRandomID, addr lpPassName, 10
; Main header
invoke EmailFormatHeader, ToName, To, FromName, From, addr lpBoundary, szSubject, szHeader
invoke lstrlen, szHeader
coinvoke stream, IStream, Write, szHeader, eax, NULL
; Message header boundary
invoke wsprintf, szHeader, offset TxtHeader, addr lpBoundary
invoke lstrlen, szHeader
coinvoke stream, IStream, Write, szHeader, eax, NULL
; HTML Start
invoke lstrlen, offset szHTMLStart
coinvoke stream, IStream, Write, offset szHTMLStart, eax, NULL
; The Message Body
mov edx, b64PasswordMime
add edx, 6 ; image file extension
.IF bPassImgOnly
invoke CreateMessagePassImg, addr lpPassName, edx
.ELSE
invoke CreateMessageContent2, addr lpPassName, edx, addr lpBoundary
.ENDIF
mov szMessage, eax
invoke MutateMessage, eax, stream
; HTML end
invoke lstrlen, offset szHTMLEnd
coinvoke stream, IStream, Write, offset szHTMLEnd, eax, NULL
; If password enabled
mov eax, offset szZipPassBuff
.IF byte ptr[eax]
mov edx, b64PasswordMime
add edx, 6 ; file extension
; Image password header
invoke wsprintf, szHeader, offset ImgPassHeader, addr lpBoundary, b64PasswordMime, addr lpPassName, edx, addr lpPassName, edx, addr lpPassName, edx
invoke lstrlen, szHeader
coinvoke stream, IStream, Write, szHeader, eax, NULL
coinvoke stream, IStream, Write, b64Password, b64PasswordLen, NULL
coinvoke stream, IStream, Write, offset szTextCRLF, 2, NULL
coinvoke stream, IStream, Write, offset szTextCRLF, 2, NULL
.ENDIF
; File header
invoke EmailRandomName
invoke wsprintf, szHeader, offset ZipHeader, addr lpBoundary, eax, szAttachExt, eax, szAttachExt
invoke lstrlen, szHeader
coinvoke stream, IStream, Write, szHeader, eax, NULL
; File data
coinvoke stream, IStream, Write, b64Attach, b64AttachLen, NULL
; -------------------
; Attach with sources
invoke Rand, 100
.IF eax >= 70
; 30% send sources
coinvoke stream, IStream, Write, offset szTextCRLF, 2, NULL
coinvoke stream, IStream, Write, offset szTextCRLF, 2, NULL
; File header
invoke wsprintf, szHeader, offset ZipHeader, addr lpBoundary, offset szSrcAttachName, offset szSrcAttachExt, offset szSrcAttachName, offset szSrcAttachExt
invoke lstrlen, szHeader
coinvoke stream, IStream, Write, szHeader, eax, NULL
; File data
coinvoke stream, IStream, Write, b64SrcAttach, b64SrcAttachLen, NULL
.ENDIF
; Final boundary
invoke wsprintf, szHeader, offset ZipBoundaryHdr, addr lpBoundary
invoke lstrlen, szHeader
coinvoke stream, IStream, Write, szHeader, eax, NULL
invoke GlobalFree, szMessage
invoke GlobalFree, szHeader
invoke GlobalFree, FromName
invoke GlobalFree, ToName
IFDEF TESTVERSION
; Write sample email to disk
invoke wsprintf, addr lpBoundary, offset szTestSaveFmt, To
invoke StreamSaveToFile, stream, addr lpBoundary
ENDIF
mov eax, stream
ret
EmailFormatMessage endp
|
learn-antlr/src/main/antlr/com/github/tt4g/learn/antlr/TripleUnderscoreLexer.g4 | tt4g/learn-antlr | 0 | 952 | /**
* Parse "___" ${IDENTIFIER} "___" pattern.
*/
lexer grammar TripleUnderscoreLexer;
import TripleUnderscoreTokenLexer;
// Ignore other pattern.
IGNORE : . -> skip ;
|
sbsext/tk2/mdv.asm | olifink/smsqe | 0 | 19825 | ; SBSEXT_TK2_MDV - Extended MDV driver. Reverse engineered by <NAME>
xdef mdv_init
xdef mdv_io
include 'dev8_keys_iod'
include 'dev8_keys_qdos_io'
include 'dev8_keys_qdos_ioa'
include 'dev8_keys_qdos_sms'
include 'dev8_keys_hdr'
include 'dev8_keys_err'
include 'dev8_keys_sbt'
include 'dev8_keys_sys'
include 'dev8_keys_chn'
section mdv
; Driver linkage block extensions
iod_oio equ $42 ; Original I/O
iod_oop equ $46 ; Original open
iod_ocl equ $4a ; Original close
iod_end equ $4e
; Channel definition block extensions
chn_spare equ $58 ; Some spare bytes to put data into
; Physical definition block
md_fail equ $24 ; Byte Failure count
md_spare equ $25 ; 3 Bytes
md_map equ $28 ; $FF*2 bytes Microdrive sector map
md_lsect equ $226 ; Number of last sector allocated
md_pendg equ $228 ; Word Map of pending operations
md_end equ $428
mdv_init
trap #0
moveq #sms.info,d0
trap #1
; cmpi.l #'2.00',d2 ; Um, what QDOS version 2.00? SMSQ/E?
andi.l #$FF00FFFF,d2
cmpi.l #$31003930,d2 ; Minerva doesn't need our help either
bge.s mi_rts ; ... don't enable then
lea sys_fsdl(a0),a4 ; Filing system driver list
movea.l a0,a5
mi_loop
movea.l a4,a0
movea.l (a4),a4
tst.l (a4) ; End of list?
bne.s mi_loop ; No
cmpa.l #$0000C000,a4 ; Driver in ROM?
bge.s mi_rts ; No, abort
move.l a0,-(sp)
moveq #sms.achp,d0
moveq #iod_end-iod_iolk,d1 ; Size of new driver linkage block
moveq #0,d2
trap #1
lea sys_fsdd(a5),a1 ; Drive definitions
moveq #sys.nfsd-1,d1
mis_loop
movea.l (a1)+,a2 ; Next definition
cmpa.l iod_drlk(a2),a4 ; Does this belong to the driver?
bne.s mis_no ; No
move.l a0,iod_drlk(a2) ; Yes, replace with new block
mis_no
dbf d1,mis_loop
movea.l a0,a3 ; New driver linkage block
moveq #iod_dnam-iod_iolk,d1
mi_copy
move.l (a4)+,(a3)+ ; Copy everything except the linkages
subq.w #4,d1
bgt.s mi_copy
lea iod_ioad-iod_iolk(a0),a3
lea iod_oio-iod_iolk(a0),a4
move.l (a3),(a4)+ ; Copy of original I/O routine
lea mdv_io(pc),a1
move.l a1,(a3)+ ; Our I/O routine
move.l (a3),(a4)+ ; Copy of original open
lea mdv_open(pc),a1
move.l a1,(a3)+ ; Our open
move.l (a3),(a4)+ ; Copy of original close
lea mdv_close(pc),a1
move.l a1,(a3)+ ; Our close
movea.l (sp)+,a1 ; Entry in filing system driver list
move.l a0,(a1) ; Overwrite
mi_rts
move.w #0,sr
rts
; New MDV driver I/O
mdv_io cmpi.b #iof.rnam,d0
beq mdv_rnam
cmpi.b #iof.trnc,d0
beq mdv_trnc
cmpi.b #iof.flsh,d0
bne.s mdv_oio
; Update file header on flush
mdv_flsh
tst.w d3
bne.s mdv_oio
move.l chn_feof(a0),d0 ; File size
lsl.w #7,d0
lsr.l #7,d0 ; In bytes
lea chn_spare(a0),a4 ; There are some spare bytes
move.l d0,(a4) ; Write file size in bytes to it
moveq #4,d2
moveq #hdr_flen,d4
bsr.s mdv_whead ; Update file length in both headers
moveq #iof.flsh,d0
mdv_oio
movea.l iod_oio(a3),a4 ; Original I/O routine
jmp (a4)
; Read complete file header into buffer A4
mdv_rhead
moveq #hdr_end,d2
moveq #iob.fmul,d0
mdv_trap ; Simulate trap call of original driver
movea.l a4,a1 ; Buffer
movem.l d0/d2/d4/a2-a5,-(a7)
mtrap_loop
movem.l (a7),d0/d2/d4/a2-a3
moveq #0,d1
moveq #0,d3
bsr.s mdv_oio
addq.l #1,d0 ; err.nc?
beq.s mtrap_loop ; Then try again
subq.l #1,d0 ; Restore error code
movem.l (a7)+,d1-d2/d4/a2-a5
rts
; Write header data
;
; d4 = position in header
; d2 = length of data
mdv_whead
lea chn_csb(a0),a2 ; Save current file position
move.l -(a2),-(sp) ; chn_feof
move.l -(a2),-(sp) ; chn_fpos
move.w -(a2),-(sp) ; chn_qdid
clr.w (a2) ; Write to root directory
move.w (sp),d0 ; File ID
lsl.l #6,d0
add.l d4,d0 ; Add wanted position
lsl.l #7,d0 ; Decompose again into block/byte
lsr.w #7,d0
move.l d0,chn_fpos(a0) ; Fake current position
st $0025(a0) ; Don't bother with end, max it (?)
moveq #iob.smul,d0
bsr.s mdv_trap ; Write bytes
bne.s mdv_posrestore
move.w (sp),(a2) ; File ID
move.l d4,chn_fpos(a0) ; Use index as index into file
moveq #iob.smul,d0 ; Also update header in file data
bsr.s mdv_trap
mdv_posrestore
lea chn_qdid(a0),a2 ; Restore file position
move.w (sp)+,(a2)+ ; chn_qdid
move.l (sp)+,(a2)+ ; chn_fpos
move.l (sp)+,(a2)+ ; chn_feof
tst.l d0
rts
; New driver supports RENAME
mdv_rnam
move.w (a1)+,d4 ; New name length
subq.w #5,d4 ; Minus MDVx_
bls.s mdv_inam ; Must be longer!
cmpi.w #hdr.nmln,d4
bhi.s mdv_inam ; Name too long
bsr mdv_getddb
move.l #$DFDFDFFF,d0
and.l (a1)+,d0 ; Mask casing
sub.b iod_dnum(a2),d0 ; Remove drive number
cmpi.l #'MDV0',d0
bne.s mdv_inam ; Not for MDV? Cannot do
cmpi.b #'_',(a1)+
bne.s mdv_inam
bsr.s mr_do
bne.s mr_rts
moveq #hdr.nmln+2,d2
moveq #hdr_name,d4
bra.s mdv_whead ; Write new filename to header
mdv_inam
moveq #err.inam,d0
mr_rts
rts
; Check if new filename already exists in directory. If not, rename in CDB
;
; d4 = size of filename (without device)
; a1 = filename (without device)
mr_do
lea chn_spare(a0),a4 ; Spare space for header
lea chn_csb(a0),a2 ; Remember current file position
move.l -(a2),-(sp) ; chn_feof
move.l -(a2),-(sp) ; chn_fpos
move.w -(a2),-(sp) ; chn_qdid
move.l a1,-(sp) ; Remember new filename
clr.w (a2)+ ; Read root directory
clr.l (a2)+
bsr mdv_rhead ; Read header of directory
bne.s mr_exit
move.l (a4),d0 ; Length of directory in bytes
lsl.l #7,d0
lsr.w #7,d0 ; Now blocks
move.l d0,chn_feof(a0) ; Set EOF
lea hdr_name+2(a4),a5 ; Pointer to name in directory entry
mr_searchloop
bsr mdv_rhead ; Read next directory entry
bne.s mr_rename_cdb ; No more entries
movea.l (sp),a1 ; New filename
cmp.w -2(a5),d4 ; Size matches?
bne.s mr_searchloop ; No
moveq #0,d0 ; Start with first character
mr_checkname
bsr.s mr_getchar ; From new filename
move.b d1,d2
bsr.s mr_getchar ; And old filename
cmp.b d1,d2
bne.s mr_searchloop ; Don't match, continue search
addq.w #1,d0
cmp.w d4,d0 ; End of filename?
blt.s mr_checkname ; Nope
moveq #err.fex,d0 ; Filename does already exist, error
bra.s mr_exit
mr_rename_cdb
movea.l (sp),a1 ; New filename
lea chn_name(a0),a2
movea.l a2,a4
move.w d4,(a2)+ ; Put new name into CDB
mr_setloop
move.b (a1)+,(a2)+
subq.w #1,d4
bgt.s mr_setloop
moveq #0,d0
mr_exit
addq.l #4,sp ; Skip new filename
bra mdv_posrestore ; And restore file position
; Get character by index, always upper-case. Except for umlauts...
mr_getchar
exg a1,a5
move.b (a5,d0.w),d1
cmpi.b #'a',d1
blt.s mrgc_rts
cmpi.b #'z',d1
bgt.s mrgc_rts
subi.b #'a'-'A',d1
mrgc_rts
rts
; Get driver linkage block in A2 plus slave block drive ID in D1
mdv_getddb
moveq #0,d1
move.b chn_drid(a0),d1
lsl.w #2,d1
lea sys_fsdd(a6),a2
movea.l (a2,d1.w),a2
lsl.b #2,d1 ; Slave has drive ID in upper nibble
addq.b #1,d1 ; Slave drive ID
rts
; New driver supports TRUNCATE
mdv_trnc
cmpi.b #ioa.kshr,chn_accs(a0)
bne.s mt_do
moveq #err.rdo,d0
rts
mt_do
move.l chn_fpos(a0),d4
move.l d4,chn_feof(a0) ; Set FPOS as EOF
subq.l #1,d4
swap d4 ; Last block within file
move.w chn_qdid(a0),d5 ; File ID
bsr.s mdv_getddb ; Get driver linkage in a2
lea md_map(a2),a5 ; Sector map
lea $FF*2-2(a5),a4 ; 2 bytes per sector, start with last
; Mark all sectors after the cut off point as empty
mt_sect_loop
cmp.b (a4),d5 ; For our file?
bne.s mt_sect_next
cmp.b 1(a4),d4 ; And a block beyond the new end?
bcc.s mt_sect_next ; No
move.w #$FD00,(a4) ; Yes, mark as empty
clr.w md_pendg-md_map(a4) ; And clear pending operations
mt_sect_next
subq.l #2,a4 ; Work towards start of sector map
cmpa.l a5,a4
bgt.s mt_sect_loop
; Remove any slave block entries after cut off point
movea.l sys_sbtb(a6),a4 ; Slave block base
mt_sb_loop
moveq #sbt.driv,d0 ; Mask of pointer to drive
and.b (a4),d0
cmp.b d0,d1 ; Is it ours?
bne.s mt_sb_next ; No
cmp.w sbt_file(a4),d5 ; File matches?
bne.s mt_sb_next ; No
cmp.w sbt_blok(a4),d4 ; Block is beyond the new ned?
bcc.s mt_sb_next ; No
move.b #sbt.mpty,(a4) ; Yes, forget slave block
mt_sb_next
addq.l #sbt.len,a4
cmpa.l sys_sbtt(a6),a4
blt.s mt_sb_loop
move.w #-1,md_pendg(a2) ; Write map
st chn_updt(a0) ; File was updated
moveq #0,d0
mdv_rts2
rts
; New OPEN. Support overwrite and directory access
mdv_open
move.b chn_accs(a0),d3
cmpi.b #ioa.kovr,d3
beq.s mdv_open_over
cmpi.b #ioa.kdir,d3
beq.s mdv_open_dir
mdv_oopen
movea.l iod_oop(a3),a4
jmp (a4)
mdv_open_over
move.b #ioa.kexc,chn_accs(a0)
movem.l a1/a3,-(a7)
bsr.s mdv_oopen ; Try to open file to read
movem.l (a7)+,a1/a3
move.b #ioa.kovr,chn_accs(a0)
cmpi.w #err.fdnf,d0
beq.s mdv_open_nf ; Not found, just open it normally
tst.l d0
bne.s mdv_rts2
moveq #hdr.len,d4
lea chn_spare+hdr_name(a0),a4
clr.l -(a4) ; Clear hdr_xtra
clr.l -(a4) ; Clear hdr_data
clr.w -(a4) ; Clear hdr_accs/hdr_type
move.l d4,-(a4) ; Empty file (just header)
moveq #iob.smul,d0
moveq #hdr_name,d2 ; Everything up to the name
clr.l chn_fpos(a0)
bsr mdv_trap ; Overwrite header data
move.l d4,chn_fpos(a0) ; Set position to start of file
bra mdv_trnc ; Truncate file
; File not found, just open it normally
mdv_open_nf
clr.l chn_fpos(a0)
bra.s mdv_oopen
mdv_open_dir
clr.w chn_name(a0)
bra.s mdv_oopen
; New CLOSE, update file date before closing
mdv_close
tst.b chn_updt(a0) ; File updated
beq.s mc_do ; No, no need to update date then
moveq #hdr_date,d0
move.l d0,chn_fpos(a0) ; No need to save this, we're closing
move.l a0,-(sp)
moveq #sms.rrtc,d0 ; Read current date
trap #1
movea.l (sp)+,a0
lea chn_spare(a0),a4
move.l d1,(a4) ; Put into spare buffer
moveq #iob.smul,d0
moveq #4,d2
bsr mdv_trap ; Update update date in header
mc_do movea.l iod_ocl(a3),a4
jmp (a4) ; Call original close
end
|
scripts for spotify/rotate.applescript | tincochan/Applescript_For_Spotify | 0 | 1020 | <reponame>tincochan/Applescript_For_Spotify
tell application "System Events"
set desktopList to a reference to every desktop
if ((count desktopList) > 1) then
set displayList to {}
repeat with x from 1 to (count desktopList)
set end of displayList to display name of item x of desktopList
end repeat
set targetDisplay to choose from list displayList with prompt "Select a Display to rotate:" default items item 1 of displayList
else
set targetDisplay to display name of item 1 of desktopList
end if
end tell
set targetRot to "90°"
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.displays"
tell application "System Events"
tell process "System Preferences"
tell window targetDisplay
set oldval to value of pop up button "Rotation:" of tab group 1
if oldval is not equal to targetRot then
click pop up button "Rotation:" of tab group 1
click menu item targetRot of menu of pop up button "Rotation:" of tab group 1
delay 2
click button "Confirm" of sheet 1
end if
end tell
end tell
end tell
end tell
tell application "System Preferences"
quit
end tell
|
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/___fssub.asm | jpoikela/z88dk | 0 | 161985 | <reponame>jpoikela/z88dk<gh_stars>0
SECTION code_fp_math32
PUBLIC ___fssub
EXTERN cm32_sdcc_fssub
defc ___fssub = cm32_sdcc_fssub
|
Examples.agda | elpinal/exsub-ccc | 3 | 4181 | module Examples where
open import Data.List using ([]; _∷_)
open import Data.Fin using () renaming (zero to fzero)
open import Relation.Binary using (Rel)
open import Level using () renaming (zero to lzero)
open import Syntax
open import Theory
module NatBool where
data Gr : Set where
nat : Gr
bool : Gr
data Func : Set where
zero plus true false not : Func
open PType Gr
sorting : Func -> Sorting
sorting zero = record { dom = Unit ; cod = ⌊ nat ⌋ }
sorting plus = record { dom = ⌊ nat ⌋ * ⌊ nat ⌋ ; cod = ⌊ nat ⌋ }
sorting true = record { dom = Unit ; cod = ⌊ bool ⌋ }
sorting false = record { dom = Unit ; cod = ⌊ bool ⌋ }
sorting not = record { dom = ⌊ bool ⌋ ; cod = ⌊ bool ⌋ }
Sg : Signature lzero lzero
Sg = record { Gr = Gr ; Func = Func ; sorting = sorting }
open Term Sg
data Ax : forall Γ A -> Rel (Γ ⊢ A) lzero where
not-true≡false : Ax [] ⌊ bool ⌋ (func not (func true unit)) (func false unit)
not-false≡true : Ax [] ⌊ bool ⌋ (func not (func false unit)) (func true unit)
plus-identityˡ : Ax (⌊ nat ⌋ ∷ []) ⌊ nat ⌋
(func plus (pair (func zero unit) var))
var
Th : Theory lzero lzero lzero
Th = record { Sg = Sg ; Ax = Ax }
open Theory.Theory Th
import Relation.Binary.Reasoning.Setoid as S
thm1 : forall {Γ} -> Γ ⊢ func not (func true unit) ≡ func false unit
thm1 =
begin
func not (func true unit)
≈˘⟨ cong/func (cong/func (comm/unit _ _ _)) ⟩
func not (func true (unit [ ! ]))
≈˘⟨ cong/func (comm/func _ _ _ _ _) ⟩
func not (func true unit [ ! ])
≈˘⟨ comm/func _ _ _ _ _ ⟩
func not (func true unit) [ ! ]
≈⟨ cong/sub refl (ax not-true≡false) ⟩
func false unit [ ! ]
≈⟨ comm/func _ _ _ _ _ ⟩
func false (unit [ ! ])
≈⟨ cong/func (comm/unit _ _ _) ⟩
func false unit
∎
where open S TermSetoid
|
oeis/085/A085407.asm | neoneye/loda-programs | 11 | 95027 | <gh_stars>10-100
; A085407: Runs of zeros in binomial(3k+2,k+1)/(3k+2) modulo 2 (A085405).
; Submitted by <NAME>
; 1,1,3,1,5,1,1,11,1,1,3,1,21,1,1,3,1,5,1,1,43,1,1,3,1,5,1,1,11,1,1,3,1,85,1,1,3,1,5,1,1,11,1,1,3,1,21,1,1,3,1,5,1,1,171,1,1,3,1,5,1,1,11,1,1,3,1,21,1,1,3,1,5,1,1,43,1,1,3,1,5,1,1,11,1,1,3,1,341,1,1,3,1,5,1,1,11
seq $0,139764 ; Smallest term in Zeckendorf representation of n.
pow $0,2
mov $1,2
lpb $0
mul $0,2
div $0,5
mul $1,2
lpe
mov $0,$1
div $0,12
mul $0,2
add $0,1
|
UniDB/Morph/Sub.agda | skeuchel/unidb-agda | 0 | 15878 | <gh_stars>0
module UniDB.Morph.Sub where
open import UniDB.Spec
open import UniDB.Morph.Depth
--------------------------------------------------------------------------------
data Single (T : STX) : MOR where
single : {γ : Dom} (t : T γ) → Single T (suc γ) γ
instance
iLkSingle : {T : STX} {{vrT : Vr T}} → Lk T (Single T)
lk {{iLkSingle {T}}} (single t) zero = t
lk {{iLkSingle {T}}} (single t) (suc i) = vr {T} i
iBetaSingle : {T : STX} → Beta T (Single T)
beta {{iBetaSingle}} = single
--------------------------------------------------------------------------------
data Sub (T : STX) : MOR where
sub : {γ₁ γ₂ : Dom} (ξ : Depth (Single T) γ₁ γ₂) → Sub T γ₁ γ₂
module _ {T : STX} where
instance
iLkSub : {{vrT : Vr T}} {{wkT : Wk T}} → Lk T (Sub T)
lk {{iLkSub}} (sub ξ) = lk {T} {Depth (Single T)} ξ
iUpSub : Up (Sub T)
_↑₁ {{iUpSub}} (sub ζ) = sub (ζ ↑₁)
_↑_ {{iUpSub}} ξ 0 = ξ
_↑_ {{iUpSub}} ξ (suc δ⁺) = ξ ↑ δ⁺ ↑₁
↑-zero {{iUpSub}} ξ = refl
↑-suc {{iUpSub}} ξ δ = refl
iBetaSub : Beta T (Sub T)
beta {{iBetaSub}} t = sub (beta {T} {Depth (Single T)} t)
--------------------------------------------------------------------------------
|
programs/oeis/036/A036296.asm | karttu/loda | 1 | 171985 | ; A036296: Denominator of Sum i/2^i, i=1..n.
; 1,2,1,8,8,32,8,128,128,512,256,2048,2048,8192,1024,32768,32768,131072,65536,524288,524288,2097152,524288,8388608,8388608,33554432,16777216,134217728,134217728,536870912,33554432,2147483648,2147483648,8589934592,4294967296,34359738368,34359738368,137438953472,34359738368,549755813888,549755813888,2199023255552,1099511627776,8796093022208,8796093022208,35184372088832,4398046511104,140737488355328,140737488355328,562949953421312,281474976710656,2251799813685248,2251799813685248,9007199254740992,2251799813685248
add $0,1
mov $1,$0
cal $1,84623 ; Numerator of 2^(n-1)/n.
add $1,1
div $1,2
|
src/RdpTests/DisplayListAquaBox.asm | bryanperris/cor64 | 38 | 80398 | // https://github.com/PeterLemon/N64
endian msb
arch n64.rdp
include "LIB/N64.INC" // Include N64 Definitions
include "LIB/N64_GFX.INC" // Include Graphics Macros
align(8) // Align 64-Bit
Set_Scissor 0<<2,0<<2, 0,0, 320<<2,240<<2 // Set Scissor: XH 0.0,YH 0.0, Scissor Field Enable Off,Field Off, XL 320.0,YL 240.0
Set_Other_Modes CYCLE_TYPE_FILL // Set Other Modes
Set_Color_Image IMAGE_DATA_FORMAT_RGBA,SIZE_OF_PIXEL_32B,320-1, $00100000 // Set Color Image: FORMAT RGBA,SIZE 32B,WIDTH 320, DRAM ADDRESS $00100000
Set_Fill_Color $000000FF // Set Fill Color: PACKED COLOR 32B R8G8B8A8 Pixel
Fill_Rectangle 319<<2,239<<2, 0<<2,0<<2 // Fill Rectangle: XL 319.0,YL 239.0, XH 0.0,YH 0.0
Set_Fill_Color $00FFFFFF // Set Fill Color: PACKED COLOR 32B R8G8B8A8 Pixel
Fill_Rectangle 312<<2,224<<2, 192<<2,160<<2 // Fill Rectangle: XL 312.0,YL 224.0, XH 192.0,YH 160.0
Sync_Full // Ensure Entire Scene Is Fully Drawn |
lib/intcode-op.ads | jweese/Ada_Vent_19 | 1 | 7834 | <reponame>jweese/Ada_Vent_19<filename>lib/intcode-op.ads<gh_stars>1-10
with Memory;
package Intcode.Op is
type Code is (
Add,
Mul,
Get,
Put,
Jnz,
Jz,
Lt,
Eq,
Mrb,
Halt
);
type Parameter_Mode is (Position, Immediate, Relative);
type Parameter_List is array (Positive range <>) of Parameter_Mode;
type Schema(Num_Params: Natural) is record
Instruction: Code;
Params: Parameter_List(1 .. Num_Params);
end record;
function Decode(V: Memory.Value) return Schema;
end Intcode.Op;
|
src/Data/Graph/Path/Finite.agda | kcsmnt0/graph | 0 | 16459 | <reponame>kcsmnt0/graph
open import Data.Graph
module Data.Graph.Path.Finite {ℓᵥ ℓₑ} (g : FiniteGraph ℓᵥ ℓₑ) where
open import Category.Monad
open import Data.Bool as Bool
open import Data.Graph.Path.Cut g hiding (_∈_)
open import Data.List as List hiding (_∷ʳ_)
open import Data.List.Any as Any
open import Data.List.Any.Properties
open import Data.List.Membership.Propositional
open import Data.List.Membership.Propositional.Properties hiding (finite)
open import Data.List.Categorical as ListCat
open import Data.Nat using (ℕ; zero; suc; _≤_; z≤n; s≤s)
open import Data.Nat.Properties
open import Data.Product as Σ
open import Data.Unit using (⊤; tt)
open import Data.Sum as ⊎
open import Data.Vec as Vec using (Vec; []; _∷_)
import Level as ℓ
open import Finite
open import Function
open import Function.Equality using (Π)
open import Function.Equivalence using (Equivalence)
open import Function.Inverse using (Inverse)
open import Function.LeftInverse using (LeftInverse; leftInverse)
open import Relation.Binary
open import Relation.Binary.Construct.Closure.ReflexiveTransitive hiding (_>>=_)
open import Relation.Binary.PropositionalEquality as ≡
open import Relation.Binary.HeterogeneousEquality as ≅
open import Relation.Nullary hiding (module Dec)
open import Relation.Nullary.Decidable as Dec
open import Relation.Nullary.Negation
open Π using (_⟨$⟩_)
open Equivalence using (to; from)
open FiniteGraph g
open Inverse using (to; from)
open IsFinite
open RawMonad {ℓᵥ ℓ.⊔ ℓₑ} ListCat.monad
isubst : ∀ {ℓ₁ ℓ₂ ℓ₃} {I : Set ℓ₁}
(A : I → Set ℓ₂) (B : ∀ {k} → A k → Set ℓ₃)
{i j : I} {x : A i} {y : A j} →
i ≡ j → x ≅ y →
B x → B y
isubst A B refl refl = id
True-unique : ∀ {ℓ} {A : Set ℓ} (A? : Dec A) (x y : True A?) → x ≡ y
True-unique A? x y with A?
True-unique A? tt tt | yes a = refl
True-unique A? () y | no ¬a
True-unique-≅ : ∀
{ℓ₁ ℓ₂} {A : Set ℓ₁} {B : Set ℓ₂}
(A? : Dec A) (B? : Dec B)
(x : True A?) (y : True B?) →
x ≅ y
True-unique-≅ A? B? x y with A? | B?
True-unique-≅ A? B? tt tt | yes a | yes b = refl
True-unique-≅ A? B? x () | _ | no ¬b
True-unique-≅ A? B? () y | no ¬a | _
∃-≅ : ∀
{ℓ₁ ℓ₂} {A : Set ℓ₁} {P : A → Set ℓ₂}
{x y : A} {p : P x} {q : P y} →
x ≡ y → p ≅ q → (∃ P ∋ (x , p)) ≡ (y , q)
∃-≅ refl refl = refl
nexts : ∀ {a b n} → Path a b n → List (∃ λ b → Path a b (suc n))
nexts {a} {b} p = List.map (λ where (_ , e) → -, p ∷ʳ e) (elements (edgeFinite b))
∈-nexts : ∀ {a c n} →
(pf : IsFinite (∃ λ b → Path a b n)) →
(p : Path a c (suc n)) →
(c , p) ∈ (elements pf >>= (nexts ∘ proj₂))
∈-nexts pf p =
case unsnoc p of λ where
(_ , p′ , e′ , refl) →
to >>=-∈↔ ⟨$⟩
(-,
membership pf (-, p′) ,
∈-map⁺ (membership (edgeFinite _) (-, e′)))
Path-finite : ∀ n a → IsFinite (∃ λ b → Path a b n)
Path-finite zero a = finite List.[ -, [] ] λ where (_ , []) → here refl
Path-finite (suc n) a =
let pf = Path-finite n a in
finite (elements pf >>= (nexts ∘ proj₂)) (∈-nexts pf ∘ proj₂)
≤-top? : ∀ {x y} → x ≤ suc y → x ≤ y ⊎ x ≡ suc y
≤-top? z≤n = inj₁ z≤n
≤-top? {y = zero} (s≤s z≤n) = inj₂ refl
≤-top? {y = suc y} (s≤s p) =
case ≤-top? p of λ where
(inj₁ le) → inj₁ (s≤s le)
(inj₂ refl) → inj₂ refl
Path≤-finite : ∀ n a → IsFinite (∃ λ b → Path≤ a b n)
Path≤-finite zero a = finite List.[ -, -, z≤n , [] ] λ where (_ , _ , z≤n , []) → here refl
Path≤-finite (suc n) a =
let
finite xs elem = Path≤-finite n a
finite xs′ elem′ = Path-finite (suc n) a
in
finite
(List.map (Σ.map₂ (Σ.map₂ (Σ.map₁ ≤-step))) xs List.++
List.map (Σ.map₂ (_,_ (suc n) ∘ _,_ ≤-refl)) xs′)
λ where
(b , m , le , p) → case ≤-top? le of λ where
(inj₁ le′) →
to ++↔ ⟨$⟩
inj₁
(to map-∈↔ ⟨$⟩
(-, (elem (b , m , le′ , p)) ,
≡.cong (λ q → b , m , q , p) (≤-irrelevance le (≤-step le′))))
(inj₂ refl) →
to (++↔ {xs = List.map _ xs}) ⟨$⟩
inj₂
(to map-∈↔ ⟨$⟩
(-, elem′ (-, p) ,
≡.cong (λ q → b , m , q , p) (≤-irrelevance le (s≤s ≤-refl))))
AcyclicPath-finite : ∀ a → IsFinite (∃₂ λ b n → ∃ λ (p : Path a b n) → True (acyclic? p))
AcyclicPath-finite a =
via-left-inverse (IsFinite.filter (Path≤-finite (size vertexFinite) a) _) $
leftInverse
(λ where (b , n , p , acp) → (b , n , acyclic-length-≤ p (toWitness acp) , p) , acp)
(λ where ((b , n , le , p) , acp) → b , n , p , acp)
λ where _ → refl
AcyclicStar : Vertex → Vertex → Set _
AcyclicStar a b = ∃ λ (p : Star Edge a b) → True (acyclic? (fromStar p))
AcyclicStar-finite : ∀ a → IsFinite (∃ (AcyclicStar a))
AcyclicStar-finite a =
via-left-inverse (AcyclicPath-finite a) $
leftInverse
(λ where
(b , p , acp) →
b , starLength p , fromStar p , acp)
(λ where
(b , n , p , acp) →
b , toStar p ,
isubst (Path a b) (True ∘ acyclic?)
(starLength-toStar p) (fromStar-toStar p)
acp)
(λ where
(b , p , acp) →
≡.cong (b ,_) $
∃-≅
(≡.sym (toStar-fromStar p))
(True-unique-≅ _ _ _ _))
|
chapter03/pmtest1.asm | 12Tall/os | 0 | 174855 | <reponame>12Tall/os<gh_stars>0
%include "pm.inc" ; constant, macro
%include "func.inc"
org 07c00h
jmp LABEL_BIGIN ; 4 bytes
section .gdt ; GDT section, allocate memory space only
; ======================================================================
; ----------------------------------------------------------------------
; label: base; limit; attr;(8 bytes)
LABEL_GDT: Descriptor 0, 0, 0
LABEL_DESC_CODE32: Descriptor 0, SegCode32Len-1, DA_C + DA_32 ; uncoordinate code section
LABEL_DESC_VIDEO: Descriptor 0B8000h,0ffffh, DA_DRW ; video cache section
; -----------------------------------------------------------------------
GdtLen equ $ - LABEL_GDT ; length of gdt; limit = length-1
GdtPtr dw GdtLen - 1 ; !content of gdt register!
dd 0 ; base of gdt
; Selector: !just constant, not in memory
; -----------------------------------------------------------------------
Selector_Code32 equ LABEL_DESC_CODE32 - LABEL_GDT
Selector_Video equ LABEL_DESC_VIDEO - LABEL_GDT
; -----------------------------------------------------------------------
; =======================================================================
section .s16
[BITS 16]
; =======================================================================
LABEL_BIGIN:
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0100h ; aligin to section base
; init cede32 descriptor
Init_Descriptor LABEL_DESC_CODE32, LABEL_SEG_CODE32
; /\
; ||
; --------------------------------------------------
; xor eax, eax ; reset eax
; mov ax, cs ;
; shl eax, 4 ; eax = cs << 4
; add eax, LABEL_SEG_CODE32 ; addr of code32 section
; mov word [LABEL_DESC_CODE32 + 2], ax
; shr eax, 16
; mov byte [LABEL_DESC_CODE32 + 4], al
; mov byte [LABEL_DESC_CODE32 + 7], ah
; --------------------------------------------------
; prepare for loading GDTR(gdt register)
xor eax, eax
mov ax, ds
shl eax, 4 ; eax = ds << 4
add eax, LABEL_GDT
mov dword [GdtPtr + 2], eax ; [GdtPtr+2] = base of gdt
; load gdt register
lgdt [GdtPtr]
cli
; open A20
in al, 92h
or al, 00000010b
out 92h, al
; exchange protect mode
mov eax, cr0
or eax, 1
mov cr0, eax
; long jmp
jmp dword Selector_Code32:0
; =======================================================================
section .s32
[BITS 32]
; =======================================================================
LABEL_SEG_CODE32:
mov ax, Selector_Video ; offset address
mov gs, ax
mov edi, (80 * 11 + 79)* 2 ; line 11 row 79
mov ah, 0ch ; font style
mov al, 'p'
mov [gs:edi], ax
jmp $
SegCode32Len equ $ - LABEL_SEG_CODE32 ; this line belong to .s32, until
; there is any new section defined before
; ======================================================================== |
Multiprocessor-Communication/MC B/Bcomp3.asm | xfrings/8051-Experiments | 0 | 16269 | <filename>Multiprocessor-Communication/MC B/Bcomp3.asm
;ASTER 02/03/2009 2135
;TO BE ASSEMBLED IN KEIL MICROVISION V3.60
;ARTIFICIAL INTELLIGENCE
;MICROCOMPUTER B
;REV 0 LAST UPDATED 04/03/2009 1610
;-----------------------------------------------------------------------------------------------------------
;SET THE ASSEMBLER FOR AT89S52
$NOMOD51
$INCLUDE (AT89X52.h)
;-----------------------------------------------------------------------------------------------------------
ORG 0000H
RESET: SJMP 0030H
ORG 0030H
START: NOP
MOV SP,#10H ;RELOCATE STACK OVER 10H
CLR A
MOV P0,A
MOV P1,A
MOV P2,A
MOV P3,#0FFH
LCALL DELAYIN
MOV R0,#20H ;CLEAR RAM FROM 20H TO 7FH
CLR A
CLRALL: MOV @R0,A
INC R0
CJNE R0,#7FH,CLRALL
MOV T2CON,#30H ;SET UP THE UART 9600BPS
MOV RCAP2H,#0FFH
MOV RCAP2L,#0DCH
ANL PCON,#7FH
MOV IE,#90H ;ENABLE INTERRUPTS: SERIAL
MOV IP,#10H
MOV SCON,#58H
SETB TR2 ;START BAUD GEN TIMER
;----------------------------------------------------------------------------------------------------------
;**********************************************************************************************************
;THE PROGRAM MAIN
;PASS DIRECTION IN R2,BANK0 : 00H->FORWARD, 01H->BACKWARD
MAIN:
MAIN_END: LJMP MAIN
;MAIN ENDS HERE
;**********************************************************************************************************
;----------------------------------------------------------------------------------------------------------
;INTERRUPT SERVICE ROUTINES
ORG 0023H
LJMP 1000H
ORG 1000H
SERCON: CLR TR2
JNB RI,TXI
CLR RI
MOV A,SBUF
JB 20H,SKIPC
CJNE A,#0CEH,EXITC
MOV SBUF,#9EH
SETB 20H
SJMP EXITC
SKIPC: CJNE A,#0BEH,SKIPC2
MOV SBUF,#0BEH
CLR 20H
SJMP EXITC
SKIPC2: SETB 21H
MOV SBUF,#9EH
SJMP EXITC
TXI: CLR TI
EXITC: SETB TR2
RETI
;----------------------------------------------------------------------------------------------------------
;MOTOR DRIVING ROUTINES
;MOTOR 1: BASE RIGHT MOTOR :: MOTOR CODE: 01H
BSERGT: NOP
CJNE R2,#00H,BACK1
SETB P2.0
CLR P2.1
MOV 34H,#00H
SJMP DONE1
BACK1: CJNE R2,#01H,RSTP1
CLR P2.0
SETB P2.1
MOV 34H,#01H
SJMP DONE1
RSTP1: CJNE R2,#02H,HSTP1
CLR P2.0
CLR P2.1
MOV 34H,#04H
SJMP DONE1
HSTP1: MOV R3,34H
CJNE R3,#00H,RREV1
RFOR1: CLR P2.0
CLR P2.1
LCALL DELAYHS
SETB P2.1
LCALL DELAYHS
CLR P2.1
MOV 34H,#04H
SJMP DONE1
RREV1: CJNE R3,#01H,DONE1
CLR P2.0
CLR P2.1
LCALL DELAYHS
SETB P2.0
LCALL DELAYHS
CLR P2.0
MOV 34H,#04H
DONE1: NOP
RET
;MOTOR 2: BASE LEFT MOTOR :: MOTOR CODE: 02H
BSELFT: NOP
CJNE R2,#00H,BACK2
SETB P2.2
CLR P2.3
MOV 38H,#00H
SJMP DONE2
BACK2: CJNE R2,#01H,RSTP2
CLR P2.2
SETB P2.3
MOV 38H,#01H
SJMP DONE2
RSTP2: CJNE R2,#02H,HSTP2
CLR P2.2
CLR P2.3
MOV 38H,#04H
SJMP DONE2
HSTP2: MOV R3,38H
CJNE R3,#00H,RREV2
RFOR2: CLR P2.2
CLR P2.3
LCALL DELAYHS
SETB P2.3
LCALL DELAYHS
CLR P2.3
MOV 38H,#04H
SJMP DONE2
RREV2: CJNE R3,#01H,DONE2
CLR P2.2
CLR P2.3
LCALL DELAYHS
SETB P2.2
LCALL DELAYHS
CLR P2.2
MOV 38H,#04H
DONE2: NOP
RET
;MOTOR 3: SHOULDER RIGHT MOTOR :: MOTOR CODE: 03H
SHLRGT: NOP
CJNE R2,#00H,BACK3
SETB P2.4
CLR P2.5
MOV 3CH,#00H
SJMP DONE1
BACK3: CJNE R2,#01H,RSTP3
CLR P2.4
SETB P2.5
MOV 3CH,#01H
SJMP DONE3
RSTP3: CJNE R2,#02H,HSTP3
CLR P2.4
CLR P2.5
MOV 3CH,#04H
SJMP DONE3
HSTP3: MOV R3,3CH
CJNE R3,#00H,RREV3
RFOR3: CLR P2.4
CLR P2.5
LCALL DELAYHS
SETB P2.5
LCALL DELAYHS
CLR P2.5
MOV 3CH,#04H
SJMP DONE3
RREV3: CJNE R3,#01H,DONE3
CLR P2.4
CLR P2.5
LCALL DELAYHS
SETB P2.4
LCALL DELAYHS
CLR P2.4
MOV 3CH,#04H
DONE3: NOP
RET
;MOTOR 4: SHOULDER LEFT MOTOR :: MOTOR CODE: 04H
SHLLFT: NOP
CJNE R2,#00H,BACK4
SETB P2.6
CLR P2.7
MOV 40H,#00H
SJMP DONE4
BACK4: CJNE R2,#01H,RSTP4
CLR P2.6
SETB P2.7
MOV 40H,#01H
SJMP DONE4
RSTP4: CJNE R2,#02H,HSTP4
CLR P2.6
CLR P2.7
MOV 40H,#04H
SJMP DONE4
HSTP4: MOV R3,40H
CJNE R3,#00H,RREV4
RFOR4: CLR P2.6
CLR P2.7
LCALL DELAYHS
SETB P2.7
LCALL DELAYHS
CLR P2.7
MOV 40H,#04H
SJMP DONE4
RREV4: CJNE R3,#01H,DONE4
CLR P2.6
CLR P2.7
LCALL DELAYHS
SETB P2.6
LCALL DELAYHS
CLR P2.6
MOV 40H,#04H
DONE4: NOP
RET
;MOTOR 5: ARM ELBOW RIGHT MOTOR :: MOTOR CODE : 05H
ELRGT: NOP
CJNE R2,#00H,BACK5
SETB P1.0
CLR P1.1
MOV 44H,#00H
SJMP DONE5
BACK5: CJNE R2,#01H,RSTP5
CLR P1.0
SETB P1.1
MOV 44H,#01H
SJMP DONE5
RSTP5: CJNE R2,#02H,HSTP5
CLR P1.0
CLR P1.1
MOV 44H,#04H
SJMP DONE5
HSTP5: MOV R3,44H
CJNE R3,#00H,RREV5
RFOR5: CLR P1.0
CLR P1.1
LCALL DELAYHS
SETB P1.1
LCALL DELAYHS
CLR P1.1
MOV 44H,#04H
SJMP DONE5
RREV5: CJNE R3,#01H,DONE5
CLR P1.0
CLR P1.1
LCALL DELAYHS
SETB P1.0
LCALL DELAYHS
CLR P1.0
MOV 44H,#04H
DONE5: NOP
RET
;MOTOR 6: ARM ELBOW RIGHT MOTOR :: MOTOR CODE : 06H
ELLFT: NOP
CJNE R2,#00H,BACK6
SETB P1.2
CLR P1.3
MOV 48H,#00H
SJMP DONE6
BACK6: CJNE R2,#01H,RSTP6
CLR P1.2
SETB P1.3
MOV 48H,#01H
SJMP DONE6
RSTP6: CJNE R2,#02H,HSTP6
CLR P1.2
CLR P1.3
MOV 48H,#04H
SJMP DONE6
HSTP6: MOV R3,48H
CJNE R3,#00H,RREV6
RFOR6: CLR P1.2
CLR P1.3
LCALL DELAYHS
SETB P1.3
LCALL DELAYHS
CLR P1.3
MOV 48H,#04H
SJMP DONE6
RREV6: CJNE R3,#01H,DONE6
CLR P1.2
CLR P1.3
LCALL DELAYHS
SETB P1.2
LCALL DELAYHS
CLR P1.2
MOV 48H,#04H
DONE6: NOP
RET
;MOTOR 7: RIGHT CLASPER :: MOTOR CODE: 07H
;MOTOR 8: LEFT CLASPER :: MOTOR CODE : 08H
;-------------------------------------------------------------------------------------------------
;DELAY ROUTINES
;DELAY INIT
DELAYIN: MOV R7,#07H
MOV R6,#0FFH
MOV R5,#0FFH
DJNZ R5,$
DJNZ R6,$-2
DJNZ R7,$-4
RET
DELAYHS: MOV R7,#0A0H
DJNZ R7,$
RET
;--------------------------------------------------------------------------------------------------
END |
lib/kernel/print.asm | Elio-yang/EOS | 0 | 94386 | ;/*
; * print.asm
; *
; * Created by ElioYang on 2022/1/28.
; * Email: <EMAIL>
; *
; * MIT License
; * Copyright (c) 2021 Elio-yang
; *
; */
TI_GDT equ 0
RPL0 equ 0
SELECTOR_VIDEO equ (0x0003<<3) + TI_GDT + RPL0
; TODO
; fix color property while print
; put_char(ch,color)
; color can be defined as macros
; should be stored in 'property'
section .data
property dw 0
put_int_buffer dq 0 ; 定义8字节缓冲区用于数字到字符的转换
[bits 32]
section .text
;------------------------ put_char -----------------------------
;功能描述:把栈中的1个字符写入光标所在处
;-------------------------------------------------------------------
global put_char
put_char:
pushad ;备份32位寄存器环境
;需要保证gs中为正确的视频段选择子,为保险起见,每次打印时都为gs赋值
mov ax, SELECTOR_VIDEO ; 不能直接把立即数送入段寄存器
mov gs, ax
;;;;;;;;; 获取当前光标位置 ;;;;;;;;;
;先获得高8位
mov dx, 0x03d4 ;索引寄存器
mov al, 0x0e ;用于提供光标位置的高8位
out dx, al
mov dx, 0x03d5 ;通过读写数据端口0x3d5来获得或设置光标位置
in al, dx ;得到了光标位置的高8位
mov ah, al
;再获取低8位
mov dx, 0x03d4
mov al, 0x0f
out dx, al
mov dx, 0x03d5
in al, dx
;将光标存入bx
mov bx, ax
;下面这行是在栈中获取待打印的字符
mov ecx, [esp + 36] ;pushad压入4×8=32字节,加上主调函数的返回地址4字节,故esp+36字节
; GET COLOR
mov edx,[esp+40]
mov [property],edx
cmp cl, 0xd ;CR是0x0d,LF是0x0a
jz .is_carriage_return
cmp cl, 0xa
jz .is_line_feed
cmp cl, 0x8 ;BS(backspace)的asc码是8
jz .is_backspace
jmp .put_other
;;;;;;;;;;;;;;;;;;
.is_backspace:
;;;;;;;;;;;; backspace的一点说明 ;;;;;;;;;;
; 当为backspace时,本质上只要将光标移向前一个显存位置即可.后面再输入的字符自然会覆盖此处的字符
; 但有可能在键入backspace后并不再键入新的字符,这时在光标已经向前移动到待删除的字符位置,但字符还在原处,
; 这就显得好怪异,所以此处添加了空格或空字符0
dec bx
shl bx,1
mov byte [gs:bx], 0x20 ;将待删除的字节补为0或空格皆可
inc bx
mov byte [gs:bx], 0x07
shr bx,1
jmp .set_cursor
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.put_other:
shl bx, 1 ; 光标位置是用2字节表示,将光标值乘2,表示对应显存中的偏移字节
mov [gs:bx], cl ; ascii字符本身
inc bx
mov edx,[property] ; get property
mov byte [gs:bx],dl ; 字符属性
shr bx, 1 ; 恢复老的光标值
inc bx ; 下一个光标值
cmp bx, 2000
jl .set_cursor ; 若光标值小于2000,表示未写到显存的最后,则去设置新的光标值
; 若超出屏幕字符数大小(2000)则换行处理
.is_line_feed: ; 是换行符LF(\n)
.is_carriage_return: ; 是回车符CR(\r)
; 如果是CR(\r),只要把光标移到行首就行了。
xor dx, dx ; dx是被除数的高16位,清0.
mov ax, bx ; ax是被除数的低16位.
mov si, 80 ; 由于是效仿linux,linux中\n便表示下一行的行首,所以本系统中,
div si ; 把\n和\r都处理为linux中\n的意思,也就是下一行的行首。
sub bx, dx ; 光标值减去除80的余数便是取整
; 以上4行处理\r的代码
.is_carriage_return_end: ; 回车符CR处理结束
add bx, 80
cmp bx, 2000
.is_line_feed_end: ; 若是LF(\n),将光标移+80便可。
jl .set_cursor
;屏幕行范围是0~24,滚屏的原理是将屏幕的1~24行搬运到0~23行,再将第24行用空格填充
.roll_screen: ; 若超出屏幕大小,开始滚屏
cld
mov ecx, 960 ; 一共有2000-80=1920个字符要搬运,共1920*2=3840字节.一次搬4字节,共3840/4=960次
mov esi, 0xb80a0 ; 第1行行首
mov edi, 0xb8000 ; 第0行行首
rep movsd
;;;;;;;将最后一行填充为空白
mov ebx, 3840 ; 最后一行首字符的第一个字节偏移= 1920 * 2
mov ecx, 80 ;一行是80字符(160字节),每次清空1字符(2字节),一行需要移动80次
.cls:
mov word [gs:ebx], 0x0720 ;0x0720是黑底白字的空格键
add ebx, 2
loop .cls
mov bx,1920 ;将光标值重置为1920,最后一行的首字符.
.set_cursor:
;将光标设为bx值
;;;;;;; 1 先设置高8位 ;;;;;;;;
mov dx, 0x03d4 ;索引寄存器
mov al, 0x0e ;用于提供光标位置的高8位
out dx, al
mov dx, 0x03d5 ;通过读写数据端口0x3d5来获得或设置光标位置
mov al, bh
out dx, al
;;;;;;; 2 再设置低8位 ;;;;;;;;;
mov dx, 0x03d4
mov al, 0x0f
out dx, al
mov dx, 0x03d5
mov al, bl
out dx, al
.put_char_done:
popad
mov dword[property],0
ret
;------------------------ set_cursor -----------------------------
; set cursor position
;-------------------------------------------------------------------
global set_cursor
set_cursor:
pushad
mov bx, [esp+36]
;;;;;;; 1 先设置高8位 ;;;;;;;;
mov dx, 0x03d4 ;索引寄存器
mov al, 0x0e ;用于提供光标位置的高8位
out dx, al
mov dx, 0x03d5 ;通过读写数据端口0x3d5来获得或设置光标位置
mov al, bh
out dx, al
;;;;;;; 2 再设置低8位 ;;;;;;;;;
mov dx, 0x03d4
mov al, 0x0f
out dx, al
mov dx, 0x03d5
mov al, bl
out dx, al
popad
ret
global cls_screen
cls_screen:
pushad
;;;;;;;;;;;;;;;
; 由于用户程序的cpl为3,显存段的dpl为0,故用于显存段的选择子gs在低于自己特权的环境中为0,
; 导致用户程序再次进入中断后,gs为0,故直接在put_str中每次都为gs赋值.
mov ax, SELECTOR_VIDEO ; 不能直接把立即数送入gs,须由ax中转
mov gs, ax
mov ebx, 0
mov ecx, 80*25
.cls:
mov word [gs:ebx], 0x0720 ;0x0720是黑底白字的空格键
add ebx, 2
loop .cls
mov ebx, 0
.set_cursor: ;直接把set_cursor搬过来用,省事
;;;;;;; 1 先设置高8位 ;;;;;;;;
mov dx, 0x03d4 ;索引寄存器
mov al, 0x0e ;用于提供光标位置的高8位
out dx, al
mov dx, 0x03d5 ;通过读写数据端口0x3d5来获得或设置光标位置
mov al, bh
out dx, al
;;;;;;; 2 再设置低8位 ;;;;;;;;;
mov dx, 0x03d4
mov al, 0x0f
out dx, al
mov dx, 0x03d5
mov al, bl
out dx, al
popad
ret |
Ada/program.adb | yangyangisyou/GildedRose-Refactoring-Kata | 2,201 | 2324 | <reponame>yangyangisyou/GildedRose-Refactoring-Kata<gh_stars>1000+
with Ada.Text_IO;
use Ada.Text_IO;
with Items;
use Items;
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
with Gilded_Rose;
use Gilded_Rose;
procedure Program is
Things : Item_Vecs.Vector;
begin
Things.Append(New_Item =>
(Name => To_Unbounded_String("+5 Dexterity Vest"),
Sell_In => 10,
Quality => 20));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Aged Brie"),
Sell_In => 2,
Quality => 0));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Elixir of the Mongoose"),
Sell_In => 5,
Quality => 7));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Sulfuras, Hand of Ragnaros"),
Sell_In => 0,
Quality => 80));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Sulfuras, Hand of Ragnaros"),
Sell_In => -1,
Quality => 80));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
Sell_In => 15,
Quality => 20));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
Sell_In => 10,
Quality => 49));
Things.Append(New_Item =>
(Name => To_Unbounded_String("Backstage passes to a TAFKAL80ETC concert"),
Sell_In => 5,
Quality => 49));
-- this conjured item does not work properly yet
Things.Append(New_Item =>
(Name => To_Unbounded_String("Conjured Mana Cake"),
Sell_In => 3,
Quality => 6));
declare
App : Gilded_Rose.Gilded_Rose := (Items => Things);
begin
Put_Line("OMGHAI!");
for I in 0 .. 30 loop
Put_Line("-------- day" & Integer'Image(I) & " --------");
Put_Line("name, sellIn, quality");
for Each of App.Items loop
Put_Line(To_String(Each));
end loop;
Put_Line("");
Update_Quality(App);
end loop;
end;
end;
|
neio/src/main/grammar/DocumentLexer.g4 | FlashYoshi/neio | 0 | 2629 | /*
[The BSD License]
Copyright (c) 2012 <NAME> and <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
lexer grammar DocumentLexer;
HEADER : {getCharPositionInLine() == 0}? LS_BRACE CHAR+ RS_BRACE;
COMMENT : '//' ~[\r\n]* NL -> channel(HIDDEN);
MULTILINE_COMMENT : '/*' .*? '*/' NL -> channel(HIDDEN);
SCOPED_CODE : {getCharPositionInLine() == 0}? DLCB CONTENT* DRCB {_input.LA(1) == '\r' || _input.LA(1) == '\n'}?;
LONE_CODE : {getCharPositionInLine() == 0}? LCB CONTENT* RCB {_input.LA(1) == '\r' || _input.LA(1) == '\n'}?;
CODE : LCB -> pushMode(INCODE);
fragment CHAR : [a-zA-Z0-9];
ESCAPE : B_SLASH .;
S : ' ';
WS : [\t] -> channel(HIDDEN);
NL : '\r'? '\n';
LS_BRACE : '[';
RS_BRACE : ']';
L_BRACE : '(';
R_BRACE : ')';
DLCB : '{{';
LCB : '{';
DRCB : '}}';
RCB : '}';
Q : '"';
fragment SQ : '\'';
TQ : SQ SQ SQ;
fragment B_QUOTE : '`';
fragment DB_QUOTE : '``';
fragment TB_QUOTE : '```';
fragment B_SLASH : '\\';
fragment UNDERSCORE : '_';
fragment H : '#';
fragment D : '-';
fragment ST : '*';
fragment DOLLAR : '$';
fragment PIPE : '|';
fragment EQUALS : '=';
fragment CARET : '^';
MethodName : {getCharPositionInLine() == 0}? (H | D | ST | DLR | EQUALS | CARET | B_QUOTE | UNDERSCORE | P)+;
HASH : H;
DASH : D;
STAR : ST;
P : PIPE;
EQ : EQUALS;
CA : CARET;
BQ : B_QUOTE;
US : UNDERSCORE;
DLR : DOLLAR;
fragment VALID_CHAR : ~[#-*_`\[\]{} \r\n] | SQ | HASH | DLR | L_BRACE | R_BRACE | EQ | CA;
WORD : VALID_CHAR+;
mode INCODE;
CCONTENT : CONTENT* RCB -> mode(DEFAULT_MODE);
CONTENT : (LCB CONTENT* RCB) | ANY;
ANY : ~["{}']+ | STRING;
STRING : Q (~["] | B_SLASH Q)* Q
| SQ (~['] | B_SLASH SQ)* SQ
| TEXTMODE;
TEXTMODE : TQ (. | B_SLASH SQ B_SLASH SQ B_SLASH SQ)*? TQ;
UNKNOWN : . ; |
source/sql/oci/matreshka-internals-sql_drivers-oracle-databases.ads | svn2github/matreshka | 24 | 30719 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- Implementation of Abstract_Database type for Oracle database.
------------------------------------------------------------------------------
with Matreshka.Internals.Strings;
with Matreshka.Internals.SQL_Drivers.Oracle.Plug_In;
package Matreshka.Internals.SQL_Drivers.Oracle.Databases is
type OCI_Database is new Abstract_Database with record
Error : aliased Error_Handle;
Service : aliased Service_Handle;
Error_Text : Matreshka.Internals.Strings.Shared_String_Access;
Plugins : access Oracle.Plug_In.Abstract_Plug_In'Class;
end record;
overriding procedure Close (Self : not null access OCI_Database);
overriding procedure Commit (Self : not null access OCI_Database);
overriding function Error_Message
(Self : not null access OCI_Database)
return League.Strings.Universal_String;
overriding function Query
(Self : not null access OCI_Database) return not null Query_Access;
overriding procedure Finalize (Self : not null access OCI_Database);
overriding function Open
(Self : not null access OCI_Database;
Options : SQL.Options.SQL_Options) return Boolean;
function Check_Error
(Self : not null access OCI_Database;
Code : Error_Code) return Boolean;
Env : aliased Environment;
-- This is an OCI environment shared between all connections.
-- Because the environment initialized in thread mode, all threads
-- can safely use it.
-- XXX Reasons of use of global object must be here, as well as all kind of
-- considerations of its use.
end Matreshka.Internals.SQL_Drivers.Oracle.Databases;
|
old/run7.asm | ZornsLemma/blinkenlights | 0 | 92630 | org &70
guard &90
.led_group_count
equb 0
.vsync_count
equb 0
.SFTODOTHING \ SFTODO: RENAME inverse_raster_row OR SIMILAR
equb 0
.screen_ptr
equw 0
.tmp_y
equb 0
org &2000
guard &7c00
\ TODO: IS THE VSYNC-Y INTERRUPT STUFF USEFUL IN MODE 7? MAYBE, BUT THINK ABOUT IT.
led_count = 38*2*25*3
ticks_per_frame = 8
sys_int_vsync = 2
sys_via_ifr = &fe40+13
irq1v = &204
user_via_auxiliary_control_register = &fe6b
user_via_interrupt_flag_register = &fe6d
user_via_interrupt_enable_register = &fe6e
macro advance_to_next_led_fall_through
inx
bne led_loop
endmacro
macro advance_to_next_led
advance_to_next_led_fall_through
beq advance_to_next_led_group \ always branch
endmacro
.start
\ Interrupt code based on https://github.com/kieranhj/intro-to-interrupts/blob/master/source/screen-example.asm
scanline_to_interrupt_at = -2
vsync_position = 35
total_rows = 39
us_per_scanline = 64
us_per_row = 8*us_per_scanline
\ TODO: I should be able to just use timer1 now
timer2_value_in_us = (total_rows-vsync_position)*us_per_row - 2*us_per_scanline + scanline_to_interrupt_at*us_per_scanline
timer1_value_in_us = us_per_row - 2 \ us_per_row \ - 2*us_per_scanline
sei
lda #&7f:sta &fe4e:sta user_via_interrupt_enable_register \ disable all interrupts
lda #&82
sta &fe4e
lda irq1v:sta jmp_old_irq_handler+1
lda irq1v+1:sta jmp_old_irq_handler+2
lda #lo(irq_handler):sta irq1v
lda #hi(irq_handler):sta irq1v+1
lda #0:sta vsync_count
cli
jmp forever_loop
\ TODO: Pay proper attention to alignment so the branches in the important code never take longer than necessary - this is a crude hack which will probably do the job but I haven't checked.
align &100
.forever_loop
\ Initialise all the addresses in the self-modifying code.
lda #hi(count_table):sta lda_count_x+2:sta sta_count_x_1+2
if FALSE
sta sta_count_x_1b+2
endif
sta sta_count_x_2+2
lda #hi(period_table):sta adc_period_x+2
\lda #hi(inverse_row_table):sta lda_inverse_row_x+2
\ Reset X and led_group_count.
\ At the moment we have 5*256 LEDs; if we had a number which wasn't a multiple of
\ 256 we'd need to start the first pass round the loop with X>0 so we end neatly
\ on a multiple of 256.
lda #&16:sta led_group_count \ TODO: SHOULD BE 5
ldx #0
lda #&02:sta screen_ptr:lda #&7c:sta screen_ptr+1
ldy #38*6
\ The idea here is that if we took less than 1/50th second to process the last update we
\ wait for VSYNC (well, more precisely, the start of the blank area at the bottom of the
\ screen), but if we took longer we just keep going until we catch up.
dec vsync_count
dec vsync_count
dec vsync_count
dec vsync_count
dec vsync_count
bpl missed_vsync
.vsync_wait_loop
lda vsync_count
bmi vsync_wait_loop
.missed_vsync
.SFTODO999
.led_loop_sec
sec
\ TIME: 4+0.5*(2+2+2)+0.5*(3+2+3)+5+2+2+2+2+4+2+5+3=38 cycles per LED v approx with no toggling - probably down to 35 with ticks_per_frame <= 4
.led_loop
if FALSE
.SFTODOHANG99
bcc SFTODOHANG99
endif
\ TIME: To hit 50fps consistently, I have 7.3 cycles per LED. Obviously that's not
\ possible.
\ Decrement this LED's count and do nothing else if it's not yet zero.
\ TODO: Relatively little code here touches carry; it may be possible to optimise away the sec/clc instructions here.
.lda_count_x
lda $ff00,x \ patched
\ sec - we have arranged that carry is always set here already
if ticks_per_frame > 4
\ TODO: This bmi at the cost of 2/3 cycles per LED means we can use the full 8-bit range of
\ the count. This is an experiment.
bmi not_going_to_toggle
endif
sbc #ticks_per_frame
bmi toggle_led
.sta_count_x_1
sta $ff00,x \ patched
.advance_to_next_led
inx:beq advance_to_next_led_group
.return_from_advance_to_next_led_group
dey
beq next_line
lda SFTODOTABLE,y:bpl led_loop
inc screen_ptr:bne led_loop
inc screen_ptr+1:jmp led_loop
.next_line
ldy #38*6
\ TODO: Since we probably know C is set, we could get rid of clc and adc#2 instead - but this code isn't executed that often, so not a huge win
clc:lda screen_ptr:adc #3:sta screen_ptr:bcc led_loop_sec
inc screen_ptr+1:jmp led_loop
if ticks_per_frame > 4
.not_going_to_toggle
sbc #ticks_per_frame
jmp sta_count_x_1
endif
\ Toggle this LED.
.toggle_led
if FALSE
.SFTODOHANG44
bcs SFTODOHANG44
endif
\ This LED's count has gone negative; add the period.
\ clc - we have arranged that carry is always clear here already
.adc_period_x
adc $ff00,x \ patched
.sta_count_x_2
sta $ff00,x \ patched
\ Toggle the LED's state in screen RAM.
lda SFTODOTABLE,y
\ TODO: Scope for using CMOS instructions to avoid needing Y=0
sty tmp_y
ldy #0:eor (screen_ptr),y:sta (screen_ptr),y
ldy tmp_y
jmp advance_to_next_led
if FALSE \ SFTODO?!
\ If the raster is currently on this row, wait for it to pass.
.lda_inverse_row_x
lda $ff00,x \ patched
.raster_loop
cmp SFTODOTHING
beq raster_loop
endif
.advance_to_next_led_group
\ X has wrapped around to 0, so advance all the addresses in the self-modifying
\ code to the next page.
inc lda_count_x+2:inc sta_count_x_1+2
if FALSE
inc sta_count_x_1b+2
endif
inc sta_count_x_2+2
inc adc_period_x+2
\inc lda_inverse_row_x+2
dec led_group_count:beq forever_loop_indirect
jmp return_from_advance_to_next_led_group
.forever_loop_indirect
jmp forever_loop
.irq_handler
{
lda &fc:pha
lda &fe4d:and #&02:beq return_to_os
\ Handle VSYNC interrupt.
lda &fe41 \ SFTODO: clear this interrupt
inc vsync_count
pla:sta &fc:rti \ SFTODO dont enter OS, hence clearing interrupt ourselves
.return_to_os
pla:sta &fc
.^jmp_old_irq_handler
jmp &ffff \ patched
}
if FALSE \ TODO: DELETE
.led_pattern
if FALSE
equb %00111100
equb %01111110
equb %01111110
equb %01111110
equb %01111110
equb %00111100
else
\ TODO: If I stick with this, I can avoid plotting the all 0s rows
equb %00000000
equb %00011000
equb %00111100
equb %00111100
equb %00011000
equb %00000000
endif
endif
\ TODO: Eventually probably want to have a BASIC loader which generates a different
\ random set of frequencies each time.
randomize 42
align &100
.count_table
for i, 0, led_count-1
equb 1
next
macro pequb x
assert x >= 0 and x <= 255
equb int(x/4) \ SFTODO HACK BECAUSE WE CAN'T HIT CLOSE TO 50FPS
endmacro
align &100
.period_table
for i, 0, led_count-1
\ TODO: original try: equb 20+rnd(9)
\ equb 23+rnd(5)
\ equb 10+rnd(6)
\ equb 12+rnd(4)
\ equb 20+rnd(6) \ maybe not too bad
\ equb 40+rnd(18) \ TODO EXPERIMENTAL - MAYBE NOT TOO BAD
\ equb 40+rnd(7)
\ equb 45+rnd(9)
\ equb 47+rnd(5)
\ equb 22+rnd(5)
\ equb 22+rnd(9) \ maybe not too bad
\ equb 22+rnd(7) \ maybe not too bad
\ equb 30+rnd(9)
\ equb 40+rnd(18)
\ equb 20+rnd(18) \ TODO EXPERIMENTAL
\ equb 46+rnd(4)+rnd(4)
\ equb 30+rnd(5)+rnd(5)
\ equb 30+rnd(3)+rnd(3)
\ equb 50+rnd(5)+rnd(5)
\ equb 40*ticks_per_frame+rnd(ticks_per_frame*2)
pequb 22*ticks_per_frame+rnd(ticks_per_frame*5) \ fairly good (tpf=3, 4, 8)
next
align &100
.state_table
for i, 0, led_count-1
equb 0
next
HACKTODO=0
if FALSE \ SFTODO
align &100
.inverse_row_table
for i, 0, led_count - 1
equb 24 - (i div (40*6)
next
endif
align &100
.SFTODOTABLE
equb 0
for i, 1, 38*6
if (i - 1) mod 6 == 5
equb 128+64
else
equb 1 << ((i - 1) mod 6)
endif
next
.end
puttext "boot7.txt", "!BOOT", 0
save "BLINKEN", start, end
\ TODO: In mode 4 we potentially have enough RAM to double buffer the screen to avoid flicker
\ TODO: I should keep on with the mode 4 version, but I should also do a mode 7 version using separated graphics - that should be super smooth as it's character based and I can easily toggle individual sixels=LEDs
\ TODO: I should look into having the timer update (approximately; just sketching out a solution here) a "current line number" variable, and then before toggling an LED we would wait for the raster to pass if it's on our line or the line before - this would slow things down slightly, but we'd avoid any tearing
|
tests/all_inst.asm | Chysn/wAx | 5 | 173059 | ; 6502 Test Program
;
; All 6502 Instructions
; Add 6502 Addressing Modes
;
; When assembled, it should match the binary pattern
; in all_inst.obj
*=$1c00
c: adc #$00
adc $10
adc $20,x
adc $3030
adc $4040,x
adc $5050,y
adc ($60,x)
adc ($70),y
and #$80
and $90
and $10,x
and $1111
and $1212,x
and $1313,y
and ($14,x)
and ($15),y
asl
asl $17
asl $18,x
asl $1919
asl $2020,x
bcc $1c31
bcs $1c33
beq $1c35
bit $24
bit $2525
bmi $1c3c
bne $1c3e
bpl $1c40
brk
bvc $1c43
bvs $1c45
clc
cld
cli
clv
cmp #$36
cmp $37
cmp $38,x
cmp $3939
cmp $4040,x
cmp $4141,y
cmp ($42,x)
cmp ($43),y
cpx #$44
cpx $45
cpx $4646
cpy #$47
cpy $48
cpy $4949
dec $50
dec $51,x
dec $5252
dec $5353,x
dex
dey
eor #$56
eor $57
eor $58,x
eor $5959
eor $6060,x
eor $6161,y
eor ($62,x)
eor ($63),y
inc $64
inc $65,x
inc $6666
inc $6767,x
inx
iny
jmp $7070
jmp ($7171)
jsr $7272
lda #$73
lda $74
lda $75,x
lda $7676
lda $7777,x
lda $7878,y
lda ($79,x)
lda ($80),y
ldx #$81
ldx $82
ldx $83,y
ldx $8484
ldx $8585,y
ldy #$86
ldy $87
ldy $88,x
ldy $8989
ldy $9090,x
lsr
lsr $92
lsr $93,x
lsr $9494
lsr $9595,x
nop
ora #$97
ora $98
ora $99,x
ora $1000
ora $1010,x
ora $2020,y
ora ($30,x)
ora ($40),y
pha
php
pla
plp
rol
rol $10
rol $11,x
rol $1212
rol $1313,x
ror
ror $15
ror $16,x
ror $1717
ror $1818,x
rti
rts
sbc #$21
sbc $22
sbc $23,x
sbc $2424
sbc $2525,x
sbc $2626,y
sbc ($27,x)
sbc ($28),y
sec
sed
sei
sta $32
sta $33,x
sta $3434
sta $3535,x
sta $3636,y
sta ($37,x)
sta ($38),y
stx $39
stx $40,y
stx $4141
sty $42
sty $43,x
sty $4444
tax
tay
tsx
txa
txs
tya
|
samples/x86-linux/open-read-write.asm | hpolloni/shellnoob | 492 | 26993 | <reponame>hpolloni/shellnoob<gh_stars>100-1000
.section .text
jmp fplabel
afterfplabel:
pop %ebx
mov %ebx, %eax
add $0xb, %eax # pointer to X
xor %ecx, %ecx
movb %cl, (%eax)
xor %ecx, %ecx
xor %edx, %edx
xor %eax, %eax
movb $0x5, %al
int $0x80 # open('/etc/secret', 0, 0) = fd
mov %ebx, %ecx
mov %eax, %ebx
xor %edx, %edx
addb $0xff, %dl
xor %eax, %eax
movb $0x3, %al
int $0x80 # read(fd, *buf, 0xff) = read_num
xor %ebx, %ebx
inc %ebx
mov %eax, %edx
xor %eax, %eax
movb $0x4, %al
int $0x80 # write(fd, *buf, read_num)
xor %ebx, %ebx
xor %eax, %eax
inc %eax
int $0x80 # exit(0)
fplabel:
call afterfplabel
.ascii "/tmp/secretX"
|
programs/oeis/179/A179571.asm | jmorken/loda | 1 | 161047 | ; A179571: Number of permutations of 1..n+4 with the number moved left exceeding the number moved right by n.
; 31,66,134,267,529,1048,2080,4137,8243,16446,32842,65623,131173,262260,524420,1048725,2097319,4194490,8388814,16777443,33554681,67109136,134218024,268435777,536871259,1073742198,2147484050,4294967727,8589935053,17179869676,34359738892,68719477293,137438954063,274877907570,549755814550,1099511628475,2199023256289,4398046511880,8796093023024,17592186045273,35184372089731,70368744178606,140737488356314,281474976711687,562949953422389,1125899906843748,2251799813686420,4503599627371717,9007199254742263
add $0,2
lpb $0
add $1,$0
sub $0,1
add $2,4
mul $2,2
lpe
add $1,4
add $1,$2
|
hex-modular_unit_test.ads | annexi-strayline/ASAP-HEX | 1 | 5230 | ------------------------------------------------------------------------------
-- --
-- Generic HEX String Handling Package --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2018-2019, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME>, <NAME>, <NAME>, <NAME> --
-- (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Hex.Modular_Codec;
generic
with package Subject is new Hex.Modular_Codec (<>);
package Hex.Modular_Unit_Test is
type Test_Result is (Pass, Fail);
function Execute_Test
(First : Subject.Modular_Value := Subject.Modular_Value'First;
Last : Subject.Modular_Value := Subject.Modular_Value'Last;
Tasks : Positive := 1;
Report: Boolean := False)
return Test_Result;
-- Executes a unit test on a generic instantiation of Modular_Codec.
--
-- Each task tests a range of Modular_Value from First .. Last (inclusive),
-- testing encoding and decoding of each value in both lower and upper
-- cases.
--
-- If Report is True, details about the status and any errors are output
-- as the test progresses
--
-- If Tasks is > 1, separate Tasks are spawned with the work divided as
-- evenly as possible between them
--
-- This will eventually be replaced with "for parallel"
end Hex.Modular_Unit_Test;
|
oeis/327/A327440.asm | neoneye/loda-programs | 11 | 20737 | ; A327440: a(n) = floor(3*n/10).
; Submitted by <NAME>
; 0,0,0,0,1,1,1,2,2,2,3,3,3,3,4,4,4,5,5,5,6,6,6,6,7,7,7,8,8,8,9,9,9,9,10,10,10,11,11,11,12,12,12,12,13,13,13,14,14,14,15,15,15,15,16,16,16,17,17,17,18,18,18,18,19,19,19,20,20,20,21,21,21,21,22,22,22,23
mul $0,36
div $0,120
|
src/Group.agda | nad/equality | 3 | 838 | ------------------------------------------------------------------------
-- Groups
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Equality
module Group
{e⁺} (eq : ∀ {a p} → Equality-with-J a p e⁺) where
open Derived-definitions-and-properties eq
open import Logical-equivalence using (_⇔_)
open import Prelude as P hiding (id; _∘_) renaming (_×_ to _⊗_)
import Bijection eq as B
open import Equivalence eq as Eq using (_≃_)
open import Function-universe eq as F hiding (id; _∘_)
open import Groupoid eq using (Groupoid)
open import H-level eq
open import H-level.Closure eq
open import Integer.Basics eq using (+_; -[1+_])
open import Univalence-axiom eq
private
variable
a g₁ g₂ : Level
A : Type a
g x y : A
k : Kind
------------------------------------------------------------------------
-- Groups
-- Groups.
--
-- Note that the carrier type is required to be a set (following the
-- HoTT book).
record Group g : Type (lsuc g) where
infix 8 _⁻¹
infixr 7 _∘_
field
Carrier : Type g
Carrier-is-set : Is-set Carrier
_∘_ : Carrier → Carrier → Carrier
id : Carrier
_⁻¹ : Carrier → Carrier
left-identity : ∀ x → (id ∘ x) ≡ x
right-identity : ∀ x → (x ∘ id) ≡ x
assoc : ∀ x y z → (x ∘ (y ∘ z)) ≡ ((x ∘ y) ∘ z)
left-inverse : ∀ x → ((x ⁻¹) ∘ x) ≡ id
right-inverse : ∀ x → (x ∘ (x ⁻¹)) ≡ id
-- Groups are groupoids.
groupoid : Groupoid lzero g
groupoid = record
{ Object = ⊤
; _∼_ = λ _ _ → Carrier
; id = id
; _∘_ = _∘_
; _⁻¹ = _⁻¹
; left-identity = left-identity
; right-identity = right-identity
; assoc = assoc
; left-inverse = left-inverse
; right-inverse = right-inverse
}
open Groupoid groupoid public
hiding (Object; _∼_; id; _∘_; _⁻¹; left-identity; right-identity;
assoc; left-inverse; right-inverse)
private
variable
G G₁ G₁′ G₂ G₂′ G₃ : Group g
-- The type of groups can be expressed using a nested Σ-type.
Group-as-Σ :
Group g ≃
∃ λ (A : Set g) →
let A = ⌞ A ⌟ in
∃ λ (_∘_ : A → A → A) →
∃ λ (id : A) →
∃ λ (_⁻¹ : A → A) →
(∀ x → (id ∘ x) ≡ x) ⊗
(∀ x → (x ∘ id) ≡ x) ⊗
(∀ x y z → (x ∘ (y ∘ z)) ≡ ((x ∘ y) ∘ z)) ⊗
(∀ x → ((x ⁻¹) ∘ x) ≡ id) ⊗
(∀ x → (x ∘ (x ⁻¹)) ≡ id)
Group-as-Σ =
Eq.↔→≃
(λ G → let open Group G in
(Carrier , Carrier-is-set)
, _∘_
, id
, _⁻¹
, left-identity
, right-identity
, assoc
, left-inverse
, right-inverse)
_
refl
refl
------------------------------------------------------------------------
-- Group homomorphisms and isomorphisms
-- Group homomorphisms (generalised to several kinds of underlying
-- "functions").
record Homomorphic (k : Kind) (G₁ : Group g₁) (G₂ : Group g₂) :
Type (g₁ ⊔ g₂) where
private
module G₁ = Group G₁
module G₂ = Group G₂
field
related : G₁.Carrier ↝[ k ] G₂.Carrier
to : G₁.Carrier → G₂.Carrier
to = to-implication related
field
homomorphic :
∀ x y → to (x G₁.∘ y) ≡ to x G₂.∘ to y
open Homomorphic public using (related; homomorphic)
open Homomorphic using (to)
-- The type of (generalised) group homomorphisms can be expressed
-- using a nested Σ-type.
Homomorphic-as-Σ :
{G₁ : Group g₁} {G₂ : Group g₂} →
Homomorphic k G₁ G₂ ≃
let module G₁ = Group G₁
module G₂ = Group G₂
in
∃ λ (f : G₁.Carrier ↝[ k ] G₂.Carrier) →
∀ x y →
to-implication f (x G₁.∘ y) ≡
to-implication f x G₂.∘ to-implication f y
Homomorphic-as-Σ =
Eq.↔→≃
(λ G₁↝G₂ → G₁↝G₂ .related , G₁↝G₂ .homomorphic)
_
refl
refl
-- A variant of Homomorphic.
infix 4 _↝[_]ᴳ_ _→ᴳ_ _≃ᴳ_
_↝[_]ᴳ_ : Group g₁ → Kind → Group g₂ → Type (g₁ ⊔ g₂)
_↝[_]ᴳ_ = flip Homomorphic
-- Group homomorphisms.
_→ᴳ_ : Group g₁ → Group g₂ → Type (g₁ ⊔ g₂)
_→ᴳ_ = _↝[ implication ]ᴳ_
-- Group isomorphisms.
_≃ᴳ_ : Group g₁ → Group g₂ → Type (g₁ ⊔ g₂)
_≃ᴳ_ = _↝[ equivalence ]ᴳ_
-- "Functions" of type G₁ ↝[ k ]ᴳ G₂ can be converted to group
-- homomorphisms.
↝ᴳ→→ᴳ : G₁ ↝[ k ]ᴳ G₂ → G₁ →ᴳ G₂
↝ᴳ→→ᴳ f .related = to f
↝ᴳ→→ᴳ f .homomorphic = f .homomorphic
-- _↝[ k ]ᴳ_ is reflexive.
↝ᴳ-refl : G ↝[ k ]ᴳ G
↝ᴳ-refl .related = F.id
↝ᴳ-refl {G = G} {k = k} .homomorphic x y =
to-implication {k = k} F.id (x ∘ y) ≡⟨ cong (_$ _) $ to-implication-id k ⟩
x ∘ y ≡⟨ sym $ cong₂ (λ f g → f _ ∘ g _)
(to-implication-id k)
(to-implication-id k) ⟩∎
to-implication {k = k} F.id x ∘
to-implication {k = k} F.id y ∎
where
open Group G
-- _↝[ k ]ᴳ_ is transitive.
↝ᴳ-trans : G₁ ↝[ k ]ᴳ G₂ → G₂ ↝[ k ]ᴳ G₃ → G₁ ↝[ k ]ᴳ G₃
↝ᴳ-trans {G₁ = G₁} {k = k} {G₂ = G₂} {G₃ = G₃}
G₁↝G₂ G₂↝G₃ = λ where
.related → G₂↝G₃ .related F.∘ G₁↝G₂ .related
.homomorphic x y →
to-implication (G₂↝G₃ .related F.∘ G₁↝G₂ .related) (x G₁.∘ y) ≡⟨ cong (_$ _) $ to-implication-∘ k ⟩
to G₂↝G₃ (to G₁↝G₂ (x G₁.∘ y)) ≡⟨ cong (to G₂↝G₃) $ homomorphic G₁↝G₂ _ _ ⟩
to G₂↝G₃ (to G₁↝G₂ x G₂.∘ to G₁↝G₂ y) ≡⟨ homomorphic G₂↝G₃ _ _ ⟩
to G₂↝G₃ (to G₁↝G₂ x) G₃.∘ to G₂↝G₃ (to G₁↝G₂ y) ≡⟨ sym $ cong₂ (λ f g → f _ G₃.∘ g _)
(to-implication-∘ k)
(to-implication-∘ k) ⟩∎
to-implication (G₂↝G₃ .related F.∘ G₁↝G₂ .related) x G₃.∘
to-implication (G₂↝G₃ .related F.∘ G₁↝G₂ .related) y ∎
where
module G₁ = Group G₁
module G₂ = Group G₂
module G₃ = Group G₃
-- _≃ᴳ_ is symmetric.
≃ᴳ-sym : G₁ ≃ᴳ G₂ → G₂ ≃ᴳ G₁
≃ᴳ-sym {G₁ = G₁} {G₂ = G₂} G₁≃G₂ = λ where
.related → inverse (G₁≃G₂ .related)
.homomorphic x y → _≃_.injective (G₁≃G₂ .related)
(to G₁≃G₂ (_≃_.from (G₁≃G₂ .related) (x G₂.∘ y)) ≡⟨ _≃_.right-inverse-of (G₁≃G₂ .related) _ ⟩
x G₂.∘ y ≡⟨ sym $ cong₂ G₂._∘_
(_≃_.right-inverse-of (G₁≃G₂ .related) _)
(_≃_.right-inverse-of (G₁≃G₂ .related) _) ⟩
to G₁≃G₂ (_≃_.from (G₁≃G₂ .related) x) G₂.∘
to G₁≃G₂ (_≃_.from (G₁≃G₂ .related) y) ≡⟨ sym $ G₁≃G₂ .homomorphic _ _ ⟩∎
to G₁≃G₂
(_≃_.from (G₁≃G₂ .related) x G₁.∘ _≃_.from (G₁≃G₂ .related) y) ∎)
where
module G₁ = Group G₁
module G₂ = Group G₂
-- Group homomorphisms preserve identity elements.
→ᴳ-id :
(G₁↝G₂ : G₁ ↝[ k ]ᴳ G₂) →
to G₁↝G₂ (Group.id G₁) ≡ Group.id G₂
→ᴳ-id {G₁ = G₁} {G₂ = G₂} G₁↝G₂ =
G₂.idempotent⇒≡id
(to G₁↝G₂ G₁.id G₂.∘ to G₁↝G₂ G₁.id ≡⟨ sym $ G₁↝G₂ .homomorphic _ _ ⟩
to G₁↝G₂ (G₁.id G₁.∘ G₁.id) ≡⟨ cong (to G₁↝G₂) $ G₁.left-identity _ ⟩∎
to G₁↝G₂ G₁.id ∎)
where
module G₁ = Group G₁
module G₂ = Group G₂
-- Group homomorphisms are homomorphic with respect to the inverse
-- operators.
→ᴳ-⁻¹ :
∀ (G₁↝G₂ : G₁ ↝[ k ]ᴳ G₂) x →
to G₁↝G₂ (Group._⁻¹ G₁ x) ≡ Group._⁻¹ G₂ (to G₁↝G₂ x)
→ᴳ-⁻¹ {G₁ = G₁} {G₂ = G₂} G₁↝G₂ x = G₂.⁻¹∘≡id→≡
(to G₁↝G₂ x G₂.⁻¹ G₂.⁻¹ G₂.∘ to G₁↝G₂ (x G₁.⁻¹) ≡⟨ cong (G₂._∘ to G₁↝G₂ (x G₁.⁻¹)) $ G₂.involutive _ ⟩
to G₁↝G₂ x G₂.∘ to G₁↝G₂ (x G₁.⁻¹) ≡⟨ sym $ G₁↝G₂ .homomorphic _ _ ⟩
to G₁↝G₂ (x G₁.∘ x G₁.⁻¹) ≡⟨ cong (to G₁↝G₂) (G₁.right-inverse _) ⟩
to G₁↝G₂ G₁.id ≡⟨ →ᴳ-id G₁↝G₂ ⟩∎
G₂.id ∎)
where
module G₁ = Group G₁
module G₂ = Group G₂
-- Group homomorphisms are homomorphic with respect to exponentiation.
→ᴳ-^ :
∀ (G₁↝G₂ : G₁ ↝[ k ]ᴳ G₂) x i →
to G₁↝G₂ (Group._^_ G₁ x i) ≡
Group._^_ G₂ (to G₁↝G₂ x) i
→ᴳ-^ {G₁ = G₁} {G₂ = G₂} G₁↝G₂ x = lemma₂
where
module G₁ = Group G₁
module G₂ = Group G₂
lemma₁ : ∀ n → to G₁↝G₂ (y G₁.^+ n) ≡ to G₁↝G₂ y G₂.^+ n
lemma₁ zero =
to G₁↝G₂ G₁.id ≡⟨ →ᴳ-id G₁↝G₂ ⟩∎
G₂.id ∎
lemma₁ {y = y} (suc n) =
to G₁↝G₂ (y G₁.∘ y G₁.^+ n) ≡⟨ G₁↝G₂ .homomorphic _ _ ⟩
to G₁↝G₂ y G₂.∘ to G₁↝G₂ (y G₁.^+ n) ≡⟨ cong (_ G₂.∘_) $ lemma₁ n ⟩∎
to G₁↝G₂ y G₂.∘ to G₁↝G₂ y G₂.^+ n ∎
lemma₂ : ∀ i → to G₁↝G₂ (x G₁.^ i) ≡ to G₁↝G₂ x G₂.^ i
lemma₂ (+ n) = lemma₁ n
lemma₂ -[1+ n ] =
to G₁↝G₂ ((x G₁.⁻¹) G₁.^+ suc n) ≡⟨ lemma₁ (suc n) ⟩
to G₁↝G₂ (x G₁.⁻¹) G₂.^+ suc n ≡⟨ cong (G₂._^+ suc n) $ →ᴳ-⁻¹ G₁↝G₂ _ ⟩∎
(to G₁↝G₂ x G₂.⁻¹) G₂.^+ suc n ∎
-- Group equality can be expressed in terms of equality of pairs of
-- carrier types and binary operators (assuming extensionality).
≡≃,∘≡,∘ :
{G₁ G₂ : Group g} →
Extensionality g g →
let module G₁ = Group G₁
module G₂ = Group G₂
in
(G₁ ≡ G₂) ≃ ((G₁.Carrier , G₁._∘_) ≡ (G₂.Carrier , G₂._∘_))
≡≃,∘≡,∘ {g = g} {G₁ = G₁} {G₂ = G₂} ext =
G₁ ≡ G₂ ↝⟨ inverse $ Eq.≃-≡ Group≃ ⟩
((G₁.Carrier , G₁._∘_) , _) ≡ ((G₂.Carrier , G₂._∘_) , _) ↔⟨ (inverse $
ignore-propositional-component $
The-rest-propositional _) ⟩□
(G₁.Carrier , G₁._∘_) ≡ (G₂.Carrier , G₂._∘_) □
where
module G₁ = Group G₁
module G₂ = Group G₂
Carrier-∘ = ∃ λ (C : Type g) → (C → C → C)
The-rest : Carrier-∘ → Type g
The-rest (C , _∘_) =
∃ λ ((id , _⁻¹) : C ⊗ (C → C)) →
Is-set C ⊗
(∀ x → (id ∘ x) ≡ x) ⊗
(∀ x → (x ∘ id) ≡ x) ⊗
(∀ x y z → (x ∘ (y ∘ z)) ≡ ((x ∘ y) ∘ z)) ⊗
(∀ x → ((x ⁻¹) ∘ x) ≡ id) ⊗
(∀ x → (x ∘ (x ⁻¹)) ≡ id)
Group≃ : Group g ≃ Σ Carrier-∘ The-rest
Group≃ = Eq.↔→≃
(λ G → let open Group G in
(Carrier , _∘_)
, (id , _⁻¹)
, Carrier-is-set , left-identity , right-identity , assoc
, left-inverse , right-inverse)
_
refl
refl
The-rest-propositional : ∀ C → Is-proposition (The-rest C)
The-rest-propositional C R₁ R₂ =
Σ-≡,≡→≡
(cong₂ _,_ id-unique inverse-unique)
((×-closure 1 (H-level-propositional ext 2) $
×-closure 1 (Π-closure ext 1 λ _ →
G₂′.Carrier-is-set) $
×-closure 1 (Π-closure ext 1 λ _ →
G₂′.Carrier-is-set) $
×-closure 1 (Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
Π-closure ext 1 λ _ →
G₂′.Carrier-is-set) $
×-closure 1 (Π-closure ext 1 λ _ →
G₂′.Carrier-is-set) $
(Π-closure ext 1 λ _ →
G₂′.Carrier-is-set))
_ _)
where
module G₁′ = Group (_≃_.from Group≃ (C , R₁))
module G₂′ = Group (_≃_.from Group≃ (C , R₂))
id-unique : G₁′.id ≡ G₂′.id
id-unique = G₂′.idempotent⇒≡id (G₁′.left-identity G₁′.id)
inverse-unique : G₁′._⁻¹ ≡ G₂′._⁻¹
inverse-unique = apply-ext ext λ x → G₂′.⁻¹-unique-right
(x G₁′.∘ x G₁′.⁻¹ ≡⟨ G₁′.right-inverse _ ⟩
G₁′.id ≡⟨ id-unique ⟩∎
G₂′.id ∎)
-- Group isomorphisms are equivalent to equalities (assuming
-- extensionality and univalence).
≃ᴳ≃≡ :
{G₁ G₂ : Group g} →
Extensionality g g →
Univalence g →
(G₁ ≃ᴳ G₂) ≃ (G₁ ≡ G₂)
≃ᴳ≃≡ {G₁ = G₁} {G₂ = G₂} ext univ =
G₁ ≃ᴳ G₂ ↝⟨ Homomorphic-as-Σ ⟩
(∃ λ (eq : G₁.Carrier ≃ G₂.Carrier) →
∀ x y →
_≃_.to eq (x G₁.∘ y) ≡ _≃_.to eq x G₂.∘ _≃_.to eq y) ↝⟨ (∃-cong λ eq → Π-cong ext eq λ _ → Π-cong ext eq λ _ →
≡⇒≃ $ sym $ cong (_≡ _≃_.to eq _ G₂.∘ _≃_.to eq _) $ cong (_≃_.to eq) $
cong₂ G₁._∘_
(_≃_.left-inverse-of eq _)
(_≃_.left-inverse-of eq _)) ⟩
(∃ λ (eq : G₁.Carrier ≃ G₂.Carrier) →
∀ x y → _≃_.to eq (_≃_.from eq x G₁.∘ _≃_.from eq y) ≡ x G₂.∘ y) ↝⟨ (∃-cong λ _ → ∀-cong ext λ _ →
Eq.extensionality-isomorphism ext) ⟩
(∃ λ (eq : G₁.Carrier ≃ G₂.Carrier) →
∀ x →
(λ y → _≃_.to eq (_≃_.from eq x G₁.∘ _≃_.from eq y)) ≡ (x G₂.∘_)) ↝⟨ (∃-cong λ _ →
Eq.extensionality-isomorphism ext) ⟩
(∃ λ (eq : G₁.Carrier ≃ G₂.Carrier) →
(λ x y → _≃_.to eq (_≃_.from eq x G₁.∘ _≃_.from eq y)) ≡ G₂._∘_) ↝⟨ (∃-cong λ eq → ≡⇒≃ $ cong (_≡ _) $ sym $ lemma eq) ⟩
(∃ λ (eq : G₁.Carrier ≃ G₂.Carrier) →
subst (λ A → A → A → A) (≃⇒≡ univ eq) G₁._∘_ ≡ G₂._∘_) ↝⟨ (Σ-cong (inverse $ ≡≃≃ univ) λ _ → Eq.id) ⟩
(∃ λ (eq : G₁.Carrier ≡ G₂.Carrier) →
subst (λ A → A → A → A) eq G₁._∘_ ≡ G₂._∘_) ↔⟨ B.Σ-≡,≡↔≡ ⟩
((G₁.Carrier , G₁._∘_) ≡ (G₂.Carrier , G₂._∘_)) ↝⟨ inverse $ ≡≃,∘≡,∘ ext ⟩□
G₁ ≡ G₂ □
where
module G₁ = Group G₁
module G₂ = Group G₂
lemma : ∀ _ → _
lemma = λ eq → apply-ext ext λ x → apply-ext ext λ y →
subst (λ A → A → A → A) (≃⇒≡ univ eq) G₁._∘_ x y ≡⟨ cong (_$ y) subst-→ ⟩
subst (λ A → A → A) (≃⇒≡ univ eq)
(subst P.id (sym (≃⇒≡ univ eq)) x G₁.∘_) y ≡⟨ subst-→ ⟩
subst P.id (≃⇒≡ univ eq)
(subst P.id (sym (≃⇒≡ univ eq)) x G₁.∘
subst P.id (sym (≃⇒≡ univ eq)) y) ≡⟨ cong₂ (λ f g → f (g x G₁.∘ g y))
(trans (apply-ext ext λ _ → subst-id-in-terms-of-≡⇒↝ equivalence) $
cong _≃_.to $ _≃_.right-inverse-of (≡≃≃ univ) _)
(trans (apply-ext ext λ _ → subst-id-in-terms-of-inverse∘≡⇒↝ equivalence) $
cong _≃_.from $ _≃_.right-inverse-of (≡≃≃ univ) _) ⟩∎
_≃_.to eq (_≃_.from eq x G₁.∘ _≃_.from eq y) ∎
------------------------------------------------------------------------
-- Abelian groups
-- The property of being abelian.
Abelian : Group g → Type g
Abelian G =
∀ x y → x ∘ y ≡ y ∘ x
where
open Group G
-- If two groups are isomorphic, and one is abelian, then the other
-- one is abelian.
≃ᴳ→Abelian→Abelian : G₁ ≃ᴳ G₂ → Abelian G₁ → Abelian G₂
≃ᴳ→Abelian→Abelian {G₁ = G₁} {G₂ = G₂} G₁≃G₂ ∘-comm x y =
_≃_.injective (G₂≃G₁ .related)
(to G₂≃G₁ (x G₂.∘ y) ≡⟨ G₂≃G₁ .homomorphic _ _ ⟩
to G₂≃G₁ x G₁.∘ to G₂≃G₁ y ≡⟨ ∘-comm _ _ ⟩
to G₂≃G₁ y G₁.∘ to G₂≃G₁ x ≡⟨ sym $ G₂≃G₁ .homomorphic _ _ ⟩∎
to G₂≃G₁ (y G₂.∘ x) ∎)
where
module G₁ = Group G₁
module G₂ = Group G₂
G₂≃G₁ = ≃ᴳ-sym G₁≃G₂
------------------------------------------------------------------------
-- A group construction
-- The direct product of two groups.
infixr 2 _×_
_×_ : Group g₁ → Group g₂ → Group (g₁ ⊔ g₂)
G₁ × G₂ = λ where
.Carrier → G₁.Carrier ⊗ G₂.Carrier
.Carrier-is-set → ×-closure 2 G₁.Carrier-is-set G₂.Carrier-is-set
._∘_ → Σ-zip G₁._∘_ G₂._∘_
.id → G₁.id , G₂.id
._⁻¹ → Σ-map G₁._⁻¹ G₂._⁻¹
.left-identity _ → cong₂ _,_
(G₁.left-identity _) (G₂.left-identity _)
.right-identity _ → cong₂ _,_
(G₁.right-identity _) (G₂.right-identity _)
.assoc _ _ _ → cong₂ _,_ (G₁.assoc _ _ _) (G₂.assoc _ _ _)
.left-inverse _ → cong₂ _,_
(G₁.left-inverse _) (G₂.left-inverse _)
.right-inverse _ → cong₂ _,_
(G₁.right-inverse _) (G₂.right-inverse _)
where
open Group
module G₁ = Group G₁
module G₂ = Group G₂
-- The direct product operator preserves group homomorphisms.
↝-× :
G₁ ↝[ k ]ᴳ G₂ → G₁′ ↝[ k ]ᴳ G₂′ →
(G₁ × G₁′) ↝[ k ]ᴳ (G₂ × G₂′)
↝-× {G₁ = G₁} {k = k} {G₂ = G₂} {G₁′ = G₁′} {G₂′ = G₂′}
G₁↝G₂ G₁′↝G₂′ = λ where
.related →
G₁↝G₂ .related ×-cong G₁′↝G₂′ .related
.homomorphic x@(x₁ , x₂) y@(y₁ , y₂) →
to-implication (G₁↝G₂ .related ×-cong G₁′↝G₂′ .related)
(Σ-zip (Group._∘_ G₁) (Group._∘_ G₁′) x y) ≡⟨ cong (_$ _) $ to-implication-×-cong k ⟩
Σ-map (to G₁↝G₂) (to G₁′↝G₂′)
(Σ-zip (Group._∘_ G₁) (Group._∘_ G₁′) x y) ≡⟨⟩
to G₁↝G₂ (Group._∘_ G₁ x₁ y₁) ,
to G₁′↝G₂′ (Group._∘_ G₁′ x₂ y₂) ≡⟨ cong₂ _,_
(G₁↝G₂ .homomorphic _ _)
(G₁′↝G₂′ .homomorphic _ _) ⟩
Group._∘_ G₂ (to G₁↝G₂ x₁) (to G₁↝G₂ y₁) ,
Group._∘_ G₂′ (to G₁′↝G₂′ x₂) (to G₁′↝G₂′ y₂) ≡⟨⟩
Group._∘_ (G₂ × G₂′)
(to G₁↝G₂ x₁ , to G₁′↝G₂′ x₂)
(to G₁↝G₂ y₁ , to G₁′↝G₂′ y₂) ≡⟨ sym $ cong₂ (λ f g → Group._∘_ (G₂ × G₂′) (f _) (g _))
(to-implication-×-cong k)
(to-implication-×-cong k) ⟩∎
Group._∘_ (G₂ × G₂′)
(to-implication (G₁↝G₂ .related ×-cong G₁′↝G₂′ .related) x)
(to-implication (G₁↝G₂ .related ×-cong G₁′↝G₂′ .related) y) ∎
-- Exponentiation for the direct product of G₁ and G₂ can be expressed
-- in terms of exponentiation for G₁ and exponentiation for G₂.
^-× :
∀ (G₁ : Group g₁) (G₂ : Group g₂) {x y} i →
Group._^_ (G₁ × G₂) (x , y) i ≡
(Group._^_ G₁ x i , Group._^_ G₂ y i)
^-× G₁ G₂ = helper
where
module G₁ = Group G₁
module G₂ = Group G₂
module G₁₂ = Group (G₁ × G₂)
+-helper : ∀ n → (x , y) G₁₂.^+ n ≡ (x G₁.^+ n , y G₂.^+ n)
+-helper zero = refl _
+-helper {x = x} {y = y} (suc n) =
(x , y) G₁₂.∘ (x , y) G₁₂.^+ n ≡⟨ cong (_ G₁₂.∘_) $ +-helper n ⟩
(x , y) G₁₂.∘ (x G₁.^+ n , y G₂.^+ n) ≡⟨⟩
(x G₁.∘ x G₁.^+ n , y G₂.∘ y G₂.^+ n) ∎
helper : ∀ i → (x , y) G₁₂.^ i ≡ (x G₁.^ i , y G₂.^ i)
helper (+ n) = +-helper n
helper -[1+ n ] = +-helper (suc n)
------------------------------------------------------------------------
-- The centre of a group
-- Centre ext G is the centre of the group G, sometimes denoted Z(G).
Centre :
Extensionality g g →
Group g → Group g
Centre ext G = λ where
.Carrier → ∃ λ (x : Carrier) → ∀ y → x ∘ y ≡ y ∘ x
.Carrier-is-set → Σ-closure 2 Carrier-is-set λ _ →
Π-closure ext 2 λ _ →
mono₁ 2 Carrier-is-set
._∘_ → Σ-zip _∘_ λ {x y} hyp₁ hyp₂ z →
(x ∘ y) ∘ z ≡⟨ sym $ assoc _ _ _ ⟩
x ∘ (y ∘ z) ≡⟨ cong (x ∘_) $ hyp₂ z ⟩
x ∘ (z ∘ y) ≡⟨ assoc _ _ _ ⟩
(x ∘ z) ∘ y ≡⟨ cong (_∘ y) $ hyp₁ z ⟩
(z ∘ x) ∘ y ≡⟨ sym $ assoc _ _ _ ⟩∎
z ∘ (x ∘ y) ∎
.id → id
, λ x →
id ∘ x ≡⟨ left-identity _ ⟩
x ≡⟨ sym $ right-identity _ ⟩∎
x ∘ id ∎
._⁻¹ → Σ-map _⁻¹ λ {x} hyp y →
x ⁻¹ ∘ y ≡⟨ cong (x ⁻¹ ∘_) $ sym $ involutive _ ⟩
x ⁻¹ ∘ y ⁻¹ ⁻¹ ≡⟨ sym ∘⁻¹ ⟩
(y ⁻¹ ∘ x) ⁻¹ ≡⟨ cong _⁻¹ $ sym $ hyp (y ⁻¹) ⟩
(x ∘ y ⁻¹) ⁻¹ ≡⟨ ∘⁻¹ ⟩
y ⁻¹ ⁻¹ ∘ x ⁻¹ ≡⟨ cong (_∘ x ⁻¹) $ involutive _ ⟩∎
y ∘ x ⁻¹ ∎
.left-identity → λ _ →
Σ-≡,≡→≡ (left-identity _)
((Π-closure ext 1 λ _ → Carrier-is-set) _ _)
.right-identity → λ _ →
Σ-≡,≡→≡ (right-identity _)
((Π-closure ext 1 λ _ → Carrier-is-set) _ _)
.assoc → λ _ _ _ →
Σ-≡,≡→≡ (assoc _ _ _)
((Π-closure ext 1 λ _ → Carrier-is-set) _ _)
.left-inverse → λ _ →
Σ-≡,≡→≡ (left-inverse _)
((Π-closure ext 1 λ _ → Carrier-is-set) _ _)
.right-inverse → λ _ →
Σ-≡,≡→≡ (right-inverse _)
((Π-closure ext 1 λ _ → Carrier-is-set) _ _)
where
open Group G
-- The centre of an abelian group is isomorphic to the group.
Abelian→Centre≃ :
(ext : Extensionality g g) (G : Group g) →
Abelian G → Centre ext G ≃ᴳ G
Abelian→Centre≃ ext G abelian = ≃ᴳ-sym λ where
.Homomorphic.related → inverse equiv
.Homomorphic.homomorphic _ _ →
cong (_ ,_) ((Π-closure ext 1 λ _ → Carrier-is-set) _ _)
where
open Group G
equiv =
(∃ λ (x : Carrier) → ∀ y → x ∘ y ≡ y ∘ x) ↔⟨ (drop-⊤-right λ _ →
_⇔_.to contractible⇔↔⊤ $
Π-closure ext 0 λ _ →
propositional⇒inhabited⇒contractible
Carrier-is-set
(abelian _ _)) ⟩□
Carrier □
|
src/exceptions-stub/gdnative-exceptions.adb | persan/gdnative_ada | 10 | 24433 | <gh_stars>1-10
package body GDNative.Exceptions is
-- Here I should probably allow the library user to specify handlers for exceptions
-- (crash report dialog?)
procedure Put_Warning (Message : in Wide_String) is null;
procedure Put_Error (Occurrence : in Ada.Exceptions.Exception_Occurrence) is null;
end; |
alloy4fun_models/trashltl/models/10/ke985bD6fvXAC8JBE.als | Kaixi26/org.alloytools.alloy | 0 | 3125 | open main
pred idke985bD6fvXAC8JBE_prop11 {
always all f : File | f not in Protected implies after f in Protected'
}
pred __repair { idke985bD6fvXAC8JBE_prop11 }
check __repair { idke985bD6fvXAC8JBE_prop11 <=> prop11o } |
test/asset/agda-stdlib-1.0/Data/String.agda | omega12345/agda-mode | 0 | 4826 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Strings
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.String where
open import Data.Vec as Vec using (Vec)
open import Data.Char as Char using (Char)
------------------------------------------------------------------------
-- Re-export contents of base, and decidability of equality
open import Data.String.Base public
open import Data.String.Properties using (_≟_; _==_) public
------------------------------------------------------------------------
-- Operations
toVec : (s : String) → Vec Char (length s)
toVec s = Vec.fromList (toList s)
|
alloy4fun_models/trashltl/models/9/ba32kDT9NNBrLPQTi.als | Kaixi26/org.alloytools.alloy | 0 | 2043 | <gh_stars>0
open main
pred idba32kDT9NNBrLPQTi_prop10 {
always all f:Protected | always f in Protected
}
pred __repair { idba32kDT9NNBrLPQTi_prop10 }
check __repair { idba32kDT9NNBrLPQTi_prop10 <=> prop10o } |
source/function/graphics/rcolor.asm | mega65dev/rom-assembler | 0 | 167916 | ; ********************************************************************************************
; ********************************************************************************************
;
; Name : rcolor.asm
; Purpose : ..
; Created : 15th Nov 1991
; Updated : 4th Jan 2021
; Authors : <NAME>
;
; ********************************************************************************************
; ********************************************************************************************
;************************************************************************
; RCOLOR (source) -- return current color assigned to source
; 0 : Background color
; 1 : Foreground color
; 2 : Highlight color
; 3 : Border color
;************************************************************************
rcolor jsr conint ; evaluate integer argument, put in .X
; jsr put_io_in_map
cpx #4
+lbcs fcerr ; illegal qty
txa
asl ; make into word pointer
tax
lda color_source,x ; get address of source
sta grapnt
lda color_source+1,x
sta grapnt+1
ldy #0
lda (grapnt),y ; read source (aways system space or I/O????)
and #$0f ; mask unused bits
tay
; iny ; make color match keytops
+lbra sngflt ; float 1 byte in .Y
color_source
!word vic+33,_color,highlight_color,vic+32
; ********************************************************************************************
;
; Date Changes
; ==== =======
;
; ********************************************************************************************
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0.log_21829_251.asm | ljhsiun2/medusa | 9 | 7568 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xe5bd, %rax
nop
nop
nop
nop
cmp $16340, %r9
movups (%rax), %xmm0
vpextrq $0, %xmm0, %r14
xor $56411, %r9
lea addresses_UC_ht+0xf84d, %rsi
lea addresses_A_ht+0xe501, %rdi
nop
nop
nop
nop
cmp %r11, %r11
mov $12, %rcx
rep movsw
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_WT_ht+0x170bd, %r11
cmp %rax, %rax
mov $0x6162636465666768, %rcx
movq %rcx, %xmm1
and $0xffffffffffffffc0, %r11
vmovaps %ymm1, (%r11)
cmp $21946, %rsi
lea addresses_UC_ht+0x107bd, %rsi
nop
nop
nop
and %r9, %r9
movups (%rsi), %xmm4
vpextrq $0, %xmm4, %rax
nop
add %r14, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %rbp
push %rbx
push %rcx
push %rsi
// Store
lea addresses_US+0x3dbd, %rbx
nop
nop
nop
nop
add %r14, %r14
mov $0x5152535455565758, %rbp
movq %rbp, %xmm0
movaps %xmm0, (%rbx)
nop
nop
nop
nop
nop
dec %r15
// Store
lea addresses_WT+0x718f, %rsi
nop
nop
nop
nop
cmp $55881, %r14
mov $0x5152535455565758, %rcx
movq %rcx, (%rsi)
nop
nop
sub $602, %rbp
// Faulty Load
lea addresses_UC+0x135bd, %r15
nop
nop
sub $56343, %rcx
vmovntdqa (%r15), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %rbx
lea oracles, %r15
and $0xff, %rbx
shlq $12, %rbx
mov (%r15,%rbx,1), %rbx
pop %rsi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_US', 'AVXalign': True, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WT', 'AVXalign': False, 'size': 8}}
[Faulty Load]
{'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'same': True, 'congruent': 2, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 32}}
{'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'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
*/
|
ffight/lcs/1p/87.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 7546 | copyright zengfr site:http://github.com/zengfr/romhack
001AD6 abcd -(A3), -(A1) [1p+87]
copyright zengfr site:http://github.com/zengfr/romhack
|
ejercicios4/escribir_aula_act.adb | iyan22/AprendeAda | 0 | 7328 | <reponame>iyan22/AprendeAda<gh_stars>0
with Ada.Text_IO, Ada.Integer_Text_IO, copia_examenes;
use copia_examenes;
use Ada.Text_Io, Ada.Integer_Text_Io;
procedure Escribir_aula_act(aula_act: in T_Aula) is
begin
New_Line;
Put_line("----------------------------------------------------------------------");
for i in 1..10 loop
for J in 1..10 loop
put("|");
if aula_act(i,j).ocupada=true then
Put(" "); put("T ");Put(aula_act(I, J).ex.num_palabras_diferentes, width => 0); Put(" ");
else Put(" F ");
end if;
end loop;
put("|");
new_line;
for J in 1..10 loop
put("|");
if aula_act(i,j).ocupada=true then
for x in 1..aula_act(I, J).ex.num_palabras_diferentes loop
Put(aula_act(I, J).ex.palabras(x).n_apariciones, width => 0);
end loop;
for z in aula_act(I, J).ex.num_palabras_diferentes+1..6 loop
put(" ");
end loop;
else
for z in 1..6 loop
put(" ");
end loop;
end if;
end loop;
put("|");
new_line;
Put_line("----------------------------------------------------------------------");
end loop;
put_line("Por cuestiones de espacio en este caso de prueba");
put_line("el n_apariciones de una variable no va ha ser mayor que 10");
put("Asi por ejemplo cuando en la casilla tenemos esta informacion: ");
new_line;
Put_line(" ------");
put_line(" | T 4 |");
put_line(" | 2367 |");
Put_line(" ------");
put_line(" Querra decir que la casilla esta ocupada (T de true)");
put_line(" que hay 4 variables, y aparcen 2,3,6,7 veces");
put_line(" el numero de apariciones de la primera es -> 2");
put_line(" el numero de apariciones de la segunda es -> 3");
put_line(" el numero de apariciones de la tercera es -> 6");
put_line(" y el numero de apariciones de la cuarta es -> 7");
end Escribir_aula_act;
|
programs/oeis/040/A040869.asm | neoneye/loda | 22 | 88188 | ; A040869: Continued fraction for sqrt(899).
; 29,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58
mov $1,$0
cmp $0,0
sub $1,$0
gcd $1,2
add $1,27
add $0,$1
mul $0,$1
sub $0,783
|
agda/Data/Empty/Base.agda | oisdk/masters-thesis | 4 | 13493 | <filename>agda/Data/Empty/Base.agda
{-# OPTIONS --cubical --safe #-}
module Data.Empty.Base where
open import Cubical.Data.Empty
using (⊥; isProp⊥)
public
open import Level
infix 4.5 ¬_
¬_ : Type a → Type a
¬ A = A → ⊥
⊥-elim : ⊥ → A
⊥-elim ()
|
mips/mips_cc/16-1.asm | ping58972/Computer-Organization-Architecture | 0 | 240134 | <filename>mips/mips_cc/16-1.asm
## MIPS Assignment #2
## Ch16-1.asm
## Program to calculate: (12+97+133+82+236)/5
.data
b1: .byte 12
b2: .byte 97
b3: .byte 133
b4: .byte 82
b5: .byte 236
.text
main:
ori $7,$0,0x5 # Initialize 5 for division later on
lui $8,0x1001 # Save base address
lbu $9,0($8) # Load byte 1
lbu $10, 1($8) # Load byte 2
lbu $11, 2($8) # Load byte 3
lbu $12, 3($8) # Load byte 4
lbu $13, 4($8) # Load byte 5
addu $10, $9, $10 # $10 <- b1+b2
addu $10, $10, $11 # $10 <- b1+b2+b3
addu $10, $10, $12 # $10 <- b1+b2+b3+b4
addu $10, $10, $13 # $10 <- b1+b2+b3+b4+b5
divu $10, $7 # (b1+b2+b3+b4+b5)/5
mflo $10 # $10 <- result
sb $10, 1($8) # storing result to memory
## End of file
|
tests/optimize_config/auto_counters_tests_config.ads | jhumphry/auto_counters | 5 | 7847 | <filename>tests/optimize_config/auto_counters_tests_config.ads
-- auto_counters_tests_config.ads
-- Configuration for Unit tests for Auto_Counters
-- Configuration for optimized builds
-- Copyright (c) 2016, <NAME> - see LICENSE file for details
package Auto_Counters_Tests_Config is
pragma Pure;
Assertions_Enabled : constant Boolean := False;
-- Some unit tests are checking that appropriate preconditions and assertions
-- are in place. In optimized builds where assertions are disabled these
-- tests will cause incorrect failure notifications or segfaults. The
-- Assertions_Enabled flag indicates whether these tests should be run.
end Auto_Counters_Tests_Config;
|
libsrc/target/zx/if1/if1_bytecount.asm | ahjelm/z88dk | 640 | 24907 | ;
; ZX IF1 & Microdrive functions
;
; Get the record counter from the FP
; int if1_bytecount (long fp);
;
; in: DEHL: LONG FILE PTR
; out: record number
;
;
; $Id: if1_bytecount.asm $
;
SECTION code_clib
PUBLIC if1_bytecount
PUBLIC _if1_bytecount
if1_bytecount:
_if1_bytecount:
; __FASTCALL__
ld a,1
and h
ld h,a
ret
|
algebra/4-the-natural-numbers.agda | aronerben/agda-playground | 0 | 15343 | module 4-the-natural-numbers where
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; cong; sym)
open Eq.≡-Reasoning using (begin_; _≡⟨⟩_; step-≡; _∎)
open import Data.Nat using (ℕ; zero; suc; _+_; _*_; ⌊_/2⌋)
-- 4)
--sum-to-n : ℕ → ℕ
--sum-to-n n = sum (upTo (suc n))
open import Data.Nat.Properties using (*-comm; *-distribʳ-+; +-suc; +-comm; *-distribˡ-+)
1+⋯+n : ℕ → ℕ
1+⋯+n zero = zero
1+⋯+n (suc n) = suc n + 1+⋯+n n
n≡[n*2]/2 : ∀ (n : ℕ) → n ≡ ⌊ n * 2 /2⌋
n≡[n*2]/2 zero = refl
n≡[n*2]/2 (suc n) =
begin
suc n
≡⟨ cong suc (n≡[n*2]/2 n) ⟩
suc ⌊ n * 2 /2⌋
≡⟨⟩
1 + ⌊ n * 2 /2⌋
≡⟨⟩
⌊ 2 + n * 2 /2⌋
≡⟨⟩
⌊ suc n * 2 /2⌋
∎
data IsEven : ℕ → Set where
even : (k : ℕ) → IsEven (k * 2)
rearrange-lemma : ∀ n → suc (suc n) * suc n ≡ suc n * 2 + suc n * n
rearrange-lemma n =
begin
suc (suc n) * suc n
≡⟨⟩
suc (1 + n) * (1 + n)
≡⟨⟩
(2 + n) * (1 + n)
≡⟨ *-distribʳ-+ (1 + n) 2 n ⟩
2 * (1 + n) + n * (1 + n)
≡⟨ cong (2 * (1 + n) +_) (*-comm n (1 + n)) ⟩
2 * (1 + n) + (1 + n) * n
≡⟨⟩
2 * suc n + suc n * n
≡⟨ cong (_+ suc n * n) (*-comm 2 (suc n)) ⟩
suc n * 2 + suc n * n
∎
even+even≡even : ∀ {m n : ℕ} → IsEven m → IsEven n → IsEven (m + n)
even+even≡even (even k) (even i) rewrite (sym (*-distribʳ-+ 2 k i)) = even (k + i)
[1+n]*n≡even : ∀ (n : ℕ) → IsEven (suc n * n)
[1+n]*n≡even zero = even 0
[1+n]*n≡even (suc n) rewrite rearrange-lemma n = even+even≡even (even (suc n)) ([1+n]*n≡even n)
even/2+even/2≡[even+even]/2 : ∀ {m n : ℕ} → IsEven m → IsEven n → ⌊ m /2⌋ + ⌊ n /2⌋ ≡ ⌊ m + n /2⌋
even/2+even/2≡[even+even]/2 (even k) (even i) =
begin
⌊ k * 2 /2⌋ + ⌊ i * 2 /2⌋
≡⟨ cong (_+ ⌊ i * 2 /2⌋) (sym (n≡[n*2]/2 k)) ⟩
k + ⌊ i * 2 /2⌋
≡⟨ cong (k +_) (sym (n≡[n*2]/2 i)) ⟩
k + i
≡⟨ n≡[n*2]/2 (k + i) ⟩
⌊ (k + i) * 2 /2⌋
≡⟨ cong ⌊_/2⌋ (*-distribʳ-+ 2 k i) ⟩
⌊ k * 2 + i * 2 /2⌋
∎
gaussian-sum : ∀ (n : ℕ) → 1+⋯+n n ≡ ⌊ n * (n + 1) /2⌋
gaussian-sum zero = refl
gaussian-sum (suc n) =
begin
1+⋯+n (suc n)
≡⟨⟩
suc n + 1+⋯+n n
≡⟨ cong (suc n +_) (gaussian-sum n)⟩
suc n + ⌊ n * (n + 1) /2⌋
≡⟨ cong (_+ ⌊ n * (n + 1) /2⌋) (n≡[n*2]/2 (suc n)) ⟩
⌊ suc n * 2 /2⌋ + ⌊ n * (n + 1) /2⌋
≡⟨ cong (λ {term → ⌊ suc n * 2 /2⌋ + ⌊ n * term /2⌋}) (+-comm n 1) ⟩
⌊ suc n * 2 /2⌋ + ⌊ n * (1 + n) /2⌋
≡⟨⟩
⌊ suc n * 2 /2⌋ + ⌊ n * suc n /2⌋
≡⟨ cong (λ {term → ⌊ suc n * 2 /2⌋ + ⌊ term /2⌋}) (*-comm n (suc n)) ⟩
⌊ suc n * 2 /2⌋ + ⌊ suc n * n /2⌋
≡⟨ even/2+even/2≡[even+even]/2 (even (suc n)) ([1+n]*n≡even n) ⟩
⌊ suc n * 2 + suc n * n /2⌋
≡⟨ cong (⌊_/2⌋) (sym (*-distribˡ-+ (1 + n) 2 n)) ⟩
⌊ suc n * (2 + n) /2⌋
≡⟨ cong (λ {term → ⌊ suc n * term /2⌋}) (+-comm 2 n) ⟩
⌊ suc n * (n + 2) /2⌋
≡⟨ cong (λ {term → ⌊ suc n * term /2⌋}) (+-suc n 1) ⟩
⌊ suc n * (suc n + 1) /2⌋
∎
|
src/ada/src/utils/bounded_dynamic_arrays.adb | VVCAS-Sean/OpenUxAS | 88 | 9209 | <gh_stars>10-100
package body Bounded_Dynamic_Arrays is
-----------
-- Clear --
-----------
procedure Clear (This : out Sequence) is
begin
This.Current_Length := 0;
This.Content := (others => Default_Value);
end Clear;
-------------------
-- Null_Sequence --
-------------------
function Null_Sequence return Sequence is
Result : Sequence (Capacity => 0);
begin
Result.Current_Length := 0;
Result.Content (1 .. 0) := Null_List;
pragma Assert (Value (Result) = Null_List);
return Result;
end Null_Sequence;
--------------
-- Instance --
--------------
function Instance
(Capacity : Natural_Index;
Content : List)
return Sequence
is
Result : Sequence (Capacity);
begin
Result.Current_Length := Content'Length;
Result.Content (1 .. Result.Current_Length) := Content;
pragma Assert (Content'Length = 0 or else
Contains_At (Result, 1, Content));
pragma Assert (Value (Result) = Content);
return Result;
end Instance;
--------------
-- Instance --
--------------
function Instance
(Content : List)
return Sequence
is
Result : Sequence (Capacity => Content'Length);
begin
pragma Assert (for all K in Result.Content'Range => Result.Content (K) = Default_Value);
Result.Current_Length := Content'Length;
Result.Content (1 .. Result.Current_Length) := Content;
pragma Assert (Content'Length = 0 or else
Contains_At (Result, 1, Content));
pragma Assert (Value (Result) = Content);
return Result;
end Instance;
--------------
-- Instance --
--------------
function Instance
(Capacity : Natural_Index;
Content : Component)
return Sequence
is
Result : Sequence (Capacity);
begin
Result.Current_Length := 1;
Result.Content (1) := Content;
return Result;
end Instance;
---------
-- "&" --
---------
function "&" (Left : Sequence; Right : Sequence) return Sequence is
begin
return Instance
(Capacity => Left.Current_Length + Right.Current_Length,
Content => Value (Left) & Value (Right));
end "&";
---------
-- "&" --
---------
function "&" (Left : Sequence; Right : List) return Sequence is
begin
return Instance
(Capacity => Left.Current_Length + Right'Length,
Content => Value (Left) & Right);
end "&";
---------
-- "&" --
---------
function "&" (Left : List; Right : Sequence) return Sequence is
begin
return Instance
(Capacity => Left'Length + Right.Current_Length,
Content => Normalized (Left) & Value (Right));
end "&";
---------
-- "&" --
---------
function "&" (Left : Sequence; Right : Component) return Sequence is
begin
return Instance
(Capacity => Left.Current_Length + 1,
Content => Value (Left) & Right);
end "&";
---------
-- "&" --
---------
function "&" (Left : Component; Right : Sequence) return Sequence is
begin
return Instance
(Capacity => Right.Current_Length + 1,
Content => Left & Value (Right));
end "&";
----------
-- Copy --
----------
procedure Copy (Source : Sequence; To : in out Sequence) is
begin
To.Current_Length := Source.Current_Length;
To.Content (1 .. To.Current_Length) := Source.Content (1 .. Source.Current_Length);
-- pragma Assert (Source.Current_Length = 0 or else
-- Contains_At (To, 1, Value (Source)));
end Copy;
----------
-- Copy --
----------
procedure Copy (Source : List; To : in out Sequence) is
begin
To.Current_Length := Source'Length;
To.Content (1 .. To.Current_Length) := Source;
-- pragma Assert (Source'Length = 0 or else
-- Contains_At (To, 1, Source));
-- pragma Assert (Value (To) = Source);
-- pragma Assert (To.Current_Length <= To.Capacity);
end Copy;
----------
-- Copy --
----------
procedure Copy (Source : Component; To : in out Sequence) is
begin
To.Content (1) := Source;
To.Current_Length := 1;
end Copy;
------------
-- Append --
------------
procedure Append (Tail : Sequence; To : in out Sequence) is
New_Length : constant Natural_Index := Length (Tail) + To.Current_Length;
begin
To.Content (1 .. New_Length) := Value (To) & Value (Tail);
To.Current_Length := New_Length;
end Append;
------------
-- Append --
------------
procedure Append (Tail : List; To : in out Sequence) is
New_Length : constant Natural_Index := Tail'Length + To.Current_Length;
begin
To.Content (1 .. New_Length) := Value (To) & Tail;
To.Current_Length := New_Length;
end Append;
------------
-- Append --
------------
procedure Append (Tail : Component; To : in out Sequence) is
New_Length : constant Index := 1 + To.Current_Length;
begin
To.Content (New_Length) := Tail;
To.Current_Length := New_Length;
end Append;
-----------
-- Amend --
-----------
procedure Amend (This : in out Sequence; By : Sequence; Start : Index) is
begin
Amend (This, Value (By), Start);
end Amend;
-----------
-- Amend --
-----------
procedure Amend (This : in out Sequence; By : List; Start : Index) is
Last : constant Index := Start + By'Length - 1;
begin
This.Content (Start .. Last) := By;
if Last > This.Current_Length then
This.Current_Length := Last;
end if;
end Amend;
-----------
-- Amend --
-----------
procedure Amend (This : in out Sequence; By : Component; Start : Index) is
begin
This.Content (Start) := By;
end Amend;
--------------
-- Location --
--------------
function Location (Fragment : Sequence; Within : Sequence) return Natural_Index is
begin
return Location (Value (Fragment), Within);
end Location;
--------------
-- Location --
--------------
function Location (Fragment : List; Within : Sequence) return Natural_Index is
begin
-- We must check for the empty Fragment since that would be found, but
-- we want to return zero (indicating not found) in that case. It would
-- be found because on the first iteration with K = 1, the condition in
-- the if-statement would be computing a null slice on the LHS of the
-- comparison (ie, the range would be 1 .. 1+0-1), and that LHS would
-- equal the RHS empty array fragment. We must also check for the
-- fragment not being longer than the content of Within itself.
if Fragment'Length in 1 .. Within.Current_Length then
for K in 1 .. (Within.Current_Length - Fragment'Length + 1) loop
if Contains_At (Within, K, Fragment) then
return K;
end if;
pragma Loop_Invariant
(for all J in 1 .. K => not Contains_At (Within, J, Fragment));
end loop;
end if;
return 0;
end Location;
--------------
-- Location --
--------------
function Location (Fragment : Component; Within : Sequence) return Natural_Index is
begin
for K in 1 .. Within.Current_Length loop
if Within.Content (K) = Fragment then
pragma Assert (Contains_At (Within, K, Fragment));
return K;
end if;
pragma Loop_Invariant ((for all J in 1 .. K => Within.Content (J) /= Fragment));
end loop;
return 0;
end Location;
----------------
-- Normalized --
----------------
function Normalized (L : List) return List is
-- This is a function instead of a subtype because we need it in a
-- postcondition as well as the "&" subprogram body, and we cannot
-- define subtypes in postconditions.
Result : constant List (1 .. L'Length) := L;
begin
return Result;
end Normalized;
end Bounded_Dynamic_Arrays;
|
Transynther/x86/_processed/NC/_st_zr_sm_/i3-7100_9_0xca_notsx.log_21829_262.asm | ljhsiun2/medusa | 9 | 246613 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r14
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x14c28, %r14
cmp %r10, %r10
vmovups (%r14), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %r11
nop
nop
nop
dec %r13
lea addresses_WT_ht+0xfbe8, %r8
nop
nop
nop
sub %r9, %r9
movb $0x61, (%r8)
nop
nop
nop
nop
add %rax, %rax
lea addresses_A_ht+0x11a68, %rsi
lea addresses_WT_ht+0x3428, %rdi
nop
nop
nop
dec %r9
mov $52, %rcx
rep movsq
nop
nop
nop
nop
nop
cmp %r9, %r9
lea addresses_WT_ht+0x13478, %rsi
nop
xor %r9, %r9
mov $0x6162636465666768, %r8
movq %r8, %xmm2
movups %xmm2, (%rsi)
nop
nop
nop
nop
cmp %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r14
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_WT+0xfa28, %rsi
lea addresses_normal+0x16960, %rdi
clflush (%rsi)
nop
nop
nop
add %r13, %r13
mov $127, %rcx
rep movsb
nop
nop
nop
dec %rdi
// Store
mov $0x428, %r12
clflush (%r12)
nop
nop
nop
add $21527, %rdx
movw $0x5152, (%r12)
sub %rsi, %rsi
// Store
mov $0x274790000000428, %rcx
nop
nop
nop
xor $23458, %r8
mov $0x5152535455565758, %r13
movq %r13, %xmm3
vmovntdq %ymm3, (%rcx)
nop
nop
nop
nop
nop
add $8859, %r12
// Faulty Load
mov $0x274790000000428, %rdi
nop
nop
nop
nop
nop
sub $25339, %rcx
mov (%rdi), %r8
lea oracles, %rdi
and $0xff, %r8
shlq $12, %r8
mov (%rdi,%r8,1), %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 1, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_P', 'size': 2, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': True, 'type': 'addresses_NC', 'size': 32, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': True}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False}}
{'58': 21549, '39': 137, '00': 135, '52': 8}
58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 39 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 39 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 39 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 39 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 39 58 58 58 58 58 58 58 58 39 39 58 58 58 58 58 58 58 58 58 58 58 58 58 58 39 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 39 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 39 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
programs/oeis/072/A072261.asm | jmorken/loda | 1 | 169936 | <reponame>jmorken/loda<filename>programs/oeis/072/A072261.asm<gh_stars>1-10
; A072261: a(n) = 4*a(n-1) + 1, a(1)=7.
; 7,29,117,469,1877,7509,30037,120149,480597,1922389,7689557,30758229,123032917,492131669,1968526677,7874106709,31496426837,125985707349,503942829397,2015771317589,8063085270357,32252341081429,129009364325717,516037457302869,2064149829211477,8256599316845909
mov $1,4
pow $1,$0
mul $1,44
div $1,6
|
3-mid/impact/source/3d/collision/narrowphase/impact-d3-manifold.adb | charlie5/lace | 20 | 711 | <filename>3-mid/impact/source/3d/collision/narrowphase/impact-d3-manifold.adb
with impact.d3.Vector;
package body impact.d3.Manifold
is
-- --- Containers
-- --
--
-- function Length (Self : in Vector) return ada.Containers.Count_Type
-- is
-- begin
-- return vectors.Vector (Self).Length;
-- end;
--
--
--
--
-- procedure append (Self : in out Vector; New_Item : impact.d3.Manifold.Item'Class;
-- Count : Ada.Containers.Count_Type := 1)
-- is
-- use Vectors;
-- begin
-- append (vectors.Vector (Self), impact.d3.Manifold.Item (new_item), Count);
-- end;
--- Forge
--
function to_Manifold (body0,
body1 : in Containers.Any_view;
unused : in Integer;
contactBreakingThreshold : in Real;
contactProcessingThreshold : in Real) return Item
is
pragma Unreferenced (unused);
Self : impact.d3.Manifold.item;
begin
Self.m_body0 := body0;
Self.m_body1 := body1;
Self.m_cachedPoints := 0;
Self.m_contactBreakingThreshold := contactBreakingThreshold;
Self.m_contactProcessingThreshold := contactProcessingThreshold;
return Self;
end to_Manifold;
procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
function validContactDistance (Self : in Item; pt : in impact.d3.manifold_Point.item'Class) return Boolean
is
begin
return pt.m_distance1 <= Self.getContactBreakingThreshold;
end validContactDistance;
function getBody0 (Self : in Item) return Containers.Any_view
is
begin
return Self.m_body0;
end getBody0;
function getBody1 (Self : in Item) return Containers.Any_view
is
begin
return Self.m_body1;
end getBody1;
procedure setBodies (Self : in out Item; body0,
body1 : in Containers.Any_view)
is
begin
Self.m_body0 := body0;
Self.m_body1 := body1;
end setBodies;
use type impact.d3.Containers.Any_view;
procedure clearUserCache (Self : in out Item; pt : access manifold_Point.item'Class)
is
pragma Unreferenced (Self);
oldPtr : constant impact.d3.Containers.Any_view := pt.m_userPersistentData;
unused : Boolean;
pragma Unreferenced (unused);
begin
if oldPtr /= null then
if pt.m_userPersistentData /= null
and then gContactDestroyedCallback /= null
then
unused := gContactDestroyedCallback (pt.m_userPersistentData);
pt.m_userPersistentData := null;
end if;
end if;
end clearUserCache;
function getNumContacts (Self : in Item) return Integer
is
begin
return Self.m_cachedPoints;
end getNumContacts;
function getContactPoint (Self : access Item; index : in Integer) return access manifold_Point.item'Class
is
begin
pragma Assert (index <= Self.m_cachedPoints);
return Self.m_pointCache (index)'Access;
end getContactPoint;
function getContactPoint (Self : in Item; index : in Integer) return manifold_Point.item'Class
is
begin
pragma Assert (index <= Self.m_cachedPoints);
return Self.m_pointCache (index);
end getContactPoint;
function getContactBreakingThreshold (Self : in Item) return Real
is
begin
return Self.m_contactBreakingThreshold;
end getContactBreakingThreshold;
function getContactProcessingThreshold (Self : in Item) return Real
is
begin
return Self.m_contactProcessingThreshold;
end getContactProcessingThreshold;
function getCacheEntry (Self : in Item; newPoint : in manifold_Point.item'Class) return Integer
is
use impact.d3.Vector;
shortestDist : Real := Self.getContactBreakingThreshold * Self.getContactBreakingThreshold;
size : constant Integer := Self.getNumContacts;
nearestPoint : Integer := -1;
mp : access constant impact.d3.manifold_Point.item;
diffA : Vector_3;
distToManiPoint : Real;
begin
for i in 1 .. size loop
mp := Self.m_pointCache (i)'Access;
diffA := mp.m_localPointA - newPoint.m_localPointA;
distToManiPoint := dot (diffA, diffA);
if distToManiPoint < shortestDist then
shortestDist := distToManiPoint;
nearestPoint := i;
end if;
end loop;
return nearestPoint;
end getCacheEntry;
function addManifoldPoint (Self : access Item; newPoint : in manifold_Point.item) return Integer
is
pragma Assert (validContactDistance (Self.all, newPoint));
insertIndex : Integer := Self.getNumContacts + 1;
begin
if insertIndex > MANIFOLD_CACHE_SIZE then
if MANIFOLD_CACHE_SIZE >= 4 then
insertIndex := sortCachedPoints (Self.all, newPoint); -- sort cache so best points come first, based on area
else
insertIndex := 1;
end if;
clearUserCache (Self.all, Self.m_pointCache (insertIndex)'Access);
else
Self.m_cachedPoints := Self.m_cachedPoints + 1;
end if;
if insertIndex < 1 then
insertIndex := 1;
end if;
pragma Assert (Self.m_pointCache (insertIndex).m_userPersistentData = null);
Self.m_pointCache (insertIndex) := newPoint;
return insertIndex;
end addManifoldPoint;
procedure removeContactPoint (Self : in out Item; index : in Integer)
is
lastUsedIndex : Integer;
begin
clearUserCache (Self, Self.m_pointCache (index)'Access);
lastUsedIndex := Self.getNumContacts;
-- m_pointCache[index] = m_pointCache[lastUsedIndex];
if index /= lastUsedIndex then
Self.m_pointCache (index) := Self.m_pointCache (lastUsedIndex);
-- get rid of duplicated userPersistentData pointer
Self.m_pointCache (lastUsedIndex).m_userPersistentData := null;
Self.m_pointCache (lastUsedIndex).mConstraintRow (1).m_accumImpulse := 0.0;
Self.m_pointCache (lastUsedIndex).mConstraintRow (2).m_accumImpulse := 0.0;
Self.m_pointCache (lastUsedIndex).mConstraintRow (3).m_accumImpulse := 0.0;
Self.m_pointCache (lastUsedIndex).m_appliedImpulse := 0.0;
Self.m_pointCache (lastUsedIndex).m_lateralFrictionInitialized := False;
Self.m_pointCache (lastUsedIndex).m_appliedImpulseLateral1 := 0.0;
Self.m_pointCache (lastUsedIndex).m_appliedImpulseLateral2 := 0.0;
Self.m_pointCache (lastUsedIndex).m_lifeTime := 0;
end if;
pragma Assert (Self.m_pointCache (lastUsedIndex).m_userPersistentData = null);
Self.m_cachedPoints := Self.m_cachedPoints - 1;
end removeContactPoint;
-- type Any_view is access all Any'Class;
procedure replaceContactPoint (Self : in out Item; newPoint : in impact.d3.manifold_Point.item;
insertIndex : in Integer)
is
MAINTAIN_PERSISTENCY : constant Boolean := True;
begin
pragma Assert (validContactDistance (Self, newPoint));
if MAINTAIN_PERSISTENCY then
declare
lifeTime : constant Integer := Self.m_pointCache (insertIndex).getLifeTime; pragma Assert (lifeTime >= 0);
appliedImpulse : constant Real := Self.m_pointCache (insertIndex).mConstraintRow (1).m_accumImpulse;
appliedLateralImpulse1 : constant Real := Self.m_pointCache (insertIndex).mConstraintRow (2).m_accumImpulse;
appliedLateralImpulse2 : constant Real := Self.m_pointCache (insertIndex).mConstraintRow (3).m_accumImpulse;
-- bool isLateralFrictionInitialized = m_pointCache[insertIndex].m_lateralFrictionInitialized;
cache : constant impact.d3.Containers.Any_view := impact.d3.Containers.Any_view (Self.m_pointCache (insertIndex).m_userPersistentData); -- .all'access;
begin
Self.m_pointCache (insertIndex) := newPoint;
Self.m_pointCache (insertIndex).m_userPersistentData := cache;
Self.m_pointCache (insertIndex).m_appliedImpulse := appliedImpulse;
Self.m_pointCache (insertIndex).m_appliedImpulseLateral1 := appliedLateralImpulse1;
Self.m_pointCache (insertIndex).m_appliedImpulseLateral2 := appliedLateralImpulse2;
Self.m_pointCache (insertIndex).mConstraintRow (1).m_accumImpulse := appliedImpulse;
Self.m_pointCache (insertIndex).mConstraintRow (2).m_accumImpulse := appliedLateralImpulse1;
Self.m_pointCache (insertIndex).mConstraintRow (3).m_accumImpulse := appliedLateralImpulse2;
Self.m_pointCache (insertIndex).m_lifeTime := lifeTime;
end;
else
Self.clearUserCache (Self.m_pointCache (insertIndex)'Access);
Self.m_pointCache (insertIndex) := newPoint;
end if;
end replaceContactPoint;
procedure refreshContactPoints (Self : in out Item; trA, trB : in Transform_3d)
is
use impact.d3.Vector;
distance2d : Real;
projectedDifference,
projectedPoint : Vector_3;
begin
-- first refresh worldspace positions and distance
--
for i in reverse 1 .. Self.getNumContacts loop
declare
use linear_Algebra_3d;
manifoldPoint : impact.d3.manifold_Point.item renames Self.m_pointCache (i);
begin
manifoldPoint.m_positionWorldOnA := trA * manifoldPoint.m_localPointA;
manifoldPoint.m_positionWorldOnB := trB * manifoldPoint.m_localPointB;
manifoldPoint.m_distance1 := dot (manifoldPoint.m_positionWorldOnA - manifoldPoint.m_positionWorldOnB, manifoldPoint.m_normalWorldOnB);
manifoldPoint.m_lifeTime := manifoldPoint.m_lifeTime + 1;
end;
end loop;
-- ... then ...
--
for i in reverse 1 .. Self.getNumContacts loop
declare
manifoldPoint : impact.d3.manifold_Point.item renames Self.m_pointCache (i);
unused : Boolean;
pragma Unreferenced (unused);
begin
if not validContactDistance (Self, manifoldPoint) then -- contact becomes invalid when signed distance exceeds margin (projected on contactnormal direction)
Self.removeContactPoint (i);
else -- contact also becomes invalid when relative movement orthogonal to normal exceeds margin
projectedPoint := manifoldPoint.m_positionWorldOnA - manifoldPoint.m_normalWorldOnB * manifoldPoint.m_distance1;
projectedDifference := manifoldPoint.m_positionWorldOnB - projectedPoint;
distance2d := dot (projectedDifference, projectedDifference);
if distance2d > Self.getContactBreakingThreshold * Self.getContactBreakingThreshold then
Self.removeContactPoint (i);
else
if gContactProcessedCallback /= null then -- contact point processed callback
unused := gContactProcessedCallback (manifoldPoint, Self.m_body0, Self.m_body1);
end if;
end if;
end if;
end;
end loop;
end refreshContactPoints;
procedure clearManifold (Self : in out Item)
is
begin
for i in 1 .. Self.m_cachedPoints loop
clearUserCache (Self, Self.m_pointCache (i)'Access);
end loop;
Self.m_cachedPoints := 0;
end clearManifold;
function sortCachedPoints (Self : in Item; pt : in manifold_Point.item'Class) return Integer
is
KEEP_DEEPEST_POINT : constant Boolean := True;
maxPenetrationIndex : Integer := -1;
maxPenetration : Real;
res0, res1,
res2, res3 : Real;
a0, b0,
a1, b1,
a2, b2,
a3, b3,
cross : Vector_3;
begin
-- calculate 4 possible cases areas, and take biggest area
-- also need to keep 'deepest'
if KEEP_DEEPEST_POINT then
maxPenetration := pt.getDistance;
for i in 1 .. 4 loop
if Self.m_pointCache (i).getDistance < maxPenetration then
maxPenetrationIndex := i;
maxPenetration := Self.m_pointCache (i).getDistance;
end if;
end loop;
end if;
res0 := 0.0;
res1 := 0.0;
res2 := 0.0;
res3 := 0.0;
if maxPenetrationIndex /= 1 then
a0 := pt.m_localPointA - Self.m_pointCache (2).m_localPointA;
b0 := Self.m_pointCache (4).m_localPointA - Self.m_pointCache (3).m_localPointA;
cross := impact.d3.Vector.cross (a0, b0);
res0 := impact.d3.Vector.length2 (cross);
end if;
if maxPenetrationIndex /= 2 then
a1 := pt.m_localPointA - Self.m_pointCache (1).m_localPointA;
b1 := Self.m_pointCache (4).m_localPointA - Self.m_pointCache (3).m_localPointA;
cross := impact.d3.Vector.cross (a1, b1);
res1 := impact.d3.Vector.length2 (cross);
end if;
if maxPenetrationIndex /= 3 then
a2 := pt.m_localPointA - Self.m_pointCache (1).m_localPointA;
b2 := Self.m_pointCache (4).m_localPointA - Self.m_pointCache (2).m_localPointA;
cross := impact.d3.Vector.cross (a2, b2);
res2 := impact.d3.Vector.length2 (cross);
end if;
if maxPenetrationIndex /= 4 then
a3 := pt.m_localPointA - Self.m_pointCache (1).m_localPointA;
b3 := Self.m_pointCache (3).m_localPointA - Self.m_pointCache (2).m_localPointA;
cross := impact.d3.Vector.cross (a3, b3);
res3 := impact.d3.Vector.length2 (cross);
end if;
declare
maxvec : constant Vector_4 := (res0, res1, res2, res3);
biggestarea : constant Integer := impact.d3.Vector.closestAxis4 (maxvec);
begin
return biggestarea;
end;
end sortCachedPoints;
-- function findContactPoint (Self : in impact.d3.Manifold; unUsed : access impact.d3.manifold_Point.impact.d3.manifold_Point;
-- numUnused : in Integer;
-- pt : in impact.d3.manifold_Point.impact.d3.manifold_Point) return Integer
-- is
-- begin
--
-- end;
end impact.d3.Manifold;
|
test/Fail/SafeFlagPrimTrustMe.agda | redfish64/autonomic-agda | 1 | 8496 | module SafeFlagPrimTrustMe where
-- Cannot make an example with the correct type signature for
-- primTrustMe since it requires postulated universe level builtins,
-- which --safe flag will reject.
private
primitive
primTrustMe : Set
|
programs/oeis/103/A103627.asm | neoneye/loda | 22 | 80863 | <reponame>neoneye/loda
; A103627: Let S(n) = {n,1,n}; sequence gives concatenation S(0), S(1), S(2), ...
; 0,1,0,1,1,1,2,1,2,3,1,3,4,1,4,5,1,5,6,1,6,7,1,7,8,1,8,9,1,9,10,1,10,11,1,11,12,1,12,13,1,13,14,1,14,15,1,15,16,1,16,17,1,17,18,1,18,19,1,19,20,1,20,21,1,21,22,1,22,23,1,23,24,1,24,25,1,25,26,1,26,27,1,27,28,1,28,29,1,29,30,1,30,31,1,31,32,1,32,33
lpb $0
add $1,1
mov $$0,$0
trn $$2,3
lpe
mov $0,$1
|
alloy4fun_models/trashltl/models/9/4rHs2AmEG6N4fYeqX.als | Kaixi26/org.alloytools.alloy | 0 | 1934 | <gh_stars>0
open main
pred id4rHs2AmEG6N4fYeqX_prop10 {
after all f : File | once f in Protected implies f in Protected
}
pred __repair { id4rHs2AmEG6N4fYeqX_prop10 }
check __repair { id4rHs2AmEG6N4fYeqX_prop10 <=> prop10o } |
anticrashhook/src/shims.asm | gibbed/JC4AnticrashHook | 4 | 172745 | wrapper_load PROTO C
.CODE
shim_crash PROC
int 3
nop; nop; nop; nop; nop; nop; nop
shim_crash ENDP
MAKE_SHIM macro name, ordinal
.DATA
PUBLIC shim_p_&name&
shim_p_&name& QWORD shim_crash
ENDM
INCLUDE shims.inc
PURGE MAKE_SHIM
MAKE_SHIM macro name, ordinal
.CODE
shim_l_&name& PROC
push r11
push r10
push r9
push r8
push rdx
push rcx
push rax
call wrapper_load
pop rax
pop rcx
pop rdx
pop r8
pop r9
pop r10
pop r11
jmp shim_p_&name&
shim_l_&name& ENDP
ENDM
INCLUDE shims.inc
PURGE MAKE_SHIM
MAKE_SHIM macro name, ordinal
.CODE
shim_h_&name& PROC
jmp shim_p_&name&
shim_h_&name& ENDP
ENDM
INCLUDE shims.inc
PURGE MAKE_SHIM
END
|
src/io/clr.asm | fourstix/Elfos-utils | 3 | 94012 | ; -------------------------------------------------------------------
; Simple program to clear the display screen (Ansi or non-Ansi)
; Copyright 2020 by <NAME>
; -------------------------------------------------------------------
; Based on software written by <NAME>
; Thanks to the author for making this code available.
; Original author copyright notice:
; *******************************************************************
; *** This software is copyright 2004 by <NAME> ***
; *** You have permission to use, modify, copy, and distribute ***
; *** this software so long as this copyright notice is retained. ***
; *** This software may not be used in commercial applications ***
; *** without express written permission from the author. ***
; *******************************************************************
#include ops.inc
#include bios.inc
#include kernel.inc
; ************************************************************
; ***** This block generates the 6 byte Execution header *****
;
; ************************************************************
; The Execution header starts 6 bytes before the program start
org 02000h-6 ; Header starts at 01ffah
dw 02000h ; Program load address
dw endrom-2000h ; Program size
dw 02000h ; Program execution address
org 02000H
br start ; Jump past build information
; Build date
date: db 80H+9 ; Month 80H offset means extended info
db 22 ; Day
dw 2021 ; Year
; Current build number
build: dw 5
; Must end with 0 (null)
db 'Copyright 2021 by <NAME>',0
start: CALL o_inmsg ; Write clear string to display
db 01bh,'[2J',0ch,0 ; ANSI string followed by form feed character
RETURN ; return to Elf/OS
;------ define end of execution block
endrom: equ $
|
src/sparkzumo.adb | yannickmoy/SPARKZumo | 6 | 22200 | <reponame>yannickmoy/SPARKZumo
pragma SPARK_Mode;
with Interfaces.C; use Interfaces.C;
with Sparkduino; use Sparkduino;
package body SPARKZumo is
Stop : constant := 0;
Sample_Rate : constant := 500;
procedure RISC_Test
is
Arr : Sensor_Array;
begin
loop
Zumo_Pushbutton.WaitForButton;
Zumo_QTR.Read_Sensors (Sensor_Values => Arr,
ReadMode => Emitters_On);
for I in Arr'Range loop
Serial_Print_Short (Msg => "Sensor" & I'Img & ": ",
Val => short (Arr (I)));
end loop;
end loop;
end RISC_Test;
procedure Calibration_Sequence
is
begin
for I in 1 .. 4 loop
case I is
when 1 | 3 =>
Zumo_Motors.SetSpeed (LeftVelocity => Motor_Speed'First / 3,
RightVelocity => Motor_Speed'Last / 3);
when others =>
Zumo_Motors.SetSpeed (LeftVelocity => Motor_Speed'Last / 3,
RightVelocity => Motor_Speed'First / 3);
end case;
for J in 1 .. 80 loop
Zumo_QTR.Calibrate (ReadMode => ReadMode);
SysDelay (20);
end loop;
end loop;
Zumo_Motors.SetSpeed (LeftVelocity => Stop,
RightVelocity => Stop);
end Calibration_Sequence;
procedure Inits
is
begin
Zumo_LED.Init;
Zumo_Pushbutton.Init;
Zumo_Motors.Init;
Zumo_QTR.Init;
-- Zumo_Motion.Init;
Initd := True;
end Inits;
procedure Setup
is
begin
-- Board_Init.Initialize;
Inits;
Zumo_LED.Yellow_Led (On => True);
Zumo_Pushbutton.WaitForButton;
Zumo_LED.Yellow_Led (On => False);
Calibration_Sequence;
-- RISC_Test;
Zumo_LED.Yellow_Led (On => True);
Zumo_Pushbutton.WaitForButton;
-- for I in Zumo_QTR.Cal_Vals_On'Range loop
-- Serial_Print_Calibration (Index => I,
-- Min => Zumo_QTR.Cal_Vals_On (I).Min,
-- Max => Zumo_QTR.Cal_Vals_On (I).Max);
-- end loop;
--
-- SysDelay (1000);
-- Zumo_Pushbutton.WaitForButton;
end Setup;
procedure WorkLoop
is
Start, Length : unsigned_long;
begin
Start := Millis;
Line_Finder.LineFinder (ReadMode => ReadMode);
Length := Millis - Start;
if Length < Sample_Rate then
DelayMicroseconds (Time => unsigned (Sample_Rate - Length) * 100);
end if;
end WorkLoop;
procedure Exception_Handler
is
begin
Zumo_Motors.SetSpeed (LeftVelocity => Stop,
RightVelocity => Stop);
loop
Zumo_LED.Yellow_Led (On => True);
SysDelay (Time => 500);
Zumo_LED.Yellow_Led (On => False);
SysDelay (Time => 500);
end loop;
end Exception_Handler;
end SPARKZumo;
|
source/torrent-downloaders.ads | reznikmm/torrent | 4 | 21411 | <filename>source/torrent-downloaders.ads<gh_stars>1-10
-- Copyright (c) 2019-2020 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Containers.Ordered_Maps;
with Ada.Containers.Vectors;
with Ada.Finalization;
with GNAT.Sockets;
with League.Strings;
with Torrent.Connections;
with Torrent.Metainfo_Files;
with Torrent.Storages;
limited with Torrent.Contexts;
package Torrent.Downloaders is
type Downloader
(Context : access Torrent.Contexts.Context'Class;
Meta : not null Torrent.Metainfo_Files.Metainfo_File_Access;
File_Count : Ada.Containers.Count_Type;
Piece_Count : Piece_Index) is
tagged limited private;
-- The downloader tracks one torrent file and all connections
-- related to it.
type Downloader_Access is access all Downloader'Class
with Storage_Size => 0;
procedure Initialize
(Self : in out Downloader'Class;
Peer : SHA1;
Path : League.Strings.Universal_String);
procedure Start (Self : aliased in out Downloader'Class);
procedure Stop (Self : in out Downloader'Class);
procedure Update (Self : in out Downloader'Class);
function Completed (Self : Downloader'Class)
return Torrent.Connections.Piece_Index_Array
with Inline;
function Create_Session
(Self : in out Downloader'Class;
Address : GNAT.Sockets.Sock_Addr_Type)
return Torrent.Connections.Connection_Access;
function Is_Leacher (Self : Downloader'Class) return Boolean;
private
package Connection_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Torrent.Connections.Connection_Access,
"=" => Torrent.Connections."=");
package Piece_State_Maps is new Ada.Containers.Ordered_Maps
(Key_Type => Piece_Index,
Element_Type => Torrent.Connections.Interval_Vectors.Vector,
"<" => "<",
"=" => Torrent.Connections.Interval_Vectors."=");
protected type Tracked_Pieces
(Downloader : not null access Downloaders.Downloader;
Piece_Count : Piece_Index) is
new Torrent.Connections.Connection_State_Listener with
procedure Initialize
(Piece_Length : Piece_Offset;
Last_Piece_Length : Piece_Offset);
overriding procedure Reserve_Intervals
(Map : Boolean_Array;
Value : out Torrent.Connections.Piece_State);
overriding function We_Are_Intrested
(Map : Boolean_Array) return Boolean;
overriding procedure Interval_Saved
(Piece : Piece_Index;
Value : Torrent.Connections.Interval;
Last : out Boolean);
overriding procedure Piece_Completed
(Piece : Piece_Index;
Ok : Boolean);
overriding procedure Unreserve_Intervals
(Value : Torrent.Connections.Piece_Interval_Array);
overriding procedure Interval_Sent (Size : Piece_Offset);
private
Our_Map : Boolean_Array (1 .. Piece_Count) := (others => False);
Piece_Size : Piece_Offset;
Last_Piece_Size : Piece_Offset;
Finished : Piece_State_Maps.Map;
Unfinished : Piece_State_Maps.Map;
end Tracked_Pieces;
type Downloader
(Context : access Torrent.Contexts.Context'Class;
Meta : not null Torrent.Metainfo_Files.Metainfo_File_Access;
File_Count : Ada.Containers.Count_Type;
Piece_Count : Piece_Index) is
new Ada.Finalization.Limited_Controlled with
record
Tracked : aliased Tracked_Pieces
(Downloader'Unchecked_Access, Piece_Count);
Peer_Id : SHA1;
Port : Positive;
Uploaded : Ada.Streams.Stream_Element_Count;
Downloaded : Ada.Streams.Stream_Element_Count;
Left : Ada.Streams.Stream_Element_Count;
Completed : Torrent.Connections.Piece_Index_Array
(1 .. Piece_Count);
Last_Completed : Torrent.Piece_Count;
Storage : aliased Torrent.Storages.Storage (Meta, File_Count);
end record;
end Torrent.Downloaders;
|
src/rom_512.asm | ka6sox/icestick_6502 | 0 | 27393 | ; rom_512.asm
; 6502 assembly in acme syntax for for tst_6502.
; <NAME> 03-02-19
; some fixed addresses in the design
tst_ram = $0000
tst_gpio = $1000
acia_ctl = $2000
acia_dat = $2001
tst_rom = $fe00
cpu_nmi = $fffa
cpu_reset = $fffc
cpu_irq = $fffe
; some variables
led_bits = tst_ram
dly_cnt = tst_ram + 1
str_low = tst_ram + 2
str_high = tst_ram + 3
tst_chr = tst_ram + 4
; start of program at start of ROM
*= tst_rom
; initiaize stack pointer
ldx #$ff
txs
; initialize led data
lda #8
sta led_bits
; initialize test character
lda #0
sta tst_chr
; initialize ACIA
lda #$03 ; reset ACIA
sta acia_ctl
lda #$00 ; normal running
sta acia_ctl
; send startup message
jsr startup_msg
; enable ACIA RX IRQ
lda #$80 ; rx irq enable
sta acia_ctl
cli ; enable irqs
; main loop
lp lda #16 ; delay 16 outer loops
jsr delay
lda led_bits ; get LED state
sta tst_gpio ; save to GPIO
clc ; shift left
rol
bcc + ; reload if bit shifted out msb
lda #8
+ sta led_bits ; save new state
; lda tst_chr ; send test character
; and #$7f
; jsr send_chr
; inc tst_chr ; advance test char
jmp lp ; loop forever
; delay routine
delay
sta dly_cnt ; save loop count
txa ; temp save x
pha
tya ; temp save y
pha
- ldx #0 ; init x loop
-- ldy #0 ; init y loop
--- dey
bne --- ; loop on y
dex
bne -- ; loop on x
dec dly_cnt
bne - ; loop on loop count
pla ; restore y
tay
pla ; restore x
tax
rts
; send startup message
startup_msg
pha ; temp save acc
lda #< start_string ; get addr of string for send routine
sta str_low
lda #> start_string
sta str_high
jsr send_str ; send it
pla ; restore acc
rts
; send a max 255 char string to serial port
send_str
tya ; temp save y
pha
ldy #0 ; point to start of string
- lda (<str_low),y ; get char
beq + ; terminator?
jsr send_chr ; no, send
iny ; advance pointer
bne - ; loop if < 256 sent
+ pla ; restore y
tay
rts
; send a single character to serial port
send_chr
pha ; temp save char to send
- lda acia_ctl ; wait for TX empty
and #$02
beq -
pla ; restor char
sta acia_dat ; send
rts
; interrupt service routine for serial RX
isr
pha ; save acc
lda acia_dat ; get data, clear irq
jsr send_chr ; echo it
pla ; restore acc
rti
; end of program
; strings
start_string
!raw 13, 10, 10, "Icestick 6502 serial test", 13, 10, 10, 0
; vectors
*= cpu_nmi
!word tst_rom
*= cpu_reset
!word tst_rom
*= cpu_irq
!word isr
|
alloy4fun_models/trashltl/models/5/tXnLk9ctQtFZFZMvF.als | Kaixi26/org.alloytools.alloy | 0 | 4113 | <filename>alloy4fun_models/trashltl/models/5/tXnLk9ctQtFZFZMvF.als
open main
pred idtXnLk9ctQtFZFZMvF_prop6 {
all f:File | always f in Trash implies always f in Trash
}
pred __repair { idtXnLk9ctQtFZFZMvF_prop6 }
check __repair { idtXnLk9ctQtFZFZMvF_prop6 <=> prop6o } |
3-mid/physics/implement/c_math/source/thin/c_math_c-vector_2.ads | charlie5/lace | 20 | 11844 | -- This file is generated by SWIG. Please do *not* modify by hand.
--
with Interfaces.C;
package c_math_c.Vector_2 is
-- Item
--
type Item is record
x : aliased c_math_c.Real;
y : aliased c_math_c.Real;
end record;
-- Items
--
type Items is
array (Interfaces.C.size_t range <>) of aliased c_math_c.Vector_2.Item;
-- Pointer
--
type Pointer is access all c_math_c.Vector_2.Item;
-- Pointers
--
type Pointers is
array (Interfaces.C.size_t range <>) of aliased c_math_c.Vector_2.Pointer;
-- Pointer_Pointer
--
type Pointer_Pointer is access all c_math_c.Vector_2.Pointer;
function construct return c_math_c.Vector_2.Item;
function construct
(x : in c_math_c.Real;
y : in c_math_c.Real) return c_math_c.Vector_2.Item;
private
function construct_v1 return c_math_c.Vector_2.Item;
function construct return c_math_c.Vector_2.Item renames construct_v1;
pragma Import (C, construct_v1, "Ada_new_Vector_2__SWIG_0");
function construct_v2
(x : in c_math_c.Real;
y : in c_math_c.Real) return c_math_c.Vector_2.Item;
function construct
(x : in c_math_c.Real;
y : in c_math_c.Real) return c_math_c.Vector_2.Item renames
construct_v2;
pragma Import (C, construct_v2, "Ada_new_Vector_2__SWIG_1");
end c_math_c.Vector_2;
|
tools-src/gnu/gcc/gcc/ada/s-memory.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 25193 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . M E M O R Y --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 2001 Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides the low level memory allocation/deallocation
-- mechanisms used by GNAT.
-- To provide an alternate implementation, simply recompile the modified
-- body of this package with gnatmake -u -a -g s-memory.adb and make sure
-- that the ali and object files for this unit are found in the object
-- search path.
package System.Memory is
pragma Elaborate_Body;
type size_t is mod 2 ** Standard'Address_Size;
function Alloc (Size : size_t) return System.Address;
-- malloc for use by GNAT, with error checking and task lockout,
-- as well as allocation tracking.
procedure Free (Ptr : System.Address);
-- free for use by GNAT, with task lockout and allocation tracking.
function Realloc
(Ptr : System.Address;
Size : size_t)
return System.Address;
-- realloc for use by GNAT, with error checking and task lockout.
private
pragma Export (C, Alloc, "__gnat_malloc");
pragma Export (C, Free, "__gnat_free");
pragma Export (C, Realloc, "__gnat_realloc");
end System.Memory;
|
grammar/Nyar.g4 | ggssh/silly_pl0 | 1 | 4418 | <reponame>ggssh/silly_pl0
grammar Nyar;
import Lexer;
compUnit: (decl | funcDef)* EOF;// 编译单元
decl: constDecl | varDecl;// 声明
constDecl: CONST INT constDef (COMMA constDef)* SEMICOLON;// 常量声明
constDef:
IDENTIFIER ASSIGN expr
| IDENTIFIER LBRACK (expr)? RBRACK ASSIGN LBRACE expr (
COMMA expr
)* RBRACE;
varDecl: INT varDef (COMMA varDef)* SEMICOLON;
varDef:
IDENTIFIER
| IDENTIFIER LBRACK expr RBRACK
| IDENTIFIER ASSIGN expr
| IDENTIFIER LBRACK (expr)? RBRACK ASSIGN LBRACE expr (COMMA expr)* RBRACE;
funcDef: (VOID | INT ) IDENTIFIER LPAREN RPAREN block;
block: LBRACE (decl | stmt)* RBRACE;
//blockItem: decl | stmt;
stmt:
lVal ASSIGN expr SEMICOLON // 赋值语句
| IDENTIFIER LPAREN RPAREN SEMICOLON // 函数调用(目前未实现将函数返回值作为参数)
| block // 块
| IF LPAREN cond RPAREN stmt (ELSE stmt)? // if 语句
| WHILE LPAREN cond RPAREN stmt // while语句
| SEMICOLON // 空
| RETURN expr SEMICOLON;//返回语句
lVal: IDENTIFIER | IDENTIFIER LBRACK expr RBRACK; // 左值表达式,目前只支持一维数组
cond: expr relOp expr;// 条件表达式
relOp: EQ | NE | LT | GT | LE | GE;
expr:
expr binOp expr
| unaryOp expr
| LPAREN expr RPAREN
| lVal //todo 加个函数调用
| NUMBER;
binOp: ADD | SUB | MUL | DIV | MOD;
unaryOp: ADD | SUB; |
ioq3/build/release-js-js/missionpack/game/g_missile.asm | RawTechnique/quake-port | 1 | 5124 | <gh_stars>1-10
export G_BounceMissile
code
proc G_BounceMissile 48 12
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 4
ADDRFP4 4
INDIRP4
ASGNP4
ADDRLP4 16
ADDRGP4 level+36
INDIRI4
CVIF4 4
ADDRGP4 level+32
INDIRI4
ADDRGP4 level+36
INDIRI4
SUBI4
CVIF4 4
ADDRFP4 4
INDIRP4
CNSTI4 8
ADDP4
INDIRF4
MULF4
ADDF4
CVFI4 4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 12
ADDP4
ARGP4
ADDRLP4 16
INDIRI4
ARGI4
ADDRLP4 0
ARGP4
ADDRGP4 BG_EvaluateTrajectoryDelta
CALLV
pop
ADDRLP4 20
ADDRLP4 0
INDIRF4
ASGNF4
ADDRLP4 28
ADDRFP4 4
INDIRP4
CNSTI4 24
ADDP4
ASGNP4
ADDRLP4 12
ADDRLP4 20
INDIRF4
ADDRLP4 28
INDIRP4
INDIRF4
MULF4
ADDRLP4 0+4
INDIRF4
ADDRFP4 4
INDIRP4
CNSTI4 28
ADDP4
INDIRF4
MULF4
ADDF4
ADDRLP4 0+8
INDIRF4
ADDRFP4 4
INDIRP4
CNSTI4 32
ADDP4
INDIRF4
MULF4
ADDF4
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 36
ADDP4
ADDRLP4 20
INDIRF4
ADDRLP4 28
INDIRP4
INDIRF4
CNSTF4 3221225472
ADDRLP4 12
INDIRF4
MULF4
MULF4
ADDF4
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 40
ADDP4
ADDRLP4 0+4
INDIRF4
ADDRFP4 4
INDIRP4
CNSTI4 28
ADDP4
INDIRF4
CNSTF4 3221225472
ADDRLP4 12
INDIRF4
MULF4
MULF4
ADDF4
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 44
ADDP4
ADDRLP4 0+8
INDIRF4
ADDRFP4 4
INDIRP4
CNSTI4 32
ADDP4
INDIRF4
CNSTF4 3221225472
ADDRLP4 12
INDIRF4
MULF4
MULF4
ADDF4
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 8
ADDP4
INDIRI4
CNSTI4 32
BANDI4
CNSTI4 0
EQI4 $61
ADDRLP4 32
ADDRFP4 0
INDIRP4
CNSTI4 36
ADDP4
ASGNP4
ADDRLP4 32
INDIRP4
CNSTF4 1059481190
ADDRLP4 32
INDIRP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 36
ADDRFP4 0
INDIRP4
CNSTI4 40
ADDP4
ASGNP4
ADDRLP4 36
INDIRP4
CNSTF4 1059481190
ADDRLP4 36
INDIRP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 40
ADDRFP4 0
INDIRP4
CNSTI4 44
ADDP4
ASGNP4
ADDRLP4 40
INDIRP4
CNSTF4 1059481190
ADDRLP4 40
INDIRP4
INDIRF4
MULF4
ASGNF4
ADDRFP4 4
INDIRP4
CNSTI4 32
ADDP4
INDIRF4
CNSTF4 1045220557
LEF4 $63
ADDRFP4 0
INDIRP4
CNSTI4 36
ADDP4
ARGP4
ADDRLP4 44
ADDRGP4 VectorLength
CALLF4
ASGNF4
ADDRLP4 44
INDIRF4
CNSTF4 1109393408
GEF4 $63
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 4
INDIRP4
CNSTI4 12
ADDP4
ARGP4
ADDRGP4 G_SetOrigin
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 84
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 4
DIVI4
ASGNI4
ADDRGP4 $53
JUMPV
LABELV $63
LABELV $61
ADDRLP4 32
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ASGNP4
ADDRLP4 32
INDIRP4
ADDRLP4 32
INDIRP4
INDIRF4
ADDRFP4 4
INDIRP4
CNSTI4 24
ADDP4
INDIRF4
ADDF4
ASGNF4
ADDRLP4 36
ADDRFP4 0
INDIRP4
CNSTI4 492
ADDP4
ASGNP4
ADDRLP4 36
INDIRP4
ADDRLP4 36
INDIRP4
INDIRF4
ADDRFP4 4
INDIRP4
CNSTI4 28
ADDP4
INDIRF4
ADDF4
ASGNF4
ADDRLP4 40
ADDRFP4 0
INDIRP4
CNSTI4 496
ADDP4
ASGNP4
ADDRLP4 40
INDIRP4
ADDRLP4 40
INDIRP4
INDIRF4
ADDRFP4 4
INDIRP4
CNSTI4 32
ADDP4
INDIRF4
ADDF4
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
INDIRB
ASGNB 12
ADDRFP4 0
INDIRP4
CNSTI4 16
ADDP4
ADDRGP4 level+32
INDIRI4
ASGNI4
LABELV $53
endproc G_BounceMissile 48 12
export G_ExplodeMissile
proc G_ExplodeMissile 44 24
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 12
ADDP4
ARGP4
ADDRGP4 level+32
INDIRI4
ARGI4
ADDRLP4 0
ARGP4
ADDRGP4 BG_EvaluateTrajectory
CALLV
pop
ADDRLP4 0
ADDRLP4 0
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 0+4
ADDRLP4 0+4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 0+8
ADDRLP4 0+8
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 0
ARGP4
ADDRGP4 G_SetOrigin
CALLV
pop
ADDRLP4 24
CNSTF4 0
ASGNF4
ADDRLP4 12+4
ADDRLP4 24
INDIRF4
ASGNF4
ADDRLP4 12
ADDRLP4 24
INDIRF4
ASGNF4
ADDRLP4 12+8
CNSTF4 1065353216
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 0
ASGNI4
ADDRLP4 12
ARGP4
ADDRLP4 28
ADDRGP4 DirToByte
CALLI4
ASGNI4
ADDRFP4 0
INDIRP4
ARGP4
CNSTI4 51
ARGI4
ADDRLP4 28
INDIRI4
ARGI4
ADDRGP4 G_AddEvent
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 556
ADDP4
CNSTI4 1
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 740
ADDP4
INDIRI4
CNSTI4 0
EQI4 $75
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 600
ADDP4
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 740
ADDP4
INDIRI4
CVIF4 4
ARGF4
ADDRFP4 0
INDIRP4
CNSTI4 744
ADDP4
INDIRI4
CVIF4 4
ARGF4
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 752
ADDP4
INDIRI4
ARGI4
ADDRLP4 36
ADDRGP4 G_RadiusDamage
CALLI4
ASGNI4
ADDRLP4 36
INDIRI4
CNSTI4 0
EQI4 $77
ADDRLP4 40
CNSTI4 812
ADDRFP4 0
INDIRP4
CNSTI4 512
ADDP4
INDIRI4
MULI4
ADDRGP4 g_entities+516
ADDP4
INDIRP4
CNSTI4 716
ADDP4
ASGNP4
ADDRLP4 40
INDIRP4
ADDRLP4 40
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $77
LABELV $75
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 trap_LinkEntity
CALLV
pop
LABELV $67
endproc G_ExplodeMissile 44 24
proc ProximityMine_Explode 0 4
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 G_ExplodeMissile
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 768
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $81
ADDRFP4 0
INDIRP4
CNSTI4 768
ADDP4
INDIRP4
ARGP4
ADDRGP4 G_FreeEntity
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 768
ADDP4
CNSTP4 0
ASGNP4
LABELV $81
LABELV $80
endproc ProximityMine_Explode 0 4
proc ProximityMine_Die 0 0
ADDRFP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 ProximityMine_Explode
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $83
endproc ProximityMine_Die 0 0
export ProximityMine_Trigger
proc ProximityMine_Trigger 44 12
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 4
ADDRFP4 4
INDIRP4
ASGNP4
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $86
ADDRGP4 $85
JUMPV
LABELV $86
ADDRLP4 20
CNSTI4 24
ASGNI4
ADDRLP4 0
ADDRFP4 0
INDIRP4
ADDRLP4 20
INDIRI4
ADDP4
INDIRF4
ADDRFP4 4
INDIRP4
ADDRLP4 20
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 28
CNSTI4 28
ASGNI4
ADDRLP4 0+4
ADDRFP4 0
INDIRP4
ADDRLP4 28
INDIRI4
ADDP4
INDIRF4
ADDRFP4 4
INDIRP4
ADDRLP4 28
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 32
CNSTI4 32
ASGNI4
ADDRLP4 0+8
ADDRFP4 0
INDIRP4
ADDRLP4 32
INDIRI4
ADDP4
INDIRF4
ADDRFP4 4
INDIRP4
ADDRLP4 32
INDIRI4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 0
ARGP4
ADDRLP4 36
ADDRGP4 VectorLength
CALLF4
ASGNF4
ADDRLP4 36
INDIRF4
ADDRFP4 0
INDIRP4
CNSTI4 600
ADDP4
INDIRP4
CNSTI4 744
ADDP4
INDIRI4
CVIF4 4
LEF4 $90
ADDRGP4 $85
JUMPV
LABELV $90
ADDRGP4 g_gametype+12
INDIRI4
CNSTI4 3
LTI4 $92
ADDRFP4 0
INDIRP4
CNSTI4 600
ADDP4
INDIRP4
CNSTI4 204
ADDP4
INDIRI4
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
NEI4 $95
ADDRGP4 $85
JUMPV
LABELV $95
LABELV $92
ADDRFP4 4
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRLP4 40
ADDRGP4 CanDamage
CALLI4
ASGNI4
ADDRLP4 40
INDIRI4
CNSTI4 0
NEI4 $97
ADDRGP4 $85
JUMPV
LABELV $97
ADDRLP4 12
ADDRFP4 0
INDIRP4
CNSTI4 600
ADDP4
INDIRP4
ASGNP4
ADDRLP4 12
INDIRP4
CNSTI4 156
ADDP4
CNSTI4 0
ASGNI4
ADDRLP4 12
INDIRP4
ARGP4
CNSTI4 67
ARGI4
CNSTI4 0
ARGI4
ADDRGP4 G_AddEvent
CALLV
pop
ADDRLP4 12
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 500
ADDI4
ASGNI4
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 G_FreeEntity
CALLV
pop
LABELV $85
endproc ProximityMine_Trigger 44 12
proc ProximityMine_Activate 16 8
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 ProximityMine_Explode
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
ADDRGP4 g_proxMineTimeout+12
INDIRI4
ADDI4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 732
ADDP4
CNSTI4 1
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 728
ADDP4
CNSTI4 1
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 712
ADDP4
ADDRGP4 ProximityMine_Die
ASGNP4
ADDRGP4 $103
ARGP4
ADDRLP4 8
ADDRGP4 G_SoundIndex
CALLI4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 156
ADDP4
ADDRLP4 8
INDIRI4
ASGNI4
ADDRLP4 12
ADDRGP4 G_Spawn
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 12
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 524
ADDP4
ADDRGP4 $104
ASGNP4
ADDRLP4 4
ADDRFP4 0
INDIRP4
CNSTI4 744
ADDP4
INDIRI4
CVIF4 4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 436
ADDP4
ADDRLP4 4
INDIRF4
NEGF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 440
ADDP4
ADDRLP4 4
INDIRF4
NEGF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 444
ADDP4
ADDRLP4 4
INDIRF4
NEGF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 448
ADDP4
ADDRLP4 4
INDIRF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 452
ADDP4
ADDRLP4 4
INDIRF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 456
ADDP4
ADDRLP4 4
INDIRF4
ASGNF4
ADDRLP4 0
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRGP4 G_SetOrigin
CALLV
pop
ADDRLP4 0
INDIRP4
CNSTI4 600
ADDP4
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 460
ADDP4
CNSTI4 1073741824
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 700
ADDP4
ADDRGP4 ProximityMine_Trigger
ASGNP4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 trap_LinkEntity
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 768
ADDP4
ADDRLP4 0
INDIRP4
ASGNP4
LABELV $100
endproc ProximityMine_Activate 16 8
proc ProximityMine_ExplodeOnPlayer 16 32
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 0
ADDRFP4 0
INDIRP4
CNSTI4 764
ADDP4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 4
INDIRP4
ADDRLP4 4
INDIRP4
INDIRI4
CNSTI4 -3
BANDI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 836
ADDP4
INDIRI4
ADDRGP4 level+32
INDIRI4
LEI4 $106
ADDRLP4 0
INDIRP4
ARGP4
ADDRLP4 12
ADDRFP4 0
INDIRP4
CNSTI4 600
ADDP4
INDIRP4
ASGNP4
ADDRLP4 12
INDIRP4
ARGP4
ADDRLP4 12
INDIRP4
ARGP4
ADDRGP4 vec3_origin
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 92
ADDP4
ARGP4
CNSTI4 1000
ARGI4
CNSTI4 4
ARGI4
CNSTI4 27
ARGI4
ADDRGP4 G_Damage
CALLV
pop
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 836
ADDP4
CNSTI4 0
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 20
ADDP4
ARGP4
CNSTI4 72
ARGI4
ADDRGP4 G_TempEntity
CALLP4
pop
ADDRGP4 $107
JUMPV
LABELV $106
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRGP4 G_SetOrigin
CALLV
pop
ADDRLP4 8
ADDRFP4 0
INDIRP4
CNSTI4 424
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRI4
CNSTI4 -2
BANDI4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 752
ADDP4
CNSTI4 25
ASGNI4
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 G_ExplodeMissile
CALLV
pop
LABELV $107
LABELV $105
endproc ProximityMine_ExplodeOnPlayer 16 32
proc ProximityMine_Player 20 12
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 4
ADDRFP4 4
INDIRP4
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 8
ADDP4
INDIRI4
CNSTI4 128
BANDI4
CNSTI4 0
EQI4 $110
ADDRGP4 $109
JUMPV
LABELV $110
ADDRFP4 0
INDIRP4
ARGP4
CNSTI4 66
ARGI4
CNSTI4 0
ARGI4
ADDRGP4 G_AddEvent
CALLV
pop
ADDRFP4 4
INDIRP4
CNSTI4 8
ADDP4
INDIRI4
CNSTI4 2
BANDI4
CNSTI4 0
EQI4 $112
ADDRLP4 0
CNSTI4 740
ASGNI4
ADDRLP4 4
ADDRFP4 4
INDIRP4
CNSTI4 768
ADDP4
INDIRP4
ADDRLP4 0
INDIRI4
ADDP4
ASGNP4
ADDRLP4 4
INDIRP4
ADDRLP4 4
INDIRP4
INDIRI4
ADDRFP4 0
INDIRP4
ADDRLP4 0
INDIRI4
ADDP4
INDIRI4
ADDI4
ASGNI4
ADDRLP4 8
ADDRFP4 4
INDIRP4
CNSTI4 768
ADDP4
INDIRP4
CNSTI4 744
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
CNSTF4 1069547520
ADDRLP4 8
INDIRP4
INDIRI4
CVIF4 4
MULF4
CVFI4 4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 G_FreeEntity
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
ASGNI4
ADDRGP4 $109
JUMPV
LABELV $112
ADDRLP4 0
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 104
ADDP4
ASGNP4
ADDRLP4 0
INDIRP4
ADDRLP4 0
INDIRP4
INDIRI4
CNSTI4 2
BORI4
ASGNI4
ADDRFP4 4
INDIRP4
CNSTI4 768
ADDP4
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 4
ADDRFP4 0
INDIRP4
CNSTI4 8
ADDP4
ASGNP4
ADDRLP4 4
INDIRP4
ADDRLP4 4
INDIRP4
INDIRI4
CNSTI4 128
BORI4
ASGNI4
ADDRLP4 8
ADDRFP4 0
INDIRP4
CNSTI4 424
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRI4
CNSTI4 1
BORI4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 12
ADDP4
CNSTI4 2
ASGNI4
ADDRLP4 16
CNSTF4 0
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 44
ADDP4
ADDRLP4 16
INDIRF4
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 40
ADDP4
ADDRLP4 16
INDIRF4
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 36
ADDP4
ADDRLP4 16
INDIRF4
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 764
ADDP4
ADDRFP4 4
INDIRP4
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 ProximityMine_ExplodeOnPlayer
ASGNP4
ADDRFP4 4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 836
ADDP4
INDIRI4
ADDRGP4 level+32
INDIRI4
LEI4 $115
ADDRFP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 2000
ADDI4
ASGNI4
ADDRGP4 $116
JUMPV
LABELV $115
ADDRFP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 10000
ADDI4
ASGNI4
LABELV $116
LABELV $109
endproc ProximityMine_Player 20 12
export G_MissileImpact
proc G_MissileImpact 96 32
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 4
ADDRFP4 4
INDIRP4
ASGNP4
ADDRLP4 4
CNSTI4 0
ASGNI4
ADDRLP4 0
CNSTI4 812
ADDRFP4 4
INDIRP4
CNSTI4 52
ADDP4
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ASGNP4
ADDRLP4 48
CNSTI4 0
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 732
ADDP4
INDIRI4
ADDRLP4 48
INDIRI4
NEI4 $121
ADDRFP4 0
INDIRP4
CNSTI4 8
ADDP4
INDIRI4
CNSTI4 48
BANDI4
ADDRLP4 48
INDIRI4
EQI4 $121
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 4
INDIRP4
ARGP4
ADDRGP4 G_BounceMissile
CALLV
pop
ADDRFP4 0
INDIRP4
ARGP4
CNSTI4 44
ARGI4
CNSTI4 0
ARGI4
ADDRGP4 G_AddEvent
CALLV
pop
ADDRGP4 $120
JUMPV
LABELV $121
ADDRLP4 0
INDIRP4
CNSTI4 732
ADDP4
INDIRI4
CNSTI4 0
EQI4 $123
ADDRFP4 0
INDIRP4
CNSTI4 192
ADDP4
INDIRI4
CNSTI4 12
EQI4 $125
ADDRLP4 52
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
ASGNP4
ADDRLP4 52
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $127
ADDRLP4 52
INDIRP4
CNSTI4 836
ADDP4
INDIRI4
ADDRGP4 level+32
INDIRI4
LEI4 $127
ADDRLP4 8
ADDRFP4 0
INDIRP4
CNSTI4 36
ADDP4
INDIRB
ASGNB 12
ADDRLP4 8
ARGP4
ADDRGP4 VectorNormalize
CALLF4
pop
ADDRLP4 0
INDIRP4
ARGP4
ADDRLP4 8
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRLP4 32
ARGP4
ADDRLP4 20
ARGP4
ADDRLP4 56
ADDRGP4 G_InvulnerabilityEffect
CALLI4
ASGNI4
ADDRLP4 56
INDIRI4
CNSTI4 0
EQI4 $130
ADDRFP4 4
INDIRP4
CNSTI4 24
ADDP4
ADDRLP4 20
INDIRB
ASGNB 12
ADDRLP4 60
ADDRFP4 0
INDIRP4
CNSTI4 8
ADDP4
ASGNP4
ADDRLP4 44
ADDRLP4 60
INDIRP4
INDIRI4
CNSTI4 32
BANDI4
ASGNI4
ADDRLP4 60
INDIRP4
ADDRLP4 60
INDIRP4
INDIRI4
CNSTI4 -33
BANDI4
ASGNI4
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 4
INDIRP4
ARGP4
ADDRGP4 G_BounceMissile
CALLV
pop
ADDRLP4 64
ADDRFP4 0
INDIRP4
CNSTI4 8
ADDP4
ASGNP4
ADDRLP4 64
INDIRP4
ADDRLP4 64
INDIRP4
INDIRI4
ADDRLP4 44
INDIRI4
BORI4
ASGNI4
LABELV $130
ADDRFP4 0
INDIRP4
CNSTI4 664
ADDP4
ADDRLP4 0
INDIRP4
ASGNP4
ADDRGP4 $120
JUMPV
LABELV $127
LABELV $125
LABELV $123
ADDRLP4 0
INDIRP4
CNSTI4 732
ADDP4
INDIRI4
CNSTI4 0
EQI4 $132
ADDRFP4 0
INDIRP4
CNSTI4 736
ADDP4
INDIRI4
CNSTI4 0
EQI4 $134
ADDRLP4 0
INDIRP4
ARGP4
CNSTI4 812
ADDRFP4 0
INDIRP4
CNSTI4 512
ADDP4
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ARGP4
ADDRLP4 64
ADDRGP4 LogAccuracyHit
CALLI4
ASGNI4
ADDRLP4 64
INDIRI4
CNSTI4 0
EQI4 $136
ADDRLP4 68
CNSTI4 812
ADDRFP4 0
INDIRP4
CNSTI4 512
ADDP4
INDIRI4
MULI4
ADDRGP4 g_entities+516
ADDP4
INDIRP4
CNSTI4 716
ADDP4
ASGNP4
ADDRLP4 68
INDIRP4
ADDRLP4 68
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 4
CNSTI4 1
ASGNI4
LABELV $136
ADDRFP4 0
INDIRP4
CNSTI4 12
ADDP4
ARGP4
ADDRGP4 level+32
INDIRI4
ARGI4
ADDRLP4 52
ARGP4
ADDRGP4 BG_EvaluateTrajectoryDelta
CALLV
pop
ADDRLP4 52
ARGP4
ADDRLP4 68
ADDRGP4 VectorLength
CALLF4
ASGNF4
ADDRLP4 68
INDIRF4
CNSTF4 0
NEF4 $140
ADDRLP4 52+8
CNSTF4 1065353216
ASGNF4
LABELV $140
ADDRLP4 0
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
ARGP4
CNSTI4 812
ADDRFP4 0
INDIRP4
CNSTI4 512
ADDP4
INDIRI4
MULI4
ADDRGP4 g_entities
ADDP4
ARGP4
ADDRLP4 52
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 92
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 736
ADDP4
INDIRI4
ARGI4
CNSTI4 0
ARGI4
ADDRFP4 0
INDIRP4
CNSTI4 748
ADDP4
INDIRI4
ARGI4
ADDRGP4 G_Damage
CALLV
pop
LABELV $134
LABELV $132
ADDRFP4 0
INDIRP4
CNSTI4 192
ADDP4
INDIRI4
CNSTI4 12
NEI4 $143
ADDRFP4 0
INDIRP4
CNSTI4 12
ADDP4
INDIRI4
CNSTI4 5
EQI4 $145
ADDRGP4 $120
JUMPV
LABELV $145
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
INDIRI4
CNSTI4 1
NEI4 $147
ADDRLP4 0
INDIRP4
CNSTI4 728
ADDP4
INDIRI4
CNSTI4 0
LEI4 $147
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 0
INDIRP4
ARGP4
ADDRGP4 ProximityMine_Player
CALLV
pop
ADDRGP4 $120
JUMPV
LABELV $147
ADDRFP4 4
INDIRP4
CNSTI4 12
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRGP4 SnapVectorTowards
CALLV
pop
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 4
INDIRP4
CNSTI4 12
ADDP4
ARGP4
ADDRGP4 G_SetOrigin
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 12
ADDP4
CNSTI4 0
ASGNI4
ADDRLP4 60
CNSTF4 0
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 44
ADDP4
ADDRLP4 60
INDIRF4
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 40
ADDP4
ADDRLP4 60
INDIRF4
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 36
ADDP4
ADDRLP4 60
INDIRF4
ASGNF4
ADDRFP4 0
INDIRP4
ARGP4
CNSTI4 66
ARGI4
ADDRFP4 4
INDIRP4
CNSTI4 44
ADDP4
INDIRI4
ARGI4
ADDRGP4 G_AddEvent
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 ProximityMine_Activate
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 2000
ADDI4
ASGNI4
ADDRFP4 4
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 116
ADDP4
ARGP4
ADDRGP4 vectoangles
CALLV
pop
ADDRLP4 64
ADDRFP4 0
INDIRP4
CNSTI4 116
ADDP4
ASGNP4
ADDRLP4 64
INDIRP4
ADDRLP4 64
INDIRP4
INDIRF4
CNSTF4 1119092736
ADDF4
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 764
ADDP4
ADDRLP4 0
INDIRP4
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 712
ADDP4
ADDRGP4 ProximityMine_Die
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 672
ADDP4
ADDRFP4 4
INDIRP4
CNSTI4 24
ADDP4
INDIRB
ASGNB 12
ADDRFP4 0
INDIRP4
CNSTI4 436
ADDP4
CNSTF4 3229614080
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 440
ADDP4
CNSTF4 3229614080
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 444
ADDP4
CNSTF4 3229614080
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 448
ADDP4
CNSTF4 1082130432
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 452
ADDP4
CNSTF4 1082130432
ASGNF4
ADDRFP4 0
INDIRP4
CNSTI4 456
ADDP4
CNSTF4 1082130432
ASGNF4
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 trap_LinkEntity
CALLV
pop
ADDRGP4 $120
JUMPV
LABELV $143
ADDRFP4 0
INDIRP4
CNSTI4 524
ADDP4
INDIRP4
ARGP4
ADDRGP4 $152
ARGP4
ADDRLP4 52
ADDRGP4 qk_strcmp
CALLI4
ASGNI4
ADDRLP4 52
INDIRI4
CNSTI4 0
NEI4 $150
ADDRLP4 72
ADDRGP4 G_Spawn
CALLP4
ASGNP4
ADDRLP4 56
ADDRLP4 72
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 732
ADDP4
INDIRI4
CNSTI4 0
EQI4 $153
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $153
ADDRFP4 4
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRLP4 80
ADDRGP4 DirToByte
CALLI4
ASGNI4
ADDRLP4 56
INDIRP4
ARGP4
CNSTI4 50
ARGI4
ADDRLP4 80
INDIRI4
ARGI4
ADDRGP4 G_AddEvent
CALLV
pop
ADDRLP4 56
INDIRP4
CNSTI4 140
ADDP4
ADDRLP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 764
ADDP4
ADDRLP4 0
INDIRP4
ASGNP4
ADDRLP4 88
CNSTF4 1056964608
ASGNF4
ADDRLP4 60
ADDRLP4 0
INDIRP4
CNSTI4 488
ADDP4
INDIRF4
ADDRLP4 88
INDIRF4
ADDRLP4 0
INDIRP4
CNSTI4 436
ADDP4
INDIRF4
ADDRLP4 0
INDIRP4
CNSTI4 448
ADDP4
INDIRF4
ADDF4
MULF4
ADDF4
ASGNF4
ADDRLP4 60+4
ADDRLP4 0
INDIRP4
CNSTI4 492
ADDP4
INDIRF4
ADDRLP4 88
INDIRF4
ADDRLP4 0
INDIRP4
CNSTI4 440
ADDP4
INDIRF4
ADDRLP4 0
INDIRP4
CNSTI4 452
ADDP4
INDIRF4
ADDF4
MULF4
ADDF4
ASGNF4
ADDRLP4 60+8
ADDRLP4 0
INDIRP4
CNSTI4 496
ADDP4
INDIRF4
CNSTF4 1056964608
ADDRLP4 0
INDIRP4
CNSTI4 444
ADDP4
INDIRF4
ADDRLP4 0
INDIRP4
CNSTI4 456
ADDP4
INDIRF4
ADDF4
MULF4
ADDF4
ASGNF4
ADDRLP4 60
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRGP4 SnapVectorTowards
CALLV
pop
ADDRGP4 $154
JUMPV
LABELV $153
ADDRLP4 60
ADDRFP4 4
INDIRP4
CNSTI4 12
ADDP4
INDIRB
ASGNB 12
ADDRFP4 4
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRLP4 84
ADDRGP4 DirToByte
CALLI4
ASGNI4
ADDRLP4 56
INDIRP4
ARGP4
CNSTI4 51
ARGI4
ADDRLP4 84
INDIRI4
ARGI4
ADDRGP4 G_AddEvent
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 764
ADDP4
CNSTP4 0
ASGNP4
LABELV $154
ADDRLP4 60
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRGP4 SnapVectorTowards
CALLV
pop
ADDRLP4 56
INDIRP4
CNSTI4 556
ADDP4
CNSTI4 1
ASGNI4
ADDRLP4 56
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 0
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 11
ASGNI4
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 60
ARGP4
ADDRGP4 G_SetOrigin
CALLV
pop
ADDRLP4 56
INDIRP4
ARGP4
ADDRLP4 60
ARGP4
ADDRGP4 G_SetOrigin
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 Weapon_HookThink
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 100
ADDI4
ASGNI4
ADDRLP4 80
ADDRFP4 0
INDIRP4
CNSTI4 600
ADDP4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 12
ADDP4
ASGNP4
ADDRLP4 80
INDIRP4
ADDRLP4 80
INDIRP4
INDIRI4
CNSTI4 2048
BORI4
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 600
ADDP4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 92
ADDP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
INDIRB
ASGNB 12
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 trap_LinkEntity
CALLV
pop
ADDRLP4 56
INDIRP4
ARGP4
ADDRGP4 trap_LinkEntity
CALLV
pop
ADDRGP4 $120
JUMPV
LABELV $150
ADDRLP4 0
INDIRP4
CNSTI4 732
ADDP4
INDIRI4
CNSTI4 0
EQI4 $158
ADDRLP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $158
ADDRFP4 4
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRLP4 60
ADDRGP4 DirToByte
CALLI4
ASGNI4
ADDRFP4 0
INDIRP4
ARGP4
CNSTI4 50
ARGI4
ADDRLP4 60
INDIRI4
ARGI4
ADDRGP4 G_AddEvent
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 140
ADDP4
ADDRLP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRGP4 $159
JUMPV
LABELV $158
ADDRFP4 4
INDIRP4
CNSTI4 44
ADDP4
INDIRI4
CNSTI4 4096
BANDI4
CNSTI4 0
EQI4 $160
ADDRFP4 4
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRLP4 60
ADDRGP4 DirToByte
CALLI4
ASGNI4
ADDRFP4 0
INDIRP4
ARGP4
CNSTI4 52
ARGI4
ADDRLP4 60
INDIRI4
ARGI4
ADDRGP4 G_AddEvent
CALLV
pop
ADDRGP4 $161
JUMPV
LABELV $160
ADDRFP4 4
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRLP4 60
ADDRGP4 DirToByte
CALLI4
ASGNI4
ADDRFP4 0
INDIRP4
ARGP4
CNSTI4 51
ARGI4
ADDRLP4 60
INDIRI4
ARGI4
ADDRGP4 G_AddEvent
CALLV
pop
LABELV $161
LABELV $159
ADDRFP4 0
INDIRP4
CNSTI4 556
ADDP4
CNSTI4 1
ASGNI4
ADDRFP4 0
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 0
ASGNI4
ADDRFP4 4
INDIRP4
CNSTI4 12
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 24
ADDP4
ARGP4
ADDRGP4 SnapVectorTowards
CALLV
pop
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 4
INDIRP4
CNSTI4 12
ADDP4
ARGP4
ADDRGP4 G_SetOrigin
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 740
ADDP4
INDIRI4
CNSTI4 0
EQI4 $162
ADDRFP4 4
INDIRP4
CNSTI4 12
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 600
ADDP4
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 740
ADDP4
INDIRI4
CVIF4 4
ARGF4
ADDRFP4 0
INDIRP4
CNSTI4 744
ADDP4
INDIRI4
CVIF4 4
ARGF4
ADDRLP4 0
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 752
ADDP4
INDIRI4
ARGI4
ADDRLP4 64
ADDRGP4 G_RadiusDamage
CALLI4
ASGNI4
ADDRLP4 64
INDIRI4
CNSTI4 0
EQI4 $164
ADDRLP4 4
INDIRI4
CNSTI4 0
NEI4 $166
ADDRLP4 68
CNSTI4 812
ADDRFP4 0
INDIRP4
CNSTI4 512
ADDP4
INDIRI4
MULI4
ADDRGP4 g_entities+516
ADDP4
INDIRP4
CNSTI4 716
ADDP4
ASGNP4
ADDRLP4 68
INDIRP4
ADDRLP4 68
INDIRP4
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $166
LABELV $164
LABELV $162
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 trap_LinkEntity
CALLV
pop
LABELV $120
endproc G_MissileImpact 96 32
export G_RunMissile
proc G_RunMissile 100 28
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 0
INDIRP4
CNSTI4 12
ADDP4
ARGP4
ADDRGP4 level+32
INDIRI4
ARGI4
ADDRLP4 60
ARGP4
ADDRGP4 BG_EvaluateTrajectory
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 664
ADDP4
INDIRP4
CVPU4 4
CNSTU4 0
EQU4 $171
ADDRLP4 56
ADDRFP4 0
INDIRP4
CNSTI4 664
ADDP4
INDIRP4
INDIRI4
ASGNI4
ADDRGP4 $172
JUMPV
LABELV $171
ADDRFP4 0
INDIRP4
CNSTI4 192
ADDP4
INDIRI4
CNSTI4 12
NEI4 $173
ADDRFP4 0
INDIRP4
CNSTI4 756
ADDP4
INDIRI4
CNSTI4 0
EQI4 $173
ADDRLP4 56
CNSTI4 1023
ASGNI4
ADDRGP4 $174
JUMPV
LABELV $173
ADDRLP4 56
ADDRFP4 0
INDIRP4
CNSTI4 512
ADDP4
INDIRI4
ASGNI4
LABELV $174
LABELV $172
ADDRLP4 0
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 436
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 448
ADDP4
ARGP4
ADDRLP4 60
ARGP4
ADDRLP4 56
INDIRI4
ARGI4
ADDRFP4 0
INDIRP4
CNSTI4 572
ADDP4
INDIRI4
ARGI4
ADDRGP4 trap_Trace
CALLV
pop
ADDRLP4 80
CNSTI4 0
ASGNI4
ADDRLP4 0+4
INDIRI4
ADDRLP4 80
INDIRI4
NEI4 $178
ADDRLP4 0
INDIRI4
ADDRLP4 80
INDIRI4
EQI4 $175
LABELV $178
ADDRLP4 0
ARGP4
ADDRLP4 88
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ASGNP4
ADDRLP4 88
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 436
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 448
ADDP4
ARGP4
ADDRLP4 88
INDIRP4
ARGP4
ADDRLP4 56
INDIRI4
ARGI4
ADDRFP4 0
INDIRP4
CNSTI4 572
ADDP4
INDIRI4
ARGI4
ADDRGP4 trap_Trace
CALLV
pop
ADDRLP4 0+8
CNSTF4 0
ASGNF4
ADDRGP4 $176
JUMPV
LABELV $175
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ADDRLP4 0+12
INDIRB
ASGNB 12
LABELV $176
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 trap_LinkEntity
CALLV
pop
ADDRLP4 0+8
INDIRF4
CNSTF4 1065353216
EQF4 $181
ADDRLP4 0+44
INDIRI4
CNSTI4 16
BANDI4
CNSTI4 0
EQI4 $184
ADDRLP4 88
ADDRFP4 0
INDIRP4
CNSTI4 600
ADDP4
INDIRP4
ASGNP4
ADDRLP4 92
CNSTU4 0
ASGNU4
ADDRLP4 88
INDIRP4
CVPU4 4
ADDRLP4 92
INDIRU4
EQU4 $187
ADDRLP4 96
ADDRLP4 88
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
ASGNP4
ADDRLP4 96
INDIRP4
CVPU4 4
ADDRLP4 92
INDIRU4
EQU4 $187
ADDRLP4 96
INDIRP4
CNSTI4 760
ADDP4
INDIRP4
CVPU4 4
ADDRFP4 0
INDIRP4
CVPU4 4
NEU4 $187
ADDRFP4 0
INDIRP4
CNSTI4 600
ADDP4
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 760
ADDP4
CNSTP4 0
ASGNP4
LABELV $187
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 G_FreeEntity
CALLV
pop
ADDRGP4 $169
JUMPV
LABELV $184
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 0
ARGP4
ADDRGP4 G_MissileImpact
CALLV
pop
ADDRFP4 0
INDIRP4
CNSTI4 4
ADDP4
INDIRI4
CNSTI4 3
EQI4 $189
ADDRGP4 $169
JUMPV
LABELV $189
LABELV $181
ADDRFP4 0
INDIRP4
CNSTI4 192
ADDP4
INDIRI4
CNSTI4 12
NEI4 $191
ADDRFP4 0
INDIRP4
CNSTI4 756
ADDP4
INDIRI4
CNSTI4 0
NEI4 $191
ADDRLP4 0
ARGP4
ADDRLP4 92
ADDRFP4 0
INDIRP4
CNSTI4 488
ADDP4
ASGNP4
ADDRLP4 92
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 436
ADDP4
ARGP4
ADDRFP4 0
INDIRP4
CNSTI4 448
ADDP4
ARGP4
ADDRLP4 92
INDIRP4
ARGP4
CNSTI4 1023
ARGI4
ADDRFP4 0
INDIRP4
CNSTI4 572
ADDP4
INDIRI4
ARGI4
ADDRGP4 trap_Trace
CALLV
pop
ADDRLP4 0+4
INDIRI4
CNSTI4 0
EQI4 $197
ADDRLP4 0+52
INDIRI4
ADDRFP4 0
INDIRP4
CNSTI4 512
ADDP4
INDIRI4
EQI4 $193
LABELV $197
ADDRFP4 0
INDIRP4
CNSTI4 756
ADDP4
CNSTI4 1
ASGNI4
LABELV $193
LABELV $191
ADDRFP4 0
INDIRP4
ARGP4
ADDRGP4 G_RunThink
CALLV
pop
LABELV $169
endproc G_RunMissile 100 28
export fire_plasma
proc fire_plasma 20 4
ADDRFP4 8
ADDRFP4 8
INDIRP4
ASGNP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRGP4 VectorNormalize
CALLF4
pop
ADDRLP4 4
ADDRGP4 G_Spawn
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 524
ADDP4
ADDRGP4 $199
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 10000
ADDI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 G_ExplodeMissile
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 3
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 424
ADDP4
CNSTI4 128
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 192
ADDP4
CNSTI4 8
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 512
ADDP4
ADDRFP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 600
ADDP4
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 736
ADDP4
CNSTI4 20
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 740
ADDP4
CNSTI4 15
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 744
ADDP4
CNSTI4 20
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 748
ADDP4
CNSTI4 8
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 752
ADDP4
CNSTI4 9
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 572
ADDP4
CNSTI4 100663297
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 664
ADDP4
CNSTP4 0
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 12
ADDP4
CNSTI4 2
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 16
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 50
SUBI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 24
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
CNSTF4 1157234688
ADDRFP4 8
INDIRP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
CNSTF4 1157234688
ADDRFP4 8
INDIRP4
CNSTI4 4
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
CNSTF4 1157234688
ADDRFP4 8
INDIRP4
CNSTI4 8
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 8
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 12
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
ASGNP4
ADDRLP4 12
INDIRP4
ADDRLP4 12
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 16
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
ASGNP4
ADDRLP4 16
INDIRP4
ADDRLP4 16
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 488
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
RETP4
LABELV $198
endproc fire_plasma 20 4
export fire_grenade
proc fire_grenade 20 4
ADDRFP4 8
ADDRFP4 8
INDIRP4
ASGNP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRGP4 VectorNormalize
CALLF4
pop
ADDRLP4 4
ADDRGP4 G_Spawn
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 524
ADDP4
ADDRGP4 $203
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 2500
ADDI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 G_ExplodeMissile
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 3
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 424
ADDP4
CNSTI4 128
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 192
ADDP4
CNSTI4 4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 8
ADDP4
CNSTI4 32
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 512
ADDP4
ADDRFP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 600
ADDP4
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 736
ADDP4
CNSTI4 100
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 740
ADDP4
CNSTI4 100
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 744
ADDP4
CNSTI4 150
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 748
ADDP4
CNSTI4 4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 752
ADDP4
CNSTI4 5
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 572
ADDP4
CNSTI4 100663297
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 664
ADDP4
CNSTP4 0
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 12
ADDP4
CNSTI4 5
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 16
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 50
SUBI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 24
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
CNSTF4 1143930880
ADDRFP4 8
INDIRP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
CNSTF4 1143930880
ADDRFP4 8
INDIRP4
CNSTI4 4
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
CNSTF4 1143930880
ADDRFP4 8
INDIRP4
CNSTI4 8
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 8
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 12
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
ASGNP4
ADDRLP4 12
INDIRP4
ADDRLP4 12
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 16
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
ASGNP4
ADDRLP4 16
INDIRP4
ADDRLP4 16
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 488
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
RETP4
LABELV $202
endproc fire_grenade 20 4
export fire_bfg
proc fire_bfg 20 4
ADDRFP4 8
ADDRFP4 8
INDIRP4
ASGNP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRGP4 VectorNormalize
CALLF4
pop
ADDRLP4 4
ADDRGP4 G_Spawn
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 524
ADDP4
ADDRGP4 $207
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 10000
ADDI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 G_ExplodeMissile
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 3
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 424
ADDP4
CNSTI4 128
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 192
ADDP4
CNSTI4 9
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 512
ADDP4
ADDRFP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 600
ADDP4
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 736
ADDP4
CNSTI4 100
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 740
ADDP4
CNSTI4 100
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 744
ADDP4
CNSTI4 120
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 748
ADDP4
CNSTI4 12
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 752
ADDP4
CNSTI4 13
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 572
ADDP4
CNSTI4 100663297
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 664
ADDP4
CNSTP4 0
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 12
ADDP4
CNSTI4 2
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 16
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 50
SUBI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 24
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
CNSTF4 1157234688
ADDRFP4 8
INDIRP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
CNSTF4 1157234688
ADDRFP4 8
INDIRP4
CNSTI4 4
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
CNSTF4 1157234688
ADDRFP4 8
INDIRP4
CNSTI4 8
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 8
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 12
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
ASGNP4
ADDRLP4 12
INDIRP4
ADDRLP4 12
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 16
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
ASGNP4
ADDRLP4 16
INDIRP4
ADDRLP4 16
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 488
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
RETP4
LABELV $206
endproc fire_bfg 20 4
export fire_rocket
proc fire_rocket 20 4
ADDRFP4 8
ADDRFP4 8
INDIRP4
ASGNP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRGP4 VectorNormalize
CALLF4
pop
ADDRLP4 4
ADDRGP4 G_Spawn
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 524
ADDP4
ADDRGP4 $211
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 15000
ADDI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 G_ExplodeMissile
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 3
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 424
ADDP4
CNSTI4 128
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 192
ADDP4
CNSTI4 5
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 512
ADDP4
ADDRFP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 600
ADDP4
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 736
ADDP4
CNSTI4 100
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 740
ADDP4
CNSTI4 100
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 744
ADDP4
CNSTI4 120
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 748
ADDP4
CNSTI4 6
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 752
ADDP4
CNSTI4 7
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 572
ADDP4
CNSTI4 100663297
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 664
ADDP4
CNSTP4 0
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 12
ADDP4
CNSTI4 2
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 16
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 50
SUBI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 24
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
CNSTF4 1147207680
ADDRFP4 8
INDIRP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
CNSTF4 1147207680
ADDRFP4 8
INDIRP4
CNSTI4 4
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
CNSTF4 1147207680
ADDRFP4 8
INDIRP4
CNSTI4 8
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 8
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 12
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
ASGNP4
ADDRLP4 12
INDIRP4
ADDRLP4 12
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 16
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
ASGNP4
ADDRLP4 16
INDIRP4
ADDRLP4 16
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 488
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
RETP4
LABELV $210
endproc fire_rocket 20 4
export fire_grapple
proc fire_grapple 20 4
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 8
ADDRFP4 8
INDIRP4
ASGNP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRGP4 VectorNormalize
CALLF4
pop
ADDRLP4 4
ADDRGP4 G_Spawn
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 524
ADDP4
ADDRGP4 $152
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 10000
ADDI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 Weapon_HookFree
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 3
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 424
ADDP4
CNSTI4 128
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 192
ADDP4
CNSTI4 10
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 512
ADDP4
ADDRFP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 748
ADDP4
CNSTI4 28
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 572
ADDP4
CNSTI4 100663297
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 600
ADDP4
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 664
ADDP4
CNSTP4 0
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 12
ADDP4
CNSTI4 2
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 16
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 50
SUBI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 140
ADDP4
ADDRFP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 24
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
CNSTF4 1145569280
ADDRFP4 8
INDIRP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
CNSTF4 1145569280
ADDRFP4 8
INDIRP4
CNSTI4 4
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
CNSTF4 1145569280
ADDRFP4 8
INDIRP4
CNSTI4 8
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 8
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 12
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
ASGNP4
ADDRLP4 12
INDIRP4
ADDRLP4 12
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 16
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
ASGNP4
ADDRLP4 16
INDIRP4
ADDRLP4 16
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 488
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 760
ADDP4
ADDRLP4 0
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
RETP4
LABELV $214
endproc fire_grapple 20 4
export fire_nail
proc fire_nail 120 4
ADDRFP4 4
ADDRFP4 4
INDIRP4
ASGNP4
ADDRFP4 8
ADDRFP4 8
INDIRP4
ASGNP4
ADDRFP4 12
ADDRFP4 12
INDIRP4
ASGNP4
ADDRFP4 16
ADDRFP4 16
INDIRP4
ASGNP4
ADDRLP4 40
ADDRGP4 G_Spawn
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 40
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 524
ADDP4
ADDRGP4 $218
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 10000
ADDI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 G_ExplodeMissile
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 3
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 424
ADDP4
CNSTI4 128
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 192
ADDP4
CNSTI4 11
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 512
ADDP4
ADDRFP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 600
ADDP4
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 736
ADDP4
CNSTI4 20
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 748
ADDP4
CNSTI4 23
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 572
ADDP4
CNSTI4 100663297
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 664
ADDP4
CNSTP4 0
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 12
ADDP4
CNSTI4 2
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 16
ADDP4
ADDRGP4 level+32
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 24
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 44
ADDRGP4 qk_rand
CALLI4
ASGNI4
ADDRLP4 28
CNSTF4 1073741824
CNSTF4 1078530011
ADDRLP4 44
INDIRI4
CNSTI4 32767
BANDI4
CVIF4 4
CNSTF4 1191181824
DIVF4
MULF4
MULF4
ASGNF4
ADDRLP4 28
INDIRF4
ARGF4
ADDRLP4 48
ADDRGP4 qk_sin
CALLF4
ASGNF4
ADDRLP4 52
ADDRGP4 qk_rand
CALLI4
ASGNI4
ADDRLP4 32
CNSTF4 1098907648
CNSTF4 1140457472
ADDRLP4 48
INDIRF4
CNSTF4 1073741824
ADDRLP4 52
INDIRI4
CNSTI4 32767
BANDI4
CVIF4 4
CNSTF4 1191181824
DIVF4
CNSTF4 1056964608
SUBF4
MULF4
MULF4
MULF4
MULF4
ASGNF4
ADDRLP4 28
INDIRF4
ARGF4
ADDRLP4 56
ADDRGP4 qk_cos
CALLF4
ASGNF4
ADDRLP4 60
ADDRGP4 qk_rand
CALLI4
ASGNI4
ADDRLP4 28
CNSTF4 1098907648
CNSTF4 1140457472
ADDRLP4 56
INDIRF4
CNSTF4 1073741824
ADDRLP4 60
INDIRI4
CNSTI4 32767
BANDI4
CVIF4 4
CNSTF4 1191181824
DIVF4
CNSTF4 1056964608
SUBF4
MULF4
MULF4
MULF4
MULF4
ASGNF4
ADDRLP4 68
CNSTF4 1207959552
ASGNF4
ADDRLP4 4
ADDRFP4 4
INDIRP4
INDIRF4
ADDRLP4 68
INDIRF4
ADDRFP4 8
INDIRP4
INDIRF4
MULF4
ADDF4
ASGNF4
ADDRLP4 76
CNSTI4 4
ASGNI4
ADDRLP4 4+4
ADDRFP4 4
INDIRP4
ADDRLP4 76
INDIRI4
ADDP4
INDIRF4
ADDRLP4 68
INDIRF4
ADDRFP4 8
INDIRP4
ADDRLP4 76
INDIRI4
ADDP4
INDIRF4
MULF4
ADDF4
ASGNF4
ADDRLP4 80
CNSTI4 8
ASGNI4
ADDRLP4 4+8
ADDRFP4 4
INDIRP4
ADDRLP4 80
INDIRI4
ADDP4
INDIRF4
CNSTF4 1207959552
ADDRFP4 8
INDIRP4
ADDRLP4 80
INDIRI4
ADDP4
INDIRF4
MULF4
ADDF4
ASGNF4
ADDRLP4 4
ADDRLP4 4
INDIRF4
ADDRFP4 12
INDIRP4
INDIRF4
ADDRLP4 28
INDIRF4
MULF4
ADDF4
ASGNF4
ADDRLP4 4+4
ADDRLP4 4+4
INDIRF4
ADDRFP4 12
INDIRP4
CNSTI4 4
ADDP4
INDIRF4
ADDRLP4 28
INDIRF4
MULF4
ADDF4
ASGNF4
ADDRLP4 4+8
ADDRLP4 4+8
INDIRF4
ADDRFP4 12
INDIRP4
CNSTI4 8
ADDP4
INDIRF4
ADDRLP4 28
INDIRF4
MULF4
ADDF4
ASGNF4
ADDRLP4 4
ADDRLP4 4
INDIRF4
ADDRFP4 16
INDIRP4
INDIRF4
ADDRLP4 32
INDIRF4
MULF4
ADDF4
ASGNF4
ADDRLP4 4+4
ADDRLP4 4+4
INDIRF4
ADDRFP4 16
INDIRP4
CNSTI4 4
ADDP4
INDIRF4
ADDRLP4 32
INDIRF4
MULF4
ADDF4
ASGNF4
ADDRLP4 4+8
ADDRLP4 4+8
INDIRF4
ADDRFP4 16
INDIRP4
CNSTI4 8
ADDP4
INDIRF4
ADDRLP4 32
INDIRF4
MULF4
ADDF4
ASGNF4
ADDRLP4 16
ADDRLP4 4
INDIRF4
ADDRFP4 4
INDIRP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 16+4
ADDRLP4 4+4
INDIRF4
ADDRFP4 4
INDIRP4
CNSTI4 4
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 16+8
ADDRLP4 4+8
INDIRF4
ADDRFP4 4
INDIRP4
CNSTI4 8
ADDP4
INDIRF4
SUBF4
ASGNF4
ADDRLP4 16
ARGP4
ADDRGP4 VectorNormalize
CALLF4
pop
ADDRLP4 104
ADDRGP4 qk_rand
CALLI4
ASGNI4
ADDRLP4 36
CNSTF4 1155596288
ADDRLP4 104
INDIRI4
CNSTI4 32767
BANDI4
CVIF4 4
CNSTF4 1191181824
DIVF4
MULF4
CNSTF4 1141555200
ADDF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
ADDRLP4 16
INDIRF4
ADDRLP4 36
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
ADDRLP4 16+4
INDIRF4
ADDRLP4 36
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
ADDRLP4 16+8
INDIRF4
ADDRLP4 36
INDIRF4
MULF4
ASGNF4
ADDRLP4 108
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
ASGNP4
ADDRLP4 108
INDIRP4
ADDRLP4 108
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 112
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
ASGNP4
ADDRLP4 112
INDIRP4
ADDRLP4 112
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 116
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
ASGNP4
ADDRLP4 116
INDIRP4
ADDRLP4 116
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 488
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
RETP4
LABELV $217
endproc fire_nail 120 4
export fire_prox
proc fire_prox 20 4
ADDRFP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 8
ADDRFP4 8
INDIRP4
ASGNP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRGP4 VectorNormalize
CALLF4
pop
ADDRLP4 4
ADDRGP4 G_Spawn
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 524
ADDP4
ADDRGP4 $238
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 684
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 3000
ADDI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 688
ADDP4
ADDRGP4 G_ExplodeMissile
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 4
ADDP4
CNSTI4 3
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 424
ADDP4
CNSTI4 128
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 192
ADDP4
CNSTI4 12
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 8
ADDP4
CNSTI4 0
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 512
ADDP4
ADDRFP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 600
ADDP4
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 736
ADDP4
CNSTI4 0
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 740
ADDP4
CNSTI4 100
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 744
ADDP4
CNSTI4 150
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 748
ADDP4
CNSTI4 25
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 752
ADDP4
CNSTI4 25
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 572
ADDP4
CNSTI4 100663297
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 664
ADDP4
CNSTP4 0
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 756
ADDP4
CNSTI4 0
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 204
ADDP4
ADDRFP4 0
INDIRP4
CNSTI4 516
ADDP4
INDIRP4
CNSTI4 616
ADDP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 12
ADDP4
CNSTI4 5
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 16
ADDP4
ADDRGP4 level+32
INDIRI4
CNSTI4 50
SUBI4
ASGNI4
ADDRLP4 0
INDIRP4
CNSTI4 24
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
CNSTF4 1143930880
ADDRFP4 8
INDIRP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
CNSTF4 1143930880
ADDRFP4 8
INDIRP4
CNSTI4 4
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
CNSTF4 1143930880
ADDRFP4 8
INDIRP4
CNSTI4 8
ADDP4
INDIRF4
MULF4
ASGNF4
ADDRLP4 8
ADDRLP4 0
INDIRP4
CNSTI4 36
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 8
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 12
ADDRLP4 0
INDIRP4
CNSTI4 40
ADDP4
ASGNP4
ADDRLP4 12
INDIRP4
ADDRLP4 12
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 16
ADDRLP4 0
INDIRP4
CNSTI4 44
ADDP4
ASGNP4
ADDRLP4 16
INDIRP4
ADDRLP4 16
INDIRP4
INDIRF4
CVFI4 4
CVIF4 4
ASGNF4
ADDRLP4 0
INDIRP4
CNSTI4 488
ADDP4
ADDRFP4 4
INDIRP4
INDIRB
ASGNB 12
ADDRLP4 0
INDIRP4
RETP4
LABELV $237
endproc fire_prox 20 4
import trap_SnapVector
import trap_GeneticParentsAndChildSelection
import trap_BotResetWeaponState
import trap_BotFreeWeaponState
import trap_BotAllocWeaponState
import trap_BotLoadWeaponWeights
import trap_BotGetWeaponInfo
import trap_BotChooseBestFightWeapon
import trap_BotAddAvoidSpot
import trap_BotInitMoveState
import trap_BotFreeMoveState
import trap_BotAllocMoveState
import trap_BotPredictVisiblePosition
import trap_BotMovementViewTarget
import trap_BotReachabilityArea
import trap_BotResetLastAvoidReach
import trap_BotResetAvoidReach
import trap_BotMoveInDirection
import trap_BotMoveToGoal
import trap_BotResetMoveState
import trap_BotFreeGoalState
import trap_BotAllocGoalState
import trap_BotMutateGoalFuzzyLogic
import trap_BotSaveGoalFuzzyLogic
import trap_BotInterbreedGoalFuzzyLogic
import trap_BotFreeItemWeights
import trap_BotLoadItemWeights
import trap_BotUpdateEntityItems
import trap_BotInitLevelItems
import trap_BotSetAvoidGoalTime
import trap_BotAvoidGoalTime
import trap_BotGetLevelItemGoal
import trap_BotGetMapLocationGoal
import trap_BotGetNextCampSpotGoal
import trap_BotItemGoalInVisButNotVisible
import trap_BotTouchingGoal
import trap_BotChooseNBGItem
import trap_BotChooseLTGItem
import trap_BotGetSecondGoal
import trap_BotGetTopGoal
import trap_BotGoalName
import trap_BotDumpGoalStack
import trap_BotDumpAvoidGoals
import trap_BotEmptyGoalStack
import trap_BotPopGoal
import trap_BotPushGoal
import trap_BotResetAvoidGoals
import trap_BotRemoveFromAvoidGoals
import trap_BotResetGoalState
import trap_BotSetChatName
import trap_BotSetChatGender
import trap_BotLoadChatFile
import trap_BotReplaceSynonyms
import trap_UnifyWhiteSpaces
import trap_BotMatchVariable
import trap_BotFindMatch
import trap_StringContains
import trap_BotGetChatMessage
import trap_BotEnterChat
import trap_BotChatLength
import trap_BotReplyChat
import trap_BotNumInitialChats
import trap_BotInitialChat
import trap_BotNumConsoleMessages
import trap_BotNextConsoleMessage
import trap_BotRemoveConsoleMessage
import trap_BotQueueConsoleMessage
import trap_BotFreeChatState
import trap_BotAllocChatState
import trap_Characteristic_String
import trap_Characteristic_BInteger
import trap_Characteristic_Integer
import trap_Characteristic_BFloat
import trap_Characteristic_Float
import trap_BotFreeCharacter
import trap_BotLoadCharacter
import trap_EA_ResetInput
import trap_EA_GetInput
import trap_EA_EndRegular
import trap_EA_View
import trap_EA_Move
import trap_EA_DelayedJump
import trap_EA_Jump
import trap_EA_SelectWeapon
import trap_EA_MoveRight
import trap_EA_MoveLeft
import trap_EA_MoveBack
import trap_EA_MoveForward
import trap_EA_MoveDown
import trap_EA_MoveUp
import trap_EA_Crouch
import trap_EA_Respawn
import trap_EA_Use
import trap_EA_Attack
import trap_EA_Talk
import trap_EA_Gesture
import trap_EA_Action
import trap_EA_Command
import trap_EA_SayTeam
import trap_EA_Say
import trap_AAS_PredictClientMovement
import trap_AAS_Swimming
import trap_AAS_AlternativeRouteGoals
import trap_AAS_PredictRoute
import trap_AAS_EnableRoutingArea
import trap_AAS_AreaTravelTimeToGoalArea
import trap_AAS_AreaReachability
import trap_AAS_IntForBSPEpairKey
import trap_AAS_FloatForBSPEpairKey
import trap_AAS_VectorForBSPEpairKey
import trap_AAS_ValueForBSPEpairKey
import trap_AAS_NextBSPEntity
import trap_AAS_PointContents
import trap_AAS_TraceAreas
import trap_AAS_PointReachabilityAreaIndex
import trap_AAS_PointAreaNum
import trap_AAS_Time
import trap_AAS_PresenceTypeBoundingBox
import trap_AAS_Initialized
import trap_AAS_EntityInfo
import trap_AAS_AreaInfo
import trap_AAS_BBoxAreas
import trap_BotUserCommand
import trap_BotGetServerCommand
import trap_BotGetSnapshotEntity
import trap_BotLibTest
import trap_BotLibUpdateEntity
import trap_BotLibLoadMap
import trap_BotLibStartFrame
import trap_BotLibDefine
import trap_BotLibVarGet
import trap_BotLibVarSet
import trap_BotLibShutdown
import trap_BotLibSetup
import trap_DebugPolygonDelete
import trap_DebugPolygonCreate
import trap_GetEntityToken
import trap_GetUsercmd
import trap_BotFreeClient
import trap_BotAllocateClient
import trap_EntityContact
import trap_EntitiesInBox
import trap_UnlinkEntity
import trap_LinkEntity
import trap_AreasConnected
import trap_AdjustAreaPortalState
import trap_InPVSIgnorePortals
import trap_InPVS
import trap_PointContents
import trap_Trace
import trap_SetBrushModel
import trap_GetServerinfo
import trap_SetUserinfo
import trap_GetUserinfo
import trap_GetConfigstring
import trap_SetConfigstring
import trap_SendServerCommand
import trap_DropClient
import trap_LocateGameData
import trap_Cvar_VariableStringBuffer
import trap_Cvar_VariableValue
import trap_Cvar_VariableIntegerValue
import trap_Cvar_Set
import trap_Cvar_Update
import trap_Cvar_Register
import trap_SendConsoleCommand
import trap_FS_Seek
import trap_FS_GetFileList
import trap_FS_FCloseFile
import trap_FS_Write
import trap_FS_Read
import trap_FS_FOpenFile
import trap_Args
import trap_Argv
import trap_Argc
import trap_RealTime
import trap_Milliseconds
import trap_Error
import trap_Print
import g_proxMineTimeout
import g_singlePlayer
import g_enableBreath
import g_enableDust
import g_rankings
import pmove_msec
import pmove_fixed
import g_smoothClients
import g_blueteam
import g_redteam
import g_cubeTimeout
import g_obeliskRespawnDelay
import g_obeliskRegenAmount
import g_obeliskRegenPeriod
import g_obeliskHealth
import g_filterBan
import g_banIPs
import g_teamForceBalance
import g_teamAutoJoin
import g_allowVote
import g_blood
import g_doWarmup
import g_warmup
import g_motd
import g_synchronousClients
import g_weaponTeamRespawn
import g_weaponRespawn
import g_debugDamage
import g_debugAlloc
import g_debugMove
import g_inactivity
import g_forcerespawn
import g_quadfactor
import g_knockback
import g_speed
import g_gravity
import g_needpass
import g_password
import g_friendlyFire
import g_capturelimit
import g_timelimit
import g_fraglimit
import g_dmflags
import g_restarted
import g_maxGameClients
import g_maxclients
import g_cheats
import g_dedicated
import g_gametype
import g_entities
import level
import Pickup_Team
import CheckTeamStatus
import TeamplayInfoMessage
import Team_GetLocationMsg
import Team_GetLocation
import SelectCTFSpawnPoint
import Team_FreeEntity
import Team_ReturnFlag
import Team_InitGame
import Team_CheckHurtCarrier
import Team_FragBonuses
import Team_DroppedFlagThink
import AddTeamScore
import TeamColorString
import TeamName
import OtherTeam
import BotTestAAS
import BotAIStartFrame
import BotAIShutdownClient
import BotAISetupClient
import BotAILoadMap
import BotAIShutdown
import BotAISetup
import BotInterbreedEndMatch
import Svcmd_BotList_f
import Svcmd_AddBot_f
import G_BotConnect
import G_RemoveQueuedBotBegin
import G_CheckBotSpawn
import G_GetBotInfoByName
import G_GetBotInfoByNumber
import G_InitBots
import Svcmd_AbortPodium_f
import SpawnModelsOnVictoryPads
import UpdateTournamentInfo
import G_WriteSessionData
import G_InitWorldSession
import G_InitSessionData
import G_ReadSessionData
import Svcmd_GameMem_f
import G_InitMemory
import G_Alloc
import CheckObeliskAttack
import Team_CheckDroppedItem
import OnSameTeam
import G_RunClient
import ClientEndFrame
import ClientThink
import ClientCommand
import ClientBegin
import ClientDisconnect
import ClientUserinfoChanged
import ClientConnect
import G_Error
import G_Printf
import SendScoreboardMessageToAllClients
import G_LogPrintf
import AddTournamentQueue
import G_RunThink
import CheckTeamLeader
import SetLeader
import FindIntermissionPoint
import MoveClientToIntermission
import DeathmatchScoreboardMessage
import G_StartKamikaze
import FireWeapon
import G_FilterPacket
import G_ProcessIPBans
import ConsoleCommand
import SpotWouldTelefrag
import CalculateRanks
import AddScore
import player_die
import ClientSpawn
import InitBodyQue
import BeginIntermission
import ClientRespawn
import CopyToBodyQue
import SelectSpawnPoint
import SetClientViewAngle
import PickTeam
import TeamLeader
import TeamCount
import Weapon_HookThink
import Weapon_HookFree
import CheckGauntletAttack
import SnapVectorTowards
import CalcMuzzlePoint
import LogAccuracyHit
import DropPortalDestination
import DropPortalSource
import TeleportPlayer
import trigger_teleporter_touch
import Touch_DoorTrigger
import G_RunMover
import TossClientCubes
import TossClientPersistantPowerups
import TossClientItems
import body_die
import G_InvulnerabilityEffect
import G_RadiusDamage
import G_Damage
import CanDamage
import BuildShaderStateConfig
import AddRemap
import G_SetOrigin
import G_AddEvent
import G_AddPredictableEvent
import vectoyaw
import vtos
import tv
import G_TouchTriggers
import G_EntitiesFree
import G_FreeEntity
import G_Sound
import G_TempEntity
import G_Spawn
import G_InitGentity
import G_SetMovedir
import G_UseTargets
import G_PickTarget
import G_Find
import G_KillBox
import G_TeamCommand
import G_SoundIndex
import G_ModelIndex
import SaveRegisteredItems
import RegisterItem
import ClearRegisteredItems
import Touch_Item
import Add_Ammo
import ArmorIndex
import Think_Weapon
import FinishSpawningItem
import G_SpawnItem
import SetRespawn
import LaunchItem
import Drop_Item
import PrecacheItem
import UseHoldableItem
import RespawnItem
import G_RunItem
import G_CheckTeamItems
import Cmd_FollowCycle_f
import SetTeam
import BroadcastTeamChange
import StopFollowing
import Cmd_Score_f
import G_NewString
import G_SpawnEntitiesFromString
import G_SpawnVector
import G_SpawnInt
import G_SpawnFloat
import G_SpawnString
import BG_PlayerTouchesItem
import BG_PlayerStateToEntityStateExtraPolate
import BG_PlayerStateToEntityState
import BG_TouchJumpPad
import BG_AddPredictableEventToPlayerstate
import BG_EvaluateTrajectoryDelta
import BG_EvaluateTrajectory
import BG_CanItemBeGrabbed
import BG_FindItemForHoldable
import BG_FindItemForPowerup
import BG_FindItemForWeapon
import BG_FindItem
import bg_numItems
import bg_itemlist
import Pmove
import PM_UpdateViewAngles
import Com_Printf
import Com_Error
import Info_NextPair
import Info_Validate
import Info_SetValueForKey_Big
import Info_SetValueForKey
import Info_RemoveKey_Big
import Info_RemoveKey
import Info_ValueForKey
import Com_TruncateLongString
import va
import Q_CountChar
import Q_CleanStr
import Q_PrintStrlen
import Q_strcat
import Q_strncpyz
import Q_stristr
import Q_strupr
import Q_strlwr
import Q_stricmpn
import Q_strncmp
import Q_stricmp
import Q_isintegral
import Q_isanumber
import Q_isalpha
import Q_isupper
import Q_islower
import Q_isprint
import Com_RandomBytes
import Com_SkipCharset
import Com_SkipTokens
import Com_sprintf
import Com_HexStrToInt
import Parse3DMatrix
import Parse2DMatrix
import Parse1DMatrix
import SkipRestOfLine
import SkipBracedSection
import COM_MatchToken
import COM_ParseWarning
import COM_ParseError
import COM_Compress
import COM_ParseExt
import COM_Parse
import COM_GetCurrentParseLine
import COM_BeginParseSession
import COM_DefaultExtension
import COM_CompareExtension
import COM_StripExtension
import COM_GetExtension
import COM_SkipPath
import Com_Clamp
import PerpendicularVector
import AngleVectors
import MatrixMultiply
import MakeNormalVectors
import RotateAroundDirection
import RotatePointAroundVector
import ProjectPointOnPlane
import PlaneFromPoints
import AngleDelta
import AngleNormalize180
import AngleNormalize360
import AnglesSubtract
import AngleSubtract
import LerpAngle
import AngleMod
import BoundsIntersectPoint
import BoundsIntersectSphere
import BoundsIntersect
import BoxOnPlaneSide
import SetPlaneSignbits
import AxisCopy
import AxisClear
import AnglesToAxis
import vectoangles
import Q_crandom
import Q_random
import Q_rand
import Q_acos
import Q_log2
import VectorRotate
import Vector4Scale
import VectorNormalize2
import VectorNormalize
import CrossProduct
import VectorInverse
import VectorNormalizeFast
import DistanceSquared
import Distance
import VectorLengthSquared
import VectorLength
import VectorCompare
import AddPointToBounds
import ClearBounds
import RadiusFromBounds
import NormalizeColor
import ColorBytes4
import ColorBytes3
import _VectorMA
import _VectorScale
import _VectorCopy
import _VectorAdd
import _VectorSubtract
import _DotProduct
import ByteToDir
import DirToByte
import ClampShort
import ClampChar
import Q_rsqrt
import Q_fabs
import Q_isnan
import axisDefault
import vec3_origin
import g_color_table
import colorDkGrey
import colorMdGrey
import colorLtGrey
import colorWhite
import colorCyan
import colorMagenta
import colorYellow
import colorBlue
import colorGreen
import colorRed
import colorBlack
import bytedirs
import Hunk_AllocDebug
import FloatSwap
import LongSwap
import ShortSwap
import CopyLongSwap
import CopyShortSwap
import qk_acos
import qk_fabs
import qk_abs
import qk_tan
import qk_atan2
import qk_cos
import qk_sin
import qk_sqrt
import qk_floor
import qk_ceil
import qk_memcpy
import qk_memset
import qk_memmove
import qk_sscanf
import qk_vsnprintf
import qk_strtol
import qk_atoi
import qk_strtod
import qk_atof
import qk_toupper
import qk_tolower
import qk_strncpy
import qk_strstr
import qk_strrchr
import qk_strchr
import qk_strcmp
import qk_strcpy
import qk_strcat
import qk_strlen
import qk_rand
import qk_srand
import qk_qsort
lit
align 1
LABELV $238
byte 1 112
byte 1 114
byte 1 111
byte 1 120
byte 1 32
byte 1 109
byte 1 105
byte 1 110
byte 1 101
byte 1 0
align 1
LABELV $218
byte 1 110
byte 1 97
byte 1 105
byte 1 108
byte 1 0
align 1
LABELV $211
byte 1 114
byte 1 111
byte 1 99
byte 1 107
byte 1 101
byte 1 116
byte 1 0
align 1
LABELV $207
byte 1 98
byte 1 102
byte 1 103
byte 1 0
align 1
LABELV $203
byte 1 103
byte 1 114
byte 1 101
byte 1 110
byte 1 97
byte 1 100
byte 1 101
byte 1 0
align 1
LABELV $199
byte 1 112
byte 1 108
byte 1 97
byte 1 115
byte 1 109
byte 1 97
byte 1 0
align 1
LABELV $152
byte 1 104
byte 1 111
byte 1 111
byte 1 107
byte 1 0
align 1
LABELV $104
byte 1 112
byte 1 114
byte 1 111
byte 1 120
byte 1 109
byte 1 105
byte 1 110
byte 1 101
byte 1 95
byte 1 116
byte 1 114
byte 1 105
byte 1 103
byte 1 103
byte 1 101
byte 1 114
byte 1 0
align 1
LABELV $103
byte 1 115
byte 1 111
byte 1 117
byte 1 110
byte 1 100
byte 1 47
byte 1 119
byte 1 101
byte 1 97
byte 1 112
byte 1 111
byte 1 110
byte 1 115
byte 1 47
byte 1 112
byte 1 114
byte 1 111
byte 1 120
byte 1 109
byte 1 105
byte 1 110
byte 1 101
byte 1 47
byte 1 119
byte 1 115
byte 1 116
byte 1 98
byte 1 116
byte 1 105
byte 1 99
byte 1 107
byte 1 46
byte 1 119
byte 1 97
byte 1 118
byte 1 0
|
source/directories/machine-apple-darwin/a-hifina.adb | ytomino/drake | 33 | 3456 | with Ada.Exception_Identification.From_Here;
package body Ada.Hierarchical_File_Names is
use Exception_Identification.From_Here;
function Parent_Directory_Name (
Level : Positive)
return String;
function Parent_Directory_Name (
Level : Positive)
return String is
begin
return Result : String (1 .. 3 * Level - 1) do
Result (1) := '.';
Result (2) := '.';
for I in 2 .. Level loop
Result (I * 3 - 3) := '/';
Result (I * 3 - 2) := '.';
Result (I * 3 - 1) := '.';
end loop;
end return;
end Parent_Directory_Name;
function Current_Directory_Name return String is (".");
procedure Containing_Root_Directory (Name : String; Last : out Natural);
procedure Containing_Root_Directory (Name : String; Last : out Natural) is
begin
Last := Name'First - 1;
while Last < Name'Last and then Is_Path_Delimiter (Name (Last + 1)) loop
Last := Last + 1;
end loop;
end Containing_Root_Directory;
procedure Exclude_Trailing_Directories (
Directory : String;
Last : in out Natural;
Level : in out Natural);
procedure Exclude_Trailing_Directories (
Directory : String;
Last : in out Natural;
Level : in out Natural)
is
R_Last : Natural;
begin
Exclude_Trailing_Path_Delimiter (Directory, Last);
Containing_Root_Directory (
Directory (Directory'First .. Last),
Last => R_Last); -- First - 1 if not Is_Full_Name (...)
while Last > R_Last loop
declare
S_First : Positive;
S_Last : Natural;
begin
Simple_Name (
Directory (Directory'First .. Last),
First => S_First,
Last => S_Last);
if Is_Current_Directory_Name (Directory (S_First .. S_Last)) then
null; -- skip "./"
elsif Is_Parent_Directory_Name (Directory (S_First .. S_Last)) then
Level := Level + 1;
elsif Level = 0 then
exit;
else
Level := Level - 1;
end if;
-- Containing_Directory (Directory (First .. Last), ...)
Last := S_First - 1;
Exclude_Trailing_Path_Delimiter (Directory, Last);
end;
end loop;
end Exclude_Trailing_Directories;
-- path delimiter
function Is_Path_Delimiter (Item : Character) return Boolean is
begin
return Item = '/';
end Is_Path_Delimiter;
procedure Include_Trailing_Path_Delimiter (
S : in out String;
Last : in out Natural;
Path_Delimiter : Path_Delimiter_Type := Default_Path_Delimiter)
is
pragma Unreferenced (Path_Delimiter);
begin
if not Is_Path_Delimiter (S (Last)) then
Last := Last + 1;
S (Last) := '/';
end if;
end Include_Trailing_Path_Delimiter;
procedure Exclude_Trailing_Path_Delimiter (
S : String;
Last : in out Natural) is
begin
while Last > S'First -- no removing root path delimiter
and then Is_Path_Delimiter (S (Last))
loop
Last := Last - 1;
end loop;
end Exclude_Trailing_Path_Delimiter;
-- operations in Ada.Directories
function Simple_Name (Name : String) return String is
First : Positive;
Last : Natural;
begin
Simple_Name (Name, First => First, Last => Last);
if First > Last then
Raise_Exception (Name_Error'Identity); -- CXAG002
end if;
return Name (First .. Last);
end Simple_Name;
function Unchecked_Simple_Name (Name : String) return String is
First : Positive;
Last : Natural;
begin
Simple_Name (Name, First => First, Last => Last);
return Name (First .. Last);
end Unchecked_Simple_Name;
function Containing_Directory (Name : String) return String is
First : Positive;
Last : Natural;
Error : Boolean;
begin
Containing_Directory (Name, First => First, Last => Last);
Error := First > Last;
if not Error then
-- ignore trailing delimiters on error-checking
Error := True;
for I in reverse Last + 1 .. Name'Last loop
if not Is_Path_Delimiter (Name (I)) then
Error := False;
exit;
end if;
end loop;
end if;
if Error then
Raise_Exception (Use_Error'Identity); -- RM A.16.1(38/3)
end if;
return Name (First .. Last);
end Containing_Directory;
function Unchecked_Containing_Directory (Name : String) return String is
First : Positive;
Last : Natural;
begin
Containing_Directory (Name, First => First, Last => Last);
return Name (First .. Last);
end Unchecked_Containing_Directory;
function Extension (Name : String) return String is
First : Positive;
Last : Natural;
begin
Extension (Name, First => First, Last => Last);
return Name (First .. Last);
end Extension;
function Base_Name (Name : String) return String is
First : Positive;
Last : Natural;
begin
Base_Name (Name, First => First, Last => Last);
return Name (First .. Last);
end Base_Name;
procedure Simple_Name (
Name : String;
First : out Positive;
Last : out Natural) is
begin
First := Name'First;
Last := Name'Last;
for I in reverse Name'Range loop
if Is_Path_Delimiter (Name (I)) then
First := I + 1;
exit; -- found
end if;
end loop;
end Simple_Name;
procedure Containing_Directory (
Name : String;
First : out Positive;
Last : out Natural) is
begin
First := Name'First;
Last := Name'First - 1;
for I in reverse Name'Range loop
if Is_Path_Delimiter (Name (I)) then
if I > First then
Last := I - 1;
-- "//" as "/"
Exclude_Trailing_Path_Delimiter (Name, Last => Last);
else
Last := I; -- no removing root path delimiter
end if;
exit; -- found
end if;
end loop;
end Containing_Directory;
procedure Extension (
Name : String;
First : out Positive;
Last : out Natural) is
begin
First := Name'Last + 1;
Last := Name'Last;
for I in reverse Name'Range loop
if Is_Path_Delimiter (Name (I)) then
exit; -- not found
elsif Name (I) = '.' then
-- Extension (".DOTFILE") = ""
if I > Name'First
and then not Is_Path_Delimiter (Name (I - 1))
then
First := I + 1;
end if;
exit; -- found
end if;
end loop;
end Extension;
procedure Base_Name (
Name : String;
First : out Positive;
Last : out Natural) is
begin
Simple_Name (Name, First => First, Last => Last);
if First > Last or else Name (Last) /= '.' then -- AA-A-16 79.a/2
for I in reverse First .. Last - 1 loop
if Name (I) = '.' then
-- Base_Name (".DOTFILE") = ".DOTFILE"
if I > First then
Last := I - 1;
end if;
exit;
end if;
end loop;
end if;
end Base_Name;
-- operations in Ada.Directories.Hierarchical_File_Names
function Is_Simple_Name (Name : String) return Boolean is
begin
for I in Name'Range loop
if Is_Path_Delimiter (Name (I)) then
return False;
end if;
end loop;
return True;
end Is_Simple_Name;
function Is_Root_Directory_Name (Name : String) return Boolean is
Last : Natural;
begin
Containing_Root_Directory (Name, Last => Last);
return Name'First <= Last and then Last = Name'Last;
end Is_Root_Directory_Name;
function Is_Parent_Directory_Name (Name : String) return Boolean is
begin
return Name = "..";
end Is_Parent_Directory_Name;
function Is_Current_Directory_Name (Name : String) return Boolean is
begin
return Name = ".";
end Is_Current_Directory_Name;
function Is_Full_Name (Name : String) return Boolean is
begin
return Name'First <= Name'Last
and then Is_Path_Delimiter (Name (Name'First));
end Is_Full_Name;
function Is_Relative_Name (Name : String) return Boolean is
begin
return not Is_Full_Name (Name);
end Is_Relative_Name;
function Initial_Directory (Name : String) return String is
First : Positive;
Last : Natural;
begin
Initial_Directory (Name, First => First, Last => Last);
return Name (First .. Last);
end Initial_Directory;
function Relative_Name (Name : String) return String is
First : Positive;
Last : Natural;
begin
Relative_Name (Name, First => First, Last => Last);
if First > Last then
Raise_Exception (Name_Error'Identity); -- CXAG002
end if;
return Name (First .. Last);
end Relative_Name;
function Unchecked_Relative_Name (Name : String) return String is
First : Positive;
Last : Natural;
begin
Relative_Name (Name, First => First, Last => Last);
return Name (First .. Last);
end Unchecked_Relative_Name;
procedure Initial_Directory (
Name : String;
First : out Positive;
Last : out Natural) is
begin
First := Name'First;
if Is_Full_Name (Name) then -- full
Last := Name'First; -- Name (First .. Last) = "/"
else -- relative
Last := Name'Last;
for I in Name'Range loop
if Is_Path_Delimiter (Name (I)) then
Last := I - 1;
exit; -- found
end if;
end loop;
end if;
end Initial_Directory;
procedure Relative_Name (
Name : String;
First : out Positive;
Last : out Natural) is
begin
First := Name'Last + 1;
Last := Name'Last;
for I in Name'Range loop
if Is_Path_Delimiter (Name (I)) then
First := I + 1;
-- "//" as "/"
while First <= Last and then Is_Path_Delimiter (Name (First)) loop
First := First + 1;
end loop;
exit; -- found
end if;
end loop;
end Relative_Name;
function Compose (
Directory : String := "";
Relative_Name : String;
Extension : String := "";
Path_Delimiter : Path_Delimiter_Type := Default_Path_Delimiter)
return String
is
pragma Check (Pre,
Check =>
Directory'Length = 0
or else Is_Relative_Name (Relative_Name)
or else raise Name_Error); -- CXAG002
pragma Unreferenced (Path_Delimiter);
Directory_Length : constant Natural := Directory'Length;
Relative_Name_Length : constant Natural := Relative_Name'Length;
Extension_Length : constant Natural := Extension'Length;
Result : String (
1 .. Directory_Length + Relative_Name_Length + Extension_Length + 2);
Last : Natural;
begin
-- append directory
Last := Directory_Length;
if Last > 0 then
Result (1 .. Last) := Directory;
Include_Trailing_Path_Delimiter (Result, Last => Last);
end if;
-- append name
Result (Last + 1 .. Last + Relative_Name_Length) := Relative_Name;
Last := Last + Relative_Name_Length;
-- append extension
if Extension_Length /= 0 then
Last := Last + 1;
Result (Last) := '.';
Result (Last + 1 .. Last + Extension_Length) := Extension;
Last := Last + Extension_Length;
end if;
return Result (1 .. Last);
end Compose;
function Normalized_Compose (
Directory : String := "";
Relative_Name : String;
Extension : String := "";
Path_Delimiter : Path_Delimiter_Type := Default_Path_Delimiter)
return String
is
pragma Unreferenced (Path_Delimiter);
Parent_Count : Natural := 0;
C_D_Last : Natural; -- Containing_Directory (Directory)
R_R_First : Positive; -- Relative_Name (Relative_Name)
R_R_Last : Natural;
begin
R_R_First := Relative_Name'First;
R_R_Last := Relative_Name'Last;
while R_R_First <= R_R_Last loop
declare
I_R_First : Positive; -- Initial_Directory (Relative_Name)
I_R_Last : Natural;
begin
Initial_Directory (
Relative_Name (R_R_First .. R_R_Last),
First => I_R_First,
Last => I_R_Last);
if Is_Current_Directory_Name (
Relative_Name (I_R_First .. I_R_Last))
then
Hierarchical_File_Names.Relative_Name (
Relative_Name (R_R_First .. R_R_Last),
First => R_R_First,
Last => R_R_Last);
elsif Is_Parent_Directory_Name (
Relative_Name (I_R_First .. I_R_Last))
then
Parent_Count := Parent_Count + 1;
Hierarchical_File_Names.Relative_Name (
Relative_Name (R_R_First .. R_R_Last),
First => R_R_First,
Last => R_R_Last);
else
exit;
end if;
end;
end loop;
C_D_Last := Directory'Last;
Exclude_Trailing_Directories (
Directory,
Last => C_D_Last,
Level => Parent_Count);
if Parent_Count > 0 then
return Compose (
Compose (
Directory (Directory'First .. C_D_Last),
Parent_Directory_Name (
Parent_Count)),
Relative_Name (R_R_First .. R_R_Last),
Extension);
elsif Directory'First > C_D_Last
and then R_R_First > R_R_Last
and then (Directory'Length > 0 or else Relative_Name'Length > 0)
and then Extension'Length = 0
then
return Current_Directory_Name;
else
return Compose (
Directory (Directory'First .. C_D_Last),
Relative_Name (R_R_First .. R_R_Last),
Extension);
end if;
end Normalized_Compose;
function Relative_Name (
Name : String;
From : String;
Path_Delimiter : Path_Delimiter_Type := Default_Path_Delimiter)
return String
is
pragma Unreferenced (Path_Delimiter);
R_N_First : Positive := Name'First;
R_N_Last : Natural := Name'Last;
Parent_Count : Natural := 0;
begin
Relative_Name (
Name => Name,
First => R_N_First,
Last => R_N_Last,
From => From,
Parent_Count => Parent_Count);
if Parent_Count > 0 then
if R_N_First > R_N_Last then
return Parent_Directory_Name (
Parent_Count);
else
return Compose (
Parent_Directory_Name (
Parent_Count),
Name (R_N_First .. R_N_Last));
end if;
elsif R_N_First > R_N_Last then
return Current_Directory_Name;
else
return Name (R_N_First .. R_N_Last);
end if;
end Relative_Name;
procedure Relative_Name (
Name : String;
First : out Positive;
Last : out Natural;
From : String;
Parent_Count : out Natural) is
begin
if Is_Full_Name (Name) /= Is_Full_Name (From) then
-- Relative_Name ("A", "/B") or reverse
Raise_Exception (Use_Error'Identity);
else
First := Name'First;
Last := Name'Last;
Parent_Count := 0;
declare
R_F_First : Positive := From'First;
R_F_Last : Natural := From'Last;
begin
-- remove same part
while First <= Last and then R_F_First <= R_F_Last loop
declare
I_N_First : Positive; -- Initial_Directory (Name)
I_N_Last : Natural;
I_F_First : Positive; -- Initial_Directory (From)
I_F_Last : Natural;
begin
Initial_Directory (
Name (First .. Last),
First => I_N_First,
Last => I_N_Last);
Initial_Directory (
From (R_F_First .. R_F_Last),
First => I_F_First,
Last => I_F_Last);
if Name (I_N_First .. I_N_Last) =
From (I_F_First .. I_F_Last)
then
Relative_Name (
Name (First .. Last),
First => First,
Last => Last);
Relative_Name (
From (R_F_First .. R_F_Last),
First => R_F_First,
Last => R_F_Last);
else
exit;
end if;
end;
end loop;
-- strip "./" in remainder of Name
while First <= Last loop
declare
I_N_First : Positive; -- Initial_Directory (Name)
I_N_Last : Natural;
begin
Initial_Directory (
Name (First .. Last),
First => I_N_First,
Last => I_N_Last);
exit when not Is_Current_Directory_Name (
Name (I_N_First .. I_N_Last));
Relative_Name (
Name (First .. Last),
First => First,
Last => Last);
end;
end loop;
-- remainder of From
while R_F_First <= R_F_Last loop
declare
I_F_First : Positive; -- Initial_Directory (From)
I_F_Last : Natural;
begin
Initial_Directory (
From (R_F_First .. R_F_Last),
First => I_F_First,
Last => I_F_Last);
if Is_Current_Directory_Name (
From (I_F_First .. I_F_Last))
then
null; -- skip "./" of From
elsif Is_Parent_Directory_Name (
From (I_F_First .. I_F_Last))
then
if Parent_Count > 0 then
Parent_Count := Parent_Count - 1;
else
-- Relative_Name ("A", "..")
Raise_Exception (Use_Error'Identity);
end if;
else
Parent_Count := Parent_Count + 1;
end if;
Relative_Name (
From (R_F_First .. R_F_Last),
First => R_F_First,
Last => R_F_Last);
end;
end loop;
end;
end if;
end Relative_Name;
function Parent_Directory (
Directory : String;
Path_Delimiter : Path_Delimiter_Type := Default_Path_Delimiter)
return String
is
pragma Unreferenced (Path_Delimiter);
First : Positive;
Last : Natural;
Parent_Count : Natural;
begin
Parent_Directory (
Directory,
First => First,
Last => Last,
Parent_Count => Parent_Count);
if Parent_Count > 0 then
if First <= Last then -- Parent_Directory ("/")
-- raise Use_Error ?
return Compose (
Directory (First .. Last),
Parent_Directory_Name (
Parent_Count));
else
return Parent_Directory_Name (
Parent_Count);
end if;
elsif First > Last then
return Current_Directory_Name;
else
return Directory (First .. Last);
end if;
end Parent_Directory;
procedure Parent_Directory (
Directory : String;
First : out Positive;
Last : out Natural;
Parent_Count : out Natural) is
begin
First := Directory'First;
Last := Directory'Last;
Parent_Count := 1;
Exclude_Trailing_Directories (
Directory,
Last => Last,
Level => Parent_Count);
end Parent_Directory;
end Ada.Hierarchical_File_Names;
|
lab_11/01-buttonclick/main.asm | ak-karimzai/asm | 0 | 364 | ; Name : buttonclick.asm
;
; Build : nasm -felf64 -o buttonclick.o -l buttonclick.lst buttonclick.asm
; ld -s -m elf_x86_64 buttonclick.o -o buttonclick -lc --dynamic-linker /lib64/ld-linux-x86-64.so.2 `pkg-config --libs gtk+-2.0`
; Description : events and signals intro
;
; Remark : run this program from a terminal
;
; C - source : http://zetcode.com/tutorials/gtktutorial/gtkevents/
; asm - source: https://github.com/agguro/gtk-programming
;
bits 64
[list -]
extern exit
extern gtk_button_new_with_label
extern gtk_container_add
extern gtk_fixed_new
extern gtk_fixed_put
extern gtk_init
extern gtk_main
extern gtk_main_quit
extern gtk_widget_set_size_request
extern gtk_widget_show_all
extern gtk_window_new
extern gtk_window_set_default_size
extern gtk_window_set_position
extern gtk_window_set_title
extern g_print
extern g_signal_connect_data
extern gtk_spin_button_new_with_range
extern gtk_button_new_with_label
extern gtk_label_new
extern gtk_label_set_text
extern gtk_spin_button_get_value_as_int
extern g_strdup_printf
extern g_free
%define GTK_WIN_POS_CENTER 1
%define GTK_WINDOW_TOPLEVEL 0
%define NULL 0
[list +]
section .data
window:
.handle: dq 0
.title: db "GtkButton", 0
fixed:
.handle: dq 0
button:
.handle: dq 0
.label: db "Click", 0
button_new:
.handle: dq 0
.label: db "Add", 0
res_label:
.handle: dq 0
.label: dq "0", 0
int_format dq "Res: %d", 0
spin_a:
.handle dq 0
spin_b:
.handle dq 0
res_str: dq 0
signal:
.clicked: db "clicked", 0
.destroy: db "destroy", 0
message:
.clicked: db "Clicked", 10, 0
section .text
global _start
_start:
xor rdi, rdi ; no commandline arguments will be passed
xor rsi, rsi
call gtk_init
mov rdi, GTK_WINDOW_TOPLEVEL
call gtk_window_new
mov qword[window.handle], rax
mov rsi, window.title
mov rdi, qword[window.handle]
call gtk_window_set_title
mov rdx, 200
mov rsi, 260
mov rdi, qword[window.handle]
call gtk_window_set_default_size
mov rsi, GTK_WIN_POS_CENTER
mov rdi, qword[window.handle]
call gtk_window_set_position
call gtk_fixed_new
mov qword[fixed.handle], rax
mov rsi, qword[fixed.handle]
mov rdi, qword[window.handle]
call gtk_container_add
mov rdi, button_new.label
call gtk_button_new_with_label
mov qword[button_new.handle], rax
mov rcx, 150
mov rdx, 70
mov rsi, qword[button_new.handle]
mov rdi, qword[fixed.handle]
call gtk_fixed_put
mov rdx, 35
mov rsi, 100
mov rdi, qword[button_new.handle]
call gtk_widget_set_size_request
mov rdi, __?float64?__(-2147483648.0)
movq XMM0, rdi
mov rsi, __?float64?__(+2147483647.0)
movq XMM1, rsi
mov rdx, __?float64?__(1.0)
movq XMM2, rdx
call gtk_spin_button_new_with_range
mov qword[spin_a.handle], rax
mov rcx, 20
mov rdx, 8
mov rsi, qword[spin_a.handle]
mov rdi, qword[fixed.handle]
call gtk_fixed_put
mov rdx, 0
mov rsi, 250
mov rdi, qword[spin_a.handle]
call gtk_widget_set_size_request
mov rdi, __?float64?__(-2147483648.0)
movq XMM0, rdi
mov rsi, __?float64?__(+2147483647.0)
movq XMM1, rsi
mov rdx, __?float64?__(1.0)
movq XMM2, rdx
call gtk_spin_button_new_with_range
mov qword[spin_b.handle], rax
mov rcx, 60
mov rdx, 8
mov rsi, qword[spin_b.handle]
mov rdi, qword[fixed.handle]
call gtk_fixed_put
mov rdx, 0
mov rsi, 250
mov rdi, qword[spin_b.handle]
call gtk_widget_set_size_request
call gtk_label_new
mov qword[res_label.handle], rax
mov rdi,qword[res_label.handle]
mov rsi,res_label.label
call gtk_label_set_text
mov rcx, 100
mov rdx, 20
mov rsi, qword[res_label.handle]
mov rdi, qword[fixed.handle]
call gtk_fixed_put
mov rdx, 35
mov rsi, 200
mov rdi, qword[res_label.handle]
call gtk_widget_set_size_request
xor r9d, r9d
xor r8d, r8d
mov rcx, NULL
mov rdx, button_clicked
mov rsi, signal.clicked
mov rdi, qword[button_new.handle]
call g_signal_connect_data
xor r9d, r9d
xor r8d, r8d
mov rcx, NULL
mov rdx, gtk_main_quit
mov rsi, signal.destroy
mov rdi, qword[window.handle]
call g_signal_connect_data
mov rdi, qword[window.handle]
call gtk_widget_show_all
call gtk_main
xor rdi, rdi
call exit
button_clicked:
push rsi
mov rdi, qword[spin_a]
call gtk_spin_button_get_value_as_int
mov rdx, rax
mov rdi, qword[spin_b]
call gtk_spin_button_get_value_as_int
add rdx, rax
mov rcx, rdx
mov rsi, rcx
mov rax, 1
mov rdi, int_format
call g_strdup_printf
mov [res_str], rax
mov rdi, qword[res_label.handle]
mov rsi, [res_str]
call gtk_label_set_text
mov rdi, [res_str]
call g_free
mov qword[res_str], 0
pop rsi
ret |
cv/cvlibrar.asm | DigitalMars/optlink | 28 | 163376 | <gh_stars>10-100
TITLE CVLIBRAR - Copyright (c) SLR Systems 1994
INCLUDE MACROS
INCLUDE LIBRARY
INCLUDE IO_STRUC
PUBLIC CV_LIBRARIES
.DATA
EXTERNDEF CV_TEMP_RECORD:BYTE
EXTERNDEF MAX_LIBNUM:DWORD,CURNMOD_NUMBER:DWORD,CV_LIBRARY_TYPE:DWORD,BYTES_SO_FAR:DWORD
EXTERNDEF FIRST_CV_LIB_GINDEX:DWORD
EXTERNDEF LIBRARY_GARRAY:STD_PTR_S
EXTERNDEF CV_DWORD_ALIGN:DWORD
.CODE PASS2_TEXT
EXTERNDEF HANDLE_CV_INDEX:PROC,_xdebug_write:proc,_move_file_list_gindex_nfn:proc
CV_LIB_VARS STRUC
MY_FILNAM_BP NFN_STRUCT <>
CV_LIB_VARS ENDS
FIX MACRO X
X EQU ([EBP - SIZE CV_LIB_VARS].(X&_BP))
ENDM
FIX MY_FILNAM
CV_LIBRARIES PROC
;
;OUTPUT LIST OF LIBRARY NAMES USED IN INDEX ORDER...
;
CALL CV_DWORD_ALIGN
MOV EAX,FIRST_CV_LIB_GINDEX
XOR ECX,ECX
TEST EAX,EAX
JZ L9$
PUSHM EBP,EDI,ESI,EBX
MOV EBP,ESP
SUB ESP,SIZE CV_LIB_VARS
ASSUME EBP:PTR CV_LIB_VARS
MOV EDI,OFF CV_TEMP_RECORD+1
MOV ESI,EAX
MOV EAX,BYTES_SO_FAR
PUSH EAX
MOV [EDI-1],CL ;FIRST IS NUL
L1$:
CONVERT ESI,ESI,LIBRARY_GARRAY
ASSUME ESI:PTR LIBRARY_STRUCT
MOV EAX,[ESI]._LS_NEXT_CV_GINDEX
PUSH EAX
CALL DO_LIBRARY
POP ESI
MOV EDI,OFF CV_TEMP_RECORD
TEST ESI,ESI
JNZ L1$
MOV CURNMOD_NUMBER,-1
BITT CV_4_TYPE
JNZ L2$
INC CURNMOD_NUMBER
L2$:
;
;NOW, DO INDEX ENTRY
;
POP EAX
MOV ECX,CV_LIBRARY_TYPE
CALL HANDLE_CV_INDEX
CALL CV_DWORD_ALIGN
MOV ESP,EBP
POPM EBX,ESI,EDI,EBP
L9$:
RET
CV_LIBRARIES ENDP
DO_LIBRARY PROC NEAR PRIVATE
;
;DX IS LIBRARY # TO FIND, SAVE DX AND CX
;
;FOUND LIBRARY, NOW OUTPUT NAME TEXT PLEASE
;
MOV ECX,[ESI]._LS_FILE_LIST_GINDEX
LEA EAX,MY_FILNAM
push ECX
push EAX
call _move_file_list_gindex_nfn ;STICKS IN SEARCH PATH IF THERE WAS ONE
add ESP,8
MOV ECX,MY_FILNAM.NFN_TOTAL_LENGTH
LEA ESI,MY_FILNAM.NFN_TEXT
MOV [EDI],CL
INC EDI
AND ECX,0FFH ;JUST IN CASE
REP MOVSB
push EDI
call _xdebug_write
add ESP,4
ret
DO_LIBRARY ENDP
END
|
src/Ninu.Emulator.Tests/Cpu/TestFiles/stores.6502.asm | jorgy343/Ninu | 0 | 246543 | <filename>src/Ninu.Emulator.Tests/Cpu/TestFiles/stores.6502.asm
.include "..\..\..\Cpu\TestFiles\std.6502.asm"
; These tests do not currently purposefully test flags. All tests that have offset addressing modes
; are designed to wrap around to a new page to test buggy wrapping behavior where applicable.
* = $0000
.byte $00 ; Tell the assembler to start assembling at $0000.
; sta indirect zero page with x offset - test 1
* = $72
.addr $2345
; sta indirect zero page with y offset
* = $d0
.addr $44ff
; sta indirect zero page with x offset - test 2
* = $ff
.addr $3456
; Start program at 0x1000 so we can freely store data in zero page.
* = $1000
.init
; Data setup.
lda #$a1
ldx #$a2
ldy #$a3
; sta
sta $d0 ; zero page
sta $d0,x ; zero page with x offset
sta $a0d0 ; absolute
sta $a0d0,x ; absolute with x offset
sta $a0d0,y ; absolute with y offset
sta ($d0,x) ; indirect zero page with x offset - test 1
sta ($5d,x) ; indirect zero page with x offset - test 2
sta ($d0),y ; indirect zero page with y offset
; stx
stx $b0 ; zero page
stx $b0,y ; zero page with x offset
stx $b0e0 ; absolute
; sty
sty $c0 ; zero page
sty $c0,x ; zero page with x offset
sty $c0f0 ; absolute
.done
* = $fff0
rti
* = $fffa
nmiVector .addr $fff0
resetVector .addr $1000
irqVector .addr $fff0 |
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_1850_1101.asm | ljhsiun2/medusa | 9 | 95475 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1da70, %rsi
lea addresses_UC_ht+0x15970, %rdi
sub %r14, %r14
mov $30, %rcx
rep movsq
nop
nop
and $17772, %r10
lea addresses_A_ht+0x1dc70, %rsi
lea addresses_normal_ht+0x13270, %rdi
nop
and $58190, %r8
mov $82, %rcx
rep movsb
nop
nop
nop
nop
nop
dec %rsi
lea addresses_WC_ht+0x1c70, %r14
inc %rbp
mov (%r14), %rcx
xor $47648, %rsi
lea addresses_normal_ht+0x14c70, %rsi
lea addresses_D_ht+0x1ec70, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
sub $23199, %r11
mov $100, %rcx
rep movsw
sub $6156, %r14
lea addresses_UC_ht+0x1e744, %r10
clflush (%r10)
nop
nop
cmp $58777, %rdi
mov $0x6162636465666768, %rcx
movq %rcx, (%r10)
nop
nop
nop
xor %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %rax
push %rbp
push %rbx
push %rsi
// Store
lea addresses_A+0x14e16, %r14
clflush (%r14)
nop
nop
nop
and $55969, %r15
movl $0x51525354, (%r14)
nop
nop
sub %r12, %r12
// Load
lea addresses_A+0x1dc70, %rbp
nop
nop
nop
inc %rax
mov (%rbp), %bx
nop
nop
nop
add $8147, %r15
// Store
lea addresses_US+0x6070, %rax
nop
nop
nop
and %r12, %r12
movb $0x51, (%rax)
nop
nop
and %r14, %r14
// Load
lea addresses_D+0x2470, %r14
clflush (%r14)
nop
nop
nop
nop
nop
sub %r12, %r12
mov (%r14), %rax
nop
and %r14, %r14
// Store
lea addresses_A+0x9470, %rsi
nop
nop
nop
cmp %r12, %r12
movl $0x51525354, (%rsi)
and $13960, %rsi
// Faulty Load
lea addresses_A+0x1dc70, %rbx
clflush (%rbx)
nop
nop
nop
xor $1804, %r14
mov (%rbx), %r12
lea oracles, %rbx
and $0xff, %r12
shlq $12, %r12
mov (%rbx,%r12,1), %r12
pop %rsi
pop %rbx
pop %rbp
pop %rax
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'00': 1850}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
AirMessage/AppleScript/AppleScriptSource/FaceTime/handleIncomingCall.applescript | ryanspecter/airmessage-server-next | 23 | 4201 | --Accepts or rejects a pending incoming call
on main(accept)
tell application "System Events"
--Make sure the notification exists
if not (exists group 1 of UI element 1 of scroll area 1 of window 1 of application process "NotificationCenter") then
return false
end if
--Get the first notification
set notificationGroup to group 1 of UI element 1 of scroll area 1 of window 1 of application process "NotificationCenter"
--Handle the call
if accept then
set buttonAccept to button 1 of notificationGroup
click buttonAccept
else
set buttonReject to button 2 of notificationGroup
click buttonReject
end if
return true
end tell
end main
|
Cubical/Categories/Instances/DistLattice.agda | FernandoLarrain/cubical | 1 | 14632 | {-# OPTIONS --safe #-}
module Cubical.Categories.Instances.DistLattice where
open import Cubical.Foundations.Prelude
open import Cubical.Algebra.DistLattice
open import Cubical.Categories.Category
open import Cubical.Categories.Instances.Lattice
open Category
DistLatticeCategory : ∀ {ℓ} (L : DistLattice ℓ) → Category ℓ ℓ
DistLatticeCategory L = LatticeCategory (DistLattice→Lattice L)
|
Prueba PPI/PRUEBA PPI.asm | alfreedom/Z80-ASM-Programs | 0 | 28539 | <reponame>alfreedom/Z80-ASM-Programs
LD A,080h
OUT (03h),A
LD A,0FFh
CICLO: OUT (00h),A
OUT (01h),A
OUT (02h),A
JP CICLO |
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/printi16.asm | gb-archive/really-old-stuff | 10 | 2211 | #include once <printnum.asm>
#include once <div16.asm>
#include once <neg16.asm>
#include once <attr.asm>
__PRINTI16: ; Prints a 16bits signed in HL
; Converts 16 to 32 bits
PROC
LOCAL __PRINTU_LOOP
ld a, h
or a
jp p, __PRINTU16
call __PRINT_MINUS
call __NEGHL
__PRINTU16:
ld b, 0
__PRINTU_LOOP:
ld a, h
or l
jp z, __PRINTU_START
push bc
ld de, 10
call __DIVU16_FAST ; Divides by DE. DE = MODULUS at exit. Since < 256, E = Modulus
pop bc
ld a, e
or '0' ; Stores ASCII digit (must be print in reversed order)
push af
inc b
jp __PRINTU_LOOP ; Uses JP in loops
ENDP
|
src/css-core-groups.ads | stcarrez/ada-css | 3 | 24199 | -----------------------------------------------------------------------
-- css-core-groups -- CSS rule to represent a group of CSS rules
-- Copyright (C) 2017 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with CSS.Core.Vectors;
package CSS.Core.Groups is
type CSSGroupingRule is new CSS.Core.CSSRule with record
Rules : CSS.Core.Vectors.Vector;
end record;
type CSSGroupingRule_Access is access all CSSGroupingRule'Class;
-- Get the type that identifies the rule.
overriding
function Get_Type (Rule : in CSSGroupingRule) return CSSRule_Type;
end CSS.Core.Groups;
|
nasm/assgnment1/p2.asm | codingneverends/assembly | 0 | 175701 | section .data
msg1 :db 'Enter your name : ',9
l1 : equ $-msg1
section .bss
name : resb 1
l : resb 1
section .text
global _start:
_start:
mov eax, 4
mov ebx, 1
mov ecx, msg1
mov edx, l1
int 80h
mov eax, 3
mov ebx, 0
mov ecx, name
mov edx, l
int 80h
mov eax, 4
mov ebx, 1
mov ecx, name
mov edx, l
int 80h
mov eax, 1
mov ebx, 0
int 80h |
Mail To Things.scpt | phuna/EmailsToThings | 4 | 692 | --
-- Properties to be adjusted:
--
-- Here we specify if we want tot truncate the message (1) or not (0)
property truncateMsg : 1
-- in case we truncate, specify the length (number of chars)
property truncateLength : 500
-- here set a due date offset in number of days
-- eg. 1 ==> Due date Today + 1, i.e. Tomorrow
-- if < 0 (eg. -1) then no due date
property dueDateOffset : 1
-- Variables
set todoNotes to ""
set todoName to ""
set todoTags to ""
tell application "Mail"
activate
set selectedMsgs to selection
if selectedMsgs is {} then
display dialog "Please select one or more messages" with icon 1
return
end if
set theMessage to item 1 of selectedMsgs
set theSubject to subject of theMessage
set theContent to ((content of theMessage) as rich text)
-- Check for a blank subject line,
if theSubject is missing value then
set theSubject to "No Subject"
end if
-- End check
set theID to message id of theMessage as string
set theSenderName to sender of theMessage
set theTxtContent to theContent
if (truncateMsg is 1) then
if length of theTxtContent > truncateLength then
set theTxtContent to (rich text 1 through truncateLength of theTxtContent) & "[...]"
end if
end if
set todoName to theSubject
set todoNotes to "[url=message:%3C" & theID & "%3E]" & theSenderName & " // " & theSubject & "[/url]" & linefeed & "Sent: " & date sent of theMessage & linefeed & linefeed & theTxtContent
set todoTypes to {"Response", "Action", "Watch", "ToRead"}
set answer to (choose from list todoTypes with prompt "Choose one." without multiple selections allowed) as rich text
if answer is not "false" then
set todoTags to answer
end if
if (dueDateOffset < 0) then
set theDueDate to missing value
else
set theDueDate to (current date) + dueDateOffset * days
end if
if todoTags is not "" then
tell application "Things"
set newToDo to make new to do with properties {name:todoName, notes:todoNotes, tag names:todoTags} at beginning of list "Inbox"
if (theDueDate is not missing value) then
set due date of newToDo to theDueDate
end if
end tell
display notification "Task \"" & todoName & "\" added" with title "Mail to Things"
end if
end tell
|
libsrc/z80_crt0s/r2k/sccz80/l_mult.asm | jpoikela/z88dk | 38 | 240646 |
SECTION code_crt0_sccz80
PUBLIC l_mult
; Entry: hl = value1
; de = value2
; Exit: hl = value1 * value2
.l_mult
ld c,l
ld b,h
defb 0xf7 ; mul : hlbc = bc * de
ld l,c
ld h,b
ret
|
src/GBA.Input.ads | 98devin/ada-gba-dev | 7 | 9804 | -- Copyright (c) 2021 <NAME>
-- zlib License -- see LICENSE for details.
with GBA.Memory.IO_Registers;
package GBA.Input is
type Key is
( A_Button
, B_Button
, Select_Button
, Start_Button
, Right_Direction
, Left_Direction
, Up_Direction
, Down_Direction
, Left_Shoulder
, Right_Shoulder
)
with Size => 16;
for Key use
( A_Button => 0
, B_Button => 1
, Select_Button => 2
, Start_Button => 3
, Right_Direction => 4
, Left_Direction => 5
, Up_Direction => 6
, Down_Direction => 7
, Left_Shoulder => 8
, Right_Shoulder => 9
);
type Key_Flags is mod 2**10
with Size => 16;
type Key_Set is array (Key) of Boolean
with Pack, Size => 16;
function To_Flags (S : Key_Set) return Key_Flags
with Inline_Always;
function To_Flags (K : Key) return Key_Flags
with Inline_Always;
function "or" (K1, K2 : Key) return Key_Flags
with Pure_Function, Inline_Always;
function "or" (F : Key_Flags; K : Key) return Key_Flags
with Pure_Function, Inline_Always;
function Read_Key_State return Key_Flags
with Inline_Always;
function Read_Key_State return Key_Set
with Inline_Always;
procedure Disable_Input_Interrupt_Request;
procedure Request_Interrupt_If_Key_Pressed(K : Key);
procedure Request_Interrupt_If_Any_Pressed(F : Key_Flags);
procedure Request_Interrupt_If_All_Pressed(F : Key_Flags);
-- Unsafe Interface --
type Key_Control_Op is
( Disjunction, Conjunction );
for Key_Control_Op use
( Disjunction => 0, Conjunction => 1 );
type Key_Control_Info is
record
Flags : Key_Flags;
Interrupt_Requested : Boolean;
Interrupt_Op : Key_Control_Op;
end record
with Size => 16;
for Key_Control_Info use
record
Flags at 0 range 0 .. 9;
Interrupt_Requested at 0 range 14 .. 14;
Interrupt_Op at 0 range 15 .. 15;
end record;
use GBA.Memory.IO_Registers;
Key_Input : Key_Flags
with Import, Address => KEYINPUT;
Key_Control : Key_Control_Info
with Import, Address => KEYCNT;
end GBA.Input; |
examples/stm32f0/dma/main.adb | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 1979 | with STM32GD.Board; use STM32GD.Board;
with STM32GD.USART; use STM32GD.USART;
procedure Main is
RX_Buffer : USART_Data (1 .. 16);
RX_Count : Natural;
begin
Init;
LED.Set;
while True loop
USART.DMA_Receive (10, RX_Buffer, RX_Count);
LED.Toggle;
if RX_Count > 0 then
USART.DMA_Transmit (RX_Buffer, RX_Count);
end if;
end loop;
end Main;
|
Transynther/x86/_processed/NONE/_st_/i9-9900K_12_0xa0.log_21829_1741.asm | ljhsiun2/medusa | 9 | 102504 | <filename>Transynther/x86/_processed/NONE/_st_/i9-9900K_12_0xa0.log_21829_1741.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r13
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x1c736, %r12
nop
nop
nop
nop
nop
add $30021, %rdi
movl $0x61626364, (%r12)
nop
nop
xor $35342, %rsi
lea addresses_D_ht+0x1e706, %r13
cmp %r11, %r11
vmovups (%r13), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rdx
nop
nop
nop
nop
sub $55334, %rdx
lea addresses_A_ht+0x11b36, %rsi
nop
cmp %r10, %r10
movl $0x61626364, (%rsi)
nop
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_WT_ht+0x7636, %r10
nop
nop
and %rdx, %rdx
mov (%r10), %r11w
nop
nop
nop
dec %r13
lea addresses_normal_ht+0xa736, %rsi
lea addresses_A_ht+0x9976, %rdi
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov $116, %rcx
rep movsq
cmp $1703, %rdi
lea addresses_WC_ht+0x3336, %r12
nop
inc %rdi
movl $0x61626364, (%r12)
nop
nop
nop
nop
xor $64455, %rdi
lea addresses_A_ht+0xcd36, %r13
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov (%r13), %di
nop
nop
and $10000, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r13
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
// Load
lea addresses_WT+0x7636, %r9
nop
nop
nop
xor $37213, %rdi
mov (%r9), %ebp
sub %rbx, %rbx
// Store
mov $0x436, %rdi
nop
nop
and %rcx, %rcx
mov $0x5152535455565758, %r9
movq %r9, (%rdi)
nop
xor $59839, %rbx
// Store
lea addresses_WT+0x17336, %rdi
nop
nop
nop
nop
cmp $45943, %rcx
movl $0x51525354, (%rdi)
nop
nop
nop
nop
xor %rbp, %rbp
// Store
mov $0x5c70f200000005d6, %rdx
nop
nop
nop
nop
sub $26110, %rcx
movb $0x51, (%rdx)
nop
nop
nop
sub $35068, %rbp
// Store
lea addresses_WT+0xfef6, %rdi
nop
nop
nop
nop
sub $33070, %rcx
mov $0x5152535455565758, %rdx
movq %rdx, %xmm5
movups %xmm5, (%rdi)
nop
nop
nop
nop
and %rdx, %rdx
// Faulty Load
lea addresses_WC+0xa336, %rdx
add $55580, %r11
movb (%rdx), %bl
lea oracles, %r9
and $0xff, %rbx
shlq $12, %rbx
mov (%r9,%rbx,1), %rbx
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_P', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_NC', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': True, 'congruent': 8, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'54': 21829}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54
*/
|
examples/zfp/systick/monotonic_counter.ads | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 12009 | <filename>examples/zfp/systick/monotonic_counter.ads
with Interfaces; use Interfaces;
package Monotonic_Counter is
Counter : Unsigned_32;
Overflow : Boolean;
procedure Reset;
end Monotonic_Counter;
|
oeis/132/A132384.asm | neoneye/loda-programs | 11 | 28331 | <filename>oeis/132/A132384.asm
; A132384: a(n) = Sum_{ k <= n, k is not an i-th power with i >= 2} k.
; Submitted by <NAME>
; 1,3,6,6,11,17,24,24,24,34,45,57,70,84,99,99,116,134,153,173,194,216,239,263,263,289,289,317,346,376,407,407,440,474,509,509,546,584,623,663,704,746,789,833,878,924,971,1019,1019,1069,1120,1172,1225,1279
mov $2,$0
mov $5,$0
lpb $2
mov $0,$5
sub $2,1
sub $0,$2
mov $6,$0
add $6,1
mov $7,0
mov $8,$0
lpb $6
mov $0,$8
mov $4,2
sub $6,1
lpb $0
mov $3,$0
seq $3,326186 ; a(n) = n - A057521(n), where A057521 gives the powerful part of n.
mov $0,$3
add $0,$3
mov $4,$3
lpe
mov $3,$4
sub $3,1
add $7,$3
lpe
mul $7,$4
add $1,$7
lpe
mov $0,$1
div $0,2
add $0,1
|
source/variable.asm | paulscottrobson/Basic65816 | 0 | 21412 | <reponame>paulscottrobson/Basic65816
; *******************************************************************************************
; *******************************************************************************************
;
; Name : variable.asm
; Purpose : Expression Evaluation
; Date : 7th June 2019
; Author : <EMAIL>
;
; *******************************************************************************************
; *******************************************************************************************
; *******************************************************************************************
;
; Attempt to locate the variable expression at the current code pointer. If it doesn't
; exist return an error.
;
; Store the address of its data in DVariablePtr. Return this in YA with CS if it is
; a string value, CC if it is an integer.
;
; This is only used by the Expression function, should not be called directly.
;
; *******************************************************************************************
VariableAccessExpression:
;
; find the variable. this also sets up the DHashPtr to point to the link.
;
lda (DCodePtr) ; get the first token, push on stack
pha
jsr VariableFind ; try to find the variables
sta DVariablePtr ; store the result in DVariablePtr
bcc _VANError ; not found, so report an error.
;
; apply subscripting if array.
;
pla ; get and save that first token
pha ; we use it for typing.
tay ; put first token in Y.
and #IDArrayMask ; is it an array ?
beq _VANNotArray
;
; Subscript it. If you do this DVariablePtr points to record+4 - the high subscript
;
lda DVariablePtr ; variable pointer into A
jsr VariableSubscript ; index calculation
sta DVariablePtr ; and write it back.
;
; Get value and type.
;
_VANNotArray:
pla ; get the token back.
and #IDTypeMask ; this is the integer/string bit. $2000 if string, $0000 if int
eor #IDTypeMask ; now $0000 if string, $2000 if integer.
beq _VANIsString ; if zero, Y = 0 and just load the lower address with the variable (string)
;
; Returning a number.
;
clc ; returning a number, read high data word
ldy #2
lda (DVariablePtr),y
tay ; put A into Y (this is the high byte)
lda (DVariablePtr) ; read the low data word
rts
;
; Returning a string.
;
_VANIsString:
ldy #0 ; load string into YA
lda (DVariablePtr)
bne _VANNotEmptyString
lda #Block_NullString ; if value is $0000 then return the empty string
clc ; which is always maintained.
adc DBaseAddress
_VANNotEmptyString:
sec
rts
_VANError:
#error "Variable unknown"
; *******************************************************************************************
;
; Find a variable at codeptr. Identify the hash table and hash entry and store the
; address in DHashPtr. Search down the list looking for the variable ; if it exists,
; return its data record address in A with CS, and skip the variable tokens.
;
; If it doesn't exist, return CC and leave the token where it is.
;
; *******************************************************************************************
VariableFind:
;
; check it's an identifier token
;
lda (DCodePtr) ; look at the first token
cmp #$C000 ; must be $C000-$FFFF, an identifier.
bcc _VFError
;
; check if it's a "fast variable" A-Z
;
cmp #$C01A+1 ; C01A is identifier, no continuation Z
bcs _VFSlowVariable ; < this it is the fast variable A-Z
;
; Fast Variable
;
and #$001F ; now it is 1-26.
dec a ; now 0-25
asl a ; x 4 and clear carry
asl a
adc #Block_FastVariables ; offset to fast variables
adc DBaseAddress ; now an actual address in A
;
inc DCodePtr ; skip over the token (only one)
inc DCodePtr
sec ; return with carry set.
rts
;
; Variable in the linked list. First identify which linked list.
;
_VFSlowVariable:
;
; Figure out which hash table to use, there are four integer/string
; and single value/array.
;
lda (DCodePtr) ; get the token
and #(IDTypeMask+IDArrayMask) ; get the type bits out --tt ---- ---- ----
xba ; now this is 0000 0000 00tt 0000 e.g. tt x 16
;
asl a ; 32 bytes (16 x 2 byteentries) per table, also clc
adc #Block_HashTable ; now its the correct has table offset
adc DBaseAddress ; now the actual address
sta DTemp1 ; so this is the base of the hash table for the type
;
; Figure out which hash entry.
;
lda (DCodePtr) ; get the token - building the hash code.
and #Block_HashMask ; now a mask value, very simple but okay I think.
asl a ; double (word entries) and clear carry
adc DTemp1 ; add to the base hash table
sta DHashTablePtr ; save pointer for later
sta DTemp1 ; save in DTemp1, which we will use to follow the chain.
;
; Search the next element in the chain, looking for a particular variable.
;
_VFNext:
lda (DTemp1) ; normally the link, first time will be the header.
beq _VFFail ; if zero, then it's the end of the list.
;
; Valid variable record, check if it's the one we want.
;
sta DTemp1 ; this is the new variable record to check
tay ; read the address of the name at $0002,y
lda $0002,y
sta DTemp2 ; save in DTemp2
;
; Check the name of this record (DTemp2) against the one we're finding (CodePtr)
;
ldy #0 ; start matching lists of tokens, we can do it in words
_VFCompare:
lda (DTemp2),y ; see if they match
cmp (DCodePtr),y
bne _VFNext ; if not, go to the next one.
iny ; advance token pointer
iny
and #IDContMask ; if continuation bit set, keep going (if they match)
bne _VFCompare
;
; Found it - the token lists match.
;
tya ; this is the length of the word.
clc ; so we add it to the code pointer
adc DCodePtr
sta DCodePtr ; now points to the token after the identifier.
;
lda DTemp1 ; this is the variable record
clc ; four on is the actual data
adc #4 ; or it's the reference for the data for arrays.
;
sec ; return with CS indicating success
rts
;
_VFFail: ; didn't find the variable
clc
rts
_VFError:
#error "Missing variable"
; *******************************************************************************************
;
; Subscript an Array Entry. On entry A points to the link to the data, X is the level.
;
; *******************************************************************************************
VariableSubscript:
;
; Get the address of the data block for the array.
;
phy ; save Y
tay ; put the link pointer into Y
lda $0000,y ; read the link, this is the array data block.
pha ; save array data block address on stack.
;
; Get the subscript and check it is 0-65535
;
jsr EvaluateNextInteger ; get the subscript
jsr ExpectRightBracket ; skip right bracket.
cpy #0 ; msword must be zero
bne _VANSubscript
;
; Compare the subscript against the max index at the start of the memory block.
;
ply ; start of array memory block.
cmp $0000,y ; the max index is at the start, so check against that.
beq _VANSubOkay ; fail if subscript > high subscript
bcs _VANSubscript
_VANSubOkay:
;
; Convert to a data address
;
asl a ; double lsword
asl a ; and again, also clears carry.
sta DTemp1 ; 4 x subscript in DTemp1
tya ; restore the address of the array memory block.
inc a ; add 2 to get it past the high subscript
inc a
clc
adc DTemp1 ; add the subscript x 4
ply ; restore Y
rts
_VANSubscript:
#error "Bad Array Subscript"
; *******************************************************************************************
;
; Create a new variable.
;
; *** VariableFind needs to have been called first so DHashPtr is set up ***
;
; DCodePtr points to the token.
;
; On exit A contains the address of the data part of the record (e.g. at +4)
;
;
; *******************************************************************************************
VariableCreate:
;
; Allocate space - 8 bytes always.
;
ldy #Block_LowMemoryPtr ; get low memory
lda (DBaseAddress),y
pha ; save it
clc
adc #8
sta (DBaseAddress),y ; update low memory
;
; Check we are okay on memory.
;
ldy #Block_HighMemoryPtr ; check allocation.
cmp (DBaseAddress),y
bcs _VCOutOfMemory
ply ; restore new variable address to Y.
;
; Clear the data space.
;
lda #$0000 ; clear that word to empty string/zero.
sta $0004,y ; data from +4..+7 is zeroed.
sta $0006,y
;
; Now set it up, put the original hash first link as this record's link
; e.g. insert it into the front of the linked list.
;
lda (DHashTablePtr) ; get the link to next.
sta $0000,y ; save at offset +0
;
; Set up the token. If the token is in the tokenised space used for typed in
; commands (e.g. we've typed a3 = 42 at the keyboard) that token needs to be
; copied, because the reference will disappear.
;
lda #Block_ProgramStart ; work out the program start
clc ; in DTemp1.
adc DBaseAddress
sta DTemp1
;
; If the token address is < program start it's in the token buffer and needs
; duplicating.
;
lda DCodePtr ; get the address of the token.
cmp DTemp1 ; if it is below the program start we need to clone it.
bcs _VCDontClone ; because the variable being created has its identifier
jsr VCCloneIdentifier ; in the token workspace, done via the command line
_VCDontClone:
;
; Update the token address word in the new variable record.
;
sta $0002,y ; save at offset +2
;
; The record is now complete, so put it in the head of the hash table linked list.
;
tya ; update the head link
sta (DHashTablePtr)
clc ; advance pointer to the data part.
adc #4
pha ; save on stack.
;
; Consume the identifier token
;
_VCSkipToken:
lda (DCodePtr) ; skip over the token
inc DCodePtr
inc DCodePtr
and #IDContMask ; if there is a continuation
bne _VCSkipToken
pla ; restore data address
rts ; and done.
;
_VCOutOfMemory:
brl OutOfMemoryError
;
; Clone the identifier at A. Used when we can't use a program token to name
; a new variable, because we did it at the keyboard. This will hardly ever
; be used :)
;
VCCloneIdentifier:
phx ; save XY
phy
tax ; identifier address in Y.
ldy #Block_LowMemoryPtr ; get low memory address, this will be the new identifier.
lda (DBaseAddress),y
pha
_VCCloneLoop:
ldy #Block_LowMemoryPtr ; get low memory
lda (DBaseAddress),y
pha ; save on stack
inc a ; space for one token.
inc a
sta (DBaseAddress),y
ply ; address of word in Y
lda @w$0000,x ; read the token
sta $0000,y ; copy it into that new byte.
inx ; advance the token pointer
inx
and #IDContMask ; continuation ?
bne _VCCloneLoop
;
pla ; restore start address
ply ; and the others
plx
rts
|
source/league/league-pretty_printers.ads | svn2github/matreshka | 24 | 29268 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015-2017, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This project provides facilities for pretty printing texts.
--
-- User creates documents from strings, new lines and empty documents,
-- composes them toghether with append, indent them as required and marks
-- logicaly parts as groups to fold new lines all together when all parts of
-- a group fits desired width. Resulting document is formatted then to given
-- width by printer.
--
with League.Strings;
with League.String_Vectors;
private with Ada.Containers.Vectors;
private with Ada.Containers.Hashed_Maps;
package League.Pretty_Printers is
type Printer is tagged limited private;
type Printer_Access is access all Printer'Class;
type Document is tagged private;
not overriding function New_Document
(Self : access Printer'Class) return Document;
-- Create empty document
not overriding function Put
(Self : Document'Class;
Right : League.Strings.Universal_String) return Document;
-- Append a string to given document
not overriding procedure Put
(Self : in out Document;
Right : League.Strings.Universal_String);
-- Append a string to given document
not overriding function Put
(Self : Document'Class;
Right : Wide_Wide_String) return Document;
-- Append a string to given document
not overriding procedure Put
(Self : in out Document;
Right : Wide_Wide_String);
-- Append a string to given document
not overriding procedure Put_Line
(Self : in out Document;
Right : Wide_Wide_String);
-- Append a string to given document and then new line
not overriding function New_Line
(Self : Document'Class;
Gap : Wide_Wide_String := " ") return Document;
-- Append a new line to given document
not overriding procedure New_Line
(Self : in out Document;
Gap : Wide_Wide_String := " ");
-- Append a new line to given document
not overriding function Nest
(Self : Document'Class;
Indent : Natural) return Document;
-- Create document where each new line appended with Indent spaces
not overriding procedure Nest
(Self : in out Document;
Indent : Natural);
-- Append each new line with Indent spaces
not overriding function Append
(Self : Document'Class;
Right : Document'Class) return Document;
-- Create document as join text from two documents
not overriding procedure Append
(Self : in out Document;
Right : Document'Class);
-- Append a document to Self
not overriding function Group (Self : Document'Class) return Document;
-- Group all new lines in Self documend to fold them altogether
not overriding procedure Group
(Self : in out Document);
-- Group all new lines in Self documend to fold them altogether
function Pretty
(Self : in out Printer;
Width : Positive;
Input : Document'Class)
return League.String_Vectors.Universal_String_Vector;
-- Convert Input document to string with given prefered line Width
private
type Document_Index is new Positive;
type Output_Kinds is
(Empty_Output,
Text_Output,
New_Line_Output,
Nest_Output,
Concat_Output,
Union_Output);
type Output_Item (Kind : Output_Kinds := Empty_Output) is record
case Kind is
when Empty_Output =>
null;
when New_Line_Output =>
Gap : League.Strings.Universal_String;
when Text_Output =>
Text : League.Strings.Universal_String;
when Nest_Output =>
Indent : Natural := 0;
Down : Document_Index;
when Union_Output | Concat_Output =>
Left, Right : Document_Index;
-- For union there is next invariant:
-- Length (First_Line (left)) >= Max (Length (First_Line (right)))
end case;
end record;
function Hash (Item : Output_Item) return Ada.Containers.Hash_Type;
package Maps is new Ada.Containers.Hashed_Maps
(Key_Type => Output_Item,
Element_Type => Document_Index,
Hash => Hash,
Equivalent_Keys => "=",
"=" => "=");
package Output_Item_Vectors is new Ada.Containers.Vectors
(Index_Type => Document_Index,
Element_Type => Output_Item,
"=" => "=");
type Printer is tagged limited record
Store : Output_Item_Vectors.Vector;
Back : Maps.Map;
end record;
procedure Concat
(Self : in out Printer;
Left : Document_Index;
Right : Document_Index;
Result : out Document_Index);
procedure Group
(Self : in out Printer;
Input : Document_Index;
Result : out Document_Index);
procedure Nest
(Self : in out Printer;
Indent : Natural;
Input : Document_Index;
Result : out Document_Index);
procedure New_Line
(Self : in out Printer;
Result : out Document_Index;
Gap : League.Strings.Universal_String);
procedure Nil
(Self : in out Printer;
Result : out Document_Index);
procedure Text
(Self : in out Printer;
Line : League.Strings.Universal_String;
Result : out Document_Index);
procedure Append
(Self : in out Printer;
Item : Output_Item;
Index : out Document_Index);
procedure Flatten
(Self : in out Printer;
Input : Document_Index;
Result : out Document_Index);
type Document is tagged record
Printer : Printer_Access;
Index : Document_Index;
end record;
end League.Pretty_Printers;
|
programs/oeis/104/A104099.asm | neoneye/loda | 22 | 91560 | ; A104099: n * (10n^2 - 6n + 1), or n*A087348(n).
; 0,5,58,219,548,1105,1950,3143,4744,6813,9410,12595,16428,20969,26278,32415,39440,47413,56394,66443,77620,89985,103598,118519,134808,152525,171730,192483,214844,238873,264630,292175,321568,352869,386138,421435
mov $2,$0
mul $0,4
add $0,$2
mov $1,$0
bin $0,3
mul $0,12
add $0,$1
div $0,25
|
Groups/Subgroups/Normal/Lemmas.agda | Smaug123/agdaproofs | 4 | 4446 | <gh_stars>1-10
{-# OPTIONS --safe --warning=error --without-K #-}
open import Groups.Definition
open import Setoids.Setoids
open import Sets.EquivalenceRelations
open import Groups.Homomorphisms.Definition
open import Groups.Homomorphisms.Lemmas
open import Groups.Subgroups.Definition
open import Groups.Lemmas
open import Groups.Abelian.Definition
open import Groups.Subgroups.Normal.Definition
open import Agda.Primitive using (Level; lzero; lsuc; _⊔_)
module Groups.Subgroups.Normal.Lemmas where
data GroupKernelElement {a} {b} {c} {d} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_·A_ : A → A → A} {_·B_ : B → B → B} (G : Group S _·A_) {H : Group T _·B_} {f : A → B} (hom : GroupHom G H f) : Set (a ⊔ b ⊔ c ⊔ d) where
kerOfElt : (x : A) → (Setoid._∼_ T (f x) (Group.0G H)) → GroupKernelElement G hom
groupKernel : {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_·A_ : A → A → A} {_·B_ : B → B → B} (G : Group S _·A_) {H : Group T _·B_} {f : A → B} (hom : GroupHom G H f) → Setoid (GroupKernelElement G hom)
Setoid._∼_ (groupKernel {S = S} G {H} {f} fHom) (kerOfElt x fx=0) (kerOfElt y fy=0) = Setoid._∼_ S x y
Equivalence.reflexive (Setoid.eq (groupKernel {S = S} G {H} {f} fHom)) {kerOfElt x x₁} = Equivalence.reflexive (Setoid.eq S)
Equivalence.symmetric (Setoid.eq (groupKernel {S = S} G {H} {f} fHom)) {kerOfElt x prX} {kerOfElt y prY} = Equivalence.symmetric (Setoid.eq S)
Equivalence.transitive (Setoid.eq (groupKernel {S = S} G {H} {f} fHom)) {kerOfElt x prX} {kerOfElt y prY} {kerOfElt z prZ} = Equivalence.transitive (Setoid.eq S)
groupKernelGroupOp : {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_·A_ : A → A → A} {_·B_ : B → B → B} (G : Group S _·A_) {H : Group T _·B_} {f : A → B} (hom : GroupHom G H f) → (GroupKernelElement G hom) → (GroupKernelElement G hom) → (GroupKernelElement G hom)
groupKernelGroupOp {T = T} {_·A_ = _+A_} G {H = H} hom (kerOfElt x prX) (kerOfElt y prY) = kerOfElt (x +A y) (transitive (GroupHom.groupHom hom) (transitive (Group.+WellDefined H prX prY) (Group.identLeft H)))
where
open Setoid T
open Equivalence eq
groupKernelGroup : {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_·A_ : A → A → A} {_·B_ : B → B → B} (G : Group S _·A_) {H : Group T _·B_} {f : A → B} (hom : GroupHom G H f) → Group (groupKernel G hom) (groupKernelGroupOp G hom)
Group.+WellDefined (groupKernelGroup G fHom) {kerOfElt x prX} {kerOfElt y prY} {kerOfElt a prA} {kerOfElt b prB} = Group.+WellDefined G
Group.0G (groupKernelGroup G fHom) = kerOfElt (Group.0G G) (imageOfIdentityIsIdentity fHom)
Group.inverse (groupKernelGroup {T = T} G {H = H} fHom) (kerOfElt x prX) = kerOfElt (Group.inverse G x) (transitive (homRespectsInverse fHom) (transitive (inverseWellDefined H prX) (invIdent H)))
where
open Setoid T
open Equivalence eq
Group.+Associative (groupKernelGroup {S = S} {_·A_ = _·A_} G fHom) {kerOfElt x prX} {kerOfElt y prY} {kerOfElt z prZ} = Group.+Associative G
Group.identRight (groupKernelGroup G fHom) {kerOfElt x prX} = Group.identRight G
Group.identLeft (groupKernelGroup G fHom) {kerOfElt x prX} = Group.identLeft G
Group.invLeft (groupKernelGroup G fHom) {kerOfElt x prX} = Group.invLeft G
Group.invRight (groupKernelGroup G fHom) {kerOfElt x prX} = Group.invRight G
injectionFromKernelToG : {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_·A_ : A → A → A} {_·B_ : B → B → B} (G : Group S _·A_) {H : Group T _·B_} {f : A → B} (hom : GroupHom G H f) → GroupKernelElement G hom → A
injectionFromKernelToG G hom (kerOfElt x _) = x
injectionFromKernelToGIsHom : {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_·A_ : A → A → A} {_·B_ : B → B → B} (G : Group S _·A_) {H : Group T _·B_} {f : A → B} (hom : GroupHom G H f) → GroupHom (groupKernelGroup G hom) G (injectionFromKernelToG G hom)
GroupHom.groupHom (injectionFromKernelToGIsHom {S = S} G hom) {kerOfElt x prX} {kerOfElt y prY} = Equivalence.reflexive (Setoid.eq S)
GroupHom.wellDefined (injectionFromKernelToGIsHom G hom) {kerOfElt x prX} {kerOfElt y prY} i = i
groupKernelGroupPred : {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_·A_ : A → A → A} {_·B_ : B → B → B} (G : Group S _·A_) {H : Group T _·B_} {f : A → B} (hom : GroupHom G H f) → A → Set d
groupKernelGroupPred {T = T} G {H = H} {f = f} hom a = Setoid._∼_ T (f a) (Group.0G H)
groupKernelGroupPredWd : {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_·A_ : A → A → A} {_·B_ : B → B → B} (G : Group S _·A_) {H : Group T _·B_} {f : A → B} (hom : GroupHom G H f) → {x y : A} → (Setoid._∼_ S x y) → (groupKernelGroupPred G hom x → groupKernelGroupPred G hom y)
groupKernelGroupPredWd {S = S} {T = T} G hom {x} {y} x=y fx=0 = Equivalence.transitive (Setoid.eq T) (GroupHom.wellDefined hom (Equivalence.symmetric (Setoid.eq S) x=y)) fx=0
groupKernelGroupIsSubgroup : {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_·A_ : A → A → A} {_·B_ : B → B → B} (G : Group S _·A_) {H : Group T _·B_} {f : A → B} (hom : GroupHom G H f) → Subgroup G (groupKernelGroupPred G hom)
Subgroup.closedUnderPlus (groupKernelGroupIsSubgroup {S = S} {T = T} G {H = H} hom) g=0 h=0 = Equivalence.transitive (Setoid.eq T) (GroupHom.groupHom hom) (Equivalence.transitive (Setoid.eq T) (Group.+WellDefined H g=0 h=0) (Group.identLeft H))
Subgroup.containsIdentity (groupKernelGroupIsSubgroup G hom) = imageOfIdentityIsIdentity hom
Subgroup.closedUnderInverse (groupKernelGroupIsSubgroup {S = S} {T = T} G {H = H} hom) g=0 = Equivalence.transitive (Setoid.eq T) (homRespectsInverse hom) (Equivalence.transitive (Setoid.eq T) (inverseWellDefined H g=0) (invIdent H))
Subgroup.isSubset (groupKernelGroupIsSubgroup G hom) = groupKernelGroupPredWd G hom
groupKernelGroupIsNormalSubgroup : {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_·A_ : A → A → A} {_·B_ : B → B → B} (G : Group S _·A_) {H : Group T _·B_} {f : A → B} (hom : GroupHom G H f) → normalSubgroup G (groupKernelGroupIsSubgroup G hom)
groupKernelGroupIsNormalSubgroup {T = T} G {H = H} hom k=0 = transitive groupHom (transitive (+WellDefined reflexive groupHom) (transitive (+WellDefined reflexive (transitive (+WellDefined k=0 reflexive) identLeft)) (transitive (symmetric groupHom) (transitive (wellDefined (Group.invRight G)) (imageOfIdentityIsIdentity hom)))))
where
open Setoid T
open Group H
open Equivalence eq
open GroupHom hom
abelianGroupSubgroupIsNormal : {a b c : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {G : Group S _+_} {pred : A → Set c} → (s : Subgroup G pred) → AbelianGroup G → normalSubgroup G s
abelianGroupSubgroupIsNormal {S = S} {_+_ = _+_} {G = G} record { isSubset = predWd ; closedUnderPlus = respectsPlus ; containsIdentity = respectsId ; closedUnderInverse = respectsInv } abelian {k} {l} prK = predWd (transitive (transitive (transitive (symmetric identLeft) (+WellDefined (symmetric invRight) reflexive)) (symmetric +Associative)) (+WellDefined reflexive commutative)) prK
where
open Group G
open AbelianGroup abelian
open Setoid S
open Equivalence eq
|
ejercicios3/ordenar_por_insercion.adb | iyan22/AprendeAda | 0 | 10112 | <filename>ejercicios3/ordenar_por_insercion.adb
with datos;
use datos;
with Buscar_Posicion_De_Insercion, Desplazar_Una_Posicion_A_La_Derecha;
procedure Ordenar_Por_Insercion (L : in Lista_Enteros; L_Ordenada : out Lista_Enteros) is
-- pre:
-- post: L_ordenada contiene los valores de L en orden ascendente
pos, PosActual : Integer;
begin
L_Ordenada := L;
PosActual := L_Ordenada.Numeros'First+1;
if L.Cont > 1 then
loop exit when PosActual > L_Ordenada.Cont;
buscar_posicion_de_insercion( L_Ordenada.Numeros(PosActual), L_Ordenada, PosActual, Pos);
if pos /= -1 then
desplazar_una_posicion_a_la_derecha(L_Ordenada, PosActual, Pos);
end if;
PosActual := PosActual+1;
end loop;
end if;
end Ordenar_Por_Insercion;
|
src/drivers/zumo_motors.ads | yannickmoy/SPARKZumo | 6 | 3760 | <filename>src/drivers/zumo_motors.ads
pragma SPARK_Mode;
with Types; use Types;
-- @summary
-- Control for the robot's motors
--
-- @description
-- This package exposes on interface to control the robot's motors
--
package Zumo_Motors is
-- True if the package has been init'd
Initd : Boolean := False;
-- Whether to reverse the left motor
FlipLeft : Boolean := False;
-- Whether to reverse the right motor
FlipRight : Boolean := False;
-- Init the package. pin mux and whatnot
procedure Init
with Global => (In_Out => Initd),
Pre => not Initd,
Post => Initd;
-- Flip the direction of the left motor
-- @param Flip if true, flip the direction
procedure FlipLeftMotor (Flip : Boolean)
with Global => (Output => (FlipLeft)),
Post => FlipLeft = Flip;
-- Flip the direction of the right motor
-- @param Flip if tru,. flip the direction
procedure FlipRightMotor (Flip : Boolean)
with Global => (Output => (FlipRight)),
Post => FlipRight = Flip;
-- Set the speed of the left motor
-- @param Velocity the speed to set the motor at
procedure SetLeftSpeed (Velocity : Motor_Speed)
with Global => (Proof_In => Initd,
Input => FlipLeft),
-- Output => (Pwm.Register_State)),
Pre => Initd;
-- Set the speed of the right motor
-- @param Velocity the speed to set the motor at
procedure SetRightSpeed (Velocity : Motor_Speed)
with Global => (Proof_In => Initd,
Input => FlipRight),
-- Output => (Pwm.Register_State)),
Pre => Initd;
-- Set the speed of both the left and right motors
-- @param LeftVelocity the left motor velocity to set
-- @param RightVelocity the right motor velocity to set
procedure SetSpeed (LeftVelocity : Motor_Speed;
RightVelocity : Motor_Speed)
with Global => (Proof_In => Initd,
Input => (FlipLeft,
FlipRight)),
-- Output => (Pwm.Register_State)),
Pre => Initd;
end Zumo_Motors;
|
sdk-6.5.20/tools/led/example/knigget.asm | copslock/broadcom_cpri | 0 | 98185 | ;
; $Id: knigget.asm,v 1.2 2011/04/12 09:05:29 sraj Exp $
;
; This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
;
; Copyright 2007-2020 Broadcom Inc. All rights reserved.
;
; This is the default program for the Black Knight.
; To start it, use the following commands from BCM,
; where unit 0 is the 5670:
;
; 0:led load knigget.hex
; 0:led auto on
; 0:led start
;
; The Black Knight has 2 columns of 4 LEDs each on the rear:
;
; E1 E2
; L1 L2
; T1 T2
; R1 R2
;
; There is one bit per LED with the following colors:
;
; ZERO Green
; ONE Black
;
; The bits are shifted out in the following order:
; E1, L1, T1, R1, E2, L2, T2, R2
;
; Current implementation:
;
; E1 reflects port 1 higig link enable
; L1 reflects port 1 higig link up
; T1 reflects port 1 higig transmit activity
; R1 reflects port 1 higig receive activity
;
port 3 ; 5670 port 3 (right)
pushst LINKEN
tinv
pack
pushst LINKUP
tinv
pack
pushst TX
tinv
pack
pushst RX
tinv
pack
port 6 ; 5670 port 6 (left)
pushst LINKEN
tinv
pack
pushst LINKUP
tinv
pack
pushst TX
tinv
pack
pushst RX
tinv
pack
send 8
;
; Symbolic names for the bits of the port status fields
;
RX equ 0x0 ; received packet
TX equ 0x1 ; transmitted packet
COLL equ 0x2 ; collision indicator
SPEED_C equ 0x3 ; 100 Mbps
SPEED_M equ 0x4 ; 1000 Mbps
DUPLEX equ 0x5 ; half/full duplex
FLOW equ 0x6 ; flow control capable
LINKUP equ 0x7 ; link down/up status
LINKEN equ 0x8 ; link disabled/enabled status
ZERO equ 0xE ; always 0
ONE equ 0xF ; always 1
|
tests/bank_simple/4.asm | NullMember/customasm | 414 | 98184 | <reponame>NullMember/customasm
#ruledef test
{
loop => 0x5555 @ $`16
}
#bankdef test
{
#addr 0x8000
#outp 8 * 0x0000
}
loop
loop
loop
loop
; = 0x55558000
; = 0x55558004
; = 0x55558008
; = 0x5555800c |
Windows/Visual Studio/MinMax/MinMax/CalcMinMax.asm | leonhad/masm | 9 | 86671 | <gh_stars>1-10
.686
.model flat, c
.const
r4_MinFloat dword 0ff7fffffh
r4_MaxFloat dword 7f7fffffh
.code
CalcMinMax proc
push ebp
mov ebp, esp
xor eax, eax
mov edx, [ebp+8] ; edx = a
mov ecx, [ebp+12] ; ecx = n
test ecx, ecx
jle Done ; jump to Done if n <= 0
fld [r4_MinFloat] ; initial min value
fld [r4_MaxFloat] ; initial max value
@@:
fld real4 ptr [edx] ; load *a
fld st(0) ; duplicate *a on stack
fcomi st(0), st(2) ; compare *a with min
fcmovnb st(0), st(2) ; st(0) = smaller val
fstp st(2) ; save new min value
fcomi st(0), st(2) ; compare *a with max
fcmovb st(0), st(2) ; st(0) = larager val
fstp st(2) ; save new max value
add edx, 4 ; point to next a[i]
dec ecx
jnz @B
mov eax, [ebp+16]
fstp real4 ptr[eax] ; save final min
mov eax, [ebp+20]
fstp real4 ptr[eax] ; save final max
mov eax, 1
Done:
pop ebp
ret
CalcMinMax endp
end
|
Task/Executable-library/Ada/executable-library-2.ada | LaudateCorpus1/RosettaCodeData | 1 | 9852 | with Ada.Text_IO, Parameter, Hailstones;
procedure Hailstone is
-- if Parameter.X > 0, the length of Hailstone(Parameter.X)
-- is computed and written into Parameter.Y
-- if Parameter.X = 0, Hailstone(27) and N <= 100_000 with maximal
-- Hailstone(N) are computed and printed.
procedure Show_Sequence(N: Natural) is
Seq: Hailstones.Integer_Sequence := Hailstones.Create_Sequence(N);
begin
Ada.Text_IO.Put("Hailstone(" & Integer'Image(N) & " ) = (");
if Seq'Length < 8 then
for I in Seq'First .. Seq'Last-1 loop
Ada.Text_IO.Put(Integer'Image(Seq(I)) & ",");
end loop;
else
for I in Seq'First .. Seq'First+3 loop
Ada.Text_IO.Put(Integer'Image(Seq(I)) & ",");
end loop;
Ada.Text_IO.Put(" ...,");
for I in Seq'Last-3 .. Seq'Last-1 loop
Ada.Text_IO.Put(Integer'Image(Seq(I)) &",");
end loop;
end if;
Ada.Text_IO.Put_Line(Integer'Image(Seq(Seq'Last)) & " ); Length: " &
Integer'Image(seq'Length));
end Show_Sequence;
begin
if Parameter.X>0 then
Parameter.Y := Hailstones.Create_Sequence(Parameter.X)'Length;
else
Show_Sequence(27);
declare
Longest: Natural := 0;
Longest_Length: Natural := 0;
begin
for I in 2 .. 100_000 loop
if Hailstones.Create_Sequence(I)'Length > Longest_Length then
Longest := I;
Longest_Length := Hailstones.Create_Sequence(I)'Length;
end if;
end loop;
Ada.Text_IO.Put("Longest<=100_000: ");
Show_Sequence(Longest);
end;
end if;
end Hailstone;
|
alloy4fun_models/trashltl/models/1/uGgLnNr3sPt3oAg3D.als | Kaixi26/org.alloytools.alloy | 0 | 4076 | <gh_stars>0
open main
pred iduGgLnNr3sPt3oAg3D_prop2 {
always after some File
}
pred __repair { iduGgLnNr3sPt3oAg3D_prop2 }
check __repair { iduGgLnNr3sPt3oAg3D_prop2 <=> prop2o } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.