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 |
|---|---|---|---|---|
tests/data_simple/18.asm | NullMember/customasm | 414 | 91228 | <reponame>NullMember/customasm
#d8 2 + 3 ; = 0x05 |
oeis/158/A158373.asm | neoneye/loda-programs | 11 | 102834 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A158373: 625n^2 - 2n.
; 623,2496,5619,9992,15615,22488,30611,39984,50607,62480,75603,89976,105599,122472,140595,159968,180591,202464,225587,249960,275583,302456,330579,359952,390575,422448,455571,489944,525567,562440,600563,639936,680559,722432,765555,809928,855551,902424,950547,999920,1050543,1102416,1155539,1209912,1265535,1322408,1380531,1439904,1500527,1562400,1625523,1689896,1755519,1822392,1890515,1959888,2030511,2102384,2175507,2249880,2325503,2402376,2480499,2559872,2640495,2722368,2805491,2889864,2975487
mov $1,$0
add $0,1
mul $0,25
pow $0,2
mul $1,2
sub $0,$1
sub $0,2
|
oeis/110/A110451.asm | neoneye/loda-programs | 11 | 247270 | <filename>oeis/110/A110451.asm<gh_stars>10-100
; A110451: a(n) = n*(4*n^2 + 2*n + 1).
; 0,7,42,129,292,555,942,1477,2184,3087,4210,5577,7212,9139,11382,13965,16912,20247,23994,28177,32820,37947,43582,49749,56472,63775,71682,80217,89404,99267,109830,121117,133152,145959,159562,173985,189252,205387,222414,240357,259240,279087,299922,321769,344652,368595,393622,419757,447024,475447,505050,535857,567892,601179,635742,671605,708792,747327,787234,828537,871260,915427,961062,1008189,1056832,1107015,1158762,1212097,1267044,1323627,1381870,1441797,1503432,1566799,1631922,1698825,1767532
mov $1,4
mul $1,$0
mul $0,$1
add $1,2
mul $0,$1
add $0,$1
div $0,4
|
test/fail/SizedTypesVarSwap.agda | asr/agda-kanso | 1 | 11150 | <reponame>asr/agda-kanso<gh_stars>1-10
{-# OPTIONS --sized-types #-}
module SizedTypesVarSwap where
postulate
Size : Set
_^ : Size -> Size
∞ : Size
{-# BUILTIN SIZE Size #-}
{-# BUILTIN SIZESUC _^ #-}
{-# BUILTIN SIZEINF ∞ #-}
data Nat : {size : Size} -> Set where
zero : {size : Size} -> Nat {size ^}
suc : {size : Size} -> Nat {size} -> Nat {size ^}
bad : {i j : Size} -> Nat {i} -> Nat {j} -> Nat {∞}
bad (suc x) y = bad (suc y) x
bad zero y = y
|
AVR_Assembly/attiny44.asm | yarikbratashchuk/NNfSiX | 1,045 | 94715 | ; -------------------------------------------------------------------------------------------------
; REGISTERS
; -------------------------------------------------------------------------------------------------
.EQU SREG = 0x3F ; avr status register
.EQU SREG_I = 7 ; global interrupt enable
.EQU SREG_T = 6 ; bit copy storage
.EQU SREG_H = 5 ; half carry flag
.EQU SREG_S = 4 ; sign bit
.EQU SREG_V = 3 ; twos complement overflow flag
.EQU SREG_N = 2 ; negative flag
.EQU SREG_Z = 1 ; zero flag
.EQU SREG_C = 0 ; carry flag
.EQU SPH = 0x3E ; stack pointer high
.EQU SP9 = 1 ; bit 9
.EQU SP8 = 0 ; bit 8
.EQU SPL = 0x3D ; stack pointer low
.EQU SP7 = 7 ; bit 7
.EQU SP6 = 6 ; bit 6
.EQU SP5 = 5 ; bit 5
.EQU SP4 = 4 ; bit 4
.EQU SP3 = 3 ; bit 3
.EQU SP2 = 2 ; bit 2
.EQU SP1 = 1 ; bit 1
.EQU SP0 = 0 ; bit 0
.EQU OCR0B = 0x3C
.EQU GIMSK = 0x3B
.EQU INT0 = 6
.EQU PCIE1 = 5
.EQU PCIE0 = 4
.EQU GIFR = 0x3A
.EQU INTF0 = 6
.EQU PCIF1 = 5
.EQU PCIF0 = 4
.EQU TIMSK0 = 0x39
.EQU OCIE0B = 2
.EQU OCIE0A = 1
.EQU TOIE0 = 0
.EQU TIFR0 = 0x38
.EQU OCF0B = 2
.EQU OCF0A = 1
.EQU TOV0 = 0
.EQU SPMCSR = 0x37
.EQU RSIG = 5
.EQU CTPB = 4
.EQU RFLB = 3
.EQU PGWRT = 2
.EQU PGERS = 1
.EQU SPMEN = 0
.EQU OCR0A = 0x36
.EQU MCUCR = 0x35
.EQU BODS = 7
.EQU PUD = 6
.EQU SE = 5
.EQU SM1 = 4
.EQU SM0 = 3
.EQU BODSE = 2
.EQU ISC01 = 1
.EQU ISC00 = 0
.EQU MCUSR = 0x34
.EQU WDRF = 3
.EQU BORF = 2
.EQU EXTRF = 1
.EQU PORF = 0
.EQU TCCR0B = 0x33 ; timer couter 0 control register B
.EQU FOC0A = 7 ; force output compare A timer counter 0
.EQU FOC0B = 6 ; force output compare B timer counter 0
.EQU WGM02 = 3 ; waveform generation mode 2 timer counter 0
.EQU CS02 = 2 ; clock source 2 timer counter 0
.EQU CS01 = 1 ; clock source 1 timer counter 0
.EQU CS00 = 0 ; clock source 0 timer counter 0
.EQU TCNT0 = 0x32 ; timer counter 0
.EQU OSCCAL = 0x31 ; oscillator calibration register
.EQU CAL7 = 7
.EQU CAL6 = 6
.EQU CAL5 = 5
.EQU CAL4 = 4
.EQU CAL3 = 3
.EQU CAL2 = 2
.EQU CAL1 = 1
.EQU CAL0 = 0
.EQU TCCR0A = 0x30
.EQU TCCR1A = 0x2F
.EQU TCCR1B = 0x2E
.EQU TCNT1H = 0x2D
.EQU TCNT1L = 0x2C
.EQU OCR1AH = 0x2B
.EQU OCR1AL = 0x2A
.EQU OCR1BH = 0x29
.EQU OCR1BL = 0x28
.EQU DWDR = 0x27
.EQU CLKPR = 0x26
.EQU CLKPCE = 7
.EQU CLKPS3 = 3
.EQU CLKPS2 = 2
.EQU CLKPS1 = 1
.EQU CLKPS0 = 0
.EQU ICR1H = 0x25
.EQU ICR1L = 0x24
.EQU GTCCR = 0x23
.EQU TCCR1C = 0x22
.EQU WDTCSR = 0x21
.EQU WDIF = 7
.EQU WDIE = 6
.EQU WDP3 = 5
.EQU WDCE = 4
.EQU WDE = 3
.EQU WDP2 = 2
.EQU WDP1 = 1
.EQU WDP0 = 0
.EQU PCMSK1 = 0x20
.EQU EEARH = 0x1F
.EQU EEAR8 = 0
.EQU EEARL = 0x1E
.EQU EEAR7 = 7
.EQU EEAR6 = 6
.EQU EEAR5 = 5
.EQU EEAR4 = 4
.EQU EEAR3 = 3
.EQU EEAR2 = 2
.EQU EEAR1 = 1
.EQU EEAR0 = 0
.EQU EEDR = 0x1D ; eeprom data register
.EQU EECR = 0x1C
.EQU EEPM1 = 5
.EQU EEPM0 = 4
.EQU EERIE = 3
.EQU EEMPE = 2
.EQU EEPE = 1
.EQU EERE = 0
.EQU PORTA = 0x1B
.EQU DDRA = 0x1A
.EQU PINA = 0x19
.EQU PORTB = 0x18 ; data output register port B
.EQU PORTB3 = 3
.EQU PORTB2 = 2
.EQU PORTB1 = 1
.EQU PORTB0 = 0
.EQU DDRB = 0x17 ; data direction register port B
.EQU DDB3 = 3
.EQU DDB2 = 2
.EQU DDB1 = 1
.EQU DDB0 = 0
.EQU PINB = 0x16 ; data input register port B
.EQU PINB3 = 3
.EQU PINB2 = 2
.EQU PINB1 = 1
.EQU PINB0 = 0
.EQU GPIOR2 = 0x15
.EQU GPIOR1 = 0x14
.EQU GPIOR0 = 0x13
.EQU PCMSK0 = 0x12
; reserved
.EQU USIBR = 0x10 ; usi buffer register
.EQU USIDR = 0x0F ; usi data register
.EQU USISR = 0x0E ; usi status register
.EQU USISIF = 7
.EQU USIOIF = 6
.EQU USIPF = 5
.EQU USIDC = 4
.EQU USICNT3 = 3
.EQU USICNT2 = 2
.EQU USICNT1 = 1
.EQU USICNT0 = 0
.EQU USICR = 0x0D ; usi counter register
.EQU USISIE = 7
.EQU USIOIE = 6
.EQU USIWM1 = 5
.EQU USIWM0 = 4
.EQU USICS1 = 3
.EQU USICS0 = 2
.EQU USICLK = 1
.EQU USITC = 0
.EQU TIMSK1 = 0x0C
.EQU TIFR1 = 0x0B
; reserved
; reserved
.EQU ACSR = 0x08
.EQU ACD = 7
.EQU ACBG = 6
.EQU ACO = 5
.EQU ACI = 4
.EQU ACIE = 3
.EQU ACIS1 = 1
.EQU ACIS0 = 0
.EQU ADMUX = 0x07
.EQU REFS1 = 7
.EQU REFS0 = 6
.EQU ADLAR = 5
.EQU REFS2 = 4
.EQU MUX3 = 3
.EQU MUX2 = 2
.EQU MUX1 = 1
.EQU MUX0 = 0
.EQU ADCSRA = 0x06
.EQU ADEN = 7
.EQU ADSC = 6
.EQU ADATE = 5
.EQU ADIF = 4
.EQU ADIE = 3
.EQU ADPS2 = 2
.EQU ADPS1 = 1
.EQU ADPS0 = 0
.EQU ADCH = 0x05 ; adc data high
.EQU ADCL = 0x04 ; adc data low
.EQU ADCSRB = 0x03
.EQU BIN = 7
.EQU ACME = 6
.EQU IPR = 5
.EQU ADTS2 = 2
.EQU ADTS1 = 1
.EQU ADTS0 = 0
; reserved
.EQU DIDR0 = 0x01
.EQU PRR = 0x00
; -------------------------------------------------------------------------------------------------
; STANDARD VALUES
; -------------------------------------------------------------------------------------------------
.EQU RAMEND = 0x015F |
tools-src/gnu/gcc/gcc/ada/g-expect.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 10069 | <filename>tools-src/gnu/gcc/gcc/ada/g-expect.ads
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- G N A T . E X P E C T --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 2000-2001 Ada Core Technologies, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 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 is maintained by Ada Core Technologies Inc (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
-- Currently this package is implemented on all native GNAT ports except
-- for VMS. It is not yet implemented for any of the cross-ports (e.g. it
-- is not available for VxWorks or LynxOS).
--
-- Usage
-- =====
--
-- This package provides a set of subprograms similar to what is available
-- with the standard Tcl Expect tool.
-- It allows you to easily spawn and communicate with an external process.
-- You can send commands or inputs to the process, and compare the output
-- with some expected regular expression.
--
-- Usage example:
--
-- Non_Blocking_Spawn (Fd, "ftp machine@domaine");
-- Timeout := 10000; -- 10 seconds
-- Expect (Fd, Result, Regexp_Array'(+"\(user\)", +"\(passwd\)"),
-- Timeout);
-- case Result is
-- when 1 => Send (Fd, "my_name"); -- matched "user"
-- when 2 => Send (Fd, "my_passwd"); -- matched "passwd"
-- when Expect_Timeout => null; -- timeout
-- when others => null;
-- end case;
-- Close (Fd);
--
-- You can also combine multiple regular expressions together, and get the
-- specific string matching a parenthesis pair by doing something like. If you
-- expect either "lang=optional ada" or "lang=ada" from the external process,
-- you can group the two together, which is more efficient, and simply get the
-- name of the language by doing:
--
-- declare
-- Matched : Regexp_Array (0 .. 2);
-- begin
-- Expect (Fd, Result, "lang=(optional)? ([a-z]+)", Matched);
-- Put_Line ("Seen: " &
-- Expect_Out (Fd) (Matched (2).First .. Matched (2).Last));
-- end;
--
-- Alternatively, you might choose to use a lower-level interface to the
-- processes, where you can give your own input and output filters every
-- time characters are read from or written to the process.
--
-- procedure My_Filter (Descriptor : Process_Descriptor; Str : String) is
-- begin
-- Put_Line (Str);
-- end;
--
-- Fd := Non_Blocking_Spawn ("tail -f a_file");
-- Add_Filter (Fd, My_Filter'Access, Output);
-- Expect (Fd, Result, "", 0); -- wait forever
--
-- The above example should probably be run in a separate task, since it is
-- blocking on the call to Expect.
--
-- Both examples can be combined, for instance to systematically print the
-- output seen by expect, even though you still want to let Expect do the
-- filtering. You can use the Trace_Filter subprogram for such a filter.
--
-- If you want to get the output of a simple command, and ignore any previous
-- existing output, it is recommended to do something like:
--
-- Expect (Fd, Result, ".*", Timeout => 0);
-- -- empty the buffer, by matching everything (after checking
-- -- if there was any input).
-- Send (Fd, "command");
-- Expect (Fd, Result, ".."); -- match only on the output of command
--
-- Task Safety
-- ===========
--
-- This package is not task-safe. However, you can easily make is task safe
-- by encapsulating the type Process_Descriptor in a protected record.
-- There should not be concurrent calls to Expect.
with System;
with GNAT.OS_Lib;
with GNAT.Regpat;
package GNAT.Expect is
type Process_Id is new Integer;
Invalid_Pid : constant Process_Id := -1;
Null_Pid : constant Process_Id := 0;
type Filter_Type is (Output, Input, Died);
-- The signals that are emitted by the Process_Descriptor upon state
-- changed in the child. One can connect to any of this signal through
-- the Add_Filter subprograms.
--
-- Output => Every time new characters are read from the process
-- associated with Descriptor, the filter is called with
-- these new characters in argument.
--
-- Note that output is only generated when the program is
-- blocked in a call to Expect.
--
-- Input => Every time new characters are written to the process
-- associated with Descriptor, the filter is called with
-- these new characters in argument.
-- Note that input is only generated by calls to Send.
--
-- Died => The child process has died, or was explicitly killed
type Process_Descriptor is tagged private;
-- Contains all the components needed to describe a process handled
-- in this package, including a process identifier, file descriptors
-- associated with the standard input, output and error, and the buffer
-- needed to handle the expect calls.
type Process_Descriptor_Access is access Process_Descriptor'Class;
------------------------
-- Spawning a process --
------------------------
procedure Non_Blocking_Spawn
(Descriptor : out Process_Descriptor'Class;
Command : String;
Args : GNAT.OS_Lib.Argument_List;
Buffer_Size : Natural := 4096;
Err_To_Out : Boolean := False);
-- This call spawns a new process and allows sending commands to
-- the process and/or automatic parsing of the output.
--
-- The expect buffer associated with that process can contain at most
-- Buffer_Size characters. Older characters are simply discarded when
-- this buffer is full. Beware that if the buffer is too big, this could
-- slow down the Expect calls if not output is matched, since Expect has
-- to match all the regexp against all the characters in the buffer.
-- If Buffer_Size is 0, there is no limit (ie all the characters are kept
-- till Expect matches), but this is slower.
--
-- If Err_To_Out is True, then the standard error of the spawned process is
-- connected to the standard output. This is the only way to get the
-- Except subprograms also match on output on standard error.
--
-- Invalid_Process is raised if the process could not be spawned.
procedure Close (Descriptor : in out Process_Descriptor);
-- Terminate the process and close the pipes to it. It implicitly
-- does the 'wait' command required to clean up the process table.
-- This also frees the buffer associated with the process id.
procedure Send_Signal
(Descriptor : Process_Descriptor;
Signal : Integer);
-- Send a given signal to the process.
procedure Interrupt (Descriptor : in out Process_Descriptor);
-- Interrupt the process (the equivalent of Ctrl-C on unix and windows)
-- and call close if the process dies.
function Get_Input_Fd
(Descriptor : Process_Descriptor)
return GNAT.OS_Lib.File_Descriptor;
-- Return the input file descriptor associated with Descriptor.
function Get_Output_Fd
(Descriptor : Process_Descriptor)
return GNAT.OS_Lib.File_Descriptor;
-- Return the output file descriptor associated with Descriptor.
function Get_Error_Fd
(Descriptor : Process_Descriptor)
return GNAT.OS_Lib.File_Descriptor;
-- Return the error output file descriptor associated with Descriptor.
function Get_Pid
(Descriptor : Process_Descriptor)
return Process_Id;
-- Return the process id associated with a given process descriptor.
--------------------
-- Adding filters --
--------------------
-- This is a rather low-level interface to subprocesses, since basically
-- the filtering is left entirely to the user. See the Expect subprograms
-- below for higher level functions.
type Filter_Function is access
procedure
(Descriptor : Process_Descriptor'Class;
Str : String;
User_Data : System.Address := System.Null_Address);
-- Function called every time new characters are read from or written
-- to the process.
--
-- Str is a string of all these characters.
--
-- User_Data, if specified, is a user specific data that will be passed to
-- the filter. Note that no checks are done on this parameter that should
-- be used with cautiousness.
procedure Add_Filter
(Descriptor : in out Process_Descriptor;
Filter : Filter_Function;
Filter_On : Filter_Type := Output;
User_Data : System.Address := System.Null_Address;
After : Boolean := False);
-- Add a new filter for one of the filter type. This filter will be
-- run before all the existing filters, unless After is set True,
-- in which case it will be run after existing filters. User_Data
-- is passed as is to the filter procedure.
procedure Remove_Filter
(Descriptor : in out Process_Descriptor;
Filter : Filter_Function);
-- Remove a filter from the list of filters (whatever the type of the
-- filter).
procedure Trace_Filter
(Descriptor : Process_Descriptor'Class;
Str : String;
User_Data : System.Address := System.Null_Address);
-- Function that can be used a filter and that simply outputs Str on
-- Standard_Output. This is mainly used for debugging purposes.
-- User_Data is ignored.
procedure Lock_Filters (Descriptor : in out Process_Descriptor);
-- Temporarily disables all output and input filters. They will be
-- reactivated only when Unlock_Filters has been called as many times as
-- Lock_Filters;
procedure Unlock_Filters (Descriptor : in out Process_Descriptor);
-- Unlocks the filters. They are reactivated only if Unlock_Filters
-- has been called as many times as Lock_Filters.
------------------
-- Sending data --
------------------
procedure Send
(Descriptor : in out Process_Descriptor;
Str : String;
Add_LF : Boolean := True;
Empty_Buffer : Boolean := False);
-- Send a string to the file descriptor.
--
-- The string is not formatted in any way, except if Add_LF is True,
-- in which case an ASCII.LF is added at the end, so that Str is
-- recognized as a command by the external process.
--
-- If Empty_Buffer is True, any input waiting from the process (or in the
-- buffer) is first discarded before the command is sent. The output
-- filters are of course called as usual.
-----------------------------------------------------------
-- Working on the output (single process, simple regexp) --
-----------------------------------------------------------
type Expect_Match is new Integer;
Expect_Full_Buffer : constant Expect_Match := -1;
-- If the buffer was full and some characters were discarded.
Expect_Timeout : constant Expect_Match := -2;
-- If not output matching the regexps was found before the timeout.
function "+" (S : String) return GNAT.OS_Lib.String_Access;
-- Allocate some memory for the string. This is merely a convenience
-- convenience function to help create the array of regexps in the
-- call to Expect.
procedure Expect
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexp : String;
Timeout : Integer := 10000;
Full_Buffer : Boolean := False);
-- Wait till a string matching Fd can be read from Fd, and return 1
-- if a match was found.
--
-- It consumes all the characters read from Fd until a match found, and
-- then sets the return values for the subprograms Expect_Out and
-- Expect_Out_Match.
--
-- The empty string "" will never match, and can be used if you only want
-- to match after a specific timeout. Beware that if Timeout is -1 at the
-- time, the current task will be blocked forever.
--
-- This command times out after Timeout milliseconds (or never if Timeout
-- is -1). In that case, Expect_Timeout is returned. The value returned by
-- Expect_Out and Expect_Out_Match are meaningless in that case.
--
-- Note that using a timeout of 0ms leads to unpredictable behavior, since
-- the result depends on whether the process has already sent some output
-- the first time Expect checks, and this depends on the operating system.
--
-- The regular expression must obey the syntax described in GNAT.Regpat.
--
-- If Full_Buffer is True, then Expect will match if the buffer was too
-- small and some characters were about to be discarded. In that case,
-- Expect_Full_Buffer is returned.
procedure Expect
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexp : GNAT.Regpat.Pattern_Matcher;
Timeout : Integer := 10000;
Full_Buffer : Boolean := False);
-- Same as the previous one, but with a precompiled regular expression.
-- This is more efficient however, especially if you are using this
-- expression multiple times, since this package won't need to recompile
-- the regexp every time.
procedure Expect
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexp : String;
Matched : out GNAT.Regpat.Match_Array;
Timeout : Integer := 10000;
Full_Buffer : Boolean := False);
-- Same as above, but it is now possible to get the indexes of the
-- substrings for the parentheses in the regexp (see the example at the
-- top of this package, as well as the documentation in the package
-- GNAT.Regpat).
--
-- Matched'First should be 0, and this index will contain the indexes for
-- the whole string that was matched. The index 1 will contain the indexes
-- for the first parentheses-pair, and so on.
------------
-- Expect --
------------
procedure Expect
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexp : GNAT.Regpat.Pattern_Matcher;
Matched : out GNAT.Regpat.Match_Array;
Timeout : Integer := 10000;
Full_Buffer : Boolean := False);
-- Same as above, but with a precompiled regular expression.
-------------------------------------------------------------
-- Working on the output (single process, multiple regexp) --
-------------------------------------------------------------
type Regexp_Array is array (Positive range <>) of GNAT.OS_Lib.String_Access;
type Pattern_Matcher_Access is access GNAT.Regpat.Pattern_Matcher;
type Compiled_Regexp_Array is array (Positive range <>)
of Pattern_Matcher_Access;
function "+"
(P : GNAT.Regpat.Pattern_Matcher)
return Pattern_Matcher_Access;
-- Allocate some memory for the pattern matcher.
-- This is only a convenience function to help create the array of
-- compiled regular expressoins.
procedure Expect
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexps : Regexp_Array;
Timeout : Integer := 10000;
Full_Buffer : Boolean := False);
-- Wait till a string matching one of the regular expressions in Regexps
-- is found. This function returns the index of the regexp that matched.
-- This command is blocking, but will timeout after Timeout milliseconds.
-- In that case, Timeout is returned.
procedure Expect
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexps : Compiled_Regexp_Array;
Timeout : Integer := 10000;
Full_Buffer : Boolean := False);
-- Same as the previous one, but with precompiled regular expressions.
-- This can be much faster if you are using them multiple times.
procedure Expect
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexps : Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
Timeout : Integer := 10000;
Full_Buffer : Boolean := False);
-- Same as above, except that you can also access the parenthesis
-- groups inside the matching regular expression.
-- The first index in Matched must be 0, or Constraint_Error will be
-- raised. The index 0 contains the indexes for the whole string that was
-- matched, the index 1 contains the indexes for the first parentheses
-- pair, and so on.
procedure Expect
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexps : Compiled_Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
Timeout : Integer := 10000;
Full_Buffer : Boolean := False);
-- Same as above, but with precompiled regular expressions.
-- The first index in Matched must be 0, or Constraint_Error will be
-- raised.
-------------------------------------------
-- Working on the output (multi-process) --
-------------------------------------------
type Multiprocess_Regexp is record
Descriptor : Process_Descriptor_Access;
Regexp : Pattern_Matcher_Access;
end record;
type Multiprocess_Regexp_Array is array (Positive range <>)
of Multiprocess_Regexp;
procedure Expect
(Result : out Expect_Match;
Regexps : Multiprocess_Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
Timeout : Integer := 10000;
Full_Buffer : Boolean := False);
-- Same as above, but for multi processes.
procedure Expect
(Result : out Expect_Match;
Regexps : Multiprocess_Regexp_Array;
Timeout : Integer := 10000;
Full_Buffer : Boolean := False);
-- Same as the previous one, but for multiple processes.
-- This procedure finds the first regexp that match the associated process.
------------------------
-- Getting the output --
------------------------
procedure Flush
(Descriptor : in out Process_Descriptor;
Timeout : Integer := 0);
-- Discard all output waiting from the process.
--
-- This output is simply discarded, and no filter is called. This output
-- will also not be visible by the next call to Expect, nor will any
-- output currently buffered.
--
-- Timeout is the delay for which we wait for output to be available from
-- the process. If 0, we only get what is immediately available.
function Expect_Out (Descriptor : Process_Descriptor) return String;
-- Return the string matched by the last Expect call.
--
-- The returned string is in fact the concatenation of all the strings
-- read from the file descriptor up to, and including, the characters
-- that matched the regular expression.
--
-- For instance, with an input "philosophic", and a regular expression
-- "hi" in the call to expect, the strings returned the first and second
-- time would be respectively "phi" and "losophi".
function Expect_Out_Match (Descriptor : Process_Descriptor) return String;
-- Return the string matched by the last Expect call.
--
-- The returned string includes only the character that matched the
-- specific regular expression. All the characters that came before are
-- simply discarded.
--
-- For instance, with an input "philosophic", and a regular expression
-- "hi" in the call to expect, the strings returned the first and second
-- time would both be "hi".
----------------
-- Exceptions --
----------------
Invalid_Process : exception;
-- Raised by most subprograms above when the parameter Descriptor is not a
-- valid process or is a closed process.
Process_Died : exception;
-- Raised by all the expect subprograms if Descriptor was originally a
-- valid process that died while Expect was executing. It is also raised
-- when Expect receives an end-of-file.
------------------------
-- Internal functions --
------------------------
-- The following subprograms are provided so that it is easy to write
-- extensions to this package. However, clients should not use these
-- routines directly.
procedure Portable_Execvp (Cmd : String; Args : System.Address);
-- Executes, in a portable way, the command Cmd (full path must be
-- specified), with the given Args. Note that the first element in Args
-- must be the executable name, and the last element must be a null
-- pointer
private
type Filter_List_Elem;
type Filter_List is access Filter_List_Elem;
type Filter_List_Elem is record
Filter : Filter_Function;
User_Data : System.Address;
Filter_On : Filter_Type;
Next : Filter_List;
end record;
type Pipe_Type is record
Input, Output : GNAT.OS_Lib.File_Descriptor;
end record;
-- This type represents a pipe, used to communicate between two processes.
procedure Set_Up_Communications
(Pid : in out Process_Descriptor;
Err_To_Out : Boolean;
Pipe1 : access Pipe_Type;
Pipe2 : access Pipe_Type;
Pipe3 : access Pipe_Type);
-- Set up all the communication pipes and file descriptors prior to
-- spawning the child process.
procedure Set_Up_Parent_Communications
(Pid : in out Process_Descriptor;
Pipe1 : in out Pipe_Type;
Pipe2 : in out Pipe_Type;
Pipe3 : in out Pipe_Type);
-- Finish the set up of the pipes while in the parent process
procedure Set_Up_Child_Communications
(Pid : in out Process_Descriptor;
Pipe1 : in out Pipe_Type;
Pipe2 : in out Pipe_Type;
Pipe3 : in out Pipe_Type;
Cmd : String;
Args : System.Address);
-- Finish the set up of the pipes while in the child process
-- This also spawns the child process (based on Cmd).
-- On systems that support fork, this procedure is executed inside the
-- newly created process.
type Process_Descriptor is tagged record
Pid : Process_Id := Invalid_Pid;
Input_Fd : GNAT.OS_Lib.File_Descriptor := GNAT.OS_Lib.Invalid_FD;
Output_Fd : GNAT.OS_Lib.File_Descriptor := GNAT.OS_Lib.Invalid_FD;
Error_Fd : GNAT.OS_Lib.File_Descriptor := GNAT.OS_Lib.Invalid_FD;
Filters_Lock : Integer := 0;
Filters : Filter_List := null;
Buffer : GNAT.OS_Lib.String_Access := null;
Buffer_Size : Natural := 0;
Buffer_Index : Natural := 0;
Last_Match_Start : Natural := 0;
Last_Match_End : Natural := 0;
end record;
pragma Import (C, Portable_Execvp, "__gnat_expect_portable_execvp");
end GNAT.Expect;
|
Parametric/Syntax/MType.agda | inc-lc/ilc-agda | 10 | 17231 | <reponame>inc-lc/ilc-agda
import Parametric.Syntax.Type as Type
module Parametric.Syntax.MType where
module Structure (Base : Type.Structure) where
open Type.Structure Base
mutual
-- Derived from CBPV
data ValType : Set where
U : (c : CompType) → ValType
B : (ι : Base) → ValType
vUnit : ValType
_v×_ : (τ₁ : ValType) → (τ₂ : ValType) → ValType
_v+_ : (τ₁ : ValType) → (τ₂ : ValType) → ValType
-- Same associativity as the standard _×_
infixr 2 _v×_
data CompType : Set where
F : ValType → CompType
_⇛_ : ValType → CompType → CompType
-- We did not use this in CBPV, so dropped.
-- _Π_ : CompType → CompType → CompType
cbnToCompType : Type → CompType
cbnToCompType (base ι) = F (B ι)
cbnToCompType (σ ⇒ τ) = U (cbnToCompType σ) ⇛ cbnToCompType τ
cbvToValType : Type → ValType
cbvToValType (base ι) = B ι
cbvToValType (σ ⇒ τ) = U (cbvToValType σ ⇛ F (cbvToValType τ))
open import Base.Syntax.Context ValType public
using ()
renaming
( ∅ to ∅∅
; _•_ to _••_
; mapContext to mapValCtx
; Var to ValVar
; Context to ValContext
; this to vThis; that to vThat
; _≼_ to _≼≼_
; weaken-var to weaken-val-var
; keep_•_ to keep_••_
; drop_•_ to drop_••_
; ≼-refl to ≼≼-refl
; ≼-trans to ≼≼-trans)
cbnToValType : Type → ValType
cbnToValType τ = U (cbnToCompType τ)
cbvToCompType : Type → CompType
cbvToCompType τ = F (cbvToValType τ)
fromCBNCtx : Context → ValContext
fromCBNCtx Γ = mapValCtx cbnToValType Γ
fromCBVCtx : Context → ValContext
fromCBVCtx Γ = mapValCtx cbvToValType Γ
open import Data.List
open Data.List using (List) public
fromCBVToCompList : Context → List CompType
fromCBVToCompList Γ = mapValCtx cbvToCompType Γ
fromVar : ∀ {Γ τ} → (f : Type → ValType) → Var Γ τ → ValVar (mapValCtx f Γ) (f τ)
fromVar {x • Γ} f this = vThis
fromVar {x • Γ} f (that v) = vThat (fromVar f v)
|
libsrc/_DEVELOPMENT/string/c/sdcc_iy/bcmp.asm | jpoikela/z88dk | 640 | 29759 |
; BSD
; int bcmp (const void *b1, const void *b2, size_t len)
SECTION code_clib
SECTION code_string
PUBLIC _bcmp
EXTERN _memcmp
defc _bcmp = _memcmp
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1702.asm | ljhsiun2/medusa | 9 | 16112 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1702.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x575e, %rsi
lea addresses_WC_ht+0x71e, %rdi
nop
nop
nop
nop
sub %rbp, %rbp
mov $34, %rcx
rep movsb
nop
nop
xor %r11, %r11
lea addresses_D_ht+0x1c71e, %r8
nop
nop
dec %r13
movb $0x61, (%r8)
nop
sub $19262, %rsi
lea addresses_UC_ht+0x16b1e, %rsi
lea addresses_normal_ht+0xec5e, %rdi
nop
nop
nop
nop
add %rbp, %rbp
mov $89, %rcx
rep movsw
nop
nop
add $59762, %r13
lea addresses_A_ht+0x641e, %rdi
nop
nop
nop
and %rbp, %rbp
mov $0x6162636465666768, %r8
movq %r8, %xmm3
vmovups %ymm3, (%rdi)
nop
nop
add $60005, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %r9
push %rdi
push %rsi
// Store
lea addresses_PSE+0x771e, %rsi
nop
nop
nop
nop
cmp %r8, %r8
movb $0x51, (%rsi)
nop
nop
nop
nop
add $61694, %rdi
// Faulty Load
lea addresses_normal+0x5b1e, %r13
nop
nop
xor $40134, %rsi
movb (%r13), %r9b
lea oracles, %rsi
and $0xff, %r9
shlq $12, %r9
mov (%rsi,%r9,1), %r9
pop %rsi
pop %rdi
pop %r9
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_PSE', 'congruent': 7}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_normal', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 5}, 'OP': 'STOR'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
Cubical/Categories/Yoneda.agda | Edlyr/cubical | 0 | 7806 | {-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Categories.Yoneda where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Univalence using (ua)
open import Cubical.Foundations.Function renaming (_∘_ to _◍_)
open import Cubical.Data.Sigma
open import Cubical.Foundations.Equiv
open import Cubical.HITs.PropositionalTruncation
open import Cubical.Categories.Category
open import Cubical.Categories.Instances.Sets
open import Cubical.Categories.Instances.Functors
open import Cubical.Categories.NaturalTransformation
open import Cubical.Categories.Functor
open import Cubical.Categories.Presheaf
private
variable
ℓ ℓ' ℓ'' : Level
-- THE YONEDA LEMMA
open NatTrans
open NatTransP
open Functor
open Iso
module _ (A B : Type ℓ) (f : A → B) where
isInj = ∀ (x y : A) → (f x ≡ f y) → x ≡ y
isSurj = ∀ (b : B) → Σ[ a ∈ A ] f a ≡ b
bijectionToIso : isInj × isSurj
→ isIso f
bijectionToIso (i , s) = (λ b → fst (s b)) , (λ b → snd (s b)) , λ a → i (fst (s (f a))) a (snd (s (f a)))
module _ {C : Precategory ℓ ℓ'} ⦃ isCatC : isCategory C ⦄ where
open Precategory
yoneda : (F : Functor C (SET ℓ'))
→ (c : C .ob)
→ Iso ((FUNCTOR C (SET ℓ')) [ C [ c ,-] , F ]) (fst (F ⟅ c ⟆))
yoneda F c = theIso
where
natType = (FUNCTOR C (SET ℓ')) [ C [ c ,-] , F ]
setType = fst (F ⟅ c ⟆)
-- takes a natural transformation to what it does on id
ϕ : natType → setType
ϕ α = (α ⟦ _ ⟧) (C .id c)
-- takes an element x of F c and sends it to the (only) natural transformation
-- which takes the identity to x
Ψ : setType → natType
Ψ x .N-ob c = λ f → (F ⟪ f ⟫) x
Ψ x .N-hom g
= funExt (λ f → (F ⟪ f ⋆⟨ C ⟩ g ⟫) x
≡[ i ]⟨ (F .F-seq f g) i x ⟩
(F ⟪ g ⟫) ((F ⟪ f ⟫) x)
∎)
theIso : Iso natType setType
theIso .fun = ϕ
theIso .inv = Ψ
theIso .rightInv x i = F .F-id i x
theIso .leftInv α@(natTrans αo αh) = NatTrans-≡-intro (sym αo≡βo) (symP αh≡βh)
where
β = Ψ (ϕ α)
βo = β .N-ob
βh = β .N-hom
-- equivalence of action on objects follows
-- from simple equational reasoning using naturality
αo≡βo : αo ≡ βo
αo≡βo = funExt λ x → funExt λ f
→ αo x f
≡[ i ]⟨ αo x (C .⋆IdL f (~ i)) ⟩ -- expand into the bottom left of the naturality diagram
αo x (C .id c ⋆⟨ C ⟩ f)
≡[ i ]⟨ αh f i (C .id c) ⟩ -- apply naturality
(F ⟪ f ⟫) ((αo _) (C .id c))
∎
-- type aliases for natural transformation
NOType = N-ob-Type (C [ c ,-]) F
NHType = N-hom-Type (C [ c ,-]) F
-- equivalence of commutative squares follows from SET being a Category
αh≡βh : PathP (λ i → NHType (αo≡βo i)) αh βh -- αh βh
αh≡βh = isPropHomP αh βh αo≡βo
where
isProp-hom : ⦃ isCatSET : isCategory (SET ℓ') ⦄ → (ϕ : NOType) → isProp (NHType ϕ)
isProp-hom ⦃ isCatSET ⦄ γ = isPropImplicitΠ λ x
→ isPropImplicitΠ λ y
→ isPropΠ λ f
→ isCatSET .isSetHom {x = (C [ c , x ]) , (isCatC .isSetHom)} {F ⟅ y ⟆} _ _
isPropHomP : isOfHLevelDep 1 (λ ηo → NHType ηo)
isPropHomP = isOfHLevel→isOfHLevelDep 1 λ a → isProp-hom a
-- Naturality of the bijection
-- in the functor
-- it's equivalent to apply ϕ to α then do β ⟦ c ⟧
-- or apply ϕ the the composite nat trans α ◍ β
-- where ϕ takes a natural transformation to its representing element
yonedaIsNaturalInFunctor : ∀ {F G : Functor C (SET ℓ')} (c : C .ob)
→ (β : F ⇒ G)
→ (fun (yoneda G c) ◍ compTrans β) ≡ (β ⟦ c ⟧ ◍ fun (yoneda F c))
yonedaIsNaturalInFunctor {F = F} {G} c β = funExt λ α → refl
-- in the object
-- it's equivalent to apply ϕ and then F ⟪ f ⟫
-- or to apply ϕ to the natural transformation obtained by precomposing with f
yonedaIsNaturalInOb : ∀ {F : Functor C (SET ℓ')}
→ (c c' : C .ob)
→ (f : C [ c , c' ])
→ yoneda F c' .fun ◍ preComp f ≡ F ⟪ f ⟫ ◍ yoneda F c .fun
yonedaIsNaturalInOb {F = F} c c' f = funExt (λ α
→ (yoneda F c' .fun ◍ preComp f) α
≡⟨ refl ⟩
(α ⟦ c' ⟧) (f ⋆⟨ C ⟩ C .id c')
≡[ i ]⟨ (α ⟦ c' ⟧) (C .⋆IdR f i) ⟩
(α ⟦ c' ⟧) f
≡[ i ]⟨ (α ⟦ c' ⟧) (C .⋆IdL f (~ i)) ⟩
(α ⟦ c' ⟧) (C .id c ⋆⟨ C ⟩ f)
≡[ i ]⟨ (α .N-hom f i) (C .id c) ⟩
(F ⟪ f ⟫) ((α ⟦ c ⟧) (C .id c))
≡⟨ refl ⟩
((F ⟪ f ⟫) ◍ yoneda F c .fun) α
∎)
-- Yoneda embedding
-- TODO: probably want to rename/refactor
module _ {C : Precategory ℓ ℓ} ⦃ C-cat : isCategory C ⦄ where
open Functor
open NatTrans
open Precategory C
yo : ob → Functor (C ^op) (SET ℓ)
yo x .F-ob y .fst = C [ y , x ]
yo x .F-ob y .snd = C-cat .isSetHom
yo x .F-hom f g = f ⋆⟨ C ⟩ g
yo x .F-id i f = ⋆IdL f i
yo x .F-seq f g i h = ⋆Assoc g f h i
YO : Functor C (PreShv C ℓ)
YO .F-ob = yo
YO .F-hom f .N-ob z g = g ⋆⟨ C ⟩ f
YO .F-hom f .N-hom g i h = ⋆Assoc g h f i
YO .F-id = makeNatTransPath λ i _ → λ f → ⋆IdR f i
YO .F-seq f g = makeNatTransPath λ i _ → λ h → ⋆Assoc h f g (~ i)
module _ {x} (F : Functor (C ^op) (SET ℓ)) where
yo-yo-yo : NatTrans (yo x) F → F .F-ob x .fst
yo-yo-yo α = α .N-ob _ (id _)
no-no-no : F .F-ob x .fst → NatTrans (yo x) F
no-no-no a .N-ob y f = F .F-hom f a
no-no-no a .N-hom f = funExt λ g i → F .F-seq g f i a
yoIso : Iso (NatTrans (yo x) F) (F .F-ob x .fst)
yoIso .Iso.fun = yo-yo-yo
yoIso .Iso.inv = no-no-no
yoIso .Iso.rightInv b i = F .F-id i b
yoIso .Iso.leftInv a = makeNatTransPath (funExt λ _ → funExt rem)
where
rem : ∀ {z} (x₁ : C [ z , x ]) → F .F-hom x₁ (yo-yo-yo a) ≡ (a .N-ob z) x₁
rem g =
F .F-hom g (yo-yo-yo a)
≡[ i ]⟨ a .N-hom g (~ i) (id x) ⟩
a .N-hom g i0 (id x)
≡[ i ]⟨ a .N-ob _ (⋆IdR g i) ⟩
(a .N-ob _) g
∎
yoEquiv : NatTrans (yo x) F ≃ F .F-ob x .fst
yoEquiv = isoToEquiv yoIso
isFullYO : isFull YO
isFullYO x y F[f] = ∣ yo-yo-yo _ F[f] , yoIso {x} (yo y) .Iso.leftInv F[f] ∣
isFaithfulYO : isFaithful YO
isFaithfulYO x y f g p i =
hcomp
(λ j → λ{ (i = i0) → ⋆IdL f j; (i = i1) → ⋆IdL g j})
(yo-yo-yo _ (p i))
|
programs/oeis/071/A071582.asm | neoneye/loda | 22 | 88893 | ; A071582: Powers of 4 written backwards.
; 1,4,61,46,652,4201,6904,48361,63556,441262,6758401,4034914,61277761,46880176,654534862,4281473701,6927694924,48196897171,63767491786,449609778472,6777261159901,4011156408934,61444068129571,46677144786307,656017679474182,4262486099985211,6940737269953054,48918490589341081,63972973049575027,447117151673032882,6796486064051292511,4097837248106861164,61615590737044764481,46460283849267968737,658528253971509741592,4243031147170261950811,6963125469682846632274,48745808587413956498881,63191432341952736875557,445676392756309454132203,6716074719264169185298021,4074288966158548723075384,61889259766043831131824391,46259118176263355425217377,650187427860543128900584903,4224219984720835829300497321,6986946959901251417510671594,48578958389348066582604070891,63305934539573346241526182297,443108571473053750750056219613,6735023076941049228220060567621,4051282186895067192190042060705,61068215274932407615630690428202,46044150098759618660641483692118,652675020651387627624856355815423,4205032804262317096073364124708921,6900229236940358267284358586922915,48308861358912141501393143478196702,63512576214978465024275563794767038,441680070567159522869822649899603233
mov $1,4
pow $1,$0
seq $1,4086 ; Read n backwards (referred to as R(n) in many sequences).
mov $0,$1
|
29_2.asm | elder-george/black_book_vga | 2 | 90873 | ; Program to restore a mode 10h EGA graphics screen from
; the file SNAPSHOT.SCR.
global start
%include 'common.inc'
%include 'dos_api.inc'
section stack stack
resb 256
DISPLAYED_SCREEN_SIZE equ (640/8)*350
section data
Filename db 'SNAPSHOT.SCR',0 ;name of file we're restoring from
ErrMsg1 db '*** Could not open SNAPSHOT.SCR ***',0dh,0ah,'$'
ErrMsg2 db '*** Error reading from SNAPSHOT.SCR ***',0dh,0ah,'$'
WaitKeyMsg db 0dh, 0ah, 'Done. Press any key to end...',0dh,0ah,'$'
Handle resw 1 ;handle of file we're restoring from
Plane resb 1 ;plane being written
section code
start:
mov ax, data
mov ds, ax
SET_VIDEO_MODE MODE_V640x350x16
FILE_OPEN Filename, 0
mov [Handle], ax
jnc .RestoreTheScreen
SHOW_MESSAGE data, ErrMsg1
jmp .exit
.RestoreTheScreen:
mov byte[Plane], 0
.RestoreLoop:
mov cl, [Plane]
mov al, 1
shl al, cl
SET_SC SC_MAP_MASK, al
xor dx, dx
push ds
FILE_READ [Handle], VGA_VIDEO_SEGMENT, dx, DISPLAYED_SCREEN_SIZE
pop ds
jc .ReadError
cmp ax, DISPLAYED_SCREEN_SIZE
je .RestoreLoopBottom
.ReadError:
SHOW_MESSAGE data, ErrMsg2
jmp .CloseFile
.RestoreLoopBottom:
mov al, [Plane]
inc al
mov [Plane], al
cmp al, 3
jbe .RestoreLoop
.CloseFile:
FILE_CLOSE [Handle]
.exit:
WAIT_FOR_KEYPRESS
SET_VIDEO_MODE MODE_T80x50
EXIT 0 |
programs/oeis/034/A034444.asm | neoneye/loda | 22 | 8992 | ; A034444: a(n) is the number of unitary divisors of n (d such that d divides n, gcd(d, n/d) = 1).
; 1,2,2,2,2,4,2,2,2,4,2,4,2,4,4,2,2,4,2,4,4,4,2,4,2,4,2,4,2,8,2,2,4,4,4,4,2,4,4,4,2,8,2,4,4,4,2,4,2,4,4,4,2,4,4,4,4,4,2,8,2,4,4,2,4,8,2,4,4,8,2,4,2,4,4,4,4,8,2,4,2,4,2,8,4,4,4,4,2,8,4,4,4,4,4,4,2,4,4,4
seq $0,1221 ; Number of distinct primes dividing n (also called omega(n)).
mov $1,2
pow $1,$0
mov $0,$1
|
src/asis/a4g-a_sem.adb | My-Colaborations/dynamo | 15 | 26561 | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . A _ S E M --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2012, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY 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 ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.<EMAIL>). --
-- --
------------------------------------------------------------------------------
with Asis.Declarations; use Asis.Declarations;
with Asis.Elements; use Asis.Elements;
with Asis.Expressions; use Asis.Expressions;
with Asis.Extensions; use Asis.Extensions;
with Asis.Iterator; use Asis.Iterator;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Types; use A4G.A_Types;
with A4G.Contt.TT; use A4G.Contt.TT; use A4G.Contt;
with A4G.Contt.UT; use A4G.Contt.UT;
with A4G.Mapping; use A4G.Mapping;
with Atree; use Atree;
with Namet; use Namet;
with Nlists; use Nlists;
with Sem_Aux; use Sem_Aux;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Snames; use Snames;
package body A4G.A_Sem is
----------------------
-- Local subprogram --
----------------------
function Is_Importing_Pragma
(N : Node_Id;
For_Name : Name_Id)
return Boolean;
-- Checks if N is a node representing Import or Interface pragma that
-- is applied to the name For_Name
-----------------------------
-- Belongs_To_Limited_View --
-----------------------------
function Belongs_To_Limited_View (Decl : Asis.Element) return Boolean is
Result : Boolean := False;
begin
case Declaration_Kind (Decl) is
when An_Ordinary_Type_Declaration |
A_Task_Type_Declaration |
A_Protected_Type_Declaration |
An_Incomplete_Type_Declaration |
A_Tagged_Incomplete_Type_Declaration |
A_Private_Type_Declaration |
A_Private_Extension_Declaration |
A_Package_Declaration =>
Result := True;
when others =>
null;
end case;
return Result;
end Belongs_To_Limited_View;
------------------------------
-- Char_Defined_In_Standard --
------------------------------
function Char_Defined_In_Standard (N : Node_Id) return Boolean is
N_Etype : Node_Id;
begin
N_Etype := Etype (N);
if No (N_Etype) then
-- It may happen for array literal rewritten into a string literal,
-- so some additional digging is needed
N_Etype := Parent (N);
if Nkind (N_Etype) = N_String_Literal then
N_Etype := Etype (N_Etype);
if Ekind (N_Etype) = E_String_Literal_Subtype then
N_Etype := Component_Type (N_Etype);
end if;
else
N_Etype := Empty;
end if;
end if;
return Present (N_Etype) and then
Sloc (N_Etype) <= Standard_Location;
end Char_Defined_In_Standard;
------------------------
-- Corr_Decl_For_Stub --
------------------------
function Corr_Decl_For_Stub (Stub_Node : Node_Id) return Node_Id is
Result_Node : Node_Id := Empty;
Stub_Entity_Node : Node_Id;
Scope_Node : Node_Id;
Search_Node : Node_Id;
Search_Node_Kind : Node_Kind;
List_To_Search : List_Id;
Search_In_Package : Boolean;
Decl_Found : Boolean := False;
Priv_Decl_Passed : Boolean := False;
Body_Passed : Boolean := False;
procedure Search_In_List;
-- looks for a possible subprogram declaration node for which
-- the given stub is a completion, using global settings for
-- List_To_Search and Search_Node
function Is_Spec_For_Stub
(Search_Node : Node_Id;
Stub_Node : Node_Id;
Stub_Entity_Node : Node_Id)
return Boolean;
-- check if the current Search_Node is a corresponding definition
-- for a given stub. We cannot directly use the Corresponding_Body
-- field here, because in case when subunits are around, this field
-- will point to a proper body of a subunit, but not to a stub
-- This function is called only for those nodes for which
-- Corresponding_Body field makes sense
function Is_Spec_For_Stub
(Search_Node : Node_Id;
Stub_Node : Node_Id;
Stub_Entity_Node : Node_Id)
return Boolean
is
Corr_Body_Node : constant Node_Id := Corresponding_Body (Search_Node);
N : Node_Id;
begin
if Corr_Body_Node = Stub_Entity_Node then
return True;
else
-- we have to check if we are in the proper body of a subunit
N := Parent (Corr_Body_Node);
if Nkind (N) = N_Procedure_Specification or else
Nkind (N) = N_Function_Specification
then
N := Parent (N);
end if;
N := Parent (N);
-- now, in case of subunit's parent body, we should be in
-- N_Subunit node
if Nkind (N) = N_Subunit then
return Corresponding_Stub (N) = Stub_Node;
else
return False;
end if;
end if;
end Is_Spec_For_Stub;
procedure Search_In_List is
begin
while Present (Search_Node) loop
Search_Node_Kind := Nkind (Search_Node);
if (Search_Node_Kind = N_Subprogram_Declaration or else
Search_Node_Kind = N_Generic_Subprogram_Declaration or else
Search_Node_Kind = N_Package_Declaration or else
Search_Node_Kind = N_Generic_Package_Declaration or else
Search_Node_Kind = N_Single_Task_Declaration or else
Search_Node_Kind = N_Task_Type_Declaration or else
Search_Node_Kind = N_Single_Protected_Declaration or else
Search_Node_Kind = N_Protected_Type_Declaration)
and then
Is_Spec_For_Stub (Search_Node, Stub_Node, Stub_Entity_Node)
-- ???Corresponding_Body (Search_Node) = Stub_Entity_Node
then
-- the corresponding declaration for the stub is found
Result_Node := Search_Node;
Decl_Found := True;
return;
elsif Search_Node = Stub_Node then
-- no need to search any mode, no declaration exists,
-- the stub itself works as a declaration
Decl_Found := True;
return;
end if;
Search_Node := Next_Non_Pragma (Search_Node);
end loop;
end Search_In_List;
begin -- Corr_Decl_For_Stub
-- first, setting Stub_Entity_Node:
if Nkind (Stub_Node) = N_Subprogram_Body_Stub then
Stub_Entity_Node := Defining_Unit_Name (Specification (Stub_Node));
else
Stub_Entity_Node := Defining_Identifier (Stub_Node);
end if;
-- then, defining the scope node and list to search in:
Scope_Node := Scope (Stub_Entity_Node);
if No (Scope_Node) then
-- Unfortunately, this is the case for stubs of generic units
-- with no (non-generic) parameters
Scope_Node := Stub_Entity_Node;
while not (Nkind (Scope_Node) = N_Package_Body or else
Nkind (Scope_Node) = N_Subprogram_Body)
loop
Scope_Node := Parent (Scope_Node);
end loop;
if Nkind (Scope_Node) = N_Package_Body then
Scope_Node := Corresponding_Spec (Scope_Node);
else
Scope_Node := Defining_Unit_Name (Specification (Scope_Node));
end if;
end if;
if Ekind (Scope_Node) = E_Generic_Package or else
Ekind (Scope_Node) = E_Package
then
Search_In_Package := True;
Scope_Node := Parent (Scope_Node);
if Nkind (Scope_Node) = N_Defining_Program_Unit_Name then
-- we are in a child library package
Scope_Node := Parent (Scope_Node);
end if;
-- now we are in the package spec
List_To_Search := Visible_Declarations (Scope_Node);
if No (List_To_Search) then
List_To_Search := Private_Declarations (Scope_Node);
Priv_Decl_Passed := True;
if No (List_To_Search) then
List_To_Search := List_Containing (Stub_Node);
-- what else could it be?
Body_Passed := True;
end if;
end if;
else
Search_In_Package := False;
List_To_Search := List_Containing (Stub_Node);
-- The following code was here for many years, but it seems that the
-- only effect of this conditional processing is failures in case
-- if we have a stub following the corresponding declaration in the
-- body of library generic subprogram. We keep it commented out just
-- in case.
-- -- The situation of the stub for generic subprogram having
-- -- (non-generic) parameters makes a special case:
-- if Ekind (Scope_Node) in Generic_Unit_Kind
-- and then
-- Corresponding_Stub (Parent (Parent (Parent (Corresponding_Body
-- (Parent (Parent (Scope_Node))))))) =
-- Stub_Node
-- then
-- return Parent (Parent (Scope_Node));
-- else
-- Search_In_Package := False;
-- List_To_Search := List_Containing (Stub_Node);
-- end if;
end if;
Search_Node := First_Non_Pragma (List_To_Search);
Search_In_List;
-- now, if we are in a package, and if we have not found the result
-- (or passed the stub node), we have to continue:
if Search_In_Package and then not Decl_Found then
-- where should we continue the search?
if not Priv_Decl_Passed then
List_To_Search := Private_Declarations (Scope_Node);
Priv_Decl_Passed := True;
if No (List_To_Search) then
List_To_Search := List_Containing (Stub_Node);
Body_Passed := True;
end if;
elsif not Body_Passed then
List_To_Search := List_Containing (Stub_Node);
Body_Passed := True;
end if;
Search_Node := First_Non_Pragma (List_To_Search);
Search_In_List;
if not Decl_Found then
-- if we are here, we have to search the package body,
-- where the stub itself is
List_To_Search := List_Containing (Stub_Node);
Search_Node := First_Non_Pragma (List_To_Search);
Search_In_List;
end if;
end if;
return Result_Node;
end Corr_Decl_For_Stub;
-------------------------
-- Defined_In_Standard --
-------------------------
function Defined_In_Standard (N : Node_Id) return Boolean is
N_Entity : Node_Id := Empty;
N_Etype : Node_Id := Empty;
Result : Boolean := False;
begin
if Nkind (N) in N_Has_Entity then
N_Entity := Entity (N);
elsif Nkind (N) in Sinfo.N_Entity then
N_Entity := N;
end if;
if Present (N_Entity) then
N_Etype := Etype (N_Entity);
end if;
Result :=
Present (N_Entity) and then
Present (N_Etype) and then
Sloc (N_Entity) <= Standard_Location and then
Sloc (N_Etype) <= Standard_Location;
return Result;
end Defined_In_Standard;
--------------------
-- Entity_Present --
--------------------
function Entity_Present (N : Node_Id) return Boolean is
Result : Boolean := Present (Entity (N));
begin
if Result then
Result := Nkind (Entity (N)) in N_Entity;
end if;
return Result;
end Entity_Present;
--------------------------------
-- Explicit_Parent_Subprogram --
--------------------------------
function Explicit_Parent_Subprogram (E : Entity_Id) return Entity_Id is
Result : Entity_Id := Empty;
E_Ekind : constant Entity_Kind := Ekind (E);
Parent_Type : Entity_Id;
Tmp_Res : Entity_Id;
begin
-- The problem here is that we can not just traverse the Alias chain,
-- because in case if the parent subprogram is declared by the
-- subprogram renaming and the renamed entity is an intrinsic
-- subprogram, the Alias field of the derived subprogram will
-- point not to the parent renaming declaration, but to this
-- intrinsic subprogram (see F407-016).
if Is_Intrinsic_Subprogram (E)
and then
Present (Alias (E))
and then
Defined_In_Standard (Alias (E))
then
-- Here we may have a renaming declaration, and the renamed entity
-- is a predefined operation. So we have to traverse the derivation
-- chain and to try to locate the explicit renaming that is the cause
-- of the existing of this derived subprogram.
Parent_Type := Etype (E);
Parent_Type := Etype (Parent_Type);
Parent_Type := Parent (Parent_Type);
Parent_Type := Defining_Identifier (Parent_Type);
-- Here we should have Parent_Type pointing to the entity of the
-- parent type
Tmp_Res := Next_Entity (Parent_Type);
while Present (Tmp_Res) loop
if Ekind (Tmp_Res) = E_Ekind
and then
Is_Intrinsic_Subprogram (Tmp_Res)
and then
Chars (Tmp_Res) = Chars (E)
and then
Alias (Tmp_Res) = Alias (E)
then
Result := Tmp_Res;
exit;
end if;
Tmp_Res := Next_Entity (Tmp_Res);
end loop;
if Present (Result)
and then
not Comes_From_Source (Result)
then
Result := Explicit_Parent_Subprogram (Result);
end if;
else
Result := Alias (E);
while Present (Alias (Result))
and then
not Comes_From_Source (Result)
loop
Result := Alias (Result);
end loop;
end if;
return Result;
end Explicit_Parent_Subprogram;
--------------------------
-- Get_Actual_Type_Name --
--------------------------
function Get_Actual_Type_Name (Type_Mark_Node : Node_Id) return Node_Id is
Result : Node_Id := Type_Mark_Node;
Tmp_Node : Node_Id;
begin
if Is_From_Instance (Type_Mark_Node) then
Tmp_Node := Entity (Type_Mark_Node);
if Present (Tmp_Node)
and then
Ekind (Tmp_Node) in Einfo.Type_Kind
then
Tmp_Node := Parent (Tmp_Node);
end if;
if Nkind (Tmp_Node) = N_Subtype_Declaration
and then
not Is_Rewrite_Substitution (Tmp_Node)
and then
not Comes_From_Source (Tmp_Node)
then
Result := Sinfo.Subtype_Indication (Tmp_Node);
-- In case of nested instantiations, we have to traverse
-- the chain of subtype declarations created by the compiler
-- for actual types
while Is_From_Instance (Result)
and then
Nkind (Parent (Entity (Result))) = N_Subtype_Declaration
and then
not Comes_From_Source (Parent (Entity (Result)))
loop
Result := Parent (Entity (Result));
if Is_Rewrite_Substitution (Result) then
-- The case when the actual type is a derived type. Here
-- the chain of subtypes leads to the artificial internal
-- type created by the compiler, but not to the actual type
-- (8924-006)
Result := Sinfo.Defining_Identifier (Result);
while Present (Homonym (Result)) loop
Result := Homonym (Result);
end loop;
exit;
end if;
Result := Sinfo.Subtype_Indication (Result);
end loop;
end if;
end if;
return Result;
end Get_Actual_Type_Name;
----------------------------
-- Get_Corr_Called_Entity --
----------------------------
function Get_Corr_Called_Entity
(Call : Asis.Element)
return Asis.Declaration
is
Arg_Node : Node_Id;
Arg_Node_Kind : Node_Kind;
Result_Node : Node_Id;
Result_Unit : Compilation_Unit;
Special_Case : Special_Cases := Not_A_Special_Case;
Result_Kind : Internal_Element_Kinds := Not_An_Element;
Inherited : Boolean := False;
Res_Node_Field_1 : Node_Id := Empty;
Tmp_Node : Node_Id;
Result_El : Asis.Element;
begin
-- The general implementation approach is:
--
-- 1. First, we try to define Result_Node as pointing to the tree
-- node on which the resulting ASIS Element should be based.
-- During this step Arg_Node is also set (and probably adjusted)
--
-- 2. If the result looks like representing an Ada implicit construct
-- (for now the main and the only check is
-- Comes_From_Source (Result_Node)), at the second step we
-- form the representation of the implicit inherited user-defined
-- subprogram by setting Result_Node pointing to the explicit
-- declaration of the subprogram being inherited, and
-- Res_Node_Field_1 pointing to the defining identifier node
-- corresponding to the given implicit subprogram. Note, that
-- at the moment implicit predefined operations are not
-- implemented.
--
-- 3. On the last step we compute additional attributes of the
-- resulting Element.
------------------------------------------------------------------
-- 1. Defining Result_Node (and adjusting Arg_Node, if needed) --
------------------------------------------------------------------
Arg_Node := R_Node (Call);
Arg_Node_Kind := Nkind (Arg_Node);
Tmp_Node := Node (Call);
-- Rewritten node should know everything. But if in case of a function
-- call this node is the result of compile-time optimization,
-- we have to work with original node only:
if Arg_Node_Kind = N_String_Literal or else
Arg_Node_Kind = N_Integer_Literal or else
Arg_Node_Kind = N_Real_Literal or else
Arg_Node_Kind = N_Character_Literal or else
Arg_Node_Kind = N_Raise_Constraint_Error or else
Arg_Node_Kind = N_Raise_Program_Error or else
Arg_Node_Kind = N_Conditional_Expression or else
Arg_Node_Kind = N_Explicit_Dereference or else
Arg_Node_Kind = N_Type_Conversion or else
Arg_Node_Kind = N_Unchecked_Type_Conversion or else
Arg_Node_Kind = N_Identifier or else
(Arg_Node_Kind in N_Op
and then
(Nkind (Tmp_Node) = N_Function_Call
or else
(Nkind (Tmp_Node) in N_Op
and then
Entity_Present (Tmp_Node)
and then
(Pass_Generic_Actual (Parent (Parent ((Entity (Tmp_Node)))))))))
then
Arg_Node := Node (Call);
Arg_Node_Kind := Nkind (Arg_Node);
end if;
case Arg_Node_Kind is
when N_Attribute_Reference =>
return Nil_Element;
-- call to a procedure-attribute or to a function-attribute
-- but in case when a representation clause was applied
-- to define stream IOU attributes, we can return something
-- more interesting, then Nil_Element, see the corresponding
-- Aladdin's message
when N_Entry_Call_Statement |
N_Procedure_Call_Statement |
N_Function_Call =>
-- here we have to filter out the case when Nil_Element
-- should be returned for a call through access-to-function:
if Nkind (Sinfo.Name (Arg_Node)) = N_Explicit_Dereference then
return Nil_Element;
end if;
if Arg_Node_Kind = N_Entry_Call_Statement then
Arg_Node := Sinfo.Name (Arg_Node);
-- Arg_Node points to the name of the called entry
if Nkind (Arg_Node) = N_Indexed_Component then
-- this is the case for a call to an entry from an
-- entry family
Arg_Node := Prefix (Arg_Node);
end if;
Result_Node := Entity (Selector_Name (Arg_Node));
else
-- here we have Arg_Node_Kind equal to
-- N_Procedure_Call_Statement or to N_Function_Call, and this
-- is the right place to check if this is a dispatching call.
-- We do not want to use Asis.Extensions.Is_Dispatching_Call
-- query here to avoid introducing dependency on
-- Asis.Extensions
if Present (Controlling_Argument (Arg_Node)) then
return Nil_Element;
end if;
Arg_Node := Sinfo.Name (Arg_Node);
if Nkind (Arg_Node) = N_Selected_Component then
-- this is the case for calls to protected subprograms
Result_Node := Entity (Selector_Name (Arg_Node));
else
Result_Node := Entity (Arg_Node);
end if;
end if;
if No (Result_Node)
and then
Arg_Node_Kind = N_Function_Call
and then
Is_From_Unknown_Pragma (R_Node (Call))
then
return Nil_Element;
end if;
when N_Op =>
-- all the predefined operations (??)
Result_Node := Entity (Arg_Node);
when others =>
pragma Assert (False);
null;
end case;
if Present (Result_Node)
and then
not Comes_From_Source (Result_Node)
and then
Nkind (Parent (Result_Node)) = N_Defining_Program_Unit_Name
then
-- Case of a child subprogram for that an explicit separate spec is
-- not given. Result_Node points to the defining identifier from
-- the subprogram spec artificially created by the compiler. We
-- reset it to point to the proper defining identifier from the
-- explicitly given body
Result_Node := Parent (Parent (Parent (Result_Node)));
pragma Assert (Nkind (Result_Node) = N_Subprogram_Declaration);
Result_Node := Corresponding_Body (Result_Node);
end if;
pragma Assert (Present (Result_Node));
-- it is possible, that for a subprogram defined by a stub, the
-- subprogram body declaration from the corresponding subunit is
-- returned. In this case we have to go to the corresponding
-- stub (the subprogram body which is the proper body from a
-- subunit can never be returned as a corresponding called entity)
Set_Stub_For_Subunit_If_Any (Result_Node);
if Is_Generic_Instance (Result_Node) then
Result_Node := Get_Instance_Name (Result_Node);
end if;
Tmp_Node := Original_Node (Parent (Parent (Result_Node)));
while Nkind (Tmp_Node) = N_Subprogram_Renaming_Declaration
and then
not (Comes_From_Source (Tmp_Node))
and then
not Pass_Generic_Actual (Tmp_Node)
loop
-- Result_Node is a defining name from the artificial renaming
-- declarations created by the compiler in the for wrapper
-- package for expanded subprogram instantiation. We
-- have to go to expanded subprogram spec which is renamed.
--
-- We have to do this in a loop in case of nested instantiations
Result_Node := Sinfo.Name (Tmp_Node);
if Nkind (Result_Node) = N_Selected_Component then
Result_Node := Selector_Name (Result_Node);
end if;
Result_Node := Entity (Result_Node);
Tmp_Node := Parent (Parent (Result_Node));
end loop;
-- F703-020: operations of an actual type provided for the formal
-- derived type (we are in the expanded generic)
if not Comes_From_Source (Result_Node)
and then
Present (Alias (Result_Node))
and then
not (Is_Intrinsic_Subprogram (Result_Node))
and then
Pass_Generic_Actual (Parent (Result_Node))
then
-- This means that we have an operation of an actual that corresponds
-- to the generic formal derived type. In the tree, these operations
-- are "(re)defined" for the artificial subtype declaration used to
-- pass the actual type into expanded template. We go one step up
-- the aliases chain to get to the proper declaration of the type
-- operation
Result_Node := Alias (Result_Node);
end if;
-- the code below is very similar to what we have in
-- A4G.Expr_Sem.Identifier_Name_Definition (this name may be changed)!
-- In future we'll probably have to re-study this again (???)
-- first, defining the Enclosing Unit and doing the consistency check
-----------------------------------------------------------
-- 2. Defining Association_Etype as the type "producing" --
-- a given implicit construct (if needed) --
-----------------------------------------------------------
-- We have to turn off for a while the full processing of the
-- implicit elements (Hope to fix this soon).
if (not Comes_From_Source (Result_Node)
or else
Is_Artificial_Protected_Op_Item_Spec (Result_Node))
and then
not Pass_Generic_Actual (Parent (Parent (Result_Node)))
then
if Present (Alias (Result_Node))
and then
Nkind (Original_Node (Parent (Result_Node))) in
N_Formal_Type_Declaration .. N_Private_Extension_Declaration
then
-- ???Is this the right test for implicit inherited user-defined
-- subprogram???
Inherited := True;
Res_Node_Field_1 := Result_Node;
while Present (Alias (Result_Node))
and then
not Comes_From_Source (Result_Node)
loop
Result_Node := Alias (Result_Node);
end loop;
elsif Is_Generic_Instance (Result_Node) then
Special_Case := Expanded_Subprogram_Instantiation;
elsif Is_Artificial_Protected_Op_Item_Spec (Result_Node) then
Result_Node := Corresponding_Body (Parent (Parent (Result_Node)));
elsif Ekind (Result_Node) = E_Function
and then
not Comes_From_Source (Result_Node)
and then
Chars (Result_Node) = Name_Op_Ne
and then
Present (Corresponding_Equality (Result_Node))
then
Special_Case := Is_From_Imp_Neq_Declaration;
-- |A2012 start SCz
-- elsif Nkind (Original_Node ((Parent (Parent (Result_Node))))) =
-- N_Expression_Function
-- then
-- null;
-- |A2012 end
else
return Nil_Element;
-- ???!!! this turns off all the predefined operations!!!
end if;
end if;
-- Now, checking if we have a call to an entry/procedure/function of
-- derived task/protected type
Tmp_Node := Arg_Node;
if Nkind (Tmp_Node) = N_Selected_Component then
Tmp_Node := Prefix (Tmp_Node);
Tmp_Node := Etype (Tmp_Node);
if Ekind (Tmp_Node) in Concurrent_Kind then
while not Comes_From_Source (Original_Node (Parent (Tmp_Node)))
loop
Tmp_Node := Etype (Tmp_Node);
end loop;
Tmp_Node := Parent (Tmp_Node);
if Nkind (Tmp_Node) = N_Full_Type_Declaration
and then
Nkind (Sinfo.Type_Definition (Tmp_Node)) =
N_Derived_Type_Definition
then
Inherited := True;
Res_Node_Field_1 := Tmp_Node;
end if;
end if;
end if;
if Present (Res_Node_Field_1) then
Result_Unit :=
Enclosing_Unit (Encl_Cont_Id (Call), Res_Node_Field_1);
else
Result_Unit :=
Enclosing_Unit (Encl_Cont_Id (Call), Result_Node);
end if;
-- ??? should be changed when full processing of implicit elements
-- will be ready
-- And now - from a defining name to a declaration itself
-- (this also may need adjustment for the full implementation
-- of the implicit stuff)
if Inherited then
-- For inherited subprograms we have to set the result kind manually
-- to get subprogram declarations in case of inheriting from
-- subprogram ransoming (8728-023)
if Ekind (Result_Node) = E_Function or else
Ekind (Result_Node) = E_Operator
then
Result_Kind := A_Function_Declaration;
elsif Ekind (Result_Node) = E_Procedure then
if Null_Present (Parent (Result_Node)) then
Result_Kind := A_Null_Procedure_Declaration;
else
Result_Kind := A_Procedure_Declaration;
end if;
end if;
end if;
if Special_Case not in Predefined then
if Nkind (Result_Node) in N_Entity
and then
Ekind (Result_Node) = E_Enumeration_Literal
then
-- This happens if an enumeration literal is used as an actual for
-- a formal function, and if we process the corresponding function
-- call in the instantiation. See EBB11-004
Result_Kind := An_Enumeration_Literal_Specification;
else
Result_Node := Parent (Result_Node);
if Nkind (Result_Node) = N_Defining_Program_Unit_Name then
Result_Node := Parent (Result_Node);
end if;
if Nkind (Result_Node) = N_Procedure_Specification or else
Nkind (Result_Node) = N_Function_Specification
then
Result_Node := Parent (Result_Node);
end if;
end if;
elsif Special_Case in Predefined then
Result_Kind := A_Function_Declaration;
end if;
Result_El :=
Node_To_Element_New
(Node => Result_Node,
Node_Field_1 => Res_Node_Field_1,
Internal_Kind => Result_Kind,
Spec_Case => Special_Case,
Inherited => Inherited,
In_Unit => Result_Unit);
-- Fix for C125-002: Is_Part_Of_Instance of the result is defined on
-- the base of Result_Node which points to the explicit subprogram.
-- That is, if we define the type derived from some other type declared
-- inside the instance, we will get all its inherited subprograms
-- being Is_Part_Of_Instance even if the derived type is not declared
-- inside any instance. And the other way around.
if Present (Res_Node_Field_1) then
if Is_From_Instance (Res_Node_Field_1) then
Set_From_Instance (Result_El, True);
else
Set_From_Instance (Result_El, False);
end if;
end if;
return Result_El;
end Get_Corr_Called_Entity;
----------------------
-- Get_Derived_Type --
----------------------
function Get_Derived_Type
(Type_Entity : Entity_Id;
Inherited_Subpr : Entity_Id)
return Entity_Id
is
Result : Entity_Id := Type_Entity;
Derived_Type : Entity_Id;
Next_Derived_Type : Entity_Id;
begin
Derived_Type := Original_Node (Parent (Inherited_Subpr));
Next_Derived_Type := Derived_Type;
if Nkind (Next_Derived_Type) = N_Full_Type_Declaration then
Next_Derived_Type := Sinfo.Type_Definition (Next_Derived_Type);
elsif Nkind (Next_Derived_Type) = N_Formal_Type_Declaration then
Next_Derived_Type := Sinfo.Formal_Type_Definition (Next_Derived_Type);
end if;
if Nkind (Next_Derived_Type) = N_Formal_Derived_Type_Definition then
Next_Derived_Type := Sinfo.Subtype_Mark (Next_Derived_Type);
else
Next_Derived_Type := Sinfo.Subtype_Indication (Next_Derived_Type);
end if;
Derived_Type := Defining_Identifier (Derived_Type);
if Nkind (Next_Derived_Type) = N_Subtype_Indication then
Next_Derived_Type := Sinfo.Subtype_Mark (Next_Derived_Type);
end if;
Next_Derived_Type := Entity (Next_Derived_Type);
loop
if Next_Derived_Type = Type_Entity then
Result := Derived_Type;
exit;
elsif Is_Derived_Type (Next_Derived_Type) then
Next_Derived_Type := Original_Node (Parent (Next_Derived_Type));
if Nkind (Next_Derived_Type) = N_Full_Type_Declaration then
Next_Derived_Type := Sinfo.Type_Definition (Next_Derived_Type);
end if;
Next_Derived_Type := Sinfo.Subtype_Indication (Next_Derived_Type);
if Nkind (Next_Derived_Type) = N_Subtype_Indication then
Next_Derived_Type := Sinfo.Subtype_Mark (Next_Derived_Type);
end if;
Next_Derived_Type := Entity (Next_Derived_Type);
else
exit;
end if;
end loop;
return Result;
end Get_Derived_Type;
--------------------------
-- Get_Importing_Pragma --
--------------------------
function Get_Importing_Pragma (E : Entity_Id) return Node_Id is
Result : Node_Id := Empty;
Tmp_Node : Node_Id;
Pragma_Node : Node_Id;
Arg_Chars : constant Name_Id := Chars (E);
begin
-- First, check if we have the corresponding pragma in the list of
-- representation items applied to the argument node:
Pragma_Node := First_Rep_Item (E);
while Present (Pragma_Node) loop
if Is_Importing_Pragma (Pragma_Node, Arg_Chars) then
Result := Pragma_Node;
exit;
else
Pragma_Node := Next_Rep_Item (Pragma_Node);
end if;
end loop;
if No (Result) then
-- That means that Import or Interface pragma is applied to an
-- overloaded entities
Pragma_Node := Next (Parent (Parent (E)));
while Present (Pragma_Node) loop
if Is_Importing_Pragma (Pragma_Node, Arg_Chars) then
Result := Pragma_Node;
exit;
else
Next (Pragma_Node);
end if;
end loop;
end if;
if No (Result) then
Tmp_Node := Parent (Parent (Parent (E)));
if Nkind (Tmp_Node) = N_Package_Specification
and then
List_Containing (Parent (Parent (E))) =
Visible_Declarations (Tmp_Node)
then
-- this is a somewhat exotic case - a subprogram declaration in
-- the visible part of a package spec, and the corresponding
-- pragma is in the corresponding private part.
Pragma_Node := First (Private_Declarations (Tmp_Node));
while Present (Pragma_Node) loop
if Is_Importing_Pragma (Pragma_Node, Arg_Chars) then
Result := Pragma_Node;
exit;
else
Next (Pragma_Node);
end if;
end loop;
end if;
end if;
pragma Assert (Present (Result));
return Result;
end Get_Importing_Pragma;
-----------------------
-- Get_Instance_Name --
-----------------------
function Get_Instance_Name (Int_Name : Node_Id) return Node_Id is
Result_Node : Node_Id := Empty;
Decl_Node : Node_Id;
begin
Decl_Node := Parent (Int_Name);
if Nkind (Decl_Node) = N_Defining_Program_Unit_Name then
Decl_Node := Parent (Decl_Node);
end if;
Decl_Node := Parent (Decl_Node);
if Nkind (Decl_Node) = N_Subprogram_Declaration then
Decl_Node := Parent (Parent (Decl_Node));
end if;
if (not Is_List_Member (Decl_Node)
and then
not Is_Rewrite_Substitution (Decl_Node))
or else
(Is_List_Member (Decl_Node)
and then
Nkind (Original_Node (Decl_Node)) = N_Formal_Package_Declaration)
then
-- The first condition corresponds to the case when a library
-- package is instantiated at library level - no artificial package
-- is created in this case.
-- The second condition corresponds to the defining name from
-- a formal package declaration (it is also classified as
-- Is_Generic_Instance)
return Int_Name;
end if;
-- now Decl_Node points to the declaration of an artificial package
-- created by the compiler for the instantiation
if Is_Rewrite_Substitution (Decl_Node) then
Decl_Node := Original_Node (Decl_Node);
if Is_Rewrite_Substitution (Decl_Node) then
-- The node can be rewritten twice in case when a library-level
-- instantiation is a supporter of a main unit, and the expanded
-- body of this instantiation is required according to Lib (h),
-- see 9418-015, 9416-A01 and 9426-A13
Decl_Node := Original_Node (Decl_Node);
end if;
if Nkind (Original_Node (Decl_Node)) =
N_Formal_Package_Declaration
then
Result_Node := Defining_Identifier (Original_Node (Decl_Node));
else
Result_Node := Defining_Unit_Name (Original_Node (Decl_Node));
end if;
else
Decl_Node := Next_Non_Pragma (Decl_Node);
while Present (Decl_Node) loop
if Nkind (Decl_Node) in N_Generic_Instantiation then
Result_Node := Defining_Unit_Name (Decl_Node);
exit;
else
Decl_Node := Next_Non_Pragma (Decl_Node);
end if;
end loop;
end if;
pragma Assert (Present (Result_Node));
return Result_Node;
end Get_Instance_Name;
------------------
-- Is_Anonymous --
------------------
function Is_Anonymous (E : Entity_Kind) return Boolean is
Result : Boolean := False;
begin
case E is
when E_Anonymous_Access_Subprogram_Type |
E_Anonymous_Access_Protected_Subprogram_Type |
E_Anonymous_Access_Type =>
Result := True;
when others =>
null;
end case;
return Result;
end Is_Anonymous;
-------------------
-- Is_Applied_To --
-------------------
function Is_Applied_To
(Pragma_Node : Node_Id;
Entity_Node : Entity_Id)
return Boolean
is
Result : Boolean := False;
Pragma_Arg : Node_Id := Empty;
Entity_Decl : Node_Id;
begin
case Pragma_Name (Pragma_Node) is
-- Cases when the second pragma argument indicates the entity
-- the pragma is applied to:
when Name_Component_Alignment |
Name_Convention |
Name_Export |
Name_External |
Name_Import |
Name_Interface =>
Pragma_Arg := First (Pragma_Argument_Associations (Pragma_Node));
Pragma_Arg := Sinfo.Expression (Next (Pragma_Arg));
if Entity (Pragma_Arg) = Entity_Node
or else
Chars (Pragma_Arg) = Chars (Entity_Node)
then
Result := True;
end if;
-- Cases when a pragma may have several arguments, and any of then
-- may indicate the entity the pragma is applied to
when Name_Inline |
Name_Inline_Always |
Name_No_Return |
Name_Unmodified |
Name_Unreferenced |
Name_Unreferenced_Objects =>
Pragma_Arg := First (Pragma_Argument_Associations (Pragma_Node));
while Present (Pragma_Arg) loop
Pragma_Arg := Sinfo.Expression (Pragma_Arg);
if Entity (Pragma_Arg) = Entity_Node
or else
Chars (Pragma_Arg) = Chars (Entity_Node)
then
Result := True;
exit;
end if;
Pragma_Arg := Next (Parent (Pragma_Arg));
end loop;
-- Cases when only the first argument of a pragma may indicate the
-- entity the pragma is applied to
when -- GNAT-specific pragmas first
Name_Common_Object |
Name_Complex_Representation |
Name_CPP_Class |
Name_CPP_Constructor |
Name_Export_Exception |
Name_Export_Function |
Name_Export_Object |
Name_Export_Procedure |
Name_Export_Valued_Procedure |
Name_Favor_Top_Level |
Name_Finalize_Storage_Only |
Name_Import_Exception |
Name_Import_Function |
Name_Import_Object |
Name_Import_Procedure |
Name_Import_Valued_Procedure |
Name_Inline_Generic |
Name_Interface_Name |
Name_Keep_Names |
Name_Linker_Alias |
Name_Linker_Constructor |
Name_Linker_Destructor |
Name_Linker_Section |
Name_Machine_Attribute |
Name_No_Strict_Aliasing |
Name_Persistent_BSS |
Name_Psect_Object |
Name_Pure_Function |
Name_Shared |
Name_Stream_Convert |
Name_Suppress_Initialization |
Name_Task_Storage |
Name_Universal_Aliasing |
Name_Weak_External |
-- Standard Ada 2005 pragmas
Name_Asynchronous |
Name_Atomic |
Name_Atomic_Components |
Name_Attach_Handler |
Name_Controlled |
Name_Discard_Names |
Name_Interrupt_Handler |
Name_Pack |
Name_Preelaborable_Initialization |
Name_Unchecked_Union |
Name_Volatile |
Name_Volatile_Components =>
Pragma_Arg := First (Pragma_Argument_Associations (Pragma_Node));
Pragma_Arg := Sinfo.Expression (Pragma_Arg);
if Entity (Pragma_Arg) = Entity_Node
or else
Chars (Pragma_Arg) = Chars (Entity_Node)
then
Result := True;
end if;
-- Cases when a specific processing is needed
when Name_Float_Representation =>
Pragma_Arg := First (Pragma_Argument_Associations (Pragma_Node));
if Present (Next (Pragma_Arg)) then
Pragma_Arg := Next (Pragma_Arg);
end if;
Pragma_Arg := Sinfo.Expression (Pragma_Arg);
if Entity (Pragma_Arg) = Entity_Node
or else
Chars (Pragma_Arg) = Chars (Entity_Node)
then
Result := True;
end if;
when Name_Obsolescent =>
if Is_Obsolescent (Entity_Node) then
-- This pragma may or may not contain the reference to the
-- entity it is applied to. The pragma may or may not contain
-- arguments
if Present (Pragma_Argument_Associations (Pragma_Node))
and then
List_Length (Pragma_Argument_Associations (Pragma_Node)) >= 2
then
Pragma_Arg :=
First (Pragma_Argument_Associations (Pragma_Node));
Pragma_Arg := Sinfo.Expression (Pragma_Arg);
end if;
if No (Pragma_Arg)
or else
Chars (Pragma_Arg) = Chars (Entity_Node)
then
-- here we have to check if the pragma immediately follows
-- the declaration that defines Entity_Node, or the pragma
-- is the first declarative element in the package spec and
-- Entity_Node defines this package. Pragma_Arg is used as
-- temporary node below
Pragma_Arg := Prev (Pragma_Node);
if Present (Pragma_Arg) then
-- Go to the declaration that declares Entity_Node
Entity_Decl := Parent (Entity_Node);
while Present (Entity_Decl)
and then
not Is_List_Member (Entity_Decl)
loop
Entity_Decl := Parent (Entity_Decl);
end loop;
Result := Entity_Decl = Pragma_Arg;
else
-- With the current implementation of the ASIS
-- Corresponding_Pragmas query this code never works!
-- Check if the pragma Obsolescent is the program unit
-- pragma:
Pragma_Arg := Parent (Pragma_Node);
if Nkind (Pragma_Arg) = N_Package_Specification then
if Nkind (Parent (Pragma_Arg)) =
N_Package_Declaration
then
-- To filter out the case of generic packages
Pragma_Arg := Defining_Unit_Name (Pragma_Arg);
if Nkind (Pragma_Arg) =
N_Defining_Program_Unit_Name
then
Pragma_Arg := Defining_Identifier (Pragma_Arg);
end if;
Result := Pragma_Arg = Entity_Node;
end if;
end if;
end if;
else
-- With the current implementation of the ASIS
-- Corresponding_Pragmas query this code never works!
-- Case when a pragma may be applied to an enumeration
-- literal.
if Ekind (Entity_Node) = E_Enumeration_Literal then
Entity_Decl := Parent (Parent (Entity_Node));
Result := Next (Entity_Decl) = Pragma_Node;
end if;
end if;
end if;
-- All the other pragmas cannot be a part of the result
when others =>
null;
end case;
return Result;
end Is_Applied_To;
------------------------------------------
-- Is_Artificial_Protected_Op_Item_Spec --
------------------------------------------
function Is_Artificial_Protected_Op_Item_Spec
(E : Entity_Id)
return Boolean
is
Arg : Entity_Id := E;
Result : Boolean := False;
begin
if Nkind (Arg) = N_Defining_Identifier then
-- No need to consider defining expanded names
if Ekind (Arg) in Formal_Kind then
Arg := Parent (Parent (Arg));
if Nkind (Arg) in N_Subprogram_Specification then
Arg := Defining_Unit_Name (Arg);
end if;
end if;
if Nkind (Arg) in N_Entity
and then
(Ekind (Arg) in Formal_Kind or else Ekind (Arg) in Subprogram_Kind)
and then
not Comes_From_Source (Parent (Arg))
and then
Nkind (Parent (Parent (Parent (Arg)))) = N_Protected_Body
then
Result := True;
end if;
end if;
return Result;
end Is_Artificial_Protected_Op_Item_Spec;
-------------------------
-- Is_Derived_Rep_Item --
-------------------------
function Is_Derived_Rep_Item
(Type_Entity : Entity_Id;
Rep_Item : Node_Id)
return Boolean
is
Result : Boolean := True;
Type_Ard : Node_Id := Empty;
begin
case Nkind (Rep_Item) is
when N_Attribute_Definition_Clause =>
if Entity (Sinfo.Name (Rep_Item)) = Type_Entity then
Result := False;
end if;
when N_Pragma =>
Type_Ard := Sinfo.Expression
(First (Pragma_Argument_Associations (Rep_Item)));
if Entity (Type_Ard) = Type_Entity then
Result := False;
end if;
when N_Enumeration_Representation_Clause |
N_Record_Representation_Clause =>
if Entity (Sinfo.Identifier (Rep_Item)) = Type_Entity then
Result := False;
end if;
when others =>
null;
pragma Assert (False);
end case;
return Result;
end Is_Derived_Rep_Item;
----------------------
-- Is_From_Instance --
----------------------
function Is_From_Instance (Node : Node_Id) return Boolean is
begin
return
(Sloc (Node) > Standard_Location
and then
Instantiation (Get_Source_File_Index (Sloc (Node))) /= No_Location)
or else
(Present (Parent (Node))
and then
Nkind (Parent (Node)) = N_Package_Specification
and then
Is_From_Instance ((Parent (Node))));
end Is_From_Instance;
---------------------------------
-- Is_From_Rewritten_Aggregate --
---------------------------------
function Is_From_Rewritten_Aggregate (Node : Node_Id) return Boolean is
Result : Boolean := False;
Next_Aggr : Node_Id;
begin
if Nkind (Node) = N_Component_Association then
Next_Aggr := Parent (Node);
while Nkind (Next_Aggr) = N_Aggregate
or else
Nkind (Next_Aggr) = N_Extension_Aggregate
loop
if Is_Rewrite_Substitution (Next_Aggr) then
Result := True;
exit;
end if;
Next_Aggr := Parent (Next_Aggr);
end loop;
end if;
return Result;
end Is_From_Rewritten_Aggregate;
----------------------------
-- Is_From_Unknown_Pragma --
----------------------------
function Is_From_Unknown_Pragma (Node : Node_Id) return Boolean is
Result : Boolean := False;
Tmp : Node_Id := Parent (Node);
N : Name_Id;
begin
while Nkind (Tmp) /= N_Compilation_Unit loop
case Nkind (Tmp) is
when N_Pragma =>
N := Pragma_Name (Tmp);
-- See Snames.Get_Pragma_Id
if not (
N in First_Pragma_Name .. Last_Pragma_Name
or else
N = Name_AST_Entry
or else
N = Name_Interface
or else
N = Name_Priority
or else
N = Name_Storage_Size
or else
N = Name_Storage_Unit)
then
Result := True;
end if;
exit;
when N_Statement_Other_Than_Procedure_Call |
N_Procedure_Call_Statement |
N_Representation_Clause |
N_Component_Declaration ..
N_Generic_Procedure_Renaming_Declaration =>
exit;
when others =>
Tmp := Parent (Tmp);
end case;
end loop;
return Result;
end Is_From_Unknown_Pragma;
-----------------
-- Is_Impl_Neq --
-----------------
function Is_Impl_Neq (Def_Op : Entity_Id) return Boolean is
Result : Boolean := False;
begin
if Nkind (Def_Op) in N_Entity
and then Ekind (Def_Op) = E_Function
and then not Comes_From_Source (Def_Op)
and then Chars (Def_Op) = Name_Op_Ne
and then Present (Corresponding_Equality (Def_Op))
then
Result := True;
end if;
return Result;
end Is_Impl_Neq;
-------------------------
-- Is_Importing_Pragma --
-------------------------
function Is_Importing_Pragma
(N : Node_Id;
For_Name : Name_Id)
return Boolean
is
Result : Boolean := False;
Tmp : Node_Id;
begin
if Nkind (N) = N_Pragma
and then
(Pragma_Name (N) = Name_Import
or else
Pragma_Name (N) = Name_Interface)
then
Tmp := First (Pragma_Argument_Associations (N));
Tmp := Sinfo.Expression (Next (Tmp));
Result := Chars (Tmp) = For_Name;
end if;
return Result;
end Is_Importing_Pragma;
------------------------------------
-- Is_Name_Of_Expanded_Subprogram --
-------------------------------------
function Is_Name_Of_Expanded_Subprogram (Node : Node_Id) return Boolean is
Result : Boolean := False;
begin
if Nkind (Node) = N_Defining_Identifier
and then
Is_Generic_Instance (Node)
and then
Ekind (Node) in E_Function .. E_Procedure
then
Result := True;
end if;
return Result;
end Is_Name_Of_Expanded_Subprogram;
-------------------
-- Is_Predefined --
-------------------
function Is_Predefined (Def_Op : Node_Id) return Boolean is
Result : Boolean := False;
Tmp : Entity_Id;
begin
if Ekind (Def_Op) in E_Function .. E_Operator
and then
not Comes_From_Source (Def_Op)
and then
not Is_Impl_Neq (Def_Op)
then
if Sloc (Def_Op) <= Standard_Location
or else
No (Alias (Def_Op))
or else
No (Parent (Def_Op))
then
Result := True;
elsif Present (Alias (Def_Op)) then
Tmp := Alias (Def_Op);
while Present (Alias (Tmp)) loop
Tmp := Alias (Tmp);
end loop;
if not Comes_From_Source (Tmp)
and then
No (Parent (Tmp))
then
Result := True;
end if;
end if;
end if;
return Result;
end Is_Predefined;
------------------------------
-- Is_Range_Memberchip_Test --
------------------------------
function Is_Range_Memberchip_Test (E : Asis.Element) return Boolean is
Tmp : Asis.Element;
Result : Boolean := False;
begin
if No (Alternatives (Node (E))) then
Tmp := Membership_Test_Choices (E) (1);
Result := Constraint_Kind (Tmp) in
A_Range_Attribute_Reference .. A_Simple_Expression_Range;
end if;
return Result;
end Is_Range_Memberchip_Test;
-----------------------------
-- Is_Type_Memberchip_Test --
-----------------------------
function Is_Type_Memberchip_Test (E : Asis.Element) return Boolean is
Tmp_El : Asis.Element;
Result : Boolean := False;
begin
if No (Alternatives (Node (E))) then
Tmp_El := Membership_Test_Choices (E) (1);
case Expression_Kind (Tmp_El) is
when An_Identifier |
A_Selected_Component |
An_Attribute_Reference =>
Tmp_El := Normalize_Reference (Tmp_El);
Result := Is_Type (Entity (R_Node (Tmp_El)));
when others => null;
end case;
end if;
return Result;
end Is_Type_Memberchip_Test;
-----------------------
-- Limited_View_Kind --
-----------------------
function Limited_View_Kind
(Decl : Asis.Element)
return Internal_Element_Kinds
is
Result : Internal_Element_Kinds := Int_Kind (Decl);
Type_Def : Asis.Element;
begin
case Result is
when A_Private_Extension_Declaration =>
Result := A_Tagged_Incomplete_Type_Declaration;
when A_Task_Type_Declaration |
A_Protected_Type_Declaration =>
Result := An_Incomplete_Type_Declaration;
when An_Ordinary_Type_Declaration |
A_Private_Type_Declaration =>
Type_Def := Type_Declaration_View (Decl);
case Int_Kind (Type_Def) is
when A_Derived_Record_Extension_Definition |
A_Tagged_Record_Type_Definition |
Internal_Interface_Kinds |
A_Tagged_Private_Type_Definition =>
Result := A_Tagged_Incomplete_Type_Declaration;
when others =>
Result := An_Incomplete_Type_Declaration;
end case;
when others =>
null;
end case;
return Result;
end Limited_View_Kind;
-------------------------
-- Pass_Generic_Actual --
-------------------------
function Pass_Generic_Actual (N : Node_Id) return Boolean is
Arg_Node : constant Node_Id := Original_Node (N);
Result : Boolean := False;
begin
-- See the discussion in F424-031 and F427-008
case Nkind (Arg_Node) is
when N_Subtype_Declaration =>
Result :=
not Comes_From_Source (Arg_Node)
and then
not Is_Internal_Name (Chars (Defining_Identifier (Arg_Node)))
and then
Is_From_Instance (Defining_Identifier (Arg_Node));
when N_Subprogram_Renaming_Declaration =>
Result := Present (Corresponding_Formal_Spec (Arg_Node));
when N_Object_Renaming_Declaration |
N_Object_Declaration =>
Result :=
Present (Corresponding_Generic_Association (Arg_Node))
or else
(not Comes_From_Source (Arg_Node)
and then
Is_From_Instance (Defining_Identifier (Arg_Node)));
when N_Formal_Object_Declaration =>
-- Here we should correctly process the situation in the expanded
-- spec that corresponds to a formal package. In case if the
-- given generic formal parameter of the formal package is not
-- specified in the formal package declaration, the corresponding
-- parameter is presented in the expanded spec as a formal
-- parameter, but not as a renaming
Result :=
Is_From_Instance (Arg_Node)
and then
Comes_From_Source (Arg_Node)
and then
not Comes_From_Source (Defining_Identifier (Arg_Node));
when others =>
null;
end case;
return Result;
end Pass_Generic_Actual;
---------------------------------
-- Part_Of_Pass_Generic_Actual --
---------------------------------
function Part_Of_Pass_Generic_Actual (N : Node_Id) return Boolean is
Result : Boolean := Pass_Generic_Actual (N);
Tmp_N : Node_Id := Parent (N);
begin
if not Result then
while Present (Tmp_N) loop
if Pass_Generic_Actual (Tmp_N) then
Result := True;
exit;
else
case Nkind (Tmp_N) is
-- The idea is to stop tree traversing as soon as possible
when N_Statement_Other_Than_Procedure_Call |
N_Renaming_Declaration |
N_Later_Decl_Item |
N_Component_Declaration ..
N_Private_Type_Declaration |
N_Formal_Subprogram_Declaration =>
exit;
when others =>
null;
end case;
end if;
Tmp_N := Parent (Tmp_N);
end loop;
end if;
return Result;
end Part_Of_Pass_Generic_Actual;
--------------------------------------------
-- Represents_Class_Wide_Type_In_Instance --
--------------------------------------------
function Represents_Class_Wide_Type_In_Instance
(N : Node_Id)
return Boolean
is
Result : Boolean := False;
A_Node : Node_Id;
begin
if Nkind (N) = N_Identifier then
A_Node := Associated_Node (N);
if Present (A_Node)
and then
Nkind (A_Node) in N_Entity
and then
Ekind (A_Node) in E_Class_Wide_Type .. E_Class_Wide_Subtype
then
Result := True;
end if;
end if;
return Result;
end Represents_Class_Wide_Type_In_Instance;
--------------------------------------
-- Represents_Base_Type_In_Instance --
--------------------------------------
function Represents_Base_Type_In_Instance (N : Node_Id) return Boolean is
Result : Boolean := False;
begin
if Nkind (N) = N_Identifier
and then
not Comes_From_Source (N)
and then
Is_Internal_Name (Chars (N))
and then
Present (Associated_Node (N))
and then
Ekind (Associated_Node (N)) in
E_Enumeration_Type .. E_Floating_Point_Subtype
then
Result := True;
end if;
return Result;
end Represents_Base_Type_In_Instance;
--------------------
-- Reset_For_Body --
--------------------
procedure Reset_For_Body
(El : in out Asis.Element;
Body_Unit : Asis.Compilation_Unit)
is
Spec_CU : constant Unit_Id := Encl_Unit_Id (El);
Arg_Tree : constant Tree_Id := Encl_Tree (El);
Body_Tree : Tree_Id;
Result_El : Asis.Element := Nil_Element;
-- and the rest of the local declarations is needed for traversal
Spec_El : Asis.Element;
My_State : No_State := Not_Used;
Control : Asis.Traverse_Control := Continue;
procedure Pre_Op
(Element : Asis.Element;
Control : in out Traverse_Control;
State : in out No_State);
procedure Pre_Op
(Element : Asis.Element;
Control : in out Traverse_Control;
State : in out No_State)
is
pragma Unreferenced (State);
El_Kind : constant Internal_Element_Kinds := Int_Kind (Element);
begin
case El_Kind is
when A_Task_Type_Declaration |
A_Single_Task_Declaration |
An_Incomplete_Type_Declaration |
A_Procedure_Declaration |
A_Function_Declaration |
An_Entry_Declaration |
A_Generic_Procedure_Declaration |
A_Generic_Function_Declaration
=>
-- here we have declarations which may have completion in the
-- package body, but their subcomponents cannot have a
-- completion
if Is_Equal (Element, El) then
Result_El := Element;
Control := Terminate_Immediately;
else
Control := Abandon_Children;
end if;
when A_Protected_Type_Declaration |
A_Single_Protected_Declaration |
A_Package_Declaration |
A_Generic_Package_Declaration
=>
-- here we have declarations which may have completion in the
-- package body, their subcomponents also can have a completion
if Is_Equal (Element, El) then
Result_El := Element;
Control := Terminate_Immediately;
end if;
when A_Protected_Definition =>
Control := Continue;
-- To look for protected entries and subprograms
when others =>
Control := Abandon_Children;
end case;
end Pre_Op;
procedure Find_For_Reset is new Traverse_Element
(State_Information => No_State,
Pre_Operation => Pre_Op,
Post_Operation => No_Op);
begin
Reset_Tree_For_Unit (Body_Unit);
Body_Tree := Get_Current_Tree;
if Arg_Tree = Body_Tree then
return;
end if;
Spec_El := Node_To_Element_New
(Node => Unit (Top (Spec_CU)),
Starting_Element => El);
Find_For_Reset (Spec_El, Control, My_State);
pragma Assert (not Is_Nil (Result_El));
El := Result_El;
end Reset_For_Body;
---------------------------------
-- Set_Stub_For_Subunit_If_Any --
---------------------------------
procedure Set_Stub_For_Subunit_If_Any (Def_Name : in out Node_Id)
is
Stub_Node : Node_Id;
Decl_Node : Node_Id;
Node_Context : constant Node_Id := Parent (Parent (Parent (Def_Name)));
begin
if not (Nkind (Def_Name) = N_Defining_Identifier and then
Nkind (Node_Context) = N_Subunit and then
Nkind (Proper_Body (Node_Context)) = N_Subprogram_Body and then
Def_Name = Defining_Unit_Name (Specification
(Proper_Body (Node_Context))))
then
-- nothing to change
return;
else
Def_Name := Defining_Unit_Name
(Specification (Corresponding_Stub (Node_Context)));
Stub_Node := Parent (Parent (Def_Name));
Decl_Node := Corr_Decl_For_Stub (Stub_Node);
if Present (Decl_Node) then
Def_Name := Defining_Unit_Name (Specification (Decl_Node));
end if;
end if;
end Set_Stub_For_Subunit_If_Any;
---------------------
-- Unwind_Renaming --
---------------------
function Unwind_Renaming (Def_Name : Node_Id) return Node_Id is
Parent_Decl : Node_Id;
Result_Node : Node_Id;
begin
-- a recursive algorithm is probably not the most effective,
-- but it is easy-to-maintain. Moreover, we do not really
-- expect long renaming chains in not-crazy programs
-- When the implementation of this function is stable, we probably
-- should replace the recursive code by the iteration-based code
Result_Node := Def_Name;
Parent_Decl := Parent (Result_Node);
case Nkind (Parent_Decl) is
when N_Renaming_Declaration =>
-- unwinding once again
Result_Node := Sinfo.Name (Entity (Parent_Decl));
return Unwind_Renaming (Result_Node);
when N_Function_Specification | N_Procedure_Specification =>
-- two cases are possible: if this subprogram specification
-- is the component of another (subprogram) renaming
-- declaration, we should unwind again,
-- otherwise we have got the result:
if Nkind (Parent (Parent_Decl)) =
N_Subprogram_Renaming_Declaration
then
-- unwinding once again
-- Result_Node := Sinfo.Name (Entity (Parent (Parent_Decl)));
Result_Node := Entity (Sinfo.Name (Parent (Parent_Decl)));
return Unwind_Renaming (Result_Node);
else
if Is_Rewrite_Substitution (Parent (Parent_Decl)) and then
Nkind (Original_Node (Parent (Parent_Decl))) =
N_Subprogram_Renaming_Declaration
then
-- this means, that we have met the renaming of a
-- subprogram-attribute, so
return Empty;
else
-- all the ransoming (if any) have already been unwounded
return Result_Node;
end if;
end if;
when others =>
return Result_Node;
end case;
end Unwind_Renaming;
end A4G.A_Sem;
|
oeis/269/A269607.asm | neoneye/loda-programs | 11 | 82188 | ; A269607: Number of length-4 0..n arrays with no repeated value differing from the previous repeated value by one or less.
; 8,62,222,572,1220,2298,3962,6392,9792,14390,20438,28212,38012,50162,65010,82928,104312,129582,159182,193580,233268,278762,330602,389352,455600,529958,613062,705572,808172,921570,1046498,1183712,1333992,1498142,1676990,1871388,2082212,2310362,2556762,2822360,3108128,3415062,3744182,4096532,4473180,4875218,5303762,5759952,6244952,6759950,7306158,7884812,8497172,9144522,9828170,10549448,11309712,12110342,12952742,13838340,14768588,15744962,16768962,17842112,18965960,20142078,21372062,22657532
mov $1,$0
add $1,3
mul $0,$1
add $0,1
bin $1,2
mul $1,$0
mov $0,$1
add $0,1
mul $0,2
|
Data/Maybe/Sugar.agda | oisdk/agda-playground | 6 | 2503 | <gh_stars>1-10
{-# OPTIONS --cubical --safe #-}
module Data.Maybe.Sugar where
open import Prelude
open import Data.Maybe
infixl 4 _<*>_
_>>=_ : Maybe A → (A → Maybe B) → Maybe B
nothing >>= f = nothing
just x >>= f = f x
pure : A → Maybe A
pure = just
_<*>_ : Maybe (A → B) →
Maybe A →
Maybe B
nothing <*> xs = nothing
just f <*> nothing = nothing
just f <*> just x = just (f x)
_>>_ : Maybe A → Maybe B → Maybe B
nothing >> _ = nothing
just _ >> y = y
guard : Bool → Maybe ⊤
guard false = nothing
guard true = just tt
_<|>_ : Maybe A → Maybe A → Maybe A
nothing <|> ys = ys
xs@(just _) <|> _ = xs
|
src/traces/agate-traces__vcd.adb | Fabien-Chouteau/AGATE | 3 | 28154 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017-2020, <NAME> --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with AGATE.Traces_Output; use AGATE.Traces_Output;
with AGATE.Timer;
with AGATE_Types_Data.Traces; use AGATE_Types_Data.Traces;
package body AGATE.Traces is
Next_String_Token : String_Token := 0;
Next_Wire_Token : Wire_Token := 0;
Next_Reg_Token : Reg_Token := 0;
Next_Event_Token : Event_Token := 0;
Running_Task_Token : String_Token;
Context_Switch_Token : Event_Token;
Registration_Done : Boolean := False;
procedure Initialize;
procedure Put_Line (Str : String);
procedure End_Of_Registration;
function Timestamp (Now : Time := 0) return String;
procedure Put_State_Change (Token : Reg_Token;
Value : Word;
Now : Time := 0);
procedure Put_State_Change (Token : Wire_Token;
Value : Boolean;
Now : Time := 0);
procedure Put_State_Change (Token : String_Token;
Value : String;
Now : Time := 0);
procedure Put_State_Change (Token : Event_Token;
Now : Time := 0);
function Create return String_Token;
function Create return Wire_Token;
function Create return Reg_Token;
function Create return Event_Token;
function Image (Val : Natural) return String;
function Image (Tok : String_Token) return String;
function Image (Tok : Wire_Token) return String;
function Image (Tok : Reg_Token) return String;
function Image (Tok : Event_Token) return String;
procedure Declare_Var (Tok : String_Token; Name : String);
procedure Declare_Var (Tok : Wire_Token; Name : String);
procedure Declare_Var (Tok : Reg_Token; Name : String);
procedure Declare_Var (Tok : Event_Token; Name : String);
function Clean (Name : String) return String;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Traces_Output.Initialize ("agate_traces.vcd");
Put_Line ("$timescale 1 us $end");
Put_Line ("$scope module AGATE $end");
Running_Task_Token := Create;
Declare_Var (Running_Task_Token, "Running_Task");
Context_Switch_Token := Create;
Declare_Var (Context_Switch_Token, "Context_Switch");
end Initialize;
--------------
-- Put_Line --
--------------
procedure Put_Line
(Str : String)
is
To_Put : constant String := Str & ASCII.CR & ASCII.LF;
begin
if Traces_Output.Write (To_Put (To_Put'First)'Address,
To_Put'Length) /= To_Put'Length
then
raise Program_Error;
end if;
end Put_Line;
-------------------------
-- End_Of_Registration --
-------------------------
procedure End_Of_Registration is
begin
Put_Line ("$upscope $end");
Put_Line ("$enddefinitions $end");
-- Print initial values
for X in Wire_Token'First .. Next_Wire_Token - 1 loop
Put_Line ("#0 0" & Image (X));
end loop;
for X in Reg_Token'First .. Next_Reg_Token - 1 loop
Put_Line ("#0 b0 " & Image (X));
end loop;
Registration_Done := True;
end End_Of_Registration;
---------------
-- Timestamp --
---------------
function Timestamp
(Now : Time := 0)
return String
is
T : constant Time := (if Now /= 0 then Now else Timer.Clock);
Img : constant String := T'Img;
begin
return "#" & Img (Img'First + 1 .. Img'Last);
end Timestamp;
----------------------
-- Put_State_Change --
----------------------
procedure Put_State_Change
(Token : Reg_Token;
Value : Word;
Now : Time := 0)
is
Bin : String (1 .. 32);
Val : Word := Value;
begin
if not Registration_Done then
End_Of_Registration;
end if;
for C of reverse Bin loop
C := (if (Val and 1) = 0 then '0' else '1');
Val := Shift_Right (Val, 1);
end loop;
-- TODO: print the boolean value of the integer (e.g. b100101)
Put_Line (Timestamp (Now) & " b" & Bin & " " & Image (Token));
end Put_State_Change;
----------------------
-- Put_State_Change --
----------------------
procedure Put_State_Change
(Token : Wire_Token;
Value : Boolean;
Now : Time := 0)
is
begin
if not Registration_Done then
End_Of_Registration;
end if;
Put_Line (Timestamp (Now) & (if Value then " 1" else " 0") &
Image (Token));
end Put_State_Change;
----------------------
-- Put_State_Change --
----------------------
procedure Put_State_Change
(Token : String_Token;
Value : String;
Now : Time := 0)
is
begin
if not Registration_Done then
End_Of_Registration;
end if;
Put_Line (Timestamp (Now) & " s" & Value & " " & Image (Token));
end Put_State_Change;
----------------------
-- Put_State_Change --
----------------------
procedure Put_State_Change
(Token : Event_Token;
Now : Time := 0)
is
begin
if not Registration_Done then
End_Of_Registration;
end if;
Put_Line (Timestamp (Now) & " x" & Image (Token));
end Put_State_Change;
-----------
-- Clean --
-----------
function Clean
(Name : String)
return String
is
Ret : String := Name;
begin
for C of Ret loop
if C in ASCII.NUL .. ' ' then
C := '_';
end if;
end loop;
return Ret;
end Clean;
------------
-- Create --
------------
function Create
return String_Token
is
Ret : constant String_Token := Next_String_Token;
begin
Next_String_Token := Next_String_Token + 1;
return Ret;
end Create;
------------
-- Create --
------------
function Create
return Wire_Token
is
Ret : constant Wire_Token := Next_Wire_Token;
begin
Next_Wire_Token := Next_Wire_Token + 1;
return Ret;
end Create;
------------
-- Create --
------------
function Create
return Reg_Token
is
Ret : constant Reg_Token := Next_Reg_Token;
begin
Next_Reg_Token := Next_Reg_Token + 1;
return Ret;
end Create;
------------
-- Create --
------------
function Create
return Event_Token
is
Ret : constant Event_Token := Next_Event_Token;
begin
Next_Event_Token := Next_Event_Token + 1;
return Ret;
end Create;
-----------
-- Image --
-----------
function Image
(Val : Natural)
return String
is
Ret : constant String := Val'Img;
begin
return Ret (Ret'First + 1 .. Ret'Last);
end Image;
-----------
-- Image --
-----------
function Image
(Tok : String_Token)
return String
is ("s" & Image (Natural (Tok)));
-----------
-- Image --
-----------
function Image
(Tok : Wire_Token)
return String
is ("w" & Image (Natural (Tok)));
-----------
-- Image --
-----------
function Image
(Tok : Reg_Token)
return String
is ("r" & Image (Natural (Tok)));
-----------
-- Image --
-----------
function Image
(Tok : Event_Token)
return String
is ("e" & Image (Natural (Tok)));
-----------------
-- Declare_Var --
-----------------
procedure Declare_Var
(Tok : String_Token;
Name : String)
is
begin
Put_Line ("$var string 1 " & Image (Tok) & " " & Name & " $end");
end Declare_Var;
-----------------
-- Declare_Var --
-----------------
procedure Declare_Var
(Tok : Wire_Token;
Name : String)
is
begin
Put_Line ("$var wire 1 " & Image (Tok) & " " & Name & " $end");
end Declare_Var;
-----------------
-- Declare_Var --
-----------------
procedure Declare_Var
(Tok : Reg_Token;
Name : String)
is
begin
Put_Line ("$var reg 32 " & Image (Tok) & " " & Name & " $end");
end Declare_Var;
-----------------
-- Declare_Var --
-----------------
procedure Declare_Var
(Tok : Event_Token;
Name : String)
is
begin
Put_Line ("$var event 1 " & Image (Tok) & " " & Name & " $end");
end Declare_Var;
--------------
-- Register --
--------------
procedure Register
(ID : Task_ID;
Name : String)
is
begin
ID.Trace_Data.Running := Create;
ID.Trace_Data.Status := Create;
ID.Trace_Data.Prio := Create;
Declare_Var (ID.Trace_Data.Running, Clean (Name));
Declare_Var (ID.Trace_Data.Status, Clean (Name) & "_Status");
Declare_Var (ID.Trace_Data.Prio, Clean (Name) & "_Priority");
end Register;
------------
-- Resume --
------------
procedure Resume (ID : Task_ID) is
begin
Put_State_Change (ID.Trace_Data.Status, Clean (Image (ID.Status)));
Put_State_Change (ID.Trace_Data.Prio, Word (ID.Current_Prio));
end Resume;
-------------
-- Suspend --
-------------
procedure Suspend (ID : Task_ID) is
begin
Put_State_Change (ID.Trace_Data.Status, Clean (Image (ID.Status)));
end Suspend;
-----------
-- Fault --
-----------
procedure Fault (ID : Task_ID) is
begin
Put_State_Change (ID.Trace_Data.Status, Clean (Image (ID.Status)));
end Fault;
-------------
-- Running --
-------------
procedure Running (ID : Task_ID) is
begin
Put_State_Change (ID.Trace_Data.Status, Clean (Image (ID.Status)));
end Running;
---------------------
-- Change_Priority --
---------------------
procedure Change_Priority
(ID : Task_ID;
New_Prio : Internal_Task_Priority)
is
begin
Put_State_Change (ID.Trace_Data.Prio, Word (New_Prio));
end Change_Priority;
--------------------
-- Context_Switch --
--------------------
procedure Context_Switch
(Old, Next : Task_ID)
is
Now : constant Time := Timer.Clock;
begin
Put_State_Change (Old.Trace_Data.Running, False, Now);
Put_State_Change (Next.Trace_Data.Running, True, Now);
Put_State_Change (Running_Task_Token, Clean (Next.Name), Now);
Put_State_Change (Context_Switch_Token, Now);
end Context_Switch;
--------------
-- Register --
--------------
procedure Register
(ID : Semaphore_ID;
Name : String)
is
begin
ID.Trace_Data.Token := Create;
Declare_Var (ID.Trace_Data.Token, Clean (Name));
end Register;
-------------------
-- Value_Changed --
-------------------
procedure Value_Changed
(ID : Semaphore_ID;
Count : Semaphore_Count;
By : Task_ID)
is
pragma Unreferenced (By);
begin
Put_State_Change (ID.Trace_Data.Token, Word (Count));
end Value_Changed;
--------------
-- Register --
--------------
procedure Register
(ID : Mutex_ID;
Name : String)
is
begin
ID.Trace_Data.Token := Create;
Declare_Var (ID.Trace_Data.Token, Clean (Name) & "_Owner");
end Register;
----------
-- Lock --
----------
procedure Lock
(ID : Mutex_ID;
By : Task_ID)
is
begin
Put_State_Change (ID.Trace_Data.Token, Clean (By.Name));
end Lock;
-------------
-- Release --
-------------
procedure Release
(ID : Mutex_ID;
By : Task_ID)
is
pragma Unreferenced (By);
begin
Put_State_Change (ID.Trace_Data.Token, "unlocked");
end Release;
--------------
-- Shutdown --
--------------
procedure Shutdown
is
begin
Traces_Output.Finalize;
end Shutdown;
begin
Initialize;
end AGATE.Traces;
|
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i9-9900K_12_0xa0_notsx.log_13761_1846.asm | ljhsiun2/medusa | 9 | 170417 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1b457, %rsi
lea addresses_WC_ht+0x1cd57, %rdi
nop
sub %rax, %rax
mov $53, %rcx
rep movsw
nop
nop
nop
inc %r12
lea addresses_normal_ht+0x1687f, %r12
clflush (%r12)
nop
nop
nop
nop
sub %rdi, %rdi
and $0xffffffffffffffc0, %r12
movaps (%r12), %xmm0
vpextrq $1, %xmm0, %rsi
nop
nop
nop
nop
sub %rax, %rax
lea addresses_D_ht+0x10757, %rcx
nop
nop
and %r15, %r15
mov (%rcx), %eax
sub $4095, %r12
lea addresses_WC_ht+0x4657, %rsi
lea addresses_D_ht+0x19ac9, %rdi
nop
nop
nop
nop
inc %r11
mov $15, %rcx
rep movsw
nop
add $5368, %rax
lea addresses_D_ht+0x7217, %rsi
lea addresses_D_ht+0xbbd7, %rdi
nop
nop
nop
add %rbx, %rbx
mov $0, %rcx
rep movsl
nop
nop
nop
nop
inc %r12
lea addresses_normal_ht+0x3bc7, %rsi
lea addresses_WC_ht+0xbc17, %rdi
clflush (%rsi)
nop
cmp $44270, %rax
mov $46, %rcx
rep movsw
nop
cmp %r12, %r12
lea addresses_normal_ht+0x1a957, %rdi
nop
nop
nop
nop
nop
sub %rax, %rax
movups (%rdi), %xmm4
vpextrq $1, %xmm4, %r11
nop
and $44270, %rbx
lea addresses_WT_ht+0x17957, %rsi
lea addresses_A_ht+0x18174, %rdi
nop
nop
nop
nop
nop
sub %r15, %r15
mov $1, %rcx
rep movsq
nop
xor %rbx, %rbx
lea addresses_WT_ht+0x18ef7, %rsi
lea addresses_normal_ht+0x557, %rdi
nop
nop
nop
and $51972, %rax
mov $25, %rcx
rep movsl
nop
nop
nop
nop
cmp %r11, %r11
lea addresses_A_ht+0x1a3d7, %r12
nop
xor %rax, %rax
movl $0x61626364, (%r12)
nop
nop
nop
nop
nop
and $42588, %rbx
lea addresses_UC_ht+0x9357, %rsi
nop
nop
nop
nop
nop
dec %r11
movl $0x61626364, (%rsi)
nop
nop
nop
nop
nop
add %rbx, %rbx
lea addresses_A_ht+0x12e17, %rax
nop
and $23439, %rbx
mov $0x6162636465666768, %r15
movq %r15, %xmm3
and $0xffffffffffffffc0, %rax
movntdq %xmm3, (%rax)
nop
nop
cmp $37333, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r8
push %r9
push %rbp
push %rsi
// Store
mov $0x7582bf00000009ef, %r8
nop
sub $31215, %rbp
movl $0x51525354, (%r8)
nop
and $35444, %r8
// Faulty Load
mov $0x691320000000557, %rbp
nop
nop
nop
xor %rsi, %rsi
vmovntdqa (%rbp), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %r13
lea oracles, %rbp
and $0xff, %r13
shlq $12, %r13
mov (%rbp,%r13,1), %r13
pop %rsi
pop %rbp
pop %r9
pop %r8
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 16, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 6}}
{'08': 132, '72': 64, '40': 382, '49': 13182, '00': 1}
49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 08 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 72 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 08 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 08 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 08 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 40 49 49 40 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 40 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 08 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 08 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 08 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 08 49 49 49 40 49 49 49 08 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 08 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 40 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 40 49 49 49 40 49 49 49 49 49 49 49 49
*/
|
PIC/SerialCom/SSeg.asm | MrRomo/Rbot- | 1 | 165572 | <filename>PIC/SerialCom/SSeg.asm
_display:
;SSeg.c,10 :: void display(int num, char dec[4]) {
;SSeg.c,13 :: int div = 1000;
MOVLW 232
MOVWF display_div_L0+0
MOVLW 3
MOVWF display_div_L0+1
;SSeg.c,14 :: for (i = 0; i < 4; i++) {
CLRF display_i_L0+0
L_display0:
MOVLW 4
SUBWF display_i_L0+0, 0
BTFSC STATUS+0, 0
GOTO L_display1
;SSeg.c,15 :: a = num/div;
MOVF display_div_L0+0, 0
MOVWF R4+0
MOVF display_div_L0+1, 0
MOVWF R4+1
MOVF FARG_display_num+0, 0
MOVWF R0+0
MOVF FARG_display_num+1, 0
MOVWF R0+1
CALL _Div_16x16_S+0
MOVF R0+0, 0
MOVWF FLOC__display+0
MOVF R0+1, 0
MOVWF FLOC__display+1
MOVF FLOC__display+0, 0
MOVWF R0+0
MOVF FLOC__display+1, 0
MOVWF R0+1
MOVF display_div_L0+0, 0
MOVWF R4+0
MOVF display_div_L0+1, 0
MOVWF R4+1
CALL _Mul_16X16_U+0
;SSeg.c,16 :: num = num - (a*div);
MOVF R0+0, 0
SUBWF FARG_display_num+0, 1
BTFSS STATUS+0, 0
DECF FARG_display_num+1, 1
MOVF R0+1, 0
SUBWF FARG_display_num+1, 1
;SSeg.c,17 :: div /= 10;
MOVLW 10
MOVWF R4+0
MOVLW 0
MOVWF R4+1
MOVF display_div_L0+0, 0
MOVWF R0+0
MOVF display_div_L0+1, 0
MOVWF R0+1
CALL _Div_16x16_S+0
MOVF R0+0, 0
MOVWF display_div_L0+0
MOVF R0+1, 0
MOVWF display_div_L0+1
;SSeg.c,18 :: disp = seg[a]<<1;
MOVF FLOC__display+0, 0
ADDLW _seg+0
MOVWF FSR
MOVF INDF+0, 0
MOVWF R2+0
MOVF R2+0, 0
MOVWF R0+0
RLF R0+0, 1
BCF R0+0, 0
MOVF R0+0, 0
MOVWF PORTB+0
;SSeg.c,19 :: deco = ~dec[i];
MOVF display_i_L0+0, 0
ADDWF FARG_display_dec+0, 0
MOVWF FSR
COMF INDF+0, 0
MOVWF PORTD+0
;SSeg.c,20 :: DELAY_us(1000);
MOVLW 3
MOVWF R12+0
MOVLW 151
MOVWF R13+0
L_display3:
DECFSZ R13+0, 1
GOTO L_display3
DECFSZ R12+0, 1
GOTO L_display3
NOP
NOP
;SSeg.c,21 :: deco = 0xFF;
MOVLW 255
MOVWF PORTD+0
;SSeg.c,14 :: for (i = 0; i < 4; i++) {
INCF display_i_L0+0, 1
;SSeg.c,22 :: }
GOTO L_display0
L_display1:
;SSeg.c,23 :: }
L_end_display:
RETURN
; end of _display
|
lab4/hello.asm | jeffliou64/elec291 | 0 | 21546 | ;--------------------------------------------------------
; File Created by C51
; Version 1.0.0 #1069 (Apr 23 2015) (MSVC)
; This file was generated Fri Feb 26 17:44:59 2016
;--------------------------------------------------------
$name hello
$optc51 --model-small
R_DSEG segment data
R_CSEG segment code
R_BSEG segment bit
R_XSEG segment xdata
R_PSEG segment xdata
R_ISEG segment idata
R_OSEG segment data overlay
BIT_BANK segment data overlay
R_HOME segment code
R_GSINIT segment code
R_IXSEG segment xdata
R_CONST segment code
R_XINIT segment code
R_DINIT segment code
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
public _main
public _UART0_Init
public _SYSCLK_Init
public _PORT_Init
;--------------------------------------------------------
; Special Function Registers
;--------------------------------------------------------
_P0 DATA 0x80
_SP DATA 0x81
_DPL DATA 0x82
_DPH DATA 0x83
_EMI0TC DATA 0x84
_EMI0CF DATA 0x85
_OSCLCN DATA 0x86
_PCON DATA 0x87
_TCON DATA 0x88
_TMOD DATA 0x89
_TL0 DATA 0x8a
_TL1 DATA 0x8b
_TH0 DATA 0x8c
_TH1 DATA 0x8d
_CKCON DATA 0x8e
_PSCTL DATA 0x8f
_P1 DATA 0x90
_TMR3CN DATA 0x91
_TMR4CN DATA 0x91
_TMR3RLL DATA 0x92
_TMR4RLL DATA 0x92
_TMR3RLH DATA 0x93
_TMR4RLH DATA 0x93
_TMR3L DATA 0x94
_TMR4L DATA 0x94
_TMR3H DATA 0x95
_TMR4H DATA 0x95
_USB0ADR DATA 0x96
_USB0DAT DATA 0x97
_SCON DATA 0x98
_SCON0 DATA 0x98
_SBUF DATA 0x99
_SBUF0 DATA 0x99
_CPT1CN DATA 0x9a
_CPT0CN DATA 0x9b
_CPT1MD DATA 0x9c
_CPT0MD DATA 0x9d
_CPT1MX DATA 0x9e
_CPT0MX DATA 0x9f
_P2 DATA 0xa0
_SPI0CFG DATA 0xa1
_SPI0CKR DATA 0xa2
_SPI0DAT DATA 0xa3
_P0MDOUT DATA 0xa4
_P1MDOUT DATA 0xa5
_P2MDOUT DATA 0xa6
_P3MDOUT DATA 0xa7
_IE DATA 0xa8
_CLKSEL DATA 0xa9
_EMI0CN DATA 0xaa
__XPAGE DATA 0xaa
_SBCON1 DATA 0xac
_P4MDOUT DATA 0xae
_PFE0CN DATA 0xaf
_P3 DATA 0xb0
_OSCXCN DATA 0xb1
_OSCICN DATA 0xb2
_OSCICL DATA 0xb3
_SBRLL1 DATA 0xb4
_SBRLH1 DATA 0xb5
_FLSCL DATA 0xb6
_FLKEY DATA 0xb7
_IP DATA 0xb8
_CLKMUL DATA 0xb9
_SMBTC DATA 0xb9
_AMX0N DATA 0xba
_AMX0P DATA 0xbb
_ADC0CF DATA 0xbc
_ADC0L DATA 0xbd
_ADC0H DATA 0xbe
_SFRPAGE DATA 0xbf
_SMB0CN DATA 0xc0
_SMB1CN DATA 0xc0
_SMB0CF DATA 0xc1
_SMB1CF DATA 0xc1
_SMB0DAT DATA 0xc2
_SMB1DAT DATA 0xc2
_ADC0GTL DATA 0xc3
_ADC0GTH DATA 0xc4
_ADC0LTL DATA 0xc5
_ADC0LTH DATA 0xc6
_P4 DATA 0xc7
_TMR2CN DATA 0xc8
_TMR5CN DATA 0xc8
_REG01CN DATA 0xc9
_TMR2RLL DATA 0xca
_TMR5RLL DATA 0xca
_TMR2RLH DATA 0xcb
_TMR5RLH DATA 0xcb
_TMR2L DATA 0xcc
_TMR5L DATA 0xcc
_TMR2H DATA 0xcd
_TMR5H DATA 0xcd
_SMB0ADM DATA 0xce
_SMB1ADM DATA 0xce
_SMB0ADR DATA 0xcf
_SMB1ADR DATA 0xcf
_PSW DATA 0xd0
_REF0CN DATA 0xd1
_SCON1 DATA 0xd2
_SBUF1 DATA 0xd3
_P0SKIP DATA 0xd4
_P1SKIP DATA 0xd5
_P2SKIP DATA 0xd6
_USB0XCN DATA 0xd7
_PCA0CN DATA 0xd8
_PCA0MD DATA 0xd9
_PCA0CPM0 DATA 0xda
_PCA0CPM1 DATA 0xdb
_PCA0CPM2 DATA 0xdc
_PCA0CPM3 DATA 0xdd
_PCA0CPM4 DATA 0xde
_P3SKIP DATA 0xdf
_ACC DATA 0xe0
_XBR0 DATA 0xe1
_XBR1 DATA 0xe2
_XBR2 DATA 0xe3
_IT01CF DATA 0xe4
_CKCON1 DATA 0xe4
_SMOD1 DATA 0xe5
_EIE1 DATA 0xe6
_EIE2 DATA 0xe7
_ADC0CN DATA 0xe8
_PCA0CPL1 DATA 0xe9
_PCA0CPH1 DATA 0xea
_PCA0CPL2 DATA 0xeb
_PCA0CPH2 DATA 0xec
_PCA0CPL3 DATA 0xed
_PCA0CPH3 DATA 0xee
_RSTSRC DATA 0xef
_B DATA 0xf0
_P0MDIN DATA 0xf1
_P1MDIN DATA 0xf2
_P2MDIN DATA 0xf3
_P3MDIN DATA 0xf4
_P4MDIN DATA 0xf5
_EIP1 DATA 0xf6
_EIP2 DATA 0xf7
_SPI0CN DATA 0xf8
_PCA0L DATA 0xf9
_PCA0H DATA 0xfa
_PCA0CPL0 DATA 0xfb
_PCA0CPH0 DATA 0xfc
_PCA0CPL4 DATA 0xfd
_PCA0CPH4 DATA 0xfe
_VDM0CN DATA 0xff
_DPTR DATA 0x8382
_TMR2RL DATA 0xcbca
_TMR3RL DATA 0x9392
_TMR4RL DATA 0x9392
_TMR5RL DATA 0xcbca
_TMR2 DATA 0xcdcc
_TMR3 DATA 0x9594
_TMR4 DATA 0x9594
_TMR5 DATA 0xcdcc
_SBRL1 DATA 0xb5b4
_ADC0 DATA 0xbebd
_ADC0GT DATA 0xc4c3
_ADC0LT DATA 0xc6c5
_PCA0 DATA 0xfaf9
_PCA0CP1 DATA 0xeae9
_PCA0CP2 DATA 0xeceb
_PCA0CP3 DATA 0xeeed
_PCA0CP0 DATA 0xfcfb
_PCA0CP4 DATA 0xfefd
;--------------------------------------------------------
; special function bits
;--------------------------------------------------------
_P0_0 BIT 0x80
_P0_1 BIT 0x81
_P0_2 BIT 0x82
_P0_3 BIT 0x83
_P0_4 BIT 0x84
_P0_5 BIT 0x85
_P0_6 BIT 0x86
_P0_7 BIT 0x87
_TF1 BIT 0x8f
_TR1 BIT 0x8e
_TF0 BIT 0x8d
_TR0 BIT 0x8c
_IE1 BIT 0x8b
_IT1 BIT 0x8a
_IE0 BIT 0x89
_IT0 BIT 0x88
_P1_0 BIT 0x90
_P1_1 BIT 0x91
_P1_2 BIT 0x92
_P1_3 BIT 0x93
_P1_4 BIT 0x94
_P1_5 BIT 0x95
_P1_6 BIT 0x96
_P1_7 BIT 0x97
_S0MODE BIT 0x9f
_SCON0_6 BIT 0x9e
_MCE0 BIT 0x9d
_REN0 BIT 0x9c
_TB80 BIT 0x9b
_RB80 BIT 0x9a
_TI0 BIT 0x99
_RI0 BIT 0x98
_SCON_6 BIT 0x9e
_MCE BIT 0x9d
_REN BIT 0x9c
_TB8 BIT 0x9b
_RB8 BIT 0x9a
_TI BIT 0x99
_RI BIT 0x98
_P2_0 BIT 0xa0
_P2_1 BIT 0xa1
_P2_2 BIT 0xa2
_P2_3 BIT 0xa3
_P2_4 BIT 0xa4
_P2_5 BIT 0xa5
_P2_6 BIT 0xa6
_P2_7 BIT 0xa7
_EA BIT 0xaf
_ESPI0 BIT 0xae
_ET2 BIT 0xad
_ES0 BIT 0xac
_ET1 BIT 0xab
_EX1 BIT 0xaa
_ET0 BIT 0xa9
_EX0 BIT 0xa8
_P3_0 BIT 0xb0
_P3_1 BIT 0xb1
_P3_2 BIT 0xb2
_P3_3 BIT 0xb3
_P3_4 BIT 0xb4
_P3_5 BIT 0xb5
_P3_6 BIT 0xb6
_P3_7 BIT 0xb7
_IP_7 BIT 0xbf
_PSPI0 BIT 0xbe
_PT2 BIT 0xbd
_PS0 BIT 0xbc
_PT1 BIT 0xbb
_PX1 BIT 0xba
_PT0 BIT 0xb9
_PX0 BIT 0xb8
_MASTER0 BIT 0xc7
_TXMODE0 BIT 0xc6
_STA0 BIT 0xc5
_STO0 BIT 0xc4
_ACKRQ0 BIT 0xc3
_ARBLOST0 BIT 0xc2
_ACK0 BIT 0xc1
_SI0 BIT 0xc0
_MASTER1 BIT 0xc7
_TXMODE1 BIT 0xc6
_STA1 BIT 0xc5
_STO1 BIT 0xc4
_ACKRQ1 BIT 0xc3
_ARBLOST1 BIT 0xc2
_ACK1 BIT 0xc1
_SI1 BIT 0xc0
_TF2 BIT 0xcf
_TF2H BIT 0xcf
_TF2L BIT 0xce
_TF2LEN BIT 0xcd
_TF2CEN BIT 0xcc
_T2SPLIT BIT 0xcb
_TR2 BIT 0xca
_T2CSS BIT 0xc9
_T2XCLK BIT 0xc8
_TF5H BIT 0xcf
_TF5L BIT 0xce
_TF5LEN BIT 0xcd
_TMR5CN_4 BIT 0xcc
_T5SPLIT BIT 0xcb
_TR5 BIT 0xca
_TMR5CN_1 BIT 0xc9
_T5XCLK BIT 0xc8
_CY BIT 0xd7
_AC BIT 0xd6
_F0 BIT 0xd5
_RS1 BIT 0xd4
_RS0 BIT 0xd3
_OV BIT 0xd2
_F1 BIT 0xd1
_PARITY BIT 0xd0
_CF BIT 0xdf
_CR BIT 0xde
_PCA0CN_5 BIT 0xde
_CCF4 BIT 0xdc
_CCF3 BIT 0xdb
_CCF2 BIT 0xda
_CCF1 BIT 0xd9
_CCF0 BIT 0xd8
_ACC_7 BIT 0xe7
_ACC_6 BIT 0xe6
_ACC_5 BIT 0xe5
_ACC_4 BIT 0xe4
_ACC_3 BIT 0xe3
_ACC_2 BIT 0xe2
_ACC_1 BIT 0xe1
_ACC_0 BIT 0xe0
_AD0EN BIT 0xef
_AD0TM BIT 0xee
_AD0INT BIT 0xed
_AD0BUSY BIT 0xec
_AD0WINT BIT 0xeb
_AD0CM2 BIT 0xea
_AD0CM1 BIT 0xe9
_AD0CM0 BIT 0xe8
_B_7 BIT 0xf7
_B_6 BIT 0xf6
_B_5 BIT 0xf5
_B_4 BIT 0xf4
_B_3 BIT 0xf3
_B_2 BIT 0xf2
_B_1 BIT 0xf1
_B_0 BIT 0xf0
_SPIF BIT 0xff
_WCOL BIT 0xfe
_MODF BIT 0xfd
_RXOVRN BIT 0xfc
_NSSMD1 BIT 0xfb
_NSSMD0 BIT 0xfa
_TXBMT BIT 0xf9
_SPIEN BIT 0xf8
;--------------------------------------------------------
; overlayable register banks
;--------------------------------------------------------
rbank0 segment data overlay
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
rseg R_DSEG
;--------------------------------------------------------
; overlayable items in internal ram
;--------------------------------------------------------
rseg R_OSEG
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
rseg R_ISEG
;--------------------------------------------------------
; absolute internal ram data
;--------------------------------------------------------
DSEG
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
rseg R_BSEG
;--------------------------------------------------------
; paged external ram data
;--------------------------------------------------------
rseg R_PSEG
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
rseg R_XSEG
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
XSEG
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
rseg R_IXSEG
rseg R_HOME
rseg R_GSINIT
rseg R_CSEG
;--------------------------------------------------------
; Reset entry point and interrupt vectors
;--------------------------------------------------------
CSEG at 0x0000
ljmp _crt0
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
rseg R_HOME
rseg R_GSINIT
rseg R_GSINIT
;--------------------------------------------------------
; data variables initialization
;--------------------------------------------------------
rseg R_DINIT
; The linker places a 'ret' at the end of segment R_DINIT.
;--------------------------------------------------------
; code
;--------------------------------------------------------
rseg R_CSEG
;------------------------------------------------------------
;Allocation info for local variables in function 'PORT_Init'
;------------------------------------------------------------
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:7: void PORT_Init (void)
; -----------------------------------------
; function PORT_Init
; -----------------------------------------
_PORT_Init:
using 0
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:9: P0MDOUT |= 0x10; // Enable UTX as push-pull output
orl _P0MDOUT,#0x10
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:10: XBR0 = 0x01; // Enable UART on P0.4(TX) and P0.5(RX)
mov _XBR0,#0x01
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:11: XBR1 = 0x40; // Enable crossbar and weak pull-ups
mov _XBR1,#0x40
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'SYSCLK_Init'
;------------------------------------------------------------
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:14: void SYSCLK_Init (void)
; -----------------------------------------
; function SYSCLK_Init
; -----------------------------------------
_SYSCLK_Init:
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:16: CLKSEL|=0b_0000_0011; // SYSCLK derived from Internal HF Osc / 1.
orl _CLKSEL,#0x03
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:17: OSCICN |= 0x03; // Configure internal oscillator for its maximum
orl _OSCICN,#0x03
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:18: RSTSRC = 0x04; // Enable missing clock detector
mov _RSTSRC,#0x04
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'UART0_Init'
;------------------------------------------------------------
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:21: void UART0_Init (void)
; -----------------------------------------
; function UART0_Init
; -----------------------------------------
_UART0_Init:
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:23: SCON0 = 0x10;
mov _SCON0,#0x10
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:24: TH1 = 0x10000-((SYSCLK/BAUDRATE)/2L);
mov _TH1,#0x30
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:25: CKCON &= ~0x0B; // T1M = 1; SCA1:0 = xx
anl _CKCON,#0xF4
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:26: CKCON |= 0x08;
orl _CKCON,#0x08
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:27: TL1 = TH1; // Init Timer1
mov _TL1,_TH1
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:28: TMOD &= ~0xf0; // TMOD: timer 1 in 8-bit auto-reload
anl _TMOD,#0x0F
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:29: TMOD |= 0x20;
orl _TMOD,#0x20
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:30: TR1 = 1; // START Timer1
setb _TR1
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:31: TI = 1; // Indicate TX0 ready
setb _TI
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'main'
;------------------------------------------------------------
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:34: void main (void)
; -----------------------------------------
; function main
; -----------------------------------------
_main:
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:36: PCA0MD &= ~0x40; // WDTE = 0 (clear watchdog timer enable)
anl _PCA0MD,#0xBF
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:37: PORT_Init(); // Initialize Port I/O
lcall _PORT_Init
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:38: SYSCLK_Init (); // Initialize Oscillator
lcall _SYSCLK_Init
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:39: UART0_Init(); // Initialize UART0
lcall _UART0_Init
; C:\Users\jeffreyliou\Desktop\elec291\lab4\hello.c:40: printf( "Hello, world!\r\n" );
mov a,#__str_0
push acc
mov a,#(__str_0 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
dec sp
dec sp
dec sp
ret
rseg R_CSEG
rseg R_XINIT
rseg R_CONST
__str_0:
db 'Hello, world!'
db 0x0D
db 0x0A
db 0x00
CSEG
end
|
libsrc/_DEVELOPMENT/math/float/math48/c/sccz80/cm48_sccz80_nan.asm | jpoikela/z88dk | 640 | 1558 | <reponame>jpoikela/z88dk
; double __FASTCALL__ nan(const char *tagp)
SECTION code_clib
SECTION code_fp_math48
PUBLIC cm48_sccz80_nan
EXTERN am48_nan
defc cm48_sccz80_nan = am48_nan
|
src/model/l_system/lse-model-l_system-factory.ads | mgrojo/lsystem-editor | 2 | 554 | <reponame>mgrojo/lsystem-editor<filename>src/model/l_system/lse-model-l_system-factory.ads<gh_stars>1-10
-------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: Heziode
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 <NAME> (Heziode) <<EMAIL>>
--
-- 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.Containers.Hashed_Maps;
with LSE.Utils.Angle;
with LSE.Model.Grammar.Symbol_Utils;
with LSE.Model.L_System.Growth_Rule;
use Ada.Containers;
use LSE.Utils.Angle;
use LSE.Model.Grammar.Symbol_Utils.P_List;
use LSE.Model.Grammar.Symbol_Utils.Ptr;
-- @description
-- This package provides a factory for making a L-System.
--
package LSE.Model.L_System.Factory is
-- Make an axiom
-- @param Value String to convert to a list of Symbol
-- @return Return the list created
function Make_Axiom (Value : String)
return LSE.Model.Grammar.Symbol_Utils.P_List.List;
-- Make an angle
-- @param Value String to convert to an angle
-- @return Return the angle created
function Make_Angle (Value : String) return LSE.Utils.Angle.Angle;
-- Make a growth rule
-- @param Value String to convert to a growth rule
-- @return Return the growth rule created
function Make_Rule (Head : Character; Rule : String)
return Growth_Rule.Instance;
private
-- Get hash of a character
-- @param Key Character to get hash
-- @return Return the hash corresponding to character
function ID_Hashed (Key : Character) return Hash_Type;
package Know_Symbol is new Ada.Containers.Hashed_Maps
(Key_Type => Character,
Element_Type => Holder,
Hash => ID_Hashed,
Equivalent_Keys => "=");
-- List of static symbol (optimized to prevent RAM overflow)
Symbol_List : Know_Symbol.Map;
-- Get the symbol corresponding to the character
-- @param Key Character used to get corresponding symbol
-- @return Return a pointer to the corresponding symbol
function Get_Symbol (Key : Character) return Holder;
-- Create a list of symbol
-- @param Value String to convert to symbol list
-- @return Return the list of symbol created
function Make_Symbol_List (Value : String)
return LSE.Model.Grammar.Symbol_Utils.P_List.List;
end LSE.Model.L_System.Factory;
|
test/vxcall.asm | kspalaiologos/asmbf | 67 | 25050 |
psh 1
psh 2
psh 3
psh 4
vxcall spt 6, 2
pop r1
pop r1
add r1, .0
out r1
|
lib/EvenOdd.agda | Zalastax/adventofcode2017 | 0 | 15649 | <filename>lib/EvenOdd.agda
module EvenOdd where
open import Data.Nat
data Even : ℕ → Set where
evenZero : Even 0
evenSuc : {n : ℕ} → Even n → Even (suc (suc n))
data Odd : ℕ → Set where
oddOne : Odd 1
oddSuc : {n : ℕ} → Odd n → Odd (suc (suc n))
_e+e_ : {n m : ℕ} → Even n → Even m → Even (n + m)
evenZero e+e b = b
evenSuc a e+e b = evenSuc (a e+e b)
_o+o_ : {n m : ℕ} → Odd n → Odd m → Even (n + m)
oddOne o+o oddOne = evenSuc evenZero
oddOne o+o oddSuc b = evenSuc (oddOne o+o b)
oddSuc a o+o b = evenSuc (a o+o b)
_o+e_ : {n m : ℕ} → Odd n → Even m → Odd (n + m)
oddOne o+e evenZero = oddOne
oddOne o+e evenSuc b = oddSuc (oddOne o+e b)
oddSuc a o+e b = oddSuc (a o+e b)
_e+o_ : {n m : ℕ} → Even n → Odd m → Odd (n + m)
evenZero e+o b = b
evenSuc a e+o b = oddSuc (a e+o b)
|
programs/oeis/001/A001956.asm | karttu/loda | 0 | 171153 | ; A001956: Beatty sequence of (5+sqrt(13))/2.
; 4,8,12,17,21,25,30,34,38,43,47,51,55,60,64,68,73,77,81,86,90,94,98,103,107,111,116,120,124,129,133,137,141,146,150,154,159,163,167,172,176,180,185,189,193,197,202,206,210,215,219,223,228,232,236,240,245,249,253,258,262,266,271,275,279,283,288,292,296,301,305,309,314,318,322,327,331,335,339,344,348,352,357,361,365,370,374,378,382,387,391,395,400,404,408,413,417,421,425,430,434,438,443,447,451,456,460,464,469,473,477,481,486,490,494,499,503,507,512,516,520,524,529,533,537,542,546,550,555,559,563,567,572,576,580,585,589,593,598,602,606,610,615,619,623,628,632,636,641,645,649,654,658,662,666,671,675,679,684,688,692,697,701,705,709,714,718,722,727,731,735,740,744,748,752,757,761,765,770,774,778,783,787,791,796,800,804,808,813,817,821,826,830,834,839,843,847,851,856,860,864,869,873,877,882,886,890,894,899,903,907,912,916,920,925,929,933,938,942,946,950,955,959,963,968,972,976,981,985,989,993,998,1002,1006,1011,1015,1019,1024,1028,1032,1036,1041,1045,1049,1054,1058,1062,1067,1071,1075
add $0,1
cal $0,284678 ; Positions of 0 in A284677; complement of A284679.
mov $1,$0
sub $1,2
|
Palmtree.Math.Core.Sint/vs_build/x86_Release/pmc_getnumbertype.asm | rougemeilland/Palmtree.Math.Core.Sint | 0 | 86706 | <reponame>rougemeilland/Palmtree.Math.Core.Sint
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1
TITLE z:\sources\lunor\repos\rougemeilland\palmtree.math.core.sint\palmtree.math.core.sint\pmc_getnumbertype.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB OLDNAMES
PUBLIC _PMC_GetNumberType_X@8
PUBLIC _IsZero_UINT
END
|
config/utils/openChrome.applescript | nbarinov/vkui-common | 3 | 4265 | property targetTab: null
property targetTabIndex: -1
property targetWindow: null
property theProgram: "Google Chrome"
on run argv
set theURL to item 1 of argv
if (count of argv) > 1 then
set theProgram to item 2 of argv
end if
using terms from application "Google Chrome"
tell application theProgram
if (count every window) = 0 then
make new window
end if
set found to my lookupTabWithUrl(theURL)
if found then
set targetWindow's active tab index to targetTabIndex
tell targetTab to reload
tell targetWindow to activate
set index of targetWindow to 1
return
end if
set found to my lookupTabWithUrl("chrome://newtab/")
if found then
set targetWindow's active tab index to targetTabIndex
set URL of targetTab to theURL
tell targetWindow to activate
return
end if
tell window 1
activate
make new tab with properties {URL:theURL}
end tell
end tell
end using terms from
end run
on lookupTabWithUrl(lookupUrl)
using terms from application "Google Chrome"
tell application theProgram
set found to false
set theTabIndex to -1
repeat with theWindow in every window
set theTabIndex to 0
repeat with theTab in every tab of theWindow
set theTabIndex to theTabIndex + 1
if (theTab's URL as string) contains lookupUrl then
set targetTab to theTab
set targetTabIndex to theTabIndex
set targetWindow to theWindow
set found to true
exit repeat
end if
end repeat
if found then
exit repeat
end if
end repeat
end tell
end using terms from
return found
end lookupTabWithUrl
|
screen handle.asm | rzo42/MIDI-KEYS | 0 | 91384 | <gh_stars>0
; ========================================
; Project : MIDI KEYS (user interface)
; Target : Commodore VIC 20
; Author : <NAME>
; ========================================
;delay loop for smooth input
screen_handle$
pha
lda #0
tay
tax
jsr _setim$
@delay_loop
jsr _rdtim$
cmp #7
bcc @delay_loop
pla
sec
sbc #129 ;subtract 129 from key value
tax ;and tensfer to x for indexing
;add or subtract?
@shift_test
lda shift_key$ ;test shift key
cmp last_shift$ ;test for stability
bne @shift_test ;if unstable then retest
cmp #0 ;if no shift key
bne value_minus$;branch for subtraction
;add value
value_plus$
lda midi_reg$,x ;load current field value,x
cmp max_in$,x ;compare to its max input
bne @plus_next ;if != max then continue to addition
jmp loop_0$ ;else jmp back to keypress
@plus_next
inc midi_reg$,x ;add 1 to field value registor
jmp screen_val_print$ ;jump to print value to screen
;subtract value
value_minus$
lda midi_reg$,x ;load current field value,x
cmp #0 ;compare to 0
bne @minus_next ;if != then continue to subtraction
jmp loop_0$ ;else jmp back to keypress
@minus_next
dec midi_reg$,x ;subtract 1 from field register
screen_val_print$
ldy #17 ;y = 17 ;x=x
clc
jsr _plot$ ;place cursor
lda midi_reg$,x ;load current note value
tax ;trnsfer to x for lsb int val
lda #0 ;load a with 0 for msb int val
jsr _print_int$ ; print intger to screen
lda #<null_print$;clear trailling spaces
ldy #>null_print$
jsr _print_str$
jmp mc_set$ ;return to main controler
;=============================================================================== |
Step1/Little.g4 | alken2/COP4620 | 0 | 5085 | lexer grammar Little;
KEYWORD: 'PROGRAM'|'BEGIN'|'END'|'FUNCTION'|'READ'|'WRITE'|'IF'|'ELSE'|'ENDIF'|'WHILE'|'ENDWHILE'|'CONTINUE'|'BREAK'|
'RETURN'|'INT'|'VOID'|'STRING'|'FLOAT';
OPERATOR: ':=' | '+' | '-' | '*' | '/' | '=' | '!=' | '<' | '>' | '(' | ')' | ';' | ',' | '<=' | '>=';
COMMENT : '--'[ -~]*[\r\n] -> skip;
WS: [ \t\r\n]+ -> skip;
IDENTIFIER: [a-zA-Z][a-zA-Z0-9]*;
INTLITERAL: [0-9]+;
FLOATLITERAL: [0-9]*'.'[0-9]+;
STRINGLITERAL: '"'[ -!#-~]*'"';
|
sources/ippcp/asm_intel64_gas_converted/linux/pic/m7/merged/pcpsha256m7as.asm | ymarkovitch/ipp-crypto | 0 | 171156 | ###############################################################################
# Copyright 2019 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# 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.
###############################################################################
.section .note.GNU-stack,"",%progbits
.text
.p2align 4, 0x90
.globl m7_UpdateSHA256
.type m7_UpdateSHA256, @function
m7_UpdateSHA256:
push %rbx
push %r12
push %r13
push %r14
push %r15
sub $(80), %rsp
movslq %edx, %rdx
movq %rdx, (64)(%rsp)
.Lsha256_block_loopgas_1:
xor %rcx, %rcx
.Lloop1gas_1:
mov (%rsi,%rcx,4), %r8d
bswap %r8d
mov %r8d, (%rsp,%rcx,4)
mov (4)(%rsi,%rcx,4), %r9d
bswap %r9d
mov %r9d, (4)(%rsp,%rcx,4)
add $(2), %rcx
cmp $(16), %rcx
jl .Lloop1gas_1
mov (%rdi), %r8d
mov (4)(%rdi), %r9d
mov (8)(%rdi), %r10d
mov (12)(%rdi), %r11d
mov (16)(%rdi), %r12d
mov (20)(%rdi), %r13d
mov (24)(%rdi), %r14d
mov (28)(%rdi), %r15d
add $(1116352408), %r15d
add (%rsp), %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(6), %ecx
mov %r12d, %ebx
push %r12
not %edx
ror $(11), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(14), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
add %r15d, %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(2), %ecx
mov %r8d, %ebx
push %r8
xor %r9d, %edx
ror $(13), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(9), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
mov (4)(%rsp), %eax
mov (56)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (4)(%rsp), %ecx
mov (56)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (%rsp), %eax
add (36)(%rsp), %ebx
add %ebx, %eax
mov %eax, (%rsp)
add $(1899447441), %r14d
add (4)(%rsp), %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(6), %ecx
mov %r11d, %ebx
push %r11
not %edx
ror $(11), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(14), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
add %r14d, %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(2), %ecx
mov %r15d, %ebx
push %r15
xor %r8d, %edx
ror $(13), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(9), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
mov (8)(%rsp), %eax
mov (60)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (8)(%rsp), %ecx
mov (60)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (4)(%rsp), %eax
add (40)(%rsp), %ebx
add %ebx, %eax
mov %eax, (4)(%rsp)
add $(3049323471), %r13d
add (8)(%rsp), %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(6), %ecx
mov %r10d, %ebx
push %r10
not %edx
ror $(11), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(14), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
add %r13d, %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(2), %ecx
mov %r14d, %ebx
push %r14
xor %r15d, %edx
ror $(13), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(9), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
mov (12)(%rsp), %eax
mov (%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (12)(%rsp), %ecx
mov (%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (8)(%rsp), %eax
add (44)(%rsp), %ebx
add %ebx, %eax
mov %eax, (8)(%rsp)
add $(3921009573), %r12d
add (12)(%rsp), %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(6), %ecx
mov %r9d, %ebx
push %r9
not %edx
ror $(11), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(14), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
add %r12d, %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(2), %ecx
mov %r13d, %ebx
push %r13
xor %r14d, %edx
ror $(13), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(9), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
mov (16)(%rsp), %eax
mov (4)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (16)(%rsp), %ecx
mov (4)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (12)(%rsp), %eax
add (48)(%rsp), %ebx
add %ebx, %eax
mov %eax, (12)(%rsp)
add $(961987163), %r11d
add (16)(%rsp), %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(6), %ecx
mov %r8d, %ebx
push %r8
not %edx
ror $(11), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(14), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
add %r11d, %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(2), %ecx
mov %r12d, %ebx
push %r12
xor %r13d, %edx
ror $(13), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(9), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
mov (20)(%rsp), %eax
mov (8)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (20)(%rsp), %ecx
mov (8)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (16)(%rsp), %eax
add (52)(%rsp), %ebx
add %ebx, %eax
mov %eax, (16)(%rsp)
add $(1508970993), %r10d
add (20)(%rsp), %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(6), %ecx
mov %r15d, %ebx
push %r15
not %edx
ror $(11), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(14), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
add %r10d, %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(2), %ecx
mov %r11d, %ebx
push %r11
xor %r12d, %edx
ror $(13), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(9), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
mov (24)(%rsp), %eax
mov (12)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (24)(%rsp), %ecx
mov (12)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (20)(%rsp), %eax
add (56)(%rsp), %ebx
add %ebx, %eax
mov %eax, (20)(%rsp)
add $(2453635748), %r9d
add (24)(%rsp), %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(6), %ecx
mov %r14d, %ebx
push %r14
not %edx
ror $(11), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(14), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
add %r9d, %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(2), %ecx
mov %r10d, %ebx
push %r10
xor %r11d, %edx
ror $(13), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(9), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
mov (28)(%rsp), %eax
mov (16)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (28)(%rsp), %ecx
mov (16)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (24)(%rsp), %eax
add (60)(%rsp), %ebx
add %ebx, %eax
mov %eax, (24)(%rsp)
add $(2870763221), %r8d
add (28)(%rsp), %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(6), %ecx
mov %r13d, %ebx
push %r13
not %edx
ror $(11), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(14), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
add %r8d, %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(2), %ecx
mov %r9d, %ebx
push %r9
xor %r10d, %edx
ror $(13), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(9), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
mov (32)(%rsp), %eax
mov (20)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (32)(%rsp), %ecx
mov (20)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (28)(%rsp), %eax
add (%rsp), %ebx
add %ebx, %eax
mov %eax, (28)(%rsp)
add $(3624381080), %r15d
add (32)(%rsp), %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(6), %ecx
mov %r12d, %ebx
push %r12
not %edx
ror $(11), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(14), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
add %r15d, %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(2), %ecx
mov %r8d, %ebx
push %r8
xor %r9d, %edx
ror $(13), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(9), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
mov (36)(%rsp), %eax
mov (24)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (36)(%rsp), %ecx
mov (24)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (32)(%rsp), %eax
add (4)(%rsp), %ebx
add %ebx, %eax
mov %eax, (32)(%rsp)
add $(310598401), %r14d
add (36)(%rsp), %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(6), %ecx
mov %r11d, %ebx
push %r11
not %edx
ror $(11), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(14), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
add %r14d, %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(2), %ecx
mov %r15d, %ebx
push %r15
xor %r8d, %edx
ror $(13), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(9), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
mov (40)(%rsp), %eax
mov (28)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (40)(%rsp), %ecx
mov (28)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (36)(%rsp), %eax
add (8)(%rsp), %ebx
add %ebx, %eax
mov %eax, (36)(%rsp)
add $(607225278), %r13d
add (40)(%rsp), %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(6), %ecx
mov %r10d, %ebx
push %r10
not %edx
ror $(11), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(14), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
add %r13d, %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(2), %ecx
mov %r14d, %ebx
push %r14
xor %r15d, %edx
ror $(13), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(9), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
mov (44)(%rsp), %eax
mov (32)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (44)(%rsp), %ecx
mov (32)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (40)(%rsp), %eax
add (12)(%rsp), %ebx
add %ebx, %eax
mov %eax, (40)(%rsp)
add $(1426881987), %r12d
add (44)(%rsp), %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(6), %ecx
mov %r9d, %ebx
push %r9
not %edx
ror $(11), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(14), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
add %r12d, %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(2), %ecx
mov %r13d, %ebx
push %r13
xor %r14d, %edx
ror $(13), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(9), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
mov (48)(%rsp), %eax
mov (36)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (48)(%rsp), %ecx
mov (36)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (44)(%rsp), %eax
add (16)(%rsp), %ebx
add %ebx, %eax
mov %eax, (44)(%rsp)
add $(1925078388), %r11d
add (48)(%rsp), %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(6), %ecx
mov %r8d, %ebx
push %r8
not %edx
ror $(11), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(14), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
add %r11d, %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(2), %ecx
mov %r12d, %ebx
push %r12
xor %r13d, %edx
ror $(13), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(9), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
mov (52)(%rsp), %eax
mov (40)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (52)(%rsp), %ecx
mov (40)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (48)(%rsp), %eax
add (20)(%rsp), %ebx
add %ebx, %eax
mov %eax, (48)(%rsp)
add $(2162078206), %r10d
add (52)(%rsp), %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(6), %ecx
mov %r15d, %ebx
push %r15
not %edx
ror $(11), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(14), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
add %r10d, %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(2), %ecx
mov %r11d, %ebx
push %r11
xor %r12d, %edx
ror $(13), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(9), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
mov (56)(%rsp), %eax
mov (44)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (56)(%rsp), %ecx
mov (44)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (52)(%rsp), %eax
add (24)(%rsp), %ebx
add %ebx, %eax
mov %eax, (52)(%rsp)
add $(2614888103), %r9d
add (56)(%rsp), %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(6), %ecx
mov %r14d, %ebx
push %r14
not %edx
ror $(11), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(14), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
add %r9d, %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(2), %ecx
mov %r10d, %ebx
push %r10
xor %r11d, %edx
ror $(13), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(9), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
mov (60)(%rsp), %eax
mov (48)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (60)(%rsp), %ecx
mov (48)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (56)(%rsp), %eax
add (28)(%rsp), %ebx
add %ebx, %eax
mov %eax, (56)(%rsp)
add $(3248222580), %r8d
add (60)(%rsp), %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(6), %ecx
mov %r13d, %ebx
push %r13
not %edx
ror $(11), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(14), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
add %r8d, %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(2), %ecx
mov %r9d, %ebx
push %r9
xor %r10d, %edx
ror $(13), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(9), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
mov (%rsp), %eax
mov (52)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (%rsp), %ecx
mov (52)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (60)(%rsp), %eax
add (32)(%rsp), %ebx
add %ebx, %eax
mov %eax, (60)(%rsp)
add $(3835390401), %r15d
add (%rsp), %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(6), %ecx
mov %r12d, %ebx
push %r12
not %edx
ror $(11), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(14), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
add %r15d, %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(2), %ecx
mov %r8d, %ebx
push %r8
xor %r9d, %edx
ror $(13), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(9), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
mov (4)(%rsp), %eax
mov (56)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (4)(%rsp), %ecx
mov (56)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (%rsp), %eax
add (36)(%rsp), %ebx
add %ebx, %eax
mov %eax, (%rsp)
add $(4022224774), %r14d
add (4)(%rsp), %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(6), %ecx
mov %r11d, %ebx
push %r11
not %edx
ror $(11), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(14), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
add %r14d, %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(2), %ecx
mov %r15d, %ebx
push %r15
xor %r8d, %edx
ror $(13), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(9), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
mov (8)(%rsp), %eax
mov (60)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (8)(%rsp), %ecx
mov (60)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (4)(%rsp), %eax
add (40)(%rsp), %ebx
add %ebx, %eax
mov %eax, (4)(%rsp)
add $(264347078), %r13d
add (8)(%rsp), %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(6), %ecx
mov %r10d, %ebx
push %r10
not %edx
ror $(11), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(14), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
add %r13d, %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(2), %ecx
mov %r14d, %ebx
push %r14
xor %r15d, %edx
ror $(13), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(9), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
mov (12)(%rsp), %eax
mov (%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (12)(%rsp), %ecx
mov (%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (8)(%rsp), %eax
add (44)(%rsp), %ebx
add %ebx, %eax
mov %eax, (8)(%rsp)
add $(604807628), %r12d
add (12)(%rsp), %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(6), %ecx
mov %r9d, %ebx
push %r9
not %edx
ror $(11), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(14), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
add %r12d, %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(2), %ecx
mov %r13d, %ebx
push %r13
xor %r14d, %edx
ror $(13), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(9), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
mov (16)(%rsp), %eax
mov (4)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (16)(%rsp), %ecx
mov (4)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (12)(%rsp), %eax
add (48)(%rsp), %ebx
add %ebx, %eax
mov %eax, (12)(%rsp)
add $(770255983), %r11d
add (16)(%rsp), %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(6), %ecx
mov %r8d, %ebx
push %r8
not %edx
ror $(11), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(14), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
add %r11d, %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(2), %ecx
mov %r12d, %ebx
push %r12
xor %r13d, %edx
ror $(13), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(9), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
mov (20)(%rsp), %eax
mov (8)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (20)(%rsp), %ecx
mov (8)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (16)(%rsp), %eax
add (52)(%rsp), %ebx
add %ebx, %eax
mov %eax, (16)(%rsp)
add $(1249150122), %r10d
add (20)(%rsp), %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(6), %ecx
mov %r15d, %ebx
push %r15
not %edx
ror $(11), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(14), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
add %r10d, %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(2), %ecx
mov %r11d, %ebx
push %r11
xor %r12d, %edx
ror $(13), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(9), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
mov (24)(%rsp), %eax
mov (12)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (24)(%rsp), %ecx
mov (12)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (20)(%rsp), %eax
add (56)(%rsp), %ebx
add %ebx, %eax
mov %eax, (20)(%rsp)
add $(1555081692), %r9d
add (24)(%rsp), %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(6), %ecx
mov %r14d, %ebx
push %r14
not %edx
ror $(11), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(14), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
add %r9d, %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(2), %ecx
mov %r10d, %ebx
push %r10
xor %r11d, %edx
ror $(13), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(9), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
mov (28)(%rsp), %eax
mov (16)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (28)(%rsp), %ecx
mov (16)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (24)(%rsp), %eax
add (60)(%rsp), %ebx
add %ebx, %eax
mov %eax, (24)(%rsp)
add $(1996064986), %r8d
add (28)(%rsp), %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(6), %ecx
mov %r13d, %ebx
push %r13
not %edx
ror $(11), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(14), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
add %r8d, %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(2), %ecx
mov %r9d, %ebx
push %r9
xor %r10d, %edx
ror $(13), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(9), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
mov (32)(%rsp), %eax
mov (20)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (32)(%rsp), %ecx
mov (20)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (28)(%rsp), %eax
add (%rsp), %ebx
add %ebx, %eax
mov %eax, (28)(%rsp)
add $(2554220882), %r15d
add (32)(%rsp), %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(6), %ecx
mov %r12d, %ebx
push %r12
not %edx
ror $(11), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(14), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
add %r15d, %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(2), %ecx
mov %r8d, %ebx
push %r8
xor %r9d, %edx
ror $(13), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(9), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
mov (36)(%rsp), %eax
mov (24)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (36)(%rsp), %ecx
mov (24)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (32)(%rsp), %eax
add (4)(%rsp), %ebx
add %ebx, %eax
mov %eax, (32)(%rsp)
add $(2821834349), %r14d
add (36)(%rsp), %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(6), %ecx
mov %r11d, %ebx
push %r11
not %edx
ror $(11), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(14), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
add %r14d, %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(2), %ecx
mov %r15d, %ebx
push %r15
xor %r8d, %edx
ror $(13), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(9), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
mov (40)(%rsp), %eax
mov (28)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (40)(%rsp), %ecx
mov (28)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (36)(%rsp), %eax
add (8)(%rsp), %ebx
add %ebx, %eax
mov %eax, (36)(%rsp)
add $(2952996808), %r13d
add (40)(%rsp), %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(6), %ecx
mov %r10d, %ebx
push %r10
not %edx
ror $(11), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(14), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
add %r13d, %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(2), %ecx
mov %r14d, %ebx
push %r14
xor %r15d, %edx
ror $(13), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(9), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
mov (44)(%rsp), %eax
mov (32)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (44)(%rsp), %ecx
mov (32)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (40)(%rsp), %eax
add (12)(%rsp), %ebx
add %ebx, %eax
mov %eax, (40)(%rsp)
add $(3210313671), %r12d
add (44)(%rsp), %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(6), %ecx
mov %r9d, %ebx
push %r9
not %edx
ror $(11), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(14), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
add %r12d, %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(2), %ecx
mov %r13d, %ebx
push %r13
xor %r14d, %edx
ror $(13), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(9), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
mov (48)(%rsp), %eax
mov (36)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (48)(%rsp), %ecx
mov (36)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (44)(%rsp), %eax
add (16)(%rsp), %ebx
add %ebx, %eax
mov %eax, (44)(%rsp)
add $(3336571891), %r11d
add (48)(%rsp), %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(6), %ecx
mov %r8d, %ebx
push %r8
not %edx
ror $(11), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(14), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
add %r11d, %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(2), %ecx
mov %r12d, %ebx
push %r12
xor %r13d, %edx
ror $(13), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(9), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
mov (52)(%rsp), %eax
mov (40)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (52)(%rsp), %ecx
mov (40)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (48)(%rsp), %eax
add (20)(%rsp), %ebx
add %ebx, %eax
mov %eax, (48)(%rsp)
add $(3584528711), %r10d
add (52)(%rsp), %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(6), %ecx
mov %r15d, %ebx
push %r15
not %edx
ror $(11), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(14), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
add %r10d, %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(2), %ecx
mov %r11d, %ebx
push %r11
xor %r12d, %edx
ror $(13), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(9), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
mov (56)(%rsp), %eax
mov (44)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (56)(%rsp), %ecx
mov (44)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (52)(%rsp), %eax
add (24)(%rsp), %ebx
add %ebx, %eax
mov %eax, (52)(%rsp)
add $(113926993), %r9d
add (56)(%rsp), %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(6), %ecx
mov %r14d, %ebx
push %r14
not %edx
ror $(11), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(14), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
add %r9d, %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(2), %ecx
mov %r10d, %ebx
push %r10
xor %r11d, %edx
ror $(13), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(9), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
mov (60)(%rsp), %eax
mov (48)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (60)(%rsp), %ecx
mov (48)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (56)(%rsp), %eax
add (28)(%rsp), %ebx
add %ebx, %eax
mov %eax, (56)(%rsp)
add $(338241895), %r8d
add (60)(%rsp), %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(6), %ecx
mov %r13d, %ebx
push %r13
not %edx
ror $(11), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(14), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
add %r8d, %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(2), %ecx
mov %r9d, %ebx
push %r9
xor %r10d, %edx
ror $(13), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(9), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
mov (%rsp), %eax
mov (52)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (%rsp), %ecx
mov (52)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (60)(%rsp), %eax
add (32)(%rsp), %ebx
add %ebx, %eax
mov %eax, (60)(%rsp)
add $(666307205), %r15d
add (%rsp), %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(6), %ecx
mov %r12d, %ebx
push %r12
not %edx
ror $(11), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(14), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
add %r15d, %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(2), %ecx
mov %r8d, %ebx
push %r8
xor %r9d, %edx
ror $(13), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(9), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
mov (4)(%rsp), %eax
mov (56)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (4)(%rsp), %ecx
mov (56)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (%rsp), %eax
add (36)(%rsp), %ebx
add %ebx, %eax
mov %eax, (%rsp)
add $(773529912), %r14d
add (4)(%rsp), %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(6), %ecx
mov %r11d, %ebx
push %r11
not %edx
ror $(11), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(14), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
add %r14d, %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(2), %ecx
mov %r15d, %ebx
push %r15
xor %r8d, %edx
ror $(13), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(9), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
mov (8)(%rsp), %eax
mov (60)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (8)(%rsp), %ecx
mov (60)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (4)(%rsp), %eax
add (40)(%rsp), %ebx
add %ebx, %eax
mov %eax, (4)(%rsp)
add $(1294757372), %r13d
add (8)(%rsp), %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(6), %ecx
mov %r10d, %ebx
push %r10
not %edx
ror $(11), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(14), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
add %r13d, %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(2), %ecx
mov %r14d, %ebx
push %r14
xor %r15d, %edx
ror $(13), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(9), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
mov (12)(%rsp), %eax
mov (%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (12)(%rsp), %ecx
mov (%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (8)(%rsp), %eax
add (44)(%rsp), %ebx
add %ebx, %eax
mov %eax, (8)(%rsp)
add $(1396182291), %r12d
add (12)(%rsp), %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(6), %ecx
mov %r9d, %ebx
push %r9
not %edx
ror $(11), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(14), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
add %r12d, %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(2), %ecx
mov %r13d, %ebx
push %r13
xor %r14d, %edx
ror $(13), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(9), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
mov (16)(%rsp), %eax
mov (4)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (16)(%rsp), %ecx
mov (4)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (12)(%rsp), %eax
add (48)(%rsp), %ebx
add %ebx, %eax
mov %eax, (12)(%rsp)
add $(1695183700), %r11d
add (16)(%rsp), %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(6), %ecx
mov %r8d, %ebx
push %r8
not %edx
ror $(11), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(14), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
add %r11d, %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(2), %ecx
mov %r12d, %ebx
push %r12
xor %r13d, %edx
ror $(13), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(9), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
mov (20)(%rsp), %eax
mov (8)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (20)(%rsp), %ecx
mov (8)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (16)(%rsp), %eax
add (52)(%rsp), %ebx
add %ebx, %eax
mov %eax, (16)(%rsp)
add $(1986661051), %r10d
add (20)(%rsp), %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(6), %ecx
mov %r15d, %ebx
push %r15
not %edx
ror $(11), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(14), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
add %r10d, %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(2), %ecx
mov %r11d, %ebx
push %r11
xor %r12d, %edx
ror $(13), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(9), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
mov (24)(%rsp), %eax
mov (12)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (24)(%rsp), %ecx
mov (12)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (20)(%rsp), %eax
add (56)(%rsp), %ebx
add %ebx, %eax
mov %eax, (20)(%rsp)
add $(2177026350), %r9d
add (24)(%rsp), %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(6), %ecx
mov %r14d, %ebx
push %r14
not %edx
ror $(11), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(14), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
add %r9d, %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(2), %ecx
mov %r10d, %ebx
push %r10
xor %r11d, %edx
ror $(13), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(9), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
mov (28)(%rsp), %eax
mov (16)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (28)(%rsp), %ecx
mov (16)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (24)(%rsp), %eax
add (60)(%rsp), %ebx
add %ebx, %eax
mov %eax, (24)(%rsp)
add $(2456956037), %r8d
add (28)(%rsp), %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(6), %ecx
mov %r13d, %ebx
push %r13
not %edx
ror $(11), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(14), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
add %r8d, %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(2), %ecx
mov %r9d, %ebx
push %r9
xor %r10d, %edx
ror $(13), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(9), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
mov (32)(%rsp), %eax
mov (20)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (32)(%rsp), %ecx
mov (20)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (28)(%rsp), %eax
add (%rsp), %ebx
add %ebx, %eax
mov %eax, (28)(%rsp)
add $(2730485921), %r15d
add (32)(%rsp), %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(6), %ecx
mov %r12d, %ebx
push %r12
not %edx
ror $(11), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(14), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
add %r15d, %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(2), %ecx
mov %r8d, %ebx
push %r8
xor %r9d, %edx
ror $(13), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(9), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
mov (36)(%rsp), %eax
mov (24)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (36)(%rsp), %ecx
mov (24)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (32)(%rsp), %eax
add (4)(%rsp), %ebx
add %ebx, %eax
mov %eax, (32)(%rsp)
add $(2820302411), %r14d
add (36)(%rsp), %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(6), %ecx
mov %r11d, %ebx
push %r11
not %edx
ror $(11), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(14), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
add %r14d, %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(2), %ecx
mov %r15d, %ebx
push %r15
xor %r8d, %edx
ror $(13), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(9), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
mov (40)(%rsp), %eax
mov (28)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (40)(%rsp), %ecx
mov (28)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (36)(%rsp), %eax
add (8)(%rsp), %ebx
add %ebx, %eax
mov %eax, (36)(%rsp)
add $(3259730800), %r13d
add (40)(%rsp), %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(6), %ecx
mov %r10d, %ebx
push %r10
not %edx
ror $(11), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(14), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
add %r13d, %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(2), %ecx
mov %r14d, %ebx
push %r14
xor %r15d, %edx
ror $(13), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(9), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
mov (44)(%rsp), %eax
mov (32)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (44)(%rsp), %ecx
mov (32)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (40)(%rsp), %eax
add (12)(%rsp), %ebx
add %ebx, %eax
mov %eax, (40)(%rsp)
add $(3345764771), %r12d
add (44)(%rsp), %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(6), %ecx
mov %r9d, %ebx
push %r9
not %edx
ror $(11), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(14), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
add %r12d, %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(2), %ecx
mov %r13d, %ebx
push %r13
xor %r14d, %edx
ror $(13), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(9), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
mov (48)(%rsp), %eax
mov (36)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (48)(%rsp), %ecx
mov (36)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (44)(%rsp), %eax
add (16)(%rsp), %ebx
add %ebx, %eax
mov %eax, (44)(%rsp)
add $(3516065817), %r11d
add (48)(%rsp), %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(6), %ecx
mov %r8d, %ebx
push %r8
not %edx
ror $(11), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(14), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
add %r11d, %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(2), %ecx
mov %r12d, %ebx
push %r12
xor %r13d, %edx
ror $(13), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(9), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
mov (52)(%rsp), %eax
mov (40)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (52)(%rsp), %ecx
mov (40)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (48)(%rsp), %eax
add (20)(%rsp), %ebx
add %ebx, %eax
mov %eax, (48)(%rsp)
add $(3600352804), %r10d
add (52)(%rsp), %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(6), %ecx
mov %r15d, %ebx
push %r15
not %edx
ror $(11), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(14), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
add %r10d, %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(2), %ecx
mov %r11d, %ebx
push %r11
xor %r12d, %edx
ror $(13), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(9), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
mov (56)(%rsp), %eax
mov (44)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (56)(%rsp), %ecx
mov (44)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (52)(%rsp), %eax
add (24)(%rsp), %ebx
add %ebx, %eax
mov %eax, (52)(%rsp)
add $(4094571909), %r9d
add (56)(%rsp), %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(6), %ecx
mov %r14d, %ebx
push %r14
not %edx
ror $(11), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(14), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
add %r9d, %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(2), %ecx
mov %r10d, %ebx
push %r10
xor %r11d, %edx
ror $(13), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(9), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
mov (60)(%rsp), %eax
mov (48)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (60)(%rsp), %ecx
mov (48)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (56)(%rsp), %eax
add (28)(%rsp), %ebx
add %ebx, %eax
mov %eax, (56)(%rsp)
add $(275423344), %r8d
add (60)(%rsp), %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(6), %ecx
mov %r13d, %ebx
push %r13
not %edx
ror $(11), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(14), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
add %r8d, %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(2), %ecx
mov %r9d, %ebx
push %r9
xor %r10d, %edx
ror $(13), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(9), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
mov (%rsp), %eax
mov (52)(%rsp), %ebx
shr $(3), %eax
shr $(10), %ebx
mov (%rsp), %ecx
mov (52)(%rsp), %edx
ror $(7), %ecx
ror $(17), %edx
xor %ecx, %eax
xor %edx, %ebx
ror $(11), %ecx
ror $(2), %edx
xor %ecx, %eax
xor %edx, %ebx
add (60)(%rsp), %eax
add (32)(%rsp), %ebx
add %ebx, %eax
mov %eax, (60)(%rsp)
add $(430227734), %r15d
add (%rsp), %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(6), %ecx
mov %r12d, %ebx
push %r12
not %edx
ror $(11), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(14), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
add %r15d, %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(2), %ecx
mov %r8d, %ebx
push %r8
xor %r9d, %edx
ror $(13), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(9), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
add $(506948616), %r14d
add (4)(%rsp), %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(6), %ecx
mov %r11d, %ebx
push %r11
not %edx
ror $(11), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(14), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
add %r14d, %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(2), %ecx
mov %r15d, %ebx
push %r15
xor %r8d, %edx
ror $(13), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(9), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
add $(659060556), %r13d
add (8)(%rsp), %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(6), %ecx
mov %r10d, %ebx
push %r10
not %edx
ror $(11), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(14), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
add %r13d, %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(2), %ecx
mov %r14d, %ebx
push %r14
xor %r15d, %edx
ror $(13), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(9), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
add $(883997877), %r12d
add (12)(%rsp), %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(6), %ecx
mov %r9d, %ebx
push %r9
not %edx
ror $(11), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(14), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
add %r12d, %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(2), %ecx
mov %r13d, %ebx
push %r13
xor %r14d, %edx
ror $(13), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(9), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
add $(958139571), %r11d
add (16)(%rsp), %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(6), %ecx
mov %r8d, %ebx
push %r8
not %edx
ror $(11), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(14), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
add %r11d, %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(2), %ecx
mov %r12d, %ebx
push %r12
xor %r13d, %edx
ror $(13), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(9), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
add $(1322822218), %r10d
add (20)(%rsp), %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(6), %ecx
mov %r15d, %ebx
push %r15
not %edx
ror $(11), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(14), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
add %r10d, %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(2), %ecx
mov %r11d, %ebx
push %r11
xor %r12d, %edx
ror $(13), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(9), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
add $(1537002063), %r9d
add (24)(%rsp), %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(6), %ecx
mov %r14d, %ebx
push %r14
not %edx
ror $(11), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(14), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
add %r9d, %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(2), %ecx
mov %r10d, %ebx
push %r10
xor %r11d, %edx
ror $(13), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(9), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
add $(1747873779), %r8d
add (28)(%rsp), %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(6), %ecx
mov %r13d, %ebx
push %r13
not %edx
ror $(11), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(14), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
add %r8d, %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(2), %ecx
mov %r9d, %ebx
push %r9
xor %r10d, %edx
ror $(13), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(9), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
add $(1955562222), %r15d
add (32)(%rsp), %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(6), %ecx
mov %r12d, %ebx
push %r12
not %edx
ror $(11), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(14), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
add %r15d, %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(2), %ecx
mov %r8d, %ebx
push %r8
xor %r9d, %edx
ror $(13), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(9), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r15d
add $(2024104815), %r14d
add (36)(%rsp), %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(6), %ecx
mov %r11d, %ebx
push %r11
not %edx
ror $(11), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(14), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
add %r14d, %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(2), %ecx
mov %r15d, %ebx
push %r15
xor %r8d, %edx
ror $(13), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(9), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r14d
add $(2227730452), %r13d
add (40)(%rsp), %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(6), %ecx
mov %r10d, %ebx
push %r10
not %edx
ror $(11), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(14), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
add %r13d, %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(2), %ecx
mov %r14d, %ebx
push %r14
xor %r15d, %edx
ror $(13), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(9), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r13d
add $(2361852424), %r12d
add (44)(%rsp), %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(6), %ecx
mov %r9d, %ebx
push %r9
not %edx
ror $(11), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(14), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
add %r12d, %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(2), %ecx
mov %r13d, %ebx
push %r13
xor %r14d, %edx
ror $(13), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(9), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r12d
add $(2428436474), %r11d
add (48)(%rsp), %r11d
mov %r8d, %ecx
mov %r8d, %edx
ror $(6), %ecx
mov %r8d, %ebx
push %r8
not %edx
ror $(11), %r8d
and %r9d, %ebx
and %r10d, %edx
xor %r8d, %ecx
ror $(14), %r8d
xor %ebx, %edx
xor %r8d, %ecx
pop %r8
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
add %r11d, %r15d
mov %r12d, %ecx
mov %r12d, %edx
ror $(2), %ecx
mov %r12d, %ebx
push %r12
xor %r13d, %edx
ror $(13), %r12d
and %r13d, %ebx
and %r14d, %edx
xor %r12d, %ecx
ror $(9), %r12d
xor %ebx, %edx
xor %r12d, %ecx
pop %r12
lea (%rdx,%rcx), %rbx
add %ebx, %r11d
add $(2756734187), %r10d
add (52)(%rsp), %r10d
mov %r15d, %ecx
mov %r15d, %edx
ror $(6), %ecx
mov %r15d, %ebx
push %r15
not %edx
ror $(11), %r15d
and %r8d, %ebx
and %r9d, %edx
xor %r15d, %ecx
ror $(14), %r15d
xor %ebx, %edx
xor %r15d, %ecx
pop %r15
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
add %r10d, %r14d
mov %r11d, %ecx
mov %r11d, %edx
ror $(2), %ecx
mov %r11d, %ebx
push %r11
xor %r12d, %edx
ror $(13), %r11d
and %r12d, %ebx
and %r13d, %edx
xor %r11d, %ecx
ror $(9), %r11d
xor %ebx, %edx
xor %r11d, %ecx
pop %r11
lea (%rdx,%rcx), %rbx
add %ebx, %r10d
add $(3204031479), %r9d
add (56)(%rsp), %r9d
mov %r14d, %ecx
mov %r14d, %edx
ror $(6), %ecx
mov %r14d, %ebx
push %r14
not %edx
ror $(11), %r14d
and %r15d, %ebx
and %r8d, %edx
xor %r14d, %ecx
ror $(14), %r14d
xor %ebx, %edx
xor %r14d, %ecx
pop %r14
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
add %r9d, %r13d
mov %r10d, %ecx
mov %r10d, %edx
ror $(2), %ecx
mov %r10d, %ebx
push %r10
xor %r11d, %edx
ror $(13), %r10d
and %r11d, %ebx
and %r12d, %edx
xor %r10d, %ecx
ror $(9), %r10d
xor %ebx, %edx
xor %r10d, %ecx
pop %r10
lea (%rdx,%rcx), %rbx
add %ebx, %r9d
add $(3329325298), %r8d
add (60)(%rsp), %r8d
mov %r13d, %ecx
mov %r13d, %edx
ror $(6), %ecx
mov %r13d, %ebx
push %r13
not %edx
ror $(11), %r13d
and %r14d, %ebx
and %r15d, %edx
xor %r13d, %ecx
ror $(14), %r13d
xor %ebx, %edx
xor %r13d, %ecx
pop %r13
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
add %r8d, %r12d
mov %r9d, %ecx
mov %r9d, %edx
ror $(2), %ecx
mov %r9d, %ebx
push %r9
xor %r10d, %edx
ror $(13), %r9d
and %r10d, %ebx
and %r11d, %edx
xor %r9d, %ecx
ror $(9), %r9d
xor %ebx, %edx
xor %r9d, %ecx
pop %r9
lea (%rdx,%rcx), %rbx
add %ebx, %r8d
add %r8d, (%rdi)
add %r9d, (4)(%rdi)
add %r10d, (8)(%rdi)
add %r11d, (12)(%rdi)
add %r12d, (16)(%rdi)
add %r13d, (20)(%rdi)
add %r14d, (24)(%rdi)
add %r15d, (28)(%rdi)
add $(64), %rsi
subq $(64), (64)(%rsp)
jg .Lsha256_block_loopgas_1
add $(80), %rsp
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbx
ret
.Lfe1:
.size m7_UpdateSHA256, .Lfe1-(m7_UpdateSHA256)
|
oeis/041/A041096.asm | neoneye/loda-programs | 11 | 160243 | <reponame>neoneye/loda-programs
; A041096: Numerators of continued fraction convergents to sqrt(56).
; Submitted by <NAME>
; 7,15,217,449,6503,13455,194873,403201,5839687,12082575,174995737,362074049,5244032423,10850138895,157145976953,325142092801,4709135276167,9743412645135,141116912308057,291977237261249,4228798233965543,8749573705192335,126722830106658233,262195233918508801,3797456104965781447,7857107443850071695,113796960318866785177,235451028081583642049,3410111353461037773863,7055673735003659189775,102189543643512266430713,211434761022028192051201,3062276197951906955147527,6335987156925842102346255
add $0,1
mov $3,4
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
dif $2,4
dif $2,7
mul $2,28
add $3,$2
lpe
mov $0,$3
div $0,4
|
Sum4WordDataSmallModel.asm | benymaxparsa/Assembly-8086 | 0 | 173470 | <filename>Sum4WordDataSmallModel.asm
TITLE PROG2-2 (EXE) REWRITTEN WITH SIMPLE SEGMENT DEFINITION
PAGE 60, 132
.MODEL SMALL
.STACK 32
.DATA
DATA1 DW 234DH, 1DE6H, 3BC7H, 566AH
;ORG 10H
SUM DW ?
.CODE
START:
MOV AX, @DATA
MOV DS, AX
MOV CX, 04
MOV DI, OFFSET DATA1
XOR BX, BX
ADD_LP:
ADD BX, [DI]
INC DI
INC DI
DEC CX
JNZ ADD_LP
MOV SI, OFFSET SUM
MOV [SI], BX
MOV AH, 4CH
INT 21H
END START |
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_291_412.asm | ljhsiun2/medusa | 9 | 28752 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x1966b, %rsi
lea addresses_A_ht+0x1fa3, %rdi
xor %r12, %r12
mov $80, %rcx
rep movsl
nop
nop
add $34453, %rsi
lea addresses_A_ht+0x1c667, %r9
nop
nop
inc %rdi
movw $0x6162, (%r9)
nop
nop
nop
nop
add %r9, %r9
lea addresses_WT_ht+0x1deb, %rsi
nop
nop
nop
nop
nop
xor $22399, %r8
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
movups %xmm3, (%rsi)
nop
nop
nop
nop
nop
and $43758, %rdi
lea addresses_normal_ht+0x1ae73, %rdi
nop
nop
nop
and $64658, %r9
mov (%rdi), %r12d
nop
nop
nop
nop
add $20574, %r8
lea addresses_normal_ht+0xac63, %rdi
nop
add %r9, %r9
mov (%rdi), %r8d
nop
nop
nop
nop
add %r12, %r12
lea addresses_UC_ht+0x16c63, %r12
nop
nop
nop
nop
nop
and $56582, %rdi
mov $0x6162636465666768, %r9
movq %r9, %xmm2
movups %xmm2, (%r12)
nop
nop
sub $46831, %rsi
lea addresses_normal_ht+0x76e7, %r12
nop
xor %rbx, %rbx
movb $0x61, (%r12)
add %r12, %r12
lea addresses_D_ht+0x1e6b, %rsi
lea addresses_WC_ht+0x15aa3, %rdi
nop
nop
sub $8348, %r8
mov $52, %rcx
rep movsw
nop
nop
nop
nop
nop
add $14938, %r9
lea addresses_D_ht+0x2723, %rdi
nop
cmp %r9, %r9
movl $0x61626364, (%rdi)
nop
nop
nop
xor %r8, %r8
lea addresses_WT_ht+0x3ea3, %rsi
lea addresses_UC_ht+0x174a3, %rdi
add $44649, %r15
mov $125, %rcx
rep movsl
cmp %rcx, %rcx
lea addresses_D_ht+0x15863, %r8
nop
dec %r15
movb $0x61, (%r8)
nop
nop
nop
nop
nop
cmp %r15, %r15
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %rax
push %rbp
push %rbx
push %rcx
push %rsi
// Store
lea addresses_UC+0x1d6a3, %rcx
nop
nop
sub %rbx, %rbx
mov $0x5152535455565758, %rsi
movq %rsi, %xmm2
vmovaps %ymm2, (%rcx)
nop
nop
nop
nop
sub $38268, %rsi
// Faulty Load
lea addresses_RW+0x3ea3, %r11
nop
nop
nop
nop
nop
and $60246, %r10
mov (%r11), %bp
lea oracles, %rbx
and $0xff, %rbp
shlq $12, %rbp
mov (%rbx,%rbp,1), %rbp
pop %rsi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': True, 'NT': True, 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'32': 291}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
Library/GrObj/Attr/attr.asm | steakknife/pcgeos | 504 | 167085 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Admin
FILE: objectAttr.asm
AUTHOR: <NAME>, Nov 15, 1991
ROUTINES:
Name
----
GrObjCanChangeAttributes?
GrObjCanDraw?
METHODS:
Name
----
GrObjSetAreaAttr
GrObjSetAreaColor
GrObjSetAreaMask
GrObjSetAreaDrawMode
GrObjSetAreaInfo
GrObjSetLineAttr
GrObjSetLineColor
GrObjSetLineMask
GrObjSetLineEnd
GrObjSetLineJoin
GrObjSetLineStyle
GrObjSetLineWidth
GrObjSetLineMiterLimit
GrObjGetGrObjAreaToken
GrObjGetGrObjLineToken
GrObjSetGrObjAreaToken
GrObjSetGrObjLineToken
GrObjInitToDefaultAttrs
GrObjApplyAttributesToGstate
GrObjInvertGrObjSprite
GrObjDraw
GrObjDrawSpriteLine
GrObjDrawNormalSpriteLine
GrObjDerefAGrObjAreaToken
GrObjDerefAGrObjLineToken
REVISION HISTORY:
Name Date Description
---- ---- -----------
Steve 11/15/91 Initial revision
DESCRIPTION:
$Id: attr.asm,v 1.1 97/04/04 18:07:04 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAttributesCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjInitToDefaultAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize attributes of object to default
attributes
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
RETURN:
GOI_areaAttrToken set
GOI_lineAttrToken set
GOI_grobjAttrFlags set
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 11/16/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjInitToDefaultAttrs method extern dynamic GrObjClass,
MSG_GO_INIT_TO_DEFAULT_ATTRS
uses ax,cx,dx
.enter
test ds:[di].GOI_optFlags, mask GOOF_FLOATER
jnz done
; Creation of the object is undone in one sweeping gesture,
; it is deleted. This deletion will deref any necessary tokens
; so don't generate any undo for setting the initial tokens.
;
call GrObjGlobalUndoIgnoreActions
; Get the current default area attr index from the manager
; And set it as the token for this object
;
mov ax,MSG_GO_GET_GROBJ_AREA_TOKEN
mov di, mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToGOAM
mov ax,MSG_GO_SET_GROBJ_AREA_TOKEN
call ObjCallInstanceNoLock
; Get the current default line attr index from the manager
; And set it as the token for this object
;
mov ax,MSG_GO_GET_GROBJ_LINE_TOKEN
mov di, mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToGOAM
mov ax,MSG_GO_SET_GROBJ_LINE_TOKEN
call ObjCallInstanceNoLock
mov ax,MSG_GO_GET_GROBJ_ATTR_FLAGS
mov di,mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToGOAM
; Reset all but the no default bits and don't set any of
; the no default bits
;
mov dx,not NO_DEFAULT_GROBJ_ATTR_FLAGS
andnf cx,dx
mov ax,MSG_GO_SET_GROBJ_ATTR_FLAGS
call ObjCallInstanceNoLock
; Set correct parent bounds again to account of non-standard
; default attrs
;
mov ax,MSG_GO_CALC_PARENT_DIMENSIONS
call ObjCallInstanceNoLock
call GrObjGlobalUndoAcceptActions
done:
.leave
ret
GrObjInitToDefaultAttrs endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjMakeAttrsDefault
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set our attributes as the default in the attribute
manager
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 11/16/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjMakeAttrsDefault method extern dynamic GrObjClass,
MSG_GO_MAKE_ATTRS_DEFAULT
uses ax,cx,dx
.enter
test ds:[di].GOI_optFlags, mask GOOF_FLOATER or \
mask GOOF_ATTRIBUTE_MANAGER
jnz done
; It doesn't make sense to undo this
;
call GrObjGlobalUndoIgnoreActions
mov ax,MSG_GO_GET_GROBJ_AREA_TOKEN
call ObjCallInstanceNoLock
mov di, mask MF_FIXUP_DS
mov ax,MSG_GO_SET_GROBJ_AREA_TOKEN
call GrObjMessageToGOAM
mov ax,MSG_GO_GET_GROBJ_LINE_TOKEN
call ObjCallInstanceNoLock
mov ax,MSG_GO_SET_GROBJ_LINE_TOKEN
mov di, mask MF_FIXUP_DS
call GrObjMessageToGOAM
mov ax,MSG_GO_GET_GROBJ_ATTR_FLAGS
call ObjCallInstanceNoLock
; Reset all but the no default bits and don't set any of
; the no default bits
;
mov dx,not NO_DEFAULT_GROBJ_ATTR_FLAGS
andnf cx,dx
mov di,mask MF_FIXUP_DS or mask MF_CALL
mov ax,MSG_GO_SET_GROBJ_ATTR_FLAGS
call GrObjMessageToGOAM
call GrObjGlobalUndoAcceptActions
done:
.leave
ret
GrObjMakeAttrsDefault endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetGrObjAreaToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return the GrObjBaseAreaAttrElement token
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
RETURN:
cx - area token
must return carry set
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetGrObjAreaToken method extern dynamic GrObjClass,
MSG_GO_GET_GROBJ_AREA_TOKEN
.enter
mov cx,ds:[di].GOI_areaAttrToken
stc
.leave
ret
GrObjGetGrObjAreaToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGetGrObjLineToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return the GrObjBaseLineAttrElement token
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
RETURN:
cx - line token
must return carry set
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGetGrObjLineToken method extern dynamic GrObjClass,
MSG_GO_GET_GROBJ_LINE_TOKEN
.enter
mov cx,ds:[di].GOI_lineAttrToken
stc
.leave
ret
GrObjGetGrObjLineToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetGrObjAreaToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the area attribute token of the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cx - area token
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetGrObjAreaToken method extern dynamic GrObjClass,
MSG_GO_SET_GROBJ_AREA_TOKEN
uses cx, dx, bp
.enter
cmp cx, CA_NULL_ELEMENT
je returnToBaseStyle
call GrObjAttrGenerateUndoAreaAttrChangeChain
call ObjMarkDirty
mov ax,cx ;new token
xchg ax,ds:[di].GOI_areaAttrToken
cmp cx, ax ;check diff
je done
call GrObjAddRefGrObjAreaToken
xchg cx,ax ;cx <- old token
;ax <- new
call GrObjDerefGrObjAreaToken
call GrObjAttrInvalidateAndSendAreaUINotification
done:
.leave
ret
returnToBaseStyle:
;
; Retrieve our style token
;
mov cx,ds:[di].GOI_areaAttrToken
sub sp, size GrObjFullAreaAttrElement
mov bp, sp
mov ax, MSG_GOAM_GET_FULL_AREA_ATTR_ELEMENT
mov di, mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToGOAM
mov cx, ss:[bp].GOFAAE_base.GOBAAE_styleElement.SSEH_style
add sp, size GrObjFullAreaAttrElement
;
; Get the base area attribute from the style token
;
mov ax, MSG_GOAM_GET_AREA_AND_LINE_TOKENS_FROM_STYLE
mov di, mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToGOAM
jc done
;
; Apply the base attr
;
mov_tr cx, ax ;cx <- base area token
mov ax, MSG_GO_SET_GROBJ_AREA_TOKEN
call ObjCallInstanceNoLock
jmp done
GrObjSetGrObjAreaToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetGrObjLineToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the line attribute token of the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cx - line token
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetGrObjLineToken method extern dynamic GrObjClass,
MSG_GO_SET_GROBJ_LINE_TOKEN
uses cx,dx,bp
.enter
cmp cx, CA_NULL_ELEMENT
je returnToBaseStyle
call GrObjAttrGenerateUndoLineAttrChangeChain
call ObjMarkDirty
mov ax,cx ;new token
xchg ax,ds:[di].GOI_lineAttrToken
cmp cx, ax ;check diff
je done
call GrObjAddRefGrObjLineToken
xchg cx,ax ;ax <- new token
;cx <- old token
call GrObjDerefGrObjLineToken
call GrObjAttrInvalidateAndSendLineUINotification
done:
.leave
ret
returnToBaseStyle:
;
; Retrieve our style token
;
mov cx,ds:[di].GOI_lineAttrToken
sub sp, size GrObjFullLineAttrElement
mov bp, sp
mov ax, MSG_GOAM_GET_FULL_LINE_ATTR_ELEMENT
mov di, mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToGOAM
mov cx, ss:[bp].GOFLAE_base.GOBLAE_styleElement.SSEH_style
add sp, size GrObjFullLineAttrElement
;
; Get the base area attribute from the style token
;
mov ax, MSG_GOAM_GET_AREA_AND_LINE_TOKENS_FROM_STYLE
mov di, mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToGOAM
jc done
;
; Apply the base attr
;
mov cx, dx ;cx <- base line token
mov ax, MSG_GO_SET_GROBJ_LINE_TOKEN
call ObjCallInstanceNoLock
jmp done
GrObjSetGrObjLineToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjDerefAGrObjAreaToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Decrement the reference count for the passed area token
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
RETURN:
cx - area token
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjDerefAGrObjAreaToken method extern dynamic GrObjClass,
MSG_GO_DEREF_A_GROBJ_AREA_TOKEN
.enter
call GrObjDerefGrObjAreaToken
.leave
ret
GrObjDerefAGrObjAreaToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjDerefAGrObjLineToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Decrement the reference count for the passed line token
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
RETURN:
cx - line token
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjDerefAGrObjLineToken method extern dynamic GrObjClass,
MSG_GO_DEREF_A_GROBJ_LINE_TOKEN
.enter
call GrObjDerefGrObjLineToken
.leave
ret
GrObjDerefAGrObjLineToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSubstAreaToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: GrObj method for MSG_GO_SUBST_AREA_TOKEN
If object's area token matches the passed "old" token,
replace it with the new token, and update the reference
counts if specified
Called by:
Pass: *ds:si = GrObj object
ds:di = GrObj instance
cx - old token
dx - new token
bp - nonzero to update reference counts
Return: nothing
Destroyed: ax
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon May 7, 1992 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSubstAreaToken method extern dynamic GrObjClass, MSG_GO_SUBST_AREA_TOKEN
.enter
;
; Check for the old token
;
cmp cx, ds:[di].GOI_areaAttrToken
jne done
;
; Check if we're supposed to update ref counts
;
tst bp
jz noRefs
;
; Send ourselves a MSG_GO_SET_GROBJ_AREA_TOKEN,
; which will update the references...
;
xchg cx, dx ;cx <- new
;dx <- old
mov ax, MSG_GO_SET_GROBJ_AREA_TOKEN
call ObjCallInstanceNoLock
xchg cx, dx ;cx <- old
;dx <- new
done:
.leave
ret
;
; Update the tokens without updating the refs
;
noRefs:
mov ds:[di].GOI_areaAttrToken, dx
call GrObjAttrInvalidateAndSendAreaUINotification
call ObjMarkDirty
jmp done
GrObjSubstAreaToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSubstLineToken
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: GrObj method for MSG_GO_SUBST_LINE_TOKEN
If object's line token matches the passed "old" token,
replace it with the new token, and update the reference
counts if specified
Called by:
Pass: *ds:si = GrObj object
ds:di = GrObj instance
cx - old token
dx - new token
bp - nonzero to update reference counts
Return: nothing
Destroyed: ax
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon May 7, 1992 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSubstLineToken method extern dynamic GrObjClass, MSG_GO_SUBST_LINE_TOKEN
.enter
;
; Check for the old token
;
cmp cx, ds:[di].GOI_lineAttrToken
jne done
;
; Check if we're supposed to update ref counts
;
tst bp
jz noRefs
;
; Send ourselves a MSG_GO_SET_GROBJ_LINE_TOKEN,
; which will update the references...
;
xchg cx, dx ;cx <- new
;dx <- old
mov ax, MSG_GO_SET_GROBJ_LINE_TOKEN
call ObjCallInstanceNoLock
xchg cx, dx ;cx <- old
;dx <- new
done:
.leave
ret
;
; Update the tokens without updating the refs
;
noRefs:
mov ds:[di].GOI_lineAttrToken, dx
call GrObjAttrInvalidateAndSendLineUINotification
call ObjMarkDirty
jmp done
GrObjSubstLineToken endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCanChangeAttributes?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if object can have its attributes changed
CALLED BY: INTERNAL (UTILITY)
PASS: *ds:si - GrObj
RETURN:
stc - yes
clc - no
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
object can have its attributes changed
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCanChangeAttributes? proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_locks, mask GOL_ATTRIBUTE
jnz done
stc
done:
.leave
ret
GrObjCanChangeAttributes? endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetAreaColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the area color for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - r
ch - g
dl - b
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetAreaColor method extern dynamic GrObjClass, MSG_GO_SET_AREA_COLOR
.enter
mov_tr ax,cx ;r,g
mov bx, offset GOBAAE_r
mov di,AREA_ATTR_COLOR_SIZE
call GrObjChangeAreaAttrCommon
.leave
ret
GrObjSetAreaColor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetAreaMask
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the area mask for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - SystemDrawMask
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetAreaMask method extern dynamic GrObjClass, MSG_GO_SET_AREA_MASK
.enter
mov al,cl ;SystemDrawMask
; Check to see if we are attempting to set the area mask
; for an object with text inside of it. If so, override it
; to unfilled (0%). This is sort of a hack since it easier to
; do this then to disallow the user to modify the setting in the
; first place. --JimG 8/31/99
;
mov bx, ds:[di].GOI_attrFlags
andnf bx, mask GOAF_WRAP
cmp bx, GOWTT_WRAP_INSIDE shl offset GOAF_WRAP
je specialWrapInside
doIt:
mov bx, offset GOBAAE_mask
mov di,AREA_ATTR_MASK_SIZE
call GrObjChangeAreaAttrCommon
.leave
ret
specialWrapInside:
mov al, SDM_0
jmp doIt
GrObjSetAreaMask endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetAreaDrawMode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the area draw mode for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - MixMode
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetAreaDrawMode method extern dynamic GrObjClass,
MSG_GO_SET_AREA_DRAW_MODE
.enter
mov al,cl ;MixMode
mov bx, offset GOBAAE_drawMode
mov di,AREA_ATTR_DRAW_MODE_SIZE
call GrObjChangeAreaAttrCommon
.leave
ret
GrObjSetAreaDrawMode endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetAreaPattern
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the area pattern for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cx - GraphicPattern
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetAreaPattern method extern dynamic GrObjClass, MSG_GO_SET_AREA_PATTERN
.enter
mov ax,cx ;GraphicPattern
mov bx, offset GOBAAE_pattern
mov di,AREA_ATTR_PATTERN_SIZE
call GrObjChangeAreaAttrCommon
.leave
ret
GrObjSetAreaPattern endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetAreaAttrElementType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the area element type for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - GrObjAreaAttrElementType
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetAreaAttrElementType method extern dynamic GrObjClass,
MSG_GO_SET_AREA_ATTR_ELEMENT_TYPE
uses cx, dx
.enter
push cx
mov cx, ds:[di].GOI_areaAttrToken
sub sp,size GrObjFullAreaAttrElement
mov bp,sp
call GrObjGetGrObjFullAreaAttrElement
mov al, ss:[bp].GOBAAE_aaeType
mov bl, ss:[bp].GOBAAE_backR
mov bh, ss:[bp].GOBAAE_backG
mov dl, ss:[bp].GOBAAE_backB
add sp, size GrObjFullAreaAttrElement
pop cx
cmp al, cl
je done
push bx ;save backR, backG
mov al,cl
mov bx, offset GOBAAE_aaeType
mov di,AREA_ATTR_TYPE_SIZE
call GrObjChangeAreaAttrCommon
jnc popCXDone ; => couldn't change, so
; don't do gradient stuff
cmp cl, GOAAET_GRADIENT
pop cx ;cl <- backR, ch <- backG
jne done
mov ax, MSG_GO_SET_ENDING_GRADIENT_COLOR
call ObjCallInstanceNoLock
mov cl, DEFAULT_GRADIENT_TYPE
mov ax, MSG_GO_SET_GRADIENT_TYPE
call ObjCallInstanceNoLock
mov cx, DEFAULT_NUMBER_OF_GRADIENT_INTERVALS
mov ax, MSG_GO_SET_NUMBER_OF_GRADIENT_INTERVALS
call ObjCallInstanceNoLock
done:
.leave
ret
popCXDone:
pop cx
jmp done
GrObjSetAreaAttrElementType endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjChangeAreaAttrCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Common code for changing most area attributes
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - object
ax,dx - new data
bx - offset to field to change
di - size of data to change
RETURN:
carry set if attributes changed
carry clear if attributes may not be changed
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/ 7/92 Initial version
ardeb 11/29/93 Changed to return carry to cope with gradient
fill change on attribute-locked object (was
recursing endlessly as GrObjSetAreaAttrElement-
Type kept trying to call SET_ENDING_GRADIENT_-
COLOR, which would again attempt to set the
thing to GOAAET_GRADIENT and fail...)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjChangeAreaAttrCommon proc far
class GrObjClass
uses cx,bp
.enter
EC < call ECGrObjCheckLMemObject >
call GrObjCanChangeAttributes?
jnc done
call GrObjAttrGenerateUndoAreaAttrChangeChain
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_areaAttrToken
call GrObjChangeGrObjBaseAreaAttrElementField
GrObjDeref di,ds,si
mov ds:[di].GOI_areaAttrToken,cx
; Invalidate the object so that it will draw with its
; new attributes
;
call GrObjAttrInvalidateAndSendAreaUINotification
call ObjMarkDirty
stc
done:
.leave
ret
GrObjChangeAreaAttrCommon endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetTransparency
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the transparenccy info for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - nonzero if true
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetTransparency method extern dynamic GrObjClass,
MSG_GO_SET_TRANSPARENCY
uses ax,cx
.enter
call GrObjCanChangeAttributes?
jnc done
call GrObjAttrGenerateUndoAreaAttrChangeChain
mov ah,mask GOAAIR_TRANSPARENT ;always reset
mov al,ah ;assume true
tst cl
jnz set
clr al ;set nothing
set:
mov cx,ds:[di].GOI_areaAttrToken
mov bx, offset GOBAAE_areaInfo
call GrObjChangeGrObjBaseAreaAttrElementByteRecord
GrObjDeref di,ds,si
mov ds:[di].GOI_areaAttrToken,cx
; Invalidate the object so that it will draw with its
; new attributes
;
call GrObjAttrInvalidateAndSendAreaUINotification
call ObjMarkDirty
done:
.leave
ret
GrObjSetTransparency endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetAreaAttr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set rectangles area attributes
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
ss:bp - GrObjBaseAreaAttrElement
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/23/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetAreaAttr method extern dynamic GrObjClass,
MSG_GO_SET_AREA_ATTR
uses ax,cx
.enter
EC < push ds >
EC < segmov ds,ss >
EC < call GrObjCheckGrObjBaseAreaAttrElement >
EC < pop ds >
call GrObjCanChangeAttributes?
jnc done
call GrObjAttrGenerateUndoAreaAttrChangeChain
mov cx,ds:[di].GOI_areaAttrToken
call GrObjDerefGrObjAreaToken
call GrObjAddGrObjFullAreaAttrElement
mov ds:[di].GOI_areaAttrToken,ax
; Invalidate the object so that it will draw with its
; new attributes
;
call GrObjAttrInvalidateAndSendAreaUINotification
call ObjMarkDirty
done:
.leave
ret
GrObjSetAreaAttr endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetLineColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the line color for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - r
ch - g
dl - b
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetLineColor method extern dynamic GrObjClass,
MSG_GO_SET_LINE_COLOR
.enter
mov_tr ax,cx ;r,g
mov bx, offset GOBLAE_r
mov di,LINE_ATTR_COLOR_SIZE
call GrObjChangeLineAttrCommon
.leave
ret
GrObjSetLineColor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetLineMask
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the line mask for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - SystemDrawMask
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetLineMask method extern dynamic GrObjClass,
MSG_GO_SET_LINE_MASK
.enter
; We calc the PARENT dimensions on changing the line mask
; because if the mask goes from zero to non zero then
; the line width actually gets used.
;
mov al,cl ;SystemDrawMask
mov bx, offset GOBLAE_mask
mov di,LINE_ATTR_MASK_SIZE
call GrObjChangeLineAttrCommonAndCalcPARENT
.leave
ret
GrObjSetLineMask endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetLineJoin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the line join for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - LineJoin
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetLineJoin method extern dynamic GrObjClass,
MSG_GO_SET_LINE_JOIN
.enter
mov al,cl ;DrawJoins
mov bx, offset GOBLAE_join
mov di,LINE_ATTR_JOIN_SIZE
call GrObjChangeLineAttrCommon
.leave
ret
GrObjSetLineJoin endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetLineEnd
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the line end for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - LineEnd
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetLineEnd method extern dynamic GrObjClass, MSG_GO_SET_LINE_END
.enter
mov al,cl ;DrawEnds
mov bx, offset GOBLAE_end
mov di,LINE_ATTR_END_SIZE
call GrObjChangeLineAttrCommon
.leave
ret
GrObjSetLineEnd endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetLineStyle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the line style for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - LineStyle
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetLineStyle method extern dynamic GrObjClass,
MSG_GO_SET_LINE_STYLE
.enter
mov al,cl ;DrawStyles
mov bx, offset GOBLAE_style
mov di,LINE_ATTR_STYLE_SIZE
call GrObjChangeLineAttrCommon
.leave
ret
GrObjSetLineStyle endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetLineWidth
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the line width for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
dx:cx - WWFixed line width
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetLineWidth method extern dynamic GrObjClass,
MSG_GO_SET_LINE_WIDTH
.enter
EC < tst dx >
EC < ERROR_S GROBJ_BUMMER_YOUVE_GOT_A_NEGATIVE_LINE_WIDTH____GET_STEVE_NOW
mov_tr ax,cx ;width frac
mov bx, offset GOBLAE_width
mov di,LINE_ATTR_WIDTH_SIZE
call GrObjChangeLineAttrCommonAndCalcPARENT
.leave
ret
GrObjSetLineWidth endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetLineMiterLimit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the line miter limit for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
dx:cx - WWFixed line miter limit
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetLineMiterLimit method extern dynamic GrObjClass,
MSG_GO_SET_LINE_MITER_LIMIT
.enter
mov_tr ax,cx ;miter limit frac
mov bx, offset GOBLAE_miterLimit
mov di,LINE_ATTR_MITER_LIMIT_SIZE
call GrObjChangeLineAttrCommon
.leave
ret
GrObjSetLineMiterLimit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetLineAttr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set rectangles line attributes
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
ss:bp - GrObjBaseLineAttrElement
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/23/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetLineAttr method extern dynamic GrObjClass,
MSG_GO_SET_LINE_ATTR
uses ax,cx
.enter
EC < push ds >
EC < segmov ds,ss >
EC < call GrObjCheckGrObjBaseLineAttrElement >
EC < pop ds >
call GrObjCanChangeAttributes?
jnc done
call GrObjAttrGenerateUndoLineAttrChangeChain
; Invalidate at the original line width incase the line
; width gets smaller
;
mov ax,MSG_GO_INVALIDATE_LINE
call ObjCallInstanceNoLock
movnf cx, CA_NULL_ELEMENT
xchg cx,ds:[di].GOI_lineAttrToken
call GrObjDerefGrObjLineToken
call GrObjAddGrObjFullLineAttrElement
mov ds:[di].GOI_lineAttrToken,ax
; Adjust for any change in line width
;
mov ax,MSG_GO_CALC_PARENT_DIMENSIONS
call ObjCallInstanceNoLock
; Invalidate the object so that it will draw with its
; new attributes
;
call GrObjAttrInvalidateAndSendLineUINotification
call ObjMarkDirty
done:
.leave
ret
GrObjSetLineAttr endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetLineAttrElementType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the line element type for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - GrObjLineAttrElementType
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetLineAttrElementType method extern dynamic GrObjClass,
MSG_GO_SET_LINE_ATTR_ELEMENT_TYPE
.enter
mov al,cl
mov bx, offset GOBLAE_laeType
mov di,LINE_ATTR_TYPE_SIZE
call GrObjChangeLineAttrCommon
.leave
ret
GrObjSetLineAttrElementType endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetArrowheadLength
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the length of the arrow head branches
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - arrowhead length
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetArrowheadLength method extern dynamic GrObjClass,
MSG_GO_SET_ARROWHEAD_LENGTH
.enter
mov al,cl ;length
mov bx, offset GOBLAE_arrowheadLength
mov di,size GOBLAE_arrowheadLength
call GrObjChangeLineAttrCommonAndCalcPARENT
.leave
ret
GrObjSetArrowheadLength endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetArrowheadAngle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the arrowhead deflection angle
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - arrowhead deflection angle
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetArrowheadAngle method extern dynamic GrObjClass,
MSG_GO_SET_ARROWHEAD_ANGLE
.enter
mov al,cl ;angle
mov bx, offset GOBLAE_arrowheadAngle
mov di,size GOBLAE_arrowheadAngle
call GrObjChangeLineAttrCommonAndCalcPARENT
.leave
ret
GrObjSetArrowheadAngle endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjChangeLineAttrCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Common code for changing most line attributes
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - object
ax,dx - new data
bx - offset to field to change
di - size of data to change
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
This routine should probably return carry set/clear like
GrObjChangeAreaAttrCommon, for consistency sake.
The area attribute one was changed 11/29/93 by Adam
to keep from endless recursion when gradient fill
is enabled for an object with an attribute lock set.
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjChangeLineAttrCommon proc far
class GrObjClass
uses cx,bp
.enter
EC < call ECGrObjCheckLMemObject >
call GrObjCanChangeAttributes?
jnc done
call GrObjAttrGenerateUndoLineAttrChangeChain
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_lineAttrToken
call GrObjChangeGrObjBaseLineAttrElementField
GrObjDeref di,ds,si
mov ds:[di].GOI_lineAttrToken,cx
; Invalidate the object so that it will draw with its
; new attributes
;
call GrObjAttrInvalidateAndSendLineUINotification
call ObjMarkDirty
done:
.leave
ret
GrObjChangeLineAttrCommon endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjChangeLineAttrCommonAndCalcPARENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Common code for changing most line attributes
the require a recalc of the parent bounds
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - object
ax,dx - new data
bx - offset to field to change
di - size of data to change
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjChangeLineAttrCommonAndCalcPARENT proc far
class GrObjClass
uses cx,bp
.enter
EC < call ECGrObjCheckLMemObject >
call GrObjCanChangeAttributes?
jnc done
call GrObjAttrGenerateUndoLineAttrChangeChain
GrObjDeref bp,ds,si
mov cx,ds:[bp].GOI_lineAttrToken
call GrObjChangeGrObjBaseLineAttrElementField
GrObjDeref di,ds,si
mov ds:[di].GOI_lineAttrToken,cx
mov ax,MSG_GO_CALC_PARENT_DIMENSIONS
call ObjCallInstanceNoLock
; Invalidate the object so that it will draw with its
; new attributes
;
call GrObjAttrInvalidateAndSendLineUINotification
call ObjMarkDirty
done:
.leave
ret
GrObjChangeLineAttrCommonAndCalcPARENT endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetArrowheadOnStart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the arrowhead on start for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - nonzero if true
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetArrowheadOnStart method extern dynamic GrObjClass,
MSG_GO_SET_ARROWHEAD_ON_START
uses ax,cx
.enter
call GrObjCanChangeAttributes?
jnc done
call GrObjAttrGenerateUndoLineAttrChangeChain
mov ah,mask GOLAIR_ARROWHEAD_ON_START ;always reset
mov al,ah ;assume true
tst cl
jnz set
clr al ;set nothing
set:
mov cx,ds:[di].GOI_lineAttrToken
mov bx, offset GOBLAE_lineInfo
call GrObjChangeGrObjBaseLineAttrElementByteRecord
GrObjDeref di,ds,si
mov ds:[di].GOI_lineAttrToken,cx
mov ax,MSG_GO_CALC_PARENT_DIMENSIONS
call ObjCallInstanceNoLock
; Invalidate the object so that it will draw with its
; new attributes
;
call GrObjAttrInvalidateAndSendLineUINotification
done:
.leave
ret
GrObjSetArrowheadOnStart endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetArrowheadOnEnd
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the arrowhead on start for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - nonzero if true
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetArrowheadOnEnd method extern dynamic GrObjClass,
MSG_GO_SET_ARROWHEAD_ON_END
uses ax,cx
.enter
call GrObjCanChangeAttributes?
jnc done
call GrObjAttrGenerateUndoLineAttrChangeChain
mov ah,mask GOLAIR_ARROWHEAD_ON_END ;always reset
mov al,ah ;assume true
tst cl
jnz set
clr al ;set nothing
set:
mov cx,ds:[di].GOI_lineAttrToken
mov bx, offset GOBLAE_lineInfo
call GrObjChangeGrObjBaseLineAttrElementByteRecord
GrObjDeref di,ds,si
mov ds:[di].GOI_lineAttrToken,cx
mov ax,MSG_GO_CALC_PARENT_DIMENSIONS
call ObjCallInstanceNoLock
; Invalidate the object so that it will draw with its
; new attributes
;
call GrObjAttrInvalidateAndSendLineUINotification
call ObjMarkDirty
done:
.leave
ret
GrObjSetArrowheadOnEnd endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetArrowheadFilled
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the arrowhead on start for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - nonzero if true
ch - nonzero to fill with area attributes,
zero to fill with line attributes
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetArrowheadFilled method extern dynamic GrObjClass,
MSG_GO_SET_ARROWHEAD_FILLED
uses ax,cx
.enter
call GrObjCanChangeAttributes?
jnc done
call GrObjAttrGenerateUndoLineAttrChangeChain
mov ax, (mask GOLAIR_ARROWHEAD_FILLED or \
mask GOLAIR_ARROWHEAD_FILL_WITH_AREA_ATTRIBUTES) shl 8 or \
(mask GOLAIR_ARROWHEAD_FILLED or \
mask GOLAIR_ARROWHEAD_FILL_WITH_AREA_ATTRIBUTES)
tst cl
jnz checkAreaFill
BitClr al, GOLAIR_ARROWHEAD_FILLED
checkAreaFill:
tst ch
jnz set
BitClr al, GOLAIR_ARROWHEAD_FILL_WITH_AREA_ATTRIBUTES
set:
mov cx,ds:[di].GOI_lineAttrToken
mov bx, offset GOBLAE_lineInfo
call GrObjChangeGrObjBaseLineAttrElementByteRecord
GrObjDeref di,ds,si
mov ds:[di].GOI_lineAttrToken,cx
; Invalidate the object so that it will draw with its
; new attributes
;
call GrObjAttrInvalidateAndSendLineUINotification
call ObjMarkDirty
done:
.leave
ret
GrObjSetArrowheadFilled endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetBGColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the background color for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - r
ch - g
dl - b
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetBGColor method extern dynamic GrObjClass, MSG_GO_SET_BG_COLOR
.enter
mov_tr ax,cx ;r,g
mov bx, offset GOBAAE_backR
mov di,AREA_ATTR_COLOR_SIZE
call GrObjChangeAreaAttrCommon
.leave
ret
GrObjSetBGColor endp
GrObjAttributesCode ends
GrObjDrawCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjApplyAttributesToGState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Apply the area and line attributes to
the passed gstate
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
bp - gstate
RETURN:
bp - gstate with attributes applied
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjApplyAttributesToGState method extern dynamic GrObjClass,
MSG_GO_APPLY_ATTRIBUTES_TO_GSTATE
.enter
xchg di,bp ;gstate, instance offset
mov cx,ds:[bp].GOI_areaAttrToken
call GrObjApplyGrObjAreaToken
mov cx,ds:[bp].GOI_lineAttrToken
call GrObjApplyGrObjLineToken
mov bp,di ;gstate
.leave
ret
GrObjApplyAttributesToGState endp
GrObjDrawCode ends
GrObjSpecialGraphicsCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetStartingGradientColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the staring gradient area color for the object
which is stored in the normal area color location
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - r
ch - g
dl - b
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetStartingGradientColor method extern dynamic GrObjClass,
MSG_GO_SET_STARTING_GRADIENT_COLOR
.enter
push cx
mov cl, GOAAET_GRADIENT
mov ax, MSG_GO_SET_AREA_ATTR_ELEMENT_TYPE
call ObjCallInstanceNoLock
pop ax ;r,g
mov bx, offset GOBAAE_r
mov di,AREA_ATTR_COLOR_SIZE
call GrObjChangeAreaAttrCommon
.leave
ret
GrObjSetStartingGradientColor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetEndingGradientColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the ending gradient area color for the object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - r
ch - g
dl - b
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetEndingGradientColor method extern dynamic GrObjClass,
MSG_GO_SET_ENDING_GRADIENT_COLOR
.enter
push cx
mov cl, GOAAET_GRADIENT
mov ax, MSG_GO_SET_AREA_ATTR_ELEMENT_TYPE
call ObjCallInstanceNoLock
pop ax ;r,g
mov bx, offset GOGAAE_endR
mov di,AREA_ATTR_COLOR_SIZE
call GrObjChangeAreaAttrCommon
.leave
ret
GrObjSetEndingGradientColor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetNumberOfGradientIntervals
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the number of gradient intervals
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cx - number of intervals
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetNumberOfGradientIntervals method extern dynamic GrObjClass,
MSG_GO_SET_NUMBER_OF_GRADIENT_INTERVALS
.enter
push cx
mov cl, GOAAET_GRADIENT
mov ax, MSG_GO_SET_AREA_ATTR_ELEMENT_TYPE
call ObjCallInstanceNoLock
pop ax ;num intervals
mov bx, offset GOGAAE_numIntervals
mov di,size GOGAAE_numIntervals
call GrObjChangeAreaAttrCommon
.leave
ret
GrObjSetNumberOfGradientIntervals endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjSetGradientType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Change the gradient type
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
cl - GrObjGradientType
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjSetGradientType method extern dynamic GrObjClass,
MSG_GO_SET_GRADIENT_TYPE
.enter
push cx
mov cl, GOAAET_GRADIENT
mov ax, MSG_GO_SET_AREA_ATTR_ELEMENT_TYPE
call ObjCallInstanceNoLock
pop ax ;gradient type
mov bx, offset GOGAAE_type
mov di,size GOGAAE_type
call GrObjChangeAreaAttrCommon
.leave
ret
GrObjSetGradientType endp
GrObjSpecialGraphicsCode ends
|
source/environment/machine-w64-mingw32/s-naenva.adb | ytomino/drake | 33 | 11373 | with System.Address_To_Constant_Access_Conversions;
with System.Address_To_Named_Access_Conversions;
with System.Storage_Elements;
with System.Zero_Terminated_WStrings;
with System.Debug; -- assertions
with C.string;
with C.winbase;
with C.windef;
with C.winerror;
with C.winnt;
package body System.Native_Environment_Variables is
use type Storage_Elements.Storage_Offset;
use type C.size_t;
use type C.windef.DWORD;
use type C.windef.WINBOOL;
use type C.winnt.LPWCH;
use type C.winnt.WCHAR;
package LPWCH_Conv is
new Address_To_Named_Access_Conversions (C.winnt.WCHAR, C.winnt.LPWCH);
package LPCWCH_Conv is
new Address_To_Constant_Access_Conversions (
C.winnt.WCHAR,
C.winnt.LPCWCH);
procedure Get_1 (
Name : not null C.winnt.LPCWCH;
Length : out C.windef.DWORD;
Found : out Boolean);
procedure Get_1 (
Name : not null C.winnt.LPCWCH;
Length : out C.windef.DWORD;
Found : out Boolean) is
begin
Length := C.winbase.GetEnvironmentVariable (Name, null, 0);
Found :=
Length > 0
or else C.winbase.GetLastError /= C.winerror.ERROR_ENVVAR_NOT_FOUND;
end Get_1;
function Get_2 (
Name : not null C.winnt.LPCWCH;
Length : C.windef.DWORD)
return String;
function Get_2 (
Name : not null C.winnt.LPCWCH;
Length : C.windef.DWORD)
return String
is
Result : C.winnt.WCHAR_array (0 .. C.size_t (Length));
Result_Length : C.windef.DWORD;
begin
Result_Length :=
C.winbase.GetEnvironmentVariable (
Name,
Result (0)'Access,
Result'Length);
return Zero_Terminated_WStrings.Value (
Result (0)'Access,
C.size_t (Result_Length));
end Get_2;
procedure Do_Separate (
Item : not null C.winnt.LPCWCH;
Name_Length : out C.size_t;
Value : out C.winnt.LPCWCH);
procedure Do_Separate (
Item : not null C.winnt.LPCWCH;
Name_Length : out C.size_t;
Value : out C.winnt.LPCWCH)
is
-- skip first '=', it means special variable
Next : constant C.winnt.LPCWCH :=
LPCWCH_Conv.To_Pointer (
LPCWCH_Conv.To_Address (Item)
+ Storage_Elements.Storage_Offset'(
C.winnt.WCHAR'Size / Standard'Storage_Unit));
P : C.winnt.LPWCH;
begin
P := C.string.wcschr (Next, C.wchar_t'Val (Character'Pos ('=')));
if P /= null then
Name_Length :=
C.size_t (
(LPWCH_Conv.To_Address (P) - LPCWCH_Conv.To_Address (Item))
/ Storage_Elements.Storage_Offset'(
C.winnt.WCHAR'Size / Standard'Storage_Unit));
Value :=
LPCWCH_Conv.To_Pointer (
LPWCH_Conv.To_Address (P)
+ Storage_Elements.Storage_Offset'(
C.winnt.WCHAR'Size / Standard'Storage_Unit));
else
Name_Length := C.string.wcslen (Item);
Value :=
LPCWCH_Conv.To_Pointer (
LPCWCH_Conv.To_Address (Item)
+ Storage_Elements.Storage_Offset (Name_Length)
* (C.winnt.WCHAR'Size / Standard'Storage_Unit));
end if;
end Do_Separate;
-- implementation
function Value (Name : String) return String is
W_Name : aliased C.winnt.WCHAR_array (
0 ..
Name'Length * Zero_Terminated_WStrings.Expanding);
Length : C.windef.DWORD;
Found : Boolean;
begin
Zero_Terminated_WStrings.To_C (Name, W_Name (0)'Access);
Get_1 (W_Name (0)'Unchecked_Access, Length, Found => Found);
if not Found then
raise Constraint_Error;
else
return Get_2 (W_Name (0)'Unchecked_Access, Length);
end if;
end Value;
function Value (Name : String; Default : String) return String is
W_Name : C.winnt.WCHAR_array (
0 ..
Name'Length * Zero_Terminated_WStrings.Expanding);
Length : C.windef.DWORD;
Found : Boolean;
begin
Zero_Terminated_WStrings.To_C (Name, W_Name (0)'Access);
Get_1 (W_Name (0)'Unchecked_Access, Length, Found => Found);
if not Found then
return Default;
else
return Get_2 (W_Name (0)'Unchecked_Access, Length);
end if;
end Value;
function Exists (Name : String) return Boolean is
W_Name : C.winnt.WCHAR_array (
0 ..
Name'Length * Zero_Terminated_WStrings.Expanding);
Length : C.windef.DWORD;
Found : Boolean;
begin
Zero_Terminated_WStrings.To_C (Name, W_Name (0)'Access);
Get_1 (W_Name (0)'Unchecked_Access, Length, Found => Found);
return Found;
end Exists;
procedure Set (Name : String; Value : String) is
W_Name : C.winnt.WCHAR_array (
0 ..
Name'Length * Zero_Terminated_WStrings.Expanding);
W_Value : C.winnt.WCHAR_array (
0 ..
Value'Length * Zero_Terminated_WStrings.Expanding);
begin
Zero_Terminated_WStrings.To_C (Name, W_Name (0)'Access);
Zero_Terminated_WStrings.To_C (Value, W_Value (0)'Access);
if C.winbase.SetEnvironmentVariable (
W_Name (0)'Access,
W_Value (0)'Access) =
C.windef.FALSE
then
raise Constraint_Error;
end if;
end Set;
procedure Clear (Name : String) is
W_Name : C.winnt.WCHAR_array (
0 ..
Name'Length * Zero_Terminated_WStrings.Expanding);
begin
Zero_Terminated_WStrings.To_C (Name, W_Name (0)'Access);
if C.winbase.SetEnvironmentVariable (W_Name (0)'Access, null) =
C.windef.FALSE
then
raise Constraint_Error;
end if;
end Clear;
procedure Clear is
Block : constant Address := Get_Block;
I : Cursor := First (Block);
Error : Boolean := False;
begin
while Has_Element (I) loop
declare
Item : constant C.winnt.LPCWCH :=
LPCWCH_Conv.To_Pointer (Address (I));
begin
if Item.all /=
C.winnt.WCHAR'Val (Wide_Character'Pos ('='))
then -- skip special variable
declare
Name_Length : C.size_t;
Value : C.winnt.LPCWCH;
begin
Do_Separate (Item, Name_Length, Value);
declare
Name : aliased C.winnt.WCHAR_array (0 .. Name_Length);
begin
declare
Item_All : C.winnt.WCHAR_array (0 .. Name_Length - 1);
for Item_All'Address use LPCWCH_Conv.To_Address (Item);
begin
Name (0 .. Name_Length - 1) := Item_All;
Name (Name_Length) := C.winnt.WCHAR'Val (0);
end;
if C.winbase.SetEnvironmentVariable (
Name (0)'Access,
null) =
C.windef.FALSE
then
Error := True;
exit;
end if;
end;
end;
end if;
end;
I := Next (Block, I);
end loop;
Release_Block (Block);
if Error then
raise Constraint_Error;
end if;
end Clear;
function Has_Element (Position : Cursor) return Boolean is
begin
return LPCWCH_Conv.To_Pointer (Address (Position)).all /=
C.winnt.WCHAR'Val (0);
end Has_Element;
function Name (Position : Cursor) return String is
Item : constant C.winnt.LPCWCH :=
LPCWCH_Conv.To_Pointer (Address (Position));
Name_Length : C.size_t;
Value : C.winnt.LPCWCH;
begin
Do_Separate (Item, Name_Length, Value);
return Zero_Terminated_WStrings.Value (Item, Name_Length);
end Name;
function Value (Position : Cursor) return String is
Item : constant C.winnt.LPCWCH :=
LPCWCH_Conv.To_Pointer (Address (Position));
Name_Length : C.size_t;
Value : C.winnt.LPCWCH;
begin
Do_Separate (Item, Name_Length, Value);
return Zero_Terminated_WStrings.Value (Value);
end Value;
function Get_Block return Address is
-- a trailing W for calling GetEnvironmentStringsW is necessary.
-- since kernel32.dll exports not GetEnvironmentStringsA
-- but GetEnvironmentStrings.
Result : constant C.winnt.LPWCH := C.winbase.GetEnvironmentStringsW;
begin
if Result = null then
raise Constraint_Error;
else
return LPWCH_Conv.To_Address (Result);
end if;
end Get_Block;
procedure Release_Block (Block : Address) is
Success : C.windef.WINBOOL;
begin
Success :=
C.winbase.FreeEnvironmentStrings (LPWCH_Conv.To_Pointer (Block));
pragma Check (Debug,
Check =>
Success /= C.windef.FALSE
or else Debug.Runtime_Error ("FreeEnvironmentStrings failed"));
end Release_Block;
function First (Block : Address) return Cursor is
begin
return Cursor (Block);
end First;
function Next (Block : Address; Position : Cursor) return Cursor is
pragma Unreferenced (Block);
Item_Length : constant C.size_t :=
C.string.wcslen (LPCWCH_Conv.To_Pointer (Address (Position)));
begin
return Cursor (
Address (Position)
+ (Storage_Elements.Storage_Offset (Item_Length) + 1)
* (C.winnt.WCHAR'Size / Standard'Storage_Unit));
end Next;
end System.Native_Environment_Variables;
|
src/intel/tools/tests/gen7/wait.asm | PWN-Hunter/mesa3d | 0 | 90157 | wait(1) n0<0>.xUD { align16 WE_all 1N };
|
asm/6502/tools/charset_editor/charpix_nav.asm | fcatrin/clc88 | 6 | 11558 | <filename>asm/6502/tools/charset_editor/charpix_nav.asm
.proc charpix_on_key
lda last_key
cmp #16
jeq charpix_char_select_up
cmp #17
jeq charpix_char_select_down
cmp #14
jeq charpix_char_select_left
cmp #15
jeq charpix_char_select_right
cmp #66
jeq charpix_toggle
rts
.endp
.proc charpix_char_select_left
dec charpix_char_x
spl
mva #7 charpix_char_x
jmp charpix_char_highlight
.endp
.proc charpix_char_select_right
inc charpix_char_x
lda charpix_char_x
cmp #8
sne
mva #0 charpix_char_x
jmp charpix_char_highlight
.endp
.proc charpix_char_select_up
dec charpix_char_y
spl
mva #7 charpix_char_y
jmp charpix_char_highlight
.endp
.proc charpix_char_select_down
inc charpix_char_y
lda charpix_char_y
cmp #8
sne
mva #0 charpix_char_y
jmp charpix_char_highlight
.endp
.proc charpix_char_highlight
jmp charpix_char_update
.endp
.proc charpix_char_update
mwa charpix_char_attrib_last RAM_TO_VRAM
lda RAM_TO_VRAM
ora RAM_TO_VRAM+1
beq not_reset_attrib
ldy #0
mva #$9f (RAM_TO_VRAM),y
not_reset_attrib
adb charpix_char_x #CHARPIX_POS_X screen_pos_x
adb charpix_char_y #CHARPIX_POS_Y screen_pos_y
ldx screen_pos_x
ldy screen_pos_y
jsr screen_position_attrib
mwa RAM_TO_VRAM charpix_char_attrib_last
ldy #0
mva #$23 (RAM_TO_VRAM),y
rts
.endp
.proc charpix_toggle
jsr get_char_addr
adb SRC_ADDR charpix_char_y
scc
inc SRC_ADDR+1
ldy #0
ldx charpix_char_x
lda charpix_bitmask, x
tax
and (SRC_ADDR), y
beq set_on
txa
eor #$FF
and (SRC_ADDR), y
sta (SRC_ADDR), y
jmp draw_char_editor
set_on:
txa
ora (SRC_ADDR), y
sta (SRC_ADDR), y
jmp draw_char_editor
.endp
charpix_char_x .byte 0
charpix_char_y .byte 0
charpix_char_attrib_last .word 0
charpix_bitmask .byte 128, 64, 32, 16, 8, 4, 2, 1
|
src/Web/Semantic/DL/Category/Morphism.agda | agda/agda-web-semantic | 9 | 5451 | <gh_stars>1-10
open import Data.Product using ( ∃ ; _×_ ; _,_ ; proj₁ ; proj₂ )
open import Relation.Unary using ( _∈_ )
open import Web.Semantic.DL.ABox using ( ABox )
open import Web.Semantic.DL.ABox.Model using ( _⊨a_ ; _⊨b_ ; ⊨a-resp-≲ ; ⊨b-resp-≲ )
open import Web.Semantic.DL.ABox.Interp using ( Interp ; ⌊_⌋ ; _*_ )
open import Web.Semantic.DL.ABox.Interp.Morphism using ( _≲_ ; ≲-refl )
open import Web.Semantic.DL.KB using ( _,_ )
open import Web.Semantic.DL.KB.Model using ( _⊨_ )
open import Web.Semantic.DL.Integrity using ( Initial ; _⊕_⊨_ ; extension ; ext-init ; ext-⊨ ; ext✓ ; init-≲ ; init-⊨ ; init-med ; med-≲ )
open import Web.Semantic.DL.Signature using ( Signature )
open import Web.Semantic.DL.TBox using ( TBox ; _,_ )
open import Web.Semantic.DL.TBox.Model using ( _⊨t_ )
open import Web.Semantic.DL.Category.Object using ( Object ; _,_ ; IN ; iface )
open import Web.Semantic.Util using ( _⊕_⊕_ ; inode ; enode )
module Web.Semantic.DL.Category.Morphism {Σ : Signature} {S T : TBox Σ} where
infixr 4 _,_
-- A morphism A ⇒ B is an abox F such that for every I ⊨ S , T , A
-- there is a J which is the initial extension of I satisfying (S , F),
-- and moreover J satisfies (T , B).
data _⇒_w/_ (A B : Object S T) (V : Set) : Set₁ where
_,_ : (F : ABox Σ (IN A ⊕ V ⊕ IN B)) →
(∀ I → (I ⊨ (S , T) , iface A) → (I ⊕ (S , F) ⊨ (T , iface B))) →
(A ⇒ B w/ V)
data _⇒_ (A B : Object S T) : Set₁ where
_,_ : ∀ V → (A ⇒ B w/ V) → (A ⇒ B)
BN : ∀ {A B} → (F : A ⇒ B) → Set
BN (V , F,F✓) = V
impl : ∀ {A B} → (F : A ⇒ B) → ABox Σ (IN A ⊕ BN F ⊕ IN B)
impl (V , F , F✓) = F
impl✓ : ∀ {A B} → (F : A ⇒ B) → ∀ I → (I ⊨ (S , T) , iface A) → (I ⊕ (S , impl F) ⊨ (T , iface B))
impl✓ (V , F , F✓) = F✓
apply : ∀ {A B} (F : A ⇒ B) I → (I ⊨ (S , T) , iface A) →
Interp Σ (IN A ⊕ BN F ⊕ IN B)
apply F I I⊨STA = extension (impl✓ F I I⊨STA)
apply-init : ∀ {A B} (F : A ⇒ B) I I⊨STA →
(apply F I I⊨STA ∈ Initial I (S , impl F))
apply-init F I I⊨STA = ext-init (impl✓ F I I⊨STA)
apply-⊨ : ∀ {A B} (F : A ⇒ B) I I⊨STA →
(enode * (apply F I I⊨STA) ⊨ (T , iface B))
apply-⊨ F I I⊨STA = ext-⊨ (impl✓ F I I⊨STA)
apply-≲ : ∀ {A B} (F : A ⇒ B) I I⊨STA → (I ⊨a impl F) →
(apply F (inode * I) I⊨STA ≲ I)
apply-≲ F I ((I⊨S , I⊨T) , I⊨A) I⊨F =
med-≲ (init-med
(apply-init F (inode * I) ((I⊨S , I⊨T) , I⊨A))
I
(≲-refl (inode * I))
(I⊨S , I⊨F))
apply✓ : ∀ {A B} (F : A ⇒ B) I I⊨STA →
(enode * apply F I I⊨STA ⊨ (S , T) , iface B)
apply✓ F I I⊨STA = ext✓ (impl✓ F I I⊨STA)
-- Morphisms F and G are equivalent whenever
-- in any interpretation I ⊨ S,T
-- we have I ⊨ F iff I ⊨ G.
infix 2 _⊑_ _⊑′_ _≣_
_⊑_ : ∀ {A B : Object S T} → (A ⇒ B) → (A ⇒ B) → Set₁
_⊑_ {A} F G =
∀ I → (inode * I ⊨ (S , T) , iface A) → (I ⊨a impl F) → (I ⊨b impl G)
data _≣_ {A B : Object S T} (F G : A ⇒ B) : Set₁ where
_,_ : (F ⊑ G) → (G ⊑ F) → (F ≣ G)
-- An alternative characterization, which may be easier
-- to work with.
_⊑′_ : ∀ {A B : Object S T} → (A ⇒ B) → (A ⇒ B) → Set₁
F ⊑′ G = ∀ I I⊨STA → (apply F I I⊨STA) ⊨b (impl G)
⊑′-impl-⊑ : ∀ {A B : Object S T} → (F G : A ⇒ B) → (F ⊑′ G) → (F ⊑ G)
⊑′-impl-⊑ F G F⊑′G I I⊨STA I⊨F =
⊨b-resp-≲ (apply-≲ F I I⊨STA I⊨F) (impl G) (F⊑′G (inode * I) I⊨STA)
⊑-impl-⊑′ : ∀ {A B : Object S T} → (F G : A ⇒ B) → (F ⊑ G) → (F ⊑′ G)
⊑-impl-⊑′ {A} {B} F G F⊑G I (I⊨ST , I⊨A) = J⊨G where
J : Interp Σ (IN A ⊕ BN F ⊕ IN B)
J = apply F I (I⊨ST , I⊨A)
J⊨S : ⌊ J ⌋ ⊨t S
J⊨S = proj₁ (init-⊨ (apply-init F I (I⊨ST , I⊨A)))
J⊨T : ⌊ J ⌋ ⊨t T
J⊨T = proj₁ (apply-⊨ F I (I⊨ST , I⊨A))
J⊨A : inode * J ⊨a iface A
J⊨A = ⊨a-resp-≲ (init-≲ (apply-init F I (I⊨ST , I⊨A))) (iface A) I⊨A
J⊨F : J ⊨a impl F
J⊨F = proj₂ (init-⊨ (apply-init F I (I⊨ST , I⊨A)))
J⊨G : J ⊨b impl G
J⊨G = F⊑G J ((J⊨S , J⊨T) , J⊨A) J⊨F
|
Transynther/x86/_processed/AVXALIGN/_st_zr_un_/i7-7700_9_0xca_notsx.log_21829_547.asm | ljhsiun2/medusa | 9 | 179692 | <filename>Transynther/x86/_processed/AVXALIGN/_st_zr_un_/i7-7700_9_0xca_notsx.log_21829_547.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x6e82, %rsi
lea addresses_UC_ht+0x1559a, %rdi
nop
nop
nop
nop
nop
sub $60020, %r13
mov $39, %rcx
rep movsl
nop
nop
nop
dec %rsi
lea addresses_D_ht+0x19b82, %rbp
nop
nop
nop
nop
xor %r14, %r14
movw $0x6162, (%rbp)
nop
sub $56306, %r13
lea addresses_WC_ht+0x1e872, %rdi
and $8650, %rsi
movw $0x6162, (%rdi)
nop
nop
and %r13, %r13
lea addresses_WC_ht+0x1c656, %rcx
xor $30634, %rdi
movw $0x6162, (%rcx)
nop
nop
nop
dec %rsi
lea addresses_normal_ht+0x7ac2, %rsi
lea addresses_WC_ht+0x172fd, %rdi
nop
nop
nop
nop
inc %rbp
mov $87, %rcx
rep movsw
nop
nop
and %rbp, %rbp
lea addresses_WC_ht+0x18102, %rsi
lea addresses_normal_ht+0x8ac2, %rdi
clflush (%rdi)
nop
nop
nop
nop
and $50096, %r9
mov $14, %rcx
rep movsb
nop
nop
nop
nop
nop
and %r14, %r14
lea addresses_normal_ht+0x4082, %rcx
nop
nop
nop
nop
nop
sub $17717, %rsi
mov (%rcx), %r13d
nop
dec %r9
lea addresses_WC_ht+0x24a2, %rbp
nop
nop
nop
nop
xor %rsi, %rsi
movb $0x61, (%rbp)
nop
nop
cmp %rdx, %rdx
lea addresses_WT_ht+0x16f11, %rdx
nop
cmp $10092, %rsi
movb $0x61, (%rdx)
nop
nop
nop
cmp $63842, %r14
lea addresses_WT_ht+0x10142, %r13
nop
nop
nop
nop
nop
cmp %rdi, %rdi
movb (%r13), %r14b
nop
nop
nop
nop
nop
sub %rdx, %rdx
lea addresses_WT_ht+0x17802, %rdi
nop
nop
nop
nop
inc %rcx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
movups %xmm7, (%rdi)
nop
inc %rbp
lea addresses_WC_ht+0x4002, %rsi
xor %rdi, %rdi
mov (%rsi), %ecx
nop
nop
xor $2360, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
// Load
lea addresses_WC+0x1c802, %rbp
nop
cmp $55089, %rcx
mov (%rbp), %esi
nop
and $47162, %rcx
// Store
lea addresses_PSE+0x802, %rcx
clflush (%rcx)
nop
nop
nop
nop
xor $46835, %rdi
mov $0x5152535455565758, %r15
movq %r15, %xmm3
movups %xmm3, (%rcx)
nop
nop
nop
nop
sub $17829, %rdx
// Load
lea addresses_A+0x10022, %rdx
nop
nop
and $1580, %r15
mov (%rdx), %r14
nop
nop
add %rcx, %rcx
// Load
lea addresses_RW+0xed72, %rbp
nop
nop
and %r14, %r14
movb (%rbp), %r15b
nop
nop
sub %r15, %r15
// Faulty Load
lea addresses_WC+0x1c802, %r14
nop
nop
nop
nop
and %rdx, %rdx
movaps (%r14), %xmm7
vpextrq $0, %xmm7, %rsi
lea oracles, %rbp
and $0xff, %rsi
shlq $12, %rsi
mov (%rbp,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'src': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'6d': 12, '00': 288, '58': 21529}
00 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 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 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 00 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 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 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 00 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 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 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 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 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
*/
|
Task/Array-concatenation/AppleScript/array-concatenation-2.applescript | LaudateCorpus1/RosettaCodeData | 1 | 3104 | on run
concat([["alpha", "beta", "gamma"], ¬
["delta", "epsilon", "zeta"], ¬
["eta", "theta", "iota"]])
end run
-- concat :: [[a]] -> [a]
on concat(xxs)
set lst to {}
repeat with xs in xxs
set lst to lst & xs
end repeat
return lst
end concat
|
Task/List-comprehensions/Ada/list-comprehensions.ada | mullikine/RosettaCodeData | 1 | 27741 | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers.Doubly_Linked_Lists;
procedure Pythagore_Set is
type Triangles is array (1 .. 3) of Positive;
package Triangle_Lists is new Ada.Containers.Doubly_Linked_Lists (
Triangles);
use Triangle_Lists;
function Find_List (Upper_Bound : Positive) return List is
L : List := Empty_List;
begin
for A in 1 .. Upper_Bound loop
for B in A + 1 .. Upper_Bound loop
for C in B + 1 .. Upper_Bound loop
if ((A * A + B * B) = C * C) then
Append (L, (A, B, C));
end if;
end loop;
end loop;
end loop;
return L;
end Find_List;
Triangle_List : List;
C : Cursor;
T : Triangles;
begin
Triangle_List := Find_List (Upper_Bound => 20);
C := First (Triangle_List);
while Has_Element (C) loop
T := Element (C);
Put
("(" &
Integer'Image (T (1)) &
Integer'Image (T (2)) &
Integer'Image (T (3)) &
") ");
Next (C);
end loop;
end Pythagore_Set;
|
programs/oeis/186/A186348.asm | karttu/loda | 0 | 242104 | <filename>programs/oeis/186/A186348.asm<gh_stars>0
; A186348: Adjusted joint rank sequence of (f(i)) and (g(j)) with f(i) after g(j) when f(i)=g(j), where f(i)=8i and g(j)=j^2. Complement of A186349.
; 3,6,7,9,11,12,14,16,17,18,20,21,23,24,25,27,28,30,31,32,33,35,36,37,39,40,41,42,44,45,46,48,49,50,51,52,54,55,56,57,59,60,61,62,63,65,66,67,68,70,71,72,73,74,75,77,78,79,80,81,83,84,85,86,87,88
mov $3,$0
mul $0,2
add $0,1
mul $0,2
add $0,2
mul $0,2
lpb $0,1
sub $0,1
add $2,1
sub $0,$2
trn $0,$2
lpe
mov $1,$2
lpb $3,1
add $1,1
sub $3,1
lpe
add $1,1
|
bb-runtimes/runtimes/ravenscar-sfp-stm32g474/gnarl/s-bbinte.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 24949 | <filename>bb-runtimes/runtimes/ravenscar-sfp-stm32g474/gnarl/s-bbinte.ads
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B B . I N T E R R U P T S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2004 The European Space Agency --
-- Copyright (C) 2003-2021, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL 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. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
-- The port of GNARL to bare board targets was initially developed by the --
-- Real-Time Systems Group at the Technical University of Madrid. --
-- --
------------------------------------------------------------------------------
-- Package in charge of implementing the basic routines for interrupt
-- management.
pragma Restrictions (No_Elaboration_Code);
with System;
with System.BB.Parameters;
package System.BB.Interrupts is
pragma Preelaborate;
subtype Interrupt_ID is System.BB.Parameters.Interrupt_Range;
-- Interrupt identifiers.
subtype Any_Interrupt_ID is Integer
range Interrupt_ID'First .. Interrupt_ID'Last + 1;
No_Interrupt : constant Any_Interrupt_ID := Any_Interrupt_ID'Last;
-- Special value indicating no interrupt
type Interrupt_Handler is access procedure (Id : Interrupt_ID);
-- Prototype of procedures used as low level handlers
procedure Initialize_Interrupts;
-- Initialize table containing the pointers to the different interrupt
-- stacks. Should be called before any other subprograms in this package.
procedure Interrupt_Wrapper (Id : Interrupt_ID);
-- This wrapper procedure is in charge of setting the appropriate
-- software priorities before calling the user-defined handler. It is
-- called directly by the Board_Support.
procedure Attach_Handler
(Handler : not null Interrupt_Handler;
Id : Interrupt_ID;
Prio : Interrupt_Priority);
pragma Inline (Attach_Handler);
-- Attach the procedure Handler as handler of the interrupt Id. Prio is
-- the priority of the associated protected object. This priority could be
-- used to program the hardware priority of the interrupt.
function Current_Interrupt return Any_Interrupt_ID;
-- Function that returns the hardware interrupt currently being handled on
-- the current CPU (if any). If no hardware interrupt is being handled the
-- returned value is No_Interrupt.
function Within_Interrupt_Stack
(Stack_Address : System.Address) return Boolean;
pragma Inline (Within_Interrupt_Stack);
-- Function that tells whether the Address passed as argument belongs to
-- the interrupt stack that is currently being used on current CPU (if
-- any). It returns True if Stack_Address is within the range of the
-- interrupt stack being used. False in case Stack_Address is not within
-- the interrupt stack (or no interrupt is being handled).
end System.BB.Interrupts;
|
programs/oeis/036/A036579.asm | neoneye/loda | 22 | 174420 | <reponame>neoneye/loda
; A036579: Ternary Thue-Morse sequence: closed under a->abc, b->ac, c->b.
; 1,2,0,1,0,2,1,2,0,2,1,0,1,2,0,1,0,2,1,0,1,2,0,2,1,2,0,1,0,2,1,2,0,2,1,0,1,2,0,2,1,2,0,1,0,2,1,0,1,2,0,1,0,2,1,2,0,2,1,0,1,2,0,1,0,2,1,0,1,2,0,2,1,2,0,1,0,2,1,0,1,2,0,1,0,2,1,2,0,2,1,0,1,2,0,2,1,2,0
seq $0,36577 ; Ternary Thue-Morse sequence: closed under a->abc, b->ac, c->b.
mul $0,2
mod $0,3
|
programs/oeis/065/A065168.asm | karttu/loda | 0 | 13874 | ; A065168: Permutation t->t-1 of Z, folded to N.
; 3,1,5,2,7,4,9,6,11,8,13,10,15,12,17,14,19,16,21,18,23,20,25,22,27,24,29,26,31,28,33,30,35,32,37,34,39,36,41,38,43,40,45,42,47,44,49,46,51,48,53,50,55,52,57,54,59,56,61,58,63,60,65,62,67,64,69,66,71,68,73,70
add $0,12
mov $2,-1
pow $2,$0
sub $2,6
mov $3,-3
lpb $0,1
div $3,2
div $0,$3
add $0,1
mul $0,2
mov $3,$0
trn $0,1
mov $1,2
mul $2,4
add $1,$2
trn $1,$3
lpe
div $1,2
add $1,1
|
programs/oeis/048/A048487.asm | karttu/loda | 1 | 161600 | ; A048487: a(n) = T(4,n), array T given by A048483.
; 1,6,16,36,76,156,316,636,1276,2556,5116,10236,20476,40956,81916,163836,327676,655356,1310716,2621436,5242876,10485756,20971516,41943036,83886076,167772156,335544316,671088636,1342177276,2684354556,5368709116,10737418236,21474836476,42949672956,85899345916,171798691836,343597383676,687194767356,1374389534716,2748779069436,5497558138876,10995116277756,21990232555516,43980465111036,87960930222076,175921860444156,351843720888316,703687441776636,1407374883553276,2814749767106556,5629499534213116
mov $1,2
pow $1,$0
mul $1,5
sub $1,4
|
regtests/asf-converters-tests.adb | jquorning/ada-asf | 12 | 18454 | -----------------------------------------------------------------------
-- Faces Context Tests - Unit tests for ASF.Contexts.Faces
-- Copyright (C) 2010, 2011, 2012, 2013, 2015, 2018, 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.Calendar;
with Ada.Calendar.Formatting;
with Ada.Unchecked_Deallocation;
with Util.Beans.Objects.Time;
with Util.Test_Caller;
with Util.Dates;
with ASF.Tests;
with ASF.Components.Html.Text;
with ASF.Converters.Dates;
with ASF.Converters.Numbers;
package body ASF.Converters.Tests is
use Util.Tests;
use ASF.Converters.Dates;
package Caller is new Util.Test_Caller (Test, "Converters");
procedure Test_Date_Conversion (T : in out Test;
Date_Style : in Dates.Style_Type;
Time_Style : in Dates.Style_Type;
Expect : in String);
procedure Test_Conversion_Error (T : in out Test;
Value : in String);
procedure Test_Number_Conversion (T : in out Test;
Picture : in String;
Value : in Float;
Expect : in String);
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
-- To document what is tested, register the test methods for each
-- operation that is tested.
Caller.Add_Test (Suite, "Test ASF.Converters.Dates.To_String (Date, Short)",
Test_Date_Short_Converter'Access);
Caller.Add_Test (Suite, "Test ASF.Converters.Dates.To_String (Date, Medium)",
Test_Date_Medium_Converter'Access);
Caller.Add_Test (Suite, "Test ASF.Converters.Dates.To_String (Date, Long)",
Test_Date_Long_Converter'Access);
Caller.Add_Test (Suite, "Test ASF.Converters.Dates.To_String (Date, Full)",
Test_Date_Full_Converter'Access);
Caller.Add_Test (Suite, "Test ASF.Converters.Dates.To_String (Time, Short)",
Test_Time_Short_Converter'Access);
Caller.Add_Test (Suite, "Test ASF.Converters.Dates.To_String (Time, Medium)",
Test_Time_Medium_Converter'Access);
Caller.Add_Test (Suite, "Test ASF.Converters.Dates.To_String (Time, Long)",
Test_Time_Long_Converter'Access);
Caller.Add_Test (Suite, "Test ASF.Converters.Dates.To_Object (Error)",
Test_Date_Converter_Error'Access);
Caller.Add_Test (Suite, "Test ASF.Converters.Numbers.To_String (Float)",
Test_Number_Converter'Access);
end Add_Tests;
-- ------------------------------
-- Test getting an attribute from the faces context.
-- ------------------------------
procedure Test_Date_Conversion (T : in out Test;
Date_Style : in Dates.Style_Type;
Time_Style : in Dates.Style_Type;
Expect : in String) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => ASF.Converters.Dates.Date_Converter'Class,
Name => ASF.Converters.Dates.Date_Converter_Access);
Ctx : aliased ASF.Contexts.Faces.Faces_Context;
UI : ASF.Components.Html.Text.UIOutput;
C : ASF.Converters.Dates.Date_Converter_Access;
D : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (2011, 11, 19,
3, 4, 5);
begin
T.Setup (Ctx);
ASF.Contexts.Faces.Set_Current (Ctx'Unchecked_Access, ASF.Tests.Get_Application.all'Access);
if Date_Style = Dates.DEFAULT then
C := ASF.Converters.Dates.Create_Date_Converter (Date => Date_Style,
Time => Time_Style,
Format => ASF.Converters.Dates.TIME,
Locale => "en",
Pattern => "");
elsif Time_Style = Dates.DEFAULT then
C := ASF.Converters.Dates.Create_Date_Converter (Date => Date_Style,
Time => Time_Style,
Format => ASF.Converters.Dates.DATE,
Locale => "en",
Pattern => "");
else
C := ASF.Converters.Dates.Create_Date_Converter (Date => Date_Style,
Time => Time_Style,
Format => ASF.Converters.Dates.BOTH,
Locale => "en",
Pattern => "");
end if;
UI.Set_Converter (C.all'Access);
declare
R : constant String := C.To_String (Ctx, UI, Util.Beans.Objects.Time.To_Object (D));
V : Util.Beans.Objects.Object;
S : Util.Dates.Date_Record;
begin
Util.Tests.Assert_Equals (T, Expect, R, "Invalid date conversion");
V := C.To_Object (Ctx, UI, R);
Util.Dates.Split (Into => S, Date => Util.Beans.Objects.Time.To_Time (V));
if Date_Style /= Dates.DEFAULT then
T.Assert (Util.Dates.Is_Same_Day (Util.Beans.Objects.Time.To_Time (V), D),
"Invalid date");
else
Util.Tests.Assert_Equals (T, 3, Natural (S.Hour),
"Invalid date conversion: hour");
Util.Tests.Assert_Equals (T, 4, Natural (S.Minute),
"Invalid date conversion: minute");
if Time_Style = Dates.LONG then
Util.Tests.Assert_Equals (T, 5, Natural (S.Second),
"Invalid date conversion: second");
end if;
end if;
exception
when others =>
T.Fail ("Exception when converting date string: " & R);
end;
Free (C);
end Test_Date_Conversion;
-- ------------------------------
-- Test the date short converter.
-- ------------------------------
procedure Test_Date_Short_Converter (T : in out Test) is
begin
Test_Date_Conversion (T, ASF.Converters.Dates.SHORT, ASF.Converters.Dates.DEFAULT,
"19/11/2011");
end Test_Date_Short_Converter;
-- ------------------------------
-- Test the date medium converter.
-- ------------------------------
procedure Test_Date_Medium_Converter (T : in out Test) is
begin
Test_Date_Conversion (T, ASF.Converters.Dates.MEDIUM, ASF.Converters.Dates.DEFAULT,
"Nov 19, 2011");
end Test_Date_Medium_Converter;
-- ------------------------------
-- Test the date long converter.
-- ------------------------------
procedure Test_Date_Long_Converter (T : in out Test) is
begin
Test_Date_Conversion (T, ASF.Converters.Dates.LONG, ASF.Converters.Dates.DEFAULT,
"November 19, 2011");
end Test_Date_Long_Converter;
-- ------------------------------
-- Test the date full converter.
-- ------------------------------
procedure Test_Date_Full_Converter (T : in out Test) is
begin
Test_Date_Conversion (T, ASF.Converters.Dates.FULL, ASF.Converters.Dates.DEFAULT,
"Saturday, November 19, 2011");
end Test_Date_Full_Converter;
-- ------------------------------
-- Test the time short converter.
-- ------------------------------
procedure Test_Time_Short_Converter (T : in out Test) is
begin
Test_Date_Conversion (T, ASF.Converters.Dates.DEFAULT, ASF.Converters.Dates.SHORT,
"03:04");
end Test_Time_Short_Converter;
-- ------------------------------
-- Test the time short converter.
-- ------------------------------
procedure Test_Time_Medium_Converter (T : in out Test) is
begin
Test_Date_Conversion (T, ASF.Converters.Dates.DEFAULT, ASF.Converters.Dates.MEDIUM,
"03:04");
end Test_Time_Medium_Converter;
-- ------------------------------
-- Test the time long converter.
-- ------------------------------
procedure Test_Time_Long_Converter (T : in out Test) is
begin
Test_Date_Conversion (T, ASF.Converters.Dates.DEFAULT, ASF.Converters.Dates.LONG,
"03:04:05");
end Test_Time_Long_Converter;
-- ------------------------------
-- Test getting an attribute from the faces context.
-- ------------------------------
procedure Test_Conversion_Error (T : in out Test;
Value : in String) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => ASF.Converters.Dates.Date_Converter'Class,
Name => ASF.Converters.Dates.Date_Converter_Access);
Ctx : aliased ASF.Contexts.Faces.Faces_Context;
UI : ASF.Components.Html.Text.UIOutput;
C : ASF.Converters.Dates.Date_Converter_Access;
begin
T.Setup (Ctx);
ASF.Contexts.Faces.Set_Current (Ctx'Unchecked_Access, ASF.Tests.Get_Application.all'Access);
C := ASF.Converters.Dates.Create_Date_Converter (Date => ASF.Converters.Dates.LONG,
Time => ASF.Converters.Dates.LONG,
Format => ASF.Converters.Dates.BOTH,
Locale => "en",
Pattern => "");
UI.Set_Converter (C.all'Access);
declare
V : Util.Beans.Objects.Object;
pragma Unreferenced (V);
begin
V := C.To_Object (Ctx, UI, Value);
T.Fail ("No exception raised for " & Value);
exception
when Invalid_Conversion =>
null;
end;
Free (C);
end Test_Conversion_Error;
-- ------------------------------
-- Test converter reporting conversion errors when converting a string back to a date.
-- ------------------------------
procedure Test_Date_Converter_Error (T : in out Test) is
begin
Test_Conversion_Error (T, "some invalid date");
end Test_Date_Converter_Error;
-- Test number converter.
procedure Test_Number_Conversion (T : in out Test;
Picture : in String;
Value : in Float;
Expect : in String) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => ASF.Converters.Numbers.Number_Converter'Class,
Name => ASF.Converters.Numbers.Number_Converter_Access);
Ctx : aliased ASF.Contexts.Faces.Faces_Context;
UI : ASF.Components.Html.Text.UIOutput;
C : ASF.Converters.Numbers.Number_Converter_Access;
D : constant Util.Beans.Objects.Object := Util.Beans.Objects.To_Object (Value);
begin
T.Setup (Ctx);
ASF.Contexts.Faces.Set_Current (Ctx'Unchecked_Access, ASF.Tests.Get_Application.all'Access);
C := new ASF.Converters.Numbers.Number_Converter;
UI.Set_Converter (C.all'Access);
C.Set_Picture (Picture);
declare
R : constant String := C.To_String (Ctx, UI, D);
begin
Util.Tests.Assert_Equals (T, Expect, R,
"Invalid number conversion with picture " & Picture);
end;
Free (C);
end Test_Number_Conversion;
-- ------------------------------
-- Test converter reporting conversion errors when converting a string back to a date.
-- ------------------------------
procedure Test_Number_Converter (T : in out Test) is
begin
Test_Number_Conversion (T, "Z9.99", 12.345323, "12.35");
Test_Number_Conversion (T, "Z9.99", 2.334323, " 2.33");
Test_Number_Conversion (T, "<$Z_ZZ9.99>", 2.334323, " € 2.33 ");
Test_Number_Conversion (T, "Z_ZZ9.99B$", 2.334323, " 2.33 €");
Test_Number_Conversion (T, "Z_ZZ9.99B$", 2342.334323, "2,342.33 €");
-- Test_Number_Conversion (T, "Z_ZZ9.99B$", 21342.334323, "2,342.33 €");
end Test_Number_Converter;
end ASF.Converters.Tests;
|
llvm-gcc-4.2-2.9/gcc/ada/exp_ch4.ads | vidkidz/crossbridge | 1 | 18848 | <filename>llvm-gcc-4.2-2.9/gcc/ada/exp_ch4.ads
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ C H 4 --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Expand routines for chapter 4 constructs
with Types; use Types;
package Exp_Ch4 is
procedure Expand_N_Allocator (N : Node_Id);
procedure Expand_N_And_Then (N : Node_Id);
procedure Expand_N_Conditional_Expression (N : Node_Id);
procedure Expand_N_In (N : Node_Id);
procedure Expand_N_Explicit_Dereference (N : Node_Id);
procedure Expand_N_Indexed_Component (N : Node_Id);
procedure Expand_N_Not_In (N : Node_Id);
procedure Expand_N_Null (N : Node_Id);
procedure Expand_N_Op_Abs (N : Node_Id);
procedure Expand_N_Op_Add (N : Node_Id);
procedure Expand_N_Op_And (N : Node_Id);
procedure Expand_N_Op_Concat (N : Node_Id);
procedure Expand_N_Op_Divide (N : Node_Id);
procedure Expand_N_Op_Expon (N : Node_Id);
procedure Expand_N_Op_Eq (N : Node_Id);
procedure Expand_N_Op_Ge (N : Node_Id);
procedure Expand_N_Op_Gt (N : Node_Id);
procedure Expand_N_Op_Le (N : Node_Id);
procedure Expand_N_Op_Lt (N : Node_Id);
procedure Expand_N_Op_Minus (N : Node_Id);
procedure Expand_N_Op_Mod (N : Node_Id);
procedure Expand_N_Op_Multiply (N : Node_Id);
procedure Expand_N_Op_Ne (N : Node_Id);
procedure Expand_N_Op_Not (N : Node_Id);
procedure Expand_N_Op_Or (N : Node_Id);
procedure Expand_N_Op_Plus (N : Node_Id);
procedure Expand_N_Op_Rem (N : Node_Id);
procedure Expand_N_Op_Rotate_Left (N : Node_Id);
procedure Expand_N_Op_Rotate_Right (N : Node_Id);
procedure Expand_N_Op_Shift_Left (N : Node_Id);
procedure Expand_N_Op_Shift_Right (N : Node_Id);
procedure Expand_N_Op_Shift_Right_Arithmetic (N : Node_Id);
procedure Expand_N_Op_Subtract (N : Node_Id);
procedure Expand_N_Op_Xor (N : Node_Id);
procedure Expand_N_Or_Else (N : Node_Id);
procedure Expand_N_Qualified_Expression (N : Node_Id);
procedure Expand_N_Selected_Component (N : Node_Id);
procedure Expand_N_Slice (N : Node_Id);
procedure Expand_N_Type_Conversion (N : Node_Id);
procedure Expand_N_Unchecked_Expression (N : Node_Id);
procedure Expand_N_Unchecked_Type_Conversion (N : Node_Id);
function Expand_Record_Equality
(Nod : Node_Id;
Typ : Entity_Id;
Lhs : Node_Id;
Rhs : Node_Id;
Bodies : List_Id)
return Node_Id;
-- Expand a record equality into an expression that compares the fields
-- individually to yield the required Boolean result. Loc is the
-- location for the generated nodes. Typ is the type of the record, and
-- Lhs, Rhs are the record expressions to be compared, these
-- expressions need not to be analyzed but have to be side-effect free.
-- Bodies is a list on which to attach bodies of local functions that
-- are created in the process. This is the responsability of the caller
-- to insert those bodies at the right place. Nod provdies the Sloc
-- value for generated code.
end Exp_Ch4;
|
src/higher.agda | pcapriotti/agda-base | 20 | 1646 | {-# OPTIONS --without-K #-}
module higher where
open import higher.circle public
|
data/baseStats_original/aerodactyl.asm | adhi-thirumala/EvoYellow | 16 | 83097 | db DEX_AERODACTYL ; pokedex id
db 80 ; base hp
db 105 ; base attack
db 65 ; base defense
db 130 ; base speed
db 60 ; base special
db ROCK ; species type 1
db FLYING ; species type 2
db 45 ; catch rate
db 202 ; base exp yield
INCBIN "pic/ymon/aerodactyl.pic",0,1 ; 77, sprite dimensions
dw AerodactylPicFront
dw AerodactylPicBack
; attacks known at lvl 0
db WING_ATTACK
db AGILITY
db 0
db 0
db 5 ; growth rate
; learnset
tmlearn 2,4,6
tmlearn 9,10,15
tmlearn 20,23
tmlearn 31,32
tmlearn 33,34,38,39
tmlearn 43,44
tmlearn 50,52
db BANK(AerodactylPicFront)
|
src/dds-request_reply-replier2.adb | alexcamposruiz/dds-requestreply | 0 | 8901 | with DDS.DataReader;
with Dds;
with DDS.Request_Reply.Connext_C_Replier;
with DDS.Request_Reply.Connext_C_Entity_Params;
with Ada.Unchecked_Deallocation;
with DDS.Request_Reply.Connext_C_Untyped_Impl;
with DDS.Request_Reply.Untypedcommon;
package body DDS.Request_Reply.Replier is
use DDS.Request_Reply;
use Connext_C_Replier;
use Connext_C_Entity_Params;
use connext_c_untyped_impl;
use Untypedcommon;
-- void RTI_Connext_Replier_on_data_available(
-- void* listener_data, DDS_DataReader* reader)
-- {
-- RTI_Connext_Replier* self = (RTI_Connext_Replier*) listener_data;
--
-- DDSLog_testPrecondition(self != NULL, return)
-- DDSLog_testPrecondition(self->listener.on_request_available != NULL, return)
--
-- self->listener.on_request_available(&self->listener, self);
-- }
procedure RTI_Connext_Replier_On_Data_Available (Self : RTI_Connext_Replier_Access;
Reader : DDS.DataReader.Ref_Access) is
begin
Self.Listener.On_Request_Available (Self);
end;
-- DDS_ReturnCode_t RTI_Connext_ReplierParams_toEntityParams(
-- const RTI_Connext_ReplierParams* self, RTI_Connext_EntityParams* toParams)
-- {
--
-- DDSLog_testPrecondition(self == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
-- DDSLog_testPrecondition(toParams == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
-- toParams->participant = self->participant;
-- toParams->datareader_qos = self->datareader_qos;
-- toParams->datawriter_qos = self->datawriter_qos;
-- toParams->publisher = self->publisher;
-- toParams->qos_library_name = self->qos_library_name;
-- toParams->qos_profile_name = self->qos_profile_name;
-- toParams->reply_topic_name = self->reply_topic_name;
-- toParams->request_topic_name = self->request_topic_name;
-- toParams->service_name = self->service_name;
-- toParams->subscriber = self->subscriber;
--
-- return DDS_RETCODE_OK;
-- }
procedure RTI_Connext_ReplierParams_ToEntityParams (Self : RTI_Connext_ReplierParams;
ToParams : out RTI_Connext_EntityParams) is
begin
ToParams.Participant := Self.Participant;
Copy (ToParams.Datareader_Qos, Self.Datareader_Qos);
Copy (ToParams.Datawriter_Qos, Self.Datawriter_Qos);
ToParams.Publisher := Self.Publisher;
Copy (ToParams.Qos_Library_Name , Self.Qos_Library_Name);
Copy (ToParams.Qos_Profile_Name , Self.Qos_Profile_Name);
Copy (ToParams.Reply_Topic_Name, Self.Reply_Topic_Name);
Copy (ToParams.Request_Topic_Name, Self.Request_Topic_Name);
Copy (ToParams.Service_Name, Self.Service_Name);
ToParams.Subscriber := Self.Subscriber;
end;
-- DDS_ReturnCode_t RTI_Connext_Replier_delete(RTI_Connext_Replier * self)
-- {
-- DDS_ReturnCode_t retcode = DDS_RETCODE_OK;
--
-- if(self == NULL) {
-- DDSLog_exception(&DDS_LOG_BAD_PARAMETER_s,
-- "self");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
--
-- if (self->_impl != NULL) {
-- retcode = RTI_Connext_EntityUntypedImpl_delete(self->_impl);
-- if(retcode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Failure deleting impl");
-- }
-- }
--
-- RTIOsapiHeap_free(self);
--
-- return retcode;
-- }
procedure RTI_Connext_Replier_Delete (Self : in out RTI_Connext_Replier_Access) is
procedure Free is new Ada.Unchecked_Deallocation (RTI_Connext_Replier, RTI_Connext_Replier_Access);
begin
Free (Self);
end;
-- DDS_ReturnCode_t RTI_Connext_Replier_wait_for_requests(
-- RTI_Connext_Replier* self,
-- int min_count,
-- const struct DDS_Duration_t* max_wait)
-- {
-- DDS_ReturnCode_t retcode = DDS_RETCODE_OK;
--
--
--
-- retcode = RTI_Connext_EntityUntypedImpl_wait_for_any_sample(
-- self->_impl, max_wait, min_count);
--
-- if(retcode != DDS_RETCODE_OK && retcode != DDS_RETCODE_TIMEOUT) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "wait for samples");
-- }
-- return retcode;
-- }
procedure RTI_Connext_Replier_Wait_For_Requests (Self : not null access RTI_Connext_Replier;
Min_Count : DDS.Integer;
Max_Wait : DDS.Duration_T) is
Dummy_ret : DDS.ReturnCode_T;
begin
Dummy_ret := RTI_Connext_EntityUntypedImpl_Wait_For_Any_Sample (RTI_Connext_EntityUntypedImpl (Self.all)'Access, Max_Wait => Max_Wait, Min_Sample_Count => Min_Count);
end;
end DDS.Request_Reply.Replier;
|
fat.asm | maikmerten/tinyload | 5 | 161371 | <reponame>maikmerten/tinyload<gh_stars>1-10
BUFFERPAGE = 2 ; pages 2 and 3 serve as buffer für 512-bytes sectors
BUFFERBASE = BUFFERPAGE * 256 ; absolute starting address of buffer
LOADPAGE = 8 ; load files into memory starting with this page
LASTLOADPAGE = 223 ; last page to load into
;; Memory positions for FAT layout information.
;; Many variables here could fit in less than 4 bytes.
;; However, this makes 32-bit math much easier.
BYTESPERSECTOR = $0000
SECTORSPERCLUSTER = BYTESPERSECTOR + 4
RESERVEDSECTORS = SECTORSPERCLUSTER + 4
FATCOPIES = RESERVEDSECTORS + 4
ROOTENTRIES = FATCOPIES + 4
SECTORSPERFAT = ROOTENTRIES + 4
ROOTSTART = SECTORSPERFAT + 4
ROOTSIZE = ROOTSTART + 4
DATASTART = ROOTSIZE + 4
POSITION = DATASTART + 4
CURRENTCLUSTER = POSITION + 4
OFFSET = CURRENTCLUSTER + 4
CURRENTPAGE = OFFSET + 4
;;
;; read basic information from FAT boot block
;; and do some basic computations regarding the fs layout
;;
.proc fat_init
jsr fat_buffer_sector
;; sectors per cluster
lda BUFFERBASE + 13
sta SECTORSPERCLUSTER
;; reserved sectors
lda BUFFERBASE + 14
sta RESERVEDSECTORS
;; number of FAT copies
lda BUFFERBASE + 16
sta FATCOPIES
;; determine bytes per sector
lda BUFFERBASE + 11
sta BYTESPERSECTOR
lda BUFFERBASE + 12
sta BYTESPERSECTOR+1
;; number of root directory entries
lda BUFFERBASE + 17
sta ROOTENTRIES
lda BUFFERBASE + 18
sta ROOTENTRIES+1
;; sectors per FAT
lda BUFFERBASE + 22
sta SECTORSPERFAT
lda BUFFERBASE + 23
sta SECTORSPERFAT+1
;; using put_address_lo for setting up math pointers
;; this works as all our variables and constants are in
;; page 0
;; compute position of root directory
;mul32 SECTORSPERFAT, FATCOPIES, ROOTSTART
put_address_lo SECTORSPERFAT, MPTR1
put_address_lo FATCOPIES, MPTR2
put_address_lo ROOTSTART, MPTR3
jsr math_mul32
;add32 ROOTSTART, RESERVEDSECTORS, ROOTSTART
put_address_lo ROOTSTART, MPTR1
put_address_lo RESERVEDSECTORS, MPTR2
jsr math_add32
;; compute size of root directory
;mul32 ROOTENTRIES, CONST32_32, ROOTSIZE
put_address_lo ROOTENTRIES, MPTR1
put_address_lo CONST32_32, MPTR2
put_address_lo ROOTSIZE, MPTR3
jsr math_mul32
;div32 ROOTSIZE, BYTESPERSECTOR, ROOTSIZE, TMP
put_address_lo ROOTSIZE, MPTR1
put_address_lo BYTESPERSECTOR, MPTR2
put_address_lo TMP, MPTR4
jsr math_div32
;; compute position of data region
;; the two first entries in the FAT are special and don't point to data
;; offset the start of the data region accordingly
;mul32 SECTORSPERCLUSTER, CONST32_2, TMP4
put_address_lo SECTORSPERCLUSTER, MPTR1
put_address_lo CONST32_2, MPTR2
put_address_lo TMP4, MPTR3
jsr math_mul32
;add32 ROOTSTART, ROOTSIZE, DATASTART
put_address_lo ROOTSTART, MPTR1
put_address_lo ROOTSIZE, MPTR2
put_address_lo DATASTART, MPTR3
jsr math_add32
;sub32 DATASTART, TMP4, DATASTART
put_address_lo DATASTART, MPTR1
put_address_lo TMP4, MPTR2
jsr math_sub32
rts
.endproc
;;
;; loads sector denoted by (ARG1,ARG1+1,ARG1+2) into buffer
;;
.proc fat_buffer_sector
lda #BUFFERPAGE
sta ARG2
jsr io_sd_read_block
rts
.endproc
;;
;; Determines next cluster in chain.
;; Reads CURRENTCLUSTER and writes there as well.
;;
.proc fat_next_cluster
push_ay
;; compute sector for cluster entry
;mul32 CURRENTCLUSTER, CONST32_2, ARG1 ; each cluster entry is two bytes in FAT16
put_address_lo CURRENTCLUSTER, MPTR1
put_address_lo CONST32_2, MPTR2
put_address_lo ARG1, MPTR3
jsr math_mul32
;div32 ARG1, BYTESPERSECTOR, ARG1, OFFSET ; compute sector position and byte offset
put_address_lo ARG1, MPTR1
put_address_lo BYTESPERSECTOR, MPTR2
put_address_lo OFFSET, MPTR4
jsr math_div32
;add32 ARG1, RESERVEDSECTORS, ARG1 ; add starting position of the FAT
put_address_lo RESERVEDSECTORS, MPTR2
jsr math_add32
jsr fat_buffer_sector ; load sector with the relevant piece of the cluster chain
jsr util_clear_arg1
lda #BUFFERPAGE
sta ARG1+1 ; use ARG1 as pointer for a change
add32 ARG1, OFFSET, ARG1 ; add byte offset
ldy #0
lda (ARG1),y
sta CURRENTCLUSTER
iny
lda (ARG1),y
sta CURRENTCLUSTER+1
pull_ay
rts
.endproc
;;
;; Load complete cluster (as denoted by CURRENTCLUSTER) into pages starting with CURRENTPAGE.
;; Increments CURRENTPAGE accordingly.
;;
.proc fat_load_cluster
push_ax
;mul32 CURRENTCLUSTER, SECTORSPERCLUSTER, POSITION
put_address_lo CURRENTCLUSTER, MPTR1
put_address_lo SECTORSPERCLUSTER, MPTR2
put_address_lo POSITION, MPTR3
jsr math_mul32
;add32 POSITION, DATASTART, POSITION
put_address_lo POSITION, MPTR1
put_address_lo DATASTART, MPTR2
jsr math_add32
;; argument to advance sector position
put_address_lo CONST32_1, MPTR2
ldx #0
stx RET ; return code: zero is OK
loop_sectors:
lda CURRENTPAGE
cmp #LASTLOADPAGE
bcs out_of_mem ; if carry set: CURRENTPAGE >= LASTLOADPAGE
load:
mov32 POSITION, ARG1
lda CURRENTPAGE
sta ARG2
jsr io_sd_read_block
;add32 POSITION, CONST32_1, POSITION ; advance sector position
jsr math_add32
inc CURRENTPAGE ; advance page...
inc CURRENTPAGE ; ... two times (a sector is 512 bytes)
inx
cpx SECTORSPERCLUSTER
bne loop_sectors
end:
pull_ax
rts
out_of_mem:
lda #1 ; return code: not OK
sta RET
bne end
.endproc
;;
;; This routine will try to find and load a file with a name matching S_AUTOEXEC
;;
.proc fat_load_autoexec
;; ------------------------------------------------------------
;; put down code for "file not found"
;; ------------------------------------------------------------
lda #$FF
sta CURRENTCLUSTER
sta CURRENTCLUSTER+1
;; ------------------------------------------------------------
;; loop over every sector of root dir
;; ------------------------------------------------------------
ldx #0
loop_sectors:
jsr util_clear_arg1
stx ARG1
add32 ARG1, ROOTSTART, ARG1
jsr fat_buffer_sector
jsr fat_find_autoexec_in_buffer
inx
cpx ROOTSIZE
bne loop_sectors
;; check if a file was found
lda CURRENTCLUSTER
cmp #$FF
bne load
lda CURRENTCLUSTER+1
cmp #$FF
bne load
;; file not found, store non-zero return code
sta RET
beq end
;; ------------------------------------------------------------
;; load file
;; ------------------------------------------------------------
load:
lda #LOADPAGE ; starting page of load
sta CURRENTPAGE
loop_cluster:
jsr fat_load_cluster
lda RET ; check for out-of-memory status
bne end
jsr fat_next_cluster
;; check for end of cluster chain
lda CURRENTCLUSTER
cmp #$FF
bne loop_cluster
lda CURRENTCLUSTER+1
cmp #$F8
bcc loop_cluster
end:
rts
.endproc
;;
;; Searches through a directory in the buffer.
;;
.proc fat_find_autoexec_in_buffer
push_axy
;; initialize position (memorized in ARG1)
jsr util_clear_arg1
lda #BUFFERPAGE
sta ARG1+1
loop_entries:
;; PTR1: Pointer to dir entry
mov16 ARG1, PTR1
;; ------------------------------------------------------------
;; check status of directory entry
;; ------------------------------------------------------------
ldy #0
lda (PTR1),y
beq end ; entry empty, no subsequent entry
cmp #$e5
beq next_entry ; file deleted
ldy #11
lda (PTR1),y
and #$02
bne next_entry ; file hidden
;; ------------------------------------------------------------
;; compare file name of entry with S_AUTOEXEC
;; ------------------------------------------------------------
ldy #11
compare_filename:
dey
lda (PTR1),y
cmp S_AUTOEXEC,y
bne next_entry
tya
bne compare_filename
;; ------------------------------------------------------------
;; file name matches!
;; ------------------------------------------------------------
ldy #26
lda (PTR1),y
sta CURRENTCLUSTER
iny
lda (PTR1),y
sta CURRENTCLUSTER+1
jmp end
next_entry:
;add32 ARG1, CONST32_32, ARG1 ; advance position by 32 bytes
put_address_lo ARG1, MPTR1
put_address_lo CONST32_32, MPTR2
put_address_lo ARG1, MPTR3
jsr math_add32
inx
cpx #16 ; iterate over 16 entries
beq end
jmp loop_entries
end:
pull_axy
rts
.endproc
|
Project4/Sandbox/opd.asm | orrinjelo/virtual-machine | 0 | 103881 | <gh_stars>0
PLUS .BYT '+'
spc .BYT 32
ret .BYT 13
EOT .BYT 3 ; End of text
; Strings
opderr .BYT 32
.BYT 'i'
.BYT 's'
.BYT 32
.BYT 'n'
.BYT 'o'
.BYT 't'
.BYT 32
.BYT 'a'
.BYT 32
.BYT 'n'
.BYT 'u'
.BYT 'm'
.BYT 'b'
.BYT 'e'
.BYT 'r'
.BYT 13
.BYT 3 ; EOT
; Other useful values
ZERO .INT 0
I .INT 1
II .INT 2
III .INT 3
IV .INT 4
V .INT 5
VI .INT 6
VII .INT 7
VIII .INT 8
IX .INT 9
cZERO .BYT 48
cI .BYT 49
cII .BYT 50
cIII .BYT 51
cIV .BYT 52
cV .BYT 53
cVI .BYT 54
cVII .BYT 55
cVIII .BYT 56
cIX .BYT 57
opdv .INT 0
flag .INT 0
_s .BYT '+'
_k .INT 1
_j .BYT '4'
JMP START
; Convert char j to an integer if possible.
; If the flag is not set use the sign indicator s
; and the tenths indicator to compute the actual
; value of j. Add the value to the accumulator opdv.
; Passed values:
; R0: char s
; R1: int k
; R2: char j
; R3: reserved for I/O
; R4: t
; R7: reserved (temporarily) for returns
; ======== FUNCTION START opd =======================================
opd MOV SP FP ; Test for underflow
MOV R5 SP
CMP R5 SB
BGT R5 UNDERFLOW
MOV R7 FP ; Load _s
ADI R7 -8
;LDR R7 (R1)
LDB R0 (R7)
ADI R7 -4 ; Load _k
;LDR R7 (R1)
LDR R1 (R7)
ADI R7 -4 ; Load _j
;LDR R7 (R1)
LDB R2 (R7)
MOV R4 FP ; What is this doing?
ADI R4 -16
LDR R3 R4
; ======== END FUNCTION HEADING =====================================
LDR R4 ZERO ; int t = 0
LDB R5 cZERO
CMP R5 R2 ; if (j == '0')
BNZ R5 ELSE1
ADI R4 0 ; t = 0
JMP ENDIF
ELSE1 LDB R5 cI
CMP R5 R2 ; else if (j == '1')
BNZ R5 ELSE2
ADI R4 1 ; t = 1
JMP ENDIF
ELSE2 LDB R5 cII
CMP R5 R2 ; else if (j == '2')
BNZ R5 ELSE3
ADI R4 2 ; t = 2
JMP ENDIF
ELSE3 LDB R5 cIII
CMP R5 R2 ; else if (j == '3')
BNZ R5 ELSE4
ADI R4 3 ; t = 3
JMP ENDIF
ELSE4 LDB R5 cIV
CMP R5 R2 ; else if (j == '4')
BNZ R5 ELSE5
ADI R4 4 ; t = 4
JMP ENDIF
ELSE5 LDB R5 cV
CMP R5 R2 ; else if (j == '5')
BNZ R5 ELSE6
ADI R4 5 ; t = 5
JMP ENDIF
ELSE6 LDB R5 cVI
CMP R5 R2 ; else if (j == '6')
BNZ R5 ELSE7
ADI R4 6 ; t = 6
JMP ENDIF
ELSE7 LDB R5 cVII
CMP R5 R2 ; else if (j == '7')
BNZ R5 ELSE8
ADI R4 7 ; t = 7
JMP ENDIF
ELSE8 LDB R5 cVIII
CMP R5 R2 ; else if (j == '8')
BNZ R5 ELSE9
ADI R4 8 ; t = 8
JMP ENDIF
ELSE9 LDB R5 cIX
CMP R5 R2 ; else if (j == '9')
BNZ R5 ELSEF
ADI R4 9 ; t = 9
JMP ENDIF
ELSEF LDB R5 flag ; Create a print function
ADI R5 1
STR R5 flag ; flag = 1
ENDIF LDR R5 flag
BNZ R5 ENDIFFLAG ; if (!flag)
LDR R5 PLUS
CMP R5 R0
BNZ R5 SPLUSELSE ; if (s == '+')
MUL R4 R1 ; t *= k
JMP ENDSPLUS
SPLUSELSE MOV R5 R1
SUB R5 R1
SUB R5 R1 ; -k
MUL R4 R5 ; t *= -k
ENDSPLUS LDR R7 opdv
ADD R7 R4 ; opdv + t
STR R7 opdv
ENDIFFLAG MOV R5 FP ; Return address pointed to by FP
ADI R5 -4
LDR R5 (R5)
JMR R5
; ======== FUNCTION END opd =========================================
; print function: will print the string that is passed to it
print MOV R5 FP
ADI R5 -8
LDR R6 (R5)
LDR R7 (R6)
ps_ LDB R5 EOT
CMP R5 R7
BRZ R5 eps_
TRP 3
ADI R6 1
LDB R7 (R6)
JMP ps_
eps_ MOV SP FP ; Test for underflow
MOV R5 SP
CMP R5 SB
BGT R5 UNDERFLOW
MOV R5 FP ; Return address pointed to by FP
ADI R5 -4
LDR R5 (R5)
JMR R5
START MOV R1 SP ; Test for overflow
ADI R1 -8 ; Adjust for Rtn address & PFP
CMP R1 SL
BLT R1 OVERFLOW
MOV R1 FP ; Save FP in R1, this will be PFP
MOV FP SP ; Point at current activation record
ADI SP -8 ; Adjust SP for ret address
STR R1 (SP) ; PFP to top of stack
MOV R0 PC ; PC incremented by 1 instruction
ADI R0 168 ; Compute return address ; 20 * lines below
ADI R1 -4 ; FP - 4
STR R0 (R1) ; Return address to the beginning of the frame
; Add any other vars you need here
ADI R1 -4
LDB R0 _s
STR R0 (R1)
ADI R1 -4
LDR R0 _k
STR R0 (R1)
ADI R1 -4
LDR R0 _j
STR R0 (R1)
JMP opd
LDB R3 opdv
TRP 1
TRP 0
|
kernel/hal/io.asm | phaubertin/jinue | 2 | 10717 | ; Copyright (C) 2019 <NAME>.
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
;
; 1. Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; 3. Neither the name of the author nor the names of other contributors
; may be used to endorse or promote products derived from this software
; without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
bits 32
; ------------------------------------------------------------------------------
; FUNCTION: inb
; C PROTOTYPE: uint8_t inb(uint16_t port)
; ------------------------------------------------------------------------------
global inb
inb:
mov edx, [esp+4] ; first argument: port
in al, dx
movsx eax, al
ret
; ------------------------------------------------------------------------------
; FUNCTION: inw
; C PROTOTYPE: uint16_t inw(uint16_t port)
; ------------------------------------------------------------------------------
global inw
inw:
mov edx, [esp+4] ; first argument: port
in ax, dx
movsx eax, ax
ret
; ------------------------------------------------------------------------------
; FUNCTION: inl
; C PROTOTYPE: uint32_t inl(uint16_t port)
; ------------------------------------------------------------------------------
global inl
inl:
mov edx, [esp+4] ; first argument: port
in eax, dx
ret
; ------------------------------------------------------------------------------
; FUNCTION: outb
; C PROTOTYPE: void outb(uint16_t port, uint8_t value)
; ------------------------------------------------------------------------------
global outb
outb:
mov eax, [esp+8] ; second argument: value
mov edx, [esp+4] ; first argument: port
out dx, al
ret
; ------------------------------------------------------------------------------
; FUNCTION: outw
; C PROTOTYPE: void outw(uint16_t port, uint16_t value)
; ------------------------------------------------------------------------------
global outw
outw:
mov eax, [esp+8] ; second argument: value
mov edx, [esp+4] ; first argument: port
out dx, ax
ret
; ------------------------------------------------------------------------------
; FUNCTION: outl
; C PROTOTYPE: void outl(uint16_t port, uint32_t value)
; ------------------------------------------------------------------------------
global outl
outl:
mov eax, [esp+8] ; second argument: value
mov edx, [esp+4] ; first argument: port
out dx, eax
ret
;------------------------------------------------------------------------
; FUNCTION: iodelay
; C PROTOTYPE: void iodelay(void)
;------------------------------------------------------------------------
global iodelay
iodelay:
out 0x80, al
ret
|
src/TNT/Base.agda | PragmaTwice/TNT | 9 | 5785 | <reponame>PragmaTwice/TNT
{-# OPTIONS --without-K #-}
module TNT.Base where
open import Data.Nat
open import Data.Nat.DivMod
open import Data.Nat.Divisibility
open import Data.Nat.Properties
open import Agda.Builtin.Equality
open import Relation.Nullary.Decidable
open import Data.Empty
-- defination of congruence modulo
_≡_⟨mod_⟩ : ℕ → ℕ → (n : ℕ) → {≢0 : False (n ≟ 0)} → Set
(a ≡ b ⟨mod 0 ⟩){}
a ≡ b ⟨mod suc n ⟩ = a % suc n ≡ b % suc n
-- commutative
≡-comm : ∀ {ℓ} {A : Set ℓ} {a b : A} → a ≡ b → b ≡ a
≡-comm refl = refl
≡-mod-comm : ∀ {a b n : ℕ} → a ≡ b ⟨mod suc n ⟩ → b ≡ a ⟨mod suc n ⟩
≡-mod-comm refl₁ = ≡-comm refl₁
-- divisibility
a≡b⟨modn⟩⇒a%n-b%n≡0 : ∀ {a b n : ℕ} → a ≡ b ⟨mod suc n ⟩ → ∣ a % suc n - b % suc n ∣ ≡ 0
a≡b⟨modn⟩⇒a%n-b%n≡0 refl₁ = n≡m⇒∣n-m∣≡0 refl₁
a%n-b%n≡0⇒⟨a-b⟩%n≡0 : ∀ {a b n : ℕ} → ∣ a % suc n - b % suc n ∣ ≡ 0 → ∣ a - b ∣ % suc n ≡ 0
a%n-b%n≡0⇒⟨a-b⟩%n≡0 = {!!}
≡-mod-div : ∀ {a b n : ℕ} → a ≡ b ⟨mod suc n ⟩ → suc n ∣ ∣ a - b ∣
≡-mod-div {a} {b} {n} refl₁ = m%n≡0⇒n∣m ∣ a - b ∣ n (a%n-b%n≡0⇒⟨a-b⟩%n≡0 {a} {b} {n} (a≡b⟨modn⟩⇒a%n-b%n≡0 {a} {b} {n} refl₁))
-- transitivity
≡-trans : ∀ {ℓ} {A : Set ℓ} {a b c : A} → a ≡ b → b ≡ c → a ≡ c
≡-trans refl refl = refl
≡-mod-trans : ∀ {a b c n : ℕ} → a ≡ b ⟨mod suc n ⟩ → b ≡ c ⟨mod suc n ⟩ → a ≡ c ⟨mod suc n ⟩
≡-mod-trans refl₁ refl₂ = ≡-trans refl₁ refl₂
|
alloy4fun_models/trashltl/models/2/oRcLNKsmZcf9HjZ3S.als | Kaixi26/org.alloytools.alloy | 0 | 3221 | open main
pred idoRcLNKsmZcf9HjZ3S_prop3 {
some File
}
pred __repair { idoRcLNKsmZcf9HjZ3S_prop3 }
check __repair { idoRcLNKsmZcf9HjZ3S_prop3 <=> prop3o } |
Task/Seven-sided-dice-from-five-sided-dice/Ada/seven-sided-dice-from-five-sided-dice-2.ada | LaudateCorpus1/RosettaCodeData | 1 | 6143 | with Ada.Numerics.Discrete_Random;
package body Random_57 is
type M5 is mod 5;
package Rand_5 is new Ada.Numerics.Discrete_Random(M5);
Gen: Rand_5.Generator;
function Random7 return Mod_7 is
N: Natural;
begin
loop
N := Integer(Rand_5.Random(Gen))* 5 + Integer(Rand_5.Random(Gen));
-- N is uniformly distributed in 0 .. 24
if N < 21 then
return Mod_7(N/3);
else -- (N-21) is in 0 .. 3
N := (N-21) * 5 + Integer(Rand_5.Random(Gen)); -- N is in 0 .. 19
if N < 14 then
return Mod_7(N / 2);
else -- (N-14) is in 0 .. 5
N := (N-14) * 5 + Integer(Rand_5.Random(Gen)); -- N is in 0 .. 29
if N < 28 then
return Mod_7(N/4);
else -- (N-28) is in 0 .. 1
N := (N-28) * 5 + Integer(Rand_5.Random(Gen)); -- 0 .. 9
if N < 7 then
return Mod_7(N);
else -- (N-7) is in 0, 1, 2
N := (N-7)* 5 + Integer(Rand_5.Random(Gen)); -- 0 .. 14
if N < 14 then
return Mod_7(N/2);
else -- (N-14) is 0. This is not useful for us!
null;
end if;
end if;
end if;
end if;
end if;
end loop;
end Random7;
function Simple_Random7 return Mod_7 is
N: Natural :=
Integer(Rand_5.Random(Gen))* 5 + Integer(Rand_5.Random(Gen));
-- N is uniformly distributed in 0 .. 24
begin
while N > 20 loop
N := Integer(Rand_5.Random(Gen))* 5 + Integer(Rand_5.Random(Gen));
end loop; -- Now I <= 20
return Mod_7(N / 3);
end Simple_Random7;
begin
Rand_5.Reset(Gen);
end Random_57;
|
zx81-tw2.0-src/tw-data.asm | monstergdc/ZX81-TurboWieszcz | 1 | 242064 | <filename>zx81-tw2.0-src/tw-data.asm
;TURBO WIESZCZ++ 2.0 FOR ZX81
;(C)2015, 2017 <EMAIL>
;CRE: 2015.09.24 (zx48)
;ZX81 v: 20171206
;DATA
TTLS dw TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9, TT10, TT11, TT12
dw TT13, TT14, TT15, TT16, TT17, TT18, TT19, TT20, TT21, TT22, TT23
dw TT24, TT25, TT26, TT27, TT28, TT29, TT30, TT31, TT32
D0_A dw D0_0,D0_1
dw D0_2,D0_3
dw D0_4,D0_5
dw D0_6,D0_7
dw D0_8,D0_9
dw D0_10,D0_11
dw D0_12,D0_13
dw D0_14,D0_15
dw D0_16,D0_17
dw D0_18,D0_19
dw D0_20,D0_21
dw D0_22
dw D0_23,D0_24
dw D0_25,D0_26
dw D0_27,D0_28
dw D0_29,D0_30
dw D0_31
D1_A dw D1_0,D1_1
dw D1_2,D1_3
dw D1_4,D1_5
dw D1_6,D1_7
dw D1_8,D1_9
dw D1_10,D1_11
dw D1_12,D1_13
dw D1_14,D1_15
dw D1_16,D1_17
dw D1_18,D1_19
dw D1_20,D1_21
dw D1_22
dw D1_23,D1_24
dw D1_25,D1_26
dw D1_27,D1_28
dw D1_29,D1_30
dw D1_31
D2_A dw D2_0,D2_1
dw D2_2,D2_3
dw D2_4,D2_5
dw D2_6,D2_7
dw D2_8,D2_9
dw D2_10,D2_11
dw D2_12,D2_13
dw D2_14,D2_15
dw D2_16,D2_17
dw D2_18,D2_19
dw D2_20,D2_21
dw D2_22
dw D2_23,D2_24
dw D2_25,D2_26
dw D2_27,D2_28
dw D2_29,D2_30
dw D2_31
D3_A dw D3_0,D3_1
dw D3_2,D3_3
dw D3_4,D3_5
dw D3_6,D3_7
dw D3_8,D3_9
dw D3_10,D3_11
dw D3_12,D3_13
dw D3_14,D3_15
dw D3_16,D3_17
dw D3_18,D3_19
dw D3_20,D3_21
dw D3_22
dw D3_23,D3_24
dw D3_25,D3_26
dw D3_27,D3_28
dw D3_29,D3_30
dw D3_31
;titles
TT1 db 63, 38, 44, 49, 38, 41, 38
db 255
TT2 db 57, 52, 0, 47, 58, 63, 0, 48, 52, 51, 46, 42, 40
db 255
TT3 db 56, 60, 46, 38, 57, 0, 44, 46, 51, 46, 42
db 255
TT4 db 63, 0, 60, 46, 63, 62, 57, 38, 0, 60, 0, 53, 46, 42, 48, 49, 42
db 255
TT5 db 48, 38, 57, 38, 48, 49, 46, 63, 50
db 255
TT6 db 41, 63, 46, 42, 51, 0, 63, 0, 63, 62, 40, 46, 38, 27, 27, 27
db 255
TT7 db 50, 38, 56, 38, 48, 55, 38
db 255
TT8 db 48, 38, 57, 38, 56, 57, 55, 52, 43, 38
db 255
TT9 db 60, 56, 63, 62, 56, 40, 62, 0, 63, 44, 46, 51, 46, 42, 50, 62, 27, 27, 27
db 255
TT10 db 56, 53, 52, 48, 52, 47
db 255
TT11 db 48, 52, 51, 46, 42, 40
db 255
TT12 db 48, 52, 51, 46, 42, 40, 0, 49, 58, 41, 63, 48, 52, 56, 40, 46
db 255
TT13 db 57, 42, 49, 42, 43, 52, 51, 0, 41, 52, 0, 39, 52, 44, 38
db 255
TT14 db 60, 46, 42, 40, 63, 51, 42, 0, 40, 46, 42, 50, 51, 52, 56, 40, 46
db 255
TT15 db 50, 55, 52, 48
db 255
TT16 db 50, 55, 52, 48, 0, 60, 0, 56, 55, 52, 41, 48, 58, 0, 41, 51, 46, 38
db 255
TT17 db 40, 46, 42, 50, 51, 52, 56, 40
db 255
TT18 db 53, 46, 52, 55, 58, 51, 42, 50, 0, 60, 0, 49, 42, 39
db 255
TT19 db 50, 38, 55, 56, 63, 0, 57, 55, 52, 49, 46
db 255
TT20 db 56, 63, 62, 41, 42, 55, 56, 57, 60, 38, 0, 63, 49, 42, 44, 52
db 255
TT21 db 52, 48, 55, 52, 53, 51, 52, 56, 40, 46, 0, 56, 60, 46, 38, 57, 38
db 255
TT22 db 58, 50, 55, 63, 42, 40, 0, 53, 52, 0, 55, 38, 63, 0, 52, 56, 57, 38, 57, 51, 46
db 255
TT23 db 53, 52, 57, 42, 53, 46, 42, 51, 46, 42
db 255
TT24 db 39, 52, 49, 0, 50, 52, 44, 63, 58
db 255
TT25 db 60, 46, 42, 40, 63, 51, 42, 0, 60, 62, 50, 46, 52, 57, 62
db 255
TT26 db 63, 38, 57, 55, 58, 57, 42, 0, 41, 58, 56, 63, 42
db 255
TT27 db 58, 40, 46, 42, 48, 38, 47
db 255
TT28 db 38, 53, 52, 48, 38, 49, 46, 53, 56, 38
db 255
TT29 db 63, 49, 58, 41, 63, 42, 51, 46, 42, 0, 53, 55, 62, 56, 48, 38
db 255
TT30 db 50, 38, 48, 38, 39, 55, 38
db 255
TT31 db 63, 38, 44, 49, 38, 41, 38, 0, 56, 60, 46, 38, 57, 38
db 255
TT32 db 56, 50, 46, 42, 55, 40
db 255
;verses
D0_0 db 38, 0, 51, 38, 0, 57, 42, 0, 63, 39, 55, 52, 41, 51, 46, 42, 0, 51, 46, 42, 0, 39, 42, 41, 63, 46, 42, 0, 48, 38, 55, 62
db 255
D0_1 db 52, 53, 58, 56, 57, 52, 56, 63, 38, 49, 62, 0, 39, 38, 44, 51, 38, 26, 0, 50, 52, 40, 63, 38, 55, 62
db 255
D0_2 db 51, 38, 0, 51, 46, 40, 0, 56, 46, 42, 0, 50, 52, 41, 49, 62, 0, 63, 41, 38, 41, 63, 38, 0, 51, 46, 0, 40, 63, 38, 55, 62
db 255
D0_3 db 63, 0, 48, 55, 60, 46, 0, 50, 52, 55, 41, 52, 60, 38, 51, 62, 40, 45, 0, 56, 38, 40, 63, 38, 0, 53, 58, 40, 45, 38, 55, 62
db 255
D0_4 db 57, 52, 0, 51, 46, 42, 57, 52, 53, 42, 55, 63, 42, 26, 0, 60, 42, 63, 42, 26, 0, 48, 38, 49, 50, 38, 55, 62
db 255
D0_5 db 53, 55, 52, 63, 51, 52, 0, 51, 46, 42, 56, 63, 40, 63, 42, 56, 51, 46, 0, 56, 62, 53, 46, 38, 0, 57, 38, 49, 38, 55, 62
db 255
D0_6 db 63, 38, 0, 40, 52, 0, 51, 38, 50, 0, 63, 51, 52, 56, 46, 40, 0, 57, 38, 48, 46, 42, 0, 40, 46, 42, 63, 38, 55, 62
db 255
D0_7 db 63, 49, 52, 60, 55, 52, 44, 52, 0, 46, 56, 48, 55, 63, 38, 0, 48, 52, 39, 55, 0, 52, 48, 58, 49, 38, 55, 62
db 255
D0_8 db 53, 55, 52, 63, 51, 52, 0, 56, 60, 42, 0, 50, 52, 41, 49, 62, 0, 60, 63, 51, 52, 56, 46, 0, 60, 46, 48, 38, 55, 62
db 255
D0_9 db 53, 58, 56, 57, 52, 56, 63, 38, 0, 56, 51, 62, 0, 57, 60, 52, 47, 42, 0, 57, 42, 0, 51, 52, 40, 51, 42, 0, 50, 38, 55, 62
db 255
D0_10 db 53, 55, 52, 63, 51, 52, 0, 51, 46, 42, 56, 63, 40, 63, 42, 56, 51, 46, 48, 0, 56, 62, 53, 46, 42, 0, 57, 38, 49, 38, 55, 62
db 255
D0_11 db 53, 55, 63, 42, 41, 63, 46, 60, 51, 46, 42, 0, 57, 48, 38, 51, 62, 0, 63, 62, 40, 46, 38, 0, 49, 52, 44, 38, 55, 62, 57, 50
db 255
D0_12 db 47, 58, 63, 0, 56, 57, 55, 38, 40, 45, 0, 60, 62, 53, 58, 56, 63, 40, 63, 38, 0, 56, 60, 52, 47, 42, 0, 52, 44, 38, 55, 62
db 255
D0_13 db 46, 0, 52, 57, 52, 0, 44, 46, 51, 46, 42, 56, 63, 0, 60, 0, 53, 38, 56, 63, 40, 63, 62, 0, 53, 52, 40, 63, 60, 38, 55, 62
db 255
D0_14 db 60, 39, 46, 47, 38, 47, 38, 0, 53, 38, 49, 42, 0, 63, 49, 52, 57, 42, 0, 48, 38, 43, 38, 55, 62
db 255
D0_15 db 63, 62, 40, 46, 42, 0, 52, 41, 48, 55, 62, 60, 38, 0, 56, 60, 52, 47, 42, 0, 53, 55, 63, 62, 60, 38, 55, 62
db 255
D0_16 db 51, 38, 0, 41, 51, 46, 42, 0, 53, 52, 51, 58, 55, 42, 47, 26, 0, 53, 58, 56, 57, 42, 47, 0, 53, 46, 42, 40, 63, 38, 55, 62
db 255
D0_17 db 38, 53, 52, 48, 38, 49, 46, 53, 56, 62, 0, 51, 38, 41, 42, 56, 63, 49, 62, 0, 40, 63, 38, 55, 62
db 255
D0_18 db 58, 53, 38, 41, 49, 62, 0, 38, 51, 46, 52, 49, 0, 60, 56, 53, 52, 50, 46, 51, 38, 0, 40, 45, 60, 38, 49, 42
db 255
D0_19 db 63, 62, 40, 46, 42, 0, 58, 48, 55, 62, 60, 38, 0, 56, 60, 52, 47, 42, 0, 53, 55, 63, 62, 60, 38, 55, 62
db 255
D0_20 db 41, 63, 46, 60, 51, 62, 40, 45, 0, 52, 60, 38, 41, 52, 60, 0, 60, 63, 49, 38, 57, 58, 47, 38, 0, 40, 45, 50, 38, 55, 62
db 255
D0_21 db 39, 52, 50, 39, 52, 60, 40, 42, 0, 39, 46, 52, 55, 38, 0, 51, 38, 56, 63, 42, 0, 51, 38, 50, 46, 38, 55, 62
db 255
D0_22 db 51, 46, 42, 0, 41, 38, 0, 56, 46, 42, 0, 60, 62, 55, 60, 38, 40, 0, 40, 63, 38, 55, 57, 52, 50, 0, 57, 52, 60, 38, 55, 58
db 255
D0_23 db 53, 55, 52, 63, 51, 52, 0, 43, 55, 38, 47, 42, 55, 63, 62, 0, 56, 62, 53, 46, 38, 0, 57, 38, 49, 38, 55, 62
db 255
D0_24 db 53, 52, 0, 40, 52, 0, 51, 38, 50, 0, 56, 38, 40, 63, 62, 40, 0, 53, 52, 41, 49, 42, 0, 39, 55, 52, 60, 38, 55, 62
db 255
D0_25 db 41, 46, 49, 42, 55, 0, 47, 58, 63, 0, 51, 46, 42, 0, 41, 52, 56, 57, 38, 55, 40, 63, 62, 0, 57, 52, 60, 38, 55, 58
db 255
D0_26 db 56, 50, 58, 57, 51, 52, 0, 53, 38, 57, 55, 63, 62, 56, 63, 0, 51, 38, 0, 53, 58, 56, 57, 42, 0, 39, 38, 63, 38, 55, 62
db 255
D0_27 db 49, 52, 48, 52, 50, 52, 57, 62, 60, 38, 0, 51, 46, 42, 0, 50, 38, 0, 47, 58, 63, 0, 53, 38, 55, 62
db 255
D0_28 db 44, 41, 62, 0, 51, 46, 42, 0, 48, 38, 63, 41, 42, 44, 52, 0, 56, 57, 38, 40, 0, 51, 38, 0, 39, 55, 52, 60, 38, 55, 62
db 255
D0_29 db 53, 52, 63, 38, 55, 49, 0, 45, 46, 49, 38, 55, 62, 0, 56, 60, 42, 0, 52, 48, 58, 49, 38, 55, 62
db 255
D0_30 db 56, 53, 52, 60, 46, 49, 62, 0, 51, 38, 56, 0, 57, 55, 58, 47, 38, 40, 42, 0, 52, 53, 38, 55, 62
db 255
D0_31 db 57, 52, 0, 51, 46, 42, 0, 47, 42, 56, 57, 0, 40, 38, 49, 48, 38, 0, 38, 51, 46, 0, 49, 52, 44, 38, 55, 62, 57, 50
db 255
D1_0 db 47, 58, 63, 0, 51, 38, 0, 38, 55, 42, 51, 42, 0, 48, 55, 42, 60, 0, 57, 55, 62, 56, 48, 38
db 255
D1_1 db 47, 58, 63, 0, 53, 46, 38, 51, 38, 0, 40, 46, 42, 48, 51, 46, 42, 0, 46, 50, 0, 63, 0, 53, 62, 56, 48, 38
db 255
D1_2 db 47, 58, 63, 0, 45, 42, 51, 0, 60, 0, 52, 41, 41, 38, 49, 46, 0, 44, 41, 63, 46, 42, 56, 0, 39, 49, 62, 56, 48, 38
db 255
D1_3 db 56, 50, 46, 42, 55, 40, 0, 60, 0, 48, 38, 40, 46, 42, 0, 40, 63, 38, 46, 0, 56, 46, 42, 0, 39, 49, 46, 56, 48, 38
db 255
D1_4 db 51, 46, 42, 56, 38, 50, 52, 60, 46, 57, 42, 0, 41, 58, 40, 45, 52, 60, 0, 46, 44, 55, 63, 62, 56, 48, 38
db 255
D1_5 db 47, 58, 63, 0, 63, 38, 40, 46, 56, 48, 38, 47, 38, 40, 0, 49, 38, 53, 46, 56, 48, 38
db 255
D1_6 db 63, 38, 50, 46, 38, 56, 57, 0, 53, 52, 63, 52, 56, 57, 38, 40, 0, 60, 0, 63, 38, 50, 40, 63, 62, 56, 48, 38, 40, 45
db 255
D1_7 db 55, 63, 42, 48, 38, 0, 60, 62, 49, 42, 60, 38, 0, 63, 0, 49, 52, 63, 62, 56, 48, 38
db 255
D1_8 db 51, 46, 42, 56, 63, 40, 63, 42, 56, 40, 0, 60, 62, 49, 38, 49, 38, 0, 56, 46, 42, 0, 50, 46, 56, 48, 38
db 255
D1_9 db 47, 58, 63, 0, 63, 38, 40, 46, 56, 48, 38, 47, 38, 40, 0, 63, 42, 39, 46, 56, 48, 38
db 255
D1_10 db 52, 57, 60, 38, 55, 57, 38, 0, 51, 46, 42, 56, 63, 40, 63, 42, 56, 40, 0, 60, 38, 49, 46, 63, 48, 38
db 255
D1_11 db 51, 46, 40, 63, 62, 50, 0, 51, 38, 0, 55, 63, 62, 50, 56, 48, 46, 40, 45, 0, 39, 52, 46, 56, 48, 38, 40, 45
db 255
D1_12 db 40, 63, 38, 55, 57, 0, 60, 63, 51, 46, 42, 40, 38, 0, 56, 60, 42, 0, 53, 38, 49, 42, 51, 46, 56, 48, 38
db 255
D1_13 db 38, 0, 60, 0, 50, 55, 52, 48, 58, 0, 56, 60, 46, 42, 40, 38, 0, 63, 42, 39, 46, 56, 48, 38
db 255
D1_14 db 63, 42, 60, 56, 63, 38, 41, 0, 41, 52, 40, 45, 52, 41, 63, 38, 0, 60, 62, 63, 60, 46, 56, 48, 38
db 255
D1_15 db 56, 60, 46, 42, 57, 62, 40, 45, 0, 44, 49, 52, 41, 0, 60, 46, 38, 55, 62, 0, 53, 55, 63, 62, 40, 46, 56, 48, 38
db 255
D1_16 db 53, 52, 51, 58, 55, 52, 0, 53, 38, 57, 55, 63, 62, 0, 63, 0, 46, 40, 45, 0, 53, 62, 56, 48, 38
db 255
D1_17 db 50, 44, 49, 38, 0, 56, 57, 52, 46, 0, 51, 38, 0, 58, 55, 52, 40, 63, 62, 56, 48, 38, 40, 45
db 255
D1_18 db 48, 52, 56, 40, 46, 0, 53, 52, 44, 55, 63, 42, 39, 46, 38, 0, 58, 60, 55, 46, 56, 48, 38
db 255
D1_19 db 44, 49, 52, 41, 0, 60, 46, 38, 55, 62, 0, 57, 38, 48, 0, 51, 38, 56, 0, 53, 55, 63, 62, 40, 46, 56, 48, 38
db 255
D1_20 db 55, 58, 51, 42, 49, 62, 0, 56, 48, 38, 49, 51, 42, 0, 63, 60, 38, 49, 46, 56, 48, 38
db 255
D1_21 db 40, 63, 38, 55, 57, 0, 55, 52, 63, 53, 38, 49, 38, 0, 53, 38, 49, 42, 51, 46, 56, 48, 38
db 255
D1_22 db 47, 58, 63, 0, 60, 0, 50, 55, 52, 48, 58, 0, 56, 60, 46, 42, 40, 38, 0, 63, 42, 39, 46, 56, 48, 38
db 255
D1_23 db 63, 51, 52, 60, 0, 53, 58, 56, 57, 38, 0, 63, 42, 39, 55, 38, 48, 38, 0, 50, 46, 56, 48, 38
db 255
D1_24 db 41, 46, 38, 39, 42, 49, 56, 48, 46, 42, 0, 57, 52, 0, 56, 38, 0, 46, 44, 55, 63, 62, 56, 48, 38
db 255
D1_25 db 51, 46, 42, 0, 53, 52, 60, 46, 42, 41, 63, 0, 41, 46, 38, 39, 49, 58, 0, 51, 38, 63, 60, 46, 56, 48, 38
db 255
D1_26 db 51, 38, 47, 44, 49, 52, 56, 51, 46, 42, 47, 0, 56, 49, 62, 40, 45, 38, 40, 0, 60, 62, 63, 60, 46, 56, 48, 38
db 255
D1_27 db 41, 46, 38, 39, 42, 49, 56, 48, 46, 42, 0, 50, 38, 47, 38, 0, 51, 38, 63, 60, 46, 56, 48, 38
db 255
D1_28 db 57, 38, 50, 0, 58, 40, 46, 42, 48, 38, 47, 38, 0, 49, 58, 41, 63, 46, 56, 48, 38
db 255
D1_29 db 57, 38, 48, 0, 55, 63, 42, 40, 63, 42, 0, 56, 57, 38, 55, 38, 0, 45, 46, 53, 46, 56, 48, 38
db 255
D1_30 db 44, 41, 63, 46, 42, 0, 41, 38, 60, 51, 42, 0, 49, 58, 41, 63, 46, 0, 56, 46, 42, 41, 49, 46, 56, 48, 38
db 255
D1_31 db 51, 38, 47, 44, 49, 52, 56, 51, 46, 42, 47, 0, 53, 46, 56, 63, 40, 63, 62, 0, 45, 46, 53, 46, 56, 48, 38
db 255
D2_0 db 55, 60, 38, 0, 53, 38, 63, 58, 55, 38, 50, 46, 0, 56, 60, 52, 47, 42, 0, 52, 43, 46, 38, 55, 62
db 255
D2_1 db 51, 46, 40, 0, 51, 46, 42, 0, 53, 52, 50, 52, 63, 42, 0, 57, 58, 0, 41, 55, 58, 46, 41, 0, 56, 57, 38, 55, 62
db 255
D2_2 db 57, 52, 0, 51, 52, 40, 51, 42, 0, 63, 47, 38, 60, 62, 0, 46, 0, 56, 42, 51, 51, 42, 0, 50, 38, 55, 62
db 255
D2_3 db 51, 46, 42, 44, 55, 52, 63, 51, 42, 0, 53, 55, 63, 62, 0, 51, 46, 40, 45, 0, 51, 38, 60, 42, 57, 0, 38, 57, 38, 55, 46
db 255
D2_4 db 53, 52, 41, 0, 60, 52, 41, 63, 38, 0, 48, 56, 46, 42, 63, 51, 42, 47, 0, 41, 46, 38, 39, 49, 46, 40, 0, 38, 63, 38, 55, 62
db 255
D2_5 db 63, 0, 41, 38, 49, 38, 0, 56, 57, 55, 38, 56, 63, 49, 46, 60, 42, 0, 57, 55, 38, 39, 46, 38, 0, 43, 38, 51, 43, 38, 55, 62
db 255
D2_6 db 57, 38, 48, 46, 42, 0, 56, 38, 0, 52, 57, 52, 0, 53, 46, 42, 48, 49, 38, 0, 39, 42, 63, 50, 46, 38, 55, 62
db 255
D2_7 db 63, 38, 56, 0, 41, 52, 52, 48, 52, 49, 38, 0, 49, 58, 51, 62, 26, 0, 53, 52, 63, 38, 55, 62
db 255
D2_8 db 38, 0, 57, 42, 55, 38, 63, 0, 51, 38, 44, 49, 42, 0, 47, 42, 56, 57, 42, 56, 0, 47, 58, 63, 0, 56, 57, 38, 55, 62
db 255
D2_9 db 57, 58, 0, 51, 46, 42, 0, 53, 52, 50, 52, 63, 42, 0, 47, 58, 63, 0, 56, 46, 49, 38, 0, 60, 46, 38, 55, 62
db 255
D2_10 db 40, 58, 41, 63, 42, 0, 51, 46, 42, 56, 63, 40, 63, 42, 56, 40, 46, 42, 0, 50, 52, 47, 42, 0, 51, 42, 48, 57, 38, 55, 62
db 255
D2_11 db 60, 56, 63, 62, 56, 57, 48, 52, 0, 63, 38, 49, 42, 60, 38, 0, 60, 55, 63, 38, 40, 62, 0, 49, 46, 53, 38, 55, 62, 57
db 255
D2_12 db 63, 38, 39, 52, 47, 40, 63, 42, 0, 56, 38, 0, 46, 40, 45, 0, 51, 46, 42, 40, 51, 42, 0, 63, 38, 50, 46, 38, 55, 62
db 255
D2_13 db 63, 38, 57, 55, 58, 57, 42, 0, 41, 58, 56, 63, 42, 0, 49, 38, 40, 63, 38, 0, 56, 46, 42, 0, 60, 0, 53, 38, 55, 62
db 255
D2_14 db 56, 60, 46, 38, 57, 0, 53, 52, 48, 38, 63, 58, 47, 42, 0, 56, 60, 52, 47, 42, 0, 60, 62, 50, 46, 38, 55, 62
db 255
D2_15 db 57, 58, 0, 51, 46, 42, 0, 53, 52, 50, 52, 63, 42, 0, 42, 49, 42, 48, 57, 55, 62, 48, 0, 56, 57, 38, 55, 62
db 255
D2_16 db 39, 55, 38, 48, 0, 58, 40, 63, 58, 40, 26, 0, 40, 45, 42, 40, 46, 0, 38, 0, 57, 38, 48, 63, 42, 0, 60, 46, 38, 55, 62
db 255
D2_17 db 53, 52, 50, 51, 46, 47, 26, 0, 38, 0, 50, 52, 60, 46, 49, 0, 50, 46, 40, 48, 46, 42, 60, 46, 40, 63, 0, 56, 57, 38, 55, 62
db 255
D2_18 db 56, 53, 38, 49, 52, 51, 62, 40, 45, 0, 49, 38, 56, 52, 60, 0, 56, 57, 55, 38, 56, 63, 38, 0, 45, 42, 48, 57, 38, 55, 62
db 255
D2_19 db 50, 52, 55, 41, 42, 55, 40, 62, 0, 49, 46, 40, 63, 38, 0, 56, 60, 52, 47, 42, 0, 52, 43, 46, 38, 55, 62
db 255
D2_20 db 48, 56, 46, 38, 41, 63, 0, 53, 52, 63, 52, 56, 57, 38, 47, 42, 0, 51, 38, 44, 49, 42, 0, 39, 42, 63, 0, 60, 46, 38, 55, 62
db 255
D2_21 db 53, 38, 53, 46, 42, 63, 0, 63, 38, 40, 63, 62, 51, 38, 0, 52, 41, 53, 55, 38, 60, 46, 38, 40, 0, 40, 63, 38, 55, 62
db 255
D2_22 db 57, 58, 0, 51, 46, 42, 0, 53, 52, 50, 52, 63, 42, 0, 53, 38, 40, 46, 52, 55, 42, 48, 26, 0, 56, 57, 38, 55, 62
db 255
D2_23 db 58, 53, 38, 41, 38, 0, 52, 57, 52, 0, 41, 38, 39, 0, 57, 42, 51, 0, 53, 55, 38, 56, 57, 38, 55, 62
db 255
D2_24 db 46, 0, 58, 41, 42, 55, 63, 38, 47, 38, 0, 63, 0, 56, 46, 49, 38, 0, 51, 46, 38, 44, 38, 55, 62
db 255
D2_25 db 39, 62, 56, 57, 55, 52, 0, 56, 50, 46, 44, 38, 47, 38, 0, 51, 38, 60, 42, 57, 0, 51, 46, 42, 63, 41, 38, 55, 62
db 255
D2_26 db 47, 58, 63, 0, 51, 46, 42, 55, 58, 40, 45, 52, 50, 42, 0, 46, 40, 45, 0, 38, 60, 38, 57, 38, 55, 62
db 255
D2_27 db 46, 0, 39, 42, 63, 0, 60, 38, 55, 57, 52, 56, 40, 46, 0, 56, 38, 0, 47, 58, 63, 0, 41, 52, 49, 38, 55, 62
db 255
D2_28 db 44, 41, 63, 46, 42, 0, 56, 46, 42, 0, 53, 52, 41, 63, 46, 38, 49, 62, 0, 57, 42, 0, 51, 42, 51, 58, 43, 38, 55, 62
db 255
D2_29 db 57, 38, 48, 0, 51, 38, 56, 0, 63, 38, 39, 46, 47, 38, 0, 44, 55, 52, 63, 51, 42, 0, 53, 58, 49, 56, 38, 55, 62
db 255
D2_30 db 53, 52, 60, 52, 41, 63, 0, 63, 38, 49, 42, 60, 38, 0, 60, 46, 42, 49, 48, 46, 42, 0, 52, 39, 56, 63, 38, 55, 62
db 255
D2_31 db 38, 63, 0, 55, 52, 63, 53, 38, 41, 38, 47, 38, 0, 56, 46, 42, 0, 46, 0, 43, 46, 49, 38, 55, 62
db 255
D3_0 db 60, 51, 42, 57, 0, 51, 38, 0, 51, 38, 56, 0, 57, 42, 63, 0, 53, 55, 63, 62, 47, 41, 63, 46, 42, 0, 48, 55, 62, 56, 48, 38
db 255
D3_1 db 63, 51, 46, 48, 38, 41, 0, 63, 38, 41, 51, 42, 44, 52, 0, 56, 40, 45, 55, 52, 51, 46, 56, 48, 38
db 255
D3_2 db 53, 52, 60, 46, 42, 57, 55, 63, 42, 0, 57, 51, 46, 42, 0, 56, 60, 46, 56, 57, 0, 39, 46, 40, 63, 62, 56, 48, 38
db 255
D3_3 db 55, 52, 41, 42, 50, 0, 63, 0, 40, 63, 38, 55, 40, 46, 42, 44, 52, 0, 58, 55, 60, 46, 56, 48, 38
db 255
D3_4 db 46, 0, 56, 60, 38, 41, 0, 51, 46, 42, 63, 51, 52, 56, 51, 62, 0, 56, 46, 42, 0, 60, 40, 46, 56, 48, 38
db 255
D3_5 db 45, 58, 48, 26, 0, 47, 38, 48, 0, 63, 0, 60, 46, 42, 49, 48, 46, 42, 44, 52, 0, 49, 52, 57, 51, 46, 56, 48, 38
db 255
D3_6 db 63, 49, 52, 60, 55, 52, 44, 52, 0, 39, 55, 63, 50, 46, 38, 0, 46, 40, 45, 0, 51, 38, 63, 60, 46, 56, 48, 38
db 255
D3_7 db 60, 0, 48, 38, 40, 46, 42, 0, 51, 46, 42, 56, 50, 46, 38, 49, 52, 0, 48, 57, 52, 56, 0, 53, 46, 56, 48, 38
db 255
D3_8 db 48, 57, 52, 56, 0, 52, 39, 52, 48, 0, 50, 52, 55, 41, 58, 47, 42, 0, 49, 46, 56, 48, 38
db 255
D3_9 db 48, 55, 60, 46, 38, 0, 52, 40, 46, 42, 48, 38, 47, 38, 0, 63, 42, 39, 46, 56, 48, 38
db 255
D3_10 db 60, 52, 48, 52, 49, 52, 0, 41, 63, 46, 48, 46, 42, 0, 53, 46, 38, 55, 63, 62, 56, 48, 38
db 255
D3_11 db 46, 0, 63, 38, 41, 63, 38, 0, 40, 63, 38, 46, 0, 56, 46, 42, 0, 51, 46, 56, 48, 38
db 255
D3_12 db 41, 46, 38, 39, 42, 49, 0, 40, 46, 42, 0, 41, 63, 46, 56, 46, 38, 47, 0, 60, 62, 63, 62, 56, 48, 38
db 255
D3_13 db 53, 49, 52, 51, 38, 0, 63, 38, 44, 49, 38, 41, 62, 0, 52, 44, 51, 46, 56, 48, 38
db 255
D3_14 db 44, 60, 38, 49, 57, 0, 51, 46, 42, 40, 45, 0, 56, 46, 42, 0, 44, 60, 38, 49, 57, 42, 50, 0, 52, 41, 40, 46, 56, 48, 38
db 255
D3_15 db 56, 57, 52, 46, 56, 63, 0, 51, 38, 0, 56, 48, 55, 38, 47, 58, 0, 58, 55, 60, 46, 56, 48, 38
db 255
D3_16 db 57, 38, 50, 0, 56, 63, 38, 57, 38, 51, 0, 40, 63, 38, 55, 57, 38, 0, 60, 62, 46, 56, 48, 38
db 255
D3_17 db 58, 40, 46, 42, 48, 38, 47, 26, 0, 53, 55, 63, 62, 56, 63, 49, 52, 56, 40, 0, 47, 42, 56, 57, 0, 50, 44, 49, 46, 56, 57, 38
db 255
D3_18 db 51, 38, 41, 63, 46, 42, 46, 0, 63, 49, 58, 41, 63, 42, 51, 46, 42, 0, 53, 55, 62, 56, 48, 38
db 255
D3_19 db 60, 62, 41, 63, 46, 52, 39, 46, 38, 0, 52, 40, 63, 62, 0, 53, 57, 38, 56, 63, 62, 56, 48, 38
db 255
D3_20 db 53, 38, 41, 38, 47, 38, 0, 49, 39, 62, 0, 51, 38, 0, 48, 49, 42, 53, 46, 56, 48, 52
db 255
D3_21 db 56, 50, 46, 42, 55, 40, 0, 63, 39, 46, 42, 55, 38, 0, 63, 51, 46, 60, 52, 0, 60, 0, 48, 52, 49, 62, 56, 48, 38, 40, 45
db 255
D3_22 db 40, 52, 56, 0, 63, 51, 52, 60, 58, 0, 63, 44, 55, 63, 62, 57, 38, 0, 60, 0, 49, 52, 63, 62, 56, 48, 38, 40, 45
db 255
D3_23 db 56, 53, 38, 41, 38, 56, 63, 0, 63, 0, 60, 46, 42, 49, 48, 46, 42, 44, 52, 0, 58, 55, 60, 46, 56, 48, 38
db 255
D3_24 db 49, 38, 60, 38, 0, 56, 53, 52, 41, 0, 63, 46, 42, 50, 46, 0, 60, 62, 57, 55, 62, 56, 48, 38
db 255
D3_25 db 60, 52, 48, 52, 49, 52, 0, 44, 55, 63, 50, 46, 0, 38, 49, 39, 52, 0, 39, 49, 62, 56, 48, 38
db 255
D3_26 db 43, 38, 49, 56, 63, 62, 60, 42, 0, 63, 49, 52, 57, 52, 0, 53, 52, 49, 62, 56, 48, 38
db 255
D3_27 db 51, 38, 47, 60, 46, 42, 40, 42, 47, 0, 40, 63, 38, 55, 57, 0, 57, 58, 0, 58, 63, 62, 56, 48, 38
db 255
D3_28 db 52, 60, 46, 42, 40, 63, 48, 46, 0, 63, 49, 62, 0, 57, 58, 0, 53, 52, 63, 62, 56, 48, 38
db 255
D3_29 db 52, 60, 46, 42, 40, 63, 48, 46, 0, 56, 53, 38, 41, 49, 62, 0, 63, 0, 58, 55, 60, 46, 56, 48, 38
db 255
D3_30 db 56, 51, 58, 47, 38, 0, 56, 46, 42, 0, 41, 62, 50, 62, 0, 63, 0, 52, 44, 51, 46, 56, 48, 38
db 255
D3_31 db 57, 52, 0, 40, 63, 38, 55, 51, 42, 0, 49, 42, 40, 38, 0, 53, 57, 38, 56, 63, 62, 56, 48, 38
db 255
;---
ABO DB 57, 58, 55, 39, 52, 0, 60, 46, 42, 56, 63, 40, 63, 0, 21, 21, 0, 59, 30, 27, 28, 0, 24, 0, 63, 61, 36, 29, 118
DB 44, 42, 51, 42, 55, 38, 57, 52, 55, 0, 60, 46, 42, 55, 56, 63, 62, 118, 118
DB 16, 40, 17, 30, 28, 29, 35, 0, 50, 52, 51, 56, 57, 42, 55, 24, 44, 41, 40, 26, 118
DB 60, 60, 60, 27, 51, 52, 51, 46, 42, 60, 46, 40, 63, 27, 40, 52, 50, 118
DB 60, 60, 60, 27, 51, 52, 51, 46, 42, 60, 46, 40, 63, 27, 38, 55, 57, 27, 53, 49, 118, 118
DB 56, 57, 55, 52, 43, 62, 0, 39, 62, 14, 0, 44, 55, 62, 40, 45, 26, 0, 43, 55, 42, 42, 38, 48, 26, 0, 43, 55, 42, 41, 26, 0, 50, 52, 51, 56, 57, 42, 55, 26, 0, 50, 38, 55, 42, 48, 0, 53, 38, 50, 53, 58, 40, 45, 118, 118
DB 52, 53, 38, 55, 57, 62, 0, 51, 38, 0, 50, 52, 46, 40, 45, 0, 60, 42, 55, 56, 47, 38, 40, 45, 14, 118
DB 22, 0, 51, 38, 0, 63, 61, 0, 56, 53, 42, 40, 57, 55, 58, 50, 0, 32, 36, 0, 16, 30, 28, 29, 33, 17, 118
DB 22, 0, 51, 38, 0, 38, 51, 41, 55, 52, 46, 41, 38, 0, 16, 30, 28, 29, 29, 21, 17, 118
DB 22, 0, 51, 38, 0, 40, 52, 50, 50, 52, 41, 52, 55, 42, 0, 40, 22, 34, 32, 0, 16, 29, 37, 37, 30, 22, 29, 37, 37, 33, 17, 118
DB 52, 53, 38, 55, 57, 62, 40, 45, 0, 63, 0, 48, 52, 49, 42, 46, 0, 51, 38, 0, 53, 52, 50, 62, 56, 49, 42, 0, 63, 118
DB 11, 50, 38, 44, 38, 63, 62, 51, 58, 0, 38, 50, 46, 44, 38, 11, 118
DB 38, 58, 57, 52, 55, 56, 57, 60, 38, 0, 50, 38, 55, 48, 38, 0, 53, 38, 50, 53, 58, 40, 45, 38
DB 0, 46, 0, 60, 42, 55, 22, 0, 56, 47, 38, 40, 45, 0, 44, 55, 62, 40, 45, 38, 0, 51, 38, 0, 38, 50, 46, 44, 42, 0, 46, 0, 46, 53, 45, 52, 51, 42, 118, 118
DB 45, 46, 56, 57, 52, 55, 46, 38, 0, 60, 46, 42, 56, 63, 40, 63, 38, 0, 60, 0, 50, 38, 44, 38, 63, 62, 51, 46, 42, 118
DB 11, 45, 38, 0, 38, 55, 57, 11, 0, 32, 35, 0, 31, 24, 30, 28, 29, 32, 118
DB 53, 52, 55, 57, 0, 63, 61, 36, 29, 0, 46, 51, 56, 53, 46, 55, 42, 41, 0, 39, 62, 0, 57, 62, 44, 55, 62, 56
DB 255
OPTS DB 52, 53, 40, 47, 42, 14, 118, 118
DB 56, 53, 38, 40, 47, 38, 0, 22, 0, 44, 42, 51, 42, 55, 58, 47, 0, 51, 52, 60, 62, 0, 60, 46, 42, 55, 56, 63, 118
DB 38, 0, 22, 0, 46, 51, 43, 52, 55, 50, 38, 40, 47, 42, 0, 52, 0, 53, 55, 52, 44, 55, 38, 50, 46, 42, 118
DB 61, 0, 22, 0, 53, 55, 63, 62, 56, 53, 46, 42, 56, 63, 42, 51, 46, 42, 0, 41, 55, 58, 48, 52, 60, 38, 51, 46, 38, 118
DB 55, 0, 22, 0, 63, 50, 46, 38, 51, 38, 0, 57, 55, 62, 39, 58, 0, 55, 62, 50, 52, 60, 14, 118
DB 0, 0, 0, 0, 38, 39, 38, 39, 26, 0, 38, 39, 39, 38, 26, 0, 38, 38, 39, 39, 118
DB 45, 0, 22, 0, 57, 42, 51, 0, 42, 48, 55, 38, 51, 0, 53, 52, 50, 52, 40, 62, 118
DB 63, 0, 22, 0, 57, 55, 62, 39, 0, 63, 24, 39, 42, 63, 0, 53, 52, 60, 57, 52, 55, 63, 42, 51, 118
DB 50, 0, 22, 0, 57, 55, 62, 39, 0, 38, 58, 57, 52, 50, 38, 57, 62, 40, 63, 51, 62, 26, 0, 40, 52, 0, 29, 28, 56, 118, 118
DB 52, 53, 40, 47, 42, 0, 55, 26, 63, 26, 50, 0, 63, 38, 41, 63, 46, 38, 49, 38, 47, 38, 0, 57, 62, 49, 48, 52, 118
DB 50, 46, 42, 41, 63, 62, 0, 48, 52, 49, 42, 47, 51, 62, 50, 46, 0, 60, 46, 42, 55, 56, 63, 38, 50, 46
DB 255
;do not encode
DB " (C)2017 <EMAIL>, JAKUB NONIEWICZ AKA MONSTER/GDC"
DB " CREDITS: CODE: MONSTER/GDC, IDEA: <NAME> "
DB "WRITTEN 4 SPECCY.PL PARTY 2018.04 "
|
src/geste.ads | Fabien-Chouteau/GESTE | 13 | 13609 | <reponame>Fabien-Chouteau/GESTE<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- GESTE --
-- --
-- Copyright (C) 2018 <NAME> --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with GESTE_Config; use GESTE_Config;
package GESTE is
type Pix_Point is record
X, Y : Integer;
end record;
type Pix_Rect is record
TL : Pix_Point; -- Top Left
BR : Pix_Point; -- Bottom right
end record;
-- Palette --
type Palette_Type is array (Color_Index) of Output_Color;
type Palette_Ref is access constant Palette_Type;
No_Palette : constant Palette_Ref := null;
-- Tile --
type Tile is array (0 .. Tile_Size - 1,
0 .. Tile_Size - 1)
of Color_Index;
type Tile_Array is array (Tile_Index range <>) of Tile;
type Tile_Array_Ref is access constant Tile_Array;
-- Collisions --
type Tile_Collisions is array (0 .. Tile_Size - 1,
0 .. Tile_Size - 1)
of Boolean;
type Tile_Collisions_Array is array (Tile_Index range <>)
of Tile_Collisions;
type Tile_Collisions_Array_Ref is access constant Tile_Collisions_Array;
No_Collisions : constant Tile_Collisions_Array_Ref := null;
-- Layer --
type Layer_Type is abstract tagged limited private;
function Position (This : Layer_Type) return Pix_Point;
function Width (This : Layer_Type) return Natural;
function Height (This : Layer_Type) return Natural;
procedure Move (This : in out Layer_Type;
Pt : Pix_Point);
procedure Enable_Collisions (This : in out Layer_Type;
Enable : Boolean := True);
package Layer is
subtype Instance is Layer_Type;
subtype Class is Instance'Class;
type Ref is access all Class;
type Const_Ref is access constant Class;
end Layer;
-- Engine --
type Layer_Priority is new Natural;
procedure Add (L : not null Layer.Ref;
Priority : Layer_Priority);
procedure Remove (L : not null Layer.Ref);
procedure Remove_All;
subtype Output_Buffer_Index is Natural;
type Output_Buffer is array (Output_Buffer_Index range <>) of Output_Color;
type Push_Pixels_Proc is
access procedure (Buffer : Output_Buffer);
type Set_Drawing_Area_Proc is access procedure (Area : Pix_Rect);
procedure Render_Window (Window : Pix_Rect;
Background : Output_Color;
Buffer : in out Output_Buffer;
Push_Pixels : Push_Pixels_Proc;
Set_Drawing_Area : Set_Drawing_Area_Proc);
procedure Render_All (Screen_Rect : Pix_Rect;
Background : Output_Color;
Buffer : in out Output_Buffer;
Push_Pixels : Push_Pixels_Proc;
Set_Drawing_Area : Set_Drawing_Area_Proc);
procedure Render_Dirty (Screen_Rect : Pix_Rect;
Background : Output_Color;
Buffer : in out Output_Buffer;
Push_Pixels : Push_Pixels_Proc;
Set_Drawing_Area : Set_Drawing_Area_Proc);
-- Collisions --
function Collides (Pt : Pix_Point) return Boolean;
private
subtype Coordinate is Integer;
subtype Lenght is Natural;
-- Layer --
type Layer_Type is abstract tagged limited record
Next : Layer.Ref := null;
Prev : Layer.Ref := null;
Prio : Layer_Priority := 0;
Pt : Pix_Point := (0, 0);
A_Width : Natural := 0;
A_Height : Natural := 0;
Dirty : Boolean := True;
Last_Pt : Pix_Point := (0, 0);
Collisions_Enabled : Boolean := False;
end record;
function Pix (This : Layer_Type;
Unused_X, Unused_Y : Integer)
return Output_Color
is (Transparent);
function Collides (This : Layer_Type;
Unused_X, Unused_Y : Integer)
return Boolean
is (False);
procedure Update_Size (This : in out Layer_Type)
is null;
Layer_List : Layer.Ref := null;
end GESTE;
|
Local.agda | fangyi-zhou/mpst-in-agda | 1 | 9999 | open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl)
open import Data.Fin using (Fin)
open import Data.Nat using (ℕ)
open import Data.Product using (_×_; _,_)
open import Data.Vec using (Vec; lookup; _[_]≔_)
open import Common
data Local (n : ℕ) : Set where
endL : Local n
sendSingle recvSingle : Fin n -> Label -> Local n -> Local n
private
variable
n : ℕ
p p′ q : Fin n
l l′ : Label
lSub lSub′ : Local n
endL≢sendSingle : ∀ { lSub } -> endL {n} ≢ sendSingle q l lSub
endL≢sendSingle ()
endL≢recvSingle : ∀ { lSub } -> endL {n} ≢ recvSingle q l lSub
endL≢recvSingle ()
sendSingle-injective :
sendSingle {n} p l lSub ≡ sendSingle p′ l′ lSub′
-> p ≡ p′ × l ≡ l′ × lSub ≡ lSub′
sendSingle-injective refl = refl , refl , refl
recvSingle-injective :
recvSingle {n} p l lSub ≡ recvSingle p′ l′ lSub′
-> p ≡ p′ × l ≡ l′ × lSub ≡ lSub′
recvSingle-injective refl = refl , refl , refl
Configuration : ℕ -> Set
Configuration n = Vec (Local n) n
data _-_→l_ {n : ℕ} : (Fin n × Local n) -> Action n -> (Fin n × Local n) -> Set where
→l-send :
∀ { lp lpSub }
-> (p : Fin n)
-> lp ≡ sendSingle q l lpSub
-> (p≢q : p ≢ q)
-> (p , lp) - (action p q p≢q l) →l (p , lpSub)
→l-recv :
∀ { lp lpSub }
-> (p : Fin n)
-> lp ≡ recvSingle q l lpSub
-> (q≢p : q ≢ p)
-> (p , lp) - (action q p q≢p l) →l (p , lpSub)
data _-_→c_ {n : ℕ} : Configuration n -> Action n -> Configuration n -> Set where
→c-comm :
∀ { lp lp′ lq lq′ c′ p≢q-p p≢q-q }
-> (c : Configuration n)
-> (p≢q : p ≢ q)
-> lp ≡ lookup c p
-> lq ≡ lookup c q
-> c′ ≡ c [ p ]≔ lp′ [ q ]≔ lq′
-> (p , lp) - (action p q p≢q-p l) →l (p , lp′)
-> (q , lq) - (action p q p≢q-q l) →l (q , lq′)
-> c - (action p q p≢q l) →c c′
|
src/common/septum.adb | jquorning/septum | 236 | 21397 | -------------------------------------------------------------------------------
-- Copyright 2021, The Septum Developers (see AUTHORS file)
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
-- http://www.apache.org/licenses/LICENSE-2.0
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-------------------------------------------------------------------------------
with Ada.Command_Line;
with Ada.Exceptions;
with Ada.Text_IO;
with GNAT.Traceback.Symbolic;
with SP.Config;
with SP.Interactive;
procedure Septum is
use Ada.Text_IO;
begin
-- Look for a single "--version" flag
if Ada.Command_Line.Argument_Count = 1
and then Ada.Command_Line.Argument (1) = "--version"
then
Put_Line (SP.Version);
return;
end if;
-- Create a local configuration file in the current directory.
if Ada.Command_Line.Argument_Count = 1
and then Ada.Command_Line.Argument (1) = "init"
then
SP.Config.Create_Local_Config;
return;
end if;
-- Don't recognize any other arguments.
if Ada.Command_Line.Argument_Count /= 0 then
Put_Line ("Unrecognized command line arguments.");
New_Line;
Put_Line ("Usage: septum --version print program version");
Put_Line (" septum init creates config directory with empty config");
Put_Line (" septum run interactive search mode");
return;
end if;
SP.Interactive.Main;
exception
when Err : others =>
Put_Line (Ada.Exceptions.Exception_Information (Err));
Put_Line ("Exception traceback: " & GNAT.Traceback.Symbolic.Symbolic_Traceback (Err));
end Septum;
|
libsrc/_DEVELOPMENT/z180/c/sdcc/z180_otdmr.asm | jpoikela/z88dk | 640 | 26691 | <filename>libsrc/_DEVELOPMENT/z180/c/sdcc/z180_otdmr.asm
; void *z180_otdmr(void *src, uint8_t port, uint8_t num)
SECTION code_clib
SECTION code_z180
PUBLIC _z180_otdmr
EXTERN asm_z180_otdmr
_z180_otdmr:
pop af
pop hl
pop bc
push bc
push hl
push af
jp asm_z180_otdmr
|
programs/oeis/104/A104150.asm | karttu/loda | 0 | 81570 | <reponame>karttu/loda<filename>programs/oeis/104/A104150.asm
; A104150: Shifted factorial numbers: a(0)=0, a(n) = (n-1)!.
; 0,1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,355687428096000,6402373705728000
sub $0,1
fac $0
add $0,1
trn $0,1
mov $1,$0
|
src/fot/LTC-PCF/Data/Nat/Divisibility/By0/Properties.agda | asr/fotc | 11 | 5135 | ------------------------------------------------------------------------------
-- Properties of the divisibility relation
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module LTC-PCF.Data.Nat.Divisibility.By0.Properties where
open import Common.FOL.Relation.Binary.EqReasoning
open import LTC-PCF.Base
open import LTC-PCF.Base.Properties
open import LTC-PCF.Data.Nat
open import LTC-PCF.Data.Nat.Properties
open import LTC-PCF.Data.Nat.Divisibility.By0
open import LTC-PCF.Data.Nat.Inequalities
open import LTC-PCF.Data.Nat.Inequalities.Properties
open import LTC-PCF.Data.Nat.Properties
open import LTC-PCF.Data.Nat.UnaryNumbers
open import LTC-PCF.Data.Nat.UnaryNumbers.Totality
------------------------------------------------------------------------------
-- Any positive number divides 0.
S∣0 : ∀ {n} → N n → succ₁ n ∣ zero
S∣0 {n} Nn = zero , nzero , sym (*-leftZero (succ₁ n))
-- 0 divides 0.
0∣0 : zero ∣ zero
0∣0 = zero , nzero , sym (*-leftZero zero)
-- The divisibility relation is reflexive.
∣-refl : ∀ {n} → N n → n ∣ n
∣-refl {n} Nn = [1] , 1-N , sym (*-leftIdentity Nn)
-- If x divides y and z then x divides y ∸ z.
x∣y→x∣z→x∣y∸z-helper : ∀ {m n o k k'} → N m → N k → N k' →
n ≡ k * m →
o ≡ k' * m →
n ∸ o ≡ (k ∸ k') * m
x∣y→x∣z→x∣y∸z-helper Nm Nk Nk' refl refl = sym (*∸-leftDistributive Nk Nk' Nm)
x∣y→x∣z→x∣y∸z : ∀ {m n o} → N m → N n → N o → m ∣ n → m ∣ o → m ∣ n ∸ o
x∣y→x∣z→x∣y∸z Nm Nn No (k , Nk , h₁) (k' , Nk' , h₂) =
k ∸ k' , ∸-N Nk Nk' , x∣y→x∣z→x∣y∸z-helper Nm Nk Nk' h₁ h₂
-- If x divides y and z then x divides y + z.
x∣y→x∣z→x∣y+z-helper : ∀ {m n o k k'} → N m → N k → N k' →
n ≡ k * m →
o ≡ k' * m →
n + o ≡ (k + k') * m
x∣y→x∣z→x∣y+z-helper Nm Nk Nk' refl refl = sym (*+-leftDistributive Nk Nk' Nm)
x∣y→x∣z→x∣y+z : ∀ {m n o} → N m → N n → N o → m ∣ n → m ∣ o → m ∣ n + o
x∣y→x∣z→x∣y+z Nm Nn No (k , Nk , h₁) (k' , Nk' , h₂) =
k + k' , +-N Nk Nk' , x∣y→x∣z→x∣y+z-helper Nm Nk Nk' h₁ h₂
-- If x divides y and y is positive, then x ≤ y.
x∣S→x≤S : ∀ {m n} → N m → N n → m ∣ (succ₁ n) → m ≤ succ₁ n
x∣S→x≤S {m} Nm Nn (.zero , nzero , Sn≡0*m) =
⊥-elim (0≢S (trans (sym (*-leftZero m)) (sym Sn≡0*m)))
x∣S→x≤S {m} Nm Nn (.(succ₁ k) , nsucc {k} Nk , Sn≡Sk*m) =
subst (λ t₁ → m ≤ t₁)
(sym Sn≡Sk*m)
(subst (λ t₂ → m ≤ t₂)
(sym (*-Sx k m))
(x≤x+y Nm (*-N Nk Nm)))
0∣x→x≡0 : ∀ {m} → N m → zero ∣ m → m ≡ zero
0∣x→x≡0 nzero _ = refl
0∣x→x≡0 (nsucc {m} Nm) (k , Nk , Sm≡k*0) =
⊥-elim (0≢S (trans (sym (*-leftZero k))
(trans (*-comm nzero Nk) (sym Sm≡k*0))))
|
test/asset/agda-stdlib-1.0/Codata/Colist.agda | omega12345/agda-mode | 0 | 11857 | <reponame>omega12345/agda-mode
------------------------------------------------------------------------
-- The Agda standard library
--
-- The Colist type and some operations
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe --sized-types #-}
module Codata.Colist where
open import Size
open import Data.Unit
open import Data.Nat.Base
open import Data.Product using (_×_ ; _,_)
open import Data.These using (These; this; that; these)
open import Data.Maybe using (Maybe; nothing; just)
open import Data.List.Base using (List; []; _∷_)
open import Data.List.NonEmpty using (List⁺; _∷_)
open import Data.Vec as Vec using (Vec; []; _∷_)
open import Data.BoundedVec as BVec using (BoundedVec)
open import Function
open import Codata.Thunk using (Thunk; force)
open import Codata.Conat as Conat using (Conat ; zero ; suc)
open import Codata.Cowriter as CW using (Cowriter; _∷_)
open import Codata.Delay as Delay using (Delay ; now ; later)
open import Codata.Stream using (Stream ; _∷_)
data Colist {a} (A : Set a) (i : Size) : Set a where
[] : Colist A i
_∷_ : A → Thunk (Colist A) i → Colist A i
module _ {w a} {W : Set w} {A : Set a} where
------------------------------------------------------------------------
-- Relationship to Cowriter.
fromCowriter : ∀ {i} → Cowriter W A i → Colist W i
fromCowriter CW.[ _ ] = []
fromCowriter (w ∷ ca) = w ∷ λ where .force → fromCowriter (ca .force)
module _ {a} {A : Set a} where
toCowriter : ∀ {i} → Colist A i → Cowriter A ⊤ i
toCowriter [] = CW.[ _ ]
toCowriter (a ∷ as) = a ∷ λ where .force → toCowriter (as .force)
------------------------------------------------------------------------
-- Basic functions.
[_] : A → Colist A ∞
[ a ] = a ∷ λ where .force → []
length : ∀ {i} → Colist A i → Conat i
length [] = zero
length (x ∷ xs) = suc λ where .force → length (xs .force)
replicate : ∀ {i} → Conat i → A → Colist A i
replicate zero a = []
replicate (suc n) a = a ∷ λ where .force → replicate (n .force) a
infixr 5 _++_ _⁺++_
_++_ : ∀ {i} → Colist A i → Colist A i → Colist A i
[] ++ ys = ys
(x ∷ xs) ++ ys = x ∷ λ where .force → xs .force ++ ys
lookup : ℕ → Colist A ∞ → Maybe A
lookup n [] = nothing
lookup zero (a ∷ as) = just a
lookup (suc n) (a ∷ as) = lookup n (as .force)
colookup : ∀ {i} → Conat i → Colist A i → Delay (Maybe A) i
colookup n [] = now nothing
colookup zero (a ∷ as) = now (just a)
colookup (suc n) (a ∷ as) =
later λ where .force → colookup (n .force) (as .force)
take : ∀ (n : ℕ) → Colist A ∞ → BoundedVec A n
take zero xs = BVec.[]
take n [] = BVec.[]
take (suc n) (x ∷ xs) = x BVec.∷ take n (xs .force)
cotake : ∀ {i} → Conat i → Stream A i → Colist A i
cotake zero xs = []
cotake (suc n) (x ∷ xs) = x ∷ λ where .force → cotake (n .force) (xs .force)
fromList : List A → Colist A ∞
fromList [] = []
fromList (x ∷ xs) = x ∷ λ where .force → fromList xs
_⁺++_ : ∀ {i} → List⁺ A → Thunk (Colist A) i → Colist A i
(x ∷ xs) ⁺++ ys = x ∷ λ where .force → fromList xs ++ ys .force
fromStream : ∀ {i} → Stream A i → Colist A i
fromStream = cotake Conat.infinity
module _ {ℓ} {A : Set ℓ} where
chunksOf : (n : ℕ) → Colist A ∞ → Cowriter (Vec A n) (BoundedVec A n) ∞
chunksOf n = chunksOfAcc n id id module ChunksOf where
chunksOfAcc : ∀ {i} m →
-- We have two continuations but we are only ever going to use one.
-- If we had linear types, we would write the type using the & conjunction here.
(k≤ : BoundedVec A m → BoundedVec A n) →
(k≡ : Vec A m → Vec A n) →
-- Finally we chop up the input stream.
Colist A ∞ → Cowriter (Vec A n) (BoundedVec A n) i
chunksOfAcc zero k≤ k≡ as = k≡ [] ∷ λ where .force → chunksOfAcc n id id as
chunksOfAcc (suc k) k≤ k≡ [] = CW.[ k≤ BVec.[] ]
chunksOfAcc (suc k) k≤ k≡ (a ∷ as) =
chunksOfAcc k (k≤ ∘ (a BVec.∷_)) (k≡ ∘ (a ∷_)) (as .force)
module _ {a b} {A : Set a} {B : Set b} where
map : ∀ {i} (f : A → B) → Colist A i → Colist B i
map f [] = []
map f (a ∷ as) = f a ∷ λ where .force → map f (as .force)
unfold : ∀ {i} → (A → Maybe (A × B)) → A → Colist B i
unfold next seed with next seed
... | nothing = []
... | just (seed′ , b) = b ∷ λ where .force → unfold next seed′
scanl : ∀ {i} → (B → A → B) → B → Colist A i → Colist B i
scanl c n [] = n ∷ λ where .force → []
scanl c n (a ∷ as) = n ∷ λ where .force → scanl c (c n a) (as .force)
module _ {a b c} {A : Set a} {B : Set b} {C : Set c} where
alignWith : ∀ {i} → (These A B → C) → Colist A i → Colist B i → Colist C i
alignWith f [] bs = map (f ∘′ that) bs
alignWith f as@(_ ∷ _) [] = map (f ∘′ this) as
alignWith f (a ∷ as) (b ∷ bs) =
f (these a b) ∷ λ where .force → alignWith f (as .force) (bs .force)
zipWith : ∀ {i} → (A → B → C) → Colist A i → Colist B i → Colist C i
zipWith f [] bs = []
zipWith f as [] = []
zipWith f (a ∷ as) (b ∷ bs) =
f a b ∷ λ where .force → zipWith f (as .force) (bs .force)
module _ {a b} {A : Set a} {B : Set b} where
align : ∀ {i} → Colist A i → Colist B i → Colist (These A B) i
align = alignWith id
zip : ∀ {i} → Colist A i → Colist B i → Colist (A × B) i
zip = zipWith _,_
ap : ∀ {i} → Colist (A → B) i → Colist A i → Colist B i
ap = zipWith _$′_
|
src/arch/socs/stm32f439/Ada/soc-interrupts.ads | wookey-project/ewok-legacy | 0 | 12683 | <gh_stars>0
--
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
package soc.interrupts
with spark_mode => on
is
-------------------------------------
-- STM32F4xx interrupts and events --
-------------------------------------
type t_interrupt is
(ESTACK, -- 0
INT_RESET,
INT_NMI,
INT_HARDFAULT,
INT_MEMMANAGE,
INT_BUSFAULT, -- 5
INT_USAGEFAULT,
INT_VOID1,
INT_VOID2,
INT_VOID3,
INT_VOID4, -- 10
INT_SVC,
INT_DEBUGON,
INT_VOID5,
INT_PENDSV,
INT_SYSTICK, -- 15
INT_WWDG,
INT_PVD,
INT_TAMP_STAMP,
INT_RTC_WKUP,
INT_FLASH, -- 20
INT_RCC,
INT_EXTI0,
INT_EXTI1,
INT_EXTI2,
INT_EXTI3, -- 25
INT_EXTI4,
INT_DMA1_STREAM0,
INT_DMA1_STREAM1,
INT_DMA1_STREAM2,
INT_DMA1_STREAM3, -- 30
INT_DMA1_STREAM4,
INT_DMA1_STREAM5,
INT_DMA1_STREAM6,
INT_ADC,
INT_CAN1_TX, -- 35
INT_CAN1_RX0,
INT_CAN1_RX1,
INT_CAN1_SCE,
INT_EXTI9_5,
INT_TIM1_BRK_TIM9, -- 40
INT_TIM1_UP_TIM10,
INT_TIM1_TRG_COM_TIM11,
INT_TIM1_CC,
INT_TIM2,
INT_TIM3, -- 45
INT_TIM4,
INT_I2C1_EV,
INT_I2C1_ER,
INT_I2C2_EV,
INT_I2C2_ER, -- 50
INT_SPI1,
INT_SPI2,
INT_USART1,
INT_USART2,
INT_USART3, -- 55
INT_EXTI15_10,
INT_RTC_ALARM,
INT_OTG_FS_WKUP,
INT_TIM8_BRK_TIM12,
INT_TIM8_UP_TIM13, -- 60
INT_TIM8_TRG_COM_TIM14,
INT_TIM8_CC,
INT_DMA1_STREAM7,
INT_FSMC,
INT_SDIO, -- 65
INT_TIM5,
INT_SPI3,
INT_UART4,
INT_UART5,
INT_TIM6_DAC, -- 70
INT_TIM7,
INT_DMA2_STREAM0,
INT_DMA2_STREAM1,
INT_DMA2_STREAM2,
INT_DMA2_STREAM3, -- 75
INT_DMA2_STREAM4,
INT_ETH,
INT_ETH_WKUP,
INT_CAN2_TX,
INT_CAN2_RX0, -- 80
INT_CAN2_RX1,
INT_CAN2_SCE,
INT_OTG_FS,
INT_DMA2_STREAM5,
INT_DMA2_STREAM6, -- 85
INT_DMA2_STREAM7,
INT_USART6,
INT_I2C3_EV,
INT_I2C3_ER,
INT_OTG_HS_EP1_OUT, -- 90
INT_OTG_HS_EP1_IN,
INT_OTG_HS_WKUP,
INT_OTG_HS,
INT_DCMI,
INT_CRYP, -- 95
INT_HASH_RNG,
INT_FPU,
INT_98, INT_99,
INT_100, INT_101, INT_102, INT_103, INT_104, INT_105, INT_106, INT_107, INT_108, INT_109,
INT_110, INT_111, INT_112, INT_113, INT_114, INT_115, INT_116, INT_117, INT_118, INT_119,
INT_120, INT_121, INT_122, INT_123, INT_124, INT_125, INT_126, INT_127, INT_128, INT_129,
INT_130, INT_131, INT_132, INT_133, INT_134, INT_135, INT_136, INT_137, INT_138, INT_139,
INT_140, INT_141, INT_142, INT_143, INT_144, INT_145, INT_146, INT_147, INT_148, INT_149,
INT_150, INT_151, INT_152, INT_153, INT_154, INT_155, INT_156, INT_157, INT_158, INT_159,
INT_160, INT_161, INT_162, INT_163, INT_164, INT_165, INT_166, INT_167, INT_168, INT_169,
INT_170, INT_171, INT_172, INT_173, INT_174, INT_175, INT_176, INT_177, INT_178, INT_179,
INT_180, INT_181, INT_182, INT_183, INT_184, INT_185, INT_186, INT_187, INT_188, INT_189,
INT_190, INT_191, INT_192, INT_193, INT_194, INT_195, INT_196, INT_197, INT_198, INT_199,
INT_200, INT_201, INT_202, INT_203, INT_204, INT_205, INT_206, INT_207, INT_208, INT_209,
INT_210, INT_211, INT_212, INT_213, INT_214, INT_215, INT_216, INT_217, INT_218, INT_219,
INT_220, INT_221, INT_222, INT_223, INT_224, INT_225, INT_226, INT_227, INT_228, INT_229,
INT_230, INT_231, INT_232, INT_233, INT_234, INT_235, INT_236, INT_237, INT_238, INT_239,
INT_240, INT_241, INT_242, INT_243, INT_244, INT_245, INT_246, INT_247, INT_248, INT_249,
INT_250, INT_251, INT_252, INT_253, INT_254, INT_255)
with size => 8;
function get_interrupt return t_interrupt
with
inline,
convention => c,
export => true,
external_name => "interrupt_get_num";
end soc.interrupts;
|
benchmark/benchmark-sonic.sms.asm | maxim-zhao/bmp2tilecompressors | 12 | 168524 | ; { "technology": "Sonic 1", "extension": "soniccompr" }
.memorymap
defaultslot 0
slotsize $4000
slot 0 $0000
.endme
.rombankmap
bankstotal 1
banksize $4000
banks 1
.endro
.bank 0 slot 0
.org 0
ld hl,data
ld de,$4000
call Sonic1TileLoader_Decompress
ret ; ends the test
.define Sonic1TileLoaderMemory $c000
.block "decompressor"
.include "../decompressors/Sonic decompressor.asm"
.endb
data: .incbin "data.soniccompr"
|
gcc-gcc-7_3_0-release/gcc/ada/ceinfo.adb | best08618/asylo | 7 | 2676 | <filename>gcc-gcc-7_3_0-release/gcc/ada/ceinfo.adb
------------------------------------------------------------------------------
-- --
-- GNAT SYSTEM UTILITIES --
-- --
-- C E I N F O --
-- --
-- B o d y --
-- --
-- Copyright (C) 1998-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Check consistency of einfo.ads and einfo.adb. Checks that field name usage
-- is consistent, including comments mentioning fields.
-- Note that this is used both as a standalone program, and as a procedure
-- called by XEinfo. This raises an unhandled exception if it finds any
-- errors; we don't attempt any sophisticated error recovery.
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Spitbol; use GNAT.Spitbol;
with GNAT.Spitbol.Patterns; use GNAT.Spitbol.Patterns;
with GNAT.Spitbol.Table_VString;
procedure CEinfo is
package TV renames GNAT.Spitbol.Table_VString;
use TV;
Infil : File_Type;
Lineno : Natural := 0;
Err : exception;
-- Raised on error
Fieldnm : VString;
Accessfunc : VString;
Line : VString;
Fields : GNAT.Spitbol.Table_VString.Table (500);
-- Maps field names to underlying field access name
UC : constant Pattern := Any ("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
Fnam : constant Pattern := (UC & Break (' ')) * Fieldnm;
Field_Def : constant Pattern :=
"-- " & Fnam & " (" & Break (')') * Accessfunc;
Field_Ref : constant Pattern :=
" -- " & Fnam & Break ('(') & Len (1) &
Break (')') * Accessfunc;
Field_Com : constant Pattern := " -- " & Fnam & Span (' ') &
(Break (' ') or Rest) * Accessfunc;
Func_Hedr : constant Pattern := " function " & Fnam;
Func_Retn : constant Pattern := " return " & Break (' ') * Accessfunc;
Proc_Hedr : constant Pattern := " procedure " & Fnam;
Proc_Setf : constant Pattern := " Set_" & Break (' ') * Accessfunc;
procedure Next_Line;
-- Read next line trimmed from Infil into Line and bump Lineno
procedure Next_Line is
begin
Line := Get_Line (Infil);
Trim (Line);
Lineno := Lineno + 1;
end Next_Line;
-- Start of processing for CEinfo
begin
Anchored_Mode := True;
New_Line;
Open (Infil, In_File, "einfo.ads");
Put_Line ("Acquiring field names from spec");
loop
Next_Line;
-- Old format of einfo.ads
exit when Match (Line, " -- Access Kinds --");
-- New format of einfo.ads
exit when Match (Line, "-- Access Kinds --");
if Match (Line, Field_Def) then
Set (Fields, Fieldnm, Accessfunc);
end if;
end loop;
Put_Line ("Checking consistent references in spec");
loop
Next_Line;
exit when Match (Line, " -- Description of Defined");
end loop;
loop
Next_Line;
exit when Match (Line, " -- Component_Alignment Control");
if Match (Line, Field_Ref) then
if Accessfunc /= "synth"
and then
Accessfunc /= "special"
and then
Accessfunc /= Get (Fields, Fieldnm)
then
if Present (Fields, Fieldnm) then
Put_Line ("*** field name incorrect at line " & Lineno);
Put_Line (" found field " & Accessfunc);
Put_Line (" expecting field " & Get (Fields, Fieldnm));
else
Put_Line
("*** unknown field name " & Fieldnm & " at line " & Lineno);
end if;
raise Err;
end if;
end if;
end loop;
Close (Infil);
Open (Infil, In_File, "einfo.adb");
Lineno := 0;
Put_Line ("Check listing of fields in body");
loop
Next_Line;
exit when Match (Line, " -- Attribute Access Functions --");
if Match (Line, Field_Com)
and then Fieldnm /= "(unused)"
and then Accessfunc /= Get (Fields, Fieldnm)
then
if Present (Fields, Fieldnm) then
Put_Line ("*** field name incorrect at line " & Lineno);
Put_Line (" found field " & Accessfunc);
Put_Line (" expecting field " & Get (Fields, Fieldnm));
else
Put_Line
("*** unknown field name " & Fieldnm & " at line " & Lineno);
end if;
raise Err;
end if;
end loop;
Put_Line ("Check references in access routines in body");
loop
Next_Line;
exit when Match (Line, " -- Classification Functions --");
if Match (Line, Func_Hedr) then
null;
elsif Match (Line, Func_Retn)
and then Accessfunc /= Get (Fields, Fieldnm)
and then Fieldnm /= "Mechanism"
then
Put_Line ("*** incorrect field at line " & Lineno);
Put_Line (" found field " & Accessfunc);
Put_Line (" expecting field " & Get (Fields, Fieldnm));
raise Err;
end if;
end loop;
Put_Line ("Check references in set routines in body");
loop
Next_Line;
exit when Match (Line, " -- Attribute Set Procedures");
end loop;
loop
Next_Line;
exit when Match (Line, " ------------");
if Match (Line, Proc_Hedr) then
null;
elsif Match (Line, Proc_Setf)
and then Accessfunc /= Get (Fields, Fieldnm)
and then Fieldnm /= "Mechanism"
then
Put_Line ("*** incorrect field at line " & Lineno);
Put_Line (" found field " & Accessfunc);
Put_Line (" expecting field " & Get (Fields, Fieldnm));
raise Err;
end if;
end loop;
Close (Infil);
Put_Line ("All tests completed successfully, no errors detected");
end CEinfo;
|
4-high/gel/source/joint/gel-any_joint.adb | charlie5/lace | 20 | 8654 | <reponame>charlie5/lace<gh_stars>10-100
with
physics.Object;
package body gel.any_Joint
is
use Math;
---------
-- Forge
--
procedure define (Self : access Item; in_Space : in std_physics.Space.view;
Sprite_A, Sprite_B : access gel.Sprite.item'Class;
Frame_A, Frame_B : in Matrix_4x4)
is
A_Frame : aliased constant Matrix_4x4 := Frame_A;
B_Frame : aliased constant Matrix_4x4 := Frame_B;
type Joint_cast is access all gel.Joint.Item;
sprite_A_Solid,
sprite_B_Solid : std_Physics.Object.view;
begin
if Sprite_A /= null then sprite_A_Solid := std_Physics.Object.view (Sprite_A.Solid); end if;
if Sprite_B /= null then sprite_B_Solid := std_Physics.Object.view (Sprite_B.Solid); end if;
Joint.define (Joint_cast (Self), Sprite_A, Sprite_B); -- Define base class.
Self.Physics := in_Space.new_DoF6_Joint (sprite_A_Solid,
sprite_B_Solid,
A_Frame,
B_Frame);
end define;
procedure define (Self : access Item; in_Space : in std_physics.Space.view;
Sprite_A, Sprite_B : access gel.Sprite.item'Class;
pivot_Anchor : in Vector_3;
pivot_Axis : in Matrix_3x3)
is
use linear_Algebra_3D;
pivot_in_A : constant Vector_3 := Inverse (Sprite_A.Spin) * (pivot_Anchor - Sprite_A.Site);
pivot_in_B : constant Vector_3 := Inverse (Sprite_B.Spin) * (pivot_Anchor - Sprite_B.Site);
axis_in_A : constant Matrix_3x3 := Sprite_A.Spin * pivot_Axis;
axis_in_B : constant Matrix_3x3 := Sprite_B.Spin * pivot_Axis;
Frame_A : constant Matrix_4x4 := to_transform_Matrix (axis_in_A, pivot_in_A);
Frame_B : constant Matrix_4x4 := to_transform_Matrix (axis_in_B, pivot_in_B);
begin
Self.define (in_Space,
Sprite_A, Sprite_B,
Frame_A, Frame_B);
end define;
overriding
procedure destroy (Self : in out Item)
is
begin
raise Error with "TODO";
end destroy;
--------------
--- Attributes
--
overriding
function Frame_A (Self : in Item) return Matrix_4x4
is
begin
return Self.Physics.Frame_A;
end Frame_A;
overriding
function Frame_B (Self : in Item) return Matrix_4x4
is
begin
return Self.Physics.Frame_B;
end Frame_B;
overriding
procedure Frame_A_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.Physics.Frame_A_is (Now);
end Frame_A_is;
overriding
procedure Frame_B_is (Self : in out Item; Now : in Matrix_4x4)
is
begin
Self.Physics.Frame_B_is (Now);
end Frame_B_is;
overriding
function Physics (Self : in Item) return gel.joint.Physics_view
is
begin
return gel.joint.Physics_view (Self.Physics);
end Physics;
overriding
function Degrees_of_freedom (Self : in Item) return Joint.Degree_of_freedom
is
pragma unreferenced (Self);
begin
return 6;
end Degrees_of_freedom;
-- Bounds - limits the range of motion for a degree of freedom.
--
-- TODO: Use Radians type for angular bounds.
overriding
function is_Bound (Self : in Item; for_Degree : in joint.Degree_of_freedom) return Boolean
is
begin
if for_Degree in Sway .. Surge then
return False;
end if;
return Self.Physics.is_Limited (for_Degree);
end is_Bound;
overriding
function low_Bound (Self : access Item; for_Degree : in joint.Degree_of_freedom) return Real
is
begin
case for_Degree
is
when Sway .. Surge =>
raise Error with "Unhandled degree of freedom:" & for_Degree'Image;
when Pitch .. Roll =>
return Self.Physics.lower_Limit (for_Degree);
end case;
end low_Bound;
overriding
procedure low_Bound_is (Self : access Item; for_Degree : in Joint.Degree_of_freedom;
Now : in Real)
is
begin
Self.Physics.lower_Limit_is (Now, for_Degree);
end low_Bound_is;
overriding
function high_Bound (Self : access Item; for_Degree : in Joint.Degree_of_freedom) return Real
is
begin
case for_Degree
is
when Sway .. Surge =>
raise Error with "Unhandled degree of freedom:" & for_Degree'Image;
when Pitch .. Roll =>
return Self.Physics.upper_Limit (for_Degree);
end case;
end high_Bound;
overriding
procedure high_Bound_is (Self : access Item; for_Degree : in Joint.Degree_of_freedom;
Now : in Real)
is
begin
Self.Physics.upper_Limit_is (Now, for_Degree);
end high_Bound_is;
----------
-- Extent
--
overriding
function Extent (Self : in Item; for_Degree : in Joint.Degree_of_freedom) return Real
is
begin
if for_Degree in Sway .. Surge
then
raise Error with "Unhandled degree of freedom:" & for_Degree'Image;
end if;
return Self.Physics.Extent (for_Degree);
end Extent;
------------------
-- Motor Velocity
--
overriding
procedure Velocity_is (Self : in Item; for_Degree : in Joint.Degree_of_freedom;
Now : in Real)
is
begin
Self.Physics.Velocity_is (Now, for_Degree);
end Velocity_is;
end gel.any_Joint;
|
src/lv-anim.ads | Fabien-Chouteau/ada-lvlg | 3 | 29432 | <filename>src/lv-anim.ads
with System;
with Interfaces.C.Extensions;
package Lv.Anim is
type Path_T is access function (Arg1 : System.Address) return Int32_T;
pragma Convention (C, Path_T);
type Fp_T is access procedure (Arg1 : System.Address; Arg2 : Int32_T);
pragma Convention (C, Fp_T);
type Cb_T is access procedure (Arg1 : System.Address);
pragma Convention (C, Cb_T);
type U_Lv_Anim_T is record
Var : System.Address;
Fp : Fp_T;
End_Cb : Cb_T;
Path : Path_T;
Start : aliased Int32_T;
C_End : aliased Int32_T;
Time : aliased Uint16_T;
Act_Time : aliased Int16_T;
Playback_Pause : aliased Uint16_T;
Repeat_Pause : aliased Uint16_T;
Playback : Extensions.Unsigned_1;
Repeat : Extensions.Unsigned_1;
Playback_Now : Extensions.Unsigned_1;
Has_Run : Extensions.Unsigned_1;
end record;
pragma Convention (C_Pass_By_Copy, U_Lv_Anim_T);
pragma Pack (U_Lv_Anim_T);
subtype Anim_T is U_Lv_Anim_T;
-- Init. the animation module
procedure Init;
-- Create an animation
-- @param p an initialized 'anim_t' variable. Not required after call.
procedure Create (A : access Anim_T);
-- Delete an animation for a variable with a given animatior function
-- @param var pointer to variable
-- @param fp a function pointer which is animating 'var',
-- or NULL to ignore it and delete all animation with 'var
-- @return true: at least 1 animation is deleted, false: no animation is deleted
function Del (Var : System.Address; Fp : Fp_T) return U_Bool;
-- Calculate the time of an animation with a given speed and the start and end values
-- @param speed speed of animation in unit/sec
-- @param start start value of the animation
-- @param end end value of the animation
-- @return the required time [ms] for the animation with the given parameters
function Speed_To_Time
(Speed : Uint16_T;
Start : Int32_T;
End_P : Int32_T) return Uint16_T;
-- Calculate the current value of an animation applying linear characteristic
-- @param a pointer to an animation
-- @return the current value to set
function Path_Linear (A : access constant Anim_T) return Int32_T;
-- Calculate the current value of an animation applying an "S" characteristic (cosine)
-- @param a pointer to an animation
-- @return the current value to set
function Path_Ease_In_Out
(A : access constant Anim_T) return Int32_T;
-- Calculate the current value of an animation applying step characteristic.
-- (Set end value on the end of the animation)
-- @param a pointer to an animation
-- @return the current value to set
function Path_Step (A : access constant Anim_T) return Int32_T;
-------------
-- Imports --
-------------
pragma Import (C, Init, "lv_anim_init");
pragma Import (C, Create, "lv_anim_create");
pragma Import (C, Del, "lv_anim_del");
pragma Import (C, Speed_To_Time, "lv_anim_speed_to_time");
pragma Import (C, Path_Linear, "lv_anim_path_linear");
pragma Import (C, Path_Ease_In_Out, "lv_anim_path_ease_in_out");
pragma Import (C, Path_Step, "lv_anim_path_step");
end Lv.Anim;
|
libsrc/_DEVELOPMENT/adt/ba_priority_queue/c/sdcc_iy/ba_priority_queue_destroy_fastcall.asm | jpoikela/z88dk | 640 | 93686 |
; void ba_priority_queue_destroy_fastcall(ba_priority_queue_t *q)
SECTION code_clib
SECTION code_adt_ba_priority_queue
PUBLIC _ba_priority_queue_destroy_fastcall
EXTERN asm_ba_priority_queue_destroy
defc _ba_priority_queue_destroy_fastcall = asm_ba_priority_queue_destroy
|
Exams/3-Individual_exam_3/src/nasm/separacao.nasm | FelixLuciano/Elements-of-Computing-Systems | 0 | 245360 | ;-------------------------------------
; separacao.nasm
; Leia o README.md para detalhes
;-------------------------------------
; Separa primeiro byte
leaw $10, %A ; Insere o endereço de RAM[10] no reg. A
movw (%A), %D ; Copia o valor de RAM[10] no reg. D
leaw $255, %A ; Copia o valor de máscara 0000000011111111 no reg. A
andw %A, %D, %D ; Registra o resultado da operação AND no reg. D
leaw $0, %A ; Insere o endereço de RAM[0] no reg. A
movw %D, (%A) ; Copia o valor do reg. D na RAM[0]
; Separa segundo byte
leaw $10, %A ; Insere o endereço de RAM[10] no reg. A
movw (%A), %D ; Copia o valor de RAM[10] no reg. D
leaw $65280, %A ; Copia o valor de máscara 1111111100000000 no reg. A
andw %A, %D, %D ; Registra o resultado da operação AND no reg. D
leaw $1, %A ; Insere o endereço de RAM[1] no reg. A
movw %D, (%A) ; Copia o valor do reg. D na RAM[1]
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0_notsx.log_21829_712.asm | ljhsiun2/medusa | 9 | 170142 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r14
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x17d26, %r10
nop
nop
nop
add %r14, %r14
mov $0x6162636465666768, %r13
movq %r13, %xmm2
and $0xffffffffffffffc0, %r10
movntdq %xmm2, (%r10)
nop
nop
nop
nop
nop
inc %rbp
lea addresses_A_ht+0x21d2, %rax
nop
nop
nop
nop
nop
xor %rbx, %rbx
mov $0x6162636465666768, %r12
movq %r12, %xmm5
vmovups %ymm5, (%rax)
nop
sub $43171, %r13
lea addresses_D_ht+0x8ed2, %r13
nop
nop
nop
and %rbp, %rbp
mov (%r13), %bx
nop
nop
nop
cmp %r14, %r14
lea addresses_WT_ht+0x9ad2, %rsi
lea addresses_WC_ht+0x109d2, %rdi
nop
nop
cmp %rax, %rax
mov $8, %rcx
rep movsw
nop
nop
cmp %r13, %r13
lea addresses_D_ht+0x7852, %rdi
nop
nop
dec %rbp
mov $0x6162636465666768, %r12
movq %r12, %xmm4
movups %xmm4, (%rdi)
nop
nop
nop
nop
nop
inc %rsi
lea addresses_A_ht+0x8d8c, %rbp
nop
nop
nop
xor %r14, %r14
mov (%rbp), %di
and $52345, %r10
lea addresses_WT_ht+0xb892, %r12
clflush (%r12)
nop
nop
nop
nop
nop
add $62586, %r10
movb $0x61, (%r12)
nop
xor $62886, %rcx
lea addresses_UC_ht+0x109d2, %rsi
nop
nop
nop
nop
nop
and %rcx, %rcx
mov (%rsi), %ax
nop
nop
nop
nop
and $32963, %rax
lea addresses_WT_ht+0x62b2, %r14
nop
nop
sub %rdi, %rdi
mov (%r14), %rsi
nop
nop
nop
nop
inc %r13
lea addresses_UC_ht+0x127d2, %rsi
lea addresses_WT_ht+0x11dd2, %rdi
nop
nop
nop
nop
xor $7591, %rax
mov $30, %rcx
rep movsb
nop
nop
nop
dec %r10
lea addresses_D_ht+0xff8f, %rax
dec %rdi
mov (%rax), %r10
nop
nop
nop
nop
inc %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r14
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r15
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_PSE+0x75d2, %rsi
lea addresses_A+0x1f8f2, %rdi
and %r12, %r12
mov $99, %rcx
rep movsq
nop
nop
nop
nop
nop
sub %rsi, %rsi
// Store
lea addresses_D+0x13512, %rdx
sub %r12, %r12
movw $0x5152, (%rdx)
nop
nop
nop
dec %r12
// Store
lea addresses_UC+0x2fd2, %r8
nop
nop
xor %rsi, %rsi
movb $0x51, (%r8)
nop
nop
sub %rsi, %rsi
// Store
lea addresses_D+0xd5d2, %rdi
add %r8, %r8
mov $0x5152535455565758, %r15
movq %r15, (%rdi)
nop
nop
nop
nop
nop
cmp %rcx, %rcx
// Faulty Load
lea addresses_RW+0x125d2, %rdi
xor $51073, %r12
mov (%rdi), %r8w
lea oracles, %rcx
and $0xff, %r8
shlq $12, %r8
mov (%rcx,%r8,1), %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_PSE', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 1, 'NT': True, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 9}}
[Faulty Load]
{'src': {'type': 'addresses_RW', 'AVXalign': True, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 7}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 1, 'NT': False, 'same': False, 'congruent': 6}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': True}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
data/pokemon/evos_attacks_kanto.asm | AtmaBuster/pokeplat-gen2 | 6 | 95805 | SECTION "Evolutions and Attacks 1", ROMX
EvosAttacksPointers1::
dw BulbasaurEvosAttacks
dw IvysaurEvosAttacks
dw VenusaurEvosAttacks
dw CharmanderEvosAttacks
dw CharmeleonEvosAttacks
dw CharizardEvosAttacks
dw SquirtleEvosAttacks
dw WartortleEvosAttacks
dw BlastoiseEvosAttacks
dw CaterpieEvosAttacks
dw MetapodEvosAttacks
dw ButterfreeEvosAttacks
dw WeedleEvosAttacks
dw KakunaEvosAttacks
dw BeedrillEvosAttacks
dw PidgeyEvosAttacks
dw PidgeottoEvosAttacks
dw PidgeotEvosAttacks
dw RattataEvosAttacks
dw RaticateEvosAttacks
dw SpearowEvosAttacks
dw FearowEvosAttacks
dw EkansEvosAttacks
dw ArbokEvosAttacks
dw PikachuEvosAttacks
dw RaichuEvosAttacks
dw SandshrewEvosAttacks
dw SandslashEvosAttacks
dw NidoranFEvosAttacks
dw NidorinaEvosAttacks
dw NidoqueenEvosAttacks
dw NidoranMEvosAttacks
dw NidorinoEvosAttacks
dw NidokingEvosAttacks
dw ClefairyEvosAttacks
dw ClefableEvosAttacks
dw VulpixEvosAttacks
dw NinetalesEvosAttacks
dw JigglypuffEvosAttacks
dw WigglytuffEvosAttacks
dw ZubatEvosAttacks
dw GolbatEvosAttacks
dw OddishEvosAttacks
dw GloomEvosAttacks
dw VileplumeEvosAttacks
dw ParasEvosAttacks
dw ParasectEvosAttacks
dw VenonatEvosAttacks
dw VenomothEvosAttacks
dw DiglettEvosAttacks
dw DugtrioEvosAttacks
dw MeowthEvosAttacks
dw PersianEvosAttacks
dw PsyduckEvosAttacks
dw GolduckEvosAttacks
dw MankeyEvosAttacks
dw PrimeapeEvosAttacks
dw GrowlitheEvosAttacks
dw ArcanineEvosAttacks
dw PoliwagEvosAttacks
dw PoliwhirlEvosAttacks
dw PoliwrathEvosAttacks
dw AbraEvosAttacks
dw KadabraEvosAttacks
dw AlakazamEvosAttacks
dw MachopEvosAttacks
dw MachokeEvosAttacks
dw MachampEvosAttacks
dw BellsproutEvosAttacks
dw WeepinbellEvosAttacks
dw VictreebelEvosAttacks
dw TentacoolEvosAttacks
dw TentacruelEvosAttacks
dw GeodudeEvosAttacks
dw GravelerEvosAttacks
dw GolemEvosAttacks
dw PonytaEvosAttacks
dw RapidashEvosAttacks
dw SlowpokeEvosAttacks
dw SlowbroEvosAttacks
dw MagnemiteEvosAttacks
dw MagnetonEvosAttacks
dw FarfetchDEvosAttacks
dw DoduoEvosAttacks
dw DodrioEvosAttacks
dw SeelEvosAttacks
dw DewgongEvosAttacks
dw GrimerEvosAttacks
dw MukEvosAttacks
dw ShellderEvosAttacks
dw CloysterEvosAttacks
dw GastlyEvosAttacks
dw HaunterEvosAttacks
dw GengarEvosAttacks
dw OnixEvosAttacks
dw DrowzeeEvosAttacks
dw HypnoEvosAttacks
dw KrabbyEvosAttacks
dw KinglerEvosAttacks
dw VoltorbEvosAttacks
dw ElectrodeEvosAttacks
dw ExeggcuteEvosAttacks
dw ExeggutorEvosAttacks
dw CuboneEvosAttacks
dw MarowakEvosAttacks
dw HitmonleeEvosAttacks
dw HitmonchanEvosAttacks
dw LickitungEvosAttacks
dw KoffingEvosAttacks
dw WeezingEvosAttacks
dw RhyhornEvosAttacks
dw RhydonEvosAttacks
dw ChanseyEvosAttacks
dw TangelaEvosAttacks
dw KangaskhanEvosAttacks
dw HorseaEvosAttacks
dw SeadraEvosAttacks
dw GoldeenEvosAttacks
dw SeakingEvosAttacks
dw StaryuEvosAttacks
dw StarmieEvosAttacks
dw MrMimeEvosAttacks
dw ScytherEvosAttacks
dw JynxEvosAttacks
dw ElectabuzzEvosAttacks
dw MagmarEvosAttacks
dw PinsirEvosAttacks
dw TaurosEvosAttacks
dw MagikarpEvosAttacks
dw GyaradosEvosAttacks
dw LaprasEvosAttacks
dw DittoEvosAttacks
dw EeveeEvosAttacks
dw VaporeonEvosAttacks
dw JolteonEvosAttacks
dw FlareonEvosAttacks
dw PorygonEvosAttacks
dw OmanyteEvosAttacks
dw OmastarEvosAttacks
dw KabutoEvosAttacks
dw KabutopsEvosAttacks
dw AerodactylEvosAttacks
dw SnorlaxEvosAttacks
dw ArticunoEvosAttacks
dw ZapdosEvosAttacks
dw MoltresEvosAttacks
dw DratiniEvosAttacks
dw DragonairEvosAttacks
dw DragoniteEvosAttacks
dw MewtwoEvosAttacks
dw MewEvosAttacks
BulbasaurEvosAttacks:
dbbw EVOLVE_LEVEL, 16, IVYSAUR
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 3, GROWL
dbw 7, LEECH_SEED
dbw 9, VINE_WHIP
dbw 13, POISONPOWDER
dbw 13, SLEEP_POWDER
dbw 15, TAKE_DOWN
dbw 19, RAZOR_LEAF
dbw 21, SWEET_SCENT
dbw 25, GROWTH
dbw 27, DOUBLE_EDGE
dbw 31, WORRY_SEED
dbw 33, SYNTHESIS
dbw 37, SEED_BOMB
db 0 ; no more level-up moves
IvysaurEvosAttacks:
dbbw EVOLVE_LEVEL, 32, VENUSAUR
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, GROWL
dbw 1, LEECH_SEED
dbw 3, GROWL
dbw 7, LEECH_SEED
dbw 9, VINE_WHIP
dbw 13, POISONPOWDER
dbw 13, SLEEP_POWDER
dbw 15, TAKE_DOWN
dbw 20, RAZOR_LEAF
dbw 23, SWEET_SCENT
dbw 28, GROWTH
dbw 31, DOUBLE_EDGE
dbw 36, WORRY_SEED
dbw 39, SYNTHESIS
dbw 44, SOLARBEAM
db 0 ; no more level-up moves
VenusaurEvosAttacks:
db 0 ; no more evolutions
dbw 1, VINE_WHIP
dbw 1, TACKLE
dbw 1, GROWL
dbw 1, LEECH_SEED
dbw 3, GROWL
dbw 7, LEECH_SEED
dbw 9, VINE_WHIP
dbw 13, POISONPOWDER
dbw 13, SLEEP_POWDER
dbw 15, TAKE_DOWN
dbw 20, RAZOR_LEAF
dbw 23, SWEET_SCENT
dbw 28, GROWTH
dbw 31, DOUBLE_EDGE
dbw 32, PETAL_DANCE
dbw 39, WORRY_SEED
dbw 45, SYNTHESIS
dbw 53, SOLARBEAM
db 0 ; no more level-up moves
CharmanderEvosAttacks:
dbbw EVOLVE_LEVEL, 16, CHARMELEON
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, GROWL
dbw 7, EMBER
dbw 10, SMOKESCREEN
dbw 16, DRAGON_RAGE
dbw 19, SCARY_FACE
dbw 25, FIRE_FANG
dbw 28, SLASH
dbw 34, FLAMETHROWER
dbw 37, FIRE_SPIN
db 0 ; no more level-up moves
CharmeleonEvosAttacks:
dbbw EVOLVE_LEVEL, 36, CHARIZARD
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, GROWL
dbw 1, EMBER
dbw 7, EMBER
dbw 10, SMOKESCREEN
dbw 17, DRAGON_RAGE
dbw 21, SCARY_FACE
dbw 28, FIRE_FANG
dbw 32, SLASH
dbw 39, FLAMETHROWER
dbw 43, FIRE_SPIN
db 0 ; no more level-up moves
CharizardEvosAttacks:
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, GROWL
dbw 1, EMBER
dbw 1, SMOKESCREEN
dbw 1, DRAGON_CLAW
dbw 1, AIR_SLASH
dbw 1, SHADOW_CLAW
dbw 7, EMBER
dbw 10, SMOKESCREEN
dbw 17, DRAGON_RAGE
dbw 21, SCARY_FACE
dbw 28, FIRE_FANG
dbw 32, SLASH
dbw 36, WING_ATTACK
dbw 42, FLAMETHROWER
dbw 49, FIRE_SPIN
dbw 59, HEAT_WAVE
dbw 66, FLARE_BLITZ
db 0 ; no more level-up moves
SquirtleEvosAttacks:
dbbw EVOLVE_LEVEL, 16, WARTORTLE
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 4, TAIL_WHIP
dbw 7, BUBBLE
dbw 10, WITHDRAW
dbw 13, WATER_GUN
dbw 16, BITE
dbw 19, RAPID_SPIN
dbw 22, PROTECT
dbw 25, WATER_PULSE
dbw 28, AQUA_TAIL
dbw 31, SKULL_BASH
dbw 34, IRON_DEFENSE
dbw 37, RAIN_DANCE
dbw 40, HYDRO_PUMP
db 0 ; no more level-up moves
WartortleEvosAttacks:
dbbw EVOLVE_LEVEL, 36, BLASTOISE
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, TAIL_WHIP
dbw 1, BUBBLE
dbw 4, TAIL_WHIP
dbw 7, BUBBLE
dbw 10, WITHDRAW
dbw 13, WATER_GUN
dbw 16, BITE
dbw 20, RAPID_SPIN
dbw 24, PROTECT
dbw 28, WATER_PULSE
dbw 32, AQUA_TAIL
dbw 36, SKULL_BASH
dbw 40, IRON_DEFENSE
dbw 44, RAIN_DANCE
dbw 48, HYDRO_PUMP
db 0 ; no more level-up moves
BlastoiseEvosAttacks:
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, TAIL_WHIP
dbw 1, WITHDRAW
dbw 1, BUBBLE
dbw 1, FLASH_CANNON
dbw 4, TAIL_WHIP
dbw 7, BUBBLE
dbw 10, WITHDRAW
dbw 13, WATER_GUN
dbw 16, BITE
dbw 20, RAPID_SPIN
dbw 24, PROTECT
dbw 28, WATER_PULSE
dbw 32, AQUA_TAIL
dbw 39, SKULL_BASH
dbw 46, IRON_DEFENSE
dbw 53, RAIN_DANCE
dbw 60, HYDRO_PUMP
db 0 ; no more level-up moves
CaterpieEvosAttacks:
dbbw EVOLVE_LEVEL, 7, METAPOD
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, STRING_SHOT
dbw 15, BUG_BITE
db 0 ; no more level-up moves
MetapodEvosAttacks:
dbbw EVOLVE_LEVEL, 10, BUTTERFREE
db 0 ; no more evolutions
dbw 1, HARDEN
dbw 7, HARDEN
db 0 ; no more level-up moves
ButterfreeEvosAttacks:
db 0 ; no more evolutions
dbw 1, CONFUSION
dbw 10, CONFUSION
dbw 12, POISONPOWDER
dbw 12, STUN_SPORE
dbw 12, SLEEP_POWDER
dbw 16, GUST
dbw 18, SUPERSONIC
dbw 22, WHIRLWIND
dbw 24, PSYBEAM
dbw 28, SILVER_WIND
dbw 30, TAILWIND
dbw 34, SAFEGUARD
dbw 36, CAPTIVATE
dbw 40, BUG_BUZZ
db 0 ; no more level-up moves
WeedleEvosAttacks:
dbbw EVOLVE_LEVEL, 7, KAKUNA
db 0 ; no more evolutions
dbw 1, POISON_STING
dbw 1, STRING_SHOT
dbw 15, BUG_BITE
db 0 ; no more level-up moves
KakunaEvosAttacks:
dbbw EVOLVE_LEVEL, 10, BEEDRILL
db 0 ; no more evolutions
dbw 1, HARDEN
dbw 7, HARDEN
db 0 ; no more level-up moves
BeedrillEvosAttacks:
db 0 ; no more evolutions
dbw 1, FURY_ATTACK
dbw 10, FURY_ATTACK
dbw 13, FOCUS_ENERGY
dbw 16, TWINEEDLE
dbw 19, RAGE
dbw 22, PURSUIT
dbw 25, TOXIC_SPIKES
dbw 28, PIN_MISSILE
dbw 31, AGILITY
dbw 34, ASSURANCE
dbw 37, POISON_JAB
dbw 40, ENDEAVOR
db 0 ; no more level-up moves
PidgeyEvosAttacks:
dbbw EVOLVE_LEVEL, 18, PIDGEOTTO
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 5, SAND_ATTACK
dbw 9, GUST
dbw 13, QUICK_ATTACK
dbw 17, WHIRLWIND
dbw 21, TWISTER
dbw 25, FEATHERDANCE
dbw 29, AGILITY
dbw 33, WING_ATTACK
dbw 37, ROOST
dbw 41, TAILWIND
dbw 45, MIRROR_MOVE
dbw 49, AIR_SLASH
db 0 ; no more level-up moves
PidgeottoEvosAttacks:
dbbw EVOLVE_LEVEL, 36, PIDGEOT
db 0 ; no more evolutions
dbw 1, GUST
dbw 1, SAND_ATTACK
dbw 1, TACKLE
dbw 5, SAND_ATTACK
dbw 9, GUST
dbw 13, QUICK_ATTACK
dbw 17, WHIRLWIND
dbw 22, TWISTER
dbw 27, FEATHERDANCE
dbw 32, AGILITY
dbw 37, WING_ATTACK
dbw 42, ROOST
dbw 47, TAILWIND
dbw 52, MIRROR_MOVE
dbw 57, AIR_SLASH
db 0 ; no more level-up moves
PidgeotEvosAttacks:
db 0 ; no more evolutions
dbw 1, GUST
dbw 1, SAND_ATTACK
dbw 1, TACKLE
dbw 1, QUICK_ATTACK
dbw 5, SAND_ATTACK
dbw 9, GUST
dbw 13, QUICK_ATTACK
dbw 17, WHIRLWIND
dbw 22, TWISTER
dbw 27, FEATHERDANCE
dbw 32, AGILITY
dbw 38, WING_ATTACK
dbw 44, ROOST
dbw 50, TAILWIND
dbw 56, MIRROR_MOVE
dbw 62, AIR_SLASH
db 0 ; no more level-up moves
RattataEvosAttacks:
dbbw EVOLVE_LEVEL, 20, RATICATE
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, TAIL_WHIP
dbw 4, QUICK_ATTACK
dbw 7, FOCUS_ENERGY
dbw 10, BITE
dbw 13, PURSUIT
dbw 16, HYPER_FANG
dbw 19, SUCKER_PUNCH
dbw 22, CRUNCH
dbw 25, ASSURANCE
dbw 28, SUPER_FANG
dbw 31, DOUBLE_EDGE
dbw 34, ENDEAVOR
db 0 ; no more level-up moves
RaticateEvosAttacks:
db 0 ; no more evolutions
dbw 1, SWORDS_DANCE
dbw 1, TACKLE
dbw 1, TAIL_WHIP
dbw 1, QUICK_ATTACK
dbw 1, FOCUS_ENERGY
dbw 4, QUICK_ATTACK
dbw 7, FOCUS_ENERGY
dbw 10, BITE
dbw 13, PURSUIT
dbw 16, HYPER_FANG
dbw 19, SUCKER_PUNCH
dbw 20, SCARY_FACE
dbw 24, CRUNCH
dbw 29, ASSURANCE
dbw 34, SUPER_FANG
dbw 39, DOUBLE_EDGE
dbw 44, ENDEAVOR
db 0 ; no more level-up moves
SpearowEvosAttacks:
dbbw EVOLVE_LEVEL, 20, FEAROW
db 0 ; no more evolutions
dbw 1, GROWL
dbw 1, PECK
dbw 5, LEER
dbw 9, FURY_ATTACK
dbw 13, PURSUIT
dbw 17, AERIAL_ACE
dbw 21, MIRROR_MOVE
dbw 25, AGILITY
dbw 29, ASSURANCE
dbw 33, ROOST
dbw 37, DRILL_PECK
db 0 ; no more level-up moves
FearowEvosAttacks:
db 0 ; no more evolutions
dbw 1, FURY_ATTACK
dbw 1, LEER
dbw 1, GROWL
dbw 1, PECK
dbw 1, PLUCK
dbw 5, LEER
dbw 9, FURY_ATTACK
dbw 13, PURSUIT
dbw 17, AERIAL_ACE
dbw 23, MIRROR_MOVE
dbw 29, AGILITY
dbw 35, ASSURANCE
dbw 41, ROOST
dbw 47, DRILL_PECK
db 0 ; no more level-up moves
EkansEvosAttacks:
dbbw EVOLVE_LEVEL, 22, ARBOK
db 0 ; no more evolutions
dbw 1, WRAP
dbw 1, LEER
dbw 4, POISON_STING
dbw 9, BITE
dbw 12, GLARE
dbw 17, SCREECH
dbw 20, ACID
dbw 25, STOCKPILE
dbw 25, SPIT_UP
dbw 25, SWALLOW
dbw 28, MUD_BOMB
dbw 33, GASTRO_ACID
dbw 36, HAZE
dbw 41, GUNK_SHOT
db 0 ; no more level-up moves
ArbokEvosAttacks:
db 0 ; no more evolutions
dbw 1, WRAP
dbw 1, POISON_STING
dbw 1, LEER
dbw 1, BITE
dbw 1, THUNDER_FANG
dbw 1, ICE_FANG
dbw 1, FIRE_FANG
dbw 4, POISON_STING
dbw 9, BITE
dbw 12, GLARE
dbw 17, SCREECH
dbw 20, ACID
dbw 22, CRUNCH
dbw 28, STOCKPILE
dbw 28, SPIT_UP
dbw 28, SWALLOW
dbw 34, MUD_BOMB
dbw 42, GASTRO_ACID
dbw 48, HAZE
dbw 56, GUNK_SHOT
db 0 ; no more level-up moves
PikachuEvosAttacks:
dbbw EVOLVE_ITEM, THUNDERSTONE, RAICHU
db 0 ; no more evolutions
dbw 1, GROWL
dbw 1, THUNDERSHOCK
dbw 5, TAIL_WHIP
dbw 10, THUNDER_WAVE
dbw 13, QUICK_ATTACK
dbw 18, DOUBLE_TEAM
dbw 21, SLAM
dbw 26, THUNDERBOLT
dbw 29, FEINT
dbw 34, AGILITY
dbw 37, DISCHARGE
dbw 42, LIGHT_SCREEN
dbw 45, THUNDER
db 0 ; no more level-up moves
RaichuEvosAttacks:
db 0 ; no more evolutions
dbw 1, TAIL_WHIP
dbw 1, THUNDERSHOCK
dbw 1, THUNDERBOLT
dbw 1, QUICK_ATTACK
db 0 ; no more level-up moves
SandshrewEvosAttacks:
dbbw EVOLVE_LEVEL, 22, SANDSLASH
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 3, DEFENSE_CURL
dbw 7, SAND_ATTACK
dbw 9, POISON_STING
dbw 13, RAPID_SPIN
dbw 15, SWIFT
dbw 19, FURY_SWIPES
dbw 21, ROLLOUT
dbw 25, FURY_CUTTER
dbw 27, SAND_TOMB
dbw 31, SLASH
dbw 33, GYRO_BALL
dbw 37, SANDSTORM
db 0 ; no more level-up moves
SandslashEvosAttacks:
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, SAND_ATTACK
dbw 1, DEFENSE_CURL
dbw 3, DEFENSE_CURL
dbw 7, SAND_ATTACK
dbw 9, POISON_STING
dbw 13, RAPID_SPIN
dbw 15, SWIFT
dbw 19, FURY_SWIPES
dbw 21, ROLLOUT
dbw 22, CRUSH_CLAW
dbw 28, FURY_CUTTER
dbw 33, SAND_TOMB
dbw 40, SLASH
dbw 45, GYRO_BALL
dbw 52, SANDSTORM
db 0 ; no more level-up moves
NidoranFEvosAttacks:
dbbw EVOLVE_LEVEL, 16, NIDORINA
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, GROWL
dbw 7, TAIL_WHIP
dbw 9, DOUBLE_KICK
dbw 13, POISON_STING
dbw 19, FURY_SWIPES
dbw 21, BITE
dbw 25, HELPING_HAND
dbw 31, TOXIC_SPIKES
dbw 33, FLATTER
dbw 37, CRUNCH
dbw 43, CAPTIVATE
dbw 45, POISON_FANG
db 0 ; no more level-up moves
NidorinaEvosAttacks:
dbbw EVOLVE_ITEM, MOON_STONE, NIDOQUEEN
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, GROWL
dbw 7, TAIL_WHIP
dbw 9, DOUBLE_KICK
dbw 13, POISON_STING
dbw 20, FURY_SWIPES
dbw 23, BITE
dbw 28, HELPING_HAND
dbw 35, TOXIC_SPIKES
dbw 38, FLATTER
dbw 43, CRUNCH
dbw 50, CAPTIVATE
dbw 58, POISON_FANG
db 0 ; no more level-up moves
NidoqueenEvosAttacks:
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, DOUBLE_KICK
dbw 1, TAIL_WHIP
dbw 1, POISON_STING
dbw 23, BODY_SLAM
dbw 43, EARTH_POWER
dbw 58, SUPERPOWER
db 0 ; no more level-up moves
NidoranMEvosAttacks:
dbbw EVOLVE_LEVEL, 16, NIDORINO
db 0 ; no more evolutions
dbw 1, LEER
dbw 1, PECK
dbw 7, FOCUS_ENERGY
dbw 9, DOUBLE_KICK
dbw 13, POISON_STING
dbw 19, FURY_ATTACK
dbw 21, HORN_ATTACK
dbw 25, HELPING_HAND
dbw 31, TOXIC_SPIKES
dbw 33, FLATTER
dbw 37, POISON_JAB
dbw 43, CAPTIVATE
dbw 45, HORN_DRILL
db 0 ; no more level-up moves
NidorinoEvosAttacks:
dbbw EVOLVE_ITEM, MOON_STONE, NIDOKING
db 0 ; no more evolutions
dbw 1, LEER
dbw 1, PECK
dbw 7, FOCUS_ENERGY
dbw 9, DOUBLE_KICK
dbw 13, POISON_STING
dbw 20, FURY_ATTACK
dbw 23, HORN_ATTACK
dbw 28, HELPING_HAND
dbw 35, TOXIC_SPIKES
dbw 38, FLATTER
dbw 43, POISON_JAB
dbw 50, CAPTIVATE
dbw 58, HORN_DRILL
db 0 ; no more level-up moves
NidokingEvosAttacks:
db 0 ; no more evolutions
dbw 1, DOUBLE_KICK
dbw 1, POISON_STING
dbw 1, PECK
dbw 1, FOCUS_ENERGY
dbw 23, THRASH
dbw 43, EARTH_POWER
dbw 58, MEGAHORN
db 0 ; no more level-up moves
ClefairyEvosAttacks:
dbbw EVOLVE_ITEM, MOON_STONE, CLEFABLE
db 0 ; no more evolutions
dbw 1, POUND
dbw 1, GROWL
dbw 4, ENCORE
dbw 7, SING
dbw 10, DOUBLESLAP
dbw 13, DEFENSE_CURL
dbw 16, FOLLOW_ME
dbw 19, MINIMIZE
dbw 22, WAKE_UP_SLAP
dbw 25, COSMIC_POWER
dbw 28, LUCKY_CHANT
dbw 31, METRONOME
dbw 34, GRAVITY
dbw 37, MOONLIGHT
dbw 40, LIGHT_SCREEN
dbw 43, METEOR_MASH
dbw 46, HEALING_WISH
db 0 ; no more level-up moves
ClefableEvosAttacks:
db 0 ; no more evolutions
dbw 1, DOUBLESLAP
dbw 1, SING
dbw 1, MINIMIZE
dbw 1, METRONOME
db 0 ; no more level-up moves
VulpixEvosAttacks:
dbbw EVOLVE_ITEM, FIRE_STONE, NINETALES
db 0 ; no more evolutions
dbw 1, EMBER
dbw 4, TAIL_WHIP
dbw 7, ROAR
dbw 11, QUICK_ATTACK
dbw 14, WILL_O_WISP
dbw 17, CONFUSE_RAY
dbw 21, IMPRISON
dbw 24, FLAMETHROWER
dbw 27, SAFEGUARD
dbw 31, PAYBACK
dbw 34, FIRE_SPIN
dbw 37, CAPTIVATE
dbw 41, GRUDGE
dbw 44, EXTRASENSORY
dbw 47, FIRE_BLAST
db 0 ; no more level-up moves
NinetalesEvosAttacks:
db 0 ; no more evolutions
dbw 1, EMBER
dbw 1, QUICK_ATTACK
dbw 1, CONFUSE_RAY
dbw 1, SAFEGUARD
dbw 1, NASTY_PLOT
db 0 ; no more level-up moves
JigglypuffEvosAttacks:
dbbw EVOLVE_ITEM, MOON_STONE, WIGGLYTUFF
db 0 ; no more evolutions
dbw 1, SING
dbw 5, DEFENSE_CURL
dbw 9, POUND
dbw 13, DISABLE
dbw 17, ROLLOUT
dbw 21, DOUBLESLAP
dbw 25, REST
dbw 29, BODY_SLAM
dbw 33, GYRO_BALL
dbw 37, WAKE_UP_SLAP
dbw 41, MIMIC
dbw 45, HYPER_VOICE
dbw 49, DOUBLE_EDGE
db 0 ; no more level-up moves
WigglytuffEvosAttacks:
db 0 ; no more evolutions
dbw 1, DOUBLESLAP
dbw 1, SING
dbw 1, DISABLE
dbw 1, DEFENSE_CURL
db 0 ; no more level-up moves
ZubatEvosAttacks:
dbbw EVOLVE_LEVEL, 22, GOLBAT
db 0 ; no more evolutions
dbw 1, LEECH_LIFE
dbw 5, SUPERSONIC
dbw 9, ASTONISH
dbw 13, BITE
dbw 17, WING_ATTACK
dbw 21, CONFUSE_RAY
dbw 25, AIR_CUTTER
dbw 29, MEAN_LOOK
dbw 33, POISON_FANG
dbw 37, HAZE
dbw 41, AIR_SLASH
db 0 ; no more level-up moves
GolbatEvosAttacks:
dbbw EVOLVE_HAPPINESS, TR_ANYTIME, CROBAT
db 0 ; no more evolutions
dbw 1, SUPERSONIC
dbw 1, SCREECH
dbw 1, LEECH_LIFE
dbw 1, ASTONISH
dbw 5, SUPERSONIC
dbw 9, ASTONISH
dbw 13, BITE
dbw 17, WING_ATTACK
dbw 21, CONFUSE_RAY
dbw 27, AIR_CUTTER
dbw 33, MEAN_LOOK
dbw 39, POISON_FANG
dbw 45, HAZE
dbw 51, AIR_SLASH
db 0 ; no more level-up moves
OddishEvosAttacks:
dbbw EVOLVE_LEVEL, 21, GLOOM
db 0 ; no more evolutions
dbw 1, ABSORB
dbw 5, SWEET_SCENT
dbw 9, ACID
dbw 13, POISONPOWDER
dbw 15, STUN_SPORE
dbw 17, SLEEP_POWDER
dbw 21, MEGA_DRAIN
dbw 25, LUCKY_CHANT
dbw 29, NATURAL_GIFT
dbw 33, MOONLIGHT
dbw 37, GIGA_DRAIN
dbw 41, PETAL_DANCE
db 0 ; no more level-up moves
GloomEvosAttacks:
dbbw EVOLVE_ITEM, LEAF_STONE, VILEPLUME
dbbw EVOLVE_ITEM, SUN_STONE, BELLOSSOM
db 0 ; no more evolutions
dbw 1, ACID
dbw 1, ABSORB
dbw 1, SWEET_SCENT
dbw 5, SWEET_SCENT
dbw 9, ACID
dbw 13, POISONPOWDER
dbw 15, STUN_SPORE
dbw 17, SLEEP_POWDER
dbw 23, MEGA_DRAIN
dbw 29, LUCKY_CHANT
dbw 35, NATURAL_GIFT
dbw 41, MOONLIGHT
dbw 47, GIGA_DRAIN
dbw 53, PETAL_DANCE
db 0 ; no more level-up moves
VileplumeEvosAttacks:
db 0 ; no more evolutions
dbw 1, MEGA_DRAIN
dbw 1, POISONPOWDER
dbw 1, STUN_SPORE
dbw 1, AROMATHERAPY
dbw 53, PETAL_DANCE
dbw 65, SOLARBEAM
db 0 ; no more level-up moves
ParasEvosAttacks:
dbbw EVOLVE_LEVEL, 24, PARASECT
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 6, POISONPOWDER
dbw 6, STUN_SPORE
dbw 11, LEECH_LIFE
dbw 17, SPORE
dbw 22, SLASH
dbw 27, GROWTH
dbw 33, GIGA_DRAIN
dbw 38, AROMATHERAPY
dbw 43, X_SCISSOR
db 0 ; no more level-up moves
ParasectEvosAttacks:
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, POISONPOWDER
dbw 1, STUN_SPORE
dbw 1, LEECH_LIFE
dbw 1, CROSS_POISON
dbw 6, POISONPOWDER
dbw 6, STUN_SPORE
dbw 11, LEECH_LIFE
dbw 17, SPORE
dbw 22, SLASH
dbw 30, GROWTH
dbw 39, GIGA_DRAIN
dbw 47, AROMATHERAPY
dbw 55, X_SCISSOR
db 0 ; no more level-up moves
VenonatEvosAttacks:
dbbw EVOLVE_LEVEL, 31, VENOMOTH
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, DISABLE
dbw 1, FORESIGHT
dbw 5, SUPERSONIC
dbw 11, CONFUSION
dbw 13, POISONPOWDER
dbw 17, LEECH_LIFE
dbw 23, STUN_SPORE
dbw 25, PSYBEAM
dbw 29, SLEEP_POWDER
dbw 35, SIGNAL_BEAM
dbw 37, ZEN_HEADBUTT
dbw 41, POISON_FANG
dbw 47, PSYCHIC_M
db 0 ; no more level-up moves
VenomothEvosAttacks:
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, SUPERSONIC
dbw 1, DISABLE
dbw 1, FORESIGHT
dbw 1, SILVER_WIND
dbw 5, SUPERSONIC
dbw 11, CONFUSION
dbw 13, POISONPOWDER
dbw 17, LEECH_LIFE
dbw 23, STUN_SPORE
dbw 25, PSYBEAM
dbw 29, SLEEP_POWDER
dbw 31, GUST
dbw 37, SIGNAL_BEAM
dbw 41, ZEN_HEADBUTT
dbw 47, POISON_FANG
dbw 55, PSYCHIC_M
dbw 59, BUG_BUZZ
db 0 ; no more level-up moves
DiglettEvosAttacks:
dbbw EVOLVE_LEVEL, 26, DUGTRIO
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, SAND_ATTACK
dbw 4, GROWL
dbw 7, ASTONISH
dbw 12, MAGNITUDE
dbw 15, MUD_SLAP
dbw 18, DIG
dbw 23, SUCKER_PUNCH
dbw 26, EARTH_POWER
dbw 29, MUD_BOMB
dbw 34, SLASH
dbw 37, EARTHQUAKE
dbw 40, FISSURE
db 0 ; no more level-up moves
DugtrioEvosAttacks:
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, SAND_ATTACK
dbw 1, GROWL
dbw 1, TRI_ATTACK
dbw 1, NIGHT_SLASH
dbw 4, GROWL
dbw 7, ASTONISH
dbw 12, MAGNITUDE
dbw 15, MUD_SLAP
dbw 18, DIG
dbw 23, SUCKER_PUNCH
dbw 26, SAND_TOMB
dbw 28, EARTH_POWER
dbw 33, MUD_BOMB
dbw 40, SLASH
dbw 45, EARTHQUAKE
dbw 50, FISSURE
db 0 ; no more level-up moves
MeowthEvosAttacks:
dbbw EVOLVE_LEVEL, 28, PERSIAN
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, GROWL
dbw 6, BITE
dbw 9, FAKE_OUT
dbw 14, FURY_SWIPES
dbw 17, SCREECH
dbw 22, FAINT_ATTACK
dbw 25, TAUNT
dbw 30, PAY_DAY
dbw 33, SLASH
dbw 38, NASTY_PLOT
dbw 41, ASSURANCE
dbw 46, CAPTIVATE
dbw 49, NIGHT_SLASH
dbw 54, FEINT
db 0 ; no more level-up moves
PersianEvosAttacks:
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, BITE
dbw 1, GROWL
dbw 1, FAKE_OUT
dbw 1, SWITCHEROO
dbw 6, BITE
dbw 9, FAKE_OUT
dbw 14, FURY_SWIPES
dbw 17, SCREECH
dbw 22, FAINT_ATTACK
dbw 25, TAUNT
dbw 32, POWER_GEM
dbw 37, SLASH
dbw 44, NASTY_PLOT
dbw 49, ASSURANCE
dbw 56, CAPTIVATE
dbw 61, NIGHT_SLASH
dbw 68, FEINT
db 0 ; no more level-up moves
PsyduckEvosAttacks:
dbbw EVOLVE_LEVEL, 33, GOLDUCK
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, WATER_SPORT
dbw 5, TAIL_WHIP
dbw 9, WATER_GUN
dbw 14, DISABLE
dbw 18, CONFUSION
dbw 22, WATER_PULSE
dbw 27, FURY_SWIPES
dbw 31, SCREECH
dbw 35, PSYCH_UP
dbw 40, ZEN_HEADBUTT
dbw 44, AMNESIA
dbw 48, HYDRO_PUMP
db 0 ; no more level-up moves
GolduckEvosAttacks:
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, TAIL_WHIP
dbw 1, WATER_GUN
dbw 1, WATER_SPORT
dbw 1, AQUA_JET
dbw 5, TAIL_WHIP
dbw 9, WATER_GUN
dbw 14, DISABLE
dbw 18, CONFUSION
dbw 22, WATER_PULSE
dbw 27, FURY_SWIPES
dbw 31, SCREECH
dbw 37, PSYCH_UP
dbw 44, ZEN_HEADBUTT
dbw 50, AMNESIA
dbw 56, HYDRO_PUMP
db 0 ; no more level-up moves
MankeyEvosAttacks:
dbbw EVOLVE_LEVEL, 28, PRIMEAPE
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, LEER
dbw 1, LOW_KICK
dbw 1, FOCUS_ENERGY
dbw 1, COVET
dbw 9, FURY_SWIPES
dbw 13, KARATE_CHOP
dbw 17, SEISMIC_TOSS
dbw 21, SCREECH
dbw 25, ASSURANCE
dbw 33, SWAGGER
dbw 37, CROSS_CHOP
dbw 41, THRASH
dbw 45, PUNISHMENT
dbw 49, CLOSE_COMBAT
db 0 ; no more level-up moves
PrimeapeEvosAttacks:
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, LEER
dbw 1, LOW_KICK
dbw 1, FOCUS_ENERGY
dbw 1, FLING
dbw 9, FURY_SWIPES
dbw 13, KARATE_CHOP
dbw 17, SEISMIC_TOSS
dbw 21, SCREECH
dbw 25, ASSURANCE
dbw 28, RAGE
dbw 35, SWAGGER
dbw 41, CROSS_CHOP
dbw 47, THRASH
dbw 53, PUNISHMENT
dbw 59, CLOSE_COMBAT
db 0 ; no more level-up moves
GrowlitheEvosAttacks:
dbbw EVOLVE_ITEM, FIRE_STONE, ARCANINE
db 0 ; no more evolutions
dbw 1, BITE
dbw 1, ROAR
dbw 6, EMBER
dbw 9, LEER
dbw 14, ODOR_SLEUTH
dbw 17, HELPING_HAND
dbw 20, FLAME_WHEEL
dbw 25, REVERSAL
dbw 28, FIRE_FANG
dbw 31, TAKE_DOWN
dbw 34, FLAMETHROWER
dbw 39, AGILITY
dbw 42, CRUNCH
dbw 45, HEAT_WAVE
dbw 48, FLARE_BLITZ
db 0 ; no more level-up moves
ArcanineEvosAttacks:
db 0 ; no more evolutions
dbw 1, BITE
dbw 1, ROAR
dbw 1, ODOR_SLEUTH
dbw 1, THUNDER_FANG
dbw 1, FIRE_FANG
dbw 39, EXTREMESPEED
db 0 ; no more level-up moves
PoliwagEvosAttacks:
dbbw EVOLVE_LEVEL, 25, POLIWHIRL
db 0 ; no more evolutions
dbw 1, WATER_SPORT
dbw 5, BUBBLE
dbw 8, HYPNOSIS
dbw 11, WATER_GUN
dbw 15, DOUBLESLAP
dbw 18, RAIN_DANCE
dbw 21, BODY_SLAM
dbw 25, BUBBLEBEAM
dbw 28, MUD_SHOT
dbw 31, BELLY_DRUM
dbw 35, WAKE_UP_SLAP
dbw 38, HYDRO_PUMP
dbw 41, MUD_BOMB
db 0 ; no more level-up moves
PoliwhirlEvosAttacks:
dbbw EVOLVE_ITEM, WATER_STONE, POLIWRATH
dbbw EVOLVE_TRADE, KINGS_ROCK, POLITOED
db 0 ; no more evolutions
dbw 1, HYPNOSIS
dbw 1, BUBBLE
dbw 1, WATER_SPORT
dbw 5, BUBBLE
dbw 8, HYPNOSIS
dbw 11, WATER_GUN
dbw 15, DOUBLESLAP
dbw 18, RAIN_DANCE
dbw 21, BODY_SLAM
dbw 27, BUBBLEBEAM
dbw 32, MUD_SHOT
dbw 37, BELLY_DRUM
dbw 43, WAKE_UP_SLAP
dbw 48, HYDRO_PUMP
dbw 53, MUD_BOMB
db 0 ; no more level-up moves
PoliwrathEvosAttacks:
db 0 ; no more evolutions
dbw 1, DOUBLESLAP
dbw 1, BUBBLEBEAM
dbw 1, SUBMISSION
dbw 1, HYPNOSIS
dbw 43, DYNAMICPUNCH
dbw 53, MIND_READER
db 0 ; no more level-up moves
AbraEvosAttacks:
dbbw EVOLVE_LEVEL, 16, KADABRA
db 0 ; no more evolutions
dbw 1, TELEPORT
db 0 ; no more level-up moves
KadabraEvosAttacks:
dbbw EVOLVE_TRADE, -1, ALAKAZAM
db 0 ; no more evolutions
dbw 1, CONFUSION
dbw 1, TELEPORT
dbw 1, KINESIS
dbw 16, CONFUSION
dbw 18, DISABLE
dbw 22, MIRACLE_EYE
dbw 24, PSYBEAM
dbw 28, REFLECT
dbw 30, RECOVER
dbw 34, PSYCHO_CUT
dbw 36, ROLE_PLAY
dbw 40, PSYCHIC_M
dbw 42, FUTURE_SIGHT
dbw 46, TRICK
db 0 ; no more level-up moves
AlakazamEvosAttacks:
db 0 ; no more evolutions
dbw 1, CONFUSION
dbw 1, TELEPORT
dbw 1, KINESIS
dbw 16, CONFUSION
dbw 18, DISABLE
dbw 22, MIRACLE_EYE
dbw 24, PSYBEAM
dbw 28, REFLECT
dbw 30, RECOVER
dbw 34, PSYCHO_CUT
dbw 36, CALM_MIND
dbw 40, PSYCHIC_M
dbw 42, FUTURE_SIGHT
dbw 46, TRICK
db 0 ; no more level-up moves
MachopEvosAttacks:
dbbw EVOLVE_LEVEL, 28, MACHOKE
db 0 ; no more evolutions
dbw 1, LEER
dbw 1, LOW_KICK
dbw 7, FOCUS_ENERGY
dbw 10, KARATE_CHOP
dbw 13, FORESIGHT
dbw 19, SEISMIC_TOSS
dbw 22, REVENGE
dbw 25, VITAL_THROW
dbw 31, SUBMISSION
dbw 34, WAKE_UP_SLAP
dbw 37, CROSS_CHOP
dbw 43, SCARY_FACE
dbw 46, DYNAMICPUNCH
db 0 ; no more level-up moves
MachokeEvosAttacks:
dbbw EVOLVE_TRADE, -1, MACHAMP
db 0 ; no more evolutions
dbw 1, LEER
dbw 1, LOW_KICK
dbw 1, FOCUS_ENERGY
dbw 7, FOCUS_ENERGY
dbw 10, KARATE_CHOP
dbw 13, FORESIGHT
dbw 19, SEISMIC_TOSS
dbw 22, REVENGE
dbw 25, VITAL_THROW
dbw 32, SUBMISSION
dbw 36, WAKE_UP_SLAP
dbw 40, CROSS_CHOP
dbw 44, SCARY_FACE
dbw 51, DYNAMICPUNCH
db 0 ; no more level-up moves
MachampEvosAttacks:
db 0 ; no more evolutions
dbw 1, LEER
dbw 1, LOW_KICK
dbw 1, FOCUS_ENERGY
dbw 7, FOCUS_ENERGY
dbw 10, KARATE_CHOP
dbw 13, FORESIGHT
dbw 19, SEISMIC_TOSS
dbw 22, REVENGE
dbw 25, VITAL_THROW
dbw 32, SUBMISSION
dbw 36, WAKE_UP_SLAP
dbw 40, CROSS_CHOP
dbw 44, SCARY_FACE
dbw 51, DYNAMICPUNCH
db 0 ; no more level-up moves
BellsproutEvosAttacks:
dbbw EVOLVE_LEVEL, 21, WEEPINBELL
db 0 ; no more evolutions
dbw 1, VINE_WHIP
dbw 7, GROWTH
dbw 11, WRAP
dbw 13, SLEEP_POWDER
dbw 15, POISONPOWDER
dbw 17, STUN_SPORE
dbw 23, ACID
dbw 27, KNOCK_OFF
dbw 29, SWEET_SCENT
dbw 35, GASTRO_ACID
dbw 39, RAZOR_LEAF
dbw 41, SLAM
dbw 47, WRING_OUT
db 0 ; no more level-up moves
WeepinbellEvosAttacks:
dbbw EVOLVE_ITEM, LEAF_STONE, VICTREEBEL
;dbbw EVOLVE_ITEM, POISON_STONE, BELMITT
db 0 ; no more evolutions
dbw 1, VINE_WHIP
dbw 1, WRAP
dbw 1, GROWTH
dbw 7, GROWTH
dbw 11, WRAP
dbw 13, SLEEP_POWDER
dbw 15, POISONPOWDER
dbw 17, STUN_SPORE
dbw 23, ACID
dbw 27, KNOCK_OFF
dbw 29, SWEET_SCENT
dbw 35, GASTRO_ACID
dbw 39, RAZOR_LEAF
dbw 41, SLAM
dbw 47, WRING_OUT
db 0 ; no more level-up moves
VictreebelEvosAttacks:
db 0 ; no more evolutions
dbw 1, VINE_WHIP
dbw 1, RAZOR_LEAF
dbw 1, SLEEP_POWDER
dbw 1, SWEET_SCENT
dbw 1, STOCKPILE
dbw 1, SPIT_UP
dbw 1, SWALLOW
dbw 47, LEAF_BLADE
dbw 47, LEAF_STORM
db 0 ; no more level-up moves
TentacoolEvosAttacks:
dbbw EVOLVE_LEVEL, 30, TENTACRUEL
db 0 ; no more evolutions
dbw 1, POISON_STING
dbw 5, SUPERSONIC
dbw 8, CONSTRICT
dbw 12, ACID
dbw 15, TOXIC_SPIKES
dbw 19, BUBBLEBEAM
dbw 22, WRAP
dbw 26, BARRIER
dbw 29, WATER_PULSE
dbw 33, POISON_JAB
dbw 36, SCREECH
dbw 40, HYDRO_PUMP
dbw 43, WRING_OUT
db 0 ; no more level-up moves
TentacruelEvosAttacks:
db 0 ; no more evolutions
dbw 1, POISON_STING
dbw 1, SUPERSONIC
dbw 1, CONSTRICT
dbw 5, SUPERSONIC
dbw 8, CONSTRICT
dbw 12, ACID
dbw 15, TOXIC_SPIKES
dbw 19, BUBBLEBEAM
dbw 22, WRAP
dbw 26, BARRIER
dbw 29, WATER_PULSE
dbw 36, POISON_JAB
dbw 42, SCREECH
dbw 49, HYDRO_PUMP
dbw 55, WRING_OUT
db 0 ; no more level-up moves
GeodudeEvosAttacks:
dbbw EVOLVE_LEVEL, 25, GRAVELER
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, DEFENSE_CURL
dbw 4, MUD_SPORT
dbw 8, ROCK_POLISH
dbw 11, ROCK_THROW
dbw 15, MAGNITUDE
dbw 18, SELFDESTRUCT
dbw 22, ROLLOUT
dbw 25, ROCK_BLAST
dbw 29, EARTHQUAKE
dbw 32, EXPLOSION
dbw 36, DOUBLE_EDGE
dbw 39, STONE_EDGE
db 0 ; no more level-up moves
GravelerEvosAttacks:
dbbw EVOLVE_TRADE, -1, GOLEM
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, DEFENSE_CURL
dbw 1, MUD_SPORT
dbw 1, ROCK_POLISH
dbw 4, MUD_SPORT
dbw 8, ROCK_POLISH
dbw 11, ROCK_THROW
dbw 15, MAGNITUDE
dbw 18, SELFDESTRUCT
dbw 22, ROLLOUT
dbw 27, ROCK_BLAST
dbw 33, EARTHQUAKE
dbw 38, EXPLOSION
dbw 44, DOUBLE_EDGE
dbw 49, STONE_EDGE
db 0 ; no more level-up moves
GolemEvosAttacks:
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, DEFENSE_CURL
dbw 1, MUD_SPORT
dbw 1, ROCK_POLISH
dbw 4, MUD_SPORT
dbw 8, ROCK_POLISH
dbw 11, ROCK_THROW
dbw 15, MAGNITUDE
dbw 18, SELFDESTRUCT
dbw 22, ROLLOUT
dbw 27, ROCK_BLAST
dbw 33, EARTHQUAKE
dbw 38, EXPLOSION
dbw 44, DOUBLE_EDGE
dbw 49, STONE_EDGE
db 0 ; no more level-up moves
PonytaEvosAttacks:
dbbw EVOLVE_LEVEL, 40, RAPIDASH
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, GROWL
dbw 6, TAIL_WHIP
dbw 10, EMBER
dbw 15, FLAME_WHEEL
dbw 19, STOMP
dbw 24, FIRE_SPIN
dbw 28, TAKE_DOWN
dbw 33, AGILITY
dbw 37, FIRE_BLAST
dbw 42, BOUNCE
dbw 46, FLARE_BLITZ
db 0 ; no more level-up moves
RapidashEvosAttacks:
db 0 ; no more evolutions
dbw 1, TAIL_WHIP
dbw 1, GROWL
dbw 1, EMBER
dbw 1, QUICK_ATTACK
dbw 1, MEGAHORN
dbw 1, POISON_JAB
dbw 6, TAIL_WHIP
dbw 10, EMBER
dbw 15, FLAME_WHEEL
dbw 19, STOMP
dbw 24, FIRE_SPIN
dbw 28, TAKE_DOWN
dbw 33, AGILITY
dbw 37, FIRE_BLAST
dbw 40, FURY_ATTACK
dbw 47, BOUNCE
dbw 56, FLARE_BLITZ
db 0 ; no more level-up moves
SlowpokeEvosAttacks:
dbbw EVOLVE_LEVEL, 37, SLOWBRO
dbbw EVOLVE_TRADE, KINGS_ROCK, SLOWKING
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, CURSE
dbw 1, YAWN
dbw 6, GROWL
dbw 11, WATER_GUN
dbw 15, CONFUSION
dbw 20, DISABLE
dbw 25, HEADBUTT
dbw 29, WATER_PULSE
dbw 34, ZEN_HEADBUTT
dbw 39, SLACK_OFF
dbw 43, AMNESIA
dbw 48, PSYCHIC_M
dbw 53, RAIN_DANCE
dbw 57, PSYCH_UP
db 0 ; no more level-up moves
SlowbroEvosAttacks:
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, GROWL
dbw 1, CURSE
dbw 1, YAWN
dbw 6, GROWL
dbw 11, WATER_GUN
dbw 15, CONFUSION
dbw 20, DISABLE
dbw 25, HEADBUTT
dbw 29, WATER_PULSE
dbw 34, ZEN_HEADBUTT
dbw 37, WITHDRAW
dbw 41, SLACK_OFF
dbw 47, AMNESIA
dbw 54, PSYCHIC_M
dbw 61, RAIN_DANCE
dbw 67, PSYCH_UP
db 0 ; no more level-up moves
MagnemiteEvosAttacks:
dbbw EVOLVE_LEVEL, 30, MAGNETON
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, METAL_SOUND
dbw 6, THUNDERSHOCK
dbw 11, SUPERSONIC
dbw 14, SONICBOOM
dbw 17, THUNDER_WAVE
dbw 22, SPARK
dbw 27, LOCK_ON
dbw 30, MAGNET_BOMB
dbw 33, SCREECH
dbw 38, DISCHARGE
dbw 43, MIRROR_SHOT
dbw 46, MAGNET_RISE
dbw 49, GYRO_BALL
dbw 54, ZAP_CANNON
db 0 ; no more level-up moves
MagnetonEvosAttacks:
dbbbw EVOLVE_LEVEL_IN_LOCATION, 1, MAGNETIC_FIELD, MAGNEZONE
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, SUPERSONIC
dbw 1, THUNDERSHOCK
dbw 1, TRI_ATTACK
dbw 1, METAL_SOUND
dbw 6, THUNDERSHOCK
dbw 11, SUPERSONIC
dbw 14, SONICBOOM
dbw 17, THUNDER_WAVE
dbw 22, SPARK
dbw 27, LOCK_ON
dbw 30, MAGNET_BOMB
dbw 34, SCREECH
dbw 40, DISCHARGE
dbw 46, MIRROR_SHOT
dbw 50, MAGNET_RISE
dbw 54, GYRO_BALL
dbw 60, ZAP_CANNON
db 0 ; no more level-up moves
FarfetchDEvosAttacks:
dbbw EVOLVE_LEVEL, 33, MADAME
db 0 ; no more evolutions
dbw 1, SAND_ATTACK
dbw 1, LEER
dbw 1, PECK
dbw 1, FURY_CUTTER
dbw 1, POISON_JAB
dbw 7, FURY_ATTACK
dbw 9, KNOCK_OFF
dbw 13, AERIAL_ACE
dbw 19, SLASH
dbw 21, AIR_CUTTER
dbw 25, SWORDS_DANCE
dbw 31, AGILITY
dbw 33, NIGHT_SLASH
dbw 37, AIR_SLASH
dbw 43, FEINT
dbw 45, FALSE_SWIPE
; dbw 65, POT_SMASH
db 0 ; no more level-up moves
DoduoEvosAttacks:
dbbw EVOLVE_LEVEL, 31, DODRIO
db 0 ; no more evolutions
dbw 1, GROWL
dbw 1, PECK
dbw 5, QUICK_ATTACK
dbw 10, RAGE
dbw 14, FURY_ATTACK
dbw 19, PURSUIT
dbw 23, UPROAR
dbw 28, ACUPRESSURE
dbw 32, DOUBLE_HIT
dbw 37, AGILITY
dbw 41, DRILL_PECK
dbw 46, ENDEAVOR
db 0 ; no more level-up moves
DodrioEvosAttacks:
db 0 ; no more evolutions
dbw 1, GROWL
dbw 1, PECK
dbw 1, QUICK_ATTACK
dbw 1, RAGE
dbw 1, PLUCK
dbw 5, QUICK_ATTACK
dbw 10, RAGE
dbw 14, FURY_ATTACK
dbw 19, PURSUIT
dbw 23, UPROAR
dbw 28, ACUPRESSURE
dbw 34, TRI_ATTACK
dbw 41, AGILITY
dbw 47, DRILL_PECK
dbw 54, ENDEAVOR
db 0 ; no more level-up moves
SeelEvosAttacks:
dbbw EVOLVE_LEVEL, 34, DEWGONG
db 0 ; no more evolutions
dbw 1, HEADBUTT
dbw 3, GROWL
dbw 7, WATER_SPORT
dbw 11, ICY_WIND
dbw 13, ENCORE
dbw 17, ICE_SHARD
dbw 21, REST
dbw 23, AQUA_RING
dbw 27, AURORA_BEAM
dbw 31, AQUA_JET
dbw 33, BRINE
dbw 37, TAKE_DOWN
dbw 41, DIVE
dbw 43, AQUA_TAIL
dbw 47, ICE_BEAM
dbw 51, SAFEGUARD
db 0 ; no more level-up moves
DewgongEvosAttacks:
db 0 ; no more evolutions
dbw 1, HEADBUTT
dbw 1, GROWL
dbw 1, ICY_WIND
dbw 1, SIGNAL_BEAM
dbw 3, GROWL
dbw 7, SIGNAL_BEAM
dbw 11, ICY_WIND
dbw 13, ENCORE
dbw 17, ICE_SHARD
dbw 21, REST
dbw 23, AQUA_RING
dbw 27, AURORA_BEAM
dbw 31, AQUA_JET
dbw 33, BRINE
dbw 34, SHEER_COLD
dbw 37, TAKE_DOWN
dbw 41, DIVE
dbw 43, AQUA_TAIL
dbw 47, ICE_BEAM
dbw 51, SAFEGUARD
db 0 ; no more level-up moves
GrimerEvosAttacks:
dbbw EVOLVE_LEVEL, 38, MUK
db 0 ; no more evolutions
dbw 1, POUND
dbw 1, POISON_GAS
dbw 4, HARDEN
dbw 7, MUD_SLAP
dbw 12, DISABLE
dbw 17, MINIMIZE
dbw 20, SLUDGE
dbw 23, MUD_BOMB
dbw 28, FLING
dbw 33, SCREECH
dbw 36, SLUDGE_BOMB
dbw 39, ACID_ARMOR
dbw 44, GUNK_SHOT
dbw 49, MEMENTO
db 0 ; no more level-up moves
MukEvosAttacks:
db 0 ; no more evolutions
dbw 1, POUND
dbw 1, HARDEN
dbw 1, POISON_GAS
dbw 1, MUD_SLAP
dbw 4, HARDEN
dbw 7, MUD_SLAP
dbw 12, DISABLE
dbw 17, MINIMIZE
dbw 20, SLUDGE
dbw 23, MUD_BOMB
dbw 28, FLING
dbw 33, SCREECH
dbw 36, SLUDGE_BOMB
dbw 44, ACID_ARMOR
dbw 54, GUNK_SHOT
dbw 65, MEMENTO
db 0 ; no more level-up moves
ShellderEvosAttacks:
dbbw EVOLVE_ITEM, WATER_STONE, CLOYSTER
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 4, WITHDRAW
dbw 8, SUPERSONIC
dbw 13, ICICLE_SPEAR
dbw 16, PROTECT
dbw 20, LEER
dbw 25, CLAMP
dbw 28, ICE_SHARD
dbw 32, AURORA_BEAM
dbw 37, WHIRLPOOL
dbw 40, IRON_DEFENSE
dbw 44, BRINE
dbw 49, ICE_BEAM
db 0 ; no more level-up moves
CloysterEvosAttacks:
db 0 ; no more evolutions
dbw 1, SUPERSONIC
dbw 1, AURORA_BEAM
dbw 1, WITHDRAW
dbw 1, PROTECT
dbw 1, TOXIC_SPIKES
dbw 28, SPIKES
dbw 40, SPIKE_CANNON
db 0 ; no more level-up moves
GastlyEvosAttacks:
dbbw EVOLVE_LEVEL, 25, HAUNTER
db 0 ; no more evolutions
dbw 1, HYPNOSIS
dbw 1, LICK
dbw 5, SPITE
dbw 8, MEAN_LOOK
dbw 12, CURSE
dbw 15, NIGHT_SHADE
dbw 19, CONFUSE_RAY
dbw 22, SUCKER_PUNCH
dbw 26, PAYBACK
dbw 29, SHADOW_BALL
dbw 33, DREAM_EATER
dbw 36, DARK_PULSE
dbw 40, DESTINY_BOND
dbw 43, NIGHTMARE
db 0 ; no more level-up moves
HaunterEvosAttacks:
dbbw EVOLVE_TRADE, -1, GENGAR
db 0 ; no more evolutions
dbw 1, HYPNOSIS
dbw 1, LICK
dbw 1, SPITE
dbw 5, SPITE
dbw 8, MEAN_LOOK
dbw 12, CURSE
dbw 15, NIGHT_SHADE
dbw 19, CONFUSE_RAY
dbw 22, SUCKER_PUNCH
dbw 25, SHADOW_PUNCH
dbw 28, PAYBACK
dbw 33, SHADOW_BALL
dbw 39, DREAM_EATER
dbw 44, DARK_PULSE
dbw 50, DESTINY_BOND
dbw 55, NIGHTMARE
db 0 ; no more level-up moves
GengarEvosAttacks:
db 0 ; no more evolutions
dbw 1, HYPNOSIS
dbw 1, LICK
dbw 1, SPITE
dbw 5, SPITE
dbw 8, MEAN_LOOK
dbw 12, CURSE
dbw 15, NIGHT_SHADE
dbw 19, CONFUSE_RAY
dbw 22, SUCKER_PUNCH
dbw 25, SHADOW_PUNCH
dbw 28, PAYBACK
dbw 33, SHADOW_BALL
dbw 39, DREAM_EATER
dbw 44, DARK_PULSE
dbw 50, DESTINY_BOND
dbw 55, NIGHTMARE
db 0 ; no more level-up moves
OnixEvosAttacks:
dbbw EVOLVE_TRADE, METAL_COAT, STEELIX
db 0 ; no more evolutions
dbw 1, BIND
dbw 1, TACKLE
dbw 1, HARDEN
dbw 1, MUD_SPORT
dbw 6, SCREECH
dbw 9, ROCK_THROW
dbw 14, RAGE
dbw 17, ROCK_TOMB
dbw 22, SANDSTORM
dbw 25, SLAM
dbw 30, ROCK_POLISH
dbw 33, DRAGONBREATH
dbw 38, CURSE
dbw 41, IRON_TAIL
dbw 46, SAND_TOMB
dbw 49, DOUBLE_EDGE
dbw 54, STONE_EDGE
db 0 ; no more level-up moves
DrowzeeEvosAttacks:
dbbw EVOLVE_LEVEL, 26, HYPNO
db 0 ; no more evolutions
dbw 1, POUND
dbw 1, HYPNOSIS
dbw 7, DISABLE
dbw 9, CONFUSION
dbw 15, HEADBUTT
dbw 18, POISON_GAS
dbw 21, MEDITATE
dbw 26, PSYBEAM
dbw 29, PSYCH_UP
dbw 32, HEADBUTT
dbw 37, SWAGGER
dbw 40, PSYCHIC_M
dbw 43, NASTY_PLOT
dbw 50, ZEN_HEADBUTT
dbw 53, FUTURE_SIGHT
db 0 ; no more level-up moves
HypnoEvosAttacks:
db 0 ; no more evolutions
dbw 1, POUND
dbw 1, DISABLE
dbw 1, CONFUSION
dbw 1, HYPNOSIS
dbw 1, NIGHTMARE
dbw 1, SWITCHEROO
dbw 7, DISABLE
dbw 9, CONFUSION
dbw 15, HEADBUTT
dbw 18, POISON_GAS
dbw 21, MEDITATE
dbw 28, PSYBEAM
dbw 33, PSYCH_UP
dbw 38, HEADBUTT
dbw 45, SWAGGER
dbw 50, PSYCHIC_M
dbw 55, NASTY_PLOT
dbw 64, ZEN_HEADBUTT
dbw 69, FUTURE_SIGHT
db 0 ; no more level-up moves
KrabbyEvosAttacks:
dbbw EVOLVE_LEVEL, 28, KINGLER
db 0 ; no more evolutions
dbw 1, BUBBLE
dbw 1, MUD_SPORT
dbw 5, VICEGRIP
dbw 9, LEER
dbw 11, HARDEN
dbw 15, BUBBLEBEAM
dbw 19, MUD_SHOT
dbw 21, METAL_CLAW
dbw 25, STOMP
dbw 29, PROTECT
dbw 31, GUILLOTINE
dbw 35, SLAM
dbw 39, BRINE
dbw 41, CRABHAMMER
dbw 45, FLAIL
db 0 ; no more level-up moves
KinglerEvosAttacks:
db 0 ; no more evolutions
dbw 1, VICEGRIP
dbw 1, BUBBLE
dbw 1, MUD_SPORT
dbw 5, VICEGRIP
dbw 9, LEER
dbw 11, HARDEN
dbw 15, BUBBLEBEAM
dbw 19, MUD_SHOT
dbw 21, METAL_CLAW
dbw 25, STOMP
dbw 32, PROTECT
dbw 37, GUILLOTINE
dbw 44, SLAM
dbw 51, BRINE
dbw 56, CRABHAMMER
dbw 63, FLAIL
db 0 ; no more level-up moves
VoltorbEvosAttacks:
dbbw EVOLVE_LEVEL, 30, ELECTRODE
db 0 ; no more evolutions
dbw 1, CHARGE
dbw 5, TACKLE
dbw 8, SONICBOOM
dbw 12, SPARK
dbw 15, ROLLOUT
dbw 19, SCREECH
dbw 22, LIGHT_SCREEN
dbw 26, CHARGE_BEAM
dbw 29, SELFDESTRUCT
dbw 33, SWIFT
dbw 36, MAGNET_RISE
dbw 40, GYRO_BALL
dbw 43, EXPLOSION
dbw 47, MIRROR_COAT
db 0 ; no more level-up moves
ElectrodeEvosAttacks:
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, SONICBOOM
dbw 1, SPARK
dbw 1, CHARGE
dbw 5, TACKLE
dbw 8, SONICBOOM
dbw 12, SPARK
dbw 15, ROLLOUT
dbw 19, SCREECH
dbw 22, LIGHT_SCREEN
dbw 26, CHARGE_BEAM
dbw 29, SELFDESTRUCT
dbw 35, SWIFT
dbw 40, MAGNET_RISE
dbw 46, GYRO_BALL
dbw 51, EXPLOSION
dbw 57, MIRROR_COAT
db 0 ; no more level-up moves
ExeggcuteEvosAttacks:
dbbw EVOLVE_ITEM, LEAF_STONE, EXEGGUTOR
db 0 ; no more evolutions
dbw 1, HYPNOSIS
dbw 1, BARRAGE
dbw 1, UPROAR
dbw 7, REFLECT
dbw 11, LEECH_SEED
dbw 17, BULLET_SEED
dbw 19, STUN_SPORE
dbw 21, POISONPOWDER
dbw 23, SLEEP_POWDER
dbw 27, CONFUSION
dbw 33, WORRY_SEED
dbw 37, NATURAL_GIFT
dbw 43, SOLARBEAM
dbw 47, PSYCHIC_M
db 0 ; no more level-up moves
ExeggutorEvosAttacks:
db 0 ; no more evolutions
dbw 1, STOMP
dbw 1, CONFUSION
dbw 1, HYPNOSIS
dbw 1, BARRAGE
dbw 1, SEED_BOMB
dbw 17, STOMP
dbw 27, EGG_BOMB
dbw 37, WOOD_HAMMER
dbw 47, LEAF_STORM
db 0 ; no more level-up moves
CuboneEvosAttacks:
dbbw EVOLVE_LEVEL, 28, MAROWAK
db 0 ; no more evolutions
dbw 1, GROWL
dbw 3, TAIL_WHIP
dbw 7, BONE_CLUB
dbw 11, HEADBUTT
dbw 13, LEER
dbw 17, FOCUS_ENERGY
dbw 21, BONEMERANG
dbw 23, RAGE
dbw 27, FALSE_SWIPE
dbw 31, THRASH
dbw 33, FLING
dbw 37, BONE_RUSH
dbw 41, ENDEAVOR
dbw 43, DOUBLE_EDGE
db 0 ; no more level-up moves
MarowakEvosAttacks:
dbbw EVOLVE_LEVEL, 42, GUARDIA
db 0 ; no more evolutions
dbw 1, HEADBUTT
dbw 1, TAIL_WHIP
dbw 1, GROWL
dbw 1, BONE_CLUB
dbw 3, TAIL_WHIP
dbw 7, BONE_CLUB
dbw 11, HEADBUTT
dbw 13, LEER
dbw 17, FOCUS_ENERGY
dbw 21, BONEMERANG
dbw 23, RAGE
dbw 27, FALSE_SWIPE
dbw 33, THRASH
dbw 37, FLING
dbw 43, BONE_RUSH
dbw 49, ENDEAVOR
dbw 53, DOUBLE_EDGE
db 0 ; no more level-up moves
HitmonleeEvosAttacks:
db 0 ; no more evolutions
dbw 1, DOUBLE_KICK
dbw 1, REVENGE
dbw 5, MEDITATE
dbw 9, ROLLING_KICK
dbw 13, JUMP_KICK
dbw 17, BRICK_BREAK
dbw 21, FOCUS_ENERGY
dbw 25, FEINT
dbw 29, HI_JUMP_KICK
dbw 33, MIND_READER
dbw 37, FORESIGHT
dbw 41, BLAZE_KICK
dbw 45, ENDURE
dbw 49, MEGA_KICK
dbw 53, CLOSE_COMBAT
dbw 57, REVERSAL
db 0 ; no more level-up moves
HitmonchanEvosAttacks:
db 0 ; no more evolutions
dbw 1, COMET_PUNCH
dbw 1, REVENGE
dbw 6, AGILITY
dbw 11, PURSUIT
dbw 16, MACH_PUNCH
dbw 16, BULLET_PUNCH
dbw 21, FEINT
dbw 26, VACUUM_WAVE
dbw 31, FIRE_PUNCH
dbw 31, ICE_PUNCH
dbw 31, THUNDERPUNCH
dbw 36, SKY_UPPERCUT
dbw 41, MEGA_PUNCH
dbw 46, DETECT
dbw 51, COUNTER
dbw 56, CLOSE_COMBAT
db 0 ; no more level-up moves
LickitungEvosAttacks:
;dbbw EVOLVE_MOVE, ROLLOUT, LICKILICKY
db 0 ; no more evolutions
dbw 1, LICK
dbw 5, SUPERSONIC
dbw 9, DEFENSE_CURL
dbw 13, KNOCK_OFF
dbw 17, WRAP
dbw 21, STOMP
dbw 25, DISABLE
dbw 29, SLAM
dbw 33, ROLLOUT
dbw 37, ME_FIRST
dbw 41, REFRESH
dbw 45, SCREECH
dbw 49, POWER_WHIP
dbw 53, WRING_OUT
db 0 ; no more level-up moves
KoffingEvosAttacks:
dbbw EVOLVE_LEVEL, 35, WEEZING
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, POISON_GAS
dbw 6, SMOG
dbw 10, SMOKESCREEN
dbw 15, ASSURANCE
dbw 19, SELFDESTRUCT
dbw 24, SLUDGE
dbw 28, HAZE
dbw 33, GYRO_BALL
dbw 37, EXPLOSION
dbw 42, SLUDGE_BOMB
dbw 46, DESTINY_BOND
dbw 51, MEMENTO
db 0 ; no more level-up moves
WeezingEvosAttacks:
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, SMOKESCREEN
dbw 1, SMOG
dbw 1, POISON_GAS
dbw 6, SMOG
dbw 10, SMOKESCREEN
dbw 15, ASSURANCE
dbw 19, SELFDESTRUCT
dbw 24, SLUDGE
dbw 28, HAZE
dbw 33, DOUBLE_HIT
dbw 40, EXPLOSION
dbw 48, SLUDGE_BOMB
dbw 55, DESTINY_BOND
dbw 63, MEMENTO
db 0 ; no more level-up moves
RhyhornEvosAttacks:
dbbw EVOLVE_LEVEL, 42, RHYDON
db 0 ; no more evolutions
dbw 1, HORN_ATTACK
dbw 1, TAIL_WHIP
dbw 9, STOMP
dbw 13, FURY_ATTACK
dbw 21, SCARY_FACE
dbw 25, ROCK_BLAST
dbw 33, TAKE_DOWN
dbw 37, HORN_DRILL
dbw 45, STONE_EDGE
dbw 49, EARTHQUAKE
dbw 57, MEGAHORN
db 0 ; no more level-up moves
RhydonEvosAttacks:
dbbw EVOLVE_TRADE, PROTECTOR, RHYPERIOR
db 0 ; no more evolutions
dbw 1, STOMP
dbw 1, HORN_ATTACK
dbw 1, FURY_ATTACK
dbw 1, TAIL_WHIP
dbw 9, STOMP
dbw 13, FURY_ATTACK
dbw 21, SCARY_FACE
dbw 25, ROCK_BLAST
dbw 33, TAKE_DOWN
dbw 37, HORN_DRILL
dbw 42, HAMMER_ARM
dbw 45, STONE_EDGE
dbw 49, EARTHQUAKE
dbw 57, MEGAHORN
db 0 ; no more level-up moves
ChanseyEvosAttacks:
dbbw EVOLVE_HAPPINESS, TR_ANYTIME, BLISSEY
db 0 ; no more evolutions
dbw 1, POUND
dbw 1, GROWL
dbw 5, TAIL_WHIP
dbw 9, REFRESH
dbw 12, SOFTBOILED
dbw 16, DOUBLESLAP
dbw 20, MINIMIZE
dbw 23, SING
dbw 27, FLING
dbw 31, DEFENSE_CURL
dbw 34, LIGHT_SCREEN
dbw 38, EGG_BOMB
dbw 42, HEALING_WISH
dbw 46, DOUBLE_EDGE
db 0 ; no more level-up moves
TangelaEvosAttacks:
dbbw EVOLVE_LEVEL, 40, GELANIA
dbbww EVOLVE_LEVEL_WITH_MOVE, 1, ANCIENTPOWER, TANGROWTH
db 0 ; no more evolutions
dbw 1, CONSTRICT
dbw 1, INGRAIN
dbw 5, SLEEP_POWDER
dbw 8, ABSORB
dbw 12, GROWTH
dbw 15, POISONPOWDER
dbw 19, VINE_WHIP
dbw 22, BIND
dbw 26, MEGA_DRAIN
dbw 29, STUN_SPORE
dbw 33, ANCIENTPOWER
dbw 36, KNOCK_OFF
dbw 40, NATURAL_GIFT
dbw 43, SLAM
dbw 47, TICKLE
dbw 50, WRING_OUT
dbw 54, POWER_WHIP
db 0 ; no more level-up moves
KangaskhanEvosAttacks:
db 0 ; no more evolutions
dbw 1, COMET_PUNCH
dbw 1, LEER
dbw 7, FAKE_OUT
dbw 10, TAIL_WHIP
dbw 13, BITE
dbw 19, MEGA_PUNCH
dbw 22, RAGE
dbw 25, DIZZY_PUNCH
dbw 31, CRUNCH
dbw 34, ENDURE
dbw 37, OUTRAGE
dbw 43, DOUBLE_HIT
dbw 46, SUCKER_PUNCH
dbw 49, REVERSAL
db 0 ; no more level-up moves
HorseaEvosAttacks:
dbbw EVOLVE_LEVEL, 32, SEADRA
db 0 ; no more evolutions
dbw 1, BUBBLE
dbw 4, SMOKESCREEN
dbw 8, LEER
dbw 11, WATER_GUN
dbw 14, FOCUS_ENERGY
dbw 18, BUBBLEBEAM
dbw 23, AGILITY
dbw 26, TWISTER
dbw 30, BRINE
dbw 35, HYDRO_PUMP
dbw 38, DRAGON_DANCE
dbw 42, DRAGON_PULSE
db 0 ; no more level-up moves
SeadraEvosAttacks:
dbbw EVOLVE_TRADE, DRAGON_SCALE, KINGDRA
db 0 ; no more evolutions
dbw 1, LEER
dbw 1, WATER_GUN
dbw 1, SMOKESCREEN
dbw 1, BUBBLE
dbw 4, SMOKESCREEN
dbw 8, LEER
dbw 11, WATER_GUN
dbw 14, FOCUS_ENERGY
dbw 18, BUBBLEBEAM
dbw 23, AGILITY
dbw 26, TWISTER
dbw 30, BRINE
dbw 40, HYDRO_PUMP
dbw 48, DRAGON_DANCE
dbw 57, DRAGON_PULSE
db 0 ; no more level-up moves
GoldeenEvosAttacks:
dbbw EVOLVE_LEVEL, 33, SEAKING
db 0 ; no more evolutions
dbw 1, TAIL_WHIP
dbw 1, PECK
dbw 1, WATER_SPORT
dbw 7, SUPERSONIC
dbw 11, HORN_ATTACK
dbw 17, WATER_PULSE
dbw 21, FLAIL
dbw 27, AQUA_RING
dbw 31, FURY_ATTACK
dbw 37, WATERFALL
dbw 41, HORN_DRILL
dbw 47, AGILITY
dbw 51, MEGAHORN
db 0 ; no more level-up moves
SeakingEvosAttacks:
db 0 ; no more evolutions
dbw 1, TAIL_WHIP
dbw 1, SUPERSONIC
dbw 1, PECK
dbw 1, WATER_SPORT
dbw 1, POISON_JAB
dbw 7, SUPERSONIC
dbw 11, HORN_ATTACK
dbw 17, WATER_PULSE
dbw 21, FLAIL
dbw 27, AQUA_RING
dbw 31, FURY_ATTACK
dbw 40, WATERFALL
dbw 47, HORN_DRILL
dbw 56, AGILITY
dbw 63, MEGAHORN
db 0 ; no more level-up moves
StaryuEvosAttacks:
dbbw EVOLVE_ITEM, WATER_STONE, STARMIE
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, HARDEN
dbw 6, WATER_GUN
dbw 10, RAPID_SPIN
dbw 15, RECOVER
dbw 19, CAMOUFLAGE
dbw 24, SWIFT
dbw 28, BUBBLEBEAM
dbw 33, MINIMIZE
dbw 37, GYRO_BALL
dbw 42, LIGHT_SCREEN
dbw 46, POWER_GEM
dbw 51, COSMIC_POWER
dbw 55, HYDRO_PUMP
db 0 ; no more level-up moves
StarmieEvosAttacks:
db 0 ; no more evolutions
dbw 1, WATER_GUN
dbw 1, RECOVER
dbw 1, SWIFT
dbw 1, RAPID_SPIN
dbw 28, CONFUSE_RAY
db 0 ; no more level-up moves
MrMimeEvosAttacks:
db 0 ; no more evolutions
dbw 1, CONFUSION
dbw 1, BARRIER
dbw 1, MAGICAL_LEAF
dbw 1, POWER_SWAP
dbw 1, GUARD_SWAP
dbw 4, COPYCAT
dbw 8, MEDITATE
dbw 11, ENCORE
dbw 15, DOUBLESLAP
dbw 18, MIMIC
dbw 22, LIGHT_SCREEN
dbw 22, REFLECT
dbw 25, PSYBEAM
dbw 29, SUBSTITUTE
dbw 32, RECYCLE
dbw 36, TRICK
dbw 39, PSYCHIC_M
dbw 43, ROLE_PLAY
dbw 46, BATON_PASS
dbw 50, SAFEGUARD
db 0 ; no more level-up moves
ScytherEvosAttacks:
dbbw EVOLVE_TRADE, METAL_COAT, SCIZOR
db 0 ; no more evolutions
dbw 1, LEER
dbw 1, QUICK_ATTACK
dbw 1, VACUUM_WAVE
dbw 5, FOCUS_ENERGY
dbw 9, PURSUIT
dbw 13, FALSE_SWIPE
dbw 17, AGILITY
dbw 21, WING_ATTACK
dbw 25, FURY_CUTTER
dbw 29, SLASH
dbw 33, RAZOR_WIND
dbw 37, DOUBLE_TEAM
dbw 41, X_SCISSOR
dbw 45, NIGHT_SLASH
dbw 49, DOUBLE_HIT
dbw 53, AIR_SLASH
dbw 57, SWORDS_DANCE
dbw 61, FEINT
db 0 ; no more level-up moves
JynxEvosAttacks:
db 0 ; no more evolutions
dbw 1, POUND
dbw 1, LICK
dbw 1, LOVELY_KISS
dbw 1, POWDER_SNOW
dbw 5, LICK
dbw 8, LOVELY_KISS
dbw 11, POWDER_SNOW
dbw 15, DOUBLESLAP
dbw 18, ICE_PUNCH
dbw 21, MEAN_LOOK
dbw 25, FAKE_TEARS
dbw 28, WAKE_UP_SLAP
dbw 33, AVALANCHE
dbw 39, BODY_SLAM
dbw 44, WRING_OUT
dbw 49, PERISH_SONG
dbw 55, BLIZZARD
db 0 ; no more level-up moves
ElectabuzzEvosAttacks:
dbbw EVOLVE_TRADE, ELECTRIZER, ELECTIVIRE
db 0 ; no more evolutions
dbw 1, LEER
dbw 1, THUNDERSHOCK
dbw 1, QUICK_ATTACK
dbw 7, THUNDERSHOCK
dbw 10, LOW_KICK
dbw 16, SWIFT
dbw 19, SHOCK_WAVE
dbw 25, LIGHT_SCREEN
dbw 28, THUNDERPUNCH
dbw 37, DISCHARGE
dbw 43, THUNDERBOLT
dbw 52, SCREECH
dbw 58, THUNDER
db 0 ; no more level-up moves
MagmarEvosAttacks:
dbbw EVOLVE_TRADE, MAGMARIZER, MAGMORTAR
db 0 ; no more evolutions
dbw 1, LEER
dbw 1, EMBER
dbw 1, SMOG
dbw 7, EMBER
dbw 10, SMOKESCREEN
dbw 16, FAINT_ATTACK
dbw 19, FIRE_SPIN
dbw 25, CONFUSE_RAY
dbw 28, FIRE_PUNCH
dbw 36, LAVA_PLUME
dbw 41, FLAMETHROWER
dbw 49, SUNNY_DAY
dbw 54, FIRE_BLAST
db 0 ; no more level-up moves
PinsirEvosAttacks:
dbbw EVOLVE_LEVEL, 42, PRAXE
db 0 ; no more evolutions
dbw 1, VICEGRIP
dbw 1, FOCUS_ENERGY
dbw 4, BIND
dbw 8, SEISMIC_TOSS
dbw 13, HARDEN
dbw 18, REVENGE
dbw 21, BRICK_BREAK
dbw 25, VITAL_THROW
dbw 30, X_SCISSOR
dbw 35, THRASH
dbw 38, SWORDS_DANCE
dbw 42, SUBMISSION
dbw 47, GUILLOTINE
dbw 52, SUPERPOWER
db 0 ; no more level-up moves
TaurosEvosAttacks:
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 3, TAIL_WHIP
dbw 5, RAGE
dbw 8, HORN_ATTACK
dbw 11, SCARY_FACE
dbw 15, PURSUIT
dbw 19, REST
dbw 24, PAYBACK
dbw 29, ZEN_HEADBUTT
dbw 35, TAKE_DOWN
dbw 41, SWAGGER
dbw 48, THRASH
dbw 55, GIGA_IMPACT
db 0 ; no more level-up moves
MagikarpEvosAttacks:
dbbw EVOLVE_LEVEL, 20, GYARADOS
db 0 ; no more evolutions
dbw 1, SPLASH
dbw 15, TACKLE
dbw 30, FLAIL
db 0 ; no more level-up moves
GyaradosEvosAttacks:
db 0 ; no more evolutions
dbw 1, THRASH
dbw 20, BITE
dbw 23, DRAGON_RAGE
dbw 26, LEER
dbw 29, TWISTER
dbw 32, ICE_FANG
dbw 35, AQUA_TAIL
dbw 38, RAIN_DANCE
dbw 41, HYDRO_PUMP
dbw 44, DRAGON_DANCE
dbw 47, HYPER_BEAM
db 0 ; no more level-up moves
LaprasEvosAttacks:
db 0 ; no more evolutions
dbw 1, GROWL
dbw 1, SING
dbw 1, WATER_GUN
dbw 4, MIST
dbw 7, CONFUSE_RAY
dbw 10, ICE_SHARD
dbw 14, WATER_PULSE
dbw 18, BODY_SLAM
dbw 22, RAIN_DANCE
dbw 27, PERISH_SONG
dbw 32, ICE_BEAM
dbw 37, BRINE
dbw 43, SAFEGUARD
dbw 49, HYDRO_PUMP
dbw 55, SHEER_COLD
db 0 ; no more level-up moves
DittoEvosAttacks:
dbbw EVOLVE_TRADE, METAL_COAT, METTO
db 0 ; no more evolutions
dbw 1, TRANSFORM
db 0 ; no more level-up moves
EeveeEvosAttacks:
dbbw EVOLVE_ITEM, THUNDERSTONE, JOLTEON
dbbw EVOLVE_ITEM, WATER_STONE, VAPOREON
dbbw EVOLVE_ITEM, FIRE_STONE, FLAREON
dbbw EVOLVE_HAPPINESS, TR_MORNDAY, ESPEON
dbbw EVOLVE_HAPPINESS, TR_NITE, UMBREON
dbbbw EVOLVE_LEVEL_IN_LOCATION, 1, MOSSY_ROCK, LEAFEON
dbbbw EVOLVE_LEVEL_IN_LOCATION, 1, ICY_ROCK, GLACEON
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, TAIL_WHIP
dbw 1, HELPING_HAND
dbw 8, SAND_ATTACK
dbw 15, GROWL
dbw 22, QUICK_ATTACK
dbw 29, BITE
dbw 36, BATON_PASS
dbw 43, TAKE_DOWN
dbw 50, LAST_RESORT
dbw 57, TRUMP_CARD
db 0 ; no more level-up moves
VaporeonEvosAttacks:
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, TAIL_WHIP
dbw 1, HELPING_HAND
dbw 8, SAND_ATTACK
dbw 15, WATER_GUN
dbw 22, QUICK_ATTACK
dbw 29, BITE
dbw 36, AURORA_BEAM
dbw 43, AQUA_RING
dbw 50, LAST_RESORT
dbw 57, HAZE
dbw 64, ACID_ARMOR
dbw 71, HYDRO_PUMP
dbw 78, MUDDY_WATER
db 0 ; no more level-up moves
JolteonEvosAttacks:
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, TAIL_WHIP
dbw 1, HELPING_HAND
dbw 8, SAND_ATTACK
dbw 15, THUNDERSHOCK
dbw 22, QUICK_ATTACK
dbw 29, DOUBLE_KICK
dbw 36, PIN_MISSILE
dbw 43, THUNDER_FANG
dbw 50, LAST_RESORT
dbw 57, THUNDER_WAVE
dbw 64, AGILITY
dbw 71, THUNDER
dbw 78, DISCHARGE
db 0 ; no more level-up moves
FlareonEvosAttacks:
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, TAIL_WHIP
dbw 1, HELPING_HAND
dbw 8, SAND_ATTACK
dbw 15, EMBER
dbw 22, QUICK_ATTACK
dbw 29, BITE
dbw 36, FIRE_SPIN
dbw 43, FIRE_FANG
dbw 50, LAST_RESORT
dbw 57, SMOG
dbw 64, SCARY_FACE
dbw 71, FIRE_BLAST
dbw 78, LAVA_PLUME
db 0 ; no more level-up moves
PorygonEvosAttacks:
dbbw EVOLVE_TRADE, UP_GRADE, PORYGON2
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 1, SHARPEN
dbw 1, CONVERSION
dbw 1, CONVERSION2
dbw 7, PSYBEAM
dbw 12, AGILITY
dbw 18, RECOVER
dbw 23, MAGNET_RISE
dbw 29, SIGNAL_BEAM
dbw 34, RECYCLE
dbw 40, DISCHARGE
dbw 45, LOCK_ON
dbw 51, TRI_ATTACK
dbw 56, MAGIC_COAT
dbw 62, ZAP_CANNON
db 0 ; no more level-up moves
OmanyteEvosAttacks:
dbbw EVOLVE_LEVEL, 40, OMASTAR
db 0 ; no more evolutions
dbw 1, WITHDRAW
dbw 1, CONSTRICT
dbw 7, BITE
dbw 10, WATER_GUN
dbw 16, ROLLOUT
dbw 19, LEER
dbw 25, MUD_SHOT
dbw 28, BRINE
dbw 34, PROTECT
dbw 37, ANCIENTPOWER
dbw 43, TICKLE
dbw 46, ROCK_BLAST
dbw 52, HYDRO_PUMP
db 0 ; no more level-up moves
OmastarEvosAttacks:
db 0 ; no more evolutions
dbw 1, BITE
dbw 1, WITHDRAW
dbw 1, CONSTRICT
dbw 7, BITE
dbw 10, WATER_GUN
dbw 16, ROLLOUT
dbw 19, LEER
dbw 25, MUD_SHOT
dbw 28, BRINE
dbw 34, PROTECT
dbw 37, ANCIENTPOWER
dbw 40, SPIKE_CANNON
dbw 48, TICKLE
dbw 56, ROCK_BLAST
dbw 67, HYDRO_PUMP
db 0 ; no more level-up moves
KabutoEvosAttacks:
dbbw EVOLVE_LEVEL, 40, KABUTOPS
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, HARDEN
dbw 6, ABSORB
dbw 11, LEER
dbw 16, MUD_SHOT
dbw 21, SAND_ATTACK
dbw 26, ENDURE
dbw 31, AQUA_JET
dbw 36, MEGA_DRAIN
dbw 41, METAL_SOUND
dbw 46, ANCIENTPOWER
dbw 51, WRING_OUT
db 0 ; no more level-up moves
KabutopsEvosAttacks:
db 0 ; no more evolutions
dbw 1, SCRATCH
dbw 1, LEER
dbw 1, ABSORB
dbw 1, HARDEN
dbw 1, FEINT
dbw 6, ABSORB
dbw 11, LEER
dbw 16, MUD_SHOT
dbw 21, SAND_ATTACK
dbw 26, ENDURE
dbw 31, AQUA_JET
dbw 36, MEGA_DRAIN
dbw 40, SLASH
dbw 45, METAL_SOUND
dbw 54, ANCIENTPOWER
dbw 63, WRING_OUT
dbw 72, NIGHT_SLASH
db 0 ; no more level-up moves
AerodactylEvosAttacks:
db 0 ; no more evolutions
dbw 1, WING_ATTACK
dbw 1, BITE
dbw 1, SUPERSONIC
dbw 1, SCARY_FACE
dbw 1, THUNDER_FANG
dbw 1, ICE_FANG
dbw 1, FIRE_FANG
dbw 9, ROAR
dbw 17, AGILITY
dbw 25, ANCIENTPOWER
dbw 33, CRUNCH
dbw 41, TAKE_DOWN
dbw 49, IRON_HEAD
dbw 57, HYPER_BEAM
dbw 65, ROCK_SLIDE
dbw 73, GIGA_IMPACT
db 0 ; no more level-up moves
SnorlaxEvosAttacks:
db 0 ; no more evolutions
dbw 1, TACKLE
dbw 4, DEFENSE_CURL
dbw 9, AMNESIA
dbw 12, LICK
dbw 17, BELLY_DRUM
dbw 20, YAWN
dbw 25, REST
dbw 28, SNORE
dbw 28, SLEEP_TALK
dbw 33, BODY_SLAM
dbw 36, BLOCK
dbw 41, ROLLOUT
dbw 44, CRUNCH
dbw 49, GIGA_IMPACT
db 0 ; no more level-up moves
ArticunoEvosAttacks:
db 0 ; no more evolutions
dbw 1, GUST
dbw 1, POWDER_SNOW
dbw 8, MIST
dbw 15, ICE_SHARD
dbw 22, MIND_READER
dbw 29, ANCIENTPOWER
dbw 36, AGILITY
dbw 43, ICE_BEAM
dbw 50, REFLECT
dbw 57, ROOST
dbw 64, TAILWIND
dbw 71, BLIZZARD
dbw 78, SHEER_COLD
dbw 85, HAIL
db 0 ; no more level-up moves
ZapdosEvosAttacks:
db 0 ; no more evolutions
dbw 1, PECK
dbw 1, THUNDERSHOCK
dbw 8, THUNDER_WAVE
dbw 15, DETECT
dbw 22, PLUCK
dbw 29, ANCIENTPOWER
dbw 36, CHARGE
dbw 43, AGILITY
dbw 50, DISCHARGE
dbw 57, ROOST
dbw 64, LIGHT_SCREEN
dbw 71, DRILL_PECK
dbw 78, THUNDER
dbw 85, RAIN_DANCE
db 0 ; no more level-up moves
MoltresEvosAttacks:
db 0 ; no more evolutions
dbw 1, WING_ATTACK
dbw 1, EMBER
dbw 8, FIRE_SPIN
dbw 15, AGILITY
dbw 22, ENDURE
dbw 29, ANCIENTPOWER
dbw 36, FLAMETHROWER
dbw 43, SAFEGUARD
dbw 50, AIR_SLASH
dbw 57, ROOST
dbw 64, HEAT_WAVE
dbw 71, SOLARBEAM
dbw 78, SKY_ATTACK
dbw 85, SUNNY_DAY
db 0 ; no more level-up moves
DratiniEvosAttacks:
dbbw EVOLVE_LEVEL, 30, DRAGONAIR
db 0 ; no more evolutions
dbw 1, WRAP
dbw 1, LEER
dbw 5, THUNDER_WAVE
dbw 11, TWISTER
dbw 15, DRAGON_RAGE
dbw 21, SLAM
dbw 25, AGILITY
dbw 31, AQUA_TAIL
dbw 35, DRAGON_RUSH
dbw 41, SAFEGUARD
dbw 45, DRAGON_DANCE
dbw 51, OUTRAGE
dbw 55, HYPER_BEAM
db 0 ; no more level-up moves
DragonairEvosAttacks:
dbbw EVOLVE_LEVEL, 55, DRAGONITE
db 0 ; no more evolutions
dbw 1, WRAP
dbw 1, LEER
dbw 1, THUNDER_WAVE
dbw 1, TWISTER
dbw 5, THUNDER_WAVE
dbw 11, TWISTER
dbw 15, DRAGON_RAGE
dbw 21, SLAM
dbw 25, AGILITY
dbw 33, AQUA_TAIL
dbw 39, DRAGON_RUSH
dbw 47, SAFEGUARD
dbw 53, DRAGON_DANCE
dbw 61, OUTRAGE
dbw 67, HYPER_BEAM
db 0 ; no more level-up moves
DragoniteEvosAttacks:
db 0 ; no more evolutions
dbw 1, FIRE_PUNCH
dbw 1, THUNDERPUNCH
dbw 1, WRAP
dbw 1, LEER
dbw 1, THUNDER_WAVE
dbw 1, TWISTER
dbw 1, ROOST
dbw 5, THUNDER_WAVE
dbw 11, TWISTER
dbw 15, DRAGON_RAGE
dbw 21, SLAM
dbw 25, AGILITY
dbw 33, AQUA_TAIL
dbw 39, DRAGON_RUSH
dbw 47, SAFEGUARD
dbw 53, DRAGON_DANCE
dbw 55, WING_ATTACK
dbw 64, OUTRAGE
dbw 73, HYPER_BEAM
db 0 ; no more level-up moves
MewtwoEvosAttacks:
db 0 ; no more evolutions
dbw 1, DISABLE
dbw 1, CONFUSION
dbw 8, BARRIER
dbw 15, SWIFT
dbw 22, FUTURE_SIGHT
dbw 29, PSYCH_UP
dbw 36, MIRACLE_EYE
dbw 43, MIST
dbw 50, PSYCHO_CUT
dbw 57, AMNESIA
dbw 64, POWER_SWAP
dbw 64, GUARD_SWAP
dbw 71, PSYCHIC_M
dbw 79, ME_FIRST
dbw 86, RECOVER
dbw 93, SAFEGUARD
dbw 100, AURA_SPHERE
db 0 ; no more level-up moves
MewEvosAttacks:
db 0 ; no more evolutions
dbw 1, POUND
dbw 1, TRANSFORM
dbw 10, MEGA_PUNCH
dbw 20, METRONOME
dbw 30, PSYCHIC_M
dbw 40, BARRIER
dbw 50, ANCIENTPOWER
dbw 60, AMNESIA
dbw 70, ME_FIRST
dbw 80, BATON_PASS
dbw 90, NASTY_PLOT
dbw 100, AURA_SPHERE
db 0 ; no more level-up moves
|
BraveBrowser/toggleBtwnScrptsBlockdAndAllowdAtBraveShield/preBraveVersion0.64_testedw0.61/toggle.applescript | dm4rnde/FewScriptsForUIAutomateInMacOS | 0 | 3872 | # Author: dm4rnde (<EMAIL>; https://github.com/dm4rnde)
# MIT License
# Copyright (c) 2019 dm4rnde (<EMAIL>)
# https://github.com/dm4rnde/FewScriptsForUIAutomateInMacOS
# 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.
# Precondition to run:
# - must have 'Brave Browser' opened AND
# - must have tab opened showing web page AND
# - (must have 'script blocking' off ('Brave Shields ...' shows 'All scripts allowed') on that web page
# OR
# must have 'script blocking' on ('Brave Shields ...' shows 'Scripts blocked') on that web page) AND
# - there shouldn't be any other popups, search boxes, or similar taking over the focus
# within 'Brave Browser'
#test; uncomment 1 line at a time only
#toBlocked(true)
#toBlocked(false)
-- A subroutine, that will do all the work.
-- blockAllScripts : boolean : true (to block all scripts -- to 'Scripts blocked')
-- blockAllScripts : boolean : false (to allow all scripts -- to 'All scripts allowed')
on toBlocked(blockAllScripts)
tell application "Brave Browser" to activate
# init vars
tell application "Brave Browser" to set activeTabNme to get title of window 1
set winNme to activeTabNme & " - Brave"
set shldsBtnNme to "Brave Shields
Has access to this site"
#
# 1. click on the lion icon on the 'address bar', which will open 'Brave Shields ...' overlay-like
# element
#
# # # # #
#(*finetunedelay)
#delay 1
try
tell application "Brave Browser" to activate
tell application "System Events" to tell process "Brave"
try
set theBtn to button shldsBtnNme of group 1 of group 1 of window winNme
on error errorMessage1 number errorNumber1
#guard against: Private Window is opened
#Private Window has ' (Private)' eppended to a window name
set winNme to winNme & " (Private)"
end try
set theBtn to button shldsBtnNme of group 1 of group 1 of window winNme
#now if it is not even Private Window case, then just fail
tell theBtn to perform action "AXPress"
end tell
on error errorMessage2 number errorNumber2
display dialog "ERROR2: " & errorMessage2
# in that case, fail all
return errorMessage2
end try
#(*finetunedelay)
delay 0.4
# It is very important to have some delay here,
# to allow new UI element to appear
#
# 2. then go to pre-last drop down and click on it to open drop-down;
# 3. then go to intended new value, click on it, and wait until page reloads;
#
# # # # #
#tell application "Brave Browser" to activate
try
# Will get coordinates of window 1 (which is a 'Brave Shields ...', an overlay-like element)
tell application "System Events" to tell process "Brave"
set overlyBrShieldPosn to get position of image 1 of group 1 of window 1
end tell
on error errorMessage3 number errorNumber3
display dialog "ERROR3: " & errorMessage3
# in that case, fail all
return errorMessage3
end try
#(*finetunecoord)
# Fine tune location so to click on pre-last drop down
set xCooe to ((item 1 of overlyBrShieldPosn) + 150)
set yCooe to ((item 2 of overlyBrShieldPosn) + 340)
# It is difficult to get basic click working w/ applescript alone,
# using non-applescript solution
# https://discussions.apple.com/thread/3708948
# Coordinates, from somewhere around where drop down is
set x to xCooe
set y to yCooe
#(*finetunecoord)
if blockAllScripts then
set yShift to 25
else
set yShift to 3
end if
#(*finetunecoord)
# After drop down has been opened, this is to adjust
# coordinates to click certain text
set y2 to (yCooe - yShift)
do shell script "
/usr/bin/python <<END
import time
from Quartz.CoreGraphics import CGEventCreate
from Quartz.CoreGraphics import CGEventGetLocation
from Quartz.CoreGraphics import CGEventCreateMouseEvent
from Quartz.CoreGraphics import CGEventPost
from Quartz.CoreGraphics import kCGMouseButtonLeft
from Quartz.CoreGraphics import kCGHIDEventTap
from Quartz.CoreGraphics import kCGEventMouseMoved
from Quartz.CoreGraphics import kCGEventLeftMouseDown
from Quartz.CoreGraphics import kCGEventLeftMouseUp
def mouseEvent(type, pos_x, pos_y):
e = CGEventCreateMouseEvent(None, type, (pos_x, pos_y), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, e)
def mouseMove(pos_x, pos_y):
mouseEvent(kCGEventMouseMoved, pos_x, pos_y)
def mouseClick(pos_x, pos_y):
mouseEvent(kCGEventLeftMouseDown, pos_x, pos_y)
mouseEvent(kCGEventLeftMouseUp, pos_x, pos_y)
cg_event = CGEventCreate(None)
current_pos = CGEventGetLocation(cg_event) # save current mouse position
mouseClick(" & x & "," & y & ") # go to pre-last drop down and open drop-down
#(*finetunedelay)
time.sleep(0.5) # give it some time for UI to make changes appear
mouseClick(" & x & "," & y2 & ") # select intended new value
mouseMove(int(current_pos.x), int(current_pos.y)) # restore mouse position
END"
#(*finetunedelay)
# Must give it some time for reloading
# (as don't want to press Escape too soon,
# as Escape has another meaning in browser --
# stop loading the page --, which we don't
# want; we just want to hide the UI element
# 'Brave Shields ...')
delay 3.5
#
# 4. finally close the 'Brave Shields ...' element
#
# # # # #
tell application "System Events"
# Keyboard key Escape
key code 53
# Second Escape press is to cover those cases,
# when intended value was already selected
# and no drop down value was actually changed
# (nothing changed)
#(*finetunedelay)
delay 0.5
key code 53
end tell
end toBlocked
|
programs/oeis/088/A088828.asm | neoneye/loda | 22 | 6238 | ; A088828: Nonsquare positive odd numbers.
; 3,5,7,11,13,15,17,19,21,23,27,29,31,33,35,37,39,41,43,45,47,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213
mov $1,$0
seq $0,204164 ; Symmetric matrix based on f(i,j)=floor[(i+j)/2], by antidiagonals.
add $0,$1
mul $0,2
add $0,1
|
alloy4fun_models/trashltl/models/7/AKkjvuoAZkjY5C7Yc.als | Kaixi26/org.alloytools.alloy | 0 | 3613 | open main
pred idAKkjvuoAZkjY5C7Yc_prop8 {
always (some link.File implies eventually link.File in Trash)
}
pred __repair { idAKkjvuoAZkjY5C7Yc_prop8 }
check __repair { idAKkjvuoAZkjY5C7Yc_prop8 <=> prop8o } |
39.asm | AsadKhalil/Assembly_x86 | 0 | 9848 | <gh_stars>0
[org 0x0100]
jmp start
input: dw 6
prime:
push bp
mov bp, sp
sub sp, 2
push ax
push bx
push cx
push dx
mov word[bp-2], 0
mov bx, [bp+4]
mov cx,bx
loop1:
mov dx,0
mov ax,cx
dec bx
cmp bx,1
je true1
div bx
cmp dx,0
je false1
jmp loop1
true1:
mov word[bp+6], 1 ;moving prime from ax to return value space
jmp end1
false1:
mov word[bp+6],0
end1:
pop dx
pop cx ;restore value of si
pop bx ;restore value of bx
pop ax ;restore value of ax
add sp, 2 ;removing local variable from memory
pop bp ;restoring old value of bp
ret 2 ;removing parameters from stack
adjacent:
push bp
mov bp, sp
sub sp, 2
push bx
push dx
mov word[bp-2], 0 ;initialize local variable to 0
mov bx, [bp+4] ;address of input
loop2:
dec bx
sub sp, 2 ;space for return value
push bx ;push address of input
call prime ;call function
pop dx ;pop return value
cmp dx,0
je loop2
mov [bp+6],bx
end2:
pop dx
pop bx ;restore value of bx
add sp, 2 ;removing local variable from memory
pop bp ;restoring old value of bp
ret 2 ;removing parameters from stack
start:
sub sp, 2 ;space for return value
push word[input] ;push address of input
call prime ;call function
pop dx ;pop return value
cmp dx,0
je exit1
sub sp, 2 ;space for return value
push word[input]
call adjacent
pop dx
exit1:
mov ax, 0x4c00
int 21h
|
programs/oeis/139/A139700.asm | karttu/loda | 1 | 81333 | ; A139700: Binomial transform of [1, 30, 30, 30, ...].
; 1,31,91,211,451,931,1891,3811,7651,15331,30691,61411,122851,245731,491491,983011,1966051,3932131,7864291,15728611,31457251,62914531,125829091,251658211,503316451,1006632931,2013265891,4026531811,8053063651,16106127331
mov $1,2
pow $1,$0
sub $1,1
mul $1,30
add $1,1
|
Cubical/Algebra/Group/Abelianization/Properties.agda | gmagaf/cubical | 0 | 9593 | <filename>Cubical/Algebra/Group/Abelianization/Properties.agda
{-
This file contains:
- the abelianization of groups as a HIT as proposed in https://arxiv.org/abs/2007.05833
The definition of the abelianization is not as a set-quotient, since the relation of
abelianization is cumbersome to work with.
-}
{-# OPTIONS --safe #-}
module Cubical.Algebra.Group.Abelianization.Properties where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.Data.Sigma
open import Cubical.Algebra.Group.Base
open import Cubical.Algebra.Group.Properties
open import Cubical.Algebra.Group.Morphisms
open import Cubical.Algebra.Group.MorphismProperties
using (isPropIsGroupHom; compGroupHom; idGroupHom)
open import Cubical.Algebra.AbGroup.Base
open import Cubical.Algebra.Group.Abelianization.Base
private
variable
ℓ : Level
module _ (G : Group ℓ) where
open GroupStr {{...}}
open GroupTheory G
private
instance
_ = snd G
-- Some helpful lemmas, similar to those in Cubical/HITs/SetQuotients/Properties.agda
elimProp : {B : Abelianization G → Type ℓ}
→ (Bprop : (x : Abelianization G) → isProp (B x))
→ (f : (g : fst G) → B (η g))
→ (x : Abelianization G)
→ B x
elimProp Bprop f (η g) = f g
elimProp {B = B} Bprop f (comm a b c i) =
isProp→PathP (λ i → Bprop (comm a b c i)) (f (a · (b · c))) (f (a · (c · b))) i
elimProp Bprop f (isset x y p q i j) =
isOfHLevel→isOfHLevelDep
2 (λ x → isProp→isSet (Bprop x)) (g x) (g y) (cong g p) (cong g q) (isset x y p q) i j
where
g = elimProp Bprop f
elimProp2 : {C : Abelianization G → Abelianization G → Type ℓ}
→ (Cprop : (x y : Abelianization G) → isProp (C x y))
→ (f : (a b : fst G) → C (η a) (η b))
→ (x y : Abelianization G)
→ C x y
elimProp2 Cprop f = elimProp (λ x → isPropΠ (λ y → Cprop x y))
(λ x → elimProp (λ y → Cprop (η x) y) (f x))
elimProp3 : {D : Abelianization G → Abelianization G → Abelianization G → Type ℓ}
→ (Dprop : (x y z : Abelianization G) → isProp (D x y z))
→ ((a b c : fst G) → D (η a) (η b) (η c))
→ (x y z : Abelianization G)
→ D x y z
elimProp3 Dprop f = elimProp (λ x → isPropΠ2 (λ y z → Dprop x y z))
(λ x → elimProp2 (λ y z → Dprop (η x) y z) (f x))
elimContr : {B : Abelianization G → Type ℓ}
→ (Bcontr : ∀ (a : fst G) → isContr (B (η a)))
→ (x : Abelianization G)
→ B x
elimContr Bcontr = elimProp (elimProp (λ _ → isPropIsProp) λ _ → isContr→isProp (Bcontr _))
λ _ → Bcontr _ .fst
elimContr2 : {C : Abelianization G → Abelianization G → Type ℓ}
→ (Ccontr : ∀ (a b : fst G) → isContr (C (η a) (η b)))
→ (x y : Abelianization G)
→ C x y
elimContr2 Ccontr = elimContr λ _ → isOfHLevelΠ 0
(elimContr λ _ → inhProp→isContr (Ccontr _ _) isPropIsContr)
rec : {M : Type ℓ}
(Mset : isSet M)
(f : fst G → M)
(fcomm : (a b c : fst G) → f (a · (b · c)) ≡ f (a · (c · b)))
→ Abelianization G → M
rec Mset f fcomm (η g) = f g
rec Mset f fcomm (comm a b c i) = fcomm a b c i
rec Mset f fcomm (isset a b p q i j) = Mset (g a) (g b) (cong g p) (cong g q) i j
where
g = rec Mset f fcomm
rec2 : {M : Type ℓ}
(Mset : isSet M)
(f : fst G → fst G → M)
(fcomml : (a b c d : fst G) → f (a · (b · c)) d ≡ f (a · (c · b)) d)
(fcommr : (a b c d : fst G) → f a (b · (c · d)) ≡ f a (b · (d · c)))
→ Abelianization G → Abelianization G → M
rec2 Mset f fcomml fcommr =
rec
(isSetΠ (λ _ → Mset))
(λ g → rec Mset (λ h → f g h) (fcommr g))
(λ a b c → funExt (elimProp (λ _ → Mset _ _) (λ d → fcomml a b c d)))
module AbelianizationGroupStructure (G : Group ℓ) where
open GroupStr {{...}}
open GroupTheory G
private
instance
_ = snd G
{-
Definition of the group structure on the abelianization. Here the generality of the comm
relation is used.
-}
_·Ab_ : Abelianization G → Abelianization G → Abelianization G
_·Ab_ =
(rec2 G)
isset
(λ x y → η (x · y))
(λ a b c d → η ((a · (b · c)) · d) ≡⟨ cong η (cong (λ x → (x · d)) (assoc _ _ _)) ⟩
η (((a · b) · c) · d) ≡⟨ cong η (sym (assoc (a · b) c d)) ⟩
η ((a · b) · (c · d)) ≡⟨ comm (a · b) c d ⟩
η ((a · b) · (d · c)) ≡⟨ cong η (sym (assoc _ _ _)) ⟩
η (a · (b · (d · c))) ≡⟨ cong η (cong (λ x → (a · x)) (assoc _ _ _)) ⟩
η (a · ((b · d) · c)) ≡⟨ comm a (b · d) c ⟩
η (a · (c · (b · d))) ≡⟨ cong η (cong (λ x → (a · x)) (assoc _ _ _)) ⟩
η (a · ((c · b) · d)) ≡⟨ cong η (assoc a (c · b) d) ⟩
η ((a · (c · b)) · d) ∎)
(λ a b c d → η (a · (b · (c · d))) ≡⟨ cong η (assoc _ _ _) ⟩
η ((a · b) · (c · d)) ≡⟨ comm (a · b) c d ⟩
η ((a · b) · (d · c)) ≡⟨ cong η (sym (assoc _ _ _)) ⟩
η (a · (b · (d · c))) ∎)
1Ab : Abelianization G
1Ab = η 1g
invAb : Abelianization G → Abelianization G
invAb =
(rec G)
isset
((λ x → η (inv x)))
(λ a b c → η (inv (a · (b · c))) ≡⟨ cong η (invDistr a (b · c)) ⟩
η ((inv (b · c)) · (inv a)) ≡⟨ cong (λ x → η (x · (inv a))) (invDistr b c) ⟩
η (((inv c) · (inv b)) · (inv a)) ≡⟨ cong
η
((sym (lid (((inv c) · (inv b)) · (inv a))))) ⟩
η (1g · (((inv c) · (inv b)) · (inv a))) ≡⟨ comm 1g ((inv c) · (inv b)) (inv a) ⟩
η (1g · ((inv a) · ((inv c) · (inv b)))) ≡⟨ cong η (lid ((inv a) · ((inv c) · (inv b)))) ⟩
η ((inv a) · ((inv c) · (inv b))) ≡⟨ comm (inv a) (inv c) (inv b) ⟩
η ((inv a) · ((inv b) · (inv c))) ≡⟨ cong
η
((sym (lid ((inv a) · ((inv b) · (inv c)))))) ⟩
η (1g · ((inv a) · ((inv b) · (inv c)))) ≡⟨ comm 1g (inv a) ((inv b) · (inv c)) ⟩
η (1g · (((inv b) · (inv c)) · (inv a))) ≡⟨ cong η (lid (((inv b) · (inv c)) · (inv a))) ⟩
η (((inv b) · (inv c)) · (inv a)) ≡⟨ cong
(λ x → η (x · (inv a)))
(sym (invDistr c b)) ⟩
η ((inv (c · b)) · (inv a)) ≡⟨ cong η (sym (invDistr a (c · b))) ⟩
η (inv (a · (c · b))) ∎)
assocAb : (x y z : Abelianization G) → x ·Ab (y ·Ab z) ≡ (x ·Ab y) ·Ab z
assocAb =
(elimProp3 G)
(λ x y z → isset (x ·Ab (y ·Ab z)) ((x ·Ab y) ·Ab z))
(λ x y z → cong η (assoc x y z))
ridAb : (x : Abelianization G) → x ·Ab 1Ab ≡ x
ridAb =
(elimProp G)
(λ x → isset (x ·Ab 1Ab) x)
(λ x → cong η (rid x))
rinvAb : (x : Abelianization G) → x ·Ab (invAb x) ≡ 1Ab
rinvAb =
(elimProp G)
(λ x → isset (x ·Ab (invAb x)) 1Ab)
(λ x → (η x) ·Ab (invAb (η x)) ≡⟨ refl ⟩
(η x) ·Ab (η (inv x)) ≡⟨ refl ⟩
η (x · (inv x)) ≡⟨ cong η (fst (inverse x)) ⟩
η 1g ≡⟨ refl ⟩
1Ab ∎)
commAb : (x y : Abelianization G) → x ·Ab y ≡ y ·Ab x
commAb =
(elimProp2 G)
(λ x y → isset (x ·Ab y) (y ·Ab x))
(λ x y → (η x) ·Ab (η y) ≡⟨ refl ⟩
η (x · y) ≡⟨ cong η (sym (lid (x · y))) ⟩
η (1g · (x · y)) ≡⟨ comm 1g x y ⟩
η (1g · (y · x)) ≡⟨ cong η (lid (y · x)) ⟩
η (y · x) ≡⟨ refl ⟩
(η y) ·Ab (η x) ∎)
-- The proof that the abelianization is in fact an abelian group.
asAbelianGroup : AbGroup ℓ
asAbelianGroup = makeAbGroup 1Ab _·Ab_ invAb isset assocAb ridAb rinvAb commAb
-- The proof that η can be seen as a group homomorphism
ηAsGroupHom : GroupHom G (AbGroup→Group asAbelianGroup)
ηAsGroupHom = f , fIsHom
where
f = λ x → η x
fIsHom : IsGroupHom (snd G) f (snd (AbGroup→Group asAbelianGroup))
IsGroupHom.pres· fIsHom = λ x y → refl
IsGroupHom.pres1 fIsHom = refl
IsGroupHom.presinv fIsHom = λ x → refl
AbelianizationAbGroup : (G : Group ℓ) → AbGroup ℓ
AbelianizationAbGroup G = AbelianizationGroupStructure.asAbelianGroup G
AbelianizationHom : (G : Group ℓ) → GroupHom G (AbGroup→Group (AbelianizationAbGroup G))
AbelianizationHom G = AbelianizationGroupStructure.ηAsGroupHom G
module UniversalProperty (G : Group ℓ) where
open GroupStr {{...}}
open GroupTheory G
open AbelianizationGroupStructure G
private
instance
_ = snd G
abstract
{- The proof of the universal property of the abelianization.
G --η--> abelianization
\ .
\ .
f ∃! inducedHom
\ .
\ .
H
commuting diagram
-}
inducedHom : (H : AbGroup ℓ)
→ (f : GroupHom G (AbGroup→Group H))
→ AbGroupHom asAbelianGroup H
inducedHom H f = g , gIsHom
where open IsGroupHom
instance
_ : GroupStr (fst H)
_ = snd (AbGroup→Group H)
f' : fst G → fst H
f' = fst f
g : Abelianization G → fst H
g = (rec G)
(isSetAbGroup H)
(λ x → (f') x)
(λ a b c → f' (a · b · c) ≡⟨ (snd f).pres· a (b · c) ⟩
(f' a) · (f' (b · c)) ≡⟨ cong
(λ x → (f' a) · x)
((snd f).pres· b c) ⟩
(f' a) · (f' b) · (f' c) ≡⟨ cong
(λ x → (f' a) · x)
((snd H).AbGroupStr.comm (f' b) (f' c)) ⟩
(f' a) · (f' c) · (f' b) ≡⟨ cong
(λ x → (f' a) · x)
(sym ((snd f).pres· c b)) ⟩
(f' a) · (f' (c · b)) ≡⟨ sym ((snd f).pres· a (c · b)) ⟩
f' (a · c · b) ∎)
gIsHom : IsGroupHom (snd (AbGroup→Group asAbelianGroup)) g (snd (AbGroup→Group H))
pres· gIsHom =
(elimProp2 G)
(λ x y → isSetAbGroup H _ _)
((snd f).pres·)
pres1 gIsHom = (snd f).pres1
presinv gIsHom =
(elimProp G)
(λ x → isSetAbGroup H _ _)
((snd f).presinv)
commutativity : (H : AbGroup ℓ)
→ (f : GroupHom G (AbGroup→Group H))
→ (compGroupHom ηAsGroupHom (inducedHom H f) ≡ f)
commutativity H f =
Σ≡Prop
(λ _ → isPropIsGroupHom _ _)
(λ i x → q x i)
where q : (x : fst G)
→ fst (compGroupHom ηAsGroupHom (inducedHom H f)) x ≡ fst f x
q = (λ x → refl)
uniqueness : (H : AbGroup ℓ)
→ (f : GroupHom G (AbGroup→Group H))
→ (g : AbGroupHom asAbelianGroup H)
→ (p : compGroupHom ηAsGroupHom g ≡ f)
→ (g ≡ inducedHom H f)
uniqueness H f g p =
Σ≡Prop
(λ _ → isPropIsGroupHom _ _)
(λ i x → q x i)
where q : (x : Abelianization G)
→ fst g x ≡ fst (inducedHom H f) x
q = (elimProp G)
(λ _ → isSetAbGroup H _ _)
(λ x → fst g (η x) ≡⟨ cong (λ f → f x) (cong fst p) ⟩
(fst f) x ≡⟨ refl ⟩
fst (inducedHom H f) (η x)∎)
|
OS2.1/CPinti/core/older/i386/GestDMI.asm | Cwc-Test/CpcdosOS2.1 | 0 | 165027 | <reponame>Cwc-Test/CpcdosOS2.1
; *** Gestion du multi-core ***
; En developpement / Adaptation par <NAME>
; 24-07-2015
; Maj : 27-10-2015
;
; Remerciements a <NAME>
;-------------------------------------------------------------------------------------------
FORMAT MZ
ENTRY CODE16:Start16
STACK STACK16:sseg16
; Definition des macro
macro sleep16 Ginette_La_Voisine
{
; Important s'il on veut laisser les autres coeurs se reveiller
push ax
mov al,0x30
out 0x43,al
mov ax,Ginette_La_Voisine
; Envoyer 1 petit octet
out 0x40, al
xchg al,ah
; Et un plus gros
out 0x40, al
; et on verifie
local .lchk1
.lchk1:
mov al,0xE2
out 0x43,al
in al,0x40
mov ah,al
in al,0x40
xchg al,ah
cmp ax,0
jnz .lchk1
; ** CRASH **
; bt ax,7
; jnc .lchk1
; ***********
pop ax
}
macro lock16 trg,del = -1
{
push ds
push di
push ecx
MOV DI,DATA16
MOV DS,DI
MOV DI,trg
mov ecx,del
call far CODE16:MutexLock16f
pop ecx
pop di
pop ds
}
macro lock32 trg,del = -1
{
push ds
push di
push ecx
MOV DI,pm_sel_mydata16
MOV DS,DI
MOV DI,trg
mov ecx,del
db 066h
db 09ah
dw MutexLock16f
dw pm_sel_mycode16
pop ecx
pop di
pop ds
}
; --> push ad, eax
macro pushadeax
{
push ebx
push ecx
push edx
push esi
push edi
push ebp
}
; --> pop ad, eax
macro popadeax
{
pop ebp
pop edi
pop esi
pop edx
pop ecx
pop ebx
}
macro spin v
{
push ecx
mov ecx,v
local .l1
local .l2
.l1:
pause
dec ecx
jecxz .l2
jmp .l1
.l2:
pop ecx
}
macro linear reg,trg,seg = DATA16
{
; xor reg,reg
mov reg,seg
shl reg,4
add reg,trg
}
macro lock64 trg,del = -1
{
push rcx
push rdi
mov ecx,del
linear rdi,trg
call MutexLock64
pop rdi
pop rcx
}
macro unlock16 trg
{
push ds
push di
MOV DI,DATA16
MOV DS,DI
MOV DI,trg
call far CODE16:MutexFree16f
pop di
pop ds
}
macro unlock32 trg
{
push ds
push di
MOV DI,pm_sel_mydata16
MOV DS,DI
MOV DI,trg
db 066h
db 09ah
dw MutexFree16f
dw pm_sel_mycode16
pop di
pop ds
}
macro unlock64 trg
{
push rdi
linear rdi,trg
call MutexFree64
pop rdi
}
;-------------------------------------------------------------------------------------------
; Structure Definitions
;-------------------------------------------------------------------------------------------
struc A_CPU a,b,c,d
{
.acpi dd a
.apic dd b
.flags dd c
.handle dd d
}
struc GDT_STR s0_15,b0_15,b16_23,flags,access,b24_31
{
.s0_15 dw s0_15
.b0_15 dw b0_15
.b16_23 db b16_23
.flags db flags
.access db access
.b24_31 db b24_31
}
struc IDT_STR o0_15,se0_15,zb,flags,o16_31
{
.o0_15 dw o0_15
.se0_15 dw se0_15
.zb db zb
.flags db flags
.o16_31 dw o16_31
}
struc IDT_STR64 o0_15,se0_15,zb,flags,o16_31,o32_63,zr
{
.o0_15 dw o0_15
.se0_15 dw se0_15
.zb db zb
.flags db flags
.o16_31 dw o16_31
.o32_63 dd o32_63
.zr dd zr
}
;-------------------------------------------------------------------------------------------
; data segment
;-------------------------------------------------------------------------------------------
SEGMENT DATA16 USE16
ORG 0
; Messages
m1 db "Interface multicore pour CPinti Core.",0dh,0ah,"$"
m2 db "DMMI installe!.",0dh,0ah,"$"
m3 db "DMMI desinstalle.",0dh,0ah,"$"
testr db 0
page1gb equ 1
IntCompleted db 0
null1 db 100 dup (0)
intf1called db 0
null2 db 100 dup (0)
real_regs dw 10 dup (0); ax,bx,cx,dx,si,di,ds,es,int,flags
null3 db 100 dup (0)
; ACPI compatible, Lenovo B590, et certains ASUS -> Adresse a chercher!
tester_mutex db 0xFF
mut_ipi db 0xFF
mut_f1 db 0xFF
maxmutex = 128
mutexs db maxmutex dup (254)
numcpus db 0
somecpu A_CPU 0,0,0,0
cpusstructize = $-(somecpu)
CpusOfs:
cpus db cpusstructize*64 dup(0)
MainCPUAPIC db 0
LocalApic dd 0xFEE00000
XsdtAddress dq 0
StartSipiAddrOfs dw 0
StartSipiAddrSeg dw 0
ProcedureStart dd 0
RealIDT db 6 dup (0)
; GDT
pm_sel_mycode32 = 0x08
pm_sel_mycode16 = 0x10
pm_sel_mydata32 = 0x18
pm_sel_mydata16 = 0x20
pm_sel_rcode32 = 0x28
pm_sel_rcode16 = 0x30
pm_sel_rdata32 = 0x38
pm_sel_rdata16 = 0x40
pm_sel_rcode64 = 0x48
pm_sel_rdata64 = 0x50
; Full GDT
gdt_start dw gdt_size
gdt_ptr dd 0
dummy_descriptor GDT_STR 0,0,0,0,0,0
mycode32_descriptor GDT_STR 0ffffh,0,0,9ah,0cfh,0 ; 4GB 32-bit code
mycode16_descriptor GDT_STR 0ffffh,0,0,9ah,0,0 ; 64k 16-bit code
mydata32_descriptor GDT_STR 0ffffh,0,0,92h,0cfh,0 ; 4GB 32-bit data
mydata16_descriptor GDT_STR 0ffffh,0,0,92h,0,0 ; 64k 16-bit data
rcode32_descriptor GDT_STR 0ffffh,0,0,9ah,0cfh,0 ; 4GB 32-bit code
rcode16_descriptor GDT_STR 0ffffh,0,0,9ah,0,0 ; 64k 16-bit code
rdata32_descriptor GDT_STR 0ffffh,0,0,92h,0cfh,0 ; 4GB 32-bit data
rdata16_descriptor GDT_STR 0ffffh,0,0,92h,0,0 ; 64k 16-bit data
code64_descriptor GDT_STR 0ffffh,0,0,9ah,0afh,0 ; 16TB 64-bit code, 08cfh access = 01001111b = Big,64bit (0), 1111 more size
data64_descriptor GDT_STR 0ffffh,0,0,92h,0afh,0 ; 16TB 64-bit data, 08cfh access = 10001111b = Big,64bit (0), 1111 more size
gdt_size = $-(dummy_descriptor)
; Mode GDT (non reel)
gdt_startUNR dw gdt_sizeUNR
gdt_ptrUNR dd 0
dummy_descriptorUNR GDT_STR 0,0,0,0,0,0
code16_descriptorUNR GDT_STR 0ffffh,0,0,9ah,0,0
data32_descriptorUNR GDT_STR 0ffffh,0,0,92h,0cfh,0
gdt_sizeUNR = $-(dummy_descriptorUNR)
; IDT protege
idt_PM_start dw idt_size
idt_PM_ptr dd 0
interruptsall db 2048 dup (0)
idt_size=$-(interruptsall)
; IDT long
lidt_PM_start dw lidt_size
lidt_PM_ptr dq 0
linterruptsall db 4096 dup (0)
lidt_size=$-(linterruptsall)
LONGPAGEABS dd 0
;-------------------------------------------------------------------------------------------
; 16 bit stack segment
;-------------------------------------------------------------------------------------------
SEGMENT STACK16 USE16
ORG 0
sseg16 dw 2048 dup (?)
stack16_end:
;-------------------------------------------------------------------------------------------
; Segment to store page entries
;-------------------------------------------------------------------------------------------
SEGMENT PAGEFORLONG USE16
dummy dd 10000 dup (0)
;-------------------------------------------------------------------------------------------
; 16 bit stack segment for sipi
;-------------------------------------------------------------------------------------------
SEGMENT STACK16S USE16
ORG 0
sseg16s dw 2048 dup (?)
stack16s_end:
;-------------------------------------------------------------------------------------------
; 16 bit code segment
;-------------------------------------------------------------------------------------------
SEGMENT CODE16 USE16
ORG 0h
OldIntF0 dd 0
OrgPSP DW 0
OldIntF1 dd 0
OldIntF2 dd 0
OldInt21 dd 0
;-------------------------------------------------------------------------------------------
; RealCall
;-------------------------------------------------------------------------------------------
RealCall:
pushf
push cs
call f0real
retf
;-------------------------------------------------------------------------------------------
; Interrupt 0x21
;-------------------------------------------------------------------------------------------
rd21:
push ax
push ds
push bx
mov ax,DATA16
mov ds,ax
call far CODE16:GetMyApic16f
cmp bl,0
jz .GoOld
pop bx
pop ds
pop ax
mov bp,ax
mov ax,0x0421
int 0xF0
iret
.GoOld:
pop bx
pop ds
pop ax
jmp far [cs:OldInt21]
;-------------------------------------------------------------------------------------------
; Interrupt 0xF0 :
;-------------------------------------------------------------------------------------------
f0real:
jmp .a00
db 'dmmi'
db 'dmmi'
.a00:
; push ax
; mov al,0x20
; out 0x20,al
; pop ax
.a0:
; ah = 0, init
cmp ah,0
jnz .ea0
push ds
mov ax,DATA16
mov ds,ax
xor bx,bx
mov bl,[ds:numcpus]
call far CODE16:FindFreeCPU16
xor eax,eax
push esi
mov esi,cpus
xor cx,cx
mov cl,[ds:numcpus]
dec cx
mov ax,0
add esi,cpusstructize ; bypass first cpu
.l1:
cmp dword [esi + 12],0
jnz .l4
inc ax
.l4:
dec cx
add esi,cpusstructize
jcxz .l2
jmp .l1
.l2:
mov ecx,eax
pop esi
mov ax,DATA16
mov dx,cpus
mov dx,pm_sel_mycode32
mov gs,dx
mov dx,CODE16
mov es,dx
mov dx,RealCall
mov esi,ProtectedCall
mov edi,LongCall
xchg cx,bx
pop ds
iret
.ea0:
cmp ah,0x01
jz .a0100
jmp .a2
.a0100:
; REAL mode thread
; Start Real mode thread
; EDX seg:ofs (or if bit 2 of AL is 1, DX ofs, SI seg)
; BX cpu index, or 0
bt ax,0
jc .ea1a0
bt ax,1
jc .ea1a0
bt ax,2
push ds
pushf
xor eax,eax
mov ax,DATA16
mov ds,ax
mov [ds:IntCompleted],0
mov [ds:ProcedureStart],0
popf
jc .prepx
mov [ds:StartSipiAddrOfs],dx
shr edx,16
mov [ds:StartSipiAddrSeg],dx
jmp .okx
.prepx:
; Set a call-one (useful for C)
mov word [ds:ProcedureStart],dx
mov word [ds:ProcedureStart + 2],si
; db 0xcc
; pushad
; call far [ds:ProcedureStart]
; popad
mov [ds:StartSipiAddrOfs],PrepRM
mov [ds:StartSipiAddrSeg],CODE16
.okx:
pop ds
cmp bx,0
jnz .bxn0
call far CODE16:FindFreeCPU16
cmp ax,0
jnz .cont
.ef:
mov ax,0
iret
.bxn0:
mov eax,ebx
.cont:
push ebx
push eax
pop ebx
; save handle
call GetLinearCPUPtr16
mov [fs:eax + 12],ebx
push ds
mov ax,DATA16
mov ds,ax
call far CODE16:SendSIPIf
pop ds
pop eax ;keep ebx, handle
mov eax,ebx
; iii Loop for completion of interrupt
push ax
push ds
mov ax,DATA16
mov ds,ax
.iii:
jecxz .liii
cmp ecx,-1
jz .nliii
dec ecx
.nliii:
pause
cmp [ds:IntCompleted],1
jnz .iii
.liii:
pop ds
pop ax
.endiii:
iret
.ea1a0:
.a1a2:
; Start Protected mode thread
; Low AL 2 bits = 1
; edx,esi,edi
; starts from org 0 segnent esi
; BX cpu index, or 0
bt ax,0
jnc .ea1a2
bt ax,1
jc .ea1a2
call CODE16:GDTInitF
xor eax,eax
push ds
mov ax,DATA16
mov ds,ax
mov [ds:IntCompleted],0
mov [ds:StartSipiAddrOfs],PrepPM
mov [ds:StartSipiAddrSeg],CODE16
pop ds
cmp bx,0
jnz .bxn1
call far CODE16:FindFreeCPU16
cmp ax,0
jnz .cont1
.ef2:
mov ax,0
iret
.bxn1:
mov eax,ebx
.cont1:
push ebx
push eax
pop ebx
; save handle
call GetLinearCPUPtr16
mov [fs:eax + 12],ebx
call far CODE16:SendSIPIf
pop eax ;keep ebx, handle
mov eax,ebx
; iii Loop for completion of interrupt
push ax
push ds
mov ax,DATA16
mov ds,ax
.iii2:
jecxz .liii2
cmp ecx,-1
jz .nliii2
dec ecx
.nliii2:
pause
cmp [ds:IntCompleted],1
jnz .iii2
.liii2:
pop ds
pop ax
.endiii2:
iret
.ea1a2:
.a1a3:
; Start Long x64 mode thread
; starts from physcal esi
; BX cpu index, or 0
bt ax,0
jc .ea1a3
bt ax,1
jnc .ea1a3
; Linear Start
push ds
mov ax,CODE64
mov ds,ax
mov [ds:PutLinearStart64X],esi
pop ds
call CODE16:GDTInitF
xor eax,eax
push ds
mov ax,DATA16
mov ds,ax
mov [ds:IntCompleted],0
mov [ds:StartSipiAddrOfs],PrepLM
mov [ds:StartSipiAddrSeg],CODE16
pop ds
cmp bx,0
jnz .bxn2
call far CODE16:FindFreeCPU16
cmp ax,0
jnz .cont2
.ef3:
mov ax,0
iret
.bxn2:
mov eax,ebx
.cont2:
push ebx
push eax
pop ebx
; save handle
call GetLinearCPUPtr16
mov [fs:eax + 12],ebx
call far CODE16:SendSIPIf
pop eax ;keep ebx, handle
mov eax,ebx
; iii Loop for completion of interrupt
push ax
push ds
mov ax,DATA16
mov ds,ax
.iii3:
jecxz .liii3
cmp ecx,-1
jz .nlii3
dec ecx
.nlii3:
pause
cmp [ds:IntCompleted],1
jnz .iii3
.liii3:
pop ds
pop ax
.endiii3:
iret
.ea1a3:
.a2:
; End thread
cmp ah,0x02
jnz .ea2
push ds
mov ax,DATA16
mov ds,ax
call far CODE16:GetMyApic16f
mov eax,ebx
call FAR CODE16:CPUIndexFromAPIC16f
mov ebx,eax
; remove handle
call GetLinearCPUPtr16
mov dword [fs:eax + 12],0
; Wake CPU
xor ebx,ebx
mov ECX,0F2h
MOV bp,DATA16
MOV ds,BP
; call FAR CODE16:SendIPIF
.s1:
cli
hlt
jmp .s1
iret
.ea2:
.a3:
; Wait for CPU
cmp ah,0x03
jnz .ea3
cmp al,0x1
jnz .NoHLT
; Wait using int 0xF2
mov byte [cs:f2wake],0
.LoopF2:
HLT
cmp byte [cs:f2wake],0
jnz .EndLoopF2
jmp .LoopF2
.EndLoopF2:
iret
.NoHLT:
pushad
; save handle
call GetLinearCPUPtr16
.wft:
pause
cmp dword [fs:eax + 12],0
jnz .wft
popad
iret
.ea3:
.a400: ; Call Interrupt
cmp ah,0x04
jnz .ea4
; BP = AX
; AL = INT N
PUSH DS
PUSHAD
;lock
lock16 mut_f1
mov ax,bp
; put them
mov bp,DATA16
mov ds,bp
MOV BP,real_regs
mov [ds:bp + 0],ax
mov [ds:bp + 2],bx
mov [ds:bp + 4],cx
mov [ds:bp + 6],dx
mov [ds:bp + 8],si
mov [ds:bp + 10],di
popad
pop ds
push ds
pop di
push ds
pushad
MOV bp,DATA16
MOV ds,BP
MOV BP,real_regs
mov [ds:bp + 12],di
mov [ds:bp + 14],es
POPAD
PUSHAD
mov ah,0
push bp
MOV BP,real_regs
mov [ds:bp + 16],ax
pop bp
; call
call far CODE16:GetMyApic16f
mov eax,ebx
call FAR CODE16:CPUIndexFromAPIC16f
mov ebx,eax
mov [ds:intf1called],0
; cmp ebx,0
; jnz .nlocal
; int 0xf1
; jmp .ecall
.nlocal:
; send ipi
xor ebx,ebx
mov ECX,0F1h
push bp
MOV bp,DATA16
MOV ds,BP;
pop bp
call FAR CODE16:SendIPIF
MOV bp,DATA16
MOV ds,BP
.rtr:
pause
cmp byte [ds:intf1called],0
jz .rtr
.ecall:
;lock
; restore regs
POPad
POP ds
MOV bp,DATA16
MOV ds,BP
MOV BP,real_regs
mov ax,[ds:bp]
mov bx,[ds:bp + 2]
mov cx,[ds:bp + 4]
mov dx,[ds:bp + 6]
mov si,[ds:bp + 8]
mov di,[ds:bp + 10]
push ax
push bx
mov ax,[ds:bp + 12]
mov bx,[ds:bp + 14]
mov bp,[ds:bp + 18]
mov ds,ax
mov es,bx
pop bx
pop ax
push bp
popf
PUsh ds
PUshad
;unlock
unlock16 mut_f1
POPad
POP ds
iret
.ea4:
.a500: ; Mutex Alloc, returns in bX
cmp ax,0x0500
jnz .ea500
push ds
push si
mov ax,DATA16
mov ds,ax
mov si,0
.lx1:
cmp byte [ds:mutexs + si],0xFE
jz .freefound
inc si
cmp si,maxmutex
jae .nofreefound
jmp .lx1
.nofreefound:
mov bx,0
mov ax,0
jmp .mlend
.freefound:
mov bx,si
mov ax,1
mov byte [ds:mutexs + si],0xFF
.mlend:
pop si
pop ds
iret
.ea500:
.a501: ; Mutex Free. BX = mut
cmp ax,0x0501
jnz .ea501
push ds
push si
mov ax,DATA16
mov ds,ax
mov si,bx
mov ax,0
cmp byte [ds:mutexs + si],0xFF
jnz .freefail
mov byte [ds:mutexs + si],0xFE
mov ax,1
.freefail:
pop si
pop ds
iret
.ea501:
.a502: ; Mutex Lock. BX = mut
cmp ax,0x0502
jnz .ea502
push ds
push si
mov ax,DATA16
mov ds,ax
mov si,bx
mov ax,0
cmp byte [ds:mutexs + si],0xFE
jz .lockfail
push di
mov di,mutexs
add di,si
call far CODE16:MutexLock16f
pop di
mov ax,1
.lockfail:
pop si
pop ds
iret
.ea502:
.a503: ; Mutex Unlock. BX = mut
cmp ax,0x0503
jnz .ea503
push ds
push si
mov ax,DATA16
mov ds,ax
mov si,bx
mov ax,0
cmp byte [ds:mutexs + si],0xFE
jz .unlockfail
cmp byte [ds:mutexs + si],0xFF
jz .unlockfail
push di
mov di,mutexs
add di,si
call far CODE16:MutexFree16f
pop di
mov ax,1
.unlockfail:
pop si
pop ds
iret
.ea503:
.a504: ; Mutex wait free. BX = mut
cmp ax,0x0504
jnz .ea504
mov eax,-1
push edi
linear edi, mutexs
add di,bx
cmp byte [fs:edi],0xFE
jz .lockfail4
.Loop1:
CMP byte [fs:edi],0xff
JZ .OutLoop1
cmp ecx,-1
jz .nox
dec ecx
jecxz .lockfail4
.nox:
pause
JMP .Loop1
.OutLoop1:
mov ax,1
.lockfail4:
pop edi
iret
.ea504:
.a6:
; Wake CPU
cmp ah,0x06
jnz .ea6
mov ECX,0F2h
MOV bp,DATA16
MOV ds,BP
call FAR CODE16:SendIPIF
iret
.ea6:
.a7: ; Thread initilized and running
cmp ax,0x0700
jnz .ea7
push ax
push ds
mov ax,DATA16
mov ds,ax
mov [ds:IntCompleted],1
pop ds
pop ax
iret
.ea7:
.a99:
cmp ah,0x99
jnz .ea99
; Free interrupts
push cs
call FreeInterrupts
; Free memory
mov ax,[cs:OrgPSP]
mov es,ax
mov ax,0x4900
int 21h
; Goodbye :)
mov ax,4C00h
int 21h
iret
.ea99:
iret
;-------------------------------------------------------------------------------------------
; Interrupt 0xF2 :
;-------------------------------------------------------------------------------------------
f2wake db 0
f2real:
mov byte [cs:f2wake],1
iret
;-------------------------------------------------------------------------------------------
; Interrupt 0xF1 :
;-------------------------------------------------------------------------------------------
; trs db 0
f1real:
if 0
cmp byte [cs:trs],0
jz .fx
; db 0xcc
.fx:
mov byte [cs:trs],1
mov dl,0x31
mov ax,0x0200
int 21h
; mov al,0x20
; out 0x20,al
iret
end if
PUSH DS
push es
PUSHAD
MOV DI,DATA16
MOV DS,DI
;lock
MOV DI,DATA16
MOV DS,DI
MOV BP,real_regs
mov ax,[ds:bp]
mov bx,[ds:bp + 2]
mov cx,[ds:bp + 4]
mov dx,[ds:bp + 6]
mov si,[ds:bp + 8]
mov di,[ds:bp + 10]
push ax
push bx
mov ax,[ds:bp + 12]
mov bx,[ds:bp + 14]
mov bp,[ds:bp + 16]
mov ds,ax
mov es,bx
pop bx
mov ax,4
push dx
mul bp
pop dx
mov bp,ax
pop ax
; call interrupt
push ds
push di
MOV di,DATA16
MOV DS,di
mov di,word [ds:RealIDT + 4];
mov gs,di
mov di,word [ds:RealIDT + 2]; ; gs:di now interrupt vector
add bp,di
pop di
pop ds
pushf
call far [gs:bp]
pushf
; restore regs
push ds
MOV BP,DATA16
MOV DS,BP
MOV BP,real_regs
mov [ds:bp],ax
mov [ds:bp + 2],bx
mov [ds:bp + 4],cx
mov [ds:bp + 6],dx
mov [ds:bp + 8],si
mov [ds:bp + 10],di
pop ds
push ds
pop ax
MOV BP,DATA16
MOV DS,BP
MOV BP,real_regs
mov [ds:bp + 12],ax
push es
pop ax
mov [ds:bp + 14],ax
pop ax
mov [ds:bp + 18],ax
MOV DI,DATA16
MOV DS,DI
mov [ds:intf1called],1
; End of it :)
call SendEOI
POPAD
pop es
POP DS
iret
;-------------------------------------------------------------------------------------------
; GetLinearCPUPtr16 : EBX : index
;-------------------------------------------------------------------------------------------
GetLinearCPUPtr16: ; In EAX
push edx
push ebx
xor eax,eax
mov eax,ebx
mov dx,cpusstructize
mul dx
add eax,cpus
mov ebx,DATA16
shl ebx,4
add ebx,eax
xchg eax,ebx
pop ebx
pop edx
ret
;-------------------------------------------------------------------------------------------
; BackFromLong : Back from long mode, switch to RM before HLT
;-------------------------------------------------------------------------------------------
BackFromLong:
; Switch back to real mode
mov eax, cr0 ; Read CR0.
and eax,7ffffffeh ; Set PE=0.
mov cr0, eax ; Write CR0.
; Deactivate Long Mode
mov ecx, 0c0000080h ; EFER MSR number.
rdmsr ; Read EFER.
btc eax, 8 ; Set LME=0.
wrmsr ; Write EFER.
; Disable PAE
mov eax, cr4
btc eax, 5
btc eax, 4
mov cr4, eax
; Halt
.fx:
CLI
HLT
jmp .fx
;-------------------------------------------------------------------------------------------
; InitPageTable: Initialize Page
;-------------------------------------------------------------------------------------------
InitPageTable:
pushad
push ds
push es
linear eax,0,PAGEFORLONG
mov ECX,0
.L1:
TEST EAX,0xFFF
JZ .L2
INC EAX
INC ECX
JMP .L1
.L2:
mov [DS:LONGPAGEABS],EAX
mov esi,eax
mov edi,eax
; Zero the memory
xor eax, eax
mov edi,ebp
mov ecx,03000h
.lx2:
mov byte [fs:esi],0
inc esi
loop .lx2
sub esi,0x3000
if page1gb eq 1
; 4 Levels: PML4T (512) -> PDPT (512) -> PDT (512) -> PT (512) 4KB page
; We will stop at PDPT with S = 1, to create 1GB pages
; Put the PML4T to 0x0000, these are 512 entries, so it takes 0x1000 bytes
; We only want the first PML4T
mov eax,esi
add eax,0x1000 ; point it to the first PDPT
or eax,3 ; Present, Readable/Writable
mov [fs:esi + 0x0000],eax
mov ecx,4 ; Map 4GB (512*1GB).
mov eax,0x83 ; Also bit 7
mov edi,esi
add edi,0x1000
.lxf1:
mov [fs:edi],eax
add eax,1024*1024*1024
add edi,8
loop .lxf1
else
; 4 Levels: PML4T (512) -> PDPT (512) -> PDT (512) -> PT (512) 4KB page
; In PAE, we will stop at PDT with S = 1, to create 2MB pages
; Put the PML4T to 0x0000, these are 512 entries, so it takes 0x1000 bytes
; We only want the first PML4T
mov eax,esi
add eax,0x1000 ; point it to the first PDPT
or eax,3 ; Present, Readable/Writable
mov [fs:esi + 0x0000],eax
; Put the PDPT to 0x1000, these are 512 entries, it takes 0x1000 bytes
; We only want the first PDPT
mov eax,esi
add eax,0x2000 ; point it to the first PDT
or eax,3 ; Present, Readable/Writable
mov [fs:esi + 0x1000],eax
if 0
; We would use this to map 4KB pages
; Put the PDT to 0x2000, these are 512 entries, it takes 0x1000 bytes
; We only want the first PDT
mov eax,esi
add eax,0x3000 ; point it to the first PT
or eax,3 ; Present, Readable/Writable
mov [fs:esi + 0x2000],eax
; The 512 PT entries now at 0x3000
mov ecx,512 ; Map 2MB (512*4K)
mov eax,0x3
mov edi,esi
add edi,0x3000
.lxf1:
mov [fs:edi],eax
add eax,0x1000
add edi,8
loop .lxf1
end if
if 1
mov ecx,511 ; Map 1GB (512*2MB) - 2MB (reserved to map the APIC later)
mov eax,0x83 ; Also bit 7
mov edi,esi
add edi,0x2000
.lxf1:
mov [fs:edi],eax
add eax,1024*1024*2
add edi,8
loop .lxf1
end if
; We also want to map the Local APIC because we want to access it from long mode
; We will write at [fs:edi], which is 1GB - 2MB
mov eax,0x83
add eax,[ds:LocalApic]
mov [fs:edi],eax
end if
pop es
pop ds
popad
ret
;-------------------------------------------------------------------------------------------
; GDTInitF: Initialize GDT for stuff
;-------------------------------------------------------------------------------------------
GDTInitF: ; // edx upper = 16bit cs, dx = 16bit ds, esi = 32bit physical cs, edi = 32 bit physical ds
push ds
mov ax,DATA16
mov ds,ax
linear eax,0,CODE32
mov [ds:mycode32_descriptor.b0_15],ax ; store it in the dscr
shr eax,8
mov [ds:mycode32_descriptor.b16_23],ah
linear eax,0,CODE16
mov [ds:mycode16_descriptor.b0_15],ax ; store it in the dscr
shr eax,8
mov [ds:mycode16_descriptor.b16_23],ah
xor eax,eax
mov [ds:mydata32_descriptor.b0_15],ax ; store it in the dscr
shr eax,8
mov [ds:mydata32_descriptor.b16_23],ah
linear eax,0,DATA16
mov [ds:mydata16_descriptor.b0_15],ax ; store it in the dscr
shr eax,8
mov [ds:mydata16_descriptor.b16_23],ah
mov eax,esi
mov [ds:rcode32_descriptor.b0_15],ax ; store it in the dscr
shr eax,8
mov [ds:rcode32_descriptor.b16_23],ah
xor eax,eax
mov eax,edx
shr eax,16
shl eax,4 ; make a physical address
mov [ds:rcode16_descriptor.b0_15],ax ; store it in the dscr
shr eax,8
mov [ds:rcode16_descriptor.b16_23],ah
mov eax,edi
mov [ds:rdata32_descriptor.b0_15],ax ; store it in the dscr
shr eax,8
mov [ds:rdata32_descriptor.b16_23],ah
xor eax,eax
mov ax,dx
shl eax,4 ; make a physical address
mov [ds:rdata16_descriptor.b0_15],ax ; store it in the dscr
shr eax,8
mov [ds:rdata16_descriptor.b16_23],ah
XOR eax,eax
mov [ds:code64_descriptor.b0_15],ax ; store it in the dscr
mov [ds:code64_descriptor.b16_23],ah
XOR eax,eax
mov [ds:data64_descriptor.b0_15],ax ; store it in the dscr
mov [ds:data64_descriptor.b16_23],ah
linear eax,dummy_descriptor
mov [gdt_ptr],eax
pop ds
retf
;-------------------------------------------------------------------------------------------
; IDTInitF: Initialize IDT for stuff
;-------------------------------------------------------------------------------------------
IDTInitF:
xor edx,edx
add edx,f0pm
mov eax,edx
mov di,interruptsall
add di,0xf0*8
mov word [di],ax ; lower
add di,2
mov word [di],pm_sel_mycode32; sel
add di,2
mov byte [di],0
add di,1
mov byte [di],08Eh;
add di,1
mov eax,edx
shr eax,16
mov word [di],ax ; upper
; Set idt ptr
linear eax,interruptsall
mov [idt_PM_ptr],eax
retf
;-------------------------------------------------------------------------------------------
; IDTInit64F: Initialize IDT for 64 stuff
;-------------------------------------------------------------------------------------------
IDTInit64f:
linear edx,f0lm,CODE64
mov ecx,256
mov di,linterruptsall
.l1:
mov eax,edx
;add di,0xf0*16
mov word [di],ax ; lower
add di,2
mov word [di],pm_sel_rcode64; sel
add di,2
mov byte [di],0
add di,1
mov byte [di],08Eh;
add di,1
mov eax,edx
shr eax,16
mov word [di],ax ; upper
add di,2
mov dword [di],0;
add di,8
loop .l1
; Set idt ptr
linear eax,linterruptsall
mov dword [lidt_PM_ptr],eax
mov dword [lidt_PM_ptr + 4],0
retf
;-------------------------------------------------------------------------------------------
; Function CPUIndexFromAPIC16f : EAX -> EAX
;-------------------------------------------------------------------------------------------
CPUIndexFromAPIC16f:
mov edx,eax
mov esi,0
xor ebx,ebx
call GetLinearCPUPtr16
; EAX = linear ptr to cpu index array
push ds
push edx
xor ecx,ecx
mov dx,DATA16
mov ds,dx
pop edx
mov cl,[ds:numcpus]
pop ds
.l1z:
cmp [fs:eax + 4],edx
jz .found
dec ecx
add eax,cpusstructize
inc esi
jecxz .nfound
jmp .l1z
.nfound:
mov eax,-1
retf
.found:
mov eax,esi
retf
;-------------------------------------------------------------------------------------------
; Function FindFreeCPU16 : AX CPU idx
;-------------------------------------------------------------------------------------------
FindFreeCPU16:
push esi
push ecx
push ds
mov cx,DATA16
mov ds,cx
mov esi,cpus
xor cx,cx
mov cl,[ds:numcpus]
dec cx
mov ax,1
add esi,cpusstructize ; bypass first cpu
.l1:
cmp dword [ds:esi + 12],0
jnz .l4
jmp .l3
.l4:
dec cx
inc ax
add esi,cpusstructize
jcxz .l2
jmp .l1
.l2:
mov ax,0
.l3:
pop ds
pop ecx
pop esi
retf
;-------------------------------------------------------------------------------------------
; Function MutexLock16f : DS:DI Mutex to lock
;-------------------------------------------------------------------------------------------
MutexLock16f: ; DS:DI mutex to lock
CMP byte [DS:DI],0xFE
JNZ .np1
retf
.np1:
pushadeax
PUSH CS
CALL GetMyApic16f ; BL has the APIC
MOV AL,0xFF
.Loop1:
CMP [DS:DI],BL
JZ .OutLoop2
CMP [DS:DI],AL
JZ .OutLoop1
pause
cmp ecx,-1
jz .nox
dec ecx
jecxz .locktimeout
.nox:
JMP .Loop1
.locktimeout:
mov eax,-1
popadeax
retf
.OutLoop1:
; Lock is free, can we grab it?
MOV AL,0xFF
LOCK CMPXCHG [DS:DI],bl
JNZ .Loop1 ; Write failed
mov eax,1
.OutLoop2: ; Lock Acquired
popadeax
RETF
;-------------------------------------------------------------------------------------------
; Function MutexFree16f : DS:DI Mutex to free
;-------------------------------------------------------------------------------------------
MutexFree16f: ; DS:DI mutex to lock
CMP byte [DS:DI],0xFE
JNZ .np1
retf
.np1:
PUSHAD
PUSH CS
CALL GetMyApic16f ; BL has the APIC
CMP [DS:DI],BL
JNZ .Exit
mov AL,0xFF
MOV [DS:DI],AL
.Exit:
POPAD
RETF
;-------------------------------------------------------------------------------------------
; Function GetMyApic16f : EBX = APIC
;-------------------------------------------------------------------------------------------
GetMyApic16f:
push eax
push ecx
push edx
mov eax,1
cpuid
and ebx,0xff000000
shr ebx,24
pop edx
pop ecx
pop eax
retf
;-------------------------------------------------------------------------------------------
; Function SendSIPIf : Sends SIPI. EBX = CPU Index
;-------------------------------------------------------------------------------------------
SendSIPIf:
PUSHAD
PUSH DS
mov cx,DATA16
mov ds,cx
XOR ECX,ECX
; Spurious
MOV EDI,[DS:LocalApic]
ADD EDI,0x0F0
MOV EDX,[FS:EDI]
OR EDX,0x1FF
MOV [FS:EDI],EDX
; Vector
linear eax,SipiStart,CODE16
.L1:
MOV ECX,EAX
TEST EAX,0xFFF
JZ .L2
INC EAX
JMP .L1
.L2:
MOV ESI,EAX
SHR ESI,12
; Init
MOV ECX,0x04500
OR ECX,ESI
push cs
call SendIPIF
; Delay 10 ms = 0,01 s = (100 Hz)
; 1193182/100
; sleep16 11931
MOV AH,86H
MOV CX,0
MOV DX,10*1000 ;10 ms
INT 15H
; SIPI 1
MOV ECX,0x05600
OR ECX,ESI
push cs
call SendIPIF
; Delay 200 us = 0,2 ms = 0,0002 s = (5000 Hz)
; 1193182/5000
; sleep16 238
MOV AH,86H
MOV CX,0
MOV DX,200 ; 200us
INT 15H
; SIPI 2
MOV ECX,0x05600
OR ECX,ESI
push cs
call SendIPIF
POP DS
POPAD
RETF
;-------------------------------------------------------------------------------------------
; Function SendIPIf : Sends IPI. EBX = CPU Index, ECX = IPI
;-------------------------------------------------------------------------------------------
SendIPIF: ; EBX = CPU INDEX, ECX = IPI
PUSHAD
; Lock Mutex
lock16 mut_ipi
; Write it to 0x310
; EBX is CPU INDEX
; MAKE IT APIC ID
xor eax,eax
mov ax,cpusstructize
mul bx
add ax,cpus
mov di,ax
add di,4
mov bl,[ds:di]
MOV EDI,[DS:LocalApic]
ADD EDI,0x310
MOV EDX,[FS:EDI]
AND EDX,0xFFFFFF
XOR EAX,EAX
MOV AL,BL
SHL EAX,24
OR EDX,EAX
MOV [FS:EDI],EDX
; Write it to 0x300
; MOV EDI,0xFEE00000
MOV EDI,[DS:LocalApic]
ADD EDI,0x300
MOV [FS:EDI],ECX
; Verify it got delivered
.Verify:
PAUSE
MOV EAX,[FS:EDI];
SHR EAX,12
TEST EAX,1
JNZ .Verify
; Write it to 0xB0 (EOI)
; MOV EDI,0xFEE00000
; MOV EDI,[DS:LocalApic]
; ADD EDI,0xB0
; MOV dword [FS:EDI],0
; Release Mutex
unlock16 mut_ipi
POPAD
RETF
;-------------------------------------------------------------------------------------------
; Function SendEOI : Sends EOI
;-------------------------------------------------------------------------------------------
SendEOI:
PUSH EDI
PUSH DS
mov di,DATA16
mov ds,di
; Write it to 0xB0 (EOI)
; MOV EDI,0xFEE00000
MOV EDI,[DS:LocalApic]
ADD EDI,0xB0
MOV dword [FS:EDI],0
POP DS
POP EDI
RET
;-------------------------------------------------------------------------------------------
; Function ChecksumValid : Check the sum. EDI physical addr, ECX count
;-------------------------------------------------------------------------------------------
ChecksumValid:
PUSH ECX
PUSH EDI
XOR EAX,EAX
.St:
ADD EAX,[FS:EDI]
INC EDI
DEC ECX
JECXZ .End
JMP .St
.End:
TEST EAX,0xFF
JNZ .F
MOV EAX,1
.F:
POP EDI
POP ECX
RETF
;-------------------------------------------------------------------------------------------
; Function FillACPI : Fills ACPI information
;-------------------------------------------------------------------------------------------
FillACPI:
PUSHAD
push es
mov es,[fs:040eh]
xor edi,edi
mov di,[es:0]
pop es
mov edi, 0x000E0000
.s:
cmp edi, 0x000FFFFF ;
jge .noACPI ; Fail.
mov eax,[fs:edi]
add edi,4
mov edx,[fs:edi]
add edi,4
cmp eax,0x20445352
jnz .s
cmp edx,0x20525450
jnz .s
jmp .found
.noACPI:
POPAD
mov ah,04ch
int 21h
RETF
.found:
; Found at EDI
sub edi,8
mov esi,edi
; 36 bytes for ACPI 2
mov ecx,36
push cs
call ChecksumValid
cmp eax,1
jnz .noACPI2
mov eax,[fs:edi + 24]
mov dword [ds:XsdtAddress],eax
mov eax,[fs:edi + 28]
mov dword [ds:XsdtAddress + 4],eax
mov edi,dword [ds:XsdtAddress]
mov eax,[fs:edi]
cmp eax, 'XSDT' ; Valid?
jnz .noACPI2
POPAD
RETF
.noACPI2:
mov edi,esi
mov ecx,20
push cs
call ChecksumValid
cmp eax,1
jnz .noACPI
mov eax,[fs:edi + 16]
mov dword [ds:XsdtAddress],eax
mov edi,dword [ds:XsdtAddress]
mov eax,[fs:edi]
cmp eax, 'RSDT' ; Valid?
jnz .noACPI
POPAD
RETF
;-------------------------------------------------------------------------------------------
; Function FindACPITable : Finds EAX Table
;-------------------------------------------------------------------------------------------
FindACPITable:
; EAX = sig
push edi
push ebx
push edx
mov edi,dword [ds:XsdtAddress]
.l1:
mov ebx,[fs:edi]
mov edx,[fs:edi + 4]
cmp edx,0
jnz .ok1
mov ah,04ch
int 21h
.ok1:
cmp ebx,eax
jz .f1
add edi,edx
jmp .l1
.f1:
mov eax,edi
pop edx
pop ebx
pop edi
RETF
;-------------------------------------------------------------------------------------------
; Function DumpMadt : Fills from EAX MADT
;-------------------------------------------------------------------------------------------
DumpMadt: ; EAX
pushad
mov edi,eax
mov [ds:numcpus],0
mov ecx,[fs:edi + 4] ; length
mov eax,[fs:edi + 0x24] ; Local APIC
mov [ds:LocalApic],eax
add edi,0x2C
sub ecx,0x2C
.l1:
xor ebx,ebx
mov bl,[fs:edi + 1] ; length
cmp bl,0
jz .end ; duh
sub ecx,ebx
mov al,[fs:edi] ; type
cmp al,0
jnz .no0
; This is a CPU!
xor eax,eax
mov al,[ds:numcpus]
inc [ds:numcpus]
mov edx,cpusstructize
mul edx
xor esi,esi
mov si,cpus
add esi,eax
mov al,[fs:edi + 2]; ACPI id
mov byte [ds:si],al
mov al,[fs:edi + 3]; APIC id
mov byte [ds:si + 4],al
.no0:
add edi,ebx
jecxz .end
jmp .l1
.end:
popad
RETF
;-------------------------------------------------------------------------------------------
; Function CheckF0 : Checks if DMMI is installed. Returns AX = 0xFACE on success
;-------------------------------------------------------------------------------------------
CheckF0:
mov ax,35f0h
int 21h
; es:bx
add bx,2
mov eax,[es:bx]
cmp eax,'dmmi'
jnz .f
add bx,4
mov eax,[es:bx]
cmp eax,'dmmi'
jnz .f
mov ax,0xface
retf
.f:
mov ax,0
retf
;-------------------------------------------------------------------------------------------
; Function EnableA20 : Enables A20 line
;-------------------------------------------------------------------------------------------
WaitKBC:
mov cx,0ffffh
A20L:
in al,64h
test al,2
loopnz A20L
retf
EnableA20:
push cs
call WaitKBC
mov al,0d1h
out 64h,al
push cs
call WaitKBC
mov al,0dfh
out 60h,al
retf
;-------------------------------------------------------------------------------------------
; Function QuickEnterUnreal
;-------------------------------------------------------------------------------------------
QuickEnterUnreal:
PUSH DS
MOV AX,DATA16
MOV DS,AX
mov bx,gdt_startUNR
lgdt [ds:bx]
mov eax,cr0
or al,1
mov cr0,eax
JMP $+2
mov ax,10h
mov fs,ax
mov ds,ax
mov eax,cr0
and al,not 1
mov cr0,eax
POP DS
xor ax,ax
mov fs,ax
RETF
;-------------------------------------------------------------------------------------------
; Function EnterUnreal : Release int 0xf1 and 0xf0
;-------------------------------------------------------------------------------------------
EnterUnreal:
PUSHAD
PUSH DS
MOV AX,DATA16
MOV DS,AX
linear eax,0,CODE16
mov [ds:code16_descriptorUNR.b0_15],ax ; store it in the dscr
shr eax,8
mov [ds:code16_descriptorUNR.b16_23],ah
XOR eax,eax
mov [ds:data32_descriptorUNR.b0_15],ax ; store it in the dscr
mov [ds:data32_descriptorUNR.b16_23],ah
; Set gdt ptr
linear eax,dummy_descriptorUNR
mov [gdt_ptrUNR],eax
mov bx,gdt_startUNR
lgdt [ds:bx]
mov eax,cr0
or al,1
mov cr0,eax
JMP $+2
mov ax,10h
mov fs,ax
mov ds,ax
mov eax,cr0
and al,not 1
mov cr0,eax
POP DS
xor ax,ax
mov fs,ax
POPAD
RETF
;-------------------------------------------------------------------------------------------
; Function FreeInterrupts : Release int 0xf1 and 0xf0
;-------------------------------------------------------------------------------------------
FreeInterrupts:
mov ax,DATA16
mov ds,ax
mov ax,2521h
lds dx,[cs:OldInt21]
int 21h
mov ax,DATA16
mov ds,ax
mov ax,25f2h
lds dx,[cs:OldIntF2]
int 21h
mov ax,DATA16
mov ds,ax
mov ax,25f1h
lds dx,[cs:OldIntF1]
int 21h
mov ax,DATA16
mov ds,ax
mov ax,25f0h
lds dx,[cs:OldIntF0]
int 21h
retf
;-------------------------------------------------------------------------------------------
; Function SetupInterrupts : Setup int 0xf1 and 0xf0
;-------------------------------------------------------------------------------------------
SetupInterrupts:
push ds
mov ax,35f0h
int 21h
mov word [cs:OldIntF0],bx
mov word [cs:OldIntF0 + 2],es
mov ax,35f1h
int 21h
mov word [cs:OldIntF1],bx
mov word [cs:OldIntF1 + 2],es
mov ax,35f2h
int 21h
mov word [cs:OldIntF2],bx
mov word [cs:OldIntF2 + 2],es
mov ax,3521h
int 21h
mov word [cs:OldInt21],bx
mov word [cs:OldInt21 + 2],es
mov ax,25f0h
push cs
pop ds
mov dx,f0real
int 21h
mov ax,25f1h
push cs
pop ds
mov dx,f1real
int 21h
mov ax,25f2h
push cs
pop ds
mov dx,f2real
int 21h
mov ax,2521h
push cs
pop ds
mov dx,rd21
int 21h
pop ds
retf
;-------------------------------------------------------------------------------------------
; Function Start16 : Starts here
;-------------------------------------------------------------------------------------------
Start16:
cli
mov ax,DATA16
mov ds,ax
mov ax,STACK16
mov ss,ax
mov sp,stack16_end
sti
; Save IDT
sidt fword [ds:RealIDT]
; Save PSP
mov ax,es
mov [cs:OrgPSP],ax
; Show hello
mov ah,9
mov dx,m1
int 21h
; Setup GDT
call CODE16:IDTInitF
call CODE16:IDTInit64f
; Exists?
push cs
call CheckF0
cmp ax,0xface
jnz .inst
mov ax,DATA16
mov ds,ax
mov ah,9
mov dx,m3
int 21h
; Free memory and exit
mov ax,9900h
int 0xF0
.inst:
; A20
push cs
call EnableA20
; Unreal
CLI
call FAR CODE16:EnterUnreal
STI
; Setup interrupts
push cs
call SetupInterrupts
; Prepare ACPI
push cs
call GetMyApic16f
mov [ds:MainCPUAPIC],bl
push cs
call FillACPI
mov eax,'APIC'
push cs
call FindACPITable
push cs
call DumpMadt
; Page Table
call InitPageTable
; Linear Start
push ds
mov ax,CODE16
mov ds,ax
linear esi,LStart,CODE64
mov [ds:PutLinearStart64h],esi
pop ds
cmp [ds:testr],1
jnz .ntestrun
jmp testrun
.ntestrun:
; Message
mov ax,DATA16
mov ds,ax
mov ah,9
mov dx,m2
int 21h
xor edx,edx
mov dx,ENDALLSEG
sub dx,DATA16
add dx,17 ; add 16 paras for PSP + 1 extra
mov ax,3100h ; terminate and stay resident
int 21h
; end
h1 dw ?
h2 dw ?
rcall dd ?
testrun:
sti
mov ax,0000
int 0xf0
mov word [cs:rcall],dx
mov word [cs:rcall + 2],es
mov ax,RUN64
push ds
mov ds,ax
mov dword [ds:lcall],edi
mov dword [ds:lcall + 4],0
pop ds
; run real mode seg
if 1
mov ecx,-1
mov dx,RUN16
shl edx,16
mov dx,r1
mov bx,0
mov ax,0x0100
call far [cs:rcall];
mov ax,0x0300
call far [cs:rcall];
end if
if 1
; run pm mode seg
mov ecx,-1
mov ebx,0
mov dx,CODE16
shl edx,16
mov dx,DATA16
linear esi,0,RUN32
mov edi,0
mov ax,0x0101
call far [cs:rcall];
mov ax,0x0300
call far [cs:rcall];
end if
if 1
; run long mode seg
mov ecx,-1
mov bx,0
linear esi,Begin64,RUN64
mov ax,0x0102
call far [cs:rcall];
mov ax,0x0300
call far [cs:rcall];
end if
; Run some with mutex
mov ax,DATA16
mov ds,ax
; NOTE THESE ASSUME MUTEX HANDLES 0 and 1 FOR SIMPLICITY
; Alloc Mutex
mov ax,0x0500
call far [cs:rcall];
; Alloc Mutex
mov ax,0x0500
call far [cs:rcall];
; Lock Mutex
mov ebx,0
mov ecx,-1
mov ax,0x0502
call far [cs:rcall];
; Lock Mutex
mov ebx,1
mov ecx,-1
mov ax,0x0502
call far [cs:rcall];
linear ebx,tester_mutex
mov byte [fs:ebx],0x0
if 1
; Start Thread
mov ecx,-1
mov bx,0
linear esi,Begin64Mutex1,RUN64
mov ax,0x0102
call far [cs:rcall];
mov [cs:h1],ax
; Start Thread
mov ecx,-1
mov bx,0
linear esi,Begin64Mutex2,RUN64
mov ax,0x0102
call far [cs:rcall];
mov [cs:h2],ax
; Unlock Mutex so thread can continue
mov ebx,0
mov ax,0x0503
call far [cs:rcall];
; Wait for thread
mov ax,0x0300
mov bx,[cs:h1]
call far [cs:rcall];
; Unlock Mutex so thread can continue
mov ebx,1
mov ax,0x0503
call far [cs:rcall];
; Wait for thread
mov ax,0x0300
mov bx,[cs:h2]
call far [cs:rcall];
end if
; Destroy Mutex
mov ebx,0
mov ax,0x0501
call far [cs:rcall];
; Destroy Mutex
mov ebx,1
mov ax,0x0501
call far [cs:rcall];
; End testing
; Free memory and exit
mov ax,9900h
int 0xF0
;-------------------------------------------------------------------------------------------
; Function PrepRM : IPI Starts here to prepare real mode
;-------------------------------------------------------------------------------------------
RealStack dw 2048
PrepRM:
CLI
mov ax,CODE16
mov ss,ax
mov sp,RealStack
mov ax,DATA16
mov ds,ax
STI
mov ax,0x0700
int 0xF0
call far [ds:ProcedureStart]
mov ax,0x0200
int 0xF0
;-------------------------------------------------------------------------------------------
; Function PrepLM : IPI Starts here to prepare long mode
;-------------------------------------------------------------------------------------------
PrepLM:
CLI
mov bx,DATA16
mov ds,bx
mov bx,gdt_start
lgdt [ds:bx]
mov bx,DATA16
mov ds,bx
mov bx,lidt_PM_start
lidt [ds:bx]
; page table
mov eax,[DS:LONGPAGEABS]
mov cr3,eax
; Enable PAE
mov eax, cr4
bts eax, 5
bts eax, 4 ; And PSE
mov cr4, eax
; Enable Long Mode
mov ecx, 0c0000080h ; EFER MSR number.
rdmsr ; Read EFER.
bts eax, 8 ; Set LME=1.
wrmsr ; Write EFER.
; Enable Paging to activate Long Mode
mov eax, cr0 ; Read CR0.
or eax,80000001h ; Set PE=1.
mov cr0, eax ; Write CR0.
db 066h
db 0eah
PutLinearStart64h dd 0
dw pm_sel_rcode64
;-------------------------------------------------------------------------------------------
; Function PrepPM : IPI Starts here to prepare protected mode
;-------------------------------------------------------------------------------------------
PrepPM:
CLI
mov bx,DATA16
mov ds,bx
mov bx,gdt_start
lgdt [ds:bx]
mov bx,idt_PM_start
lidt [ds:bx]
mov eax,cr0
or al,1
mov cr0,eax
mov ax,pm_sel_rcode16
mov gs,ax
mov ax,pm_sel_rdata16
mov ds,ax
mov ax,pm_sel_rdata32
mov es,ax
mov ss,ax
mov ax,0
mov fs,ax
db 066h
db 0eah
dd 0
dw pm_sel_rcode32
;-------------------------------------------------------------------------------------------
; Function SipiStart : IPI Starts here
;-------------------------------------------------------------------------------------------
SipiStart:
db 4096 dup (144) ; // fill NOPs
; Load IDT
CLI
mov di,DATA16
mov ds,di
lidt fword [ds:RealIDT]
mov ax,STACK16S
mov ss,ax
mov sp,stack16s_end
; A20
call FAR CODE16:EnableA20
; Quick Enter Unrel
call FAR CODE16:QuickEnterUnreal
; Spurious, APIC
MOV EDI,[DS:LocalApic]
ADD EDI,0x0F0
MOV EDX,[FS:EDI]
OR EDX,0x1FF
push dword 0
pop fs
MOV [FS:EDI],EDX
MOV EDI,[DS:LocalApic]
ADD EDI,0x0B0
MOV dword [FS:EDI],0
; JMP to starting address
mov di,StartSipiAddrOfs
jmp far [ds:di]
;-------------------------------------------------------------------------------------------
; 32 bit code segment
;-------------------------------------------------------------------------------------------
SEGMENT CODE32 USE32
;-------------------------------------------------------------------------------------------
; ProtectedCall
;-------------------------------------------------------------------------------------------
ProtectedCall:
pushfd
push cs
call f0pm
retf
;-------------------------------------------------------------------------------------------
; Interrupt 0xF0 :
;-------------------------------------------------------------------------------------------
f0pm:
.a2:
; End thread
cmp ah,0x02
jnz .ea2
push ds
mov ax,pm_sel_mydata16
mov ds,ax
db 066h
db 09ah
dw GetMyApic16f
dw pm_sel_mycode16
mov eax,ebx
call CPUIndexFromAPIC32
mov ebx,eax
call GetLinearCPUPtr32
push fs
mov dx,pm_sel_mydata32
mov fs,dx
mov dword [fs:eax + 12],0
pop fs
; Wake CPU
xor ebx,ebx
MOV bp,pm_sel_mydata16
MOV ds,BP
MOV bp,pm_sel_mydata32
MOV fs,BP
mov ECX,0F2h
; call pm_sel_mycode32:SendIPI32F
.s1:
cli
hlt
jmp .s1
iretd
.ea2:
.a400: ; Call Interrupt
cmp ah,0x04
jnz .ea4
; BP = AX
; AL = INT N
PUSH DS
PUSHAD
;lock
lock32 mut_f1
mov ax,bp
; put them
MOV bp,pm_sel_mydata16
MOV ds,BP
MOV BP,real_regs
mov word [ds:bp + 0],ax
mov [ds:bp + 2],bx
mov [ds:bp + 4],cx
mov [ds:bp + 6],dx
mov [ds:bp + 8],si
mov [ds:bp + 10],di
POPAD
PUSHAD
MOV bp,pm_sel_mydata16
MOV ds,BP
mov ah,0
MOV BP,real_regs
mov [ds:bp + 16],ax
shr esi,16
mov [ds:bp + 12],si
shr edi,16
mov [ds:bp + 14],di
; send ipi
MOV bp,pm_sel_mydata16
MOV ds,BP
MOV bp,pm_sel_mydata32
MOV fs,BP
xor ebx,ebx
mov ECX,0F1h
call pm_sel_mycode32:SendIPI32F
MOV bp,pm_sel_mydata16
MOV ds,BP
.rtr:
cmp [ds:intf1called],0
jz .rtr
; restore regs
POPad
POP ds
MOV bp,pm_sel_mydata16
MOV ds,BP
MOV BP,real_regs
mov ax,[ds:bp]
mov bx,[ds:bp + 2]
mov cx,[ds:bp + 4]
mov dx,[ds:bp + 6]
mov si,[ds:bp + 8]
mov di,[ds:bp + 10]
push ax
push bx
mov ax,[ds:bp + 12]
mov bx,[ds:bp + 14]
mov bp,[ds:bp + 18]
push si
xor esi,esi
mov si,ax
shl esi,16
pop si
push di
xor edi,edi
mov di,bx
shl edi,16
pop di
pop bx
pop ax
push ebp
popfd
PUsh ds
PUshad
;unlock
unlock32 mut_f1
POPad
POP ds
iretd
.ea4:
.a502: ; Mutex Lock. BX = mut
cmp ax,0x0502
jnz .ea502
push ds
push si
mov ax,pm_sel_mydata16
mov ds,ax
mov si,bx
mov ax,0
cmp byte [ds:mutexs + si],0xFE
jz .lockfail
push di
mov di,mutexs
add di,si
db 066h
db 09ah
dw MutexLock16f
dw pm_sel_mycode16
pop di
mov ax,1
.lockfail:
pop si
pop ds
iretd
.ea502:
.a503: ; Mutex Unlock. BX = mut
cmp ax,0x0503
jnz .ea503
push ds
push si
mov ax,pm_sel_mydata16
mov ds,ax
mov si,bx
mov ax,0
cmp byte [ds:mutexs + si],0xFE
jz .unlockfail
cmp byte [ds:mutexs + si],0xFF
jz .unlockfail
push di
mov di,mutexs
add di,si
db 066h
db 09ah
dw MutexFree16f
dw pm_sel_mycode16
pop di
mov ax,1
.unlockfail:
pop si
pop ds
iretd
.ea503:
.a504: ; Mutex wait free. BX = mut
cmp ax,0x0504
jnz .ea504
mov eax,-1
push edi
linear edi, mutexs
add di,bx
cmp byte [fs:edi],0xFE
jz .lockfail4
.Loop1:
CMP byte [fs:edi],0xff
JZ .OutLoop1
cmp ecx,-1
jz .nox
dec ecx
jecxz .lockfail4
.nox:
pause
JMP .Loop1
.OutLoop1:
mov ax,1
.lockfail4:
pop edi
iret
.ea504:
.a6:
; Wake CPU
cmp ah,0x06
jnz .ea6
MOV bp,pm_sel_mydata16
MOV ds,BP
MOV bp,pm_sel_mydata32
MOV fs,BP
mov ECX,0F2h
call pm_sel_mycode32:SendIPI32F
iretd
.ea6:
.a7: ; Thread initilized and running
cmp ax,0x0700
jnz .ea7
push ax
push ds
mov ax,pm_sel_mydata16
mov ds,ax
mov [ds:IntCompleted],1
pop ds
pop ax
iretd
.ea7:
iretd
;-------------------------------------------------------------------------------------------
; GetLinearCPUPtr32 : EBX : index
;-------------------------------------------------------------------------------------------
GetLinearCPUPtr32: ; In EAX
push edx
push ebx
xor eax,eax
mov eax,ebx
mov dx,cpusstructize
mul dx
add eax,cpus
mov ebx,DATA16
shl ebx,4
add ebx,eax
xchg eax,ebx
pop ebx
pop edx
ret
;-------------------------------------------------------------------------------------------
; Function CPUIndexFromAPIC32 : EAX -> EAX
;-------------------------------------------------------------------------------------------
CPUIndexFromAPIC32:
mov edx,eax
mov esi,0
xor ebx,ebx
call GetLinearCPUPtr32
; EAX = linear ptr to cpu index array
push ds
push edx
xor ecx,ecx
mov dx,pm_sel_mydata16
mov ds,dx
pop edx
mov cl,[ds:numcpus]
pop ds
push fs
push dx
mov dx,pm_sel_mydata32
mov fs,dx
pop dx
.l1z:
cmp [fs:eax + 4],edx
jz .found
dec ecx
add eax,cpusstructize
inc esi
jecxz .nfound
jmp .l1z
.nfound:
pop fs
mov eax,-1
ret
.found:
pop fs
mov eax,esi
ret
;-------------------------------------------------------------------------------------------
; Function SendIPI32f : Sends IPI. EBX = CPU Index, ECX = IPI
;-------------------------------------------------------------------------------------------
SendIPI32F: ; EBX = CPU INDEX, ECX = IPI
PUSHAD
push ds
mov ax,pm_sel_mydata16
mov ds,ax
; Lock Mutex 0
lock32 mut_ipi
; Write it to 0x310
; EBX is CPU INDEX
; MAKE IT APIC ID
xor eax,eax
mov ax,cpusstructize
mul bx
add ax,cpus
mov di,ax
add di,4
mov bl,[ds:di]
MOV EDI,[DS:LocalApic]
ADD EDI,0x310
MOV EDX,[FS:EDI]
AND EDX,0xFFFFFF
XOR EAX,EAX
MOV AL,BL
SHL EAX,24
OR EDX,EAX
MOV [FS:EDI],EDX
; Write it to 0x300
MOV EDI,[DS:LocalApic]
ADD EDI,0x300
MOV [FS:EDI],ECX
; Verify it got delivered
.Verify:
MOV EAX,[FS:EDI];
SHR EAX,12
TEST EAX,1
JNZ .Verify
; Write it to 0xB0 (EOI)
MOV EDI,[DS:LocalApic]
ADD EDI,0xB0
MOV dword [FS:EDI],0
; Release Mutex 0
unlock32 mut_ipi
pop ds
POPAD
RETF
;-------------------------------------------------------------------------------------------
; 64 bit code segment
;-------------------------------------------------------------------------------------------
SEGMENT CODE64 USE64
;-------------------------------------------------------------------------------------------
; LongCall
;-------------------------------------------------------------------------------------------
LongCall:
pushfq
mov bp,cs
push bp
call f0lm
ret
;-------------------------------------------------------------------------------------------
; Interrupt 0xF0 :
;-------------------------------------------------------------------------------------------
f0lm:
.a2:
; End thread
cmp ah,0x02
jnz .ea2
call GetMyApic64
mov eax,ebx
call CPUIndexFromAPIC64
mov ebx,eax
; remove handle
call GetLinearCPUPtr64
mov dword [eax + 12],0
; Wake cpu
xor rbx,rbx
mov RCX,0F2h
; call SendIPI64
; Go back to 16 bit with retf trick
.gb:
push pm_sel_mycode16
xor rcx,rcx
mov ecx,BackFromLong
push rcx
retf
.ea2:
.a400: ; Call Interrupt
cmp ah,0x04
jnz .ea4
; BP = AX
; AL = INT N
;lock
push rax
lock64 mut_f1
pop rax
push rax
push rcx
push rdx
push rbx
push rbp
push rsi
push rdi
mov ax,bp
; put them
linear rbp,real_regs
mov word [rbp + 0],ax
mov [rbp + 2],bx
mov [rbp + 4],cx
mov [rbp + 6],dx
mov [rbp + 8],si
mov [rbp + 10],di
pop rdi
pop rsi
pop rbp
pop rbx
pop rdx
pop rcx
pop rax
push rax
push rcx
push rdx
push rbx
push rbp
push rsi
push rdi
linear rbp,real_regs
mov ah,0
mov [rbp + 16],ax
shr esi,16
mov [rbp + 12],si
shr edi,16
mov [rbp + 14],di
; send ipi
linear rbp,intf1called
mov byte [rbp],0
xor rbx,rbx
mov RCX,0F1h
call SendIPI64
linear rbp,intf1called
.rtr:
pause
cmp byte [rbp],0
jz .rtr
; restore regs
pop rdi
pop rsi
pop rbp
pop rbx
pop rdx
pop rcx
pop rax
linear rbp,real_regs
mov ax,[rbp]
mov bx,[rbp + 2]
mov cx,[rbp + 4]
mov dx,[rbp + 6]
mov si,[rbp + 8]
mov di,[rbp + 10]
push ax
push bx
mov ax,[rbp + 12]
mov bx,[rbp + 14]
mov bp,[rbp + 18]
push si
xor esi,esi
mov si,ax
shl esi,16
pop si
push di
xor edi,edi
mov di,bx
shl edi,16
pop di
pop bx
pop ax
push rbp
popfq
push rax
push rcx
push rdx
push rbx
push rbp
push rsi
push rdi
;unlock
unlock64 mut_f1
pop rdi
pop rsi
pop rbp
pop rbx
pop rdx
pop rcx
pop rax
iretq
.ea4:
.a502: ; Mutex Lock. BX = mut
cmp ax,0x0502
jnz .ea502
mov rax,0
push rdi
linear rdi,mutexs
add di,bx
cmp byte [rdi],0xFE
jz .lockfail
call MutexLock64
.lockfail:
pop rdi
iretq
.ea502:
.a503: ; Mutex Unlock. BX = mut
cmp ax,0x0503
jnz .ea503
push rdi
linear rdi, mutexs
add di,bx
cmp byte [rdi],0xFE
jz .unlockfail
cmp byte [rdi],0xFF
jz .unlockfail
call MutexFree64
mov ax,1
.unlockfail:
pop rdi
iretq
.ea503:
.a504: ; Mutex wait free. BX = mut
cmp ax,0x0504
jnz .ea504
mov rax,0
push rdi
linear rdi, mutexs
add di,bx
cmp byte [rdi],0xFE
jz .lockfail4
.Loop1:
CMP byte [RDI],0xff
JZ .OutLoop1
pause
cmp ecx,-1
jz .nox
dec ecx
jecxz .lockfail4
.nox:
JMP .Loop1
.OutLoop1:
mov ax,1
.lockfail4:
pop rdi
iretq
.ea504:
.a6:
; Wake CPU
cmp ah,0x06
jnz .ea6
mov RCX,0F2h
call SendIPI64
iretq
.ea6:
.a7: ; Thread initilized and running
cmp ax,0x0700
jnz .ea7
push rax
linear rax,IntCompleted
mov byte [rax],1
pop rax
iretq
.ea7:
iretq
;-------------------------------------------------------------------------------------------
; GetLinearCPUPtr64 : EBX : index
;-------------------------------------------------------------------------------------------
GetLinearCPUPtr64: ; In EAX
push rdx
push rbx
xor rax,rax
mov eax,ebx
mov dx,cpusstructize
mul dx
add eax,cpus
mov ebx,DATA16
shl ebx,4
add ebx,eax
xchg eax,ebx
pop rbx
pop rdx
ret
;-------------------------------------------------------------------------------------------
; Function CPUIndexFromAPIC64 : RAX -> RAX
;-------------------------------------------------------------------------------------------
CPUIndexFromAPIC64:
mov rdx,rax
mov rsi,0
xor rbx,rbx
call GetLinearCPUPtr64
; RAX = linear ptr to cpu index array
push rdx
xor rdx,rdx
mov dx,DATA16
shl rdx,4
add rdx,numcpus
xor rcx,rcx
mov cl,[rdx]
pop rdx
.l1z:
cmp [rax + 4],edx
jz .found
dec rcx
add rax,cpusstructize
inc rsi
jecxz .nfound
jmp .l1z
.nfound:
mov rax,-1
ret
.found:
mov rax,rsi
ret
;-------------------------------------------------------------------------------------------
; GetLongLinearCPUPtr :
;-------------------------------------------------------------------------------------------
GetLongLinearCPUPtr:
; We can't call 16-bit code
push rax
push rcx
push rdx
mov eax,1
cpuid
and ebx,0xff000000
shr ebx,24
pop rdx
pop rcx
pop rax
mov rax,0
mov eax,ebx
mov dx,cpusstructize
mul dx
add eax,cpus
push rax
pop rbx
xor rax,rax
mov ax,DATA16
shl rax,4
add rax,rbx
ret
;-------------------------------------------------------------------------------------------
; Function GetMyApic64 : EAX = APIC
;-------------------------------------------------------------------------------------------
GetMyApic64:
push rax
push rcx
push rdx
mov eax,1
cpuid
and ebx,0xff000000
shr rbx,24
pop rdx
pop rcx
pop rax
ret
;-------------------------------------------------------------------------------------------
; Function MutexLock64 : RDI Mutex to lock
;-------------------------------------------------------------------------------------------
MutexLock64:
CMP byte [RDI],0xFE
JNZ .np1
ret
.np1:
PUSH RBX
CALL GetMyApic64 ; BL has the APIC
MOV AL,0xFF
.Loop1:
CMP [RDI],BL
JZ .OutLoop2
CMP [RDI],AL
JZ .OutLoop1
pause
cmp ecx,-1
jz .nox
dec ecx
jecxz .locktimeout
.nox:
JMP .Loop1
.locktimeout:
mov eax,-1
pop rbx
ret
.OutLoop1:
; Lock is free, can we grab it?
MOV AL,0xFF
LOCK CMPXCHG [RDI],bl
JNZ .Loop1 ; Write failed
mov eax,1
.OutLoop2: ; Lock Acquired
POP RBX
RET
;-------------------------------------------------------------------------------------------
; Function MutexFree64 : RDI Mutex to free
;-------------------------------------------------------------------------------------------
MutexFree64: ; RDI mutex to lock
CMP byte [RDI],0xFE
JNZ .np1
retf
.np1:
PUSH RAX
PUSH RBX
CALL GetMyApic64 ; BL has the APIC
CMP [RDI],BL
JNZ .Exit
mov AL,0xFF
MOV [RDI],AL
.Exit:
POP RBX
POP RAX
RET
;-------------------------------------------------------------------------------------------
; Function GetLongAPIC :
;-------------------------------------------------------------------------------------------
GetLongAPIC:
xor rdi,rdi
if page1gb eq 1
mov rdi,0xFEE00000
else
mov rdi,0x40000000 ; 1GB
sub rdi,0x200000 ; 2MB
end if
ret
;-------------------------------------------------------------------------------------------
; Function SendEOI64 : Sends EOI
;-------------------------------------------------------------------------------------------
SendEOI64:
PUSH RDI
call GetLongAPIC
; Write it to 0xB0 (EOI)
ADD RDI,0xB0
MOV dword [RDI],0
POP RDI
RET
;-------------------------------------------------------------------------------------------
; Function SendIPI64 : Sends IPI. RBX = CPU Index, ECX = IPI
;-------------------------------------------------------------------------------------------
SendIPI64: ; RBX = CPU INDEX, ECX = IPI
push rax
push rcx
push rdx
push rbx
push rbp
push rsi
push rdi
mov ax,pm_sel_rdata64
mov ds,ax
mov es,ax
; Lock Mutex 0
push rax
lock64 mut_ipi
pop rax
; Write it to 0x310
; EBX is CPU INDEX
; MAKE IT APIC ID
xor rax,rax
mov rax,cpusstructize
mul bx
add rax,CpusOfs ; BANG
xor rdi,rdi
mov di,DATA16
shl rdi,4
add rdi,rax
add rdi,4
mov bl,[rdi]
call GetLongAPIC
ADD RDI,0x310
MOV EDX,[RDI] ; BANG
AND RDX,0xFFFFFF
XOR RAX,RAX
MOV AL,BL
SHL RAX,24
OR RDX,RAX
MOV [RDI],EDX
; Write it to 0x300
call GetLongAPIC
ADD EDI,0x300
MOV [RDI],ECX
; Verify it got delivered
.Verify:
MOV EAX,[RDI];
SHR EAX,12
TEST EAX,1
JNZ .Verify
; Write it to 0xB0 (EOI)
call GetLongAPIC
ADD RDI,0xB0
MOV dword [RDI],0
; Release Mutex 0
unlock64 mut_ipi
pop rdi
pop rsi
pop rbp
pop rbx
pop rdx
pop rcx
pop rax
RET
;-------------------------------------------------------------------------------------------
; LStart start IPI long mode
;-------------------------------------------------------------------------------------------
LStart:
; set idt
linear rbx,lidt_PM_start
lidt tbyte [rbx]
; final jump using the retf trick
mov ax,pm_sel_rdata64
mov ss,ax
mov es,ax
mov ds,ax
mov fs,ax
mov gs,ax
push pm_sel_rcode64
xor rcx,rcx
db 0xb9 ; mov ecx,xxxxxxxx
PutLinearStart64X dd 0
push rcx
retf
; TESTING STUFF
SEGMENT RUNSTACK16 USE16
dw 256 dup (?)
rs16:
dw 256 dup (?)
rs16b:
msg1 db "Hello real",0dh,0ah,"$"
msg2 db "Hello protected",0dh,0ah,"$"
msg3 db "Hello long",0dh,0ah,"$"
msg4 db "Hello long Mutex 1",0dh,0ah,"$"
msg5 db "Hello long Mutex 2",0dh,0ah,"$"
SEGMENT RUN16 USE16
ORG 0
r1:
cli
mov ax,RUNSTACK16
mov ss,ax
mov sp,rs16
mov ds,ax
STI
mov ax,0x0700
int 0xF0
if 0
mov bp,0x0900
mov dx,msg1
mov ax,RUNSTACK16
mov ds,ax
mov ax,0x0421
int 0xf0
end if
if 1
; We can do it as well with redirected int 0x21
mov dx,msg1
mov ax,RUNSTACK16
mov ds,ax
mov ax,0x0900
int 0x21
end if
mov ah,2
xor ebx,ebx
int 0xf0
SEGMENT RUNDATA32 USE32
dd 256 dup (?)
rs32:
SEGMENT RUN32 USE32
ORG 0
cli
linear esp,256,RUNDATA32
mov ax,pm_sel_rdata32
mov ss,ax
sti
mov ax,0x0700
int 0xF0
mov bp,0x0900
mov dx,msg2
xor esi,esi
mov si,RUNSTACK16
shl esi,16
mov ax,0x0421
int 0xf0
mov ah,2
xor bx,bx
int 0xf0
SEGMENT RUNDATA64 USE64
dq 1024 dup (?)
SEGMENT RUN64 USE64
ORG 0
lcall dq 0
Begin64:
cli
linear rsp,256,RUNDATA64
sti
mov ax,0x0700
int 0xF0
mov bp,0x0900
mov dx,msg3
xor esi,esi
mov si,RUNSTACK16
shl esi,16
mov ax,0x0421
int 0xf0
mov ax,0x0200
xor ebx,ebx
int 0xf0
Begin64Mutex1:
cli
linear rsp,512,RUNDATA64
sti
mov ax,0x0700
int 0xF0
; Wait Mutex
mov rbx,0
mov ecx,-1
mov ax,0x0504
int 0xf0
mov bp,0x0900
mov dx,msg4
xor esi,esi
mov si,RUNSTACK16
shl esi,16
mov ax,0x0421
int 0xf0
mov ax,0x0200
xor ebx,ebx
int 0xf0
Begin64Mutex2:
cli
linear rsp,1024,RUNDATA64
sti
mov ax,0x0700
int 0xF0
; Lock Mutex
mov rbx,1
mov ecx,-1
mov ax,0x0502
int 0xf0
mov bp,0x0900
mov dx,msg5
xor esi,esi
mov si,RUNSTACK16
shl esi,16
mov ax,0x0421
int 0xf0
; Unlock mutex
mov rbx,1
mov ax,0x0503
int 0xf0
mov ax,0x0200
xor ebx,ebx
int 0xf0
SEGMENT ENDALLSEG USE16
|
source/nodes/program-dummy_subpools.adb | reznikmm/gela | 0 | 18269 | <filename>source/nodes/program-dummy_subpools.adb<gh_stars>0
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Ada.Unchecked_Deallocation;
package body Program.Dummy_Subpools is
type Dummy_Subpool_Access is access all Dummy_Subpool;
procedure Free is new Ada.Unchecked_Deallocation
(Dummy_Subpool, Dummy_Subpool_Access);
---------------------------
-- Allocate_From_Subpool --
---------------------------
overriding procedure Allocate_From_Subpool
(Self : in out Dummy_Storage_Pool;
Address : out System.Address;
Size : System.Storage_Elements.Storage_Count;
Alignment : System.Storage_Elements.Storage_Count;
Subpool : not null System.Storage_Pools.Subpools.Subpool_Handle)
is
pragma Unreferenced (Self, Subpool);
Default : System.Storage_Pools.Root_Storage_Pool'Class renames
Dummy_Subpool_Access'Storage_Pool;
begin
Default.Allocate
(Storage_Address => Address,
Size_In_Storage_Elements => Size,
Alignment => Alignment);
end Allocate_From_Subpool;
--------------------
-- Create_Subpool --
--------------------
overriding function Create_Subpool
(Self : in out Dummy_Storage_Pool)
return not null System.Storage_Pools.Subpools.Subpool_Handle
is
Dummy : constant Dummy_Subpool_Access := new Dummy_Subpool;
begin
return Result : constant not null
System.Storage_Pools.Subpools.Subpool_Handle :=
System.Storage_Pools.Subpools.Subpool_Handle (Dummy)
do
System.Storage_Pools.Subpools.Set_Pool_Of_Subpool (Result, Self);
Self.Last_Subpool := Result;
end return;
end Create_Subpool;
------------------------
-- Deallocate_Subpool --
------------------------
overriding procedure Deallocate_Subpool
(Self : in out Dummy_Storage_Pool;
Subpool : in out System.Storage_Pools.Subpools.Subpool_Handle)
is
Dummy : Dummy_Subpool_Access := Dummy_Subpool_Access (Subpool);
begin
Free (Dummy);
Self.Last_Subpool := null;
end Deallocate_Subpool;
------------------------------
-- Default_Subpool_For_Pool --
------------------------------
overriding function Default_Subpool_For_Pool
(Self : in out Dummy_Storage_Pool)
return not null System.Storage_Pools.Subpools.Subpool_Handle is
begin
return Self.Last_Subpool;
end Default_Subpool_For_Pool;
end Program.Dummy_Subpools;
|
test/succeed/Issue326.agda | larrytheliquid/agda | 1 | 7836 | <reponame>larrytheliquid/agda<gh_stars>1-10
module Issue326 where
open import Common.Prelude
open import Common.MAlonzo using () -- see issue 561
postulate
QName : Set
printBool : Bool → IO Unit
{-# BUILTIN QNAME QName #-}
{-# COMPILED printBool print #-}
primitive primQNameEquality : QName → QName → Bool
main : IO Unit
main = printBool (primQNameEquality (quote Unit) (quote IO))
|
legend-pure-m2-dsl-diagram/src/main/antlr4/org/finos/legend/pure/m2/dsl/diagram/serialization/grammar/DiagramAntlrLexer.g4 | hausea/legend-pure | 37 | 219 | lexer grammar DiagramAntlrLexer;
import M4Fragment;
DIAGRAM: 'Diagram';
TYPE_VIEW : 'TypeView';
ASSOCIATION_VIEW : 'AssociationView';
PROPERTY_VIEW : 'PropertyView';
GENERALIZATION_VIEW : 'GeneralizationView';
GEOMETRY : 'Geometry';
TYPE : 'type'(Assign);
ASSOCIATION : 'association'(Assign);
PROPERTY : 'property'(Assign);
STEREOTYPES_VISIBLE : 'stereotypesVisible'(Assign);
ATTRIBUTES_VISIBLE : 'attributesVisible'(Assign);
ATTRIBUTE_STEREOTYPES_VISIBLE : 'attributeStereotypesVisible'(Assign);
ATTRIBUTE_TYPES_VISIBLE : 'attributeTypesVisible'(Assign);
NAME_VISIBLE : 'nameVisible'(Assign);
COLOR : 'color'(Assign);
LINE_WIDTH : 'lineWidth'(Assign);
LINE_STYLE : 'lineStyle'(Assign);
POSITION : 'position'(Assign);
POINTS : 'points'(Assign);
WIDTH : 'width'(Assign);
HEIGHT : 'height'(Assign);
LABEL : 'label'(Assign);
SOURCE : 'source'(Assign);
TARGET : 'target'(Assign);
PROP_POSITION : 'propertyPosition'(Assign);
MULT_POSITION : 'multiplicityPosition'(Assign);
SOURCE_PROP_POSITION : 'sourcePropertyPosition'(Assign);
SOURCE_MULT_POSITION : 'sourceMultiplicityPosition'(Assign);
TARGET_PROP_POSITION : 'targetPropertyPosition'(Assign);
TARGET_MULT_POSITION : 'targetMultiplicityPosition'(Assign);
IMPORT : 'import';
CURLY_BRACKET_OPEN: '{';
CURLY_BRACKET_CLOSE: '}';
BRACKET_OPEN: '[';
BRACKET_CLOSE: ']';
GROUP_OPEN: '(';
GROUP_CLOSE: ')';
PATH_SEPARATOR: '::';
DOT: '.';
COMMA: ',';
END_LINE: ';';
STRING: ('\'' ( EscSeq | ~['\r\n] )* '\'' ) ;
COLOR_STRING : '#'(HexDigit)(HexDigit)(HexDigit)(HexDigit)(HexDigit)(HexDigit);
BOOLEAN: Boolean;
TRUE: True;
FALSE: False;
INTEGER: (Digit)+;
FLOAT : ('+' | '-')? (Digit)* '.' (Digit)+ ( ('e' | 'E') ('+' | '-')? (Digit)+)? ('f' | 'F')?;
VALID_STRING: (Letter | Digit | '_' ) (Letter | Digit | '_' | '$')*;
WHITESPACE: [ \r\t\n]+ -> skip ;
COMMENT: '/*' .*? '*/' -> skip ;
LINE_COMMENT: '//' ~[\r\n]* -> skip ;
STAR: '*'; |
Build/Interpreters/beebOzmoo/asm/splashscreen.asm | polluks/Puddle-BuildTools | 38 | 90963 | <filename>Build/Interpreters/beebOzmoo/asm/splashscreen.asm
!zone splash_screen {
splash_screen
ldy #0
sty z_temp ; String number currently printing
splash_line_y
ldx splash_index_line,y
lda splash_index_col,y
tay
jsr set_cursor
ldy z_temp
ldx splash_index_lb,y
lda splash_index_hb,y
jsr printstring_raw
inc z_temp
ldy z_temp
cpy #5
bne splash_line_y
lda $a2
clc
adc #<(SPLASHWAIT*60)
sta z_temp + 2
lda $a1
adc #>(SPLASHWAIT*60)
sta z_temp + 1
- jsr kernal_getchar
bne +
lda z_temp + 2
cmp $a2
bne -
lda z_temp + 1
cmp $a1
bne -
+
lda #147
jmp s_printchar
!source "splashlines.asm"
splash_index_line
!byte 4, 6, 8, 10, 24
splash_index_lb
!byte <splashline0, <splashline1, <splashline2, <splashline3, <splashline4
splash_index_hb
!byte >splashline0, >splashline1, >splashline2, >splashline3, >splashline4
}
|
Base/Change/Context.agda | inc-lc/ilc-agda | 10 | 10768 | ------------------------------------------------------------------------
-- INCREMENTAL λ-CALCULUS
--
-- Change contexts
--
-- This module specifies how a context of values is merged
-- together with the corresponding context of changes.
--
-- In the PLDI paper, instead of merging the contexts together, we just
-- concatenate them. For example, in the "typing rule" for Derive
-- in Sec. 3.2 of the paper, we write in the conclusion of the rule:
-- "Γ, ΔΓ ⊢ Derive(t) : Δτ". Simple concatenation is possible because
-- the paper uses named variables and assumes that no user variables
-- start with "d". In this formalization, we use de Bruijn indices, so
-- it is easier to alternate values and their changes in the context.
------------------------------------------------------------------------
module Base.Change.Context
{Type : Set}
(ΔType : Type → Type) where
open import Base.Syntax.Context Type
-- Transform a context of values into a context of values and
-- changes.
ΔContext : Context → Context
ΔContext ∅ = ∅
ΔContext (τ • Γ) = ΔType τ • τ • ΔContext Γ
-- like ΔContext, but ΔType τ and τ are swapped
ΔContext′ : Context → Context
ΔContext′ ∅ = ∅
ΔContext′ (τ • Γ) = τ • ΔType τ • ΔContext′ Γ
-- This sub-context relationship explains how to go back from
-- ΔContext Γ to Γ: You have to drop every other binding.
Γ≼ΔΓ : ∀ {Γ} → Γ ≼ ΔContext Γ
Γ≼ΔΓ {∅} = ∅
Γ≼ΔΓ {τ • Γ} = drop ΔType τ • keep τ • Γ≼ΔΓ
|
example/ROS/map/meta.als | chongliujlu/ColorfulAlloy | 0 | 191 | module meta
open util/ordering[Time]
sig Time{}
abstract sig Node {
subscribes: set Topic,
advertises: set Topic,
inbox: Message ->Time,
outbox: Message->Time
}
abstract sig Topic {}
fact Node_Liveness{
-- all n: Node | (some n.advertises) implies always (some n.inbox implies eventually some n.outbox)
}
sig Message {
topic : one Topic,
value : one Value
}
abstract sig Value {}
fact Messages {
all n : Node, t : Time | {
n.inbox.t.topic in n.subscribes
n.outbox.t.topic in n.advertises}
all m : Message, t: Time-last | some t': t.nexts|{
m in Node.outbox.t implies (all n : subscribes.(m.topic) | m in n.inbox.t')
}
all t: Time-last| all m : Node.outbox.t | some t': t.nexts |
{m not in Node.outbox.t'}
all m : Message, t: Time-first |some t': t.prevs|{
m in Node.inbox.t implies (some n : advertises.(m.topic) | m in n.outbox.t')
}
}
fact init {
no (outbox + inbox).first
}
abstract sig Sensor extends Node {}{
subscribes = none
}
abstract sig Actuator extends Node{}{
advertises = none
}
fact Sensor_Behaviour {
all s:Sensor,t: Time-last| some t': t.nexts | { some s.outbox.t'
}
}
fun channel : Node -> Topic -> Node {
{a : Node, t : Topic, b : Node | a->t in advertises and b->t in subscribes}
}
|
solutions/65 - Defrag Ordered/size-125_speed-15.asm | behrmann/7billionhumans | 45 | 25342 | <reponame>behrmann/7billionhumans<gh_stars>10-100
-- 7 Billion Humans (2053) --
-- 65: Defrag Ordered --
-- Author: ansvonwa
-- Size: 125
-- Speed: 15
step n
step n
if c == datacube and
ne == datacube:
comment 0
comment 1
pickup c
step ne
step ne
step ne
drop
step n
step nw
comment 2
pickup e
drop
step e
step e
step e
comment 4
pickup e
step w
step w
drop
comment 10
step s
pickup c
step e
step e
step ne
drop
step s
step s
step s
step sw
pickup sw
step n
step n
drop
end
endif
if c == datacube and
nw == datacube:
comment 3
step nw
comment 5
pickup nw
step ne
step e
step e
step ne
step ne
drop
comment 13
pickup s
step w
drop
step s
step s
step s
pickup s
step ne
step n
drop
step w
step w
pickup c
step nw
drop
step s
step s
step s
pickup sw
step ne
step n
drop
end
endif
if c != datacube:
comment 6
step n
step ne
step ne
comment 7
pickup c
step nw
drop
comment 11
pickup e
step w
step w
step w
step w
step w
drop
comment 14
pickup s
step e
drop
step e
pickup s
drop
step e
pickup s
drop
step s
pickup s
step w
step w
step w
drop
end
endif
comment 8
step n
comment 9
pickup ne
step nw
step nw
step w
step w
drop
comment 12
pickup n
step ne
step ne
step e
step e
drop
step w
comment 15
pickup sw
step e
step e
drop
step s
step s
step sw
pickup s
step w
step nw
drop
step sw
pickup s
step n
drop
DEFINE COMMENT 0
<KEY>;
DEFINE COMMENT 1
eJztjbEKgnAchL8n6XlETEWioWzwP/kEDlZ0BUGESOIrODQ3NEiTU1PP1K+3aPh/x3HDcdwM0JwVmWlN
QEGkgtzSsaFSwqCYp+WoJZMcL36bCylnYg623bKj5q6ah/a8OfKxfuRGq57S7NSxoCHiSqiTfXk8nr/g
C1PHIdU;
DEFINE COMMENT 2
eJyTYGBgaEhjEGhIZhBgKGWQY6hn0GJoZzBr6GCwAdIuDU0MPgx1DAENFQwRDVkMCQ2ZDEkMWQxpDHkM
RQ1lDE0MNQyTgPJ<KEY>;
DEFINE COMMENT 3
eJztkL1LglEUxn9jYJR9TPZBRIMURDhEOLyEfUFDYwVFmUgNRTUEZUicJQdpCUKoHEP6eBGKkJQmsYi0
hiiaqr1w6S/ovBf/hiYfeLic557z3OfcMCAuHnBRUGaklhT1bEkD09LEIB7c4qFGWpiQNtbpYJEuxvHS
Tw9e6aVVzyscn1G6GaNTRlQfYlIZlwA5545Z2mUGiynOTT2vvgs0i+O2jF9WsGSNsL6wzSpHLJEmRIag
0kGEoGwqI6ruEJJdzeEgqYkO1T2haoKYHJCUfXLKvBzzbHpszXSqc6lKFhufpPFpZXFLwGhnbHBBVC4R
suxVtJzY5LnmUbK8Gq2om5fokyLDUuBEafaRknq+MMAHftN3p3vcE+VJPd+I8U7c6GX9rzJz8s2Nqb9w
80kdP8pfGqmiin/GHxxeYAM;
DEFINE COMMENT 4
eJwTZGBgaGhhcGjoYLBq6GawYOhhsGFoYohoqGXIYqhhaGuoY5jD0MCwiKGLYV3DVIYNDCDQx1DS0MXQ
AdSziqGF4RbDKBgFo2DIAgChrRND;
DEFINE COMMENT 5
eJyTZWBgaPBnSGsIZIhjCGaIYUhg0GPIYJBiyGKQaMgDY7uGHIa4hjSGeQypDHsYQKCbQaqhmcGJoYXB
raGfwY9hElDXJKAZ/Qx9Dd0MSxpaGXZB1Qk19DJIMExkkGGYwaDQsIBBg2ExEI+CUTAKBg0AAKigGyQ;
DEFINE COMMENT 6
<KEY>;
DEFINE COMMENT 7
eJztzD0OAWEUheF3IYqRKBQKtU5BaQESIzN6pZCIHGNCRBg/swKxBrEClcISLMWxCs33Jqe6T24V12ai
DmP1aWhIpJQ6I7okzIm5MuD+Y8qIWHoZFa3tNtS0p8mJlkp6XkxJqqN/bZnaL1hZ5+Q6+HLmxoWHCp7s
eNm8NeNDKBT6W1/ZgSTF;
DEFINE COMMENT 8
eJztkLFKwmEUxX+P0BBCQmQWYqIQDUISDQ5NDaG1RISISIEUCZWE2SmkKaIhpExaggYpBMeSiKZSiQiC
aGpsaGjoAbr96SEaPHA4cL/LPec7c4B66KIXt/rw009YXuYZYB8vV3h4N37xC6/t+XEphEdhxjVKjAgJ
0xRhMhpmSUEyDJEmQJIgCUIkNcKBxnhUlE9N/N2K2a04AcWZNp4zw5Mz3zGXbXMsGDcYZJmIFpligVml
KBovlOZOGZ7JGte41Tp15aiY7rKKtELRdI+8+RY41BZVbfKhPN+OxzFuyvg4Iaoy4oi6saESTUq8OjuX
dFOzDDUmqXLjzCpkVSHHqV0+s6S/eLC8TeujZdrGp7b10jbPFg3n/RoX9+b1Yn99s1Y66OCf4QcHgFqc
;
DEFINE COMMENT 9
eJztjDEKwmAUg7+zODo4ioOTOIg6iDhJEap29QSiQYt1sRX5555DxFk8lukpXP4PQniPJC3MhCVjEqYk
mrFgRY+ULht7xkAZW6W8rI/WfJsKR9o60EHOnOirYKiKEQ+vBOYKXgnsfOe6UXPhyZl3U5XYk/tfcNWd
UrVTkUjkL/wA0r0iog;
DEFINE COMMENT 10
eJwTZmBgaMhnUGPIY1BrKGLQa6hnsGtoZ/Bp6GcIY5jIEMUwhSEDSDcx9AJZjQy7GgoYnjCA9JQyTGko
AeIahkUNXQwbGqYy7GAYBaNgFAw5AABzlRYy;
DEFINE COMMENT 11
eJyTYWBgaJjDYNIwi0GvYSaDQcMUBqOGLgaHhhaGAIZmhqSGZoaMhnaGOoYJDHMYpjJsY5jOcAaILzVM
ZnjC0MPwASj/gaGR4V1DFcMDhgqgeAXDKSB7F1BsSUM3QxfDFIYChhkMcUCzHRhmMpgwjIJRMAoGFQAA
TVklQw;
DEFINE COMMENT 12
eJwTZgCCUgYhhhIgzmHwachhiGPIY0hqqGbIYKhlyGloYGgB4h6GeoYlDJUMpxpKGS6BtDQUMEBAAVg/
V8MsBjuGUTAKRsGQAwCWLRCz;
DEFINE COMMENT 13
eJyTYACCBIa8hgIGB4ZKBp2GegaFhiYGBYZmBi2GegY/oPgmIN7HUMhwCKSUYQuDSMM8hjSGOQxlDbMZ
ehjmM8xg2MAwDyy3gaGiYR1DDcNahpaG5UA9SxmeMIyCUTAKBjUAAOXSGfU;
DEFINE COMMENT 14
eJwTYwCCDgYDhlYGDYY6Bo2GCiC7jMGioYghCIgjGMoZ8hqqGPIYGhmSGloYwho6GSwYuoBqOxmUGtoZ
lID6tIDiZkDxJQ2tDKcYmhhuNNQz3GMYBaNgFAwJAACYdxdz;
DEFINE COMMENT 15
eJwTY2BgaOhkkGPoYpBi6GCQa2hgMGqoZPBoKGbIYChg6GPIZ9gGpA8xFDNcYihhuNZQwXCHoZrhFkM9
w4WGFoY1DG0ME4C4p6GZoYahiaGqoQaIC4GmjYJRMAqGBAAAYyIZ9g;
|
Transynther/x86/_processed/US/_zr_/i3-7100_9_0xca_notsx.log_21829_330.asm | ljhsiun2/medusa | 9 | 177527 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/US/_zr_/i3-7100_9_0xca_notsx.log_21829_330.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0xc6a4, %rcx
clflush (%rcx)
nop
nop
nop
nop
xor $53515, %r10
movl $0x61626364, (%rcx)
nop
xor $16359, %rax
lea addresses_normal_ht+0x1eff5, %r9
nop
nop
nop
nop
and $13637, %rbx
vmovups (%r9), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %r12
nop
nop
nop
nop
nop
mfence
lea addresses_WT_ht+0x10d07, %r12
sub $44321, %r13
mov (%r12), %rax
nop
nop
and %r9, %r9
lea addresses_UC_ht+0x124a4, %rbx
nop
nop
nop
nop
nop
xor $47218, %r10
movw $0x6162, (%rbx)
nop
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_UC_ht+0x10324, %rax
and $62146, %r9
mov (%rax), %rbx
nop
nop
nop
xor %rax, %rax
lea addresses_normal_ht+0x17824, %rcx
nop
nop
nop
nop
and $62873, %r13
mov $0x6162636465666768, %r10
movq %r10, %xmm6
vmovups %ymm6, (%rcx)
nop
nop
add $51350, %r12
lea addresses_WT_ht+0x77f4, %r12
nop
nop
nop
nop
nop
cmp %r10, %r10
movl $0x61626364, (%r12)
nop
nop
sub %rax, %rax
lea addresses_normal_ht+0x1b06c, %rsi
lea addresses_A_ht+0x162a4, %rdi
nop
nop
nop
nop
nop
add $61888, %r13
mov $48, %rcx
rep movsl
nop
nop
nop
nop
mfence
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
// Store
lea addresses_A+0x2c88, %rdx
sub $52418, %r10
mov $0x5152535455565758, %rbp
movq %rbp, %xmm6
movups %xmm6, (%rdx)
// Exception!!!
mov (0), %rbp
nop
dec %r11
// Store
lea addresses_PSE+0xff34, %r10
nop
nop
and %rdx, %rdx
movb $0x51, (%r10)
nop
nop
inc %rbp
// Load
lea addresses_normal+0xfd7c, %rbp
clflush (%rbp)
nop
nop
nop
nop
nop
dec %r9
movb (%rbp), %r10b
nop
nop
nop
nop
xor %r9, %r9
// Store
lea addresses_normal+0x136a4, %r11
and $29678, %rdi
mov $0x5152535455565758, %r9
movq %r9, %xmm5
vmovups %ymm5, (%r11)
inc %rdi
// Faulty Load
lea addresses_US+0x1ea4, %r9
nop
and $24636, %rdx
movups (%r9), %xmm0
vpextrq $1, %xmm0, %rdi
lea oracles, %r10
and $0xff, %rdi
shlq $12, %rdi
mov (%r10,%rdi,1), %rdi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 16, 'AVXalign': True}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_A', 'size': 16, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_PSE', 'size': 1, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_normal', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_normal', 'size': 32, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}}
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_923.asm | ljhsiun2/medusa | 9 | 167876 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r9
push %rbp
push %rdi
lea addresses_A_ht+0xf806, %r9
nop
nop
nop
nop
xor %rbp, %rbp
movw $0x6162, (%r9)
dec %rdi
pop %rdi
pop %rbp
pop %r9
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r8
push %r9
push %rax
push %rbp
// Store
lea addresses_WT+0xc5ac, %rbp
inc %r8
movw $0x5152, (%rbp)
add %r15, %r15
// Faulty Load
lea addresses_RW+0x1e6ac, %r14
clflush (%r14)
nop
and $16474, %r12
mov (%r14), %r9
lea oracles, %r8
and $0xff, %r9
shlq $12, %r9
mov (%r8,%r9,1), %r9
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
Drivers/USB/Generic_EHCI.asm | jaredwhitney/os3 | 5 | 90258 | USB.init :
pusha
;call USB_InitController
;call USB_EnablePlugAndPlay
popa
ret
USB_PrintControllerInfo :
pusha
call USB_CheckExists
mov ebx, USB.STRING_mmioLoc
call console.print
mov ebx, [USB_BASE]
call console.numOut
call console.newline
mov ebx, USB.STRING_numPorts
call console.print
mov ebx, [USB.numPorts]
call console.numOut
call console.newline
popa
ret
USB_PrintActivePorts :
pusha
call USB_CheckExists
xor ecx, ecx
USB_PrintActivePorts.loop :
mov eax, [USB_OPBASE]
add eax, 0x44 ; eax -> port stat and control data
push ecx
imul ecx, 4
add eax, ecx ; get to the proper port number
pop ecx
mov ebx, [eax] ; load data for the first port
and ebx, 0b1
cmp ebx, 0
je USB.nonActive
push ebx
mov ebx, USB.STRING_activePort
call console.print
mov ebx, ecx
and ebx, 0xFF ; cl is port counter
call console.numOut
call console.newline
pop ebx
USB.nonActive :
add ecx, 1
cmp ecx, [USB.numPorts]
jl USB_PrintActivePorts.loop
popa
ret
USB_InitController :
pusha
call USB_GrabControllerInfo
; actually init the controller here!
mov ebx, [USB_OPBASE]
add ebx, 0x40
mov eax, 0x1
mov [ebx], eax ; take control of the USB ports!
popa
ret
USB_RunAsyncTasks :
pusha
mov ebx, [USB_OPBASE] ; o+0x0 = USBCMD reg
mov eax, [ebx]
or eax, 0b100000
mov [ebx], eax
popa
ret
USB_LoadQueueHead : ; queue head address in ebx
pusha
mov eax, [USB_OPBASE]
add eax, 0x18 ; ASYNCLISTADDR
mov eax, ebx
popa
ret
USB_GrabControllerInfo : ; so broken D:
pusha
mov ah, 0x0C ; EHCI controller info
mov al, 0x03
mov bl, 0x20
call PCI.getDeviceByDescription
mov al, dh
mov ah, dl
mov [USB_PCIMAJOR], ax
mov bl, [fnc]
mov [USB_PCIMINOR], bl
mov bh, 0x10
call PCI.read
mov [USB_BASE], eax
xor ebx, ebx
mov bl, [eax]
add eax, ebx ; operational base -> eax
mov [USB_OPBASE], eax
;call console.numOut
mov ebx, eax
;call console.numOut
mov eax, [USB_BASE] ; structural params
add eax, 0x4
mov ebx, [eax]
and ebx, 0xF ; number of ports
mov [USB.numPorts], ebx
popa
ret
USB_NotSupported :
mov ebx, USB.STRING_CONTROLLERNOTFOUND
mov ah, 0xFF
call console.println
popa
ret
USB_CheckExists :
pusha
mov dx, [USB_PCIMAJOR]
cmp dx, 0xFFFF
je USB_NotSupported
popa
ret
USB_EnablePlugAndPlay :
pusha
mov ebx, [USB_OPBASE]
add ebx, 0x8
mov eax, [ebx]
or eax, (0b1 << 2)
mov [ebx], eax
mov ax, [USB_PCIMAJOR]
mov bl, [USB_PCIMINOR]
mov bh, 0x4
push eax
call PCI.read
mov ecx, eax
pop eax
or ecx, 0b1 << 10
call PCI.write
popa
ret
USB.STRING_mmioLoc :
db "USB MMIO: 0x", 0x0
USB.STRING_activePort :
db "Port is active: 0x", 0x0
USB.STRING_numPorts :
db "USB Port Count: 0x", 0x0
USB.STRING_CONTROLLERNOTFOUND :
db "[Error] No EHCI Controller found!", 0x0
USB.numPorts :
dd 0x0
USB_BASE :
dd 0x0
USB_OPBASE :
dd 0x0
USB_PCIMAJOR :
dw 0x0
USB_PCIMINOR :
db 0x0
align 32 ; no idea if any of these structures are actually valid (will test later)
USB_QUEUEHEADEX :
dd (0x7e00+USB_QUEUEHEADEX-$$) | 0b11
dd 0x0 | (0x400 << 16) | (0b1 << 15) | (0b0 << 14) | (0b00 << 12) | (0x7 << 8) | (0b0 << 7) | (0b0) ; so much is probably wrong here...
dd (0b01 << 30) | 0x00
dd USB_QTDEX ; current qTD
dd (0x7e00+USB_QTDEX-$$) | 0b1 ; next qTD | T bit
dd (0x7e00+USB_QTDEX-$$) | 0b1 ; alternate qTD | T bit
dw (0b0 << 15) | (0x0 & 0b11111) ; data toggle off, 0 bytes to transfer
dw (0b0 << 15) | (0b000 << 12) | (0b00 << 10) | (0b10 << 8) | (0x00) ; 0b10 << 8 = SETUP PID
dd 0x0 ; this should be an actual buffer!
dd 0x0 ; this should be an actual buffer!
dd 0x0 ; this should be an actual buffer!
dd 0x0 ; this should be an actual buffer!
dd 0x0 ; this should be an actual buffer!
USB_QTDEX :
dd 0x0 | 0b1
dd 0x0 | 0b1
dw (0b0 << 15) | (0x0 & 0b11111)
dw (0b0 << 15) | (0b000 << 12) | (0b00 << 10) | (0b10 << 8) | (0x00)
dd 0x0 ; this should be an actual buffer!
dd 0x0 ; this should be an actual buffer!
dd 0x0 ; this should be an actual buffer!
dd 0x0 ; this should be an actual buffer!
dd 0x0 ; this should be an actual buffer! |
src/tools/uniqpage.adb | spr93/whitakers-words | 204 | 178 | <reponame>spr93/whitakers-words<filename>src/tools/uniqpage.adb
-- WORDS, a Latin dictionary, by <NAME> (USAF, Retired)
--
-- Copyright <NAME> (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Text_IO;
with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package;
-- with Latin_Utils.Latin_File_Names; use Latin_Utils.Latin_File_Names;
with Latin_Utils.Inflections_Package; use Latin_Utils.Inflections_Package;
with Latin_Utils.Dictionary_Package; use Latin_Utils.Dictionary_Package;
-- with line_stuff; use line_stuff;
-- with dictionary_form;
procedure Uniqpage is
-- package Integer_IO is new Text_IO.Integer_IO (Integer);
use Text_IO;
use Dictionary_Entry_IO;
use Part_Entry_IO;
use Kind_Entry_IO;
use Translation_Record_IO;
use Age_Type_IO;
use Area_Type_IO;
use Geo_Type_IO;
use Frequency_Type_IO;
use Source_Type_IO;
Uniques_File, Uniqpage : Text_IO.File_Type;
S : constant String (1 .. 400) := (others => ' ');
Line : String (1 .. 400) := (others => ' ');
Blanks : constant String (1 .. 400) := (others => ' ');
L, Last : Integer := 0;
Stem : Stem_Type := Null_Stem_Type;
Qual : Quality_Record;
Kind : Kind_Entry;
Tran : Translation_Record;
Mean : Meaning_Type;
procedure Get_Line_Unique
(Input : in Text_IO.File_Type;
S : out String;
Last : out Natural)
is
begin
Last := 0;
Text_IO.Get_Line (Input, S, Last);
-- FIXME: this if statement was commented out, because it triggered
-- warning "if statement has no effect". I didn't delete it because quite
-- possibly author wanted it to do something. Question is what?
--if Trim (s (s'First .. last)) /= "" then -- Rejecting blank lines
-- null;
--end if;
end Get_Line_Unique;
begin
Put_Line ("UNIQUES.LAT -> UNIQPAGE.PG");
Put_Line ("Takes UNIQUES form, single lines it, puts # at beginning,");
Put_Line ("producing a .PG file for sorting to produce paper dictionary");
Create (Uniqpage, Out_File, "UNIQPAGE.PG");
Open (Uniques_File, In_File, "UNIQUES.LAT");
Over_Lines :
while not End_Of_File (Uniques_File) loop
Line := Blanks;
Get_Line_Unique (Uniques_File, Line, Last); -- STEM
Stem := Head (Trim (Line (1 .. Last)), Max_Stem_Size);
Line := Blanks;
Get_Line_Unique (Uniques_File, Line, Last); -- QUAL, KIND, TRAN
Quality_Record_IO.Get (Line (1 .. Last), Qual, L);
Get (Line (L + 1 .. Last), Qual.Pofs, Kind, L);
Age_Type_IO.Get (Line (L + 1 .. Last), Tran.Age, L);
Area_Type_IO.Get (Line (L + 1 .. Last), Tran.Area, L);
Geo_Type_IO.Get (Line (L + 1 .. Last), Tran.Geo, L);
Frequency_Type_IO.Get (Line (L + 1 .. Last), Tran.Freq, L);
Source_Type_IO.Get (Line (L + 1 .. Last), Tran.Source, L);
Line := Blanks;
Get_Line_Unique (Uniques_File, Line, L); -- MEAN
Mean := Head (Trim (Line (1 .. L)), Max_Meaning_Size);
-- while not END_OF_FILE (UNIQUES_FILE) loop
-- S := BLANK_LINE;
-- GET_LINE (INPUT, S, LAST);
-- if TRIM (S (1 .. LAST)) /= "" then -- Rejecting blank lines
--
--
Text_IO.Put (Uniqpage, "#" & Stem);
Quality_Record_IO.Put (Uniqpage, Qual);
-- PART := (V, (QUAL.V.CON, KIND.V_KIND));
if (Qual.Pofs = V) and then (Kind.V_Kind in Gen .. Perfdef) then
Text_IO.Put (Uniqpage, " " &
Verb_Kind_Type'Image (Kind.V_Kind) & " ");
end if;
Text_IO.Put (Uniqpage, " [");
Age_Type_IO.Put (Uniqpage, Tran.Age);
Area_Type_IO.Put (Uniqpage, Tran.Area);
Geo_Type_IO.Put (Uniqpage, Tran.Geo);
Frequency_Type_IO.Put (Uniqpage, Tran.Freq);
Source_Type_IO.Put (Uniqpage, Tran.Source);
Text_IO.Put (Uniqpage, "]");
Put (Uniqpage, " :: ");
Put_Line (Uniqpage, Mean);
--end if; -- Rejecting blank lines
end loop Over_Lines;
Close (Uniqpage);
exception
when Text_IO.Data_Error =>
null;
when others =>
Put_Line (S (1 .. Last));
Close (Uniqpage);
end Uniqpage;
|
ADL/drivers/stm32f334/stm32-adc.adb | JCGobbi/Nucleo-STM32F334R8 | 0 | 26159 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics 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. --
-- --
-- --
-- This file is based on: --
-- --
-- @file stm32f4xx_hal_adc.c --
-- @author MCD Application Team --
-- @version V1.3.1 --
-- @date 25-March-2015 --
-- @brief Header file of ADC HAL module. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
with STM32_SVD.ADC; use STM32_SVD.ADC;
package body STM32.ADC is
procedure Set_Sequence_Position
(This : in out Analog_To_Digital_Converter;
Channel : Analog_Input_Channel;
Rank : Regular_Channel_Rank)
with Inline;
procedure Set_Sampling_Time
(This : in out Analog_To_Digital_Converter;
Channel : Analog_Input_Channel;
Sample_Time : Channel_Sampling_Times)
with Inline,
Pre => Conversion_Started (This) = False and
Injected_Conversion_Started (This) = False;
procedure Set_Injected_Channel_Sequence_Position
(This : in out Analog_To_Digital_Converter;
Channel : Analog_Input_Channel;
Rank : Injected_Channel_Rank)
with Inline;
procedure Set_Injected_Channel_Offset
(This : in out Analog_To_Digital_Converter;
Channel : Analog_Input_Channel;
Rank : Injected_Channel_Rank;
Offset : Injected_Data_Offset)
with Inline;
------------
-- Enable --
------------
procedure Enable (This : in out Analog_To_Digital_Converter) is
begin
if not This.CR.ADEN then
This.CR.ADEN := True;
loop
exit when This.ISR.ADRDY = True;
end loop;
end if;
end Enable;
-------------
-- Disable --
-------------
procedure Disable (This : in out Analog_To_Digital_Converter) is
begin
This.CR.ADDIS := True;
end Disable;
-------------
-- Enabled --
-------------
function Enabled (This : Analog_To_Digital_Converter) return Boolean is
(This.CR.ADEN = True);
--------------
-- Disabled --
--------------
function Disabled (This : Analog_To_Digital_Converter) return Boolean is
(This.CR.ADEN = False);
--------------------
-- Configure_Unit --
--------------------
procedure Configure_Unit
(This : in out Analog_To_Digital_Converter;
Resolution : ADC_Resolution;
Alignment : Data_Alignment)
is
begin
This.CFGR.RES := ADC_Resolution'Enum_Rep (Resolution);
This.CFGR.ALIGN := Alignment = Left_Aligned;
end Configure_Unit;
------------------------
-- Current_Resolution --
------------------------
function Current_Resolution
(This : Analog_To_Digital_Converter)
return ADC_Resolution
is (ADC_Resolution'Val (This.CFGR.RES));
-----------------------
-- Current_Alignment --
-----------------------
function Current_Alignment
(This : Analog_To_Digital_Converter)
return Data_Alignment
is ((if This.CFGR.ALIGN then Left_Aligned else Right_Aligned));
-----------------------------------
-- Configure_Regular_Conversions --
-----------------------------------
procedure Configure_Regular_Conversions
(This : in out Analog_To_Digital_Converter;
Continuous : Boolean;
Trigger : Regular_Channel_Conversion_Trigger;
Conversions : Regular_Channel_Conversions)
is
begin
This.CFGR.CONT := Continuous;
if Trigger.Enabler /= Trigger_Disabled then
This.CFGR.EXTSEL := External_Events_Regular_Group'Enum_Rep (Trigger.Event);
This.CFGR.EXTEN := External_Trigger'Enum_Rep (Trigger.Enabler);
-- ADSTART need to be set (RM3064 pg. 230 chapter 13.3.18).
This.CR.ADSTART := True;
else
This.CFGR.EXTSEL := 0;
This.CFGR.EXTEN := 0;
end if;
for Rank in Conversions'Range loop
declare
Conversion : Regular_Channel_Conversion renames Conversions (Rank);
begin
Configure_Regular_Channel
(This, Conversion.Channel, Rank, Conversion.Sample_Time);
-- We check the VBat first because that channel is also used for
-- the temperature sensor channel on some MCUs, in which case the
-- VBat conversion is the only one done. This order reflects that
-- hardware behavior.
if VBat_Conversion (This, Conversion.Channel) then
Enable_VBat_Connection;
elsif VRef_TemperatureSensor_Conversion (This, Conversion.Channel)
then
Enable_VRef_TemperatureSensor_Connection;
end if;
end;
end loop;
This.SQR1.L := UInt4 (Conversions'Length - 1); -- biased rep
end Configure_Regular_Conversions;
----------------------------------
-- Regular_Conversions_Expected --
----------------------------------
function Regular_Conversions_Expected (This : Analog_To_Digital_Converter)
return Natural is
(Natural (This.SQR1.L) + 1);
-----------------------
-- Scan_Mode_Enabled --
-----------------------
function Scan_Mode_Enabled (This : Analog_To_Digital_Converter)
return Boolean
is (This.SQR1.L /= UInt4 (0));
------------------------------------
-- Configure_Injected_Conversions --
------------------------------------
procedure Configure_Injected_Conversions
(This : in out Analog_To_Digital_Converter;
AutoInjection : Boolean;
Trigger : Injected_Channel_Conversion_Trigger;
Conversions : Injected_Channel_Conversions)
is
begin
-- Injected channels cannot be converted continuously. The only
-- exception is when an injected channel is configured to be converted
-- automatically after regular channels in continuous mode. See note in
-- RM 13.3.5, pg 390, and "Auto-injection" section on pg 392.
This.CFGR.JAUTO := AutoInjection;
if Trigger.Enabler /= Trigger_Disabled then
This.JSQR.JEXTEN := External_Trigger'Enum_Rep (Trigger.Enabler);
This.JSQR.JEXTSEL := External_Events_Injected_Group'Enum_Rep (Trigger.Event);
-- JADSTART need to be set (RM3064 pg. 230 chapter 13.3.18).
This.CR.JADSTART := True;
else
This.JSQR.JEXTEN := 0;
This.JSQR.JEXTSEL := 0;
end if;
for Rank in Conversions'Range loop
declare
Conversion : Injected_Channel_Conversion renames
Conversions (Rank);
begin
Configure_Injected_Channel
(This,
Conversion.Channel,
Rank,
Conversion.Sample_Time,
Conversion.Offset);
-- We check the VBat first because that channel is also used for
-- the temperature sensor channel on some MCUs, in which case the
-- VBat conversion is the only one done. This order reflects that
-- hardware behavior.
if VBat_Conversion (This, Conversion.Channel) then
Enable_VBat_Connection;
elsif VRef_TemperatureSensor_Conversion (This, Conversion.Channel)
then
Enable_VRef_TemperatureSensor_Connection;
end if;
end;
end loop;
This.JSQR.JL := UInt2 (Conversions'Length - 1); -- biased rep
end Configure_Injected_Conversions;
-----------------------------------
-- Injected_Conversions_Expected --
-----------------------------------
function Injected_Conversions_Expected (This : Analog_To_Digital_Converter)
return Natural is
(Natural (This.JSQR.JL) + 1);
----------------------------
-- Enable_VBat_Connection --
----------------------------
procedure Enable_VBat_Connection is
begin
ADC_Common_Periph.CCR.VBATEN := True;
end Enable_VBat_Connection;
------------------
-- VBat_Enabled --
------------------
function VBat_Enabled return Boolean is
(ADC_Common_Periph.CCR.VBATEN);
----------------------------------------------
-- Enable_VRef_TemperatureSensor_Connection --
----------------------------------------------
procedure Enable_VRef_TemperatureSensor_Connection is
begin
ADC_Common_Periph.CCR.VREFEN := True;
ADC_Common_Periph.CCR.TSEN := True;
delay until (Clock + Temperature_Sensor_Stabilization);
end Enable_VRef_TemperatureSensor_Connection;
--------------------------------------
-- VRef_TemperatureSensor_Connected --
--------------------------------------
function VRef_TemperatureSensor_Enabled return Boolean is
(ADC_Common_Periph.CCR.VREFEN and ADC_Common_Periph.CCR.TSEN);
---------------------------------
-- Configure_Common_Properties --
---------------------------------
procedure Configure_Common_Properties
(Mode : Multi_ADC_Mode_Selections;
Clock_Mode : ADC_Clock_Mode;
DMA_Mode : Dual_ADC_DMA_Modes;
Sampling_Delay : Sampling_Delay_Selections)
is
begin
ADC_Common_Periph.CCR.DUAL := Mode'Enum_Rep;
ADC_Common_Periph.CCR.DELAY_k := Sampling_Delay'Enum_Rep;
ADC_Common_Periph.CCR.MDMA := DMA_Mode'Enum_Rep;
ADC_Common_Periph.CCR.CKMODE := Clock_Mode'Enum_Rep;
end Configure_Common_Properties;
-------------------------------
-- Configure_Regular_Channel --
-------------------------------
procedure Configure_Regular_Channel
(This : in out Analog_To_Digital_Converter;
Channel : Analog_Input_Channel;
Rank : Regular_Channel_Rank;
Sample_Time : Channel_Sampling_Times)
is
begin
Set_Sampling_Time (This, Channel, Sample_Time);
Set_Sequence_Position (This, Channel, Rank);
end Configure_Regular_Channel;
--------------------------------
-- Configure_Injected_Channel --
--------------------------------
procedure Configure_Injected_Channel
(This : in out Analog_To_Digital_Converter;
Channel : Analog_Input_Channel;
Rank : Injected_Channel_Rank;
Sample_Time : Channel_Sampling_Times;
Offset : Injected_Data_Offset)
is
begin
Set_Sampling_Time (This, Channel, Sample_Time);
Set_Injected_Channel_Sequence_Position (This, Channel, Rank);
Set_Injected_Channel_Offset (This, Channel, Rank, Offset);
end Configure_Injected_Channel;
----------------------
-- Start_Conversion --
----------------------
procedure Start_Conversion (This : in out Analog_To_Digital_Converter) is
begin
if External_Trigger'Val (This.CFGR.EXTEN) /= Trigger_Disabled then
return;
end if;
if Multi_ADC_Mode_Selections'Val (ADC_Common_Periph.CCR.DUAL) = Independent
or else This'Address = STM32_SVD.ADC1_Base
then
This.CR.ADSTART := True;
end if;
end Start_Conversion;
---------------------
-- Stop_Conversion --
---------------------
procedure Stop_Conversion (This : in out Analog_To_Digital_Converter) is
begin
This.CR.ADSTP := True;
end Stop_Conversion;
------------------------
-- Conversion_Started --
------------------------
function Conversion_Started (This : Analog_To_Digital_Converter)
return Boolean
is
(This.CR.ADSTART);
----------------------
-- Conversion_Value --
----------------------
function Conversion_Value
(This : Analog_To_Digital_Converter)
return UInt16
is
begin
return This.DR.RDATA;
end Conversion_Value;
---------------------------
-- Data_Register_Address --
---------------------------
function Data_Register_Address
(This : Analog_To_Digital_Converter)
return System.Address
is
(This.DR'Address);
-------------------------------
-- Start_Injected_Conversion --
-------------------------------
procedure Start_Injected_Conversion
(This : in out Analog_To_Digital_Converter)
is
begin
This.CR.JADSTART := True;
end Start_Injected_Conversion;
---------------------------------
-- Injected_Conversion_Started --
---------------------------------
function Injected_Conversion_Started (This : Analog_To_Digital_Converter)
return Boolean
is
(This.CR.JADSTART);
-------------------------------
-- Injected_Conversion_Value --
-------------------------------
function Injected_Conversion_Value
(This : Analog_To_Digital_Converter;
Rank : Injected_Channel_Rank)
return UInt16
is
begin
case Rank is
when 1 =>
return This.JDR1.JDATA1;
when 2 =>
return This.JDR2.JDATA2;
when 3 =>
return This.JDR3.JDATA3;
when 4 =>
return This.JDR4.JDATA4;
end case;
end Injected_Conversion_Value;
--------------------------------
-- Multimode_Conversion_Value --
--------------------------------
function Multimode_Conversion_Value (Value : CDR_Data)
return UInt16 is
begin
case Value is
when Master =>
return ADC_Common_Periph.CDR.RDATA_MST;
when Slave =>
return ADC_Common_Periph.CDR.RDATA_SLV;
end case;
end Multimode_Conversion_Value;
--------------------------------
-- Multimode_Conversion_Value --
--------------------------------
function Multimode_Conversion_Value return UInt32 is
begin
return Shift_Left (UInt32 (ADC_Common_Periph.CDR.RDATA_MST), 16) or
UInt32 (ADC_Common_Periph.CDR.RDATA_SLV);
end Multimode_Conversion_Value;
-------------------------------
-- Enable_Discontinuous_Mode --
-------------------------------
procedure Enable_Discontinuous_Mode
(This : in out Analog_To_Digital_Converter;
Regular : Boolean; -- if False, enabling for Injected channels
Count : Discontinuous_Mode_Channel_Count)
is
begin
if Regular then
This.CFGR.JDISCEN := False;
This.CFGR.DISCEN := True;
else -- Injected
This.CFGR.DISCEN := False;
This.CFGR.JDISCEN := True;
end if;
This.CFGR.DISCNUM := UInt3 (Count - 1); -- biased
end Enable_Discontinuous_Mode;
----------------------------------------
-- Disable_Discontinuous_Mode_Regular --
---------------------------------------
procedure Disable_Discontinuous_Mode_Regular
(This : in out Analog_To_Digital_Converter)
is
begin
This.CFGR.DISCEN := False;
end Disable_Discontinuous_Mode_Regular;
-----------------------------------------
-- Disable_Discontinuous_Mode_Injected --
-----------------------------------------
procedure Disable_Discontinuous_Mode_Injected
(This : in out Analog_To_Digital_Converter)
is
begin
This.CFGR.JDISCEN := False;
end Disable_Discontinuous_Mode_Injected;
----------------------------------------
-- Discontinuous_Mode_Regular_Enabled --
----------------------------------------
function Discontinuous_Mode_Regular_Enabled
(This : Analog_To_Digital_Converter)
return Boolean
is (This.CFGR.DISCEN);
-----------------------------------------
-- Discontinuous_Mode_Injected_Enabled --
-----------------------------------------
function Discontinuous_Mode_Injected_Enabled
(This : Analog_To_Digital_Converter)
return Boolean
is (This.CFGR.JDISCEN);
---------------------------
-- AutoInjection_Enabled --
---------------------------
function AutoInjection_Enabled
(This : Analog_To_Digital_Converter)
return Boolean
is (This.CFGR.JAUTO);
----------------
-- Enable_DMA --
----------------
procedure Enable_DMA (This : in out Analog_To_Digital_Converter) is
begin
This.CFGR.DMAEN := True;
end Enable_DMA;
-----------------
-- Disable_DMA --
-----------------
procedure Disable_DMA (This : in out Analog_To_Digital_Converter) is
begin
This.CFGR.DMAEN := False;
end Disable_DMA;
-----------------
-- DMA_Enabled --
-----------------
function DMA_Enabled (This : Analog_To_Digital_Converter) return Boolean is
(This.CFGR.DMAEN);
------------------------------------
-- Enable_DMA_After_Last_Transfer --
------------------------------------
procedure Enable_DMA_After_Last_Transfer
(This : in out Analog_To_Digital_Converter)
is
begin
This.CFGR.DMACFG := True;
end Enable_DMA_After_Last_Transfer;
-------------------------------------
-- Disable_DMA_After_Last_Transfer --
-------------------------------------
procedure Disable_DMA_After_Last_Transfer
(This : in out Analog_To_Digital_Converter)
is
begin
This.CFGR.DMACFG := False;
end Disable_DMA_After_Last_Transfer;
-------------------------------------
-- DMA_Enabled_After_Last_Transfer --
-------------------------------------
function DMA_Enabled_After_Last_Transfer
(This : Analog_To_Digital_Converter)
return Boolean
is (This.CFGR.DMACFG);
------------------------------------------
-- Multi_Enable_DMA_After_Last_Transfer --
------------------------------------------
procedure Multi_Enable_DMA_After_Last_Transfer is
begin
-- This is a common register. You must choose the value in
-- accordance to the resolution: 2 for 12 and 10-bit resolution,
-- 3 for 8 and 6-bit resolution.
ADC_Common_Periph.CCR.MDMA := 2;
end Multi_Enable_DMA_After_Last_Transfer;
-------------------------------------------
-- Multi_Disable_DMA_After_Last_Transfer --
-------------------------------------------
procedure Multi_Disable_DMA_After_Last_Transfer is
begin
ADC_Common_Periph.CCR.MDMA := 0;
end Multi_Disable_DMA_After_Last_Transfer;
-------------------------------------------
-- Multi_DMA_Enabled_After_Last_Transfer --
-------------------------------------------
function Multi_DMA_Enabled_After_Last_Transfer return Boolean is
(ADC_Common_Periph.CCR.MDMA = 2);
------------------------------
-- Watchdog_Enable_Channels --
------------------------------
procedure Watchdog_Enable_Channels
(This : in out Analog_To_Digital_Converter;
Mode : Multiple_Channels_Watchdog;
Low : Watchdog_Threshold;
High : Watchdog_Threshold)
is
begin
This.TR1.HT1 := High;
This.TR1.LT1 := Low;
-- see RM 13.3.28, pg 258, table 45
-- Enable all channel mode
This.CFGR.AWD1SGL := False;
case Mode is
when Watchdog_All_Regular_Channels =>
This.CFGR.AWD1EN := True;
when Watchdog_All_Injected_Channels =>
This.CFGR.JAWD1EN := True;
when Watchdog_All_Both_Kinds =>
This.CFGR.AWD1EN := True;
This.CFGR.JAWD1EN := True;
end case;
end Watchdog_Enable_Channels;
-----------------------------
-- Watchdog_Enable_Channel --
-----------------------------
procedure Watchdog_Enable_Channel
(This : in out Analog_To_Digital_Converter;
Mode : Single_Channel_Watchdog;
Channel : Analog_Input_Channel;
Low : Watchdog_Threshold;
High : Watchdog_Threshold)
is
begin
This.TR1.HT1 := High;
This.TR1.LT1 := Low;
-- Set then channel
This.CFGR.AWD1CH := Channel;
-- Enable single channel mode
This.CFGR.AWD1SGL := True;
case Mode is
when Watchdog_Single_Regular_Channel =>
This.CFGR.AWD1EN := True;
when Watchdog_Single_Injected_Channel =>
This.CFGR.JAWD1EN := True;
when Watchdog_Single_Both_Kinds =>
This.CFGR.AWD1EN := True;
This.CFGR.JAWD1EN := True;
end case;
end Watchdog_Enable_Channel;
----------------------
-- Watchdog_Disable --
----------------------
procedure Watchdog_Disable (This : in out Analog_To_Digital_Converter) is
begin
This.CFGR.AWD1EN := False;
This.CFGR.JAWD1EN := False;
-- clearing the single-channel bit (AWGSDL) is not required to disable,
-- per the RM table 66, section 13.3.7, pg 391, but seems cleanest
This.CFGR.AWD1SGL := False;
end Watchdog_Disable;
----------------------
-- Watchdog_Enabled --
----------------------
function Watchdog_Enabled (This : Analog_To_Digital_Converter)
return Boolean
is
(This.CFGR.AWD1EN or This.CFGR.JAWD1EN);
------------------------------
-- Watchdog_Enable_Channels --
------------------------------
procedure Watchdog_Enable_Channels
(This : in out Analog_To_Digital_Converter;
Watchdog : Analog_Window_Watchdog;
Channels : Analog_Input_Channels;
Low : Watchdog_Threshold;
High : Watchdog_Threshold)
is
begin
case Watchdog is
when Watchdog_2 =>
This.TR2.HT2 := UInt8 (High);
This.TR2.LT2 := UInt8 (Low);
for Channel of Channels loop
This.AWD2CR.AWD2CH := This.AWD2CR.AWD2CH or (2 ** Natural (Channel));
end loop;
when Watchdog_3 =>
This.TR3.HT3 := UInt8 (High);
This.TR3.LT3 := UInt8 (Low);
for Channel of Channels loop
This.AWD3CR.AWD3CH := This.AWD3CR.AWD3CH or (2 ** Natural (Channel));
end loop;
end case;
end Watchdog_Enable_Channels;
-------------------------------
-- Watchdog_Disable_Channels --
-------------------------------
procedure Watchdog_Disable_Channels
(This : in out Analog_To_Digital_Converter;
Watchdog : Analog_Window_Watchdog;
Channels : Analog_Input_Channels)
is
begin
case Watchdog is
when Watchdog_2 =>
for Channel of Channels loop
This.AWD2CR.AWD2CH := This.AWD2CR.AWD2CH and not (2 ** Natural (Channel));
end loop;
when Watchdog_3 =>
for Channel of Channels loop
This.AWD3CR.AWD3CH := This.AWD3CR.AWD3CH and not (2 ** Natural (Channel));
end loop;
end case;
end Watchdog_Disable_Channels;
----------------------
-- Watchdog_Disable --
----------------------
procedure Watchdog_Disable
(This : in out Analog_To_Digital_Converter;
Watchdog : Analog_Window_Watchdog)
is
begin
case Watchdog is
when Watchdog_2 =>
This.AWD2CR.AWD2CH := 16#000#;
when Watchdog_3 =>
This.AWD3CR.AWD3CH := 16#000#;
end case;
end Watchdog_Disable;
----------------------
-- Watchdog_Enabled --
----------------------
function Watchdog_Enabled
(This : Analog_To_Digital_Converter;
Watchdog : Analog_Window_Watchdog) return Boolean
is
begin
case Watchdog is
when Watchdog_2 =>
return This.AWD2CR.AWD2CH /= 16#000#;
when Watchdog_3 =>
return This.AWD3CR.AWD3CH /= 16#000#;
end case;
end Watchdog_Enabled;
------------
-- Status --
------------
function Status
(This : Analog_To_Digital_Converter;
Flag : ADC_Status_Flag)
return Boolean
is
begin
case Flag is
when ADC_Ready =>
return This.ISR.ADRDY;
when Regular_Channel_Conversion_Completed =>
return This.ISR.EOC;
when Regular_Sequence_Conversion_Completed =>
return This.ISR.EOS;
when Injected_Channel_Conversion_Completed =>
return This.ISR.JEOC;
when Injected_Sequence_Conversion_Completed =>
return This.ISR.JEOS;
when Analog_Watchdog_1_Event_Occurred =>
return This.ISR.AWD.Arr (1);
when Analog_Watchdog_2_Event_Occurred =>
return This.ISR.AWD.Arr (2);
when Analog_Watchdog_3_Event_Occurred =>
return This.ISR.AWD.Arr (3);
when Sampling_Completed =>
return This.ISR.EOSMP;
when Overrun =>
return This.ISR.OVR;
when Injected_Context_Queue_Overflow =>
return This.ISR.JQOVF;
end case;
end Status;
------------------
-- Clear_Status --
------------------
procedure Clear_Status
(This : in out Analog_To_Digital_Converter;
Flag : ADC_Status_Flag)
is
begin
case Flag is
when ADC_Ready =>
This.ISR.ADRDY := True;
when Regular_Channel_Conversion_Completed =>
This.ISR.EOC := True;
when Regular_Sequence_Conversion_Completed =>
This.ISR.EOS := True;
when Injected_Channel_Conversion_Completed =>
This.ISR.JEOC := True;
when Injected_Sequence_Conversion_Completed =>
This.ISR.JEOS := True;
when Analog_Watchdog_1_Event_Occurred =>
This.ISR.AWD.Arr (1) := True;
when Analog_Watchdog_2_Event_Occurred =>
This.ISR.AWD.Arr (2) := True;
when Analog_Watchdog_3_Event_Occurred =>
This.ISR.AWD.Arr (3) := True;
when Sampling_Completed =>
This.ISR.EOSMP := True;
when Overrun =>
This.ISR.OVR := True;
when Injected_Context_Queue_Overflow =>
This.ISR.JQOVF := True;
end case;
end Clear_Status;
---------------------
-- Poll_For_Status --
---------------------
procedure Poll_For_Status
(This : in out Analog_To_Digital_Converter;
Flag : ADC_Status_Flag;
Success : out Boolean;
Timeout : Time_Span := Time_Span_Last)
is
Deadline : constant Time := Clock + Timeout;
begin
Success := False;
while Clock < Deadline loop
if Status (This, Flag) then
Success := True;
exit;
end if;
end loop;
end Poll_For_Status;
-----------------------
-- Enable_Interrupts --
-----------------------
procedure Enable_Interrupts
(This : in out Analog_To_Digital_Converter;
Source : ADC_Interrupts)
is
begin
case Source is
when ADC_Ready =>
This.IER.ADRDYIE := True;
when Regular_Channel_Conversion_Complete =>
This.IER.EOCIE := True;
when Regular_Sequence_Conversion_Complete =>
This.IER.EOSIE := True;
when Injected_Channel_Conversion_Complete =>
This.IER.JEOCIE := True;
when Injected_Sequence_Conversion_Complete =>
This.IER.JEOSIE := True;
when Analog_Watchdog_1_Event_Occurr =>
This.IER.AWD1IE := True;
when Analog_Watchdog_2_Event_Occurr =>
This.IER.AWD2IE := True;
when Analog_Watchdog_3_Event_Occurr =>
This.IER.AWD3IE := True;
when Sampling_Complete =>
This.IER.EOSMPIE := True;
when Overrun =>
This.IER.OVRIE := True;
when Injected_Context_Queue_Overflow =>
This.IER.JQOVFIE := True;
end case;
end Enable_Interrupts;
-----------------------
-- Interrupt_Enabled --
-----------------------
function Interrupt_Enabled
(This : Analog_To_Digital_Converter;
Source : ADC_Interrupts)
return Boolean
is
begin
case Source is
when ADC_Ready =>
return This.IER.ADRDYIE;
when Regular_Channel_Conversion_Complete =>
return This.IER.EOCIE;
when Regular_Sequence_Conversion_Complete =>
return This.IER.EOSIE;
when Injected_Channel_Conversion_Complete =>
return This.IER.JEOCIE;
when Injected_Sequence_Conversion_Complete =>
return This.IER.JEOSIE;
when Analog_Watchdog_1_Event_Occurr =>
return This.IER.AWD1IE;
when Analog_Watchdog_2_Event_Occurr =>
return This.IER.AWD2IE;
when Analog_Watchdog_3_Event_Occurr =>
return This.IER.AWD3IE;
when Sampling_Complete =>
return This.IER.EOSMPIE;
when Overrun =>
return This.IER.OVRIE;
when Injected_Context_Queue_Overflow =>
return This.IER.JQOVFIE;
end case;
end Interrupt_Enabled;
------------------------
-- Disable_Interrupts --
------------------------
procedure Disable_Interrupts
(This : in out Analog_To_Digital_Converter;
Source : ADC_Interrupts)
is
begin
case Source is
when ADC_Ready =>
This.IER.ADRDYIE := False;
when Regular_Channel_Conversion_Complete =>
This.IER.EOCIE := False;
when Regular_Sequence_Conversion_Complete =>
This.IER.EOSIE := False;
when Injected_Channel_Conversion_Complete =>
This.IER.JEOCIE := False;
when Injected_Sequence_Conversion_Complete =>
This.IER.JEOSIE := False;
when Analog_Watchdog_1_Event_Occurr =>
This.IER.AWD1IE := False;
when Analog_Watchdog_2_Event_Occurr =>
This.IER.AWD2IE := False;
when Analog_Watchdog_3_Event_Occurr =>
This.IER.AWD3IE := False;
when Sampling_Complete =>
This.IER.EOSMPIE := False;
when Overrun =>
This.IER.OVRIE := False;
when Injected_Context_Queue_Overflow =>
This.IER.JQOVFIE := False;
end case;
end Disable_Interrupts;
-----------------------------
-- Clear_Interrupt_Pending --
-----------------------------
procedure Clear_Interrupt_Pending
(This : in out Analog_To_Digital_Converter;
Source : ADC_Interrupts)
is
begin
case Source is
when ADC_Ready =>
This.ISR.ADRDY := True;
when Regular_Channel_Conversion_Complete =>
This.ISR.EOC := True;
when Regular_Sequence_Conversion_Complete =>
This.ISR.EOS := True;
when Injected_Channel_Conversion_Complete =>
This.ISR.JEOC := True;
when Injected_Sequence_Conversion_Complete =>
This.ISR.JEOS := True;
when Analog_Watchdog_1_Event_Occurr =>
This.ISR.AWD.Arr (1) := True;
when Analog_Watchdog_2_Event_Occurr =>
This.ISR.AWD.Arr (2) := True;
when Analog_Watchdog_3_Event_Occurr =>
This.ISR.AWD.Arr (3) := True;
when Sampling_Complete =>
This.ISR.EOSMP := True;
when Overrun =>
This.ISR.OVR := True;
when Injected_Context_Queue_Overflow =>
This.ISR.JQOVF := True;
end case;
end Clear_Interrupt_Pending;
---------------------------
-- Set_Sequence_Position --
---------------------------
procedure Set_Sequence_Position
(This : in out Analog_To_Digital_Converter;
Channel : Analog_Input_Channel;
Rank : Regular_Channel_Rank)
is
begin
case Rank is
when 1 =>
This.SQR1.SQ1 := Channel;
when 2 =>
This.SQR1.SQ2 := Channel;
when 3 =>
This.SQR1.SQ3 := Channel;
when 4 =>
This.SQR1.SQ4 := Channel;
when 5 =>
This.SQR2.SQ5 := Channel;
when 6 =>
This.SQR2.SQ6 := Channel;
when 7 =>
This.SQR2.SQ7 := Channel;
when 8 =>
This.SQR2.SQ8 := Channel;
when 9 =>
This.SQR2.SQ9 := Channel;
when 10 =>
This.SQR3.SQ10 := Channel;
when 11 =>
This.SQR3.SQ11 := Channel;
when 12 =>
This.SQR3.SQ12 := Channel;
when 13 =>
This.SQR3.SQ13 := Channel;
when 14 =>
This.SQR3.SQ14 := Channel;
when 15 =>
This.SQR4.SQ15 := Channel;
when 16 =>
This.SQR4.SQ16 := Channel;
end case;
end Set_Sequence_Position;
--------------------------------------------
-- Set_Injected_Channel_Sequence_Position --
--------------------------------------------
procedure Set_Injected_Channel_Sequence_Position
(This : in out Analog_To_Digital_Converter;
Channel : Analog_Input_Channel;
Rank : Injected_Channel_Rank)
is
begin
case Rank is
when 1 =>
This.JSQR.JSQ1 := Channel;
when 2 =>
This.JSQR.JSQ2 := Channel;
when 3 =>
This.JSQR.JSQ3 := Channel;
when 4 =>
This.JSQR.JSQ4 := Channel;
end case;
end Set_Injected_Channel_Sequence_Position;
-----------------------
-- Set_Sampling_Time --
-----------------------
procedure Set_Sampling_Time
(This : in out Analog_To_Digital_Converter;
Channel : Analog_Input_Channel;
Sample_Time : Channel_Sampling_Times)
is
begin
case Channel is
when 0 .. 9 =>
This.SMPR1.SMP.Arr (Natural (Channel)) :=
Channel_Sampling_Times'Enum_Rep (Sample_Time);
when 10 .. 18 =>
This.SMPR2.SMP.Arr (Natural (Channel)) :=
Channel_Sampling_Times'Enum_Rep (Sample_Time);
end case;
end Set_Sampling_Time;
---------------------------------
-- Set_Injected_Channel_Offset --
---------------------------------
procedure Set_Injected_Channel_Offset
(This : in out Analog_To_Digital_Converter;
Channel : Analog_Input_Channel;
Rank : Injected_Channel_Rank;
Offset : Injected_Data_Offset)
is
begin
case Rank is
when 1 =>
This.OFR1.OFFSET1_CH := Channel;
This.OFR1.OFFSET1 := Offset;
This.OFR1.OFFSET1_EN := True;
when 2 =>
This.OFR2.OFFSET2_CH := Channel;
This.OFR2.OFFSET2 := Offset;
This.OFR2.OFFSET2_EN := True;
when 3 =>
This.OFR3.OFFSET3_CH := Channel;
This.OFR3.OFFSET3 := Offset;
This.OFR3.OFFSET3_EN := True;
when 4 =>
This.OFR4.OFFSET4_CH := Channel;
This.OFR4.OFFSET4 := Offset;
This.OFR4.OFFSET4_EN := True;
end case;
end Set_Injected_Channel_Offset;
end STM32.ADC;
|
agda/Data/Nat/Properties.agda | oisdk/combinatorics-paper | 0 | 425 | {-# OPTIONS --cubical --safe #-}
module Data.Nat.Properties where
open import Data.Nat.Base
open import Agda.Builtin.Nat using () renaming (_<_ to _<ᴮ_; _==_ to _≡ᴮ_) public
open import Prelude
open import Cubical.Data.Nat using (caseNat; znots; snotz; injSuc) public
pred : ℕ → ℕ
pred (suc n) = n
pred zero = zero
correct-== : ∀ n m → Reflects (n ≡ m) (n ≡ᴮ m)
correct-== zero zero = ofʸ refl
correct-== zero (suc m) = ofⁿ znots
correct-== (suc n) zero = ofⁿ snotz
correct-== (suc n) (suc m) =
map-reflects (cong suc) (λ contra prf → contra (cong pred prf)) (correct-== n m)
discreteℕ : Discrete ℕ
discreteℕ n m .does = n ≡ᴮ m
discreteℕ n m .why = correct-== n m
isSetℕ : isSet ℕ
isSetℕ = Discrete→isSet discreteℕ
+-suc : ∀ x y → x + suc y ≡ suc (x + y)
+-suc zero y = refl
+-suc (suc x) y = cong suc (+-suc x y)
+-idʳ : ∀ x → x + 0 ≡ x
+-idʳ zero = refl
+-idʳ (suc x) = cong suc (+-idʳ x)
+-comm : ∀ x y → x + y ≡ y + x
+-comm x zero = +-idʳ x
+-comm x (suc y) = +-suc x y ; cong suc (+-comm x y)
infix 4 _<_
_<_ : ℕ → ℕ → Type₀
n < m = T (n <ᴮ m)
_≤ᴮ_ : ℕ → ℕ → Bool
zero ≤ᴮ m = true
suc n ≤ᴮ m = n <ᴮ m
+-assoc : ∀ x y z → (x + y) + z ≡ x + (y + z)
+-assoc zero y z = refl
+-assoc (suc x) y z = cong suc (+-assoc x y z)
|
data/sprites/player_sprites.asm | Dev727/ancientplatinum | 28 | 176164 | ChrisStateSprites:
db PLAYER_NORMAL, SPRITE_CHRIS
db PLAYER_BIKE, SPRITE_CHRIS_BIKE
db PLAYER_SURF, SPRITE_SURF
db PLAYER_SURF_PIKA, SPRITE_SURFING_PIKACHU
db -1 ; end
KrisStateSprites:
db PLAYER_NORMAL, SPRITE_KRIS
db PLAYER_BIKE, SPRITE_KRIS_BIKE
db PLAYER_SURF, SPRITE_SURF
db PLAYER_SURF_PIKA, SPRITE_SURFING_PIKACHU
db -1 ; end
|
v2.1/prototype/v2.1.1- Role Binding Policies extended with Agreement Policies/caterpillar-core/src/models/dynamic_process_agreement/antlr/agreement_grammar.g4 | sambacha/Caterpillar | 101 | 4806 | grammar binding_grammar;
/*
* Parser Rules
*/
agreement_policy
: LBRACES agreement_statement (SEMICOLON agreement_statement)* RBRACES
;
agreement_statement
: (scope_restriction)? role PROPOSES ACTION ON cflow_element (endorsement_constr)?
;
endorsement_constr
: ENDORSED_BY set_expresion
| WITH voting_ratio VOTES (BY (role_list | ALL))?
;
role_list
: role (COMMA role_list)*
;
set_expresion
: LPAREN set_expresion RPAREN
| role OR set_expresion
| role AND set_expresion
| role
;
voting_ratio
: ZERO DOT DIGITS
| ONE DOT ZERO
;
scope_restriction
: UNDER subprocess_id COMMA;
cflow_element
: (element_id | element_path_expression)
;
element_path_expression
: (subprocess_id DOT)+ element_id
;
role
: (role_id | role_path_expresion)
;
role_path_expresion
: (subprocess_id DOT)+ role_id
;
subprocess_id
: IDENTIFIER
;
element_id
: IDENTIFIER
;
role_id
: IDENTIFIER
;
/*
* Lexer Rules
*/
PROPOSES : 'proposes' ;
ACTION : ('link-process' | 'link-role' | 'choose-path') ;
ENDORSED_BY : ( 'endorsed-by' | 'endorsers' ) ;
WITH : 'with' ;
VOTES : 'votes' ;
BY : 'by' ;
AND : 'and';
OR : 'or' ;
ON : 'on' ;
UNDER : 'Under';
COMMA : ',' ;
DOT : '.' ;
SEMICOLON : ';';
ALL : '*' ;
LPAREN : '(' ;
RPAREN : ')' ;
LBRACES : '{' ;
RBRACES : '}' ;
IDENTIFIER : [a-zA-Z_0-9]+ ;
ZERO : '0' ;
ONE : '1' ;
DIGITS: [0-9]+ ;
WS : [ \r\t\u000C\n]+ -> skip ;
|
src/lang/stemmer-danish.adb | stcarrez/ada-stemmer | 3 | 11032 | -- Generated by Snowball 2.2.0 - https://snowballstem.org/
package body Stemmer.Danish is
pragma Style_Checks ("-mr");
pragma Warnings (Off, "*variable*is never read and never assigned*");
pragma Warnings (Off, "*mode could be*instead of*");
pragma Warnings (Off, "*formal parameter.*is not modified*");
pragma Warnings (Off, "*this line is too long*");
pragma Warnings (Off, "*is not referenced*");
procedure R_Undouble (Z : in out Context_Type; Result : out Boolean);
procedure R_Other_suffix (Z : in out Context_Type; Result : out Boolean);
procedure R_Consonant_pair (Z : in out Context_Type; Result : out Boolean);
procedure R_Main_suffix (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_regions (Z : in out Context_Type; Result : out Boolean);
G_C : constant Grouping_Array (0 .. 31) := (
True, True, True, False, True, True, True, False,
True, True, True, True, True, False, True, True,
True, True, True, False, True, True, True, False,
True, False, False, False, False, False, False, False
);
G_V : constant Grouping_Array (0 .. 151) := (
True, False, False, False, True, False, False, False,
True, False, False, False, False, False, True, False,
False, False, False, False, True, False, False, False,
True, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, True, True, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, True
);
G_S_ending : constant Grouping_Array (0 .. 135) := (
True, True, True, True, False, True, True, True,
False, True, True, True, True, True, True, True,
False, True, False, True, False, True, False, False,
True, True, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, True, False, False, False
);
Among_String : constant String := "hed" & "ethed" & "ered" & "e" & "erede"
& "ende" & "erende" & "ene" & "erne" & "ere" & "en" & "heden" & "eren" & "er"
& "heder" & "erer" & "s" & "heds" & "es" & "endes" & "erendes" & "enes" & "ernes"
& "eres" & "ens" & "hedens" & "erens" & "ers" & "ets" & "erets" & "et" & "eret"
& "gd" & "dt" & "gt" & "kt" & "ig" & "lig" & "elig" & "els" & "løst";
A_0 : constant Among_Array_Type (0 .. 31) := (
(1, 3, -1, 1, 0),
(4, 8, 0, 1, 0),
(9, 12, -1, 1, 0),
(13, 13, -1, 1, 0),
(14, 18, 3, 1, 0),
(19, 22, 3, 1, 0),
(23, 28, 5, 1, 0),
(29, 31, 3, 1, 0),
(32, 35, 3, 1, 0),
(36, 38, 3, 1, 0),
(39, 40, -1, 1, 0),
(41, 45, 10, 1, 0),
(46, 49, 10, 1, 0),
(50, 51, -1, 1, 0),
(52, 56, 13, 1, 0),
(57, 60, 13, 1, 0),
(61, 61, -1, 2, 0),
(62, 65, 16, 1, 0),
(66, 67, 16, 1, 0),
(68, 72, 18, 1, 0),
(73, 79, 19, 1, 0),
(80, 83, 18, 1, 0),
(84, 88, 18, 1, 0),
(89, 92, 18, 1, 0),
(93, 95, 16, 1, 0),
(96, 101, 24, 1, 0),
(102, 106, 24, 1, 0),
(107, 109, 16, 1, 0),
(110, 112, 16, 1, 0),
(113, 117, 28, 1, 0),
(118, 119, -1, 1, 0),
(120, 123, 30, 1, 0));
A_1 : constant Among_Array_Type (0 .. 3) := (
(124, 125, -1, -1, 0),
(126, 127, -1, -1, 0),
(128, 129, -1, -1, 0),
(130, 131, -1, -1, 0));
A_2 : constant Among_Array_Type (0 .. 4) := (
(132, 133, -1, 1, 0),
(134, 136, 0, 1, 0),
(137, 140, 1, 1, 0),
(141, 143, -1, 1, 0),
(144, 148, -1, 2, 0));
procedure R_Mark_regions (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
begin
-- (, line 31
Z.I_P1 := Z.L;
-- test, line 35
v_1 := Z.C;
-- (, line 35
C := Skip_Utf8 (Z, 3); -- hop, line 35
if C < 0 then
Result := False;
return;
end if;
Z.C := C;
-- setmark x, line 35
Z.I_X := Z.C;
Z.C := v_1;
-- goto, line 36
Out_Grouping (Z, G_V, 97, 248, True, C); if C < 0 then
Result := False;
return;
end if;
-- gopast, line 36
-- non v, line 36
In_Grouping (Z, G_V, 97, 248, True, C);
if C < 0 then
Result := False;
return;
end if;
Z.C := Z.C + C;
-- setmark p1, line 36
Z.I_P1 := Z.C;
-- try, line 37
-- (, line 37
if not (Z.I_P1 < Z.I_X) then
goto lab2;
end if;
Z.I_P1 := Z.I_X;
<<lab2>>
Result := True;
end R_Mark_regions;
procedure R_Main_suffix (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_2 : Integer;
begin
-- (, line 42
if Z.C < Z.I_P1 then
Result := False;
return;
end if;
v_2 := Z.Lb; Z.Lb := Z.I_P1;
-- (, line 43
Z.Ket := Z.C; -- [, line 43
-- substring, line 43
if Z.C <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#1c4030#) then
Z.Lb := v_2;
Result := False;
return;
-- substring, line 43
end if;
Find_Among_Backward (Z, A_0, Among_String, null, A);
if A = 0 then
Z.Lb := v_2;
Result := False;
return;
end if;
Z.Bra := Z.C; -- ], line 43
Z.Lb := v_2;
-- among, line 44
case A is
when 1 =>
-- (, line 50
-- delete, line 50
Slice_Del (Z);
when 2 =>
-- (, line 52
In_Grouping_Backward (Z, G_S_ending, 97, 229, False, C);
if C /= 0 then
Result := False;
return;
end if;
-- delete, line 52
Slice_Del (Z);
when others =>
null;
end case;
Result := True;
end R_Main_suffix;
procedure R_Consonant_pair (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_3 : Integer;
begin
-- (, line 56
-- test, line 57
v_1 := Z.L - Z.C;
-- (, line 57
if Z.C < Z.I_P1 then
Result := False;
return;
end if;
v_3 := Z.Lb; Z.Lb := Z.I_P1;
-- (, line 58
Z.Ket := Z.C; -- [, line 58
-- substring, line 58
if Z.C - 1 <= Z.Lb or else (Character'Pos (Z.P (Z.C)) /= 100 and then Character'Pos (Z.P (Z.C)) /= 116) then
Z.Lb := v_3;
Result := False;
return;
-- substring, line 58
end if;
Find_Among_Backward (Z, A_1, Among_String, null, A);
if A = 0 then
Z.Lb := v_3;
Result := False;
return;
end if;
Z.Bra := Z.C; -- ], line 58
Z.Lb := v_3;
Z.C := Z.L - v_1;
-- next, line 64
C := Skip_Utf8_Backward (Z);
if C < 0 then
Result := False;
return;
end if;
Z.C := C;
Z.Bra := Z.C; -- ], line 64
-- delete, line 64
Slice_Del (Z);
Result := True;
end R_Consonant_pair;
procedure R_Other_suffix (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_3 : Integer;
v_4 : Char_Index;
begin
-- (, line 67
-- do, line 68
v_1 := Z.L - Z.C;
-- (, line 68
Z.Ket := Z.C; -- [, line 68
-- literal, line 68
C := Eq_S_Backward (Z, "st");
if C = 0 then
goto lab0;
end if;
Z.C := Z.C - C;
Z.Bra := Z.C; -- ], line 68
-- literal, line 68
C := Eq_S_Backward (Z, "ig");
if C = 0 then
goto lab0;
end if;
Z.C := Z.C - C;
-- delete, line 68
Slice_Del (Z);
<<lab0>>
Z.C := Z.L - v_1;
if Z.C < Z.I_P1 then
Result := False;
return;
end if;
v_3 := Z.Lb; Z.Lb := Z.I_P1;
-- (, line 69
Z.Ket := Z.C; -- [, line 69
-- substring, line 69
if Z.C - 1 <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#180080#) then
Z.Lb := v_3;
Result := False;
return;
-- substring, line 69
end if;
Find_Among_Backward (Z, A_2, Among_String, null, A);
if A = 0 then
Z.Lb := v_3;
Result := False;
return;
end if;
Z.Bra := Z.C; -- ], line 69
Z.Lb := v_3;
-- among, line 70
case A is
when 1 =>
-- (, line 72
-- delete, line 72
Slice_Del (Z);
-- do, line 72
v_4 := Z.L - Z.C;
-- call consonant_pair, line 72
R_Consonant_pair (Z, Result);
Z.C := Z.L - v_4;
when 2 =>
-- (, line 74
-- <-, line 74
Slice_From (Z, "løs");
when others =>
null;
end case;
Result := True;
end R_Other_suffix;
procedure R_Undouble (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_2 : Integer;
begin
-- (, line 77
if Z.C < Z.I_P1 then
Result := False;
return;
end if;
v_2 := Z.Lb; Z.Lb := Z.I_P1;
-- (, line 78
Z.Ket := Z.C; -- [, line 78
In_Grouping_Backward (Z, G_C, 98, 122, False, C);
if C /= 0 then
Z.Lb := v_2;
Result := False;
return;
end if;
Z.Bra := Z.C; -- ], line 78
-- -> ch, line 78
Z.S_Ch := Ada.Strings.Unbounded.To_Unbounded_String (Slice_To (Z));
Z.Lb := v_2;
-- name ch, line 79
C := Eq_S_Backward (Z, Ada.Strings.Unbounded.To_String (Z.S_Ch)); if C = 0 then
Result := False;
return;
end if;
-- delete, line 80
Slice_Del (Z);
Result := True;
end R_Undouble;
procedure Stem (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
v_5 : Char_Index;
begin
-- (, line 84
-- do, line 86
v_1 := Z.C;
-- call mark_regions, line 86
R_Mark_regions (Z, Result);
Z.C := v_1;
Z.Lb := Z.C; Z.C := Z.L; -- backwards, line 87
-- (, line 87
-- do, line 88
v_2 := Z.L - Z.C;
-- call main_suffix, line 88
R_Main_suffix (Z, Result);
Z.C := Z.L - v_2;
-- do, line 89
v_3 := Z.L - Z.C;
-- call consonant_pair, line 89
R_Consonant_pair (Z, Result);
Z.C := Z.L - v_3;
-- do, line 90
v_4 := Z.L - Z.C;
-- call other_suffix, line 90
R_Other_suffix (Z, Result);
Z.C := Z.L - v_4;
-- do, line 91
v_5 := Z.L - Z.C;
-- call undouble, line 91
R_Undouble (Z, Result);
Z.C := Z.L - v_5;
Z.C := Z.Lb;
Result := True;
end Stem;
end Stemmer.Danish;
|
combinations-of-lift-and-list.agda | Saizan/Agda-proofs | 0 | 8910 | {-# OPTIONS --cubical --guarded -W ignore #-}
module combinations-of-lift-and-list where
open import Clocked.Primitives
open import Cubical.Foundations.Prelude
open import Cubical.Data.List as List
open import Cubical.Data.List.Properties
open import Cubical.Data.Sum using (_⊎_; inl; inr)
--**********************************************************************--
--**********************************************************************--
-- Combining the monads Lift and List freely and via a distributive law --
--**********************************************************************--
--**********************************************************************--
-- In this document I want to define a monad, called ListLift, that is the free combination of the Lift monad and the List monad.
-- In order to do so, I will first define the Lift monad and the List monad, and check that they are indeed monads (Step 1 and 2).
-- Then I define the LiftList monad, check that it is a monad (Step 3), and finally check that it is the free monad on the algebra
-- structures of a delay algebra and a monoid (Step 4).
-- In addition to the free combination of the List and the Lift monads, I also compose the two monads to form the monad
-- LcL : A → Lift(List A). This composition uses a distributive law, which I prove does indeed satisfy all the axioms for a
-- distributive law.
--************************--
-- Step 1: The Lift monad --
--************************--
-- Defining the monad myLift.
--(note that the return/unit is just x → nowL x)
data myLift (A : Set) (κ : Cl) : Set where
nowL : A → (myLift A κ)
stepL : ▹ κ (myLift A κ) → (myLift A κ)
bindL : {A B : Set} (κ : Cl) → (A → (myLift B κ)) → myLift A κ → myLift B κ
bindL κ f (nowL a) = f a
bindL κ f (stepL x) = stepL \(α) → bindL κ f (x α)
identity : {A : Set} → A → A
identity x = x
MultL : {A : Set} (κ : Cl) → (myLift (myLift A κ) κ) → (myLift A κ)
MultL κ = bindL κ identity
mapL : {A B : Set} (κ : Cl) → (A → B) → (myLift A κ) → (myLift B κ)
mapL κ f (nowL x) = nowL (f x)
mapL κ f (stepL x) = stepL (\ α → mapL κ f (x α))
--checking that it is indeed a monad
-- needs to satisfy three monad laws:
-- unit is a left-identity for bind: bind (f, return) = f
-- unit is a right-identity for bind: bind (return, x) = x
-- bind is associative: bind (\x > bind (g, f(x)), x) = bind(g,bind(f, x))
-- The first of these is satisfied by definition
-- The other two laws we check here below
-- unit law, two versions to learn and remember to ways of doing guarded recursion in agda:
unitlawL : {A : Set}(κ : Cl) → ∀(x : (myLift A κ)) → (bindL {A} κ nowL x) ≡ x
unitlawL κ (nowL x) = refl
unitlawL κ (stepL x) = cong stepL (later-ext (\ α → unitlawL κ (x α)))
unitlawL' : {A : Set}(κ : Cl) → ∀(x : (myLift A κ)) → (bindL {A} κ nowL x) ≡ x
unitlawL' κ (nowL x) = refl
unitlawL' κ (stepL x) = \ i → stepL (\ α → unitlawL' κ (x α) i )
-- associative law:
associativelawL : {A B C : Set}(κ : Cl) → ∀(f : A → (myLift B κ)) → ∀ (g : B → (myLift C κ)) →
∀ (y : (myLift A κ)) → (bindL κ (\ x → (bindL κ g (f x))) y) ≡ (bindL κ g (bindL κ f y))
associativelawL κ f g (nowL x) = refl
associativelawL κ f g (stepL x) = cong stepL (((later-ext (\ α → associativelawL κ f g (x α)))))
-- Some properties that will be useful later:
-- interaction of mapL and MultL:
MultMap : {A B : Set} (κ : Cl) → ∀(x : myLift (myLift A κ) κ) → ∀(f : A → B) → mapL κ f (MultL κ x) ≡ MultL κ (mapL κ (mapL κ f) x)
MultMap κ (nowL x) f = refl
MultMap κ (stepL x) f = \ i → stepL (\ α → MultMap κ (x α) f i)
-- mapmap for mapL
mapmapL : {A B C : Set} (κ : Cl) → ∀(f : A → B) → ∀(g : B → C) → ∀(x : myLift A κ) → mapL κ g (mapL κ f x) ≡ mapL κ (\ y → g(f y)) x
mapmapL κ f g (nowL x) = refl
mapmapL κ f g (stepL x) = (\ i → stepL (\ α → mapmapL κ f g (x α) i ))
--************************--
-- Step 2: The List monad --
--************************--
-- Defining the monad List
--List is already defined, but we define a unit and multiplication for it, so it becomes a monad
List-unit : {A : Set} → A → List A
List-unit x = [ x ]
List-mult : {A : Set} → List (List A) → List A
List-mult {A} = foldr _++_ []
List-bind : {A B : Set} → (A → List B) → List A → List B
List-bind f [] = []
List-bind f (x ∷ xs) = (f x) ++ (List-bind f xs)
-- and some other useful functions for later
safe-head : {A : Set} → A → List A → A
safe-head x [] = x
safe-head _ (x ∷ _) = x
tail : {A : Set} → List A → List A
tail [] = []
tail (x ∷ xs) = xs
-- Proving that this forms a monad
-- satisfying the laws:
-- List-mult (List-unit L) = L
-- List-mult (map List-unit L) = L
-- List-mult (List-Mult L) = List-mult (map List-mult L)
-- and both the unit and the multiplication are natural transformations
-- List-mult (List-unit L) = L
List-unitlaw1 : {A : Set} → ∀(L : List A) → List-mult (List-unit L) ≡ L
List-unitlaw1 [] = refl
List-unitlaw1 (x ∷ L) = cong (_++_ [ x ]) (List-unitlaw1 L)
-- List-mult (map List-unit L) = L
List-unitlaw2 : {A : Set} → ∀(L : List A) → List-mult (map List-unit L) ≡ L
List-unitlaw2 [] = refl
List-unitlaw2 (x ∷ L) = cong (_++_ [ x ]) (List-unitlaw2 L )
-- List-mult (List-Mult L) = List-mult (map List-mult L)
lemma : {A : Set} → ∀(L₁ L₂ : List (List A)) -> List-mult (L₁ ++ L₂) ≡ (List-mult L₁) ++ (List-mult L₂)
lemma [] L₂ = refl
lemma (L₁ ∷ L₃) L₂ = L₁ ++ List-mult (L₃ ++ L₂)
≡⟨ cong (L₁ ++_) (lemma L₃ L₂) ⟩
L₁ ++ ((List-mult L₃) ++ (List-mult L₂))
≡⟨ sym (++-assoc L₁ (List-mult L₃) (List-mult L₂)) ⟩
(L₁ ++ List-mult L₃) ++ List-mult L₂
≡⟨ refl ⟩
(List-mult (L₁ ∷ L₃)) ++ (List-mult L₂) ∎
List-multlaw : {A : Set} -> ∀(L : List (List (List A))) -> List-mult (List-mult L) ≡ List-mult (map List-mult L)
List-multlaw [] = refl
List-multlaw (L ∷ L₁) = List-mult (L ++ List-mult L₁)
≡⟨ lemma L (List-mult L₁) ⟩
(List-mult L ++ List-mult (List-mult L₁))
≡⟨ cong (List-mult L ++_) (List-multlaw L₁) ⟩
List-mult L ++ List-mult (map List-mult L₁) ∎
-- the unit is a natural transformation:
nattrans-Listunit : {A B : Set} → ∀(f : A → B) → ∀(x : A) → map f (List-unit x) ≡ List-unit (f x)
nattrans-Listunit f x = refl
-- the multiplication is a natural transformation:
lemma-map++ : {A B : Set} → ∀(f : A → B) → ∀(xs ys : List A) → map f (xs ++ ys) ≡ (map f xs) ++ (map f ys)
lemma-map++ f [] ys = refl
lemma-map++ f (x ∷ xs) ys = cong ((f x) ∷_) (lemma-map++ f xs ys)
nattrans-Listmult : {A B : Set} → ∀(f : A → B) → ∀(xss : List (List A)) → map f (List-mult xss) ≡ List-mult (map (map f) xss)
nattrans-Listmult f [] = refl
nattrans-Listmult f (xs ∷ xss) = map f (xs ++ List-mult xss)
≡⟨ lemma-map++ f xs (List-mult xss) ⟩
map f xs ++ map f (List-mult xss)
≡⟨ cong (map f xs ++_) (nattrans-Listmult f xss) ⟩
map f xs ++ List-mult (map (map f) xss) ∎
--****************************--
-- Step 3: The ListLift monad --
--****************************--
--Now that we have a list monad and a lift monad, I want to show that the following combination of the two is again a monad:
--ListLift : (A : Set) → (κ : Cl) → Set
--ListLift A κ = List (A ⊎ (▹ κ (ListLift A κ)))
data ListLift (A : Set) (κ : Cl) : Set where
conLL : List (A ⊎ (▹ κ (ListLift A κ))) -> ListLift A κ
--***algebraic structure for ListLift***--
--nowLL and stepLL turn ListLift into a delay algebra structure:
nowLL : {A : Set} (κ : Cl) → A → (ListLift A κ)
nowLL κ a = conLL [ (inl a) ]
stepLL : {A : Set} (κ : Cl) → ▹ κ (ListLift A κ) → (ListLift A κ)
stepLL κ a = conLL [ (inr a) ]
--union, derived from list concatenation, turns ListLift into a monoid:
_∪_ : {A : Set} {κ : Cl} → (ListLift A κ) → (ListLift A κ) → (ListLift A κ)
_∪_ {A} {κ} (conLL x) (conLL y) = conLL (x ++ y)
--proof that this union does indeed provide a monoid structure:
conLLempty-rightunit : {A : Set} (κ : Cl) → ∀ (xs : (ListLift A κ)) → xs ∪ conLL [] ≡ xs
conLLempty-rightunit κ (conLL x) = conLL (x ++ []) ≡⟨ cong conLL (++-unit-r x) ⟩ conLL x ∎
conLLempty-leftunit : {A : Set} (κ : Cl) → ∀ (xs : (ListLift A κ)) → conLL [] ∪ xs ≡ xs
conLLempty-leftunit κ (conLL x) = refl
assoc∪ : {A : Set} {κ : Cl} → ∀(xs ys zs : (ListLift A κ)) → (xs ∪ ys) ∪ zs ≡ xs ∪ (ys ∪ zs)
assoc∪ {A} {κ} (conLL x) (conLL x₁) (conLL x₂) = cong conLL (++-assoc x x₁ x₂)
--a bind operator to make ListLift into a monad
bindLL : {A B : Set} (κ : Cl) → (A → (ListLift B κ)) → ListLift A κ → ListLift B κ
bindLL κ f (conLL []) = conLL []
bindLL κ f (conLL (inl x ∷ x₁)) = (f x) ∪ bindLL κ f (conLL x₁)
bindLL κ f (conLL (inr x ∷ x₁)) = (stepLL κ (\ α → bindLL κ f (x α))) ∪ bindLL κ f (conLL x₁)
--bind commutes with ∪
bindLL∪ : {A B : Set} (κ : Cl) → ∀(f : A → (ListLift B κ)) → ∀(xs ys : (ListLift A κ)) → bindLL κ f (xs ∪ ys) ≡ (bindLL κ f xs) ∪ (bindLL κ f ys)
bindLL∪ κ f xs (conLL []) = bindLL κ f (xs ∪ conLL []) ≡⟨ cong (bindLL κ f) (conLLempty-rightunit κ xs) ⟩
bindLL κ f xs ≡⟨ sym (conLLempty-rightunit κ (bindLL κ f xs)) ⟩
(bindLL κ f xs ∪ conLL [])∎
bindLL∪ κ f (conLL []) (conLL (x ∷ x₁)) = bindLL κ f (conLL (x ∷ x₁))
≡⟨ sym (conLLempty-leftunit κ (bindLL κ f (conLL (x ∷ x₁)))) ⟩
(conLL [] ∪ bindLL κ f (conLL (x ∷ x₁))) ∎
bindLL∪ κ f (conLL (inl x₂ ∷ x₃)) (conLL (x ∷ x₁)) = (f x₂ ∪ bindLL κ f ((conLL x₃) ∪ (conLL (x ∷ x₁)))) ≡⟨ cong (f x₂ ∪_) (bindLL∪ κ f (conLL x₃) (conLL (x ∷ x₁))) ⟩
(f x₂ ∪ (bindLL κ f (conLL x₃) ∪ bindLL κ f (conLL (x ∷ x₁))))
≡⟨ sym (assoc∪ (f x₂) (bindLL κ f (conLL x₃)) (bindLL κ f (conLL (x ∷ x₁)))) ⟩
((f x₂ ∪ bindLL κ f (conLL x₃)) ∪ bindLL κ f (conLL (x ∷ x₁))) ∎
bindLL∪ κ f (conLL (inr x₂ ∷ x₃)) (conLL (x ∷ x₁)) = (conLL (inr (λ α → bindLL κ f (x₂ α)) ∷ []) ∪ bindLL κ f ((conLL x₃) ∪ (conLL (x ∷ x₁))))
≡⟨ cong (conLL (inr (λ α → bindLL κ f (x₂ α)) ∷ []) ∪_) (bindLL∪ κ f (conLL x₃) (conLL (x ∷ x₁))) ⟩
(conLL (inr (λ α → bindLL κ f (x₂ α)) ∷ []) ∪ ((bindLL κ f (conLL x₃) ∪ bindLL κ f (conLL (x ∷ x₁)))))
≡⟨ sym (assoc∪ (conLL (inr (λ α → bindLL κ f (x₂ α)) ∷ [])) (bindLL κ f (conLL x₃)) (bindLL κ f (conLL (x ∷ x₁)))) ⟩
((conLL (inr (λ α → bindLL κ f (x₂ α)) ∷ []) ∪ bindLL κ f (conLL x₃)) ∪ bindLL κ f (conLL (x ∷ x₁))) ∎
--and a map function to prove naturality of bind and now
mapLL : {A B : Set} (κ : Cl) → (f : A → B) → (ListLift A κ) → (ListLift B κ)
mapLL κ f (conLL []) = conLL []
mapLL κ f (conLL (inl x ∷ x₁)) = conLL ([ inl (f x) ]) ∪ mapLL κ f (conLL x₁)
mapLL κ f (conLL (inr x ∷ x₁)) = (stepLL κ (\ α → mapLL κ f (x α))) ∪ mapLL κ f (conLL x₁)
--***proving that ListLift is a monad***--
--bindLL and nowLL need to be natural transformations
nattrans-nowLL : {A B : Set} (κ : Cl) → ∀(f : A → B) → ∀(x : A) → mapLL κ f (nowLL κ x) ≡ nowLL κ (f x)
nattrans-nowLL {A}{B} κ f x = refl
--TODO: bind is a natural transformation
-- bindLL and nowLL also need to satisfy three monad laws:
-- unit is a left-identity for bind: bind (f, nowLL) = f
-- unit is a right-identity for bind: bind (nowLL, x) = x
-- bind is associative: bind (\x > bind (g, f(x)), x) = bind(g,bind(f, x))
-- unit is a left-identity for bind
unitlawLL1 : {A B : Set} (κ : Cl) → ∀ (f : A → (ListLift B κ)) → ∀ (x : A) → (bindLL {A} κ f (nowLL κ x)) ≡ f x
unitlawLL1 κ f x = (f x ∪ conLL []) ≡⟨ conLLempty-rightunit κ (f x) ⟩ f x ∎
-- unit is a right-identity for bind
unitlawLL2 : {A : Set}(κ : Cl) → ∀(x : (ListLift A κ)) → (bindLL κ (nowLL κ) x) ≡ x
unitlawLL2 κ (conLL []) = refl
unitlawLL2 κ (conLL (inl x ∷ x₁)) = (conLL ([ inl x ]) ∪ bindLL κ (nowLL κ) (conLL x₁)) ≡⟨ cong (conLL ([ inl x ]) ∪_ ) (unitlawLL2 κ (conLL x₁)) ⟩
(conLL ([ inl x ]) ∪ conLL x₁) ≡⟨ refl ⟩
conLL (inl x ∷ x₁) ∎
unitlawLL2 κ (conLL (inr x ∷ x₁)) = (stepLL κ (\ α → bindLL κ (nowLL κ) (x α))) ∪ bindLL κ (nowLL κ) (conLL x₁)
≡⟨ cong ((stepLL κ (\ α → bindLL κ (nowLL κ) (x α))) ∪_) (unitlawLL2 κ (conLL x₁)) ⟩
(stepLL κ (\ α → bindLL κ (nowLL κ) (x α))) ∪ conLL x₁
≡⟨ cong (_∪ conLL x₁) (\ i → stepLL κ (\ α → unitlawLL2 κ (x α) i ) ) ⟩
conLL ([ inr x ]) ∪ conLL x₁
≡⟨ refl ⟩
conLL (inr x ∷ x₁) ∎
-- bind is associative
assoclawLL : {A B C : Set}(κ : Cl) → ∀(f : A → (ListLift B κ)) → ∀ (g : B → (ListLift C κ)) → ∀ (x : (ListLift A κ))
→ (bindLL κ (\ y → (bindLL κ g (f y))) x) ≡ (bindLL κ g (bindLL κ f x))
assoclawLL {A} {B} {C} κ f g (conLL []) = refl
assoclawLL {A} {B} {C} κ f g (conLL (inl x ∷ x₁)) = (bindLL κ g (f x) ∪ bindLL κ (λ y → bindLL κ g (f y)) (conLL x₁))
≡⟨ cong (bindLL κ g (f x) ∪_) (assoclawLL κ f g (conLL x₁)) ⟩
(bindLL κ g (f x) ∪ bindLL κ g (bindLL κ f (conLL x₁)))
≡⟨ sym (bindLL∪ κ g (f x) (bindLL κ f (conLL x₁))) ⟩
bindLL κ g (f x ∪ bindLL κ f (conLL x₁)) ∎
assoclawLL {A} {B} {C} κ f g (conLL (inr x ∷ x₁)) = (conLL (inr (λ α → bindLL κ (λ y → bindLL κ g (f y)) (x α)) ∷ []) ∪ bindLL κ (λ y → bindLL κ g (f y)) (conLL x₁))
≡⟨ cong (conLL (inr (λ α → bindLL κ (λ y → bindLL κ g (f y)) (x α)) ∷ []) ∪_) (assoclawLL κ f g (conLL x₁)) ⟩
(conLL (inr (λ α → bindLL κ (λ y → bindLL κ g (f y)) (x α)) ∷ []) ∪ (bindLL κ g (bindLL κ f (conLL x₁))))
≡⟨ cong (_∪ (bindLL κ g (bindLL κ f (conLL x₁)))) (\ i → stepLL κ (\ α → assoclawLL κ f g (x α) i ) ) ⟩
((bindLL κ g (conLL (inr (λ α → bindLL κ f (x α)) ∷ []))) ∪ (bindLL κ g (bindLL κ f (conLL x₁))) )
≡⟨ sym (bindLL∪ κ g (conLL (inr (λ α → bindLL κ f (x α)) ∷ [])) (bindLL κ f (conLL x₁))) ⟩
bindLL κ g (conLL (inr (λ α → bindLL κ f (x α)) ∷ []) ∪ bindLL κ f (conLL x₁)) ∎
-- If I want to do it via fixpoints instead:
module WithFix where
LiftList : (A : Set) → (κ : Cl) → Set
LiftList A κ = fix (\ (X : ▹ κ Set) → List(A ⊎ (▸ κ \ α → (X α))))
nowLLfix : {A : Set} (κ : Cl) → A → (LiftList A κ)
nowLLfix κ a = [ (inl a) ]
stepLLfix : {A : Set} (κ : Cl) → ▹ κ (LiftList A κ) → (LiftList A κ)
stepLLfix {A} κ a = transport
(λ i →
fix-eq (λ (X : ▹ κ Type) → List (A ⊎ (▸ κ (λ α → X α)))) (~ i))
[ (inr a) ]
--***********************************************************************--
-- Step 4: The ListLift monad as the free delay-algebra and monoid monad --
--***********************************************************************--
-- We already know that (ListLift, stepLL) forms a delay algebra structure
-- and (Listlift, conLL [], _∪_) forms a monoid.
-- What we need to show is that ListLift is the free monad with these properties.
-- That is, for a set A, and any other structure (B, δ, ε, _·_) where (B, δ) is a delay algebra and (B, ε, _·_) a monoid
-- given a function f : A → B, there is a unique function ListLift A → B extending f that preserves the algebra structures.
record IsDelayalg {A : Set}(κ : Cl)(nextA : ▹ κ A → A) : Set where
constructor isdelayalg
record IsMonoid {A : Set} (ε : A) (_·_ : A → A → A) : Set where
constructor ismonoid
field
assoc : (x y z : A) → (x · y) · z ≡ x · (y · z)
leftid : (x : A) → ε · x ≡ x
rightid : (x : A) → x · ε ≡ x
record DelayMonoidData (A : Set) (κ : Cl) : Set where
constructor dmdata
field
nextA : ▹ κ A → A
ε : A
_·_ : A → A → A
record IsDelayMonoid {A : Set}(κ : Cl) (dm : DelayMonoidData A κ) : Set where
constructor isdelaymonoid
open DelayMonoidData dm
field
isMonoid : IsMonoid (ε) (_·_)
isDelayalg : IsDelayalg κ (nextA)
open IsMonoid isMonoid public
open IsDelayalg isDelayalg public
record IsPreservingDM {A B : Set}(κ : Cl) dmA dmB (g : A → B) : Set where
constructor ispreservingDM
open DelayMonoidData dmA renaming (ε to εA)
open DelayMonoidData dmB renaming (ε to εB; nextA to nextB; _·_ to _*_)
field
unit-preserve : g (εA) ≡ εB
next-preserve : (x : ▹ κ A) → g (nextA x) ≡ nextB (\ α → g (x α))
union-preserve : (x y : A) → g (x · y) ≡ (g x) * (g y)
record IsExtending {A B : Set}{κ : Cl} (f : A → B) (h : (ListLift A κ) → B) : Set where
constructor isextending
field
extends : (x : A) → h (nowLL κ x) ≡ (f x)
--fold defines the function we are after
fold : {A B : Set}{κ : Cl} → isSet A → isSet B → ∀ dm → IsDelayMonoid {B} κ dm → (A → B) → (ListLift A κ) → B
fold setA setB (dmdata nextB ε _·_) isDMB f (conLL []) = ε
fold setA setB dm@(dmdata nextB ε _·_) isDMB f (conLL (inl x ∷ x₁)) = (f x) · fold setA setB dm isDMB f (conLL x₁)
fold setA setB dm@(dmdata nextB ε _·_) isDMB f (conLL (inr x ∷ x₁)) = (nextB (\ α → fold setA setB dm isDMB f (x α))) · fold setA setB dm isDMB f (conLL x₁)
--fold extends the function f : A → B
-- direct proof:
fold-extends-f : {A B : Set}{κ : Cl} → ∀(setA : isSet A) → ∀(setB : isSet B) → ∀ dm → ∀(isDMB : IsDelayMonoid {B} κ dm) →
∀ (f : A → B) → ∀ (x : A) → fold setA setB dm isDMB f (nowLL κ x) ≡ f x
fold-extends-f setA setB dm isDMB f x = IsDelayMonoid.rightid isDMB (f x)
-- or via the record "IsExtending":
fold-extends : {A B : Set}{κ : Cl} → ∀(setA : isSet A) → ∀(setB : isSet B) → ∀ dm → ∀(isDMB : IsDelayMonoid {B} κ dm) →
∀ (f : A → B) → IsExtending f (fold setA setB dm isDMB f)
IsExtending.extends (fold-extends setA setB dm isDMB f) x = IsDelayMonoid.rightid isDMB (f x)
module _ {A B : Set}{κ : Cl} (setA : isSet A) (setB : isSet B) (dm : _) (isDMB : IsDelayMonoid {B} κ dm)
(f : A → B)
where
open IsPreservingDM
open DelayMonoidData dm renaming (nextA to nextB)
--fold preseves the DelayMonoid structure
fold-preserves : IsPreservingDM {ListLift A κ}{B} κ (dmdata (stepLL κ) (conLL []) _∪_) dm (fold setA setB dm isDMB f)
unit-preserve fold-preserves = refl
next-preserve fold-preserves x = IsDelayMonoid.rightid isDMB (nextB (λ α → fold setA setB dm isDMB f (x α)))
union-preserve fold-preserves (conLL xs) (conLL ys) = lemma-union xs ys
where
lemma-union : ∀ xs ys → fold setA setB dm isDMB f (conLL xs ∪ conLL ys) ≡
(fold setA setB dm isDMB f (conLL xs) ·
fold setA setB dm isDMB f (conLL ys))
lemma-union [] y = sym (IsDelayMonoid.leftid isDMB
(fold setA setB dm isDMB f (conLL y)))
lemma-union (inl x ∷ x₁) y = (f x · fold setA setB dm isDMB f (conLL (x₁ ++ y)))
≡⟨ cong (f x ·_) (lemma-union x₁ y) ⟩
((f x · (fold setA setB dm isDMB f (conLL x₁) ·
fold setA setB dm isDMB f (conLL y))))
≡⟨ sym (IsDelayMonoid.assoc isDMB (f x)
(fold setA setB dm isDMB f (conLL x₁))
(fold setA setB dm isDMB f (conLL y))) ⟩
((f x · fold setA setB dm isDMB f (conLL x₁)) ·
fold setA setB dm isDMB f (conLL y)) ∎
lemma-union (inr x ∷ x₁) y =
(nextB (λ α → fold setA setB dm isDMB f (x α)) ·
fold setA setB dm isDMB f (conLL (x₁ ++ y)))
≡⟨ cong (nextB (λ α → fold setA setB dm isDMB f (x α)) ·_)
(lemma-union
x₁ y) ⟩
( (nextB (λ α → fold setA setB dm isDMB f (x α)) ·
(fold setA setB dm isDMB f (conLL x₁) ·
fold setA setB dm isDMB f (conLL y))))
≡⟨ sym (IsDelayMonoid.assoc isDMB
(nextB (λ α → fold setA setB dm isDMB f (x α)))
(fold setA setB dm isDMB f (conLL x₁))
(fold setA setB dm isDMB f (conLL y))) ⟩
((nextB (λ α → fold setA setB dm isDMB f (x α)) ·
fold setA setB dm isDMB f (conLL x₁)) ·
fold setA setB dm isDMB f (conLL y)) ∎
--and fold is unique in doing so. That is, for any function h that both preserves the algebra structure and extends the function f : A → B,
-- h is equivalent to fold.
module _ {A B : Set} {κ : Cl} (h : ListLift A κ → B)
(setA : isSet A) (setB : isSet B) (dm : _) (isDMB : IsDelayMonoid {B} κ dm)
(f : A → B) (isPDM : IsPreservingDM {ListLift A κ}{B} κ (dmdata (stepLL κ) (conLL []) _∪_ ) dm h)
(isExt : IsExtending f h) where
open DelayMonoidData dm renaming (nextA to nextB)
fold-uniquenessLL : (x : (ListLift A κ)) → h x ≡ (fold setA setB dm isDMB f x)
fold-uniquenessLL (conLL []) = h (conLL [])
≡⟨ IsPreservingDM.unit-preserve isPDM ⟩
ε
≡⟨ refl ⟩
fold setA setB dm isDMB f (conLL []) ∎
fold-uniquenessLL (conLL (inl x ∷ x₁)) = h (conLL (inl x ∷ x₁))
≡⟨ refl ⟩
h ((conLL [ inl x ]) ∪ (conLL x₁))
≡⟨ IsPreservingDM.union-preserve isPDM (conLL [ inl x ]) (conLL x₁) ⟩
((h (conLL [ inl x ])) ·
(h (conLL x₁)) )
≡⟨ cong (_· (h (conLL x₁)) ) (IsExtending.extends isExt x) ⟩
(f x · (h (conLL x₁)))
≡⟨ cong (f x ·_)(fold-uniquenessLL (conLL x₁)) ⟩
(f x · fold setA setB dm isDMB f (conLL x₁)) ∎
fold-uniquenessLL (conLL (inr x ∷ x₁)) = h (conLL (inr x ∷ x₁))
≡⟨ cong (h ) refl ⟩
h ((conLL [ inr x ]) ∪ (conLL x₁))
≡⟨ IsPreservingDM.union-preserve isPDM (conLL [ inr x ]) (conLL x₁) ⟩
(h (conLL [ inr x ])) ·
(h (conLL x₁))
≡⟨ cong (_· h (conLL x₁)) refl ⟩
((h (stepLL κ x)) ·
(h (conLL x₁)) )
≡⟨ cong (_· h (conLL x₁)) (IsPreservingDM.next-preserve isPDM x) ⟩
(((nextB (λ α → h (x α))) · (h (conLL x₁))))
≡⟨ cong (_· h (conLL x₁)) (cong (nextB)
(later-ext (\ α → fold-uniquenessLL (x α)))) ⟩
((nextB (λ α → fold setA setB dm isDMB f (x α))) · (h (conLL x₁)))
≡⟨ cong (nextB (λ α → fold setA setB dm isDMB f (x α)) ·_)
(fold-uniquenessLL (conLL x₁)) ⟩
(nextB (λ α → fold setA setB dm isDMB f (x α)) ·
fold setA setB dm isDMB f (conLL x₁)) ∎
--************************************************--
-- Composing Lift and List via a distributive law --
--************************************************--
--We now define a composite monad of the List and Lift monads, formed via a distributive law.
LcL : (A : Set) → (κ : Cl) → Set
LcL A κ = myLift (List A) κ
-- the unit of this monad is simply the composit of the units for Lift (nowL x) and List ([x])
nowLcL : {A : Set} {κ : Cl} → A → (LcL A κ)
nowLcL x = nowL [ x ]
-- LcL is a monad via a distributive law, distributing List over Lift.
-- Here is the distributive law:
distlawLcL : {A : Set} (κ : Cl) → List (myLift A κ) → (LcL A κ)
distlawLcL κ [] = nowL []
distlawLcL κ (nowL x ∷ xs) = MultL κ (nowL (mapL κ (([ x ]) ++_) (distlawLcL κ xs)))
distlawLcL κ (stepL x ∷ xs) = stepL (\ α → distlawLcL κ ((x α) ∷ xs))
--proof that distlawLcL is indeed a distributive law:
--unit laws:
unitlawLcL1 : {A : Set} (κ : Cl) → ∀(x : myLift A κ) → (distlawLcL κ (List-unit x )) ≡ mapL κ List-unit x
unitlawLcL1 κ (nowL x) = refl
unitlawLcL1 κ (stepL x) = (\ i → stepL (\ α → unitlawLcL1 κ (x α) i ))
unitlawLcL2 : {A : Set} (κ : Cl) → ∀(xs : List A) → (distlawLcL κ (map nowL xs)) ≡ nowL xs
unitlawLcL2 κ [] = refl
unitlawLcL2 κ (x ∷ xs) = mapL κ (λ ys → x ∷ ys) (distlawLcL κ (map nowL xs))
≡⟨ cong (mapL κ (λ ys → x ∷ ys)) (unitlawLcL2 κ xs) ⟩
mapL κ (λ ys → x ∷ ys) (nowL xs)
≡⟨ refl ⟩
nowL (x ∷ xs) ∎
--multiplication laws:
-- In the proof of the first multiplication law, I need a lemma about list concatenation,
-- namely that putting a singleton list in front of a list of lists, and concatening the result
-- yields the same list as putting the element of the signleton in front of the first list in the list of lists,
-- and then concatenating the result.
-- The lemma is split into two parts, first the general result as described in words here,
-- followed by the specific situation in which I need it in the proofs below.
lemma7a : {A : Set} → ∀(x : A) → ∀(xss : (List (List A))) → List-mult ((x ∷ safe-head [] xss) ∷ tail xss ) ≡ List-mult (([ x ]) ∷ xss)
lemma7a x [] = refl
lemma7a x (xs ∷ xss) = refl
lemma7b : {A : Set} (κ : Cl) → ∀(y : myLift (List (List A)) κ) → ∀(x : A) →
mapL κ (λ xss → List-mult ((x ∷ safe-head [] xss) ∷ tail xss)) y ≡ mapL κ (λ xss → List-mult (([ x ]) ∷ xss)) y
lemma7b κ (nowL xss) x = cong nowL (lemma7a x xss)
lemma7b κ (stepL xss) x = (\ i → stepL (\ α → lemma7b κ (xss α) x i ))
-- in addition, I need this rather technical lemma that allows me to pull a mapL through the distributive law.
-- without it, I could not finish the proof.
lemma8 : {A : Set} (κ : Cl) → ∀(x : A) → ∀(xs : myLift (List A) κ) → ∀(xss : List (myLift (List A) κ)) →
mapL κ (λ yss → ((x ∷ safe-head [] yss) ∷ tail yss)) (distlawLcL κ (xs ∷ xss)) ≡ distlawLcL κ (mapL κ (λ ys → x ∷ ys) xs ∷ xss)
lemma8 κ x (nowL ys) [] = refl
lemma8 κ x (stepL ys) [] = (\ i → stepL (λ α → lemma8 κ x (ys α) [] i ))
lemma8 κ x (nowL []) (zs ∷ xss) = mapL κ (λ yss → (x ∷ safe-head [] yss) ∷ tail yss) (mapL κ (λ zss → [] ∷ zss) (distlawLcL κ (zs ∷ xss)))
≡⟨ mapmapL κ ((λ zss → [] ∷ zss)) ((λ yss → (x ∷ safe-head [] yss) ∷ tail yss)) (distlawLcL κ (zs ∷ xss)) ⟩
mapL κ (λ yss → (x ∷ safe-head [] ([] ∷ yss)) ∷ tail ([] ∷ yss)) (distlawLcL κ (zs ∷ xss))
≡⟨ refl ⟩
mapL κ (λ yss → (x ∷ []) ∷ yss) (distlawLcL κ (zs ∷ xss)) ∎
lemma8 κ x (nowL (y ∷ ys)) (zs ∷ xss) = mapL κ (λ yss → (x ∷ safe-head [] yss) ∷ tail yss) (mapL κ (λ zss → (y ∷ ys) ∷ zss) (distlawLcL κ (zs ∷ xss)))
≡⟨ mapmapL κ ((λ zss → (y ∷ ys) ∷ zss)) ((λ yss → (x ∷ safe-head [] yss) ∷ tail yss)) (distlawLcL κ (zs ∷ xss)) ⟩
mapL κ (λ yss → (x ∷ safe-head []((y ∷ ys) ∷ yss)) ∷ tail((y ∷ ys) ∷ yss)) (distlawLcL κ (zs ∷ xss))
≡⟨ refl ⟩
mapL κ (λ yss → (x ∷ y ∷ ys) ∷ yss) (distlawLcL κ (zs ∷ xss)) ∎
lemma8 κ x (stepL ys) (zs ∷ xss) = (\ i → stepL (λ α → lemma8 κ x (ys α) (zs ∷ xss) i ))
--now we are ready to prove the multiplication laws:
multlawLcL1 : {A : Set} (κ : Cl) → ∀(xss : List (List (myLift A κ))) → distlawLcL κ (List-mult xss) ≡
mapL κ List-mult (distlawLcL κ (map (distlawLcL κ) xss))
multlawLcL1 κ [] = refl
multlawLcL1 κ ([] ∷ xss) = distlawLcL κ (List-mult xss)
≡⟨ multlawLcL1 κ xss ⟩
mapL κ List-mult (distlawLcL κ (map (distlawLcL κ) xss))
≡⟨ refl ⟩
mapL κ (λ ys → List-mult ([] ∷ ys)) (distlawLcL κ (map (distlawLcL κ) xss))
≡⟨ sym (mapmapL κ (\ ys → [] ∷ ys) List-mult ((distlawLcL κ (map (distlawLcL κ) xss)))) ⟩
mapL κ List-mult (mapL κ (λ ys → [] ∷ ys) (distlawLcL κ (map (distlawLcL κ) xss))) ∎
multlawLcL1 κ ((nowL x ∷ []) ∷ xss) = mapL κ (λ ys → x ∷ ys) (distlawLcL κ (List-mult xss))
≡⟨ cong (mapL κ (λ ys → x ∷ ys)) (multlawLcL1 κ xss) ⟩
mapL κ (λ ys → x ∷ ys) (mapL κ List-mult (distlawLcL κ (map (distlawLcL κ) xss)))
≡⟨ mapmapL κ List-mult (λ ys → x ∷ ys) (distlawLcL κ (map (distlawLcL κ) xss)) ⟩
mapL κ (λ ys → x ∷ List-mult ys) (distlawLcL κ (map (distlawLcL κ) xss))
≡⟨ refl ⟩
mapL κ (λ ys → List-mult (([ x ]) ∷ ys)) (distlawLcL κ (map (distlawLcL κ) xss))
≡⟨ sym( mapmapL κ (λ ys → ([ x ]) ∷ ys) List-mult (distlawLcL κ (map (distlawLcL κ) xss))) ⟩
mapL κ List-mult (mapL κ (λ ys → ([ x ]) ∷ ys) (distlawLcL κ (map (distlawLcL κ) xss))) ∎
multlawLcL1 κ ((nowL x ∷ y ∷ xs) ∷ xss) = mapL κ (λ ys → x ∷ ys) (distlawLcL κ (List-mult ((y ∷ xs) ∷ xss)))
≡⟨ cong (mapL κ (λ ys → x ∷ ys)) (multlawLcL1 κ ((y ∷ xs) ∷ xss)) ⟩
mapL κ (λ ys → x ∷ ys) (mapL κ List-mult (distlawLcL κ (map (distlawLcL κ) ((y ∷ xs) ∷ xss))))
≡⟨ mapmapL κ List-mult (λ ys → x ∷ ys) (distlawLcL κ (map (distlawLcL κ) ((y ∷ xs) ∷ xss))) ⟩
mapL κ (λ yss → x ∷ (List-mult yss)) (distlawLcL κ (map (distlawLcL κ) ((y ∷ xs) ∷ xss)))
≡⟨ refl ⟩
mapL κ (λ yss → x ∷ List-mult yss) (distlawLcL κ (distlawLcL κ (y ∷ xs) ∷ map (distlawLcL κ) xss))
≡⟨ refl ⟩
mapL κ (λ yss → List-mult (([ x ]) ∷ yss)) (distlawLcL κ (distlawLcL κ (y ∷ xs) ∷ map (distlawLcL κ) xss))
≡⟨ sym (lemma7b κ ((distlawLcL κ (distlawLcL κ (y ∷ xs) ∷ map (distlawLcL κ) xss))) x) ⟩
mapL κ (λ yss → List-mult ((x ∷ safe-head [] yss) ∷ tail yss)) (distlawLcL κ (distlawLcL κ (y ∷ xs) ∷ map (distlawLcL κ) xss))
≡⟨ sym (mapmapL κ ((λ yss → ((x ∷ safe-head [] yss) ∷ tail yss))) List-mult
((distlawLcL κ (distlawLcL κ (y ∷ xs) ∷ map (distlawLcL κ) xss)))) ⟩
mapL κ List-mult (mapL κ (λ yss → ((x ∷ safe-head [] yss) ∷ tail yss)) (distlawLcL κ (distlawLcL κ (y ∷ xs) ∷ map (distlawLcL κ) xss)))
≡⟨ cong (mapL κ List-mult) (lemma8 κ x ((distlawLcL κ (y ∷ xs))) ((map (distlawLcL κ) xss))) ⟩
mapL κ List-mult (distlawLcL κ (mapL κ (λ ys → x ∷ ys) (distlawLcL κ (y ∷ xs)) ∷ (map (distlawLcL κ) xss))) ∎
multlawLcL1 κ ((stepL x ∷ xs) ∷ xss) = (\ i → stepL (\ α → multlawLcL1 κ ((x α ∷ xs) ∷ xss) i ))
lemma9a : {A : Set} (κ : Cl) → ∀(x : ▹ κ (myLift A κ)) → ∀(y : ▹ κ (myLift (List (myLift A κ)) κ)) →
MultL κ (stepL (λ α → stepL (λ β → mapL κ (λ ys → distlawLcL κ (x α ∷ ys)) (y β)))) ≡
MultL κ (stepL (λ β → stepL (λ α → mapL κ (λ ys → distlawLcL κ (x α ∷ ys)) (y β))))
lemma9a κ x y = cong (MultL κ) (cong stepL (later-ext λ α → cong stepL (later-ext λ β →
cong₂ (mapL κ) (funExt (λ ys → cong (distlawLcL _) (cong₂ _∷_ (tick-irr x α β) refl)))
(sym (tick-irr y α β)))))
lemma9 : {A : Set} (κ : Cl) → ∀(x : ▹ κ (myLift A κ)) → ∀(y : myLift (List (myLift A κ)) κ) →
MultL κ (stepL (λ α → (mapL κ (λ ys → distlawLcL κ (x α ∷ ys)) y))) ≡ MultL κ (mapL κ (λ ys → stepL (λ α → distlawLcL κ (x α ∷ ys))) y)
lemma9 κ x (nowL y) = refl
lemma9 κ x (stepL y) = stepL (λ α → stepL (λ β → MultL κ (mapL κ (λ ys → distlawLcL κ (x α ∷ ys)) (y β))))
≡⟨ lemma9a κ x y ⟩
stepL (λ β → stepL (λ α → MultL κ (mapL κ (λ ys → distlawLcL κ (x α ∷ ys)) (y β))))
≡⟨ ( (\ i → stepL (\ β → lemma9 κ x (y β) i ))) ⟩
stepL (λ β → MultL κ (mapL κ (λ ys → stepL (λ α → distlawLcL κ (x α ∷ ys))) (y β))) ∎
multlawLcL2 : {A : Set} (κ : Cl) → ∀(xs : List (myLift (myLift A κ) κ)) → distlawLcL κ (map (MultL κ) xs) ≡
MultL κ (mapL κ (distlawLcL κ) (distlawLcL κ xs))
multlawLcL2 κ [] = refl
multlawLcL2 κ (nowL (nowL x) ∷ xs) = distlawLcL κ ((nowL x) ∷ map (MultL κ) xs)
≡⟨ refl ⟩
mapL κ (λ ys → x ∷ ys) (distlawLcL κ (map (MultL κ) xs))
≡⟨ cong (mapL κ (λ ys → x ∷ ys)) (multlawLcL2 κ xs) ⟩
mapL κ (λ ys → x ∷ ys) (MultL κ (mapL κ (distlawLcL κ) (distlawLcL κ xs)))
≡⟨ MultMap κ (mapL κ (distlawLcL κ) (distlawLcL κ xs)) (λ ys → x ∷ ys) ⟩
MultL κ (mapL κ (mapL κ (λ ys → x ∷ ys)) (mapL κ (distlawLcL κ) (distlawLcL κ xs)) )
≡⟨ cong (MultL κ) (mapmapL κ ((distlawLcL κ)) (mapL κ (λ ys → x ∷ ys)) ((distlawLcL κ xs))) ⟩
MultL κ (mapL κ (λ ys → mapL κ (λ zs → x ∷ zs) (distlawLcL κ ys)) (distlawLcL κ xs))
≡⟨ refl ⟩
MultL κ (mapL κ (λ ys → (distlawLcL κ) ((nowL x) ∷ ys)) (distlawLcL κ xs))
≡⟨ cong (MultL κ) (sym (mapmapL κ ((λ ys → (nowL x) ∷ ys)) ((distlawLcL κ)) ((distlawLcL κ xs)))) ⟩
MultL κ (mapL κ (distlawLcL κ) (mapL κ (λ ys → (nowL x) ∷ ys) (distlawLcL κ xs))) ∎
multlawLcL2 κ (nowL (stepL x) ∷ xs) = distlawLcL κ ((stepL x) ∷ map (MultL κ) xs)
≡⟨ refl ⟩
stepL (λ α → distlawLcL κ (x α ∷ map (MultL κ) xs))
≡⟨ refl ⟩
stepL (λ α → distlawLcL κ (map (MultL κ) ((nowL (x α)) ∷ xs)))
≡⟨ (\ i → stepL (\ α → multlawLcL2 κ (((nowL (x α)) ∷ xs)) i )) ⟩
stepL (λ α → MultL κ (mapL κ (distlawLcL κ) (distlawLcL κ ((nowL (x α) ∷ xs)))) )
≡⟨ refl ⟩
MultL κ (stepL (λ α → (mapL κ (distlawLcL κ) (distlawLcL κ ((nowL (x α) ∷ xs))))))
≡⟨ refl ⟩
MultL κ (stepL (λ α → (mapL κ (distlawLcL κ) (mapL κ (λ ys → x α ∷ ys) (distlawLcL κ xs)))))
≡⟨ cong (MultL κ) ((λ i → stepL (\ α → (mapmapL κ ((λ ys → x α ∷ ys)) ((distlawLcL κ)) ((distlawLcL κ xs))) i ))) ⟩
MultL κ (stepL (λ α → (mapL κ (λ ys → distlawLcL κ (x α ∷ ys)) (distlawLcL κ xs))))
≡⟨ lemma9 κ x (distlawLcL κ xs) ⟩
MultL κ (mapL κ (λ ys → stepL (λ α → distlawLcL κ (x α ∷ ys))) (distlawLcL κ xs))
≡⟨ refl ⟩
MultL κ (mapL κ (λ ys → (distlawLcL κ) ((stepL x) ∷ ys)) (distlawLcL κ xs))
≡⟨ cong (MultL κ) (sym (mapmapL κ ((λ ys → (stepL x) ∷ ys)) ((distlawLcL κ)) ((distlawLcL κ xs)))) ⟩
MultL κ (mapL κ (distlawLcL κ) (mapL κ (λ ys → (stepL x) ∷ ys) (distlawLcL κ xs))) ∎
multlawLcL2 κ (stepL x ∷ xs) = (\ i → stepL (\ α → multlawLcL2 κ ((x α ∷ xs)) i ))
-- Bonusmaterial:
-- we define a union on LcL.
_l∪l_ : {A : Set} {κ : Cl} → (LcL A κ) → (LcL A κ) → (LcL A κ)
nowL x l∪l nowL y = nowL (x ++ y)
nowL x l∪l stepL y = stepL (\ α → (nowL x l∪l (y α)))
stepL x l∪l y = stepL (\ α → ((x α) l∪l y))
--nowL [] is a unit for l∪l
left-unitl∪l : {A : Set} {κ : Cl} → ∀(x : LcL A κ) → (nowL []) l∪l x ≡ x
left-unitl∪l (nowL x) = refl
left-unitl∪l (stepL x) = stepL (λ α → nowL [] l∪l x α)
≡⟨ ((\ i → stepL (\ α → left-unitl∪l (x α) i ))) ⟩
stepL (λ α → x α)
≡⟨ refl ⟩
stepL x ∎
right-unitl∪l : {A : Set} {κ : Cl} → ∀(x : LcL A κ) → x l∪l (nowL []) ≡ x
right-unitl∪l (nowL x) = cong nowL (++-unit-r x)
right-unitl∪l (stepL x) = stepL (λ α → x α l∪l nowL [])
≡⟨ ((\ i → stepL (\ α → right-unitl∪l (x α) i ))) ⟩
stepL (λ α → x α)
≡⟨ refl ⟩
stepL x ∎
--mapL κ f distributes over l∪l if f distributes over ++
dist-mapL-l∪l : {A B : Set} (κ : Cl) → ∀(f : (List A) → (List B)) → ∀(fcom : ∀(xs : List A) → ∀(ys : List A) → f (xs ++ ys) ≡ f xs ++ f ys) →
∀(x : (LcL A κ)) → ∀(y : LcL A κ) → mapL κ f (x l∪l y) ≡ (mapL κ f x) l∪l (mapL κ f y)
dist-mapL-l∪l κ f fcom (nowL x) (nowL y) = cong nowL (fcom x y)
dist-mapL-l∪l κ f fcom (nowL x) (stepL y) = (\ i → stepL (\ α → dist-mapL-l∪l κ f fcom (nowL x) (y α) i ))
dist-mapL-l∪l κ f fcom (stepL x) y = \ i → stepL (\ α → dist-mapL-l∪l κ f fcom (x α) y i )
|
Cdiff.asm | ItaiCuker/Assembly8086CrossyRoad | 0 | 7940 | ;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
proc difficulty
;כניסה: כאשר הניקוד עולה.
;יציאה: משנה את המשתנים של רמת הקושי אם הם הגיעו למס' הרצוי. בעזרת הפעולות speedDif וcardif
;calling the difficulty procedures.
call speedDif
call carDif
;adding to line counters.
inc [dif_carN]
inc [dif_speed]
ret
endp difficulty
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
proc speedDif
;כניסה: אין
;משנה את minspeed אם dif_speed הגיע למס, הרצוי.
cmp [dif_speed], 50 ; < this number decides how many new lines does it take to make the speed higher.
jne contDif1
mov [dif_speed], 0 ; zeroing line count variable.
cmp [minSpeed], 1 ;checking if alredy max speed
jz contDif1
dec [minSpeed] ;מגדיל את המהירות.
contDif1:
ret
endp speedDif
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
proc carDif
;כניסה: אין
;משנה את minCars אם dif_carN הגיע למס, הרצוי.
cmp [dif_carN], 50 ;; < this number decides how many new lines does it take to make the car number higher.
jne contDif2
mov [dif_carN], 0 ; zeroing line count variable.
cmp [minCars], 4 ;checking if alredy max cars
jz contDif2
inc [minCars] ;מגדיל את מס' המכוניות.
contDif2:
ret
endp carDif
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
oeis/079/A079962.asm | neoneye/loda-programs | 11 | 165525 | ; A079962: Number of permutations satisfying -k <= p(i) - i <= r and p(i) - i not in I, i=1..n, with k=1, r=5, I={1,3}.
; Submitted by <NAME>
; 1,1,1,2,3,5,9,14,22,36,58,94,153,247,399,646,1045,1691,2737,4428,7164,11592,18756,30348,49105,79453,128557,208010,336567,544577,881145,1425722,2306866,3732588,6039454,9772042,15811497,25583539,41395035
seq $0,18910 ; Pisot sequence L(4,5).
div $0,4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.