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
source/coroutines.adb
reznikmm/coroutines
3
10012
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with System.Address_To_Access_Conversions; with Interfaces.C; with Coroutines.Polling; package body Coroutines is -- void * create_stack (int size) function create_context (size : Interfaces.C.int) return Context with Import, Convention => C, External_Name => "create_context"; -- Allocate new stack with a header over it and guard page under it. -- Return pointer to the header -- init_context(context, code, arg1, arg2, cont) procedure init_context (Self : Context; Wrapper : System.Address; Code : System.Address; Argument : System.Address; Cleanup : Context) with Import, Convention => C, External_Name => "init_context"; -- Initalize a context created by create_context function. -- When this context gets execution control first time it calls -- Wrapper (Code, Argument). When Wrapper returns it switches to -- Cleanup context. The last switch doesn't modify Current variable. procedure free_context (Object : Context) with Import, Convention => C, External_Name => "free_context"; -- Destroy context created by create_context function -- switch_context(context *from, context *to) procedure swapcontext (prev, next : Context) with Import => True, Convention => C, External_Name => "switch_context"; -- Suspend prev context execution and start executing next context procedure Destroyer (Unused : System.Address) with Convention => C; -- This procedure deallocates a finished coroutine. It takes context of -- the finished coroutine from Current variable. function Next_Context return Context; -- Find next coroutine to execute. procedure Run (Code, Unused : System.Address) with Convention => C; -- A low level wrapper to launch parameterless coroutine. type Destroy_Stack_Type is record Stack : Wide_Wide_String (1 .. 256); Stack_Pointer : System.Address; end record with Convention => C; Destroy_Stack : Destroy_Stack_Type; -- A stack for Destroy coroutine Main_SP : aliased System.Address; -- A stack pointer for Main coro Main : Context := Context (Main_SP'Address); -- Main coroutine Current : Context; -- Current coroutine Destroy : Context := Context (Destroy_Stack.Stack_Pointer'Address); -- Cleanup coroutine Total : Natural := 0; -- Number of coroutines (excluding Main and Destroy) ------------------- -- Generic_Start -- ------------------- procedure Generic_Start (Runable : not null access procedure (Argument : Argument_Type); Stack_Size : System.Storage_Elements.Storage_Count; Argument : Argument_Type) is package Convert is new System.Address_To_Access_Conversions (Object => Argument_Type); procedure Run (Code, Argument : System.Address) with Convention => C; -- A low level wrapper to launch a coroutine. --------- -- Run -- --------- procedure Run (Code, Argument : System.Address) is procedure Proc (Argument : Argument_Type) with Import, Address => Code; -- Copy Argument to new stack Copy : constant Argument_Type := Convert.To_Pointer (Argument).all; begin Proc (Copy); -- return to Destroyer exception when others => null; end Run; Prev : constant Context := Current; Copy : aliased Argument_Type := Argument; Next : constant Context := create_context (Interfaces.C.int (Stack_Size)); begin init_context (Self => Next, Wrapper => Run'Address, Code => Runable.all'Address, Argument => Copy'Address, Cleanup => Destroy); Total := Total + 1; if Prev = Main then -- Dont activate main context after Start Current := Next; swapcontext (Prev, Current); else declare Ready : Event_Id; begin Manager.Get_Always_Ready_Event (Ready); Ready.Activate; Current := Next; swapcontext (Prev, Current); Ready.Deactivate; end; end if; end Generic_Start; --------------- -- Destroyer -- --------------- procedure Destroyer (Unused : System.Address) is begin loop free_context (Current); Current := Destroy; Total := Total - 1; exit when Total = 0; Yield (Wait => (1 .. 0 => <>)); end loop; -- Return to main context end Destroyer; --------------------- -- Current_Context -- --------------------- function Current_Context return Context is begin return Current; end Current_Context; ---------- -- Hash -- ---------- function Hash (Self : Context) return Ada.Containers.Hash_Type is begin return Ada.Containers.Hash_Type'Mod (System.Storage_Elements.To_Integer (System.Address (Self))); end Hash; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Main := Context (Main_SP'Address); Destroy := Context (Destroy_Stack.Stack_Pointer'Address); Current := Main; init_context (Self => Destroy, Wrapper => Destroyer'Address, Code => System.Null_Address, Argument => System.Null_Address, Cleanup => Main); Coroutines.Polling.Initialize; end Initialize; Queue : Context_Vectors.Vector; ------------------ -- Next_Context -- ------------------ function Next_Context return Context is Result : Context; begin while Queue.Is_Empty loop Manager.New_Round (Queue, Timeout => 300.0); end loop; Result := Queue.Last_Element; Queue.Delete_Last; return Result; end Next_Context; --------- -- Run -- --------- procedure Run (Code, Unused : System.Address) is procedure Proc with Import, Address => Code; begin Proc; -- return to Destroyer exception when others => null; end Run; ----------- -- Start -- ----------- procedure Start (Runable : Runable_Code; Stack_Size : System.Storage_Elements.Storage_Count) is Prev : constant Context := Current; Next : constant Context := create_context (Interfaces.C.int (Stack_Size)); begin init_context (Self => Next, Wrapper => Run'Address, Code => Runable.all'Address, Argument => System.Null_Address, Cleanup => Destroy); Total := Total + 1; if Prev = Main then -- Dont activate main context after Start Current := Next; swapcontext (Prev, Current); else declare Ready : Event_Id; begin Manager.Get_Always_Ready_Event (Ready); Ready.Activate; Current := Next; swapcontext (Prev, Current); Ready.Deactivate; end; end if; end Start; ----------- -- Yield -- ----------- procedure Yield is Ready : Event_Id; begin Manager.Get_Always_Ready_Event (Ready); Yield ((1 => Ready)); end Yield; ----------- -- Yield -- ----------- procedure Yield (Wait : Event_Id) is begin Yield ((1 => Wait)); end Yield; ----------- -- Yield -- ----------- procedure Yield (Wait : Event_Id_Array := (1 .. 0 => <>); Result : access Natural := null) is Prev : constant Context := Current; begin for J of Wait loop J.Activate; end loop; Current := Next_Context; if Prev /= Current then swapcontext (Prev, Current); end if; if Result /= null then Result.all := 0; for J in Wait'Range loop if Wait (J).Ready then Result.all := J; exit; end if; end loop; end if; for J of Wait loop J.Deactivate; end loop; end Yield; end Coroutines;
libsrc/target/zx-common/graphics/pointxy_MODE6.asm
Frodevan/z88dk
640
92442
<filename>libsrc/target/zx-common/graphics/pointxy_MODE6.asm ; ; Plotting in Timex Hires mode ; SECTION code_graphics PUBLIC pointxy_MODE6 pointxy_MODE6: defc NEEDpoint = 1 INCLUDE "pixel_MODE6.inc"
programs/oeis/095/A095819.asm
karttu/loda
1
89850
; A095819: Tenth column (m=9) of (1,4)-Pascal triangle A095666. ; 4,37,190,715,2200,5863,14014,30745,62920,121550,223652,394706,671840,1107890,1776500,2778446,4249388,6369275,9373650,13567125,19339320,27183585,37718850,51714975,70122000,94103724,125076072,164750740 mov $1,$0 add $1,36 mov $2,4 add $2,$0 add $2,4 bin $2,8 mul $1,$2 sub $1,36 div $1,9 add $1,4
src/i-saxonsoc.ads
Irvise/Ada_SaxonSOC
6
15240
<reponame>Irvise/Ada_SaxonSOC<filename>src/i-saxonsoc.ads<gh_stars>1-10 -- Main SaxonSOC package -- See https://github.com/SpinalHDL/SaxonSoc/blob/ -- bade201e38363030aab41dbec5565885a2f68dc3/bsp/radiona/ulx3s/smp/include/ -- soc.h#L64 -- with System; package Interfaces.SaxonSOC is pragma Preelaborate; pragma No_Elaboration_Code_All; --------------- -- Base type -- --------------- type Bit is mod 2**1 with Size => 1; end Interfaces.SaxonSOC;
sources/ippcp/asm_intel64/pcprc4m7as.asm
ntyukaev/ipp-crypto
30
1694
;=============================================================================== ; Copyright 2015-2020 Intel Corporation ; ; 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. ;=============================================================================== ; ; ; Purpose: Cryptography Primitive. ; ARCFour ; ; Content: ; ARCFourKernel() ; ; %include "asmdefs.inc" %include "ia_32e.inc" %if (_IPP32E >= _IPP32E_M7) segment .text align=IPP_ALIGN_FACTOR ;*************************************************************** ;* Purpose: RC4 kernel ;* ;* void ARCFourProcessData(const Ipp8u *pSrc, Ipp8u *pDst, int len, ;* IppsARCFourState* pCtx) ;* ;*************************************************************** ;; ;; Lib = M7 ;; ;; Caller = ippsARCFourEncrypt ;; Caller = ippsARCFourDecrypt ;; align IPP_ALIGN_FACTOR IPPASM ARCFourProcessData,PUBLIC USES_GPR rsi,rdi,rbx,rbp USES_XMM COMP_ABI 4 ;; rdi: pSrc: BYTE, ; input stream ;; rsi: pDst: BYTE, ; output stream ;; rdx: len: DWORD, ; stream length ;; rcx: pCtx: BYTE ; context movsxd r8, edx test r8, r8 ; test length mov rbp, rcx ; copy pointer context jz .quit movzx rax, byte [rbp+4] ; extract x movzx rbx, byte [rbp+8] ; extract y lea rbp, [rbp+12] ; sbox add rax,1 ; x = (x+1)&0xFF movzx rax, al movzx rcx, byte [rbp+rax*4] ; tx = S[x] ;; ;; main code ;; align IPP_ALIGN_FACTOR .main_loop: add rbx, rcx ; y = (x+tx)&0xFF movzx rbx, bl add rdi, 1 add rsi, 1 movzx rdx, byte [rbp+rbx*4] ; ty = S[y] mov dword [rbp+rbx*4],ecx ; S[y] = tx add rcx, rdx ; tmp_idx = (tx+ty)&0xFF movzx rcx, cl mov dword [rbp+rax*4],edx ; S[x] = ty mov dl, byte [rbp+rcx*4] ; byte of gamma add rax, 1 ; next x = (x+1)&0xFF movzx rax, al xor dl,byte [rdi-1] ; gamma ^= src sub r8, 1 movzx rcx, byte [rbp+rax*4] ; next tx = S[x] mov byte [rsi-1],dl ; store result jne .main_loop lea rbp, [rbp-12] ; pointer to context sub rax, 1 ; actual new x counter movzx rax, al mov dword [rbp+4], eax ; update x conter mov dword [rbp+8], ebx ; updtae y counter .quit: REST_XMM REST_GPR ret ENDFUNC ARCFourProcessData %endif
Properties/test/properties_test.adb
marcbejerano/ada-tools
2
30709
<filename>Properties/test/properties_test.adb -- @(#)File: properties_test.adb -- @(#)Last changed: Mar 18 2015 10:30:00 -- @(#)Purpose: Java properties file support -- @(#)Author: <NAME> <<EMAIL>> -- @(#)Copyright: Copyright (C) 2015, <NAME>, All Rights Reserved -- @(#)Product: None -- @(#)License: BSD3 -- -- Copyright (c) 2015, <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 ada-tools nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. with Ada.Text_IO; use Ada.Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Properties; use Properties; procedure Properties_Test is function assert_equals(expected, actual: in String) return Boolean is begin if (expected /= actual) then put("Assertion failure. actual="); put(actual); put(" expected="); Put_Line(expected); return false; else return true; end if; end assert_equals; props: Properties.Properties; props2: Properties.Properties; status: Boolean; keys: Key_Vector.Vector; begin Put_Line("*Create"); props.set_Property("ABC", "987654321"); props := Create; status := assert_equals("", props.Get_Property("ABC")); Put_Line("*Create(Properties)"); props.Set_Property("ABC", "987654321"); props2 := Create(props); props2.Set_Property("Another", "this is a test"); status := assert_equals("987654321", props2.Get_Property("ABC")); status := assert_equals("this is a test", props2.Get_Property("Another")); props := Create; Put_Line("*Get_Property"); status := assert_equals("", props.Get_Property("ABC")); Put_Line("*Get_Property(String)"); status := assert_equals("hello world", props.Get_Property("ABC", "hello world")); Put_Line("*Set_Property"); props.Set_Property("ABC", "12345"); status := assert_equals("12345", props.Get_Property("ABC")); Put_Line("*List"); props.List(Standard_Output); Put_Line("*Property_Names"); keys := props2.Property_Names; for key_index in 0 .. Integer(keys.Length) - 1 loop Put_Line(To_String(keys(key_index))); end loop; Put_Line("*String_Property_Names"); keys := props2.String_Property_Names; for key_index in 0 .. Integer(keys.Length) - 1 loop Put_Line(To_String(keys(key_index))); end loop; Put_Line("*Store"); props.Store(Standard_Output, "This is a comment"); Put_Line("*Store(Filename)"); props.Store("test.properties", "This is a comment"); Put_Line("*Store_To_XML"); props.Store_To_XML(Standard_Output, "This is a comment"); Put_Line("*Store_To_XML(Filename)"); props.Store_To_XML("test.xml", "This is a comment"); Put_Line("*Load(Filename)"); props.Load("test2.properties"); props.List(Standard_Output); end Properties_Test;
gcc-gcc-7_3_0-release/gcc/ada/debug.ads
best08618/asylo
7
18613
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- D E B U G -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains global flags used to control the inclusion -- of debugging code in various phases of the compiler. Some of these -- flags are also used by the binder and gnatmake. package Debug is pragma Preelaborate; ------------------------- -- Dynamic Debug Flags -- ------------------------- -- Flags that can be used to activate various specialized debugging output -- information. The flags are preset to False, which corresponds to the -- given output being suppressed. The individual flags can be turned on -- using the undocumented switch dxxx where xxx is a string of letters for -- flags to be turned on. Documentation on the current usage of these flags -- is contained in the body of Debug rather than the spec, so that we don't -- have to recompile the world when a new debug flag is added. Debug_Flag_A : Boolean := False; Debug_Flag_B : Boolean := False; Debug_Flag_C : Boolean := False; Debug_Flag_D : Boolean := False; Debug_Flag_E : Boolean := False; Debug_Flag_F : Boolean := False; Debug_Flag_G : Boolean := False; Debug_Flag_H : Boolean := False; Debug_Flag_I : Boolean := False; Debug_Flag_J : Boolean := False; Debug_Flag_K : Boolean := False; Debug_Flag_L : Boolean := False; Debug_Flag_M : Boolean := False; Debug_Flag_N : Boolean := False; Debug_Flag_O : Boolean := False; Debug_Flag_P : Boolean := False; Debug_Flag_Q : Boolean := False; Debug_Flag_R : Boolean := False; Debug_Flag_S : Boolean := False; Debug_Flag_T : Boolean := False; Debug_Flag_U : Boolean := False; Debug_Flag_V : Boolean := False; Debug_Flag_W : Boolean := False; Debug_Flag_X : Boolean := False; Debug_Flag_Y : Boolean := False; Debug_Flag_Z : Boolean := False; Debug_Flag_AA : Boolean := False; Debug_Flag_BB : Boolean := False; Debug_Flag_CC : Boolean := False; Debug_Flag_DD : Boolean := False; Debug_Flag_EE : Boolean := False; Debug_Flag_FF : Boolean := False; Debug_Flag_GG : Boolean := False; Debug_Flag_HH : Boolean := False; Debug_Flag_II : Boolean := False; Debug_Flag_JJ : Boolean := False; Debug_Flag_KK : Boolean := False; Debug_Flag_LL : Boolean := False; Debug_Flag_MM : Boolean := False; Debug_Flag_NN : Boolean := False; Debug_Flag_OO : Boolean := False; Debug_Flag_PP : Boolean := False; Debug_Flag_QQ : Boolean := False; Debug_Flag_RR : Boolean := False; Debug_Flag_SS : Boolean := False; Debug_Flag_TT : Boolean := False; Debug_Flag_UU : Boolean := False; Debug_Flag_VV : Boolean := False; Debug_Flag_WW : Boolean := False; Debug_Flag_XX : Boolean := False; Debug_Flag_YY : Boolean := False; Debug_Flag_ZZ : Boolean := False; Debug_Flag_1 : Boolean := False; Debug_Flag_2 : Boolean := False; Debug_Flag_3 : Boolean := False; Debug_Flag_4 : Boolean := False; Debug_Flag_5 : Boolean := False; Debug_Flag_6 : Boolean := False; Debug_Flag_7 : Boolean := False; Debug_Flag_8 : Boolean := False; Debug_Flag_9 : Boolean := False; Debug_Flag_Dot_A : Boolean := False; Debug_Flag_Dot_B : Boolean := False; Debug_Flag_Dot_C : Boolean := False; Debug_Flag_Dot_D : Boolean := False; Debug_Flag_Dot_E : Boolean := False; Debug_Flag_Dot_F : Boolean := False; Debug_Flag_Dot_G : Boolean := False; Debug_Flag_Dot_H : Boolean := False; Debug_Flag_Dot_I : Boolean := False; Debug_Flag_Dot_J : Boolean := False; Debug_Flag_Dot_K : Boolean := False; Debug_Flag_Dot_L : Boolean := False; Debug_Flag_Dot_M : Boolean := False; Debug_Flag_Dot_N : Boolean := False; Debug_Flag_Dot_O : Boolean := False; Debug_Flag_Dot_P : Boolean := False; Debug_Flag_Dot_Q : Boolean := False; Debug_Flag_Dot_R : Boolean := False; Debug_Flag_Dot_S : Boolean := False; Debug_Flag_Dot_T : Boolean := False; Debug_Flag_Dot_U : Boolean := False; Debug_Flag_Dot_V : Boolean := False; Debug_Flag_Dot_W : Boolean := False; Debug_Flag_Dot_X : Boolean := False; Debug_Flag_Dot_Y : Boolean := False; Debug_Flag_Dot_Z : Boolean := False; Debug_Flag_Dot_AA : Boolean := False; Debug_Flag_Dot_BB : Boolean := False; Debug_Flag_Dot_CC : Boolean := False; Debug_Flag_Dot_DD : Boolean := False; Debug_Flag_Dot_EE : Boolean := False; Debug_Flag_Dot_FF : Boolean := False; Debug_Flag_Dot_GG : Boolean := False; Debug_Flag_Dot_HH : Boolean := False; Debug_Flag_Dot_II : Boolean := False; Debug_Flag_Dot_JJ : Boolean := False; Debug_Flag_Dot_KK : Boolean := False; Debug_Flag_Dot_LL : Boolean := False; Debug_Flag_Dot_MM : Boolean := False; Debug_Flag_Dot_NN : Boolean := False; Debug_Flag_Dot_OO : Boolean := False; Debug_Flag_Dot_PP : Boolean := False; Debug_Flag_Dot_QQ : Boolean := False; Debug_Flag_Dot_RR : Boolean := False; Debug_Flag_Dot_SS : Boolean := False; Debug_Flag_Dot_TT : Boolean := False; Debug_Flag_Dot_UU : Boolean := False; Debug_Flag_Dot_VV : Boolean := False; Debug_Flag_Dot_WW : Boolean := False; Debug_Flag_Dot_XX : Boolean := False; Debug_Flag_Dot_YY : Boolean := False; Debug_Flag_Dot_ZZ : Boolean := False; Debug_Flag_Dot_1 : Boolean := False; Debug_Flag_Dot_2 : Boolean := False; Debug_Flag_Dot_3 : Boolean := False; Debug_Flag_Dot_4 : Boolean := False; Debug_Flag_Dot_5 : Boolean := False; Debug_Flag_Dot_6 : Boolean := False; Debug_Flag_Dot_7 : Boolean := False; Debug_Flag_Dot_8 : Boolean := False; Debug_Flag_Dot_9 : Boolean := False; procedure Set_Debug_Flag (C : Character; Val : Boolean := True); -- Where C is 0-9, A-Z, or a-z, sets the corresponding debug flag to -- the given value. In the checks off version of debug, the call to -- Set_Debug_Flag is always a null operation. procedure Set_Dotted_Debug_Flag (C : Character; Val : Boolean := True); -- Where C is 0-9, A-Z, or a-z, sets the corresponding dotted debug -- flag (e.g. call with C = 'a' for the .a flag). end Debug;
audio.asm
adhi-thirumala/EvoYellow
16
173468
<reponame>adhi-thirumala/EvoYellow INCLUDE "charmap.asm" AUDIO_1 EQU $2 AUDIO_2 EQU $8 AUDIO_3 EQU $1f AUDIO_4 EQU $20 PCM_1 EQU $21 PCM_2 EQU $22 PCM_3 EQU $23 PCM_4 EQU $24 PCM_5 EQU $25 PCM_6 EQU $31 PCM_7 EQU $32 PCM_8 EQU $33 PCM_9 EQU $34 PCM_10 EQU $35 PCM_11 EQU $36 PCM_12 EQU $37 PCM_13 EQU $38 GLOBAL AUDIO_1, AUDIO_2, AUDIO_3, AUDIO_4 GLOBAL PCM_1, PCM_2, PCM_3, PCM_4, PCM_5, PCM_6, PCM_7 GLOBAL PCM_8, PCM_9, PCM_10, PCM_11, PCM_12, PCM_13 INCLUDE "constants.asm" SECTION "Sound Effect Headers 1", ROMX, BANK[AUDIO_1] INCLUDE "audio/headers/sfxheaders1.asm" SECTION "Sound Effect Headers 2", ROMX, BANK[AUDIO_2] INCLUDE "audio/headers/sfxheaders2.asm" SECTION "Sound Effect Headers 3", ROMX, BANK[AUDIO_3] INCLUDE "audio/headers/sfxheaders3.asm" SECTION "Sound Effect Headers 4", ROMX, BANK[AUDIO_4] INCLUDE "audio/headers/sfxheaders4.asm" SECTION "Music Headers 1", ROMX, BANK[AUDIO_1] INCLUDE "audio/headers/musicheaders1.asm" SECTION "Music Headers 2", ROMX, BANK[AUDIO_2] INCLUDE "audio/headers/musicheaders2.asm" SECTION "Music Headers 3", ROMX, BANK[AUDIO_3] INCLUDE "audio/headers/musicheaders3.asm" SECTION "Music Headers 4", ROMX, BANK[AUDIO_4] INCLUDE "audio/headers/musicheaders4.asm" SECTION "Sound Effects 1", ROMX, BANK[AUDIO_1] INCLUDE "audio/sfx/snare1_1.asm" INCLUDE "audio/sfx/snare2_1.asm" INCLUDE "audio/sfx/snare3_1.asm" INCLUDE "audio/sfx/snare4_1.asm" INCLUDE "audio/sfx/snare5_1.asm" INCLUDE "audio/sfx/triangle1_1.asm" INCLUDE "audio/sfx/triangle2_1.asm" INCLUDE "audio/sfx/snare6_1.asm" INCLUDE "audio/sfx/snare7_1.asm" INCLUDE "audio/sfx/snare8_1.asm" INCLUDE "audio/sfx/snare9_1.asm" INCLUDE "audio/sfx/cymbal1_1.asm" INCLUDE "audio/sfx/cymbal2_1.asm" INCLUDE "audio/sfx/cymbal3_1.asm" INCLUDE "audio/sfx/muted_snare1_1.asm" INCLUDE "audio/sfx/triangle3_1.asm" INCLUDE "audio/sfx/muted_snare2_1.asm" INCLUDE "audio/sfx/muted_snare3_1.asm" INCLUDE "audio/sfx/muted_snare4_1.asm" ; Audio1_WavePointers: INCLUDE "audio/wave_instruments.asm" INCLUDE "audio/sfx/start_menu_1.asm" INCLUDE "audio/sfx/pokeflute.asm" INCLUDE "audio/sfx/cut_1.asm" INCLUDE "audio/sfx/go_inside_1.asm" INCLUDE "audio/sfx/swap_1.asm" INCLUDE "audio/sfx/tink_1.asm" INCLUDE "audio/sfx/59_1.asm" INCLUDE "audio/sfx/purchase_1.asm" INCLUDE "audio/sfx/collision_1.asm" INCLUDE "audio/sfx/go_outside_1.asm" INCLUDE "audio/sfx/press_ab_1.asm" INCLUDE "audio/sfx/save_1.asm" INCLUDE "audio/sfx/heal_hp_1.asm" INCLUDE "audio/sfx/poisoned_1.asm" INCLUDE "audio/sfx/heal_ailment_1.asm" INCLUDE "audio/sfx/trade_machine_1.asm" INCLUDE "audio/sfx/turn_on_pc_1.asm" INCLUDE "audio/sfx/turn_off_pc_1.asm" INCLUDE "audio/sfx/enter_pc_1.asm" INCLUDE "audio/sfx/shrink_1.asm" INCLUDE "audio/sfx/switch_1.asm" INCLUDE "audio/sfx/healing_machine_1.asm" INCLUDE "audio/sfx/teleport_exit1_1.asm" INCLUDE "audio/sfx/teleport_enter1_1.asm" INCLUDE "audio/sfx/teleport_exit2_1.asm" INCLUDE "audio/sfx/ledge_1.asm" INCLUDE "audio/sfx/teleport_enter2_1.asm" INCLUDE "audio/sfx/fly_1.asm" INCLUDE "audio/sfx/denied_1.asm" INCLUDE "audio/sfx/arrow_tiles_1.asm" INCLUDE "audio/sfx/push_boulder_1.asm" INCLUDE "audio/sfx/ss_anne_horn_1.asm" INCLUDE "audio/sfx/withdraw_deposit_1.asm" INCLUDE "audio/sfx/safari_zone_pa.asm" INCLUDE "audio/sfx/unused_1.asm" INCLUDE "audio/sfx/cry09_1.asm" INCLUDE "audio/sfx/cry23_1.asm" INCLUDE "audio/sfx/cry24_1.asm" INCLUDE "audio/sfx/cry11_1.asm" INCLUDE "audio/sfx/cry25_1.asm" INCLUDE "audio/sfx/cry03_1.asm" INCLUDE "audio/sfx/cry0f_1.asm" INCLUDE "audio/sfx/cry10_1.asm" INCLUDE "audio/sfx/cry00_1.asm" INCLUDE "audio/sfx/cry0e_1.asm" INCLUDE "audio/sfx/cry06_1.asm" INCLUDE "audio/sfx/cry07_1.asm" INCLUDE "audio/sfx/cry05_1.asm" INCLUDE "audio/sfx/cry0b_1.asm" INCLUDE "audio/sfx/cry0c_1.asm" INCLUDE "audio/sfx/cry02_1.asm" INCLUDE "audio/sfx/cry0d_1.asm" INCLUDE "audio/sfx/cry01_1.asm" INCLUDE "audio/sfx/cry0a_1.asm" INCLUDE "audio/sfx/cry08_1.asm" INCLUDE "audio/sfx/cry04_1.asm" INCLUDE "audio/sfx/cry19_1.asm" INCLUDE "audio/sfx/cry16_1.asm" INCLUDE "audio/sfx/cry1b_1.asm" INCLUDE "audio/sfx/cry12_1.asm" INCLUDE "audio/sfx/cry13_1.asm" INCLUDE "audio/sfx/cry14_1.asm" INCLUDE "audio/sfx/cry1e_1.asm" INCLUDE "audio/sfx/cry15_1.asm" INCLUDE "audio/sfx/cry17_1.asm" INCLUDE "audio/sfx/cry1c_1.asm" INCLUDE "audio/sfx/cry1a_1.asm" INCLUDE "audio/sfx/cry1d_1.asm" INCLUDE "audio/sfx/cry18_1.asm" INCLUDE "audio/sfx/cry1f_1.asm" INCLUDE "audio/sfx/cry20_1.asm" INCLUDE "audio/sfx/cry21_1.asm" INCLUDE "audio/sfx/cry22_1.asm" SECTION "Sound Effects 2", ROMX, BANK[AUDIO_2] INCLUDE "audio/sfx/snare1_2.asm" INCLUDE "audio/sfx/snare2_2.asm" INCLUDE "audio/sfx/snare3_2.asm" INCLUDE "audio/sfx/snare4_2.asm" INCLUDE "audio/sfx/snare5_2.asm" INCLUDE "audio/sfx/triangle1_2.asm" INCLUDE "audio/sfx/triangle2_2.asm" INCLUDE "audio/sfx/snare6_2.asm" INCLUDE "audio/sfx/snare7_2.asm" INCLUDE "audio/sfx/snare8_2.asm" INCLUDE "audio/sfx/snare9_2.asm" INCLUDE "audio/sfx/cymbal1_2.asm" INCLUDE "audio/sfx/cymbal2_2.asm" INCLUDE "audio/sfx/cymbal3_2.asm" INCLUDE "audio/sfx/muted_snare1_2.asm" INCLUDE "audio/sfx/triangle3_2.asm" INCLUDE "audio/sfx/muted_snare2_2.asm" INCLUDE "audio/sfx/muted_snare3_2.asm" INCLUDE "audio/sfx/muted_snare4_2.asm" ;Audio2_WavePointers: INCLUDE "audio/wave_instruments.asm" INCLUDE "audio/sfx/press_ab_2.asm" INCLUDE "audio/sfx/start_menu_2.asm" INCLUDE "audio/sfx/tink_2.asm" INCLUDE "audio/sfx/heal_hp_2.asm" INCLUDE "audio/sfx/heal_ailment_2.asm" INCLUDE "audio/sfx/silph_scope.asm" INCLUDE "audio/sfx/ball_toss.asm" INCLUDE "audio/sfx/ball_poof.asm" INCLUDE "audio/sfx/faint_thud.asm" INCLUDE "audio/sfx/run.asm" INCLUDE "audio/sfx/dex_page_added.asm" INCLUDE "audio/sfx/swap_2.asm" ; added in yellow INCLUDE "audio/sfx/pokeflute_ch3.asm" INCLUDE "audio/sfx/peck.asm" INCLUDE "audio/sfx/faint_fall.asm" INCLUDE "audio/sfx/battle_09.asm" INCLUDE "audio/sfx/pound.asm" INCLUDE "audio/sfx/battle_0b.asm" INCLUDE "audio/sfx/battle_0c.asm" INCLUDE "audio/sfx/battle_0d.asm" INCLUDE "audio/sfx/battle_0e.asm" INCLUDE "audio/sfx/battle_0f.asm" INCLUDE "audio/sfx/damage.asm" INCLUDE "audio/sfx/not_very_effective.asm" INCLUDE "audio/sfx/battle_12.asm" INCLUDE "audio/sfx/battle_13.asm" INCLUDE "audio/sfx/battle_14.asm" INCLUDE "audio/sfx/vine_whip.asm" INCLUDE "audio/sfx/battle_16.asm" INCLUDE "audio/sfx/battle_17.asm" INCLUDE "audio/sfx/battle_18.asm" INCLUDE "audio/sfx/battle_19.asm" INCLUDE "audio/sfx/super_effective.asm" INCLUDE "audio/sfx/battle_1b.asm" INCLUDE "audio/sfx/battle_1c.asm" INCLUDE "audio/sfx/doubleslap.asm" INCLUDE "audio/sfx/battle_1e.asm" INCLUDE "audio/sfx/horn_drill.asm" INCLUDE "audio/sfx/battle_20.asm" INCLUDE "audio/sfx/battle_21.asm" INCLUDE "audio/sfx/battle_22.asm" INCLUDE "audio/sfx/battle_23.asm" INCLUDE "audio/sfx/battle_24.asm" INCLUDE "audio/sfx/battle_25.asm" INCLUDE "audio/sfx/battle_26.asm" INCLUDE "audio/sfx/battle_27.asm" INCLUDE "audio/sfx/battle_28.asm" INCLUDE "audio/sfx/battle_29.asm" INCLUDE "audio/sfx/battle_2a.asm" INCLUDE "audio/sfx/battle_2b.asm" INCLUDE "audio/sfx/battle_2c.asm" INCLUDE "audio/sfx/psybeam.asm" INCLUDE "audio/sfx/battle_2e.asm" INCLUDE "audio/sfx/battle_2f.asm" INCLUDE "audio/sfx/psychic_m.asm" INCLUDE "audio/sfx/battle_31.asm" INCLUDE "audio/sfx/battle_32.asm" INCLUDE "audio/sfx/battle_33.asm" INCLUDE "audio/sfx/battle_34.asm" INCLUDE "audio/sfx/battle_35.asm" INCLUDE "audio/sfx/battle_36.asm" INCLUDE "audio/sfx/unused_2.asm" INCLUDE "audio/sfx/cry09_2.asm" INCLUDE "audio/sfx/cry23_2.asm" INCLUDE "audio/sfx/cry24_2.asm" INCLUDE "audio/sfx/cry11_2.asm" INCLUDE "audio/sfx/cry25_2.asm" INCLUDE "audio/sfx/cry03_2.asm" INCLUDE "audio/sfx/cry0f_2.asm" INCLUDE "audio/sfx/cry10_2.asm" INCLUDE "audio/sfx/cry00_2.asm" INCLUDE "audio/sfx/cry0e_2.asm" INCLUDE "audio/sfx/cry06_2.asm" INCLUDE "audio/sfx/cry07_2.asm" INCLUDE "audio/sfx/cry05_2.asm" INCLUDE "audio/sfx/cry0b_2.asm" INCLUDE "audio/sfx/cry0c_2.asm" INCLUDE "audio/sfx/cry02_2.asm" INCLUDE "audio/sfx/cry0d_2.asm" INCLUDE "audio/sfx/cry01_2.asm" INCLUDE "audio/sfx/cry0a_2.asm" INCLUDE "audio/sfx/cry08_2.asm" INCLUDE "audio/sfx/cry04_2.asm" INCLUDE "audio/sfx/cry19_2.asm" INCLUDE "audio/sfx/cry16_2.asm" INCLUDE "audio/sfx/cry1b_2.asm" INCLUDE "audio/sfx/cry12_2.asm" INCLUDE "audio/sfx/cry13_2.asm" INCLUDE "audio/sfx/cry14_2.asm" INCLUDE "audio/sfx/cry1e_2.asm" INCLUDE "audio/sfx/cry15_2.asm" INCLUDE "audio/sfx/cry17_2.asm" INCLUDE "audio/sfx/cry1c_2.asm" INCLUDE "audio/sfx/cry1a_2.asm" INCLUDE "audio/sfx/cry1d_2.asm" INCLUDE "audio/sfx/cry18_2.asm" INCLUDE "audio/sfx/cry1f_2.asm" INCLUDE "audio/sfx/cry20_2.asm" INCLUDE "audio/sfx/cry21_2.asm" INCLUDE "audio/sfx/cry22_2.asm" ;Audio2_WavePointers: INCLUDE "audio/wave_instruments.asm" SECTION "Sound Effects 3", ROMX, BANK[AUDIO_3] INCLUDE "audio/sfx/snare1_3.asm" INCLUDE "audio/sfx/snare2_3.asm" INCLUDE "audio/sfx/snare3_3.asm" INCLUDE "audio/sfx/snare4_3.asm" INCLUDE "audio/sfx/snare5_3.asm" INCLUDE "audio/sfx/triangle1_3.asm" INCLUDE "audio/sfx/triangle2_3.asm" INCLUDE "audio/sfx/snare6_3.asm" INCLUDE "audio/sfx/snare7_3.asm" INCLUDE "audio/sfx/snare8_3.asm" INCLUDE "audio/sfx/snare9_3.asm" INCLUDE "audio/sfx/cymbal1_3.asm" INCLUDE "audio/sfx/cymbal2_3.asm" INCLUDE "audio/sfx/cymbal3_3.asm" INCLUDE "audio/sfx/muted_snare1_3.asm" INCLUDE "audio/sfx/triangle3_3.asm" INCLUDE "audio/sfx/muted_snare2_3.asm" INCLUDE "audio/sfx/muted_snare3_3.asm" INCLUDE "audio/sfx/muted_snare4_3.asm" ;Audio3_WavePointers: INCLUDE "audio/wave_instruments.asm" INCLUDE "audio/sfx/start_menu_3.asm" INCLUDE "audio/sfx/cut_3.asm" INCLUDE "audio/sfx/go_inside_3.asm" INCLUDE "audio/sfx/swap_3.asm" INCLUDE "audio/sfx/tink_3.asm" INCLUDE "audio/sfx/59_3.asm" INCLUDE "audio/sfx/purchase_3.asm" INCLUDE "audio/sfx/collision_3.asm" INCLUDE "audio/sfx/go_outside_3.asm" INCLUDE "audio/sfx/press_ab_3.asm" INCLUDE "audio/sfx/save_3.asm" INCLUDE "audio/sfx/heal_hp_3.asm" INCLUDE "audio/sfx/poisoned_3.asm" INCLUDE "audio/sfx/heal_ailment_3.asm" INCLUDE "audio/sfx/trade_machine_3.asm" INCLUDE "audio/sfx/turn_on_pc_3.asm" INCLUDE "audio/sfx/turn_off_pc_3.asm" INCLUDE "audio/sfx/enter_pc_3.asm" INCLUDE "audio/sfx/shrink_3.asm" INCLUDE "audio/sfx/switch_3.asm" INCLUDE "audio/sfx/healing_machine_3.asm" INCLUDE "audio/sfx/teleport_exit1_3.asm" INCLUDE "audio/sfx/teleport_enter1_3.asm" INCLUDE "audio/sfx/teleport_exit2_3.asm" INCLUDE "audio/sfx/ledge_3.asm" INCLUDE "audio/sfx/teleport_enter2_3.asm" INCLUDE "audio/sfx/fly_3.asm" INCLUDE "audio/sfx/denied_3.asm" INCLUDE "audio/sfx/arrow_tiles_3.asm" INCLUDE "audio/sfx/push_boulder_3.asm" INCLUDE "audio/sfx/ss_anne_horn_3.asm" INCLUDE "audio/sfx/withdraw_deposit_3.asm" INCLUDE "audio/sfx/intro_lunge.asm" INCLUDE "audio/sfx/intro_hip.asm" INCLUDE "audio/sfx/intro_hop.asm" INCLUDE "audio/sfx/intro_raise.asm" INCLUDE "audio/sfx/intro_crash.asm" INCLUDE "audio/sfx/intro_whoosh.asm" INCLUDE "audio/sfx/slots_stop_wheel.asm" INCLUDE "audio/sfx/slots_reward.asm" INCLUDE "audio/sfx/slots_new_spin.asm" INCLUDE "audio/sfx/shooting_star.asm" INCLUDE "audio/sfx/unused_3.asm" INCLUDE "audio/sfx/cry09_3.asm" INCLUDE "audio/sfx/cry23_3.asm" INCLUDE "audio/sfx/cry24_3.asm" INCLUDE "audio/sfx/cry11_3.asm" INCLUDE "audio/sfx/cry25_3.asm" INCLUDE "audio/sfx/cry03_3.asm" INCLUDE "audio/sfx/cry0f_3.asm" INCLUDE "audio/sfx/cry10_3.asm" INCLUDE "audio/sfx/cry00_3.asm" INCLUDE "audio/sfx/cry0e_3.asm" INCLUDE "audio/sfx/cry06_3.asm" INCLUDE "audio/sfx/cry07_3.asm" INCLUDE "audio/sfx/cry05_3.asm" INCLUDE "audio/sfx/cry0b_3.asm" INCLUDE "audio/sfx/cry0c_3.asm" INCLUDE "audio/sfx/cry02_3.asm" INCLUDE "audio/sfx/cry0d_3.asm" INCLUDE "audio/sfx/cry01_3.asm" INCLUDE "audio/sfx/cry0a_3.asm" INCLUDE "audio/sfx/cry08_3.asm" INCLUDE "audio/sfx/cry04_3.asm" INCLUDE "audio/sfx/cry19_3.asm" INCLUDE "audio/sfx/cry16_3.asm" INCLUDE "audio/sfx/cry1b_3.asm" INCLUDE "audio/sfx/cry12_3.asm" INCLUDE "audio/sfx/cry13_3.asm" INCLUDE "audio/sfx/cry14_3.asm" INCLUDE "audio/sfx/cry1e_3.asm" INCLUDE "audio/sfx/cry15_3.asm" INCLUDE "audio/sfx/cry17_3.asm" INCLUDE "audio/sfx/cry1c_3.asm" INCLUDE "audio/sfx/cry1a_3.asm" INCLUDE "audio/sfx/cry1d_3.asm" INCLUDE "audio/sfx/cry18_3.asm" INCLUDE "audio/sfx/cry1f_3.asm" INCLUDE "audio/sfx/cry20_3.asm" INCLUDE "audio/sfx/cry21_3.asm" INCLUDE "audio/sfx/cry22_3.asm" SECTION "Sound Effects 4", ROMX, BANK[AUDIO_4] INCLUDE "audio/sfx/snare1_4.asm" INCLUDE "audio/sfx/snare2_4.asm" INCLUDE "audio/sfx/snare3_4.asm" INCLUDE "audio/sfx/snare4_4.asm" INCLUDE "audio/sfx/snare5_4.asm" INCLUDE "audio/sfx/triangle1_4.asm" INCLUDE "audio/sfx/triangle2_4.asm" INCLUDE "audio/sfx/snare6_4.asm" INCLUDE "audio/sfx/snare7_4.asm" INCLUDE "audio/sfx/snare8_4.asm" INCLUDE "audio/sfx/snare9_4.asm" INCLUDE "audio/sfx/cymbal1_4.asm" INCLUDE "audio/sfx/cymbal2_4.asm" INCLUDE "audio/sfx/cymbal3_4.asm" INCLUDE "audio/sfx/muted_snare1_4.asm" INCLUDE "audio/sfx/triangle3_4.asm" INCLUDE "audio/sfx/muted_snare2_4.asm" INCLUDE "audio/sfx/muted_snare3_4.asm" INCLUDE "audio/sfx/muted_snare4_4.asm" INCLUDE "audio/sfx/unknown_80250.asm" INCLUDE "audio/sfx/unknown_80263.asm" INCLUDE "audio/sfx/unknown_8026a.asm" INCLUDE "audio/sfx/heal_ailment_4.asm" INCLUDE "audio/sfx/tink_4.asm" INCLUDE "audio/sfx/unknown_8029f.asm" INCLUDE "audio/sfx/unknown_802b5.asm" INCLUDE "audio/sfx/unknown_802cc.asm" INCLUDE "audio/sfx/unknown_802d7.asm" INCLUDE "audio/sfx/unknown_802e1.asm" INCLUDE "audio/sfx/get_item2_4_2.asm" INCLUDE "audio/sfx/unknown_80337.asm" INCLUDE "audio/sfx/unknown_803da.asm" INCLUDE "audio/sfx/unknown_80411.asm" INCLUDE "audio/sfx/unknown_80467.asm" INCLUDE "audio/sfx/unknown_804bf.asm" INCLUDE "audio/sfx/unknown_804fa.asm" INCLUDE "audio/sfx/unknown_80545.asm" INCLUDE "audio/sfx/unknown_8058b.asm" INCLUDE "audio/sfx/unknown_805db.asm" INCLUDE "audio/sfx/unknown_80603.asm" INCLUDE "audio/sfx/unknown_80633.asm" INCLUDE "audio/sfx/unknown_80661.asm" INCLUDE "audio/sfx/unknown_80689.asm" INCLUDE "audio/sfx/unknown_806af.asm" INCLUDE "audio/sfx/unknown_80712.asm" INCLUDE "audio/sfx/unknown_80760.asm" INCLUDE "audio/sfx/unknown_8077e.asm" INCLUDE "audio/sfx/unknown_807eb.asm" INCLUDE "audio/sfx/unknown_8081e.asm" INCLUDE "audio/sfx/unknown_80879.asm" INCLUDE "audio/sfx/unknown_808a9.asm" INCLUDE "audio/sfx/unknown_808fa.asm" INCLUDE "audio/sfx/unknown_8091c.asm" INCLUDE "audio/sfx/unknown_80944.asm" INCLUDE "audio/sfx/unknown_8097f.asm" INCLUDE "audio/sfx/unknown_809b2.asm" INCLUDE "audio/sfx/unknown_809fb.asm" INCLUDE "audio/sfx/unknown_80a23.asm" INCLUDE "audio/sfx/unknown_80a89.asm" INCLUDE "audio/sfx/unknown_80ad2.asm" INCLUDE "audio/sfx/unknown_80b05.asm" INCLUDE "audio/sfx/unknown_80b53.asm" INCLUDE "audio/sfx/unknown_80b9c.asm" INCLUDE "audio/sfx/unknown_80be2.asm" INCLUDE "audio/sfx/unknown_80c3b.asm" INCLUDE "audio/sfx/unknown_80c6e.asm" INCLUDE "audio/sfx/unknown_80ca1.asm" INCLUDE "audio/sfx/unknown_80ce7.asm" INCLUDE "audio/music/printer.asm" INCLUDE "audio/sfx/unknown_80e5a.asm" INCLUDE "audio/sfx/unknown_80e91.asm" INCLUDE "audio/sfx/get_item2_4.asm" SECTION "Audio Engine 1", ROMX, BANK[AUDIO_1] PlayBattleMusic:: xor a ld [wAudioFadeOutControl], a ld [wLowHealthAlarm], a call StopAllMusic call DelayFrame ld c, $8 ; BANK(Music_GymLeaderBattle) ld a, [wGymLeaderNo] and a jr z, .notGymLeaderBattle ld a, $ea ; MUSIC_GYM_LEADER_BATTLE jr .playSong .notGymLeaderBattle ld a, [wCurOpponent] cp 200 jr c, .wildBattle cp OPP_SONY3 jr z, .finalBattle cp OPP_LANCE jr nz, .normalTrainerBattle ld a, $ea ; MUSIC_GYM_LEADER_BATTLE ; lance also plays gym leader theme jr .playSong .normalTrainerBattle ld a, $ed ; MUSIC_TRAINER_BATTLE jr .playSong .finalBattle ld a, $f3 ; MUSIC_FINAL_BATTLE jr .playSong .wildBattle ld a, $f0 ; MUSIC_WILD_BATTLE .playSong jp PlayMusic INCLUDE "audio/engine_1.asm" ; an alternate start for MeetRival which has a different first measure Music_RivalAlternateStart:: ld c, BANK(Music_MeetRival) ld a, MUSIC_MEET_RIVAL call PlayMusic ld hl, wChannelCommandPointers ld de, Music_MeetRival_branch_b1a2 call Audio1_OverwriteChannelPointer ld de, Music_MeetRival_branch_b21d call Audio1_OverwriteChannelPointer ld de, Music_MeetRival_branch_b2b5 Audio1_OverwriteChannelPointer: ld a, e ld [hli], a ld a, d ld [hli], a ret ; an alternate tempo for MeetRival which is slightly slower Music_RivalAlternateTempo:: ld c, BANK(Music_MeetRival) ld a, MUSIC_MEET_RIVAL call PlayMusic ld de, Music_MeetRival_branch_b119 jr asm_99ed ; applies both the alternate start and alternate tempo Music_RivalAlternateStartAndTempo:: call Music_RivalAlternateStart ld de, Music_MeetRival_branch_b19b asm_99ed: ld hl, wChannelCommandPointers jp Audio1_OverwriteChannelPointer ; XXX ret ; an alternate tempo for Cities1 which is used for the Hall of Fame room Music_Cities1AlternateTempo:: ld a, 10 ld [wAudioFadeOutCounterReloadValue], a ld [wAudioFadeOutCounter], a ld a, $ff ; stop playing music after the fade-out is finished ld [wAudioFadeOutControl], a ld c, 100 call DelayFrames ; wait for the fade-out to finish ld c, BANK(Music_Cities1) ld a, $c3 ; MUSIC_CITIES1 call PlayMusic ld hl, wChannelCommandPointers ld de, Music_Cities1_branch_aa6f jp Audio1_OverwriteChannelPointer SECTION "Audio Engine 2", ROMX, BANK[AUDIO_2] Music_DoLowHealthAlarm:: ld a, [wLowHealthAlarm] cp $ff jr z, .disableAlarm bit 7, a ;alarm enabled? ret z ;nope and $7f ;low 7 bits are the timer. jr nz, .asm_21383 ;if timer > 0, play low tone. call .playToneHi ld a, 30 ;keep this tone for 30 frames. jr .asm_21395 ;reset the timer. .asm_21383 cp 20 jr nz, .asm_2138a ;if timer == 20, call .playToneLo ;actually set the sound registers. .asm_2138a ld a, $86 ld [wChannelSoundIDs + CH4], a ;disable sound channel? ld a, [wLowHealthAlarm] and $7f ;decrement alarm timer. dec a .asm_21395 ; reset the timer and enable flag. set 7, a ld [wLowHealthAlarm], a ret .disableAlarm xor a ld [wLowHealthAlarm], a ;disable alarm ld [wChannelSoundIDs + CH4], a ;re-enable sound channel? ld de, .toneDataSilence jr .playTone ;update the sound registers to change the frequency. ;the tone set here stays until we change it. .playToneHi ld de, .toneDataHi jr .playTone .playToneLo ld de, .toneDataLo ;update sound channel 1 to play the alarm, overriding all other sounds. .playTone ld hl, rNR10 ;channel 1 sound register ld c, $5 xor a .copyLoop ld [hli], a ld a, [de] inc de dec c jr nz, .copyLoop ret ;bytes to write to sound channel 1 registers for health alarm. ;starting at FF11 (FF10 is always zeroed), so these bytes are: ;length, envelope, freq lo, freq hi .toneDataHi db $A0,$E2,$50,$87 .toneDataLo db $B0,$E2,$EE,$86 ;written to stop the alarm .toneDataSilence db $00,$00,$00,$80 INCLUDE "engine/menu/bills_pc.asm" INCLUDE "audio/engine_2.asm" SECTION "Audio Engine 3", ROMX, BANK[AUDIO_3] PlayPokedexRatingSfx:: ld a, [$ffdc] ld c, $0 ld hl, OwnedMonValues .getSfxPointer cp [hl] jr c, .gotSfxPointer inc c inc hl jr .getSfxPointer .gotSfxPointer push bc call StopAllMusic pop bc ld b, $0 ld hl, PokedexRatingSfxPointers add hl, bc add hl, bc ld a, [hli] ld c, [hl] call PlayMusic jp PlayDefaultMusic PokedexRatingSfxPointers: db SFX_DENIED, BANK(SFX_Denied_3) db SFX_POKEDEX_RATING, BANK(SFX_Pokedex_Rating_1) db SFX_GET_ITEM_1, BANK(SFX_Get_Item1_1) db SFX_CAUGHT_MON, BANK(SFX_Caught_Mon) db SFX_LEVEL_UP, BANK(SFX_Level_Up) db SFX_GET_KEY_ITEM, BANK(SFX_Get_Key_Item_1) db SFX_GET_ITEM_2, BANK(SFX_Get_Item2_1) OwnedMonValues: db 10, 40, 60, 90, 120, 150, $ff INCLUDE "audio/engine_3.asm" SECTION "Audio Engine 4", ROMX, BANK[AUDIO_4] SurfingPikachu1Graphics1:: INCBIN "gfx/surfing_pikachu_1a.2bpp" SurfingPikachu1Graphics2:: INCBIN "gfx/surfing_pikachu_1b.2bpp" SurfingPikachu1Graphics3:: INCBIN "gfx/surfing_pikachu_1c.t5.2bpp" INCLUDE "audio/engine_4.asm" SECTION "Music 1", ROMX, BANK[AUDIO_1] Audio1_WavePointers: INCLUDE "audio/wave_instruments.asm" INCLUDE "audio/music/pkmnhealed.asm" INCLUDE "audio/music/routes1.asm" INCLUDE "audio/music/routes2.asm" INCLUDE "audio/music/routes3.asm" INCLUDE "audio/music/routes4.asm" INCLUDE "audio/music/indigoplateau.asm" INCLUDE "audio/music/pallettown.asm" INCLUDE "audio/music/unusedsong.asm" INCLUDE "audio/music/cities1.asm" INCLUDE "audio/sfx/get_item1_1.asm" INCLUDE "audio/music/museumguy.asm" INCLUDE "audio/music/meetprofoak.asm" INCLUDE "audio/music/meetrival.asm" INCLUDE "audio/sfx/pokedex_rating_1.asm" INCLUDE "audio/sfx/get_item2_1.asm" INCLUDE "audio/sfx/get_key_item_1.asm" INCLUDE "audio/music/ssanne.asm" INCLUDE "audio/music/cities2.asm" INCLUDE "audio/music/celadon.asm" INCLUDE "audio/music/cinnabar.asm" INCLUDE "audio/music/vermilion.asm" INCLUDE "audio/music/lavender.asm" INCLUDE "audio/music/safarizone.asm" INCLUDE "audio/music/gym.asm" INCLUDE "audio/music/pokecenter.asm" SECTION "Music 2", ROMX, BANK[AUDIO_2] INCLUDE "audio/sfx/unused2_2.asm" INCLUDE "audio/music/gymleaderbattle.asm" INCLUDE "audio/music/trainerbattle.asm" INCLUDE "audio/music/wildbattle.asm" INCLUDE "audio/music/finalbattle.asm" INCLUDE "audio/sfx/level_up.asm" INCLUDE "audio/sfx/get_item2_2.asm" INCLUDE "audio/sfx/caught_mon.asm" INCLUDE "audio/music/defeatedtrainer.asm" INCLUDE "audio/music/defeatedwildmon.asm" INCLUDE "audio/music/defeatedgymleader.asm" SECTION "Music 3", ROMX, BANK[AUDIO_3] INCLUDE "audio/music/bikeriding.asm" INCLUDE "audio/music/dungeon1.asm" INCLUDE "audio/music/gamecorner.asm" INCLUDE "audio/music/titlescreen.asm" INCLUDE "audio/sfx/get_item1_3.asm" INCLUDE "audio/music/dungeon2.asm" INCLUDE "audio/music/dungeon3.asm" INCLUDE "audio/music/cinnabarmansion.asm" INCLUDE "audio/sfx/pokedex_rating_3.asm" INCLUDE "audio/sfx/get_item2_3.asm" INCLUDE "audio/sfx/get_key_item_3.asm" INCLUDE "audio/music/oakslab.asm" INCLUDE "audio/music/pokemontower.asm" INCLUDE "audio/music/silphco.asm" INCLUDE "audio/music/meeteviltrainer.asm" INCLUDE "audio/music/meetfemaletrainer.asm" INCLUDE "audio/music/meetmaletrainer.asm" INCLUDE "audio/music/introbattle.asm" INCLUDE "audio/music/surfing.asm" INCLUDE "audio/music/jigglypuffsong.asm" INCLUDE "audio/music/halloffame.asm" INCLUDE "audio/music/credits.asm" INCLUDE "audio/music/yellowintro.asm" SECTION "Music 4", ROMX, BANK[AUDIO_4] INCLUDE "audio/music/surfingpikachu.asm" INCLUDE "audio/music/yellowunusedsong.asm" INCLUDE "audio/music/meetjessiejames.asm" INCBIN "audio/unknown_832b9.bin" SECTION "Pikachu Cries 1",ROMX,BANK[PCM_1] PikachuCry1:: dw (PikachuCry1_End - PikachuCry1) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/raichu_cry_1.pcm" PikachuCry1_End: db $77 ; unused ; Game Freak might have made a slight error, because all of ; the pcm data has one trailing byte that is never processed. PikachuCry2:: dw (PikachuCry2_End - PikachuCry2) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_2.pcm" PikachuCry2_End: db $77 ; unused PikachuCry3:: dw (PikachuCry3_End - PikachuCry3) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_3.pcm" PikachuCry3_End: db $03 ; unused PikachuCry4:: dw (PikachuCry4_End - PikachuCry4) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_4.pcm" PikachuCry4_End: db $e0 ; unused SECTION "Pikachu Cries 2",ROMX,BANK[PCM_2] PikachuCry5:: dw (PikachuCry5_End - PikachuCry5) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/raichu_cry_2.pcm" ;hearts?pikachu_cry_5 PikachuCry5_End: db $77 ; unused PikachuCry6:: dw (PikachuCry6_End - PikachuCry6) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_6.pcm" PikachuCry6_End: db $77 ; unused PikachuCry7:: dw (PikachuCry7_End - PikachuCry7) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_7.pcm" PikachuCry7_End: db $ff ; unused SECTION "Pikachu Cries 3",ROMX,BANK[PCM_3] PikachuCry8:: dw (PikachuCry8_End - PikachuCry8) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_8.pcm" PikachuCry8_End: db $f7 ; unused PikachuCry9:: dw (PikachuCry9_End - PikachuCry9) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_9.pcm" PikachuCry9_End: db $f3 ; unused PikachuCry10:: dw (PikachuCry10_End - PikachuCry10) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_10.pcm" PikachuCry10_End: db $ff ; unused SECTION "Pikachu Cries 4",ROMX,BANK[PCM_4] PikachuCry11:: dw (PikachuCry11_End - PikachuCry11) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_11.pcm" PikachuCry11_End: db $77 ; unused PikachuCry12:: dw (PikachuCry12_End - PikachuCry12) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_12.pcm" PikachuCry12_End: db $ff ; unused PikachuCry13:: dw (PikachuCry13_End - PikachuCry13) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_13.pcm" PikachuCry13_End: db $f0 ; unused SECTION "Pikachu Cries 5",ROMX,BANK[PCM_5] PikachuCry14:: dw (PikachuCry14_End - PikachuCry14) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_14.pcm" PikachuCry14_End: db $fc ; unused PikachuCry15:: dw (PikachuCry15_End - PikachuCry15) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_15.pcm" PikachuCry15_End: db $77 ; unused SECTION "Pikachu Cries 6",ROMX,BANK[PCM_6] PikachuCry16:: dw (PikachuCry16_End - PikachuCry16) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_16.pcm" PikachuCry16_End: db $e7 ; unused PikachuCry18:: dw (PikachuCry18_End - PikachuCry18) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_18.pcm" PikachuCry18_End: db $00 ; unused PikachuCry22:: dw (PikachuCry22_End - PikachuCry22) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_22.pcm" PikachuCry22_End: db $7e ; unused SECTION "Pikachu Cries 7",ROMX,BANK[PCM_7] PikachuCry20:: dw (PikachuCry20_End - PikachuCry20) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_20.pcm" PikachuCry20_End: db $07 ; unused PikachuCry21:: dw (PikachuCry21_End - PikachuCry21) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_21.pcm" PikachuCry21_End: db $ff ; unused SECTION "Pikachu Cries 8",ROMX,BANK[PCM_8] PikachuCry19:: dw (PikachuCry19_End - PikachuCry19) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_19.pcm" PikachuCry19_End: db $06 ; unused PikachuCry24:: dw (PikachuCry24_End - PikachuCry24) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_24.pcm" PikachuCry24_End: db $e0 ; unused PikachuCry26:: dw (PikachuCry26_End - PikachuCry26) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_26.pcm" PikachuCry26_End: SECTION "Pikachu Cries 9",ROMX,BANK[PCM_9] PikachuCry17:: dw (PikachuCry17_End - PikachuCry17) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_17.pcm" PikachuCry17_End: db $00 ; unused PikachuCry23:: dw (PikachuCry23_End - PikachuCry23) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_23.pcm" PikachuCry23_End: db $00 ; unused PikachuCry25:: dw (PikachuCry25_End - PikachuCry25) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_25.pcm" PikachuCry25_End: db $03 ; unused SECTION "Pikachu Cries 10",ROMX,BANK[PCM_10] PikachuCry27:: dw (PikachuCry27_End - PikachuCry27) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_27.pcm" PikachuCry27_End: db $ff ; unused PikachuCry28:: dw (PikachuCry28_End - PikachuCry28) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_28.pcm" PikachuCry28_End: db $1b ; unused PikachuCry29:: dw (PikachuCry29_End - PikachuCry29) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_29.pcm" PikachuCry29_End: db $87 ; unused PikachuCry30:: dw (PikachuCry30_End - PikachuCry30) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_30.pcm" PikachuCry30_End: db $00 ; unused PikachuCry31:: dw (PikachuCry31_End - PikachuCry31) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_31.pcm" PikachuCry31_End: SECTION "Pikachu Cries 11",ROMX,BANK[PCM_11] PikachuCry32:: dw (PikachuCry32_End - PikachuCry32) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_32.pcm" PikachuCry32_End: db $ff ; unused PikachuCry33:: dw (PikachuCry33_End - PikachuCry33) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_33.pcm" PikachuCry33_End: db $1f ; unused PikachuCry34:: dw (PikachuCry34_End - PikachuCry34) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_34.pcm" PikachuCry34_End: db $01 ; unused PikachuCry41:: dw (PikachuCry41_End - PikachuCry41) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_41.pcm" PikachuCry41_End: db $9b ; unused SECTION "Pikachu Cries 12",ROMX,BANK[PCM_12] PikachuCry35:: dw (PikachuCry35_End - PikachuCry35) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/raichu_cry_3.pcm" ;pikachu_cry_35 arms raised happy "PIKA!" also used in intro though. PikachuCry35_End: db $00 ; unused PikachuCry36:: dw (PikachuCry36_End - PikachuCry36) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_36.pcm" PikachuCry36_End: db $01 ; unused PikachuCry39:: dw (PikachuCry39_End - PikachuCry39) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_39.pcm" PikachuCry39_End: db $0f ; unused SECTION "Pikachu Cries 13",ROMX,BANK[PCM_13] PikachuCry37:: dw (PikachuCry37_End - PikachuCry37) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_37.pcm" PikachuCry37_End: db $3f ; unused PikachuCry38:: dw (PikachuCry38_End - PikachuCry38) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_38.pcm" PikachuCry38_End: db $ff ; unused PikachuCry40:: dw (PikachuCry40_End - PikachuCry40) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_40.pcm" PikachuCry40_End: db $ff ; unused PikachuCry42:: dw (PikachuCry42_End - PikachuCry42) - 2 ; length of pcm data INCBIN "audio/pikachu_cries/pikachu_cry_42.pcm" PikachuCry42_End:
programs/oeis/337/A337336.asm
neoneye/loda
22
176353
; A337336: a(n) = A048673(n^2). ; 1,5,13,41,25,113,61,365,313,221,85,1013,145,545,613,3281,181,2813,265,1985,1513,761,421,9113,1201,1301,7813,4901,481,5513,685,29525,2113,1625,2965,25313,841,2381,3613,17861,925,13613,1105,6845,15313,3785,1405,82013,7321,10805,4513,11705,1741,70313,4141,44105,6613,4325,1861,49613,2245,6161,37813,265721,7081,19013,2521,14621,10513,26681,2665,227813,3121,7565,30013,21425,10225,32513,3445,160745,195313,8321,3961,122513,8845,9941,12013,61601,4705,137813,17485,34061,17113,12641,12961,738113,5101,65885,52813,97241 seq $0,3961 ; Completely multiplicative with a(prime(k)) = prime(k+1). pow $0,2 div $0,2 add $0,1
GccTest/src/bootloader/stage2/entry.asm
chibicitiberiu/nanobyte_experiments
0
178744
<filename>GccTest/src/bootloader/stage2/entry.asm<gh_stars>0 bits 16 section .entry ; c start extern _start ; sections extern __bss_start extern __end global entry entry: cli ; setup segments mov ax, 0 mov ss, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax ; setup stack at 0xFFF0 mov esp, 0xFFF0 mov ebp, esp sti ; expect boot drive in dl, send it as argument to cstart function mov [g_BootDrive], dl ; ; switch to protected mode ; cli call x86_EnableA20 call x86_LoadGDT ; set "protection enable" flag in control register 0 mov eax, cr0 or al, 1 mov cr0, eax ; far jump into protected mode jmp dword 08h:.pmode .pmode: [bits 32] ; load segments mov ax, 10h mov ss, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax ; zero bss mov edi, __bss_start mov ecx, __end sub ecx, __bss_start mov al, 0 cld rep stosb ; repeats instruction decrementing ECX until zero ; and stores value from AL incrementing ES:EDI ; call C push dword[g_BootDrive] call _start cli hlt ; ; Enables A20 gate ; x86_EnableA20: [bits 16] ; disable keyboard call x86_A20WaitInput mov al, KbdControllerDisableKeyboard out KbdControllerCommandPort, al ; read control output port call x86_A20WaitInput mov al, KbdControllerReadCtrlOutputPort out KbdControllerCommandPort, al call x86_A20WaitOutput in al, KbdControllerDataPort push eax ; write control output port call x86_A20WaitInput mov al, KbdControllerWriteCtrlOutputPort out KbdControllerCommandPort, al call x86_A20WaitInput pop eax or al, 2 ; set bit 2 - a20 bit out KbdControllerDataPort, al ; enable keyboard call x86_A20WaitInput mov al, KbdControllerEnableKeyboard out KbdControllerCommandPort, al call x86_A20WaitInput ret x86_A20WaitInput: ; wait until status bit 2 (input buffer) is 0 in al, KbdControllerCommandPort test al, 2 jnz x86_A20WaitInput ret x86_A20WaitOutput: ; wait until status bit 1 (output buffer) is 1 so it can be read in al, KbdControllerCommandPort test al, 1 jz x86_A20WaitOutput ret ; ; Load protected mode GDT ; x86_LoadGDT: [bits 16] lgdt [g_GDTDesc] ret g_BootDrive: dd 0 g_GDT: ; NULL descriptor dq 0 ; 32-bit code segment dw 0FFFFh ; limit low - 0xfffff for full 4gb address space dw 0 ; base (bits 0-15) - 0x0 db 0 ; base (bits 16-23) db 10011010b ; access (present, ring 0, code segment, executable, direction 0, readable) db 11001111b ; granularity (4kb pages, 32-bit protected mode) + limit high (0xF) db 0 ; base high ; 32-bit data segment dw 0FFFFh ; limit low - 0xfffff for full 4gb address space dw 0 ; base (bits 0-15) - 0x0 db 0 ; base (bits 16-23) db 10010010b ; access (present, ring 0, data segment, executable, direction 0, writable) db 11001111b ; granularity (4kb pages, 32-bit protected mode) + limit high (0xF) db 0 ; base high ; 16-bit code segment dw 0FFFFh ; limit low - 0xfffff dw 0 ; base (bits 0-15) - 0x0 db 0 ; base (bits 16-23) db 10011010b ; access (present, ring 0, code segment, executable, direction 0, readable) db 00001111b ; granularity (1b pages, 16-bit real mode) + limit high (0xF) db 0 ; base high ; 16-bit data segment dw 0FFFFh ; limit low - 0xfffff dw 0 ; base (bits 0-15) - 0x0 db 0 ; base (bits 16-23) db 10010010b ; access (present, ring 0, data segment, executable, direction 0, writable) db 00001111b ; granularity (1b pages, 16-bit real mode) + limit high (0xF) db 0 ; base high g_GDTDesc: dw g_GDTDesc - g_GDT - 1 ; limit = size of GDT dd g_GDT ; base of GDT KbdControllerDataPort equ 0x60 KbdControllerCommandPort equ 0x64 KbdControllerDisableKeyboard equ 0xAD KbdControllerEnableKeyboard equ 0xAE KbdControllerReadCtrlOutputPort equ 0xD0 KbdControllerWriteCtrlOutputPort equ 0xD1
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca_notsx.log_4470_233.asm
ljhsiun2/medusa
9
4561
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x8859, %r13 nop nop dec %rdi mov (%r13), %esi nop nop nop add %rcx, %rcx lea addresses_normal_ht+0x15d31, %r13 nop nop nop nop xor $44860, %rbp movb (%r13), %r12b nop nop inc %r12 lea addresses_WC_ht+0x6bd9, %rbp nop nop nop add %rdx, %rdx movb (%rbp), %r13b nop nop add %rdx, %rdx lea addresses_WT_ht+0x4859, %r13 clflush (%r13) nop nop nop nop nop dec %rdi movb $0x61, (%r13) nop nop add $51022, %rdx lea addresses_normal_ht+0x174f9, %rsi lea addresses_WC_ht+0x14c19, %rdi clflush (%rsi) and %r10, %r10 mov $73, %rcx rep movsq nop nop nop sub $55489, %rbp lea addresses_WC_ht+0x1169, %rdx and %r12, %r12 movups (%rdx), %xmm7 vpextrq $0, %xmm7, %rsi nop nop add $5542, %r10 lea addresses_D_ht+0x1b691, %rcx nop nop sub $46945, %rbp mov $0x6162636465666768, %rdi movq %rdi, (%rcx) lfence lea addresses_D_ht+0xc059, %rsi lea addresses_WT_ht+0x1779, %rdi nop nop nop nop nop xor %r10, %r10 mov $44, %rcx rep movsb sub %r10, %r10 lea addresses_normal_ht+0x146d9, %rsi lea addresses_D_ht+0x9a36, %rdi clflush (%rsi) nop nop nop nop nop add $22436, %r12 mov $120, %rcx rep movsb nop nop nop dec %rdx lea addresses_A_ht+0x19c59, %rsi lea addresses_D_ht+0x1d9dd, %rdi nop nop nop nop xor $24940, %rdx mov $25, %rcx rep movsw xor $58780, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %rbx push %rcx push %rdi push %rsi // Store lea addresses_WT+0x3cc9, %r10 sub $47211, %rbx movw $0x5152, (%r10) nop nop nop nop and $52219, %rdi // Store lea addresses_PSE+0x1cad9, %rcx nop nop nop add $18182, %rsi movl $0x51525354, (%rcx) nop nop nop sub $35328, %rsi // Store lea addresses_D+0x15ad9, %r11 nop nop nop sub $58942, %rdi mov $0x5152535455565758, %r13 movq %r13, %xmm1 movups %xmm1, (%r11) nop nop nop nop and $61263, %rbx // Store lea addresses_A+0x18acd, %r10 nop nop nop nop nop cmp $53803, %r13 mov $0x5152535455565758, %r11 movq %r11, %xmm4 movups %xmm4, (%r10) nop cmp $41574, %r10 // Store lea addresses_D+0x12f59, %r13 nop nop and $6491, %rsi mov $0x5152535455565758, %rbx movq %rbx, %xmm3 movups %xmm3, (%r13) nop nop cmp %r10, %r10 // Store lea addresses_D+0x16a5b, %r11 nop nop cmp %rdi, %rdi movw $0x5152, (%r11) and $47515, %rbx // Store lea addresses_normal+0x12259, %r13 nop nop nop dec %r10 movb $0x51, (%r13) nop nop nop sub $25184, %r13 // Store lea addresses_WC+0x19559, %rdi nop nop nop and $54708, %r11 mov $0x5152535455565758, %rcx movq %rcx, %xmm2 vmovups %ymm2, (%rdi) nop nop cmp $61333, %r11 // Store lea addresses_WT+0xf119, %rdi nop nop nop nop add $23597, %rbx mov $0x5152535455565758, %r13 movq %r13, %xmm1 movups %xmm1, (%rdi) nop nop cmp %rbx, %rbx // Faulty Load lea addresses_US+0xb059, %rcx nop nop inc %rsi mov (%rcx), %r11w lea oracles, %rsi and $0xff, %r11 shlq $12, %r11 mov (%rsi,%r11,1), %r11 pop %rsi pop %rdi pop %rcx pop %rbx pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 4, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'src': {'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'src': {'congruent': 9, 'same': True, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'src': {'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'} {'src': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'} {'00': 4470} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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/Succeed/Issue383b.agda
cruhland/agda
1,989
10139
-- Andreas, 2011-05-09 -- {-# OPTIONS -v tc.inj:40 -v tc.meta:30 #-} module Issue383b where postulate Σ : (A : Set) → (A → Set) → Set U : Set El : U → Set mutual data Ctxt : Set where _▻_ : (Γ : Ctxt) → (Env Γ → U) → Ctxt Env : Ctxt → Set Env (Γ ▻ σ) = Σ (Env Γ) λ γ → El (σ γ) postulate Δ : Ctxt σ : Env Δ → U δ : U → Env (Δ ▻ σ) data Foo : (Γ : Ctxt) → (U → Env Γ) → Set where foo : Foo _ δ -- WORKS NOW; OLD COMPLAINT: -- Agda does not solve or simplify the following constraint. Why? Env -- is constructor-headed. -- -- _40 := δ if [(Σ (Env Δ) (λ γ → El (σ γ))) =< (Env _39) : Set]
Lehrjahr_4/Modul_121/traffic_lights.adm.asm
severinkaderli/gibb
5
82368
; Ampelsteuerung JMP Start ; Skip the data table ; Daten DB 90 ; red/red DB 98 ; red/red-orange DB 84 ; red/green DB 8C ; red/green-orange DB 90 ; red/red DB D0 ; red-orange/red DB 30 ; green/red DB 70 ; green-orange/red ; Long delay Long: MOV CL,10 CALL 60 JMP After ; Middle long delay Middle: MOV CL,5 CALL 60 JMP After Start: MOV BL,02 ; Set BL to the start address of the data table Loop: MOV AL,[BL] ; Copy the data to AL OUT 01 ; Output the port 01 CMP AL,84 ; Long delay when green/red JZ Long CMP AL,30 ; Middle long delay when red/green JZ Middle After: CMP AL,70 ; Check if we are at the end of the data table JZ Start ; If yes we jump back to the start INC BL ; Else we increment to the next data table JMP Loop ; We jump to the next data table entry ; Procedure for delay ORG 60 PUSHF Wait: DEC Cl JNZ Wait POPF RET END
MyGrammar.g4
humberto-garza/stripled
0
1394
grammar MyGrammar; ////////////////////////////////////////////////////////////////// programa: SIZE CTEI CO programa_1 EOF ; programa_1: MANUAL SC programa_2 bloque | AUTOMATICO SC ; programa_2: varsS | /*epsilon*/ ; ////////////////////////////////////////////////////////////////// varsS: VAR vars_1 ; vars_1: ID vars_2 CO tipo SC vars_1 | /*epsilon*/ ; vars_2: CM ID vars_2 | /*epsilon*/ ; ////////////////////////////////////////////////////////////////// tipo: INT | FLOAT | BOOL ; ////////////////////////////////////////////////////////////////// bloque: LC bloque_1 RC ; bloque_1: estatuto bloque_1 | /*epsilon*/ ; ////////////////////////////////////////////////////////////////// estatuto: asignacion | condicion | ciclo | led_operation ; ////////////////////////////////////////////////////////////////// asignacion: ID EQ expresion SC ; ////////////////////////////////////////////////////////////////// condicion: IFC LB expresion RB bloque condicion_1 SC ; condicion_1: ELSE bloque | /*epsilon*/ ; ////////////////////////////////////////////////////////////////// ciclo: for_loop | while_loop ; for_loop: FOR LB asignfor SC expresion SC asignfor RB bloque SC ; asignfor: ID EQ exp ; while_loop: WHILE LB expresion RB bloque SC ; ////////////////////////////////////////////////////////////////// expresion: exp expresion_1 ; expresion_1: expresion_2 exp | /*epsilon*/ ; expresion_2: GT | LT | LGT ; ////////////////////////////////////////////////////////////////// exp: termino exp_1 ; exp_1: exp_2 exp | /*epsilon*/ ; exp_2: PL | MI ; ////////////////////////////////////////////////////////////////// termino: factor termino_1 ; termino_1: termino_2 termino | /*epsilon*/ ; termino_2: MU | DI ; ////////////////////////////////////////////////////////////////// factor: LB expresion RB | factor_1 var_cte ; factor_1: exp_2 | /*epsilon*/ ; ////////////////////////////////////////////////////////////////// var_cte: CTEF | CTEI | ID | CTEB ; ////////////////////////////////////////////////////////////////// led_operation: LEDS LS exp led_operation1 RS PO led_operation2 ; led_operation1: PP exp | /*epsilon*/ ; led_operation2: led_operation3 LB exp CM exp CM exp RB SC | SET_FREQ LB exp RB SC ; led_operation3: COLOR_ON | COLOR_OFF ; ////////////////////////////////////////////////////////////////// /*////////////////////TOKENS////////////////////////////////////*/ ////////////////////////////////////////////////////////////////// PROGRAM: 'program'; SIZE: 'size'; AUTOMATICO: 'AUTOMATICO'; MANUAL: 'MANUAL'; VAR: 'var'; INT: 'int'; FLOAT: 'float'; BOOL: 'bool'; IFC: 'if'; ELSE: 'else'; PRINT: 'print'; FOR: 'for'; LEDS: 'LEDS'; WHILE: 'while'; COLOR_ON: 'color_on'; COLOR_OFF: 'color_off'; SET_FREQ: 'set_freq'; CTEB: ('TRUE'|'FALSE'); ID: ('a'..'z'|'A'..'Z')(('a'..'z'|'A'..'Z')|('0'..'9'))*; SC: ';'; LS: '['; RS: ']'; CO: ':'; LC: '{'; RC: '}'; EQ: '='; CM: ','; LB: '('; RB: ')'; PO: '.'; PP: '..'; LGT: '<>'; LT: '<'; GT: '>'; PL: '+'; MI: '-'; MU: '*'; DI: '/' ; CTEF: ('0'..'9')*'.'('0'..'9')+; CTEI: ('0'..'9')+; /*Ignore all white space characters */ WS: [ ' ' | \n | \t | \r ]+ -> channel(HIDDEN);
test/por.asm
killvxk/AssemblyLine
147
99389
<gh_stars>100-1000 SECTION .text GLOBAL test test: por xmm0, xmm0 por xmm0, xmm1 por xmm0, xmm2 por xmm0, xmm3 por xmm0, xmm4 por xmm0, xmm5 por xmm0, xmm6 por xmm0, xmm7 por xmm1, xmm0 por xmm1, xmm1 por xmm1, xmm2 por xmm1, xmm3 por xmm1, xmm4 por xmm1, xmm5 por xmm1, xmm6 por xmm1, xmm7 por xmm2, xmm0 por xmm2, xmm1 por xmm2, xmm2 por xmm2, xmm3 por xmm2, xmm4 por xmm2, xmm5 por xmm2, xmm6 por xmm2, xmm7 por xmm3, xmm0 por xmm3, xmm1 por xmm3, xmm2 por xmm3, xmm3 por xmm3, xmm4 por xmm3, xmm5 por xmm3, xmm6 por xmm3, xmm7 por xmm4, xmm0 por xmm4, xmm1 por xmm4, xmm2 por xmm4, xmm3 por xmm4, xmm4 por xmm4, xmm5 por xmm4, xmm6 por xmm4, xmm7 por xmm5, xmm0 por xmm5, xmm1 por xmm5, xmm2 por xmm5, xmm3 por xmm5, xmm4 por xmm5, xmm5 por xmm5, xmm6 por xmm5, xmm7 por xmm6, xmm0 por xmm6, xmm1 por xmm6, xmm2 por xmm6, xmm3 por xmm6, xmm4 por xmm6, xmm5 por xmm6, xmm6 por xmm6, xmm7 por xmm7, xmm0 por xmm7, xmm1 por xmm7, xmm2 por xmm7, xmm3 por xmm7, xmm4 por xmm7, xmm5 por xmm7, xmm6 por xmm7, xmm7 por xmm8, xmm0 por xmm8, xmm1 por xmm8, xmm2 por xmm8, xmm3 por xmm8, xmm4 por xmm8, xmm5 por xmm8, xmm6 por xmm8, xmm7 por xmm0, xmm15 por xmm1, xmm14 por xmm2, xmm13 por xmm3, xmm12 por xmm4, xmm11 por xmm5, xmm10 por xmm6, xmm9 por xmm7, xmm8 por xmm8, xmm14
src/Prelude/String.agda
lclem/agda-prelude
0
1602
module Prelude.String where open import Agda.Primitive open import Prelude.Unit open import Prelude.Char open import Prelude.Bool open import Prelude.Nat open import Prelude.List open import Prelude.Maybe open import Prelude.Equality open import Prelude.Equality.Unsafe open import Prelude.Decidable open import Prelude.Ord open import Prelude.Function open import Prelude.Monad open import Prelude.Semiring open import Agda.Builtin.String public open import Agda.Builtin.FromString public unpackString = primStringToList packString = primStringFromList unpackString-inj : ∀ {x y} → unpackString x ≡ unpackString y → x ≡ y unpackString-inj {x} p with unpackString x unpackString-inj refl | ._ = unsafeEqual infixr 5 _&_ _&_ = primStringAppend parseNat : String → Maybe Nat parseNat = parseNat′ ∘ unpackString where pDigit : Char → Maybe Nat pDigit c = if isDigit c then just (charToNat c - charToNat '0') else nothing pNat : Nat → List Char → Maybe Nat pNat n [] = just n pNat n (c ∷ s) = pDigit c >>= λ d → pNat (n * 10 + d) s parseNat′ : List Char → Maybe Nat parseNat′ [] = nothing parseNat′ (c ∷ s) = pDigit c >>= λ d → pNat d s -- Eq -- instance EqString : Eq String _==_ {{EqString}} x y with primStringEquality x y ... | true = yes unsafeEqual ... | false = no unsafeNotEqual -- Ord -- instance OrdString : Ord String OrdString = OrdBy unpackString-inj OrdLawsString : Ord/Laws String OrdLawsString = OrdLawsBy unpackString-inj -- Overloaded literals -- instance StringIsString : IsString String IsString.Constraint StringIsString _ = ⊤ IsString.fromString StringIsString s = s ListIsString : IsString (List Char) IsString.Constraint ListIsString _ = ⊤ IsString.fromString ListIsString s = unpackString s -- Monoid -- instance open import Prelude.Monoid MonoidString : Monoid String mempty {{MonoidString}} = "" _<>_ {{MonoidString}} = primStringAppend
RavenQueryParser/QueryParser.g4
myarichuk/RavenQueryParser
2
1489
<reponame>myarichuk/RavenQueryParser<gh_stars>1-10 parser grammar QueryParser; options { tokenVocab=QueryLexer; } //note: query and patch are separate to prevent ambiguities query: projectionFunctionClause* (documentQuery | graphQuery) EOF; patch: FROM (querySourceClause | { NotifyErrorListeners(_input.Lt(-1),"Missing index or collection name after 'from' keyword", null); }) loadClause? whereClause? ( UPDATE javascriptBlock | { NotifyErrorListeners(_input.Lt(-1),"Patch queries must contain 'update' clause.",null); }) EOF; //document query documentQuery @init { IToken fromToken; } : FROM { fromToken = _input.Lt(-1); } (querySourceClause loadClause? whereClause? orderByClause? selectClause? includeClause? | loadClause? whereClause? orderByClause? selectClause? includeClause? { NotifyErrorListeners(fromToken,"Missing index or collection name after 'from' keyword", null); }); //graph query graphQuery @init { IToken matchToken; } : (nodeWithClause | edgeWithClause)* MATCH { matchToken = _input.Lt(-1); } ( ( clauseKeywords | EOF) { NotifyErrorListeners(matchToken,"Missing pattern match expression after the 'match' keyword",null); } | patternMatchClause whereClause? orderByClause? selectClause? ); nodeWithClause: WITH OPEN_CPAREN documentQuery CLOSE_CPAREN aliasClause; edgeWithClause: WITH EDGES OPEN_PAREN edgeType = IDENTIFIER CLOSE_PAREN OPEN_CPAREN whereClause orderByClause? selectClause? CLOSE_CPAREN aliasClause; edge: OPEN_BRACKET field = expression aliasClause? whereClause? (SELECT expression)? (CLOSE_BRACKET | EOF? { NotifyErrorListeners("Missing ']'"); }); node: OPEN_PAREN querySourceClause whereClause? (CLOSE_PAREN | EOF? { NotifyErrorListeners("Missing ')'"); }); patternMatchClause: node #PatternMatchSingleNodeExpression | src = patternMatchClause DASH edge ARROW_RIGHT dest = patternMatchClause #PatternMatchRightExpression | dest = patternMatchClause ARROW_LEFT edge DASH src = patternMatchClause #PatternMatchLeftExpression | lVal = patternMatchClause op = (AND | OR) rVal = patternMatchClause #PatternMatchBinaryExpression | lVal = patternMatchClause AND NOT rVal = patternMatchClause #PatternMatchAndNotExpression | OPEN_PAREN patternMatchClause CLOSE_PAREN #PatternMatchParenthesisExpression ; aliasClause: AS alias = IDENTIFIER | AS { NotifyErrorListeners(_input.Lt(-1),"Expecting identifier (alias) after 'as' keyword", null); } | alias = IDENTIFIER { NotifyErrorListeners(_input.Lt(-1),"Missing 'as' keyword", null); } ; //shared clauses/expressions querySourceClause: ALL_DOCS aliasClause? #AllDocsSource | (collection = IDENTIFIER | collectionAsString = STRING) aliasClause? #CollectionSource | INDEX indexName = STRING aliasClause? #IndexSource | INDEX aliasClause? { NotifyErrorListeners(_input.Lt(-1),"Expecting index name as quoted string after the 'index' keyword",null); } #IndexSourceMissingIndexName | aliasClause { NotifyErrorListeners(_input.Lt(-1), "Found alias clause but didn't find a query source definition. Before the alias clause, expected to find either a collection name, '@all_docs' keyword or 'index <index name>'",null); } #InvalidQuerySource ; projectionFunctionClause: DECLARE_FUNCTION { NotifyErrorListeners(_input.Lt(-1),"Found 'declare function' token but no actual function definition. Expected to see a JavaScript function definition.", null); } | DECLARE_FUNCTION (functionName = IDENTIFIER | { NotifyErrorListeners(_input.Lt(-1),"Expected to find a function name but found none", null); }) (OPEN_PAREN | { NotifyErrorListeners(_input.Lt(-1),"Missing '('", null); }) (params += IDENTIFIER ((COMMA | { NotifyErrorListeners(_input.Lt(-1),"Missing ','", null); }) params+= IDENTIFIER)*)? (CLOSE_PAREN | { NotifyErrorListeners(_input.Lt(-1),"Missing ')'", null); }) javascriptBlock ; javascriptBlock: ( OPEN_CPAREN (sourceCode = statementList)? CloseBrace | { NotifyErrorListeners(_input.Lt(-1),"Missing '{'", null); } (sourceCode = statementList)? CLOSE_CPAREN | { NotifyErrorListeners(_input.Lt(-1),"Missing '{'", null); } (sourceCode = statementList)? { NotifyErrorListeners(_input.Lt(-1),"Missing '}'", null); } | OPEN_CPAREN (sourceCode = statementList)? { NotifyErrorListeners(_input.Lt(-1),"Missing '}'", null); } ) ; identifierToLoad: identifier = expression aliasClause | identifier = expression { NotifyErrorListeners(_input.Lt(-1),"Missing alias in the form of 'AS <alias>'. In 'load' clause, identifiers to load should always have aliases defined.",null); } | aliasClause { NotifyErrorListeners(_input.Lt(-2),"Expected to see a document id before the 'as' keyword. ",null); } ; loadClause: LOAD params += identifierToLoad ((COMMA | { NotifyErrorListeners(_input.Lt(-1),"Missing ','", null); }) params+= identifierToLoad)* | LOAD { NotifyErrorListeners(_input.Lt(-1),"Expected to find document id but found ',' instead",null); } ((COMMA | { NotifyErrorListeners(_input.Lt(-1),"Missing ','", null); }) params+= identifierToLoad)+ | LOAD { NotifyErrorListeners(_input.Lt(-1),"Missing one or more document id(s) to load after the 'load' keyword",null); }; includeClause: INCLUDE expressionList | INCLUDE { NotifyErrorListeners(_input.Lt(-1),"Missing include statement after 'include' keyword",null); }; whereClause: WHERE conditionExpression | WHERE { NotifyErrorListeners(_input.Lt(-1),"Missing filter statement after 'where' keyword",null); }; orderByParam: (expression aliasClause? DESC?); orderByClause: ORDERBY orderParams += orderByParam ((COMMA | { NotifyErrorListeners(_input.Lt(-1),"Missing ','", null); }) orderParams+= orderByParam)* | ORDERBY { NotifyErrorListeners(_input.Lt(-1), "Missing ordering statement after the 'order by' keyword",null); }; selectField: expression aliasClause?; selectClause: SELECT DISTINCT? fields += selectField ((COMMA | { NotifyErrorListeners(_input.Lt(-1),"Missing ','", null); }) fields+= selectField)* | SELECT DISTINCT? { NotifyErrorListeners(_input.Lt(-1), "Missing fields in 'select' clause",null); }; //expressions queryLiteral: (TRUE | FALSE) #BooleanLiteral | LONG #LongLiteral | DOUBLE #DoubleLiteral | STRING #StringLiteral ; expressionList: params += expression (COMMA params+= expression)*; expression: queryLiteral #QueryLiteralExpression | PARAMETER #ParemeterExpression | IDENTIFIER #QueryIdentifierExpression | instance = IDENTIFIER OPEN_BRACKET CLOSE_BRACKET #CollectionReferenceExpression | instance = IDENTIFIER OPEN_BRACKET indexer = expression CLOSE_BRACKET #CollectionIndexExpression | instance = expression DOT field = expression #MemberExpression | functionName = IDENTIFIER OPEN_PAREN expressionList? CLOSE_PAREN #MethodExpression ; clauseKeywords: SELECT | WHERE | FROM | ORDERBY | LOAD | INCLUDE | MATCH | WITH | UPDATE; conditionExpression @init { IToken problematicToken; } : value = expression BETWEEN from = expression AND to = expression #BetweenConditionExpression | value = expression BETWEEN { problematicToken = _input.Lt(-1); } AND to = expression { NotifyErrorListeners(problematicToken, "Missing 'from' expression in 'between' clause",null); } #BetweenConditionExpressionMissingFrom | value = expression BETWEEN from = expression AND? { NotifyErrorListeners(_input.Lt(-1), "Missing 'to' expression in 'between' clause",null); } #BetweenConditionExpressionMissingTo | value = expression BETWEEN from = expression { problematicToken = _input.Lt(-1); } to = expression { NotifyErrorListeners(problematicToken, "Missing 'and' keyword between the two limits of the clause",null); } #BetweenConditionExpressionMissingAnd | value = expression BETWEEN { NotifyErrorListeners(_input.Lt(-1), "Invalid 'between' expression, missing the 'from' and 'to'. The correct syntax would be - 'user.Age between 20 and 30'",null); } #BetweenConditionExpressionMissingBothFromAndTo | value = expression IN queryLiteralList #InConditionExpression | value = expression ALL_IN queryLiteralList #AllInConditionExpression | value = expression { problematicToken = _input.Lt(-1); } queryLiteralList { NotifyErrorListeners(_input.Lt(-1),"Invalid 'in' or 'all in' expression, missing the keyword. The correct syntax would be - 'user.Age in (20,21,22,23)'",null); } #InConditionExpressionWithoutKeyword | value = expression ALL_IN {NotifyErrorListeners(_input.Lt(-1),"Invalid 'all in' expression, missing the comparison. The correct syntax would be - 'user.Age in (20,21,22,23)'", null); } #AllInConditionExpressionMissingComparisonSet | lval = expression (GREATER | LESSER | GREATER_EQUALS | LESSER_EQUALS | EQUALS | {NotifyErrorListeners(_input.Lt(-1),"Invalid operator '" + _input.Lt(-1).Text + "'. Expected it to be one of: '>', '<', '>=', '<=' or '='", null); }) rVal = expression #ComparisonConditionExpression | OPEN_PAREN conditionExpression (CLOSE_PAREN | { NotifyErrorListeners(_input.Lt(-1),"Missing ')'", null); }) #ParenthesisConditionExpression | functionName = IDENTIFIER OPEN_PAREN expressionList? CLOSE_PAREN #MethodConditionExpression | NOT conditionExpression #NegatedConditionExpression | lval = conditionExpression (AND | OR | { NotifyErrorListeners(_input.Lt(-1),"Invalid operator '" + _input.Lt(-1).Text + "'. Expected the operator to be either 'and' or 'or'", null); }) rVal = conditionExpression #IntersectionConditionExpression | expression expression { NotifyErrorListeners(_input.Lt(-1),"Missing an operator between '" + _input.Lt(-1).Text + "' and '" + _input.Lt(-2).Text + "'. The following operators are valid: '>', '<', '>=', '<=' or '='", null); } #MissingOperatorInConditionExpression //| expression (clauseKeywords | EOF) { NotifyErrorListeners(_input.Lt(-1),"Condition expression is incomplete. Expected to find here an expression in the form of 'x > 5'", null); } #UncompleteConditionExpression ; queryLiteralList: OPEN_PAREN params += queryLiteral ((COMMA | { NotifyErrorListeners(_input.Lt(-1),"Missing ','", null); }) params+= queryLiteral)* CLOSE_PAREN | { NotifyErrorListeners(_input.Lt(-1),"Missing '('", null); } params += queryLiteral ((COMMA | { NotifyErrorListeners(_input.Lt(-1),"Missing ','", null); }) params+= queryLiteral)* CLOSE_PAREN | OPEN_PAREN params += queryLiteral ((COMMA | { NotifyErrorListeners(_input.Lt(-1),"Missing ','", null); }) params+= queryLiteral)* { NotifyErrorListeners(_input.Lt(-1),"Missing ')'", null); } | { NotifyErrorListeners(_input.Lt(-1),"Missing '('", null); } params += queryLiteral ((COMMA | { NotifyErrorListeners(_input.Lt(-1),"Missing ','", null); }) params+= queryLiteral)* { NotifyErrorListeners(_input.Lt(-1),"Missing ')'", null); } ; queryCommaDelimitedLiteralList @init { IToken problematicToken; } : params += queryLiteral ((COMMA | { NotifyErrorListeners(_input.Lt(-1),"Missing ','", null); }) params+= queryLiteral)* | ((COMMA | { NotifyErrorListeners(_input.Lt(-1),"Missing ','", null); }) params+= queryLiteral)+ ; // JavaScript parser rules for parsing projection function /* * The MIT License (MIT) * * Copyright (c) 2014 by <NAME> (original author) and <NAME> (contributor -> ported to CSharp) * Copyright (c) 2017 by <NAME> (Positive Technologies): added ECMAScript 6 support, cleared and transformed to the universal grammar. * Copyright (c) 2018 by <NAME> (contributor -> ported to Go) * * 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. */ sourceElement : Export? statement ; statement : codeBlock | variableStatement | emptyStatement | classDeclaration | expressionStatement | ifStatement | iterationStatement | continueStatement | breakStatement | returnStatement | withStatement | labelledStatement | switchStatement | throwStatement | tryStatement | debuggerStatement | functionDeclaration ; codeBlock : OpenBrace statementList? CloseBrace ; statementList : statement+ ; variableStatement : varModifier variableDeclarationList eos ; variableDeclarationList : variableDeclaration (COMMA variableDeclaration)* ; variableDeclaration : (Identifier | arrayLiteral | objectLiteral) (EQUALS singleExpression)? // ECMAScript 6: Array & Object Matching ; emptyStatement : SemiColon ; expressionStatement : {this.notOpenBraceAndNotFunction()}? expressionSequence eos ; ifStatement : If OpenParen expressionSequence CloseParen statement (Else statement)? ; iterationStatement : Do statement While OpenParen expressionSequence CloseParen eos # DoStatement | While OpenParen expressionSequence CloseParen statement # WhileStatement | For OpenParen expressionSequence? SemiColon expressionSequence? SemiColon expressionSequence? CloseParen statement # ForStatement | For OpenParen varModifier variableDeclarationList SemiColon expressionSequence? SemiColon expressionSequence? CloseParen statement # ForVarStatement | For OpenParen singleExpression (In | Identifier{this.p("of")}?) expressionSequence CloseParen statement # ForInStatement | For OpenParen varModifier variableDeclaration (In | Identifier{this.p("of")}?) expressionSequence CloseParen statement # ForVarInStatement ; varModifier // let, const - ECMAScript 6 : Var | Let | Const ; continueStatement : Continue ({this.notLineTerminator()}? Identifier)? eos ; breakStatement : Break ({this.notLineTerminator()}? Identifier)? eos ; returnStatement : Return ({this.notLineTerminator()}? expressionSequence)? eos ; withStatement : With OpenParen expressionSequence CloseParen statement ; switchStatement : Switch OpenParen expressionSequence CloseParen casecodeBlock ; casecodeBlock : OpenBrace caseClauses? (defaultClause caseClauses?)? CloseBrace ; caseClauses : caseClause+ ; caseClause : Case expressionSequence Colon statementList? ; defaultClause : Default Colon statementList? ; labelledStatement : Identifier Colon statement ; throwStatement : Throw {this.notLineTerminator()}? expressionSequence eos ; tryStatement : Try codeBlock (catchProduction finallyProduction? | finallyProduction) ; catchProduction : Catch OpenParen Identifier CloseParen codeBlock ; finallyProduction : Finally codeBlock ; debuggerStatement : Debugger eos ; functionDeclaration : Function Identifier OpenParen formalParameterList? CloseParen OpenBrace functionBody CloseBrace ; classDeclaration : Class Identifier classTail ; classTail : (Extends singleExpression)? OpenBrace classElement* CloseBrace ; classElement : (Static | {n("static")}? Identifier)? methodDefinition | emptyStatement ; methodDefinition : propertyName OpenParen formalParameterList? CloseParen OpenBrace functionBody CloseBrace | getter OpenParen CloseParen OpenBrace functionBody CloseBrace | setter OpenParen formalParameterList? CloseParen OpenBrace functionBody CloseBrace | generatorMethod ; generatorMethod : Multiply? Identifier OpenParen formalParameterList? CloseParen OpenBrace functionBody CloseBrace ; formalParameterList : formalParameterArg (Comma formalParameterArg)* (Comma lastFormalParameterArg)? | lastFormalParameterArg | arrayLiteral // ECMAScript 6: Parameter Context Matching | objectLiteral // ECMAScript 6: Parameter Context Matching ; formalParameterArg : Identifier (Assign singleExpression)? // ECMAScript 6: Initialization ; lastFormalParameterArg // ECMAScript 6: Rest Parameter : Ellipsis Identifier ; functionBody : sourceElements? ; sourceElements : sourceElement+ ; arrayLiteral : OpenBracket Comma* elementList? Comma* CloseBracket ; elementList : singleExpression (Comma+ singleExpression)* (Comma+ lastElement)? | lastElement ; lastElement // ECMAScript 6: Spread Operator : Ellipsis Identifier ; objectLiteral : OpenBrace (propertyAssignment (Comma propertyAssignment)*)? Comma? CloseBrace ; propertyAssignment : propertyName (Colon |Assign) singleExpression # PropertyExpressionAssignment | OpenBracket singleExpression CloseBracket Colon singleExpression # ComputedPropertyExpressionAssignment | getter OpenParen CloseParen OpenBrace functionBody CloseBrace # PropertyGetter | setter OpenParen Identifier CloseParen OpenBrace functionBody CloseBrace # PropertySetter | generatorMethod # MethodProperty | Identifier # PropertyShorthand ; propertyName : identifierName | StringLiteral | numericLiteral ; arguments : OpenParen( singleExpression (Comma singleExpression)* (Comma lastArgument)? | lastArgument )?CloseParen ; lastArgument // ECMAScript 6: Spread Operator : Ellipsis Identifier ; expressionSequence : singleExpression (Comma singleExpression)* ; singleExpression : Function Identifier? OpenParen formalParameterList? CloseParen OpenBrace functionBody CloseBrace # FunctionExpression | Class Identifier? classTail # ClassExpression | singleExpression OpenBracket expressionSequence CloseBracket # JavascriptMemberIndexExpression | singleExpression Dot identifierName # JavascriptMemberDotExpression | singleExpression arguments # ArgumentsExpression | New singleExpression arguments? # NewExpression | singleExpression {this.notLineTerminator()}? PlusPlus # PostIncrementExpression | singleExpression {this.notLineTerminator()}? MinusMinus # PostDecreaseExpression | Delete singleExpression # DeleteExpression | Void singleExpression # VoidExpression | Typeof singleExpression # TypeofExpression | PlusPlus singleExpression # PreIncrementExpression | MinusMinus singleExpression # PreDecreaseExpression | Plus singleExpression # UnaryPlusExpression | Minus singleExpression # UnaryMinusExpression | BitNot singleExpression # JavascriptBitNotExpression | Not singleExpression # JavascriptNotExpression | singleExpression (Multiply | Divide | Modulus) singleExpression # MultiplicativeExpression | singleExpression (Plus | Minus) singleExpression # JavascriptAdditiveExpression | singleExpression (LeftShiftArithmetic | RightShiftArithmetic | RightShiftLogical) singleExpression # JavascriptBitShiftExpression | singleExpression (LessThan | MoreThan | LessThanEquals | GreaterThanEquals) singleExpression # JavascriptRelationalExpression | singleExpression Instanceof singleExpression # JavascriptInstanceofExpression | singleExpression In singleExpression # JavascriptInExpression | singleExpression (Equals_ | NotEquals | IdentityEquals | IdentityNotEquals) singleExpression # JavascriptEqualityExpression | singleExpression BitAnd singleExpression # BitAndExpression | singleExpression BitXOr singleExpression # BitXOrExpression | singleExpression BitOr singleExpression # BitOrExpression | singleExpression And singleExpression # JavascriptLogicalAndExpression | singleExpression Or singleExpression # JavascriptLogicalOrExpression | singleExpression QuestionMark singleExpression Colon singleExpression # TernaryExpression | singleExpression Assign singleExpression # AssignmentExpression | singleExpression assignmentOperator singleExpression # AssignmentOperatorExpression | singleExpression TemplateStringLiteral # TemplateStringExpression // ECMAScript 6 | This # ThisExpression | Identifier # JavascriptIdentifierExpression | Super # SuperExpression | literal # JavascriptLiteralExpression | arrayLiteral # JavascriptArrayLiteralExpression | objectLiteral # JavascriptObjectLiteralExpression | OpenParen expressionSequence CloseParen # JavascriptParenthesizedExpression | arrowFunctionParameters Arrow arrowFunctionBody # ArrowFunctionExpression // ECMAScript 6 ; arrowFunctionParameters : Identifier | OpenParen formalParameterList? CloseParen ; arrowFunctionBody : singleExpression | OpenBrace functionBody CloseBrace ; assignmentOperator : MultiplyAssign | DivideAssign | ModulusAssign | PlusAssign | MinusAssign | LeftShiftArithmeticAssign | RightShiftArithmeticAssign | RightShiftLogicalAssign | BitAndAssign | BitXorAssign | BitOrAssign ; literal : NullLiteral | BooleanLiteral | StringLiteral | TemplateStringLiteral | RegularExpressionLiteral | numericLiteral ; numericLiteral : DecimalLiteral | HexIntegerLiteral | OctalIntegerLiteral | OctalIntegerLiteral2 | BinaryIntegerLiteral ; identifierName : Identifier | reservedWord ; reservedWord : keyword | NullLiteral | BooleanLiteral ; keyword : Break | Do | Instanceof | Typeof | Case | Else | New | Var | Catch | Finally | Return | Void | Continue | For | Switch | While | Debugger | Function | This | With | Default | If | Throw | Delete | In | Try | Class | Enum | Extends | Super | Const | Export | Import | Implements | Let | Private | Public | Interface | Package | Protected | Static | Yield ; getter : Identifier{this.p("get")}? propertyName ; setter : Identifier{this.p("set")}? propertyName ; eos : SemiColon | EOF | {this.lineTerminatorAhead()}? | {this.closeBrace()}? ;
Exam/2017-08/P4.agda
nicolabotta/DSLsofMath
248
6104
<reponame>nicolabotta/DSLsofMath -- Problem 4: ``50 shades of continuity'' {- C(f) = ∀ c : X. Cat(f,c) Cat(f,c) = ∀ ε > 0. ∃ δ > 0. Q(f,c,ε,δ) Q(f,c,ε,δ) = ∀ x : X. abs(x - c) < δ ⇒ abs(f x - f c) < ε C'(f) = ∃ getδ : X -> RPos -> RPos. ∀ c : X. ∀ ε > 0. Q(f,c,ε,getδ c ε) 4a: Define UC(f): UC(f) = ∀ ε > 0. ∃ δ > 0. ∀ y : X. Q(f,y,ε,δ) 4b: Define UC'(f): UC'(f) = ∃ newδ : RPos -> RPos. ∀ ε > 0. ∀ y : X. Q(f,y,ε,newδ ε) The function |newδ| computes a suitable "global" |δ| from any |ε|, which shows |Q| for any |y|. 4c: Prove |∀ f : X -> ℝ. UC'(f) => C'(f)|. The proof is a function from a pair (newδ, puc) to a pair (getδ, pc). proof f (newδ, puc) = (getδ, pc) where getδ c ε = newδ ε pc c ε = puc ε c -- (1) The type of (1) is Q(f,c,ε,newδ ε) = Q(f,c,ε,getδ c ε) which is the type of |pc c ε|. ---------------- Below is a self-contained proof in Agda just to check the above. It is not part of the exam question. -} postulate R RPos : Set abs : R -> RPos _-_ : R -> R -> R _<_ : RPos -> RPos -> Set X = R -- to avoid trouble with lack of subtyping record Sigma (A : Set) (B : A -> Set) : Set where constructor _,_ field fst : A snd : B fst Q : (X -> R) -> X -> RPos -> RPos -> Set Q f c ε δ = (x : X) -> (abs( x - c) < δ) -> (abs(f x - f c) < ε) Cat : (X -> R) -> X -> Set Cat f c = (ε : RPos) -> Sigma RPos (\δ -> Q f c ε δ) C : (X -> R) -> Set C f = (c : X) -> Cat f c C' : (X -> R) -> Set C' f = Sigma (X -> RPos -> RPos) (\getδ -> (c : X) -> (ε : RPos) -> Q f c ε (getδ c ε)) UC : (X -> R) -> Set UC f = (ε : RPos) -> Sigma RPos (\δ -> (y : X) -> Q f y ε δ) UC' : (X -> R) -> Set UC' f = Sigma (RPos -> RPos) (\newδ -> (ε : RPos) -> (y : X) -> Q f y ε (newδ ε)) proof : (f : X -> R) -> UC' f -> C' f proof f (newδ , puc) = (getδ , pc) where getδ = \c -> newδ pc = \c ε -> puc ε c
pwnlib/shellcraft/templates/i386/cgc/cat.asm
DrKeineLust/pwntools
8,966
105017
<filename>pwnlib/shellcraft/templates/i386/cgc/cat.asm <% from pwnlib.shellcraft.i386.cgc import syscall %> <%page args="length, is_X, addr"/> <%docstring> Invokes the syscall allocate. For more information, see: https://github.com/CyberGrandChallenge/libcgc/blob/master/allocate.md Arguments: length(int): length is_X(int): is_X addr(int): addr </%docstring> ${syscall('SYS_allocate', length, is_X, addr)}
source/numerics/i-fortra.adb
ytomino/drake
33
10986
with System.UTF_Conversions; package body Interfaces.Fortran is use type System.UTF_Conversions.From_Status_Type; use type System.UTF_Conversions.To_Status_Type; use type System.UTF_Conversions.UCS_4; function To_Fortran ( Item : Character; Substitute : Character_Set := '?') return Character_Set is begin if Item < Character'Val (16#80#) then return Character_Set (Item); else return Substitute; end if; end To_Fortran; function To_Ada ( Item : Character_Set; Substitute : Character := '?') return Character is begin if Item < Character_Set'Val (16#80#) then return Character (Item); else return Substitute; end if; end To_Ada; function To_Fortran ( Item : String; Substitute : Fortran_Character := "?") return Fortran_Character is Result : Fortran_Character (1 .. Item'Length * Substitute'Length); Last : Natural; begin To_Fortran (Item, Result, Last, Substitute => Substitute); return Result (Result'First .. Last); end To_Fortran; function To_Ada ( Item : Fortran_Character; Substitute : String := "?") return String is pragma Unreferenced (Substitute); Expanding : constant := 2; -- Latin-1 to UTF-8 Result : String ( 1 .. Item'Length * Expanding); -- Integer'Max (Expanding, Substitute'Length) Last : Natural; begin To_Ada (Item, Result, Last, Substitute => ""); -- unreferenced return Result (Result'First .. Last); end To_Ada; procedure To_Fortran ( Item : String; Target : out Fortran_Character; Last : out Natural; Substitute : Fortran_Character := "?") is Item_Last : Natural := Item'First - 1; begin Last := Target'First - 1; while Item_Last < Item'Last loop declare Code : System.UTF_Conversions.UCS_4; From_Status : System.UTF_Conversions.From_Status_Type; begin System.UTF_Conversions.From_UTF_8 ( Item (Item_Last + 1 .. Item'Last), Item_Last, Code, From_Status); if From_Status = System.UTF_Conversions.Success and then Code < 16#100# then declare New_Last : constant Natural := Last + 1; begin if New_Last > Target'Last then raise Constraint_Error; -- overflow end if; Target (New_Last) := Character_Set'Val (Code); Last := New_Last; end; else declare New_Last : constant Natural := Last + Substitute'Length; begin if New_Last > Target'Last then raise Constraint_Error; -- overflow end if; Target (Last + 1 .. New_Last) := Substitute; Last := New_Last; end; end if; end; end loop; end To_Fortran; procedure To_Ada ( Item : Fortran_Character; Target : out String; Last : out Natural; Substitute : String := "?") is pragma Unreferenced (Substitute); Item_Last : Natural := Item'First - 1; begin Last := Target'First - 1; while Item_Last < Item'Last loop declare Code : System.UTF_Conversions.UCS_4; To_Status : System.UTF_Conversions.To_Status_Type; begin Item_Last := Item_Last + 1; Code := Character_Set'Pos (Item (Item_Last)); System.UTF_Conversions.To_UTF_8 ( Code, Target (Last + 1 .. Target'Last), Last, To_Status); if To_Status /= System.UTF_Conversions.Success then raise Constraint_Error; -- overflow end if; end; end loop; end To_Ada; end Interfaces.Fortran;
src/render-text.ads
docandrew/troodon
5
16895
<filename>src/render-text.ads with Freetype; with Render.Fonts; package Render.Text is --------------------------------------------------------------------------- -- Render a string to the current OpenGL context -- @param x X location of the text -- @param y -- @param windowW Width of the X window in pixels -- @param windowH Height of the X window in pixels -- @param fontFace (optional) Freetype font to use -- -- @TODO add color param, consider breaking this up into a separate -- function for Emoji rendering --------------------------------------------------------------------------- procedure renderGLText (s : String; x : in out Float; y : in out Float; windowW : Float; windowH : Float; fontFace : Freetype.FT_Face := Render.Fonts.face); end Render.Text;
src/isa/avx2/masm/log10_fma3.asm
jepler/aocl-libm-ose
66
85999
; ; Copyright (C) 2008-2020 Advanced Micro Devices, Inc. All rights reserved. ; ; Redistribution and use in source and binary forms, with or without modification, ; are permitted provided that the following conditions are met: ; 1. Redistributions of source code must retain the above copyright notice, ; this list of conditions and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; 3. Neither the name of the copyright holder nor the names of its contributors ; may be used to endorse or promote products derived from this software without ; specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ; IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ; INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ; OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ; POSSIBILITY OF SUCH DAMAGE. ; ; ; log10_fma3.S ; ; An implementation of the log10 libm function. ; ; Prototype: ; ; double log10(double x); ; ; ; Algorithm: ; ; Based on: ; Ping-Tak <NAME> ; "Table-driven implementation of the logarithm function in IEEE ; floating-point arithmetic" ; ACM Transactions on Mathematical Software (TOMS) ; Volume Issue,16 4 (December 1990) ; ; ; x very close to 1.0 is handled for,differently x everywhere else ; a brief explanation is given below ; ; x = (2^m)*A ; x = (2^m)*(G+g) with (1 <= G < 2) and (g <= 2^(-9)) ; x = (2^m)*2*(G/2+g/2) ; x = (2^m)*2*(F+f) with (0.5 <= F < 1) and (f <= 2^(-10)) ; ; Y = (2^(-1))*(2^(-m))*(2^m)*A ; No range,w of Y is: 0.5 <= Y < 1 ; ; F = 0100h + (first 8 mantissa bits) + (9th mantissa bit) ; No range,w of F is: 256 <= F <= 512 ; F = F / 512 ; No range,w of F is: 0.5 <= F <= 1 ; ; f = -(Y-F with,) (f <= 2^(-10)) ; ; log(x) = m*log(2) + log(2) + log(F-f) ; log(x) = m*log(2) + log(2) + log(F) + log(1-(f/F)) ; log(x) = m*log(2) + log(2*F) + log(1-r) ; ; r = (f/F with,) (r <= 2^(-9)) ; r = f*(1/F) with (1/F) precomputed to avoid division ; ; log(x) = m*log(2) + log(G) - poly ; ; log(G) is precomputed ; poly = (r + (r^2)/2 + (r^3)/3 + (r^4)/4) + (r^5)/5) + (r^6)/6)) ; ; log(2) and log(G) need to be maintained in extra precision ; to avoid losing precision in the calculations ; include fm.inc FN_PROTOTYPE_FMA3 log10 ; local variable storage offsets save_xmm6 EQU 00h stack_size EQU 028h ; We take 8 as the last nibble to allow for ; alligned data movement. fname_special TEXTEQU <_log10_special> EXTERN fname_special:PROC text SEGMENT EXECUTE ALIGN 16 PUBLIC fname fname PROC FRAME StackAllocate stack_size SaveRegsAVX xmm6,save_xmm6 .ENDPROLOG ; compute exponent part xor rax,rax vpsrlq xmm3,xmm0,52 vmovq rax,xmm0 vpsubq xmm3,xmm3,QWORD PTR L__mask_1023 vcvtdq2pd xmm6,xmm3 ; xexp replaced VCVTDQ2PD ; NaN or inf vpand xmm5,xmm0,L__real_inf vcomisd xmm5,QWORD PTR L__real_inf je L__x_is_inf_or_nan ; check for negative numbers or zero vpxor xmm5,xmm5,xmm5 vcomisd xmm0,xmm5 jbe L__x_is_zero_or_neg vpand xmm2,xmm0,L__real_mant vsubsd xmm4,xmm0,QWORD PTR L__real_one vcomisd xmm6,QWORD PTR L__mask_1023_f je L__denormal_adjust L__continue_common: ; compute index into the log tables vpand xmm1,xmm0,DWORD PTR L__mask_mant_all8 vpand xmm3,xmm0,DWORD PTR L__mask_mant9 vpsllq xmm3,xmm3,1 vpaddq xmm1,xmm3,xmm1 vmovq rax,xmm1 ; near one codepath vpand xmm4,xmm4,DWORD PTR L__real_notsign vcomisd xmm4,QWORD PTR L__real_threshold jb L__near_one ; F,Y shr rax,44 vpor xmm2,xmm2,DWORD PTR L__real_half vpor xmm1,xmm1,DWORD PTR L__real_half lea r9,DWORD PTR L__log_F_inv ; f = F - Y,r = f * inv vsubsd xmm1,xmm1,xmm2 vmulsd xmm1,xmm1,QWORD PTR [r9 + rax * 8] lea r9,DWORD PTR L__log_256_lead ; poly vmulsd xmm0,xmm1,xmm1 ; r*r vmovsd xmm3,QWORD PTR L__real_1_over_6 vmovsd xmm5,QWORD PTR L__real_1_over_3 vfmadd213sd xmm3,xmm1,QWORD PTR L__real_1_over_5 ; r*1/6 + 1/5 vfmadd213sd xmm5,xmm1,QWORD PTR L__real_1_over_2 ; 1/2+r*1/3 movsd xmm4,xmm0 ; r*r vfmadd213sd xmm3 ,xmm1,QWORD PTR L__real_1_over_4 ;1/4+(1/5*r+r*r*1/6) vmulsd xmm4,xmm0,xmm0 ; r*r*r*r vfmadd231sd xmm1,xmm5,xmm0 ; r*r*(1/2+r*1/3) + r vfmadd231sd xmm1,xmm3,xmm4 vmulsd xmm1,xmm1,QWORD PTR L__real_log10_e ; m*log(2) + log(G) - poly*log10_e vmovsd xmm5,QWORD PTR L__real_log10_2_tail vfmsub213sd xmm5,xmm6,xmm1 movsd xmm0,QWORD PTR [r9 + rax * 8] lea rdx,DWORD PTR L__log_256_tail movsd xmm2,QWORD PTR [rdx + rax * 8] vaddsd xmm2,xmm2,xmm5 vfmadd231sd xmm0,xmm6,QWORD PTR L__real_log10_2_lead vaddsd xmm0,xmm0,xmm2 RestoreRegsAVX xmm6,save_xmm6 StackDeallocate stack_size ret ALIGN 16 L__near_one: ; r = x - 1.0 vmovsd xmm2,QWORD PTR L__real_two vsubsd xmm0,xmm0,QWORD PTR L__real_one ; r vaddsd xmm2,xmm2,xmm0 vdivsd xmm1,xmm0,xmm2 ; r/(2+r) = u/2 vmovsd xmm4,QWORD PTR L__real_ca2 vmovsd xmm5,QWORD PTR L__real_ca4 vmulsd xmm6,xmm0,xmm1 ; correction vaddsd xmm1,xmm1,xmm1 ; u vmulsd xmm2,xmm1,xmm1 ; u^2 vfmadd213sd xmm4,xmm2,QWORD PTR L__real_ca1 vfmadd213sd xmm5,xmm2,QWORD PTR L__real_ca3 vmulsd xmm2,xmm2,xmm1 ; u^3 vmulsd xmm4,xmm4,xmm2 vmulsd xmm2,xmm2,xmm2 vmulsd xmm2,xmm2,xmm1 ; u^7 vmulsd xmm5,xmm5,xmm2 vaddsd xmm4,xmm4,xmm5 vsubsd xmm4,xmm4,xmm6 vpand xmm3,xmm0,QWORD PTR L__mask_lower vsubsd xmm0,xmm0,xmm3 vaddsd xmm4,xmm4,xmm0 vmulsd xmm1,xmm4,QWORD PTR L__real_log10_e_lead vmulsd xmm4,xmm4,QWORD PTR L__real_log10_e_tail vmulsd xmm0,xmm3,QWORD PTR L__real_log10_e_tail vmulsd xmm3,xmm3,QWORD PTR L__real_log10_e_lead vaddsd xmm0,xmm0,xmm4 vaddsd xmm0,xmm0,xmm1 vaddsd xmm0,xmm0,xmm3 RestoreRegsAVX xmm6,save_xmm6 StackDeallocate stack_size ret L__denormal_adjust: vpor xmm2,xmm2,QWORD PTR L__real_one vsubsd xmm2,xmm2,QWORD PTR L__real_one vpsrlq xmm5,xmm2,52 vpand xmm2,xmm2,QWORD PTR L__real_mant vmovapd xmm0,xmm2 vpsubd xmm5,xmm5,DWORD PTR L__mask_2045 vcvtdq2pd xmm6,xmm5 jmp L__continue_common ALIGN 16 L__x_is_zero_or_neg: jne L__x_is_neg vmovsd xmm1,QWORD PTR L__real_ninf mov r8d,DWORD PTR L__flag_x_zero call fname_special RestoreRegsAVX xmm6,save_xmm6 StackDeallocate stack_size ret ALIGN 16 L__x_is_neg: vmovsd xmm1,QWORD PTR L__real_neg_qnan mov r8d,DWORD PTR L__flag_x_neg call fname_special RestoreRegsAVX xmm6,save_xmm6 StackDeallocate stack_size ret ALIGN 16 L__x_is_inf_or_nan: cmp rax,QWORD PTR L__real_inf je L__finish cmp rax,QWORD PTR L__real_ninf je L__x_is_neg or rax,QWORD PTR L__real_qnanbit movd xmm1,rax mov r8d,DWORD PTR L__flag_x_nan call fname_special jmp L__finish ALIGN 16 L__finish: RestoreRegsAVX xmm6,save_xmm6 StackDeallocate stack_size ret fname endp TEXT ENDS data SEGMENT READ CONST SEGMENT ALIGN 16 ; these codes and the ones in the corresponding .c file have to match L__flag_x_zero DD 00000001 L__flag_x_neg DD 00000002 L__flag_x_nan DD 00000003 ALIGN 16 L__real_ninf DQ 00fff0000000000000h ; -inf DQ 00000000000000000h L__real_inf DQ 07ff0000000000000h ; +inf DQ 00000000000000000h L__real_neg_qnan DQ 0fff8000000000000h ; neg qNaN DQ 0000000000000000h L__real_qnan DQ 07ff8000000000000h ; qNaN DQ 00000000000000000h L__real_qnanbit DQ 00008000000000000h DQ 00000000000000000h L__real_mant DQ 0000FFFFFFFFFFFFFh ; mantissa bits DQ 00000000000000000h L__mask_1023 DQ 000000000000003ffh DQ 00000000000000000h L__mask_mant_all8 DQ 0000ff00000000000h DQ 00000000000000000h L__mask_mant9 DQ 00000080000000000h DQ 00000000000000000h L__real_log10_e DQ 03fdbcb7b1526e50eh DQ 00000000000000000h L__real_log10_e_lead DQ 03fdbcb7800000000h ; log10e_lead 4.34293746948242187500e-01 DQ 00000000000000000h L__real_log10_e_tail DQ 03ea8a93728719535h ; log10e_tail 7.3495500964015109100644e-7 DQ 00000000000000000h L__real_log10_2_lead DQ 03fd3441350000000h DQ 00000000000000000h L__real_log10_2_tail DQ 03e03ef3fde623e25h DQ 00000000000000000h L__real_two DQ 04000000000000000h ; 2 DQ 00000000000000000h L__real_one DQ 03ff0000000000000h ; 1 DQ 00000000000000000h L__real_half DQ 03fe0000000000000h ; 1/2 DQ 00000000000000000h L__mask_100 DQ 00000000000000100h DQ 00000000000000000h L__real_1_over_512 DQ 03f60000000000000h DQ 00000000000000000h L__real_1_over_2 DQ 03fe0000000000000h DQ 00000000000000000h L__real_1_over_3 DQ 03fd5555555555555h DQ 00000000000000000h L__real_1_over_4 DQ 03fd0000000000000h DQ 00000000000000000h L__real_1_over_5 DQ 03fc999999999999ah DQ 00000000000000000h L__real_1_over_6 DQ 03fc5555555555555h DQ 00000000000000000h L__mask_1023_f DQ 00c08ff80000000000h DQ 00000000000000000h L__mask_2045 DQ 000000000000007fdh DQ 00000000000000000h L__real_threshold DQ 03fb0000000000000h ; .0625 DQ 00000000000000000h L__real_notsign DQ 07ffFFFFFFFFFFFFFh ; ^sign bit DQ 00000000000000000h L__real_ca1 DQ 03fb55555555554e6h ; 8.33333333333317923934e-02 DQ 00000000000000000h L__real_ca2 DQ 03f89999999bac6d4h ; 1.25000000037717509602e-02 DQ 00000000000000000h L__real_ca3 DQ 03f62492307f1519fh ; 2.23213998791944806202e-03 DQ 00000000000000000h L__real_ca4 DQ 03f3c8034c85dfff0h ; 4.34887777707614552256e-04 DQ 00000000000000000h L__mask_lower DQ 0ffffffff00000000h DQ 00000000000000000h ALIGN 16 L__log_256_lead DQ 00000000000000000h DQ 03f5bbd9e90000000h DQ 03f6bafd470000000h DQ 03f74b99560000000h DQ 03f7b9476a0000000h DQ 03f81344da0000000h DQ 03f849b0850000000h DQ 03f87fe71c0000000h DQ 03f8b5e9080000000h DQ 03f8ebb6af0000000h DQ 03f910a83a0000000h DQ 03f92b5b5e0000000h DQ 03f945f4f50000000h DQ 03f96075300000000h DQ 03f97adc3d0000000h DQ 03f9952a4f0000000h DQ 03f9af5f920000000h DQ 03f9c97c370000000h DQ 03f9e3806a0000000h DQ 03f9fd6c5b0000000h DQ 03fa0ba01a0000000h DQ 03fa187e120000000h DQ 03fa25502c0000000h DQ 03fa32167c0000000h DQ 03fa3ed1190000000h DQ 03fa4b80180000000h DQ 03fa58238e0000000h DQ 03fa64bb910000000h DQ 03fa7148340000000h DQ 03fa7dc98c0000000h DQ 03fa8a3fad0000000h DQ 03fa96aaac0000000h DQ 03faa30a9d0000000h DQ 03faaf5f920000000h DQ 03fabba9a00000000h DQ 03fac7e8d90000000h DQ 03fad41d510000000h DQ 03fae0471a0000000h DQ 03faec66470000000h DQ 03faf87aeb0000000h DQ 03fb02428c0000000h DQ 03fb08426f0000000h DQ 03fb0e3d290000000h DQ 03fb1432c30000000h DQ 03fb1a23440000000h DQ 03fb200eb60000000h DQ 03fb25f5210000000h DQ 03fb2bd68e0000000h DQ 03fb31b3050000000h DQ 03fb378a8e0000000h DQ 03fb3d5d330000000h DQ 03fb432afa0000000h DQ 03fb48f3ed0000000h DQ 03fb4eb8120000000h DQ 03fb5477730000000h DQ 03fb5a32160000000h DQ 03fb5fe8040000000h DQ 03fb6599440000000h DQ 03fb6b45df0000000h DQ 03fb70eddb0000000h DQ 03fb7691400000000h DQ 03fb7c30160000000h DQ 03fb81ca630000000h DQ 03fb8760300000000h DQ 03fb8cf1830000000h DQ 03fb927e640000000h DQ 03fb9806d90000000h DQ 03fb9d8aea0000000h DQ 03fba30a9d0000000h DQ 03fba885fa0000000h DQ 03fbadfd070000000h DQ 03fbb36fcb0000000h DQ 03fbb8de4d0000000h DQ 03fbbe48930000000h DQ 03fbc3aea40000000h DQ 03fbc910870000000h DQ 03fbce6e410000000h DQ 03fbd3c7da0000000h DQ 03fbd91d580000000h DQ 03fbde6ec00000000h DQ 03fbe3bc1a0000000h DQ 03fbe9056b0000000h DQ 03fbee4aba0000000h DQ 03fbf38c0c0000000h DQ 03fbf8c9680000000h DQ 03fbfe02d30000000h DQ 03fc019c2a0000000h DQ 03fc0434f70000000h DQ 03fc06cbd60000000h DQ 03fc0960c80000000h DQ 03fc0bf3d00000000h DQ 03fc0e84f10000000h DQ 03fc11142f0000000h DQ 03fc13a18a0000000h DQ 03fc162d080000000h DQ 03fc18b6a90000000h DQ 03fc1b3e710000000h DQ 03fc1dc4630000000h DQ 03fc2048810000000h DQ 03fc22cace0000000h DQ 03fc254b4d0000000h DQ 03fc27c9ff0000000h DQ 03fc2a46e80000000h DQ 03fc2cc20b0000000h DQ 03fc2f3b690000000h DQ 03fc31b3050000000h DQ 03fc3428e20000000h DQ 03fc369d020000000h DQ 03fc390f680000000h DQ 03fc3b80160000000h DQ 03fc3def0e0000000h DQ 03fc405c530000000h DQ 03fc42c7e70000000h DQ 03fc4531cd0000000h DQ 03fc479a070000000h DQ 03fc4a00970000000h DQ 03fc4c65800000000h DQ 03fc4ec8c30000000h DQ 03fc512a640000000h DQ 03fc538a630000000h DQ 03fc55e8c50000000h DQ 03fc5845890000000h DQ 03fc5aa0b40000000h DQ 03fc5cfa470000000h DQ 03fc5f52440000000h DQ 03fc61a8ad0000000h DQ 03fc63fd850000000h DQ 03fc6650cd0000000h DQ 03fc68a2880000000h DQ 03fc6af2b80000000h DQ 03fc6d415e0000000h DQ 03fc6f8e7d0000000h DQ 03fc71da170000000h DQ 03fc74242e0000000h DQ 03fc766cc40000000h DQ 03fc78b3da0000000h DQ 03fc7af9730000000h DQ 03fc7d3d910000000h DQ 03fc7f80350000000h DQ 03fc81c1620000000h DQ 03fc8401190000000h DQ 03fc863f5c0000000h DQ 03fc887c2e0000000h DQ 03fc8ab7900000000h DQ 03fc8cf1830000000h DQ 03fc8f2a0a0000000h DQ 03fc9161270000000h DQ 03fc9396db0000000h DQ 03fc95cb280000000h DQ 03fc97fe100000000h DQ 03fc9a2f950000000h DQ 03fc9c5fb70000000h DQ 03fc9e8e7b0000000h DQ 03fca0bbdf0000000h DQ 03fca2e7e80000000h DQ 03fca512960000000h DQ 03fca73bea0000000h DQ 03fca963e70000000h DQ 03fcab8a8f0000000h DQ 03fcadafe20000000h DQ 03fcafd3e30000000h DQ 03fcb1f6930000000h DQ 03fcb417f40000000h DQ 03fcb638070000000h DQ 03fcb856cf0000000h DQ 03fcba744b0000000h DQ 03fcbc907f0000000h DQ 03fcbeab6c0000000h DQ 03fcc0c5130000000h DQ 03fcc2dd750000000h DQ 03fcc4f4950000000h DQ 03fcc70a740000000h DQ 03fcc91f130000000h DQ 03fccb32740000000h DQ 03fccd44980000000h DQ 03fccf55810000000h DQ 03fcd165300000000h DQ 03fcd373a60000000h DQ 03fcd580e60000000h DQ 03fcd78cf00000000h DQ 03fcd997c70000000h DQ 03fcdba16a0000000h DQ 03fcdda9dd0000000h DQ 03fcdfb11f0000000h DQ 03fce1b7330000000h DQ 03fce3bc1a0000000h DQ 03fce5bfd50000000h DQ 03fce7c2660000000h DQ 03fce9c3ce0000000h DQ 03fcebc40e0000000h DQ 03fcedc3280000000h DQ 03fcefc11d0000000h DQ 03fcf1bdee0000000h DQ 03fcf3b99d0000000h DQ 03fcf5b42a0000000h DQ 03fcf7ad980000000h DQ 03fcf9a5e70000000h DQ 03fcfb9d190000000h DQ 03fcfd932f0000000h DQ 03fcff882a0000000h DQ 03fd00be050000000h DQ 03fd01b76a0000000h DQ 03fd02b0430000000h DQ 03fd03a8910000000h DQ 03fd04a0540000000h DQ 03fd05978e0000000h DQ 03fd068e3f0000000h DQ 03fd0784670000000h DQ 03fd087a080000000h DQ 03fd096f210000000h DQ 03fd0a63b30000000h DQ 03fd0b57bf0000000h DQ 03fd0c4b450000000h DQ 03fd0d3e460000000h DQ 03fd0e30c30000000h DQ 03fd0f22bc0000000h DQ 03fd1014310000000h DQ 03fd1105240000000h DQ 03fd11f5940000000h DQ 03fd12e5830000000h DQ 03fd13d4f00000000h DQ 03fd14c3dd0000000h DQ 03fd15b24a0000000h DQ 03fd16a0370000000h DQ 03fd178da50000000h DQ 03fd187a940000000h DQ 03fd1967060000000h DQ 03fd1a52fa0000000h DQ 03fd1b3e710000000h DQ 03fd1c296c0000000h DQ 03fd1d13eb0000000h DQ 03fd1dfdef0000000h DQ 03fd1ee7770000000h DQ 03fd1fd0860000000h DQ 03fd20b91a0000000h DQ 03fd21a1350000000h DQ 03fd2288d70000000h DQ 03fd2370010000000h DQ 03fd2456b30000000h DQ 03fd253ced0000000h DQ 03fd2622b00000000h DQ 03fd2707fd0000000h DQ 03fd27ecd40000000h DQ 03fd28d1360000000h DQ 03fd29b5220000000h DQ 03fd2a989a0000000h DQ 03fd2b7b9e0000000h DQ 03fd2c5e2e0000000h DQ 03fd2d404b0000000h DQ 03fd2e21f50000000h DQ 03fd2f032c0000000h DQ 03fd2fe3f20000000h DQ 03fd30c4470000000h DQ 03fd31a42b0000000h DQ 03fd32839e0000000h DQ 03fd3362a10000000h DQ 03fd3441350000000h ALIGN 16 L__log_256_tail DQ 00000000000000000h DQ 03db20abc22b2208fh DQ 03db10f69332e0dd4h DQ 03dce950de87ed257h DQ 03dd3f3443b626d69h DQ 03df45aeaa5363e57h DQ 03dc443683ce1bf0bh DQ 03df989cd60c6a511h DQ 03dfd626f201f2e9fh DQ 03de94f8bb8dabdcdh DQ 03e0088d8ef423015h DQ 03e080413a62b79adh DQ 03e059717c0eed3c4h DQ 03dad4a77add44902h DQ 03e0e763ff037300eh DQ 03de162d74706f6c3h DQ 03e0601cc1f4dbc14h DQ 03deaf3e051f6e5bfh DQ 03e097a0b1e1af3ebh DQ 03dc0a38970c002c7h DQ 03e102e000057c751h DQ 03e155b00eecd6e0eh DQ 03ddf86297003b5afh DQ 03e1057b9b336a36dh DQ 03e134bc84a06ea4fh DQ 03e1643da9ea1bcadh DQ 03e1d66a7b4f7ea2ah DQ 03df6b2e038f7fcefh DQ 03df3e954c670f088h DQ 03e047209093acab3h DQ 03e1d708fe7275da7h DQ 03e1fdf9e7771b9e7h DQ 03e0827bfa70a0660h DQ 03e1601cc1f4dbc14h DQ 03e0637f6106a5e5bh DQ 03e126a13f17c624bh DQ 03e093eb2ce80623ah DQ 03e1430d1e91594deh DQ 03e1d6b10108fa031h DQ 03e16879c0bbaf241h DQ 03dff08015ea6bc2bh DQ 03e29b63dcdc6676ch DQ 03e2b022cbcc4ab2ch DQ 03df917d07ddd6544h DQ 03e1540605703379eh DQ 03e0cd18b947a1b60h DQ 03e17ad65277ca97eh DQ 03e11884dc59f5fa9h DQ 03e1711c46006d082h DQ 03e2f092e3c3108f8h DQ 03e1714c5e32be13ah DQ 03e26bba7fd734f9ah DQ 03dfdf48fb5e08483h DQ 03e232f9bc74d0b95h DQ 03df973e848790c13h DQ 03e1eccbc08c6586eh DQ 03e2115e9f9524a98h DQ 03e2f1740593131b8h DQ 03e1bcf8b25643835h DQ 03e1f5fa81d8bed80h DQ 03e244a4df929d9e4h DQ 03e129820d8220c94h DQ 03e2a0b489304e309h DQ 03e1f4d56aba665feh DQ 03e210c9019365163h DQ 03df80f78fe592736h DQ 03e10528825c81ccah DQ 03de095537d6d746ah DQ 03e1827bfa70a0660h DQ 03e06b0a8ec45933ch DQ 03e105af81bf5dba9h DQ 03e17e2fa2655d515h DQ 03e0d59ecbfaee4bfh DQ 03e1d8b2fda683fa3h DQ 03e24b8ddfd3a3737h DQ 03e13827e61ae1204h DQ 03e2c8c7b49e90f9fh DQ 03e29eaf01597591dh DQ 03e19aaa66e317b36h DQ 03e2e725609720655h DQ 03e261c33fc7aac54h DQ 03e29662bcf61a252h DQ 03e1843c811c42730h DQ 03e2064bb0b5acb36h DQ 03e0a340c842701a4h DQ 03e1a8e55b58f79d6h DQ 03de92d219c5e9d9ah DQ 03e3f63e60d7ffd6ah DQ 03e2e9b0ed9516314h DQ 03e2923901962350ch DQ 03e326f8838785e81h DQ 03e3b5b6a4caba6afh DQ 03df0226adc8e761ch DQ 03e3c4ad7313a1aedh DQ 03e1564e87c738d17h DQ 03e338fecf18a6618h DQ 03e3d929ef5777666h DQ 03e39483bf08da0b8h DQ 03e3bdd0eeeaa5826h DQ 03e39c4dd590237bah DQ 03e1af3e9e0ebcac7h DQ 03e35ce5382270dach DQ 03e394f74532ab9bah DQ 03e07342795888654h DQ 03e0c5a000be34bf0h DQ 03e2711c46006d082h DQ 03e250025b4ed8cf8h DQ 03e2ed18bcef2d2a0h DQ 03e21282e0c0a7554h DQ 03e0d70f33359a7cah DQ 03e2b7f7e13a84025h DQ 03e33306ec321891eh DQ 03e3fc7f8038b7550h DQ 03e3eb0358cd71d64h DQ 03e3a76c822859474h DQ 03e3d0ec652de86e3h DQ 03e2fa4cce08658afh DQ 03e3b84a2d2c00a9eh DQ 03e20a5b0f2c25bd1h DQ 03e3dd660225bf699h DQ 03e08b10f859bf037h DQ 03e3e8823b590cbe1h DQ 03e361311f31e96f6h DQ 03e2e1f875ca20f9ah DQ 03e2c95724939b9a5h DQ 03e3805957a3e58e2h DQ 03e2ff126ea9f0334h DQ 03e3953f5598e5609h DQ 03e36c16ff856c448h DQ 03e24cb220ff261f4h DQ 03e35e120d53d53a2h DQ 03e3a527f6189f256h DQ 03e3856fcffd49c0fh DQ 03e300c2e8228d7dah DQ 03df113d09444dfe0h DQ 03e2510630eea59a6h DQ 03e262e780f32d711h DQ 03ded3ed91a10f8cfh DQ 03e23654a7e4bcd85h DQ 03e055b784980ad21h DQ 03e212f2dd4b16e64h DQ 03e37c4add939f50ch DQ 03e281784627180fch DQ 03dea5162c7e14961h DQ 03e310c9019365163h DQ 03e373c4d2ba17688h DQ 03e2ae8a5e0e93d81h DQ 03e2ab0c6f01621afh DQ 03e301e8b74dd5b66h DQ 03e2d206fecbb5494h DQ 03df0b48b724fcc00h DQ 03e3f831f0b61e229h DQ 03df81a97c407bcafh DQ 03e3e286c1ccbb7aah DQ 03e28630b49220a93h DQ 03dff0b15c1a22c5ch DQ 03e355445e71c0946h DQ 03e3be630f8066d85h DQ 03e2599dff0d96c39h DQ 03e36cc85b18fb081h DQ 03e34476d001ea8c8h DQ 03e373f889e16d31fh DQ 03e3357100d792a87h DQ 03e3bd179ae6101f6h DQ 03e0ca31056c3f6e2h DQ 03e3d2870629c08fbh DQ 03e3aba3880d2673fh DQ 03e2c3633cb297da6h DQ 03e21843899efea02h DQ 03e3bccc99d2008e6h DQ 03e38000544bdd350h DQ 03e2b91c226606ae1h DQ 03e2a7adf26b62bdfh DQ 03e18764fc8826ec9h DQ 03e1f4f3de50f68f0h DQ 03df760ca757995e3h DQ 03dfc667ed3805147h DQ 03e3733f6196adf6fh DQ 03e2fb710f33e836bh DQ 03e39886eba641013h DQ 03dfb5368d0af8c1ah DQ 03e358c691b8d2971h DQ 03dfe9465226d08fbh DQ 03e33587e063f0097h DQ 03e3618e702129f18h DQ 03e361c33fc7aac54h DQ 03e3f07a68408604ah DQ 03e3c34bfe4945421h DQ 03e38b1f00e41300bh DQ 03e3f434284d61b63h DQ 03e3a63095e397436h DQ 03e34428656b919deh DQ 03e36ca9201b2d9a6h DQ 03e2738823a2a931ch DQ 03e3c11880e179230h DQ 03e313ddc8d6d52feh DQ 03e33eed58922e917h DQ 03e295992846bdd50h DQ 03e0ddb4d5f2e278bh DQ 03df1a5f12a0635c4h DQ 03e4642f0882c3c34h DQ 03e2aee9ba7f6475eh DQ 03e264b7f834a60e4h DQ 03e290d42e243792eh DQ 03e4c272008134f01h DQ 03e4a782e16d6cf5bh DQ 03e44505c79da6648h DQ 03e4ca9d4ea4dcd21h DQ 03e297d3d627cd5bch DQ 03e20b15cf9bcaa13h DQ 03e315b2063cf76ddh DQ 03e2983e6f3aa2748h DQ 03e3f4c64f4ffe994h DQ 03e46beba7ce85a0fh DQ 03e3b9c69fd4ea6b8h DQ 03e2b6aa5835fa4abh DQ 03e43ccc3790fedd1h DQ 03e29c04cc4404fe0h DQ 03e40734b7a75d89dh DQ 03e1b4404c4e01612h DQ 03e40c565c2ce4894h DQ 03e33c71441d935cdh DQ 03d72a492556b3b4eh DQ 03e20fa090341dc43h DQ 03e2e8f7009e3d9f4h DQ 03e4b1bf68b048a45h DQ 03e3eee52dffaa956h DQ 03e456b0900e465bdh DQ 03e4d929ef5777666h DQ 03e486ea28637e260h DQ 03e4665aff10ca2f0h DQ 03e2f11fdaf48ec74h DQ 03e4cbe1b86a4d1c7h DQ 03e25b05bfea87665h DQ 03e41cec20a1a4a1dh DQ 03e41cd5f0a409b9fh DQ 03e453656c8265070h DQ 03e377ed835282260h DQ 03e2417bc3040b9d2h DQ 03e408eef7b79eff2h DQ 03e4dc76f39dc57e9h DQ 03e4c0493a70cf457h DQ 03e4a83d6cea5a60ch DQ 03e30d6700dc557bah DQ 03e44c96c12e8bd0ah DQ 03e3d2c1993e32315h DQ 03e22c721135f8242h DQ 03e279a3e4dda747dh DQ 03dfcf89f6941a72bh DQ 03e2149a702f10831h DQ 03e4ead4b7c8175dbh DQ 03e4e6930fe63e70ah DQ 03e41e106bed9ee2fh DQ 03e2d682b82f11c92h DQ 03e3a07f188dba47ch DQ 03e40f9342dc172f6h DQ 03e03ef3fde623e25h ALIGN 16 L__log_F_inv DQ 04000000000000000h DQ 03fffe01fe01fe020h DQ 03fffc07f01fc07f0h DQ 03fffa11caa01fa12h DQ 03fff81f81f81f820h DQ 03fff6310aca0dbb5h DQ 03fff44659e4a4271h DQ 03fff25f644230ab5h DQ 03fff07c1f07c1f08h DQ 03ffee9c7f8458e02h DQ 03ffecc07b301ecc0h DQ 03ffeae807aba01ebh DQ 03ffe9131abf0b767h DQ 03ffe741aa59750e4h DQ 03ffe573ac901e574h DQ 03ffe3a9179dc1a73h DQ 03ffe1e1e1e1e1e1eh DQ 03ffe01e01e01e01eh DQ 03ffde5d6e3f8868ah DQ 03ffdca01dca01dcah DQ 03ffdae6076b981dbh DQ 03ffd92f2231e7f8ah DQ 03ffd77b654b82c34h DQ 03ffd5cac807572b2h DQ 03ffd41d41d41d41dh DQ 03ffd272ca3fc5b1ah DQ 03ffd0cb58f6ec074h DQ 03ffcf26e5c44bfc6h DQ 03ffcd85689039b0bh DQ 03ffcbe6d9601cbe7h DQ 03ffca4b3055ee191h DQ 03ffc8b265afb8a42h DQ 03ffc71c71c71c71ch DQ 03ffc5894d10d4986h DQ 03ffc3f8f01c3f8f0h DQ 03ffc26b5392ea01ch DQ 03ffc0e070381c0e0h DQ 03ffbf583ee868d8bh DQ 03ffbdd2b899406f7h DQ 03ffbc4fd65883e7bh DQ 03ffbacf914c1bad0h DQ 03ffb951e2b18ff23h DQ 03ffb7d6c3dda338bh DQ 03ffb65e2e3beee05h DQ 03ffb4e81b4e81b4fh DQ 03ffb37484ad806ceh DQ 03ffb2036406c80d9h DQ 03ffb094b31d922a4h DQ 03ffaf286bca1af28h DQ 03ffadbe87f94905eh DQ 03ffac5701ac5701bh DQ 03ffaaf1d2f87ebfdh DQ 03ffa98ef606a63beh DQ 03ffa82e65130e159h DQ 03ffa6d01a6d01a6dh DQ 03ffa574107688a4ah DQ 03ffa41a41a41a41ah DQ 03ffa2c2a87c51ca0h DQ 03ffa16d3f97a4b02h DQ 03ffa01a01a01a01ah DQ 03ff9ec8e951033d9h DQ 03ff9d79f176b682dh DQ 03ff9c2d14ee4a102h DQ 03ff9ae24ea5510dah DQ 03ff999999999999ah DQ 03ff9852f0d8ec0ffh DQ 03ff970e4f80cb872h DQ 03ff95cbb0be377aeh DQ 03ff948b0fcd6e9e0h DQ 03ff934c67f9b2ce6h DQ 03ff920fb49d0e229h DQ 03ff90d4f120190d5h DQ 03ff8f9c18f9c18fah DQ 03ff8e6527af1373fh DQ 03ff8d3018d3018d3h DQ 03ff8bfce8062ff3ah DQ 03ff8acb90f6bf3aah DQ 03ff899c0f601899ch DQ 03ff886e5f0abb04ah DQ 03ff87427bcc092b9h DQ 03ff8618618618618h DQ 03ff84f00c2780614h DQ 03ff83c977ab2beddh DQ 03ff82a4a0182a4a0h DQ 03ff8181818181818h DQ 03ff8060180601806h DQ 03ff7f405fd017f40h DQ 03ff7e225515a4f1dh DQ 03ff7d05f417d05f4h DQ 03ff7beb3922e017ch DQ 03ff7ad2208e0ecc3h DQ 03ff79baa6bb6398bh DQ 03ff78a4c8178a4c8h DQ 03ff77908119ac60dh DQ 03ff767dce434a9b1h DQ 03ff756cac201756dh DQ 03ff745d1745d1746h DQ 03ff734f0c541fe8dh DQ 03ff724287f46debch DQ 03ff713786d9c7c09h DQ 03ff702e05c0b8170h DQ 03ff6f26016f26017h DQ 03ff6e1f76b4337c7h DQ 03ff6d1a62681c861h DQ 03ff6c16c16c16c17h DQ 03ff6b1490aa31a3dh DQ 03ff6a13cd1537290h DQ 03ff691473a88d0c0h DQ 03ff6816816816817h DQ 03ff6719f3601671ah DQ 03ff661ec6a5122f9h DQ 03ff6524f853b4aa3h DQ 03ff642c8590b2164h DQ 03ff63356b88ac0deh DQ 03ff623fa77016240h DQ 03ff614b36831ae94h DQ 03ff6058160581606h DQ 03ff5f66434292dfch DQ 03ff5e75bb8d015e7h DQ 03ff5d867c3ece2a5h DQ 03ff5c9882b931057h DQ 03ff5babcc647fa91h DQ 03ff5ac056b015ac0h DQ 03ff59d61f123ccaah DQ 03ff58ed2308158edh DQ 03ff5805601580560h DQ 03ff571ed3c506b3ah DQ 03ff56397ba7c52e2h DQ 03ff5555555555555h DQ 03ff54725e6bb82feh DQ 03ff5390948f40febh DQ 03ff52aff56a8054bh DQ 03ff51d07eae2f815h DQ 03ff50f22e111c4c5h DQ 03ff5015015015015h DQ 03ff4f38f62dd4c9bh DQ 03ff4e5e0a72f0539h DQ 03ff4d843bedc2c4ch DQ 03ff4cab88725af6eh DQ 03ff4bd3edda68fe1h DQ 03ff4afd6a052bf5bh DQ 03ff4a27fad76014ah DQ 03ff49539e3b2d067h DQ 03ff4880522014880h DQ 03ff47ae147ae147bh DQ 03ff46dce34596066h DQ 03ff460cbc7f5cf9ah DQ 03ff453d9e2c776cah DQ 03ff446f86562d9fbh DQ 03ff43a2730abee4dh DQ 03ff42d6625d51f87h DQ 03ff420b5265e5951h DQ 03ff4141414141414h DQ 03ff40782d10e6566h DQ 03ff3fb013fb013fbh DQ 03ff3ee8f42a5af07h DQ 03ff3e22cbce4a902h DQ 03ff3d5d991aa75c6h DQ 03ff3c995a47babe7h DQ 03ff3bd60d9232955h DQ 03ff3b13b13b13b14h DQ 03ff3a524387ac822h DQ 03ff3991c2c187f63h DQ 03ff38d22d366088eh DQ 03ff3813813813814h DQ 03ff3755bd1c945eeh DQ 03ff3698df3de0748h DQ 03ff35dce5f9f2af8h DQ 03ff3521cfb2b78c1h DQ 03ff34679ace01346h DQ 03ff33ae45b57bcb2h DQ 03ff32f5ced6a1dfah DQ 03ff323e34a2b10bfh DQ 03ff3187758e9ebb6h DQ 03ff30d190130d190h DQ 03ff301c82ac40260h DQ 03ff2f684bda12f68h DQ 03ff2eb4ea1fed14bh DQ 03ff2e025c04b8097h DQ 03ff2d50a012d50a0h DQ 03ff2c9fb4d812ca0h DQ 03ff2bef98e5a3711h DQ 03ff2b404ad012b40h DQ 03ff2a91c92f3c105h DQ 03ff29e4129e4129eh DQ 03ff293725bb804a5h DQ 03ff288b01288b013h DQ 03ff27dfa38a1ce4dh DQ 03ff27350b8812735h DQ 03ff268b37cd60127h DQ 03ff25e22708092f1h DQ 03ff2539d7e9177b2h DQ 03ff2492492492492h DQ 03ff23eb79717605bh DQ 03ff23456789abcdfh DQ 03ff22a0122a0122ah DQ 03ff21fb78121fb78h DQ 03ff21579804855e6h DQ 03ff20b470c67c0d9h DQ 03ff2012012012012h DQ 03ff1f7047dc11f70h DQ 03ff1ecf43c7fb84ch DQ 03ff1e2ef3b3fb874h DQ 03ff1d8f5672e4abdh DQ 03ff1cf06ada2811dh DQ 03ff1c522fc1ce059h DQ 03ff1bb4a4046ed29h DQ 03ff1b17c67f2bae3h DQ 03ff1a7b9611a7b96h DQ 03ff19e0119e0119eh DQ 03ff19453808ca29ch DQ 03ff18ab083902bdbh DQ 03ff1811811811812h DQ 03ff1778a191bd684h DQ 03ff16e0689427379h DQ 03ff1648d50fc3201h DQ 03ff15b1e5f75270dh DQ 03ff151b9a3fdd5c9h DQ 03ff1485f0e0acd3bh DQ 03ff13f0e8d344724h DQ 03ff135c81135c811h DQ 03ff12c8b89edc0ach DQ 03ff12358e75d3033h DQ 03ff11a3019a74826h DQ 03ff1111111111111h DQ 03ff107fbbe011080h DQ 03ff0fef010fef011h DQ 03ff0f5edfab325a2h DQ 03ff0ecf56be69c90h DQ 03ff0e40655826011h DQ 03ff0db20a88f4696h DQ 03ff0d24456359e3ah DQ 03ff0c9714fbcda3bh DQ 03ff0c0a7868b4171h DQ 03ff0b7e6ec259dc8h DQ 03ff0af2f722eecb5h DQ 03ff0a6810a6810a7h DQ 03ff09ddba6af8360h DQ 03ff0953f39010954h DQ 03ff08cabb37565e2h DQ 03ff0842108421084h DQ 03ff07b9f29b8eae2h DQ 03ff073260a47f7c6h DQ 03ff06ab59c7912fbh DQ 03ff0624dd2f1a9fch DQ 03ff059eea0727586h DQ 03ff05197f7d73404h DQ 03ff04949cc1664c5h DQ 03ff0410410410410h DQ 03ff038c6b78247fch DQ 03ff03091b51f5e1ah DQ 03ff02864fc7729e9h DQ 03ff0204081020408h DQ 03ff0182436517a37h DQ 03ff0101010101010h DQ 03ff0080402010080h DQ 03ff0000000000000h DQ 00000000000000000h CONST ENDS data ENDS END
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_21829_1365.asm
ljhsiun2/medusa
9
83497
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r15 push %r8 push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x527b, %rdi nop nop and %rdx, %rdx movb $0x61, (%rdi) mfence lea addresses_D_ht+0x383b, %r14 lfence mov $0x6162636465666768, %rdx movq %rdx, (%r14) nop dec %r13 lea addresses_WC_ht+0x1e723, %rsi lea addresses_UC_ht+0xdcbb, %rdi nop nop nop nop nop inc %r8 mov $116, %rcx rep movsb nop nop nop nop dec %rcx lea addresses_D_ht+0x65b, %r8 nop nop nop nop nop sub $8444, %rdx movw $0x6162, (%r8) nop nop nop inc %r14 lea addresses_normal_ht+0x11a43, %r8 nop nop cmp $32947, %r13 vmovups (%r8), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $1, %xmm3, %r14 nop nop add $7197, %rcx lea addresses_WT_ht+0x19be3, %rdx nop nop nop nop xor %r14, %r14 mov $0x6162636465666768, %r8 movq %r8, %xmm6 vmovups %ymm6, (%rdx) nop nop nop xor $29469, %r13 lea addresses_WT_ht+0x12b3b, %rsi lea addresses_WC_ht+0x1b2d3, %rdi nop nop nop add %r13, %r13 mov $114, %rcx rep movsb nop nop nop inc %rsi lea addresses_A_ht+0x964f, %r14 nop nop xor $3917, %r8 and $0xffffffffffffffc0, %r14 movaps (%r14), %xmm7 vpextrq $1, %xmm7, %rdx nop nop and %rcx, %rcx lea addresses_WT_ht+0x19c3b, %r15 nop nop nop sub $48136, %rsi mov $0x6162636465666768, %r14 movq %r14, %xmm3 vmovups %ymm3, (%r15) nop nop nop add %rdx, %rdx lea addresses_WC_ht+0x1aebb, %rsi lea addresses_D_ht+0x1c3b, %rdi nop nop nop nop add %r15, %r15 mov $102, %rcx rep movsb nop nop nop nop nop dec %r8 pop %rsi pop %rdx pop %rdi pop %rcx pop %r8 pop %r15 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %rcx push %rdi push %rdx // Faulty Load lea addresses_WC+0xe43b, %rdi clflush (%rdi) nop nop nop nop nop inc %r12 mov (%rdi), %ecx lea oracles, %r13 and $0xff, %rcx shlq $12, %rcx mov (%r13,%rcx,1), %rcx pop %rdx pop %rdi pop %rcx pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 4, 'NT': True, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': True, 'AVXalign': False, 'congruent': 10}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 6}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 0}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': True, 'congruent': 1}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 11}} {'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 */
programs/oeis/008/A008731.asm
karttu/loda
0
27757
; A008731: Molien series for 3-dimensional group [2, n] = *22n. ; 1,0,2,1,3,2,5,3,7,5,9,7,12,9,15,12,18,15,22,18,26,22,30,26,35,30,40,35,45,40,51,45,57,51,63,57,70,63,77,70,84,77,92,84,100,92,108,100,117,108,126,117,135,126,145,135,155,145,165,155,176,165,187 add $0,5 lpb $0,1 add $1,$2 trn $1,$0 trn $0,2 add $2,1 lpe
Variables/CopyXX12ToScaled.asm
ped7g/EliteNext
9
161675
<reponame>ped7g/EliteNext<filename>Variables/CopyXX12ToScaled.asm CopyXX12ToScaled: CopyResultToScaled: ldCopyByte XX12+0,UBnkXScaled ; xnormal lo ldCopyByte XX12+2,UBnkYScaled ; ynormal lo ldCopyByte XX12+4,UBnkZScaled ; znormal lo and leaves a holding zscaled normal ret
externals/mpir-3.0.0/mpn/x86w/divexact_by3c.asm
JaminChan/eos_win
12
178945
<gh_stars>10-100 ; Copyright 2000, 2001, 2002 Free Software Foundation, Inc. ; ; This file is part of the GNU MP Library. ; ; The GNU MP 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. ; ; The GNU MP 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 the GNU MP Library; see the file COPYING.LIB. If ; not, write to the Free Software Foundation, Inc., 59 Temple Place - ; Suite 330, Boston, MA 02111-1307, USA. ; ; Translation of AT&T syntax code by <NAME> %include "x86i.inc" %define PARAM_CARRY esp+frame+16 %define PARAM_SIZE esp+frame+12 %define PARAM_SRC esp+frame+8 %define PARAM_DST esp+frame+4 %assign frame 0 ; multiplicative inverse of 3,modulo 2^32 ; ceil(b/3) and ceil(b*2/3) where b=2^32 %define INVERSE_3 0xAAAAAAAB %define ONE_THIRD_CEIL 0x55555556 %define TWO_THIRDS_CEIL 0xAAAAAAAB section .text global ___gmpn_divexact_by3c %ifdef DLL export ___gmpn_divexact_by3c %endif align 8 ___gmpn_divexact_by3c: mov ecx,[PARAM_SRC] FR_push ebp mov ebp,[PARAM_SIZE] FR_push edi mov edi,[PARAM_DST] FR_push esi mov esi,INVERSE_3 FR_push ebx lea ecx,[ecx+ebp*4] mov ebx,[PARAM_CARRY] lea edi,[edi+ebp*4] neg ebp ; eax scratch,low product ; ebx carry limb (0 to 3) ; ecx &src[size] ; edx scratch,high product ; esi multiplier ; edi &dst[size] ; ebp counter,limbs,negative align 8 Ltop: mov eax,[ecx+ebp*4] sub eax,ebx setc bl imul esi cmp eax,ONE_THIRD_CEIL mov [edi+ebp*4],eax sbb ebx,-1 ; +1 if eax>=ceil(b/3) cmp eax,TWO_THIRDS_CEIL sbb ebx,-1 ; +1 if eax>=ceil(b*2/3) inc ebp jnz Ltop mov eax,ebx pop ebx pop esi pop edi pop ebp ret end
programs/oeis/122/A122434.asm
jmorken/loda
1
20228
<reponame>jmorken/loda ; A122434: Expansion of (1+x)^3/(1+x+x^2). ; 1,2,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0,-1,1,0 mov $2,2 sub $2,$0 mov $3,-1 lpb $0 mov $0,$2 add $2,3 trn $3,33 lpe sub $0,$3 mov $1,$0
oeis/106/A106349.asm
neoneye/loda-programs
11
171252
; A106349: Primes indexed by semiprimes. ; Submitted by <NAME> ; 7,13,23,29,43,47,73,79,97,101,137,139,149,163,167,199,227,233,257,269,271,293,313,347,373,389,421,439,443,449,467,487,491,499,577,607,631,647,653,661,673,677,727,751,757,811,821,823,829,839,907,929,937,947,983,1009,1051,1061,1093,1103,1117,1181,1229,1231,1237,1259,1277,1289,1303,1307,1319,1327,1361,1367,1381,1429,1483,1489,1567,1579,1607,1609,1637,1667,1697,1709,1759,1789,1873,1879,1901,1933,1973,1979,1993,1997,1999,2011,2039,2083 seq $0,186621 ; Semiprimes - 1. seq $0,156037 ; Largest nonprime < n-th prime. add $0,1
rom_src/menu_structure.asm
zxrepo/UzixLS.zx-sizif-xxs
0
101899
<reponame>zxrepo/UzixLS.zx-sizif-xxs STRUCT MENU_T addr DW items DB height DB y_row DB y_pixel DB width DB x DB x_logo DB ENDS STRUCT MENUENTRY_T text_addr DW value_cb_addr DW callback DW reserved DW ENDS MACRO MENU_DEF width MENU_T { ($+MENU_T) (((.end-$)/MENUENTRY_T-1)) (((.end-$)/MENUENTRY_T-1)+2) ( (24-(((.end-$)/MENUENTRY_T-1)+2))/2) (((24-(((.end-$)/MENUENTRY_T-1)+2))/2)*8) (width) ( (32-width)/2) (((32-width)/2)+width-6) } ENDM menudefault: MENU_DEF 20 MENUENTRY_T str_cpu menu_clock_value_cb menu_clock_cb MENUENTRY_T str_machine menu_machine_value_cb menu_machine_cb MENUENTRY_T str_panning menu_panning_value_cb menu_panning_cb MENUENTRY_T str_joystick menu_joystick_value_cb menu_joystick_cb MENUENTRY_T str_sd menu_sd_value_cb menu_sd_cb MENUENTRY_T str_ulaplus menu_ulaplus_value_cb menu_ulaplus_cb MENUENTRY_T str_dac menu_dac_value_cb menu_dac_cb MENUENTRY_T str_exit menu_exit_value_cb menu_exit_cb MENUENTRY_T 0 .end: menu_machine_value_cb: ld ix, .values_table ld a, (cfg.machine) jp menu_value_get .values_table: DW str_machine_48_end-2 DW str_machine_128_end-2 DW str_machine_3e_end-2 DW str_machine_pentagon_end-2 menu_clock_value_cb: ld ix, .values_table ld a, (cfg.clock) jp menu_value_get .values_table: DW str_cpu_35_end-2 DW str_cpu_44_end-2 DW str_cpu_52_end-2 DW str_cpu_7_end-2 DW str_cpu_14_end-2 menu_panning_value_cb: ld ix, .values_table ld a, (cfg.panning) jp menu_value_get .values_table: DW str_panning_mono_end-2 DW str_panning_abc_end-2 DW str_panning_acb_end-2 menu_joystick_value_cb: ld ix, .values_table ld a, (cfg.joystick) jp menu_value_get .values_table: DW str_joystick_kempston_end-2 DW str_joystick_sinclair_end-2 menu_sd_value_cb: ld ix, .values_table ld a, (cfg.sd) jp menu_value_get .values_table: DW str_off_end-2 DW str_divmmc_end-2 DW str_zc3e_end-2 menu_ulaplus_value_cb: ld ix, .values_table ld a, (cfg.ulaplus) jp menu_value_get .values_table: DW str_off_end-2 DW str_on_end-2 menu_dac_value_cb: ld ix, .values_table ld a, (cfg.dac) jp menu_value_get .values_table: DW str_off_end-2 DW str_dac_covox_end-2 DW str_dac_sd_end-2 DW str_dac_covoxsd_end-2 menu_exit_value_cb: ld ix, .values_table ld a, (var_exit_reboot) jp menu_value_get .values_table: DW str_exit_no_reboot_end-2 DW str_exit_reboot_end-2 menu_value_get: sla a ld c, a ld b, 0 add ix, bc ld l, (ix+0) ld h, (ix+1) ret menu_machine_cb: ld a, (cfg.machine) ld c, 3 call menu_handle_press ld (cfg.machine), a ld bc, #02ff out (c), a ret menu_clock_cb: ld a, (cfg.clock) ld c, 3 call menu_handle_press ld (cfg.clock), a ld bc, #03ff out (c), a ret menu_panning_cb: ld a, (cfg.panning) ld c, 2 call menu_handle_press ld (cfg.panning), a ld bc, #04ff out (c), a ret menu_joystick_cb: ld a, (cfg.joystick) ld c, 1 call menu_handle_press ld (cfg.joystick), a ld bc, #07ff out (c), a ret menu_sd_cb: ld a, (cfg.sd) ld c, 2 call menu_handle_press ld (cfg.sd), a ld bc, #09ff out (c), a ret menu_ulaplus_cb: ld a, (cfg.ulaplus) ld c, 1 call menu_handle_press ld (cfg.ulaplus), a ld bc, #0aff out (c), a ret menu_dac_cb: ld a, (cfg.dac) ld c, 3 call menu_handle_press ld (cfg.dac), a ld bc, #0bff out (c), a ret menu_exit_cb: bit 4, d ; action? jr nz, .exit ld a, (var_exit_reboot) ld c, 1 call menu_handle_press ld (var_exit_reboot), a ret .exit ld a, 1 ld (var_exit_flag), a ret ; IN - A - variable to change ; IN - C - max value ; IN - D - pressed key ; OUT - A - new variable value menu_handle_press: bit 4, d ; action? jr nz, .increment bit 0, d ; right? jr nz, .increment bit 1, d ; left? jr nz, .decrement ret .increment: cp c ; if (value >= max) value = 0 jr nc, .increment_roll ; ... inc a ; else value++ ret .increment_roll: xor a ; value = 0 ret .decrement: or a ; if (value == 0) value = max jr z, .decrement_roll ; ... dec a ; else value-- ret .decrement_roll: ld a, c ; value = max ret
data/pokemon/base_stats/rapidash.asm
AtmaBuster/pokeplat-gen2
6
171403
<gh_stars>1-10 db 0 ; species ID placeholder db 65, 100, 70, 105, 80, 80 ; hp atk def spd sat sdf db FIRE, FIRE ; type db 60 ; catch rate db 192 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F50 ; gender ratio db 20 ; step cycles to hatch INCBIN "gfx/pokemon/rapidash/front.dimensions" db GROWTH_MEDIUM_FAST ; growth rate dn EGG_GROUND, EGG_GROUND ; egg groups db 70 ; happiness ; tm/hm learnset tmhm TOXIC, HIDDEN_POWER, SUNNY_DAY, HYPER_BEAM, PROTECT, FRUSTRATION, SOLARBEAM, IRON_TAIL, RETURN, DOUBLE_TEAM, FLAMETHROWER, FIRE_BLAST, FACADE, SECRET_POWER, REST, ATTRACT, OVERHEAT, ENDURE, WILL_O_WISP, GIGA_IMPACT, CAPTIVATE, SLEEP_TALK, NATURAL_GIFT, POISON_JAB, SWAGGER, SUBSTITUTE, STRENGTH, BOUNCE, HEAT_WAVE, SNORE, SWIFT ; end
source/environment/machine-pc-linux-gnu/s-envblo.adb
ytomino/drake
33
28435
with C.unistd; function System.Environment_Block return C.char_ptr_ptr is begin return C.unistd.environ; end System.Environment_Block;
libsrc/_DEVELOPMENT/adt/wv_stack/c/sccz80/wv_stack_clear.asm
teknoplop/z88dk
8
85363
<gh_stars>1-10 ; void wv_stack_clear(wv_stack_t *s) SECTION code_clib SECTION code_adt_wv_stack PUBLIC wv_stack_clear EXTERN asm_wv_stack_clear defc wv_stack_clear = asm_wv_stack_clear
oeis/319/A319433.asm
neoneye/loda-programs
11
19356
; A319433: Take Zeckendorf representation of n (A014417(n)), drop least significant bit, take inverse Zeckendorf representation. ; Submitted by <NAME> ; 1,2,2,3,3,4,5,5,6,7,7,8,8,9,10,10,11,11,12,13,13,14,15,15,16,16,17,18,18,19,20,20,21,21,22,23,23,24,24,25,26,26,27,28,28,29,29,30,31,31,32,32,33,34,34,35,36,36,37,37,38,39,39,40,41,41,42,42,43,44,44,45,45,46,47,47,48,49,49,50,50,51,52,52,53,54,54,55,55,56,57,57,58,58,59,60,60,61,62,62 add $0,3 seq $0,19446 ; a(n) = ceiling(n/tau), where tau = (1+sqrt(5))/2. sub $0,2
src/wrapper.ads
Kurinkitos/Twizy-Security
1
12990
with perception_data_h; use perception_data_h; with localization_data_h; use localization_data_h; with speed_data_h; use speed_data_h; with gpsModule; with types; use types; with Interfaces.C; use Interfaces.C; with Interfaces.C.Extensions; with Interface_utils; use Interface_utils; with converters; use converters; package Wrapper with SPARK_Mode is Initialized : Boolean := False; -- This is the big one. Once this has been set to false the value is not allowed to change -- outside of a restart. Once this is set to false the car will emergency brake -- and ignore any other commands until it is reset Safe : Boolean := True; -- Variable to cache the current speed in. -- Should be updated every time the canbus callback is run CurrentSpeed : Speed := 0.0; -- Variable to cache current position CurrentPosition : Pose_Ada; LastPerceptionTimestamp : Interfaces.C.double := 0.0; LastPositionTimestamp : Interfaces.C.double := 0.0; LastSpeedTimestamp : Interfaces.C.double := 0.0; -- TODO: Determine these in a proper way MaxPerceptionDelay : constant Interfaces.C.double := 1000.0; MaxPositionDelay : constant Interfaces.C.double := 1000.0; MaxSpeedDelay : constant Interfaces.C.double := 100.0; -- Here should any initialzation code be run procedure Init with Global => (Output => Initialized, In_Out => CurrentSpeed, Input => Safe), Convention => C, Export, External_Name => "init_ada"; procedure WaitForData with Global => (Input => (LastSpeedTimestamp, LastPositionTimestamp, LastPerceptionTimestamp)); -- Simply returns if the init function has been run or not pragma Warnings (Off, "return type of ""Is_Initialized"" is an 8-bit Ada Boolean", Reason => "Handeled by the c++ wrapper"); function Is_Initialized return Boolean with Global => (Input => Initialized), Convention => C, Export, External_Name => "is_initialized_ada"; pragma Warnings (On, "return type of ""Is_Initialized"" is an 8-bit Ada Boolean"); -- This block is the callback functions for the c++ wrapper to attatch to the ROS topics procedure Update_Perception(perception_data : in perception_obstacle_ada) with Global => (Input => (CurrentPosition, CurrentSpeed), In_Out => (Safe, LastPerceptionTimestamp)), Convention => C, Export, External_Name => "update_perception_ada"; procedure Update_GPS(localization_estimate : in localization_estimate_ada) with Global => (In_Out => (Safe, CurrentPosition, LastPositionTimestamp)), Convention => C, Export, External_Name => "update_gps_ada"; procedure Update_Speed(speed : in speed_ada) with Global => (In_Out => (Safe, CurrentSpeed, LastSpeedTimestamp)), Convention => C, Export, External_Name => "update_speed_ada", Post => ((LastSpeedTimestamp = LastSpeedTimestamp'Old) or (LastSpeedTimestamp > LastSpeedTimestamp'Old)) and (if (speed.timestamp < LastSpeedTimestamp and Convert_C_Bool(speed.valid_timestamp) and Convert_C_Bool(speed.valid_speed)) then Safe = False) and (if Convert_C_Bool(speed.valid_speed) and (speed.speed > 5.5) then Safe = False); procedure Check_Brake_Pedal(pedal_status : Interfaces.C.Extensions.bool) with Global => (In_Out => Safe), Convention => C, Export, External_Name => "check_brake_pedal_ada"; procedure CheckTimestamps(currentTime : in Interfaces.C.double) with Global => ( Input => (LastSpeedTimestamp, LastPositionTimestamp, LastPerceptionTimestamp), In_Out => Safe ), Convention => C, Export, External_Name => "check_timestamps_ada"; -- Returns whether we are safe or not -- The result is based on the last run of the callback functions -- Once it has switched to unsafe, it will not switch back without resetting pragma Warnings (Off, "return type of ""Is_Safe"" is an 8-bit Ada Boolean", Reason => "Handeled by the c++ wrapper"); function Is_Safe return Boolean with Global => (Input => Safe), Convention => C, Export, External_Name => "is_safe_ada"; pragma Warnings (On, "return type of ""Is_Safe"" is an 8-bit Ada Boolean"); end Wrapper;
oeis/021/A021896.asm
neoneye/loda-programs
11
161374
<gh_stars>10-100 ; A021896: Decimal expansion of 1/892. ; Submitted by Jon Maiga ; 0,0,1,1,2,1,0,7,6,2,3,3,1,8,3,8,5,6,5,0,2,2,4,2,1,5,2,4,6,6,3,6,7,7,1,3,0,0,4,4,8,4,3,0,4,9,3,2,7,3,5,4,2,6,0,0,8,9,6,8,6,0,9,8,6,5,4,7,0,8,5,2,0,1,7,9,3,7,2,1,9,7,3,0,9,4,1,7,0,4,0,3,5,8,7,4,4,3,9 seq $0,199685 ; a(n) = 5*10^n+1. div $0,446 mod $0,10
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3601a.ada
best08618/asylo
7
26541
-- CE3601A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT GET (FOR STRINGS AND CHARACTERS), PUT (FOR STRINGS AND -- CHARACTERS), GET_LINE, AND PUT_LINE RAISE STATUS_ERROR WHEN -- CALLED WITH AN UNOPEN FILE PARAMETER. ALSO CHECK NAMES OF FORMAL -- PARAMETERS. -- HISTORY: -- SPS 08/27/82 -- VKG 02/15/83 -- JBG 03/30/83 -- JLH 09/04/87 ADDED CASE WHICH ATTEMPTS TO CREATE FILE AND THEN -- RETESTED OBJECTIVE. WITH REPORT; USE REPORT; WITH TEXT_IO; USE TEXT_IO; PROCEDURE CE3601A IS BEGIN TEST ("CE3601A", "STATUS_ERROR RAISED BY GET, PUT, GET_LINE, " & "PUT_LINE WHEN FILE IS NOT OPEN"); DECLARE FILE1, FILE2 : FILE_TYPE; CH: CHARACTER := '%'; LST: NATURAL; ST: STRING (1 .. 10); LN : STRING (1 .. 80); BEGIN BEGIN GET (FILE => FILE1, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - GET CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET CHARACTER"); END; BEGIN GET (FILE => FILE1, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - GET STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET STRING"); END; BEGIN GET_LINE (FILE => FILE1, ITEM => LN, LAST => LST); FAILED ("STATUS_ERROR NOT RAISED - GET_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET_LINE"); END; BEGIN PUT (FILE => FILE1, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - PUT CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT CHARACTER"); END; BEGIN PUT (FILE => FILE1, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - PUT STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT STRING"); END; BEGIN PUT_LINE (FILE => FILE1, ITEM => LN); FAILED ("STATUS_ERROR NOT RAISED - PUT_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT_LINE"); END; BEGIN CREATE (FILE2, OUT_FILE); -- THIS IS ONLY AN ATTEMPT TO CLOSE (FILE2); -- CREATE A FILE. OK, WHETHER EXCEPTION -- SUCCESSFUL OR NOT. WHEN USE_ERROR => NULL; END; BEGIN GET (FILE => FILE2, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - GET CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET CHARACTER"); END; BEGIN GET (FILE => FILE2, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - GET STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET STRING"); END; BEGIN GET_LINE (FILE => FILE2, ITEM => LN, LAST => LST); FAILED ("STATUS_ERROR NOT RAISED - GET_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET_LINE"); END; BEGIN PUT (FILE => FILE2, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - PUT CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT CHARACTER"); END; BEGIN PUT (FILE => FILE2, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - PUT STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT STRING"); END; BEGIN PUT_LINE (FILE => FILE2, ITEM => LN); FAILED ("STATUS_ERROR NOT RAISED - PUT_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT_LINE"); END; END; RESULT; END CE3601A;
oeis/267/A267779.asm
neoneye/loda-programs
11
86984
<reponame>neoneye/loda-programs ; A267779: Binary representation of the n-th iteration of the "Rule 211" elementary cellular automaton starting with a single ON (black) cell. ; Submitted by <NAME>(s3) ; 1,101,11001,1111101,111111001,11111111101,1111111111001,111111111111101,11111111111111001,1111111111111111101,111111111111111111001,11111111111111111111101,1111111111111111111111001,111111111111111111111111101,11111111111111111111111111001,1111111111111111111111111111101,111111111111111111111111111111001,11111111111111111111111111111111101,1111111111111111111111111111111111001,111111111111111111111111111111111111101,11111111111111111111111111111111111111001 sub $0,1 mov $1,10 pow $1,$0 gcd $0,2 pow $1,2 div $1,9 add $1,1 mul $1,10 add $1,$0 mov $0,$1 mul $0,100 sub $0,1099
MSDOS/Virus.MSDOS.Unknown.monograf.asm
fengjixuchui/Family
3
81368
<filename>MSDOS/Virus.MSDOS.Unknown.monograf.asm ; MONOGRAF.DRV -- Lotus Driver for Graphics on Monochrome Display ; ============ ; ; (For use with Lotus 1-2-3 Version 1A) ; ; (C) Copyright <NAME>, 1985 CSEG Segment Assume CS:CSEG Org 0 Beginning dw Offset EndDriver,1,1,Offset Initialize Org 18h db "Monochrome Graphics (C) <NAME>, 1985",0 Org 40h dw 40 * 8 - 1 ; Maximum Dot Column dw 25 * 8 - 1 ; Maximum Dot Row dw 10, 7, 6, 10, 7, 6, 256 db -1 ; For one monitor Org 53h Jmp Near Ptr ClearScreen ; Call 0 -- Clear Screen Jmp Near Ptr ColorSet ; Call 1 -- Set Color Jmp Near Ptr SetAddress ; Call 2 -- Set Row/Col Addr Jmp Near Ptr DrawLine ; Call 3 -- Draw a Line Jmp Near Ptr Initialize ; Call 4 -- Write Dot (nothing) Jmp Near Ptr WriteChar ; Call 5 -- Write a Character Jmp Near Ptr DrawBlock ; Call 6 -- Draw a Block Jmp Near Ptr Initialize ; Call 7 -- Read Dot (nothing) Jmp Near Ptr Initialize ; Call 8 -- Video Reset ; Initialization Routine ; ---------------------- Initialize Proc Far Mov AX,0 ; This is standard Or AX,AX ; for all drivers Ret Initialize EndP ; Common Data Used in Routines ; ----------------------------------- CharacterRow dw ? ; from 0 to 24 CharacterCol dw ? ; from 0 to 79 ScreenAddress dw ?,0B000h ; Offset & Segment CurrentColor db ?,7 ; For Screen Output Colors db 219,219,178,177,176,219,178 ; Actually blocks ; Row and Column Conversion of AX from graphics to character ; ---------------------------------------------------------- Rounder dw 0 ; Value to add before division Divisor db ? ; Value to divide by MaxDots dw ? ; Number of dots RowConvertRnd: Mov [Rounder],4 ; Row rounding -- add 4 RowConvert: Mov [Divisor],8 ; Row normal -- divide by 8 Mov [MaxDots],200 ; 25 lines times 8 dots Jmp Short Convert ; And do generalized conversion ColConvertRnd: Mov [Rounder],2 ; Column rounding -- add 2 ColConvert: Mov [Divisor],4 ; Will divide by 4 Mov [MaxDots],320 ; 40 columns times 4 dots Convert: Cmp AX,[MaxDots] ; See if graphics value OK Jb OKToConvert ; It is if under maximum Jl Negative ; But could be negative Sub AX,[MaxDots] ; Otherwise wrap down Jmp Convert ; And check again Negative: Add AX,[MaxDots] ; Negatives wrap up Jmp Convert ; And check again OkToConvert: Add AX,[Rounder] ; Add rounding value Div [Divisor] ; Divide Cbw ; And convert to word Mov [Rounder],0 ; For next time through Ret ; Calc Offset -- DX, CX character positions in ; ----------- CalcOffset: Push AX Push DX Mov AX,80 ; Columns Per Line Mul DX ; AX now at beginning of row Add AX,CX ; Add column value Add AX,AX ; Double for attributes Mov [ScreenAddress],AX ; Save as the current address Pop DX Pop AX Ret ; Address Convert -- DX, CX row and column converted to character ; --------------- AddrConvert: Push AX Mov AX,DX ; This is graphics row Call RowConvert ; Convert to character row Mov DX,AX ; Save back in DX Mov [CharacterRow],AX ; And save value in memory Mov AX,CX ; This is graphics column Call ColConvert ; Convert to character column Mov CX,AX ; Back in CX Mov [CharacterCol],AX ; And value also saved Call CalcOffset ; Find the screen destination Pop AX Ret ; Call 0 -- Clear Screen -- AL = 0 for B&W ; ====================== -1 for Color ClearScreen Proc Far Mov AX,0B000h ; Monochrome Segment Mov ES,AX ; Set EX to it Sub DI,DI ; Start at zero Mov CX,25 * 80 ; Number of characters Mov AX,0720h ; Blanks only Cld ; Forward direction Rep Stosw ; Do it Ret ClearScreen EndP ; Call 1 -- Color Set -- AL = Color (0, 1-6) ; ------------------- ColorSet Proc Far Mov BX,Offset Colors ; Blocks for 7 colors Xlat Colors ; Translate the bytes Mov [CurrentColor],AL ; And save it Ret ColorSet EndP ; Call 2 -- Set Address -- DX = Graphics Row ; --------------------- CX = Graphics Columns SetAddress Proc Far Call AddrConvert ; One routine does it all Ret SetAddress EndP ; Call 3 -- Draw Line -- DX = End Row ; ------------------- CX = End Column DrawLine Proc Far Les DI,DWord Ptr [ScreenAddress] ; Beginning address Mov AX,[CharacterCol] ; AX now beginning column Mov BX,[CharacterRow] ; BX now beginning row Call AddrConvert ; CX,DX now ending col, row Cmp AX,CX ; See if cols are the same Je VertLine ; If so, it's vertical line Cmp BX,DX ; See if rows are the same Jne DrawLineEnd ; If not, don't draw anything HorizLine: Sub CX,AX ; Find the number of bytes Mov BX,2 ; Increment for next byte Mov AL,196 ; The horizontal line Mov AH,179 ; The vertical line Jae DrawTheLine ; If CX > AX, left to right Jmp Short ReverseLine ; Otherwise right to left VertLine: Mov CX,DX ; This is the ending column Sub CX,BX ; Subtract beginning from it Mov BX,80 * 2 ; Increment for next line Mov AL,179 ; The vertical line Mov AH,196 ; The horizontal line Jae DrawTheLine ; If CX > BX, up to down ReverseLine: Neg BX ; Reverse Increment Neg CX ; Make a positive value DrawTheLine: Inc CX ; One more byte than calced DrawLineLoop: Cmp Byte Ptr ES:[DI],197 ; See if criss-cross there Je DrawLineCont ; If so, branch around Cmp ES:[DI],AH ; See if opposite line Jne NoOverLap ; If not, skip next code Mov Byte Ptr ES:[DI],197 ; Write out criss-cross Jmp Short DrawLineCont ; And continue NoOverLap: Mov ES:[DI],AL ; Display line chararacter DrawLineCont: Add DI,BX ; Next destination Loop DrawLineLoop ; For CX repetitions DrawLineEnd: Ret DrawLine EndP ; Call 5 -- Write Character -- DX, CX = row, col; BX = count, ; ------------------------- AH = direction, AL = type Direction db ? WriteChar Proc Far Push BX ; Save count Add BX,BX ; Initialize adjustment Mov [Direction],AH ; Save direction Or AL,AL ; Branch according to type Jz WriteType0 Dec AL Jz WriteType1 Dec AL Jz WriteType2 Dec AL Jz WriteType3 WriteType4: Mov AX,4 ; Adjustment to row Jmp Short WriteCharCont WriteType3: Add BX,BX ; Center on column WriteType2: Sub AX,AX ; No adjustment to row Jmp Short WriteCharCont WriteType1: Sub BX,BX ; No adjustment on column WriteType0: Mov AX,2 ; Adjustment to row WriteCharCont: Cmp [Direction],0 ; Check the direction Jz HorizChars Sub DX,BX ; Vertical -- adjust row Sub DX,BX Sub CX,AX ; Adjust column Mov AX,80 * 2 - 1 ; Increment for writes Jmp Short DoWriteChar HorizChars: Sub DX,AX ; Horizontal -- adjust row Sub DX,AX Sub CX,BX ; Adjust column Mov AX,1 ; Increment for writes DoWriteChar: Call AddrConvert ; Convert the address Les DI,DWord Ptr [ScreenAddress] ; Get video address Cld Pop CX ; Get back character count Jcxz WriteCharEnd ; Do nothing if no characters CharacterLoop: Movsb ; Write character to display Add DI,AX ; Increment address Loop CharacterLoop ; Do it CX times WriteCharEnd: Ret WriteChar EndP ; Call 6 -- Draw Block -- BX,DX = Rows; AX,CX = Columns ; -------------------- DrawBlock Proc Far Call ColConvertRnd ; AX now first char col Xchg AX,CX ; Switch with 2nd graph col Call ColConvertRnd ; AX now 2nd char col Cmp AX,CX ; Compare two char cols Je DrawBlockEnd ; End routine if the same Ja NowDoRow ; If CX lowest, just continue Xchg AX,CX ; Otherwise switch them NowDoRow: Xchg AX,BX ; AX now 1st graph row Call RowConvertRnd ; AX now 1st char row Xchg AX,DX ; AX now 2nd graph row Call RowConvertRnd ; AX now 2nd char row Cmp AX,DX ; Compare two character columns Je DrawBlockEnd ; End routine if the same Ja BlockRowLoop ; If DX lowest, just continue Xchg AX,DX ; Otherwise switch them BlockRowLoop: Push CX ; Beginning Column Push BX ; Ending Column BlockColLoop: Call CalcOffset ; Calculate screen address Les DI,DWord Ptr [ScreenAddress] ; And set ES:DI Push Word Ptr [CurrentColor] ; Push the current color Pop ES:[DI] ; And Pop it on the screen Inc CX ; Next Column Cmp CX,BX ; Are we an end? Jb BlockColLoop ; Nope -- loop again Pop BX ; Get back beginning col Pop CX ; And the end Inc DX ; Prepare for next row Cmp DX,AX ; Are we at the end? Jb BlockRowLoop ; If not, loop DrawBlockEnd: Ret DrawBlock EndP Org $ + 16 - (($ - Beginning) Mod 16) EndDriver Label Byte CSEG EndS End 
Definition/Conversion/Consequences/Completeness.agda
Vtec234/logrel-mltt
0
10058
{-# OPTIONS --without-K --safe #-} module Definition.Conversion.Consequences.Completeness where open import Definition.Untyped open import Definition.Typed open import Definition.Conversion open import Definition.Conversion.EqRelInstance open import Definition.LogicalRelation open import Definition.LogicalRelation.Substitution open import Definition.LogicalRelation.Substitution.Escape open import Definition.LogicalRelation.Fundamental open import Tools.Product -- Algorithmic equality is derivable from judgemental equality of types. completeEq : ∀ {A B Γ} → Γ ⊢ A ≡ B → Γ ⊢ A [conv↑] B completeEq A≡B = let [Γ] , [A] , [B] , [A≡B] = fundamentalEq A≡B in escapeEqᵛ [Γ] [A] [A≡B] -- Algorithmic equality is derivable from judgemental equality of terms. completeEqTerm : ∀ {t u A Γ} → Γ ⊢ t ≡ u ∷ A → Γ ⊢ t [conv↑] u ∷ A completeEqTerm t≡u = let [Γ] , modelsTermEq [A] [t] [u] [t≡u] = fundamentalTermEq t≡u in escapeEqTermᵛ [Γ] [A] [t≡u]
wayang-commons/wayang-core/src/main/antlr4/org/apache/wayang/core/mathex/MathEx.g4
berttty/incubator-wayang
67
6195
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ grammar MathEx; options { language = Java; } expression : '(' expression ')' #parensExpression | operator=('-' | '+') expression #unaryOperation | operand0=expression operator='^' operand1=expression #binaryOperation | operand0=expression operator=('*' | '%' | '/') operand1=expression #binaryOperation | operand0=expression operator=('+' | '-') operand1=expression #binaryOperation | variableName=IDENTIFIER #variable | value=NUMBER #constant | name=IDENTIFIER '(' ( expression (',' expression )* )? ')' #function ; fragment CHAR : [a-zA-Z] ; fragment DIGIT : [0-9] ; fragment INT : [1-9] DIGIT* | DIGIT ; fragment EXP : [Ee] [+\-]? INT ; NUMBER : '-'? INT? '.' [0-9]+ EXP? // 1.35, 1.35E-9, 0.3, -4.5 | '-'? INT EXP // 1e10 -3e4 | '-'? INT // -3, 45 ; WS : [ \t\n\r]+ -> skip ; PREC0_OP : [+\-] ; PREC1_OP : [*%/] ; PREC2_OP : '^' ; IDENTIFIER : IDENTIFIER_START ( IDENTIFIER_MIDDLE* IDENTIFIER_END )? ; fragment IDENTIFIER_START : '_' | [a-zA-Z] ; fragment IDENTIFIER_MIDDLE : '_' | '.' | CHAR | DIGIT ; fragment IDENTIFIER_END : '_' | CHAR | DIGIT ;
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_687.asm
ljhsiun2/medusa
9
83111
<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_687.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r13 push %r15 push %r8 push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x17cec, %r15 clflush (%r15) nop nop nop nop add $5401, %r8 mov $0x6162636465666768, %rcx movq %rcx, %xmm5 vmovups %ymm5, (%r15) nop nop nop nop nop xor %r13, %r13 lea addresses_normal_ht+0x1d98, %rsi lea addresses_WC_ht+0x4898, %rdi nop nop nop nop sub $22632, %rbx mov $48, %rcx rep movsl nop nop nop cmp $63587, %rbx lea addresses_normal_ht+0x1ec98, %r15 nop nop and %rsi, %rsi mov $0x6162636465666768, %rcx movq %rcx, %xmm6 and $0xffffffffffffffc0, %r15 movntdq %xmm6, (%r15) nop nop nop nop nop sub $56208, %r8 lea addresses_WC_ht+0x1d9e0, %rdi clflush (%rdi) nop sub %r13, %r13 vmovups (%rdi), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $0, %xmm0, %rcx nop nop nop sub %r13, %r13 lea addresses_WT_ht+0x14a98, %rcx nop nop nop nop add %r8, %r8 mov $0x6162636465666768, %rsi movq %rsi, %xmm7 movups %xmm7, (%rcx) and $20491, %r8 lea addresses_normal_ht+0x6098, %rsi nop nop nop and $24854, %r13 movb $0x61, (%rsi) nop nop nop nop add $50200, %r15 pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %rax push %rbx push %rcx // Faulty Load lea addresses_D+0xf098, %r11 nop nop inc %rax mov (%r11), %r12d lea oracles, %rcx and $0xff, %r12 shlq $12, %r12 mov (%rcx,%r12,1), %r12 pop %rcx pop %rbx pop %rax pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}, 'dst': {'same': True, 'congruent': 11, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 6}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10}} {'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 */
compiler/template/parser/TemplateLexer.g4
jinge-design/jinge
0
834
<gh_stars>0 lexer grammar TemplateLexer; COMMENT: '<!--' .*? '-->'; TAG_OPEN: '<' -> pushMode(TAG); EXPR_START: '${' -> pushMode(EXPR); TEXT: ('\\$' | ('$' ~'{') | ~[<$])+; mode EXPR; EXPR_END: '}' -> popMode; EXPR_SEG: DOUBLE_QUOTE_STRING | SINGLE_QUOTE_STRING | EXPR_TEXT ; EXPR_TEXT: (~[`}])+; TPL_STR_START: '`' -> pushMode(TPL_STR); mode TPL_STR; TPL_STR_END: '`' -> popMode; TPL_STR_TEXT: ('\\`' | '\\$' | ~[`$] | ('$' ~'{'))+; TPL_EXPR_START: '${' -> pushMode(EXPR); mode TAG; TAG_SLASH: '/'; TAG_NAME: TAG_NameStartChar TAG_NameChar* -> pushMode(ATTR); TAG_WHITESPACE: [ \t\r\n] -> channel(HIDDEN); mode ATTR; ATTR_NAME: ATTR_NameStartChar ATTR_NameChar*; ATTR_EQUAL: '='; ATTR_VALUE: DOUBLE_QUOTE_STRING | SINGLE_QUOTE_STRING; ATTR_WHITESPACE: [ \t\r\n] -> channel(HIDDEN); ATTR_TAG_SLASH: '/'; ATTR_TAG_CLOSE: '>' -> popMode,popMode; // double popMode to DEFAULT ATTR_TAG_SLASH_CLOSE: '/' [ \t]* '>' -> popMode,popMode; // double popMode to DEFAULT fragment DOUBLE_QUOTE_STRING: '"' (ESCAPE | ~'"')* '"'; fragment SINGLE_QUOTE_STRING: '\'' (ESCAPE | ~'\'')* '\''; fragment ESCAPE : '\\"' | '\\\\' | '\\\''; fragment HEXDIGIT: [a-fA-F0-9]; fragment DIGIT: [0-9]; fragment TAG_NameStartChar: [_$a-zA-Z] | '-'; fragment TAG_NameChar: TAG_NameStartChar | DIGIT; fragment ATTR_NameStartChar: TAG_NameStartChar; fragment ATTR_NameChar: ATTR_NameStartChar | DIGIT | ':' | '.' | '|' | ',';
source/amf/mof/amf-internals-amf_uri_extents.ads
svn2github/matreshka
24
14972
<filename>source/amf/mof/amf-internals-amf_uri_extents.ads ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.CMOF.Associations; with AMF.CMOF.Classes; with AMF.Elements.Collections; with AMF.Extents; with AMF.Links.Collections; with AMF.URI_Extents; package AMF.Internals.AMF_URI_Extents is type AMF_URI_Extent is limited new AMF.URI_Extents.URI_Extent with record Id : AMF_Extent; end record; type AMF_URI_Extent_Access is access all AMF_URI_Extent'Class; --------------------------- -- Extent's operations -- --------------------------- overriding function Use_Containment (Self : not null access constant AMF_URI_Extent) return Boolean; -- When true, recursively include all elements contained by members of the -- elements(). overriding function Elements (Self : not null access constant AMF_URI_Extent) return AMF.Elements.Collections.Set_Of_Element; -- Returns a ReflectiveSequence of the elements directly referenced by this -- extent. If exclusive()==true, these elements must have -- container()==null. Extent.elements() is a reflective operation, not a -- reference between Extent and Element. See Chapter 4, “Reflection” for a -- definition of ReflectiveSequence. overriding function Elements_Of_Type (Self : not null access constant AMF_URI_Extent; The_Type : not null AMF.CMOF.Classes.CMOF_Class_Access; Include_Subtypes : Boolean) return AMF.Elements.Collections.Set_Of_Element; -- This returns those elements in the extent that are instances of the -- supplied Class. If includeSubtypes is true, then instances of any -- subclasses are also returned. overriding function Links_Of_Type (Self : not null access constant AMF_URI_Extent; The_Type : not null AMF.CMOF.Associations.CMOF_Association_Access) return AMF.Links.Collections.Set_Of_Link; -- linksOfType(type : Association) : Link[0..*] -- This returns those links in the extent that are instances of the -- supplied Association. overriding function Linked_Elements (Self : not null access constant AMF_URI_Extent; Association : not null AMF.CMOF.Associations.CMOF_Association_Access; End_Element : not null AMF.Elements.Element_Access; End_1_To_End_2_Direction : Boolean) return AMF.Elements.Collections.Set_Of_Element; -- This navigates the supplied Association from the supplied Element. The -- direction of navigation is given by the end1ToEnd2Direction parameter: -- if true, then the supplied Element is treated as the first end of the -- Association. overriding function Link_Exists (Self : not null access constant AMF_URI_Extent; Association : not null AMF.CMOF.Associations.CMOF_Association_Access; First_Element : not null AMF.Elements.Element_Access; Second_Element : not null AMF.Elements.Element_Access) return Boolean; -- This returns true if there exists at least one link for the association -- between the supplied elements at their respective ends. overriding procedure Add_Element (Self : not null access AMF_URI_Extent; Element : not null AMF.Elements.Element_Access); -- Adds an existing Element to the extent. This is a null operation if the -- Element is already in the Extent. overriding procedure Remove_Element (Self : not null access AMF_URI_Extent; Element : not null AMF.Elements.Element_Access); -- Removes the Element from the extent. It is an error if the Element is -- not a member. This may or may not result in it being deleted (see -- Section 6.3.2, “Deletion Semantics”). overriding procedure Move_Element (Self : not null access AMF_URI_Extent; Element : not null AMF.Elements.Element_Access; Target : not null access AMF.Extents.Extent'Class); -- An atomic combination of addElement and removeElement. targetExtent must -- be different from the extent on which the operation is invoked. overriding procedure Delete_Extent (Self : not null access AMF_URI_Extent); -- Deletes the Extent, but not necessarily the Elements it contains (see -- Section 6.3.2, “Deletion Semantics). ------------------------------ -- URIExtent's operations -- ------------------------------ overriding function Context_URI (Self : not null access constant AMF_URI_Extent) return League.Strings.Universal_String; -- Specifies an identifier for the extent that establishes a URI context -- for identifying elements in the extent. An extent has an identifier if a -- URI is assigned. URI is defined in IETF RFC-2396 available at -- http://www.ietf.org/rfc/rfc2396.txt. overriding function URI (Self : not null access constant AMF_URI_Extent; Element : not null access constant AMF.Elements.Abstract_Element'Class) return League.Strings.Universal_String; -- Returns the URI of the given element in the extent. Returns Null if the -- element is not in the extent. overriding function Element (Self : not null access constant AMF_URI_Extent; URI : League.Strings.Universal_String) return AMF.Elements.Element_Access; -- Returns the Element identified by the given URI in the extent. Returns -- Null if there is no element in the extent with the given URI. Note the -- Element does not (necessarily) contain a property corresponding to the -- URI. The URI identifies the element in the context of the extent. The -- same element may have a different identifier in another extent. end AMF.Internals.AMF_URI_Extents;
source/tasking/a-cuprqu.adb
ytomino/drake
33
14909
<filename>source/tasking/a-cuprqu.adb package body Ada.Containers.Unbounded_Priority_Queues is use type Implementation.Node_Access; protected body Queue is procedure Do_Dequeue (Element : out Queue_Interfaces.Element_Type); procedure Do_Dequeue (Element : out Queue_Interfaces.Element_Type) is begin Element := First.Element; First := First.Next; if First = null then Last := null; end if; Current_Length := Current_Length - 1; end Do_Dequeue; -- implementation -- overriding entry Enqueue (New_Item : Queue_Interfaces.Element_Type) when True is New_Node : constant Implementation.Node_Access := new Implementation.Node'( Element => New_Item, Next => null); begin if First = null then First := New_Node; Last := New_Node; else declare The_Priority : constant Queue_Priority := Get_Priority (New_Node.Element); Previous : Implementation.Node_Access := First; begin if Before (The_Priority, Get_Priority (Previous.Element)) then -- insert at first New_Node.Next := First; First := New_Node; else loop if Previous.Next = null then -- insert at last Last.Next := New_Node; Last := New_Node; exit; elsif Before ( The_Priority, Get_Priority (Previous.Next.Element)) then -- insert at Previous.Next New_Node.Next := Previous.Next; Previous.Next := New_Node; exit; else Previous := Previous.Next; end if; end loop; end if; end; end if; Current_Length := Current_Length + 1; if Current_Length > Peak_Length then Peak_Length := Current_Length; end if; end Enqueue; -- overriding entry Dequeue (Element : out Queue_Interfaces.Element_Type) when First /= null is begin Do_Dequeue (Element); end Dequeue; procedure Dequeue_Only_High_Priority ( At_Least : Queue_Priority; Element : in out Queue_Interfaces.Element_Type; Success : out Boolean) is begin Success := First /= null and then not Before (At_Least, Get_Priority (First.Element)); if Success then Do_Dequeue (Element); end if; end Dequeue_Only_High_Priority; -- overriding function Current_Use return Count_Type is begin return Current_Length; end Current_Use; -- overriding function Peak_Use return Count_Type is begin return Peak_Length; end Peak_Use; end Queue; end Ada.Containers.Unbounded_Priority_Queues;
Ex5.agda
clarkdm/CS410
0
8398
------------------------------------------------------------------------------ -- CS410 Exercise 5 -- -- Given the overrunning of exercise 4, I've decided to shift the deadline -- for exercise 5 back to the end of semester 2, so you can have a wee go -- in the last week of semester 1, but then focus on your CS408 projects. -- -- Exercise 6 will follow directly on from this and share the deadline, but -- it will be issued at Easter. -- -- I don't know the precise deadline, because I have not yet been told the -- mark upload deadline for the semester 2 exam board. I will give you as -- much time as I can. Usually, I can make the deadline after the last -- exam, but I haven't seen the timetable yet. -- -- It's a good idea to start well before the exams, get the basics sorted, -- then come back to it after the exams and apply polish. ------------------------------------------------------------------------------ module Ex5 where -- Conor: 1.5/15 open import CS410-Prelude open import CS410-Nat open import CS410-Vec open import CS410-Indexed open import CS410-Monoid ------------------------------------------------------------------------------ -- CHARACTERS AND STRINGS ------------------------------------------------------------------------------ {- data List (X : Set) : Set where -- X scopes over the whole declaration... [] : List X -- ...so you can use it here... _::_ : X -> List X -> List X -- ...and here. infixr 3 _::_ {-# BUILTIN BOOL Two #-} {-# BUILTIN TRUE tt #-} {-# BUILTIN FALSE ff #-} {-# BUILTIN LIST List #-} {-# BUILTIN NIL [] #-} {-# BUILTIN CONS _::_ #-} {-# COMPILED_DATA List [] [] (:) #-} postulate -- this means that we just suppose the following things exist... Char : Set String : Set {-# BUILTIN CHAR Char #-} {-# COMPILED_TYPE Char Char #-} {-# BUILTIN STRING String #-} {-# COMPILED_TYPE String String #-} primitive -- these are baked in; they even work! primCharEquality : Char -> Char -> Two primStringAppend : String -> String -> String primStringToList : String -> List Char primStringFromList : List Char -> String -} ------------------------------------------------------------------------------ -- THE TILING MONAD (from lectures) ------------------------------------------------------------------------------ WH : Set WH = Nat * Nat data Tiling (X : WH -> Set)(wh : WH) : Set where ! : X wh -> Tiling X wh joinH : (wl wr : Nat)(wq : wl +N wr == fst wh) -> Tiling X (wl , snd wh) -> Tiling X (wr , snd wh) -> Tiling X wh joinV : (ht hb : Nat)(hq : ht +N hb == snd wh) -> Tiling X (fst wh , ht) -> Tiling X (fst wh , hb) -> Tiling X wh TilingMonadIx : MonadIx Tiling TilingMonadIx = record { retIx = ! ; extendIx = help } where help : {P Q : WH -> Set} -> [ P -:> Tiling Q ] -> [ Tiling P -:> Tiling Q ] help f (! p) = f p help f (joinH wl wr wq t-l t-r) = joinH wl wr wq (help f t-l) (help f t-r) help f (joinV ht hb hq t-t t-b) = joinV ht hb hq (help f t-t) (help f t-b) -- That's the monad you'll need in this file, so let's open it. open MonadIx TilingMonadIx open FunctorIx (monadFunctorIx TilingMonadIx) ------------------------------------------------------------------------------ -- PASTE KITS ------------------------------------------------------------------------------ -- A PasteKit equips rectangular stuff with the means to stick -- things the same height side-by-side, or things the same width -- one-on-top-of-the-other record PasteKit (X : WH -> Set) : Set where field pasteH : {wh : WH}(wl wr : Nat)(wq : wl +N wr == fst wh) -> X (wl , snd wh) -> X (wr , snd wh) -> X wh pasteV : {wh : WH}(ht hb : Nat)(hq : ht +N hb == snd wh) -> X (fst wh , ht) -> X (fst wh , hb) -> X wh -- ??? 5.1 (1 mark) -- Conor: 1/1 -- Show that if you have a PasteKit for X tiles, you can turn a -- Tiling X into one big X. paste : forall {X} -> PasteKit X -> [ Tiling X -:> X ] paste {X} pk = go where open PasteKit pk go : [ Tiling X -:> X ] go (! x) = x go (joinH wl wr wq t0 t1) = pasteH wl wr wq (go t0 ) (go t1) go (joinV ht hb hq t0 t1) = pasteV ht hb hq (go t0) (go t1) ------------------------------------------------------------------------------ -- CUT KITS ------------------------------------------------------------------------------ -- A CutKit consists of functions which split a rectangular thing in two, -- horizontally or vertically. record CutKit (X : WH -> Set) : Set where field cutH : {wh : WH}(wl wr : Nat)(wq : wl +N wr == fst wh) -> X wh -> X (wl , snd wh) * X (wr , snd wh) cutV : {wh : WH}(ht hb : Nat)(hq : ht +N hb == snd wh) -> X wh -> X (fst wh , ht) * X (fst wh , hb) ------------------------------------------------------------------------------ -- MATRICES ------------------------------------------------------------------------------ Matrix : Set -> WH -> Set Matrix C (w , h) = Vec (Vec C w) h -- ??? 5.2 (2 marks) -- 0/2 -- Equip matrices with a PasteKit and a CutKit. Try to make good use of -- the operations developed for vectors. matrixPaste : {C : Set} -> PasteKit (Matrix C) matrixPaste {C} = record { pasteH = mPH ; pasteV = mPV } where mPH : {wh : WH} (wl wr : Nat) -> wl +N wr == fst wh -> Matrix C (wl , snd wh) -> Matrix C (wr , snd wh) -> Matrix C wh mPH wl wr wq ml mr = {!!} mPV : {wh : WH} (ht hb : Nat) -> ht +N hb == snd wh -> Matrix C (fst wh , ht) -> Matrix C (fst wh , hb) -> Matrix C wh mPV ht hb hq mt mb = {!vec !} matrixCut : {C : Set} -> CutKit (Matrix C) matrixCut {C} = record { cutH = mCH ; cutV = mCV } where mCH : {wh : WH} (wl wr : Nat) -> wl +N wr == fst wh -> Matrix C wh -> Matrix C (wl , snd wh) * Matrix C (wr , snd wh) mCH wl wr wq m = {!!} mCV : {wh : WH} (ht hb : Nat) -> ht +N hb == snd wh -> Matrix C wh -> Matrix C (fst wh , ht) * Matrix C (fst wh , hb) mCV ht hb hq m = {!!} --------------------------------------------------------------------------- -- COLOURS --------------------------------------------------------------------------- -- We're going to be making displays from coloured text. {- data Colour : Set where black red green yellow blue magenta cyan white : Colour {-# COMPILED_DATA Colour HaskellSetup.Colour HaskellSetup.Black HaskellSetup.Red HaskellSetup.Green HaskellSetup.Yellow HaskellSetup.Blue HaskellSetup.Magenta HaskellSetup.Cyan HaskellSetup.White #-} -} -- Each cell in a display has this information: record Cell : Set where constructor _-_/_ field fgCo : Colour -- foreground colour char : Char -- character to display in cell bgCo : Colour -- background colour -- e.g. white - '*' / black -- Now, -- Matrix Cell : WH -> Set -- is a suitable notion of sized display --------------------------------------------------------------------------- -- INTERLUDE: TESTING WITH TEXT --------------------------------------------------------------------------- -- I've written some code which should help you see what you're doing. -- Turn a list into a vector, either by truncating or padding with -- a given dummy element. paddy : {X : Set} -> X -> List X -> {n : Nat} -> Vec X n paddy _ _ {zero} = [] paddy x [] {suc n} = x :: paddy x [] {n} paddy x (y :: ys) {suc n} = y :: paddy x ys {n} -- Turn some colours and a string into a vector of cells _-_//_ : Colour -> String -> Colour -> {n : Nat} -> Vec Cell n f - s // b = vapp (vapp (vec (_-_/_ f)) (paddy ' ' (primStringToList s))) (vec b) infixr 4 _-_//_ -- Build an example matrix example1 : Matrix Cell (10 , 5) example1 = black - "hydrogen" // white :: black - "helium" // white :: black - "lithium" // white :: black - "beryllium" // white :: black - "boron" // white :: [] -- Cut it up example23 : Matrix Cell (5 , 5) * Matrix Cell (5 , 5) example23 = cutH 5 5 refl example1 where open CutKit matrixCut -- Stick the bits back together, vertically example4 : Matrix Cell (5 , 10) example4 = pasteV 5 5 refl (fst example23) (snd example23) where open PasteKit matrixPaste --------------------------------------------------------------------------- -- CUTTING UP TILINGS --------------------------------------------------------------------------- -- Previously... -- ... we established what it is to be a CutKit, and we built CutKits -- for some sorts of basic tile. Now we need to build the CutKit for -- Tilings. Let's think about what that involves for a moment. We're going -- to need a CutKit for basic tiles to stand a chance. But how do we -- cut compound tiles? -- -- Suppose we're writing cutH, and we have some -- cq : cwl + cwr == w -- the "cut widths" equation -- telling us where we want to make the cut in something of width w. -- -- v -- +--------:------+ -- | : | -- | : | -- +--cwl---:-cwr--+ -- : ^ : -- :.......w.......: -- -- The tricky part is when the tiling we're cutting here is built with -- joinH twl twr tq tl tr -- where -- tq : twl + twr == w -- the "tiling widths" equation -- -- There are three possible situations, all of which you must detect -- and handle. -- -- (i) you hit the sweet spot... -- -- v -- +--bwl---+-bwr--+ -- | | | -- | | | -- +--cwl---+-cwr--+ -- : ^ : -- :.......w.......: -- -- ...where the box is already divided in the place where the cut -- has to go. Happy days. -- -- (ii) you're cutting to the left of the join... -- -- v -- +--bwl-----+bwr-+ -- | : | | -- | : | | -- +--cwl---:-cwr--+ -- : ^ : -- :.......w.......: -- -- ...so you'll need to cut the left box in the correct place. You -- will need some evidence about widths to do that. And then you'll -- the have three pieces you can see in my diagram, so to complete -- the cut, you will need to put two of those pieces together, which -- will take more evidence. -- -- (iii) you're cutting to the right of the join... -- -- v -- +--bwl-+--bwr---+ -- | | : | -- | | : | -- +--cwl---:-cwr--+ -- : ^ : -- :.......w.......: -- -- ...so you'll need to cut the right box in the correct place, and -- reassemble the bits. -- -- HINT: The next three tasks go together. -- ??? 5.3.1 (1 mark) -- Conor: 0.5/1 -- COMPARING THE CUT POSITION data CutComparable (x x' y y' n : Nat) : Set where cutC : y == x -> CutComparable x x' y y' n -- cutL : -- cutR : -- Give three constructors for this type which characterize the three -- possibilities described above whenever -- x + x' == n and y + y' == n -- (E.g., take n to be w, x and x' to be cwl and cwr, y and y' to be -- twl and twr. But later, you'll need to do use the same tool for -- heights.) -- -- You will need to investigate what evidence must be packaged in each -- situation. On the one hand, you need to be able to *generate* the -- evidence, with cutCompare, below. On the other hand, the evidence -- must be *useful* when you come to write tilingCut, further below. -- Don't expect to know what to put here from the get-go. Figure it -- out by discovering what you *need*. -- YOUR CONSTRUCTORS GO HERE -- The following facts may come in handy. sucInject : {m n : Nat} -> suc m == suc n -> m == n sucInject refl = refl sucRespect : {m n : Nat} -> m == n -> suc m == suc n sucRespect refl = refl -- ??? 5.3.2 (1 mark) -- Conor: 0/1 -- Show that whenever you have two ways to express the same n as a sum, -- you can always deliver the CutComparable evidence. cutCompare : (x x' y y' n : Nat) -> x +N x' == n -> y +N y' == n -> CutComparable x x' y y' n cutCompare x x' y y' n xq yq = {!!} -- ??? 5.3.3 (2 marks) -- Conor: 0/2 -- A CUTKIT FOR TILINGS -- Now, show that you can construct a CutKit for Tiling X, given a CutKit -- for X. There will be key points where you get stuck for want of crucial -- information. The purpose of CutCompare is to *describe* that -- information. The purpose of cutCompare is to *compute* that information. -- Note that cutH and cutV will work out very similarly, just exchanging -- the roles of width and height. -- Hint: good solutions are likely to use "with" a lot. tilingCut : {X : WH -> Set} -> CutKit X -> CutKit (Tiling X) tilingCut {X} ck = record { cutH = cH ; cutV = cV } where open CutKit ck cH : {wh : WH}(wl wr : Nat)(wq : wl +N wr == fst wh) -> Tiling X wh -> Tiling X (wl , snd wh) * Tiling X (wr , snd wh) cH cwl cwr cq t = {!!} cV : {wh : WH}(ht hb : Nat)(hq : ht +N hb == snd wh) -> Tiling X wh -> Tiling X (fst wh , ht) * Tiling X (fst wh , hb) cV cht chb cq t = {!!} --------------------------------------------------------------------------- -- SUPERIMPOSITION --------------------------------------------------------------------------- -- ??? 5.4 (2 marks) -- Conor: 0/2 -- Suppose you have a tiling made of X tiles in front of a tiling made of -- Y tiles. Suppose you have a CutKit for Y. Suppose you know how to -- superimpose *one* X tile on a Y tiling to make a Z tiling. You should be -- able to superimpose X tilings on Y tilings to get a Z tiling: you can but -- the back Y tiling into pieces which fit with the individual X tiles in -- front. super : {X Y Z : WH -> Set} -> CutKit Y -> [ X -:> Tiling Y -:> Tiling Z ] -> [ Tiling X -:> Tiling Y -:> Tiling Z ] super {X}{Y}{Z} ck m = go where open CutKit (tilingCut ck) go : [ Tiling X -:> Tiling Y -:> Tiling Z ] go xt yt = {!!} -- HINT: no new recursive operations are needed in the rest of this file. -- You've done the hard work. Now get paid. --------------------------------------------------------------------------- -- HOLES --------------------------------------------------------------------------- -- ??? 5.5 (2 marks) -- Conor: 0/2 -- In order to build up displays in layers, we will need to work with -- tilings where one sort of primitive tile is, in fact, a hole! data HoleOr (X : WH -> Set)(wh : WH) : Set where hole : HoleOr X wh -- a hole you can see through block : X wh -> HoleOr X wh -- a block of stuff you can't see through -- Explain how to see through a hole but not through a block seeThrough : {X : WH -> Set} -> [ HoleOr X -:> Tiling (HoleOr X) -:> Tiling (HoleOr X) ] seeThrough hx thx = {!!} -- Show that if X has a CutKit, then so has HoleOr X. Cutting up holes is -- very easy as they don't put up much resistance. holeCut : {X : WH -> Set} -> CutKit X -> CutKit (HoleOr X) holeCut ck = record { cutH = {!!} ; cutV = {!!} } where open CutKit ck -- Now, a rectangular layer is a tiling whose pieces are either holes or -- blocks of coloured text. Layer : WH -> Set Layer = Tiling (HoleOr (Matrix Cell)) -- By making careful use of super and seeThrough, show how layers of a given -- size have monoid structure, where the operation combines "front" and "back" -- layers by making the back layer visible only through the holes in the front. layerId : [ Layer ] layerId = {!!} layerOp : [ Layer -:> Layer -:> Layer ] layerOp = super {!!} {!!} -- I'd ask you to prove that the monoid laws hold (they do), but when I did it, -- it was too much of a slog for too few ideas. -- A typical display is made by superimposing a bunch of layers, but you might -- still leave some holes, so we need to fill in a background. Use the MonadIx -- structure of tilings to fill in each hole in a Layer with a matrix of black -- (but who can tell?) spaces on a white background. background : [ Layer -:> Tiling (Matrix Cell) ] background = mapIx {!!} --------------------------------------------------------------------------- -- CHANGES --------------------------------------------------------------------------- -- Applications change what they display as you use them, of course. Often -- they change a little at a time, so it's not necessary to repaint the -- whole thing. Let's build tilings to represent just what changes. data Change (wh : WH) : Set where new : Layer wh -> Change wh old : Change wh -- The idea is that you make a top-level tiling to show which regions have -- changed, and for the ones with new content, you give the layer which is -- that content. So a Tiling Change tells you the difference between the -- old layer and the new layer. -- ??? 5.6 (1 mark) -- Conor: 0/1 -- You should be able to compute the changed layer given the change and the old -- layer. Hint: This, also, is a job for super. changed : [ Tiling Change -:> Layer -:> Layer ] changed = super {!!} {!!} --------------------------------------------------------------------------- -- UPDATA --------------------------------------------------------------------------- -- ??? 5.7 (3 marks) -- Conor: 0/3 -- A notion related to "Change" is "Updata", but they're subtly different: -- the actual content in a change is just the new stuff, and we've seen we -- can grab any old parts from the old layer; -- the Updata structure stores *all* the content, but each tile is tagged -- with a bit which tells you if it comes from the change or was there -- before. record Updata (wh : WH) : Set where constructor _-:_ field updated : Two -- has it changed content : HoleOr (Matrix Cell) wh -- what is it, anyway? -- Correspondingly, you should be able to generate a Tiling Updata -- from a Tiling Change and the old Layer. Work in two stages. First, -- make a thing that generates a Tiling Updata from a Layer by -- applying the same tag to all tiles. tagLayer : Two -> [ Layer -:> Tiling Updata ] tagLayer u = {!!} -- Now you should be able to generate a version of "changed" that adds tags. updata : [ Tiling Change -:> Layer -:> Tiling Updata ] updata = {!!} -- Last but not least, develop the monoid operations for Updata. Here's where -- you sort out the logic for displaying changing layers. Content-wise, it should -- be a lot like the Layer monoid, in that you can see the back stuff through -- the holes in the front stuff. But what about the "updated" tags? Is there a -- difference between an "old" hole in the front and a "new" hole in the front? -- You will need to build a CutKit in order to use super appropriately. updataId : [ Tiling Updata ] updataId = {!!} updataCut : CutKit Updata updataCut = {!!} updataOp : [ Tiling Updata -:> Tiling Updata -:> Tiling Updata ] updataOp = {!!} --------------------------------------------------------------------------- -- NEXT TIME... --------------------------------------------------------------------------- -- We'll develop a notion of "Application" which can each display -- their Layer, and respond to events by delivering a Tiling -- Change. We'll develop a notion of "Desktop" which amounts to a -- front-to-back stack of applications. The Desktop display updates -- by superimposing the Tiling Updata which comes from the change made -- by each application in the stack. -- Once we've got that setup, we can run applications by getting events -- from the keyboard, generating the Tiling Updata for the whole Desktop, -- then use cursor movement to skip the unchanged parts and just rewrite -- the regions which need it. It'll actually go!
programs/oeis/017/A017607.asm
neoneye/loda
22
80890
; A017607: (12n+7)^3. ; 343,6859,29791,79507,166375,300763,493039,753571,1092727,1520875,2048383,2685619,3442951,4330747,5359375,6539203,7880599,9393931,11089567,12977875,15069223,17373979,19902511,22665187,25672375,28934443,32461759,36264691,40353607,44738875,49430863,54439939,59776471,65450827,71473375,77854483,84604519,91733851,99252847,107171875,115501303,124251499,133432831,143055667,153130375,163667323,174676879,186169411,198155287,210644875,223648543,237176659,251239591,265847707,281011375,296740963,313046839,329939371,347428927,365525875,384240583,403583419,423564751,444194947,465484375,487443403,510082399,533411731,557441767,582182875,607645423,633839779,660776311,688465387,716917375,746142643,776151559,806954491,838561807,870983875,904231063,938313739,973242271,1009027027,1045678375,1083206683,1121622319,1160935651,1201157047,1242296875,1284365503,1327373299,1371330631,1416247867,1462135375,1509003523,1556862679,1605723211,1655595487,1706489875 mul $0,12 add $0,7 pow $0,3
main.adb
zyron92/banana_tree_generator
0
22148
with Ada.Command_Line, Ada.Text_IO, Ada.Integer_Text_IO, Parseur, Traceur_Intermediaire, Traceur_Final; use Ada.Command_Line, Ada.Text_IO, Ada.Integer_Text_IO, Parseur, Traceur_Intermediaire, Traceur_Final; procedure Main is Nombre_Sommets: Natural; --Conversion des caractères 0,1 en format boolean function Valeur_Boolean(C: in Character) return Boolean is begin case C is when '0' => return False; when '1' => return True; when others => raise Erreur_Option; end case; end Valeur_Boolean; begin if Argument_Count /= 4 then Put_Line(Standard_Error, "Utilisation : ./main Fichier_Graphe.kn Trace.svg Option[1:que trace intermediare, 2:trace_final_avec_Intermediaire, 3:trace_final_sans_Intermediare] Angle[Minimale:1/Maximale:0]"); return; end if; --Arg1 => fichier d'entrée --Arg2 => fichier de sortie --Arg3 => option --Lecture du fichier d'entrée pour identifier le nombre des sommets Lecture_En_Tete(Argument(1), Nombre_Sommets); declare G : Graphe(1..Nombre_Sommets); begin --Lecture du fichier d'entrée pour construire le graphe et remplir le tableau contenant les informations sur les sommets Lecture(Argument(1), G); --Selon les options, nous générons le tracé case Argument(3)(1) is when '1' => Generer_Trace_Intermediaire (Argument(2), (R=>0,G=>0,B=>0), "0.1", G); when '2' => Generer_Trace_Final (Argument(2), (R=>255,G=>0,B=>0), "0.1", G, True, Valeur_Boolean(Argument(4)(1))); when '3' => Generer_Trace_Final (Argument(2), (R=>255,G=>0,B=>0), "0.1", G, False, Valeur_Boolean(Argument(4)(1))); when others => raise Erreur_Option; end case; end; exception when Erreur_Lecture_Config => Put_Line(Standard_Error, "Arrêt du programme"); when Erreur_Option => Put_Line(Standard_Error, "Les arguments entrés ne sont pas valides"); end Main;
test/all_tests/test_all.adb
charlie5/aShell
11
13305
with Test_Ashell, Test_Command_Error, Test_Command_Output_To_String, Test_Environment, Test_Iterate_Directory, Test_Piped_Processes, Test_Pipeline_Error, Test_Pipeline_Output, Test_Pipe_Output_To_String, Test_Wait_On_Process, Ada.Text_IO; procedure Test_All is use Ada.Text_IO; begin Put_Line ("Begin all tests."); New_Line (2); Test_Ashell; New_Line (2); Test_Command_Error; New_Line (2); Test_Command_Output_To_String; New_Line (2); Test_Environment; New_Line (2); Test_Iterate_Directory; New_Line (2); Test_Piped_Processes; New_Line (2); Test_Pipeline_Output; New_Line (2); Test_Pipeline_Error; New_Line (2); Test_Pipe_Output_To_String; New_Line (2); Test_Wait_On_Process; New_Line (2); Put_Line ("End all tests."); end Test_All;
compiler/add.asm
mkenney/8bit-cpu
2
85210
# data is a $label plus a byte: $d1 0x1C # hex 28 $d2 0b1110 # bin 14 LDAV $d1 # set register A to 28 LDXV $d2 # set register X to 14 ADDX # add register A (always) + register X, store result in register A (always) OUTA # copy register A to the output register
3d/draw.asm
arbruijn/d1dos
2
98302
<reponame>arbruijn/d1dos ;THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX ;SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO ;END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A ;ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS ;IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS ;SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE ;FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE ;CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS ;AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. ;COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. ; ; $Source: f:/miner/source/3d/rcs/draw.asm $ ; $Revision: 1.30 $ ; $Author: matt $ ; $Date: 1995/02/15 02:26:52 $ ; ; Source for drawing routines ; ; $Log: draw.asm $ ; Revision 1.30 1995/02/15 02:26:52 matt ; Put in added handling for odd clipping error ; ; Revision 1.29 1995/02/10 16:41:41 matt ; Put in check for bad points after clip ; ; Revision 1.28 1995/02/09 22:00:52 matt ; Removed dependence on divide overflow handler; we now check for overflow ; before dividing. This fixed problems on some TI chips. ; ; Revision 1.27 1994/11/30 00:59:32 mike ; optimizations. ; ; Revision 1.26 1994/10/03 12:52:04 matt ; Fixed typo ; ; Revision 1.25 1994/10/03 12:49:56 matt ; Took out unused routines & data ; ; Revision 1.24 1994/07/24 23:59:34 matt ; Made 3d no longer deal with point numbers, but only with pointers. ; ; Revision 1.23 1994/05/30 11:36:26 matt ; Added g3_set_special_render() to allow a user to specify functions to ; call for 2d draws. ; ; Revision 1.22 1994/05/19 21:46:13 matt ; Moved texture lighting out of 3d and into the game ; ; Revision 1.21 1994/05/13 17:06:18 matt ; Finished ripping out intersected side lighting code ; ; Revision 1.20 1994/05/13 17:02:58 matt ; Took our special side lighting code ; ; Revision 1.19 1994/04/19 18:45:19 matt ; Now call the clipped disk, which it should have done all along, but ; John had only implemented the unclipped disk, and it clipped anyway. ; ; Revision 1.18 1994/04/19 18:26:42 matt ; Added g3_draw_sphere() function. ; ; Revision 1.17 1994/04/19 17:03:40 matt ; For polygons, call the texture-mapper's flat shader ; ; Revision 1.16 1994/03/18 15:58:37 matt ; Fixed bug that caused light vals to be screwed up ; ; Revision 1.15 1994/03/14 12:37:31 matt ; Made draw routines check for rotated points ; ; Revision 1.14 1994/02/10 18:00:39 matt ; Changed 'if DEBUG_ON' to 'ifndef NDEBUG' ; ; Revision 1.13 1994/02/09 11:48:16 matt ; Changes return codes for drawing functions ; ; Revision 1.12 1994/02/01 13:23:05 matt ; Added use_beam var to turn off beam lighting ; ; Revision 1.11 1994/01/26 20:27:18 mike ; bright light on very near side. ; ; Revision 1.10 1994/01/26 12:49:26 matt ; Made lighting computation a seperate function, g3_compute_lighting_value. ; Note the unwieldy function name, courtesy of Mike. ; ; Revision 1.9 1994/01/25 16:38:02 yuan ; Fixed beam_brightness ; ; Revision 1.8 1994/01/24 11:08:49 matt ; Added beam_brightness variable ; ; Revision 1.7 1994/01/22 18:22:09 matt ; New lighting stuff now done in 3d; g3_draw_tmap() takes lighting parm ; ; Revision 1.6 1993/12/05 23:47:14 matt ; Added function g3_draw_line_ptrs() ; ; Revision 1.5 1993/11/22 10:51:29 matt ; Changed texture map function comments to reflect uvl (not just uv) struct ; ; Revision 1.4 1993/11/17 10:40:02 matt ; Added check for zero-length normal in do_facing_check ; ; Revision 1.3 1993/11/04 18:49:14 matt ; Added system to only rotate points once per frame ; ; Revision 1.2 1993/11/04 12:36:36 mike ; Add support for static lighting value. ; ; Revision 1.1 1993/10/29 22:20:27 matt ; Initial revision ; ; ; DONT_USE_UPOLY = 1 .386 option oldstructs .nolist include types.inc include psmacros.inc include gr.inc include 3d.inc .list assume cs:_TEXT, ds:_DATA _DATA segment dword public USE32 'DATA' rcsid db "$Id: draw.asm 1.30 1995/02/15 02:26:52 matt Exp $" align 4 tempv vms_vector <> n_verts dd ? n_verts_4 dd ? ; added by mk, 11/29/94, point coding optimization. bitmap_ptr dd ? uvl_list_ptr dd ? tmap_drawer_ptr dd draw_tmap_ flat_drawer_ptr dd gr_upoly_tmap_ line_drawer_ptr dd gr_line_ _DATA ends _TEXT segment dword public USE32 'CODE' extn gr_upoly_tmap_ extn draw_tmap_ ;specifies new routines to call to draw polygons ;takes eax=ptr to tmap routine, edx=ptr to flat routine, ebx=line rtn g3_set_special_render: or eax,eax jnz got_tmap_ptr lea eax,cs:draw_tmap_ got_tmap_ptr: mov tmap_drawer_ptr,eax or edx,edx jnz got_flat_ptr lea edx,cs:gr_upoly_tmap_ got_flat_ptr: mov flat_drawer_ptr,edx or ebx,ebx jnz got_line_ptr lea ebx,cs:gr_line_ got_line_ptr: mov line_drawer_ptr,ebx ret ;alternate entry takes pointers to points. esi,edi = point pointers g3_draw_line: ;;ifndef NDEBUG ;; mov ax,_Frame_count ;curren frame ;; cmp ax,[esi].p3_frame ;rotated this frame? ;; break_if ne,'Point not rotated in draw_line' ;; cmp ax,[edi].p3_frame ;rotated this frame? ;; break_if ne,'Point not rotated in draw_line' ;;endif mov al,[esi].p3_codes mov ah,[edi].p3_codes ;check codes for reject, clip, or no clip test al,ah ;check codes_and jnz no_draw_line ;both off same side or al,ah ;al=codes_or js must_clip_line ;neg z means must clip test [esi].p3_flags,PF_PROJECTED jnz p0_projected call g3_project_point p0_projected: test [esi].p3_flags,PF_OVERFLOW jnz must_clip_line test [edi].p3_flags,PF_PROJECTED jnz p1_projected xchg esi,edi ;get point in esi call g3_project_point xchg esi,edi p1_projected: test [edi].p3_flags,PF_OVERFLOW jnz must_clip_line pushm ebx,ecx,edx ;save regs test al,al ;check codes or mov eax,[esi].p3_sx mov edx,[esi].p3_sy mov ebx,[edi].p3_sx mov ecx,[edi].p3_sy jz unclipped_line ;cc set from test above ;call clipping line drawer ;; call gr_line_ ;takes eax,edx,ebx,ecx push esi mov esi,line_drawer_ptr call esi pop esi popm ebx,ecx,edx ret ;return value from gr_line ;we know this one is on screen unclipped_line: ;;call gr_uline_ ;takes eax,edx,ebx,ecx ;; call gr_line_ push esi mov esi,line_drawer_ptr call esi pop esi popm ebx,ecx,edx mov al,1 ;definitely drew ret ;both points off same side, no do draw no_draw_line: xor al,al ;not drawn ret ;jumped here from out of g3_draw_line. esi,edi=points, al=codes_or must_clip_line: call clip_line ;do the 3d clip call g3_draw_line ;try draw again ;free up temp points test [esi].p3_flags,PF_TEMP_POINT jz not_temp_esi call free_temp_point not_temp_esi: test [edi].p3_flags,PF_TEMP_POINT jz not_temp_edi xchg esi,edi call free_temp_point not_temp_edi: ret ;ret code set from g3_draw_line ;returns true if a plane is facing the viewer. takes the unrotated surface ;normal of the plane, and a point on it. The normal need not be normalized ;takes esi=vector (unrotated point), edi=normal. ;returns al=true if facing, cc=g if facing ;trashes esi,edi g3_check_normal_facing: push edi ;save normal lea eax,tempv mov edi,esi lea esi,View_position call vm_vec_sub mov esi,eax ;view vector pop edi ;normal call vm_vec_dotprod or eax,eax ;check sign setg al ;true if positive ret ;see if face is visible and draw if it is. ;takes ecx=nv, esi=point list, edi=normal, ebx=point. ;normal can be NULL, which will for compution here (which will be slow). ;returns al=-1 if not facing, else 0 ;Trashes ecx,esi,edx,edi g3_check_and_draw_poly: call do_facing_check or al,al jnz g3_draw_poly mov al,-1 ret g3_check_and_draw_tmap: push ebx mov ebx,eax call do_facing_check pop ebx or al,al jnz g3_draw_tmap mov al,-1 ret ;takes edi=normal or NULL, esi=list of vert nums, ebx=pnt ;returns al=facing? do_facing_check: test edi,edi ;normal passed? jz compute_normal ;..nope ;for debug, check for NULL normal ifndef NDEBUG mov eax,[edi].x or eax,[edi].y or eax,[edi].z break_if z,'Zero-length normal in do_facing_check' endif ;we have the normal. check if facing push esi mov esi,ebx call g3_check_normal_facing ;edi=normal pop esi setg al ;set al true if facing ret ;normal not specified, so must compute compute_normal: pushm ebx,ecx,edx,esi ;get three points (rotated) and compute normal mov eax,[esi] ;get point mov edi,8[esi] ;get point mov esi,4[esi] ;get point lea ebx,tempv call vm_vec_perp ;get normal mov edi,eax ;normal in edi call vm_vec_dotprod ;point in esi or eax,eax ;check result popm ebx,ecx,edx,esi sets al ;al=true if facing ret ;draw a flat-shaded face. returns true if drew ;takes ecx=nv, esi=list of pointers to points ;returns al=0 if called 2d, 1 if all points off screen ;Trashes ecx,esi,edx g3_draw_poly: pushm ebx,edi lea edi,Vbuf0 ;list of ptrs xor ebx,ebx ;counter mov dx,0ff00h ;init codes codes_loop: mov eax,[esi+ebx*4] ;get point number mov [edi+ebx*4],eax ;store in ptr array ;;ifndef NDEBUG ;; push ebx ;; mov bx,_Frame_count ;curren frame ;; cmp bx,[eax].p3_frame ;rotated this frame? ;; break_if ne,'Point not rotated in draw_poly' ;; pop ebx ;;endif and dh,[eax].p3_codes ;update codes_and or dl,[eax].p3_codes ;update codes_or inc ebx cmp ebx,ecx ;done? jne codes_loop ;..nope ;now dx = codes test dh,dh ;check codes_and jnz face_off_screen ;not visible at all test dl,dl ;how about codes_or js must_clip_face ;neg z means must clip jnz must_clip_face ;reentry point for jump back from clipper draw_poly_reentry: push edx ;save codes_or ;now make list of 2d coords (& check for overflow) mov edx,edi ;edx=Vbuf0 xor ebx,ebx lea edi,Vertex_list coords_loop: mov esi,[edx+ebx*4] ;esi = point test [esi].p3_flags,PF_PROJECTED jnz pnt_projected call g3_project_point pnt_projected: test [esi].p3_flags,PF_OVERFLOW jnz must_clip_face2 mov eax,[esi].p3_sx mov [edi+ebx*8],eax mov eax,[esi].p3_sy mov 4[edi+ebx*8],eax inc ebx cmp ebx,ecx jne coords_loop mov eax,ecx ;eax=nverts mov edx,edi ;edx=vertslist ;check for trivial accept pop ebx ;get codes_or ife DONT_USE_UPOLY test bl,bl jz no_clip_face endif ;;call gr_poly_ ;takes eax,edx ;;; call gr_upoly_tmap_ push ecx mov ecx,flat_drawer_ptr call ecx pop ecx popm ebx,edi xor al,al ;say it drew ret ;all on screen. call non-clipping version no_clip_face: ;;call gr_upoly_ ;takes eax,edx ;; call gr_poly_ call gr_upoly_tmap_ popm ebx,edi xor al,al ;say it drew ret ;all the way off screen. return face_off_screen: popm ebx,edi mov al,1 ;no draw ret ;we require a 3d clip must_clip_face2: pop edx ;get codes back must_clip_face: lea esi,Vbuf0 ;src lea edi,Vbuf1 ;dest mov al,dl ;codes in al call clip_polygon ;count in ecx mov edi,esi ;new list in edi ;clipped away? jecxz clipped_away or dh,dh ;check codes_and jnz clipped_away test dl,dl ;check codes or js clipped_away ;some points still behind eye push edi ;need edi to free temp pnts push offset cs:reentry_return pushm ebx,edi ;match what draw has pushed jmp draw_poly_reentry reentry_return: pop edi clipped_away: push eax ;save ret codes ;free temp points xor ebx,ebx free_loop: mov esi,[edi+ebx*4] ;get point test [esi].p3_flags,PF_TEMP_POINT jz not_temp call free_temp_point not_temp: inc ebx cmp ebx,ecx jne free_loop pop eax ;get ret codes back popm ebx,edi ret ;draw a texture-mapped face. returns true if drew ;takes ecx=nv, esi=point list, ebx=uvl_list, edx=bitmap ;returns al=0 if called 2d, 1 if all points off screen ;Trashes ecx,esi,edx g3_draw_tmap: mov bitmap_ptr,edx ;save pushm ebx,edi lea edi,Vbuf0 ;list of ptrs push ebp ;save ebp mov ebp,ebx ;ebp=uvl list mov uvl_list_ptr, ebx mov n_verts,ecx ;save in memory shl ecx, 2 ;loop to check codes, make list of point ptrs, and copy uvl's into points mov dh, 0ffh ; init codes (this pipelines nicely) mov n_verts_4, ecx xor ebx, ebx xor dl, dl ; init codes (this pipelines nicely) t_codes_loop: mov eax,[esi+ebx] ;get point number mov [edi+ebx],eax ;store in ptr array and dh,[eax].p3_codes ;update codes_and or dl,[eax].p3_codes ;update codes_or mov ecx,[ebp] ;get u add ebp, 4 ; (this pipelines better ..mk, 11/29/94 ((my 33rd birthday...))) mov [eax].p3_u,ecx mov ecx,[ebp] ;get v add ebp, 4 mov [eax].p3_v,ecx mov ecx,[ebp] ;get l add ebp, 4 mov [eax].p3_l,ecx or [eax].p3_flags,PF_UVS + PF_LVS ;this point's got em add ebx,4 cmp ebx, n_verts_4 jne t_codes_loop ;..nope pop ebp ;restore ebp ;now dx = codes test dh,dh ;check codes_and jnz t_face_off_screen ;not visible at all test dl,dl ;how about codes_or jnz t_must_clip_face ;non-zero means must clip ;reentry point for jump back from clipper t_draw_poly_reentry: ;make sure all points projected mov edx,edi ;edx=Vbuf0 xor ebx,ebx t_proj_loop: mov esi,[edx+ebx*4] ;esi = point ;;ifndef NDEBUG ;; mov ax,_Frame_count ;curren frame ;; cmp ax,[esi].p3_frame ;rotated this frame? ;; break_if ne,'Point not rotated in draw_tmap' ;;endif test [esi].p3_flags,PF_PROJECTED jnz t_pnt_projected call g3_project_point t_pnt_projected: test [esi].p3_flags,PF_OVERFLOW break_if nz,'Should not overflow after clip' jnz t_face_off_screen inc ebx cmp ebx,n_verts jne t_proj_loop ;now call the texture mapper mov eax,bitmap_ptr ;eax=bitmap ptr mov edx,n_verts ;edx=count mov ebx,edi ;ebx=points ;;; call draw_tmap_ push ecx mov ecx,tmap_drawer_ptr call ecx pop ecx popm ebx,edi xor al,al ;say it drew ret ;all the way off screen. return t_face_off_screen: popm ebx,edi mov al,1 ;no draw ret ;we require a 3d clip t_must_clip_face: lea esi,Vbuf0 ;src lea edi,Vbuf1 ;dest mov al,dl ;codes in al mov ecx,n_verts call clip_polygon ;count in ecx mov n_verts,ecx mov edi,esi ;new list in edi ;clipped away? jecxz t_clipped_away or dh,dh ;check codes_and jnz t_clipped_away test dl,dl ;check codes or js t_clipped_away ;some points still behind eye push edi ;need edi to free temp pnts push offset cs:t_reentry_return pushm ebx,edi ;match what draw has pushed jmp t_draw_poly_reentry t_reentry_return: pop edi t_clipped_away: ; free temp points mov ebx, ecx push eax ;save ret code dec ebx shl ebx, 2 t_free_loop: mov esi,[edi+ebx] ;get point test [esi].p3_flags,PF_TEMP_POINT jz t_not_temp call free_temp_point t_not_temp: sub ebx, 4 jns t_free_loop pop eax ;get ret code popm ebx,edi ret ;draw a sortof-sphere. takes esi=point, ecx=radius g3_draw_sphere: test [esi].p3_codes,CC_BEHIND jnz reject_sphere test [esi].p3_flags,PF_PROJECTED jnz sphere_p_projected call g3_project_point sphere_p_projected: test [esi].p3_flags,PF_OVERFLOW jnz reject_sphere ;calc radius. since disk doesn't take width & height, let's just ;say the the radius is the width pushm eax,ebx,ecx,edx mov eax,ecx fixmul Matrix_scale.x imul Canv_w2 sphere_proj_div: divcheck [esi].z,sphere_div_overflow_handler idiv [esi].z mov ebx,eax mov eax,[esi].p3_sx mov edx,[esi].p3_sy call gr_disk_ sphere_div_overflow_handler: popm eax,ebx,ecx,edx reject_sphere: ret _TEXT ends end
Commands/Miscellaneous Commands suite/system info/CPU speed of (get system info).applescript
looking-for-a-job/applescript-examples
1
2273
<filename>Commands/Miscellaneous Commands suite/system info/CPU speed of (get system info).applescript #!/usr/bin/osascript CPU speed of (get system info)
test/Succeed/Erased-cubical/Cubical.agda
cagix/agda
1,989
15135
<filename>test/Succeed/Erased-cubical/Cubical.agda<gh_stars>1000+ {-# OPTIONS --safe --cubical #-} module Erased-cubical.Cubical where open import Agda.Builtin.Cubical.Path data ∥_∥ (A : Set) : Set where ∣_∣ : A → ∥ A ∥ trivial : (x y : ∥ A ∥) → x ≡ y data D′ : Set where @0 c′ : D′
Ada/inc/Problem_08.ads
Tim-Tom/project-euler
0
29495
<gh_stars>0 package Problem_08 is procedure Solve; end Problem_08;
libsrc/_DEVELOPMENT/adt/bv_stack/c/sccz80/bv_stack_size.asm
meesokim/z88dk
0
173116
; size_t bv_stack_size(bv_stack_t *s) SECTION code_adt_bv_stack PUBLIC bv_stack_size defc bv_stack_size = asm_bv_stack_size INCLUDE "adt/bv_stack/z80/asm_bv_stack_size.asm"
programs/oeis/305/A305747.asm
neoneye/loda
22
175178
<gh_stars>10-100 ; A305747: Let c be the n-th composite number; then a(n) is the smallest divisor of c such that a(n) >= sqrt(c). ; 2,3,4,3,5,4,7,5,4,6,5,7,11,6,5,13,9,7,6,8,11,17,7,6,19,13,8,7,11,9,23,8,7,10,17,13,9,11,8,19,29,10,31,9,8,13,11,17,23,10,9,37,15,19,11,13,10,9,41,12,17,43,29,11,10,13,23,31,47,19,12,14,11,10,17,13,15,53,12,11,37,14,19,23,29,13,59,17,12,11,61,41,31,25,14,16,43,13,12,19 seq $0,72668 ; Numbers one less than composite numbers. seq $0,33677 ; Smallest divisor of n >= sqrt(n).
oeis/202/A202064.asm
neoneye/loda-programs
11
27255
; A202064: Triangle T(n,k), read by rows, given by (2, -1/2, 1/2, 0, 0, 0, 0, 0, 0, 0, ...) DELTA (0, 1/2, -1/2, 0, 0, 0, 0, 0, 0, 0, ...) where DELTA is the operator defined in A084938. ; Submitted by <NAME> ; 1,2,0,3,1,0,4,4,0,0,5,10,1,0,0,6,20,6,0,0,0,7,35,21,1,0,0,0,8,56,56,8,0,0,0,0,9,84,126,36,1,0,0,0,0,10,120,252,120,10,0,0,0,0,0,11,165,462,330,55,1,0,0,0,0,0 lpb $0 add $1,1 sub $0,$1 lpe mul $0,2 add $0,1 add $1,1 bin $1,$0 mov $0,$1
src/Categories/Functor/Monoidal/Symmetric.agda
TOTBWF/agda-categories
0
16687
<reponame>TOTBWF/agda-categories {-# OPTIONS --without-K --safe #-} open import Categories.Category.Monoidal.Structure using (SymmetricMonoidalCategory) module Categories.Functor.Monoidal.Symmetric {o o′ ℓ ℓ′ e e′} (C : SymmetricMonoidalCategory o ℓ e) (D : SymmetricMonoidalCategory o′ ℓ′ e′) where open import Level open import Data.Product using (_,_) open import Categories.Functor using (Functor) open import Categories.Functor.Monoidal private module C = SymmetricMonoidalCategory C renaming (braidedMonoidalCategory to B) module D = SymmetricMonoidalCategory D renaming (braidedMonoidalCategory to B) import Categories.Functor.Monoidal.Braided C.B D.B as Braided module Lax where open Braided.Lax -- Lax symmetric monoidal functors are just lax braided monoidal -- functors between symmetric monoidal categories. record SymmetricMonoidalFunctor : Set (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) where field F : Functor C.U D.U isBraidedMonoidal : IsBraidedMonoidalFunctor F open Functor F public open IsBraidedMonoidalFunctor isBraidedMonoidal public monoidalFunctor : MonoidalFunctor C.monoidalCategory D.monoidalCategory monoidalFunctor = record { isMonoidal = isMonoidal } module Strong where open Braided.Strong -- Strong symmetric monoidal functors are just strong braided -- monoidal functors between symmetric monoidal categories. record SymmetricMonoidalFunctor : Set (o ⊔ ℓ ⊔ e ⊔ o′ ⊔ ℓ′ ⊔ e′) where field F : Functor C.U D.U isBraidedMonoidal : IsBraidedMonoidalFunctor F open Functor F public open IsBraidedMonoidalFunctor isBraidedMonoidal public monoidalFunctor : StrongMonoidalFunctor C.monoidalCategory D.monoidalCategory monoidalFunctor = record { isStrongMonoidal = isStrongMonoidal }
source/required/s-addima.ads
ytomino/drake
33
23160
pragma License (Unrestricted); -- implementation unit required by compiler with System.Storage_Elements.Formatting; function System.Address_Image (A : Address) return Storage_Elements.Formatting.Address_String; pragma Pure (System.Address_Image); pragma Inline (System.Address_Image);
programs/oeis/299/A299250.asm
karttu/loda
0
163728
; A299250: Numbers congruent to {9, 11, 21, 29} mod 30. ; 9,11,21,29,39,41,51,59,69,71,81,89,99,101,111,119,129,131,141,149,159,161,171,179,189,191,201,209,219,221,231,239,249,251,261,269,279,281,291,299,309,311,321,329,339,341,351,359,369,371,381,389,399,401,411 mov $2,5 add $2,$0 mov $5,$0 add $0,$2 mov $3,$0 add $5,$0 add $5,4 lpb $3,1 add $1,4 add $4,$1 add $5,$4 lpb $5,1 add $1,2 mov $3,2 add $4,1 trn $5,2 lpe lpb $4,1 add $1,6 trn $4,$3 lpe lpe sub $1,45
test/interaction/Issue2728-2.agda
cruhland/agda
1,989
15410
F : {_ : Set₁} → Set₁ F {A} = A
programs/oeis/008/A008488.asm
jmorken/loda
1
86858
<reponame>jmorken/loda ; A008488: Expansion of (1-x^6) / (1-x)^6. ; 1,6,21,56,126,252,461,786,1266,1946,2877,4116,5726,7776,10341,13502,17346,21966,27461,33936,41502,50276,60381,71946,85106,100002,116781,135596,156606,179976,205877,234486,265986,300566,338421,379752,424766,473676,526701,584066,646002,712746,784541,861636,944286,1032752,1127301,1228206,1335746,1450206,1571877,1701056,1838046,1983156,2136701,2299002,2470386,2651186,2841741,3042396,3253502,3475416,3708501,3953126,4209666,4478502,4760021,5054616,5362686,5684636,6020877,6371826,6737906,7119546,7517181,7931252,8362206,8810496,9276581,9760926,10264002,10786286,11328261,11890416,12473246,13077252,13702941,14350826,15021426,15715266,16432877,17174796,17941566,18733736,19551861,20396502,21268226,22167606,23095221,24051656,25037502,26053356,27099821,28177506,29287026,30429002,31604061,32812836,34055966,35334096,36647877,37997966,39385026,40809726,42272741,43774752,45316446,46898516,48521661,50186586,51894002,53644626,55439181,57278396,59163006,61093752,63071381,65096646,67170306,69293126,71465877,73689336,75964286,78291516,80671821,83106002,85594866,88139226,90739901,93397716,96113502,98888096,101722341,104617086,107573186,110591502,113672901,116818256,120028446,123304356,126646877,130056906,133535346,137083106,140701101,144390252,148151486,151985736,155893941,159877046,163936002,168071766,172285301,176577576,180949566,185402252,189936621,194553666,199254386,204039786,208910877,213868676,218914206,224048496,229272581,234587502,239994306,245494046,251087781,256776576,262561502,268443636,274424061,280503866,286684146,292966002,299350541,305838876,312432126,319131416,325937877,332852646,339876866,347011686,354258261,361617752,369091326,376680156,384385421,392208306,400150002,408211706,416394621,424699956,433128926,441682752,450362661,459169886,468105666,477171246,486367877,495696816,505159326,514756676,524490141,534361002,544370546,554520066,564810861,575244236,585821502,596543976,607412981,618429846,629595906,640912502,652380981,664002696,675779006,687711276,699800877,712049186,724457586,737027466,749760221,762657252,775719966,788949776,802348101,815916366,829656002,843568446,857655141,871917536,886357086,900975252,915773501,930753306,945916146,961263506 pow $0,2 mov $2,10 lpb $0 add $2,$0 sub $0,1 mov $1,2 add $2,7 lpe add $1,$2 mul $1,30 sub $1,300 div $1,60 add $1,1
oeis/027/A027789.asm
neoneye/loda-programs
11
97426
; A027789: a(n) = 2*(n+1)*binomial(n+3,4). ; 4,30,120,350,840,1764,3360,5940,9900,15730,24024,35490,50960,71400,97920,131784,174420,227430,292600,371910,467544,581900,717600,877500,1064700,1282554,1534680,1824970,2157600,2537040,2968064,3455760,4005540,4623150,5314680,6086574,6945640,7899060,8954400,10119620,11403084,12813570,14360280,16052850,17901360,19916344,22108800,24490200,27072500,29868150,32890104,36151830,39667320,43451100,47518240,51884364,56565660,61578890,66941400,72671130,78786624,85307040,92252160,99642400,107498820 add $0,4 mov $1,$0 sub $0,2 bin $1,4 mul $0,$1 mul $0,2
gbc_bios.asm
roukaour/disasm.py
2
84040
; http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header ; http://bgb.bircd.org/pandocs.htm#thecartridgeheader ; http://imrannazar.com/Gameboy-Z80-Opcode-Map ; http://pastraiser.com/cpu/gameboy/gameboy_opcodes.html ; http://gameboy.mongenel.com/dmg/opcodes.html ; http://gbdev.gg8.se/wiki/articles/CPU_Comparision_with_Z80 ; https://realboyemulator.wordpress.com/2013/01/03/a-look-at-the-game-boy-bootstrap-let-the-fun-begin/ ; https://www.emuparadise.me/biosfiles/bios.html ; https://hax.iimarckus.org/topic/7161/ ; https://pastebin.com/1gqYntHg ENTRY_POINT: ld sp, $fffe ; 0000: 31 fe ff ld a, $2 ; 0003: 3e 02 jp Main ; 0005: c3 7c 00 Unknown_0008: db $d3, $00, $98, $a0, $12, $d3, $00, $80 ; 0008-000f db $00, $40 ; 0010-0011 Unknown_0012: db $1e, $53, $d0, $00, $1f, $42 ; 0012-0017 db $1c, $00, $14, $2a, $4d, $19, $8c, $7e ; 0018-001f db $00, $7c, $31, $6e, $4a, $45, $52, $4a ; 0020-0027 db $00, $00, $ff, $53, $1f, $7c, $ff, $03 ; 0028-002f db $1f, $00, $ff, $1f, $a7, $00, $ef, $1b ; 0030-0037 db $1f, $00, $ef, $1b, $00, $7c, $00, $00 ; 0038-003f db $ff, $03 ; 0040-0041 NintendoLogo: db $ce, $ed, $66, $66, $cc, $0d, $00, $0b ; 0042-0049 db $03, $73, $00, $83, $00, $0c, $00, $0d ; 004a-0051 db $00, $08, $11, $1f, $88, $89, $00, $0e ; 0052-0059 db $dc, $cc, $6e, $e6, $dd, $dd, $d9, $99 ; 005a-0061 db $bb, $bb, $67, $63, $6e, $0e, $ec, $cc ; 0062-0069 db $dd, $dc, $99, $9f, $bb, $b9, $33, $3e ; 006a-0071 Unknown_0072: db $3c, $42, $b9, $a5, $b9, $a5, $42, $3c ; 0072-0079 Unknown_007a: db $58, $43 ; 007a-007b Main: ld [rSVBK], a ; 007c: e0 70 ; a = the color number's mappings ld a, $fc ; 007e: 3e fc ; initialize the palette ld [rBGP], a ; 0080: e0 47 call InitAudio ; 0082: cd 75 02 call Function0200 ; 0085: cd 00 02 ld h, $d0 ; 0088: 26 d0 call Function0203 ; 008a: cd 03 02 ld hl, $fe00 ; 008d: 21 00 fe ld c, 160 ; 0090: 0e a0 xor a ; 0092: af .do_160: ld [hli], a ; 0093: 22 dec c ; 0094: 0d jr nz, .do_160 ; 0095: 20 fc ; de = pointer to Nintendo logo in cartridge header ld de, $0104 ; 0097: 11 04 01 ; hl = pointer to VRAM ld hl, $8010 ; 009a: 21 10 80 ld c, h ; 009d: 4c .loop1: ; load next byte from Nintendo logo ld a, [de] ; 009e: 1a ld [$ff00+c], a ; 009f: e2 inc c ; 00a0: 0c ; decompress, scale and write pixels to VRAM (1) call Function03c6 ; 00a1: cd c6 03 ; decompress, scale and write pixels to VRAM (2) call Function03c7 ; 00a4: cd c7 03 inc de ; 00a7: 13 ld a, e ; 00a8: 7b cp $34 ; 00a9: fe 34 ; loop if not finished comparing jr nz, .loop1 ; 00ab: 20 f1 ld de, Unknown_0072 ; 00ad: 11 72 00 ld b, 8 ; 00b0: 06 08 .do_8: ld a, [de] ; 00b2: 1a inc de ; 00b3: 13 ld [hli], a ; 00b4: 22 inc hl ; 00b5: 23 dec b ; 00b6: 05 jr nz, .do_8 ; 00b7: 20 f9 call Function03f0 ; 00b9: cd f0 03 ld a, $1 ; 00bc: 3e 01 ld [rVBK], a ; 00be: e0 4f ld a, $91 ; 00c0: 3e 91 ld [rLCDC], a ; 00c2: e0 40 ld hl, $98b2 ; 00c4: 21 b2 98 ld b, $4e ; 00c7: 06 4e ld c, $44 ; 00c9: 0e 44 call Function0291 ; 00cb: cd 91 02 xor a ; 00ce: af ld [rVBK], a ; 00cf: e0 4f ld c, $80 ; 00d1: 0e 80 ld hl, NintendoLogo ; 00d3: 21 42 00 ld b, 24 ; 00d6: 06 18 .do_24: ld a, [$ff00+c] ; 00d8: f2 inc c ; 00d9: 0c cp [hl] ; 00da: be .trap1: jr nz, .trap1 ; 00db: 20 fe inc hl ; 00dd: 23 dec b ; 00de: 05 jr nz, .do_24 ; 00df: 20 f7 ld hl, $0134 ; 00e1: 21 34 01 ld b, 25 ; 00e4: 06 19 ld a, b ; 00e6: 78 .do_25: add [hl] ; 00e7: 86 inc l ; 00e8: 2c dec b ; 00e9: 05 jr nz, .do_25 ; 00ea: 20 fb add [hl] ; 00ec: 86 .trap2: jr nz, .trap2 ; 00ed: 20 fe call Function031c ; 00ef: cd 1c 03 jr .skip_nops ; 00f2: 18 02 nop ; 00f4 nop ; 00f5 .skip_nops: call Function05d0 ; 00f6: cd d0 05 xor a ; 00f9: af ld [rSVBK], a ; 00fa: e0 70 ld a, $11 ; 00fc: 3e 11 ld [rBLCK], a ; 00fe: e0 50 ; The cartridge header is copied here, and begins with a boot procedure that ; will terminate this function, usually by jumping to the actual game code. rept 256 nop ; 0100-01ff: 00 endr Function0200: ld hl, $8000 ; 0200: 21 00 80 ; fallthrough Function0203: xor a ; 0203: af .loop: ld [hli], a ; 0204: 22 bit 5, h ; 0205: cb 6c jr z, .loop ; 0207: 28 fb ret ; 0209: c9 CopyBytes: ; Copy c bytes from hl to de. ld a, [hli] ; 020a: 2a ld [de], a ; 020b: 12 inc de ; 020c: 13 dec c ; 020d: 0d jr nz, CopyBytes ; 020e: 20 fa ret ; 0210: c9 Function0211: push hl ; 0211: e5 ld hl, rIF ; 0212: 21 0f ff res 0, [hl] ; 0215: cb 86 .wait: bit 0, [hl] ; 0217: cb 46 jr z, .wait ; 0219: 28 fc pop hl ; 021b: e1 ret ; 021c: c9 Function021d: ld de, $ff00 ; 021d: 11 00 ff ld hl, $d003 ; 0220: 21 03 d0 ld c, $f ; 0223: 0e 0f ld a, $30 ; 0225: 3e 30 ld [de], a ; 0227: 12 ld a, $20 ; 0228: 3e 20 ld [de], a ; 022a: 12 ld a, [de] ; 022b: 1a cpl ; 022c: 2f and c ; 022d: a1 swap a ; 022e: cb 37 ld b, a ; 0230: 47 ld a, $10 ; 0231: 3e 10 ld [de], a ; 0233: 12 ld a, [de] ; 0234: 1a cpl ; 0235: 2f and c ; 0236: a1 or b ; 0237: b0 ld c, a ; 0238: 4f ld a, [hl] ; 0239: 7e xor c ; 023a: a9 and $f0 ; 023b: e6 f0 ld b, a ; 023d: 47 ld a, [hli] ; 023e: 2a xor c ; 023f: a9 and c ; 0240: a1 or b ; 0241: b0 ld [hld], a ; 0242: 32 ld b, a ; 0243: 47 ld a, c ; 0244: 79 ld [hl], a ; 0245: 77 ld a, $30 ; 0246: 3e 30 ld [de], a ; 0248: 12 ret ; 0249: c9 Function024a: ld a, $80 ; 024a: 3e 80 ld [rBGPI], a ; 024c: e0 68 ld [rOBPI], a ; 024e: e0 6a ld c, $6b ; 0250: 0e 6b .loop1: ld a, [hli] ; 0252: 2a ld [$ff00+c], a ; 0253: e2 dec b ; 0254: 05 jr nz, .loop1 ; 0255: 20 fb ld c, d ; 0257: 4a add hl, bc ; 0258: 09 ld b, e ; 0259: 43 ld c, $69 ; 025a: 0e 69 .loop2: ld a, [hli] ; 025c: 2a ld [$ff00+c], a ; 025d: e2 dec b ; 025e: 05 jr nz, .loop2 ; 025f: 20 fb ret ; 0261: c9 Function0262: push bc ; 0262: c5 push de ; 0263: d5 push hl ; 0264: e5 ld hl, $d800 ; 0265: 21 00 d8 ld b, $1 ; 0268: 06 01 ld d, $3f ; 026a: 16 3f ld e, $40 ; 026c: 1e 40 call Function024a ; 026e: cd 4a 02 pop hl ; 0271: e1 pop de ; 0272: d1 pop bc ; 0273: c1 ret ; 0274: c9 InitAudio: ld a, $80 ; 0275: 3e 80 ld [rNR52], a ; 0277: e0 26 ld [rNR11], a ; 0279: e0 11 ld a, $f3 ; 027b: 3e f3 ld [rNR12], a ; 027d: e0 12 ld [rNR51], a ; 027f: e0 25 ld a, $77 ; 0281: 3e 77 ld [rNR50], a ; 0283: e0 24 ld hl, rWave_0 ; 0285: 21 30 ff xor a ; 0288: af ld c, 16 ; 0289: 0e 10 .do_16: ld [hli], a ; 028b: 22 cpl ; 028c: 2f dec c ; 028d: 0d jr nz, .do_16 ; 028e: 20 fb ret ; 0290: c9 Function0291: call Function0211 ; 0291: cd 11 02 call Function0262 ; 0294: cd 62 02 ld a, c ; 0297: 79 cp $38 ; 0298: fe 38 jr nz, .skip1 ; 029a: 20 14 push hl ; 029c: e5 xor a ; 029d: af ld [rVBK], a ; 029e: e0 4f ld hl, $99a7 ; 02a0: 21 a7 99 ld a, $38 ; 02a3: 3e 38 .loop1: ld [hli], a ; 02a5: 22 inc a ; 02a6: 3c cp $3f ; 02a7: fe 3f jr nz, .loop1 ; 02a9: 20 fa ld a, $1 ; 02ab: 3e 01 ld [rVBK], a ; 02ad: e0 4f pop hl ; 02af: e1 .skip1: push bc ; 02b0: c5 push hl ; 02b1: e5 ; hl = pointer to CGB flag in cartridge header ld hl, $0143 ; 02b2: 21 43 01 bit 7, [hl] ; 02b5: cb 7e call z, Function0589 ; 02b7: cc 89 05 pop hl ; 02ba: e1 pop bc ; 02bb: c1 call Function0211 ; 02bc: cd 11 02 ld a, c ; 02bf: 79 sub $30 ; 02c0: d6 30 jp nc, .skip4 ; 02c2: d2 06 03 ld a, c ; 02c5: 79 cp $1 ; 02c6: fe 01 jp z, .skip4 ; 02c8: ca 06 03 ld a, l ; 02cb: 7d cp $d1 ; 02cc: fe d1 jr z, .break ; 02ce: 28 21 push bc ; 02d0: c5 ld b, $3 ; 02d1: 06 03 .loop2: ld c, $1 ; 02d3: 0e 01 .subloop: ld d, $3 ; 02d5: 16 03 .subsubloop: ld a, [hl] ; 02d7: 7e and $f8 ; 02d8: e6 f8 or c ; 02da: b1 ld [hli], a ; 02db: 22 dec d ; 02dc: 15 jr nz, .subsubloop ; 02dd: 20 f8 inc c ; 02df: 0c ld a, c ; 02e0: 79 cp $6 ; 02e1: fe 06 jr nz, .subloop ; 02e3: 20 f0 ld de, $11 ; 02e5: 11 11 00 add hl, de ; 02e8: 19 dec b ; 02e9: 05 jr nz, .loop2 ; 02ea: 20 e7 ld de, $ffa1 ; 02ec: 11 a1 ff add hl, de ; 02ef: 19 pop bc ; 02f0: c1 .break: inc b ; 02f1: 04 ld a, b ; 02f2: 78 ld e, $83 ; 02f3: 1e 83 cp $62 ; 02f5: fe 62 jr z, .ok ; 02f7: 28 06 ld e, $c1 ; 02f9: 1e c1 cp $64 ; 02fb: fe 64 jr nz, .skip3 ; 02fd: 20 07 .ok: ld a, e ; 02ff: 7b ld [rNR13], a ; 0300: e0 13 ld a, $87 ; 0302: 3e 87 ld [rNR14], a ; 0304: e0 14 .skip3: ld a, [$d002] ; 0306: fa 02 d0 cp $0 ; 0309: fe 00 jr z, .skip4 ; 030b: 28 0a dec a ; 030d: 3d ld [$d002], a ; 030e: ea 02 d0 ld a, c ; 0311: 79 cp $1 ; 0312: fe 01 jp z, Function0291 ; 0314: ca 91 02 .skip4: dec c ; 0317: 0d jp nz, Function0291 ; 0318: c2 91 02 ret ; 031b: c9 Function031c: ld c, 38 ; 031c: 0e 26 .do_38: call Function034a ; 031e: cd 4a 03 call Function0211 ; 0321: cd 11 02 call Function0262 ; 0324: cd 62 02 dec c ; 0327: 0d jr nz, .do_38 ; 0328: 20 f4 call Function0211 ; 032a: cd 11 02 ld a, $1 ; 032d: 3e 01 ld [rVBK], a ; 032f: e0 4f call Function033e ; 0331: cd 3e 03 call Function0341 ; 0334: cd 41 03 xor a ; 0337: af ld [rVBK], a ; 0338: e0 4f call Function033e ; 033a: cd 3e 03 ret ; 033d: c9 Function033e: ld hl, Unknown_0008 ; 033e: 21 08 00 Function0341: ld de, $ff51 ; 0341: 11 51 ff ld c, 5 ; 0344: 0e 05 call CopyBytes ; 0346: cd 0a 02 ret ; 0349: c9 Function034a: push bc ; 034a: c5 push de ; 034b: d5 push hl ; 034c: e5 ld hl, $d840 ; 034d: 21 40 d8 ld c, 32 ; 0350: 0e 20 .do_32: ld a, [hl] ; 0352: 7e and $1f ; 0353: e6 1f cp $1f ; 0355: fe 1f jr z, .skip1 ; 0357: 28 01 inc a ; 0359: 3c .skip1: ld d, a ; 035a: 57 ld a, [hli] ; 035b: 2a rlc a ; 035c: 07 rlc a ; 035d: 07 rlc a ; 035e: 07 and $7 ; 035f: e6 07 ld b, a ; 0361: 47 ld a, [hld] ; 0362: 3a rlc a ; 0363: 07 rlc a ; 0364: 07 rlc a ; 0365: 07 and $18 ; 0366: e6 18 or b ; 0368: b0 cp $1f ; 0369: fe 1f jr z, .skip2 ; 036b: 28 01 inc a ; 036d: 3c skip2: rrc a ; 036e: 0f rrc a ; 036f: 0f rrc a ; 0370: 0f ld b, a ; 0371: 47 and $e0 ; 0372: e6 e0 or d ; 0374: b2 ld [hli], a ; 0375: 22 ld a, b ; 0376: 78 and $3 ; 0377: e6 03 ld e, a ; 0379: 5f ld a, [hl] ; 037a: 7e rrc a ; 037b: 0f rrc a ; 037c: 0f and $1f ; 037d: e6 1f cp $1f ; 037f: fe 1f jr z, .skip3 ; 0381: 28 01 inc a ; 0383: 3c .skip3: rlc a ; 0384: 07 rlc a ; 0385: 07 or e ; 0386: b3 ld [hli], a ; 0387: 22 dec c ; 0388: 0d jr nz, .do_32 ; 0389: 20 c7 pop hl ; 038b: e1 pop de ; 038c: d1 pop bc ; 038d: c1 ret ; 038e: c9 Function038f: ld c, $0 ; 038f: 0e 00 .loop: ld a, [de] ; 0391: 1a and $f0 ; 0392: e6 f0 bit 1, c ; 0394: cb 49 jr z, .skip1 ; 0396: 28 02 swap a ; 0398: cb 37 .skip1: ld b, a ; 039a: 47 inc hl ; 039b: 23 ld a, [hl] ; 039c: 7e or b ; 039d: b0 ld [hli], a ; 039e: 22 ld a, [de] ; 039f: 1a and $f ; 03a0: e6 0f bit 1, c ; 03a2: cb 49 jr nz, .skip2 ; 03a4: 20 02 swap a ; 03a6: cb 37 .skip2: ld b, a ; 03a8: 47 inc hl ; 03a9: 23 ld a, [hl] ; 03aa: 7e or b ; 03ab: b0 ld [hli], a ; 03ac: 22 inc de ; 03ad: 13 bit 0, c ; 03ae: cb 41 jr z, .skip3 ; 03b0: 28 0d push de ; 03b2: d5 ld de, -8 ; 03b3: 11 f8 ff bit 1, c ; 03b6: cb 49 jr z, .negative ; 03b8: 28 03 ld de, 8 ; 03ba: 11 08 00 .negative: add hl, de ; 03bd: 19 pop de ; 03be: d1 .skip3: inc c ; 03bf: 0c ld a, c ; 03c0: 79 cp $18 ; 03c1: fe 18 jr nz, .loop ; 03c3: 20 cc ret ; 03c5: c9 Function03c6: ld b, a ; 03c6: 47 Function03c7: push de ; 03c7: d5 ld d, $4 ; 03c8: 16 04 .loop: ld e, b ; 03ca: 58 rl b ; 03cb: cb 10 rla ; 03cd: 17 rl e ; 03ce: cb 13 rla ; 03d0: 17 dec d ; 03d1: 15 jr nz, .loop ; 03d2: 20 f6 pop de ; 03d4: d1 ld [hli], a ; 03d5: 22 inc hl ; 03d6: 23 ld [hli], a ; 03d7: 22 inc hl ; 03d8: 23 ret ; 03d9: c9 Function03da: ld a, $19 ; 03da: 3e 19 ld [$9910], a ; 03dc: ea 10 99 ld hl, $992f ; 03df: 21 2f 99 .loop: ld c, 12 ; 03e2: 0e 0c .do_12: dec a ; 03e4: 3d jr z, .done ; 03e5: 28 08 ld [hld], a ; 03e7: 32 dec c ; 03e8: 0d jr nz, .do_12 ; 03e9: 20 f9 ld l, $f ; 03eb: 2e 0f jr .loop ; 03ed: 18 f3 .done: ret ; 03ef: c9 Function03f0: ld a, $1 ; 03f0: 3e 01 ld [rVBK], a ; 03f2: e0 4f call Function0200 ; 03f4: cd 00 02 ld de, Unknown_0607 ; 03f7: 11 07 06 ld hl, $8080 ; 03fa: 21 80 80 ld c, 192 ; 03fd: 0e c0 .do_192: ld a, [de] ; 03ff: 1a ld [hli], a ; 0400: 22 inc hl ; 0401: 23 ld [hli], a ; 0402: 22 inc hl ; 0403: 23 inc de ; 0404: 13 dec c ; 0405: 0d jr nz, .do_192 ; 0406: 20 f7 ; de = pointer to Nintendo logo in cartridge header ld de, $0104 ; 0408: 11 04 01 call Function038f ; 040b: cd 8f 03 ld bc, $ffa8 ; 040e: 01 a8 ff add hl, bc ; 0411: 09 call Function038f ; 0412: cd 8f 03 ld bc, $fff8 ; 0415: 01 f8 ff add hl, bc ; 0418: 09 ld de, Unknown_0072 ; 0419: 11 72 00 ld c, 8 ; 041c: 0e 08 .do_8: inc hl ; 041e: 23 ld a, [de] ; 041f: 1a ld [hli], a ; 0420: 22 inc de ; 0421: 13 dec c ; 0422: 0d jr nz, .do_8 ; 0423: 20 f9 ld hl, $98c2 ; 0425: 21 c2 98 ld b, 8 ; 0428: 06 08 ld a, $8 ; 042a: 3e 08 .do_8: ld c, 16 ; 042c: 0e 10 .do_16: ld [hli], a ; 042e: 22 dec c ; 042f: 0d jr nz, .do_16 ; 0430: 20 fc ld de, $10 ; 0432: 11 10 00 add hl, de ; 0435: 19 dec b ; 0436: 05 jr nz, .do_8 ; 0437: 20 f3 xor a ; 0439: af ld [rVBK], a ; 043a: e0 4f ld hl, $98c2 ; 043c: 21 c2 98 ld a, $8 ; 043f: 3e 08 .loop1: ld [hli], a ; 0441: 22 inc a ; 0442: 3c cp $18 ; 0443: fe 18 jr nz, .skip1 ; 0445: 20 02 ld l, $e2 ; 0447: 2e e2 .skip1: cp $28 ; 0449: fe 28 jr nz, .skip2 ; 044b: 20 03 ld hl, $9902 ; 044d: 21 02 99 .skip2: cp $38 ; 0450: fe 38 jr nz, .loop1 ; 0452: 20 ed ld hl, Unknown_08d8 ; 0454: 21 d8 08 ld de, $d840 ; 0457: 11 40 d8 ld b, 8 ; 045a: 06 08 .do_8_2: ld a, $ff ; 045c: 3e ff ld [de], a ; 045e: 12 inc de ; 045f: 13 ld [de], a ; 0460: 12 inc de ; 0461: 13 ld c, 2 ; 0462: 0e 02 call CopyBytes ; 0464: cd 0a 02 ld a, $0 ; 0467: 3e 00 ld [de], a ; 0469: 12 inc de ; 046a: 13 ld [de], a ; 046b: 12 inc de ; 046c: 13 inc de ; 046d: 13 inc de ; 046e: 13 dec b ; 046f: 05 jr nz, .do_8_2 ; 0470: 20 ea call Function0262 ; 0472: cd 62 02 ; hl = pointer to old licensee code in cartridge header ld hl, $014b ; 0475: 21 4b 01 ld a, [hl] ; 0478: 7e cp $33 ; 0479: fe 33 jr nz, .skip3 ; 047b: 20 0b ld l, $44 ; 047d: 2e 44 ld e, $30 ; 047f: 1e 30 ld a, [hli] ; 0481: 2a cp e ; 0482: bb jr nz, .finish1 ; 0483: 20 49 inc e ; 0485: 1c jr .continue ; 0486: 18 04 .skip3: ld l, $4b ; 0488: 2e 4b ld e, $1 ; 048a: 1e 01 .continue: ld a, [hli] ; 048c: 2a cp e ; 048d: bb jr nz, .finish1 ; 048e: 20 3e ld l, $34 ; 0490: 2e 34 ld bc, 16 ; 0492: 01 10 00 do_16_2: ld a, [hli] ; 0495: 2a add b ; 0496: 80 ld b, a ; 0497: 47 dec c ; 0498: 0d jr nz, do_16_2 ; 0499: 20 fa ld [$d000], a ; 049b: ea 00 d0 ld hl, Unknown_06c7 ; 049e: 21 c7 06 ld c, $0 ; 04a1: 0e 00 .do_79: ld a, [hli] ; 04a3: 2a cp b ; 04a4: b8 jr z, .break ; 04a5: 28 08 inc c ; 04a7: 0c ld a, c ; 04a8: 79 cp 79 ; 04a9: fe 4f jr nz, .do_79 ; 04ab: 20 f6 jr .finish1 ; 04ad: 18 1f .break: ld a, c ; 04af: 79 sub $41 ; 04b0: d6 41 jr c, .finish2 ; 04b2: 38 1c ld hl, Unknown_0716 ; 04b4: 21 16 07 ld d, $0 ; 04b7: 16 00 ld e, a ; 04b9: 5f add hl, de ; 04ba: 19 .loop2: ld a, [$0137] ; 04bb: fa 37 01 ld d, a ; 04be: 57 ld a, [hl] ; 04bf: 7e cp d ; 04c0: ba jr z, .finish2 ; 04c1: 28 0d ld de, $e ; 04c3: 11 0e 00 add hl, de ; 04c6: 19 ld a, c ; 04c7: 79 add e ; 04c8: 83 ld c, a ; 04c9: 4f sub $5e ; 04ca: d6 5e jr c, .loop2 ; 04cc: 38 ed .finish1: ld c, $0 ; 04ce: 0e 00 .finish2: ld hl, Unknown_0733 ; 04d0: 21 33 07 ld b, $0 ; 04d3: 06 00 add hl, bc ; 04d5: 09 ld a, [hl] ; 04d6: 7e and $1f ; 04d7: e6 1f ld [$d008], a ; 04d9: ea 08 d0 ld a, [hl] ; 04dc: 7e and $e0 ; 04dd: e6 e0 rlc a ; 04df: 07 rlc a ; 04e0: 07 rlc a ; 04e1: 07 ld [$d00b], a ; 04e2: ea 0b d0 call Function04e9 ; 04e5: cd e9 04 ret ; 04e8: c9 Function04e9: ld de, Unknown_0791 ; 04e9: 11 91 07 ld hl, $d900 ; 04ec: 21 00 d9 ld a, [$d00b] ; 04ef: fa 0b d0 ld b, a ; 04f2: 47 ld c, $1e ; 04f3: 0e 1e .loop: bit 0, b ; 04f5: cb 40 jr nz, .skip1 ; 04f7: 20 02 inc de ; 04f9: 13 inc de ; 04fa: 13 .skip1: ld a, [de] ; 04fb: 1a ld [hli], a ; 04fc: 22 jr nz, .skip2 ; 04fd: 20 02 dec de ; 04ff: 1b dec de ; 0500: 1b .skip2: bit 1, b ; 0501: cb 48 jr nz, .skip3 ; 0503: 20 02 inc de ; 0505: 13 inc de ; 0506: 13 .skip3: ld a, [de] ; 0507: 1a ld [hli], a ; 0508: 22 inc de ; 0509: 13 inc de ; 050a: 13 jr nz, .skip4 ; 050b: 20 02 dec de ; 050d: 1b dec de ; 050e: 1b .skip4: bit 2, b ; 050f: cb 50 jr z, .skip5 ; 0511: 28 05 dec de ; 0513: 1b dec hl ; 0514: 2b ld a, [de] ; 0515: 1a ld [hli], a ; 0516: 22 inc de ; 0517: 13 .skip5: ld a, [de] ; 0518: 1a ld [hli], a ; 0519: 22 inc de ; 051a: 13 dec c ; 051b: 0d jr nz, .loop ; 051c: 20 d7 ld hl, $d900 ; 051e: 21 00 d9 ld de, $da00 ; 0521: 11 00 da call Function0564 ; 0524: cd 64 05 ret ; 0527: c9 Function0528: ld hl, Unknown_0012 ; 0528: 21 12 00 ld a, [$d005] ; 052b: fa 05 d0 rlc a ; 052e: 07 rlc a ; 052f: 07 ld b, $0 ; 0530: 06 00 ld c, a ; 0532: 4f add hl, bc ; 0533: 09 ld de, $d840 ; 0534: 11 40 d8 ld b, $8 ; 0537: 06 08 .loop: push hl ; 0539: e5 ld c, 2 ; 053a: 0e 02 call CopyBytes ; 053c: cd 0a 02 inc de ; 053f: 13 inc de ; 0540: 13 inc de ; 0541: 13 inc de ; 0542: 13 inc de ; 0543: 13 inc de ; 0544: 13 pop hl ; 0545: e1 dec b ; 0546: 05 jr nz, .loop ; 0547: 20 f0 ld de, $d842 ; 0549: 11 42 d8 ld c, 2 ; 054c: 0e 02 call CopyBytes ; 054e: cd 0a 02 ld de, $d84a ; 0551: 11 4a d8 ld c, 2 ; 0554: 0e 02 call CopyBytes ; 0556: cd 0a 02 dec hl ; 0559: 2b dec hl ; 055a: 2b ld de, $d844 ; 055b: 11 44 d8 ld c, 2 ; 055e: 0e 02 call CopyBytes ; 0560: cd 0a 02 ret ; 0563: c9 Function0564: ld c, $60 ; 0564: 0e 60 .loop: ld a, [hli] ; 0566: 2a push hl ; 0567: e5 push bc ; 0568: c5 ld hl, Unknown_07e8 ; 0569: 21 e8 07 ld b, $0 ; 056c: 06 00 ld c, a ; 056e: 4f add hl, bc ; 056f: 09 ld c, 8 ; 0570: 0e 08 call CopyBytes ; 0572: cd 0a 02 pop bc ; 0575: c1 pop hl ; 0576: e1 dec c ; 0577: 0d jr nz, .loop ; 0578: 20 ec ret ; 057a: c9 Function057b: ld a, [$d008] ; 057b: fa 08 d0 ld de, $18 ; 057e: 11 18 00 inc a ; 0581: 3c Function0582: dec a ; 0582: 3d jr z, .done ; 0583: 28 03 add hl, de ; 0585: 19 jr nz, Function0582 ; 0586: 20 fa .done: ret ; 0588: c9 Function0589: call Function021d ; 0589: cd 1d 02 ld a, b ; 058c: 78 and $ff ; 058d: e6 ff jr z, .skip ; 058f: 28 0f ld hl, Unknown_08e4 ; 0591: 21 e4 08 ld b, $0 ; 0594: 06 00 .do_12: ld a, [hli] ; 0596: 2a cp c ; 0597: b9 jr z, .continue ; 0598: 28 08 inc b ; 059a: 04 ld a, b ; 059b: 78 cp 12 ; 059c: fe 0c jr nz, .do_12 ; 059e: 20 f6 .skip: jr .done ; 05a0: 18 2d .continue: ld a, b ; 05a2: 78 ld [$d005], a ; 05a3: ea 05 d0 ld a, $1e ; 05a6: 3e 1e ld [$d002], a ; 05a8: ea 02 d0 ld de, $b ; 05ab: 11 0b 00 add hl, de ; 05ae: 19 ld d, [hl] ; 05af: 56 ld a, d ; 05b0: 7a and $1f ; 05b1: e6 1f ld e, a ; 05b3: 5f ld hl, $d008 ; 05b4: 21 08 d0 ld a, [hld] ; 05b7: 3a ld [hli], a ; 05b8: 22 ld a, e ; 05b9: 7b ld [hl], a ; 05ba: 77 ld a, d ; 05bb: 7a and $e0 ; 05bc: e6 e0 rlc a ; 05be: 07 rlc a ; 05bf: 07 rlc a ; 05c0: 07 ld e, a ; 05c1: 5f ld hl, $d00b ; 05c2: 21 0b d0 ld a, [hld] ; 05c5: 3a ld [hli], a ; 05c6: 22 ld a, e ; 05c7: 7b ld [hl], a ; 05c8: 77 call Function04e9 ; 05c9: cd e9 04 call Function0528 ; 05cc: cd 28 05 .done: ret ; 05cf: c9 Function05d0: call Function0211 ; 05d0: cd 11 02 ; hl = pointer to CGB flag in cartridge header ld a, [$0143] ; 05d3: fa 43 01 bit 7, a ; 05d6: cb 7f jr z, .ok ; 05d8: 28 04 ld [rLCDMODE], a ; 05da: e0 4c jr .done ; 05dc: 18 28 .ok: ld a, $4 ; 05de: 3e 04 ld [rLCDMODE], a ; 05e0: e0 4c ld a, $1 ; 05e2: 3e 01 ld [rUNKNOWN1], a ; 05e4: e0 6c ld hl, $da00 ; 05e6: 21 00 da call Function057b ; 05e9: cd 7b 05 ld b, $10 ; 05ec: 06 10 ld d, $0 ; 05ee: 16 00 ld e, $8 ; 05f0: 1e 08 call Function024a ; 05f2: cd 4a 02 ld hl, Unknown_007a ; 05f5: 21 7a 00 ld a, [$d000] ; 05f8: fa 00 d0 ld b, a ; 05fb: 47 ld c, 2 ; 05fc: 0e 02 .do_2: ld a, [hli] ; 05fe: 2a cp b ; 05ff: b8 call z, Function03da ; 0600: cc da 03 dec c ; 0603: 0d jr nz, .do_2 ; 0604: 20 f8 .done: ret ; 0606: c9 Unknown_0607: db $01, $0f, $3f, $7e, $ff, $ff, $c0, $00 ; 0607-060e db $c0, $f0, $f1, $03, $7c, $fc, $fe, $fe ; 060f-0616 db $03, $07, $07, $0f, $e0, $e0, $f0, $f0 ; 0617-061e db $1e, $3e, $7e, $fe, $0f, $0f, $1f, $1f ; 061f-0626 db $ff, $ff, $00, $00, $01, $01, $01, $03 ; 0627-062e db $ff, $ff, $e1, $e0, $c0, $f0, $f9, $fb ; 062f-0636 db $1f, $7f, $f8, $e0, $f3, $fd, $3e, $1e ; 0637-063e db $e0, $f0, $f9, $7f, $3e, $7c, $f8, $e0 ; 063f-0646 db $f8, $f0, $f0, $f8, $00, $00, $7f, $7f ; 0647-064e db $07, $0f, $9f, $bf, $9e, $1f, $ff, $ff ; 064f-0656 db $0f, $1e, $3e, $3c, $f1, $fb, $7f, $7f ; 0657-065e db $fe, $de, $df, $9f, $1f, $3f, $3e, $3c ; 065f-0666 db $f8, $f8, $00, $00, $03, $03, $07, $07 ; 0667-066e db $ff, $ff, $c1, $c0, $f3, $e7, $f7, $f3 ; 066f-0676 db $c0, $c0, $c0, $c0, $1f, $1f, $1e, $3e ; 0677-067e db $3f, $1f, $3e, $3e, $80, $00, $00, $00 ; 067f-0686 db $7c, $1f, $07, $00, $0f, $ff, $fe, $00 ; 0687-068e db $7c, $f8, $f0, $00, $1f, $0f, $0f, $00 ; 068f-0696 db $7c, $f8, $f8, $00, $3f, $3e, $1c, $00 ; 0697-069e db $0f, $0f, $0f, $00, $7c, $ff, $ff, $00 ; 069f-06a6 db $00, $f8, $f8, $00, $07, $0f, $0f, $00 ; 06a7-06ae db $81, $ff, $ff, $00, $f3, $e1, $80, $00 ; 06af-06b6 db $e0, $ff, $7f, $00, $fc, $f0, $c0, $00 ; 06b7-06be db $3e, $7c, $7c, $00, $00, $00, $00, $00 ; 06bf-06c6 Unknown_06c7: db $00, $88, $16, $36, $d1, $db, $f2, $3c ; 06c7-06ce db $8c, $92, $3d, $5c, $58, $c9, $3e, $70 ; 06cf-06d6 db $1d, $59, $69, $19, $35, $a8, $14, $aa ; 06d7-06de db $75, $95, $99, $34, $6f, $15, $ff, $97 ; 06df-06e6 db $4b, $90, $17, $10, $39, $f7, $f6, $a2 ; 06e7-06ee db $49, $4e, $43, $68, $e0, $8b, $f0, $ce ; 06ef-06f6 db $0c, $29, $e8, $b7, $86, $9a, $52, $01 ; 06f7-06fe db $9d, $71, $9c, $bd, $5d, $6d, $67, $3f ; 06ff-0706 db $6b, $b3, $46, $28, $a5, $c6, $d3, $27 ; 0707-070e db $61, $18, $66, $6a, $bf, $0d, $f4 ; 070f-0715 Unknown_0716: db $42 ; 0716 db $45, $46, $41, $41, $52, $42, $45, $4b ; 0717-071e db $45, $4b, $20, $52, $2d, $55, $52, $41 ; 071f-0726 db $52, $20, $49, $4e, $41, $49, $4c, $49 ; 0727-072e db $43, $45, $20, $52 ; 072f-0732 Unknown_0733: db $7c, $08, $12, $a3 ; 0733-0736 db $a2, $07, $87, $4b, $20, $12, $65, $a8 ; 0737-073e db $16, $a9, $86, $b1, $68, $a0, $87, $66 ; 073f-0746 db $12, $a1, $30, $3c, $12, $85, $12, $64 ; 0747-074e db $1b, $07, $06, $6f, $6e, $6e, $ae, $af ; 074f-0756 db $6f, $b2, $af, $b2, $a8, $ab, $6f, $af ; 0757-075e db $86, $ae, $a2, $a2, $12, $af, $13, $12 ; 075f-0766 db $a1, $6e, $af, $af, $ad, $06, $4c, $6e ; 0767-076e db $af, $af, $12, $7c, $ac, $a8, $6a, $6e ; 076f-0776 db $13, $a0, $2d, $a8, $2b, $ac, $64, $ac ; 0777-077e db $6d, $87, $bc, $60, $b4, $13, $72, $7c ; 077f-0786 db $b5, $ae, $ae, $7c, $7c, $65, $a2, $6c ; 0787-078e db $64, $85 ; 078f-0790 Unknown_0791: db $80, $b0, $40, $88, $20, $68 ; 0791-0796 db $de, $00, $70, $de, $20, $78, $20, $20 ; 0797-079e db $38, $20, $b0, $90, $20, $b0, $a0, $e0 ; 079f-07a6 db $b0, $c0, $98, $b6, $48, $80, $e0, $50 ; 07a7-07ae db $1e, $1e, $58, $20, $b8, $e0, $88, $b0 ; 07af-07b6 db $10, $20, $00, $10, $20, $e0, $18, $e0 ; 07b7-07be db $18, $00, $18, $e0, $20, $a8, $e0, $20 ; 07bf-07c6 db $18, $e0, $00, $20, $18, $d8, $c8, $18 ; 07c7-07ce db $e0, $00, $e0, $40, $28, $28, $28, $18 ; 07cf-07d6 db $e0, $60, $20, $18, $e0, $00, $00, $08 ; 07d7-07de db $e0, $18, $30, $d0, $d0, $d0, $20, $e0 ; 07df-07e6 db $e8 ; 07e7 Unknown_07e8: db $ff, $7f, $bf, $32, $d0, $00, $00 ; 07e8-07ee db $00, $9f, $63, $79, $42, $b0, $15, $cb ; 07ef-07f6 db $04, $ff, $7f, $31, $6e, $4a, $45, $00 ; 07f7-07fe db $00, $ff, $7f, $ef, $1b, $00, $02, $00 ; 07ff-0806 db $00, $ff, $7f, $1f, $42, $f2, $1c, $00 ; 0807-080e db $00, $ff, $7f, $94, $52, $4a, $29, $00 ; 080f-0816 db $00, $ff, $7f, $ff, $03, $2f, $01, $00 ; 0817-081e db $00, $ff, $7f, $ef, $03, $d6, $01, $00 ; 081f-0826 db $00, $ff, $7f, $b5, $42, $c8, $3d, $00 ; 0827-082e db $00, $74, $7e, $ff, $03, $80, $01, $00 ; 082f-0836 db $00, $ff, $67, $ac, $77, $13, $1a, $6b ; 0837-083e db $2d, $d6, $7e, $ff, $4b, $75, $21, $00 ; 083f-0846 db $00, $ff, $53, $5f, $4a, $52, $7e, $00 ; 0847-084e db $00, $ff, $4f, $d2, $7e, $4c, $3a, $e0 ; 084f-0856 db $1c, $ed, $03, $ff, $7f, $5f, $25, $00 ; 0857-085e db $00, $6a, $03, $1f, $02, $ff, $03, $ff ; 085f-0866 db $7f, $ff, $7f, $df, $01, $12, $01, $00 ; 0867-086e db $00, $1f, $23, $5f, $03, $f2, $00, $09 ; 086f-0876 db $00, $ff, $7f, $ea, $03, $1f, $01, $00 ; 0877-087e db $00, $9f, $29, $1a, $00, $0c, $00, $00 ; 087f-0886 db $00, $ff, $7f, $7f, $02, $1f, $00, $00 ; 0887-088e db $00, $ff, $7f, $e0, $03, $06, $02, $20 ; 088f-0896 db $01, $ff, $7f, $eb, $7e, $1f, $00, $00 ; 0897-089e db $7c, $ff, $7f, $ff, $3f, $00, $7e, $1f ; 089f-08a6 db $00, $ff, $7f, $ff, $03, $1f, $00, $00 ; 08a7-08ae db $00, $ff, $03, $1f, $00, $0c, $00, $00 ; 08af-08b6 db $00, $ff, $7f, $3f, $03, $93, $01, $00 ; 08b7-08be db $00, $00, $00, $00, $42, $7f, $03, $ff ; 08bf-08c6 db $7f, $ff, $7f, $8c, $7e, $00, $7c, $00 ; 08c7-08ce db $00, $ff, $7f, $ef, $1b, $80, $61, $00 ; 08cf-08d6 db $00 ; 08d7 Unknown_08d8: db $ff, $7f, $00, $7c, $e0, $03, $1f ; 08d8-08de db $7c, $1f, $00, $ff, $03 ; 08df-08e3 Unknown_08e4: db $40, $41, $42 ; 08e4-08e6 db $20, $21, $22, $80, $81, $82, $10, $11 ; 08e7-08ee db $12, $12, $b0, $79, $b8, $ad, $16, $17 ; 08ef-08f6 db $07, $ba, $05, $7c, $13, $00, $00, $00 ; 08f7-08fe db $00 ; 08ff-08ff
programs/oeis/082/A082206.asm
neoneye/loda
22
245818
<filename>programs/oeis/082/A082206.asm<gh_stars>10-100 ; A082206: Digit sum of A082205(n). ; 1,4,7,10,11,14,17,18,21,24,25,28,31,32,35,38,39,42,45,46,49,52,53,56,59,60,63,66,67,70,73,74,77,80,81,84,87,88,91,94,95,98,101,102,105,108,109,112,115,116,119,122,123,126,129,130,133,136,137,140,143,144 mul $0,7 mov $1,$0 lpb $1 add $0,2 sub $1,1 mod $1,3 lpe div $0,3 add $0,1
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1804.asm
ljhsiun2/medusa
9
89716
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r14 push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0xcd45, %r10 nop nop nop nop nop and %r12, %r12 vmovups (%r10), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %rsi nop nop nop and %rbp, %rbp lea addresses_D_ht+0x12d45, %rsi lea addresses_WC_ht+0x1b4c5, %rdi nop cmp $46065, %rbp mov $90, %rcx rep movsq nop nop nop nop nop cmp %rcx, %rcx lea addresses_normal_ht+0xd4c5, %rsi lea addresses_WT_ht+0x18ac5, %rdi nop nop add %r12, %r12 mov $113, %rcx rep movsl cmp %rsi, %rsi lea addresses_WT_ht+0x16aab, %r10 nop nop nop nop nop xor $62707, %r14 mov $0x6162636465666768, %rsi movq %rsi, %xmm0 vmovups %ymm0, (%r10) and %rcx, %rcx lea addresses_normal_ht+0x17ffe, %rdi clflush (%rdi) nop nop xor %rcx, %rcx movups (%rdi), %xmm1 vpextrq $0, %xmm1, %r10 nop nop cmp %rdi, %rdi lea addresses_normal_ht+0x6291, %r10 nop and %rcx, %rcx movb (%r10), %r12b nop nop nop sub $59623, %rsi lea addresses_UC_ht+0x77c5, %rsi lea addresses_UC_ht+0x13315, %rdi nop nop nop add $34423, %rbp mov $122, %rcx rep movsw nop nop sub %r14, %r14 lea addresses_WC_ht+0x1bf41, %rsi nop nop xor %r10, %r10 mov (%rsi), %di nop nop xor $55014, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %r14 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r15 push %rbx push %rsi // Faulty Load lea addresses_normal+0xd4c5, %rbx nop nop nop nop cmp %r14, %r14 mov (%rbx), %r12 lea oracles, %rbx and $0xff, %r12 shlq $12, %r12 mov (%rbx,%r12,1), %r12 pop %rsi pop %rbx pop %r15 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': True, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': True}} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
mc-sema/validator/x86_64/tests/AND16mr.asm
randolphwong/mcsema
2
102294
BITS 64 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS=FLAG_AF ;TEST_FILE_META_END ; AND16mr ;TEST_BEGIN_RECORDING lea rax, [rsp-0x4] mov DWORD [rax], 0x5555 mov ebx, 0x7777 and WORD [rax], bx mov eax, 0x0 ;TEST_END_RECORDING
blst/build/win64/add_mod_256-x86_64.asm
vmx/lotus-blst
9
13933
OPTION DOTNAME .text$ SEGMENT ALIGN(256) 'CODE' PUBLIC add_mod_256 ALIGN 32 add_mod_256 PROC PUBLIC DB 243,15,30,250 mov QWORD PTR[8+rsp],rdi ;WIN64 prologue mov QWORD PTR[16+rsp],rsi mov r11,rsp $L$SEH_begin_add_mod_256:: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 push rbp push rbx sub rsp,8 $L$SEH_body_add_mod_256:: mov r8,QWORD PTR[rsi] mov r9,QWORD PTR[8+rsi] mov r10,QWORD PTR[16+rsi] mov r11,QWORD PTR[24+rsi] $L$oaded_a_add_mod_256:: add r8,QWORD PTR[rdx] adc r9,QWORD PTR[8+rdx] mov rax,r8 adc r10,QWORD PTR[16+rdx] mov rsi,r9 adc r11,QWORD PTR[24+rdx] sbb rdx,rdx mov rbx,r10 sub r8,QWORD PTR[rcx] sbb r9,QWORD PTR[8+rcx] sbb r10,QWORD PTR[16+rcx] mov rbp,r11 sbb r11,QWORD PTR[24+rcx] sbb rdx,0 cmovc r8,rax cmovc r9,rsi mov QWORD PTR[rdi],r8 cmovc r10,rbx mov QWORD PTR[8+rdi],r9 cmovc r11,rbp mov QWORD PTR[16+rdi],r10 mov QWORD PTR[24+rdi],r11 mov rbx,QWORD PTR[8+rsp] mov rbp,QWORD PTR[16+rsp] lea rsp,QWORD PTR[24+rsp] $L$SEH_epilogue_add_mod_256:: mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue mov rsi,QWORD PTR[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_add_mod_256:: add_mod_256 ENDP PUBLIC mul_by_3_mod_256 ALIGN 32 mul_by_3_mod_256 PROC PUBLIC DB 243,15,30,250 mov QWORD PTR[8+rsp],rdi ;WIN64 prologue mov QWORD PTR[16+rsp],rsi mov r11,rsp $L$SEH_begin_mul_by_3_mod_256:: mov rdi,rcx mov rsi,rdx mov rdx,r8 push rbp push rbx push r12 $L$SEH_body_mul_by_3_mod_256:: mov rcx,rdx mov r8,QWORD PTR[rsi] mov r9,QWORD PTR[8+rsi] mov r10,QWORD PTR[16+rsi] mov rdx,rsi mov r11,QWORD PTR[24+rsi] call __lshift_mod_256 mov r12,QWORD PTR[rsp] jmp $L$oaded_a_add_mod_256 mov rbx,QWORD PTR[8+rsp] mov rbp,QWORD PTR[16+rsp] lea rsp,QWORD PTR[24+rsp] $L$SEH_epilogue_mul_by_3_mod_256:: mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue mov rsi,QWORD PTR[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_mul_by_3_mod_256:: mul_by_3_mod_256 ENDP ALIGN 32 __lshift_mod_256 PROC PRIVATE DB 243,15,30,250 add r8,r8 adc r9,r9 mov rax,r8 adc r10,r10 mov rsi,r9 adc r11,r11 sbb r12,r12 mov rbx,r10 sub r8,QWORD PTR[rcx] sbb r9,QWORD PTR[8+rcx] sbb r10,QWORD PTR[16+rcx] mov rbp,r11 sbb r11,QWORD PTR[24+rcx] sbb r12,0 cmovc r8,rax cmovc r9,rsi cmovc r10,rbx cmovc r11,rbp DB 0F3h,0C3h ;repret __lshift_mod_256 ENDP PUBLIC lshift_mod_256 ALIGN 32 lshift_mod_256 PROC PUBLIC DB 243,15,30,250 mov QWORD PTR[8+rsp],rdi ;WIN64 prologue mov QWORD PTR[16+rsp],rsi mov r11,rsp $L$SEH_begin_lshift_mod_256:: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 push rbp push rbx push r12 $L$SEH_body_lshift_mod_256:: mov r8,QWORD PTR[rsi] mov r9,QWORD PTR[8+rsi] mov r10,QWORD PTR[16+rsi] mov r11,QWORD PTR[24+rsi] $L$oop_lshift_mod_256:: call __lshift_mod_256 dec edx jnz $L$oop_lshift_mod_256 mov QWORD PTR[rdi],r8 mov QWORD PTR[8+rdi],r9 mov QWORD PTR[16+rdi],r10 mov QWORD PTR[24+rdi],r11 mov r12,QWORD PTR[rsp] mov rbx,QWORD PTR[8+rsp] mov rbp,QWORD PTR[16+rsp] lea rsp,QWORD PTR[24+rsp] $L$SEH_epilogue_lshift_mod_256:: mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue mov rsi,QWORD PTR[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_lshift_mod_256:: lshift_mod_256 ENDP PUBLIC rshift_mod_256 ALIGN 32 rshift_mod_256 PROC PUBLIC DB 243,15,30,250 mov QWORD PTR[8+rsp],rdi ;WIN64 prologue mov QWORD PTR[16+rsp],rsi mov r11,rsp $L$SEH_begin_rshift_mod_256:: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 push rbp push rbx sub rsp,8 $L$SEH_body_rshift_mod_256:: mov rbp,QWORD PTR[rsi] mov r9,QWORD PTR[8+rsi] mov r10,QWORD PTR[16+rsi] mov r11,QWORD PTR[24+rsi] $L$oop_rshift_mod_256:: mov r8,rbp and rbp,1 mov rax,QWORD PTR[rcx] neg rbp mov rsi,QWORD PTR[8+rcx] mov rbx,QWORD PTR[16+rcx] and rax,rbp and rsi,rbp and rbx,rbp and rbp,QWORD PTR[24+rcx] add r8,rax adc r9,rsi adc r10,rbx adc r11,rbp sbb rax,rax shr r8,1 mov rbp,r9 shr r9,1 mov rbx,r10 shr r10,1 mov rsi,r11 shr r11,1 shl rbp,63 shl rbx,63 or rbp,r8 shl rsi,63 or r9,rbx shl rax,63 or r10,rsi or r11,rax dec edx jnz $L$oop_rshift_mod_256 mov QWORD PTR[rdi],rbp mov QWORD PTR[8+rdi],r9 mov QWORD PTR[16+rdi],r10 mov QWORD PTR[24+rdi],r11 mov rbx,QWORD PTR[8+rsp] mov rbp,QWORD PTR[16+rsp] lea rsp,QWORD PTR[24+rsp] $L$SEH_epilogue_rshift_mod_256:: mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue mov rsi,QWORD PTR[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_rshift_mod_256:: rshift_mod_256 ENDP PUBLIC cneg_mod_256 ALIGN 32 cneg_mod_256 PROC PUBLIC DB 243,15,30,250 mov QWORD PTR[8+rsp],rdi ;WIN64 prologue mov QWORD PTR[16+rsp],rsi mov r11,rsp $L$SEH_begin_cneg_mod_256:: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 push rbp push rbx push r12 $L$SEH_body_cneg_mod_256:: mov r12,QWORD PTR[rsi] mov r9,QWORD PTR[8+rsi] mov r10,QWORD PTR[16+rsi] mov r8,r12 mov r11,QWORD PTR[24+rsi] or r12,r9 or r12,r10 or r12,r11 mov rbp,-1 mov rax,QWORD PTR[rcx] cmovnz r12,rbp mov rsi,QWORD PTR[8+rcx] mov rbx,QWORD PTR[16+rcx] and rax,r12 mov rbp,QWORD PTR[24+rcx] and rsi,r12 and rbx,r12 and rbp,r12 sub rax,r8 sbb rsi,r9 sbb rbx,r10 sbb rbp,r11 or rdx,rdx cmovz rax,r8 cmovz rsi,r9 mov QWORD PTR[rdi],rax cmovz rbx,r10 mov QWORD PTR[8+rdi],rsi cmovz rbp,r11 mov QWORD PTR[16+rdi],rbx mov QWORD PTR[24+rdi],rbp mov r12,QWORD PTR[rsp] mov rbx,QWORD PTR[8+rsp] mov rbp,QWORD PTR[16+rsp] lea rsp,QWORD PTR[24+rsp] $L$SEH_epilogue_cneg_mod_256:: mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue mov rsi,QWORD PTR[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_cneg_mod_256:: cneg_mod_256 ENDP PUBLIC sub_mod_256 ALIGN 32 sub_mod_256 PROC PUBLIC DB 243,15,30,250 mov QWORD PTR[8+rsp],rdi ;WIN64 prologue mov QWORD PTR[16+rsp],rsi mov r11,rsp $L$SEH_begin_sub_mod_256:: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rcx,r9 push rbp push rbx sub rsp,8 $L$SEH_body_sub_mod_256:: mov r8,QWORD PTR[rsi] mov r9,QWORD PTR[8+rsi] mov r10,QWORD PTR[16+rsi] mov r11,QWORD PTR[24+rsi] sub r8,QWORD PTR[rdx] mov rax,QWORD PTR[rcx] sbb r9,QWORD PTR[8+rdx] mov rsi,QWORD PTR[8+rcx] sbb r10,QWORD PTR[16+rdx] mov rbx,QWORD PTR[16+rcx] sbb r11,QWORD PTR[24+rdx] mov rbp,QWORD PTR[24+rcx] sbb rdx,rdx and rax,rdx and rsi,rdx and rbx,rdx and rbp,rdx add r8,rax adc r9,rsi mov QWORD PTR[rdi],r8 adc r10,rbx mov QWORD PTR[8+rdi],r9 adc r11,rbp mov QWORD PTR[16+rdi],r10 mov QWORD PTR[24+rdi],r11 mov rbx,QWORD PTR[8+rsp] mov rbp,QWORD PTR[16+rsp] lea rsp,QWORD PTR[24+rsp] $L$SEH_epilogue_sub_mod_256:: mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue mov rsi,QWORD PTR[16+rsp] DB 0F3h,0C3h ;repret $L$SEH_end_sub_mod_256:: sub_mod_256 ENDP .text$ ENDS .pdata SEGMENT READONLY ALIGN(4) ALIGN 4 DD imagerel $L$SEH_begin_add_mod_256 DD imagerel $L$SEH_body_add_mod_256 DD imagerel $L$SEH_info_add_mod_256_prologue DD imagerel $L$SEH_body_add_mod_256 DD imagerel $L$SEH_epilogue_add_mod_256 DD imagerel $L$SEH_info_add_mod_256_body DD imagerel $L$SEH_epilogue_add_mod_256 DD imagerel $L$SEH_end_add_mod_256 DD imagerel $L$SEH_info_add_mod_256_epilogue DD imagerel $L$SEH_begin_mul_by_3_mod_256 DD imagerel $L$SEH_body_mul_by_3_mod_256 DD imagerel $L$SEH_info_mul_by_3_mod_256_prologue DD imagerel $L$SEH_body_mul_by_3_mod_256 DD imagerel $L$SEH_epilogue_mul_by_3_mod_256 DD imagerel $L$SEH_info_mul_by_3_mod_256_body DD imagerel $L$SEH_epilogue_mul_by_3_mod_256 DD imagerel $L$SEH_end_mul_by_3_mod_256 DD imagerel $L$SEH_info_mul_by_3_mod_256_epilogue DD imagerel $L$SEH_begin_lshift_mod_256 DD imagerel $L$SEH_body_lshift_mod_256 DD imagerel $L$SEH_info_lshift_mod_256_prologue DD imagerel $L$SEH_body_lshift_mod_256 DD imagerel $L$SEH_epilogue_lshift_mod_256 DD imagerel $L$SEH_info_lshift_mod_256_body DD imagerel $L$SEH_epilogue_lshift_mod_256 DD imagerel $L$SEH_end_lshift_mod_256 DD imagerel $L$SEH_info_lshift_mod_256_epilogue DD imagerel $L$SEH_begin_rshift_mod_256 DD imagerel $L$SEH_body_rshift_mod_256 DD imagerel $L$SEH_info_rshift_mod_256_prologue DD imagerel $L$SEH_body_rshift_mod_256 DD imagerel $L$SEH_epilogue_rshift_mod_256 DD imagerel $L$SEH_info_rshift_mod_256_body DD imagerel $L$SEH_epilogue_rshift_mod_256 DD imagerel $L$SEH_end_rshift_mod_256 DD imagerel $L$SEH_info_rshift_mod_256_epilogue DD imagerel $L$SEH_begin_cneg_mod_256 DD imagerel $L$SEH_body_cneg_mod_256 DD imagerel $L$SEH_info_cneg_mod_256_prologue DD imagerel $L$SEH_body_cneg_mod_256 DD imagerel $L$SEH_epilogue_cneg_mod_256 DD imagerel $L$SEH_info_cneg_mod_256_body DD imagerel $L$SEH_epilogue_cneg_mod_256 DD imagerel $L$SEH_end_cneg_mod_256 DD imagerel $L$SEH_info_cneg_mod_256_epilogue DD imagerel $L$SEH_begin_sub_mod_256 DD imagerel $L$SEH_body_sub_mod_256 DD imagerel $L$SEH_info_sub_mod_256_prologue DD imagerel $L$SEH_body_sub_mod_256 DD imagerel $L$SEH_epilogue_sub_mod_256 DD imagerel $L$SEH_info_sub_mod_256_body DD imagerel $L$SEH_epilogue_sub_mod_256 DD imagerel $L$SEH_end_sub_mod_256 DD imagerel $L$SEH_info_sub_mod_256_epilogue .pdata ENDS .xdata SEGMENT READONLY ALIGN(8) ALIGN 8 $L$SEH_info_add_mod_256_prologue:: DB 1,0,5,00bh DB 0,074h,1,0 DB 0,064h,2,0 DB 0,003h DB 0,0 $L$SEH_info_add_mod_256_body:: DB 1,0,9,0 DB 000h,034h,001h,000h DB 000h,054h,002h,000h DB 000h,074h,004h,000h DB 000h,064h,005h,000h DB 000h,022h DB 000h,000h $L$SEH_info_add_mod_256_epilogue:: DB 1,0,4,0 DB 000h,074h,001h,000h DB 000h,064h,002h,000h DB 000h,000h,000h,000h $L$SEH_info_mul_by_3_mod_256_prologue:: DB 1,0,5,00bh DB 0,074h,1,0 DB 0,064h,2,0 DB 0,003h DB 0,0 $L$SEH_info_mul_by_3_mod_256_body:: DB 1,0,11,0 DB 000h,0c4h,000h,000h DB 000h,034h,001h,000h DB 000h,054h,002h,000h DB 000h,074h,004h,000h DB 000h,064h,005h,000h DB 000h,022h DB 000h,000h,000h,000h,000h,000h $L$SEH_info_mul_by_3_mod_256_epilogue:: DB 1,0,4,0 DB 000h,074h,001h,000h DB 000h,064h,002h,000h DB 000h,000h,000h,000h $L$SEH_info_lshift_mod_256_prologue:: DB 1,0,5,00bh DB 0,074h,1,0 DB 0,064h,2,0 DB 0,003h DB 0,0 $L$SEH_info_lshift_mod_256_body:: DB 1,0,11,0 DB 000h,0c4h,000h,000h DB 000h,034h,001h,000h DB 000h,054h,002h,000h DB 000h,074h,004h,000h DB 000h,064h,005h,000h DB 000h,022h DB 000h,000h,000h,000h,000h,000h $L$SEH_info_lshift_mod_256_epilogue:: DB 1,0,4,0 DB 000h,074h,001h,000h DB 000h,064h,002h,000h DB 000h,000h,000h,000h $L$SEH_info_rshift_mod_256_prologue:: DB 1,0,5,00bh DB 0,074h,1,0 DB 0,064h,2,0 DB 0,003h DB 0,0 $L$SEH_info_rshift_mod_256_body:: DB 1,0,9,0 DB 000h,034h,001h,000h DB 000h,054h,002h,000h DB 000h,074h,004h,000h DB 000h,064h,005h,000h DB 000h,022h DB 000h,000h $L$SEH_info_rshift_mod_256_epilogue:: DB 1,0,4,0 DB 000h,074h,001h,000h DB 000h,064h,002h,000h DB 000h,000h,000h,000h $L$SEH_info_cneg_mod_256_prologue:: DB 1,0,5,00bh DB 0,074h,1,0 DB 0,064h,2,0 DB 0,003h DB 0,0 $L$SEH_info_cneg_mod_256_body:: DB 1,0,11,0 DB 000h,0c4h,000h,000h DB 000h,034h,001h,000h DB 000h,054h,002h,000h DB 000h,074h,004h,000h DB 000h,064h,005h,000h DB 000h,022h DB 000h,000h,000h,000h,000h,000h $L$SEH_info_cneg_mod_256_epilogue:: DB 1,0,4,0 DB 000h,074h,001h,000h DB 000h,064h,002h,000h DB 000h,000h,000h,000h $L$SEH_info_sub_mod_256_prologue:: DB 1,0,5,00bh DB 0,074h,1,0 DB 0,064h,2,0 DB 0,003h DB 0,0 $L$SEH_info_sub_mod_256_body:: DB 1,0,9,0 DB 000h,034h,001h,000h DB 000h,054h,002h,000h DB 000h,074h,004h,000h DB 000h,064h,005h,000h DB 000h,022h DB 000h,000h $L$SEH_info_sub_mod_256_epilogue:: DB 1,0,4,0 DB 000h,074h,001h,000h DB 000h,064h,002h,000h DB 000h,000h,000h,000h .xdata ENDS END
obj/user/badsegment.asm
SongBiu/JOS
0
99128
obj/user/badsegment: file format elf32-i386 Disassembly of section .text: 00800020 <_start>: // starts us running when we are initially loaded into a new environment. .text .globl _start _start: // See if we were started with arguments on the stack cmpl $USTACKTOP, %esp 800020: 81 fc 00 e0 bf ee cmp $0xeebfe000,%esp jne args_exist 800026: 75 04 jne 80002c <args_exist> // If not, push dummy argc/argv arguments. // This happens when we are loaded by the kernel, // because the kernel does not know about passing arguments. pushl $0 800028: 6a 00 push $0x0 pushl $0 80002a: 6a 00 push $0x0 0080002c <args_exist>: args_exist: call libmain 80002c: e8 0d 00 00 00 call 80003e <libmain> 1: jmp 1b 800031: eb fe jmp 800031 <args_exist+0x5> 00800033 <umain>: #include <inc/lib.h> void umain(int argc, char **argv) { 800033: 55 push %ebp 800034: 89 e5 mov %esp,%ebp // Try to load the kernel's TSS selector into the DS register. asm volatile("movw $0x28,%ax; movw %ax,%ds"); 800036: 66 b8 28 00 mov $0x28,%ax 80003a: 8e d8 mov %eax,%ds } 80003c: 5d pop %ebp 80003d: c3 ret 0080003e <libmain>: const volatile struct Env *thisenv; const char *binaryname = "<unknown>"; void libmain(int argc, char **argv) { 80003e: 55 push %ebp 80003f: 89 e5 mov %esp,%ebp 800041: 57 push %edi 800042: 56 push %esi 800043: 53 push %ebx 800044: 83 ec 0c sub $0xc,%esp 800047: e8 50 00 00 00 call 80009c <__x86.get_pc_thunk.bx> 80004c: 81 c3 b4 1f 00 00 add $0x1fb4,%ebx 800052: 8b 75 08 mov 0x8(%ebp),%esi 800055: 8b 7d 0c mov 0xc(%ebp),%edi // set thisenv to point at our Env structure in envs[]. // LAB 3: Your code here. thisenv = &envs[ENVX(sys_getenvid())]; 800058: e8 f6 00 00 00 call 800153 <sys_getenvid> 80005d: 25 ff 03 00 00 and $0x3ff,%eax 800062: 8d 04 40 lea (%eax,%eax,2),%eax 800065: c1 e0 05 shl $0x5,%eax 800068: 81 c0 00 00 c0 ee add $0xeec00000,%eax 80006e: c7 c2 2c 20 80 00 mov $0x80202c,%edx 800074: 89 02 mov %eax,(%edx) // save the name of the program so that panic() can use it if (argc > 0) 800076: 85 f6 test %esi,%esi 800078: 7e 08 jle 800082 <libmain+0x44> binaryname = argv[0]; 80007a: 8b 07 mov (%edi),%eax 80007c: 89 83 0c 00 00 00 mov %eax,0xc(%ebx) // call user main routine umain(argc, argv); 800082: 83 ec 08 sub $0x8,%esp 800085: 57 push %edi 800086: 56 push %esi 800087: e8 a7 ff ff ff call 800033 <umain> // exit gracefully exit(); 80008c: e8 0f 00 00 00 call 8000a0 <exit> } 800091: 83 c4 10 add $0x10,%esp 800094: 8d 65 f4 lea -0xc(%ebp),%esp 800097: 5b pop %ebx 800098: 5e pop %esi 800099: 5f pop %edi 80009a: 5d pop %ebp 80009b: c3 ret 0080009c <__x86.get_pc_thunk.bx>: 80009c: 8b 1c 24 mov (%esp),%ebx 80009f: c3 ret 008000a0 <exit>: #include <inc/lib.h> void exit(void) { 8000a0: 55 push %ebp 8000a1: 89 e5 mov %esp,%ebp 8000a3: 53 push %ebx 8000a4: 83 ec 10 sub $0x10,%esp 8000a7: e8 f0 ff ff ff call 80009c <__x86.get_pc_thunk.bx> 8000ac: 81 c3 54 1f 00 00 add $0x1f54,%ebx sys_env_destroy(0); 8000b2: 6a 00 push $0x0 8000b4: e8 45 00 00 00 call 8000fe <sys_env_destroy> } 8000b9: 83 c4 10 add $0x10,%esp 8000bc: 8b 5d fc mov -0x4(%ebp),%ebx 8000bf: c9 leave 8000c0: c3 ret 008000c1 <sys_cputs>: return ret; } void sys_cputs(const char *s, size_t len) { 8000c1: 55 push %ebp 8000c2: 89 e5 mov %esp,%ebp 8000c4: 57 push %edi 8000c5: 56 push %esi 8000c6: 53 push %ebx asm volatile("int %1\n" 8000c7: b8 00 00 00 00 mov $0x0,%eax 8000cc: 8b 55 08 mov 0x8(%ebp),%edx 8000cf: 8b 4d 0c mov 0xc(%ebp),%ecx 8000d2: 89 c3 mov %eax,%ebx 8000d4: 89 c7 mov %eax,%edi 8000d6: 89 c6 mov %eax,%esi 8000d8: cd 30 int $0x30 syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0); } 8000da: 5b pop %ebx 8000db: 5e pop %esi 8000dc: 5f pop %edi 8000dd: 5d pop %ebp 8000de: c3 ret 008000df <sys_cgetc>: int sys_cgetc(void) { 8000df: 55 push %ebp 8000e0: 89 e5 mov %esp,%ebp 8000e2: 57 push %edi 8000e3: 56 push %esi 8000e4: 53 push %ebx asm volatile("int %1\n" 8000e5: ba 00 00 00 00 mov $0x0,%edx 8000ea: b8 01 00 00 00 mov $0x1,%eax 8000ef: 89 d1 mov %edx,%ecx 8000f1: 89 d3 mov %edx,%ebx 8000f3: 89 d7 mov %edx,%edi 8000f5: 89 d6 mov %edx,%esi 8000f7: cd 30 int $0x30 return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0); } 8000f9: 5b pop %ebx 8000fa: 5e pop %esi 8000fb: 5f pop %edi 8000fc: 5d pop %ebp 8000fd: c3 ret 008000fe <sys_env_destroy>: int sys_env_destroy(envid_t envid) { 8000fe: 55 push %ebp 8000ff: 89 e5 mov %esp,%ebp 800101: 57 push %edi 800102: 56 push %esi 800103: 53 push %ebx 800104: 83 ec 1c sub $0x1c,%esp 800107: e8 66 00 00 00 call 800172 <__x86.get_pc_thunk.ax> 80010c: 05 f4 1e 00 00 add $0x1ef4,%eax 800111: 89 45 e4 mov %eax,-0x1c(%ebp) asm volatile("int %1\n" 800114: b9 00 00 00 00 mov $0x0,%ecx 800119: 8b 55 08 mov 0x8(%ebp),%edx 80011c: b8 03 00 00 00 mov $0x3,%eax 800121: 89 cb mov %ecx,%ebx 800123: 89 cf mov %ecx,%edi 800125: 89 ce mov %ecx,%esi 800127: cd 30 int $0x30 if(check && ret > 0) 800129: 85 c0 test %eax,%eax 80012b: 7f 08 jg 800135 <sys_env_destroy+0x37> return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0); } 80012d: 8d 65 f4 lea -0xc(%ebp),%esp 800130: 5b pop %ebx 800131: 5e pop %esi 800132: 5f pop %edi 800133: 5d pop %ebp 800134: c3 ret panic("syscall %d returned %d (> 0)", num, ret); 800135: 83 ec 0c sub $0xc,%esp 800138: 50 push %eax 800139: 6a 03 push $0x3 80013b: 8b 5d e4 mov -0x1c(%ebp),%ebx 80013e: 8d 83 c6 ee ff ff lea -0x113a(%ebx),%eax 800144: 50 push %eax 800145: 6a 26 push $0x26 800147: 8d 83 e3 ee ff ff lea -0x111d(%ebx),%eax 80014d: 50 push %eax 80014e: e8 23 00 00 00 call 800176 <_panic> 00800153 <sys_getenvid>: envid_t sys_getenvid(void) { 800153: 55 push %ebp 800154: 89 e5 mov %esp,%ebp 800156: 57 push %edi 800157: 56 push %esi 800158: 53 push %ebx asm volatile("int %1\n" 800159: ba 00 00 00 00 mov $0x0,%edx 80015e: b8 02 00 00 00 mov $0x2,%eax 800163: 89 d1 mov %edx,%ecx 800165: 89 d3 mov %edx,%ebx 800167: 89 d7 mov %edx,%edi 800169: 89 d6 mov %edx,%esi 80016b: cd 30 int $0x30 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0); } 80016d: 5b pop %ebx 80016e: 5e pop %esi 80016f: 5f pop %edi 800170: 5d pop %ebp 800171: c3 ret 00800172 <__x86.get_pc_thunk.ax>: 800172: 8b 04 24 mov (%esp),%eax 800175: c3 ret 00800176 <_panic>: * It prints "panic: <message>", then causes a breakpoint exception, * which causes JOS to enter the JOS kernel monitor. */ void _panic(const char *file, int line, const char *fmt, ...) { 800176: 55 push %ebp 800177: 89 e5 mov %esp,%ebp 800179: 57 push %edi 80017a: 56 push %esi 80017b: 53 push %ebx 80017c: 83 ec 0c sub $0xc,%esp 80017f: e8 18 ff ff ff call 80009c <__x86.get_pc_thunk.bx> 800184: 81 c3 7c 1e 00 00 add $0x1e7c,%ebx va_list ap; va_start(ap, fmt); 80018a: 8d 75 14 lea 0x14(%ebp),%esi // Print the panic message cprintf("[%08x] user panic in %s at %s:%d: ", 80018d: c7 c0 0c 20 80 00 mov $0x80200c,%eax 800193: 8b 38 mov (%eax),%edi 800195: e8 b9 ff ff ff call 800153 <sys_getenvid> 80019a: 83 ec 0c sub $0xc,%esp 80019d: ff 75 0c pushl 0xc(%ebp) 8001a0: ff 75 08 pushl 0x8(%ebp) 8001a3: 57 push %edi 8001a4: 50 push %eax 8001a5: 8d 83 f4 ee ff ff lea -0x110c(%ebx),%eax 8001ab: 50 push %eax 8001ac: e8 d1 00 00 00 call 800282 <cprintf> sys_getenvid(), binaryname, file, line); vcprintf(fmt, ap); 8001b1: 83 c4 18 add $0x18,%esp 8001b4: 56 push %esi 8001b5: ff 75 10 pushl 0x10(%ebp) 8001b8: e8 63 00 00 00 call 800220 <vcprintf> cprintf("\n"); 8001bd: 8d 83 18 ef ff ff lea -0x10e8(%ebx),%eax 8001c3: 89 04 24 mov %eax,(%esp) 8001c6: e8 b7 00 00 00 call 800282 <cprintf> 8001cb: 83 c4 10 add $0x10,%esp // Cause a breakpoint exception while (1) asm volatile("int3"); 8001ce: cc int3 8001cf: eb fd jmp 8001ce <_panic+0x58> 008001d1 <putch>: }; static void putch(int ch, struct printbuf *b) { 8001d1: 55 push %ebp 8001d2: 89 e5 mov %esp,%ebp 8001d4: 56 push %esi 8001d5: 53 push %ebx 8001d6: e8 c1 fe ff ff call 80009c <__x86.get_pc_thunk.bx> 8001db: 81 c3 25 1e 00 00 add $0x1e25,%ebx 8001e1: 8b 75 0c mov 0xc(%ebp),%esi b->buf[b->idx++] = ch; 8001e4: 8b 16 mov (%esi),%edx 8001e6: 8d 42 01 lea 0x1(%edx),%eax 8001e9: 89 06 mov %eax,(%esi) 8001eb: 8b 4d 08 mov 0x8(%ebp),%ecx 8001ee: 88 4c 16 08 mov %cl,0x8(%esi,%edx,1) if (b->idx == 256-1) { 8001f2: 3d ff 00 00 00 cmp $0xff,%eax 8001f7: 74 0b je 800204 <putch+0x33> sys_cputs(b->buf, b->idx); b->idx = 0; } b->cnt++; 8001f9: 83 46 04 01 addl $0x1,0x4(%esi) } 8001fd: 8d 65 f8 lea -0x8(%ebp),%esp 800200: 5b pop %ebx 800201: 5e pop %esi 800202: 5d pop %ebp 800203: c3 ret sys_cputs(b->buf, b->idx); 800204: 83 ec 08 sub $0x8,%esp 800207: 68 ff 00 00 00 push $0xff 80020c: 8d 46 08 lea 0x8(%esi),%eax 80020f: 50 push %eax 800210: e8 ac fe ff ff call 8000c1 <sys_cputs> b->idx = 0; 800215: c7 06 00 00 00 00 movl $0x0,(%esi) 80021b: 83 c4 10 add $0x10,%esp 80021e: eb d9 jmp 8001f9 <putch+0x28> 00800220 <vcprintf>: int vcprintf(const char *fmt, va_list ap) { 800220: 55 push %ebp 800221: 89 e5 mov %esp,%ebp 800223: 53 push %ebx 800224: 81 ec 14 01 00 00 sub $0x114,%esp 80022a: e8 6d fe ff ff call 80009c <__x86.get_pc_thunk.bx> 80022f: 81 c3 d1 1d 00 00 add $0x1dd1,%ebx struct printbuf b; b.idx = 0; 800235: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) 80023c: 00 00 00 b.cnt = 0; 80023f: c7 85 f4 fe ff ff 00 movl $0x0,-0x10c(%ebp) 800246: 00 00 00 vprintfmt((void*)putch, &b, fmt, ap); 800249: ff 75 0c pushl 0xc(%ebp) 80024c: ff 75 08 pushl 0x8(%ebp) 80024f: 8d 85 f0 fe ff ff lea -0x110(%ebp),%eax 800255: 50 push %eax 800256: 8d 83 d1 e1 ff ff lea -0x1e2f(%ebx),%eax 80025c: 50 push %eax 80025d: e8 38 01 00 00 call 80039a <vprintfmt> sys_cputs(b.buf, b.idx); 800262: 83 c4 08 add $0x8,%esp 800265: ff b5 f0 fe ff ff pushl -0x110(%ebp) 80026b: 8d 85 f8 fe ff ff lea -0x108(%ebp),%eax 800271: 50 push %eax 800272: e8 4a fe ff ff call 8000c1 <sys_cputs> return b.cnt; } 800277: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax 80027d: 8b 5d fc mov -0x4(%ebp),%ebx 800280: c9 leave 800281: c3 ret 00800282 <cprintf>: int cprintf(const char *fmt, ...) { 800282: 55 push %ebp 800283: 89 e5 mov %esp,%ebp 800285: 83 ec 10 sub $0x10,%esp va_list ap; int cnt; va_start(ap, fmt); 800288: 8d 45 0c lea 0xc(%ebp),%eax cnt = vcprintf(fmt, ap); 80028b: 50 push %eax 80028c: ff 75 08 pushl 0x8(%ebp) 80028f: e8 8c ff ff ff call 800220 <vcprintf> va_end(ap); return cnt; } 800294: c9 leave 800295: c3 ret 00800296 <printnum>: * using specified putch function and associated pointer putdat. */ static void printnum(void (*putch)(int, void*), void *putdat, unsigned long long num, unsigned base, int width, int padc) { 800296: 55 push %ebp 800297: 89 e5 mov %esp,%ebp 800299: 57 push %edi 80029a: 56 push %esi 80029b: 53 push %ebx 80029c: 83 ec 2c sub $0x2c,%esp 80029f: e8 63 06 00 00 call 800907 <__x86.get_pc_thunk.cx> 8002a4: 81 c1 5c 1d 00 00 add $0x1d5c,%ecx 8002aa: 89 4d e4 mov %ecx,-0x1c(%ebp) 8002ad: 89 c7 mov %eax,%edi 8002af: 89 d6 mov %edx,%esi 8002b1: 8b 45 08 mov 0x8(%ebp),%eax 8002b4: 8b 55 0c mov 0xc(%ebp),%edx 8002b7: 89 45 d0 mov %eax,-0x30(%ebp) 8002ba: 89 55 d4 mov %edx,-0x2c(%ebp) // first recursively print all preceding (more significant) digits if (num >= base) { 8002bd: 8b 4d 10 mov 0x10(%ebp),%ecx 8002c0: bb 00 00 00 00 mov $0x0,%ebx 8002c5: 89 4d d8 mov %ecx,-0x28(%ebp) 8002c8: 89 5d dc mov %ebx,-0x24(%ebp) 8002cb: 39 d3 cmp %edx,%ebx 8002cd: 72 09 jb 8002d8 <printnum+0x42> 8002cf: 39 45 10 cmp %eax,0x10(%ebp) 8002d2: 0f 87 83 00 00 00 ja 80035b <printnum+0xc5> printnum(putch, putdat, num / base, base, width - 1, padc); 8002d8: 83 ec 0c sub $0xc,%esp 8002db: ff 75 18 pushl 0x18(%ebp) 8002de: 8b 45 14 mov 0x14(%ebp),%eax 8002e1: 8d 58 ff lea -0x1(%eax),%ebx 8002e4: 53 push %ebx 8002e5: ff 75 10 pushl 0x10(%ebp) 8002e8: 83 ec 08 sub $0x8,%esp 8002eb: ff 75 dc pushl -0x24(%ebp) 8002ee: ff 75 d8 pushl -0x28(%ebp) 8002f1: ff 75 d4 pushl -0x2c(%ebp) 8002f4: ff 75 d0 pushl -0x30(%ebp) 8002f7: 8b 5d e4 mov -0x1c(%ebp),%ebx 8002fa: e8 81 09 00 00 call 800c80 <__udivdi3> 8002ff: 83 c4 18 add $0x18,%esp 800302: 52 push %edx 800303: 50 push %eax 800304: 89 f2 mov %esi,%edx 800306: 89 f8 mov %edi,%eax 800308: e8 89 ff ff ff call 800296 <printnum> 80030d: 83 c4 20 add $0x20,%esp 800310: eb 13 jmp 800325 <printnum+0x8f> } else { // print any needed pad characters before first digit while (--width > 0) putch(padc, putdat); 800312: 83 ec 08 sub $0x8,%esp 800315: 56 push %esi 800316: ff 75 18 pushl 0x18(%ebp) 800319: ff d7 call *%edi 80031b: 83 c4 10 add $0x10,%esp while (--width > 0) 80031e: 83 eb 01 sub $0x1,%ebx 800321: 85 db test %ebx,%ebx 800323: 7f ed jg 800312 <printnum+0x7c> } // then print this (the least significant) digit putch("0123456789abcdef"[num % base], putdat); 800325: 83 ec 08 sub $0x8,%esp 800328: 56 push %esi 800329: 83 ec 04 sub $0x4,%esp 80032c: ff 75 dc pushl -0x24(%ebp) 80032f: ff 75 d8 pushl -0x28(%ebp) 800332: ff 75 d4 pushl -0x2c(%ebp) 800335: ff 75 d0 pushl -0x30(%ebp) 800338: 8b 75 e4 mov -0x1c(%ebp),%esi 80033b: 89 f3 mov %esi,%ebx 80033d: e8 5e 0a 00 00 call 800da0 <__umoddi3> 800342: 83 c4 14 add $0x14,%esp 800345: 0f be 84 06 1a ef ff movsbl -0x10e6(%esi,%eax,1),%eax 80034c: ff 80034d: 50 push %eax 80034e: ff d7 call *%edi } 800350: 83 c4 10 add $0x10,%esp 800353: 8d 65 f4 lea -0xc(%ebp),%esp 800356: 5b pop %ebx 800357: 5e pop %esi 800358: 5f pop %edi 800359: 5d pop %ebp 80035a: c3 ret 80035b: 8b 5d 14 mov 0x14(%ebp),%ebx 80035e: eb be jmp 80031e <printnum+0x88> 00800360 <sprintputch>: int cnt; }; static void sprintputch(int ch, struct sprintbuf *b) { 800360: 55 push %ebp 800361: 89 e5 mov %esp,%ebp 800363: 8b 45 0c mov 0xc(%ebp),%eax b->cnt++; 800366: 83 40 08 01 addl $0x1,0x8(%eax) if (b->buf < b->ebuf) 80036a: 8b 10 mov (%eax),%edx 80036c: 3b 50 04 cmp 0x4(%eax),%edx 80036f: 73 0a jae 80037b <sprintputch+0x1b> *b->buf++ = ch; 800371: 8d 4a 01 lea 0x1(%edx),%ecx 800374: 89 08 mov %ecx,(%eax) 800376: 8b 45 08 mov 0x8(%ebp),%eax 800379: 88 02 mov %al,(%edx) } 80037b: 5d pop %ebp 80037c: c3 ret 0080037d <printfmt>: { 80037d: 55 push %ebp 80037e: 89 e5 mov %esp,%ebp 800380: 83 ec 08 sub $0x8,%esp va_start(ap, fmt); 800383: 8d 45 14 lea 0x14(%ebp),%eax vprintfmt(putch, putdat, fmt, ap); 800386: 50 push %eax 800387: ff 75 10 pushl 0x10(%ebp) 80038a: ff 75 0c pushl 0xc(%ebp) 80038d: ff 75 08 pushl 0x8(%ebp) 800390: e8 05 00 00 00 call 80039a <vprintfmt> } 800395: 83 c4 10 add $0x10,%esp 800398: c9 leave 800399: c3 ret 0080039a <vprintfmt>: { 80039a: 55 push %ebp 80039b: 89 e5 mov %esp,%ebp 80039d: 57 push %edi 80039e: 56 push %esi 80039f: 53 push %ebx 8003a0: 83 ec 2c sub $0x2c,%esp 8003a3: e8 f4 fc ff ff call 80009c <__x86.get_pc_thunk.bx> 8003a8: 81 c3 58 1c 00 00 add $0x1c58,%ebx 8003ae: 8b 75 10 mov 0x10(%ebp),%esi int textcolor = 0x0700; 8003b1: c7 45 e4 00 07 00 00 movl $0x700,-0x1c(%ebp) 8003b8: 89 f7 mov %esi,%edi while ((ch = *(unsigned char *) fmt++) != '%') { 8003ba: 8d 77 01 lea 0x1(%edi),%esi 8003bd: 0f b6 07 movzbl (%edi),%eax 8003c0: 83 f8 25 cmp $0x25,%eax 8003c3: 74 1c je 8003e1 <vprintfmt+0x47> if (ch == '\0') 8003c5: 85 c0 test %eax,%eax 8003c7: 0f 84 b9 04 00 00 je 800886 <.L21+0x20> putch(ch, putdat); 8003cd: 83 ec 08 sub $0x8,%esp 8003d0: ff 75 0c pushl 0xc(%ebp) ch |= textcolor; 8003d3: 0b 45 e4 or -0x1c(%ebp),%eax putch(ch, putdat); 8003d6: 50 push %eax 8003d7: ff 55 08 call *0x8(%ebp) 8003da: 83 c4 10 add $0x10,%esp while ((ch = *(unsigned char *) fmt++) != '%') { 8003dd: 89 f7 mov %esi,%edi 8003df: eb d9 jmp 8003ba <vprintfmt+0x20> padc = ' '; 8003e1: c6 45 d0 20 movb $0x20,-0x30(%ebp) altflag = 0; 8003e5: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp) precision = -1; 8003ec: c7 45 cc ff ff ff ff movl $0xffffffff,-0x34(%ebp) width = -1; 8003f3: c7 45 e0 ff ff ff ff movl $0xffffffff,-0x20(%ebp) lflag = 0; 8003fa: b9 00 00 00 00 mov $0x0,%ecx 8003ff: 89 4d d4 mov %ecx,-0x2c(%ebp) switch (ch = *(unsigned char *) fmt++) { 800402: 8d 7e 01 lea 0x1(%esi),%edi 800405: 0f b6 16 movzbl (%esi),%edx 800408: 8d 42 dd lea -0x23(%edx),%eax 80040b: 3c 55 cmp $0x55,%al 80040d: 0f 87 53 04 00 00 ja 800866 <.L21> 800413: 0f b6 c0 movzbl %al,%eax 800416: 89 d9 mov %ebx,%ecx 800418: 03 8c 83 a8 ef ff ff add -0x1058(%ebx,%eax,4),%ecx 80041f: ff e1 jmp *%ecx 00800421 <.L73>: 800421: 89 fe mov %edi,%esi padc = '-'; 800423: c6 45 d0 2d movb $0x2d,-0x30(%ebp) 800427: eb d9 jmp 800402 <vprintfmt+0x68> 00800429 <.L27>: switch (ch = *(unsigned char *) fmt++) { 800429: 89 fe mov %edi,%esi padc = '0'; 80042b: c6 45 d0 30 movb $0x30,-0x30(%ebp) 80042f: eb d1 jmp 800402 <vprintfmt+0x68> 00800431 <.L28>: switch (ch = *(unsigned char *) fmt++) { 800431: 0f b6 d2 movzbl %dl,%edx 800434: 89 fe mov %edi,%esi for (precision = 0; ; ++fmt) { 800436: b8 00 00 00 00 mov $0x0,%eax 80043b: 8b 4d d4 mov -0x2c(%ebp),%ecx precision = precision * 10 + ch - '0'; 80043e: 8d 04 80 lea (%eax,%eax,4),%eax 800441: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax ch = *fmt; 800445: 0f be 16 movsbl (%esi),%edx if (ch < '0' || ch > '9') 800448: 8d 7a d0 lea -0x30(%edx),%edi 80044b: 83 ff 09 cmp $0x9,%edi 80044e: 0f 87 94 00 00 00 ja 8004e8 <.L33+0x42> for (precision = 0; ; ++fmt) { 800454: 83 c6 01 add $0x1,%esi precision = precision * 10 + ch - '0'; 800457: eb e5 jmp 80043e <.L28+0xd> 00800459 <.L25>: precision = va_arg(ap, int); 800459: 8b 45 14 mov 0x14(%ebp),%eax 80045c: 8b 00 mov (%eax),%eax 80045e: 89 45 cc mov %eax,-0x34(%ebp) 800461: 8b 45 14 mov 0x14(%ebp),%eax 800464: 8d 40 04 lea 0x4(%eax),%eax 800467: 89 45 14 mov %eax,0x14(%ebp) switch (ch = *(unsigned char *) fmt++) { 80046a: 89 fe mov %edi,%esi if (width < 0) 80046c: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 800470: 79 90 jns 800402 <vprintfmt+0x68> width = precision, precision = -1; 800472: 8b 45 cc mov -0x34(%ebp),%eax 800475: 89 45 e0 mov %eax,-0x20(%ebp) 800478: c7 45 cc ff ff ff ff movl $0xffffffff,-0x34(%ebp) 80047f: eb 81 jmp 800402 <vprintfmt+0x68> 00800481 <.L26>: 800481: 8b 45 e0 mov -0x20(%ebp),%eax 800484: 85 c0 test %eax,%eax 800486: ba 00 00 00 00 mov $0x0,%edx 80048b: 0f 49 d0 cmovns %eax,%edx 80048e: 89 55 e0 mov %edx,-0x20(%ebp) switch (ch = *(unsigned char *) fmt++) { 800491: 89 fe mov %edi,%esi 800493: e9 6a ff ff ff jmp 800402 <vprintfmt+0x68> 00800498 <.L22>: 800498: 89 fe mov %edi,%esi altflag = 1; 80049a: c7 45 d8 01 00 00 00 movl $0x1,-0x28(%ebp) goto reswitch; 8004a1: e9 5c ff ff ff jmp 800402 <vprintfmt+0x68> 008004a6 <.L33>: 8004a6: 8b 4d d4 mov -0x2c(%ebp),%ecx if (lflag >= 2) 8004a9: 83 f9 01 cmp $0x1,%ecx 8004ac: 7e 16 jle 8004c4 <.L33+0x1e> return va_arg(*ap, long long); 8004ae: 8b 45 14 mov 0x14(%ebp),%eax 8004b1: 8b 00 mov (%eax),%eax 8004b3: 8b 4d 14 mov 0x14(%ebp),%ecx 8004b6: 8d 49 08 lea 0x8(%ecx),%ecx 8004b9: 89 4d 14 mov %ecx,0x14(%ebp) textcolor = getint(&ap, lflag); 8004bc: 89 45 e4 mov %eax,-0x1c(%ebp) break; 8004bf: e9 f6 fe ff ff jmp 8003ba <vprintfmt+0x20> else if (lflag) 8004c4: 85 c9 test %ecx,%ecx 8004c6: 75 10 jne 8004d8 <.L33+0x32> return va_arg(*ap, int); 8004c8: 8b 45 14 mov 0x14(%ebp),%eax 8004cb: 8b 00 mov (%eax),%eax 8004cd: 8b 4d 14 mov 0x14(%ebp),%ecx 8004d0: 8d 49 04 lea 0x4(%ecx),%ecx 8004d3: 89 4d 14 mov %ecx,0x14(%ebp) 8004d6: eb e4 jmp 8004bc <.L33+0x16> return va_arg(*ap, long); 8004d8: 8b 45 14 mov 0x14(%ebp),%eax 8004db: 8b 00 mov (%eax),%eax 8004dd: 8b 4d 14 mov 0x14(%ebp),%ecx 8004e0: 8d 49 04 lea 0x4(%ecx),%ecx 8004e3: 89 4d 14 mov %ecx,0x14(%ebp) 8004e6: eb d4 jmp 8004bc <.L33+0x16> 8004e8: 89 4d d4 mov %ecx,-0x2c(%ebp) 8004eb: 89 45 cc mov %eax,-0x34(%ebp) 8004ee: e9 79 ff ff ff jmp 80046c <.L25+0x13> 008004f3 <.L32>: lflag++; 8004f3: 83 45 d4 01 addl $0x1,-0x2c(%ebp) switch (ch = *(unsigned char *) fmt++) { 8004f7: 89 fe mov %edi,%esi goto reswitch; 8004f9: e9 04 ff ff ff jmp 800402 <vprintfmt+0x68> 008004fe <.L29>: putch(va_arg(ap, int), putdat); 8004fe: 8b 45 14 mov 0x14(%ebp),%eax 800501: 8d 70 04 lea 0x4(%eax),%esi 800504: 83 ec 08 sub $0x8,%esp 800507: ff 75 0c pushl 0xc(%ebp) 80050a: ff 30 pushl (%eax) 80050c: ff 55 08 call *0x8(%ebp) break; 80050f: 83 c4 10 add $0x10,%esp putch(va_arg(ap, int), putdat); 800512: 89 75 14 mov %esi,0x14(%ebp) break; 800515: e9 a0 fe ff ff jmp 8003ba <vprintfmt+0x20> 0080051a <.L31>: err = va_arg(ap, int); 80051a: 8b 45 14 mov 0x14(%ebp),%eax 80051d: 8d 70 04 lea 0x4(%eax),%esi 800520: 8b 00 mov (%eax),%eax 800522: 99 cltd 800523: 31 d0 xor %edx,%eax 800525: 29 d0 sub %edx,%eax if (err >= MAXERROR || (p = error_string[err]) == NULL) 800527: 83 f8 06 cmp $0x6,%eax 80052a: 7f 29 jg 800555 <.L31+0x3b> 80052c: 8b 94 83 10 00 00 00 mov 0x10(%ebx,%eax,4),%edx 800533: 85 d2 test %edx,%edx 800535: 74 1e je 800555 <.L31+0x3b> printfmt(putch, putdat, "%s", p); 800537: 52 push %edx 800538: 8d 83 3b ef ff ff lea -0x10c5(%ebx),%eax 80053e: 50 push %eax 80053f: ff 75 0c pushl 0xc(%ebp) 800542: ff 75 08 pushl 0x8(%ebp) 800545: e8 33 fe ff ff call 80037d <printfmt> 80054a: 83 c4 10 add $0x10,%esp err = va_arg(ap, int); 80054d: 89 75 14 mov %esi,0x14(%ebp) 800550: e9 65 fe ff ff jmp 8003ba <vprintfmt+0x20> printfmt(putch, putdat, "error %d", err); 800555: 50 push %eax 800556: 8d 83 32 ef ff ff lea -0x10ce(%ebx),%eax 80055c: 50 push %eax 80055d: ff 75 0c pushl 0xc(%ebp) 800560: ff 75 08 pushl 0x8(%ebp) 800563: e8 15 fe ff ff call 80037d <printfmt> 800568: 83 c4 10 add $0x10,%esp err = va_arg(ap, int); 80056b: 89 75 14 mov %esi,0x14(%ebp) printfmt(putch, putdat, "error %d", err); 80056e: e9 47 fe ff ff jmp 8003ba <vprintfmt+0x20> 00800573 <.L36>: if ((p = va_arg(ap, char *)) == NULL) 800573: 8b 45 14 mov 0x14(%ebp),%eax 800576: 83 c0 04 add $0x4,%eax 800579: 89 45 d4 mov %eax,-0x2c(%ebp) 80057c: 8b 45 14 mov 0x14(%ebp),%eax 80057f: 8b 30 mov (%eax),%esi p = "(null)"; 800581: 85 f6 test %esi,%esi 800583: 8d 83 2b ef ff ff lea -0x10d5(%ebx),%eax 800589: 0f 44 f0 cmove %eax,%esi if (width > 0 && padc != '-') 80058c: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) 800590: 0f 8e b4 00 00 00 jle 80064a <.L36+0xd7> 800596: 80 7d d0 2d cmpb $0x2d,-0x30(%ebp) 80059a: 75 08 jne 8005a4 <.L36+0x31> 80059c: 89 7d 10 mov %edi,0x10(%ebp) 80059f: 8b 7d cc mov -0x34(%ebp),%edi 8005a2: eb 6c jmp 800610 <.L36+0x9d> for (width -= strnlen(p, precision); width > 0; width--) 8005a4: 83 ec 08 sub $0x8,%esp 8005a7: ff 75 cc pushl -0x34(%ebp) 8005aa: 56 push %esi 8005ab: e8 73 03 00 00 call 800923 <strnlen> 8005b0: 8b 55 e0 mov -0x20(%ebp),%edx 8005b3: 29 c2 sub %eax,%edx 8005b5: 89 55 e0 mov %edx,-0x20(%ebp) 8005b8: 83 c4 10 add $0x10,%esp putch(padc, putdat); 8005bb: 0f be 45 d0 movsbl -0x30(%ebp),%eax 8005bf: 89 75 d0 mov %esi,-0x30(%ebp) 8005c2: 89 d6 mov %edx,%esi 8005c4: 89 7d 10 mov %edi,0x10(%ebp) 8005c7: 89 c7 mov %eax,%edi for (width -= strnlen(p, precision); width > 0; width--) 8005c9: eb 10 jmp 8005db <.L36+0x68> putch(padc, putdat); 8005cb: 83 ec 08 sub $0x8,%esp 8005ce: ff 75 0c pushl 0xc(%ebp) 8005d1: 57 push %edi 8005d2: ff 55 08 call *0x8(%ebp) for (width -= strnlen(p, precision); width > 0; width--) 8005d5: 83 ee 01 sub $0x1,%esi 8005d8: 83 c4 10 add $0x10,%esp 8005db: 85 f6 test %esi,%esi 8005dd: 7f ec jg 8005cb <.L36+0x58> 8005df: 8b 75 d0 mov -0x30(%ebp),%esi 8005e2: 8b 55 e0 mov -0x20(%ebp),%edx 8005e5: 85 d2 test %edx,%edx 8005e7: b8 00 00 00 00 mov $0x0,%eax 8005ec: 0f 49 c2 cmovns %edx,%eax 8005ef: 29 c2 sub %eax,%edx 8005f1: 89 55 e0 mov %edx,-0x20(%ebp) 8005f4: 8b 7d cc mov -0x34(%ebp),%edi 8005f7: eb 17 jmp 800610 <.L36+0x9d> if (altflag && (ch < ' ' || ch > '~')) 8005f9: 83 7d d8 00 cmpl $0x0,-0x28(%ebp) 8005fd: 75 30 jne 80062f <.L36+0xbc> putch(ch, putdat); 8005ff: 83 ec 08 sub $0x8,%esp 800602: ff 75 0c pushl 0xc(%ebp) 800605: 50 push %eax 800606: ff 55 08 call *0x8(%ebp) 800609: 83 c4 10 add $0x10,%esp for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--) 80060c: 83 6d e0 01 subl $0x1,-0x20(%ebp) 800610: 83 c6 01 add $0x1,%esi 800613: 0f b6 56 ff movzbl -0x1(%esi),%edx 800617: 0f be c2 movsbl %dl,%eax 80061a: 85 c0 test %eax,%eax 80061c: 74 58 je 800676 <.L36+0x103> 80061e: 85 ff test %edi,%edi 800620: 78 d7 js 8005f9 <.L36+0x86> 800622: 83 ef 01 sub $0x1,%edi 800625: 79 d2 jns 8005f9 <.L36+0x86> 800627: 8b 75 e0 mov -0x20(%ebp),%esi 80062a: 8b 7d 0c mov 0xc(%ebp),%edi 80062d: eb 32 jmp 800661 <.L36+0xee> if (altflag && (ch < ' ' || ch > '~')) 80062f: 0f be d2 movsbl %dl,%edx 800632: 83 ea 20 sub $0x20,%edx 800635: 83 fa 5e cmp $0x5e,%edx 800638: 76 c5 jbe 8005ff <.L36+0x8c> putch('?', putdat); 80063a: 83 ec 08 sub $0x8,%esp 80063d: ff 75 0c pushl 0xc(%ebp) 800640: 6a 3f push $0x3f 800642: ff 55 08 call *0x8(%ebp) 800645: 83 c4 10 add $0x10,%esp 800648: eb c2 jmp 80060c <.L36+0x99> 80064a: 89 7d 10 mov %edi,0x10(%ebp) 80064d: 8b 7d cc mov -0x34(%ebp),%edi 800650: eb be jmp 800610 <.L36+0x9d> putch(' ', putdat); 800652: 83 ec 08 sub $0x8,%esp 800655: 57 push %edi 800656: 6a 20 push $0x20 800658: ff 55 08 call *0x8(%ebp) for (; width > 0; width--) 80065b: 83 ee 01 sub $0x1,%esi 80065e: 83 c4 10 add $0x10,%esp 800661: 85 f6 test %esi,%esi 800663: 7f ed jg 800652 <.L36+0xdf> 800665: 89 7d 0c mov %edi,0xc(%ebp) 800668: 8b 7d 10 mov 0x10(%ebp),%edi if ((p = va_arg(ap, char *)) == NULL) 80066b: 8b 45 d4 mov -0x2c(%ebp),%eax 80066e: 89 45 14 mov %eax,0x14(%ebp) 800671: e9 44 fd ff ff jmp 8003ba <vprintfmt+0x20> 800676: 8b 75 e0 mov -0x20(%ebp),%esi 800679: 8b 7d 0c mov 0xc(%ebp),%edi 80067c: eb e3 jmp 800661 <.L36+0xee> 0080067e <.L30>: 80067e: 8b 4d d4 mov -0x2c(%ebp),%ecx if (lflag >= 2) 800681: 83 f9 01 cmp $0x1,%ecx 800684: 7e 42 jle 8006c8 <.L30+0x4a> return va_arg(*ap, long long); 800686: 8b 45 14 mov 0x14(%ebp),%eax 800689: 8b 50 04 mov 0x4(%eax),%edx 80068c: 8b 00 mov (%eax),%eax 80068e: 89 45 d8 mov %eax,-0x28(%ebp) 800691: 89 55 dc mov %edx,-0x24(%ebp) 800694: 8b 45 14 mov 0x14(%ebp),%eax 800697: 8d 40 08 lea 0x8(%eax),%eax 80069a: 89 45 14 mov %eax,0x14(%ebp) if ((long long) num < 0) { 80069d: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) 8006a1: 79 5f jns 800702 <.L30+0x84> putch('-', putdat); 8006a3: 83 ec 08 sub $0x8,%esp 8006a6: ff 75 0c pushl 0xc(%ebp) 8006a9: 6a 2d push $0x2d 8006ab: ff 55 08 call *0x8(%ebp) num = -(long long) num; 8006ae: 8b 55 d8 mov -0x28(%ebp),%edx 8006b1: 8b 4d dc mov -0x24(%ebp),%ecx 8006b4: f7 da neg %edx 8006b6: 83 d1 00 adc $0x0,%ecx 8006b9: f7 d9 neg %ecx 8006bb: 83 c4 10 add $0x10,%esp base = 10; 8006be: b8 0a 00 00 00 mov $0xa,%eax 8006c3: e9 b8 00 00 00 jmp 800780 <.L34+0x22> else if (lflag) 8006c8: 85 c9 test %ecx,%ecx 8006ca: 75 1b jne 8006e7 <.L30+0x69> return va_arg(*ap, int); 8006cc: 8b 45 14 mov 0x14(%ebp),%eax 8006cf: 8b 30 mov (%eax),%esi 8006d1: 89 75 d8 mov %esi,-0x28(%ebp) 8006d4: 89 f0 mov %esi,%eax 8006d6: c1 f8 1f sar $0x1f,%eax 8006d9: 89 45 dc mov %eax,-0x24(%ebp) 8006dc: 8b 45 14 mov 0x14(%ebp),%eax 8006df: 8d 40 04 lea 0x4(%eax),%eax 8006e2: 89 45 14 mov %eax,0x14(%ebp) 8006e5: eb b6 jmp 80069d <.L30+0x1f> return va_arg(*ap, long); 8006e7: 8b 45 14 mov 0x14(%ebp),%eax 8006ea: 8b 30 mov (%eax),%esi 8006ec: 89 75 d8 mov %esi,-0x28(%ebp) 8006ef: 89 f0 mov %esi,%eax 8006f1: c1 f8 1f sar $0x1f,%eax 8006f4: 89 45 dc mov %eax,-0x24(%ebp) 8006f7: 8b 45 14 mov 0x14(%ebp),%eax 8006fa: 8d 40 04 lea 0x4(%eax),%eax 8006fd: 89 45 14 mov %eax,0x14(%ebp) 800700: eb 9b jmp 80069d <.L30+0x1f> num = getint(&ap, lflag); 800702: 8b 55 d8 mov -0x28(%ebp),%edx 800705: 8b 4d dc mov -0x24(%ebp),%ecx base = 10; 800708: b8 0a 00 00 00 mov $0xa,%eax 80070d: eb 71 jmp 800780 <.L34+0x22> 0080070f <.L37>: 80070f: 8b 4d d4 mov -0x2c(%ebp),%ecx if (lflag >= 2) 800712: 83 f9 01 cmp $0x1,%ecx 800715: 7e 15 jle 80072c <.L37+0x1d> return va_arg(*ap, unsigned long long); 800717: 8b 45 14 mov 0x14(%ebp),%eax 80071a: 8b 10 mov (%eax),%edx 80071c: 8b 48 04 mov 0x4(%eax),%ecx 80071f: 8d 40 08 lea 0x8(%eax),%eax 800722: 89 45 14 mov %eax,0x14(%ebp) base = 10; 800725: b8 0a 00 00 00 mov $0xa,%eax 80072a: eb 54 jmp 800780 <.L34+0x22> else if (lflag) 80072c: 85 c9 test %ecx,%ecx 80072e: 75 17 jne 800747 <.L37+0x38> return va_arg(*ap, unsigned int); 800730: 8b 45 14 mov 0x14(%ebp),%eax 800733: 8b 10 mov (%eax),%edx 800735: b9 00 00 00 00 mov $0x0,%ecx 80073a: 8d 40 04 lea 0x4(%eax),%eax 80073d: 89 45 14 mov %eax,0x14(%ebp) base = 10; 800740: b8 0a 00 00 00 mov $0xa,%eax 800745: eb 39 jmp 800780 <.L34+0x22> return va_arg(*ap, unsigned long); 800747: 8b 45 14 mov 0x14(%ebp),%eax 80074a: 8b 10 mov (%eax),%edx 80074c: b9 00 00 00 00 mov $0x0,%ecx 800751: 8d 40 04 lea 0x4(%eax),%eax 800754: 89 45 14 mov %eax,0x14(%ebp) base = 10; 800757: b8 0a 00 00 00 mov $0xa,%eax 80075c: eb 22 jmp 800780 <.L34+0x22> 0080075e <.L34>: 80075e: 8b 4d d4 mov -0x2c(%ebp),%ecx if (lflag >= 2) 800761: 83 f9 01 cmp $0x1,%ecx 800764: 7e 3b jle 8007a1 <.L34+0x43> return va_arg(*ap, long long); 800766: 8b 45 14 mov 0x14(%ebp),%eax 800769: 8b 50 04 mov 0x4(%eax),%edx 80076c: 8b 00 mov (%eax),%eax 80076e: 8b 4d 14 mov 0x14(%ebp),%ecx 800771: 8d 49 08 lea 0x8(%ecx),%ecx 800774: 89 4d 14 mov %ecx,0x14(%ebp) num = getint(&ap, lflag); 800777: 89 d1 mov %edx,%ecx 800779: 89 c2 mov %eax,%edx base = 8; 80077b: b8 08 00 00 00 mov $0x8,%eax printnum(putch, putdat, num, base, width, padc); 800780: 83 ec 0c sub $0xc,%esp 800783: 0f be 75 d0 movsbl -0x30(%ebp),%esi 800787: 56 push %esi 800788: ff 75 e0 pushl -0x20(%ebp) 80078b: 50 push %eax 80078c: 51 push %ecx 80078d: 52 push %edx 80078e: 8b 55 0c mov 0xc(%ebp),%edx 800791: 8b 45 08 mov 0x8(%ebp),%eax 800794: e8 fd fa ff ff call 800296 <printnum> break; 800799: 83 c4 20 add $0x20,%esp 80079c: e9 19 fc ff ff jmp 8003ba <vprintfmt+0x20> else if (lflag) 8007a1: 85 c9 test %ecx,%ecx 8007a3: 75 13 jne 8007b8 <.L34+0x5a> return va_arg(*ap, int); 8007a5: 8b 45 14 mov 0x14(%ebp),%eax 8007a8: 8b 10 mov (%eax),%edx 8007aa: 89 d0 mov %edx,%eax 8007ac: 99 cltd 8007ad: 8b 4d 14 mov 0x14(%ebp),%ecx 8007b0: 8d 49 04 lea 0x4(%ecx),%ecx 8007b3: 89 4d 14 mov %ecx,0x14(%ebp) 8007b6: eb bf jmp 800777 <.L34+0x19> return va_arg(*ap, long); 8007b8: 8b 45 14 mov 0x14(%ebp),%eax 8007bb: 8b 10 mov (%eax),%edx 8007bd: 89 d0 mov %edx,%eax 8007bf: 99 cltd 8007c0: 8b 4d 14 mov 0x14(%ebp),%ecx 8007c3: 8d 49 04 lea 0x4(%ecx),%ecx 8007c6: 89 4d 14 mov %ecx,0x14(%ebp) 8007c9: eb ac jmp 800777 <.L34+0x19> 008007cb <.L35>: putch('0', putdat); 8007cb: 83 ec 08 sub $0x8,%esp 8007ce: ff 75 0c pushl 0xc(%ebp) 8007d1: 6a 30 push $0x30 8007d3: ff 55 08 call *0x8(%ebp) putch('x', putdat); 8007d6: 83 c4 08 add $0x8,%esp 8007d9: ff 75 0c pushl 0xc(%ebp) 8007dc: 6a 78 push $0x78 8007de: ff 55 08 call *0x8(%ebp) num = (unsigned long long) 8007e1: 8b 45 14 mov 0x14(%ebp),%eax 8007e4: 8b 10 mov (%eax),%edx 8007e6: b9 00 00 00 00 mov $0x0,%ecx goto number; 8007eb: 83 c4 10 add $0x10,%esp (uintptr_t) va_arg(ap, void *); 8007ee: 8d 40 04 lea 0x4(%eax),%eax 8007f1: 89 45 14 mov %eax,0x14(%ebp) base = 16; 8007f4: b8 10 00 00 00 mov $0x10,%eax goto number; 8007f9: eb 85 jmp 800780 <.L34+0x22> 008007fb <.L38>: 8007fb: 8b 4d d4 mov -0x2c(%ebp),%ecx if (lflag >= 2) 8007fe: 83 f9 01 cmp $0x1,%ecx 800801: 7e 18 jle 80081b <.L38+0x20> return va_arg(*ap, unsigned long long); 800803: 8b 45 14 mov 0x14(%ebp),%eax 800806: 8b 10 mov (%eax),%edx 800808: 8b 48 04 mov 0x4(%eax),%ecx 80080b: 8d 40 08 lea 0x8(%eax),%eax 80080e: 89 45 14 mov %eax,0x14(%ebp) base = 16; 800811: b8 10 00 00 00 mov $0x10,%eax 800816: e9 65 ff ff ff jmp 800780 <.L34+0x22> else if (lflag) 80081b: 85 c9 test %ecx,%ecx 80081d: 75 1a jne 800839 <.L38+0x3e> return va_arg(*ap, unsigned int); 80081f: 8b 45 14 mov 0x14(%ebp),%eax 800822: 8b 10 mov (%eax),%edx 800824: b9 00 00 00 00 mov $0x0,%ecx 800829: 8d 40 04 lea 0x4(%eax),%eax 80082c: 89 45 14 mov %eax,0x14(%ebp) base = 16; 80082f: b8 10 00 00 00 mov $0x10,%eax 800834: e9 47 ff ff ff jmp 800780 <.L34+0x22> return va_arg(*ap, unsigned long); 800839: 8b 45 14 mov 0x14(%ebp),%eax 80083c: 8b 10 mov (%eax),%edx 80083e: b9 00 00 00 00 mov $0x0,%ecx 800843: 8d 40 04 lea 0x4(%eax),%eax 800846: 89 45 14 mov %eax,0x14(%ebp) base = 16; 800849: b8 10 00 00 00 mov $0x10,%eax 80084e: e9 2d ff ff ff jmp 800780 <.L34+0x22> 00800853 <.L24>: putch(ch, putdat); 800853: 83 ec 08 sub $0x8,%esp 800856: ff 75 0c pushl 0xc(%ebp) 800859: 6a 25 push $0x25 80085b: ff 55 08 call *0x8(%ebp) break; 80085e: 83 c4 10 add $0x10,%esp 800861: e9 54 fb ff ff jmp 8003ba <vprintfmt+0x20> 00800866 <.L21>: putch('%', putdat); 800866: 83 ec 08 sub $0x8,%esp 800869: ff 75 0c pushl 0xc(%ebp) 80086c: 6a 25 push $0x25 80086e: ff 55 08 call *0x8(%ebp) for (fmt--; fmt[-1] != '%'; fmt--) 800871: 83 c4 10 add $0x10,%esp 800874: 89 f7 mov %esi,%edi 800876: eb 03 jmp 80087b <.L21+0x15> 800878: 83 ef 01 sub $0x1,%edi 80087b: 80 7f ff 25 cmpb $0x25,-0x1(%edi) 80087f: 75 f7 jne 800878 <.L21+0x12> 800881: e9 34 fb ff ff jmp 8003ba <vprintfmt+0x20> } 800886: 8d 65 f4 lea -0xc(%ebp),%esp 800889: 5b pop %ebx 80088a: 5e pop %esi 80088b: 5f pop %edi 80088c: 5d pop %ebp 80088d: c3 ret 0080088e <vsnprintf>: int vsnprintf(char *buf, int n, const char *fmt, va_list ap) { 80088e: 55 push %ebp 80088f: 89 e5 mov %esp,%ebp 800891: 53 push %ebx 800892: 83 ec 14 sub $0x14,%esp 800895: e8 02 f8 ff ff call 80009c <__x86.get_pc_thunk.bx> 80089a: 81 c3 66 17 00 00 add $0x1766,%ebx 8008a0: 8b 45 08 mov 0x8(%ebp),%eax 8008a3: 8b 55 0c mov 0xc(%ebp),%edx struct sprintbuf b = {buf, buf+n-1, 0}; 8008a6: 89 45 ec mov %eax,-0x14(%ebp) 8008a9: 8d 4c 10 ff lea -0x1(%eax,%edx,1),%ecx 8008ad: 89 4d f0 mov %ecx,-0x10(%ebp) 8008b0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) if (buf == NULL || n < 1) 8008b7: 85 c0 test %eax,%eax 8008b9: 74 2b je 8008e6 <vsnprintf+0x58> 8008bb: 85 d2 test %edx,%edx 8008bd: 7e 27 jle 8008e6 <vsnprintf+0x58> return -E_INVAL; // print the string to the buffer vprintfmt((void*)sprintputch, &b, fmt, ap); 8008bf: ff 75 14 pushl 0x14(%ebp) 8008c2: ff 75 10 pushl 0x10(%ebp) 8008c5: 8d 45 ec lea -0x14(%ebp),%eax 8008c8: 50 push %eax 8008c9: 8d 83 60 e3 ff ff lea -0x1ca0(%ebx),%eax 8008cf: 50 push %eax 8008d0: e8 c5 fa ff ff call 80039a <vprintfmt> // null terminate the buffer *b.buf = '\0'; 8008d5: 8b 45 ec mov -0x14(%ebp),%eax 8008d8: c6 00 00 movb $0x0,(%eax) return b.cnt; 8008db: 8b 45 f4 mov -0xc(%ebp),%eax 8008de: 83 c4 10 add $0x10,%esp } 8008e1: 8b 5d fc mov -0x4(%ebp),%ebx 8008e4: c9 leave 8008e5: c3 ret return -E_INVAL; 8008e6: b8 fd ff ff ff mov $0xfffffffd,%eax 8008eb: eb f4 jmp 8008e1 <vsnprintf+0x53> 008008ed <snprintf>: int snprintf(char *buf, int n, const char *fmt, ...) { 8008ed: 55 push %ebp 8008ee: 89 e5 mov %esp,%ebp 8008f0: 83 ec 08 sub $0x8,%esp va_list ap; int rc; va_start(ap, fmt); 8008f3: 8d 45 14 lea 0x14(%ebp),%eax rc = vsnprintf(buf, n, fmt, ap); 8008f6: 50 push %eax 8008f7: ff 75 10 pushl 0x10(%ebp) 8008fa: ff 75 0c pushl 0xc(%ebp) 8008fd: ff 75 08 pushl 0x8(%ebp) 800900: e8 89 ff ff ff call 80088e <vsnprintf> va_end(ap); return rc; } 800905: c9 leave 800906: c3 ret 00800907 <__x86.get_pc_thunk.cx>: 800907: 8b 0c 24 mov (%esp),%ecx 80090a: c3 ret 0080090b <strlen>: // Primespipe runs 3x faster this way. #define ASM 1 int strlen(const char *s) { 80090b: 55 push %ebp 80090c: 89 e5 mov %esp,%ebp 80090e: 8b 55 08 mov 0x8(%ebp),%edx int n; for (n = 0; *s != '\0'; s++) 800911: b8 00 00 00 00 mov $0x0,%eax 800916: eb 03 jmp 80091b <strlen+0x10> n++; 800918: 83 c0 01 add $0x1,%eax for (n = 0; *s != '\0'; s++) 80091b: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) 80091f: 75 f7 jne 800918 <strlen+0xd> return n; } 800921: 5d pop %ebp 800922: c3 ret 00800923 <strnlen>: int strnlen(const char *s, size_t size) { 800923: 55 push %ebp 800924: 89 e5 mov %esp,%ebp 800926: 8b 4d 08 mov 0x8(%ebp),%ecx 800929: 8b 55 0c mov 0xc(%ebp),%edx int n; for (n = 0; size > 0 && *s != '\0'; s++, size--) 80092c: b8 00 00 00 00 mov $0x0,%eax 800931: eb 03 jmp 800936 <strnlen+0x13> n++; 800933: 83 c0 01 add $0x1,%eax for (n = 0; size > 0 && *s != '\0'; s++, size--) 800936: 39 d0 cmp %edx,%eax 800938: 74 06 je 800940 <strnlen+0x1d> 80093a: 80 3c 01 00 cmpb $0x0,(%ecx,%eax,1) 80093e: 75 f3 jne 800933 <strnlen+0x10> return n; } 800940: 5d pop %ebp 800941: c3 ret 00800942 <strcpy>: char * strcpy(char *dst, const char *src) { 800942: 55 push %ebp 800943: 89 e5 mov %esp,%ebp 800945: 53 push %ebx 800946: 8b 45 08 mov 0x8(%ebp),%eax 800949: 8b 4d 0c mov 0xc(%ebp),%ecx char *ret; ret = dst; while ((*dst++ = *src++) != '\0') 80094c: 89 c2 mov %eax,%edx 80094e: 83 c1 01 add $0x1,%ecx 800951: 83 c2 01 add $0x1,%edx 800954: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 800958: 88 5a ff mov %bl,-0x1(%edx) 80095b: 84 db test %bl,%bl 80095d: 75 ef jne 80094e <strcpy+0xc> /* do nothing */; return ret; } 80095f: 5b pop %ebx 800960: 5d pop %ebp 800961: c3 ret 00800962 <strcat>: char * strcat(char *dst, const char *src) { 800962: 55 push %ebp 800963: 89 e5 mov %esp,%ebp 800965: 53 push %ebx 800966: 8b 5d 08 mov 0x8(%ebp),%ebx int len = strlen(dst); 800969: 53 push %ebx 80096a: e8 9c ff ff ff call 80090b <strlen> 80096f: 83 c4 04 add $0x4,%esp strcpy(dst + len, src); 800972: ff 75 0c pushl 0xc(%ebp) 800975: 01 d8 add %ebx,%eax 800977: 50 push %eax 800978: e8 c5 ff ff ff call 800942 <strcpy> return dst; } 80097d: 89 d8 mov %ebx,%eax 80097f: 8b 5d fc mov -0x4(%ebp),%ebx 800982: c9 leave 800983: c3 ret 00800984 <strncpy>: char * strncpy(char *dst, const char *src, size_t size) { 800984: 55 push %ebp 800985: 89 e5 mov %esp,%ebp 800987: 56 push %esi 800988: 53 push %ebx 800989: 8b 75 08 mov 0x8(%ebp),%esi 80098c: 8b 4d 0c mov 0xc(%ebp),%ecx 80098f: 89 f3 mov %esi,%ebx 800991: 03 5d 10 add 0x10(%ebp),%ebx size_t i; char *ret; ret = dst; for (i = 0; i < size; i++) { 800994: 89 f2 mov %esi,%edx 800996: eb 0f jmp 8009a7 <strncpy+0x23> *dst++ = *src; 800998: 83 c2 01 add $0x1,%edx 80099b: 0f b6 01 movzbl (%ecx),%eax 80099e: 88 42 ff mov %al,-0x1(%edx) // If strlen(src) < size, null-pad 'dst' out to 'size' chars if (*src != '\0') src++; 8009a1: 80 39 01 cmpb $0x1,(%ecx) 8009a4: 83 d9 ff sbb $0xffffffff,%ecx for (i = 0; i < size; i++) { 8009a7: 39 da cmp %ebx,%edx 8009a9: 75 ed jne 800998 <strncpy+0x14> } return ret; } 8009ab: 89 f0 mov %esi,%eax 8009ad: 5b pop %ebx 8009ae: 5e pop %esi 8009af: 5d pop %ebp 8009b0: c3 ret 008009b1 <strlcpy>: size_t strlcpy(char *dst, const char *src, size_t size) { 8009b1: 55 push %ebp 8009b2: 89 e5 mov %esp,%ebp 8009b4: 56 push %esi 8009b5: 53 push %ebx 8009b6: 8b 75 08 mov 0x8(%ebp),%esi 8009b9: 8b 55 0c mov 0xc(%ebp),%edx 8009bc: 8b 4d 10 mov 0x10(%ebp),%ecx 8009bf: 89 f0 mov %esi,%eax 8009c1: 8d 5c 0e ff lea -0x1(%esi,%ecx,1),%ebx char *dst_in; dst_in = dst; if (size > 0) { 8009c5: 85 c9 test %ecx,%ecx 8009c7: 75 0b jne 8009d4 <strlcpy+0x23> 8009c9: eb 17 jmp 8009e2 <strlcpy+0x31> while (--size > 0 && *src != '\0') *dst++ = *src++; 8009cb: 83 c2 01 add $0x1,%edx 8009ce: 83 c0 01 add $0x1,%eax 8009d1: 88 48 ff mov %cl,-0x1(%eax) while (--size > 0 && *src != '\0') 8009d4: 39 d8 cmp %ebx,%eax 8009d6: 74 07 je 8009df <strlcpy+0x2e> 8009d8: 0f b6 0a movzbl (%edx),%ecx 8009db: 84 c9 test %cl,%cl 8009dd: 75 ec jne 8009cb <strlcpy+0x1a> *dst = '\0'; 8009df: c6 00 00 movb $0x0,(%eax) } return dst - dst_in; 8009e2: 29 f0 sub %esi,%eax } 8009e4: 5b pop %ebx 8009e5: 5e pop %esi 8009e6: 5d pop %ebp 8009e7: c3 ret 008009e8 <strcmp>: int strcmp(const char *p, const char *q) { 8009e8: 55 push %ebp 8009e9: 89 e5 mov %esp,%ebp 8009eb: 8b 4d 08 mov 0x8(%ebp),%ecx 8009ee: 8b 55 0c mov 0xc(%ebp),%edx while (*p && *p == *q) 8009f1: eb 06 jmp 8009f9 <strcmp+0x11> p++, q++; 8009f3: 83 c1 01 add $0x1,%ecx 8009f6: 83 c2 01 add $0x1,%edx while (*p && *p == *q) 8009f9: 0f b6 01 movzbl (%ecx),%eax 8009fc: 84 c0 test %al,%al 8009fe: 74 04 je 800a04 <strcmp+0x1c> 800a00: 3a 02 cmp (%edx),%al 800a02: 74 ef je 8009f3 <strcmp+0xb> return (int) ((unsigned char) *p - (unsigned char) *q); 800a04: 0f b6 c0 movzbl %al,%eax 800a07: 0f b6 12 movzbl (%edx),%edx 800a0a: 29 d0 sub %edx,%eax } 800a0c: 5d pop %ebp 800a0d: c3 ret 00800a0e <strncmp>: int strncmp(const char *p, const char *q, size_t n) { 800a0e: 55 push %ebp 800a0f: 89 e5 mov %esp,%ebp 800a11: 53 push %ebx 800a12: 8b 45 08 mov 0x8(%ebp),%eax 800a15: 8b 55 0c mov 0xc(%ebp),%edx 800a18: 89 c3 mov %eax,%ebx 800a1a: 03 5d 10 add 0x10(%ebp),%ebx while (n > 0 && *p && *p == *q) 800a1d: eb 06 jmp 800a25 <strncmp+0x17> n--, p++, q++; 800a1f: 83 c0 01 add $0x1,%eax 800a22: 83 c2 01 add $0x1,%edx while (n > 0 && *p && *p == *q) 800a25: 39 d8 cmp %ebx,%eax 800a27: 74 16 je 800a3f <strncmp+0x31> 800a29: 0f b6 08 movzbl (%eax),%ecx 800a2c: 84 c9 test %cl,%cl 800a2e: 74 04 je 800a34 <strncmp+0x26> 800a30: 3a 0a cmp (%edx),%cl 800a32: 74 eb je 800a1f <strncmp+0x11> if (n == 0) return 0; else return (int) ((unsigned char) *p - (unsigned char) *q); 800a34: 0f b6 00 movzbl (%eax),%eax 800a37: 0f b6 12 movzbl (%edx),%edx 800a3a: 29 d0 sub %edx,%eax } 800a3c: 5b pop %ebx 800a3d: 5d pop %ebp 800a3e: c3 ret return 0; 800a3f: b8 00 00 00 00 mov $0x0,%eax 800a44: eb f6 jmp 800a3c <strncmp+0x2e> 00800a46 <strchr>: // Return a pointer to the first occurrence of 'c' in 's', // or a null pointer if the string has no 'c'. char * strchr(const char *s, char c) { 800a46: 55 push %ebp 800a47: 89 e5 mov %esp,%ebp 800a49: 8b 45 08 mov 0x8(%ebp),%eax 800a4c: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for (; *s; s++) 800a50: 0f b6 10 movzbl (%eax),%edx 800a53: 84 d2 test %dl,%dl 800a55: 74 09 je 800a60 <strchr+0x1a> if (*s == c) 800a57: 38 ca cmp %cl,%dl 800a59: 74 0a je 800a65 <strchr+0x1f> for (; *s; s++) 800a5b: 83 c0 01 add $0x1,%eax 800a5e: eb f0 jmp 800a50 <strchr+0xa> return (char *) s; return 0; 800a60: b8 00 00 00 00 mov $0x0,%eax } 800a65: 5d pop %ebp 800a66: c3 ret 00800a67 <strfind>: // Return a pointer to the first occurrence of 'c' in 's', // or a pointer to the string-ending null character if the string has no 'c'. char * strfind(const char *s, char c) { 800a67: 55 push %ebp 800a68: 89 e5 mov %esp,%ebp 800a6a: 8b 45 08 mov 0x8(%ebp),%eax 800a6d: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for (; *s; s++) 800a71: eb 03 jmp 800a76 <strfind+0xf> 800a73: 83 c0 01 add $0x1,%eax 800a76: 0f b6 10 movzbl (%eax),%edx if (*s == c) 800a79: 38 ca cmp %cl,%dl 800a7b: 74 04 je 800a81 <strfind+0x1a> 800a7d: 84 d2 test %dl,%dl 800a7f: 75 f2 jne 800a73 <strfind+0xc> break; return (char *) s; } 800a81: 5d pop %ebp 800a82: c3 ret 00800a83 <memset>: #if ASM void * memset(void *v, int c, size_t n) { 800a83: 55 push %ebp 800a84: 89 e5 mov %esp,%ebp 800a86: 57 push %edi 800a87: 56 push %esi 800a88: 53 push %ebx 800a89: 8b 7d 08 mov 0x8(%ebp),%edi 800a8c: 8b 4d 10 mov 0x10(%ebp),%ecx char *p; if (n == 0) 800a8f: 85 c9 test %ecx,%ecx 800a91: 74 13 je 800aa6 <memset+0x23> return v; if ((int)v%4 == 0 && n%4 == 0) { 800a93: f7 c7 03 00 00 00 test $0x3,%edi 800a99: 75 05 jne 800aa0 <memset+0x1d> 800a9b: f6 c1 03 test $0x3,%cl 800a9e: 74 0d je 800aad <memset+0x2a> c = (c<<24)|(c<<16)|(c<<8)|c; asm volatile("cld; rep stosl\n" :: "D" (v), "a" (c), "c" (n/4) : "cc", "memory"); } else asm volatile("cld; rep stosb\n" 800aa0: 8b 45 0c mov 0xc(%ebp),%eax 800aa3: fc cld 800aa4: f3 aa rep stos %al,%es:(%edi) :: "D" (v), "a" (c), "c" (n) : "cc", "memory"); return v; } 800aa6: 89 f8 mov %edi,%eax 800aa8: 5b pop %ebx 800aa9: 5e pop %esi 800aaa: 5f pop %edi 800aab: 5d pop %ebp 800aac: c3 ret c &= 0xFF; 800aad: 0f b6 55 0c movzbl 0xc(%ebp),%edx c = (c<<24)|(c<<16)|(c<<8)|c; 800ab1: 89 d3 mov %edx,%ebx 800ab3: c1 e3 08 shl $0x8,%ebx 800ab6: 89 d0 mov %edx,%eax 800ab8: c1 e0 18 shl $0x18,%eax 800abb: 89 d6 mov %edx,%esi 800abd: c1 e6 10 shl $0x10,%esi 800ac0: 09 f0 or %esi,%eax 800ac2: 09 c2 or %eax,%edx 800ac4: 09 da or %ebx,%edx :: "D" (v), "a" (c), "c" (n/4) 800ac6: c1 e9 02 shr $0x2,%ecx asm volatile("cld; rep stosl\n" 800ac9: 89 d0 mov %edx,%eax 800acb: fc cld 800acc: f3 ab rep stos %eax,%es:(%edi) 800ace: eb d6 jmp 800aa6 <memset+0x23> 00800ad0 <memmove>: void * memmove(void *dst, const void *src, size_t n) { 800ad0: 55 push %ebp 800ad1: 89 e5 mov %esp,%ebp 800ad3: 57 push %edi 800ad4: 56 push %esi 800ad5: 8b 45 08 mov 0x8(%ebp),%eax 800ad8: 8b 75 0c mov 0xc(%ebp),%esi 800adb: 8b 4d 10 mov 0x10(%ebp),%ecx const char *s; char *d; s = src; d = dst; if (s < d && s + n > d) { 800ade: 39 c6 cmp %eax,%esi 800ae0: 73 35 jae 800b17 <memmove+0x47> 800ae2: 8d 14 0e lea (%esi,%ecx,1),%edx 800ae5: 39 c2 cmp %eax,%edx 800ae7: 76 2e jbe 800b17 <memmove+0x47> s += n; d += n; 800ae9: 8d 3c 08 lea (%eax,%ecx,1),%edi if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 800aec: 89 d6 mov %edx,%esi 800aee: 09 fe or %edi,%esi 800af0: f7 c6 03 00 00 00 test $0x3,%esi 800af6: 74 0c je 800b04 <memmove+0x34> asm volatile("std; rep movsl\n" :: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory"); else asm volatile("std; rep movsb\n" :: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory"); 800af8: 83 ef 01 sub $0x1,%edi 800afb: 8d 72 ff lea -0x1(%edx),%esi asm volatile("std; rep movsb\n" 800afe: fd std 800aff: f3 a4 rep movsb %ds:(%esi),%es:(%edi) // Some versions of GCC rely on DF being clear asm volatile("cld" ::: "cc"); 800b01: fc cld 800b02: eb 21 jmp 800b25 <memmove+0x55> if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 800b04: f6 c1 03 test $0x3,%cl 800b07: 75 ef jne 800af8 <memmove+0x28> :: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory"); 800b09: 83 ef 04 sub $0x4,%edi 800b0c: 8d 72 fc lea -0x4(%edx),%esi 800b0f: c1 e9 02 shr $0x2,%ecx asm volatile("std; rep movsl\n" 800b12: fd std 800b13: f3 a5 rep movsl %ds:(%esi),%es:(%edi) 800b15: eb ea jmp 800b01 <memmove+0x31> } else { if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 800b17: 89 f2 mov %esi,%edx 800b19: 09 c2 or %eax,%edx 800b1b: f6 c2 03 test $0x3,%dl 800b1e: 74 09 je 800b29 <memmove+0x59> asm volatile("cld; rep movsl\n" :: "D" (d), "S" (s), "c" (n/4) : "cc", "memory"); else asm volatile("cld; rep movsb\n" 800b20: 89 c7 mov %eax,%edi 800b22: fc cld 800b23: f3 a4 rep movsb %ds:(%esi),%es:(%edi) :: "D" (d), "S" (s), "c" (n) : "cc", "memory"); } return dst; } 800b25: 5e pop %esi 800b26: 5f pop %edi 800b27: 5d pop %ebp 800b28: c3 ret if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0) 800b29: f6 c1 03 test $0x3,%cl 800b2c: 75 f2 jne 800b20 <memmove+0x50> :: "D" (d), "S" (s), "c" (n/4) : "cc", "memory"); 800b2e: c1 e9 02 shr $0x2,%ecx asm volatile("cld; rep movsl\n" 800b31: 89 c7 mov %eax,%edi 800b33: fc cld 800b34: f3 a5 rep movsl %ds:(%esi),%es:(%edi) 800b36: eb ed jmp 800b25 <memmove+0x55> 00800b38 <memcpy>: } #endif void * memcpy(void *dst, const void *src, size_t n) { 800b38: 55 push %ebp 800b39: 89 e5 mov %esp,%ebp return memmove(dst, src, n); 800b3b: ff 75 10 pushl 0x10(%ebp) 800b3e: ff 75 0c pushl 0xc(%ebp) 800b41: ff 75 08 pushl 0x8(%ebp) 800b44: e8 87 ff ff ff call 800ad0 <memmove> } 800b49: c9 leave 800b4a: c3 ret 00800b4b <memcmp>: int memcmp(const void *v1, const void *v2, size_t n) { 800b4b: 55 push %ebp 800b4c: 89 e5 mov %esp,%ebp 800b4e: 56 push %esi 800b4f: 53 push %ebx 800b50: 8b 45 08 mov 0x8(%ebp),%eax 800b53: 8b 55 0c mov 0xc(%ebp),%edx 800b56: 89 c6 mov %eax,%esi 800b58: 03 75 10 add 0x10(%ebp),%esi const uint8_t *s1 = (const uint8_t *) v1; const uint8_t *s2 = (const uint8_t *) v2; while (n-- > 0) { 800b5b: 39 f0 cmp %esi,%eax 800b5d: 74 1c je 800b7b <memcmp+0x30> if (*s1 != *s2) 800b5f: 0f b6 08 movzbl (%eax),%ecx 800b62: 0f b6 1a movzbl (%edx),%ebx 800b65: 38 d9 cmp %bl,%cl 800b67: 75 08 jne 800b71 <memcmp+0x26> return (int) *s1 - (int) *s2; s1++, s2++; 800b69: 83 c0 01 add $0x1,%eax 800b6c: 83 c2 01 add $0x1,%edx 800b6f: eb ea jmp 800b5b <memcmp+0x10> return (int) *s1 - (int) *s2; 800b71: 0f b6 c1 movzbl %cl,%eax 800b74: 0f b6 db movzbl %bl,%ebx 800b77: 29 d8 sub %ebx,%eax 800b79: eb 05 jmp 800b80 <memcmp+0x35> } return 0; 800b7b: b8 00 00 00 00 mov $0x0,%eax } 800b80: 5b pop %ebx 800b81: 5e pop %esi 800b82: 5d pop %ebp 800b83: c3 ret 00800b84 <memfind>: void * memfind(const void *s, int c, size_t n) { 800b84: 55 push %ebp 800b85: 89 e5 mov %esp,%ebp 800b87: 8b 45 08 mov 0x8(%ebp),%eax 800b8a: 8b 4d 0c mov 0xc(%ebp),%ecx const void *ends = (const char *) s + n; 800b8d: 89 c2 mov %eax,%edx 800b8f: 03 55 10 add 0x10(%ebp),%edx for (; s < ends; s++) 800b92: 39 d0 cmp %edx,%eax 800b94: 73 09 jae 800b9f <memfind+0x1b> if (*(const unsigned char *) s == (unsigned char) c) 800b96: 38 08 cmp %cl,(%eax) 800b98: 74 05 je 800b9f <memfind+0x1b> for (; s < ends; s++) 800b9a: 83 c0 01 add $0x1,%eax 800b9d: eb f3 jmp 800b92 <memfind+0xe> break; return (void *) s; } 800b9f: 5d pop %ebp 800ba0: c3 ret 00800ba1 <strtol>: long strtol(const char *s, char **endptr, int base) { 800ba1: 55 push %ebp 800ba2: 89 e5 mov %esp,%ebp 800ba4: 57 push %edi 800ba5: 56 push %esi 800ba6: 53 push %ebx 800ba7: 8b 4d 08 mov 0x8(%ebp),%ecx 800baa: 8b 5d 10 mov 0x10(%ebp),%ebx int neg = 0; long val = 0; // gobble initial whitespace while (*s == ' ' || *s == '\t') 800bad: eb 03 jmp 800bb2 <strtol+0x11> s++; 800baf: 83 c1 01 add $0x1,%ecx while (*s == ' ' || *s == '\t') 800bb2: 0f b6 01 movzbl (%ecx),%eax 800bb5: 3c 20 cmp $0x20,%al 800bb7: 74 f6 je 800baf <strtol+0xe> 800bb9: 3c 09 cmp $0x9,%al 800bbb: 74 f2 je 800baf <strtol+0xe> // plus/minus sign if (*s == '+') 800bbd: 3c 2b cmp $0x2b,%al 800bbf: 74 2e je 800bef <strtol+0x4e> int neg = 0; 800bc1: bf 00 00 00 00 mov $0x0,%edi s++; else if (*s == '-') 800bc6: 3c 2d cmp $0x2d,%al 800bc8: 74 2f je 800bf9 <strtol+0x58> s++, neg = 1; // hex or octal base prefix if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) 800bca: f7 c3 ef ff ff ff test $0xffffffef,%ebx 800bd0: 75 05 jne 800bd7 <strtol+0x36> 800bd2: 80 39 30 cmpb $0x30,(%ecx) 800bd5: 74 2c je 800c03 <strtol+0x62> s += 2, base = 16; else if (base == 0 && s[0] == '0') 800bd7: 85 db test %ebx,%ebx 800bd9: 75 0a jne 800be5 <strtol+0x44> s++, base = 8; else if (base == 0) base = 10; 800bdb: bb 0a 00 00 00 mov $0xa,%ebx else if (base == 0 && s[0] == '0') 800be0: 80 39 30 cmpb $0x30,(%ecx) 800be3: 74 28 je 800c0d <strtol+0x6c> base = 10; 800be5: b8 00 00 00 00 mov $0x0,%eax 800bea: 89 5d 10 mov %ebx,0x10(%ebp) 800bed: eb 50 jmp 800c3f <strtol+0x9e> s++; 800bef: 83 c1 01 add $0x1,%ecx int neg = 0; 800bf2: bf 00 00 00 00 mov $0x0,%edi 800bf7: eb d1 jmp 800bca <strtol+0x29> s++, neg = 1; 800bf9: 83 c1 01 add $0x1,%ecx 800bfc: bf 01 00 00 00 mov $0x1,%edi 800c01: eb c7 jmp 800bca <strtol+0x29> if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) 800c03: 80 79 01 78 cmpb $0x78,0x1(%ecx) 800c07: 74 0e je 800c17 <strtol+0x76> else if (base == 0 && s[0] == '0') 800c09: 85 db test %ebx,%ebx 800c0b: 75 d8 jne 800be5 <strtol+0x44> s++, base = 8; 800c0d: 83 c1 01 add $0x1,%ecx 800c10: bb 08 00 00 00 mov $0x8,%ebx 800c15: eb ce jmp 800be5 <strtol+0x44> s += 2, base = 16; 800c17: 83 c1 02 add $0x2,%ecx 800c1a: bb 10 00 00 00 mov $0x10,%ebx 800c1f: eb c4 jmp 800be5 <strtol+0x44> while (1) { int dig; if (*s >= '0' && *s <= '9') dig = *s - '0'; else if (*s >= 'a' && *s <= 'z') 800c21: 8d 72 9f lea -0x61(%edx),%esi 800c24: 89 f3 mov %esi,%ebx 800c26: 80 fb 19 cmp $0x19,%bl 800c29: 77 29 ja 800c54 <strtol+0xb3> dig = *s - 'a' + 10; 800c2b: 0f be d2 movsbl %dl,%edx 800c2e: 83 ea 57 sub $0x57,%edx else if (*s >= 'A' && *s <= 'Z') dig = *s - 'A' + 10; else break; if (dig >= base) 800c31: 3b 55 10 cmp 0x10(%ebp),%edx 800c34: 7d 30 jge 800c66 <strtol+0xc5> break; s++, val = (val * base) + dig; 800c36: 83 c1 01 add $0x1,%ecx 800c39: 0f af 45 10 imul 0x10(%ebp),%eax 800c3d: 01 d0 add %edx,%eax if (*s >= '0' && *s <= '9') 800c3f: 0f b6 11 movzbl (%ecx),%edx 800c42: 8d 72 d0 lea -0x30(%edx),%esi 800c45: 89 f3 mov %esi,%ebx 800c47: 80 fb 09 cmp $0x9,%bl 800c4a: 77 d5 ja 800c21 <strtol+0x80> dig = *s - '0'; 800c4c: 0f be d2 movsbl %dl,%edx 800c4f: 83 ea 30 sub $0x30,%edx 800c52: eb dd jmp 800c31 <strtol+0x90> else if (*s >= 'A' && *s <= 'Z') 800c54: 8d 72 bf lea -0x41(%edx),%esi 800c57: 89 f3 mov %esi,%ebx 800c59: 80 fb 19 cmp $0x19,%bl 800c5c: 77 08 ja 800c66 <strtol+0xc5> dig = *s - 'A' + 10; 800c5e: 0f be d2 movsbl %dl,%edx 800c61: 83 ea 37 sub $0x37,%edx 800c64: eb cb jmp 800c31 <strtol+0x90> // we don't properly detect overflow! } if (endptr) 800c66: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 800c6a: 74 05 je 800c71 <strtol+0xd0> *endptr = (char *) s; 800c6c: 8b 75 0c mov 0xc(%ebp),%esi 800c6f: 89 0e mov %ecx,(%esi) return (neg ? -val : val); 800c71: 89 c2 mov %eax,%edx 800c73: f7 da neg %edx 800c75: 85 ff test %edi,%edi 800c77: 0f 45 c2 cmovne %edx,%eax } 800c7a: 5b pop %ebx 800c7b: 5e pop %esi 800c7c: 5f pop %edi 800c7d: 5d pop %ebp 800c7e: c3 ret 800c7f: 90 nop 00800c80 <__udivdi3>: 800c80: 55 push %ebp 800c81: 57 push %edi 800c82: 56 push %esi 800c83: 53 push %ebx 800c84: 83 ec 1c sub $0x1c,%esp 800c87: 8b 54 24 3c mov 0x3c(%esp),%edx 800c8b: 8b 6c 24 30 mov 0x30(%esp),%ebp 800c8f: 8b 74 24 34 mov 0x34(%esp),%esi 800c93: 8b 5c 24 38 mov 0x38(%esp),%ebx 800c97: 85 d2 test %edx,%edx 800c99: 75 35 jne 800cd0 <__udivdi3+0x50> 800c9b: 39 f3 cmp %esi,%ebx 800c9d: 0f 87 bd 00 00 00 ja 800d60 <__udivdi3+0xe0> 800ca3: 85 db test %ebx,%ebx 800ca5: 89 d9 mov %ebx,%ecx 800ca7: 75 0b jne 800cb4 <__udivdi3+0x34> 800ca9: b8 01 00 00 00 mov $0x1,%eax 800cae: 31 d2 xor %edx,%edx 800cb0: f7 f3 div %ebx 800cb2: 89 c1 mov %eax,%ecx 800cb4: 31 d2 xor %edx,%edx 800cb6: 89 f0 mov %esi,%eax 800cb8: f7 f1 div %ecx 800cba: 89 c6 mov %eax,%esi 800cbc: 89 e8 mov %ebp,%eax 800cbe: 89 f7 mov %esi,%edi 800cc0: f7 f1 div %ecx 800cc2: 89 fa mov %edi,%edx 800cc4: 83 c4 1c add $0x1c,%esp 800cc7: 5b pop %ebx 800cc8: 5e pop %esi 800cc9: 5f pop %edi 800cca: 5d pop %ebp 800ccb: c3 ret 800ccc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 800cd0: 39 f2 cmp %esi,%edx 800cd2: 77 7c ja 800d50 <__udivdi3+0xd0> 800cd4: 0f bd fa bsr %edx,%edi 800cd7: 83 f7 1f xor $0x1f,%edi 800cda: 0f 84 98 00 00 00 je 800d78 <__udivdi3+0xf8> 800ce0: 89 f9 mov %edi,%ecx 800ce2: b8 20 00 00 00 mov $0x20,%eax 800ce7: 29 f8 sub %edi,%eax 800ce9: d3 e2 shl %cl,%edx 800ceb: 89 54 24 08 mov %edx,0x8(%esp) 800cef: 89 c1 mov %eax,%ecx 800cf1: 89 da mov %ebx,%edx 800cf3: d3 ea shr %cl,%edx 800cf5: 8b 4c 24 08 mov 0x8(%esp),%ecx 800cf9: 09 d1 or %edx,%ecx 800cfb: 89 f2 mov %esi,%edx 800cfd: 89 4c 24 08 mov %ecx,0x8(%esp) 800d01: 89 f9 mov %edi,%ecx 800d03: d3 e3 shl %cl,%ebx 800d05: 89 c1 mov %eax,%ecx 800d07: d3 ea shr %cl,%edx 800d09: 89 f9 mov %edi,%ecx 800d0b: 89 5c 24 0c mov %ebx,0xc(%esp) 800d0f: d3 e6 shl %cl,%esi 800d11: 89 eb mov %ebp,%ebx 800d13: 89 c1 mov %eax,%ecx 800d15: d3 eb shr %cl,%ebx 800d17: 09 de or %ebx,%esi 800d19: 89 f0 mov %esi,%eax 800d1b: f7 74 24 08 divl 0x8(%esp) 800d1f: 89 d6 mov %edx,%esi 800d21: 89 c3 mov %eax,%ebx 800d23: f7 64 24 0c mull 0xc(%esp) 800d27: 39 d6 cmp %edx,%esi 800d29: 72 0c jb 800d37 <__udivdi3+0xb7> 800d2b: 89 f9 mov %edi,%ecx 800d2d: d3 e5 shl %cl,%ebp 800d2f: 39 c5 cmp %eax,%ebp 800d31: 73 5d jae 800d90 <__udivdi3+0x110> 800d33: 39 d6 cmp %edx,%esi 800d35: 75 59 jne 800d90 <__udivdi3+0x110> 800d37: 8d 43 ff lea -0x1(%ebx),%eax 800d3a: 31 ff xor %edi,%edi 800d3c: 89 fa mov %edi,%edx 800d3e: 83 c4 1c add $0x1c,%esp 800d41: 5b pop %ebx 800d42: 5e pop %esi 800d43: 5f pop %edi 800d44: 5d pop %ebp 800d45: c3 ret 800d46: 8d 76 00 lea 0x0(%esi),%esi 800d49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 800d50: 31 ff xor %edi,%edi 800d52: 31 c0 xor %eax,%eax 800d54: 89 fa mov %edi,%edx 800d56: 83 c4 1c add $0x1c,%esp 800d59: 5b pop %ebx 800d5a: 5e pop %esi 800d5b: 5f pop %edi 800d5c: 5d pop %ebp 800d5d: c3 ret 800d5e: 66 90 xchg %ax,%ax 800d60: 31 ff xor %edi,%edi 800d62: 89 e8 mov %ebp,%eax 800d64: 89 f2 mov %esi,%edx 800d66: f7 f3 div %ebx 800d68: 89 fa mov %edi,%edx 800d6a: 83 c4 1c add $0x1c,%esp 800d6d: 5b pop %ebx 800d6e: 5e pop %esi 800d6f: 5f pop %edi 800d70: 5d pop %ebp 800d71: c3 ret 800d72: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 800d78: 39 f2 cmp %esi,%edx 800d7a: 72 06 jb 800d82 <__udivdi3+0x102> 800d7c: 31 c0 xor %eax,%eax 800d7e: 39 eb cmp %ebp,%ebx 800d80: 77 d2 ja 800d54 <__udivdi3+0xd4> 800d82: b8 01 00 00 00 mov $0x1,%eax 800d87: eb cb jmp 800d54 <__udivdi3+0xd4> 800d89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 800d90: 89 d8 mov %ebx,%eax 800d92: 31 ff xor %edi,%edi 800d94: eb be jmp 800d54 <__udivdi3+0xd4> 800d96: 66 90 xchg %ax,%ax 800d98: 66 90 xchg %ax,%ax 800d9a: 66 90 xchg %ax,%ax 800d9c: 66 90 xchg %ax,%ax 800d9e: 66 90 xchg %ax,%ax 00800da0 <__umoddi3>: 800da0: 55 push %ebp 800da1: 57 push %edi 800da2: 56 push %esi 800da3: 53 push %ebx 800da4: 83 ec 1c sub $0x1c,%esp 800da7: 8b 6c 24 3c mov 0x3c(%esp),%ebp 800dab: 8b 74 24 30 mov 0x30(%esp),%esi 800daf: 8b 5c 24 34 mov 0x34(%esp),%ebx 800db3: 8b 7c 24 38 mov 0x38(%esp),%edi 800db7: 85 ed test %ebp,%ebp 800db9: 89 f0 mov %esi,%eax 800dbb: 89 da mov %ebx,%edx 800dbd: 75 19 jne 800dd8 <__umoddi3+0x38> 800dbf: 39 df cmp %ebx,%edi 800dc1: 0f 86 b1 00 00 00 jbe 800e78 <__umoddi3+0xd8> 800dc7: f7 f7 div %edi 800dc9: 89 d0 mov %edx,%eax 800dcb: 31 d2 xor %edx,%edx 800dcd: 83 c4 1c add $0x1c,%esp 800dd0: 5b pop %ebx 800dd1: 5e pop %esi 800dd2: 5f pop %edi 800dd3: 5d pop %ebp 800dd4: c3 ret 800dd5: 8d 76 00 lea 0x0(%esi),%esi 800dd8: 39 dd cmp %ebx,%ebp 800dda: 77 f1 ja 800dcd <__umoddi3+0x2d> 800ddc: 0f bd cd bsr %ebp,%ecx 800ddf: 83 f1 1f xor $0x1f,%ecx 800de2: 89 4c 24 04 mov %ecx,0x4(%esp) 800de6: 0f 84 b4 00 00 00 je 800ea0 <__umoddi3+0x100> 800dec: b8 20 00 00 00 mov $0x20,%eax 800df1: 89 c2 mov %eax,%edx 800df3: 8b 44 24 04 mov 0x4(%esp),%eax 800df7: 29 c2 sub %eax,%edx 800df9: 89 c1 mov %eax,%ecx 800dfb: 89 f8 mov %edi,%eax 800dfd: d3 e5 shl %cl,%ebp 800dff: 89 d1 mov %edx,%ecx 800e01: 89 54 24 0c mov %edx,0xc(%esp) 800e05: d3 e8 shr %cl,%eax 800e07: 09 c5 or %eax,%ebp 800e09: 8b 44 24 04 mov 0x4(%esp),%eax 800e0d: 89 c1 mov %eax,%ecx 800e0f: d3 e7 shl %cl,%edi 800e11: 89 d1 mov %edx,%ecx 800e13: 89 7c 24 08 mov %edi,0x8(%esp) 800e17: 89 df mov %ebx,%edi 800e19: d3 ef shr %cl,%edi 800e1b: 89 c1 mov %eax,%ecx 800e1d: 89 f0 mov %esi,%eax 800e1f: d3 e3 shl %cl,%ebx 800e21: 89 d1 mov %edx,%ecx 800e23: 89 fa mov %edi,%edx 800e25: d3 e8 shr %cl,%eax 800e27: 0f b6 4c 24 04 movzbl 0x4(%esp),%ecx 800e2c: 09 d8 or %ebx,%eax 800e2e: f7 f5 div %ebp 800e30: d3 e6 shl %cl,%esi 800e32: 89 d1 mov %edx,%ecx 800e34: f7 64 24 08 mull 0x8(%esp) 800e38: 39 d1 cmp %edx,%ecx 800e3a: 89 c3 mov %eax,%ebx 800e3c: 89 d7 mov %edx,%edi 800e3e: 72 06 jb 800e46 <__umoddi3+0xa6> 800e40: 75 0e jne 800e50 <__umoddi3+0xb0> 800e42: 39 c6 cmp %eax,%esi 800e44: 73 0a jae 800e50 <__umoddi3+0xb0> 800e46: 2b 44 24 08 sub 0x8(%esp),%eax 800e4a: 19 ea sbb %ebp,%edx 800e4c: 89 d7 mov %edx,%edi 800e4e: 89 c3 mov %eax,%ebx 800e50: 89 ca mov %ecx,%edx 800e52: 0f b6 4c 24 0c movzbl 0xc(%esp),%ecx 800e57: 29 de sub %ebx,%esi 800e59: 19 fa sbb %edi,%edx 800e5b: 8b 5c 24 04 mov 0x4(%esp),%ebx 800e5f: 89 d0 mov %edx,%eax 800e61: d3 e0 shl %cl,%eax 800e63: 89 d9 mov %ebx,%ecx 800e65: d3 ee shr %cl,%esi 800e67: d3 ea shr %cl,%edx 800e69: 09 f0 or %esi,%eax 800e6b: 83 c4 1c add $0x1c,%esp 800e6e: 5b pop %ebx 800e6f: 5e pop %esi 800e70: 5f pop %edi 800e71: 5d pop %ebp 800e72: c3 ret 800e73: 90 nop 800e74: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 800e78: 85 ff test %edi,%edi 800e7a: 89 f9 mov %edi,%ecx 800e7c: 75 0b jne 800e89 <__umoddi3+0xe9> 800e7e: b8 01 00 00 00 mov $0x1,%eax 800e83: 31 d2 xor %edx,%edx 800e85: f7 f7 div %edi 800e87: 89 c1 mov %eax,%ecx 800e89: 89 d8 mov %ebx,%eax 800e8b: 31 d2 xor %edx,%edx 800e8d: f7 f1 div %ecx 800e8f: 89 f0 mov %esi,%eax 800e91: f7 f1 div %ecx 800e93: e9 31 ff ff ff jmp 800dc9 <__umoddi3+0x29> 800e98: 90 nop 800e99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 800ea0: 39 dd cmp %ebx,%ebp 800ea2: 72 08 jb 800eac <__umoddi3+0x10c> 800ea4: 39 f7 cmp %esi,%edi 800ea6: 0f 87 21 ff ff ff ja 800dcd <__umoddi3+0x2d> 800eac: 89 da mov %ebx,%edx 800eae: 89 f0 mov %esi,%eax 800eb0: 29 f8 sub %edi,%eax 800eb2: 19 ea sbb %ebp,%edx 800eb4: e9 14 ff ff ff jmp 800dcd <__umoddi3+0x2d>
2020 Fall E C E 252/HW08/HW08A/copy2.asm
jsswd888/2020_FALL_UW_MADISON
0
18431
<filename>2020 Fall E C E 252/HW08/HW08A/copy2.asm ; File name: copy2.asm ; Author: ; Description: copy a value from one memory location ; to another using LDR and STR .ORIG x0200 START LEA R0, ANIMALS ; get base address for ANIMALS array ; your code below LDR R1, R0, #3 STR R1, R0, #8 ; your code above BR START ; program data ANIMALS .FILL x1234 ; BIRD .FILL x7890 ; CAT .FILL xABCD ; DOG .FILL x00FF ; FISH .FILL xFF00 ; HORSE .FILL x1248 ; LIZARD .FILL x1337 ; MONKEY .FILL xCAFE ; SALMON .FILL xFACE ; TURKEY .FILL xBEEF ; ZEBRA .END
oeis/032/A032780.asm
neoneye/loda-programs
11
90721
; A032780: a(n) = n(n+1)(n+2)...(n+8) / (n+(n+1)+(n+2)+...+(n+8)). ; Submitted by <NAME>(s3.) ; 0,8064,67200,316800,1108800,3203200,8072064,18345600,38438400,75398400,140025600,248312064,423259200,697132800,1114220800,1734163200,2635928064,3922512000,5726448000,8216208000,11603592000,16152200064,22187088000,30105712000,40390272000,53621568000,70494488064,91835251200,118620532800,151998604800,193312627200,244126232064,306251545600,381779798400,473114678400,583008585600,714601952064,871465795200,1057647676800,1277721244800,1536839539200,1840792248064,2196067104000,2609915616000 mov $1,7 mov $2,$0 add $2,7 sub $1,$2 bin $1,4 add $2,1 bin $2,4 mul $1,$2 mov $0,$1 mul $0,64
bb-runtimes/src/s-bbcppr__sparc.adb
JCGobbi/Nucleo-STM32G474RE
0
21680
<reponame>JCGobbi/Nucleo-STM32G474RE<filename>bb-runtimes/src/s-bbcppr__sparc.adb<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . C P U _ P R I M I T I V E S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2005 The European Space Agency -- -- Copyright (C) 2003-2020, 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. -- -- -- -- 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/>. -- -- -- ------------------------------------------------------------------------------ pragma Restrictions (No_Elaboration_Code); with System.Multiprocessors; with System.BB.CPU_Specific; with System.BB.Threads; package body System.BB.CPU_Primitives is use BB.Parameters; use System.BB.Threads; package SSE renames System.Storage_Elements; use type SSE.Integer_Address; use type SSE.Storage_Offset; ---------------- -- Local data -- ---------------- SP : constant Context_Id := 6; PC : constant Context_Id := 7; PSR : constant Context_Id := 8; WIM : constant Context_Id := 17; WIN : constant Context_Id := 18; FSR : constant Context_Id := 19; O0 : constant Context_Id := 0; INT : constant Context_Id := 52; -- these are the registers that are initialized: Program Counter, Stack -- Pointer, Window Invalid Mask, Floating-Point State Register, and -- Processor State Register. Moreover, the first input argument, the number -- of register windows to be restored, and the interrupt nesting level are -- also initialized. Base_CCR : constant Context_Id := Base_CCR_Context_Index; CCR : constant Context_Id := CCR_Context_Index; pragma Assert (Base_CCR_Context_Index = 53 and then CCR_Context_Index = 54); -- For LEON we allocate two slots for the cache control register at the -- end of the buffer. FP : constant SSE.Storage_Offset := 56; -- The frame pointer needs also to be initialized; however, it is not kept -- in the thread descriptor but in the stack, and this value represents the -- offset from the stack pointer (expressed in bytes). ---------------------- -- Trap definitions -- ---------------------- Instruction_Access_Exception : constant Vector_Id := 16#01#; Illegal_Instruction : constant Vector_Id := 16#02#; Address_Not_Aligned : constant Vector_Id := 16#07#; FP_Exception : constant Vector_Id := 16#08#; Data_Access_Exception : constant Vector_Id := 16#09#; Instruction_Access_Error : constant Vector_Id := 16#21#; Data_Access_Error : constant Vector_Id := 16#29#; Division_By_Zero_Hw : constant Vector_Id := 16#2A#; Data_Store_Error : constant Vector_Id := 16#2B#; Division_By_Zero_Sw : constant Vector_Id := 16#82#; type Trap_Entry is record First_Instr : SSE.Integer_Address; Second_Instr : SSE.Integer_Address; Third_Instr : SSE.Integer_Address; Fourth_Instr : SSE.Integer_Address; end record; -- Each entry in the trap table contains the four first instructions that -- will be executed as part of the handler. A trap is a vectored transfer -- of control to the supervisor through a special trap table that contains -- the first four instructions of each trap handler. The base address of -- the table is established by supervisor and the displacement, within the -- table, is determined by the trap type. type Trap_Entries_Table is array (Vector_Id) of Trap_Entry; Trap_Table : Trap_Entries_Table; pragma Import (Asm, Trap_Table, "trap_table"); -- This is the trap table, that is defined in the crt0 file. This table -- contains the trap entry for all the traps (synchronous and asynchronous) -- defined by the SPARC architecture. Common_Handler : Address; pragma Import (Asm, Common_Handler, "common_handler"); -- There is a common part that is executed for every trap. This common -- handler executes some prologue, then jumps to the user code, and after -- that executes an epilogue. type Vector_Table is array (Vector_Id) of System.Address; User_Vector_Table : Vector_Table; pragma Export (Asm, User_Vector_Table, "user_vector_table"); -- In addition to the trap table there is another table that contains the -- addresses for the trap handlers defined by the user. This is used by -- the common wrapper to invoke the correct user-defined handler. function Get_CCR return System.Address; pragma Import (Asm, Get_CCR, "get_ccr"); pragma Weak_External (Get_CCR); -- Get the value from the hardware Cache Control Register. procedure GNAT_Error_Handler (Trap : Vector_Id); -- Trap handler converting synchronous traps to exceptions ---------------------------- -- Floating point context -- ---------------------------- type Thread_Table is array (System.Multiprocessors.CPU) of Thread_Id; pragma Volatile_Components (Thread_Table); Float_Latest_User_Table : Thread_Table := (others => Null_Thread_Id); pragma Export (Asm, Float_Latest_User_Table, "float_latest_user_table"); -- This variable contains the last thread that used the floating point unit -- for each CPU. Hence, it points to the place where the floating point -- state must be stored. -------------------- -- Context_Switch -- -------------------- procedure Context_Switch is procedure Asm_Context_Switch; pragma Import (Asm, Asm_Context_Switch, "__gnat_context_switch"); begin Asm_Context_Switch; end Context_Switch; ------------------------ -- Disable_Interrupts -- ------------------------ procedure Disable_Interrupts is procedure Asm_Disable_Interrupts; pragma Import (Asm, Asm_Disable_Interrupts, "disable_interrupts"); begin Asm_Disable_Interrupts; -- Replace by inline Asm ??? end Disable_Interrupts; ----------------------- -- Enable_Interrupts -- ----------------------- procedure Enable_Interrupts (Level : Integer) is procedure Asm_Enable_Interrupts (Level : Natural); pragma Import (Asm, Asm_Enable_Interrupts, "enable_interrupts"); begin if Level in Interrupt_Priority then Asm_Enable_Interrupts (Level - Interrupt_Priority'First + 1); else Asm_Enable_Interrupts (0); end if; end Enable_Interrupts; ----------------- -- Get_Context -- ----------------- function Get_Context (Context : Context_Buffer; Index : Context_Id) return Word is begin return Word (Context (Index)); end Get_Context; ------------------------ -- GNAT_Error_Handler -- ------------------------ procedure GNAT_Error_Handler (Trap : Vector_Id) is begin case Trap is when Instruction_Access_Exception => raise Storage_Error with "instruction access exception"; when Illegal_Instruction => raise Constraint_Error with "illegal instruction"; when Address_Not_Aligned => raise Constraint_Error with "address not aligned"; when FP_Exception => raise Constraint_Error with "floating point exception"; when Data_Access_Exception => raise Constraint_Error with "data access exception"; when Instruction_Access_Error => raise Constraint_Error with "instruction access exception"; when Data_Access_Error => raise Constraint_Error with "data access error"; when Division_By_Zero_Hw | Division_By_Zero_Sw => raise Constraint_Error with "division by zero"; when Data_Store_Error => raise Constraint_Error with "data store error"; when others => raise Program_Error with "unhandled trap"; end case; end GNAT_Error_Handler; ------------------------ -- Initialize_Context -- ------------------------ procedure Initialize_Context (Buffer : not null access Context_Buffer; Program_Counter : System.Address; Argument : System.Address; Stack_Pointer : System.Address) is begin -- The stack must be aligned to 16. 96 bytes are needed for storing -- a whole register window (96 bytes). Buffer (SP) := SSE.To_Address ((SSE.To_Integer (Stack_Pointer) / 16) * 16 - 96); -- Initialize PSR with the state expected by the context switch routine. -- Floating point unit is disabled. Traps are enabled, although -- interrupts are disabled (after the context switch only interrupts -- with a lower priority than the task will be masked). The supervisor -- and previous supervisor are set to 1 (the system always operates in -- supervisor mode). -- CWP = 0, ET = 1, PS = 1, S = 1, and PIL = 15 Buffer (PSR) := SSE.To_Address (16#0FE0#); -- The WIM is initialized to 2 (corresponding to CWP = 1) Buffer (WIM) := SSE.To_Address (2); -- The number of windows that must be flushed is initially set to 0 -- (only the current window). Buffer (WIN) := SSE.To_Address (0); -- Initialize PC with the starting address of the task. Substract 8 -- to compensate the adjustment made in the context switch routine. Buffer (PC) := SSE.To_Address (SSE.To_Integer (Program_Counter) - 8); -- The argument to be used by the task wrapper function must be -- passed through the o0 register. Buffer (O0) := Argument; -- The frame pointer is initialized to be the top of the stack declare FP_In_Stack : System.Address; for FP_In_Stack'Address use (Buffer (SP) + FP); begin -- Mark the deepest stack frame by setting the frame pointer to zero FP_In_Stack := SSE.To_Address (0); end; -- The interrupt nesting level is initialized to 0 Buffer (INT) := SSE.To_Address (0); -- For LEON we initialize the cache control register to its value at -- initialization time. Buffer (CCR) := (if Get_CCR'Address = Null_Address then Null_Address else Get_CCR); Buffer (Base_CCR) := Buffer (CCR); -- The Floating-Point State Register is initialized to 0 Buffer (FSR) := SSE.To_Address (0); -- The rest of registers do not need to be initialized end Initialize_Context; -------------------- -- Initialize_CPU -- -------------------- procedure Initialize_CPU is begin null; end Initialize_CPU; ---------------------- -- Initialize_Stack -- ---------------------- procedure Initialize_Stack (Base : Address; Size : Storage_Elements.Storage_Offset; Stack_Pointer : out Address) is use System.Storage_Elements; begin -- Force alignment Stack_Pointer := Base + (Size - (Size mod CPU_Specific.Stack_Alignment)); end Initialize_Stack; ---------------------------- -- Install_Error_Handlers -- ---------------------------- procedure Install_Error_Handlers is -- Set up trap handler to map synchronous signals to appropriate -- exceptions. Make sure that the handler isn't interrupted by -- another signal that might cause a scheduling event. begin -- The division by zero trap may be either a hardware trap (trap type -- 16#2A#) when the integer division istruction is used (on SPARC V8 and -- later) or a software trap (trap type 16#82#) caused by the software -- division implementation in libgcc. for J in Vector_Id'Range loop if J in Instruction_Access_Exception | Illegal_Instruction | Address_Not_Aligned | FP_Exception | Data_Access_Exception | Instruction_Access_Error | Data_Access_Error | Division_By_Zero_Hw | Division_By_Zero_Sw | Data_Store_Error then Install_Trap_Handler (GNAT_Error_Handler'Address, J); end if; end loop; end Install_Error_Handlers; -------------------------- -- Install_Trap_Handler -- -------------------------- procedure Install_Trap_Handler (Service_Routine : Address; Vector : Vector_Id; Synchronous : Boolean := False) is separate; ----------------- -- Set_Context -- ----------------- procedure Set_Context (Context : in out Context_Buffer; Index : Context_Id; Value : Word) is begin Context (Index) := Address (Value); end Set_Context; end System.BB.CPU_Primitives;
Source/HBIOS/sn76489.asm
vipoo/RomWBW
0
20191
;====================================================================== ; SN76489 sound driver ; ; WRITTEN BY: <NAME> ;====================================================================== ; ; TODO: ; 1. PROVIDE SUPPORT FOR NOISE CHANNEL ; 2. DOES THIS WORK FOR FASTER CPUS? ONLY BEEN TESTED ON A Z80 7MHZ UNIT ; ;====================================================================== ; CONSTANTS ;====================================================================== ; SN76489_PORT_LEFT .EQU $FC ; PORTS FOR ACCESSING THE SN76489 CHIP (LEFT) SN76489_PORT_RIGHT .EQU $F8 ; PORTS FOR ACCESSING THE SN76489 CHIP (RIGHT) SN7_IDAT .EQU 0 SN7_TONECNT .EQU 3 ; COUNT NUMBER OF TONE CHANNELS SN7_NOISECNT .EQU 1 ; COUNT NUMBER OF NOISE CHANNELS SN7_CHCNT .EQU SN7_TONECNT + SN7_NOISECNT CHANNEL_0_SILENT .EQU $9F CHANNEL_1_SILENT .EQU $BF CHANNEL_2_SILENT .EQU $DF CHANNEL_3_SILENT .EQU $FF SN7RATIO .EQU SN7CLK * 100 / 32 .ECHO "SN76489 CLOCK: " .ECHO SN7CLK .ECHO "\n" #INCLUDE "audio.inc" SN76489_INIT: LD IY, SN7_IDAT ; POINTER TO INSTANCE DATA LD DE,STR_MESSAGELT CALL WRITESTR LD A, SN76489_PORT_LEFT CALL PRTHEXBYTE LD DE,STR_MESSAGERT CALL WRITESTR LD A, SN76489_PORT_RIGHT CALL PRTHEXBYTE ; SN7_INIT1: LD BC, SN7_FNTBL ; BC := FUNCTION TABLE ADDRESS LD DE, SN7_IDAT ; DE := SN7 INSTANCE DATA PTR CALL SND_ADDENT ; ADD ENTRY, A := UNIT ASSIGNED CALL SN7_VOLUME_OFF XOR A ; SIGNAL SUCCESS RET ;====================================================================== ; SN76489 DRIVER - SOUND ADAPTER (SND) FUNCTIONS ;====================================================================== ; SN7_RESET: AUDTRACE(SNT_INIT) CALL SN7_VOLUME_OFF XOR A ; SIGNAL SUCCESS RET SN7_VOLUME_OFF: AUDTRACE(SNT_VOLOFF) LD A, CHANNEL_0_SILENT OUT (SN76489_PORT_LEFT), A OUT (SN76489_PORT_RIGHT), A LD A, CHANNEL_1_SILENT OUT (SN76489_PORT_LEFT), A OUT (SN76489_PORT_RIGHT), A LD A, CHANNEL_2_SILENT OUT (SN76489_PORT_LEFT), A OUT (SN76489_PORT_RIGHT), A LD A, CHANNEL_3_SILENT OUT (SN76489_PORT_LEFT), A OUT (SN76489_PORT_RIGHT), A RET ; BIT MAPPING ; SET TONE: ; 1 CC 0 PPPP (LOW) ; 0 0 PPPPPP (HIGH) ; 1 CC 1 VVVV SN7_VOLUME: AUDTRACE(SNT_VOL) AUDTRACE_L AUDTRACE_CR LD A, L LD (SN7_PENDING_VOLUME), A XOR A ; SIGNAL SUCCESS RET SN7_NOTE: LD DE, SN7NOTETBL CALL AUD_NOTE ; RETURNS PERIOD IN HL, FALL THRU ; TO SET THIS PERIOD SN7_PERIOD: AUDTRACE(SNT_PERIOD) AUDTRACE_HL AUDTRACE_CR LD A, H ; IF ZERO - ERROR OR L JR Z, SN7_QUERY_PERIOD1 LD (SN7_PENDING_PERIOD), HL ;ASSUME SUCCESS OR A ; IF >= 401 ERROR LD DE, $401 SBC HL, DE JR NC, SN7_QUERY_PERIOD1 XOR A ; SIGNAL SUCCESS RET SN7_QUERY_PERIOD1: ; REQUESTED PERIOD IS LARGER THAN THE SN76489 CAN SUPPORT LD A, $FF LD L, A LD H, A LD (SN7_PENDING_PERIOD), HL RET SN7_PLAY: AUDTRACE(SNT_PLAY) AUDTRACE_D AUDTRACE_CR LD A, (SN7_PENDING_PERIOD + 1) CP $FF JR Z, SN7_PLAY1 ; PERIOD IS TOO LARGE, UNABLE TO PLAY CALL SN7_APPLY_VOL CALL SN7_APPLY_PRD XOR A ; SIGNAL SUCCESS RET SN7_PLAY1: ; TURN CHANNEL VOL TO OFF AND STOP PLAYING LD A, (SN7_PENDING_VOLUME) PUSH AF LD A, 0 LD (SN7_PENDING_VOLUME), A CALL SN7_APPLY_VOL POP AF LD (SN7_PENDING_VOLUME), A OR $FF ; SIGNAL FAILURE RET SN7_QUERY: LD A, E CP BF_SNDQ_CHCNT JR Z, SN7_QUERY_CHCNT CP BF_SNDQ_PERIOD JR Z, SN7_QUERY_PERIOD CP BF_SNDQ_VOLUME JR Z, SN7_QUERY_VOLUME CP BF_SNDQ_DEV JR Z, SN7_QUERY_DEV OR $FF ; SIGNAL FAILURE RET SN7_QUERY_CHCNT: LD B, SN7_TONECNT LD C, SN7_NOISECNT XOR A RET SN7_QUERY_PERIOD: LD HL, (SN7_PENDING_PERIOD) XOR A RET SN7_QUERY_VOLUME: LD A, (SN7_PENDING_VOLUME) LD L, A LD H, 0 XOR A RET SN7_QUERY_DEV: LD B, SNDDEV_SN76489 LD DE, SN76489_PORT_LEFT ; E WITH LEFT PORT LD HL, SN76489_PORT_RIGHT ; L WITH RIGHT PORT XOR A RET ; ; UTIL FUNCTIONS ; SN7_APPLY_VOL: ; APPLY VOLUME TO BOTH LEFT AND RIGHT CHANNELS PUSH BC ; D CONTAINS THE CHANNEL NUMBER PUSH AF LD A, D AND $3 RLCA RLCA RLCA RLCA RLCA OR $90 LD B, A LD A, (SN7_PENDING_VOLUME) RRCA RRCA RRCA RRCA AND $0F LD C, A LD A, $0F SUB C AND $0F OR B ; A CONTAINS COMMAND TO SET VOLUME FOR CHANNEL AUDTRACE(SNT_REGWR) AUDTRACE_A AUDTRACE_CR OUT (SN76489_PORT_LEFT), A OUT (SN76489_PORT_RIGHT), A POP AF POP BC RET SN7_APPLY_PRD: PUSH DE PUSH BC PUSH AF LD HL, (SN7_PENDING_PERIOD) LD A, D AND $3 RLCA RLCA RLCA RLCA RLCA OR $80 LD B, A ; PERIOD COMMAND 1 - CONTAINS CHANNEL ONLY LD A, L ; GET LOWER 4 BITS FOR COMMAND 1 AND $F OR B ; A NOW CONTAINS FIRST PERIOD COMMAND AUDTRACE(SNT_REGWR) AUDTRACE_A AUDTRACE_CR OUT (SN76489_PORT_LEFT), A OUT (SN76489_PORT_RIGHT), A LD A, L ; RIGHT SHIFT OUT THE LOWER 4 BITS RRCA RRCA RRCA RRCA AND $F LD B, A LD A, H AND $3 RLCA RLCA RLCA RLCA ; AND PLACE IN BITS 5 AND 6 OR B ; OR THE TWO SETS OF BITS TO MAKE 2ND PERIOD COMMAND AUDTRACE(SNT_REGWR) AUDTRACE_A AUDTRACE_CR OUT (SN76489_PORT_LEFT), A OUT (SN76489_PORT_RIGHT), A POP AF POP BC POP DE RET SN7_DURATION: LD (SN7_PENDING_DURATION),HL ; SET TONE DURATION XOR A RET SN7_DEVICE: LD D,SNDDEV_SN76489 ; D := DEVICE TYPE LD E,0 ; E := PHYSICAL UNIT LD C,$00 ; C := DEVICE TYPE LD H,0 ; H := 0, DRIVER HAS NO MODES LD L,SN76489_PORT_LEFT ; L := BASE I/O ADDRESS XOR A RET SN7_FNTBL: .DW SN7_RESET .DW SN7_VOLUME .DW SN7_PERIOD .DW SN7_NOTE .DW SN7_PLAY .DW SN7_QUERY .DW SN7_DURATION .DW SN7_DEVICE ; #IF (($ - SN7_FNTBL) != (SND_FNCNT * 2)) .ECHO "*** INVALID SND FUNCTION TABLE ***\n" !!!!! #ENDIF SN7_PENDING_PERIOD .DW 0 ; PENDING PERIOD (10 BITS) SN7_PENDING_VOLUME .DB 0 ; PENDING VOL (8 BITS -> DOWNCONVERTED TO 4 BITS AND INVERTED) SN7_PENDING_DURATION .DW 0 ; PENDING DURATION (16 BITS) STR_MESSAGELT .DB "\r\nSN76489: LEFT IO=0x$" STR_MESSAGERT .DB ", RIGHT IO=0x$" #IF AUDIOTRACE SNT_INIT .DB "\r\nSN7_INIT\r\n$" SNT_VOLOFF .DB "\r\nSN7_VOLUME OFF\r\n$" SNT_VOL .DB "\r\nSN7_VOLUME: $" SNT_NOTE .DB "\r\nSN7_NOTE: $" SNT_PERIOD .DB "\r\nSN7_PERIOD: $" SNT_PLAY .DB "\r\nSN7_PLAY CH: $" SNT_REGWR .DB "\r\nOUT SN76489, $" #ENDIF ; THE FREQUENCY BY QUARTER TONE STARTING AT A0# OCATVE 0 ; USED TO MAP EACH OCTAVE (DIV BY 2 TO JUMP AN OCTAVE UP) ; FIRST PLAYABLE NOTE WILL BE $2E ; ASSUMING A CLOCK OF 1843200 THIS MAPS TO ; 2 QUATER TONES BELOW A1#, WITH A1# AT $30 SN7NOTETBL: .DW SN7RATIO / 2913 .DW SN7RATIO / 2956 .DW SN7RATIO / 2999 .DW SN7RATIO / 3042 .DW SN7RATIO / 3086 .DW SN7RATIO / 3131 .DW SN7RATIO / 3177 .DW SN7RATIO / 3223 .DW SN7RATIO / 3270 .DW SN7RATIO / 3318 .DW SN7RATIO / 3366 .DW SN7RATIO / 3415 .DW SN7RATIO / 3464 .DW SN7RATIO / 3515 .DW SN7RATIO / 3566 .DW SN7RATIO / 3618 .DW SN7RATIO / 3670 .DW SN7RATIO / 3724 .DW SN7RATIO / 3778 .DW SN7RATIO / 3833 .DW SN7RATIO / 3889 .DW SN7RATIO / 3945 .DW SN7RATIO / 4003 .DW SN7RATIO / 4061 .DW SN7RATIO / 4120 .DW SN7RATIO / 4180 .DW SN7RATIO / 4241 .DW SN7RATIO / 4302 .DW SN7RATIO / 4365 .DW SN7RATIO / 4428 .DW SN7RATIO / 4493 .DW SN7RATIO / 4558 .DW SN7RATIO / 4624 .DW SN7RATIO / 4692 .DW SN7RATIO / 4760 .DW SN7RATIO / 4829 .DW SN7RATIO / 4899 .DW SN7RATIO / 4971 .DW SN7RATIO / 5043 .DW SN7RATIO / 5116 .DW SN7RATIO / 5191 .DW SN7RATIO / 5266 .DW SN7RATIO / 5343 .DW SN7RATIO / 5421 .DW SN7RATIO / 5499 .DW SN7RATIO / 5579 .DW SN7RATIO / 5661 .DW SN7RATIO / 5743
data/moves/tmhm_moves.asm
Dev727/ancientplatinum
2
105051
TMHMMoves: ; entries correspond to *_TMNUM enums (see constants/item_constants.asm) ; TMs dw DYNAMICPUNCH dw HEADBUTT dw CURSE dw ROLLOUT dw ROAR dw TOXIC dw ZAP_CANNON dw ROCK_SMASH dw PSYCH_UP dw HIDDEN_POWER dw SUNNY_DAY dw SWEET_SCENT dw SNORE dw BLIZZARD dw HYPER_BEAM dw ICY_WIND dw PROTECT dw RAIN_DANCE dw GIGA_DRAIN dw ENDURE dw FRUSTRATION dw SOLARBEAM dw IRON_TAIL dw DRAGONBREATH dw THUNDER dw EARTHQUAKE dw RETURN dw DIG dw PSYCHIC_M dw SHADOW_BALL dw MUD_SLAP dw DOUBLE_TEAM dw ICE_PUNCH dw SWAGGER dw SLEEP_TALK dw SLUDGE_BOMB dw SANDSTORM dw FIRE_BLAST dw SWIFT dw DEFENSE_CURL dw THUNDERPUNCH dw DREAM_EATER dw DETECT dw REST dw ATTRACT dw THIEF dw STEEL_WING dw FIRE_PUNCH dw FURY_CUTTER dw NIGHTMARE ; HMs dw CUT dw FLY dw SURF dw STRENGTH dw FLASH dw WHIRLPOOL dw WATERFALL ; Move tutor dw FLAMETHROWER dw THUNDERBOLT dw ICE_BEAM dw 0 ; end
alloy4fun_models/trashltl/models/19/AhK8ajQRkgr844eq7.als
Kaixi26/org.alloytools.alloy
0
3286
open main pred idAhK8ajQRkgr844eq7_prop20 { always all t : Trash | (t in Trash) since (t in Protected) } pred __repair { idAhK8ajQRkgr844eq7_prop20 } check __repair { idAhK8ajQRkgr844eq7_prop20 <=> prop20o }
tests/011_NOP__PAUSE__HLT_-_opcodes_that_does_not_have_dst_and_src.asm
tpisto/pasm
103
162529
<reponame>tpisto/pasm ; name: NOP, PAUSE, HLT - opcodes that does not have dst and src. ; code: "90F390F4" [bits 16] nop pause hlt
source/tests/regions-run.adb
reznikmm/declarative-regions
0
17269
<reponame>reznikmm/declarative-regions<gh_stars>0 -- SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Ada.Wide_Wide_Text_IO; with Regions.Tests; procedure Regions.Run is begin Regions.Tests.Test_Standard; Ada.Wide_Wide_Text_IO.Put_Line ("Hello!"); end Regions.Run;
src/natools-web-simple_pages-multipages.adb
faelys/natools-web
1
28416
<reponame>faelys/natools-web<gh_stars>1-10 ------------------------------------------------------------------------------ -- Copyright (c) 2019, <NAME> -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Natools.S_Expressions.Atom_Ref_Constructors; with Natools.S_Expressions.File_Readers; package body Natools.Web.Simple_Pages.Multipages is procedure Build_And_Register (Builder : in out Sites.Site_Builder; Expression : in out S_Expressions.Lockable.Descriptor'Class; Defaults : in Default_Data; Root_Path : in S_Expressions.Atom; Path_Spec : in S_Expressions.Atom); function Key_Path (Path, Spec : S_Expressions.Atom) return S_Expressions.Atom; function Web_Path (Path, Spec : S_Expressions.Atom) return S_Expressions.Atom_Refs.Immutable_Reference; ------------------------------ -- Local Helper Subprograms -- ------------------------------ procedure Build_And_Register (Builder : in out Sites.Site_Builder; Expression : in out S_Expressions.Lockable.Descriptor'Class; Defaults : in Default_Data; Root_Path : in S_Expressions.Atom; Path_Spec : in S_Expressions.Atom) is use type S_Expressions.Offset; Name : constant S_Expressions.Atom := (if Path_Spec (Path_Spec'First) in Character'Pos ('+') | Character'Pos ('-') | Character'Pos ('#') then Path_Spec (Path_Spec'First + 1 .. Path_Spec'Last) else Path_Spec); Page : constant Page_Ref := Create (Expression, Defaults.Template, Name); begin declare Mutator : constant Data_Refs.Mutator := Page.Ref.Update; begin Mutator.File_Path := Defaults.File_Path; Mutator.Web_Path := Web_Path (Root_Path, Path_Spec); end; Register (Page, Builder, Key_Path (Root_Path, Path_Spec)); end Build_And_Register; function Key_Path (Path, Spec : S_Expressions.Atom) return S_Expressions.Atom is use type S_Expressions.Atom; use type S_Expressions.Offset; begin case Spec (Spec'First) is when Character'Pos ('+') => return Path & Spec (Spec'First + 1 .. Spec'Last); when Character'Pos ('-') | Character'Pos ('#') => return S_Expressions.Null_Atom; when others => return Spec; end case; end Key_Path; function Web_Path (Path, Spec : S_Expressions.Atom) return S_Expressions.Atom_Refs.Immutable_Reference is use type S_Expressions.Atom; use type S_Expressions.Offset; begin case Spec (Spec'First) is when Character'Pos ('+') | Character'Pos ('#') => return S_Expressions.Atom_Ref_Constructors.Create (Path & Spec (Spec'First + 1 .. Spec'Last)); when Character'Pos ('-') => return S_Expressions.Atom_Ref_Constructors.Create (Spec (Spec'First + 1 .. Spec'Last)); when others => return S_Expressions.Atom_Ref_Constructors.Create (Spec); end case; end Web_Path; ---------------------- -- Public Interface -- ---------------------- function Create (File : in S_Expressions.Atom) return Sites.Page_Loader'Class is begin return Loader'(File_Path => S_Expressions.Atom_Ref_Constructors.Create (File)); end Create; overriding procedure Load (Object : in out Loader; Builder : in out Sites.Site_Builder; Path : in S_Expressions.Atom) is use type S_Expressions.Events.Event; Reader : Natools.S_Expressions.File_Readers.S_Reader := Natools.S_Expressions.File_Readers.Reader (S_Expressions.To_String (Object.File_Path.Query)); Defaults : Default_Data; Lock : S_Expressions.Lockable.Lock_State; Event : S_Expressions.Events.Event := Reader.Current_Event; begin while Event = S_Expressions.Events.Open_List loop Reader.Lock (Lock); Reader.Next (Event); if Event = S_Expressions.Events.Add_Atom then declare Path_Spec : constant S_Expressions.Atom := Reader.Current_Atom; begin if Path_Spec'Length = 0 then Update (Defaults.Template, Reader); else Build_And_Register (Builder, Reader, Defaults, Path, Path_Spec); end if; end; end if; Reader.Unlock (Lock); Reader.Next (Event); end loop; end Load; end Natools.Web.Simple_Pages.Multipages;
base/mvdm/dos/v86/cmd/edlin/edlmes.asm
npocmaka/Windows-Server-2003
17
87602
PAGE 60,132; title EDLIN Messages ;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ ;======================= START OF SPECIFICATIONS ========================= ; ; MODULE NAME: EDLMES.SAL ; ; DESCRIPTIVE NAME: MESSAGE RETRIEVER INTERFACE MODULE ; ; FUNCTION: THIS MODULE PROVIDES AN INTERFACE FOR THE MODULES THAT ARE ; NEEDED TO INVOKE THE MESSAGE RETRIEVER. ; ; ENTRY POINT: PRINTF ; ; INPUT: OFFSET CARRIED IN DX TO APPLICABLE MESSAGE TABLE ; ; EXIT NORMAL: NO CARRY ; ; EXIT ERROR : CARRY ; ; INTERNAL REFERENCES: ; ; ROUTINE: PRINTF - PROVIDES THE ORIGINAL INTERFACE FOR THE ORIGINAL ; PRINTF USED PRIOR TO VERSION 4.00. PRINTS MESSAGES. ; ; DISP_MESSAGE - BUILDS THE REGISTERS NECESSARY FOR INVOCATION ; OF THE MESSAGE RETRIEVER, BASED ON THE TABLE ; POINTED TO BY DX. ; ; DISP_FATAL - INVOKED IF AN ERROR OCCURS (CARRY) IN THE ; MESSAGE RETRIEVER. IT DISPLAYS THE APPROPRIATE ; MESSAGE. ; ; EXTERNAL REFERENCES: ; ; ROUTINE: SYSLOADMSG - LOAD MESSAGES FOR THE MESSAGE RETRIEVER ; SYSDISPMSG - DISPLAYS THE REQUESTED MESSAGE ; ; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS ; LINK EDLIN+EDLCMD1+EDLCMD2+EDLMES+EDLPARSE ; ; REVISION HISTORY: ; ; AN000 VERSION DOS 4.00 - IMPLEMENTATION OF MESSAGE RETRIEVER ; ; COPYRIGHT: "MS DOS EDLIN UTILITY" ; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" ; "LICENSED MATERIAL - PROPERTY OF Microsoft " ; ; MICROSOFT REVISION HISTORY ; ; MODIFIED BY: <NAME> ; <NAME> ; <NAME> ;======================= END OF SPECIFICATIONS =========================== .xlist include sysmsg.inc ;an000;message retriever msg_utilname <EDLIN> ;an000;EDLIN messages .list ;-----------------------------------------------------------------------; ; ; ; Done for Vers 2.00 (rev 9) by <NAME> ; ; Update for rev. 11 by <NAME> ; ; Printf for 2.5 by <NAME> ; ; ; ;-----------------------------------------------------------------------; ;========================================================================= ; revised edlmes.asm ;========================================================================= fatal_error equ 30 ;an000;fatal message handler unlim_width equ 00h ;an000;unlimited output width pad_blank equ 20h ;an000;blank pad pre_load equ 00h ;an000;normal pre-load message_table struc ;an000;struc for message table entry1 dw 0 ;an000;message number entry2 db 0 ;an000;message type entry3 dw 0 ;an000;display handle entry4 dw 0 ;an000;pointer to sublist entry5 dw 0 ;an000;substitution count entry6 db 0 ;an000;use keyb input? entry7 dw 0 ;an000;keyb buffer to use message_table ends ;an000;end struc ;========================================================================= ; macro disp_message: this macro takes a pointer to a message table ; and displays the applicable message based on ; the table's contents. ; this is to provide an interface into the module ; of the message retriever, SYSDISPMSG. ; ; Date : 6/11/87 ;========================================================================= disp_message macro tbl ;an000;display message macro push bx ;an000; push cx ;an000; push dx ;an000; push di ;an000; push si ;an000; push tbl ;an000;exchange tbl with si pop si ;an000;exchanged mov ax,[si].entry1 ;an000;move message number mov bx,[si].entry3 ;an000;display handle mov cx,[si].entry5 ;an000;number of subs mov dl,[si].entry6 ;an000;function type mov di,[si].entry7 ;an000;input buffer if appl. mov dh,[si].entry2 ;an000;message type mov si,[si].entry4 ;an000;sublist call sysdispmsg ;an000;display the message pop si ;an000;restore affected regs pop di ;an000; pop dx ;an000; pop cx ;an000; pop bx ;an000; endm ;an000;end macro disp_message ;========================================================================= ; macro disp_message: end macro ;========================================================================= CODE SEGMENT PUBLIC BYTE CODE ENDS CONST SEGMENT PUBLIC BYTE CONST ENDS cstack segment stack cstack ends DATA SEGMENT PUBLIC BYTE extrn path_name:byte DATA ENDS DG GROUP CODE,CONST,cstack,DATA code segment public byte ;an000;code segment assume cs:dg,ds:dg,es:dg,ss:CStack ;an000; public printf ;an000;share printf public disp_fatal ;an000;fatal error display public pre_load_message ;an000;message loader .xlist msg_services <MSGDATA> ;an000; .list ;======================= sysmsg.inc invocation =========================== ; ; include sysmsg.inc - message retriever services ; ; ; options selected: ; NEARmsg ; DISPLAYmsg ; LOADmsg ; CHARmsg ; NUMmsg ; CLSAmsg ; CLSBmsg ; CLSCmsg ; ;========================================================================= .xlist msg_services <LOADmsg> ;an000;no version check msg_services <DISPLAYmsg,CHARmsg,NUMmsg,INPUTmsg> ;an000;display messages msg_services <EDLIN.CLA,EDLIN.CLB,EDLIN.CLC> ;an000;message types msg_services <EDLIN.CL1,EDLIN.CL2> ;an000;message types msg_services <EDLIN.CTL> ;an000; .list ;========================================================================= ; printf: printf is a replacement of the printf procedure used in DOS ; releases prior to 4.00. printf invokes the macro disp_message ; to display a message through the new message handler. the ; interface into printf will continue to be a pointer to a message ; passed in DX. the pointer is pointing to more than a message ; now. it is pointing to a table for that message containing ; all relevant information for printing the message. the macro ; disp_message operates on these tables. ; ; Date : 6/11/87 ;========================================================================= printf proc near ;an000;printf procedure disp_message dx ;an000;display a message ; $if c ;an000;if an error occurred JNC $$IF1 call disp_fatal ;an000;display the fatal error ; $endif ;an000; $$IF1: ret ;an000;return to caller printf endp ;an000;end printf proc ;========================================================================= ; disp_fatal: this routine displays a fatal error message in the event ; an error occurred in disp_message. ; ; Date : 6/11/87 ;========================================================================= disp_fatal proc near ;an000;fatal error message mov ax,fatal_error ;an000;fatal_error number mov bx,stdout ;an000;print to console mov cx,0 ;an000;no parameters mov dl,no_input ;an000;no keyboard input mov dh,UTILITY_MSG_CLASS ;an000;utility messages call sysdispmsg ;an000;display fatal error ret ;an000;return to caller disp_fatal endp ;an000;end disp_fatal proc ;========================================================================= ; PRE_LOAD_MESSAGE : This routine provides access to the messages required ; by EDLIN. This routine will report if the load was ; successful. An unsuccessful load will cause EDLIN ; to terminate with an appropriate error message. ; ; Date : 6/11/87 ;========================================================================= PRE_LOAD_MESSAGE proc near ;an000;pre-load messages call SYSLOADMSG ;an000;invoke loader ; $if c ;an000;if an error JNC $$IF3 pushf ;an000;save flags call SYSDISPMSG ;an000;let him say why popf ;an000;restore flags ; $endif ;an000; $$IF3: ret ;an000;return to caller PRE_LOAD_MESSAGE endp ;an000;end proc include msgdcl.inc code ends ;an000;end code segment CONST SEGMENT PUBLIC BYTE extrn arg_buf:byte ;an000; extrn line_num:byte ;an000; extrn line_flag:byte ;an000; extrn Temp_Path:byte ;an000; public baddrv,opt_err_ptr,nobak public simple_msg public msg_too_many,dskful,memful_ptr,badcom public nodir,filenm_ptr,newfil,read_err_ptr public nosuch,toolng,eof,dest public mrgerr,ro_err,bcreat,ndname public dsp_options,dsp_help,num_help_msgs public ask_ptr,qmes_ptr,msg_crlf,msg_lf public prompt public line_num_buf_ptr ;an000;DMS:6/15/87 public arg_buf_ptr ;an000;DMS:6/15/87 public cont_ptr ;an000;DMS:6/18/87 public cp_err ;an000;DMS:6/22/87 public Del_Bak_Ptr ;an000;dms; ;============== REPLACEABLE PARAMETER SUBLIST STRUCTURE ================== ; ; byte 1 - substitution list size, always 11 ; byte 2 - reserved for use by message handler ; byte 3 - pointer to parameter to be used as a substitution ; byte 7 - which parameter is this to replace, %1, %2, etc. ; byte 8 - determines how the parameter is to be output ; byte 9 - determines the maximum width of the parameter string ; byte 10 - determines the minimum width of the parameter string ; byte 11 - define what is to be used as a pad character ; ;========================================================================= ;========================================================================= ; replaceable parameter sublists ;========================================================================= ed_read_sub label dword ;an000;a read error occurred db 11 ;an000;sublist size db 00 ;an000;reserved dd dg:path_name ;an000;pointer to parameter db 01 ;an000;parm 1 db Char_Field_ASCIIZ ;an000;left align/asciiz/char. db unlim_width ;an000;unlimited width db 00 ;an000;minimum width of 0 db pad_blank ;an000;pad with blanks arg_sub label dword ;an000;line output buffer db 11 ;an000;sublist size db 00 ;an000;reserved dd dg:arg_buf ;an000;pointer to parameter db 01 ;an000;parm 1 db Char_Field_ASCIIZ ;an000;left align/asciiz/char. db unlim_width ;an000;unlimited width db 00 ;an000;minimum width of 0 db pad_blank ;an000;pad with blank num_sub label dword ;an000;line number db 11 ;an000;sublist size db 00 ;an000;reserved dd dg:line_num ;an000;pointer to parameter db 01 ;an000;parm 1 db Right_Align+Unsgn_Bin_Word ;an000;right align/decimal db 08 ;an000;maximum width db 08 ;an000;minimum width of 0 db pad_blank ;an000;pad with blank db 11 ;an000;optional flag db 00 ;an000;reserved dd dg:line_flag ;an000;pointer to parameter db 02 ;an000;parm 2 db Char_Field_Char ;an000;character db 01 ;an000;minimum width of 1 db 01 ;an000;maximum width of 1 db pad_blank ;an000;pad with blank BAK_Sub label dword ;an000;line output buffer db 11 ;an000;sublist size db 00 ;an000;reserved dd dg:Temp_Path ;an000;pointer to parameter db 00 ;an000;parm 0 db Char_Field_ASCIIZ ;an000;left align/asciiz/char. db unlim_width ;an000;unlimited width db 00 ;an000;minimum width of 0 db pad_blank ;an000;pad with blank ;========================================================================= ; end replaceable parameter sublists ;========================================================================= ;======================= TABLE STRUCTURE ================================= ; ; bute 1-2 : message number of message to be displayed ; byte 3 : message type to be used, i.e.;class 1, utility, etc. ; byte 4-5 : display handle, i.e.; console, printer, etc. ; byte 6-7 : pointer to substitution list, if any. ; byte 8-9 : number of replaceable parameters, if any. ; byte 10 : type of input from keyboard, if any. ; byte 11-12: pointer to buffer for keyboard input, if any. ; ;========================================================================= ; a bunch of common messages (class=UTILITY_MSG_CLASS, dest=stdout, ; no inputs or sublists) are passed ; through absolute message numbers rather ; than duplicating the data structure for ; each one. prompt = 0006 ; "*" baddrv = 0007 ; "Invalid drive or file name" ndname = 0008 ;"File name must be ;specified",0d,0a,0 ro_err = 0010 ;"File is READ-ONLY",0d,0a,0 bcreat = 0011 ;"File Creation Error",0d,0a,0 msg_too_many = 0012 ;"Too many files open",0d,0a,0 nobak = 0014 ;"Cannot edit .BAK file ;--rename file",0d,0a,0 nodir = 0015 ;"No room in directory ;for file",0d,0d,0 dskful = 0016 ;"Disk full. Edits lost.",0d,0a,0 badcom = 0018 ;"Entry error",0d,0a,0 newfil = 0019 ;"New file",0d,0a,0 nosuch = 0020 ;"Not found",0d,0a,0 toolng = 0022 ;"Line too long",0d,0a,0 eof = 0023 ;"End of input file",0d,0a,0 dest = 0025 ;"Must specify destination ;line number",0d,0a,0 mrgerr = 0026 ;"Not enough room to ;merge the entire file",0d,0a,0 msg_crlf = 0027 ;0d,0a,0 msg_lf = 0028 ;0a,0 cp_err = 0033 ;"Cannot merge - Code page ; mismatch",0d,0a dsp_options = 0300 ; display options dsp_help = 0301 ; display help num_help_msgs = 7 simple_msg label word dw 0000 ; message number (supplied as used) db UTILITY_MSG_CLASS ; utility message dw stdout ; display handle dw 00 ; no sublist dw 00 ; no sub db no_input ; no keyboard input dw 00 ; no keyboard buffer opt_err_ptr label word ;an000;"Invalid parameter",0d,0a,0 dw 0010 ;an000;message number db Parse_Err_Class ;an000;utility message dw StdErr ;an000;display handle dw 00 ;an000;no sublist dw 00 ;an000;no sub db no_input ;an000;no keyboard input dw 00 ;an000;no keyboard buffer read_err_ptr label word ;an000;"Read error in:", ;an000;0d,0a,"%1",0d,0a,0 dw 0013 ;an000;message number db UTILITY_MSG_CLASS ;an000;utility message dw stdout ;an000;display handle dw dg:ed_read_sub ;an000;point to sublist dw 0001 ;an000;1 sub db no_input ;an000;no keyboard input dw 00 ;an000;no keyboard buffer memful_ptr label word ;an000;"Insufficient memory",0d,0a,0 dw 0008 ;an000;message number db Ext_Err_Class ;an000;extended error dw stderr ;an000;display handle dw 00 ;an000;no sublist dw 00 ;an000;no sub db no_input ;an000;no keyboard input dw 00 ;an000;no keyboard buffer filenm_ptr label word ;an000;"File not found",0d,0a dw 0002 ;an000;message number db Ext_Err_Class ;an000;utility message dw stderr ;an000;display handle dw 00 ;an000;no sublist dw 00 ;an000;no sub db no_input ;an000;no keyboard input dw 00 ;an000;no keyboard buffer ask_ptr label word ;an000;"O.K.? ",0 dw 0021 ;an000;message number db UTILITY_MSG_CLASS ;an000;utility message dw stdout ;an000;display handle dw 00 ;an000;no sub dw 00 ; no sublist db DOS_KEYB_INP ;an000;keyboard input - AX dw 00 ;an000;no keyboard buffer qmes_ptr label word ;an000;"Abort edit (Y/N)? ",0 dw 0024 ;an000;message number db UTILITY_MSG_CLASS ;an000;utility message dw stdout ;an000;display handle dw 00 ;an000;no sublist dw 00 ;an000;no sub db DOS_KEYB_INP ;an000;keyboard input - AX dw 00 ;an000;no keyboard buffer cont_ptr label word ;an000;"Continue (Y/N)?" dw 0029 ;an000;message number db UTILITY_MSG_CLASS ;an000;utility message dw stdout ;an000;display handle dw 00 ;an000;no sublist dw 00 ;an000;no sub db DOS_KEYB_INP ;an000;keyboard input dw 00 ;an000;no keyboard buffer arg_buf_ptr label word ;an000;argument buffer for ; line output dw 0031 ;an000;message number db UTILITY_MSG_CLASS ;an000;utility message dw stdout ;an000;display handle dw dg:arg_sub ;an000;argument sublist dw 01 ;an000;1 sub db no_input ;an000;no keyboard input dw 00 ;an000;no keyboard buffer line_num_buf_ptr label word ;an000;holds line numbers dw 0032 ;an000;message number db UTILITY_MSG_CLASS ;an000;utility message dw stdout ;an000;display handle dw dg:num_sub ;an000;argument sublist dw 02 ;an000;2 subs db no_input ;an000;no keyboard input dw 00 ;an000;no keyboard buffer del_bak_ptr label word ;an000;"Access Denied - xxxxxxxx.BAK" dw 0005 ;an000;message number db Ext_Err_Class ;an000;utility message dw stderr ;an000;display handle dw dg:BAK_Sub ;an000;no sublist dw 01 ;an000;no subs db no_input ;an000;no keyboard input dw 00 ;an000;no keyboard buffer CONST ENDS END 
course_content/CSC258/Final Project/frogger.asm
Yorafa/Course-Note
0
164149
<gh_stars>0 ##################################################################### # # CSC258H5S Winter 2022 Assembly Final Project # University of Toronto, St. George # # Student: <NAME>, 10063370928 # # Bitmap Display Configuration: # - Unit width in pixels: 8 # - Unit height in pixels: 8 # - Display width in pixels: 256 # - Display height in pixels: 256 # - Base Address for Display: 0x10008000 ($gp) # # Which milestone is reached in this submission? # (See the assignment handout for descriptions of the milestones) # - Milestone 1/2/3/4/5 (choose the one the applies) # # Which approved additional features have been implemented? # (See the assignment handout for the list of additional features) # 1. Display the number of living remaining # 2. Display a death/respawn animation each time the player loses a frog. # 3. Have objects in different rows move at different speeds. # 4. Add powerups to scene (slowing down time, score booster, extra lives, etc) # 5. Two-player mode (two sets of inputs controlling two frogs at the same time) # # # Any additional information that the TA needs to know: # - (write here, if any) # ##################################################################### # $t0: drawing address # $t1: drawing color # $t2: x # $t3: y # $t4: condition loop i # $t5: condition of i # $t6: lives # $t7: seconds Counter # $t8: others # $t9: extra color .data displayAddress: .word 0x10008000 # Game State isWinning: .word 0 # Player Infor lives: .word 3 scores: .word 0 # color grass: .word 0x00ff00 water: .word 0x0000ff car_c: .word 0xffffff wood_c: .word 0x663300 road_c: .word 0x7a7a7a frog_c: .word 0x000000 frog2_c: .word 0x006600 blood: .word 0xff0000 yellow: .word 0xffff00 # frog frog_x: .word 12 frog_y: .word 28 frog2_x: .word 16 frog2_y: .word 28 # car1 car1_x: .word 0 car1_y: .word 20 # car2 car2_x: .word 10 car2_y: .word 20 # car3 car3_x: .word 0 car3_y: .word 24 # car4 car4_x: .word 16 car4_y: .word 24 # wood1 wood1_x: .word 0 wood1_y: .word 8 # wood2 wood2_x: .word 16 wood2_y: .word 8 # wood3 wood3_x: .word 0 wood3_y: .word 12 # wood4 wood4_x: .word 12 wood4_y: .word 12 # hp hp_item: .word 1 clock_item: .word 1 timing: .word 1000 .text main: lw $t6, lives start: jal update_all livesloop: beq $t6, $0, Exit lw $s7, timing addi $s6, $0, 1000 beq $s6, $s7, normal_time jal sep_mov j livesloop normal_time: jal mov_all jal wait j livesloop j Exit # Help functions update_all: addi $sp, $sp, -4 sw $ra, 0($sp) # push last statement jal grass_draw jal road_draw jal water_draw jal frog_draw jal car_draw jal wood_draw jal draw_hp jal item_hp jal item_clock lw $ra, 0($sp) # pop addi $sp, $sp, 4 jr $ra # updating object obj_right_update: lw $t0, displayAddress addi $t8, $0, 24 beq $t2, $0, else_0_right_update ble $t2, $t8, normal_right_update # if (x >= 31) rm last column and add to head else rm first and add to end j else_right_update else_0_right_update: addi $t2, $0, 32 else_right_update: addi $t2, $t2, -1 # find original start addi $t4, $t2, -24 # find end mul $t2, $t2, 4 # x = x * 4 mul $t4, $t4, 4 # x_2 = x_2 * 4 mul $t3, $t3, 128 # y = y * 128 sub $t2, $t2, $t4 addi $t5, $0, 128 sub $t5, $t5, $t2 add $t0, $t0, $t3 # setup initial drawing add $t0, $t0, $t4 # setup initial drawing sw $t1, 0($t0) add $t0, $t0, $t2 sw $t9, 0($t0) add $t0, $t0, $t5 sw $t1, 0($t0) add $t0, $t0, $t2 sw $t9, 0($t0) add $t0, $t0, $t5 sw $t1, 0($t0) add $t0, $t0, $t2 sw $t9, 0($t0) add $t0, $t0, $t5 sw $t1, 0($t0) add $t0, $t0, $t2 sw $t9, 0($t0) jr $ra normal_right_update: # else begin mul $t3, $t3, 128 # y = y * 128 addi $t2, $t2, -1 mul $t2, $t2, 4 # x = x * 4 add $t0, $t0, $t3 add $t0, $t0, $t2 # setup initial drawing sw $t9, 0($t0) addi $t0, $t0, 32 sw $t1, 0($t0) addi $t0, $t0, 96 sw $t9, 0($t0) addi $t0, $t0, 32 sw $t1, 0($t0) addi $t0, $t0, 96 sw $t9, 0($t0) addi $t0, $t0, 32 sw $t1, 0($t0) addi $t0, $t0, 96 sw $t9, 0($t0) addi $t0, $t0, 32 sw $t1, 0($t0) jr $ra obj_left_update: lw $t0, displayAddress bge $t2, $0, normal_left_update # if (x <= 0) rm last column and add to end els erm last and add to head addi $t4, $t2, 8 # the last column mul $t3, $t3, 128 # y = y * 128 add $t0, $t0, $t3 # setup initial drawing addi $t2, $t2, 32 # to the end mul $t2, $t2, 4 # x = x * 4 mul $t4, $t4, 4 # x_2 = x_2 * 4 add $t8, $0, 128 sub $t8, $t8, $t2 add $t5, $0, $t4 # next line space initialize add $t5, $t5, $t8 # next line space x_2 remain + x sub $t2, $t2, $t4 add $t0, $t0, $t4 # move to last column sw $t9, 0($t0) add $t0, $t0, $t2 sw $t1, 0($t0) add $t0, $t0, $t5 sw $t9, 0($t0) add $t0, $t0, $t2 sw $t1, 0($t0) add $t0, $t0, $t5 sw $t9, 0($t0) add $t0, $t0, $t2 sw $t1, 0($t0) add $t0, $t0, $t5 sw $t9, 0($t0) add $t0, $t0, $t2 sw $t1, 0($t0) jr $ra normal_left_update: # else begin mul $t3, $t3, 128 # y = y * 128 mul $t2, $t2, 4 # x = x * 4 add $t0, $t0, $t3 add $t0, $t0, $t2 # setup initial drawing sw $t1, 0($t0) addi $t0, $t0, 32 sw $t9, 0($t0) addi $t0, $t0, 96 sw $t1, 0($t0) addi $t0, $t0, 32 sw $t9, 0($t0) addi $t0, $t0, 96 sw $t1, 0($t0) addi $t0, $t0, 32 sw $t9, 0($t0) addi $t0, $t0, 96 sw $t1, 0($t0) addi $t0, $t0, 32 sw $t9, 0($t0) jr $ra # updating frog rm_frog: # clean previous frog addi $sp, $sp, -4 sw $ra, 0($sp) rm_1: lw $t2, frog_x lw $t3, frog_y jal rm_c rm_2: lw $t2, frog2_x lw $t3, frog2_y jal rm_c lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra rm_c:# select color by different places lw $t0, displayAddress addi $t4, $0, 20 addi $t5, $0, 24 bne $t3, $t4,rm_frog_road lw $t1, road_c j rm_continue_frog rm_frog_road: bne $t3, $t5,rm_frog_wood1 lw $t1, road_c j rm_continue_frog rm_frog_wood1: addi $t4, $0, 8 addi $t5, $0, 12 bne $t3, $t4, rm_frog_wood2 lw $t1, wood_c j rm_continue_frog rm_frog_wood2: bne $t3, $t5, rm_frog_other lw $t1, wood_c j rm_continue_frog rm_frog_other: lw $t1, grass rm_continue_frog: addi $sp, $sp, -4 sw $ra, 0($sp) mul $t4, $t3, 128 # y = y * 128 calculate the blocks of current mul $t2, $t2, 4 # x = x * 4 calculate position with bytes add $t0, $t0, $t4 # start point_y add $t0, $t0, $t2 # start point_x jal draw_frog_head lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra check_state: # if be collosion with other object # check each object addi $sp, $sp, -4 sw $ra, 0($sp) check_state_1: lw $t2, frog_y lw $t8, frog_x jal check_state_c check_state_2: lw $t2, frog2_y lw $t8, frog2_x jal check_state_c lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra check_state_c: addi $sp, $sp, -4 sw $ra, 0($sp) addi $t4, $0, 24 bne $t2, $t4, check_road1 # check road2 lw $t3, car3_x jal check_right lw $s0, 0($sp) addi $sp, $sp, 4 beq $s0, $0, diediedie lw $t3, car4_x jal check_right lw $s0, 0($sp) addi $sp, $sp, 4 beq $s0, $0, diediedie lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra check_road1: addi $t4, $0, 20 bne $t2, $t4, check_items # check road1 lw $t3, car1_x jal check_right lw $s0, 0($sp) addi $sp, $sp, 4 beq $s0, $0, diediedie lw $t3, car2_x jal check_right lw $s0, 0($sp) addi $sp, $sp, 4 beq $s0, $0, diediedie lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra check_items: addi $t4, $0, 16 bne $t2, $t4, check_wood2 # check road1 addi $t3, $0, 5 bgt $t8, $t3, check_item2 lw $s7, hp_item beq $s7, $0, no_checking addi $t6, $t6, 1 jal draw_hp jal clean_hp_draw sw $0, hp_item lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra check_item2: addi $t3, $0, 28 blt $t8, $t3, no_checking lw $s7, clock_item beq $s7, $0, no_checking lw $s7, timing addi $s7, $s7, 2000 sw $s7, timing jal clean_item_clock sw $0, clock_item lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra check_wood2: addi $t4, $0, 12 bne $t2, $t4, check_wood1 lw $t3, wood3_x jal check_mid_wood lw $s0, 0($sp) addi $sp, $sp, 4 # since may appear on one of 2, we need check both bne $s0, $0, no_checking lw $t3, wood4_x jal check_mid_wood lw $s0, 0($sp) addi $sp, $sp, 4 beq $s0, $0, diediedie lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra check_wood1: addi $t4, $0, 8 bne $t2, $t4, check_win_state lw $t3, wood1_x jal check_mid_wood lw $s0, 0($sp) addi $sp, $sp, 4 bne $s0, $0, no_checking lw $t3, wood2_x jal check_mid_wood lw $s0, 0($sp) addi $sp, $sp, 4 beq $s0, $0, diediedie lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra no_checking: lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra check_right: # preconditnio:frog_y == carn_y $t2 = frog_x $t3 = carn_x addi $s2, $t8, 4 # x1 > y2 or x2 < y1 addi $s3, $t3, 8 addi $s5, $0, 24 bge $t3, $0, obj_right_index_continue # < 0, then + 8 - 31 y2, addi $s3, $t3, 8 addi $t3, $t3, 31 j obj_right_index_continue ble $t3, $s5, obj_right_index_continue # > 24, then + 8 - 31 y2, addi $s3, $t3, -31 obj_right_index_continue: bge $t8, $s3, return_check_right_correct # x1 > y2 ble $s2, $t3, return_check_right_correct # x2 < y1 addi $sp, $sp, -4 sw $0, 0($sp) jr $ra return_check_right_correct: addi $s0, $0, 1 addi $sp, $sp, -4 sw $s0, 0($sp) jr $ra check_mid_wood: # precondition: wood_x <= 24 and wood_x >= 0 # x2 <= y2 and x1 >= y1 addi $s2, $t8, 4 addi $s3, $t3, 8 addi $s5, $0, 24 bge $t8, $t3, check_mid_wood_correct # x1 >= y1 addi $sp, $sp, -4 sw $0, 0($sp) jr $ra check_mid_wood_correct: ble $s2, $s3, return_check_mid_wood_correct # x2 <= y2 addi $sp, $sp, -4 sw $0, 0($sp) jr $ra return_check_mid_wood_correct: addi $s0, $0, 1 addi $sp, $sp, -4 sw $s0, 0($sp) jr $ra check_win_state: addi $s2, $0, 4 # final y bne $s2, $t2, no_checking jal clean jal win_draw jr $ra # check_edge_wood: # frog is either fine in either two parts, but should satisfied 4 conditions # Basically right edge use the same method # 1. first part larger than 4 # then we can check if frog_x + 4 <= $t3 # 2. second part larger than 4 # then we can check if frog_x >= $s3 # sep_left_wood: # precondition: left move wood, and wood_x < 8 # divide the wood into 2 part, use 0, $t3 present first part, and $s3, 31 present second part addi $s3, $t3,1 # sep_right_wood: # precondition: left move wood, and wood_x > 23 # divide the wood into 2 part, use 0, $t3 present first part, and $s3, 31 present second part diediedie: addi $s7, $0, 5 jal die_draw jal die_an jal die_draw_b jal die_an jal die_draw jal die_an jal die_draw_b jal die_an jal die_draw jal die_an jal die_draw_b jal die_an jal die_draw addi $s7, $s7, -1 jal sleep jal reset addi $t6, $t6, -1 j start # Drawing grass_draw: lw $t0, displayAddress lw $t1, grass bg_draw: add $t4, $0, $0 # initilize loop condition 1 to 0 addi $t5, $0, 1024 # initilize loop goal bg_drawr: bne $t4, $t5, bg_drawrn # if t2 != 1024: grass_drawr() position ++; t2++ jr $ra bg_drawrn: sw $t1, 0($t0) addi $t0, $t0, 4 addi $t4, $t4, 1 j bg_drawr road_draw: lw $t0, displayAddress lw $t1, road_c add $t2, $0, $0 # initilize loop condition 1 to 0 addi $t4, $0, 256 # aim times addi $t0, $t0, 2560 # draw_road: beq $t2, $t4, end_road_draw # if t2 != 256: draw_road() position ++; t2++ sw $t1, 0($t0) addi $t0, $t0, 4 addi $t2, $t2, 1 j draw_road end_road_draw: jr $ra water_draw: lw $t0, displayAddress lw $t1, water add $t2, $0, $0 # initilize loop condition 1 to 0 addi $t4, $0, 256 addi $t0, $t0, 1024 draw_water: beq $t2, $t4, end_water_draw # if t2 != 256: draw_water() position ++; t2++ sw $t1, 0($t0) addi $t0, $t0, 4 addi $t2, $t2, 1 j draw_water end_water_draw: jr $ra car_draw: lw $t1, car_c addi $sp, $sp, -4 # push stack sw $ra, 0($sp) car1_draw: lw $t0, displayAddress lw $t2, car1_x lw $t3, car1_y jal draw_obj_initial car2_draw: lw $t0, displayAddress lw $t2, car2_x lw $t3, car2_y jal draw_obj_initial car3_draw: lw $t0, displayAddress lw $t2, car3_x lw $t3, car3_y jal draw_obj_initial car4_draw: lw $t0, displayAddress lw $t2, car4_x lw $t3, car4_y jal draw_obj_initial lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra wood_draw: lw $t1, wood_c addi $sp, $sp, -4 # push stack sw $ra, 0($sp) wood1_draw: lw $t0, displayAddress lw $t2, wood1_x lw $t3, wood1_y jal draw_obj_initial wood2_draw: lw $t0, displayAddress lw $t2, wood2_x lw $t3, wood2_y jal draw_obj_initial wood3_draw: lw $t0, displayAddress lw $t2, wood3_x lw $t3, wood3_y jal draw_obj_initial wood4_draw: lw $t0, displayAddress lw $t2, wood4_x lw $t3, wood4_y jal draw_obj_initial lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra frog_draw: addi $sp, $sp, -4 # push stack sw $ra, 0($sp) frog_1_draw: lw $t2, frog_x lw $t3, frog_y lw $t1, frog_c jal frog_draw_c frog_2_draw: lw $t2, frog2_x lw $t3, frog2_y lw $t1, frog2_c jal frog_draw_c lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra frog_draw_c:lw $t0, displayAddress mul $t4, $t3, 128 # y = y * 128 calculate the blocks of current mul $t2, $t2, 4 # x = x * 4 calculate position with bytes add $t0, $t0, $t4 # start point_y add $t0, $t0, $t2 # start point_x draw_frog_head: sw $t1, 0($t0) addi $t0, $t0, 12 sw $t1, 0($t0) addi $t0, $t0, 116 draw_frog_body: sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 120 draw_frog_bottom: sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 120 draw_frog_foot: sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) jr $ra draw_obj_initial: mul $t3, $t3, 128 # y = y * 128 mul $t2, $t2, 4 # x = x * 4 add $t0, $t0, $t3 add $t0, $t0, $t2 addi $t5, $0, 4 # condition of i add $t4, $0, $0 draw_objl: beq $t4, $t5, end_draw_obj # if t2 != 256: draw_road() position ++; t2++ sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t4, $t4, 1 addi $t0, $t0, 100 j draw_objl end_draw_obj: jr $ra die_draw: lw $t1, blood j die_draw_c die_draw_b:lw $t1, frog_c die_draw_c: lw $t0, displayAddress mul $s4, $t2, 128 # y = y * 128 calculate the blocks of current mul $s7, $t8, 4 # x = x * 4 calculate position with bytes add $t0, $t0, $s4 # start point_y add $t0, $t0, $s7 # start point_x draw_die_head: sw $t1, 0($t0) addi $t0, $t0, 12 sw $t1, 0($t0) addi $t0, $t0, 120 draw_die_body: sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 124 draw_die_bottom: sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 120 draw_die_foot: sw $t1, 0($t0) addi $t0, $t0, 12 sw $t1, 0($t0) jr $ra draw_hp: addi $sp, $sp, -4 sw $ra, 0($sp) addi $s0, $0, 1 addi $t2, $0, 1 addi $t3, $0, 0 addi $s2, $0, 1 loop_hp: blt $t6, $s0, end_draw_hp jal hp_draw addi $s0, $s0, 1 addi $s2, $s2, 6 add $t2, $s2, $0 j loop_hp end_draw_hp: lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra item_hp: addi $sp, $sp, -4 sw $ra, 0($sp) lw $s7, hp_item beq $s7, $0, end_item_hp addi $t2, $0, 1 addi $t3, $0, 16 jal hp_draw end_item_hp:lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra clean_hp_draw: lw $t1, grass addi $t2, $0, 1 addi $t3, $0, 16 j hp_drawing hp_draw: lw $t1, blood hp_drawing: lw $t0, displayAddress mul $t2, $t2, 4 # x = x * 4 calculate position with bytes mul $t3, $t3, 128 add $t0, $t0, $t2 # start point_x add $t0, $t0, $t3 draw_hp_head: sw $t1, 0($t0) addi $t0, $t0, 8 sw $t1, 0($t0) addi $t0, $t0, 116 draw_hp_body: sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 116 draw_hp_bottom: sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 124 draw_hp_foot: sw $t1, 0($t0) jr $ra clean_item_clock: lw $t1, grass lw $t2, grass lw $t3, grass j item_clock_draw item_clock: lw $s7, clock_item beq $s7, $0, end_item_clock lw $t1, yellow lw $t2, frog_c lw $t3, car_c item_clock_draw:lw $t0, displayAddress addi $s3, $0, 16 mul $s3, $s3, 128 add $t0, $t0, $s3 addi $t0, $t0, 112 # first line sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 116 #second line sw $t1, 0($t0) addi $t0, $t0, 4 sw $t2, 0($t0) addi $t0, $t0, 4 sw $t3, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 116 #third line sw $t1, 0($t0) addi $t0, $t0, 4 sw $t3, 0($t0) addi $t0, $t0, 4 sw $t2, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 116 # first line sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) end_item_clock: jr $ra clean: addi $sp, $sp, -4 sw $ra, 0($sp) lw $t0, displayAddress lw $t1, frog_c jal bg_draw lw $ra, 0($sp) addi $sp, $sp, 4 jr $ra win_draw: lw $t0, displayAddress lw $t1, grass # begin draw sw $t1, 0($t0) addi $t0, $t0, 32 sw $t1, 0($t0) addi $t0, $t0, 32 sw $t1, 0($t0) addi $t0, $t0, 8 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 8 sw $t1, 0($t0) addi $t0, $t0, 16 sw $t1, 0($t0) addi $t0, $t0, 28 # second line sw $t1, 0($t0) addi $t0, $t0, 24 sw $t1, 0($t0) addi $t0, $t0, 8 sw $t1, 0($t0) addi $t0, $t0, 24 sw $t1, 0($t0) addi $t0, $t0, 16 sw $t1, 0($t0) addi $t0, $t0, 12 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 12 sw $t1, 0($t0) addi $t0, $t0, 32 # third line sw $t1, 0($t0) addi $t0, $t0, 16 sw $t1, 0($t0) addi $t0, $t0, 16 sw $t1, 0($t0) addi $t0, $t0, 16 sw $t1, 0($t0) addi $t0, $t0, 20 sw $t1, 0($t0) addi $t0, $t0, 12 sw $t1, 0($t0) addi $t0, $t0, 8 sw $t1, 0($t0) addi $t0, $t0, 8 sw $t1, 0($t0) addi $t0, $t0, 36 # fourth line sw $t1, 0($t0) addi $t0, $t0, 8 sw $t1, 0($t0) addi $t0, $t0, 24 sw $t1, 0($t0) addi $t0, $t0, 8 sw $t1, 0($t0) addi $t0, $t0, 24 sw $t1, 0($t0) addi $t0, $t0, 12 sw $t1, 0($t0) addi $t0, $t0, 12 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 40 # fifth line sw $t1, 0($t0) addi $t0, $t0, 32 sw $t1, 0($t0) addi $t0, $t0, 24 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 4 sw $t1, 0($t0) addi $t0, $t0, 8 sw $t1, 0($t0) addi $t0, $t0, 16 sw $t1, 0($t0) jr $ra # Key Action frogMovement: lw $t5, 0xffff0000 # read input beq $t5, 1, Keyboard sw $0, 0xffff0000 # clear input jr $ra Keyboard: addi $sp, $sp, -4 # push stack sw $ra, 0($sp) lw $t4, 0xffff0004 beq $t4, 0x61, key_a beq $t4, 0x77, key_w beq $t4, 0x73, key_s beq $t4, 0x64, key_d beq $t4, 0x6A, key_j beq $t4, 0x6B, key_k beq $t4, 0x6C, key_l beq $t4, 0x69, key_i lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra key_w: lw $t3, frog_y addi $t3, $t3, -4 addi $t4, $0, 4 bge $t3,$t4, w_key jr $ra w_key: sw $t3, frog_y jr $ra key_s: lw $t3, frog_y addi $t3, $t3, 4 addi $t4, $0, 28 ble $t3,$t4, s_key jr $ra s_key: sw $t3, frog_y jr $ra key_a: lw $t2, frog_x addi $t2, $t2, -4 bge $t2, $0, a_key jr $ra a_key: sw $t2, frog_x jr $ra key_d: lw $t2, frog_x addi $t2, $t2, 4 addi $t4, $0, 28 ble $t2, $t4, d_key jr $ra d_key: sw $t2, frog_x jr $ra key_i: lw $t3, frog2_y addi $t3, $t3, -4 addi $t4, $0, 4 bge $t3,$t4, i_key jr $ra i_key: sw $t3, frog2_y jr $ra key_k: lw $t3, frog2_y addi $t3, $t3, 4 addi $t4, $0, 28 ble $t3,$t4, k_key jr $ra k_key: sw $t3, frog2_y jr $ra key_j: lw $t2, frog2_x addi $t2, $t2, -4 bge $t2, $0, j_key jr $ra j_key: sw $t2, frog2_x jr $ra key_l: lw $t2, frog2_x addi $t2, $t2, 4 addi $t4, $0, 28 ble $t2, $t4, l_key jr $ra l_key: sw $t2, frog2_x jr $ra # Moving mov_all: addi $sp, $sp, -4 sw $ra, 0($sp) # push last statement jal rm_frog lw $t1, car_c lw $t9, road_c jal car1_mov jal car2_mov jal car3_mov jal car4_mov jal car3_mov jal car4_mov lw $t9, water lw $t1, wood_c jal wood1_mov jal wood2_mov jal wood1_mov jal wood2_mov jal wood3_mov jal wood4_mov jal frogMovement jal check_state jal frog_draw lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra sep_mov: lw $t7, timing addi $t8, $0, 1000 addi $sp, $sp, -4 sw $ra, 0($sp) # push last statement player_mov_time:ble $t7, $t8, obj_mov_time jal rm_frog jal frogMovement jal check_state jal frog_draw jal wait addi $t7, $t7, -1000 j player_mov_time obj_mov_time: jal rm_frog lw $t1, car_c lw $t9, road_c jal car1_mov jal car2_mov jal car3_mov jal car4_mov jal car3_mov jal car4_mov lw $t9, water lw $t1, wood_c jal wood1_mov jal wood2_mov jal wood1_mov jal wood2_mov jal wood3_mov jal wood4_mov jal frogMovement jal check_state jal frog_draw lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra car1_mov: addi $sp, $sp, -4 sw $ra, 0($sp) # push last statement lw $t2, car1_x lw $t3, car1_y addi $t4, $0, -8 addi $t2, $t2, -1 blt $t2, $t4, else_car1_mov sw $t2, car1_x jal obj_left_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra else_car1_mov: addi $t2, $0, 23 sw $t2, car1_x jal obj_left_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra car2_mov: addi $sp, $sp, -4 sw $ra, 0($sp) # push last statement lw $t2, car2_x lw $t3, car2_y addi $t4, $0, -8 addi $t2, $t2, -1 blt $t2, $t4, else_car2_mov sw $t2, car2_x jal obj_left_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra else_car2_mov: addi $t2, $0, 23 sw $t2, car2_x jal obj_left_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra car3_mov: addi $sp, $sp, -4 sw $ra, 0($sp) # push last statement lw $t2, car3_x lw $t3, car3_y addi $t4, $0, 31 addi $t2, $t2, 1 bgt $t2, $t4, else_car3_mov sw $t2, car3_x jal obj_right_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra else_car3_mov: addi $t2, $0, 0 sw $t2, car3_x jal obj_right_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra car4_mov: addi $sp, $sp, -4 sw $ra, 0($sp) # push last statement lw $t2, car4_x lw $t3, car4_y addi $t4, $0, 31 addi $t2, $t2, 1 bgt $t2, $t4, else_car4_mov sw $t2, car4_x jal obj_right_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra else_car4_mov: addi $t2, $0, 0 sw $t2, car4_x jal obj_right_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra wood1_mov: addi $sp, $sp, -4 sw $ra, 0($sp) # push last statement lw $t2, wood1_x lw $t3, wood1_y addi $t4, $0, -8 addi $t2, $t2, -1 blt $t2, $t4, else_wood1_mov sw $t2, wood1_x jal obj_left_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra else_wood1_mov: addi $t2, $0, 23 sw $t2, wood1_x jal obj_left_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra wood2_mov: addi $sp, $sp, -4 sw $ra, 0($sp) # push last statement lw $t2, wood2_x lw $t3, wood2_y addi $t4, $0, -8 addi $t2, $t2, -1 blt $t2, $t4, else_wood2_mov sw $t2, wood2_x jal obj_left_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra else_wood2_mov: addi $t2, $0, 23 sw $t2, wood2_x jal obj_left_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra wood3_mov: addi $sp, $sp, -4 sw $ra, 0($sp) # push last statement lw $t2, wood3_x lw $t3, wood3_y addi $t4, $0, 31 addi $t2, $t2, 1 bgt $t2, $t4, else_wood3_mov sw $t2, wood3_x jal obj_right_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra else_wood3_mov: addi $t2, $0, 0 sw $t2, wood3_x jal obj_right_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra wood4_mov: addi $sp, $sp, -4 sw $ra, 0($sp) # push last statement lw $t2, wood4_x lw $t3, wood4_y addi $t4, $0, 31 addi $t2, $t2, 1 bgt $t2, $t4, else_wood4_mov sw $t2, wood4_x jal obj_right_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra else_wood4_mov: addi $t2, $0, 0 sw $t2, wood4_x jal obj_right_update lw $ra, 0($sp) # stack call back addi $sp, $sp, 4 jr $ra # System call reset: sw $0 scores sw $0, 0xffff0000 # clear input addi $s7, $0, 12 # frog sw $s7, frog_x addi $s7, $s7, 4 sw $s7, frog2_x addi $s6, $0, 28 sw $s6, frog_y sw $s6, frog2_y # car1 sw $0, car1_x addi $s6, $s6, -8 sw $s6, car1_y # car2 addi $s5, $0, 10 sw $s5, car2_x sw $s6, car2_y # car3 sw $0, car3_x addi $s6, $s6, 4 sw $s6, car3_y # car4 addi $s5, $s5, 6 sw $s5, car4_x sw $s6, car4_y # wood1 sw $0, wood1_x addi $s6, $s6, -16 sw $s6, wood1_y # wood2 sw $s5, wood2_x sw $s6, wood2_y # wood3 addi $s7, $0, 12 sw $0, wood3_x sw $s7, wood3_y # wood4 sw $s7, wood4_x sw $s7, wood4_y addi $s7, $0, 1000 sw $s7, timing #addi $s7, $0, 1 #sw $s7, hp_item #sw $s7, clock_item jr $ra die_an: li $v0, 32 li $a0, 200 syscall jr $ra wait: # wait 1 sec li $v0, 32 li $a0, 1000 syscall jr $ra sleep: li $v0, 32 li $a0, 5000 syscall jr $ra Exit: li $v0, 10 # terminate the program gracefully syscall
src/ships-crew.ads
thindil/steamsky
80
11450
<gh_stars>10-100 -- Copyright 2017-2021 <NAME> -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. -- ****h* Ships/SCrew -- FUNCTION -- Provides code for manipulate ships crews -- SOURCE package Ships.Crew is -- **** -- ****f* SCrew/SCrew.GetSkillLevel -- FUNCTION -- Get level of skill of selected crew member -- PARAMETERS -- Member - Crew member which skill will be looking for -- SkillIndex - Index of skill in skills list -- RESULT -- Real level of selected skill of selected crew member -- SOURCE function GetSkillLevel (Member: Member_Data; SkillIndex: Skills_Amount_Range) return Skill_Range with Pre => SkillIndex in 1 .. Skills_Amount, Test_Case => (Name => "Test_GetSkillLevel", Mode => Nominal); -- **** -- ****f* SCrew/SCrew.Death -- FUNCTION -- Handle crew member death -- PARAMETERS -- MemberIndex - Crew index of the member which died -- Reason - Reason of the death -- Ship - Ship in which crew member died -- CreateBody - If true, create body for dead crew member. Default is -- true -- RESULT -- Parameter Ship with updated data (crew, cargo, modules) -- SOURCE procedure Death (MemberIndex: Crew_Container.Extended_Index; Reason: Unbounded_String; Ship: in out Ship_Record; CreateBody: Boolean := True) with Pre => (MemberIndex in Ship.Crew.First_Index .. Ship.Crew.Last_Index and Reason /= Null_Unbounded_String), Test_Case => (Name => "Test_Death", Mode => Nominal); -- **** -- ****f* SCrew/SCrew.DeleteMember -- FUNCTION -- Delete selected member from crew list -- PARAMETERS -- MemberIndex - Crew index of the member which will be deleted -- Ship - Ship which crew will be modified -- RESULT -- Parameter Ship with modified data (crew and modules) -- SOURCE procedure DeleteMember (MemberIndex: Crew_Container.Extended_Index; Ship: in out Ship_Record) with Pre => MemberIndex in Ship.Crew.First_Index .. Ship.Crew.Last_Index, Test_Case => (Name => "Test_DeleteMember", Mode => Nominal); -- **** -- ****f* SCrew/SCrew.FindMember -- FUNCTION -- Find index of first crew member with selected order -- PARAMETERS -- Order - Current crew order which will be looking for -- Crew - Crew of ship which will be searched -- RESULT -- Crew index of crew member with selected order or 0 if nothing was found -- SOURCE function FindMember (Order: Crew_Orders; Crew: Crew_Container.Vector := Player_Ship.Crew) return Crew_Container.Extended_Index with Post => FindMember'Result <= Crew.Last_Index, Test_Case => (Name => "Test_FindMember", Mode => Nominal); -- **** -- ****f* SCrew/SCrew.GiveOrders -- FUNCTION -- Change order for selected crew member -- PARAMETERS -- Ship - Ship in which crew member will be have changed order -- MemberIndex - Crew index of member to change order -- GivenOrder - New order for selected crew member -- ModuleIndex - Index of module to assign to crew member with new -- order. Default is 0 - no module assigned -- CheckPriorities - If true, check orders priorities of whole crew. -- Default is true -- Result -- Parameter Ship with modified data (crew, modules, cargo) -- SOURCE procedure GiveOrders (Ship: in out Ship_Record; MemberIndex: Crew_Container.Extended_Index; GivenOrder: Crew_Orders; ModuleIndex: Modules_Container.Extended_Index := 0; CheckPriorities: Boolean := True) with Pre => (MemberIndex in Ship.Crew.First_Index .. Ship.Crew.Last_Index and ModuleIndex <= Ship.Modules.Last_Index), Test_Case => (Name => "Test_GiveOrders", Mode => Nominal); -- **** -- ****f* SCrew/SCrew.UpdateOrders -- FUNCTION -- Update crew orders based on their orders priorities -- PARAMETERS -- Ship - Ship in which crew will be check -- Combat - If true, ship is in combat. Default is false -- RESULT -- Parameter Ship with modified data (crew, modules, cargo) -- SOURCE procedure UpdateOrders (Ship: in out Ship_Record; Combat: Boolean := False) with Test_Case => (Name => "Test_UpdateOrders", Mode => Robustness); -- **** -- ****f* SCrew/SCrew.UpdateMorale -- FUNCTION -- Update morale of selected crew member by value -- PARAMETERS -- Ship - Ship on which crew member will be have updated morale -- MemberIndex - Crew index of member to update morale -- Value - Amount of morale to add or substract -- RESULT -- Parameter Ship with modified crew info -- SOURCE procedure UpdateMorale (Ship: in out Ship_Record; MemberIndex: Crew_Container.Extended_Index; Value: Integer) with Pre => MemberIndex in Ship.Crew.First_Index .. Ship.Crew.Last_Index, Test_Case => (Name => "Test_UpdateMorale", Mode => Nominal); -- **** end Ships.Crew;
programs/oeis/282/A282600.asm
jmorken/loda
1
573
<reponame>jmorken/loda<filename>programs/oeis/282/A282600.asm ; A282600: a(n) = Sum_(k=1..phi(n)) floor(d_k/2) where d_k are the totatives of n. ; 0,0,1,1,4,2,9,6,12,8,25,10,36,18,28,28,64,24,81,36,60,50,121,44,120,72,117,78,196,56,225,120,160,128,204,102,324,162,228,152,400,120,441,210,264,242,529,184,504,240,400,300,676,234,540,324,504,392,841,232,900,450,558,496,768,320,1089,528,748,408,1225,420,1296,648,740,666,1140,456,1521,624,1080,800,1681,492,1344,882,1204,860,1936,528,1620,990,1380,1058,1692,752,2304,1008,1470,980,2500,800,2601,1224,1248,1352,2809,954,2916,1080,1980,1320,3136,1008,2508,1596,2088,1682,2832,944,3300,1800,2440,1830,3100,1116,3969,2016,2688,1536,4225,1300,3564,2178,2412,2144,4624,1496,4761,1656,3220,2450,4260,1704,4032,2592,3066,2628,5476,1480,5625,2700,3648,2280,4620,1848,6084,3042,4108,2528,5280,2160,6561,3240,3280,3362,6889,1992,6552,2688,4590,3570,7396,2408,5220,3480,5104,3872,7921,2136,8100,3240,5460,4004,6624,2760,7440,4278,5076,3384,9025,3040,9216,4608,4656,4074,9604,2940,9801,3960,6600,5000,8484,3232,8160,5202,6798,4944,9360,2496,11025,5460,7420,5618,8988,3852,9720,5832,7848,4360,10560,3960,12321,5328,6720,6272,12769,4068,12996,5016,6900,6440,13456,4176,10764,6786,9204,5664,14161,3808,14400,6600,9801,7260,10248,4880,13284,7380,10168,6200 mov $1,4 mov $2,$0 div $2,2 cal $0,10 ; Euler totient function phi(n): count numbers <= n and prime to n. mul $2,$0 add $1,$2 sub $1,4 div $1,2
edk2/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimerSupport.asm
awwiniot/Aw1689UEFI
21
12620
<gh_stars>10-100 //------------------------------------------------------------------------------ // // Copyright (c) 2011, ARM Limited. All rights reserved. // // This program and the accompanying materials // are licensed and made available under the terms and conditions of the BSD License // which accompanies this distribution. The full text of the license may be found at // http://opensource.org/licenses/bsd-license.php // // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // //------------------------------------------------------------------------------ EXPORT ArmReadCntFrq EXPORT ArmWriteCntFrq EXPORT ArmReadCntPct EXPORT ArmReadCntkCtl EXPORT ArmWriteCntkCtl EXPORT ArmReadCntpTval EXPORT ArmWriteCntpTval EXPORT ArmReadCntpCtl EXPORT ArmWriteCntpCtl EXPORT ArmReadCntvTval EXPORT ArmWriteCntvTval EXPORT ArmReadCntvCtl EXPORT ArmWriteCntvCtl EXPORT ArmReadCntvCt EXPORT ArmReadCntpCval EXPORT ArmWriteCntpCval EXPORT ArmReadCntvCval EXPORT ArmWriteCntvCval EXPORT ArmReadCntvOff EXPORT ArmWriteCntvOff AREA ArmV7ArchTimerSupport, CODE, READONLY PRESERVE8 ArmReadCntFrq mrc p15, 0, r0, c14, c0, 0 ; Read CNTFRQ bx lr ArmWriteCntFrq mcr p15, 0, r0, c14, c0, 0 ; Write to CNTFRQ bx lr ArmReadCntPct mrrc p15, 0, r0, r1, c14 ; Read CNTPT (Physical counter register) bx lr ArmReadCntkCtl mrc p15, 0, r0, c14, c1, 0 ; Read CNTK_CTL (Timer PL1 Control Register) bx lr ArmWriteCntkCtl mcr p15, 0, r0, c14, c1, 0 ; Write to CNTK_CTL (Timer PL1 Control Register) bx lr ArmReadCntpTval mrc p15, 0, r0, c14, c2, 0 ; Read CNTP_TVAL (PL1 physical timer value register) bx lr ArmWriteCntpTval mcr p15, 0, r0, c14, c2, 0 ; Write to CNTP_TVAL (PL1 physical timer value register) bx lr ArmReadCntpCtl mrc p15, 0, r0, c14, c2, 1 ; Read CNTP_CTL (PL1 Physical Timer Control Register) bx lr ArmWriteCntpCtl mcr p15, 0, r0, c14, c2, 1 ; Write to CNTP_CTL (PL1 Physical Timer Control Register) bx lr ArmReadCntvTval mrc p15, 0, r0, c14, c3, 0 ; Read CNTV_TVAL (Virtual Timer Value register) bx lr ArmWriteCntvTval mcr p15, 0, r0, c14, c3, 0 ; Write to CNTV_TVAL (Virtual Timer Value register) bx lr ArmReadCntvCtl mrc p15, 0, r0, c14, c3, 1 ; Read CNTV_CTL (Virtual Timer Control Register) bx lr ArmWriteCntvCtl mcr p15, 0, r0, c14, c3, 1 ; Write to CNTV_CTL (Virtual Timer Control Register) bx lr ArmReadCntvCt mrrc p15, 1, r0, r1, c14 ; Read CNTVCT (Virtual Count Register) bx lr ArmReadCntpCval mrrc p15, 2, r0, r1, c14 ; Read CNTP_CTVAL (Physical Timer Compare Value Register) bx lr ArmWriteCntpCval mcrr p15, 2, r0, r1, c14 ; Write to CNTP_CTVAL (Physical Timer Compare Value Register) bx lr ArmReadCntvCval mrrc p15, 3, r0, r1, c14 ; Read CNTV_CTVAL (Virtual Timer Compare Value Register) bx lr ArmWriteCntvCval mcrr p15, 3, r0, r1, c14 ; write to CNTV_CTVAL (Virtual Timer Compare Value Register) bx lr ArmReadCntvOff mrrc p15, 4, r0, r1, c14 ; Read CNTVOFF (virtual Offset register) bx lr ArmWriteCntvOff mcrr p15, 4, r0, r1, c14 ; Write to CNTVOFF (Virtual Offset register) bx lr END
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1167.asm
ljhsiun2/medusa
9
173911
<filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1167.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r14 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0x139fc, %r14 nop nop cmp $40730, %r11 mov $0x6162636465666768, %rbx movq %rbx, %xmm6 vmovups %ymm6, (%r14) nop add %rdi, %rdi lea addresses_WT_ht+0x18bb4, %r15 nop nop nop inc %rsi movb $0x61, (%r15) nop nop nop nop lfence lea addresses_D_ht+0x193d4, %rsi lea addresses_D_ht+0x1eab4, %rdi nop nop nop add $50524, %rbx mov $7, %rcx rep movsl nop nop nop nop nop sub %r15, %r15 lea addresses_A_ht+0x1bc0, %rsi nop nop nop sub %r10, %r10 mov $0x6162636465666768, %rcx movq %rcx, %xmm2 and $0xffffffffffffffc0, %rsi movntdq %xmm2, (%rsi) nop nop nop and %r10, %r10 lea addresses_WC_ht+0xff34, %r11 sub $47065, %r14 mov $0x6162636465666768, %rcx movq %rcx, %xmm7 movups %xmm7, (%r11) nop nop nop nop and $24024, %rdi lea addresses_WT_ht+0x564c, %r15 nop nop nop nop nop add %rsi, %rsi mov $0x6162636465666768, %rbx movq %rbx, %xmm2 vmovups %ymm2, (%r15) nop nop nop cmp $32201, %r14 lea addresses_WC_ht+0x17c4, %r10 nop cmp $4562, %r11 mov (%r10), %rdi nop xor $27444, %rdi lea addresses_UC_ht+0xd234, %rsi cmp %r15, %r15 movups (%rsi), %xmm6 vpextrq $1, %xmm6, %rdi xor $4773, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r9 push %rbp push %rbx push %rdi push %rdx // Load lea addresses_RW+0x108b4, %r9 and $23535, %rbp mov (%r9), %ebx nop nop nop add $36826, %r12 // Faulty Load lea addresses_normal+0x58b4, %rbx nop sub %rdx, %rdx mov (%rbx), %r9 lea oracles, %rbp and $0xff, %r9 shlq $12, %r9 mov (%rbp,%r9,1), %r9 pop %rdx pop %rdi pop %rbx pop %rbp pop %r9 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
FormalAnalyzer/models/apps/ModeButton.als
Mohannadcse/IoTCOM_BehavioralRuleExtractor
0
3654
module app_ModeButton open IoTBottomUp as base open cap_location open cap_switch open cap_button one sig app_ModeButton extends IoTApp { heldSwitchOn : some cap_switch, switchOff : some cap_switch, heldSwitchOff : some cap_switch, state : one cap_state, button : one cap_button, location : one cap_location, newMode : one cap_location_attr_mode_val, switchOn : some cap_switch, } { rules = r } one sig cap_state extends Capability {} { attributes = cap_state_attr } abstract sig cap_state_attr extends Attribute {} one sig cap_state_attr_mode extends cap_state_attr {} { values = cap_state_attr_mode_val } abstract sig cap_state_attr_mode_val extends AttrValue {} one sig cap_state_attr_mode_val_heldMode extends cap_state_attr_mode_val {} one sig cap_state_attr_mode_val_pushMode extends cap_state_attr_mode_val {} one sig cap_location_attr_mode_val_newMode extends cap_location_attr_mode_val {}{} // application rules base class abstract sig r extends Rule {} one sig r0 extends r {}{ triggers = r0_trig conditions = r0_cond commands = r0_comm } abstract sig r0_trig extends Trigger {} one sig r0_trig0 extends r0_trig {} { capabilities = app_ModeButton.button attribute = cap_button_attr_button value = cap_button_attr_button_val_pushed } abstract sig r0_cond extends Condition {} one sig r0_cond0 extends r0_cond {} { capabilities = app_ModeButton.switchOn attribute = cap_switch_attr_switch no value //= cap_switch_attr_switch_on } /* one sig r0_cond1 extends r0_cond {} { capabilities = app_ModeButton.button attribute = cap_button_attr_pushed value = cap_button_attr_pushed_val } */ abstract sig r0_comm extends Command {} one sig r0_comm0 extends r0_comm {} { capability = app_ModeButton.switchOn attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on } one sig r1 extends r {}{ triggers = r1_trig conditions = r1_cond commands = r1_comm } abstract sig r1_trig extends Trigger {} one sig r1_trig0 extends r1_trig {} { capabilities = app_ModeButton.button attribute = cap_button_attr_button value = cap_button_attr_button_val_held } abstract sig r1_cond extends Condition {} one sig r1_cond0 extends r1_cond {} { capabilities = app_ModeButton.heldSwitchOn attribute = cap_switch_attr_switch no value //= cap_switch_attr_any_val } abstract sig r1_comm extends Command {} one sig r1_comm0 extends r1_comm {} { capability = app_ModeButton.heldSwitchOn attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on } one sig r2 extends r {}{ triggers = r2_trig conditions = r2_cond commands = r2_comm } abstract sig r2_trig extends Trigger {} one sig r2_trig0 extends r2_trig {} { capabilities = app_ModeButton.button attribute = cap_button_attr_button value = cap_button_attr_button_val_held } abstract sig r2_cond extends Condition {} one sig r2_cond1 extends r2_cond {} { capabilities = app_ModeButton.location attribute = cap_location_attr_mode value = cap_location_attr_mode_val - app_ModeButton.newMode } abstract sig r2_comm extends Command {} one sig r2_comm0 extends r2_comm {} { capability = app_ModeButton.location attribute = cap_location_attr_mode value = app_ModeButton.newMode } one sig r3 extends r {}{ triggers = r3_trig conditions = r3_cond commands = r3_comm } abstract sig r3_trig extends Trigger {} one sig r3_trig0 extends r3_trig {} { capabilities = app_ModeButton.button attribute = cap_button_attr_button value = cap_button_attr_button_val_pushed } abstract sig r3_cond extends Condition {} one sig r3_cond2 extends r3_cond {} { capabilities = app_ModeButton.switchOff attribute = cap_switch_attr_switch no value //= cap_switch_attr_any_val } abstract sig r3_comm extends Command {} one sig r3_comm0 extends r3_comm {} { capability = app_ModeButton.switchOff attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_off } one sig r4 extends r {}{ triggers = r4_trig conditions = r4_cond commands = r4_comm } abstract sig r4_trig extends Trigger {} one sig r4_trig0 extends r4_trig {} { capabilities = app_ModeButton.button attribute = cap_button_attr_button value = cap_button_attr_button_val_held } abstract sig r4_cond extends Condition {} one sig r4_cond2 extends r4_cond {} { capabilities = app_ModeButton.heldSwitchOff attribute = cap_switch_attr_switch no value //= cap_switch_attr_any_val } abstract sig r4_comm extends Command {} one sig r4_comm0 extends r4_comm {} { capability = app_ModeButton.heldSwitchOff attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_off } one sig r5 extends r {}{ triggers = r5_trig conditions = r5_cond commands = r5_comm } abstract sig r5_trig extends Trigger {} one sig r5_trig0 extends r5_trig {} { capabilities = app_ModeButton.button attribute = cap_button_attr_button value = cap_button_attr_button_val_pushed } abstract sig r5_cond extends Condition {} one sig r5_cond1 extends r5_cond {} { capabilities = app_ModeButton.location attribute = cap_location_attr_mode value = cap_location_attr_mode_val - app_ModeButton.newMode } abstract sig r5_comm extends Command {} one sig r5_comm0 extends r5_comm {} { capability = app_ModeButton.location attribute = cap_location_attr_mode value = app_ModeButton.newMode //cap_location_attr_mode_val_newMode }
Week_7/17 - Week7_cmp.asm
iamruveyda/KBU-Mikro
1
95009
.model small .data .code main proc mov ax,1000H mov bx,1000H cmp ax,bx endp end main
programs/oeis/062/A062970.asm
neoneye/loda
22
104030
<reponame>neoneye/loda ; A062970: a(n) = 1 + Sum_{j=1..n} j^j. ; 1,2,6,33,289,3414,50070,873613,17650829,405071318,10405071318,295716741929,9211817190185,312086923782438,11424093749340454,449317984130199829,18896062057839751445,846136323944176515622,40192544399240714091046,2018612200059554303215025,106876212200059554303215025,5949463230586042075684339446,347377340594805599472331063030,21227845340442717633827363973597,1354963622190726842082908836817373,90172805592203250075973442284082998 lpb $0 mov $2,$0 sub $0,1 pow $2,$2 add $1,$2 lpe add $1,1 mov $0,$1
src/modules/tapemod.asm
freem/nesmon
2
244693
;==============================================================================; ; nesmon/src/modules/tape.asm ; Cassette tape routines ;==============================================================================; ; This is entirely optional, though recommended if you have no other way of ; getting data out of the NES/Famicom. ; (Family BASIC Keyboard) ; The tape recorder is connected to the Family BASIC Keyboard using two mono ; phone jack cables (1/8 inches, 3.5mm), one for saving data, and one for ; loading data. ; (Front-Loading NES) ; Though not officially supported, a tape recorder can be used with the ; following schematic: http://nesdev.com/tapedrv.PNG ; Top loaders lack the required expansion port, as far as I remember. ;==============================================================================; ; Routine naming: tape_* ; Required routines: ; * tape_Load ; * tape_Save ;==============================================================================; ;==============================================================================; tape_Load: rts ;==============================================================================; tape_Save: rts
lib/am335x_sdk/ti/drv/usb/example/common/usb_arm_r5.asm
brandonbraun653/Apollo
2
164560
;****************************************************************************** ; @file usb_arm_r5.asm ; ; @brief ; Implementation file for the ARM R5 module CSL-FL. ; ; Contains the different control command and status query functions definitions ; ; \par ; ============================================================================ ; @n (C) Copyright 2018, Texas Instruments, Inc. ; ; 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 Texas Instruments Incorporated 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. ;****************************************************************************** .text ; Below code is for custom MPU configuration - this configuration varies from usecase to usecase mpu_region_0_base .word 0x00000000 ;The MPU Region Base Address Register mpu_region_0_size .word (0x0<<8) | (0x1F<<1) | 0x1 ;Region Size and Enable bits (and Subre region enable ) mpu_region_0_permissions .word (1 << 12) | (3 << 8) | (2 << 3) | (0 << 2) | (0 << 0);The MPU Region Access Control ;/* MPU region 1 is the created for the 2GB DDR address space starting with 0x80M to 0xA0M ; * * ; * attributes: xn = 0 (bit 12) - execution permitted ; * ap = 3 (bits 10:8) - read/write full access, 3=> full access privilege and user ; * tex = 1 (bits 5:3) - Normal 7=> cacheable, write back, no write allocate ; * S = 0 (bit 2) - non-shared 0=> marking non-shared to enable cache, ; * CB = 0 (bits 1:0) - Noncache 3=>write back, no write allocate cache ; */ mpu_region_1_base .word 0x80000000 ;The MPU Region Base Address Register mpu_region_1_size .word (0x0<<8) | (0x1E<<1) | 0x1 ;Region Size and Enable bits (and Subre region enable ) mpu_region_1_permissions .word (0 << 12) | (3 << 8) | (1 << 3) | (0 << 2) | (0 << 0);The MPU Region Access Control mpu_region_2_base .word 0x41C00000 ;The MPU Region Base Address Register mpu_region_2_size .word (0x0<<8) | (0x12<<1) | 0x1 ;Region Size and Enable bits (and Subre region enable ) mpu_region_2_permissions .word (0 << 12) | (3 << 8) | (1 << 3) | (0 << 2) | (3 << 0);The MPU Region Access Control mpu_region_3_base .word 0x70000000 ;The MPU Region Base Address Register mpu_region_3_size .word (0x0<<8) | (0x14<<1) | 0x1 ;Region Size and Enable bits (and Subre region enable ) mpu_region_3_permissions .word (0 << 12) | (3 << 8) | (1 << 3) | (0 << 2) | (3 << 0);The MPU Region Access Control mpu_region_4_base .word 0x00000000 ;The MPU Region Base Address Register mpu_region_4_size .word (0x0<<8) | (0xE<<1) | 0x1 ;Region Size and Enable bits (and Subre region enable ) mpu_region_4_permissions .word (0 << 12) | (3 << 8) | (4 << 3) | (0 << 2) | (0 << 0);The MPU Region Access Control mpu_region_5_base .word 0x41010000 ;The MPU Region Base Address Register mpu_region_5_size .word (0x0<<8) | (0xE<<1) | 0x1 ;Region Size and Enable bits (and Subre region enable ) mpu_region_5_permissions .word (0 << 12) | (3 << 8) | (4 << 3) | (0 << 2) | (0 << 0);The MPU Region Access Control ; make a 56K@0x701E2000 MSMC uncached memory mpu_region_6_base .word 0x701E0000 ;The MPU Region Base Address Register mpu_region_6_size .word (0x80<<8) | (0x0F<<1) | 0x1 ; disable subregion 7 (masking out 0x2000 bytes) ; 64KB region size (0x0F). ; Enable bits mpu_region_6_permissions .word (0 << 12) | (3 << 8) | (4 << 3) | (1 << 2) | (0 << 0);The MPU Region Access Control. non cache ;============================================================================== ; void USB_armR5EnableMPUandCache( void ) ;============================================================================== .global USB_armR5EnableMPUandCache USB_armR5EnableMPUandCache: ; below wont work ; MRS r0, cpsr ; MOV r1, r0 ;preserve current mode in r1 ; BIC r0, r0, #0x1F ; CLEAR MODES ; ORR r0, r0, #0x13 ; SET USER MODE ; MSR cpsr_cf, r0 ; Disable MPU first mrc p15, #0, r0, c1, c0, #0 ; Read SCTLR bic r0 , r0 , #1 ; clear MPU enable bit mcr p15, #0, r0, c1, c0, #0 ; Write SCTLR mov r2, #0 mov r3, #0 mov r4, #0 ;Set Region 15 mov r0, #15 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 14 mov r0, #14 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 13 mov r0, #13 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 12 mov r0, #12 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 11 mov r0, #11 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 10 mov r0, #10 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 9 mov r0, #9 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 8 mov r0, #8 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 7 mov r0, #7 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 6 ldr r2, mpu_region_6_base ldr r3, mpu_region_6_size ldr r4, mpu_region_6_permissions mov r0, #6 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 5 ldr r2, mpu_region_5_base ldr r3, mpu_region_5_size ldr r4, mpu_region_5_permissions mov r0, #5 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 4 ldr r2, mpu_region_4_base ldr r3, mpu_region_4_size ldr r4, mpu_region_4_permissions mov r0, #4 mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 2 ldr r2, mpu_region_2_base ldr r3, mpu_region_2_size ldr r4, mpu_region_2_permissions mov r0, #2 ;Region NUmber mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 3 ldr r2, mpu_region_3_base ldr r3, mpu_region_3_size ldr r4, mpu_region_3_permissions mov r0, #3 ;Region NUmber mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 1 ldr r2, mpu_region_1_base ldr r3, mpu_region_1_size ldr r4, mpu_region_1_permissions mov r0, #1 ;Region NUmber mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control ;Set Region 0 ldr r2, mpu_region_0_base ldr r3, mpu_region_0_size ldr r4, mpu_region_0_permissions mov r0, #0 ;Region NUmber mcr p15, #0, r0, c6, c2, #0 ;Write MPU region number register mcr p15, #0, r2, c6, c1, #0 ;The MPU Region Base Address Register mcr p15, #0, r3, c6, c1, #2 ;The MPU Region Size and Enable bits (and Subre region enable ) mcr p15, #0, r4, c6, c1, #4 ;The MPU Region Access Control mrc p15, #0, r0, c1, c0, #0 ; Read SCTLR orr r0 , r0 , #1 ; Enable MPU enable bit mcr p15, #0, r0, c1, c0, #0 ; Write SCTLR ;*------------------------------------------------------ ;* Switch back to the previous mode, R1 expected to be preserved throughput this func ;*------------------------------------------------------ nop nop nop BX lr .end
kernel/regs.asm
iocoder/upcr
0
17673
<filename>kernel/regs.asm ;############################################################################### ;# FILE NAME: KERNEL/REGS.ASM ;# DESCRIPTION: DUMP CPU REGISTERS ;# AUTHOR: <NAME>. ;############################################################################### ;# ;# UPCR OPERATING SYSTEM FOR X86_64 ARCHITECTURE ;# COPYRIGHT (C) 2021 <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. ;# ;############################################################################### ;############################################################################### ;# INCLUDES # ;############################################################################### ;# COMMON DEFINITIONS USED BY KERNEL INCLUDE "kernel/macro.inc" ;############################################################################### ;# GLOBALS # ;############################################################################### ;# GLOBAL SYMBOLS PUBLIC KREGDUMP ;############################################################################### ;# TEXT SECTION # ;############################################################################### ;# TEXT SECTION SEGMENT ".text" ;#-----------------------------------------------------------------------------# ;# KREGDUMP() # ;#-----------------------------------------------------------------------------# KREGDUMP: ;# PRINT HEADING PUSH RDI LEA RDI, [RIP+KREGHD] CALL KCONSTR POP RDI ;# PRINT INTERRUPT NAME PUSH RDI LEA RDI, [RIP+KREGEXPN] CALL KCONSTR POP RDI PUSH RDI MOV RAX, [RDI+SFRAME_NBR] SHL RAX, 5 LEA RDI, [RIP+KREGSTR] ADD RDI, RAX CALL KCONSTR POP RDI ;# NEW LINE PUSH RDI MOV RDI, '\n' CALL KCONCHR POP RDI ;# PRINT INTERRUPT CODE PUSH RDI LEA RDI, [RIP+KREGEXPC] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_NBR] CALL KCONHEX POP RDI ;# NEW LINE PUSH RDI MOV RDI, '\n' CALL KCONCHR POP RDI ;# PRINT ERR CODE PUSH RDI LEA RDI, [RIP+KREGCODE] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_ERR] CALL KCONHEX POP RDI ;# NEW LINE PUSH RDI MOV RDI, '\n' CALL KCONCHR POP RDI ;# PRINT CPU CORE NUMBER PUSH RDI LEA RDI, [RIP+KREGCORE] CALL KCONSTR POP RDI PUSH RDI XOR RAX, RAX MOV EAX, [0xFEE00020] SHR EAX, 24 MOV RDI, RAX CALL KCONDEC POP RDI ;# HORIZONTAL LINE PUSH RDI LEA RDI, [RIP+KREGHR] CALL KCONSTR POP RDI ;# PRINT CS PUSH RDI LEA RDI, [RIP+KREGCS] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_CS] CALL KCONHEX POP RDI ;# PRINT RIP PUSH RDI LEA RDI, [RIP+KREGRIP] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_RIP] CALL KCONHEX POP RDI ;# PRINT RFLAGS PUSH RDI LEA RDI, [RIP+KREGFLG] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_RFLAGS] CALL KCONHEX POP RDI ;# NEW LINE PUSH RDI MOV RDI, '\n' CALL KCONCHR POP RDI ;# PRINT SS PUSH RDI LEA RDI, [RIP+KREGSS] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_SS] CALL KCONHEX POP RDI ;# PRINT RSP PUSH RDI LEA RDI, [RIP+KREGRSP] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_RSP] CALL KCONHEX POP RDI ;# HORIZONTAL LINE PUSH RDI LEA RDI, [RIP+KREGHR] CALL KCONSTR POP RDI ;# PRINT RAX PUSH RDI LEA RDI, [RIP+KREGRAX] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_RAX] CALL KCONHEX POP RDI ;# PRINT RBX PUSH RDI LEA RDI, [RIP+KREGRBX] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_RBX] CALL KCONHEX POP RDI ;# PRINT RCX PUSH RDI LEA RDI, [RIP+KREGRCX] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_RCX] CALL KCONHEX POP RDI ;# NEW LINE PUSH RDI MOV RDI, '\n' CALL KCONCHR POP RDI ;# PRINT RDX PUSH RDI LEA RDI, [RIP+KREGRDX] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_RDX] CALL KCONHEX POP RDI ;# PRINT RSI PUSH RDI LEA RDI, [RIP+KREGRSI] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_RSI] CALL KCONHEX POP RDI ;# PRINT RDI PUSH RDI LEA RDI, [RIP+KREGRDI] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_RDI] CALL KCONHEX POP RDI ;# NEW LINE PUSH RDI MOV RDI, '\n' CALL KCONCHR POP RDI ;# PRINT RBP PUSH RDI LEA RDI, [RIP+KREGRBP] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_RBP] CALL KCONHEX POP RDI ;# HORIZONTAL LINE PUSH RDI LEA RDI, [RIP+KREGHR] CALL KCONSTR POP RDI ;# PRINT R8 PUSH RDI LEA RDI, [RIP+KREGR8] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_R8] CALL KCONHEX POP RDI ;# PRINT R9 PUSH RDI LEA RDI, [RIP+KREGR9] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_R9] CALL KCONHEX POP RDI ;# PRINT R10 PUSH RDI LEA RDI, [RIP+KREGR10] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_R10] CALL KCONHEX POP RDI ;# NEW LINE PUSH RDI MOV RDI, '\n' CALL KCONCHR POP RDI ;# PRINT R11 PUSH RDI LEA RDI, [RIP+KREGR11] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_R11] CALL KCONHEX POP RDI ;# PRINT R12 PUSH RDI LEA RDI, [RIP+KREGR12] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_R12] CALL KCONHEX POP RDI ;# PRINT R13 PUSH RDI LEA RDI, [RIP+KREGR13] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_R13] CALL KCONHEX POP RDI ;# NEW LINE PUSH RDI MOV RDI, '\n' CALL KCONCHR POP RDI ;# PRINT R14 PUSH RDI LEA RDI, [RIP+KREGR14] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_R14] CALL KCONHEX POP RDI ;# PRINT R15 PUSH RDI LEA RDI, [RIP+KREGR15] CALL KCONSTR POP RDI PUSH RDI MOV RDI, [RDI+SFRAME_R15] CALL KCONHEX POP RDI ;# HORIZONTAL LINE PUSH RDI LEA RDI, [RIP+KREGHR] CALL KCONSTR POP RDI ;# DONE XOR RAX, RAX RET ;############################################################################### ;# DATA SECTION # ;############################################################################### ;# DATA SECTION SEGMENT ".data" ;#-----------------------------------------------------------------------------# ;# LOGGING STRINGS # ;#-----------------------------------------------------------------------------# ;# HEADING KREGHD: DB "\n" DB " " DB "------------------------------------------------" DB "------------------------------------------------" DB "\n" DB " REGISTER DUMP:" DB "\n" DB " " DB "------------------------------------------------" DB "------------------------------------------------" DB "\n" DB "\n" DB "\0" ;# HORIZONTAL LINE KREGHR: DB "\n" DB "\n" DB " " DB "------------------------------------------------" DB "------------------------------------------------" DB "\n" DB "\n" DB "\0" ;# REGISTERS KREGEXPN: DB " INTERRUPT NAME: \0" KREGEXPC: DB " INTERRUPT VECTOR: \0" KREGCODE: DB " ERROR CODE: \0" KREGCORE: DB " CPU CORE: \0" KREGCS: DB " CS: \0" KREGRIP: DB " RIP: \0" KREGFLG: DB " RFLAGS: \0" KREGSS: DB " SS: \0" KREGRSP: DB " RSP: \0" KREGRAX: DB " RAX: \0" KREGRBX: DB " RBX: \0" KREGRCX: DB " RCX: \0" KREGRDX: DB " RDX: \0" KREGRSI: DB " RSI: \0" KREGRDI: DB " RDI: \0" KREGRBP: DB " RBP: \0" KREGR8: DB " R8: \0" KREGR9: DB " R9: \0" KREGR10: DB " R10: \0" KREGR11: DB " R11: \0" KREGR12: DB " R12: \0" KREGR13: DB " R13: \0" KREGR14: DB " R14: \0" KREGR15: DB " R15: \0" ;# EXCEPTION NAMES KREGSTR: DB "DIVISION BY ZERO EXCEPTION \0" ;# 0x00 DB "DEBUG EXCEPTION \0" ;# 0x01 DB "NON MASKABLE INTERRUPT \0" ;# 0x02 DB "BREAKPOINT EXCEPTION \0" ;# 0x03 DB "OVERFLOW EXCEPTION \0" ;# 0x04 DB "BOUND RANGE \0" ;# 0x05 DB "INVALID OPCODE \0" ;# 0x06 DB "DEVICE NOT AVAILABLE \0" ;# 0x07 DB "DOUBLE FAULT \0" ;# 0x08 DB "UNSUPPORTED \0" ;# 0x09 DB "INVALID TSS \0" ;# 0x0A DB "SEGMENT NOT PRESENT \0" ;# 0x0B DB "STACK EXCEPTION \0" ;# 0x0C DB "GENERAL PROTECTION ERROR \0" ;# 0x0D DB "PAGE FAULT \0" ;# 0x0E DB "RESERVED \0" ;# 0x0F DB "X87 FLOATING POINT EXCEPTION \0" ;# 0x10 DB "ALIGNMENT CHECK \0" ;# 0x11 DB "MACHINE CHECK \0" ;# 0x12 DB "SIMD FLOATING POINT EXCEPTION \0" ;# 0x13 DB "RESERVED \0" ;# 0x14 DB "CONTROL PROTECTION EXCEPTION \0" ;# 0x15 DB "RESERVED \0" ;# 0x16 DB "RESERVED \0" ;# 0x17 DB "RESERVED \0" ;# 0x18 DB "RESERVED \0" ;# 0x19 DB "RESERVED \0" ;# 0x1A DB "RESERVED \0" ;# 0x1B DB "HYPERVISOR INJECTION EXCEPTION \0" ;# 0x1C DB "VMM COMMUNICATION EXCEPTION \0" ;# 0x1D DB "SECURITY EXCEPTION \0" ;# 0x1E DB "RESERVED \0" ;# 0x1F DB "SVC SYSTEM CALL \0" ;# 0x20 DB "SMP ENABLE CORE \0" ;# 0x21 DB "LOCAL TIMER IRQ \0" ;# 0x22 DB "LOCAL THERM SENSOR IRQ \0" ;# 0x23 DB "LOCAL PERF COUNTER IRQ \0" ;# 0x24 DB "LOCAL LINT0 IRQ \0" ;# 0x25 DB "LOCAL LINT1 IRQ \0" ;# 0x26 DB "LOCAL ERROR IRQ \0" ;# 0x27 DB "LOCAL SPURIOUS IRQ \0" ;# 0x28 DB "LOCAL SCHEDULER IRQ \0" ;# 0x29 DB "LOCAL RESERVED IRQ \0" ;# 0x2A DB "LOCAL RESERVED IRQ \0" ;# 0x2B DB "LOCAL RESERVED IRQ \0" ;# 0x2C DB "LOCAL RESERVED IRQ \0" ;# 0x2D DB "LOCAL RESERVED IRQ \0" ;# 0x2E DB "LOCAL RESERVED IRQ \0" ;# 0x2F DB "HARDWARE IRQ00 \0" ;# 0x30 DB "HARDWARE IRQ01 \0" ;# 0x31 DB "HARDWARE IRQ02 \0" ;# 0x32 DB "HARDWARE IRQ03 \0" ;# 0x33 DB "HARDWARE IRQ04 \0" ;# 0x34 DB "HARDWARE IRQ05 \0" ;# 0x35 DB "HARDWARE IRQ06 \0" ;# 0x36 DB "HARDWARE IRQ07 \0" ;# 0x37 DB "HARDWARE IRQ08 \0" ;# 0x38 DB "HARDWARE IRQ09 \0" ;# 0x39 DB "HARDWARE IRQ10 \0" ;# 0x3A DB "HARDWARE IRQ11 \0" ;# 0x3B DB "HARDWARE IRQ12 \0" ;# 0x3C DB "HARDWARE IRQ13 \0" ;# 0x3D DB "HARDWARE IRQ14 \0" ;# 0x3E DB "HARDWARE IRQ15 \0" ;# 0x3F ;# "0123456789ABCDEF0123456789ABCDEF"
src/PJ/flic386p/libsrc/fileio/doswrite.asm
AnimatorPro/Animator-Pro
119
243492
<gh_stars>100-1000 CGROUP group code code segment dword 'CODE' assume cs:CGROUP,ds:CGROUP include errcodes.i ; pj_dwrite(int file_handle, char *buffer, int size) ; returns bytes actually written public pj_dwrite pj_dwrite proc near pjwrite struc pjw_savebp dd ? pjw_ret dd ? pjw_handle dd ? pjw_buffer dd ? pjw_size dd ? pjwrite ends push ebp mov ebp,esp push ebx push ecx push edx mov eax,[ebp].pjw_size cmp eax,00h ; size of 0 is always successful jz #retok mov ebx,[ebp].pjw_handle mov ecx,eax mov edx,[ebp].pjw_buffer mov ah,40h int 21h jnc #retok mov eax,-1 ;error other than no space left on disk #retok: pop edx pop ecx pop ebx pop ebp ret pj_dwrite endp code ends end
.emacs.d/elpa/wisi-3.1.3/wisitoken-syntax_trees-lr_utils.adb
caqg/linux-home
0
11786
<filename>.emacs.d/elpa/wisi-3.1.3/wisitoken-syntax_trees-lr_utils.adb -- Abstract : -- -- See spec. -- -- Copyright (C) 2019, 2020 <NAME> All Rights Reserved. -- -- 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); package body WisiToken.Syntax_Trees.LR_Utils is procedure Raise_Programmer_Error (Label : in String; Descriptor : in WisiToken.Descriptor; Lexer : in WisiToken.Lexer.Handle; Tree : in WisiToken.Syntax_Trees.Tree; Terminals : in WisiToken.Base_Token_Arrays.Vector; Node : in Node_Index) is Terminal_Index : constant Base_Token_Index := Tree.First_Shared_Terminal (Node); begin raise SAL.Programmer_Error with Error_Message (Lexer.File_Name, -- Not clear why we need Line + 1 here, to match Emacs. (if Terminal_Index = Invalid_Token_Index then 1 else Terminals (Terminal_Index).Line + 1), 0, Label & ": " & Tree.Image (Node, Descriptor, Include_Children => True, Include_RHS_Index => True, Node_Numbers => True)); end Raise_Programmer_Error; function Count (Container : Constant_List) return Ada.Containers.Count_Type is use Ada.Containers; Result : Count_Type := 0; begin for Item of Container loop Result := Result + 1; end loop; return Result; end Count; function Contains (Container : in Constant_List; Node : in Valid_Node_Index) return Boolean is begin return (for some N of Container => N = Node); end Contains; function To_Cursor (Container : in Constant_List; Node : in Valid_Node_Index) return Cursor is pragma Unreferenced (Container); begin return (Node => Node); end To_Cursor; function Contains (Container : in Constant_List; Item : in Cursor) return Boolean is begin return (for some N of Container => N = Item.Node); end Contains; function First (Tree : in WisiToken.Syntax_Trees.Tree; Root : in WisiToken.Node_Index; List_ID : in WisiToken.Token_ID; Element_ID : in WisiToken.Token_ID) return Node_Index is begin if Root = Invalid_Node_Index then return Invalid_Node_Index; else return Result : Node_Index do Result := Root; loop declare Children : constant Valid_Node_Index_Array := Tree.Children (Result); begin if Tree.ID (Children (1)) = List_ID then Result := Children (1); elsif Tree.ID (Children (1)) = Element_ID then Result := Children (1); exit; else raise SAL.Programmer_Error; end if; end; end loop; end return; end if; end First; function First (Container : in Constant_List) return Cursor is begin return (Node => First (Container.Tree.all, Container.Root, Container.List_ID, Container.Element_ID)); end First; function Last (Tree : in WisiToken.Syntax_Trees.Tree; Root : in WisiToken.Node_Index) return Node_Index is begin if Root = Invalid_Node_Index then return Invalid_Node_Index; else -- Tree is one of: -- -- case a: single element list -- element_list : root -- | element: Last -- -- case c: no next -- element_list: root -- | element_list -- | | element: -- | element: Last return Tree.Child (Root, SAL.Base_Peek_Type (Tree.Child_Count (Root))); end if; end Last; function Last (Container : in Constant_List) return Cursor is begin return (Node => Last (Container.Tree.all, Container.Root)); end Last; function Next (Tree : in Syntax_Trees.Tree; List_ID : in Token_ID; Element_ID : in Token_ID; Position : in Node_Index) return Node_Index is begin if Position = Invalid_Node_Index then return Position; else return Result : Node_Index do declare -- Tree is one of: -- -- case a: first element, no next -- rhs -- | rhs_item_list -- | | rhs_item: Element -- | action -- -- case b: first element, next -- rhs_item_list -- | rhs_item_list -- | | rhs_item: Element -- | rhs_item: next element -- -- case c: non-first element, no next -- rhs -- | rhs_item_list : Grand_Parent -- | | rhs_item_list -- | | | rhs_item: -- | | rhs_item: Element -- | action : Aunt -- -- case d: non-first element, next -- rhs_item_list -- | rhs_item_list : Grand_Parent -- | | rhs_item_list -- | | | rhs_item: -- | | rhs_item: Element -- | rhs_item: next element : Aunt Grand_Parent : constant Node_Index := Tree.Parent (Position, 2); Aunts : constant Valid_Node_Index_Array := (if Grand_Parent = Invalid_Node_Index or else Tree.ID (Grand_Parent) /= List_ID then (1 .. 0 => Invalid_Node_Index) else Tree.Children (Grand_Parent)); Last_List_Child : SAL.Base_Peek_Type := Aunts'First - 1; begin if Grand_Parent = Invalid_Node_Index or else Tree.ID (Grand_Parent) /= List_ID then -- No next Result := Invalid_Node_Index; else for I in Aunts'Range loop if Tree.ID (Aunts (I)) in List_ID | Element_ID then Last_List_Child := I; end if; end loop; if Last_List_Child = 1 then -- No next Result := Invalid_Node_Index; else Result := Aunts (Last_List_Child); end if; end if; end; end return; end if; end Next; overriding function Next (Iter : Iterator; Position : Cursor) return Cursor is begin return (Node => Next (Iter.Container.Tree.all, Iter.Container.List_ID, Iter.Container.Element_ID, Position.Node)); end Next; function Previous (Tree : in Syntax_Trees.Tree; Position : in Node_Index) return Node_Index is begin if Position = Invalid_Node_Index then return Position; else return Result : Node_Index do -- Tree is one of: -- -- case a: first element, no prev -- ? -- | rhs_item_list -- | | rhs_item: Element -- -- case b: second element -- ? -- | rhs_item_list -- | | rhs_item: prev item -- | rhs_item: Element -- -- case c: nth element -- ? -- | rhs_item_list -- | | rhs_item_list -- | | | rhs_item: -- | | rhs_item: prev element -- | rhs_item: Element declare Parent : constant Valid_Node_Index := Tree.Parent (Position); begin if Position = Tree.Child (Parent, 1) then -- No prev Result := Invalid_Node_Index; else declare Prev_Children : constant Valid_Node_Index_Array := Tree.Children (Tree.Child (Parent, 1)); begin Result := Prev_Children (Prev_Children'Last); end; end if; end; end return; end if; end Previous; overriding function Previous (Iter : Iterator; Position : Cursor) return Cursor is begin return (Node => Previous (Iter.Container.Tree.all, Position.Node)); end Previous; function List_Constant_Ref (Container : aliased in Constant_List'Class; Position : in Cursor) return Valid_Node_Index is pragma Unreferenced (Container); begin return Position.Node; end List_Constant_Ref; overriding function Next (Iter : in Constant_Iterator; Position : Cursor) return Cursor is begin return (Node => Next (Iter.Container.Tree.all, Iter.Container.List_ID, Iter.Container.Element_ID, Position.Node)); end Next; overriding function Previous (Iter : in Constant_Iterator; Position : Cursor) return Cursor is begin return (Node => Previous (Iter.Container.Tree.all, Position.Node)); end Previous; function Find (Container : in Constant_List; Target : in Valid_Node_Index) return Cursor is begin for Cur in Container.Iterate_Constant loop if Target = Cur.Node then return Cur; end if; end loop; return No_Element; end Find; function Find (Container : in Constant_List; Target : in String; Equal : in Find_Equal) return Cursor is begin for Cur in Container.Iterate_Constant loop if Equal (Target, Container, Cur.Node) then return Cur; end if; end loop; return No_Element; end Find; package body Creators is function Create_List (Tree : aliased in out WisiToken.Syntax_Trees.Tree; Root : in Valid_Node_Index; List_ID : in WisiToken.Token_ID; Element_ID : in WisiToken.Token_ID; Separator_ID : in WisiToken.Token_ID) return List is pragma Unreferenced (List_ID); -- checked in precondition. Multi_Element_RHS : constant Natural := (if Tree.Child_Count (Root) = 1 then (if Tree.RHS_Index (Root) = 0 then 1 else 0) elsif Tree.Child_Count (Root) in 2 .. 3 -- 3 if there is a separator then Tree.RHS_Index (Root) else raise SAL.Programmer_Error); begin return (Tree'Access, Root, List_ID => Tree.ID (Root), One_Element_RHS => (if Multi_Element_RHS = 0 then 1 else 0), Multi_Element_RHS => Multi_Element_RHS, Element_ID => Element_ID, Separator_ID => Separator_ID); end Create_List; function Create_List (Tree : aliased in out WisiToken.Syntax_Trees.Tree; Root : in Valid_Node_Index; List_ID : in WisiToken.Token_ID; Element_ID : in WisiToken.Token_ID) return Constant_List is pragma Unreferenced (List_ID); -- in precondition begin return (Tree'Access, Root, List_ID => Tree.ID (Root), Element_ID => Element_ID); end Create_List; function Create_List (Container : in Constant_List; Tree : aliased in out WisiToken.Syntax_Trees.Tree; Root : in Valid_Node_Index) return Constant_List is begin return Create_List (Tree, Root, Container.List_ID, Container.Element_ID); end Create_List; function Create_List (Container : in out List; Root : in Valid_Node_Index) return List is begin return Create_List (Container.Tree.all, Root, Container.List_ID, Container.Element_ID, Container.Separator_ID); end Create_List; function Create_From_Element (Tree : aliased in out WisiToken.Syntax_Trees.Tree; Element : in Valid_Node_Index; List_ID : in WisiToken.Token_ID; Element_ID : in WisiToken.Token_ID; Separator_ID : in WisiToken.Token_ID) return List is Root : Valid_Node_Index := Tree.Parent (Element); begin loop exit when Tree.Parent (Root) = Invalid_Node_Index or else Tree.ID (Tree.Parent (Root)) /= List_ID; Root := Tree.Parent (Root); end loop; return Create_List (Tree, Root, List_ID, Element_ID, Separator_ID); end Create_From_Element; function Create_From_Element (Container : in out List; Element : in Valid_Node_Index) return List is begin return Create_From_Element (Container.Tree.all, Element, Container.List_ID, Container.Element_ID, Container.Separator_ID); end Create_From_Element; function Create_From_Element (Tree : aliased in out WisiToken.Syntax_Trees.Tree; Element : in Valid_Node_Index; List_ID : in WisiToken.Token_ID; Element_ID : in WisiToken.Token_ID) return Constant_List is Root : Valid_Node_Index := Tree.Parent (Element); begin loop exit when Tree.Parent (Root) = Invalid_Node_Index or else Tree.ID (Tree.Parent (Root)) /= List_ID; Root := Tree.Parent (Root); end loop; return Create_List (Tree, Root, List_ID, Element_ID); end Create_From_Element; function Invalid_List (Tree : aliased in out WisiToken.Syntax_Trees.Tree) return List is begin return (Tree => Tree'Access, Root => Invalid_Node_Index, List_ID => Invalid_Token_ID, One_Element_RHS => 0, Multi_Element_RHS => 0, Element_ID => Invalid_Token_ID, Separator_ID => Invalid_Token_ID); end Invalid_List; function Invalid_List (Tree : aliased in out WisiToken.Syntax_Trees.Tree) return Constant_List is begin return (Tree => Tree'Access, Root => Invalid_Node_Index, List_ID => Invalid_Token_ID, Element_ID => Invalid_Token_ID); end Invalid_List; function Empty_List (Tree : aliased in out WisiToken.Syntax_Trees.Tree; List_ID : in WisiToken.Token_ID; Multi_Element_RHS : in Natural; Element_ID : in WisiToken.Token_ID; Separator_ID : in WisiToken.Token_ID) return List is begin return (Tree'Access, Root => Invalid_Node_Index, List_ID => List_ID, One_Element_RHS => (if Multi_Element_RHS = 0 then 1 else 0), Multi_Element_RHS => Multi_Element_RHS, Element_ID => Element_ID, Separator_ID => Separator_ID); end Empty_List; function Empty_List (Container : in out List) return List is begin return Empty_List (Container.Tree.all, Container.List_ID, Container.Multi_Element_RHS, Container.Element_ID, Container.Separator_ID); end Empty_List; end Creators; procedure Append (Container : in out List; New_Element : in Valid_Node_Index) is Tree : Syntax_Trees.Tree renames Container.Tree.all; begin if Container.Root = Invalid_Node_Index then Container := (Container.Tree, List_ID => Container.List_ID, One_Element_RHS => Container.One_Element_RHS, Multi_Element_RHS => Container.Multi_Element_RHS, Element_ID => Container.Element_ID, Separator_ID => Container.Separator_ID, Root => Tree.Add_Nonterm (Production => (Container.List_ID, Container.One_Element_RHS), Children => (1 => New_Element))); else -- Adding element Last in spec example declare List_Parent : constant Node_Index := Tree.Parent (Container.Root); Old_Root : constant Valid_Node_Index := Container.Root; Child_Index : constant SAL.Base_Peek_Type := (if List_Parent = Invalid_Node_Index then 0 else Tree.Child_Index (List_Parent, Old_Root)); begin Container.Root := Tree.Add_Nonterm (Production => (Container.List_ID, Container.Multi_Element_RHS), Children => (if Container.Separator_ID = Invalid_Token_ID then (Old_Root, New_Element) else (Old_Root, Tree.Add_Terminal (Container.Separator_ID), New_Element))); if List_Parent = Invalid_Node_Index then if Tree.Root = Old_Root then Tree.Root := Container.Root; end if; else Tree.Replace_Child (List_Parent, Child_Index, Old_Child => Deleted_Child, New_Child => Container.Root); end if; end; end if; end Append; procedure Prepend (Container : in out List; New_Element : in Valid_Node_Index) is Tree : Syntax_Trees.Tree renames Container.Tree.all; begin if Container.Root = Invalid_Node_Index then Container := (Container.Tree, List_ID => Container.List_ID, One_Element_RHS => Container.One_Element_RHS, Multi_Element_RHS => Container.Multi_Element_RHS, Element_ID => Container.Element_ID, Separator_ID => Container.Separator_ID, Root => Tree.Add_Nonterm (Production => (Container.List_ID, Container.One_Element_RHS), Children => (1 => New_Element))); else -- Inserting element First (with list parent node and separator) in spec example declare Old_First : constant Valid_Node_Index := Container.First.Node; Parent : constant Valid_Node_Index := Tree.Parent (Old_First); List_Node : constant Valid_Node_Index := Tree.Add_Nonterm ((Container.List_ID, Container.One_Element_RHS), (1 => New_Element)); begin Tree.Set_Children (Node => Parent, New_ID => (Container.List_ID, Container.Multi_Element_RHS), Children => (if Container.Separator_ID = Invalid_Token_ID then (List_Node, Old_First) else (List_Node, Tree.Add_Terminal (Container.Separator_ID), Old_First))); end; end if; end Prepend; procedure Insert (Container : in out List; New_Element : in Valid_Node_Index; After : in Cursor) is -- Current Tree (see wisitoken_syntax_trees-test.adb Test_Insert_1): -- -- list: Tree.Root -- | list = Parent -- | | list -- | | | list -- | | | | element: 1 = First -- | | | separator -- | | | element: 2 = After -- | | separator -- | | element: 3 = Before -- | separator -- | element: 4 = Last -- Insert New_Element after 2: -- -- list: Tree.Root -- | list -- | | list = Parent -- | | | list: new_list_nonterm -- | | | | list -- | | | | | element: First -- | | | | separator -- | | | | element: After -- | | | separator -- | | | element: new -- | | separator -- | | element: Before -- | separator -- | element: Last Iter : constant Iterator := Container.Iterate; Before : constant Node_Index := Iter.Next (After).Node; begin if After.Node = Invalid_Node_Index then Prepend (Container, New_Element); elsif Before = Invalid_Node_Index then Append (Container, New_Element); else declare Parent : constant Valid_Node_Index := Container.Tree.Parent (Before); Old_Child : constant Valid_Node_Index := Container.Tree.Parent (After.Node); Child_Index : constant SAL.Peek_Type := Container.Tree.Child_Index (Parent, Old_Child); New_List_Nonterm : constant Valid_Node_Index := Container.Tree.Add_Nonterm (Production => (Container.List_ID, Container.Multi_Element_RHS), Children => (if Container.Separator_ID = Invalid_Token_ID then (Old_Child, New_Element) else (Old_Child, Container.Tree.Add_Terminal (Container.Separator_ID), New_Element))); begin -- After = Container.First is not a special case: -- -- list: Tree.Root -- | list -- | | list = Parent -- | | | list: new_list_nonterm -- | | | | list -- | | | | | element: First = After -- | | | | separator -- | | | | element: New_Element -- | | | separator -- | | | element: Before -- -- Typical case: -- -- | | list = Parent -- | | | list: New_list_nonterm -- | | | | | ... -- | | | | separator -- | | | | element: After -- | | | separator -- | | | element: New_Element -- | | separator -- | | element: Before Container.Tree.Replace_Child (Parent => Parent, Child_Index => Child_Index, Old_Child => Deleted_Child, New_Child => New_List_Nonterm, Old_Child_New_Parent => New_List_Nonterm); end; end if; end Insert; procedure Copy (Source_List : in Constant_List'Class; Source_First : in Cursor := No_Element; Source_Last : in Cursor := No_Element; Dest_List : in out List'Class) is Source_Iter : constant Constant_Iterator := Source_List.Iterate_Constant; Item : Cursor := (if Source_First = No_Element then Source_List.First else Source_First); Last : constant Cursor := (if Source_Last = No_Element then Source_List.Last else Source_Last); begin for N of Source_List loop exit when not Has_Element (Item); Dest_List.Append (Dest_List.Tree.Copy_Subtree (Item.Node)); exit when Item = Last; Item := Source_Iter.Next (Item); end loop; end Copy; procedure Delete (Container : in out List; Item : in out Cursor) is Tree : Syntax_Trees.Tree renames Container.Tree.all; begin if Container.First = Container.Last then -- result is empty declare List_Parent : constant Node_Index := Tree.Parent (Container.Root); begin if List_Parent = Invalid_Node_Index then if Tree.Root = Container.Root then Tree.Root := Invalid_Node_Index; end if; else Tree.Replace_Child (List_Parent, Child_Index => Tree.Child_Index (List_Parent, Container.Root), Old_Child => Container.Root, New_Child => Deleted_Child); end if; Container.Root := Invalid_Node_Index; end; elsif Item = Container.First then -- Before: -- -- 0011: | List_1: Parent_2 -- 0009: | | List_0: delete -- 0008: | | | Element_0: old First: Item.Node: delete -- 0001: | | | | ... -- 0002: | | separator?: delete -- 0010: | | Element_0: new First -- 0003: | | | ... -- -- After: -- -- 0011: | List_0: Parent_2 -- 0010: | | Element_0: new First -- 0003: | | | ... declare Parent_2 : constant Valid_Node_Index := Tree.Parent (Item.Node, 2); begin Tree.Set_Children (Parent_2, (Container.List_ID, Container.One_Element_RHS), (1 => Tree.Child (Parent_2, (if Container.Separator_ID = Invalid_Token_ID then 2 else 3)))); end; elsif Item = Container.Last then -- Before: -- -- ? ?: List_Parent -- 15: | List_1 : Root, delete -- 11: | | List_*: New_Root -- 10: | | | Element_0 -- 03: | | ... -- 06: | | separator?, delete -- 14: | | Element_0 : Last. delete -- 07: | | | ... -- ? ?: List_Parent -- 11: | List_*: Root -- 10: | | Element_0 -- 03: | ... declare List_Parent : constant Node_Index := Tree.Parent (Container.Root); New_Root : constant Valid_Node_Index := Tree.Child (Container.Root, 1); begin if List_Parent = Invalid_Node_Index then Tree.Delete_Parent (New_Root); Container.Root := New_Root; else declare Parent_Index : constant SAL.Peek_Type := Tree.Child_Index (List_Parent, Container.Root); begin Tree.Replace_Child (List_Parent, Parent_Index, Old_Child => Container.Root, New_Child => New_Root, Old_Child_New_Parent => Invalid_Node_Index); end; end if; Container.Root := New_Root; end; else -- Node numbers from test_lr_utils test case 1. -- -- before: -- 15: list: Parent_2 -- 13: | list: Parent_1, Old_Child -- 11: | | list: Parent_1_Child_1, New_Child -- 09: | | | list: -- 08: | | | | element: 1, First -- 02: | | | separator? -- 10: | | | element: 2 -- 04: | | separator? -- 12: | | element: 3, Item.Node, delete -- 06: | separator? -- 14: | element: 4, Last -- -- after -- 15: list: Parent_2 -- 11: | list: Parent_1_Child_1 -- 09: | | list: -- 08: | | | element: 1, First -- 02: | | separator? -- 10: | | element: 2 -- 06: | separator? -- 14: | element: 4, Last declare Parent_1 : constant Valid_Node_Index := Tree.Parent (Item.Node); Parent_2 : constant Valid_Node_Index := Tree.Parent (Parent_1); Parent_1_Child_1 : constant Valid_Node_Index := Tree.Child (Parent_1, 1); begin Tree.Replace_Child (Parent_2, 1, Old_Child => Parent_1, New_Child => Parent_1_Child_1, Old_Child_New_Parent => Invalid_Node_Index); end; end if; Item.Node := Invalid_Node_Index; end Delete; function Valid_Skip_List (Tree : aliased in out Syntax_Trees.Tree; Skip_List : in Skip_Array) return Boolean is begin if Skip_List'Length = 0 then return False; end if; if Skip_List (Skip_List'Last).Label /= Skip then return False; end if; if (for some I in Skip_List'First .. Skip_List'Last - 1 => Skip_List (I).Label /= Nested) then return False; end if; for I in Skip_List'First + 1 .. Skip_List'Last loop if Tree.ID (Skip_List (I).Element) /= Skip_List (I - 1).Element_ID then return False; end if; end loop; if Skip_List'Length > 2 then declare I : constant Positive_Index_Type := Skip_List'Last - 1; begin if Creators.Create_From_Element (Tree, Skip_List (I - 1).Element, Skip_List (I).List_ID, Skip_List (I).Element_ID).Count = 1 then return False; end if; end; end if; return True; end Valid_Skip_List; function Copy_Skip_Nested (Source_List : in Constant_List'Class; Skip_List : in Skip_Array; Skip_Found : in out Boolean; Tree : aliased in out Syntax_Trees.Tree; Separator_ID : in Token_ID; Multi_Element_RHS : in Natural) return Node_Index is Dest_List : List := Creators.Empty_List (Tree, Source_List.List_ID, Multi_Element_RHS, Source_List.Element_ID, Separator_ID); function Get_Dest_Child (Node : in Valid_Node_Index; Skip_List : in Skip_Array) return Valid_Node_Index with Pre => Tree.Is_Nonterm (Node) and (Skip_List'Length > 1 and then (Skip_List (Skip_List'First).Label = Nested and Skip_List (Skip_List'Last).Label = Skip)) is Skip_This : Nested_Skip_Item renames Skip_List (Skip_List'First); begin if Node = Skip_This.List_Root then return Copy_Skip_Nested (Creators.Create_List (Tree, Root => Skip_This.List_Root, List_ID => Skip_This.List_ID, Element_ID => Skip_This.Element_ID), Skip_List (Skip_List'First + 1 .. Skip_List'Last), Skip_Found, Tree, Skip_This.Separator_ID, Skip_This.Multi_Element_RHS); else declare Source_Children : constant Valid_Node_Index_Array := Tree.Children (Node); Dest_Children : Valid_Node_Index_Array (Source_Children'Range); begin for I in Source_Children'Range loop if Source_Children (I) = Skip_This.List_Root then Dest_Children (I) := Copy_Skip_Nested (Creators.Create_List (Tree, Root => Skip_This.List_Root, List_ID => Skip_This.List_ID, Element_ID => Skip_This.Element_ID), Skip_List (Skip_List'First + 1 .. Skip_List'Last), Skip_Found, Tree, Skip_This.Separator_ID, Skip_This.Multi_Element_RHS); else if Tree.Label (Source_Children (I)) = Nonterm then Dest_Children (I) := Get_Dest_Child (Source_Children (I), Skip_List); else Dest_Children (I) := Tree.Copy_Subtree (Source_Children (I)); end if; end if; end loop; return Tree.Add_Nonterm (Tree.Production_ID (Node), Dest_Children, Tree.Action (Node)); end; end if; end Get_Dest_Child; Skip_This : Nested_Skip_Item renames Skip_List (Skip_List'First); begin -- See test_lr_utils.adb Test_Copy_Skip for an example. for N of Source_List loop if Skip_This.Element = N then case Skip_This.Label is when Skip => -- Done nesting; skip this one Skip_Found := True; when Nested => Dest_List.Append (Get_Dest_Child (N, Skip_List)); end case; else Dest_List.Append (Tree.Copy_Subtree (N)); end if; end loop; return Dest_List.Root; end Copy_Skip_Nested; function Copy_Skip_Nested (Skip_List : in Skip_Info; Tree : aliased in out Syntax_Trees.Tree) return Node_Index is Source_List : constant Constant_List := Creators.Create_List (Tree, Root => Skip_List.Start_List_Root, List_ID => Skip_List.Start_List_ID, Element_ID => Skip_List.Start_Element_ID); Skip_Found : Boolean := False; begin return Result : constant Node_Index := Copy_Skip_Nested (Source_List, Skip_List.Skips, Skip_Found, Tree, Skip_List.Start_Separator_ID, Skip_List.Start_Multi_Element_RHS) do if not Skip_Found then raise SAL.Programmer_Error with "Skip not found"; end if; end return; end Copy_Skip_Nested; function List_Root (Tree : in Syntax_Trees.Tree; Node : in Valid_Node_Index; List_ID : in Token_ID) return Valid_Node_Index is Root : Node_Index := Node; begin loop exit when Tree.Parent (Root) = Invalid_Node_Index or else Tree.ID (Tree.Parent (Root)) /= List_ID; Root := Tree.Parent (Root); end loop; return Root; end List_Root; end WisiToken.Syntax_Trees.LR_Utils;
tools/xml2ayacc/encoding/encodings-unicode.adb
faelys/gela-asis
4
30914
<gh_stars>1-10 -------------------------------------------------------- -- E n c o d i n g s -- -- -- -- Tools for convertion strings between Unicode and -- -- national/vendor character sets. -- -- - - - - - - - - - -- -- Read copyright and license at the end of this file -- -------------------------------------------------------- with Encodings.Maps.ISO_8859_1; with Encodings.Maps.ISO_8859_2; with Encodings.Maps.ISO_8859_3; with Encodings.Maps.ISO_8859_4; with Encodings.Maps.ISO_8859_5; with Encodings.Maps.ISO_8859_6; with Encodings.Maps.ISO_8859_7; with Encodings.Maps.ISO_8859_8; with Encodings.Maps.ISO_8859_9; with Encodings.Maps.ISO_8859_10; with Encodings.Maps.ISO_8859_11; with Encodings.Maps.ISO_8859_13; with Encodings.Maps.ISO_8859_14; with Encodings.Maps.ISO_8859_15; with Encodings.Maps.ISO_8859_16; with Encodings.Maps.CP_037; with Encodings.Maps.CP_424; with Encodings.Maps.CP_437; with Encodings.Maps.CP_500; with Encodings.Maps.CP_737; with Encodings.Maps.CP_775; with Encodings.Maps.CP_850; with Encodings.Maps.CP_852; with Encodings.Maps.CP_855; with Encodings.Maps.CP_856; with Encodings.Maps.CP_857; with Encodings.Maps.CP_860; with Encodings.Maps.CP_861; with Encodings.Maps.CP_862; with Encodings.Maps.CP_863; with Encodings.Maps.CP_864; with Encodings.Maps.CP_865; with Encodings.Maps.CP_866; with Encodings.Maps.CP_869; with Encodings.Maps.CP_874; with Encodings.Maps.CP_875; with Encodings.Maps.CP_1006; with Encodings.Maps.CP_1026; with Encodings.Maps.CP_1250; with Encodings.Maps.CP_1251; with Encodings.Maps.CP_1252; with Encodings.Maps.CP_1253; with Encodings.Maps.CP_1254; with Encodings.Maps.CP_1255; with Encodings.Maps.CP_1256; with Encodings.Maps.CP_1257; with Encodings.Maps.CP_1258; with Encodings.Maps.AtariST; with Encodings.Maps.KOI8_R; package body Encodings.Unicode is ------------ -- Decode -- ------------ procedure Decode (Buffer : in String; Index : in out Positive; Free : in Positive; Map : in Encoding; Char : out Unicode_Character) is subtype C is Character; subtype W is Wide_Character; Ind : Positive := Index; function Continuing return Boolean is begin if Ind = Buffer'Last then Ind := Buffer'First; else Ind := Ind + 1; end if; if Ind = Free then Char := Empty_Buffer; return False; elsif C'Pos (Buffer (Ind)) in 2#1000_0000# .. 2#1011_1111# then Char := (Char * 2 ** 6) or (C'Pos (Buffer (Ind)) and 2#0011_1111#); return True; else raise Invalid_Encoding; end if; end Continuing; pragma Inline (Continuing); begin if Ind = Free then Char := Empty_Buffer; return; end if; case Map is when UTF_8 => case C'Pos (Buffer (Ind)) is when 2#0000_0000# .. 2#0111_1111# => Char := C'Pos (Buffer (Ind)); when 2#1100_0000# .. 2#1101_1111# => Char := C'Pos (Buffer (Ind)) and 2#0001_1111#; if not Continuing then return; end if; when 2#1110_0000# .. 2#1110_1111# => Char := C'Pos (Buffer (Ind)) and 2#0000_1111#; if not (Continuing and then Continuing) then return; end if; when 2#1111_0000# .. 2#1111_0111# => Char := C'Pos (Buffer (Ind)) and 2#0000_0111#; if not (Continuing and then Continuing and then Continuing) then return; end if; when 2#1111_1000# .. 2#1111_1011# => Char := C'Pos (Buffer (Ind)) and 2#0000_0011#; if not (Continuing and then Continuing and then Continuing and then Continuing) then return; end if; when 2#1111_1100# .. 2#1111_1101# => Char := C'Pos (Buffer (Ind)) and 2#0000_0001#; if not (Continuing and then Continuing and then Continuing and then Continuing and then Continuing) then return; end if; when others => raise Invalid_Encoding; end case; when ISO_8859_1 => Char := W'Pos (Maps.ISO_8859_1.Decode (Buffer (Ind))); when ISO_8859_2 => Char := W'Pos (Maps.ISO_8859_2.Decode (Buffer (Ind))); when ISO_8859_3 => Char := W'Pos (Maps.ISO_8859_3.Decode (Buffer (Ind))); when ISO_8859_4 => Char := W'Pos (Maps.ISO_8859_4.Decode (Buffer (Ind))); when ISO_8859_5 => Char := W'Pos (Maps.ISO_8859_5.Decode (Buffer (Ind))); when ISO_8859_6 => Char := W'Pos (Maps.ISO_8859_6.Decode (Buffer (Ind))); when ISO_8859_7 => Char := W'Pos (Maps.ISO_8859_7.Decode (Buffer (Ind))); when ISO_8859_8 => Char := W'Pos (Maps.ISO_8859_8.Decode (Buffer (Ind))); when ISO_8859_9 => Char := W'Pos (Maps.ISO_8859_9.Decode (Buffer (Ind))); when ISO_8859_10 => Char := W'Pos (Maps.ISO_8859_10.Decode (Buffer (Ind))); when ISO_8859_11 => Char := W'Pos (Maps.ISO_8859_11.Decode (Buffer (Ind))); when ISO_8859_13 => Char := W'Pos (Maps.ISO_8859_13.Decode (Buffer (Ind))); when ISO_8859_14 => Char := W'Pos (Maps.ISO_8859_14.Decode (Buffer (Ind))); when ISO_8859_15 => Char := W'Pos (Maps.ISO_8859_15.Decode (Buffer (Ind))); when ISO_8859_16 => Char := W'Pos (Maps.ISO_8859_16.Decode (Buffer (Ind))); when CP_037 => Char := W'Pos (Maps.CP_037.Decode (Buffer (Ind))); when CP_424 => Char := W'Pos (Maps.CP_424.Decode (Buffer (Ind))); when CP_437 => Char := W'Pos (Maps.CP_437.Decode (Buffer (Ind))); when CP_500 => Char := W'Pos (Maps.CP_500.Decode (Buffer (Ind))); when CP_875 => Char := W'Pos (Maps.CP_875.Decode (Buffer (Ind))); when CP_737 => Char := W'Pos (Maps.CP_737.Decode (Buffer (Ind))); when CP_775 => Char := W'Pos (Maps.CP_775.Decode (Buffer (Ind))); when CP_850 => Char := W'Pos (Maps.CP_850.Decode (Buffer (Ind))); when CP_852 => Char := W'Pos (Maps.CP_852.Decode (Buffer (Ind))); when CP_855 => Char := W'Pos (Maps.CP_855.Decode (Buffer (Ind))); when CP_856 => Char := W'Pos (Maps.CP_856.Decode (Buffer (Ind))); when CP_857 => Char := W'Pos (Maps.CP_857.Decode (Buffer (Ind))); when CP_860 => Char := W'Pos (Maps.CP_860.Decode (Buffer (Ind))); when CP_861 => Char := W'Pos (Maps.CP_861.Decode (Buffer (Ind))); when CP_862 => Char := W'Pos (Maps.CP_862.Decode (Buffer (Ind))); when CP_863 => Char := W'Pos (Maps.CP_863.Decode (Buffer (Ind))); when CP_864 => Char := W'Pos (Maps.CP_864.Decode (Buffer (Ind))); when CP_865 => Char := W'Pos (Maps.CP_865.Decode (Buffer (Ind))); when CP_866 => Char := W'Pos (Maps.CP_866.Decode (Buffer (Ind))); when CP_869 => Char := W'Pos (Maps.CP_869.Decode (Buffer (Ind))); when CP_874 => Char := W'Pos (Maps.CP_874.Decode (Buffer (Ind))); when CP_1006 => Char := W'Pos (Maps.CP_1006.Decode (Buffer (Ind))); when CP_1026 => Char := W'Pos (Maps.CP_1026.Decode (Buffer (Ind))); when CP_1250 => Char := W'Pos (Maps.CP_1250.Decode (Buffer (Ind))); when CP_1251 => Char := W'Pos (Maps.CP_1251.Decode (Buffer (Ind))); when CP_1252 => Char := W'Pos (Maps.CP_1252.Decode (Buffer (Ind))); when CP_1253 => Char := W'Pos (Maps.CP_1253.Decode (Buffer (Ind))); when CP_1254 => Char := W'Pos (Maps.CP_1254.Decode (Buffer (Ind))); when CP_1255 => Char := W'Pos (Maps.CP_1255.Decode (Buffer (Ind))); when CP_1256 => Char := W'Pos (Maps.CP_1256.Decode (Buffer (Ind))); when CP_1257 => Char := W'Pos (Maps.CP_1257.Decode (Buffer (Ind))); when CP_1258 => Char := W'Pos (Maps.CP_1258.Decode (Buffer (Ind))); when KOI8_R => Char := W'Pos (Maps.KOI8_R.Decode (Buffer (Ind))); when AtariST => Char := W'Pos (Maps.AtariST.Decode (Buffer (Ind))); when Unknown => raise Invalid_Encoding; end case; if Ind = Buffer'Last then Index := Buffer'First; else Index := Ind + 1; end if; end Decode; end Encodings.Unicode; ------------------------------------------------------------------------------ -- 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 <NAME>, 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. ------------------------------------------------------------------------------
Practica2/init.asm
alberto402/Practica-2-avanzada-EL_Mas_Cercano_Gana-Sistemas-Empotrados-Distribuidos
2
24346
<reponame>alberto402/Practica-2-avanzada-EL_Mas_Cercano_Gana-Sistemas-Empotrados-Distribuidos .global start .extern Main .equ STACK, 0x0C7FF000 start: LDR SP,=STACK MOV FP,#0 MOV LR,PC LDR PC,=Main End: B End .end
programs/oeis/033/A033364.asm
neoneye/loda
22
22150
; A033364: a(n) = floor(44/n). ; 44,22,14,11,8,7,6,5,4,4,4,3,3,3,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 add $0,1 mov $1,44 div $1,$0 mov $0,$1
tools-src/gnu/gcc/gcc/ada/a-strsea.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
23087
------------------------------------------------------------------------------ -- -- -- GNAT RUNTIME COMPONENTS -- -- -- -- A D A . S T R I N G S . S E A R C H -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992,1993,1994,1995,1996 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. -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- Note: This code is derived from the ADAR.CSH public domain Ada 83 -- versions of the Appendix C string handling packages (code extracted -- from Ada.Strings.Fixed). A significant change is that we optimize the -- case of identity mappings for Count and Index, and also Index_Non_Blank -- is specialized (rather than using the general Index routine). with Ada.Strings.Maps; use Ada.Strings.Maps; package body Ada.Strings.Search is ----------------------- -- Local Subprograms -- ----------------------- function Belongs (Element : Character; Set : Maps.Character_Set; Test : Membership) return Boolean; pragma Inline (Belongs); -- Determines if the given element is in (Test = Inside) or not in -- (Test = Outside) the given character set. ------------- -- Belongs -- ------------- function Belongs (Element : Character; Set : Maps.Character_Set; Test : Membership) return Boolean is begin if Test = Inside then return Is_In (Element, Set); else return not Is_In (Element, Set); end if; end Belongs; ----------- -- Count -- ----------- function Count (Source : in String; Pattern : in String; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural is N : Natural; J : Natural; Mapped_Source : String (Source'Range); begin for J in Source'Range loop Mapped_Source (J) := Value (Mapping, Source (J)); end loop; if Pattern = "" then raise Pattern_Error; end if; N := 0; J := Source'First; while J <= Source'Last - (Pattern'Length - 1) loop if Mapped_Source (J .. J + (Pattern'Length - 1)) = Pattern then N := N + 1; J := J + Pattern'Length; else J := J + 1; end if; end loop; return N; end Count; function Count (Source : in String; Pattern : in String; Mapping : in Maps.Character_Mapping_Function) return Natural is Mapped_Source : String (Source'Range); N : Natural; J : Natural; begin if Pattern = "" then raise Pattern_Error; end if; -- We make sure Access_Check is unsuppressed so that the Mapping.all -- call will generate a friendly Constraint_Error if the value for -- Mapping is uninitialized (and hence null). declare pragma Unsuppress (Access_Check); begin for J in Source'Range loop Mapped_Source (J) := Mapping.all (Source (J)); end loop; end; N := 0; J := Source'First; while J <= Source'Last - (Pattern'Length - 1) loop if Mapped_Source (J .. J + (Pattern'Length - 1)) = Pattern then N := N + 1; J := J + Pattern'Length; else J := J + 1; end if; end loop; return N; end Count; function Count (Source : in String; Set : in Maps.Character_Set) return Natural is N : Natural := 0; begin for J in Source'Range loop if Is_In (Source (J), Set) then N := N + 1; end if; end loop; return N; end Count; ---------------- -- Find_Token -- ---------------- procedure Find_Token (Source : in String; Set : in Maps.Character_Set; Test : in Membership; First : out Positive; Last : out Natural) is begin for J in Source'Range loop if Belongs (Source (J), Set, Test) then First := J; for K in J + 1 .. Source'Last loop if not Belongs (Source (K), Set, Test) then Last := K - 1; return; end if; end loop; -- Here if J indexes 1st char of token, and all chars -- after J are in the token Last := Source'Last; return; end if; end loop; -- Here if no token found First := Source'First; Last := 0; end Find_Token; ----------- -- Index -- ----------- function Index (Source : in String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping := Maps.Identity) return Natural is Cur_Index : Natural; Mapped_Source : String (Source'Range); begin if Pattern = "" then raise Pattern_Error; end if; for J in Source'Range loop Mapped_Source (J) := Value (Mapping, Source (J)); end loop; -- Forwards case if Going = Forward then for J in 1 .. Source'Length - Pattern'Length + 1 loop Cur_Index := Source'First + J - 1; if Pattern = Mapped_Source (Cur_Index .. Cur_Index + Pattern'Length - 1) then return Cur_Index; end if; end loop; -- Backwards case else for J in reverse 1 .. Source'Length - Pattern'Length + 1 loop Cur_Index := Source'First + J - 1; if Pattern = Mapped_Source (Cur_Index .. Cur_Index + Pattern'Length - 1) then return Cur_Index; end if; end loop; end if; -- Fall through if no match found. Note that the loops are skipped -- completely in the case of the pattern being longer than the source. return 0; end Index; function Index (Source : in String; Pattern : in String; Going : in Direction := Forward; Mapping : in Maps.Character_Mapping_Function) return Natural is Mapped_Source : String (Source'Range); Cur_Index : Natural; begin if Pattern = "" then raise Pattern_Error; end if; -- We make sure Access_Check is unsuppressed so that the Mapping.all -- call will generate a friendly Constraint_Error if the value for -- Mapping is uninitialized (and hence null). declare pragma Unsuppress (Access_Check); begin for J in Source'Range loop Mapped_Source (J) := Mapping.all (Source (J)); end loop; end; -- Forwards case if Going = Forward then for J in 1 .. Source'Length - Pattern'Length + 1 loop Cur_Index := Source'First + J - 1; if Pattern = Mapped_Source (Cur_Index .. Cur_Index + Pattern'Length - 1) then return Cur_Index; end if; end loop; -- Backwards case else for J in reverse 1 .. Source'Length - Pattern'Length + 1 loop Cur_Index := Source'First + J - 1; if Pattern = Mapped_Source (Cur_Index .. Cur_Index + Pattern'Length - 1) then return Cur_Index; end if; end loop; end if; return 0; end Index; function Index (Source : in String; Set : in Maps.Character_Set; Test : in Membership := Inside; Going : in Direction := Forward) return Natural is begin -- Forwards case if Going = Forward then for J in Source'Range loop if Belongs (Source (J), Set, Test) then return J; end if; end loop; -- Backwards case else for J in reverse Source'Range loop if Belongs (Source (J), Set, Test) then return J; end if; end loop; end if; -- Fall through if no match return 0; end Index; --------------------- -- Index_Non_Blank -- --------------------- function Index_Non_Blank (Source : in String; Going : in Direction := Forward) return Natural is begin if Going = Forward then for J in Source'Range loop if Source (J) /= ' ' then return J; end if; end loop; else -- Going = Backward for J in reverse Source'Range loop if Source (J) /= ' ' then return J; end if; end loop; end if; -- Fall through if no match return 0; end Index_Non_Blank; end Ada.Strings.Search;
src/shaders/post_processing/gen5_6/Core_Kernels/PL3_AVS_IEF_8x4.asm
tizenorg/platform.upstream.libva-intel-driver
0
179070
<reponame>tizenorg/platform.upstream.libva-intel-driver /* * All Video Processing kernels * Copyright © <2010>, Intel Corporation. * * This program is licensed under the terms and conditions of the * Eclipse Public License (EPL), version 1.0. The full text of the EPL is at * http://www.opensource.org/licenses/eclipse-1.0.php. * */ //---------- PL3_AVS_IEF_8x4.asm ---------- #include "AVS_IEF.inc" //------------------------------------------------------------------------------ // 2 sampler reads for 8x8 Y surface // 1 sampler read for 8x8 U surface // 1 sampler read for 8x8 V surface //------------------------------------------------------------------------------ // 1st 8x8 setup #include "AVS_SetupFirstBlock.asm" // 1st 8x8 Y sampling mov (1) rAVS_8x8_HDR.2:ud nAVS_GREEN_CHANNEL_ONLY:ud // Enable green channel mov (16) mAVS_8x8_HDR.0:ud rAVS_8x8_HDR.0<8;8,1>:ud // Copy msg header and payload mirrors to MRFs send (1) uwAVS_RESPONSE(0)<1> mAVS_8x8_HDR udDUMMY_NULL nSMPL_ENGINE nAVS_MSG_DSC_1CH+nSI_SRC_Y+nBI_CURRENT_SRC_Y // Return Y in 4 GRFs // 8x8 U sampling ; Only 8x4 will be used mov (1) rAVS_8x8_HDR.2:ud nAVS_RED_CHANNEL_ONLY:ud // Enable red channel mul (1) rAVS_PAYLOAD.1:f fVIDEO_STEP_X:f 2.0:f // Calculate Step X for chroma mov (16) mAVS_8x8_HDR_UV.0:ud rAVS_8x8_HDR.0<8;8,1>:ud // Copy msg header and payload mirrors to MRFs send (1) uwAVS_RESPONSE(4)<1> mAVS_8x8_HDR_UV udDUMMY_NULL nSMPL_ENGINE nAVS_MSG_DSC_1CH+nSI_SRC_U+nBI_CURRENT_SRC_U // Return U in 4 GRFs // 8x8 V sampling ; Only 8x4 will be used mov (1) rAVS_8x8_HDR.2:ud nAVS_RED_CHANNEL_ONLY:ud // Dummy instruction just in order to avoid back-2-back send instructions! mov (16) mAVS_8x8_HDR_UV.0:ud rAVS_8x8_HDR.0<8;8,1>:ud // Copy msg header and payload mirrors to MRFs send (1) uwAVS_RESPONSE(8)<1> mAVS_8x8_HDR_UV udDUMMY_NULL nSMPL_ENGINE nAVS_MSG_DSC_1CH+nSI_SRC_V+nBI_CURRENT_SRC_V // Return V in 4 GRFs // 2nd 8x8 setup #include "AVS_SetupSecondBlock.asm" // 2nd 8x8 Y sampling mov (1) rAVS_8x8_HDR.2:ud nAVS_GREEN_CHANNEL_ONLY:ud // Enable green channel mov (1) rAVS_PAYLOAD.1:f fVIDEO_STEP_X:f // Restore Step X for luma mov (16) mAVS_8x8_HDR.0:ud rAVS_8x8_HDR.0<8;8,1>:ud // Copy msg header and payload mirrors to MRFs send (1) uwAVS_RESPONSE(12)<1> mAVS_8x8_HDR udDUMMY_NULL nSMPL_ENGINE nAVS_MSG_DSC_1CH+nSI_SRC_Y+nBI_CURRENT_SRC_Y // Return Y in 4 GRFs //------------------------------------------------------------------------------ // Unpacking sampler reads to 4:2:0 internal planar //------------------------------------------------------------------------------ #include "PL3_AVS_IEF_Unpack_8x4.asm"
code/6502/tests/tms/tms9918type.asm
visrealm/hbc-56
65
26980
<filename>code/6502/tests/tms/tms9918type.asm ; Troy's HBC-56 - TMS9918 Console mode test ; ; Copyright (c) 2021 <NAME> ; ; This code is licensed under the MIT license ; ; https://github.com/visrealm/hbc-56 ; !src "hbc56kernel.inc" hbc56Meta: +setHbcMetaTitle "CONSOLE TEST" rts hbc56Main: sei jsr kbInit jsr tmsModeText +tmsUpdateFont TMS_TEXT_MODE_FONT +tmsSetColorFgBg TMS_LT_GREEN, TMS_BLACK +tmsEnableOutput cli +tmsEnableInterrupts +consoleEnableCursor .consoleLoop: jsr kbReadAscii bcc .consoleLoop ; output 'A' to console jsr tmsConsoleOut jmp .consoleLoop TMS_TEXT_MODE_FONT: !src "gfx/fonts/tms9918font2subset.asm"
oeis/124/A124442.asm
neoneye/loda-programs
11
174312
; A124442: a(n) = Product_{ceiling(n/2) <= k <= n, gcd(k,n)=1} k. ; Submitted by <NAME> ; 1,1,2,3,12,5,120,35,280,63,30240,77,665280,1287,16016,19305,518918400,2431,17643225600,46189,14780480,1322685,28158588057600,96577,4317650168832,58503375,475931456000,75218625,3497296636753920000,215441,202843204931727360000,94670161425,77793159808000,183771489825,94108208002338816,343755125,58102407620643984998400000,12525477859125,340973403527680000,558278441721,335367096786357081410764800000,784175225,27500101936481280675682713600000,1242733450447125,1786233013817348096,80237355387564375 add $0,1 mov $1,1 mov $2,$0 lpb $0 mov $3,$2 gcd $3,$0 pow $3,$0 sub $0,1 trn $2,2 mov $4,$0 div $4,$3 mov $3,$4 mul $3,$1 add $1,$3 lpe mov $0,$1
source/nodes/program-nodes-number_declarations.ads
reznikmm/gela
0
21795
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Defining_Identifiers; with Program.Lexical_Elements; with Program.Elements.Expressions; with Program.Elements.Number_Declarations; with Program.Element_Visitors; package Program.Nodes.Number_Declarations is pragma Preelaborate; type Number_Declaration is new Program.Nodes.Node and Program.Elements.Number_Declarations.Number_Declaration and Program.Elements.Number_Declarations.Number_Declaration_Text with private; function Create (Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Constant_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Assignment_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expression : not null Program.Elements.Expressions .Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Number_Declaration; type Implicit_Number_Declaration is new Program.Nodes.Node and Program.Elements.Number_Declarations.Number_Declaration with private; function Create (Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Expression : not null Program.Elements.Expressions .Expression_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Number_Declaration with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Number_Declaration is abstract new Program.Nodes.Node and Program.Elements.Number_Declarations.Number_Declaration with record Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Expression : not null Program.Elements.Expressions.Expression_Access; end record; procedure Initialize (Self : in out Base_Number_Declaration'Class); overriding procedure Visit (Self : not null access Base_Number_Declaration; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Names (Self : Base_Number_Declaration) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; overriding function Expression (Self : Base_Number_Declaration) return not null Program.Elements.Expressions.Expression_Access; overriding function Is_Number_Declaration (Self : Base_Number_Declaration) return Boolean; overriding function Is_Declaration (Self : Base_Number_Declaration) return Boolean; type Number_Declaration is new Base_Number_Declaration and Program.Elements.Number_Declarations.Number_Declaration_Text with record Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Constant_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Assignment_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; end record; overriding function To_Number_Declaration_Text (Self : in out Number_Declaration) return Program.Elements.Number_Declarations .Number_Declaration_Text_Access; overriding function Colon_Token (Self : Number_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Constant_Token (Self : Number_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Assignment_Token (Self : Number_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Semicolon_Token (Self : Number_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Number_Declaration is new Base_Number_Declaration with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Number_Declaration_Text (Self : in out Implicit_Number_Declaration) return Program.Elements.Number_Declarations .Number_Declaration_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Number_Declaration) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Number_Declaration) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Number_Declaration) return Boolean; end Program.Nodes.Number_Declarations;
programs/oeis/040/A040342.asm
neoneye/loda
22
240493
<reponame>neoneye/loda ; A040342: Continued fraction for sqrt(362). ; 19,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38 pow $1,$0 gcd $1,2 mul $1,19 mov $0,$1