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 |
|---|---|---|---|---|
test/Fail/Issue3318-1.agda | cruhland/agda | 1,989 | 17284 | primitive
primLevelZero : _
|
oeis/142/A142308.asm | neoneye/loda-programs | 11 | 83931 | <filename>oeis/142/A142308.asm
; A142308: Primes congruent to 37 mod 44.
; Submitted by <NAME>
; 37,257,389,433,521,653,829,1049,1093,1181,1489,1621,1709,1753,1973,2017,2237,2281,2633,2677,2897,3469,3557,3733,3821,4129,4217,4261,4349,4481,4657,4789,4877,5009,5273,5449,5581,5669,5801,6197,6329,6373,6637,6857,7121,7253,7297,7517,7561,7649,8089,8221,8353,8573,8837,8969,9013,9277,9497,9629,10069,10289,10333,10597,10729,10861,10949,10993,11213,11257,12049,12269,12401,12577,12841,12973,13457,13633,13721,14029,14249,14293,14557,14821,15173,15217,15349,15569,15877,16097,16141,16229,16273,16361
mov $1,5
mov $2,$0
add $2,2
pow $2,2
lpb $2
add $1,31
mov $3,$1
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,13
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,1
lpe
mov $0,$1
add $0,32
|
boots.asm | Catobat/z3randomizer | 2 | 27388 | ;================================================================================
; Boots State Modifier
;--------------------------------------------------------------------------------
!BOOTS_MODIFIER = "$7F50CE"
ModifyBoots:
PHA
LDA !BOOTS_MODIFIER : CMP.b #$01 : BNE +
PLA : AND $7EF379 : ORA.b #$04 : RTL ; yes boots
+ : CMP #$02 : BNE +
PLA : AND $7EF379 : AND.b #$FB : RTL ; no boots
+
PLA
AND $7EF379 ; regular boots
RTL
;-------------------------------------------------------------------------------- |
asm/boot.asm | creepyCaller/F-operating-system | 0 | 104755 | org 7c00h
mov ax, cs
mov ds, ax
mov es, ax
call DispStr
jmp $
DispStr:
mov ax, BootMsg
mov bp, ax
mov cx, 15
mov ax, 1301h
mov bx, 000fh
mov dl, 0
int 10h
ret
BootMsg:
db "Hello, world !"
times 510 - ($ - $$) db 0
dw 0xaa55
|
test/interaction/Issue317.agda | shlevy/agda | 1,989 | 4472 | <gh_stars>1000+
module Issue317 (A : Set) where
postulate F : Set → Set
-- Try evaluating F A at the top-level:
--
-- 1,3-4
-- Not in scope:
-- A at 1,3-4
-- when scope checking A
--
-- OK, in that case the inferred type of F should be
-- (A : Set) → Set → Set, right? No, it isn't, it's Set → Set.
--
-- I think the parameters should be in scope when "top-level" commands
-- are executed, because these commands should behave in the same way
-- as commands executed in a top-level goal at the end of the module.
-- It seems as if the implementation of
-- Agda.Interaction.BasicOps.atTopLevel has to be modified.
|
test/Succeed/Issue2429-subtyping.agda | hborum/agda | 3 | 4500 | <reponame>hborum/agda
-- Andreas, 2017-01-24, issue #2429
-- Respect subtyping also for irrelevant lambdas!
-- Subtyping: (.A → B) ≤ (A → B)
-- Where a function is expected, we can put one which does not use its argument.
id : ∀{A B : Set} → (.A → B) → A → B
id f = f
test : ∀{A B : Set} → (.A → B) → A → B
test f = λ .a → f a
-- Should work!
-- The eta-expansion should not change anything!
|
tp04.asm | wjacoud/Assembly_Repo | 0 | 243531 | ; <NAME> - CODIGO XXXX
; Aluno 1:
; Aluno 2:
; Aluno 3:
.8086
.model small
.stack 2048
dseg segment para public 'data'
lin byte 2 ; VARIAVEIS...
col byte 3
alt byte 7
larg byte 5
dseg ends
cseg segment para public 'code'
assume cs:cseg, ds:dseg
main proc
mov ax, dseg
mov ds, ax
mov ax, 0B800h
mov es, ax
mov al, lin ;iniciar num local do ecra (linha/coluna)
mov bl, 160
mul bl
mov di, ax
mov al, col
mov bl, 2
mul bl
add di, ax
mov al, larg
mov bl, 2
mul bl
mov si; ax
add si, di
mov al, alt
mov bl, 2
div bl
mov bh, 01110100b
mov bl, ’+’
mov cx, al
ciclo1:
mov es:[di], bx
mov es:[si], bx
mov ah, 4ch
int 21h
main endp
cseg ends
end main |
programs/oeis/045/A045930.asm | neoneye/loda | 22 | 15117 | <gh_stars>10-100
; A045930: The generalized Connell sequence C_{3,5}.
; 1,2,5,8,11,14,17,18,21,24,27,30,33,36,39,42,45,48,49,52,55,58,61,64,67,70,73,76,79,82,85,88,91,94,95,98,101,104,107,110,113,116,119,122,125,128,131,134,137,140,143,146,149,152,155,156,159,162,165,168,171,174,177,180
mov $1,$0
seq $1,122799 ; A P_7-stuttered arithmetic progression with a(n+1)=a(n) if n is not a heptagonal number, a(n+1)=a(n)+2 otherwise.
add $0,$1
|
programs/oeis/160/A160805.asm | karttu/loda | 1 | 164713 | <filename>programs/oeis/160/A160805.asm
; A160805: a(n) = (2*n^3 + 9*n^2 + n + 24) / 6.
; 4,6,13,27,50,84,131,193,272,370,489,631,798,992,1215,1469,1756,2078,2437,2835,3274,3756,4283,4857,5480,6154,6881,7663,8502,9400,10359,11381,12468,13622,14845,16139,17506,18948,20467,22065,23744,25506,27353,29287,31310,33424,35631,37933,40332,42830,45429,48131,50938,53852,56875,60009,63256,66618,70097,73695,77414,81256,85223,89317,93540,97894,102381,107003,111762,116660,121699,126881,132208,137682,143305,149079,155006,161088,167327,173725,180284,187006,193893,200947,208170,215564,223131,230873,238792,246890,255169,263631,272278,281112,290135,299349,308756,318358,328157,338155,348354,358756,369363,380177,391200,402434,413881,425543,437422,449520,461839,474381,487148,500142,513365,526819,540506,554428,568587,582985,597624,612506,627633,643007,658630,674504,690631,707013,723652,740550,757709,775131,792818,810772,828995,847489,866256,885298,904617,924215,944094,964256,984703,1005437,1026460,1047774,1069381,1091283,1113482,1135980,1158779,1181881,1205288,1229002,1253025,1277359,1302006,1326968,1352247,1377845,1403764,1430006,1456573,1483467,1510690,1538244,1566131,1594353,1622912,1651810,1681049,1710631,1740558,1770832,1801455,1832429,1863756,1895438,1927477,1959875,1992634,2025756,2059243,2093097,2127320,2161914,2196881,2232223,2267942,2304040,2340519,2377381,2414628,2452262,2490285,2528699,2567506,2606708,2646307,2686305,2726704,2767506,2808713,2850327,2892350,2934784,2977631,3020893,3064572,3108670,3153189,3198131,3243498,3289292,3335515,3382169,3429256,3476778,3524737,3573135,3621974,3671256,3720983,3771157,3821780,3872854,3924381,3976363,4028802,4081700,4135059,4188881,4243168,4297922,4353145,4408839,4465006,4521648,4578767,4636365,4694444,4753006,4812053,4871587,4931610,4992124,5053131,5114633,5176632,5239130
mov $1,9
add $1,$0
add $1,$0
mul $1,$0
mul $1,$0
add $1,$0
div $1,6
add $1,4
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/renaming1.adb | best08618/asylo | 7 | 15711 | -- { dg-do compile}
-- { dg-options "-gnatwa" }
with Text_IO;
use Text_IO;
package body renaming1 is
procedure Fo (A : Text_IO.File_Access) is
begin
if A = Text_IO.Standard_Output then
null;
end if;
end Fo;
end;
|
awa/regtests/awa-events-services-tests.adb | Letractively/ada-awa | 0 | 17800 | -----------------------------------------------------------------------
-- events-tests -- Unit tests for AWA events
-- Copyright (C) 2012 <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.Test_Caller;
with Util.Beans.Methods;
with Util.Log.Loggers;
with Util.Measures;
with Util.Concurrent.Counters;
with EL.Beans;
with EL.Expressions;
with EL.Contexts.Default;
with ASF.Applications;
with ASF.Servlets.Faces;
with AWA.Applications;
with AWA.Applications.Configs;
with AWA.Applications.Factory;
with AWA.Events.Action_Method;
with AWA.Services.Contexts;
with AWA.Events.Queues;
with AWA.Events.Services;
package body AWA.Events.Services.Tests is
use AWA.Events.Services;
use Util.Log;
Log : constant Loggers.Logger := Loggers.Create ("AWA.Events.Tests");
package Event_Test_4 is new AWA.Events.Definition (Name => "event-test-4");
package Event_Test_1 is new AWA.Events.Definition (Name => "event-test-1");
package Event_Test_3 is new AWA.Events.Definition (Name => "event-test-3");
package Event_Test_2 is new AWA.Events.Definition (Name => "event-test-2");
package Event_Test_5 is new AWA.Events.Definition (Name => "event-test-5");
package Caller is new Util.Test_Caller (Test, "Events.Tests");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AWA.Events.Get_Event_Name",
Test_Get_Event_Name'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Find_Event_Index",
Test_Find_Event'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Initialize",
Test_Initialize'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Add_Action",
Test_Add_Action'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Dispatch_Synchronous",
Test_Dispatch_Synchronous'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Dispatch_Fifo",
Test_Dispatch_Fifo'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Dispatch_Persist",
Test_Dispatch_Persist'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Dispatch_Synchronous_Dyn",
Test_Dispatch_Synchronous_Dyn'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Dispatch_Synchronous_Raise",
Test_Dispatch_Synchronous_Raise'Access);
end Add_Tests;
type Action_Bean is new Util.Beans.Basic.Bean
and Util.Beans.Methods.Method_Bean with record
Count : Natural := 0;
Priority : Integer := 0;
Raise_Exception : Boolean := False;
end record;
type Action_Bean_Access is access all Action_Bean'Class;
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
overriding
function Get_Value (From : in Action_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
-- If the name cannot be found, the method should raise the No_Value
-- exception.
overriding
procedure Set_Value (From : in out Action_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
overriding
function Get_Method_Bindings (From : in Action_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
procedure Event_Action (From : in out Action_Bean;
Event : in AWA.Events.Module_Event'Class);
function Create_Action_Bean return Util.Beans.Basic.Readonly_Bean_Access;
package Event_Action_Binding is
new AWA.Events.Action_Method.Bind (Bean => Action_Bean,
Method => Event_Action,
Name => "send");
Binding_Array : aliased constant Util.Beans.Methods.Method_Binding_Array
:= (1 => Event_Action_Binding.Proxy'Access);
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
overriding
function Get_Value (From : in Action_Bean;
Name : in String) return Util.Beans.Objects.Object is
pragma Unreferenced (From, Name);
begin
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name.
-- If the name cannot be found, the method should raise the No_Value
-- exception.
-- ------------------------------
overriding
procedure Set_Value (From : in out Action_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "priority" then
From.Priority := Util.Beans.Objects.To_Integer (Value);
elsif Name = "raise_exception" then
From.Raise_Exception := Util.Beans.Objects.To_Boolean (Value);
end if;
end Set_Value;
overriding
function Get_Method_Bindings (From : in Action_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access is
pragma Unreferenced (From);
begin
return Binding_Array'Access;
end Get_Method_Bindings;
Action_Exception : exception;
Global_Counter : Util.Concurrent.Counters.Counter;
procedure Event_Action (From : in out Action_Bean;
Event : in AWA.Events.Module_Event'Class) is
pragma Unreferenced (Event);
begin
if From.Raise_Exception then
raise Action_Exception with "Raising an exception from the event action bean";
end if;
From.Count := From.Count + 1;
Util.Concurrent.Counters.Increment (Global_Counter);
end Event_Action;
function Create_Action_Bean return Util.Beans.Basic.Readonly_Bean_Access is
Result : constant Action_Bean_Access := new Action_Bean;
begin
return Result.all'Access;
end Create_Action_Bean;
-- ------------------------------
-- Test searching an event name in the definition list.
-- ------------------------------
procedure Test_Find_Event (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, Integer (Event_Test_4.Kind),
Integer (Find_Event_Index ("event-test-4")), "Find_Event");
Util.Tests.Assert_Equals (T, Integer (Event_Test_5.Kind),
Integer (Find_Event_Index ("event-test-5")), "Find_Event");
Util.Tests.Assert_Equals (T, Integer (Event_Test_1.Kind),
Integer (Find_Event_Index ("event-test-1")), "Find_Event");
end Test_Find_Event;
-- ------------------------------
-- Test the Get_Event_Type_Name internal operation.
-- ------------------------------
procedure Test_Get_Event_Name (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "event-test-1", Get_Event_Type_Name (Event_Test_1.Kind).all,
"Get_Event_Type_Name");
Util.Tests.Assert_Equals (T, "event-test-2", Get_Event_Type_Name (Event_Test_2.Kind).all,
"Get_Event_Type_Name");
Util.Tests.Assert_Equals (T, "event-test-3", Get_Event_Type_Name (Event_Test_3.Kind).all,
"Get_Event_Type_Name");
Util.Tests.Assert_Equals (T, "event-test-4", Get_Event_Type_Name (Event_Test_4.Kind).all,
"Get_Event_Type_Name");
Util.Tests.Assert_Equals (T, "event-test-5", Get_Event_Type_Name (Event_Test_5.Kind).all,
"Get_Event_Type_Name");
end Test_Get_Event_Name;
-- ------------------------------
-- Test creation and initialization of event manager.
-- ------------------------------
procedure Test_Initialize (T : in out Test) is
App : constant AWA.Applications.Application_Access := AWA.Tests.Get_Application;
Manager : Event_Manager;
begin
Manager.Initialize (App.all'Access);
T.Assert (Manager.Actions /= null, "Initialization failed");
end Test_Initialize;
-- ------------------------------
-- Test adding an action.
-- ------------------------------
procedure Test_Add_Action (T : in out Test) is
App : constant AWA.Applications.Application_Access := AWA.Tests.Get_Application;
Manager : Event_Manager;
Ctx : EL.Contexts.Default.Default_Context;
Action : constant EL.Expressions.Method_Expression
:= EL.Expressions.Create_Expression ("#{a.send}", Ctx);
Props : EL.Beans.Param_Vectors.Vector;
Queue : Queue_Ref;
Index : constant Event_Index := Find_Event_Index ("event-test-4");
begin
Manager.Initialize (App.all'Access);
Queue := AWA.Events.Queues.Create_Queue ("test", "fifo", Props, Ctx);
Manager.Add_Queue (Queue);
for I in 1 .. 10 loop
Manager.Add_Action (Event => "event-test-4",
Queue => Queue,
Action => Action,
Params => Props);
Util.Tests.Assert_Equals (T, 1, Integer (Manager.Actions (Index).Queues.Length),
"Add_Action failed");
end loop;
end Test_Add_Action;
-- ------------------------------
-- Test dispatching events
-- ------------------------------
procedure Dispatch_Event (T : in out Test;
Kind : in Event_Index;
Expect_Count : in Natural;
Expect_Prio : in Natural) is
Factory : AWA.Applications.Factory.Application_Factory;
Conf : ASF.Applications.Config;
Ctx : aliased EL.Contexts.Default.Default_Context;
Path : constant String := Util.Tests.Get_Test_Path ("regtests/config/event-test.xml");
Action : aliased Action_Bean;
begin
Conf.Set ("database", Util.Tests.Get_Parameter ("database"));
declare
App : aliased AWA.Tests.Test_Application;
S : Util.Measures.Stamp;
Faces : aliased ASF.Servlets.Faces.Faces_Servlet;
SC : AWA.Services.Contexts.Service_Context;
begin
App.Initialize (Conf => Conf,
Factory => Factory);
App.Set_Global ("event_test",
Util.Beans.Objects.To_Object (Action'Unchecked_Access,
Util.Beans.Objects.STATIC));
SC.Set_Context (App'Unchecked_Access, null);
App.Add_Servlet (Name => "faces", Server => Faces'Unchecked_Access);
App.Register_Class ("AWA.Events.Tests.Event_Action",
Create_Action_Bean'Access);
AWA.Applications.Configs.Read_Configuration (App => App,
File => Path,
Context => Ctx'Unchecked_Access);
Util.Measures.Report (S, "Initialize AWA application and read config");
App.Start;
Util.Measures.Report (S, "Start event tasks");
for I in 1 .. 100 loop
declare
Event : Module_Event;
begin
Event.Set_Event_Kind (Kind);
Event.Set_Parameter ("prio", "3");
Event.Set_Parameter ("template", "def");
App.Send_Event (Event);
end;
end loop;
Util.Measures.Report (S, "Send 100 events");
-- Wait for the dispatcher to process the events but do not wait more than 10 secs.
for I in 1 .. 10_000 loop
exit when Action.Count = Expect_Count;
delay 0.1;
end loop;
end;
Log.Info ("Action count: {0}", Natural'Image (Action.Count));
Log.Info ("Priority: {0}", Integer'Image (Action.Priority));
Util.Tests.Assert_Equals (T, Expect_Count, Action.Count,
"invalid number of calls for the action (global bean)");
Util.Tests.Assert_Equals (T, Expect_Prio, Action.Priority,
"prio parameter not transmitted (global bean)");
end Dispatch_Event;
-- ------------------------------
-- Test dispatching synchronous event to a global bean.
-- ------------------------------
procedure Test_Dispatch_Synchronous (T : in out Test) is
begin
T.Dispatch_Event (Event_Test_1.Kind, 500, 3);
end Test_Dispatch_Synchronous;
-- ------------------------------
-- Test dispatching event through a fifo queue.
-- ------------------------------
procedure Test_Dispatch_Fifo (T : in out Test) is
begin
T.Dispatch_Event (Event_Test_2.Kind, 200, 3);
end Test_Dispatch_Fifo;
-- ------------------------------
-- Test dispatching event through a database queue.
-- ------------------------------
procedure Test_Dispatch_Persist (T : in out Test) is
begin
T.Dispatch_Event (Event_Test_5.Kind, 100, 3);
end Test_Dispatch_Persist;
-- ------------------------------
-- Test dispatching synchronous event to a dynamic bean (created on demand).
-- ------------------------------
procedure Test_Dispatch_Synchronous_Dyn (T : in out Test) is
begin
T.Dispatch_Event (Event_Test_3.Kind, 0, 0);
end Test_Dispatch_Synchronous_Dyn;
-- ------------------------------
-- Test dispatching synchronous event to a dynamic bean and raise an exception in the action.
-- ------------------------------
procedure Test_Dispatch_Synchronous_Raise (T : in out Test) is
begin
T.Dispatch_Event (Event_Test_4.Kind, 0, 0);
end Test_Dispatch_Synchronous_Raise;
end AWA.Events.Services.Tests;
|
vdc_font_spacing.asm | wiebow/examples.128 | 3 | 100851 | <reponame>wiebow/examples.128
// kick assembler, c128 tests
#import "c128system.asm"
#import "c128macros.asm"
:BasicUpstart128(MAIN) // I like to use : to indicate a macro call.
MAIN:
:SetBankConfiguration(15) // set bank 15
:SetVDCUpdateAddress($0000)
ldy #0 // loop counter
lda #$01 // char code 01
ldx #31 // internal data register of the VCD.
// all data to VDC must flow trough this register.
!:
jsr WRITE_VDC
dey
bne !-
// char total (spacing)
ldx #22
lda #%10110110 // 1011 - 11 0110
jsr WRITE_VDC
ldx #9
lda #11 // vertical spacing of char to 12.
jsr WRITE_VDC
rts
// assemble sub routines.
WRITE_VDC:
:WriteVDC()
rts
READ_VDC:
:ReadVDC()
rts
|
lib/Phase1/testWrite.asm | prafgup/risc_v_assembler | 2 | 10592 | addi x2 x1 5
add x3 x2 x1
sub x3 x2 x1 |
base/hals/halacpi/i386/ixclock.asm | npocmaka/Windows-Server-2003 | 17 | 8228 | <filename>base/hals/halacpi/i386/ixclock.asm
title "Interval Clock Interrupt"
;++
;
; Copyright (c) 1989 Microsoft Corporation
;
; Module Name:
;
; ixclock.asm
;
; Abstract:
;
; This module implements the code necessary to field and process the
; interval clock interrupt.
;
; Author:
;
; <NAME> (shielint) 12-Jan-1990
;
; Environment:
;
; Kernel mode only.
;
; Revision History:
;
; bryanwi 20-Sep-90
;
; Add KiSetProfileInterval, KiStartProfileInterrupt,
; KiStopProfileInterrupt procedures.
; KiProfileInterrupt ISR.
; KiProfileList, KiProfileLock are delcared here.
;
; shielint 10-Dec-90
; Add performance counter support.
; Move system clock to irq8, ie we now use RTC to generate system
; clock. Performance count and Profile use timer 1 counter 0.
; The interval of the irq0 interrupt can be changed by
; KiSetProfileInterval. Performance counter does not care about the
; interval of the interrupt as long as it knows the rollover count.
; Note: Currently I implemented 1 performance counter for the whole
; i386 NT.
;
; <NAME> (jvert) 11-Jul-1991
; Moved from ke\i386 to hal\i386. Removed non-HAL stuff
;
; <NAME> (shielint) 13-March-92
; Move System clock back to irq0 and use RTC (irq8) to generate
; profile interrupt. Performance counter and system clock use time1
; counter 0 of 8254.
;
; <NAME> (corollary!landy) 04-Dec-92
; Move much code into separate modules for easy inclusion by various
; HAL builds.
;
;--
.386p
.xlist
include hal386.inc
include callconv.inc ; calling convention macros
include i386\ix8259.inc
include i386\kimacro.inc
include mac386.inc
include i386\ixcmos.inc
.list
EXTRNP _KeUpdateSystemTime,0
EXTRNP Kei386EoiHelper,0,IMPORT
EXTRNP _KeSetTimeIncrement,2,IMPORT
EXTRNP _HalEndSystemInterrupt,2
EXTRNP _HalBeginSystemInterrupt,3
EXTRNP _HalpReleaseCmosSpinLock ,0
EXTRNP _HalpMcaQueueDpc, 0
EXTRNP _HalpBrokenPiix4TimerTick, 0
extrn _HalpBrokenAcpiTimer:byte
extrn _QueryTimer:DWORD
extrn _KdEnteredDebugger:DWORD
extrn _HalpTimerWatchdogEnabled:DWORD
extrn _HalpTimerWatchdogStorage:DWORD
extrn _HalpTimerWatchdogCurFrame:DWORD
extrn _HalpTimerWatchdogLastFrame:DWORD
extrn _HalpTimerWatchdogStorageOverflow:DWORD
;
; Constants used to initialize timer 0
;
TIMER1_DATA_PORT0 EQU 40H ; Timer1, channel 0 data port
TIMER1_CONTROL_PORT0 EQU 43H ; Timer1, channel 0 control port
TIMER2_DATA_PORT0 EQU 48H ; Timer1, channel 0 data port
TIMER2_CONTROL_PORT0 EQU 4BH ; Timer1, channel 0 control port
TIMER1_IRQ EQU 0 ; Irq 0 for timer1 interrupt
COMMAND_8254_COUNTER0 EQU 00H ; Select count 0
COMMAND_8254_RW_16BIT EQU 30H ; Read/Write LSB firt then MSB
COMMAND_8254_MODE2 EQU 4 ; Use mode 2
COMMAND_8254_BCD EQU 0 ; Binary count down
COMMAND_8254_LATCH_READ EQU 0 ; Latch read command
PERFORMANCE_FREQUENCY EQU 1193182
COUNTER_TICKS_AVG_SHIFT EQU 4
COUNTER_TICKS_FOR_AVG EQU 16
PAGE_SIZE EQU 1000H
FRAME_COPY_SIZE EQU 64
;
; ==== Values used for System Clock ====
;
_DATA SEGMENT DWORD PUBLIC 'DATA'
;
; The following array stores the per microsecond loop count for each
; central processor.
;
;
; 8254 performance counter.
;
public HalpCurrentRollOver, HalpCurrentTimeIncrement, _HalpCurrentMSRateTableIndex
HalpCurrentRollOver dd 0
HalpCurrentTimeIncrement dd 0
_HalpCurrentMSRateTableIndex dd 0
public _HalpClockWork, _HalpClockSetMSRate, _HalpClockMcaQueueDpc
_HalpClockWork label dword
_HalpClockSetMSRate db 0
_HalpClockMcaQueueDpc db 0
_bReserved1 db 0
_bReserved2 db 0
;
; timer latency watchdog variables
;
public _HalpWatchdogAvgCounter, _HalpWatchdogCountLow, _HalpWatchdogCountHigh
public _HalpWatchdogTscLow, _HalpWatchdogTscHigh
_HalpWatchdogAvgCounter dd 0
_HalpWatchdogCountLow dd 0
_HalpWatchdogCountHigh dd 0
_HalpWatchdogTscLow dd 0
_HalpWatchdogTscHigh dd 0
_DATA ends
_TEXT SEGMENT DWORD PUBLIC 'DATA'
;
; Convert the interval to rollover count for 8254 Timer1 device.
; Timer1 counts down a 16 bit value at a rate of 1.193181667M counts-per-sec.
; (The main crystal freq is 14.31818, and this is a divide by 12)
;
; The best fit value closest to 10ms is 10.0144012689ms:
; ROLLOVER_COUNT 11949
; TIME_INCREMENT 100144
; Calculated error is -.0109472 s/day
;
;
; The following table contains 8254 values timer values to use at
; any given ms setting from 1ms - 15ms. All values work out to the
; same error per day (-.0109472 s/day).
;
public HalpRollOverTable
; RollOver Time
; Count Increment MS
HalpRollOverTable dd 1197, 10032 ; 1 ms
dd 2394, 20064 ; 2 ms
dd 3591, 30096 ; 3 ms
dd 4767, 39952 ; 4 ms
dd 5964, 49984 ; 5 ms
dd 7161, 60016 ; 6 ms
dd 8358, 70048 ; 7 ms
dd 9555, 80080 ; 8 ms
dd 10731, 89936 ; 9 ms
dd 11949, 100144 ; 10 ms
dd 13125, 110000 ; 11 ms
dd 14322, 120032 ; 12 ms
dd 15519, 130064 ; 13 ms
dd 16695, 139920 ; 14 ms
dd 17892, 149952 ; 15 ms
TimeIncr equ 4
RollOver equ 0
_TEXT ends
_DATA SEGMENT DWORD PUBLIC 'DATA'
public HalpLargestClockMS, _HalpNextMSRate, HalpPendingMSRate
HalpLargestClockMS dd 15 ; Table goes to 15MS
_HalpNextMSRate dd 14
HalpPendingMSRate dd 0
extrn _TimerInfo:DWORD
BiasLow equ 20
BiasHigh equ 24
_DATA ends
PAGELK SEGMENT DWORD PUBLIC 'CODE'
ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING
page ,132
subttl "Initialize Clock"
;++
;
; VOID
; HalpInitializeClock (
; )
;
; Routine Description:
;
; This routine initialize system time clock using 8254 timer1 counter 0
; to generate an interrupt at every 15ms interval at 8259 irq0.
;
; See the definitions of TIME_INCREMENT and ROLLOVER_COUNT if clock rate
; needs to be changed.
;
; Arguments:
;
; None
;
; Return Value:
;
; None.
;
;--
cPublicProc _HalpInitializeClock ,0
mov eax, PCR[PcPrcb]
cmp byte ptr [eax].PbCpuType, 4 ; 486 or better?
jc short @f ; no, skip
mov HalpLargestClockMS, 10 ; Limit 486's to 10MS
mov _HalpNextMSRate, 9
@@:
mov eax, HalpLargestClockMS
mov _HalpCurrentMSRateTableIndex, eax
dec _HalpCurrentMSRateTableIndex
mov ecx, HalpRollOverTable.TimeIncr
mov edx, HalpRollOverTable[eax*8-8].TimeIncr
mov eax, HalpRollOverTable[eax*8-8].RollOver
mov HalpCurrentTimeIncrement, edx
;
; (ecx) = Min time_incr
; (edx) = Max time_incr
; (eax) = max roll over count
;
push eax
stdCall _KeSetTimeIncrement, <edx, ecx>
pop ecx
;
; timer latency watchdog initialization
;
cmp _HalpTimerWatchdogEnabled, 0
jz short @f
.586p
rdtsc
.386p
mov _HalpWatchdogAvgCounter, COUNTER_TICKS_FOR_AVG
mov _HalpWatchdogTscLow, eax
mov _HalpWatchdogTscHigh, edx
xor eax, eax
mov _HalpWatchdogCountLow, eax
mov _HalpWatchdogCountHigh, eax
@@:
pushfd ; save caller's eflag
cli ; make sure interrupts are disabled
;
; Set clock rate
; (ecx) = RollOverCount
;
mov al,COMMAND_8254_COUNTER0+COMMAND_8254_RW_16BIT+COMMAND_8254_MODE2
out TIMER1_CONTROL_PORT0, al ;program count mode of timer 0
IoDelay
mov al, cl
out TIMER1_DATA_PORT0, al ; program timer 0 LSB count
IoDelay
mov al,ch
out TIMER1_DATA_PORT0, al ; program timer 0 MSB count
popfd ; restore caller's eflag
mov HalpCurrentRollOver, ecx ; Set RollOverCount & initialized
stdRET _HalpInitializeClock
stdENDP _HalpInitializeClock
PAGELK ends
_TEXT$03 SEGMENT DWORD PUBLIC 'CODE'
ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING
page ,132
subttl "System Clock Interrupt"
;++
;
; Routine Description:
;
; This routine is entered as the result of an interrupt generated by CLOCK.
; Its function is to dismiss the interrupt, raise system Irql to
; CLOCK2_LEVEL, update performance counter and transfer control to the
; standard system routine to update the system time and the execution
; time of the current thread
; and process.
;
; Arguments:
;
; None
; Interrupt is disabled
;
; Return Value:
;
; Does not return, jumps directly to KeUpdateSystemTime, which returns
;
; Sets Irql = CLOCK2_LEVEL and dismisses the interrupt
;
;--
ENTER_DR_ASSIST Hci_a, Hci_t
cPublicProc _HalpClockInterrupt ,0
;
; Save machine state in trap frame
;
ENTER_INTERRUPT Hci_a, Hci_t
;
; (esp) - base of trap frame
;
ifdef MCA
;
; Special hack for MCA machines
;
in al, 61h
jmp $+2
or al, 80h
out 61h, al
jmp $+2
endif ; MCA
;
; Dismiss interrupt and raise irq level to clock2 level
;
Hci10:
push CLOCK_VECTOR
sub esp, 4 ; allocate space to save OldIrql
stdCall _HalBeginSystemInterrupt, <CLOCK2_LEVEL, CLOCK_VECTOR, esp>
or al,al ; check for spurious interrupt
jz Hci100
;
; Check to see if we need to fix up a broken PIIX4
;
.if (_HalpBrokenAcpiTimer)
stdCall _HalpBrokenPiix4TimerTick
.endif
;
; Timer latency watchdog
;
cmp _HalpTimerWatchdogEnabled, 0
jz Hci14
.586p
rdtsc
.386p
;
; Compare difference to watchdog count, while storing a copy of the
; current counter.
;
xor ebx, ebx
push eax
push edx
sub eax, _HalpWatchdogTscLow
sbb edx, _HalpWatchdogTscHigh
pop _HalpWatchdogTscHigh
pop _HalpWatchdogTscLow
js Hci115 ; Was this a bogus counter?
; (e.g, negative delta)
push eax
mov ecx, dword ptr _KdEnteredDebugger
xor eax, eax
xchg eax, [ecx]
or al, al
pop eax
jnz Hci14
cmp HalpPendingMSRate, ebx ; Was a new rate set during last
jnz Hci14 ; tick? Yes, skip this compare
;
; If we need to compute the average of the time-stamp counter for
; the current period, add the delta to the counter.
;
cmp _HalpWatchdogAvgCounter, ebx
jnz Hci12
cmp edx, _HalpWatchdogCountHigh
ja short Hci11
jb Hci14
cmp eax, _HalpWatchdogCountLow
jbe Hci14
Hci11:
cmp dword ptr [_HalpTimerWatchdogStorageOverflow], 0
jne short Hci115
;
; copy FRAME_COPY_SIZE dwords from the stack, or to next page boundary,
; whichever is less
;
push esi
push edi
lea esi, [esp + 8]
lea ecx, [esi + PAGE_SIZE - 1]
and ecx, NOT(PAGE_SIZE - 1)
sub ecx, esi
shr ecx, 2
cmp ecx, FRAME_COPY_SIZE
jbe short Hci111
mov ecx, FRAME_COPY_SIZE
Hci111:
mov edi, dword ptr _HalpTimerWatchdogCurFrame
rep movsd
add dword ptr _HalpTimerWatchdogCurFrame, (FRAME_COPY_SIZE*4)
;
; If we didn't copy an entire FRAME_COPY_SIZE dwords, zero fill.
;
mov ecx, dword ptr _HalpTimerWatchdogCurFrame
sub ecx, edi
shr ecx, 2
xor eax, eax
rep stosd
cmp edi, dword ptr _HalpTimerWatchdogLastFrame
jbe short Hci112
mov dword ptr [_HalpTimerWatchdogStorageOverflow], 1
Hci112:
pop edi
pop esi
Hci115:
;
; reset last time so that we're accurate after the trap
;
.586p
rdtsc
.386p
mov _HalpWatchdogTscHigh, edx
mov _HalpWatchdogTscLow, eax
jmp short Hci14
Hci12:
;
; Increment the total counter, perform average when the count is reached
;
add _HalpWatchdogCountLow, eax
adc _HalpWatchdogCountHigh, edx
dec _HalpWatchdogAvgCounter
jnz short Hci14
mov edx, _HalpWatchdogCountHigh
mov eax, _HalpWatchdogCountLow
;
; compute the average * 2, this measures when we have missed
; an interrupt at this rate.
;
mov ecx, COUNTER_TICKS_AVG_SHIFT - 1
Hci13:
shr edx, 1
rcr eax, 1
loop short Hci13
mov _HalpWatchdogCountLow, eax
mov _HalpWatchdogCountHigh, edx
Hci14:
;
; Check for any more work
;
mov eax, HalpCurrentTimeIncrement
xor ebx, ebx
cmp _HalpClockWork, ebx ; Any clock interrupt work desired?
jz _KeUpdateSystemTime@0 ; No, process tick
cmp _HalpClockMcaQueueDpc, bl
je short Hci20
mov _HalpClockMcaQueueDpc, bl
;
; Queue MCA Dpc
;
push eax
stdCall _HalpMcaQueueDpc ; Queue MCA Dpc
pop eax
Hci20:
;
; (esp) = OldIrql
; (esp+4) = Vector
; (esp+8) = base of trap frame
; ebp = trap frame
; eax = time increment
; ebx = 0
;
cmp _HalpClockSetMSRate, bl ; New clock rate desired?
jz _KeUpdateSystemTime@0 ; No, process tick
;
; Time of clock frequency is being changed. See if the 8254 was
; was reprogrammed for a new rate during last tick
;
cmp HalpPendingMSRate, ebx ; Was a new rate set durning last
jnz short Hci50 ; tick? Yes, go update globals
Hci40:
; (eax) = time increment for current tick
;
; A new clock rate needs to be set. Setting the rate here will
; cause the tick after the next tick to be at the new rate.
; (the next tick is already in progress by the 8254 and will occur
; at the same rate as this tick)
;
mov ebx, _HalpNextMSRate
mov HalpPendingMSRate, ebx ; pending rate
mov ecx, HalpRollOverTable[ebx*8-8].RollOver
;
; Set clock rate
; (ecx) = RollOverCount
;
push eax ; save current tick's rate
mov al,COMMAND_8254_COUNTER0+COMMAND_8254_RW_16BIT+COMMAND_8254_MODE2
out TIMER1_CONTROL_PORT0, al ;program count mode of timer 0
IoDelay
mov al, cl
out TIMER1_DATA_PORT0, al ; program timer 0 LSB count
IoDelay
mov al,ch
out TIMER1_DATA_PORT0, al ; program timer 0 MSB count
pop eax
;
; (esp) = OldIrql
; (esp+4) = Vector
; (esp+8) = base of trap frame
; ebp = trap frame
; eax = time increment
;
jmp _KeUpdateSystemTime@0 ; dispatch this tick
Hci50:
;
; The next tick will occur at the rate which was programmed during the last
; tick. Update globals for new rate which starts with the next tick.
;
; (eax) = time increment for current tick
;
mov ebx, HalpPendingMSRate
mov _HalpCurrentMSRateTableIndex, ebx
dec _HalpCurrentMSRateTableIndex
mov ecx, HalpRollOverTable[ebx*8-8].RollOver
mov edx, HalpRollOverTable[ebx*8-8].TimeIncr
mov HalpCurrentRollOver, ecx
mov HalpCurrentTimeIncrement, edx ; next tick rate
mov HalpPendingMSRate, 0 ; no longer pending, clear it
cmp _HalpTimerWatchdogEnabled, 0
jz short @f
;
; Schedule to recalibrate watchdog counter
;
push eax
.586p
rdtsc
.386p
mov _HalpWatchdogAvgCounter, COUNTER_TICKS_FOR_AVG
mov _HalpWatchdogTscLow, eax
mov _HalpWatchdogTscHigh, edx
xor eax,eax
mov _HalpWatchdogCountHigh, eax
mov _HalpWatchdogCountLow, eax
pop eax
@@:
cmp ebx, _HalpNextMSRate ; new rate == NextRate?
jne Hci40 ; no, go set new pending rate
mov _HalpClockSetMSRate, 0 ; all done setting new rate
jmp _KeUpdateSystemTime@0 ; dispatch this tick
Hci100:
add esp, 8 ; spurious, no EndOfInterrupt
SPURIOUS_INTERRUPT_EXIT ; exit interrupt without eoi
stdENDP _HalpClockInterrupt
;++
;
; ULONG
; HalpAcpiTimerSetTimeIncrement (
; IN ULONG DesiredIncrement
; )
;
; /*++
;
; Routine Description:
;
; This routine initialize system time clock to generate an
; interrupt at every DesiredIncrement interval.
;
; Arguments:
;
; DesiredIncrement - desired interval between every timer tick (in
; 100ns unit.)
;
; Return Value:
;
; The *REAL* time increment set.
;--
cPublicProc _HalpAcpiTimerSetTimeIncrement,1
mov eax, [esp+4] ; desired setting
xor edx, edx
mov ecx, 9990
div ecx ; round to MS
cmp eax, HalpLargestClockMS ; MS > max?
jc short @f
mov eax, HalpLargestClockMS ; yes, use max
@@:
or eax, eax ; MS < min?
jnz short @f
inc eax ; yes, use min
@@:
mov _HalpNextMSRate, eax
mov _HalpClockSetMSRate, 1 ; New clock rate desired.
mov eax, HalpRollOverTable[eax*8-8].TimeIncr
stdRET _HalpAcpiTimerSetTimeIncrement
stdENDP _HalpAcpiTimerSetTimeIncrement
page ,132
subttl "Query 8254 Counter"
;++
;
; ULONG
; HalpQuery8254Counter(
; VOID
; )
;
; Routine Description:
;
; This routine returns the current value of the 8254 counter
;
; Arguments:
;
; None
;
; Return Value:
;
; Current value of the 8254 counter is returned
;
;--
cPublicProc _HalpQuery8254Counter, 0
pushfd
cli
;
; Fetch the current counter value from the hardware
;
mov al, COMMAND_8254_LATCH_READ + COMMAND_8254_COUNTER0
; Latch PIT Ctr 0 command.
out TIMER1_CONTROL_PORT0, al
IODelay
in al, TIMER1_DATA_PORT0 ; Read PIT Ctr 0, LSByte.
IODelay
movzx ecx, al ; Zero upper bytes of (ECX).
in al, TIMER1_DATA_PORT0 ; Read PIT Ctr 0, MSByte.
mov ch, al ; (CX) = PIT Ctr 0 count.
mov eax, ecx
popfd ; restore interrupt flag
stdRET _HalpQuery8254Counter
stdENDP _HalpQuery8254Counter
_TEXT$03 ends
end
|
Lambda.agda | nad/codata | 1 | 17161 | <gh_stars>1-10
------------------------------------------------------------------------
-- An investigation of various ways to define the semantics of an
-- untyped λ-calculus and a virtual machine, and a discussion of
-- type soundness and compiler correctness
--
-- <NAME>
------------------------------------------------------------------------
module Lambda where
-- Syntax and type system for an untyped λ-calculus.
import Lambda.Syntax
------------------------------------------------------------------------
-- Semantics based on substitutions
-- Substitutions.
import Lambda.Substitution
-- A big-step semantics for the language. Conditional coinduction is
-- used to avoid duplication of rules.
--
-- Cousot and Cousot give a similar definition in "Bi-inductive
-- structural semantics", and their definition inspired this one.
-- Their definition has almost the same rules, but these rules are
-- interpreted in the framework of bi-induction rather than the
-- framework of mixed induction and (conditional) coinduction.
import Lambda.Substitution.OneSemantics
-- Two separate semantics for the language, one for converging terms
-- and the other for diverging terms, as given by Leroy and Grall in
-- "Coinductive big-step operational semantics".
--
-- Leroy and Grall attempted to unify their two semantics into a
-- single one, using only coinduction, but failed to find a definition
-- which was equivalent to the two that they started with. However,
-- they aimed for a definition which did not have more rules than the
-- definition for converging terms; the definition in OneSemantics
-- does not satisfy this criterion.
import Lambda.Substitution.TwoSemantics
-- The two definitions are equivalent.
import Lambda.Substitution.Equivalence
-- A functional semantics, along with a type soundness proof.
import Lambda.Substitution.Functional
------------------------------------------------------------------------
-- Virtual machine
-- A virtual machine with two semantics (one relational and one
-- functional), a compiler from the λ-calculus defined above into the
-- language of the virtual machine, and a proof showing that the two
-- semantics are equivalent.
import Lambda.VirtualMachine
------------------------------------------------------------------------
-- Semantics based on closures
-- A semantics for the untyped λ-calculus, based on closures and
-- environments, as given by Leroy and Grall in "Coinductive big-step
-- operational semantics" (more or less).
--
-- The module also contains a proof which shows that the compiler in
-- Lambda.VirtualMachine preserves the semantics (assuming that the
-- virtual machine is deterministic). Leroy and Grall prove almost the
-- same thing. In their proof they use a relation indexed by a natural
-- number to work around limitations in Coq's productivity checker.
-- Agda has similar limitations, but I work around them using mixed
-- induction/coinduction, which in my opinion is more elegant. I am
-- not sure if my workaround would work in Coq, though.
import Lambda.Closure.Relational
-- A semantics for the untyped λ-calculus which uses the partiality
-- monad, along with another compiler correctness proof. An advantage
-- of formulating the semantics in this way is that it is very easy to
-- state compiler correctness.
import Lambda.Closure.Functional
-- The module above uses some workarounds in order to convince Agda
-- that the code is productive. The following module contains (more or
-- less) the same code without the workarounds, but is checked with
-- the termination checker turned off.
import Lambda.Closure.Functional.No-workarounds
-- The relational and functional semantics are equivalent.
import Lambda.Closure.Equivalence
-- An alternative definition of the functional semantics. This
-- definition uses continuation-passing style instead of bind.
import Lambda.Closure.Functional.Alternative
-- A definition of a type system (with recursive types) for the
-- λ-calculus given above, and a proof of type soundness for the
-- functional semantics.
import Lambda.Closure.Functional.Type-soundness
-- A very brief treatment of different kinds of term equivalences,
-- including contextual equivalence and applicative bisimilarity.
import Lambda.Closure.Equivalences
-- A functional semantics, a compiler and a compiler correctness
-- proof, and a type soundness proof for a non-deterministic untyped
-- λ-calculus with constants.
import Lambda.Closure.Functional.Non-deterministic
-- A variant of the code above without the workarounds used to
-- convince Agda that the code is productive.
import Lambda.Closure.Functional.Non-deterministic.No-workarounds
|
oeis/037/A037496.asm | neoneye/loda-programs | 11 | 80340 | <filename>oeis/037/A037496.asm
; A037496: Base-3 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,2.
; Submitted by <NAME>
; 1,3,11,34,102,308,925,2775,8327,24982,74946,224840,674521,2023563,6070691,18212074,54636222,163908668,491726005,1475178015,4425534047,13276602142,39829806426,119489419280,358468257841,1075404773523
mov $2,1
lpb $0
sub $0,1
add $1,$2
mul $1,3
add $2,20
mod $2,3
lpe
add $1,$2
mov $0,$1
|
src/kernel/x86.asm | TheDarkBomber/apiofirm | 4 | 4705 | global x86Input
x86Input:
[bits 32]
mov dx, [esp + 4]
xor eax, eax
in al, dx
ret
global x86Output
x86Output:
[bits 32]
mov dx, [esp + 4]
mov al, [esp + 8]
out dx, al
ret
global x86ReadCR0
x86ReadCR0:
[bits 32]
mov eax, cr0
ret
global x86WriteCR0
x86WriteCR0:
[bits 32]
push ebp
mov ebp, esp
mov eax, [ebp + 8]
mov cr0, eax
pop ebp
ret
global x86ReadCR2
x86ReadCR2:
[bits 32]
mov eax, cr2
ret
global x86WriteCR2
x86WriteCR2:
[bits 32]
push ebp
mov ebp, esp
mov eax, [ebp + 8]
mov cr2, eax
pop ebp
ret
global x86ReadCR3
x86ReadCR3:
[bits 32]
mov eax, cr3
ret
global x86WriteCR3
x86WriteCR3:
[bits 32]
push ebp
mov ebp, esp
mov eax, [ebp + 8]
mov cr3, eax
pop ebp
ret
global x86ReadEFLAGS
x86ReadEFLAGS:
[bits 32]
pushf
pop eax
ret
|
programs/oeis/212/A212069.asm | karttu/loda | 0 | 7542 | <filename>programs/oeis/212/A212069.asm<gh_stars>0
; A212069: Number of (w,x,y,z) with all terms in {1,...,n} and 3*w = x+y+z.
; 0,1,2,9,22,41,72,115,170,243,334,443,576,733,914,1125,1366,1637,1944,2287,2666,3087,3550,4055,4608,5209,5858,6561,7318,8129,9000,9931,10922,11979,13102,14291,15552,16885,18290,19773,21334,22973
mov $12,$0
mov $14,$0
lpb $14,1
clr $0,12
mov $0,$12
sub $14,1
sub $0,$14
mov $9,$0
mov $11,$0
lpb $11,1
mov $0,$9
sub $11,1
sub $0,$11
mov $2,$0
mul $0,2
div $2,2
mov $5,6
mov $7,6
lpb $2,1
div $0,6
mod $2,2
div $2,5
add $5,$7
mul $0,$5
lpe
mov $1,$0
div $1,2
add $10,$1
lpe
add $13,$10
lpe
mov $1,$13
|
oeis/029/A029549.asm | neoneye/loda-programs | 11 | 174802 | ; A029549: a(n + 3) = 35*a(n + 2) - 35*a(n + 1) + a(n), with a(0) = 0, a(1) = 6, a(2) = 210.
; 0,6,210,7140,242556,8239770,279909630,9508687656,323015470680,10973017315470,372759573255306,12662852473364940,430164224521152660,14612920781245825506,496409142337836914550,16863297918705209269200,572855720093639278238256,19460231185265030250831510,661075004578917389250033090,22457089924497926204250293556,762879982428350573555259947820,25915462312639421574674587932330,880362838647311982965380729751406,29906421051695967999248270223615480,1015937952919015599991475806873174920
seq $0,2315 ; NSW numbers: a(n) = 6*a(n-1) - a(n-2); also a(n)^2 - 2*b(n)^2 = -1 with b(n)=A001653(n+1).
pow $0,2
div $0,8
|
Time and Date/Tomorrows Date.applescript | rogues-gallery/applescript | 360 | 2374 | <filename>Time and Date/Tomorrows Date.applescript
set morrow to current date
set morrow to morrow + days
set the clipboard to (do shell script "echo " & morrow & " | sed s/,[^,]*$//")
|
tools/druss-commands-wifi.adb | stcarrez/bbox-ada-api | 2 | 5635 | -----------------------------------------------------------------------
-- druss-commands-wifi -- Wifi related commands
-- Copyright (C) 2017, 2018, 2019, 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.Strings.Unbounded;
with Bbox.API;
package body Druss.Commands.Wifi is
use Ada.Strings.Unbounded;
-- ------------------------------
-- Enable or disable with wifi radio.
-- ------------------------------
procedure Do_Enable (Command : in Command_Type;
Args : in Argument_List'Class;
Context : in out Context_Type) is
procedure Radio (Gateway : in out Druss.Gateways.Gateway_Type;
State : in String);
procedure Radio (Gateway : in out Druss.Gateways.Gateway_Type;
State : in String) is
Box : Bbox.API.Client_Type;
begin
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.Put ("wireless", (if State = "on" then "radio.enable=1" else "radio.enable=0"));
end Radio;
begin
Druss.Commands.Gateway_Command (Command, Args, 1, Radio'Access, Context);
end Do_Enable;
-- ------------------------------
-- Execute the wifi 'status' command to print the Wifi current status.
-- ------------------------------
procedure Do_Status (Command : in Command_Type;
Args : in Argument_List'Class;
Context : in out Context_Type) is
pragma Unreferenced (Command, Args);
procedure Wifi_Status (Gateway : in out Druss.Gateways.Gateway_Type);
Console : constant Druss.Commands.Consoles.Console_Access := Context.Console;
procedure Wifi_Status (Gateway : in out Druss.Gateways.Gateway_Type) is
begin
Gateway.Refresh;
Console.Start_Row;
Console.Print_Field (F_IP_ADDR, Gateway.Ip);
Print_On_Off (Console, F_BOOL, Gateway.Wifi.Get ("wireless.radio.24.enable", " "));
Console.Print_Field (F_CHANNEL, Gateway.Wifi.Get ("wireless.radio.24.current_channel", " "));
Console.Print_Field (F_SSID, Gateway.Wifi.Get ("wireless.ssid.24.id", " "));
Console.Print_Field (F_PROTOCOL, Gateway.Wifi.Get ("wireless.ssid.24.security.protocol", " "));
Console.Print_Field (F_ENCRYPTION, Gateway.Wifi.Get ("wireless.ssid.24.security.encryption", " "));
Console.Print_Field (F_DEVICES, Gateway.Hosts.Get ("hosts.list.length", ""));
Console.End_Row;
if not Gateway.Wifi.Exists ("wireless.radio.5.enable") then
return;
end if;
Console.Start_Row;
Console.Print_Field (F_IP_ADDR, To_String (Gateway.Ip));
Print_On_Off (Console, F_BOOL, Gateway.Wifi.Get ("wireless.radio.5.enable", " "));
Console.Print_Field (F_CHANNEL, Gateway.Wifi.Get ("wireless.radio.5.current_channel", " "));
Console.Print_Field (F_SSID, Gateway.Wifi.Get ("wireless.ssid.5.id", " "));
Console.Print_Field (F_PROTOCOL, Gateway.Wifi.Get ("wireless.ssid.5.security.protocol", " "));
Console.Print_Field (F_ENCRYPTION, Gateway.Wifi.Get ("wireless.ssid.5.security.encryption", " "));
Console.End_Row;
end Wifi_Status;
begin
Console.Start_Title;
Console.Print_Title (F_IP_ADDR, "Bbox IP", 15);
Console.Print_Title (F_BOOL, "Enable", 8);
Console.Print_Title (F_CHANNEL, "Channel", 8);
Console.Print_Title (F_SSID, "SSID", 20);
Console.Print_Title (F_PROTOCOL, "Protocol", 12);
Console.Print_Title (F_ENCRYPTION, "Encryption", 12);
Console.Print_Title (F_DEVICES, "Devices", 12);
Console.End_Title;
Druss.Gateways.Iterate (Context.Gateways, Gateways.ITER_ENABLE, Wifi_Status'Access);
end Do_Status;
-- ------------------------------
-- Execute a command to control or get status about the Wifi.
-- ------------------------------
overriding
procedure Execute (Command : in out Command_Type;
Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type) is
pragma Unreferenced (Name);
begin
if Args.Get_Count = 0 then
Command.Do_Status (Args, Context);
elsif Args.Get_Argument (1) in "on" | "off" then
Command.Do_Enable (Args, Context);
elsif Args.Get_Argument (1) = "show" then
Command.Do_Status (Args, Context);
else
Context.Console.Notice (N_USAGE, "Invalid sub-command: " & Args.Get_Argument (1));
Druss.Commands.Driver.Usage (Args, Context);
end if;
end Execute;
-- ------------------------------
-- Write the help associated with the command.
-- ------------------------------
overriding
procedure Help (Command : in out Command_Type;
Name : in String;
Context : in out Context_Type) is
pragma Unreferenced (Command);
Console : constant Druss.Commands.Consoles.Console_Access := Context.Console;
begin
Console.Notice (N_HELP, "wifi: Control and get status about the Bbox Wifi");
Console.Notice (N_HELP, "Usage: wifi {<action>} [<parameters>]");
Console.Notice (N_HELP, "");
Console.Notice (N_HELP, " wifi on [IP]... Turn ON the wifi on the Bbox.");
Console.Notice (N_HELP, " wifi off [IP]... Turn OFF the wifi on the Bbox.");
Console.Notice (N_HELP, " wifi show Show information about the wifi on the Bbox.");
Console.Notice (N_HELP, " wifi devices Show the wifi devices which are connected.");
end Help;
end Druss.Commands.Wifi;
|
test/examples/Project/wps.ads | fintatarta/protypo | 0 | 23409 | package WPs is
type WP_Type is null record;
end WPs;
|
alloy4fun_models/trainstlt/models/5/GfJ3oS684tFZid3nt.als | Kaixi26/org.alloytools.alloy | 0 | 4026 | open main
pred idGfJ3oS684tFZid3nt_prop6 {
always one s : Signal | (s in Green implies s' not in Green) or
(s not in Green implies s' in Green)
}
pred __repair { idGfJ3oS684tFZid3nt_prop6 }
check __repair { idGfJ3oS684tFZid3nt_prop6 <=> prop6o } |
source/adam-comment.ads | charlie5/aIDE | 3 | 1025 | <filename>source/adam-comment.ads<gh_stars>1-10
with
AdaM.Entity;
private
with
ada.Streams;
package AdaM.Comment
is
type Item is new Entity.item with private;
type View is access all Item'Class;
-- Forge
--
function new_Comment return Comment.view;
procedure free (Self : in out Comment.view);
procedure destruct (Self : in out Item);
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id;
function Lines (Self : in Item) return text_Lines;
procedure Lines_are (Self : in out Item; Now : in text_Lines);
overriding
function to_Source (Self : in Item) return text_Vectors.Vector;
overriding
function Name (Self : in Item) return Identifier;
private
type Item is new Entity.item with
record
Lines : text_Lines;
end record;
-- Streams
--
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View);
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View);
for View'write use View_write;
for View'read use View_read;
end AdaM.Comment;
|
src/ado-sessions-factory.adb | Letractively/ada-ado | 0 | 28102 | -----------------------------------------------------------------------
-- factory -- Session Factory
-- Copyright (C) 2009, 2010, 2011, 2012 <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 ADO.Sequences.Hilo;
-- The <b>ADO.Sessions.Factory</b> package defines the factory for creating
-- sessions.
package body ADO.Sessions.Factory is
use ADO.Databases;
-- ------------------------------
-- Open a session
-- ------------------------------
procedure Open_Session (Factory : in out Session_Factory;
Database : out Session) is
S : constant Session_Record_Access := new Session_Record;
DB : constant Master_Connection'Class := Factory.Source.Get_Connection;
begin
S.Database := Master_Connection (DB);
S.Entities := Factory.Entities;
Database.Impl := S;
end Open_Session;
-- ------------------------------
-- Get a read-only session from the factory.
-- ------------------------------
function Get_Session (Factory : in Session_Factory) return Session is
R : Session;
S : constant Session_Record_Access := new Session_Record;
DB : constant Master_Connection'Class := Factory.Source.Get_Connection;
begin
S.Database := Master_Connection (DB);
S.Entities := Factory.Entities;
R.Impl := S;
return R;
end Get_Session;
-- ------------------------------
-- Get a read-only session from the session proxy.
-- If the session has been invalidated, raise the SESSION_EXPIRED exception.
-- ------------------------------
function Get_Session (Proxy : in Session_Record_Access) return Session is
R : Session;
begin
if Proxy = null then
raise ADO.Objects.SESSION_EXPIRED;
end if;
R.Impl := Proxy;
Util.Concurrent.Counters.Increment (R.Impl.Counter);
return R;
end Get_Session;
-- ------------------------------
-- Get a read-write session from the factory.
-- ------------------------------
function Get_Master_Session (Factory : in Session_Factory) return Master_Session is
R : Master_Session;
DB : constant Master_Connection'Class := Factory.Source.Get_Connection;
S : constant Session_Record_Access := new Session_Record;
begin
R.Impl := S;
R.Sequences := Factory.Sequences;
S.Database := Master_Connection (DB);
S.Entities := Factory.Entities;
return R;
end Get_Master_Session;
-- ------------------------------
-- Open a session
-- ------------------------------
procedure Open_Session (Factory : in Session_Factory;
Database : out Master_Session) is
begin
null;
end Open_Session;
-- ------------------------------
-- Initialize the sequence factory associated with the session factory.
-- ------------------------------
procedure Initialize_Sequences (Factory : in out Session_Factory) is
use ADO.Sequences;
begin
Factory.Sequences := Factory.Seq_Factory'Unchecked_Access;
Set_Default_Generator (Factory.Seq_Factory,
ADO.Sequences.Hilo.Create_HiLo_Generator'Access,
Factory'Unchecked_Access);
end Initialize_Sequences;
-- ------------------------------
-- Create the session factory to connect to the database represented
-- by the data source.
-- ------------------------------
procedure Create (Factory : out Session_Factory;
Source : in ADO.Databases.DataSource) is
begin
Factory.Source := Source;
Factory.Entities := Factory.Entity_Cache'Unchecked_Access;
Initialize_Sequences (Factory);
if Factory.Source.Get_Database /= "" then
declare
S : Session := Factory.Get_Session;
begin
ADO.Schemas.Entities.Initialize (Factory.Entity_Cache, S);
end;
end if;
end Create;
-- ------------------------------
-- Create the session factory to connect to the database identified
-- by the URI.
-- ------------------------------
procedure Create (Factory : out Session_Factory;
URI : in String) is
begin
Factory.Source.Set_Connection (URI);
Factory.Entities := Factory.Entity_Cache'Unchecked_Access;
Initialize_Sequences (Factory);
if Factory.Source.Get_Database /= "" then
declare
S : Session := Factory.Get_Session;
begin
ADO.Schemas.Entities.Initialize (Factory.Entity_Cache, S);
end;
end if;
end Create;
end ADO.Sessions.Factory;
|
Projetos/F-Assembly/src/nasm/mod.nasm | arthurolga/Z01-Ingenheiros | 0 | 92857 | <gh_stars>0
; Arquivo: Mod.nasm
; Curso: Elementos de Sistemas
; Criado por: <NAME>
; Data: 27/03/2017
; Divide o número posicionado na RAM[1] pelo número posicionado no RAM[2] e armazena o resultado na RAM[0].
leaw $R1,%A
movw (%A),%D
WHILE:
leaw $R2,%A
subw %D,(%A),%S
movw %S,%D
leaw $WHILE,%A
jg %S
nop
IF:
leaw $FINAL,%A
je %S
nop
leaw $R2,%A
addw %D,(%A),%S
FINAL:
leaw $R0, %A
movw %S, (%A) |
oeis/127/A127359.asm | neoneye/loda-programs | 11 | 94309 | <filename>oeis/127/A127359.asm
; A127359: a(n) = Sum_{k=0..n} binomial(n, floor(k/2))*3^(n-k).
; Submitted by <NAME>
; 1,4,14,48,162,544,1820,6080,20290,67680,225684,752448,2508468,8362176,27875064,92919168,309734850,1032458080,3441543140,11471842880,38239537852,127465249344,424884399624,1416281802368,4720940242612,15736469278144,52454901060680,174849677136000,582832270492200,1942774261718400,6475914257433840,21586380961524480,71954603405441730,239848678418859360,799495595507399940,2664985319913737280,8883284402737502700,29610948015175099200,98703160062365418600,329010533564781571200,1096701778595220746940
mov $2,$0
add $2,1
mov $4,$0
lpb $2
mov $0,$4
div $1,2
sub $2,1
sub $0,$2
div $0,2
mul $1,6
mov $3,$4
bin $3,$0
mul $3,2
add $1,$3
lpe
mov $0,$1
div $0,2
|
source/strings/a-strunb.ads | ytomino/drake | 33 | 9831 | <filename>source/strings/a-strunb.ads
pragma License (Unrestricted);
with Ada.Strings.Maps;
with Ada.Strings.Unbounded_Strings.Functions.Maps;
package Ada.Strings.Unbounded is
pragma Preelaborate;
-- type Unbounded_String is private;
-- pragma Preelaborable_Initialization (Unbounded_String);
subtype Unbounded_String is Unbounded_Strings.Unbounded_String;
-- modified
-- Null_Unbounded_String : constant Unbounded_String;
function Null_Unbounded_String return Unbounded_String
renames Unbounded_Strings.Null_Unbounded_String;
function Length (Source : Unbounded_String) return Natural
renames Unbounded_Strings.Length;
-- type String_Access is access all String;
subtype String_Access is Unbounded_Strings.String_Access;
procedure Free (X : in out String_Access)
renames Unbounded_Strings.Free;
-- Conversion, Concatenation, and Selection functions
function To_Unbounded_String (Source : String)
return Unbounded_String
renames Unbounded_Strings.To_Unbounded_String;
function To_Unbounded_String (Length : Natural)
return Unbounded_String
renames Unbounded_Strings.To_Unbounded_String;
function To_String (Source : Unbounded_String) return String
renames Unbounded_Strings.To_String;
procedure Set_Unbounded_String (
Target : out Unbounded_String;
Source : String)
renames Unbounded_Strings.Set_Unbounded_String;
procedure Append (
Source : in out Unbounded_String;
New_Item : Unbounded_String)
renames Unbounded_Strings.Append;
procedure Append (
Source : in out Unbounded_String;
New_Item : String)
renames Unbounded_Strings.Append;
procedure Append (
Source : in out Unbounded_String;
New_Item : Character)
renames Unbounded_Strings.Append_Element;
function "&" (Left, Right : Unbounded_String) return Unbounded_String
renames Unbounded_Strings."&";
function "&" (Left : Unbounded_String; Right : String)
return Unbounded_String
renames Unbounded_Strings."&";
function "&" (Left : String; Right : Unbounded_String)
return Unbounded_String
renames Unbounded_Strings."&";
function "&" (Left : Unbounded_String; Right : Character)
return Unbounded_String
renames Unbounded_Strings."&";
function "&" (Left : Character; Right : Unbounded_String)
return Unbounded_String
renames Unbounded_Strings."&";
function Element (Source : Unbounded_String; Index : Positive)
return Character
renames Unbounded_Strings.Element;
procedure Replace_Element (
Source : in out Unbounded_String;
Index : Positive;
By : Character)
renames Unbounded_Strings.Replace_Element;
function Slice (
Source : Unbounded_String;
Low : Positive;
High : Natural)
return String
renames Unbounded_Strings.Slice;
function Unbounded_Slice (
Source : Unbounded_String;
Low : Positive;
High : Natural)
return Unbounded_String
renames Unbounded_Strings.Unbounded_Slice;
procedure Unbounded_Slice (
Source : Unbounded_String;
Target : out Unbounded_String;
Low : Positive;
High : Natural)
renames Unbounded_Strings.Unbounded_Slice;
function "=" (Left, Right : Unbounded_String) return Boolean
renames Unbounded_Strings."=";
function "=" (Left : Unbounded_String; Right : String) return Boolean
renames Unbounded_Strings."=";
function "=" (Left : String; Right : Unbounded_String) return Boolean
renames Unbounded_Strings."=";
function "<" (Left, Right : Unbounded_String) return Boolean
renames Unbounded_Strings."<";
function "<" (Left : Unbounded_String; Right : String) return Boolean
renames Unbounded_Strings."<";
function "<" (Left : String; Right : Unbounded_String) return Boolean
renames Unbounded_Strings."<";
function "<=" (Left, Right : Unbounded_String) return Boolean
renames Unbounded_Strings."<=";
function "<=" (Left : Unbounded_String; Right : String) return Boolean
renames Unbounded_Strings."<=";
function "<=" (Left : String; Right : Unbounded_String) return Boolean
renames Unbounded_Strings."<=";
function ">" (Left, Right : Unbounded_String) return Boolean
renames Unbounded_Strings.">";
function ">" (Left : Unbounded_String; Right : String) return Boolean
renames Unbounded_Strings.">";
function ">" (Left : String; Right : Unbounded_String) return Boolean
renames Unbounded_Strings.">";
function ">=" (Left, Right : Unbounded_String) return Boolean
renames Unbounded_Strings.">=";
function ">=" (Left : Unbounded_String; Right : String) return Boolean
renames Unbounded_Strings.">=";
function ">=" (Left : String; Right : Unbounded_String) return Boolean
renames Unbounded_Strings.">=";
-- Search subprograms
-- modified
-- function Index (
-- Source : Unbounded_String;
-- Pattern : String;
-- From : Positive;
-- Going : Direction := Forward;
-- Mapping : Maps.Character_Mapping := Maps.Identity)
-- return Natural;
function Index (
Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward)
return Natural
renames Unbounded_Strings.Functions.Index;
function Index (
Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping)
return Natural
renames Unbounded_Strings.Functions.Maps.Index;
-- modified
-- function Index (
-- Source : Unbounded_String;
-- Pattern : String;
-- From : Positive;
-- Going : Direction := Forward;
-- Mapping : Maps.Character_Mapping_Function)
-- return Natural;
function Index (
Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : not null access function (From : Character) return Character)
return Natural
renames Unbounded_Strings.Functions.Maps.Index_Element;
function Index (
Source : Unbounded_String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : not null access function (From : Wide_Wide_Character)
return Wide_Wide_Character)
return Natural
renames Unbounded_Strings.Functions.Maps.Index;
-- modified
-- function Index (
-- Source : Unbounded_String;
-- Pattern : String;
-- Going : Direction := Forward;
-- Mapping : Maps.Character_Mapping := Maps.Identity)
-- return Natural;
function Index (
Source : Unbounded_String;
Pattern : String;
Going : Direction := Forward)
return Natural
renames Unbounded_Strings.Functions.Index;
function Index (
Source : Unbounded_String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping)
return Natural
renames Unbounded_Strings.Functions.Maps.Index;
-- modified
-- function Index (
-- Source : Unbounded_String;
-- Pattern : String;
-- Going : Direction := Forward;
-- Mapping : Maps.Character_Mapping_Function)
-- return Natural;
function Index (
Source : Unbounded_String;
Pattern : String;
Going : Direction := Forward;
Mapping : not null access function (From : Character) return Character)
return Natural
renames Unbounded_Strings.Functions.Maps.Index_Element;
function Index (
Source : Unbounded_String;
Pattern : String;
Going : Direction := Forward;
Mapping : not null access function (From : Wide_Wide_Character)
return Wide_Wide_Character)
return Natural
renames Unbounded_Strings.Functions.Maps.Index;
function Index (
Source : Unbounded_String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward)
return Natural
renames Unbounded_Strings.Functions.Maps.Index;
function Index (
Source : Unbounded_String;
Set : Maps.Character_Set;
Test : Membership := Inside;
Going : Direction := Forward)
return Natural
renames Unbounded_Strings.Functions.Maps.Index;
function Index_Non_Blank (
Source : Unbounded_String;
From : Positive;
Going : Direction := Forward)
return Natural
renames Unbounded_Strings.Functions.Index_Non_Blank;
function Index_Non_Blank (
Source : Unbounded_String;
Going : Direction := Forward)
return Natural
renames Unbounded_Strings.Functions.Index_Non_Blank;
-- modified
-- function Count (
-- Source : Unbounded_String;
-- Pattern : String;
-- Mapping : Maps.Character_Mapping := Maps.Identity)
-- return Natural;
function Count (
Source : Unbounded_String;
Pattern : String)
return Natural
renames Unbounded_Strings.Functions.Count;
function Count (
Source : Unbounded_String;
Pattern : String;
Mapping : Maps.Character_Mapping)
return Natural
renames Unbounded_Strings.Functions.Maps.Count;
-- modified
-- function Count (
-- Source : Unbounded_String;
-- Pattern : String;
-- Mapping : Maps.Character_Mapping_Function)
-- return Natural;
function Count (
Source : Unbounded_String;
Pattern : String;
Mapping : not null access function (From : Character) return Character)
return Natural
renames Unbounded_Strings.Functions.Maps.Count_Element;
function Count (
Source : Unbounded_String;
Pattern : String;
Mapping : not null access function (From : Wide_Wide_Character)
return Wide_Wide_Character)
return Natural
renames Unbounded_Strings.Functions.Maps.Count;
function Count (
Source : Unbounded_String;
Set : Maps.Character_Set)
return Natural
renames Unbounded_Strings.Functions.Maps.Count;
procedure Find_Token (
Source : Unbounded_String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership;
First : out Positive;
Last : out Natural)
renames Unbounded_Strings.Functions.Maps.Find_Token;
procedure Find_Token (
Source : Unbounded_String;
Set : Maps.Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural)
renames Unbounded_Strings.Functions.Maps.Find_Token;
-- String translation subprograms
function Translate (
Source : Unbounded_String;
Mapping : Maps.Character_Mapping)
return Unbounded_String
renames Unbounded_Strings.Functions.Maps.Translate;
procedure Translate (
Source : in out Unbounded_String;
Mapping : Maps.Character_Mapping)
renames Unbounded_Strings.Functions.Maps.Translate;
-- modified
-- function Translate (
-- Source : Unbounded_String;
-- Mapping : Maps.Character_Mapping_Function)
-- return Unbounded_String;
function Translate (
Source : Unbounded_String;
Mapping : not null access function (From : Character) return Character)
return Unbounded_String
renames Unbounded_Strings.Functions.Maps.Translate_Element;
function Translate (
Source : Unbounded_String;
Mapping : not null access function (From : Wide_Wide_Character)
return Wide_Wide_Character)
return Unbounded_String
renames Unbounded_Strings.Functions.Maps.Translate;
-- modified
-- procedure Translate (
-- Source : in out Unbounded_String;
-- Mapping : Maps.Character_Mapping_Function);
procedure Translate (
Source : in out Unbounded_String;
Mapping : not null access function (From : Character) return Character)
renames Unbounded_Strings.Functions.Maps.Translate_Element;
procedure Translate (
Source : in out Unbounded_String;
Mapping : not null access function (From : Wide_Wide_Character)
return Wide_Wide_Character)
renames Unbounded_Strings.Functions.Maps.Translate;
-- String transformation subprograms
function Replace_Slice (
Source : Unbounded_String;
Low : Positive;
High : Natural;
By : String)
return Unbounded_String
renames Unbounded_Strings.Functions.Replace_Slice;
procedure Replace_Slice (
Source : in out Unbounded_String;
Low : Positive;
High : Natural;
By : String)
renames Unbounded_Strings.Functions.Replace_Slice;
function Insert (
Source : Unbounded_String;
Before : Positive;
New_Item : String)
return Unbounded_String
renames Unbounded_Strings.Functions.Insert;
procedure Insert (
Source : in out Unbounded_String;
Before : Positive;
New_Item : String)
renames Unbounded_Strings.Functions.Insert;
function Overwrite (
Source : Unbounded_String;
Position : Positive;
New_Item : String)
return Unbounded_String
renames Unbounded_Strings.Functions.Overwrite;
procedure Overwrite (
Source : in out Unbounded_String;
Position : Positive;
New_Item : String)
renames Unbounded_Strings.Functions.Overwrite;
function Delete (
Source : Unbounded_String;
From : Positive;
Through : Natural)
return Unbounded_String
renames Unbounded_Strings.Functions.Delete;
procedure Delete (
Source : in out Unbounded_String;
From : Positive;
Through : Natural)
renames Unbounded_Strings.Functions.Delete;
-- modified
function Trim (
Source : Unbounded_String;
Side : Trim_End;
Blank : Character := Space) -- additional
return Unbounded_String
renames Unbounded_Strings.Functions.Trim;
-- modified
procedure Trim (
Source : in out Unbounded_String;
Side : Trim_End;
Blank : Character := Space) -- additional
renames Unbounded_Strings.Functions.Trim;
function Trim (
Source : Unbounded_String;
Left : Maps.Character_Set;
Right : Maps.Character_Set)
return Unbounded_String
renames Unbounded_Strings.Functions.Maps.Trim;
procedure Trim (
Source : in out Unbounded_String;
Left : Maps.Character_Set;
Right : Maps.Character_Set)
renames Unbounded_Strings.Functions.Maps.Trim;
function Head (
Source : Unbounded_String;
Count : Natural;
Pad : Character := Space)
return Unbounded_String
renames Unbounded_Strings.Functions.Head;
procedure Head (
Source : in out Unbounded_String;
Count : Natural;
Pad : Character := Space)
renames Unbounded_Strings.Functions.Head;
function Tail (
Source : Unbounded_String;
Count : Natural;
Pad : Character := Space)
return Unbounded_String
renames Unbounded_Strings.Functions.Tail;
procedure Tail (
Source : in out Unbounded_String;
Count : Natural;
Pad : Character := Space)
renames Unbounded_Strings.Functions.Tail;
function "*" (Left : Natural; Right : Character) return Unbounded_String
renames Unbounded_Strings.Functions."*";
function "*" (Left : Natural; Right : String) return Unbounded_String
renames Unbounded_Strings.Functions."*";
function "*" (Left : Natural; Right : Unbounded_String)
return Unbounded_String
renames Unbounded_Strings.Functions."*";
end Ada.Strings.Unbounded;
|
programs/oeis/047/A047073.asm | karttu/loda | 1 | 23177 | <gh_stars>1-10
; A047073: Sum{T(i,n-i): i=0,1,...,n}, array T as in A047072.
; 1,2,4,4,8,12,24,40,80,140,280,504,1008,1848,3696,6864,13728,25740,51480,97240,194480,369512,739024,1410864,2821728,5408312,10816624,20801200,41602400,80233200,160466400,310235040,620470080,1202160780
sub $0,1
cal $0,63886 ; Number of n-step walks on a line starting from the origin but not returning to it.
mov $1,$0
mul $1,2
mov $0,$1
trn $0,1
mov $1,$0
add $1,1
|
bvs/BvsReadCellStr.asm | osfree-project/FamilyAPI | 0 | 23938 | <reponame>osfree-project/FamilyAPI
;/*!
; @file
;
; @brief BvsReadCellStr DOS wrapper
;
; (c) osFree Project 2008-2022, <http://www.osFree.org>
; for licence see licence.txt in root directory, or project website
;
; This is Family API implementation for DOS, used with BIND tools
; to link required API
;
; @author <NAME> (<EMAIL>)
;
;
;*/
.8086
; Helpers
INCLUDE helpers.inc
INCLUDE bios.inc
INCLUDE bseerr.inc
_TEXT SEGMENT BYTE PUBLIC 'CODE' USE16
@BVSPROLOG BVSREADCELLSTR
VIOHANDLE DW ? ;Video handle
COLUMN DW ? ;Starting column
ROW DW ? ;Starting row
SLENGTH DD ?
CELLSTR DD ?
@BVSSTART BVSREADCELLSTR
EXTERN VIOGOTOXYH: PROC
MOV BX,[DS:BP].ARGS.VIOHANDLE ; GET HANDLE
MOV CX,[DS:BP].ARGS.ROW ; GET ROW
MOV DX,[DS:BP].ARGS.COLUMN ; GET COLUMN
CALL VIOGOTOXYH
JNZ EXIT
MOV AX,0B800H ; OFFSET FOR COLOR CARD
MOV SI,DI ; GET THE ADDRESS AS SOURCE INDEX?
MOV DS,AX ; DS:SI IS NOW SET UP
LES DI,[DS:BP].ARGS.SLENGTH ; GET THE POINTER TO COUNT
MOV CX,ES:[DI] ; PUT COUNT IN CX
LES DI,[DS:BP].ARGS.CELLSTR ; GET THE POINTER IN ES:DI
CLD
REP MOVSB ; MOVE THE BYTES
XOR AX,AX ; SUCCESSFUL RETURN
EXIT:
@BVSEPILOG BVSREADCELLSTR
_TEXT ENDS
END
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_126.asm | ljhsiun2/medusa | 9 | 102754 | <filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_126.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x159aa, %rsi
lea addresses_normal_ht+0x93dc, %rdi
nop
nop
nop
cmp $14485, %rbp
mov $55, %rcx
rep movsw
nop
nop
nop
nop
nop
inc %rbx
lea addresses_A_ht+0x1d26a, %r14
nop
nop
nop
nop
nop
cmp $9087, %r8
mov (%r14), %bp
sub $2686, %rbx
lea addresses_normal_ht+0xb60c, %rsi
lea addresses_WT_ht+0x1b8b2, %rdi
nop
nop
nop
sub $13095, %r8
mov $47, %rcx
rep movsb
nop
nop
cmp %rbp, %rbp
lea addresses_A_ht+0x950c, %rsi
lea addresses_A_ht+0x15880, %rdi
nop
nop
and %r14, %r14
mov $67, %rcx
rep movsq
nop
nop
nop
nop
nop
and %rbx, %rbx
lea addresses_WT_ht+0x1ae1c, %rbx
nop
nop
nop
nop
xor %rbp, %rbp
movb $0x61, (%rbx)
nop
and $50523, %rbx
lea addresses_WT_ht+0x1088c, %rsi
lea addresses_A_ht+0x150c, %rdi
cmp $14124, %r8
mov $8, %rcx
rep movsq
nop
nop
nop
nop
inc %rbp
lea addresses_WT_ht+0x19a0a, %r14
nop
nop
nop
nop
nop
cmp %rbx, %rbx
movb (%r14), %r8b
and %rdi, %rdi
lea addresses_UC_ht+0x2cc, %rsi
lea addresses_D_ht+0x120c, %rdi
nop
nop
nop
add %r8, %r8
mov $27, %rcx
rep movsb
nop
nop
nop
nop
inc %rsi
lea addresses_WT_ht+0xd50c, %rbp
nop
nop
cmp $25035, %rsi
vmovups (%rbp), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %rcx
nop
nop
nop
nop
nop
cmp $59641, %r14
lea addresses_normal_ht+0x6d0c, %r14
nop
nop
nop
nop
dec %rbx
mov (%r14), %rsi
mfence
lea addresses_WC_ht+0x1662c, %rsi
lea addresses_UC_ht+0xcfbc, %rdi
clflush (%rdi)
and %r14, %r14
mov $15, %rcx
rep movsw
nop
nop
nop
nop
inc %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r15
push %rcx
push %rdi
push %rdx
// Load
lea addresses_UC+0x1672c, %r13
nop
nop
nop
nop
add %r14, %r14
vmovups (%r13), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %rdx
nop
sub $54117, %r13
// Faulty Load
lea addresses_D+0x1390c, %r10
nop
nop
and $25715, %rcx
movups (%r10), %xmm7
vpextrq $1, %xmm7, %rdx
lea oracles, %rdi
and $0xff, %rdx
shlq $12, %rdx
mov (%rdi,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}, 'dst': {'same': True, 'congruent': 1, 'type': 'addresses_WT_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}, 'dst': {'same': True, 'congruent': 2, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}, 'dst': {'same': True, 'congruent': 8, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
Cubical/Categories/Structures.agda | bijan2005/univalent-foundations | 0 | 9102 | <reponame>bijan2005/univalent-foundations
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Categories.Structures where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.HLevels using (isSetΣ)
open import Cubical.Data.Sigma
open import Cubical.Categories.Category
_∋_ : ∀ {ℓ} → (A : Type ℓ) → A → A
_∋_ A x = x
private
variable
ℓ ℓ' ℓ'' ℓ''' : Level
𝒞 : Precategory ℓ ℓ'
record StructureOver (𝒞 : Precategory ℓ ℓ') ℓ'' ℓ''' : Type (ℓ-suc (ℓ-max (ℓ-max ℓ ℓ') (ℓ-max ℓ'' ℓ'''))) where
field
Struct : 𝒞 .ob → Type ℓ''
IsHomo : ∀ {x y} → Struct x → Struct y → 𝒞 .hom x y → Type ℓ'''
isPropIsHomo : ∀ {x y α β f} → isProp (IsHomo {x} {y} α β f)
idnIsHomo : ∀ {x} (α : Struct x) → IsHomo α α (𝒞 .idn x)
homoSeq : ∀ {x y z α β γ} {f : 𝒞 .hom x y} {g : 𝒞 .hom y z} →
IsHomo α β f → IsHomo β γ g → IsHomo α γ (𝒞 .seq f g)
_⊆_ : ∀ {x} → Struct x → Struct x → Type ℓ'''
_⊆_ {x} α β = IsHomo α β (𝒞 .idn x)
open StructureOver public renaming (_⊆_ to _[_⊆_])
record StrIsUnivalent {𝒞 : Precategory ℓ ℓ'} (S : StructureOver 𝒞 ℓ'' ℓ''') : Type (ℓ-suc (ℓ-max (ℓ-max ℓ ℓ') (ℓ-max ℓ'' ℓ'''))) where
field
subAntisym : ∀ {x} {α β : S .Struct x} → S [ α ⊆ β ] → S [ β ⊆ α ] → α ≡ β
open StrIsUnivalent public
isPropP : {A : I → Type ℓ} {x : A i0} {y : A i1} → isProp (A i1) → PathP A x y
isPropP Aprop = toPathP (Aprop _ _)
STRUCTURES : (𝒞 : Precategory ℓ ℓ') → StructureOver 𝒞 ℓ'' ℓ''' → Precategory (ℓ-max ℓ ℓ'') (ℓ-max ℓ' ℓ''')
STRUCTURES 𝒞 S .ob = Σ (𝒞 .ob) (S .Struct)
STRUCTURES 𝒞 S .hom (x , α) (y , β) = Σ (𝒞 .hom x y) (S .IsHomo α β)
STRUCTURES 𝒞 S .idn (x , α) = 𝒞 .idn x , S .idnIsHomo α
STRUCTURES 𝒞 S .seq (f , hᶠ) (g , hᵍ) = 𝒞 .seq f g , S .homoSeq hᶠ hᵍ
STRUCTURES 𝒞 S .seq-λ (f , hᶠ) = cong₂ _,_ (𝒞 .seq-λ f) (toPathP (S .isPropIsHomo _ _))
STRUCTURES 𝒞 S .seq-ρ (f , hᶠ) = cong₂ _,_ (𝒞 .seq-ρ f) (toPathP (S .isPropIsHomo _ _))
STRUCTURES 𝒞 S .seq-α (f , hᶠ) (g , hᵍ) (h , hʰ) = cong₂ _,_ (𝒞 .seq-α f g h) (toPathP (S .isPropIsHomo _ _))
STRUCTURESisCat : ⦃ 𝒞-cat : isCategory 𝒞 ⦄ {S : StructureOver 𝒞 ℓ'' ℓ'''} → isCategory (STRUCTURES 𝒞 S)
STRUCTURESisCat {{𝒞-cat}} {S = S} .homIsSet {x = x , α} {y = y , β} = isSetΣ (𝒞-cat .homIsSet) (λ _ → isProp→isSet (S .isPropIsHomo))
SIP : ∀ ⦃ 𝒞-cat : isCategory 𝒞 ⦄ ⦃ 𝒞-univ : isUnivalent 𝒞 ⦄ → (S : StructureOver 𝒞 ℓ'' ℓ''') → ⦃ S-univ : StrIsUnivalent S ⦄ → isUnivalent (STRUCTURES 𝒞 S)
SIP {𝒞 = 𝒞} {{𝒞-cat}} {{𝒞-univ}} S {{S-univ}} .univ (x , α) (y , β) = isoToIsEquiv (iso (pathToIso (x , α) (y , β)) catisoToPath sect ret)
where
catisoToPath : ∀ {x y : 𝒞 .ob} {α : S .Struct x} {β : S .Struct y} → CatIso (STRUCTURES 𝒞 S) (x , α) (y , β) → (x , α) ≡ (y , β)
catisoToPath {x = x} {y} {α} {β} (catiso (f , hᶠ) (g , hᵍ) sec ret) = ΣPathTransport→PathΣ _ _ (x≡y , α≡β x≡y α β (subst (S .IsHomo α β) f≡h hᶠ) (subst (S .IsHomo β α) g≡h⁻¹ hᵍ))
where
x≅y : CatIso 𝒞 x y
x≅y = catiso f g (cong fst sec) (cong fst ret)
x≡y : x ≡ y
x≡y = uva 𝒞-univ x≅y
f≡h : f ≡ pathMor 𝒞 x≡y
f≡h = sym (uvaPathMor 𝒞-univ x≅y)
g≡h⁻¹ : g ≡ pathMor⁻ 𝒞 x≡y
g≡h⁻¹ = sym (uvaPathMor⁻ 𝒞-univ x≅y)
α≡β : ∀ {x y : 𝒞 .ob} (p : x ≡ y)
(α : S .Struct x) (β : S .Struct y)
(h⇒ : S .IsHomo α β (pathMor 𝒞 p)) (h⇐ : S .IsHomo β α (pathMor⁻ 𝒞 p))
→ subst (S .Struct) p α ≡ β
α≡β {x} {y} =
J (λ z q → ∀ (α : S .Struct x) (β : S .Struct z) (h⇒ : S .IsHomo α β (pathMor 𝒞 q)) (h⇐ : S .IsHomo β α (pathMor⁻ 𝒞 q)) → subst (S .Struct) q α ≡ β)
(λ α β h⇒ h⇐ → transportRefl α ∙ subAntisym S-univ (subst (S .IsHomo α β) (pathMorRefl {𝒞 = 𝒞}) h⇒) (subst (S .IsHomo β α) (pathMor⁻Refl {𝒞 = 𝒞}) h⇐))
sect : section (pathToIso (x , α) (y , β)) catisoToPath
sect (catiso h h⁻¹ sec ret) = {! !}
ret : retract (pathToIso (x , α) (y , β)) catisoToPath
ret = J (λ z q → catisoToPath (pathToIso (x , α) z q) ≡ q)
(subst {y = (pathToIso (x , α) (x , α) refl)} (λ x → catisoToPath x ≡ refl) (sym (JRefl (λ z _ → (x , α) ≅ z) ?)))
|
code/src/main.asm | sttng/merken-revision-2020 | 31 | 7450 | include "macros.asm"
include "registers.asm"
include "memory.asm"
include "common.asm"
include "assets/chars.inc"
dummy_vblank_address equ $C000
; =======================
; INTERRUPTS
; =======================
section "VBlank", ROM0[$0040]
reti
section "LCDS", ROM0[$0048]
reti
section "Timer", ROM0[$0050]
reti
section "Serial", ROM0[$0058]
reti
section "Joypad", ROM0[$0060]
reti
section "EndInterrupts", ROM0[$0100]
nop
; =======================
jp entry_point
; =======================
; HEADER
; =======================
;; NINTENDO LOGO
db $CE,$ED,$66,$66
db $CC,$0D,$00,$0B
db $03,$73,$00,$83
db $00,$0C,$00,$0D
db $00,$08,$11,$1F
db $88,$89,$00,$0E
db $DC,$CC,$6E,$E6
db $DD,$DD,$D9,$99
db $BB,$BB,$67,$63
db $6E,$0E,$EC,$CC
db $DD,$DC,$99,$9F
db $BB,$B9,$33,$3E
;; TITLE
db "M","E","R","K"
db "E","N",$00,$00
db $00,$00,$00,$00
db $00,$00,$00
; GAMEBOY COLOR
db $00
;; MAKER
db $00,$00
;; MACHINE
db $00
;; CARTRIDGE TYPE
db $01
;; ROM SIZE
db $01
;; RAM SIZE
db $00
;; COUNTRY
db $01
;; GAMEBOY
db $00
;; ROM VERSION
db $00
;; NEGATIVE CHECK
db $67
;; CHECK SUM
db $00,$00
; =======================
section "EntryPoint", ROM0[$0150]
entry_point:
; =======================================
; **** DMG Firewall ****
; =======================================
; Only DMG cool kids can play this demo
; =======================================
; Check we're running on DMG-CPUs
; Accumulator should be $11 on CBG or AGB
cp $11
jr nz, .is_dmg
; =======================================
; jp not_dmg ; <-- Uncomment this to allow only DMG
xor a
jr .start
.is_dmg:
ld a, 1
.start:
ld [is_dmg],a ; Store a 1 or 0 to indicate if the system is DMG.
ld sp, STACK_TOP ; Set Stack Pointer
ld a, %11100100
ld [fade_color], a ; Set initial fade color to default gradient
call init_dma ; Load DMA subroutine to HRAM
call dma_transfer ; Initialize OAM to 0
mInitializeMusic ; Initialize Music
mSelectSong 0 ; Initialize Song
.demo_run:
call fx1
call fx3
call fx4
call fx2
call fx6
call fx7
call fx8
call fx9
call fx5 ;<-- The end
; =======================================
; =======================================
stall::
ld a, $FF
.w:
dec a
jr nz,.w
ret
stall2::
ld a, b
.w:
dec a
jr nz,.w
ret
not_dmg:
call init_dma
call dma_transfer
ld a, $FF
ld [BGP], a
ld a, %11000100
ld [OBJP0], a
mSetROMBank 0
mSafeVRAMMemcpy chars_data, $8010, chars_data_size
call fx_write_text
call dma_transfer
ld a, [LCDC]
set 1, a
ld [LCDC], a
xor a
xor a
ld [text_wave], a
ld [wave1_offset_idx], a
ld [offset_x], a
ld [offset_x2], a
ld [tmp], a
; TODO: show a nice little message
.loop:
mWaitVBlank
call fx_animate_text
call dma_transfer
jr .loop
fx_write_text:
ld de, dmg_str
ld hl, SPRITE0_Y
ld b, 20 ; X
ld c, 20 ; Y
.loop:
ld a, c
ld [hl+], a ; set Y
ld a, b
ld [hl+], a ; set X
ld a, [de]
cp $00
jr z, .clean_up
ld [hl+], a ; set ID
inc de
inc hl
ld a, b
add a, 13 ; X offset between char
ld b, a
jr .loop
.clean_up:
xor a
dec hl
ld [hl-], a
ld [hl], a
ret
fx_animate_text:
xor a
ld [text_anim], a
ld hl, SPRITE0_Y
ld a, [text_wave]
ld b, a
ld d, 100 ; origin y pos
ld e, (end_dmg_str-dmg_str-1); <- char count
ld a, [text_wave]
add a, 5
ld [text_wave], a
.loop:
push hl
ld a, b
ld h, HIGH(ease_out_bounce)
ld l, a
ld a, [hl]
pop hl
ld c, a
ld a, d
add a, c
ld [hl+], a
ld a, [hl]
dec a
ld [hl+], a
ld a, [hl]
cp $D0
jr nz, .cont_loop
dec hl
dec hl
xor a
ld [hl+], a
ld [hl+], a
.cont_loop:
inc hl
inc hl
ld a, b
add a, 10
ld b, a
dec e
ret z
jr .loop
section "DMG", ROM0
dmg_str: incbin "assets/dmg.str"
end_dmg_str:
section "SineWaveTable8", ROM0, ALIGN[8]
sine_wave_table8::
db $00,$00,$00,$00,$00,$00,$01,$01,$01,$01,$01,$02,$02,$02,$02,$02
db $03,$03,$03,$03,$03,$03,$04,$04,$04,$04,$04,$04,$05,$05,$05,$05
db $05,$05,$05,$06,$06,$06,$06,$06,$06,$06,$06,$06,$07,$07,$07,$07
db $07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07
db $07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07
db $07,$07,$07,$07,$07,$06,$06,$06,$06,$06,$06,$06,$06,$06,$05,$05
db $05,$05,$05,$05,$05,$04,$04,$04,$04,$04,$04,$03,$03,$03,$03,$03
db $02,$02,$02,$02,$02,$02,$01,$01,$01,$01,$01,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$FF,$FE,$FE,$FE,$FE,$FE,$FE
db $FD,$FD,$FD,$FD,$FD,$FC,$FC,$FC,$FC,$FC,$FC,$FB,$FB,$FB,$FB,$FB
db $FB,$FB,$FA,$FA,$FA,$FA,$FA,$FA,$FA,$FA,$FA,$F9,$F9,$F9,$F9,$F9
db $F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9
db $F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9
db $F9,$F9,$F9,$F9,$FA,$FA,$FA,$FA,$FA,$FA,$FA,$FA,$FA,$FB,$FB,$FB
db $FB,$FB,$FB,$FB,$FC,$FC,$FC,$FC,$FC,$FC,$FD,$FD,$FD,$FD,$FD,$FD
db $FE,$FE,$FE,$FE,$FE,$FF,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00
sine_wave_table8_end::
section "BellCurve", ROM0, ALIGN[8]
bell_curve::
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01,$01,$01
db $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$02,$02,$02,$02,$02,$02
db $02,$02,$02,$02,$02,$02,$02,$03,$03,$03,$03,$03,$03,$03,$03,$03
db $03,$03,$03,$04,$04,$04,$04,$04,$04,$04,$04,$04,$04,$04,$04,$04
db $05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$06,$06,$06
db $06,$06,$06,$06,$06,$06,$06,$06,$06,$06,$07,$07,$07,$07,$07,$07
db $07,$07,$07,$07,$07,$07,$08,$08,$08,$08,$08,$08,$08,$08,$08,$08
db $08,$08,$08,$09,$09,$09,$09,$09,$09,$09,$09,$09,$09,$09,$09,$09
db $0A,$0A,$0A,$0A,$0A,$0A,$0A,$0A,$0A,$0A,$0A,$0A,$0A,$0B,$0B,$0B
db $0B,$0B,$0B,$0B,$0B,$0B,$0B,$0B,$0B,$0C,$0C,$0C,$0C,$0C,$0C,$0C
db $0C,$0C,$0C,$0C,$0C,$0C,$0D,$0D,$0D,$0D,$0D,$0D,$0D,$0D,$0D,$0D
db $0D,$0D,$0D,$0E,$0E,$0E,$0E,$0E,$0E,$0E,$0E,$0E,$0E,$0E,$0E,$0E
db $0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$10,$10,$10,$10
db $10,$10,$10,$10,$10,$10,$10,$10,$10,$11,$11,$11,$11,$11,$11,$11
db $11,$11,$11,$11,$11,$11,$12,$12,$12,$12,$12,$12,$12,$12,$12,$12
db $12,$12,$12,$13,$13,$13,$13,$13,$13,$13,$13,$13,$13,$13,$13
bell_curve_end::
section "FadeOutTable", ROM0, ALIGN[8]
fade_out_table::
db %11100100
db %11100100
db %11100100
db %11101001
db %11101001
db %11111001
db %11111001
db %11111001
db %11111010
db %11111010
db %11111110
db %11111110
db %11111110
db %11111111
db %11111111
db %11111111
fade_out_table_end::
section "FadeInTable", ROM0, ALIGN[8]
fade_in_table::
db %11111111
db %11111111
db %11111111
db %11111110
db %11111110
db %11111110
db %11111010
db %11111010
db %11111001
db %11111001
db %11111001
db %11101001
db %11101001
db %11100100
db %11100100
db %11100100
fade_in_table_end::
section "CommonVariables", WRAM0
; =================================
; COMMON VARIABLES
; =================================
current_state:: ds 1
next_state:: ds 1
fade_in_offset:: ds 1
fade_out_offset:: ds 1
fade_color:: ds 1
; =================================
load_tiles:: ds $01
fx_counter:: ds $04
continue_running:: ds 1
wave1_offset_idx:: ds $01
offset_x:: ds $01
offset_x2:: ds $01
wave_offset:: ds $01
text_wave:: ds $01
text_anim:: ds $01
text_x:: ds $01
tmp:: ds $02
sp_save:: ds $02
should_load_data:: ds $01
load_step:: ds $01
should_play_music:: ds $01
is_dmg:: ds $01
section "Vectors", WRAM0
timer_interrupt_callback:: ds 2
SECTION "Music",ROMX[$4000],BANK[MusicBank]
INCBIN "assets/carillon.bin" ; player code and music data
SECTION "Reserved",WRAM0[$c7c0]
ds $30 ; $c7c0 - $c7ef for player variables |
examples/generic_example_options.ads | AntonMeep/parse_args | 9 | 23594 | -- generic_example_options
-- An example of the use of parse_args with generic option types
-- Copyright (c) 2015, <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.Unchecked_Deallocation;
with Parse_Args;
use Parse_Args;
with Parse_Args.Generic_Discrete_Options;
with Parse_Args.Generic_Options;
with Parse_Args.Generic_Indefinite_Options;
with Parse_Args.Split_CSV;
package Generic_Example_Options is
type Compass is (North, South, East, West);
package Compass_Option is new Generic_Discrete_Options(Element => Compass,
Fallback_Default => North);
procedure Is_Even(Arg : in Integer; Result : in out Boolean);
package Even_Option is new Generic_Discrete_Options(Element => Natural,
Fallback_Default => 0,
Valid => Is_Even);
package Float_Option is new Generic_Options(Element => Float,
Fallback_Default => 0.0,
Value => Float'Value,
Image => Float'Image);
type Float_Array is array (Integer range <>) of Float;
type Float_Array_Access is access Float_Array;
procedure Free_Float_Array is
new Ada.Unchecked_Deallocation(Object => Float_Array,
Name => Float_Array_Access);
function Split_Float_Array is new Split_CSV(Element => Float,
Element_Array => Float_Array,
Element_Array_Access => Float_Array_Access,
Value => Float'Value);
function Float_Array_Image(Arg : Float_Array_Access) return String is
("<Float array of length: " & Integer'Image(Arg.all'Length) & ">");
package Float_Array_Option is new Generic_Indefinite_Options(Element => Float_Array,
Element_Access => Float_Array_Access,
Value => Split_Float_Array,
Image => Float_Array_Image,
Free_Element => Free_Float_Array);
end Generic_Example_Options;
|
oeis/186/A186293.asm | neoneye/loda-programs | 11 | 7961 | ; A186293: (A007519(n)-1)/2.
; Submitted by <NAME>
; 8,20,36,44,48,56,68,96,116,120,128,140,156,168,176,200,204,216,224,228,260,284,288,296,300,308,320,336,380,384,404,428,440,464,468,476,488,504,516,524,548,564,576,596,600,608
mov $2,36
mul $2,$0
mov $4,16
lpb $2
mov $3,$4
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $1,$0
max $1,0
cmp $1,$0
mul $2,$1
sub $2,1
add $4,8
lpe
mov $0,$4
sub $0,16
div $0,2
add $0,8
|
list2/task1/src/primes.adb | luk9400/nsi | 0 | 17220 | package body Primes with SPARK_Mode is
function IsPrime (N : in Positive) return Boolean is
begin
for I in Positive range 2 .. N - 1 loop
if N rem I = 0 then
return False;
end if;
pragma Loop_Invariant (for all J in 2 .. I => N rem J /= 0);
end loop;
return True;
end IsPrime;
end Primes;
|
os/boot/print32.asm | rzakaan/os | 0 | 951 | <gh_stars>0
[bits 32]
VIDEO_MEMORY equ 0xb8000
WHITE_ON_BLACK equ 0x0f
;
; About
; prints the specified message to video memory
;
; Attributes
; edx - store video mem pointer index
;
; Args
; bx - (ptr) it is the base address for the string
;
print32:
pusha
mov edx, VIDEO_MEMORY
print32_loop:
mov ah, WHITE_ON_BLACK
mov al, [ebx] ; [ebx] is the address of our character
cmp al, 0 ; if string[i] == \0 then return
je print32_done
mov [edx], ax ; store character + attribute in video memory
add ebx, 1 ; string[i++]
add edx, 2 ; video memory[i++]
jmp print32_loop
print32_done:
popa
ret |
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2586.asm | ljhsiun2/medusa | 9 | 9138 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x18a59, %r8
xor $56472, %r9
mov $0x6162636465666768, %r10
movq %r10, (%r8)
nop
nop
nop
cmp $43773, %r10
lea addresses_WC_ht+0x181f5, %rbx
nop
nop
nop
nop
nop
cmp %r14, %r14
movb $0x61, (%rbx)
and %rbp, %rbp
lea addresses_normal_ht+0x9f59, %rsi
lea addresses_A_ht+0xdb79, %rdi
nop
nop
nop
nop
sub %rbx, %rbx
mov $37, %rcx
rep movsb
sub %rsi, %rsi
lea addresses_WT_ht+0x1a6cd, %rsi
lea addresses_WC_ht+0x32d9, %rdi
nop
nop
nop
nop
and %r8, %r8
mov $76, %rcx
rep movsb
nop
nop
nop
nop
nop
dec %rdi
lea addresses_normal_ht+0x8759, %rsi
lea addresses_A_ht+0x12559, %rdi
nop
cmp %r14, %r14
mov $116, %rcx
rep movsb
nop
nop
nop
nop
and $56670, %rdi
lea addresses_UC_ht+0x10585, %r14
nop
nop
cmp %r9, %r9
movups (%r14), %xmm4
vpextrq $1, %xmm4, %r8
nop
nop
nop
cmp $40091, %rsi
lea addresses_WC_ht+0x9359, %r8
clflush (%r8)
nop
nop
nop
nop
and $46224, %rbp
movups (%r8), %xmm1
vpextrq $1, %xmm1, %rsi
xor %rsi, %rsi
lea addresses_WC_ht+0x1cd59, %rbp
nop
nop
nop
sub $30288, %rbx
movb (%rbp), %cl
nop
cmp %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r15
push %rax
push %rbp
push %rdx
// Store
lea addresses_PSE+0x759, %r12
and %rax, %rax
movw $0x5152, (%r12)
nop
cmp %rbp, %rbp
// Store
lea addresses_WC+0x2320, %rax
nop
nop
nop
nop
nop
sub %r10, %r10
movb $0x51, (%rax)
cmp %r15, %r15
// Faulty Load
lea addresses_normal+0x12b59, %r15
nop
nop
cmp $38459, %rdx
movups (%r15), %xmm4
vpextrq $1, %xmm4, %r10
lea oracles, %rbp
and $0xff, %r10
shlq $12, %r10
mov (%rbp,%r10,1), %r10
pop %rdx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
oeis/280/A280955.asm | neoneye/loda-programs | 11 | 165717 | ; A280955: Number of n X 2 0..2 arrays with no element equal to more than one of its horizontal, vertical and antidiagonal neighbors and with new values introduced in order 0 sequentially upwards.
; Submitted by <NAME>
; 2,9,42,205,997,4850,23593,114769,558298,2715861,13211405,64267362,312630929,1520804569,7398009354,35987886621,175064388469,851607109714,4142673879353,20152188344737,98031056006074,476875651282597,2319779017499421,11284649731134146,54894590645816865,267036740525303465,1299009974415615466,6319081450409492589,30739402439825735685,149532945535356528562,727408473351138549577,3538505077985806048241,17213187150883134919834,83734177388826902421877,407327963236825955415085,1981461749653494566267682
mul $0,2
seq $0,183304 ; Half the number of nX3 binary arrays with no element equal to a strict majority of its horizontal and vertical neighbors
max $0,2
|
Source/GameMegaSprite.asm | hhprg/C64Engine | 4 | 98872 | //
// Define MegaSprites here and add them to list of all MegaSprites.
//
{
.var sprites = List()
.eval sprites.add(Sprite( 0, 0,149), Sprite(24, 0,150), Sprite(48, 0,151))
.eval sprites.add(Sprite(48, 21,161), Sprite(72, 21,162))
.eval sprites.add(Sprite(72, 42,163), Sprite(96, 42,164))
.eval sprites.add(Sprite(72, 63,165), Sprite(96, 63,166))
.eval sprites.add(Sprite(48, 84,167), Sprite(72, 84,168))
.eval sprites.add(Sprite( 0,105,157), Sprite(24,105,158), Sprite(48,105,169))
// Add to list of all MegaSprites.
.eval AllMegaSprites.add(MegaSprite("BigBoss", sprites, GRAY))
}
{
.var sprites = List()
.eval sprites.add(Sprite( 0, 0,149), Sprite(24, 0,150), Sprite(48, 0,151))
.eval sprites.add(Sprite(48, 21,156))
.eval sprites.add(Sprite( 0, 42,157), Sprite(24, 42,158), Sprite(48, 42,169))
// Add to list of all MegaSprites.
.eval AllMegaSprites.add(MegaSprite("MiniBoss", sprites, GRAY))
}
|
Cubical/Algebra/Group/Morphism.agda | ayberkt/cubical | 0 | 14576 | {-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Algebra.Group.Morphism where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Structure
open import Cubical.Algebra.Group.Base
open import Cubical.Data.Sigma
private
variable
ℓ ℓ' ℓ'' ℓ''' : Level
-- The following definition of GroupHom and GroupEquiv are level-wise heterogeneous.
-- This allows for example to deduce that G ≡ F from a chain of isomorphisms
-- G ≃ H ≃ F, even if H does not lie in the same level as G and F.
isGroupHom : (G : Group {ℓ}) (H : Group {ℓ'}) (f : ⟨ G ⟩ → ⟨ H ⟩) → Type _
isGroupHom G H f = (x y : ⟨ G ⟩) → f (x G.+ y) ≡ (f x H.+ f y) where
module G = GroupStr (snd G)
module H = GroupStr (snd H)
record GroupHom (G : Group {ℓ}) (H : Group {ℓ'}) : Type (ℓ-max ℓ ℓ') where
constructor grouphom
field
fun : ⟨ G ⟩ → ⟨ H ⟩
isHom : isGroupHom G H fun
record GroupEquiv (G : Group {ℓ}) (H : Group {ℓ'}) : Type (ℓ-max ℓ ℓ') where
constructor groupequiv
field
eq : ⟨ G ⟩ ≃ ⟨ H ⟩
isHom : isGroupHom G H (equivFun eq)
hom : GroupHom G H
hom = grouphom (equivFun eq) isHom
open GroupHom
open GroupStr
×hom : {A : Group {ℓ}} {B : Group {ℓ'}} {C : Group {ℓ''}} {D : Group {ℓ'''}}
→ GroupHom A C → GroupHom B D → GroupHom (dirProd A B) (dirProd C D)
fun (×hom mf1 mf2) = map-× (fun mf1) (fun mf2)
isHom (×hom mf1 mf2) a b = ≡-× (isHom mf1 _ _) (isHom mf2 _ _)
isInIm : (G : Group {ℓ}) (H : Group {ℓ'}) → GroupHom G H → ⟨ H ⟩ → Type (ℓ-max ℓ ℓ')
isInIm G H ϕ h = ∃[ g ∈ ⟨ G ⟩ ] ϕ .fun g ≡ h
isInKer : (G : Group {ℓ}) (H : Group {ℓ'}) → GroupHom G H → ⟨ G ⟩ → Type ℓ'
isInKer G H ϕ g = ϕ .fun g ≡ 0g (snd H)
isSurjective : (G : Group {ℓ}) (H : Group {ℓ'}) → GroupHom G H → Type (ℓ-max ℓ ℓ')
isSurjective G H ϕ = (x : ⟨ H ⟩) → isInIm G H ϕ x
isInjective : (G : Group {ℓ}) (H : Group {ℓ'}) → GroupHom G H → Type (ℓ-max ℓ ℓ')
isInjective G H ϕ = (x : ⟨ G ⟩) → isInKer G H ϕ x → x ≡ 0g (snd G)
|
src/main/antlr/adl/base_expressions.g4 | openEHR/adl-antlr | 1 | 491 | //
// description: Antlr4 grammar for openEHR Rules core syntax.
// author: <NAME> <<EMAIL>>
// contributors:<NAME> <<EMAIL>>
// support: openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues>
// copyright: Copyright (c) 2016- openEHR Foundation <http://www.openEHR.org>
// license: Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>
//
grammar base_expressions;
import cadl2_primitives, odin_values;
//
// ======================= Top-level _objects ========================
//
statement_block: statement+ ;
// ------------------------- statements ---------------------------
statement: declaration | assignment | assertion;
declaration:
variable_declaration
| constant_declaration
;
variable_declaration: local_variable ':' type_id ( SYM_ASSIGNMENT expression )? ;
constant_declaration: constant_name ':' type_id ( SYM_EQ primitive_object )? ;
assignment:
binding
| local_assignment
;
//
// The following is the means of binding a data context path to a local variable
// TODO: remove this rule when proper external bindings are supported
binding: local_variable SYM_ASSIGNMENT bound_path ;
local_assignment: local_variable SYM_ASSIGNMENT expression ;
assertion: ( ( ALPHA_LC_ID | ALPHA_UC_ID ) ':' )? boolean_expr ;
//
// -------------------------- _expressions --------------------------
//
expression:
boolean_expr
| arithmetic_expr
;
//
// _expressions evaluating to boolean values, using standard precedence
// The equality_binop ones are not strictly necessary, but allow the use
// of boolean_leaf = true, which some people like
//
boolean_expr:
SYM_NOT boolean_expr
| boolean_expr SYM_AND boolean_expr
| boolean_expr SYM_XOR boolean_expr
| boolean_expr SYM_OR boolean_expr
| boolean_expr SYM_IMPLIES boolean_expr
| boolean_leaf equality_binop boolean_leaf
| boolean_leaf
;
//
// Atomic Boolean-valued expression elements
// TODO: SYM_EXISTS alternative to be replaced by defined() predicate
boolean_leaf:
boolean_literal
| for_all_expr
| there_exists_expr
| SYM_EXISTS ( bound_path | sub_path_local_variable )
| '(' boolean_expr ')'
| relational_expr
| equality_expr
| constraint_expr
| value_ref
;
boolean_literal:
SYM_TRUE
| SYM_FALSE
;
//
// Universal and existential quantifier
// TODO: 'in' probably isn't needed in the long term
for_all_expr: SYM_FOR_ALL VARIABLE_ID ( ':' | 'in' ) value_ref '|'? boolean_expr ;
there_exists_expr: SYM_THERE_EXISTS VARIABLE_ID ( ':' | 'in' ) value_ref '|'? boolean_expr ;
// Constraint expressions
// This provides a way of using one operator (matches) to compare a
// value (LHS) with a value range (RHS). As per ADL, the value range
// for ordered types like Integer, Date etc may be a single value,
// a list of values, or a list of intervals, and in future, potentially
// other comparators, including functions (e.g. divisible_by_N).
//
// For non-ordered types like String and Terminology_code, the RHS
// is in other forms, e.g. regex for Strings.
//
// The matches operator can be used to generate a Boolean value that
// may be used within an expression like any other Boolean (hence it
// is a booleanLeaf).
// TODO: non-primitive objects might be supported on the RHS in future.
constraint_expr: ( arithmetic_expr | value_ref ) SYM_MATCHES ( '{' c_inline_primitive_object '}' | CONTAINED_REGEXP );
//
// _expressions evaluating to arithmetic values, using standard precedence
//
arithmetic_expr:
<assoc=right> arithmetic_expr '^' arithmetic_expr
| arithmetic_expr ( '/' | '*' | '%' ) arithmetic_expr
| arithmetic_expr ( '+' | '-' ) arithmetic_expr
| arithmetic_leaf
;
arithmetic_leaf:
integer_value
| real_value
| date_value
| date_time_value
| time_value
| duration_value
| value_ref
| '(' arithmetic_expr ')'
;
//
// Equality expression between any arithmetic value; precedence is
// lowest, so only needed between leaves, since () will be needed for
// larger expressions anyway
//
equality_expr: arithmetic_expr equality_binop arithmetic_expr ;
equality_binop:
SYM_EQ
| SYM_NE
;
//
// Relational expressions of arithmetic operands generating Boolean values
//
relational_expr: arithmetic_expr relational_binop arithmetic_expr ;
relational_binop:
SYM_GT
| SYM_LT
| SYM_LE
| SYM_GE
;
//
// instances references: data references, variables, and function calls.
// TODO: Remove bound_path from this rule when external binding supported
//
value_ref:
function_call
| bound_path
| sub_path_local_variable
| local_variable
| constant_name
;
local_variable: VARIABLE_ID ;
// TODO: change to [] form, e.g. book_list [{title.contains("Quixote")}]
sub_path_local_variable: VARIABLE_WITH_PATH;
// TODO: Remove this rule when external binding supported
bound_path: ADL_PATH ;
constant_name: ALPHA_UC_ID ;
function_call: ALPHA_LC_ID '(' function_args? ')' ;
function_args: expression ( ',' expression )* ;
type_id: ALPHA_UC_ID ( '<' type_id ( ',' type_id )* '>' )? ;
|
alloy4fun_models/trashltl/models/11/BeZtp5eLGcpk8P6Wj.als | Kaixi26/org.alloytools.alloy | 0 | 3151 | open main
pred idBeZtp5eLGcpk8P6Wj_prop12 {
always (some f: File | eventually f in Trash)
}
pred __repair { idBeZtp5eLGcpk8P6Wj_prop12 }
check __repair { idBeZtp5eLGcpk8P6Wj_prop12 <=> prop12o } |
programs/oeis/108/A108678.asm | neoneye/loda | 22 | 1829 | ; A108678: a(n) = (n+1)^2*(n+2)(2n+3)/6.
; 1,10,42,120,275,546,980,1632,2565,3850,5566,7800,10647,14210,18600,23936,30345,37962,46930,57400,69531,83490,99452,117600,138125,161226,187110,215992,248095,283650,322896,366080,413457,465290,521850,583416,650275,722722
add $0,2
mul $0,2
mov $2,$0
sub $0,2
bin $2,3
mul $0,$2
div $0,8
|
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xa0.log_21829_126.asm | ljhsiun2/medusa | 9 | 247293 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1693b, %rsi
lea addresses_A_ht+0x14883, %rdi
clflush (%rsi)
clflush (%rdi)
and $23417, %rax
mov $72, %rcx
rep movsl
sub $30867, %r8
lea addresses_UC_ht+0x15efb, %r10
nop
nop
nop
nop
cmp $34989, %r12
mov $0x6162636465666768, %rcx
movq %rcx, %xmm0
movups %xmm0, (%r10)
nop
nop
nop
nop
sub $48705, %rsi
lea addresses_WT_ht+0x1e17f, %rsi
nop
nop
nop
nop
nop
xor %rax, %rax
mov $0x6162636465666768, %r10
movq %r10, %xmm0
movups %xmm0, (%rsi)
and $60169, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %rax
push %rbp
push %rcx
push %rsi
// Store
mov $0x3821ba000000016d, %rsi
sub $40677, %rcx
movb $0x51, (%rsi)
nop
inc %rsi
// Store
lea addresses_normal+0x13bbb, %rax
nop
nop
nop
nop
nop
add $57223, %rbp
mov $0x5152535455565758, %rsi
movq %rsi, (%rax)
nop
nop
inc %r10
// Faulty Load
lea addresses_normal+0x13bbb, %rsi
nop
nop
nop
sub $40653, %rax
mov (%rsi), %r10d
lea oracles, %rax
and $0xff, %r10
shlq $12, %r10
mov (%rax,%r10,1), %r10
pop %rsi
pop %rcx
pop %rbp
pop %rax
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 1, 'type': 'addresses_NC', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 8}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 2, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
src/sparknacl-sign-utils.adb | yannickmoy/SPARKNaCl | 76 | 1362 | <reponame>yannickmoy/SPARKNaCl<gh_stars>10-100
package body SPARKNaCl.Sign.Utils
with SPARK_Mode => On
is
procedure Construct (X : in Bytes_64;
Y : out Signing_SK)
is
begin
Y.F := X;
end Construct;
end SPARKNaCl.Sign.Utils;
|
BashLexer.g4 | endvroy/antlr4_bash | 6 | 7543 | lexer grammar BashLexer;
VARNAME: [a-zA-Z_][a-zA-Z0-9_]*;
PUNCS: (~[a-zA-Z0-9= \t\n<>(){}'"|$&`;\\])+;
NUM: [0-9]+;
BLANK: [ \t]+;
EQ: '=';
VAR: '$' ( [$!@] | [a-zA-Z0-9_]+)?;
SQUOTE: '\'' -> pushMode(INSIDE_SQUOTE);
DQUOTE: '"' -> pushMode(INSIDE_DQUOTE);
LPAREN: '(' -> pushMode(DEFAULT_MODE);
DOLLAR_LPAREN: '$(' -> pushMode(DEFAULT_MODE);
LT_LPAREN: '<(' -> pushMode(DEFAULT_MODE);
GT_LPAREN: '>(' -> pushMode(DEFAULT_MODE);
BACKTICK: '`' -> pushMode(BT);
DOLLAR_DLPAREN: '$((' -> pushMode(ARITH);
DOLLAR_LCURLY: '${' -> pushMode(PARAM_EXPANSION);
ESC_CHAR: '\\' .;
LCURLY: '{';
RCURLY: '}';
SEMI: ';';
PIPE: '|';
PIPE_AND: '|&';
LT: '<';
GT: '>';
LT_AND: '<&';
GT_AND: '>&';
AND_GT: '&>';
AND_DGT: '&>>';
DLT: '<<';
TLT: '<<<';
DLT_DASH: '<<-';
DGT: '>>';
LTGT: '<>';
GTPIPE: '>|';
AND: '&';
NL: '\n' -> skip;
RPAREN : ')' -> popMode;
mode INSIDE_SQUOTE;
SQUOTE_VARNAME: VARNAME -> type(VARNAME);
SQUOTE_NUM: NUM -> type(NUM);
SQUOTE_CONTENT : (~['a-zA-Z0-9_] | '\\' .)+ -> type(PUNCS);
TAIL_SQUOTE: SQUOTE -> type(SQUOTE), popMode;
mode INSIDE_DQUOTE;
DQUOTE_VARNAME: VARNAME -> type(VARNAME);
DQUOTE_NUM: NUM -> type(NUM);
DQUOTE_CONTENT : (~["\\$<>`a-zA-Z0-9_] | '\\' .)+ -> type(PUNCS);
DQUOTE_VAR : VAR -> type(VAR);
DQUOTE_DOLLAR_LPAREN : DOLLAR_LPAREN -> type(DOLLAR_LPAREN), pushMode(DEFAULT_MODE);
DQUOTE_DOLLAR_DLPAREN: DOLLAR_DLPAREN -> pushMode(ARITH);
DQUOTE_LT : LT -> type(LT);
DQUOTE_GT : GT -> type(GT);
DQUOTE_LT_LPAREN : LT_LPAREN -> type(LT_LPAREN), pushMode(DEFAULT_MODE);
DQUOTE_GT_LPAREN : GT_LPAREN -> type(GT_LPAREN), pushMode(DEFAULT_MODE);
DQUOTE_DOLLAR_LCURLY: DOLLAR_LCURLY -> type(DOLLAR_LCURLY), pushMode(PARAM_EXPANSION);
DQUOTE_BACKTICK : BACKTICK -> type(BACKTICK), pushMode(BT);
TAIL_DQUOTE : DQUOTE -> type(DQUOTE), popMode;
mode ARITH;
ARITH_CONTENT : (~["$<>()`])+;
ARITH_VAR : VAR -> type(VAR);
ARITH_DQUOTE : DQUOTE -> type(DQUOTE), pushMode(INSIDE_DQUOTE);
ARITH_DOLLAR_LPAREN : DOLLAR_LPAREN -> type(DOLLAR_LPAREN), pushMode(DEFAULT_MODE);
ARITH_LT_LPAREN : LT_LPAREN -> type(LT_LPAREN), pushMode(DEFAULT_MODE);
ARITH_GT_LPAREN : GT_LPAREN -> type(GT_LPAREN), pushMode(DEFAULT_MODE);
ARITH_LPAREN : LPAREN -> type(LPAREN), pushMode(DEFAULT_MODE);
ARITH_BACKTICK : BACKTICK -> type(BACKTICK), pushMode(BT);
DRPAREN : '))' -> popMode;
mode PARAM_EXPANSION;
PARAM_VARNAME: VARNAME -> type(VARNAME);
PARAM_PUNCS: (~[-a-zA-Z0-9= \t\n<>(){}'"|$&`;:+?%#])+ -> type(PUNCS);
PARAM_NUM: NUM -> type(NUM);
PARAM_BLANK: BLANK -> type(BLANK);
PARAM_VAR: VAR -> type(VAR);
PARAM_SQUOTE: SQUOTE -> type(SQUOTE), pushMode(INSIDE_SQUOTE);
PARAM_DQUOTE: DQUOTE -> type(DQUOTE), pushMode(INSIDE_DQUOTE);
PARAM_LPAREN: LPAREN -> type(LPAREN), pushMode(DEFAULT_MODE);
PARAM_DOLLAR_LPAREN: DOLLAR_LPAREN -> type(DOLLAR_LPAREN), pushMode(DEFAULT_MODE);
PARAM_LT_LPAREN: LT_LPAREN -> type(LT_LPAREN), pushMode(DEFAULT_MODE);
PARAM_GT_LPAREN: GT_LPAREN -> type(GT_LPAREN), pushMode(DEFAULT_MODE);
PARAM_BACKTICK: BACKTICK -> type(BACKTICK), pushMode(BT);
PARAM_DOLLAR_DLPAREN: DOLLAR_DLPAREN -> type(DOLLAR_DLPAREN), pushMode(ARITH);
COMMA: ':';
DASH: '-';
PARAM_EQ: '=';
QMARK: '?';
PLUS: '+';
PERCENT: '%';
DPERCENT: '%%';
HASH: '#';
DHASH: '##';
PARAM_RCURLY: RCURLY -> type(RCURLY), popMode;
// almost a full copy, just for backtick
mode BT;
BT_VARNAME: VARNAME -> type(VARNAME);
BT_PUNCS: PUNCS -> type(PUNCS);
BT_NUM: NUM -> type(NUM);
BT_BLANK: BLANK -> type(BLANK);
BT_EQ: EQ -> type(EQ);
BT_VAR: VAR -> type(VAR);
BT_SQUOTE: SQUOTE -> type(SQUOTE),pushMode(INSIDE_SQUOTE);
BT_DQUOTE: DQUOTE -> type(DQUOTE), pushMode(INSIDE_DQUOTE);
BT_LPAREN: LPAREN -> type(LPAREN), pushMode(BT);
BT_DOLLAR_LPAREN: DOLLAR_LPAREN -> type(DOLLAR_LPAREN), pushMode(BT);
BT_LT_LPAREN: LT_LPAREN -> type(LT_LPAREN), pushMode(BT);
BT_GT_LPAREN: GT_LPAREN -> type(GT_LPAREN), pushMode(BT);
BT_BACKTICK: BACKTICK -> type(BACKTICK), popMode;
BT_DOLLAR_DLPAREN: DOLLAR_DLPAREN -> type(DOLLAR_DLPAREN), pushMode(ARITH);
BT_DOLLAR_LCURLY: DOLLAR_LCURLY -> type(DOLLAR_LCURLY), pushMode(PARAM_EXPANSION);
BT_ESC_CHAR: ESC_CHAR -> type(ESC_CHAR);
BT_LCURLY: LCURLY -> type(LCURLY);
BT_RCURLY: RCURLY -> type(RCURLY);
BT_SEMI: SEMI -> type(SEMI);
BT_PIPE: PIPE -> type(PIPE);
BT_PIPE_AND: PIPE_AND -> type(PIPE_AND);
BT_LT: LT -> type(LT);
BT_GT: GT -> type(GT);
BT_LT_AND: LT_AND -> type(LT_AND);
BT_GT_AND: GT_AND -> type(GT_AND);
BT_AND_GT: AND_GT -> type(AND_GT);
BT_AND_DGT: AND_DGT -> type(AND_DGT);
BT_DLT: DLT -> type(DLT);
BT_TLT: TLT -> type(TLT);
BT_DLT_DASH: DLT_DASH -> type(DLT_DASH);
BT_DGT: DGT -> type(DGT);
BT_LTGT: LTGT -> type(LTGT);
BT_GTPIPE: GTPIPE -> type(GTPIPE);
BT_AND: AND -> type(AND);
BT_NL: NL -> type(NL);
BT_RPAREN: RPAREN -> type(RPAREN);
|
programs/oeis/120/A120164.asm | jmorken/loda | 1 | 90597 | ; A120164: a(1)=6; a(n)=floor((24+sum(a(1) to a(n-1)))/4).
; 6,7,9,11,14,17,22,27,34,42,53,66,83,103,129,161,202,252,315,394,492,615,769,961,1202,1502,1878,2347,2934,3667,4584,5730,7163,8953,11192,13990,17487,21859,27324,34155
mov $1,6
mov $2,$0
mov $0,4
mov $5,5
lpb $2
add $3,$0
trn $0,5
add $5,$1
mov $1,$3
mov $4,$5
lpb $4
add $1,1
trn $4,$3
lpe
sub $2,1
lpe
|
test/Compiler/simple/Issue3732.agda | xekoukou/agda-ocaml | 7 | 12915 | <reponame>xekoukou/agda-ocaml
open import Common.IO
open import Common.Unit
open import Common.String
-- Currently, it is not actually a test.
-- I need a wat to check that Erasure does not happen when it normally would.
{-# FOREIGN OCaml
type i =
| Bar of string;;
#-}
data I : Set where
bar : String → I
{-# COMPILE OCaml I No-Erasure #-}
showI : I → String
showI (bar x) = x
main : IO Unit
main = putStr (showI (bar "hello")) >>= λ _ → return unit
|
assignment_1/bind_shell_lean.nasm | CodeheadUK/SLAE64 | 2 | 7408 | <reponame>CodeheadUK/SLAE64
; An optimised verison on the bind_shell code
; Build with: nasm -felf64 bind_shell_lean.nasm -o tmp.o && ld tmp.o -o bind_shell_lean
global _start
section .text
_start:
mov rbp, rsp
; Build a server sockaddr_in struct on the stack
xor rax, rax
push rax
add ax, 0x5c11
shl rax, 16
add ax, 2
push rax
; Create Socket
xor rax, rax
mov rdx, rax
inc rax
mov rsi, rax ; SOCK_STREAM (1)
inc rax
mov rdi, rax ; AF_INET (2)
add rax, 39 ; syscall 41
syscall
push rax ; Store socket id
; Bind Socket
xor rax, rax
add rax, 49
mov rdi, [rbp-24] ; socket id
lea rsi, [rbp-16] ; sockaddr_in struct
xor rdx, rdx
add rdx, 16 ; sockaddr_in size
push rdx ; create size val ref on stack
syscall
; Listen
xor rax, rax
add rax, 2
mov rsi, rax
add rax, 48
syscall
_accept:
xor rax, rax
add rax, 43
mov rdi, [rbp-24] ; socket id
lea rsi, [rbp-16] ; sockaddr_in struct
lea rdx, [rbp-32] ; pointer to sockaddr_in size
syscall
push rax ; Store client socket id
; authenticate incoming connection
mov rdi, [rbp-40] ; socket id
lea rsi, [rbp-16] ; buffer address
xor rax, rax ; Zero out registers
push rax
push rax
pop rdx
pop r10
mov r8, rax
mov r9, rax
add rdx, 8 ; buffer length
add rax, 45 ; recvfrom
syscall
; compare strings
mov rbx, [rbp-16] ; Get input string
xor rcx, rcx ; build 'password' string
add rcx, 0x64726f77
shl rcx, 32
add rcx, 0x73736170
cmp rbx, rcx ; compare
jne _badpw ; handle failed matches
; good passphrase (fallthrough)
jmp _create_shell ; set up the shell
_badpw:
xor rax, rax ; zero out regs
push rax
pop rsi
add rax, 48 ; shutdown client socket
pop rdi ; last use of client sock id
add rsi, 2 ; SHUT_RDWR
syscall
jmp _accept ; jump back to await another connection
_create_shell:
; Duplicate I/O descriptors
xor rax, rax
add rax, 33 ; dup2
mov r8, rax
mov rdi, [rbp-40] ; client socket id
xor rsi, rsi ; STDIN
syscall
mov rax, r8 ; dup2
inc rsi ; STDOUT
syscall
mov rax, r8 ; dup2
inc rsi ; STDERR
syscall
_spawn:
xor rax, rax
push rax
pop rdx ; less instructions than MOV
mov rbx, 0x68732f6e69622f78 ; build X/bin/sh
shr rbx, 8 ; shift the ¨X¨ and append a NULL
mov [rbp-16], rbx ; copy ¨/bin/sh¨ string to buffer
lea rdi, [rbp-16] ; get the /bin/sh string
push rax ; build args array, by pushing NULL
push rdi ; then pushing string address
mov rsi, rsp ; args array address
add rax, 59 ; execve
syscall
|
quake2/source/ref_soft/r_polysa.asm | WarlockD/quake2-stm32 | 3 | 94830 | <reponame>WarlockD/quake2-stm32
.386P
.model FLAT
;
; d_polysa.s
; x86 assembly-language polygon model drawing code
;
include qasm.inc
include d_if.inc
if id386
; !!! if this is changed, it must be changed in d_polyse.c too !!!
;DPS_MAXSPANS equ (MAXHEIGHT+1)
; 1 extra for spanpackage that marks end
;SPAN_SIZE equ (((DPS_MAXSPANS + 1 + ((CACHE_SIZE - 1) / spanpackage_t_size)) + 1) * spanpackage_t_size)
MASK_1K equ 03FFh
_DATA SEGMENT
align 4
;p10_minus_p20 dd 0
;p01_minus_p21 dd 0
;temp0 dd 0
;temp1 dd 0
;Ltemp dd 0
aff8entryvec_table dd LDraw8, LDraw7, LDraw6, LDraw5
dd LDraw4, LDraw3, LDraw2, LDraw1, LDraw8IR, LDraw7IR, LDraw6IR, LDraw5IR, LDraw4IR, LDraw3IR, LDraw2IR, LDraw1IR
lzistepx dd 0
externdef _rand1k:dword
externdef _rand1k_index:dword
externdef _alias_colormap:dword
;PGM
externdef _irtable:dword
externdef _iractive:byte
;PGM
_DATA ENDS
_TEXT SEGMENT
;----------------------------------------------------------------------
; 8-bpp horizontal span drawing code for affine polygons, with smooth
; shading and no transparency
;----------------------------------------------------------------------
;===================================
;===================================
pspans equ 4+8
public _D_PolysetAff8Start
_D_PolysetAff8Start:
public _R_PolysetDrawSpans8_Opaque
_R_PolysetDrawSpans8_Opaque:
push esi ; preserve register variables
push ebx
mov esi,ds:dword ptr[pspans+esp] ; point to the first span descriptor
mov ecx,ds:dword ptr[_r_zistepx]
push ebp ; preserve caller's stack frame
push edi
ror ecx,16 ; put high 16 bits of 1/z step in low word
mov edx,ds:dword ptr[spanpackage_t_count+esi]
mov ds:dword ptr[lzistepx],ecx
LSpanLoop:
; lcount = d_aspancount - pspanpackage->count;
;
; errorterm += erroradjustup;
; if (errorterm >= 0)
; {
; d_aspancount += d_countextrastep;
; errorterm -= erroradjustdown;
; }
; else
; {
; d_aspancount += ubasestep;
; }
mov eax,ds:dword ptr[_d_aspancount]
sub eax,edx
mov edx,ds:dword ptr[_erroradjustup]
mov ebx,ds:dword ptr[_errorterm]
add ebx,edx
js LNoTurnover
mov edx,ds:dword ptr[_erroradjustdown]
mov edi,ds:dword ptr[_d_countextrastep]
sub ebx,edx
mov ebp,ds:dword ptr[_d_aspancount]
mov ds:dword ptr[_errorterm],ebx
add ebp,edi
mov ds:dword ptr[_d_aspancount],ebp
jmp LRightEdgeStepped
LNoTurnover:
mov edi,ds:dword ptr[_d_aspancount]
mov edx,ds:dword ptr[_ubasestep]
mov ds:dword ptr[_errorterm],ebx
add edi,edx
mov ds:dword ptr[_d_aspancount],edi
LRightEdgeStepped:
cmp eax,1
jl LNextSpan
jz LExactlyOneLong
;
; set up advancetable
;
mov ecx,ds:dword ptr[_a_ststepxwhole]
mov edx,ds:dword ptr[_r_affinetridesc+atd_skinwidth]
mov ds:dword ptr[advancetable+4],ecx ; advance base in t
add ecx,edx
mov ds:dword ptr[advancetable],ecx ; advance extra in t
mov ecx,ds:dword ptr[_a_tstepxfrac]
mov cx,ds:word ptr[_r_lstepx]
mov edx,eax ; count
mov ds:dword ptr[tstep],ecx
add edx,7
shr edx,3 ; count of full and partial loops
mov ebx,ds:dword ptr[spanpackage_t_sfrac+esi]
mov bx,dx
mov ecx,ds:dword ptr[spanpackage_t_pz+esi]
neg eax
mov edi,ds:dword ptr[spanpackage_t_pdest+esi]
and eax,7 ; 0->0, 1->7, 2->6, ... , 7->1
sub edi,eax ; compensate for hardwired offsets
sub ecx,eax
sub ecx,eax
mov edx,ds:dword ptr[spanpackage_t_tfrac+esi]
mov dx,ds:word ptr[spanpackage_t_light+esi]
mov ebp,ds:dword ptr[spanpackage_t_zi+esi]
ror ebp,16 ; put high 16 bits of 1/z in low word
push esi
push eax
mov al, [_iractive]
cmp al, 0
pop eax
jne IRInsert
mov esi,ds:dword ptr[spanpackage_t_ptex+esi]
jmp dword ptr[aff8entryvec_table+eax*4]
IRInsert:
mov esi,ds:dword ptr[spanpackage_t_ptex+esi]
add eax, 8
jmp dword ptr[aff8entryvec_table+eax*4]
; %bx = count of full and partial loops
; %ebx high word = sfrac
; %ecx = pz
; %dx = light
; %edx high word = tfrac
; %esi = ptex
; %edi = pdest
; %ebp = 1/z
; tstep low word = C(r_lstepx)
; tstep high word = C(a_tstepxfrac)
; C(a_sstepxfrac) low word = 0
; C(a_sstepxfrac) high word = C(a_sstepxfrac)
;===
;Standard Draw Loop
;===
LDrawLoop:
mov al,[_iractive]
cmp al,0
jne LDrawLoopIR
; FIXME: do we need to clamp light? We may need at least a buffer bit to
; keep it from poking into tfrac and causing problems
LDraw8:
cmp bp,ds:word ptr[ecx]
jl Lp1
xor eax,eax
mov ah,dh
mov al,ds:byte ptr[esi]
mov ds:word ptr[ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch8:
mov ds:byte ptr[edi],al
Lp1:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw7:
cmp bp,ds:word ptr[2+ecx]
jl Lp2
xor eax,eax
mov ah,dh
mov al,ds:byte ptr[esi]
mov ds:word ptr[2+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch7:
mov ds:byte ptr[1+edi],al
Lp2:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw6:
cmp bp,ds:word ptr[4+ecx]
jl Lp3
xor eax,eax
mov ah,dh
mov al,ds:byte ptr[esi]
mov ds:word ptr[4+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch6:
mov ds:byte ptr[2+edi],al
Lp3:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw5:
cmp bp,ds:word ptr[6+ecx]
jl Lp4
xor eax,eax
mov ah,dh
mov al,ds:byte ptr[esi]
mov ds:word ptr[6+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch5:
mov ds:byte ptr[3+edi],al
Lp4:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw4:
cmp bp,ds:word ptr[8+ecx]
jl Lp5
xor eax,eax
mov ah,dh
mov al,ds:byte ptr[esi]
mov ds:word ptr[8+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch4:
mov ds:byte ptr[4+edi],al
Lp5:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw3:
cmp bp,ds:word ptr[10+ecx]
jl Lp6
xor eax,eax
mov ah,dh
mov al,ds:byte ptr[esi]
mov ds:word ptr[10+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch3:
mov ds:byte ptr[5+edi],al
Lp6:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw2:
cmp bp,ds:word ptr[12+ecx]
jl Lp7
xor eax,eax
mov ah,dh
mov al,ds:byte ptr[esi]
mov ds:word ptr[12+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch2:
mov ds:byte ptr[6+edi],al
Lp7:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw1:
cmp bp,ds:word ptr[14+ecx]
jl Lp8
xor eax,eax
mov ah,dh
mov al,ds:byte ptr[esi]
mov ds:word ptr[14+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch1:
mov ds:byte ptr[7+edi],al
Lp8:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
add edi,8
add ecx,16
dec bx
jnz LDrawLoop
pop esi ; restore spans pointer
LNextSpan:
add esi,offset spanpackage_t_size ; point to next span
LNextSpanESISet:
mov edx,ds:dword ptr[spanpackage_t_count+esi]
cmp edx,offset -999999 ; any more spans?
jnz LSpanLoop ; yes
pop edi
pop ebp ; restore the caller's stack frame
pop ebx ; restore register variables
pop esi
ret
;=======
; IR active draw loop
;=======
LDrawLoopIR:
; FIXME: do we need to clamp light? We may need at least a buffer bit to
; keep it from poking into tfrac and causing problems
LDraw8IR:
cmp bp,ds:word ptr[ecx]
jl Lp1IR
xor eax,eax
mov al,ds:byte ptr[esi]
mov al,ds:byte ptr[_irtable+eax]
mov ds:word ptr[ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch8IR:
mov ds:byte ptr[edi],al
Lp1IR:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw7IR:
cmp bp,ds:word ptr[2+ecx]
jl Lp2IR
xor eax,eax
mov al,ds:byte ptr[esi]
mov al,ds:byte ptr[_irtable+eax]
mov ds:word ptr[2+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch7IR:
mov ds:byte ptr[1+edi],al
Lp2IR:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw6IR:
cmp bp,ds:word ptr[4+ecx]
jl Lp3IR
xor eax,eax
mov al,ds:byte ptr[esi]
mov al,ds:byte ptr[_irtable+eax]
mov ds:word ptr[4+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch6IR:
mov ds:byte ptr[2+edi],al
Lp3IR:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw5IR:
cmp bp,ds:word ptr[6+ecx]
jl Lp4IR
xor eax,eax
mov al,ds:byte ptr[esi]
mov al,ds:byte ptr[_irtable+eax]
mov ds:word ptr[6+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch5IR:
mov ds:byte ptr[3+edi],al
Lp4IR:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw4IR:
cmp bp,ds:word ptr[8+ecx]
jl Lp5IR
xor eax,eax
mov al,ds:byte ptr[esi]
mov al,ds:byte ptr[_irtable+eax]
mov ds:word ptr[8+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch4IR:
mov ds:byte ptr[4+edi],al
Lp5IR:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw3IR:
cmp bp,ds:word ptr[10+ecx]
jl Lp6IR
xor eax,eax
mov al,ds:byte ptr[esi]
mov al,ds:byte ptr[_irtable+eax]
mov ds:word ptr[10+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch3IR:
mov ds:byte ptr[5+edi],al
Lp6IR:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw2IR:
cmp bp,ds:word ptr[12+ecx]
jl Lp7IR
xor eax,eax
mov al,ds:byte ptr[esi]
mov al,ds:byte ptr[_irtable+eax]
mov ds:word ptr[12+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch2IR:
mov ds:byte ptr[6+edi],al
Lp7IR:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
LDraw1IR:
cmp bp,ds:word ptr[14+ecx]
jl Lp8IR
xor eax,eax
mov al,ds:byte ptr[esi]
mov al,ds:byte ptr[_irtable+eax]
mov ds:word ptr[14+ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch1IR:
mov ds:byte ptr[7+edi],al
Lp8IR:
add edx,ds:dword ptr[tstep]
sbb eax,eax
add ebp,ds:dword ptr[lzistepx]
adc ebp,0
add ebx,ds:dword ptr[_a_sstepxfrac]
adc esi,ds:dword ptr[advancetable+4+eax*4]
add edi,8
add ecx,16
dec bx
jnz LDrawLoopIR
pop esi ; restore spans pointer
LNextSpanIR:
add esi,offset spanpackage_t_size ; point to next span
LNextSpanESISetIR:
mov edx,ds:dword ptr[spanpackage_t_count+esi]
cmp edx,offset -999999 ; any more spans?
jnz LSpanLoop ; yes
pop edi
pop ebp ; restore the caller's stack frame
pop ebx ; restore register variables
pop esi
ret
;=======
; Standard One-Long Draw
;=======
; draw a one-long span
LExactlyOneLong:
mov al,[_iractive]
cmp al,0
jne LExactlyOneLongIR
mov ecx,ds:dword ptr[spanpackage_t_pz+esi]
mov ebp,ds:dword ptr[spanpackage_t_zi+esi]
ror ebp,16 ; put high 16 bits of 1/z in low word
mov ebx,ds:dword ptr[spanpackage_t_ptex+esi]
cmp bp,ds:word ptr[ecx]
jl LNextSpan
xor eax,eax
mov edi,ds:dword ptr[spanpackage_t_pdest+esi]
mov ah,ds:byte ptr[spanpackage_t_light+1+esi]
add esi,offset spanpackage_t_size ; point to next span
mov al,ds:byte ptr[ebx]
mov ds:word ptr[ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch9:
mov ds:byte ptr[edi],al
jmp LNextSpanESISet
;========
;========
; draw a one-long span
LExactlyOneLongIR:
mov ecx,ds:dword ptr[spanpackage_t_pz+esi]
mov ebp,ds:dword ptr[spanpackage_t_zi+esi]
ror ebp,16 ; put high 16 bits of 1/z in low word
mov ebx,ds:dword ptr[spanpackage_t_ptex+esi]
cmp bp,ds:word ptr[ecx]
jl LNextSpanIR
xor eax,eax
mov edi,ds:dword ptr[spanpackage_t_pdest+esi]
add esi,offset spanpackage_t_size ; point to next span
mov al,ds:byte ptr[ebx]
mov al,ds:byte ptr[_irtable+eax]
mov ds:word ptr[ecx],bp
mov al,ds:byte ptr[12345678h+eax]
LPatch9IR:
mov ds:byte ptr[edi],al
jmp LNextSpanESISetIR
;===================================
;===================================
public _D_Aff8Patch
_D_Aff8Patch:
mov eax,[_alias_colormap]
mov ds:dword ptr[LPatch1-4],eax
mov ds:dword ptr[LPatch2-4],eax
mov ds:dword ptr[LPatch3-4],eax
mov ds:dword ptr[LPatch4-4],eax
mov ds:dword ptr[LPatch5-4],eax
mov ds:dword ptr[LPatch6-4],eax
mov ds:dword ptr[LPatch7-4],eax
mov ds:dword ptr[LPatch8-4],eax
mov ds:dword ptr[LPatch9-4],eax
mov ds:dword ptr[LPatch1IR-4],eax
mov ds:dword ptr[LPatch2IR-4],eax
mov ds:dword ptr[LPatch3IR-4],eax
mov ds:dword ptr[LPatch4IR-4],eax
mov ds:dword ptr[LPatch5IR-4],eax
mov ds:dword ptr[LPatch6IR-4],eax
mov ds:dword ptr[LPatch7IR-4],eax
mov ds:dword ptr[LPatch8IR-4],eax
mov ds:dword ptr[LPatch9IR-4],eax
ret
;===================================
;===================================
height equ 4+16
public _R_PolysetScanLeftEdge
_R_PolysetScanLeftEdge:
push ebp ; preserve caller stack frame pointer
push esi ; preserve register variables
push edi
push ebx
mov eax,ds:dword ptr[height+esp]
mov ecx,ds:dword ptr[_d_sfrac]
and eax,0FFFFh
mov ebx,ds:dword ptr[_d_ptex]
or ecx,eax
mov esi,ds:dword ptr[_d_pedgespanpackage]
mov edx,ds:dword ptr[_d_tfrac]
mov edi,ds:dword ptr[_d_light]
mov ebp,ds:dword ptr[_d_zi]
; %eax: scratch
; %ebx: d_ptex
; %ecx: d_sfrac in high word, count in low word
; %edx: d_tfrac
; %esi: d_pedgespanpackage, errorterm, scratch alternately
; %edi: d_light
; %ebp: d_zi
; do
; {
LScanLoop:
; d_pedgespanpackage->ptex = ptex;
; d_pedgespanpackage->pdest = d_pdest;
; d_pedgespanpackage->pz = d_pz;
; d_pedgespanpackage->count = d_aspancount;
; d_pedgespanpackage->light = d_light;
; d_pedgespanpackage->zi = d_zi;
; d_pedgespanpackage->sfrac = d_sfrac << 16;
; d_pedgespanpackage->tfrac = d_tfrac << 16;
mov ds:dword ptr[spanpackage_t_ptex+esi],ebx
mov eax,ds:dword ptr[_d_pdest]
mov ds:dword ptr[spanpackage_t_pdest+esi],eax
mov eax,ds:dword ptr[_d_pz]
mov ds:dword ptr[spanpackage_t_pz+esi],eax
mov eax,ds:dword ptr[_d_aspancount]
mov ds:dword ptr[spanpackage_t_count+esi],eax
mov ds:dword ptr[spanpackage_t_light+esi],edi
mov ds:dword ptr[spanpackage_t_zi+esi],ebp
mov ds:dword ptr[spanpackage_t_sfrac+esi],ecx
mov ds:dword ptr[spanpackage_t_tfrac+esi],edx
; pretouch the next cache line
mov al,ds:byte ptr[spanpackage_t_size+esi]
; d_pedgespanpackage++;
add esi,offset spanpackage_t_size
mov eax,ds:dword ptr[_erroradjustup]
mov ds:dword ptr[_d_pedgespanpackage],esi
; errorterm += erroradjustup;
mov esi,ds:dword ptr[_errorterm]
add esi,eax
mov eax,ds:dword ptr[_d_pdest]
; if (errorterm >= 0)
; {
js LNoLeftEdgeTurnover
; errorterm -= erroradjustdown;
; d_pdest += d_pdestextrastep;
sub esi,ds:dword ptr[_erroradjustdown]
add eax,ds:dword ptr[_d_pdestextrastep]
mov ds:dword ptr[_errorterm],esi
mov ds:dword ptr[_d_pdest],eax
; d_pz += d_pzextrastep;
; d_aspancount += d_countextrastep;
; d_ptex += d_ptexextrastep;
; d_sfrac += d_sfracextrastep;
; d_ptex += d_sfrac >> 16;
; d_sfrac &= 0xFFFF;
; d_tfrac += d_tfracextrastep;
mov eax,ds:dword ptr[_d_pz]
mov esi,ds:dword ptr[_d_aspancount]
add eax,ds:dword ptr[_d_pzextrastep]
add ecx,ds:dword ptr[_d_sfracextrastep]
adc ebx,ds:dword ptr[_d_ptexextrastep]
add esi,ds:dword ptr[_d_countextrastep]
mov ds:dword ptr[_d_pz],eax
mov eax,ds:dword ptr[_d_tfracextrastep]
mov ds:dword ptr[_d_aspancount],esi
add edx,eax
; if (d_tfrac & 0x10000)
; {
jnc LSkip1
; d_ptex += r_affinetridesc.skinwidth;
; d_tfrac &= 0xFFFF;
add ebx,ds:dword ptr[_r_affinetridesc+atd_skinwidth]
; }
LSkip1:
; d_light += d_lightextrastep;
; d_zi += d_ziextrastep;
add edi,ds:dword ptr[_d_lightextrastep]
add ebp,ds:dword ptr[_d_ziextrastep]
; }
mov esi,ds:dword ptr[_d_pedgespanpackage]
dec ecx
test ecx,0FFFFh
jnz LScanLoop
pop ebx
pop edi
pop esi
pop ebp
ret
; else
; {
LNoLeftEdgeTurnover:
mov ds:dword ptr[_errorterm],esi
; d_pdest += d_pdestbasestep;
add eax,ds:dword ptr[_d_pdestbasestep]
mov ds:dword ptr[_d_pdest],eax
; d_pz += d_pzbasestep;
; d_aspancount += ubasestep;
; d_ptex += d_ptexbasestep;
; d_sfrac += d_sfracbasestep;
; d_ptex += d_sfrac >> 16;
; d_sfrac &= 0xFFFF;
mov eax,ds:dword ptr[_d_pz]
mov esi,ds:dword ptr[_d_aspancount]
add eax,ds:dword ptr[_d_pzbasestep]
add ecx,ds:dword ptr[_d_sfracbasestep]
adc ebx,ds:dword ptr[_d_ptexbasestep]
add esi,ds:dword ptr[_ubasestep]
mov ds:dword ptr[_d_pz],eax
mov ds:dword ptr[_d_aspancount],esi
; d_tfrac += d_tfracbasestep;
mov esi,ds:dword ptr[_d_tfracbasestep]
add edx,esi
; if (d_tfrac & 0x10000)
; {
jnc LSkip2
; d_ptex += r_affinetridesc.skinwidth;
; d_tfrac &= 0xFFFF;
add ebx,ds:dword ptr[_r_affinetridesc+atd_skinwidth]
; }
LSkip2:
; d_light += d_lightbasestep;
; d_zi += d_zibasestep;
add edi,ds:dword ptr[_d_lightbasestep]
add ebp,ds:dword ptr[_d_zibasestep]
; }
; } while (--height);
mov esi,ds:dword ptr[_d_pedgespanpackage]
dec ecx
test ecx,0FFFFh
jnz LScanLoop
pop ebx
pop edi
pop esi
pop ebp
ret
_TEXT ENDS
endif ;id386
END
|
source/prop_links.ads | jquorning/CELLE | 0 | 2121 |
with Ada.Containers.Doubly_Linked_Lists;
limited with Configs;
package Prop_Links is
-- A followset propagation link indicates that the contents of one
-- configuration followset should be propagated to another whenever
-- the first changes.
type Config_Access is access all Configs.Config_Record;
package Propagation_Lists is
new Ada.Containers.Doubly_Linked_Lists (Element_Type => Config_Access);
subtype List is Propagation_Lists.List;
procedure Append (Prop_List : in out List;
Config : in Configs.Config_Access);
procedure Delete (Prop_List : in out List);
-- Delete every plink on the list
procedure Copy (To : in out List;
From : in List);
-- Transfer every plink on the list "from" to the list "to"
end Prop_Links;
|
MultiplyingIntegerMul.asm | WilsenHernandez/MIPS-Tutorial | 0 | 163434 | .data
.text
addi $s0, $zero, 10
addi $s1, $zero, 4
mul $t0, $s0, $s1 # $t0 = 10 * 4
li $v0, 1
move $a0, $t0
syscall |
examples/ntc/main.adb | ekoeppen/MSP430_Generic_Ada_Drivers | 0 | 4259 | <filename>examples/ntc/main.adb
with MSP430_SVD; use MSP430_SVD;
with MSPGD.Board; use MSPGD.Board;
with MSPGD.Clock; use MSPGD.Clock;
with MSPGD.Clock.Source;
with MSPGD.GPIO; use MSPGD.GPIO;
with MSPGD.GPIO.Pin;
with Drivers.Text_IO;
with Drivers.NTC;
with Interfaces; use Interfaces;
procedure Main is
pragma Preelaborate;
package Text_IO is new Drivers.Text_IO (USART => UART);
package Delay_Clock is new MSPGD.Clock.Source (Frequency => 12000, Input => VLO, Source => ACLK);
package NTC is new Drivers.NTC;
procedure NTC_Test is
NTC_Value : Unsigned_32;
begin
loop
LED.Set;
NTC_Value := NTC.Value (Integer (Read_NTC));
Text_IO.Put ("NTC Value: ");
Text_IO.Put_Hex (NTC_Value);
Text_IO.New_Line;
LED.Clear;
Delay_Clock.Delay_Slow_Periods (1);
end loop;
end NTC_Test;
begin
Init;
Delay_Clock.Init;
Text_IO.Put_Line ("NTC test ...");
NTC_Test;
end Main;
|
examples/chained_signals/slots.ads | glencornell/ada-object-framework | 0 | 14611 | with Aof.Core.Signals;
with Derived_Objects;
package Slots is
procedure Xaa;
procedure Xab;
procedure Xac;
Chained_Signal : aliased Aof.Core.Signals.Empty.Signal;
Obj_1 : aliased Derived_Objects.Derived_Object;
Obj_2 : aliased Derived_Objects.Derived_Object;
end Slots;
|
programs/oeis/079/A079260.asm | jmorken/loda | 1 | 164203 | ; A079260: Characteristic function of primes of form 4n+1 (1 if n is prime of form 4n+1, 0 otherwise).
; 0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0
mov $2,$0
lpb $2
dif $2,4
cal $0,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
mov $1,$0
lpe
|
libsrc/newbrain/break_status.asm | dex4er/deb-z88dk | 1 | 88666 | <gh_stars>1-10
;
; Grundy Newbrain Specific libraries
;
; <NAME> - 30/03/2007
;
;
; Check if user pressed BREAK
; 1 if BREAK, otherwise 0
;
;
;
; $Id: break_status.asm,v 1.2 2007/06/03 15:13:06 stefano Exp $
;
XLIB break_status
.break_status
rst 20h
defb 36h
ld hl,1
ret c
dec hl
ret
|
ada/original_2008/ada-gui/agar-gui-widget-hbox.ads | auzkok/libagar | 286 | 19662 | with agar.gui.widget.box;
package agar.gui.widget.hbox is
use type agar.gui.widget.box.flags_t;
use type c.unsigned;
type hbox_t is record
box : aliased agar.gui.widget.box.box_t;
end record;
type hbox_access_t is access all hbox_t;
pragma convention (c, hbox_t);
pragma convention (c, hbox_access_t);
type flags_t is new c.unsigned;
HBOX_HOMOGENOUS : constant flags_t := flags_t (agar.gui.widget.box.BOX_HOMOGENOUS);
HBOX_HFILL : constant flags_t := flags_t (agar.gui.widget.box.BOX_HFILL);
HBOX_VFILL : constant flags_t := flags_t (agar.gui.widget.box.BOX_VFILL);
HBOX_EXPAND : constant flags_t := flags_t (agar.gui.widget.box.BOX_HFILL or agar.gui.widget.box.BOX_VFILL);
-- API
function allocate
(parent : widget_access_t;
flags : flags_t) return hbox_access_t;
pragma import (c, allocate, "agar_gui_widget_hbox_new");
procedure set_homogenous
(box : hbox_access_t;
homogenous : boolean := true);
pragma inline (set_homogenous);
procedure set_padding
(box : hbox_access_t;
padding : natural);
pragma inline (set_padding);
procedure set_spacing
(box : hbox_access_t;
spacing : natural);
pragma inline (set_spacing);
function widget (box : hbox_access_t) return widget_access_t;
pragma inline (widget);
end agar.gui.widget.hbox;
|
ada/euler9.adb | procrastiraptor/euler | 1 | 19678 | <reponame>procrastiraptor/euler
with Ada.Integer_Text_IO;
procedure Euler9 is
function Pythagorean(A, B, C: Positive) return Boolean is
(A * A + B * B = C * C);
C: Positive;
begin
for A in Positive range 1 .. 998 loop
for B in Positive range A .. 1000 - A - 1 loop
C := 1000 - A - B;
if Pythagorean(A, B, C) then
Ada.Integer_Text_IO.Put(A * B * C);
return;
end if;
end loop;
end loop;
end Euler9;
|
src-checkers/ada_toml_decode.adb | mosteo/ada-toml | 1 | 4701 | <filename>src-checkers/ada_toml_decode.adb
-- Test program. Read bytes on the standard input as a TOML document.
--
-- If it's a valid TOML document, parse it and emit on the standard output a
-- JSON representation of it.
--
-- If it's not a valid TOML document, print an error message on the standard
-- output.
with Ada.Command_Line;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
with Ada.Strings.Unbounded;
with Ada.Text_IO;
with Interfaces;
with TOML;
with TOML.Generic_Parse;
procedure Ada_TOML_Decode is
use type TOML.Any_Value_Kind;
package Cmd renames Ada.Command_Line;
package IO renames Ada.Text_IO;
type Stdin_Stream is null record;
procedure Get
(Stream : in out Stdin_Stream; EOF : out Boolean; Byte : out Character);
-- Callback for TOML.Generic_Parse
subtype Wrapped_Kind is
TOML.Any_Value_Kind range TOML.TOML_Array .. TOML.TOML_Boolean;
-- TODO: handle other kinds
function Kind_Name (Kind : Wrapped_Kind) return String;
-- Return the name expected in the JSON output for the given kind
function Strip_Number (Image : String) return String;
-- If the first character in Image is a space, return the rest of Image
procedure Dump_String (Value : TOML.Unbounded_UTF8_String);
-- Dump the given string as a JSON string literal
procedure Dump_Array (Value : TOML.TOML_Value)
with Pre => Value.Kind = TOML.TOML_Array;
-- Dump the given TOML array as a JSON array
procedure Dump (Value : TOML.TOML_Value);
-- Dump the given TOML value using the expected JSON output format.
-- Toplevel must be true for the root table, root table children and table
-- arrays.
---------------
-- Kind_Name --
---------------
function Kind_Name (Kind : Wrapped_Kind) return String is
begin
return (case Kind is
when TOML.TOML_Array => "array",
when TOML.TOML_String => "string",
when TOML.TOML_Integer => "integer",
when TOML.TOML_Float => "float",
when TOML.TOML_Boolean => "bool");
end Kind_Name;
------------------
-- Strip_Number --
------------------
function Strip_Number (Image : String) return String is
begin
if Image'Length > 0 and then Image (Image'First) = ' ' then
return Image (Image'First + 1 .. Image'Last);
else
return Image;
end if;
end Strip_Number;
-----------------
-- Dump_String --
-----------------
procedure Dump_String (Value : TOML.Unbounded_UTF8_String) is
use Ada.Strings.Unbounded;
begin
IO.Put ("""");
declare
S : constant Wide_Wide_String :=
Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Decode
(To_String (Value));
begin
for C of S loop
if C in '"' | '\' then
IO.Put ("\" & Character'Val (Wide_Wide_Character'Pos (C)));
elsif C in ' ' .. '~' then
IO.Put ((1 => Character'Val (Wide_Wide_Character'Pos (C))));
else
declare
use type Interfaces.Unsigned_32;
Codepoint : Interfaces.Unsigned_32 :=
Wide_Wide_Character'Pos (C);
Digits_Count : constant Positive :=
(if Codepoint <= 16#FFFF# then 4 else 8);
CP_Digits : String (1 .. Digits_Count);
begin
if Digits_Count = 4 then
IO.Put ("\u");
else
IO.Put ("\U");
end if;
for D of reverse CP_Digits loop
declare
subtype Hex_Digit is
Interfaces.Unsigned_32 range 0 .. 15;
Digit : constant Hex_Digit := Codepoint mod 16;
begin
case Digit is
when 0 .. 9 =>
D := Character'Val (Character'Pos ('0') + Digit);
when 10 .. 15 =>
D := Character'Val
(Character'Pos ('A') + Digit - 10);
end case;
Codepoint := Codepoint / 16;
end;
end loop;
IO.Put (CP_Digits);
end;
end if;
end loop;
end;
IO.Put ("""");
end Dump_String;
----------------
-- Dump_Array --
----------------
procedure Dump_Array (Value : TOML.TOML_Value) is
begin
IO.Put_Line ("[");
for I in 1 .. Value.Length loop
if I > 1 then
IO.Put_Line (",");
end if;
Dump (Value.Item (I));
end loop;
IO.Put_Line ("]");
end Dump_Array;
----------
-- Dump --
----------
procedure Dump (Value : TOML.TOML_Value) is
use all type TOML.Any_Value_Kind;
begin
if Value.Kind = TOML_Table then
IO.Put_Line ("{");
declare
Keys : constant TOML.Key_Array := Value.Keys;
begin
for I in Keys'Range loop
if I > Keys'First then
IO.Put_Line (",");
end if;
Dump_String (Keys (I));
IO.Put_Line (":");
Dump (Value.Get (Keys (I)));
end loop;
end;
IO.Put_Line ("}");
elsif Value.Kind = TOML.TOML_Array
and then Value.Item_Kind_Set
and then Value.Item_Kind = TOML_Table
then
Dump_Array (Value);
else
IO.Put_Line
("{""type"": """ & Kind_Name (Value.Kind) & """, ""value"":");
case Wrapped_Kind (Value.Kind) is
when TOML_Array =>
Dump_Array (Value);
when TOML_String =>
Dump_String (Value.As_Unbounded_String);
IO.New_Line;
when TOML_Integer =>
IO.Put_Line ("""" & Strip_Number (Value.As_Integer'Image)
& """");
when TOML_Float =>
raise Program_Error with "unimplemented";
when TOML_Boolean =>
if Value.As_Boolean then
IO.Put_Line ("""true""");
else
IO.Put_Line ("""false""");
end if;
end case;
IO.Put_Line ("}");
end if;
end Dump;
---------
-- Get --
---------
procedure Get
(Stream : in out Stdin_Stream; EOF : out Boolean; Byte : out Character)
is
pragma Unreferenced (Stream);
Available : Boolean;
begin
IO.Get_Immediate (Byte, Available);
EOF := not Available;
exception
when IO.End_Error =>
EOF := True;
end Get;
function Parse_File is new TOML.Generic_Parse (Stdin_Stream, Get);
Stdin : Stdin_Stream := (null record);
Result : constant TOML.Read_Result := Parse_File (Stdin);
begin
if Result.Success then
Dump (Result.Value);
else
IO.Put_Line (TOML.Format_Error (Result));
Cmd.Set_Exit_Status (Cmd.Failure);
end if;
end Ada_TOML_Decode;
|
src/Spoodle.g4 | TheOneKevin/spoodle-ts | 0 | 6516 | <reponame>TheOneKevin/spoodle-ts
grammar Spoodle;
program: statement *;
// Very important main grammar
statement
: blockstatement
| ifstatement
| forstatement
| whilestatement
| dostatement
| returnstatement
| declarevar
| exprstatement
;
exprstatement : rvalue? ';' ;
blockstatement : '{' statement* '}' ;
ifstatement : 'if' '(' rvalue ')' s1=statement ('else' s2=statement)? ;
forstatement : 'for' '(' (init1=declarevar | init2=exprstatement) cond=exprstatement fini=rvalue? ')' statement ;
whilestatement : 'while' '(' rvalue ')' statement ;
returnstatement : 'return' rvalue? ';' ;
dostatement : 'do' blockstatement 'while' '(' rvalue ')' ';' ;
declarevar : 'let' Whitespace* identifier ('=' rvalue)? ';' ;
rvalue
: ('(' rvalue ')') # r_rvalue
| identifier # r_identifier
| rvalue '(' functionparams? ')' # r_functioncall
| literal # r_literal
| a=rvalue '?' b=rvalue ':' c=rvalue # ternery
| unary rvalue # unaryoperation
| left=rvalue op=incdec # postfixoperation
| op=incdec right=rvalue # prefixoperation
| left=rvalue op=('*' | '/' | '%') right=rvalue # expression
| left=rvalue op=('+' | '-') right=rvalue # expression
| left=rvalue op=CMP right=rvalue # expression
| left=rvalue op=('&&' | '||') right=rvalue # logicalexpr
| identifier assign rvalue # assignment
| 'function' '(' functiontempl? ')' blockstatement # inlinefuncdecl
;
assign: binary? '=' ;
incdec: '++' | '--' ;
unary: '!' | '-' | '#' ;
CMP : '==' | '!=' | '<' | '<=' | '>' | '>=' ;
binary: CMP | '||' | '&&' | '-' | '+' | '%' | '*' | '/' ;
// Statements
/*reservedKeyword : RESERVED ;
RESERVED : '$emit' | '$typeof' ;*/
functiontempl : identifier (',' identifier)* ;
functionparams : rvalue (',' rvalue)* ;
identifier : (prefix = '$')? name;
name : NAME ;
NAME : [a-zA-Z_][a-zA-Z0-9_]* ;
// String parsing
literal : Floating_literal | Numeric_literal | String_literal | Boolean_literal ;
Floating_literal : DEC '.' DEC FL_SUFFIX ;
Numeric_literal : (HEX | DEC) NM_SUFFIX? ;
Boolean_literal : BOOLEAN;
String_literal : STRING ;
fragment STRING : '"' (EscapeChar | ~["\\])* '"' ;
fragment FL_SUFFIX : [fFdD] ;
fragment NM_SUFFIX : [bBsSlL] ;
fragment HEX : '0' ('x'|'X') [0-9a-fA-F]+ ;
fragment DEC : [0-9]+;
fragment BOOLEAN : 'true' | 'false';
fragment EscapeChar : '\\' (["\\/bfnrt] | UnicodeEscape) ;
fragment UnicodeEscape : 'u' HexDigit HexDigit HexDigit HexDigit ;
fragment HexDigit : [0-9a-fA-F] ;
// Whitespace Tokens
BlockComment : '/*' .*? '*/' -> skip ;
LineComment : '//' ~[\r\n]* -> skip ;
Whitespace : (' ' | '\t')+ -> skip ;
Newline : ('\r'? '\n' | '\r')+ -> skip ; |
src/Web/Semantic/DL/Category/Composition.agda | agda/agda-web-semantic | 9 | 11327 | <reponame>agda/agda-web-semantic
open import Data.Product using ( ∃ ; _×_ ; _,_ ; proj₁ ; proj₂ )
open import Relation.Unary using ( _∈_ )
open import Web.Semantic.DL.ABox using ( ABox ; ⟨ABox⟩ ; _,_ )
open import Web.Semantic.DL.ABox.Interp using
( Interp ; _,_ ; ⌊_⌋ ; ind ; _*_ )
open import Web.Semantic.DL.ABox.Interp.Morphism using
( _≲_ ; _,_ ; _**_ ; ≲⌊_⌋ ; ≲-resp-ind ; _≋_ )
open import Web.Semantic.DL.ABox.Model using
( _⊨a_ ; ⊨a-resp-≲ ; ⟨ABox⟩-resp-⊨ ; *-resp-⟨ABox⟩
; on-bnode ; bnodes ; _⊨b_ ; _,_ )
open import Web.Semantic.DL.Category.Morphism using
( _⇒_ ; _⇒_w/_ ; _,_ ; BN ; impl ; impl✓ )
open import Web.Semantic.DL.Category.Object using
( Object ; _,_ ; IN ; iface )
open import Web.Semantic.DL.Integrity using
( Unique ; Mediated ; Mediator ; Initial ; _⊕_⊨_ ; _>>_ ; _,_
; med-≲ ; med-≋ ; med-uniq ; init-≲ ; init-⊨ ; init-med
; extension ; ext-⊨ ; ext-init ; ext✓ )
open import Web.Semantic.DL.KB using ( KB ; _,_ )
open import Web.Semantic.DL.KB.Model using ( _⊨_ )
open import Web.Semantic.DL.Signature using ( Signature )
open import Web.Semantic.DL.TBox using ( TBox ; _,_ )
open import Web.Semantic.DL.TBox.Interp using
( Δ ; _⊨_≈_ ; ≈-refl ; ≈-sym ; ≈-trans ) renaming
( Interp to Interp′ )
open import Web.Semantic.DL.TBox.Model using ( _⊨t_ )
open import Web.Semantic.DL.TBox.Interp.Morphism using
( ≲-image ; ≲-refl ; ≲-trans ; ≲-resp-≈ ) renaming
( _≲_ to _≲′_ )
open import Web.Semantic.Util using
( _⊕_⊕_ ; inode ; bnode ; enode ; left ; right ; hmerge ; _∘_ )
module Web.Semantic.DL.Category.Composition {Σ : Signature} where
infixr 5 _⟫_ _∙_
_⟫_ : ∀ {V W X Y Z} → ABox Σ (X ⊕ V ⊕ Y) → ABox Σ (Y ⊕ W ⊕ Z) →
ABox Σ (X ⊕ (V ⊕ Y ⊕ W) ⊕ Z)
F ⟫ G = (⟨ABox⟩ left F , ⟨ABox⟩ right G)
pipe : ∀ {V W X Y Z} →
(J : Interp Σ (X ⊕ V ⊕ Y)) → (K : Interp Σ (Y ⊕ W ⊕ Z)) →
(enode * J ≲ inode * K) → (Interp Σ (X ⊕ (V ⊕ Y ⊕ W) ⊕ Z))
pipe (J , j) (K , k) (J≲K , j≲k) = (K , hmerge (≲-image J≲K ∘ j) k)
pipe-≳ : ∀ {V W X Y Z} → (I : Interp Σ X) →
(J : Interp Σ (X ⊕ V ⊕ Y)) → (K : Interp Σ (Y ⊕ W ⊕ Z)) →
(I≲J : I ≲ inode * J) → (J≲K : enode * J ≲ inode * K) →
(I ≲ inode * (pipe J K J≲K))
pipe-≳ (I , i) (J , j) (K , k) (I≲J , i≲j) (J≲K , j≲k) =
(≲-trans I≲J J≲K , λ x → ≲-resp-≈ J≲K (i≲j x))
pipe-left : ∀ {V W X Y Z} → (J : Interp Σ (X ⊕ V ⊕ Y)) →
(K : Interp Σ (Y ⊕ W ⊕ Z)) → (J≲K : enode * J ≲ inode * K) →
(J ≲ left * (pipe J K J≲K))
pipe-left (J , j) (K , k) (J≲K , j≲k) = (J≲K , lemma) where
lemma : ∀ x →
K ⊨ ≲-image J≲K (j x) ≈ hmerge (≲-image J≲K ∘ j) k (left x)
lemma (inode x) = ≈-refl K
lemma (bnode v) = ≈-refl K
lemma (enode y) = j≲k y
pipe-right : ∀ {V W X Y Z} → (J : Interp Σ (X ⊕ V ⊕ Y)) →
(K : Interp Σ (Y ⊕ W ⊕ Z)) → (J≲K : enode * J ≲ inode * K) →
(K ≲ right * (pipe J K J≲K))
pipe-right (J , j) (K , k) (J≲K , j≲k) = (≲-refl K , lemma) where
lemma : ∀ x →
K ⊨ k x ≈ hmerge (≲-image J≲K ∘ j) k (right x)
lemma (inode y) = ≈-refl K
lemma (bnode w) = ≈-refl K
lemma (enode z) = ≈-refl K
pipe-exp : ∀ {V W X Y Z} → (J : Interp Σ (X ⊕ V ⊕ Y)) →
(K : Interp Σ (Y ⊕ W ⊕ Z)) → (J≲K : enode * J ≲ inode * K) →
∀ KB → (enode * K ⊨ KB) → (enode * pipe J K J≲K ⊨ KB)
pipe-exp (J , j) (K , k) (J≲K , j≲k) KB K⊨KB = K⊨KB
⊨a-intro-⟫ : ∀ {V W X Y Z} → (I : Interp Σ (X ⊕ (V ⊕ Y ⊕ W) ⊕ Z)) →
(F : ABox Σ (X ⊕ V ⊕ Y)) → (G : ABox Σ (Y ⊕ W ⊕ Z)) →
(left * I ⊨a F) → (right * I ⊨a G) → (I ⊨a F ⟫ G)
⊨a-intro-⟫ (I , i) F G I⊨F I⊨G =
( ⟨ABox⟩-resp-⊨ left (λ x → ≈-refl I) F I⊨F
, ⟨ABox⟩-resp-⊨ right (λ x → ≈-refl I) G I⊨G )
⊨b-intro-⟫ : ∀ {V₁ W₁ V₂ W₂ X Y Z} → (I : Interp Σ (X ⊕ (V₁ ⊕ Y ⊕ W₁) ⊕ Z)) →
(F : ABox Σ (X ⊕ V₂ ⊕ Y)) → (G : ABox Σ (Y ⊕ W₂ ⊕ Z)) →
(left * I ⊨b F) → (right * I ⊨b G) → (I ⊨b F ⟫ G)
⊨b-intro-⟫ {V₂ = V₂} {W₂ = W₂} {Y = Y} (I , i) F G (f , I⊨F) (g , I⊨G) =
(h , I⊨F⟫G) where
h : (V₂ ⊕ Y ⊕ W₂) → Δ I
h (inode v) = f v
h (bnode y) = i (bnode (bnode y))
h (enode w) = g w
lemmaˡ : ∀ x →
I ⊨ on-bnode f (i ∘ left) x ≈ on-bnode h i (left x)
lemmaˡ (inode x) = ≈-refl I
lemmaˡ (bnode v) = ≈-refl I
lemmaˡ (enode y) = ≈-refl I
lemmaʳ : ∀ x →
I ⊨ on-bnode g (i ∘ right) x ≈ on-bnode h i (right x)
lemmaʳ (inode x) = ≈-refl I
lemmaʳ (bnode v) = ≈-refl I
lemmaʳ (enode y) = ≈-refl I
I⊨F⟫G : bnodes (I , i) h ⊨a F ⟫ G
I⊨F⟫G = ⊨a-intro-⟫ (bnodes (I , i) h) F G
(⊨a-resp-≲ (≲-refl I , lemmaˡ) F I⊨F)
(⊨a-resp-≲ (≲-refl I , lemmaʳ) G I⊨G)
pipe-uniq : ∀ {V W X Y Z} I J K (M : Interp Σ (X ⊕ (V ⊕ Y ⊕ W) ⊕ Z))
(I≲J : I ≲ inode * J) (I≲M : I ≲ inode * M) →
(J≲K : enode * J ≲ inode * K) (J≲M : J ≲ left * M) →
(I≲M ≋ I≲J >> J≲M) →
(Unique I J (left * M) I≲J I≲M) →
(Unique (enode * J) K (right * M) J≲K (enode ** J≲M)) →
(Unique I (pipe J K J≲K) M (pipe-≳ I J K I≲J J≲K) I≲M)
pipe-uniq {V} {W} {X} {Y} {Z} (I , i) (J , j) (K , k) (M , m)
(I≲J , i≲j) (I≲M , i≲m) (J≲K , j≲k) (J≲M , j≲m) I≲M≋I≲J≲M J≲M-uniq K≲M-uniq
(L≲₁M , l≲₁m) (L≲₂M , l≲₂m) I≲M≋I≲L≲₁M I≲M≋I≲L≲₂M =
K≲M-uniq
(L≲₁M , lemmaʳ L≲₁M l≲₁m I≲M≋I≲L≲₁M)
(L≲₂M , lemmaʳ L≲₂M l≲₂m I≲M≋I≲L≲₂M)
(J≲M-uniq (J≲M , j≲m)
(≲-trans J≲K L≲₁M , lemmaˡ L≲₁M l≲₁m I≲M≋I≲L≲₁M)
I≲M≋I≲J≲M
I≲M≋I≲L≲₁M )
(J≲M-uniq (J≲M , j≲m)
( ≲-trans J≲K L≲₂M , lemmaˡ L≲₂M l≲₂m I≲M≋I≲L≲₂M)
I≲M≋I≲J≲M
I≲M≋I≲L≲₂M ) where
L : Interp′ Σ
L = K
l : (X ⊕ (V ⊕ Y ⊕ W) ⊕ Z) → Δ L
l = hmerge (≲-image J≲K ∘ j) k
I≲L : I ≲′ L
I≲L = ≲-trans I≲J J≲K
lemmaˡ : ∀ L≲M → (∀ x → M ⊨ ≲-image L≲M (l x) ≈ m x) →
(∀ x → M ⊨ ≲-image I≲M x ≈ ≲-image L≲M (≲-image I≲L x)) →
∀ x → M ⊨ ≲-image L≲M (≲-image J≲K (j x)) ≈ m (left x)
lemmaˡ L≲M l≲m I≲M≋I≲L≲M (inode x) = l≲m (inode x)
lemmaˡ L≲M l≲m I≲M≋I≲L≲M (bnode v) = l≲m (bnode (inode v))
lemmaˡ L≲M l≲m I≲M≋I≲L≲M (enode y) =
≈-trans M (≲-resp-≈ L≲M (j≲k y)) (l≲m (bnode (bnode y)))
lemmaʳ : ∀ L≲M → (∀ x → M ⊨ ≲-image L≲M (l x) ≈ m x) →
(∀ x → M ⊨ ≲-image I≲M x ≈ ≲-image L≲M (≲-image I≲L x)) →
∀ x → M ⊨ ≲-image L≲M (k x) ≈ m (right x)
lemmaʳ L≲M l≲m I≲M≋I≲L≲M (inode y) = l≲m (bnode (bnode y))
lemmaʳ L≲M l≲m I≲M≋I≲L≲M (bnode w) = l≲m (bnode (enode w))
lemmaʳ L≲M l≲m I≲M≋I≲L≲M (enode z) = l≲m (enode z)
pipe-mediated : ∀ {V W X Y Z} I J K (M : Interp Σ (X ⊕ (V ⊕ Y ⊕ W) ⊕ Z))
(I≲J : I ≲ inode * J) (I≲M : I ≲ inode * M) →
(J≲K : enode * J ≲ inode * K) →
(m : Mediated I J (left * M) I≲J I≲M) →
(Mediated (enode * J) K (right * M) J≲K (enode ** (med-≲ m))) →
(Mediated I (pipe J K J≲K) M (pipe-≳ I J K I≲J J≲K) I≲M)
pipe-mediated {V} {W} {X} {Y} {Z} (I , i) (J , j) (K , k) (M , m)
(I≲J , i≲j) (I≲M , i≲m) (J≲K , j≲k)
((J≲M , j≲m) , I≲M≋I≲J≲M , J≲M-uniq)
((K≲M , k≲m) , J≲M≋J≲K≲M , K≲M-uniq) =
( (L≲M , l≲m) , I≲M≋I≲L≲M , L≲M-uniq) where
L : Interp′ Σ
L = K
l : (X ⊕ (V ⊕ Y ⊕ W) ⊕ Z) → Δ L
l = hmerge (≲-image J≲K ∘ j) k
I≲L : I ≲′ L
I≲L = ≲-trans I≲J J≲K
i≲l : ∀ x → L ⊨ ≲-image I≲L (i x) ≈ l (inode x)
i≲l x = ≲-resp-≈ J≲K (i≲j x)
L≲M : L ≲′ M
L≲M = K≲M
l≲m : ∀ x → M ⊨ ≲-image K≲M (l x) ≈ m x
l≲m (inode x) =
≈-trans M (≈-sym M (J≲M≋J≲K≲M (j (inode x)))) (j≲m (inode x))
l≲m (bnode (inode v)) =
≈-trans M (≈-sym M (J≲M≋J≲K≲M (j (bnode v)))) (j≲m (bnode v))
l≲m (bnode (bnode y)) = k≲m (inode y)
l≲m (bnode (enode w)) = k≲m (bnode w)
l≲m (enode z) = k≲m (enode z)
I≲M≋I≲L≲M : ∀ x → M ⊨ ≲-image I≲M x ≈ ≲-image L≲M (≲-image I≲L x)
I≲M≋I≲L≲M x = ≈-trans M (I≲M≋I≲J≲M x) (J≲M≋J≲K≲M (≲-image I≲J x))
L≲M-uniq : Unique (I , i) (L , l) (M , m) (I≲L , i≲l) (I≲M , i≲m)
L≲M-uniq = pipe-uniq (I , i) (J , j) (K , k) (M , m)
(I≲J , i≲j) (I≲M , i≲m) (J≲K , j≲k) (J≲M , j≲m)
I≲M≋I≲J≲M J≲M-uniq K≲M-uniq
pipe-mediator : ∀ S {V W X Y Z I}
{J : Interp Σ (X ⊕ V ⊕ Y)} {K : Interp Σ (Y ⊕ W ⊕ Z)} {I≲J J≲K} F G →
(Mediator I J I≲J (S , F)) → (Mediator (enode * J) K J≲K (S , G)) →
(Mediator I (pipe J K J≲K) (pipe-≳ I J K I≲J J≲K) (S , F ⟫ G))
pipe-mediator S {V} {W} {X} {Y} {Z}
{I , i} {J , j} {K , k} {I≲J , i≲j} {J≲K , j≲k}
F G J-med K-med (M , m) (I≲M , i≲m) (M⊨S , M⊨F , M⊨G) =
pipe-mediated (I , i) (J , j) (K , k) (M , m)
(I≲J , i≲j) (I≲M , i≲m) (J≲K , j≲k)
I≲J≲M-med J≲K≲M-med where
mˡ : (X ⊕ V ⊕ Y) → Δ M
mˡ x = m (left x)
mʳ : (Y ⊕ W ⊕ Z) → Δ M
mʳ x = m (right x)
I≲J≲M-med : Mediated (I , i) (J , j) (M , mˡ) (I≲J , i≲j) (I≲M , i≲m)
I≲J≲M-med = J-med (M , mˡ) (I≲M , i≲m)
(M⊨S , *-resp-⟨ABox⟩ left (M , m) F M⊨F)
J≲M : J ≲′ M
J≲M = ≲⌊ med-≲ I≲J≲M-med ⌋
j≲m : ∀ x → M ⊨ ≲-image J≲M (j x) ≈ mˡ x
j≲m = ≲-resp-ind (med-≲ I≲J≲M-med)
j′ : Y → Δ J
j′ y = j (enode y)
j≲m′ : ∀ x → M ⊨ ≲-image J≲M (j′ x) ≈ m (bnode (bnode x))
j≲m′ x = j≲m (enode x)
J≲K≲M-med : Mediated (J , j′) (K , k) (M , mʳ) (J≲K , j≲k) (J≲M , j≲m′)
J≲K≲M-med = K-med (M , mʳ) (J≲M , j≲m′)
(M⊨S , *-resp-⟨ABox⟩ right (M , m) G M⊨G)
pipe-init : ∀ {S V W X Y Z I}
{J : Interp Σ (X ⊕ V ⊕ Y)} {K : Interp Σ (Y ⊕ W ⊕ Z)} {F G} →
(J-init : J ∈ Initial I (S , F)) →
(K-init : K ∈ Initial (enode * J) (S , G)) →
(pipe J K (init-≲ K-init) ∈ Initial I (S , F ⟫ G))
pipe-init {S} {V} {W} {X} {Y} {Z} {I , i} {J , j} {K , k} {F} {G}
((I≲J , i≲j) , (J⊨S , J⊨F) , J-med) ((J≲K , j≲k) , (K⊨S , K⊨G) , K-med) =
( (I≲L , i≲l) , (L⊨S , L⊨F⟫G) , L-med) where
L : Interp′ Σ
L = K
l : (X ⊕ (V ⊕ Y ⊕ W) ⊕ Z) → Δ L
l = hmerge (≲-image J≲K ∘ j) k
I≲L : I ≲′ L
I≲L = ≲-trans I≲J J≲K
i≲l : ∀ x → L ⊨ ≲-image I≲L (i x) ≈ l (inode x)
i≲l x = ≲-resp-≈ J≲K (i≲j x)
L⊨S : L ⊨t S
L⊨S = K⊨S
L⊨F⟫G : (L , l) ⊨a F ⟫ G
L⊨F⟫G = ⊨a-intro-⟫ (L , l) F G
(⊨a-resp-≲ (pipe-left (J , j) (K , k) (J≲K , j≲k)) F J⊨F)
(⊨a-resp-≲ (pipe-right (J , j) (K , k) (J≲K , j≲k)) G K⊨G)
L-med : Mediator (I , i) (L , l) (I≲L , i≲l) (S , F ⟫ G)
L-med = pipe-mediator S F G J-med K-med
compose-⊨ : ∀ {S T V W X Y Z} A B C
(F : ABox Σ (X ⊕ V ⊕ Y)) (G : ABox Σ (Y ⊕ W ⊕ Z)) →
(∀ I → (I ⊨ (S , T) , A) → (I ⊕ S , F ⊨ T , B)) →
(∀ J → (J ⊨ (S , T) , B) → (J ⊕ S , G ⊨ T , C)) →
(∀ I → (I ⊨ (S , T) , A) → (I ⊕ S , F ⟫ G ⊨ T , C))
compose-⊨ {S} {T} {V} {W} {X} {Y} {Z} A B C F G F✓ G✓ I I⊨STA =
( pipe J K J≲K
, pipe-init J-init K-init
, pipe-exp J K J≲K (T , C) K⊨TC ) where
I⊕SF⊨TB : I ⊕ S , F ⊨ T , B
I⊕SF⊨TB = F✓ I I⊨STA
J : Interp Σ (X ⊕ V ⊕ Y)
J = extension I⊕SF⊨TB
J-init : J ∈ Initial I (S , F)
J-init = ext-init I⊕SF⊨TB
J⊕SG⊨TC : enode * J ⊕ S , G ⊨ T , C
J⊕SG⊨TC = G✓ (enode * J) (ext✓ I⊕SF⊨TB)
K : Interp Σ (Y ⊕ W ⊕ Z)
K = extension J⊕SG⊨TC
K⊨TC : enode * K ⊨ (T , C)
K⊨TC = ext-⊨ J⊕SG⊨TC
K-init : K ∈ Initial (enode * J) (S , G)
K-init = ext-init J⊕SG⊨TC
J≲K : enode * J ≲ inode * K
J≲K = init-≲ K-init
_∙′_ : ∀ {S T} {A B C : Object S T} → (F : A ⇒ B) → (G : B ⇒ C) →
(A ⇒ C w/ (BN F ⊕ IN B ⊕ BN G))
_∙′_ {S} {T} {X , X∈Fin , A} {Y , Y∈Fin , B} {Z , Z∈Fin , C} (V , F , F✓) (W , G , G✓) =
(F ⟫ G , compose-⊨ A B C F G F✓ G✓)
_∙_ : ∀ {S T} {A B C : Object S T} → (A ⇒ B) → (B ⇒ C) → (A ⇒ C)
F ∙ G = ( _ , F ∙′ G )
|
programs/oeis/164/A164560.asm | neoneye/loda | 22 | 169762 | <filename>programs/oeis/164/A164560.asm
; A164560: Partial sums of A164532.
; 1,5,11,35,71,215,431,1295,2591,7775,15551,46655,93311,279935,559871,1679615,3359231,10077695,20155391,60466175,120932351,362797055,725594111,2176782335,4353564671,13060694015,26121388031,78364164095,156728328191,470184984575,940369969151,2821109907455,5642219814911,16926659444735,33853318889471,101559956668415,203119913336831,609359740010495,1218719480020991,3656158440062975,7312316880125951,21936950640377855,43873901280755711,131621703842267135,263243407684534271,789730223053602815,1579460446107205631,4738381338321616895,9476762676643233791,28430288029929701375,56860576059859402751,170581728179578208255,341163456359156416511,1023490369077469249535,2046980738154938499071,6140942214464815497215,12281884428929630994431,36845653286788892983295,73691306573577785966591,221073919720733357899775,442147839441466715799551,1326443518324400147398655,2652887036648800294797311,7958661109946400884391935,15917322219892801768783871,47751966659678405306351615,95503933319356810612703231,286511799958070431838109695,573023599916140863676219391,1719070799748422591028658175,3438141599496845182057316351,10314424798490535546171949055,20628849596981071092343898111,61886548790943213277031694335,123773097581886426554063388671,371319292745659279662190166015,742638585491318559324380332031,2227915756473955677973140996095,4455831512947911355946281992191,13367494538843734067838845976575,26734989077687468135677691953151,80204967233062404407033075859455,160409934466124808814066151718911,481229803398374426442198455156735,962459606796748852884396910313471,2887378820390246558653190730940415,5774757640780493117306381461880831,17324272922341479351919144385642495,34648545844682958703838288771284991,103945637534048876111514866313854975,207891275068097752223029732627709951,623673825204293256669089197883129855
add $0,1
mov $1,1
mov $2,$0
lpb $0
sub $0,1
gcd $2,2
add $2,1
mul $1,$2
lpe
sub $1,1
mov $0,$1
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/pack15.ads | best08618/asylo | 7 | 25459 | <reponame>best08618/asylo
package Pack15 is
type Flags is array (1..2) of Boolean;
for Flags'Component_Size use 1;
type Messages is record
Status_Flags : Flags;
end record;
for Messages use record
Status_Flags at 0 range 1 .. 2;
end record;
O : Messages;
Buffer : Integer;
Status_Flags : Flags;
for Status_Flags'Address use Buffer'Address;
procedure Transfer;
end Pack15;
|
source/amf/uml/amf-internals-tables-standard_profile_l3_metamodel-links.adb | svn2github/matreshka | 24 | 25854 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Internals.Links;
with AMF.Internals.Tables.CMOF_Metamodel;
with AMF.Internals.Tables.UML_Metamodel;
package body AMF.Internals.Tables.Standard_Profile_L3_Metamodel.Links is
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Initialize_1;
Initialize_2;
Initialize_3;
Initialize_4;
Initialize_5;
Initialize_6;
Initialize_7;
Initialize_8;
Initialize_9;
Initialize_10;
Initialize_11;
Initialize_12;
Initialize_13;
Initialize_14;
Initialize_15;
end Initialize;
------------------
-- Initialize_1 --
------------------
procedure Initialize_1 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Classifier_Attribute_Classifier,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Attribute_A_Classifier,
Base + 4,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Classifier_Classifier_Attribute);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Classifier_Feature_Featuring_Classifier,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier,
Base + 4,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Feature_Featuring_Classifier_Classifier_Feature);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 4,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Class_Owned_Attribute_Class,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Class_Owned_Attribute_Property_Class,
Base + 4,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Class_Class_Owned_Attribute);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 4,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 4,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
end Initialize_1;
------------------
-- Initialize_2 --
------------------
procedure Initialize_2 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Classifier_Attribute_Classifier,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Attribute_A_Classifier,
Base + 5,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Classifier_Classifier_Attribute);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Classifier_Feature_Featuring_Classifier,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier,
Base + 5,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Feature_Featuring_Classifier_Classifier_Feature);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 5,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Class_Owned_Attribute_Class,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Class_Owned_Attribute_Property_Class,
Base + 5,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Class_Class_Owned_Attribute);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 5,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 5,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
end Initialize_2;
------------------
-- Initialize_3 --
------------------
procedure Initialize_3 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Classifier_Attribute_Classifier,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Attribute_A_Classifier,
Base + 6,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Classifier_Classifier_Attribute);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Classifier_Feature_Featuring_Classifier,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier,
Base + 6,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Feature_Featuring_Classifier_Classifier_Feature);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 6,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Class_Owned_Attribute_Class,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Class_Owned_Attribute_Property_Class,
Base + 6,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Class_Class_Owned_Attribute);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 6,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 6,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
end Initialize_3;
------------------
-- Initialize_4 --
------------------
procedure Initialize_4 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Typed_Element_Type_Typed_Element,
Base + 4,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element,
AMF.Internals.Tables.UML_Metamodel.MC_UML_Component,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Typed_Element_Typed_Element_Type);
end Initialize_4;
------------------
-- Initialize_5 --
------------------
procedure Initialize_5 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Typed_Element_Type_Typed_Element,
Base + 5,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element,
AMF.Internals.Tables.UML_Metamodel.MC_UML_Model,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Typed_Element_Typed_Element_Type);
end Initialize_5;
------------------
-- Initialize_6 --
------------------
procedure Initialize_6 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Typed_Element_Type_Typed_Element,
Base + 6,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element,
AMF.Internals.Tables.UML_Metamodel.MC_UML_Model,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Typed_Element_Typed_Element_Type);
end Initialize_6;
------------------
-- Initialize_7 --
------------------
procedure Initialize_7 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Classifier_Feature_Featuring_Classifier,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier,
Base + 14,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Feature_Featuring_Classifier_Classifier_Feature);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 14,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 14,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 6,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Association_Member_End_Association,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Member_End_Property_Association,
Base + 14,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Association_Association_Member_End);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Association_Member_End_Association,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Member_End_Property_Association,
Base + 6,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Association_Association_Member_End);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 14,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Association_Owned_End_Owning_Association,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Owned_End_Property_Owning_Association,
Base + 14,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Owning_Association_Association_Owned_End);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 14,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
end Initialize_7;
------------------
-- Initialize_8 --
------------------
procedure Initialize_8 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Classifier_Feature_Featuring_Classifier,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier,
Base + 12,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Feature_Featuring_Classifier_Classifier_Feature);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 12,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 12,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 4,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Association_Member_End_Association,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Member_End_Property_Association,
Base + 12,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Association_Association_Member_End);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Association_Member_End_Association,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Member_End_Property_Association,
Base + 4,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Association_Association_Member_End);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 12,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Association_Owned_End_Owning_Association,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Owned_End_Property_Owning_Association,
Base + 12,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Owning_Association_Association_Owned_End);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 12,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
end Initialize_8;
------------------
-- Initialize_9 --
------------------
procedure Initialize_9 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Classifier_Feature_Featuring_Classifier,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Feature_Feature_Featuring_Classifier,
Base + 13,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Feature_Featuring_Classifier_Classifier_Feature);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 13,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 13,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 5,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Association_Member_End_Association,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Member_End_Property_Association,
Base + 13,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Association_Association_Member_End);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Association_Member_End_Association,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Member_End_Property_Association,
Base + 5,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Association_Association_Member_End);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 13,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Association_Owned_End_Owning_Association,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Owned_End_Property_Owning_Association,
Base + 13,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Owning_Association_Association_Owned_End);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 13,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
end Initialize_9;
-------------------
-- Initialize_10 --
-------------------
procedure Initialize_10 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Member_A_Namespace,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Namespace_Namespace_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 11,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Owned_Element_Owner,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owned_Element_Element_Owner,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Owner_Element_Owned_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Member_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Owned_Member_Named_Element_Namespace,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Namespace_Namespace_Owned_Member);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Owned_Type_Package,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Owned_Type_Type_Package,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Owned_Type_Package,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Owned_Type_Type_Package,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Owned_Type_Package,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Owned_Type_Type_Package,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Type_Package_Package_Owned_Type);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Package_Import_Importing_Namespace,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Namespace_Package_Import_Package_Import_Importing_Namespace,
Base + 11,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Import_Importing_Namespace_Namespace_Package_Import);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Packaged_Element_Owning_Package,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Packaged_Element_A_Owning_Package,
Base + 8,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Owning_Package_Package_Packaged_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Packaged_Element_Owning_Package,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Packaged_Element_A_Owning_Package,
Base + 9,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Owning_Package_Package_Packaged_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Packaged_Element_Owning_Package,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Packaged_Element_A_Owning_Package,
Base + 7,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Owning_Package_Package_Packaged_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Packaged_Element_Owning_Package,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Packaged_Element_A_Owning_Package,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Owning_Package_Package_Packaged_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Packaged_Element_Owning_Package,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Packaged_Element_A_Owning_Package,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Owning_Package_Package_Packaged_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Packaged_Element_Owning_Package,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Packaged_Element_A_Owning_Package,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Owning_Package_Package_Packaged_Element);
end Initialize_10;
-------------------
-- Initialize_11 --
-------------------
procedure Initialize_11 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Import_Imported_Package_Package_Import,
Base + 11,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Import_Imported_Package_A_Package_Import,
AMF.Internals.Tables.UML_Metamodel.MM_UML_UML,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Package_Import_Package_Import_Imported_Package);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Relationship_Related_Element_Relationship,
Base + 11,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Relationship_Related_Element_A_Relationship,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Relationship_Relationship_Related_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Relationship_Related_Element_Relationship,
Base + 11,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Relationship_Related_Element_A_Relationship,
AMF.Internals.Tables.UML_Metamodel.MM_UML_UML,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Relationship_Relationship_Related_Element);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Directed_Relationship_Source_Directed_Relationship,
Base + 11,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Directed_Relationship_Source_A_Directed_Relationship,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Directed_Relationship_Directed_Relationship_Source);
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Directed_Relationship_Target_Directed_Relationship,
Base + 11,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Directed_Relationship_Target_A_Directed_Relationship,
AMF.Internals.Tables.UML_Metamodel.MM_UML_UML,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Directed_Relationship_Directed_Relationship_Target);
end Initialize_11;
-------------------
-- Initialize_12 --
-------------------
procedure Initialize_12 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Typed_Element_Type_Typed_Element,
Base + 12,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element,
Base + 1,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Typed_Element_Typed_Element_Type);
end Initialize_12;
-------------------
-- Initialize_13 --
-------------------
procedure Initialize_13 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Typed_Element_Type_Typed_Element,
Base + 13,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element,
Base + 2,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Typed_Element_Typed_Element_Type);
end Initialize_13;
-------------------
-- Initialize_14 --
-------------------
procedure Initialize_14 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Typed_Element_Type_Typed_Element,
Base + 14,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Typed_Element_Type_A_Typed_Element,
Base + 3,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Typed_Element_Typed_Element_Type);
end Initialize_14;
-------------------
-- Initialize_15 --
-------------------
procedure Initialize_15 is
begin
AMF.Internals.Links.Internal_Create_Link
(AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Tag_Element_Tag,
Base + 15,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Tag_Element_A_Tag,
Base + 10,
AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_A_Tag_Tag_Element);
end Initialize_15;
end AMF.Internals.Tables.Standard_Profile_L3_Metamodel.Links;
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48_notsx.log_2_190.asm | ljhsiun2/medusa | 9 | 173136 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r8
push %rbp
push %rcx
push %rdx
push %rsi
lea addresses_D_ht+0x85a8, %rsi
nop
sub %rcx, %rcx
vmovups (%rsi), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r8
nop
nop
xor $65476, %rbp
lea addresses_WT_ht+0x1d328, %r10
nop
lfence
and $0xffffffffffffffc0, %r10
vmovntdqa (%r10), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %r13
nop
nop
nop
nop
nop
add $30272, %rcx
pop %rsi
pop %rdx
pop %rcx
pop %rbp
pop %r8
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %rax
push %rbp
push %rcx
push %rdi
// Store
lea addresses_US+0x4e28, %rdi
nop
nop
nop
nop
nop
and $50061, %rcx
mov $0x5152535455565758, %r13
movq %r13, %xmm1
vmovaps %ymm1, (%rdi)
nop
nop
nop
nop
nop
cmp $33025, %rbp
// Store
lea addresses_WC+0x14d60, %rcx
nop
nop
cmp $63902, %r10
movw $0x5152, (%rcx)
nop
nop
add %r11, %r11
// Store
mov $0xb28, %r10
cmp $3237, %rax
mov $0x5152535455565758, %r13
movq %r13, (%r10)
nop
nop
nop
xor $9531, %r10
// Store
lea addresses_normal+0x728, %rax
nop
nop
nop
nop
and %rbp, %rbp
movw $0x5152, (%rax)
nop
nop
nop
nop
nop
add %rbp, %rbp
// Store
lea addresses_PSE+0x1ee8, %r11
nop
add $25874, %rbp
movw $0x5152, (%r11)
nop
xor $56900, %rbp
// Store
lea addresses_RW+0x11588, %rdi
nop
sub %rcx, %rcx
movw $0x5152, (%rdi)
nop
nop
nop
nop
dec %rcx
// Faulty Load
lea addresses_US+0x197a8, %r11
cmp $19289, %rdi
mov (%r11), %ecx
lea oracles, %rbp
and $0xff, %rcx
shlq $12, %rcx
mov (%rbp,%rcx,1), %rcx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_US', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_US', 'congruent': 7}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WC', 'congruent': 2}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 8, 'type': 'addresses_P', 'congruent': 7}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_normal', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_PSE', 'congruent': 6}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_RW', 'congruent': 4}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_US', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 8}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT_ht', 'congruent': 7}}
{'00': 2}
00 00
*/
|
samples/sms/common/vdp_data_buffer.asm | 0x8BitDev/MAPeD-SPReD | 23 | 163313 | ;########################################################################
;
; VDP Data Buffer
;
; Copyright 2020 0x8BitDev ( MIT license )
;
;########################################################################
; Dynamic VDP data buffer to transfer graphics data during VBLANK
; Public routines:
;
; buff_reset
; buff_push_hdr
; buff_push_data
; buff_end
; buff_apply
;
; need_draw
;
.define TR_FAST_ROW_FILLING 1
.define TR_VRAM_SCR_ATTR_ADDR $3800
.define TR_BUFF_STEP_64 %10000000 ; 1 by default
.define TR_BUFF_END 0 ; end of the buffer
;*** loop VRAM attribute address ***
.macro LOOP_VRAM_ATTR_ADDR_HL ; \1 - 1-immediate ret, 0-continue
ld a, h
cp >TR_VRAM_SCR_ATTR_ADDR + $07 ; $3f
.if \1 == 1
ret m
.else
jp m, _cont\@
.endif
; clamp address to $3800-$3f00 range
ld de, $700
and a
sbc hl, de
.if \1 == 0
_cont\@:
.endif
.endm
; *** reset the buffer state ***
buff_reset:
xor a
ld (tr_buff), a
ld hl, tr_buff
ld (tr_buff_addr), hl
ret
; *** push data header before data filling ***
; IN: A - flags | length
; DE - VRAM addr
buff_push_hdr:
ld hl, (tr_buff_addr)
ld (hl), a
inc hl
ld (hl), e
inc hl
ld (hl), d
inc hl
ld (tr_buff_addr), hl
ret
; *** push data into the buffer ***
; IN: DE - data
buff_push_data:
ld hl, (tr_buff_addr)
ld (hl), e
inc hl
ld (hl), d
inc hl
ld (tr_buff_addr), hl
ret
; *** data end marker ***
buff_end:
ld hl, (tr_buff_addr)
ld a, TR_BUFF_END
ld (hl), a
ret
; *** transfer the buffer data to the VDP ***
buff_apply:
ld hl, tr_buff
_buff_load_header:
ld a, (hl)
ld c, a
cp TR_BUFF_END
jr nz, _buff_cont
ret
_buff_cont:
and TR_BUFF_STEP_64
jr z, _buff_step_1
; 32 bytes step
call _buff_set_VDP_addr
push de
exx
pop de
exx
_buff_data_loop:
VDP_SCR_ATTR_TO_DATA_REG_HL
; VRAMaddr += 64
exx
ld hl, $40
add hl, de
LOOP_VRAM_ATTR_ADDR_HL 0
ex de, hl
VDP_WRITE_RAM_CMD_DE
exx
djnz _buff_data_loop
jp _buff_load_header
_buff_step_1:
call _buff_set_VDP_addr
.if TR_FAST_ROW_FILLING == 1
sla b
ld c, VDP_CMD_DATA_REG
otir
.else
push de
exx
pop de
ld a, e
and %11000000
ld c, a
exx
_buff_data_loop2:
VDP_SCR_ATTR_TO_DATA_REG_HL
; VRAMaddr += 2
exx
ld a, e
add a, 2
and %00111111
or c
ld e, a
VDP_WRITE_RAM_CMD_DE
exx
djnz _buff_data_loop2
.endif
jp _buff_load_header
_buff_set_VDP_addr:
; OUT: B - data length
ld a, c
and ~TR_BUFF_STEP_64 ; a - data length
ld b, a
; get VRAM addr
inc hl
ld e, (hl)
inc hl
ld d, (hl)
inc hl
VDP_WRITE_RAM_CMD_DE
ret
; *** is there any data in the buffer for transfer to the VDP? ***
; OUT: A != 0 - need draw
need_draw:
ld hl, tr_buff
ld a, (hl)
ret |
programs/oeis/078/A078112.asm | karttu/loda | 1 | 174880 | <gh_stars>1-10
; A078112: Coefficients a(n) in the unique expansion sin(1) = Sum[a(n)/n!, n>=1], where a(n) satisfies 0<=a(n)<n.
; 0,1,2,0,0,5,6,0,0,9,10,0,0,13,14,0,0,17,18,0,0,21,22,0,0,25,26,0,0,29,30,0,0,33,34,0,0,37,38,0,0,41,42,0,0,45,46,0,0,49,50,0,0,53,54,0,0,57,58,0,0,61,62,0,0,65,66,0,0,69,70,0,0,73,74,0,0,77,78,0,0,81,82,0,0,85,86,0,0,89,90,0,0,93,94,0,0,97,98,0,0,101,102,0,0,105,106,0,0,109,110,0,0,113,114,0,0,117,118,0,0,121,122,0,0,125,126,0,0,129,130,0,0,133,134,0,0,137,138,0,0,141,142,0,0,145,146,0,0,149,150,0,0,153,154,0,0,157,158,0,0,161,162,0,0,165,166,0,0,169,170,0,0,173,174,0,0,177,178,0,0,181,182,0,0,185,186,0,0,189,190,0,0,193,194,0,0,197,198,0,0,201,202,0,0,205,206,0,0,209,210,0,0,213,214,0,0,217,218,0,0,221,222,0,0,225,226,0,0,229,230,0,0,233,234,0,0,237,238,0,0,241,242,0,0,245,246,0,0,249
mov $1,$0
add $0,1
div $0,2
mod $0,2
mul $1,$0
|
Kernel/interruptions/interrupts.asm | gbaliarda/TP_ARQUI | 0 | 166325 |
GLOBAL _cli
GLOBAL _sti
GLOBAL picMasterMask
GLOBAL picSlaveMask
GLOBAL haltcpu
EXTERN ncPrintReg
GLOBAL dumpRegs
GLOBAL _hlt
GLOBAL _irq00Handler
GLOBAL _irq01Handler
GLOBAL _irq02Handler
GLOBAL _irq03Handler
GLOBAL _irq04Handler
GLOBAL _irq05Handler
GLOBAL _exception0Handler
GLOBAL _exception6Handler
EXTERN irqDispatcher
EXTERN exceptionDispatcher
EXTERN runShells
EXTERN rebootConsole
EXTERN saveBackup
SECTION .text
%macro pushState 0
push rax
push rbx
push rcx
push rdx
push rbp
push rdi
push rsi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
%endmacro
%macro popState 0
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rsi
pop rdi
pop rbp
pop rdx
pop rcx
pop rbx
pop rax
%endmacro
%macro irqHandlerMaster 1
pushState
cli ; linea agregada para que no se puede interrumpir las interrupciones de hardware. Para atender de a una interrupcion a la vez.
mov rax, %1
cmp rax, 1
jne .continue
call saveBackup ; si tenemos una interrupcion de teclado, guardamos una copia de los registros en ese momento, por las dudas que necesitemos almacenarlos
.continue:
mov rdi, %1 ; pasaje de parametro
call irqDispatcher
; signal pic EOI (End of Interrupt)
mov al, 20h
out 20h, al
sti ; linea agregada para deshabilitar que no se pueda interrumpir las interrupciones de hardware
popState
iretq
%endmacro
%macro exceptionHandler 1
pushState
mov rdi, %1 ; pasaje de parametro
call exceptionDispatcher
call dumpRegs
popState
pop rax ; rip esta arriba del stack
printReg rax, 14 ; imprime el IP de donde se produjo la exception
call rebootConsole
mov rax, 400000h ; IP del inicio de sampleCodeModule
push rax ; pusheamos ese IP para retornar a el con iretq
mov qword [rsp+24], 10CFD0h ; pisamos el stack pointer dentro del stack frame de interrupcion con el del inicio de sampleCodeModule
iretq
%endmacro
%macro printReg 2
mov rsi, %1
lea rdi, [regsNames + 4 * %2]
call ncPrintReg
%endmacro
dumpRegs:
push rdi
printReg rsi, 1
pop rdi
printReg rdi, 0
printReg rax, 2
printReg rbx, 3
printReg rcx, 4
printReg rdx, 5
printReg r8, 6
printReg r9, 7
printReg r10, 8
printReg r11, 9
printReg r12, 10
printReg r13, 11
printReg r14, 12
printReg r15, 13
printReg rsp, 15
printReg rbp, 16
ret
_hlt:
sti
hlt
ret
_cli:
cli
ret
_sti:
sti
ret
picMasterMask:
push rbp
mov rbp, rsp
mov ax, di
out 21h,al
pop rbp
retn
picSlaveMask:
push rbp
mov rbp, rsp
mov ax, di ; ax = mascara de 16 bits
out 0A1h,al
pop rbp
retn
;8254 Timer (Timer Tick)
_irq00Handler:
irqHandlerMaster 0
;Keyboard
_irq01Handler:
irqHandlerMaster 1
;Cascade pic never called
_irq02Handler:
irqHandlerMaster 2
;Serial Port 2 and 4
_irq03Handler:
irqHandlerMaster 3
;Serial Port 1 and 3
_irq04Handler:
irqHandlerMaster 4
;USB
_irq05Handler:
irqHandlerMaster 5
;Zero Division Exception
_exception0Handler:
exceptionHandler 0
;Opcode Exception
_exception6Handler:
exceptionHandler 6
haltcpu:
cli
hlt
ret
section .rodata
; dd = 4 byte value. Hacemos un "array" donde cada posicion es de 4 bytes (cada caracter ocupa 1 byte, de esta forma todos terminan en 0)
regsNames dd "rdi", "rsi", "rax", "rbx", "rcx", "rdx", "r8 ", "r9 ", "r10", "r11", "r12", "r13", "r14", "r15", "rip", "rsp", "rbp" ; 17 registros
section .bss
aux resq 1 |
libsrc/_DEVELOPMENT/target/scz180/device/csio/sdcc/csio_sd_write_byte_fastcall.asm | Frodevan/z88dk | 640 | 246059 | <reponame>Frodevan/z88dk
SECTION code_driver
PUBLIC _sd_write_byte_fastcall
EXTERN asm_sd_write_byte
;Do a write bus cycle to the SD drive, via the CSIO
;
;input L = byte to write to SD drive
defc _sd_write_byte_fastcall = asm_sd_write_byte
|
UPC Microcontroladores 2019-2/Semana 6/shawarmalovers.X/chanchopollo.asm | tocache/picomones | 5 | 245979 | list p=18f4550
#include "p18f4550.inc"
#include "LCD_LIB.asm"
CONFIG PLLDIV = 1 ; PLL Prescaler Selection bits (No prescale (4 MHz oscillator input drives PLL directly))
CONFIG CPUDIV = OSC1_PLL2 ; System Clock Postscaler Selection bits ([Primary Oscillator Src: /1][96 MHz PLL Src: /2])
CONFIG FOSC = XT_XT ; Oscillator Selection bits (XT oscillator (XT))
CONFIG PWRT = ON ; Power-up Timer Enable bit (PWRT enabled)
CONFIG BOR = OFF ; Brown-out Reset Enable bits (Brown-out Reset disabled in hardware and software)
CONFIG BORV = 3 ; Brown-out Reset Voltage bits (Minimum setting 2.05V)
CONFIG WDT = OFF ; Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
CONFIG WDTPS = 32768 ; Watchdog Timer Postscale Select bits (1:32768)
CONFIG CCP2MX = ON ; CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
CONFIG PBADEN = OFF ; PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)
CONFIG MCLRE = ON ; MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)
CONFIG LVP = OFF ; Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)
org 0x1000
cachanga da "Hello uc-haters "
org 0x1100
picarones da "Canal AN0: "
org 0x0000
goto hambrientos
org 0x0020
hambrientos:
;Configuracion del ADC del micro
;Configuro ADCON2: tiempo de adquisicion y justificacion del resultado (ADFM)
movlw 0x24
movwf ADCON2
;Configuro ADCON1: determinar los puertos analogicos y voltajes de referencia
movlw 0x0E
movwf ADCON1
;Confoguro ADCON0: determino el canal que voy a leer y la activacion del modulo ADC
movlw 0x01
movwf ADCON0
;Configuracion del LCD
movlw 0x08
movwf TRISD
call DELAY15MSEG
call LCD_CONFIG
call BORRAR_LCD
call CURSOR_HOME
call CURSOR_OFF
visfirstlain:
;Apuntar el TBLPTR hacia cachanga
movlw LOW cachanga
movwf TBLPTRL
movlw HIGH cachanga
movwf TBLPTRH
bucle1:
TBLRD*+
movf TABLAT, W
call ENVIA_CHAR
movlw .15
cpfseq TBLPTRL
goto bucle1
vissecondlain:
movlw .0
call POS_CUR_FIL2
;Apuntar el TBLPTR hacia picarones
movlw LOW picarones
movwf TBLPTRL
movlw HIGH picarones
movwf TBLPTRH
bucle2:
TBLRD*+
movf TABLAT, W
call ENVIA_CHAR
movlw .11
cpfseq TBLPTRL
goto bucle2
lecturadc:
bsf ADCON0, 1 ;Inicio la conversion en AN0
aunno:
btfsc ADCON0, 1 ;Pregunto si ya termino de convertir
goto aunno
movf ADRESH, W
call BIN_BCD
movf BCD2, W
addlw 0x30
call ENVIA_CHAR
movf BCD1, W
addlw 0x30
call ENVIA_CHAR
movf BCD0, W
addlw 0x30
call ENVIA_CHAR
goto vissecondlain
;fin:goto fin
end
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1017.asm | ljhsiun2/medusa | 9 | 176946 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x4530, %rcx
nop
nop
nop
nop
nop
xor $16962, %rdi
mov (%rcx), %r15d
nop
nop
nop
nop
cmp %r8, %r8
lea addresses_D_ht+0x1d684, %rsi
lea addresses_normal_ht+0x17c50, %rdi
nop
nop
nop
nop
sub %rbp, %rbp
mov $118, %rcx
rep movsb
nop
nop
nop
nop
xor $36485, %rbp
lea addresses_A_ht+0x13920, %rbp
nop
nop
nop
nop
nop
and $65235, %r13
mov $0x6162636465666768, %rdi
movq %rdi, %xmm0
vmovups %ymm0, (%rbp)
nop
nop
nop
cmp $18131, %r15
lea addresses_normal_ht+0x9b90, %rsi
lea addresses_UC_ht+0x9b6c, %rdi
dec %r12
mov $37, %rcx
rep movsl
add $38805, %r15
lea addresses_WT_ht+0x174dc, %r15
nop
nop
nop
nop
nop
cmp $54543, %rcx
mov (%r15), %ebp
nop
nop
nop
nop
cmp %rbp, %rbp
lea addresses_D_ht+0x8830, %r8
nop
nop
nop
nop
add %rdi, %rdi
mov (%r8), %r13
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_A_ht+0x12150, %r13
nop
nop
nop
nop
sub %r8, %r8
movb $0x61, (%r13)
cmp %r12, %r12
lea addresses_WT_ht+0x4a50, %rsi
cmp %r8, %r8
movl $0x61626364, (%rsi)
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_WC_ht+0x18a50, %rsi
lea addresses_normal_ht+0xde0e, %rdi
and %r13, %r13
mov $111, %rcx
rep movsl
nop
nop
inc %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %r9
push %rax
push %rcx
// Faulty Load
lea addresses_PSE+0x18c50, %r9
nop
nop
nop
cmp $17339, %r8
vmovups (%r9), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %r12
lea oracles, %r9
and $0xff, %r12
shlq $12, %r12
mov (%r9,%r12,1), %r12
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_A_ht', 'size': 4, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': True, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}}
{'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
*/
|
base/remoteboot/bootfloppy/src/bootware/pxe/udp.asm | npocmaka/Windows-Server-2003 | 17 | 102372 | ;--------------------------------------------------------------------
; UDPopen
;
;--------------------------------------------------------------------
Proc UDPopen
mov bx, BW_GETINFO ; Call BootWare to get info for us.
call [BWAPI]
mov eax, [dword ptr (AIINFOStruct es:di).LocalIP]
les di, [PxePtr] ; Get a pointer to PXE structure.
mov [(s_pxenv_udp_open es:di).src_ip], eax
mov ax, PXENV_STATUS_SUCCESS; return success
ret
endp
;--------------------------------------------------------------------
; UDPclose
;
; A useless function that does nothing!
;--------------------------------------------------------------------
Proc UDPclose
mov ax, PXENV_STATUS_SUCCESS; return success
ret
endp
;--------------------------------------------------------------------
; UDPread
;
;--------------------------------------------------------------------
; Casting structure for dealing with UDP/IP packets.
struc s_RxPacket
MACheader db 14 dup (0) ; ethernet address, ...
IPdummy1 db 02 dup (0) ; version, header length, TOS
IPlength dw 00 ; total length (IP+UDP+Data)
IPdummy2 db 05 dup (0) ; identification, flags, fragment, TTL
IPprotocol db 00 ; protocol number following
IPchecksum dw 00 ; 16-bit IP header checksum
IPsourceip dd 00 ; source IP address
IPdestip dd 00 ; destination IP address
;-------------------------------------------------------
UDPsource dw 00 ; source port number
UDPdest dw 00 ; destination port number
UDPlength dw 00 ; length
UDPchecksum dw 00 ; 16-bit UDP header checksum
ends
Proc UDPread
; American ;
; Arium ;
;db 0F1h
; Get a full packet.
mov bx, BW_RECEIVE
push ds
pop es ; es = ds
mov di, offset RxBuffer
mov cx, 1500
call [BWAPI] ; Call ReceivePacket function.
cmp ax, 0 ; did we get a packet?
je noPacket
;------------------------------------------------------------
; We got a packet
;------------------------------------------------------------
; Check for a UDP protocol packet.
cmp [(s_RxPacket RxBuffer).IPprotocol], 17 ; 11h
jne noPacket ; not a UDP packet
les di, [PxePtr] ; get pointer to PXE structure.
; Check if caller specified a destination IP address, if so
; we only accept packets sent to that address.
mov eax, [(s_pxenv_udp_read es:di).dest_ip]
cmp eax, 0 ; is an address specified?
je acceptANYip ; no - accept any address
; check specified address with received packet
cmp eax, [(s_RxPacket RxBuffer).IPdestip]
je ipOK ; address match, keep it
jmp noPacket ; nope, no match
acceptANYip:
; copy destination IP address into UDPRead structure
mov eax, [(s_RxPacket RxBuffer).IPdestip]
mov [(s_pxenv_udp_read es:di).dest_ip], eax
ipOK:
; Check if caller specified a destination UDP port, if so
; we only accept packets sent to that port.
mov ax, [(s_pxenv_udp_read es:di).d_port]
cmp ax, 0 ; was a port specified?
je acceptANYudp ; no - accept all packets
; check specified port with received packet
cmp [(s_RxPacket RxBuffer).UDPdest], ax
je portOK ; ports match
jmp noPacket
acceptANYudp:
; packets from any port are wanted, so copy the port number
mov ax, [(s_RxPacket RxBuffer).UDPdest]
mov [(s_pxenv_udp_read es:di).d_port], ax
portOK:
; copy the senders IP address into UDPRead structure
mov eax, [(s_RxPacket RxBuffer).IPsourceip]
mov [(s_pxenv_udp_read es:di).src_ip], eax
; copy the source port number into UDPRead structure
mov ax, [(s_RxPacket RxBuffer).UDPsource]
mov [(s_pxenv_udp_read es:di).s_port], ax
; copy packet length into UDPRead structure
mov ax, [(s_RxPacket RxBuffer).IPlength]
xchg al, ah
sub ax, 20 + 8 ; subtract IP and UDP header sizes
mov [(s_pxenv_udp_read es:di).buffer_size], ax
; copy the packet into the supplied buffer
mov si, offset RxBuffer
add si, 14 + 20 + 8 ; skip MAC, IP & UDP headers
mov bx, [(s_pxenv_udp_read es:di).buffer_seg]
mov di, [(s_pxenv_udp_read es:di).buffer_off]
mov es, bx
mov cx, ax
rep movsb ; copy the packet data.
mov ax, PXENV_STATUS_SUCCESS
ret ; return successful
noPacket:
mov ax, PXENV_STATUS_FAILURE
ret ; return failure
endp
;--------------------------------------------------------------------
; UDPwrite
;
;--------------------------------------------------------------------
UDPStruct TxUDPStruct <>
Proc UDPwrite
; Fill the transmit UDP structure.
mov [UDPStruct.Size], size TxUDPStruct
; copy destination IP address
mov eax, [(s_pxenv_udp_write es:di).ip]
mov [UDPStruct.Address], eax
; copy gateway IP address
mov eax, [(s_pxenv_udp_write es:di).gw]
mov [UDPStruct.Gateway], eax
; copy source port
mov ax, [(s_pxenv_udp_write es:di).src_port]
xchg al, ah
cmp ax, 0 ; was a port value given?
jne gotPortVal ; yes
mov ax, 2069 ; default port number
gotPortVal:
mov [UDPStruct.SourcePort], ax
; copy destination port
mov ax, [(s_pxenv_udp_write es:di).dst_port]
xchg al, ah
mov [UDPStruct.DestPort], ax
push [word ptr (s_pxenv_udp_write es:di).buffer_off]
push [word ptr (s_pxenv_udp_write es:di).buffer_seg]
pop [(UDPStruct.Data)+2]
pop [(UDPStruct.Data)+0]
mov ax, [(s_pxenv_udp_write es:di).buffer_size]
mov [UDPStruct.Length], ax
mov bx, BW_TRANSMITUDP
push cs
pop es ; es = cs
lea di, [UDPStruct]
call [BWAPI]
cmp ax, 0 ; was there an error?
je txUDPOK ; no error
mov ax, PXENV_STATUS_FAILURE
ret ; return failure
txUDPOK:
mov ax, PXENV_STATUS_SUCCESS
ret ; return success
endp
;------------------------------------------------------------------------------
|
oeis/081/A081865.asm | neoneye/loda-programs | 11 | 162279 | <gh_stars>10-100
; A081865: a(n) = sigma_7(2n-1).
; 1,2188,78126,823544,4785157,19487172,62748518,170939688,410338674,893871740,1801914272,3404825448,6103593751,10465138360,17249876310,27512614112,42637932336,64340198544,94931877134,137293757384,194754273882,271818611108,373845175782,506623120464,678223896393,897821018712,1174711139838,1522454799672,1955791367120,2488651484820,3142742836022,3940787336408,4902290717268,6060711605324,7449758080224,9095120158392,11047398519098,13354663127188,16048543577568,19203908986160,22887257593321
mul $0,2
add $0,1
mov $2,$0
mov $3,8
lpb $0
pow $3,7
add $1,$3
mov $3,$2
dif $3,$0
cmp $3,$2
cmp $3,0
mul $3,$0
sub $0,1
lpe
sub $1,2097151
mov $0,$1
|
gfx/pokemon/feraligatr/anim.asm | Dev727/ancientplatinum | 28 | 160771 | frame 0, 04
frame 1, 10
frame 2, 16
frame 3, 36
frame 2, 12
endanim
|
programs/oeis/159/A159325.asm | jmorken/loda | 1 | 243718 | ; A159325: Median number of comparisons used by insertion sort on n (distinct) elements.
; 0,1,3,5,8,11,15,19,24,30,36,42,49,56,64,73,82,91,101,111,122,134,146,158,171,185
mov $2,$0
mul $0,2
mov $1,$0
lpb $0
mul $1,2
pow $1,2
mov $3,$0
mov $0,1
mul $3,2
lpe
add $1,$3
div $1,63
add $1,$2
|
programs/oeis/271/A271350.asm | karttu/loda | 0 | 83500 | <gh_stars>0
; A271350: a(n) = 3^n mod 83.
; 1,3,9,27,81,77,65,29,4,12,36,25,75,59,11,33,16,48,61,17,51,70,44,49,64,26,78,68,38,31,10,30,7,21,63,23,69,41,40,37,28,1,3,9,27,81,77,65,29,4,12,36,25,75,59,11,33,16,48,61,17,51,70,44,49,64,26,78,68,38,31,10,30,7,21,63,23,69,41,40,37,28,1,3,9,27,81,77,65,29,4,12,36,25,75,59,11,33,16,48,61,17,51,70,44,49,64,26,78,68,38,31,10,30,7,21,63,23,69,41,40,37,28,1,3,9,27,81,77,65,29,4,12,36,25,75,59,11,33,16,48,61,17,51,70,44,49,64,26,78,68,38,31,10,30,7,21,63,23,69,41,40,37,28,1,3,9,27,81,77,65,29,4,12,36,25,75,59,11,33,16,48,61,17,51,70,44,49,64,26,78,68,38,31,10,30,7,21,63,23,69,41,40,37,28,1,3,9,27,81,77,65,29,4,12,36,25,75,59,11,33,16,48,61,17,51,70,44,49,64,26,78,68,38,31,10,30,7,21,63,23,69,41,40,37,28,1,3,9,27
add $0,1
mov $1,1
lpb $0,1
sub $0,1
mod $1,83
mul $1,3
lpe
mul $1,8
sub $1,24
div $1,24
add $1,1
|
programs/oeis/174/A174316.asm | neoneye/loda | 22 | 244742 | <reponame>neoneye/loda
; A174316: Sequence defined by a(0)=a(1)=a(2)=1, a(3)=2, a(4)=6 and the formula a(n)=2^(n-2)+2 for n>=5.
; 1,1,1,2,6,10,18,34,66,130,258,514,1026,2050,4098,8194,16386,32770,65538,131074,262146,524290,1048578,2097154,4194306,8388610,16777218,33554434,67108866,134217730,268435458,536870914,1073741826,2147483650
trn $0,2
mov $1,$0
trn $0,2
sub $0,$1
mov $2,2
pow $2,$1
bin $0,$2
add $0,1
|
agda-stdlib/src/Data/Vec/Functional/Relation/Unary/Any.agda | DreamLinuxer/popl21-artifact | 5 | 9459 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Existential lifting of predicates over Vectors
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Vec.Functional.Relation.Unary.Any where
open import Data.Fin.Base
open import Data.Fin.Properties
open import Data.Nat.Base
open import Data.Product as Σ using (Σ; ∃; _×_; _,_; proj₁; proj₂)
open import Data.Vec.Functional as VF hiding (map)
open import Function
open import Level using (Level)
open import Relation.Unary
private
variable
a b p q ℓ : Level
A : Set a
B : Set b
------------------------------------------------------------------------
-- Definition
Any : Pred A ℓ → ∀ {n} → Vector A n → Set ℓ
Any P xs = ∃ λ i → P (xs i)
------------------------------------------------------------------------
-- Operations
module _ {P : Pred A p} where
here : ∀ {x n} {v : Vector A n} → P x → Any P (x ∷ v)
here px = zero , px
there : ∀ {x n} {v : Vector A n} → Any P v → Any P (x ∷ v)
there = Σ.map suc id
module _ {P : Pred A p} {Q : Pred A q} where
map : P ⊆ Q → ∀ {n} → Any P {n = n} ⊆ Any Q
map p⊆q = Σ.map id p⊆q
------------------------------------------------------------------------
-- Properties of predicates preserved by Any
module _ {P : Pred A p} where
any : Decidable P → ∀ {n} → Decidable (Any P {n = n})
any p? xs = any? λ i → p? (xs i)
|
eq-reasoning.agda | JimFixGroupResearch/imper-ial | 0 | 13184 | module eq-reasoning {A : Set} where
open import eq
infix 1 begin_
infixr 2 _≡⟨⟩_ _≡⟨_⟩_
infix 3 _∎
begin_ : ∀ {x y : A}
→ x ≡ y
-----
→ x ≡ y
begin x≡y = x≡y
_≡⟨⟩_ : ∀ (x : A) {y : A}
→ x ≡ y
-----
→ x ≡ y
x ≡⟨⟩ x≡y = x≡y
_≡⟨_⟩_ : ∀ (x : A) {y z : A}
→ x ≡ y
→ y ≡ z
-----
→ x ≡ z
x ≡⟨ x≡y ⟩ y≡z = trans x≡y y≡z
_∎ : ∀ (x : A)
-----
→ x ≡ x
x ∎ = refl
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/forward_anon.ads | best08618/asylo | 7 | 21943 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/forward_anon.ads
package Forward_Anon is
type Object is null record;
function Get_Current return access Object;
Current_Object : constant access Object;
private
One_Object : aliased Object;
Current_Object : constant access Object := One_Object'Access;
end;
|
programs/oeis/055/A055944.asm | jmorken/loda | 1 | 14565 | ; A055944: n + reversal of base 2 digits of n (written in base 10).
; 0,2,3,6,5,10,9,14,9,18,15,24,15,24,21,30,17,34,27,44,25,42,35,52,27,44,37,54,35,52,45,62,33,66,51,84,45,78,63,96,45,78,63,96,57,90,75,108,51,84,69,102,63,96,81,114,63,96,81,114,75,108,93,126,65,130,99,164,85,150,119,184,81,146,115,180,101,166,135,200,85,150,119,184,105,170,139,204,101,166,135,200,121,186,155,220,99,164,133,198,119,184,153,218,115,180,149,214,135,200,169,234,119,184,153,218,139,204,173,238,135,200,169,234,155,220,189,254,129,258,195,324,165,294,231,360,153,282,219,348,189,318,255,384,153,282,219,348,189,318,255,384,177,306,243,372,213,342,279,408,165,294,231,360,201,330,267,396,189,318,255,384,225,354,291,420,189,318,255,384,225,354,291,420,213,342,279,408,249,378,315,444,195,324,261,390,231,360,297,426,219,348,285,414,255,384,321,450,219,348,285,414,255,384,321,450,243,372,309,438,279,408,345,474,231,360,297,426,267,396,333,462,255,384,321,450,291,420,357,486,255,384,321,450,291,420,357,486,279,408
mov $2,$0
mov $3,$0
lpb $2
sub $0,$4
div $2,2
sub $0,$2
mov $4,$2
sub $4,$0
lpe
mov $1,$0
add $1,$3
|
programs/oeis/311/A311709.asm | jmorken/loda | 1 | 96917 | <filename>programs/oeis/311/A311709.asm
; A311709: Coordination sequence Gal.4.121.1 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,4,8,13,16,21,25,29,34,36,42,46,50,55,56,63,67,71,76,76,84,88,92,97,96,105,109,113,118,116,126,130,134,139,136,147,151,155,160,156,168,172,176,181,176,189,193,197,202,196
mov $6,$0
add $0,4
mul $0,2
sub $0,4
mov $4,4
mov $7,6
lpb $0
mov $2,$0
div $0,10
sub $7,2
add $2,$7
mod $2,10
mov $4,$0
mov $0,1
add $5,$2
sub $5,4
mul $0,$5
add $4,3
sub $7,$7
add $7,2
lpe
mov $7,$4
sub $7,3
mov $1,$7
mov $3,$6
mul $3,4
add $1,$3
|
test/Succeed/SolveNeutralApplication.agda | shlevy/agda | 1,989 | 14828 | <gh_stars>1000+
-- This example comes from the discussion on Issue423.
module SolveNeutralApplication where
postulate
A : Set
a b : A
T : A → Set
mkT : ∀ a → T a
phantom : A → A → A
data Bool : Set where
true false : Bool
f : Bool → A → A
f true x = phantom x a
f false x = phantom x b
-- Andreas, 2012-09-07: the original f did not have "phantom x",
-- thus, x was cleary unused. With fixing issue 691 Agda tracks
-- constant functions in the type system, thus, reasoning as below
-- no longer works. We have to make f use its second argument.
-- We can solve the constraint
-- f x _4 == f x y
-- with
-- _4 := y
-- since the application of f is neutral.
g : (x : Bool)(y : A) → T (f x y)
g x y = mkT (f x _)
|
src/boot/stage2.asm | 7E00h/septos | 1 | 81272 | BITS 16
ORG 0xA000
%include "src/boot/structures.asm"
stage2:
; Retrieve memory information from BIOS
call get_mem_info
; Locate KERNEL.ELF
mov si, ROOT_DIR
mov di, KERNEL_STR
call fat32_findfile
cmp edi, 0
je no_kernel
; Put starting cluster in EAX
; DI contains starting cluster
mov eax, edi
mov bx, 0x1000
mov es, bx
.load_loop:
; Load file starting at 0x10000
; The file will be loaded in 64k chunks
; Once a 64k chunk is read, copy it to 0x100000 (1 MB)
xor di, di
call fat32_readfile
; Copy to higher memory
pushad
push ds
; Some BIOS interrupts may overwrite DS thereby destroying
; the cached limit value. This is why it's called per
; loop.
call enable_unreal
mov esi, 0x10000 - 4
mov edi, [DST]
sub edi, 4
mov ebx, 0x10000 / 4 ; MODIFIED ECX -> EBX
.loop:
mov edx, ds:[esi + ebx*4]
mov ds:[edi + ebx*4], edx
dec ebx
jnz .loop
.break:
pop ds
popad
cmp eax, 0x0FFFFFF8
jge .done
add dword [DST], 0x10000
jmp .load_loop
.done:
; Kernel is loaded at 1 MB now
; Time to swtich to long mode
jmp mode_long
enable_unreal:
push ds
lgdt [GDT32.Pointer]
mov eax, cr0
or al, 1
mov cr0, eax
jmp $+2
mov bx, GDT32.Data
mov ds, bx
and al, 0xFE
mov cr0, eax
pop ds
ret
mode_long:
; -- Switch to long mode --
; Zero PML4
mov edi, PML4
xor eax, eax
mov es, ax
mov ecx, 0x400
cld
rep stosd
; Zero PDP
push edi
mov edi, PDP
xor eax, eax
mov ecx, 0x400
rep stosd
pop edi
mov edi, PML4
mov cr3, edi
mov edi, cr3
; Populate entries for 1 GB identity map
mov word [edi], PDP + 3
add edi, 0x1000
mov word [edi], (1 << 7) | 3
; Enable PAE
mov eax, cr4
or eax, 1 << 5
mov cr4, eax
; Set long mode bit
mov ecx, 0xC0000080
rdmsr
or eax, 1 << 8
wrmsr
; Enable paging
mov eax, cr0
or eax, 1 << 31 | 1 << 0
mov cr0, eax
; Switch :)
lgdt [GDT64.Pointer]
jmp GDT64.Code:long_mode
hlt
; ------------------
; -- get_mem_info --
; ------------------
;
; See https://wiki.osdev.org/Detecting_Memory_(x86)#BIOS_Function:_INT_0x15.2C_EAX_.3D_0xE820
;
get_mem_info:
pushad
xor bp, bp
xor ax, ax
mov es, ax
mov di, MEM_INFO
xor ebx, ebx
mov edx, 0x534D4150 ; Some magic number
.loop
mov eax, 0xE820 ; Interrupt #
mov ecx, 24 ; Bytes to read
int 0x15
jc .done
cmp ebx, 0
je .done
cmp eax, 0x534D4150
jne .done
inc bp
add di, 24
jmp .loop
.done
mov [MEM_INFO_AMT], bp
popad
ret
no_kernel:
hlt
hlt
hlt
BITS 64
long_mode:
cli
mov ax, GDT64.Data
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
; Now the ELF needs to be loaded
; This should be easy since the CPU is in long mode
load_elf:
xor rdx, rdx
mov rbp, ELF_BASE
mov bx, [rbp+ELFe_phnum] ; # of segments in program header
mov dx, [rbp+ELFe_phentsize] ; Size of segment entry
mov r15, [rbp+ELFe_entry] ; Entry point
add rbp, [rbp+ELFe_phoff] ; # Offset of program header
.load_segment:
cmp bx, 0
jz .done
; Check type
mov eax, [rbp+ELFp_type]
cmp eax, 1
jne .next
; Load segment
mov rdi, [rbp+ELFp_vaddr]
mov rsi, [rbp+ELFp_offset]
add rsi, ELF_BASE
mov rcx, [rbp+ELFp_filesz]
rep movsb
.next:
add rbp, rdx
dec bx
jmp .load_segment
.done:
; Pass in MEM_INFO
mov rdi, MEM_INFO
xor rsi, rsi
mov si, [MEM_INFO_AMT]
mov rsp, 0xA000
call r15
hlt
GDT32:
.Null: equ $ - GDT32
dq 0
.Data: equ $ - GDT32
dw 0xFFFF ; Limit 0:15
dw 0x0000 ; Base 0:15
db 0x00 ; Base 16:23
db 0b10010010 ; Access Byte
db 0b01001111 ; Flags & Limit 16:19
db 0x00 ; Base 24:31
.Pointer:
dw $ - GDT32 - 1
dd GDT32
GDT64: ; Global Descriptor Table (64-bit).
.Null: equ $ - GDT64 ; The null descriptor.
dw 0xFFFF ; Limit (low).
dw 0 ; Base (low).
db 0 ; Base (middle)
db 0 ; Access.
db 1 ; Granularity.
db 0 ; Base (high).
.Code: equ $ - GDT64 ; The code descriptor.
dw 0 ; Limit (low).
dw 0 ; Base (low).
db 0 ; Base (middle)
db 10011010b ; Access (exec/read).
db 10101111b ; Granularity, 64 bits flag, limit19:16.
db 0 ; Base (high).
.Data: equ $ - GDT64 ; The data descriptor.
dw 0 ; Limit (low).
dw 0 ; Base (low).
db 0 ; Base (middle)
db 10010010b ; Access (read/write).
db 00000000b ; Granularity.
db 0 ; Base (high).
.Pointer: ; The GDT-pointer.
dw $ - GDT64 - 1 ; Limit.
dq GDT64 ; Base.
SRC: dd 0x10000
DST: dd 0x100000
KERNEL_STR: db "KERNEL ELF"
%include "src/boot/disk.asm" |
Transynther/x86/_processed/NC/_zr_/i3-7100_9_0x84_notsx.log_600_712.asm | ljhsiun2/medusa | 9 | 94556 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_UC+0x8adf, %r15
nop
nop
nop
nop
xor %r11, %r11
movw $0x5152, (%r15)
nop
nop
add $35596, %rsi
// REPMOV
lea addresses_PSE+0x1b9d0, %rsi
lea addresses_A+0x15abf, %rdi
clflush (%rdi)
nop
nop
nop
nop
add $64995, %r14
mov $84, %rcx
rep movsw
nop
add $2582, %rsi
// Faulty Load
mov $0x3f36130000000c1f, %rdx
nop
add $43998, %r8
movb (%rdx), %cl
lea oracles, %rsi
and $0xff, %rcx
shlq $12, %rcx
mov (%rsi,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_PSE', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'00': 600}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
gfx/pokemon/hypno/anim.asm | Dev727/ancientplatinum | 28 | 160363 | <reponame>Dev727/ancientplatinum
setrepeat 2
frame 1, 15
frame 2, 15
frame 3, 15
dorepeat 1
endanim
|
gdb-7.3/gdb/testsuite/gdb.ada/uninitialized_vars/parse_controlled.ads | vidkidz/crossbridge | 1 | 27734 | -- Copyright 2009, 2011 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- 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, see <http://www.gnu.org/licenses/>.
with Ada.Finalization;
package Parse_Controlled is
type Variant_Kind is (VK_Null, VK_Num, VK_String);
type Null_Variant_Record (Kind : Variant_Kind := VK_Null) is record
case Kind is
when VK_Null =>
null;
when VK_Num =>
Num_Value : Long_Float;
when VK_String =>
String_Value : Natural;
end case;
end record;
type Null_Variant is new Ada.Finalization.Controlled with record
V : Null_Variant_Record;
end record;
end Parse_Controlled;
|
monitor01.asm | tschaer/as11.tcl | 2 | 160289 | <gh_stars>1-10
*; MONITOR
*; 06.08.2013 <NAME>
*; Based on KERNEL1E.ASM Nov 5 2004
*; Some useful I/O registers
SCSR EQU $102E
SCDR EQU $102F
SCCR2 EQU $102D
BAUD EQU $102B
DDRD EQU $1009
TMSK2 EQU $1024
TFLG2 EQU $1025
PACTL EQU $1026
BUFSIZE EQU $10 ; keyboard buffer size = 16 chars
*; ----- Variables
ORG $0080
*; Real-time clock
hours RMB 1
minutes RMB 1
seconds RMB 1
ticks RMB 1
*; Used by GETBYT - get two ASCII chars and convert to 1 hex byte
conv RMB 1 ; 8-bit hex value
*; Used by H2BCD
hundreds RMB 1 ; stores 100's digit
decimal RMB 1 ; stores 10's and 1's in packed BCD
*; For d [xxxx][y] command
top8 RMB 1 ; upper 8 bits of dump address
low8 RMB 1 ; lower 8 bits of dump address
bytes RMB 1 ; # of 16-byte paragraphs to display
dump RMB 16 ; save current paragraph for ASCII conv.
sixteen RMB 1 ; loop counter for within a paragraph
*; Used by EDIT for command line & args
buffer RMB BUFSIZE
*; Used by BUFFER2HEX: points to first cmd-line argument
arg_ptr RMB 2
*; Used by "shell"
yes_mx1 RMB 1 ; MX1 installed. 1=yes, 0=no
faa_ptr RMB 2 ; first available RAM address
*; ----- Program
ORG $F800
strt: SEI
LDS #$7F ; put stack in bottom half of RAM
*; SCI initialization
LDAA #$02 ; make TxD pin an output
STAA DDRD
LDAA #$30 ; 4800 baud
STAA BAUD
LDAA #$0C ; TE=1, RE=1, no interrupts
STAA SCCR2
*; RTI Initialization
LDAA #$02 ; RTI rate = 16.384ms
STAA PACTL
LDAA #$40 ; Enable RTI interrupt
STAA TMSK2
LDAA #$40 ; Start RTI-ing
STAA TFLG2
*; Initialize Time data structure: initial time 23:59:55:00
LDAA #23 ; init hours to 23
STAA hours
LDAA #59 ; init minutes to 59
STAA minutes
LDAA #55 ; init seconds to 55
STAA seconds
CLRA ; start ticks at zero
STAA ticks
CLI ; enable interrupts
*; Miscellaneous initializations
LDX #reset ; print reset message
JSR outstr
LDX #help ; show available commands
JSR outstr
LDAA #$42
STAA $200 ; attempt to store to expansion RAM
LDAA $200 ; read it
CMPA #$42 ; if $42 retrieved, RAM present
BEQ yes32K
no_32K: CLR yes_mx1 ; yes_mx1=false
LDX #faa_ptr ; load address of faa ptr
INX
INX
STX faa_ptr ; store first available RAM addx
LDAA faa_ptr ; display upper byte of faa
JSR outbyt
LDAA faa_ptr+1 ; display lower byte of faa
JSR outbyt
BRA warm_start
yes32K: LDAA #$01
STAA yes_mx1 ; yes_mx1=true
LDX #y32 ; indicate mx1 detected
JSR outstr
*; Command Interpreter loop
warm_start: JSR crlf
LDX #wrm_strt ; display warm start message
JSR outstr
main: JSR crlf
LDX #prompt
JSR outstr ; display prompt
JSR edit ; get command line string
JSR crlf
LDX #buffer ; look at command
LDAA 0,x
BEQ main ; ignore empty buffer
*; Command interpreter
m_d: CMPA #'d
BNE m_x
JMP d_ump
m_x: CMPA #'x
BNE m_h
JMP x_amine
m_h: CMPA #'h
BNE m_s
JMP h_elp
m_s: CMPA #'s
BNE m_t
JMP set_time
m_t: CMPA #'t
BNE m_m
JMP display_time
m_m: CMPA #'m
BNE m_j
JMP free_ram
m_j: CMPA #'j
BNE m_l
JMP j_ump
m_l: CMPA #'l
BNE m_q
JMP l_oad
m_q: CMPA #'?
BNE m__
LDX #error ; unrecognized command, error
BRA m_e
m__: LDX #help
m_e: JSR outstr
BRA main
** Sub - Programs
* The commands that are "shell" commands
* D_UMP: Dump memory contents to screen in hex & ASCII format
* displays paragraphs of 16 memory locations, also shows ASCII
* representation of memory location if its value is greater
* than $30 and less than $7F inclusive.
* ARGUMENTS: 4-digit hex starting address, optional 2-digit number
* of paragraps to display, also in hex.
* Re-written to use BUFFER2HEX and the keyboard buffer to pass args
* Optimized Jan 11 2001 to use arg_ptr
d_ump: ldx #buffer ; point to keyboard buffer
jsr buffer2hex ; convert arguments to hex
ldy arg_ptr ; point to location in buffer
ldx 0,y ; get argument [xxxx]
stx top8 ; save as dump start address
iny ; skip upper byte of start address
iny ; skip lower byte of start address
ldaa 0,y ; examine next char in buffer
cmpa #$20 ; is it a space?
beq args ; if so, there may be more args
no_arg: ldaa #$01 ; set bytes = 1 * 16
staa bytes ;
bra loop1 ;
args: iny ; skip space after [xxxx]
ldaa 0,y ; read [yy]
beq no_arg ; if it is NULL, there are no args
staa bytes ; if not, save as # of paragraphs
loop1: ldaa bytes ;
bne ok
jmp x_optd ; if bytes = 0, exit
ok: jsr crlf ; start new line
loop: ldaa top8
jsr outbyt ; display top 8 bits of address
ldaa low8
jsr outbyt ; display low 8 bits of address
ldaa #$20
jsr outchar ; display space after address
ldaa #$10 ; init loop counter to 16
staa sixteen ;
ldx top8 ; load starting address of dump
ldy #dump ; pointer to temp. storage
read: ldaa 0,x ; get byte from memory
staa 0,y ; save in temp. storage
jsr outbyt ; display it
ldaa #$20
jsr outchar ; space between entries
inx ; point to next source byte
iny ; point to next temp. byte
dec sixteen ; decrement loop counter
bne read ; quit when sixteen = 0
stx top8 ; save updated address
dec bytes ; decrement # of 16 byte paragraphs
ldaa #$20
jsr outchar
ldy #dump ; prepaer to output ASCII rendition
ldaa #$10
staa sixteen ; re init loop counter
a_dump: ldaa 0,y
cmpa #$20 ; lower than $20?
bhs no_ctrl ; branch if not a control char.
ldaa #'. ; if yes replace with '.'
no_ctrl: cmpa #$7F ;
bls ok_asc ; $7F or lower is ok
ldaa #'. ; if over $7F replace with '.'
ok_asc: jsr outchar ; display ASCII memory byte
iny ; point to next source byte
dec sixteen ; decrement loop counter
bne a_dump ; loop while sixteen !=0
jmp loop1 ; display another 16-byte paragraph
x_optd: JMP main
* X_AMINE: view/change memory byte
* Useful for setting registers, flags, etc.
* Status: stub function written Jan 09 2001
* First version Jan 11 2001
x_amine: ldx #buffer
jsr buffer2hex ; hex-ify arguments
ldy arg_ptr
ldx 0,y
x_more: stx top8 ; use same vars as d_ump
ldaa top8 ; display upper 8 bits of address
jsr outbyt
ldaa low8 ; display lower 8 bits of address
jsr outbyt
ldaa #$20
jsr outchar ; display space
ldaa 0,x ; get current memory value
jsr outbyt
ldaa #$20
jsr outchar ;
jsr getbyt ; wait for user input
bcs x_abort ; quit if nothing entered
staa 0,x ; save byte in location
inx ; increment memory pointer
ldaa #$0D ; display new line
jsr outchar ; cannot use CRLF() b/c it fucks X
ldaa #$0A ;
jsr outchar ;
bra x_more ; do it all again
x_abort: JMP main
* J_UMP: begin executing program code at a user-specified address
* The last link in creating a complete ROM monitor
* jump address is supplied as command-line argument
* IMPORTANT: do not use jsr to call this function!!
j_ump: ldx #buffer ; point to keyboard buffer
jsr buffer2hex ; convert args to hexadecimal
ldy arg_ptr ; get location of first argument
beq abort_jump ; no address supplied, abort
ldx 0,y ; load jump address into X
jmp 0,x ; jump to address in X
abort_jump: jmp main ; return on error
* SET_TIME: alter value of Time data structure to something other
* than the power-on test values
* option to quit without entering seconds value by pressing enter
* data-format conversion routine still missing (BCD2H)
* altered Jan 11 2001 to use revised GETBYT
set_time: clra ; ldaa #$0
staa TMSK2 ; turn off RTI
jsr getbyt ; get the hours digits (echo automatically)
bcs x_time ; if no data entered, quit
* jsr bcd2h ; convert to hex from user-input BCD
staa hours ; store in data structure
ldaa #': ; display the colon separator
jsr outchar ;
jsr getbyt ; get minutes
* jsr bcd2h ; convert to hex
staa minutes
ldaa #': ; display the colon separator
jsr outchar ;
jsr getchar ; get single char (10's of seconds)
cmpa #$0D ; check if it's the return character
beq x_time ; if so, job is done
jsr outchar ; echo character
jsr a2h ; convert to hex
lsla
lsla
lsla
lsla
tab ; copy ACCA to ACCB
jsr getchar ; get 1's of seconds
jsr outchar ; echo
jsr a2h ; convert to hex
aba ; combine digits in ACCA
staa seconds ; finally store it in data structure
x_time: ldaa #$40 ;
staa TMSK2 ; turn RTI back on
JMP main
* DISPLAY_TIME: prints the current time to the screen.
* no variables passed or returned. ACCA altered.
* Displays time in decimal format.
display_time:
ldaa hours ; get hours
jsr h2bcd ; convert to BCD
jsr outbyt ; ascii-fy and output
ldaa #': ; colon separator
jsr outchar ; display it
ldaa minutes ; get minutes
jsr h2bcd ; convert to BCD
jsr outbyt ;
ldaa #': ; colon separator
jsr outchar ; display it
ldaa seconds ; get seconds
jsr h2bcd ; convert to BCD
jsr outbyt ;
JMP main
* H_ELP: Command help for various "shell" commands
* Temporary function, may assign help function to each subprogram
* Very inefficient code, could be fixed up using a jump table
h_elp: ldx #buffer ; point to keyboard buffer
h_1: ldaa 0,x ;
beq h_usage ; quit if NULL hit before space found
cmpa #$20 ; search for space
beq h_args ; space found
inx ;
bra h_1 ; keep looking
h_args: inx ; point to entry after space
ldaa 0,x ; get command "word"
cmpa #'d ; is it 'd'?
bne h_2 ; if not, skip around it
ldx #d_help ; load help string for 'd'
bra x_h_elp ; display string
h_2: cmpa #'x ; is it 'x'?
bne h_3 ; if not, skip around it
ldx #x_help ; load string
bra x_h_elp ; display it
h_3: cmpa #'s ; is it 's'?
bne h_4 ; if not, skip around it
ldx #s_help ; load string
bra x_h_elp ; display it
h_4: cmpa #'h ; is it 'h'?
bne h_5 ; if not, skip around it
ldx #h_help ; load string
bra x_h_elp ; display it
h_5: cmpa #'t : t?
bne h_6 ; if not, skip around it
ldx #t_help ; load string
bra x_h_elp ; display
h_6: cmpa #'j ; j?
bne nvc ; if not, skip around it
ldx #j_help ;
bra x_h_elp
nvc: ldx #no_help ; no help entry
bra x_h_elp
h_usage: ldx #usage ; display usage help
x_h_elp: jsr outstr
jsr crlf
JMP main
*L_OAD: downline loader for S19 files generated by AS11
* hacking-around first version, Jan 17 2001
* completely re-written Nov. 5 2004
l_oad: jsr crlf ; display "begin loading"
ldx #l_begin ;
jsr outstr ;
clr bytes ; init program length counter
l_strt: jsr getchar ; get the S
cmpa #'S
beq s_ok ; if yes, start new S19 record
bra l_strt ; if no, keep trying
s_ok: jsr getchar ;
cmpa #'1 ; S1 record
beq one ;
cmpa #'9 ; S9 record: S9030000FC always
beq nine ;
jmp load_x ; if neither, quit
one: ldx #buffer ; ** Start processing an S1 record**
jsr getchar ; ACCA=first byte of length field
staa 0,x ; buffer[0]=ACCA
jsr getchar ; ACCA=second byte of length field
staa $01,x ; buffer[1]=ACCA
jsr dchr2hex ; ACCA=hex length field value
tab ; ACCB=hex length (loop ctr)
subb #$03 ; correct length for addx & CRC fields
addx: ldx #buffer ; x -> buffer[0]
jsr getchar ; address byte 1
staa 0,x ; buffer[0]=ASCII address byte 1
jsr getchar ; address byte 2
staa $01,x ; buffer[1]=ASCII address byte 2
jsr getchar ; address byte 3
staa $02,x ; buffer[2]=ASCII address byte 3
jsr getchar ; address byte 4
staa $03,x ; buffer[3]=ASCII address byte 4
jsr qchr2hex ; x=program load address
pshx ; copy X into Y
puly ; y=program load address
ldx #buffer ; x -> buffer[0]
l_loop: jsr getchar ; ASCII program byte 1
staa 0,x ; buffer[0]=ASCII program byte 1
jsr getchar ; ASCII program byte 2
staa $01,x ; buffer[1]=ASCII program byte 2
jsr dchr2hex ; ACCA=object code byte
staa 0,y ; store code byte in RAM
inc bytes ; advance the program length counter
iny ; point to next code byte location
decb ; loop ctr --
beq l_strt ; loop ctr=0, get next S19 record
jmp l_loop ; else finish this record
nine: jsr getchar ; get the 03
jsr getchar ; get the 00
jsr getchar ; get the 00
jsr getchar ; get the FC
jsr crlf
ldx #lmesg ; display "Done."
jsr outstr ;
jsr crlf
ldaa faa_ptr ; display upper byte of faa
jsr outbyt ;
ldaa faa_ptr+1 ; display lower byte of faa
jsr outbyt
jsr crlf ; new line
ldaa bytes ; ACCA = loaded program length
jsr h2bcd ; HUNDREDS, ACCA=tens:ones
tab ; ACCB = tens:ones
ldaa hundreds ; ACCA = 100's digit
jsr outbyt
tba ; ACCA = 10's:1's digits
jsr outbyt
ldx #l_bytes ; display " bytes loaded."
jsr outstr
jsr crlf
load_x: JMP main
** Subroutines
* For writing sub-programs and useful user functions
* CRLF: print a new line to the screen
* occurs so often it warrants its own subroutine
crlf: ldx #newline
jsr outstr
rts
* GETCHAR: a polling loop that gets a character from the serial port
* returns char in ACCA
getchar: ldaa SCSR ; get serial status register
anda #$20 ; mask off all bits but RDRF flag
beq getchar ; keep checking if RDRF=0
ldaa SCDR ; load received character
rts
* OUTCHAR: sends one character to serial port
* receives character in ACCA
outchar: pshb ; save B
oc: ldab SCSR ; read serial status register
bpl oc ; loop until TDRE = 1
staa SCDR ; send char
pulb ; restore B
rts
* OUTSTR: sends a string of characters to serial port
* address of string is passed in X
outstr: ldaa 0,x ; get char in string
beq x_out ; exit if null terminator
bsr outchar ; output char
inx ; point to next char
bra outstr
x_out: rts
* H2A: Converts an 8-bit hex number into two ASCII characters
* Hex number passed in ACCA, lower ASCII returned in ACCB
h2a: tab ; copy hex number into ACCB
lsra ; shift ACCA right 4 times
lsra
lsra
lsra ; higher hex digit now in LSB's of ACCA
adda #$30 ; ASCII-fy both registers in one shot
cmpa #$3A ; is it $3A?
blo do_B ; if lower, conversion correct
adda #$7 ; if not, adjust for A-F
do_B: andb #$0F ; mask off upper 4 bits
addb #$30
cmpb #$3A
blo x_h2a ; quit if conversion correct
addb #$7 ; if not, adjust for A-F
x_h2a: rts
* A2H: Converts an ASCII character to its 4-bit hex number
* ASCII passed in ACCA, hex returned in ACCA
a2h: suba #$30
cmpa #$0A
blo notchr
suba #$07
notchr: rts
* GETBYT: Gets two ASCII chars from serial port and converts to 8-bit hex
* Gets its own chars from the serial port, returns hex in CONV & ACCA
* Carry flag set if nothing entered
getbyt: jsr getchar ; get char from serial port
cmpa #$0D ; is it enter?
beq abort ; user is aborting
jsr outchar ; echo it
jsr a2h ; convert to 4-bit hex
lsla ; shift it left 4 times
lsla
lsla
lsla
staa conv ; save it
jsr getchar ; get second char
cmpa #$0D ; is it enter?
beq abort ;
jsr outchar ; echo it
jsr a2h ; convert to 4-bit hex
adda conv ; add first char to it
staa conv ; save full 8-bit hex
bra x_getb
abort: sec ; return error code
x_getb: rts
* OUTBYT: Converts a hex number to ASCII chars and outputs it
* Hex is passed in ACCA. Returns nothing.
* fixed Jan 10 2001 to take advantage of OUTCHAR pushing B to stack
outbyt: jsr h2a
jsr outchar
tba
jsr outchar
rts
* H2BCD: converts 8-bit hex to 12-bit BCD
* call this routine just before OUTBYT to display decimal instead of hex
* hex is passed in ACCA, hundreds digit is stored in HUNDREDS
* tens and ones are stored in packed format in DECIMAL
* ACCA also returns tens and ones
h2bcd: tab ; put into lower byte of D
clra ; clear upper byte of D
ldx #100 ; load divisor
idiv ; X=hundreds, D=remainder
xgdx ; D=100's digit (actually in B)
stab hundreds ; store third digit of number
xgdx ; put remainder back in D
ldx #10 ; load divsor
idiv ; X=10's digit, D=1's
stab decimal ; store 1's digit
xgdx ; D=10's digit (actually in B)
lslb ; shift 10's into upper 4 bits
lslb ;
lslb ;
lslb ;
addb decimal ; combine 10's and 1's in ACCB
stab decimal ; store BCD
tba ; make decimal available in ACCA
rts
* EDIT: the input routine for the command interpreter
* One line of 15 chars max (to change, alter BUFFER length)
* Last entry in string is reserved for the NULL ($00)
* ENTER terminates routine, BACKSPACE allows editing
edit: ldx #buffer ; X points to command-line buffer
ldab #BUFSIZE-1 ; set loop counter=15 chars max
get_c: jsr getchar ; get a character from keyboard
cmpa #$0D ; check for enter
beq x_edit ; quit if it is
cmpa #$08 ; check for backspace character
beq bksp ; do the thing if it is
staa 0,x ; store character in buffer
jsr outchar ;
inx ; point to next location in buffer
decb ; decrement loop counter
beq x_edit ; exit on loop counter=0
bra get_c ; otherwise repeat
bksp: cmpb #BUFSIZE-1 ; is backspace the first char typed?
beq get_c ; ignore it
jsr outchar ; try and move cursor back one
ldaa #$20 ; clear that letter
jsr outchar ;
ldaa #$08 ; try and move cursor back one
jsr outchar ;
dex ; move buffer pointer back by one
bra get_c ; get next char
x_edit: clra ; make null char=$00
staa 0,x ; terminate string with NULL
rts
* BUFFER2HEX: Converts any command-line arguments in the keyboard
* buffer to hexadecimal
* from ASCII. Starts converting after the first space is found in
* the buffer - this allows future commands of more than a single letter
* leaves spaces ($20) as separators for the arguments. ARG_PTR points to
* the first converted item. To call: address of buffer must be in X
* Written in Florida December 2000
* revised Jan 11 2001 to add arg_ptr
buffer2hex:
ldaa 0,x ; get char in buffer
beq x_b2h ; exit if end of buffer ($00) hit
cmpa #$20 ; look for space character
beq spc ; start converting if space found
inx ; point to next char
bra buffer2hex ;
spc: inx ; skip space character
stx arg_ptr ; save location of first argument
ldy arg_ptr ; Copy X into Y: X=src ptr, Y=dest ptr
hexify: ldaa 0,x ; get first char after space
beq x_b2h ; exit if null detected
cmpa #$20 ; is it space character?
beq skip_spc ; if so, preserve it as a separator
jsr a2h ; convert char to hex
staa 0,y ; save in buffer
inx ; point to next source char
ldaa 0,x ; get next source char
beq x_b2h ; quit if null detected
jsr a2h ; convert this to hex also
ldab 0,y ; get previous converted char
lslb ; combine the two chars
lslb ;
lslb ;
lslb ;
aba ; full 8-bit hex number
skip_spc: staa 0,y ; store in buffer
inx ; next source entry
iny ; next dest entry
bra hexify ; continue converting
x_b2h: staa 0,x ; place NULL at end of converted buffer
rts
* FREE_RAM: displays the free RAM in the system. Takes no arguments
* Works only for unexpanded system
* Uses the first available address pointer FAA_PTR as bottom of RAM
* and $FF as top of RAM - change this if expanded
* Written Jan. 13 2001
free_ram: jsr crlf ; new line
ldaa #$FF ; put top of RAM in ACCA
suba faa_ptr+1 ; subtract highest free RAM address
jsr h2bcd ; convert to decimal
jsr outbyt ; display free memory bytes
ldx #mem_free ;
jsr outstr ;
JMP main
* CHR2HEX: convert one ASCII byte into 4-bit hex
* ASCII passed in A, value returned in A
* Input : ACCA=aaaa aaaa (ASC)
* Output : ACCA=0000 hhhh (HEX)
* Parameter passing : ACCA (value to be converted)
* Registers used internally : ACCA
chr2hex: suba #$30
cmpa #$09
ble c2h_x
suba #$07
c2h_x: rts
* DCHR2HEX: convert 2 ASCII bytes into 8-bit hex
* X points to a buffer containing two ASCII chars
* A holds return value
**
* Input : INDX -> X:Y (2 ASCII chars)
* Output : ACCA = XY (1 hex byte)
* Parameter passing : INDX (pointer to buffer)
* : ACCA (return value)
* Registers used internally : ACCA, ACCB, INDX
dchr2hex: pshb ; preserve ACCB
ldaa 0,x ; ACCA = aaaa aaaa (ASC)
jsr chr2hex ; ACCA = 0000 hhhh (HEX)
tab ; ACCB = 0000 hhhh (HEX)
ldaa $01,x ; ACCA = bbbb bbbb (ASC)
jsr chr2hex ; ACCA = 0000 iiii (HEX)
lslb ; ACCB = 000h hhh0
lslb ; ACCB = 00hh hh00
lslb ; ACCB = 0hhh h000
lslb ; ACCB = hhhh 0000
aba ; ACCA = hhhh iiii (HEX)
pulb ; restore ACCB
dc2h_x: rts
* QCHR2HEX: convert 4 ASCII bytes into 2 hex bytes
* X points to a buffer containing 4 ASCII chars
* X holds 2-byte hex return value
**
* Input : INDX -> X:Y:Z:W (4 ASCII chars)
* Output : INDX = XYZW (1 hex byte)
* Parameter Passing : INDX (pointer to buffer)
* Registers used internally : ACCA, ACCB, INDX, INDY
qchr2hex: pshy ; save INDY
pshb
psha
pshx ; copy X into Y
puly ; Y = buffer base address
jsr dchr2hex ; ACCA = XY (HEX)
tab ; ACCB = XY (HEX)
pshy ; copy Y into X
pulx ; X = buffer base address
inx ; point to next two chars
inx ;
jsr dchr2hex ; ACCA = ZW (HEX)
psha ; swap ACCA & ACCB
pshb ; since ACCD = ACCA:ACCB
pula ; ACCA = XY
pulb ; ACCB = ZW
xgdx ; INDX=ACCD=A:B=XYZW (HEX)
pula ; put everything back
pulb
puly
qc2h_x: rts
** Interrupt Service Routines
* RTI interrupt: real time clock
* updates the Time data structure on each interrupt
* Currently set up for 16.384ms RTI rate
* Accuracy: 1s = 0.999424s, or: slow by 49.7664s per 24h period
rti_isr: sei ; disable interrupts
psha ; save ACCA
ldaa #$40
staa TFLG2 ; clear interrupt flag
** update ticks
ldaa ticks ; get ticks
inca ; increment
staa ticks ; store
cmpa #$3D ; compare with 61 (16.384ms * 61 = 1s)
blo x_isr ; if lower, exit
** ticks rollover and seconds update
clra ;
staa ticks ; if not, set ticks=0
ldaa seconds ; get seconds
inca ; increment
staa seconds ; store
cmpa #$3C ; compare with 60 seconds
blo x_isr ; if lower, exit
** seconds rollover and minutes update
clra
staa seconds ; set seconds=0
ldaa minutes ; get minutes
inca ; increment
staa minutes ; store
cmpa #$3C ; compare with 60 minutes
blo x_isr ; if lower, exit
** minutes rollover and seconds update
clra
staa minutes ; minutes=0
ldaa hours ; get hours
inca ; increment
staa hours ; store
cmpa #$18 ; compare with 24 hours
blo x_isr ; if lower, exit
** hours rollover
clra
staa hours ; hours=0
x_isr: pula ; restore ACCA
cli ; re-enable interrupts
rti ; return from interrupt
** Constants & Strings
* Kernel strings
done: FCC "Done."
FCB $0D, $0A, $00
wrm_strt: FCC "MONITOR 01"
FCB $00
mem_free: FCC " bytes free."
FCB $00
y32: FCC "mx1 detected."
FCB $0D, $0A, $00
error: FCC "Error."
FCB $0D, $0A, $00
help: FCC "Commands: [d x h s t m j l]"
newline: FCB $0D, $0A, $00
prompt: FCC "[monitor]> "
FCB $00
reset: FCC "Reset."
FCB $0D, $0A, $00
lmesg: FCC "Done."
FCB $00
l_begin FCC "Begin Loading."
FCB $00
l_bytes FCC " bytes loaded."
FCB $00
** On-line Documentation
* Explains CI commands.
no_help: FCC "No help entry."
FCB $00
d_help: FCC "d [xxxx] [yy] : Dump. [x]=hex start addx, [y]=# of 16-byte blocks."
FCB $00
s_help: FCC "s : Set clock in hex. 24-h format [HH:MM:SS]. :SS opt."
FCB $00
x_help: FCC "x [xxxx] : Xamine. Enter byte at addx [x]."
FCB $00
h_help: FCC "h [x] : Help on command [x]."
FCB $00
t_help: FCC "t : Display time in 24-h format. SEE s to set."
FCB $00
m_help: FCC "m : show free system RAM."
FCB $00
j_help: FCC "j [xxxx] : Jump. Load specified address into PC."
FCB $00
usage: FCC "usage: h [d x h s t m j l]."
FCB $00
** Temporary Jump Table to display subroutine hex addresses
* useful for writing programs using 'x' command
org $FF00
j_crlf FDB crlf
j_getchar FDB getchar
j_outchar FDB outchar
j_h2a FDB h2a
j_a2h FDB a2h
j_getbyt FDB getbyt
j_outbyt FDB outbyt
j_h2bcd FDB h2bcd
** Warm Start Jump instruction
* User programs include a JMP $FFD3 to return control to kernel
org $FFD3
jmp warm_start
** Interrupt Vector Table
* only RTI interrupt enabled
* all others cause a restart
org $FFD6
SCI_VECT FDB strt
SPI_VECT FDB strt
PAI_VECT FDB strt
PAO_VECT FDB strt
TOF_VECT FDB strt
TOC5_VECT FDB strt
TOC4_VECT FDB strt
TOC3_VECT FDB strt
TOC2_VECT FDB strt
TOC1_VECT FDB strt
TIC3_VECT FDB strt
TIC2_VECT FDB strt
TIC1_VECT FDB strt
RTI_VECT FDB rti_isr
IRQ_VECT FDB strt
XIRQ_VECT FDB strt
SWI_VECT FDB strt
TRAP_VECT FDB strt
COP_FAIL_VECT FDB strt
COP_CMF_VECT FDB strt
RESET_VECT FDB strt
|
src/floors.asm | jannone/westen | 49 | 87428 | ;-----------------------------------------------
; this function sets up the grass floor for the two rooms at the beginning of the game
setup_floor_grass:
call clear_floor
ld hl,floor_grass_zx0
ld de,floor_data_buffer
call dzx0_standard
; "grass" is made out of two stripes:
ld hl,room_x
ld de,buffer1024+1020
ld bc,4
ldir
ld hl,room_height
ld a,(hl)
cp 12
jr z,setup_floor_grass_room1
ld (hl),12
ld hl,room_x
dec (hl)
dec (hl)
inc hl
inc (hl)
setup_floor_grass_room1:
ld hl,room_width
ld (hl),4
call setup_floor_blue_tiles_generic
ld hl,room_x
ld a,(hl)
add a,8
ld (hl),a
inc hl
ld a,(hl)
add a,4
ld (hl),a
call setup_floor_blue_tiles_generic
ld hl,buffer1024+1020
ld de,room_x
ld bc,4
ldir
ret
;-----------------------------------------------
setup_floor_wood:
call clear_floor
ld hl,floor_wood_zx0
ld de,floor_data_buffer
call dzx0_standard
jr setup_floor_blue_tiles_generic
;-----------------------------------------------
setup_floor_blue_tiles_frame:
call clear_floor
ld hl,floor_blue_tiles_border_zx0
ld de,floor_data_buffer
call dzx0_standard
; jr setup_floor_blue_tiles_generic
;-----------------------------------------------
setup_floor_blue_tiles_generic:
ld hl,background_tile_ptrs
ld bc,32+SCREEN_HEIGHT*256
setup_floor_blue_tiles_loop_y:
push bc
setup_floor_blue_tiles_loop_x:
push bc
push hl
; int tile = 8-(((j+start_x-1) + ((i+start_y-19)%2)*2)%4);
ld a,(room_x)
dec a
add a,c ; c+(room_x)-1
ld e,a
ld a,(room_y)
add a, -19
add a, b
and #01
add a, a ; ((b+(room_y)-19)%2)*2
add a, e
and #03
add a, -8
neg
ld ixl,a
; int isox = ((32-j)-start_x)+((19-i)-start_y)*2;
ld a,(room_x)
add a,c
add a, -32
neg
ld e,a
ld a,(room_y)
add a,b
add a, -SCREEN_HEIGHT
neg
add a,a
push af
add a,e
ld iyl,a
; int isoy = ((19-i)-start_y)*2 - ((32-j)-start_x);
ld a,(room_x)
add a,c
add a, -32
neg
ld e,a ; e = 32 - ()
pop af
; ld a,(room_y)
; add a,b
; add a, -SCREEN_HEIGHT
; neg
; add a,a
sub e
ld iyh,a
; if (isox < -2) tile = 0;
ld a,iyl
cp -2
jp p,setup_floor_blue_tiles_loop_x_skip1
setup_floor_blue_tiles_loop_x_zero:
pop hl
inc hl
inc hl
jr setup_floor_blue_tiles_loop_x_post_assign
setup_floor_blue_tiles_loop_x_skip1:
; if (isox == -1) tile = 2;
inc a
jr nz,setup_floor_blue_tiles_loop_x_skip2
ld ixl,2
setup_floor_blue_tiles_loop_x_skip2:
; if (isox == -2) tile = 1;
inc a
jr nz,setup_floor_blue_tiles_loop_x_skip3
ld ixl,1
setup_floor_blue_tiles_loop_x_skip3:
; if (isox >= width*4) tile = 0;
ld a,(room_width)
add a,a
ld e,a
ld a,iyl
sub e
jp p,setup_floor_blue_tiles_loop_x_zero
; if (isox == width*4-1) tile = 12;
inc a
jr nz,setup_floor_blue_tiles_loop_x_skip5
ld ixl,12
setup_floor_blue_tiles_loop_x_skip5:
; if (isox == width*4-2) tile = 11;
inc a
jr nz,setup_floor_blue_tiles_loop_x_skip6
ld ixl,11
setup_floor_blue_tiles_loop_x_skip6:
; if (isoy < -1) tile = 0;
ld a,iyh
cp -1
jp m,setup_floor_blue_tiles_loop_x_zero
; if (isoy == 0 && tile != 0) tile = 3;
or a
jr nz,setup_floor_blue_tiles_loop_x_skip8
ld ixl,3
setup_floor_blue_tiles_loop_x_skip8:
; if (isoy == -1 && tile != 0) tile = 4;
inc a
jr nz,setup_floor_blue_tiles_loop_x_skip9
ld ixl,4
setup_floor_blue_tiles_loop_x_skip9:
; if (isoy > height*4) tile = 0;
ld a,(room_height)
add a,a
inc a
ld e,a
ld a,iyh
sub e
jp p,setup_floor_blue_tiles_loop_x_zero
; if (isoy == height*4 && tile != 0) tile = 9;
inc a
jr nz,setup_floor_blue_tiles_loop_x_skip11
ld ixl,9
setup_floor_blue_tiles_loop_x_skip11:
; if (isoy == height*4-1 && tile != 0) tile = 10;
inc a
jr nz,setup_floor_blue_tiles_loop_x_skip12
ld ixl,10
setup_floor_blue_tiles_loop_x_skip12:
setup_floor_blue_tiles_loop_x_assign:
; map[32-j][19-i] = tile;
ld a,ixl
ld h,0
ld l,a
add hl,hl
add hl,hl
add hl,hl
add hl,hl
ld bc,floor_data_buffer
add hl,bc
ex de,hl
pop hl
ld (hl),e
inc hl
ld (hl),d
inc hl
setup_floor_blue_tiles_loop_x_post_assign:
pop bc
dec c
jp nz,setup_floor_blue_tiles_loop_x
pop bc
dec b
jp nz,setup_floor_blue_tiles_loop_y
ret
;-----------------------------------------------
clear_floor:
ld hl,background_tile_ptrs
ld de,floor_data_buffer
ld bc,32*SCREEN_HEIGHT
clear_floor_loop:
ld (hl),e
inc hl
ld (hl),d
inc hl
dec bc
ld a,b
or c
jr nz,clear_floor_loop
ret
|
puzzle_17/src/puzzle_17.adb | AdaForge/Advent_of_Code_2020 | 0 | 3588 | <filename>puzzle_17/src/puzzle_17.adb
procedure Puzzle_17 is
begin
null;
end Puzzle_17;
|
figures/flax_grammar.g4 | flax-lang/reference-manual | 0 | 2175 | // flax-grammar.g4
// Copyright (c) 2019, zhiayang
// Licensed under the Apache License Version 2.0.
// parser rules
grammar flax_grammar;
expression
: (EXCLAMATION | PLUS | MINUS | TILDE | AMPERSAND | ASTERISK | ELLIPSIS) expression
| expression (AS | IS) (expression | MUTABLE | (EXCLAMATION MUTABLE))
| expression (ASTERISK | DIVIDE | PERCENT) expression
| expression (PLUS | MINUS) expression
| expression (AMPERSAND) expression
| expression (CARET) expression
| expression (PIPE) expression
| expression (LANGLE | RANGLE | LESS_EQUALS |
GREATER_EQUALS | EQUALS_TO |
NOT_EQUALS) expression
| expression (ELLIPSIS | HALF_OPEN_ELLIPSIS) expression
| expression (LOGICAL_AND) expression
| expression (LOGICAL_OR) expression
| expression (EQUAL | PLUS_EQ | MINUS_EQ |
MULTIPLY_EQ | DIVIDE_EQ | MOD_EQ |
AMPERSAND_EQ | PIPE_EQ | CARET_EQ) expression
| LPAREN expression RPAREN
| functionCall
| scopeExpr
| scopedIdentifier
| identifier
| literal
;
statement
: expression (SEMICOLON | NEWLINE)
| deferStmt
| varDefn
| ifStmt
;
varDefn
: (VAR | LET) identifier (COLON type)? (EQUAL expression)?
;
deferStmt
: DEFER expression
;
ifStmt
: IF (varDefn SEMICOLON)* expression
bracedBlock
(ELSE IF (varDefn SEMICOLON)* expression bracedBlock)*
(ELSE bracedBlock)?
;
identifier
: IDENTIFIER
;
scopedIdentifier
: DOUBLE_COLON? identifier ((DOUBLE_COLON | CARET) identifier)*
;
polyArgList
: LANGLE (identifier (COLON scopedIdentifier)?) (COMMA identifier (COLON scopedIdentifier)?)* RANGLE
;
ffiFuncDecl
: (PUBLIC | PRIVATE | INTERNAL)? FFI FUNC IDENTIFIER funcIshDecl (AS STRING_LITERAL)?
;
parameterList
: LPAREN ((identifier COLON type (EQUAL expression)?) (COMMA identifier COLON type (EQUAL expression)?)*)? RPAREN
;
funcIshDecl
: polyArgList? parameterList (RIGHT_ARROW type)?
;
bracedBlock
: LBRACE statement* RBRACE
;
funcDefn
: (ATTR_NOMANGLE | ATTR_ENTRY | PUBLIC | PRIVATE | INTERNAL)+
FUNC IDENTIFIER funcIshDecl
bracedBlock
;
classDefn
: CLASS identifier polyArgList? (COLON scopedIdentifier (COMMA scopedIdentifier)*)? LBRACE
((
(VAR | LET) nameWithType (EQUAL expression)?
| STATIC? funcDefn
| 'init' parameterList (COLON 'super' argumentList)?
bracedBlock
| typeDefn
) (NEWLINE | SEMICOLON))*
RBRACE
;
structDefn
: STRUCT identifier polyArgList? LBRACE
((
nameWithType
| funcDefn
) (NEWLINE | SEMICOLON))*
RBRACE
;
unionDefn
: UNION identifier polyArgList? LBRACE
(
identifier (COLON type)? (NEWLINE | SEMICOLON)
)*
RBRACE
;
rawUnionDefn
: ATTR_RAW UNION identifier polyArgList? LBRACE
(
identifier COLON type (NEWLINE | SEMICOLON)
)+
RBRACE
;
enumDefn
: ENUM identifier polyArgList? (COLON type)? LBRACE
(
identifier (EQUAL expression)? (NEWLINE | SEMICOLON)
)+
RBRACE
;
typeDefn
: enumDefn
| classDefn
| unionDefn
| structDefn
| rawUnionDefn
;
type
: AMPERSAND MUTABLE? type
| LSQUARE type RSQUARE
| LSQUARE type COLON (NUMBER | ELLIPSIS)? RSQUARE
| LPAREN type (COMMA type)* RPAREN
| FUNC LPAREN type (COMMA type)* RPAREN RIGHT_ARROW type
| scopedIdentifier (EXCLAMATION LANGLE ((identifier COLON)? type) (COMMA (identifier COLON)? type) RANGLE)?
| typeDefn
;
nameWithType
: identifier COLON type
;
argumentList
: LPAREN (((identifier COLON)? expression) (COMMA (identifier COLON)? expression)*)? RPAREN
;
functionCall
: scopedIdentifier argumentList
;
scopeExpr
: scopeExpr PERIOD identifier
| scopedIdentifier
;
commaSepExprs
: expression (COMMA expression)+
;
literal
: STRING_LITERAL
| CHARACTER_LITERAL
| NUMBER
| LPAREN commaSepExprs RPAREN
| LSQUARE (AS type COLON) commaSepExprs RSQUARE
| TRUE | FALSE
;
// lexer rules
// keywords
DO: 'do';
IF: 'if';
AS: 'as';
IS: 'is';
FFI: 'ffi';
AS_EXLAIM: 'as!';
VAR: 'var';
LET: 'let';
FOR: 'for';
NULL: 'null';
TRUE: 'true';
ELSE: 'else';
ENUM: 'enum';
FREE: 'free';
CLASS : 'class';
USING: 'using';
FALSE: 'false';
DEFER: 'defer';
WHILE: 'while';
ALLOC: 'alloc';
UNION: 'union';
BREAK: 'break';
TYPEID: 'typeid';
STRUCT: 'struct';
PUBLIC: 'public';
EXPORT: 'export';
IMPORT: 'import';
TYPEOF: 'typeof';
RETURN: 'return';
SIZEOF: 'sizeof';
STATIC: 'static';
PRIVATE: 'private';
MUTABLE: 'mutable';
VIRTUAL: 'virtual';
FUNC: ('fn'|'ƒ');
INTERNAL: 'internal';
CONTINUE: 'continue';
OVERRIDE: 'override';
PROTOCOL: 'protocol';
OPERATOR: 'operator';
NAMESPACE: 'namespace';
TYPEALIAS: 'typealias';
EXTENSION: 'extension';
IDENTIFIER: [a-zA-Z_]+[a-zA-Z0-9]*;
LBRACE: '{';
RBRACE: '}';
LPAREN: '(';
RPAREN: ')';
LSQUARE: '[';
RSQUARE: ']';
LANGLE: '<';
RANGLE: '>';
PLUS: '+';
MINUS: '-';
ASTERISK: '*';
DIVIDE: ('/'|'÷');
SQUOTE: '\'';
DQUOTE: '"';
PERIOD: '.';
COMMA: ',';
COLON: ':';
EQUAL: '=';
QUESTION: '?';
EXCLAMATION: '!';
SEMICOLON: ';';
AMPERSAND: '&';
PERCENT: '%';
PIPE: '|';
DOLLAR: '$';
LOGICAL_OR: '||';
LOGICAL_AND: '&&';
AT: '@';
POUND: '#';
TILDE: '~';
CARET: '^';
LEFT_ARROW: '<-';
RIGHT_ARROW: '->';
// FAT_LEFT_ARROW: '<=';
FAT_RIGHT_ARROW: '=>';
EQUALS_TO: '==';
NOT_EQUALS: ('!='|'≠');
LESS_EQUALS: ('<='|'≤');
GREATER_EQUALS: ('>='|'≥');
DOUBLE_PLUS: '++';
DOUBLE_MINUS: '--';
PLUS_EQ: '+=';
MINUS_EQ: '-=';
MULTIPLY_EQ: '*=';
DIVIDE_EQ: '/=';
MOD_EQ: '%=';
AMPERSAND_EQ: '&=';
PIPE_EQ: '|=;';
CARET_EQ: '^=';
ELLIPSIS: '...';
HALF_OPEN_ELLIPSIS: '..<';
DOUBLE_COLON: '::';
STRING_LITERAL: '"' .*? '"';
CHARACTER_LITERAL: '\'' ('\\' ('\\'|'\''|'n'|'b'|'a'|'r'|'t') | .) '\'';
NEWLINE: '\n';
COMMENT
: '//' .*? NEWLINE
| '/*' (COMMENT|.*?) '*/'
;
NUMBER
: ('0b'|'0B') [0-1]+
| ('0x'|'0X') [0-9a-fA-F]+
| [0-9]*('.'?)[0-9]+ (('e'|'E')[0-9]+)?
;
ATTR_RAW: '@raw';
ATTR_ENTRY: '@entry';
ATTR_NOMANGLE: '@nomangle';
ATTR_OPERATOR: '@operator';
ATTR_PLATFORM: '@platform';
DIRECTIVE_RUN: '#run';
DIRECTIVE_IF: '#if';
|
data/mapObjects/pokemontower2.asm | adhi-thirumala/EvoYellow | 16 | 18425 | PokemonTower2Object:
db $1 ; border block
db $2 ; warps
db $9, $3, $0, POKEMONTOWER_3
db $9, $12, $2, POKEMONTOWER_1
db $0 ; signs
db $2 ; objects
object SPRITE_BLUE, $e, $5, STAY, NONE, $1 ; person
object SPRITE_MEDIUM, $3, $7, STAY, RIGHT, $2 ; person
; warp-to
EVENT_DISP POKEMONTOWER_2_WIDTH, $9, $3 ; POKEMONTOWER_3
EVENT_DISP POKEMONTOWER_2_WIDTH, $9, $12 ; POKEMONTOWER_1
|
BasicIS4/Metatheory/Hilbert-TarskiGluedHilbert.agda | mietek/hilbert-gentzen | 29 | 9726 | <gh_stars>10-100
module BasicIS4.Metatheory.Hilbert-TarskiGluedHilbert where
open import BasicIS4.Syntax.Hilbert public
open import BasicIS4.Semantics.TarskiGluedHilbert public
-- Internalisation of syntax as syntax representation in a particular model.
module _ {{_ : Model}} where
[_] : ∀ {A Γ} → Γ ⊢ A → Γ [⊢] A
[ var i ] = [var] i
[ app t u ] = [app] [ t ] [ u ]
[ ci ] = [ci]
[ ck ] = [ck]
[ cs ] = [cs]
[ box t ] = [box] [ t ]
[ cdist ] = [cdist]
[ cup ] = [cup]
[ cdown ] = [cdown]
[ cpair ] = [cpair]
[ cfst ] = [cfst]
[ csnd ] = [csnd]
[ unit ] = [unit]
-- Soundness with respect to all models, or evaluation.
eval : ∀ {A Γ} → Γ ⊢ A → Γ ⊨ A
eval (var i) γ = lookup i γ
eval (app {A} {B} t u) γ = _⟪$⟫_ {A} {B} (eval t γ) (eval u γ)
eval ci γ = K I
eval (ck {A} {B}) γ = K (⟪K⟫ {A} {B})
eval (cs {A} {B} {C}) γ = K (⟪S⟫′ {A} {B} {C})
eval (box t) γ = K ([ box t ] ⅋ eval t ∙)
eval cdist γ = K _⟪D⟫′_
eval cup γ = K ⟪↑⟫
eval cdown γ = K ⟪↓⟫
eval (cpair {A} {B}) γ = K (_⟪,⟫′_ {A} {B})
eval cfst γ = K π₁
eval csnd γ = K π₂
eval unit γ = ∙
-- TODO: Correctness of evaluation with respect to conversion.
-- The canonical model.
private
instance
canon : Model
canon = record
{ _⊩ᵅ_ = λ Γ P → Γ ⊢ α P
; mono⊩ᵅ = mono⊢
; _[⊢]_ = _⊢_
; mono[⊢] = mono⊢
; [var] = var
; [app] = app
; [ci] = ci
; [ck] = ck
; [cs] = cs
; [box] = box
; [cdist] = cdist
; [cup] = cup
; [cdown] = cdown
; [cpair] = cpair
; [cfst] = cfst
; [csnd] = csnd
; [unit] = unit
}
-- Soundness and completeness with respect to the canonical model.
mutual
reflectᶜ : ∀ {A Γ} → Γ ⊢ A → Γ ⊩ A
reflectᶜ {α P} t = t
reflectᶜ {A ▻ B} t = λ η → let t′ = mono⊢ η t
in λ a → reflectᶜ (app t′ (reifyᶜ a))
reflectᶜ {□ A} t = λ η → let t′ = mono⊢ η t
in t′ ⅋ reflectᶜ (down t′)
reflectᶜ {A ∧ B} t = reflectᶜ (fst t) , reflectᶜ (snd t)
reflectᶜ {⊤} t = ∙
reifyᶜ : ∀ {A Γ} → Γ ⊩ A → Γ ⊢ A
reifyᶜ {α P} s = s
reifyᶜ {A ▻ B} s = lam (reifyᶜ (s weak⊆ (reflectᶜ {A} v₀)))
reifyᶜ {□ A} s = syn (s refl⊆)
reifyᶜ {A ∧ B} s = pair (reifyᶜ (π₁ s)) (reifyᶜ (π₂ s))
reifyᶜ {⊤} s = unit
reflectᶜ⋆ : ∀ {Ξ Γ} → Γ ⊢⋆ Ξ → Γ ⊩⋆ Ξ
reflectᶜ⋆ {∅} ∙ = ∙
reflectᶜ⋆ {Ξ , A} (ts , t) = reflectᶜ⋆ ts , reflectᶜ t
reifyᶜ⋆ : ∀ {Ξ Γ} → Γ ⊩⋆ Ξ → Γ ⊢⋆ Ξ
reifyᶜ⋆ {∅} ∙ = ∙
reifyᶜ⋆ {Ξ , A} (ts , t) = reifyᶜ⋆ ts , reifyᶜ t
-- Reflexivity and transitivity.
refl⊩⋆ : ∀ {Γ} → Γ ⊩⋆ Γ
refl⊩⋆ = reflectᶜ⋆ refl⊢⋆
trans⊩⋆ : ∀ {Γ Γ′ Γ″} → Γ ⊩⋆ Γ′ → Γ′ ⊩⋆ Γ″ → Γ ⊩⋆ Γ″
trans⊩⋆ ts us = reflectᶜ⋆ (trans⊢⋆ (reifyᶜ⋆ ts) (reifyᶜ⋆ us))
-- Completeness with respect to all models, or quotation.
quot : ∀ {A Γ} → Γ ⊨ A → Γ ⊢ A
quot s = reifyᶜ (s refl⊩⋆)
-- Normalisation by evaluation.
norm : ∀ {A Γ} → Γ ⊢ A → Γ ⊢ A
norm = quot ∘ eval
-- TODO: Correctness of normalisation with respect to conversion.
|
src/Projects/eu_projects.ads | fintatarta/eugen | 0 | 29497 | <filename>src/Projects/eu_projects.ads
with Ada.Strings.Bounded;
with Ada.Strings.Fixed;
with Ada.Containers.Vectors;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Regexp_Readers.Generic_Readers;
--
-- This package hierarchy provides resources to operate with the description
-- of research projects (mostly EU-style, but it can be used in other
-- contexts).
--
-- The model for a project is the following
--
-- * A project has
-- * A name
-- * A short name
-- * A sequence of partners
-- * A sequence of WPs
-- * A risk lists
--
-- * Every PARTNER has
-- * Name, short name, ID, index
-- * A description
-- * A set of roles, every role hase
-- * name, ID
-- * descripiton
-- * cost
--
-- * Every WP has
-- * Name, short name, ID, index, description
-- * WP type (research, admin, ...)
-- * A sequence of tasks
-- * Computed attributes:
-- - begin/end dates
-- - partner effort
-- - deliverables
-- - milestones
--
-- * Every task has
-- * Name, short name, ID, index, description
-- * A parent WP
-- * A dependence list (task depends on...)
-- * A sequence of activity periods. Every period has
-- - begin/end date
-- - intensity
-- - partner effort, every effort has
-- + partner ID
-- + role
-- + number of PM
-- * A set of milestones
-- * A set of deliverables
--
-- * Every milestone has
-- * Name, short name, description, ID, index
-- * A parent task
-- * A due date
--
-- * Every deliverable has
-- * Name, short name, description, ID, index
-- * A parent task
-- * A due date
--
-- A few comments about the data involved
--
-- * Name and short name: they are used to be included in the
-- research proposal by using a special syntax (#{...} ruby-like or
-- \R{...} LaTeX-like?) that uses as parameter entity attributes
-- optionally decorated
--
-- * The dates can be in two format: symbolic and absolute. The idea
-- is that we want to allow for dates like "design.start + 3" to denote
-- three months after the end of the design WP. However, when
-- we need to create, say, a GANNT we need actual months that can be
-- obtained by computing all the symbolic dates.
--
-- * For every element we have at least two indexes: a "local" and
-- a "full" one. For example, task T4.3 has "3" as a local index
-- and "4.3" is the global one and "T4.3" is the "decorated" one.
-- While local and full are not necessarily unique (4.3 can also
-- be a deliverable or a milestone of WP4), the decorated is unique.
--
-- IDs are "labels" for entities and have a hierarchical structure, like
--
-- wp1.task2 -- A task of WP1
-- wp1.blue_print -- A deliverable of WP1
--
-- In the context of WP1 only task2 or blue_print are necessary. We will
-- call the parts separated by "." basic IDs.
--
-- Basic IDs are case insensitive and have the usual "Ada identifier syntax"
-- (letters, numbers and underscores, begin with a letter, no double or
-- final underscore allowed). We cannot use '-' (as it is allowed in XML)
-- since we could want to use the IDs in expression and ambiguity
-- could arise with subtraction.
--
-- An attribute is an ID with a final ".attribute", for example
--
-- wp1.task2.begin -- The begin date of task2
-- wp1.duration -- The overall duration of WP1
--
-- Date attributes can be used in expressions. Attributes can also be included
-- in descriptions using a syntax like
--
-- #command{wp1.task2.begin?option1=a, option2=b}
--
-- where "command" is a specific command and it can be empty
-- (that is, something like "#{wp1.name}" is allowed). The part after "?"
-- is optional and it is used for fine control the attribute format;
-- for example,
--
-- #{dissemination.name?short}
--
-- could be used to insert the "short name" of WP dissemination.
-- We could consider the possibility of default attributes and options
-- so that something like
--
-- #{dissemination}
--
-- is possible. The idea for the default is the following
--
-- * Every "class" of entity (WP, task, deliverable, ...) has a default
-- attribute.
-- * Every attribute associated with an entity (e.g., name of a WP)
-- has a default option list
-- * The maps
--
-- class -> attribute
-- (class, attribute) -> option
--
-- are part of the project attributes.
-- --------------------------------------------------------------------
-- ** Parsers, writers, processors
--
-- In order to read/write textual representations of the projects we will
-- need parsers and writers. Most probably initially we will support only
-- the YAML format since it is fairly easy to parse and to write by hand.
-- In order to allow for new formats we will use a "plugin-like structure"
--
-- A different matter is the production of external files with information
-- taken from the project. For example, LaTeX sources with the WP description
-- or a GANTT chart of the activities in SVG, PDF or TeX format.
--
-- The part of code that takes care of such productions is called a
-- _processor_. Initially most probably we will support two kinds of
-- processors
--
-- 1. Template-based, much in the spirit of AWS templates. If possible,
-- we will try to use them out-of-the-box
-- 2. Server-based: an external processor is launched with some parameters
-- that include a local port that can be queried to get informations
-- about the project. The queries have the format of an attribute
-- query (options included) with the difference that an some special
-- attributes are added, namely:
-- - tasks
-- - delivs
-- - milestones
-- - wps
-- - and maybe others
--
-- The new attributes can be used to query "all the ... of ...". For
-- example, in order to get all the tasks of WP dissemination the
-- processor can ask for
--
-- dissemination.tasks
--
-- The answer will include a space-separated list of the ids of the
-- tasks.
--
-- ----------------------------------------------------------------
-- ** Editing projects
--
-- In editing projects we can add/remove
-- - WP
-- - tasks of a WP
-- - deliverables
-- - milestones
-- - partners
-- - roles in partners
--
-- We can also change
-- - descriptions
-- - names
-- - dates
--
--
package EU_Projects is
-- Is a bound of 10 billions enough?
type Currency is delta 0.01 digits 12 range 0.0 .. 9_999_999_999.99;
Max_ID_Length : constant Positive := 256;
--
-- Function to check if X satisfies the syntax of IDs. Informally, an
-- ID has a syntax similar to an Ada identifier with the following additions
--
-- (1) "." can be used inside the identifier so that "foo.bar" is OK
-- (2) An identifier cannot begin nor end with "_" or "."
-- (3) "_" must always be followed by an alphanumeric char
-- (4) "." must always be followed by a letter
-- (5) At most one "." can be present
--
function Is_Valid_ID (X : String) return Boolean
is (
(X'Length = 0)
or else ((X'Length <= Max_ID_Length)
and then (Is_Letter (X (X'First)) and Is_Alphanumeric (X (X'Last)))
and then (for all I in X'Range =>
(Is_Alphanumeric (X (I))
or else (X (I) = '_' and then Is_Alphanumeric (X (I + 1)))
or else (X (I) = '.' and then Is_Letter (X (I + 1)))))
and then (for all I in X'Range =>
(for all J in I + 1 .. X'Last =>
(if X (I) = '.' then X (J) /= '.'))))
-- Note : in the condition above I+1 is always well defined since
-- if X(X'Last) is alphanumeric, the last two tests are cutted
-- away by the "or else" after Is_Alphanumeric (X (I)), otherwise
-- if X(X'Last) is not alphanumeric, the "for all" will not checked
-- at all because of the preceding "and then"
);
package Bounded_Identifiers is
new Ada.Strings.Bounded.Generic_Bounded_Length (Max_ID_Length);
use Bounded_Identifiers;
type Dotted_Identifier is new Bounded_Identifiers.Bounded_String
with Dynamic_Predicate =>
Is_Valid_ID (To_String (Bounded_String (Dotted_Identifier)));
-- A simple identifier is similar to a Dotted_Identifier, but it
-- cannot have a dot
subtype Simple_Identifier is Dotted_Identifier
with Dynamic_Predicate =>
(for all Ch of To_String (Simple_Identifier) => Ch /= '.');
function Image (X : Dotted_Identifier) return String
is (To_String (X));
function To_ID (X : String)return Dotted_Identifier
is (To_Bounded_String (X))
with Pre => Is_Valid_ID (X);
function Verbose_To_ID (X : String) return Dotted_Identifier;
-- Like To_ID, but it prints some debug info. Useful for debugging.
function Join (X, Y : Simple_Identifier) return Dotted_Identifier
is (To_ID (To_String (X) & "." & To_String (Y)));
function Join (X : Simple_Identifier; Y : String) return Dotted_Identifier
is (Join (X, To_ID (Y)));
package ID_Readers is
new Regexp_Readers.Generic_Readers
(Result_Type => Dotted_Identifier,
Regexp => Regexp_Readers.Dotted_Identifier,
Convert => To_ID);
package ID_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Dotted_Identifier);
subtype ID_List is ID_Vectors.Vector;
function To_ID_List (Input : String;
Separators : String := " ,")
return ID_List;
Bad_Identifier : exception;
Bad_Input : exception;
-- The result of function 'Image associated to discrete types has
-- a space at the beginning. That space is quite annoying and needs
-- to be trimmed. This function is here so that everyone can use it
function Chop (X : String) return String
is (Ada.Strings.Fixed.Trim (X, Ada.Strings.Both));
function Image (X : Integer) return String
is (Chop (Integer'Image (X)));
end EU_Projects;
|
oeis/157/A157840.asm | neoneye/loda-programs | 11 | 171335 | ; A157840: 103680000n^2 - 174211200n + 73180801.
; 2649601,139478401,483667201,1035216001,1794124801,2760393601,3934022401,5315011201,6903360001,8699068801,10702137601,12912566401,15330355201,17955504001,20788012801,23827881601,27075110401,30529699201,34191648001,38060956801,42137625601,46421654401,50913043201,55611792001,60517900801,65631369601,70952198401,76480387201,82215936001,88158844801,94309113601,100666742401,107231731201,114004080001,120983788801,128170857601,135565286401,143167075201,150976224001,158992732801,167216601601,175647830401
seq $0,157839 ; 1728000n - 1451760.
pow $0,2
sub $0,76308537600
div $0,28800
add $0,2649601
|
agda-stdlib/src/Data/Fin/Permutation/Components.agda | DreamLinuxer/popl21-artifact | 5 | 11877 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Component functions of permutations found in `Data.Fin.Permutation`
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Fin.Permutation.Components where
open import Data.Bool.Base using (Bool; true; false)
open import Data.Fin.Base
open import Data.Fin.Properties
open import Data.Nat.Base as ℕ using (zero; suc; _∸_)
import Data.Nat.Properties as ℕₚ
open import Data.Product using (proj₂)
open import Function.Base using (_∘_)
open import Relation.Nullary.Reflects using (invert)
open import Relation.Nullary using (does; _because_; yes; no)
open import Relation.Nullary.Decidable using (dec-true; dec-false)
open import Relation.Binary.PropositionalEquality
open import Algebra.Definitions using (Involutive)
open ≡-Reasoning
--------------------------------------------------------------------------------
-- Functions
--------------------------------------------------------------------------------
-- 'tranpose i j' swaps the places of 'i' and 'j'.
transpose : ∀ {n} → Fin n → Fin n → Fin n → Fin n
transpose i j k with does (k ≟ i)
... | true = j
... | false with does (k ≟ j)
... | true = i
... | false = k
-- reverse i = n ∸ 1 ∸ i
reverse : ∀ {n} → Fin n → Fin n
reverse {suc n} i = inject≤ (n ℕ- i) (ℕₚ.m∸n≤m (suc n) (toℕ i))
--------------------------------------------------------------------------------
-- Properties
--------------------------------------------------------------------------------
transpose-inverse : ∀ {n} (i j : Fin n) {k} →
transpose i j (transpose j i k) ≡ k
transpose-inverse i j {k} with k ≟ j
... | true because [k≡j] rewrite dec-true (i ≟ i) refl = sym (invert [k≡j])
... | false because [k≢j] with k ≟ i
... | true because [k≡i]
rewrite dec-false (j ≟ i) (invert [k≢j] ∘ trans (invert [k≡i]) ∘ sym)
| dec-true (j ≟ j) refl
= sym (invert [k≡i])
... | false because [k≢i] rewrite dec-false (k ≟ i) (invert [k≢i])
| dec-false (k ≟ j) (invert [k≢j]) = refl
reverse-prop : ∀ {n} → (i : Fin n) → toℕ (reverse i) ≡ n ∸ suc (toℕ i)
reverse-prop {suc n} i = begin
toℕ (inject≤ (n ℕ- i) _) ≡⟨ toℕ-inject≤ _ (ℕₚ.m∸n≤m (suc n) (toℕ i)) ⟩
toℕ (n ℕ- i) ≡⟨ toℕ‿ℕ- n i ⟩
n ∸ toℕ i ∎
reverse-involutive : ∀ {n} → Involutive _≡_ (reverse {n})
reverse-involutive {suc n} i = toℕ-injective (begin
toℕ (reverse (reverse i)) ≡⟨ reverse-prop (reverse i) ⟩
n ∸ (toℕ (reverse i)) ≡⟨ cong (n ∸_) (reverse-prop i) ⟩
n ∸ (n ∸ (toℕ i)) ≡⟨ ℕₚ.m∸[m∸n]≡n (ℕₚ.≤-pred (toℕ<n i)) ⟩
toℕ i ∎)
reverse-suc : ∀ {n} {i : Fin n} → toℕ (reverse (suc i)) ≡ toℕ (reverse i)
reverse-suc {n} {i} = begin
toℕ (reverse (suc i)) ≡⟨ reverse-prop (suc i) ⟩
suc n ∸ suc (toℕ (suc i)) ≡⟨⟩
n ∸ toℕ (suc i) ≡⟨⟩
n ∸ suc (toℕ i) ≡⟨ sym (reverse-prop i) ⟩
toℕ (reverse i) ∎
|
ZORTON.reko/ZORTON_27FB.asm | 0xLiso/dePIXELator | 0 | 91842 | ;;; Segment 27FB (27FB:0000)
27FB:0000 24 1C 00 08 83 C4 04 C9 CB 00 $.........
;; fn27FB_000A: 27FB:000A
;; Called from:
;; 27FB:03CF (in fn27FB_039A)
fn27FB_000A proc
push bx
push cx
mov cl,4h
rol dx,cl
mov bx,dx
and dx,0Fh
and bx,0F0h
add ax,bx
jnc 001Dh
l27FB_001C:
inc dx
l27FB_001D:
pop cx
pop bx
ret
;; fn27FB_0020: 27FB:0020
;; Called from:
;; 27FB:00C6 (in fn27FB_00AC)
;; 27FB:00FB (in fn27FB_00DC)
fn27FB_0020 proc
push ds
push ax
mov ax,28BAh
mov ds,ax
pop ax
push cx
push dx
mov dx,[96CEh]
add dl,0Eh
mov cx,200h
l27FB_0034:
in al,dx
or al,al
js 003Eh
l27FB_0039:
loop 0034h
l27FB_003B:
stc
jmp 0043h
l27FB_003E:
sub dl,4h
in al,dx
clc
l27FB_0043:
pop dx
pop cx
pop ds
ret
;; fn27FB_0047: 27FB:0047
;; Called from:
;; 27FB:00EF (in fn27FB_00DC)
;; 27FB:00F6 (in fn27FB_00DC)
fn27FB_0047 proc
push ds
push ax
mov ax,28BAh
mov ds,ax
pop ax
push cx
push dx
mov dx,[96CEh]
add dl,0Ch
mov cx,200h
mov ah,al
l27FB_005D:
in al,dx
or al,al
jns 0067h
l27FB_0062:
loop 005Dh
l27FB_0064:
stc
jmp 006Bh
l27FB_0067:
mov al,ah
out dx,al
clc
l27FB_006B:
pop dx
pop cx
pop ds
ret
27FB:006F 1E .
27FB:0070 50 B8 BA 28 8E D8 58 52 8B 16 CE 96 80 C2 0E EC P..(..XR........
27FB:0080 0A C0 78 02 EB F9 80 EA 04 EC 5A 1F C3 ..x.......Z..
;; fn27FB_008D: 27FB:008D
;; Called from:
;; 27FB:031E (in fn27FB_02C4)
;; 27FB:03E4 (in fn27FB_039A)
;; 27FB:03E9 (in fn27FB_039A)
;; 27FB:03EE (in fn27FB_039A)
;; 27FB:03F3 (in fn27FB_039A)
;; 27FB:03F8 (in fn27FB_039A)
fn27FB_008D proc
push ds
push ax
mov ax,28BAh
mov ds,ax
pop ax
push dx
mov dx,[96CEh]
add dx,0Ch
mov ah,al
l27FB_009F:
in al,dx
or al,al
jns 00A6h
l27FB_00A4:
jmp 009Fh
l27FB_00A6:
mov al,ah
out dx,al
pop dx
pop ds
ret
;; fn27FB_00AC: 27FB:00AC
;; Called from:
;; 27FB:00E7 (in fn27FB_00DC)
;; 27FB:042B (in fn27FB_039A)
fn27FB_00AC proc
push ds
mov ax,28BAh
mov ds,ax
mov dx,[96CEh]
add dl,6h
mov al,1h
out dx,al
sub al,al
l27FB_00BE:
dec al
jnz 00BEh
l27FB_00C2:
out dx,al
mov cx,20h
l27FB_00C6:
call 0020h
jc 00D3h
l27FB_00CB:
cmp al,0AAh
jnz 00D3h
l27FB_00CF:
sub ax,ax
jmp 00D9h
l27FB_00D3:
loop 00C6h
l27FB_00D5:
stc
mov ax,1h
l27FB_00D9:
pop ds
retf
27FB:00DB 00 .
;; fn27FB_00DC: 27FB:00DC
;; Called from:
;; 209F:00F5 (in fn209F_00DD)
fn27FB_00DC proc
push ds
push ax
mov ax,28BAh
mov ds,ax
pop ax
sub bx,bx
nop
push cs
call 00ACh
jc 0107h
l27FB_00ED:
mov al,0E0h
call 0047h
jc 0107h
l27FB_00F4:
mov al,0C6h
call 0047h
jc 0107h
l27FB_00FB:
call 0020h
jc 0107h
l27FB_0100:
cmp al,39h
jnz 0107h
l27FB_0104:
mov bx,4h
l27FB_0107:
mov ax,100h
call 0167h
mov ax,460h
call 0167h
mov ax,480h
call 0167h
mov al,0h
call 0146h
jc 0142h
l27FB_0120:
mov ax,2FFh
call 0167h
mov ax,421h
call 0167h
mov al,0C0h
call 0146h
jc 0142h
l27FB_0133:
mov ax,460h
call 0167h
mov ax,480h
call 0167h
add bx,2h
l27FB_0142:
mov ax,bx
pop ds
retf
;; fn27FB_0146: 27FB:0146
;; Called from:
;; 27FB:011B (in fn27FB_00DC)
;; 27FB:012E (in fn27FB_00DC)
fn27FB_0146 proc
push cx
push dx
mov cx,40h
mov ah,al
and ah,0E0h
mov dx,[96CEh]
add dl,8h
l27FB_0157:
in al,dx
and al,0E0h
cmp ah,al
jz 0163h
l27FB_015E:
loop 0157h
l27FB_0160:
stc
jmp 0164h
l27FB_0163:
clc
l27FB_0164:
pop dx
pop cx
ret
;; fn27FB_0167: 27FB:0167
;; Called from:
;; 27FB:010A (in fn27FB_00DC)
;; 27FB:0110 (in fn27FB_00DC)
;; 27FB:0116 (in fn27FB_00DC)
;; 27FB:0123 (in fn27FB_00DC)
;; 27FB:0129 (in fn27FB_00DC)
;; 27FB:0136 (in fn27FB_00DC)
;; 27FB:013C (in fn27FB_00DC)
fn27FB_0167 proc
push ax
push cx
push dx
mov dx,[96CEh]
add dl,8h
xchg al,ah
out dx,al
mov cx,[96C8h]
l27FB_0178:
nop
dec cx
or cx,cx
jnz 0178h
l27FB_017E:
inc dx
mov al,ah
out dx,al
mov cx,[96CAh]
l27FB_0186:
nop
dec cx
or cx,cx
jnz 0186h
l27FB_018C:
pop dx
pop cx
pop ax
ret
;; fn27FB_0190: 27FB:0190
;; Called from:
;; 27FB:03A9 (in fn27FB_039A)
fn27FB_0190 proc
push ds
push ax
mov ax,28BAh
mov ds,ax
pop ax
mov [96D4h],ax
and al,3h
shl ax,1h
mov [96DCh],ax
shr ax,1h
add al,7Fh
cmp al,81h
jnc 01B2h
l27FB_01AA:
add al,3h
cmp al,83h
jnc 01B2h
l27FB_01B0:
add al,5h
l27FB_01B2:
mov [96DFh],al
pop ds
ret
;; fn27FB_01B7: 27FB:01B7
;; Called from:
;; 27FB:02D6 (in fn27FB_02C4)
fn27FB_01B7 proc
push cx
push ds
push ax
mov ax,28BAh
mov ds,ax
pop ax
mov [96D2h],ax
and al,0Fh
mov cx,ax
and cl,7h
mov ch,1h
shl ch,cl
mov [96DEh],ch
mov cl,al
add cl,8h
cmp cl,10h
jc 01DFh
l27FB_01DC:
add cl,60h
l27FB_01DF:
sub ch,ch
mov [96DAh],cx
and al,8h
cbw
mov cl,4h
shl ax,cl
add ax,21h
mov [96D8h],ax
pop ds
pop cx
ret
27FB:01F5 00 .
;; fn27FB_01F6: 27FB:01F6
;; Called from:
;; 27FB:0518 (in fn27FB_050A)
fn27FB_01F6 proc
push ds
push es
push di
push si
mov es,dx
mov di,ax
call 0247h
or ax,ax
jz 023Eh
l27FB_0205:
mov ds,ax
mov bx,2Ch
mov ds,[bx]
sub si,si
mov bx,di
l27FB_0210:
mov di,bx
mov ah,es:[di]
l27FB_0215:
lodsb
cmp ah,al
jnz 0231h
l27FB_021A:
inc di
mov ah,es:[di]
or ah,ah
jnz 0215h
l27FB_0222:
lodsb
cmp al,20h
jz 0222h
l27FB_0227:
cmp al,3Dh
jnz 0235h
l27FB_022B:
mov dx,ds
mov ax,si
jmp 0242h
l27FB_0231:
or al,al
jz 023Ah
l27FB_0235:
lodsb
or al,al
jnz 0235h
l27FB_023A:
cmp al,[si]
jnz 0210h
l27FB_023E:
sub dx,dx
sub ax,ax
l27FB_0242:
pop si
pop di
pop es
pop ds
ret
;; fn27FB_0247: 27FB:0247
;; Called from:
;; 27FB:01FE (in fn27FB_01F6)
fn27FB_0247 proc
mov ah,30h
int 21h
cmp al,8h
jnc 027Ch
l27FB_024F:
push es
push di
mov ah,52h
int 21h
mov es,es:[bx-2h]
sub bx,bx
sub di,di
mov ax,es
l27FB_025F:
inc ax
cmp ax,es:[bx+1h]
jnz 0268h
l27FB_0266:
mov di,ax
l27FB_0268:
cmp byte ptr es:[bx],5Ah
jz 0276h
l27FB_026E:
add ax,es:[bx+3h]
mov es,ax
jmp 025Fh
l27FB_0276:
mov ax,di
pop di
pop es
jmp 0282h
l27FB_027C:
mov ah,62h
int 21h
mov ax,bx
l27FB_0282:
ret
27FB:0283 00 .
;; fn27FB_0284: 27FB:0284
;; Called from:
;; 27FB:03D6 (in fn27FB_039A)
fn27FB_0284 proc
push ds
push ax
mov ax,28BAh
mov ds,ax
pop ax
push ax
mov ah,[96D4h]
mov al,4h
add al,ah
out 0Ah,al
sub al,al
out 0Ch,al
mov al,dh
and al,0FCh
or al,ah
out 0Bh,al
mov al,dl
mov dl,[96DFh]
sub dh,dh
out dx,al
pop ax
mov dx,[96DCh]
out dx,al
mov al,ah
out dx,al
inc dx
mov al,cl
out dx,al
mov al,ch
out dx,al
mov al,[96D4h]
out 0Ah,al
pop ds
ret
27FB:02C3 00 .
;; fn27FB_02C4: 27FB:02C4
;; Called from:
;; 209F:00FE (in fn209F_00DD)
fn27FB_02C4 proc
push ds
push ax
mov ax,28BAh
mov ds,ax
pop ax
push bp
sub sp,6h
mov bp,sp
pushf
mov ax,[96D2h]
call 01B7h
neg word ptr [96D2h]
mov bx,[96DAh]
call 0497h
mov [bp+2h],ax
mov [bp+4h],dx
cli
mov dx,[96CEh]
add dl,0Eh
in al,dx
mov bx,[96DAh]
mov ax,359h
mov dx,cs
call 0482h
mov dx,[96D8h]
in al,dx
mov [96CCh],al
mov ah,[96DEh]
not ah
and al,ah
out dx,al
sti
call 037Eh
test word ptr [96D2h],8000h
jz 0334h
l27FB_031C:
mov al,0F2h
call 008Dh
call 037Eh
test word ptr [96D2h],8000h
jz 033Ah
l27FB_032C:
mov dx,[96CEh]
add dl,0Eh
in al,dx
l27FB_0334:
mov word ptr [96D2h],0h
l27FB_033A:
mov al,[96CCh]
mov dx,[96D8h]
out dx,al
mov bx,[96DAh]
mov ax,[bp+2h]
mov dx,[bp+4h]
call 0482h
mov ax,[96D2h]
popf
add sp,6h
pop bp
pop ds
retf
27FB:0359 1E 50 52 B8 BA 28 8E .PR..(.
27FB:0360 D8 8B 16 CE 96 83 C2 0E EC F7 1E D2 96 B0 20 83 .............. .
27FB:0370 3E D2 96 08 72 02 E6 A0 E6 20 5A 58 1F CF >...r.... ZX..
;; fn27FB_037E: 27FB:037E
;; Called from:
;; 27FB:0311 (in fn27FB_02C4)
;; 27FB:0321 (in fn27FB_02C4)
fn27FB_037E proc
push ds
mov ax,40h
mov ds,ax
mov bx,6Ch
mov cx,[bx]
l27FB_0389:
mov ax,[bx]
sub ax,cx
cwd
xor ax,dx
sub ax,dx
cmp ax,3h
jc 0389h
l27FB_0397:
pop ds
ret
27FB:0399 00 .
;; fn27FB_039A: 27FB:039A
;; Called from:
;; 209F:0107 (in fn209F_00DD)
fn27FB_039A proc
push bp
sub sp,6h
mov bp,sp
push ds
mov ax,28BAh
mov ds,ax
mov ax,[96D4h]
call 0190h
mov bx,[96DAh]
call 0497h
mov [bp+0h],ax
mov [bp+2h],dx
mov bx,[96DAh]
mov dx,cs
mov ax,438h
call 0482h
call 04AAh
mov ax,bp
add ax,4h
mov dx,ss
call 000Ah
sub cx,cx
mov dh,45h
call 0284h
mov byte ptr [bp+4h],1h
and byte ptr [96D5h],7Fh
mov al,40h
call 008Dh
mov al,0A6h
call 008Dh
mov al,24h
call 008Dh
sub al,al
call 008Dh
sub al,al
call 008Dh
call 045Eh
call 04D7h
mov bx,[96DAh]
mov dx,[bp+2h]
mov ax,[bp+0h]
call 0482h
mov ax,[96D4h]
cwd
cbw
mov [96D4h],ax
add al,4h
out 0Ah,al
or dx,dx
jz 0424h
l27FB_041E:
cmp byte ptr [bp+4h],1h
jnz 042Fh
l27FB_0424:
mov word ptr [96D4h],0FFFFh
nop
push cs
call 00ACh
l27FB_042F:
mov ax,[96D4h]
pop ds
add sp,6h
pop bp
retf
27FB:0438 1E 50 52 B8 BA 28 8E D8 .PR..(..
27FB:0440 8B 16 CE 96 83 C2 0E EC 80 0E D5 96 80 B0 20 83 .............. .
27FB:0450 3E D2 96 08 72 02 E6 A0 E6 20 5A 58 1F CF >...r.... ZX..
;; fn27FB_045E: 27FB:045E
;; Called from:
;; 27FB:03FB (in fn27FB_039A)
fn27FB_045E proc
push ds
push bx
push cx
push dx
mov cx,ax
mov ax,40h
mov ds,ax
mov bx,6Ch
mov cx,[bx]
l27FB_046E:
mov ax,[bx]
sub ax,cx
cwd
xor ax,dx
sub ax,dx
cmp ax,4h
jc 046Eh
l27FB_047C:
pop dx
pop cx
pop bx
pop ds
ret
27FB:0481 00 .
;; fn27FB_0482: 27FB:0482
;; Called from:
;; 27FB:02FC (in fn27FB_02C4)
;; 27FB:034C (in fn27FB_02C4)
;; 27FB:03C2 (in fn27FB_039A)
;; 27FB:040B (in fn27FB_039A)
fn27FB_0482 proc
pushf
push ds
shl bx,1h
shl bx,1h
cli
push ax
sub ax,ax
mov ds,ax
pop ax
mov [bx],ax
mov [bx+2h],dx
pop ds
popf
ret
;; fn27FB_0497: 27FB:0497
;; Called from:
;; 27FB:02E1 (in fn27FB_02C4)
;; 27FB:03B0 (in fn27FB_039A)
fn27FB_0497 proc
pushf
push ds
shl bx,1h
shl bx,1h
cli
sub ax,ax
mov ds,ax
mov ax,[bx]
mov dx,[bx+2h]
pop ds
popf
ret
;; fn27FB_04AA: 27FB:04AA
;; Called from:
;; 27FB:03C5 (in fn27FB_039A)
fn27FB_04AA proc
push ax
push cx
push dx
push ds
mov ax,28BAh
mov ds,ax
mov ax,[96D2h]
mov dx,ax
and dl,8h
mov cl,4h
shl dl,cl
add dx,21h
mov cl,al
and cl,7h
mov ah,0FEh
rol ah,cl
pushf
cli
in al,dx
and al,ah
out dx,al
popf
pop ds
pop dx
pop cx
pop ax
ret
;; fn27FB_04D7: 27FB:04D7
;; Called from:
;; 27FB:03FE (in fn27FB_039A)
fn27FB_04D7 proc
push ax
push cx
push dx
push ds
mov ax,28BAh
mov ds,ax
mov ax,[96D2h]
cmp ax,2h
jz 0504h
l27FB_04E8:
mov dx,ax
and dl,8h
mov cl,4h
shl dl,cl
add dx,21h
mov cl,al
and cl,7h
mov ah,1h
rol ah,cl
pushf
cli
in al,dx
or al,ah
out dx,al
popf
l27FB_0504:
pop ds
pop dx
pop cx
pop ax
ret
27FB:0509 00 .
;; fn27FB_050A: 27FB:050A
;; Called from:
;; 209F:00EC (in fn209F_00DD)
fn27FB_050A proc
push es
push di
push si
push ds
mov ax,28BAh
mov ds,ax
mov dx,cs
mov ax,5C5h
call 01F6h
mov di,1h
or dx,dx
jz 054Bh
l27FB_0522:
mov es,dx
mov si,ax
mov di,2h
mov al,41h
call 05CDh
jc 054Bh
l27FB_0530:
mov bx,ax
call 05EFh
jc 054Bh
l27FB_0537:
cmp ah,2h
jnz 054Bh
l27FB_053C:
and al,0F0h
cmp al,60h
ja 054Bh
l27FB_0542:
cmp al,10h
jc 054Bh
l27FB_0546:
mov [96CEh],ax
jmp 054Dh
l27FB_054B:
jmp 05BEh
l27FB_054D:
mov di,3h
mov al,49h
call 05CDh
jc 05BEh
l27FB_0557:
mov bx,ax
call 0637h
jc 05BEh
l27FB_055E:
cmp ax,2h
jc 05BEh
l27FB_0563:
cmp ax,0Fh
ja 05BEh
l27FB_0568:
mov [96D2h],ax
mov di,4h
mov al,44h
call 05CDh
jc 05BEh
l27FB_0575:
mov bx,ax
call 0637h
jc 05BEh
l27FB_057C:
cmp ax,3h
ja 05BEh
l27FB_0581:
mov [96D4h],ax
sub di,di
mov al,4Dh
call 05CDh
jc 05A3h
l27FB_058D:
mov bx,ax
call 05EFh
jc 05A3h
l27FB_0594:
cmp ah,2h
jnz 05A3h
l27FB_0599:
and al,0F0h
cmp al,60h
ja 05A3h
l27FB_059F:
cmp al,10h
jnc 05A6h
l27FB_05A3:
mov ax,[96CEh]
l27FB_05A6:
mov [96D0h],ax
mov al,54h
call 05CDh
jc 05BEh
l27FB_05B0:
mov bx,ax
call 0637h
jc 05BEh
l27FB_05B7:
or ax,ax
jz 05BEh
l27FB_05BB:
mov [96D6h],ax
l27FB_05BE:
mov ax,di
pop ds
pop si
pop di
pop es
retf
27FB:05C5 42 4C 41 53 54 45 52 00 BLASTER.
;; fn27FB_05CD: 27FB:05CD
;; Called from:
;; 27FB:052B (in fn27FB_050A)
;; 27FB:0552 (in fn27FB_050A)
;; 27FB:0570 (in fn27FB_050A)
;; 27FB:0588 (in fn27FB_050A)
;; 27FB:05AB (in fn27FB_050A)
fn27FB_05CD proc
push ds
push si
push es
pop ds
mov ah,al
l27FB_05D3:
lodsb
or al,al
jz 05EBh
l27FB_05D8:
cmp al,61h
jc 05E2h
l27FB_05DC:
cmp al,7Ah
ja 05E2h
l27FB_05E0:
sub al,20h
l27FB_05E2:
cmp al,ah
jnz 05D3h
l27FB_05E6:
mov ax,si
clc
jmp 05ECh
l27FB_05EB:
stc
l27FB_05EC:
pop si
pop ds
ret
;; fn27FB_05EF: 27FB:05EF
;; Called from:
;; 27FB:0532 (in fn27FB_050A)
;; 27FB:058F (in fn27FB_050A)
fn27FB_05EF proc
sub dx,dx
mov al,es:[bx]
inc bx
cmp al,20h
jz 0635h
l27FB_05F9:
cmp al,0h
jz 0635h
l27FB_05FD:
mov cl,4h
shl dx,cl
cmp al,30h
jc 060Fh
l27FB_0605:
cmp al,39h
ja 060Fh
l27FB_0609:
sub al,30h
or dl,al
jmp 0625h
l27FB_060F:
cmp al,61h
jc 0619h
l27FB_0613:
cmp al,7Ah
ja 0619h
l27FB_0617:
sub al,61h
l27FB_0619:
cmp al,41h
jc 0635h
l27FB_061D:
cmp al,46h
ja 0635h
l27FB_0621:
sub al,37h
or dl,al
l27FB_0625:
mov al,es:[bx]
inc bx
cmp al,20h
jz 0631h
l27FB_062D:
or al,al
jnz 05FDh
l27FB_0631:
mov ax,dx
jmp 0636h
l27FB_0635:
stc
l27FB_0636:
ret
;; fn27FB_0637: 27FB:0637
;; Called from:
;; 27FB:0559 (in fn27FB_050A)
;; 27FB:0577 (in fn27FB_050A)
;; 27FB:05B2 (in fn27FB_050A)
fn27FB_0637 proc
sub dx,dx
mov al,es:[bx]
inc bx
cmp al,20h
jz 066Dh
l27FB_0641:
cmp al,0h
jz 066Dh
l27FB_0645:
shl dx,1h
mov cx,dx
shl dx,1h
shl dx,1h
add dx,cx
cmp al,30h
jc 066Dh
l27FB_0653:
cmp al,39h
ja 066Dh
l27FB_0657:
sub al,30h
sub ah,ah
add dx,ax
mov al,es:[bx]
inc bx
cmp al,20h
jz 0669h
l27FB_0665:
or al,al
jnz 0645h
l27FB_0669:
mov ax,dx
jmp 066Eh
l27FB_066D:
stc
l27FB_066E:
ret
27FB:066F 00 .
|
source/interfaces/i-c.ads | ytomino/drake | 33 | 9466 | <gh_stars>10-100
pragma License (Unrestricted);
package Interfaces.C is
pragma Pure;
-- Declarations based on C's <limits.h>
CHAR_BIT : constant := 8; -- typically 8
SCHAR_MIN : constant := -128; -- typically -128
SCHAR_MAX : constant := 127; -- typically 127
UCHAR_MAX : constant := 255; -- typically 255
-- Signed and Unsigned Integers
type int is new Integer; -- implementation-defined
type short is new Short_Integer; -- implementation-defined
type long is new Long_Integer; -- implementation-defined
type long_long is new Long_Long_Integer; -- AI12-0184-1, 64-bit
type signed_char is range SCHAR_MIN .. SCHAR_MAX;
for signed_char'Size use CHAR_BIT;
type unsigned is mod 2 ** int'Size; -- implementation-defined
type unsigned_short is mod 2 ** short'Size; -- implementation-defined
type unsigned_long is mod 2 ** long'Size; -- implementation-defined
type unsigned_long_long is mod 2 ** long_long'Size; -- AI12-0184-1, 64-bit
type unsigned_char is mod UCHAR_MAX + 1;
for unsigned_char'Size use CHAR_BIT;
subtype plain_char is unsigned_char; -- implementation-defined
type ptrdiff_t is range
-(2 ** (Standard'Address_Size - 1)) ..
2 ** (Standard'Address_Size - 1) - 1; -- implementation-defined
type size_t is mod 2 ** Standard'Address_Size; -- implementation-defined
-- Floating Point
type C_float is new Standard.Float; -- implementation-defined
type double is new Standard.Long_Float; -- implementation-defined
type long_double is new Standard.Long_Long_Float; -- implementation-defined
-- Characters and Strings
type char is new Character; -- implementation-defined character type
nul : constant char := char'Val (0); -- implementation-defined
-- extended
function To_char (
Item : Character;
Substitute : char) -- Windows only
return char;
function To_char (
Item : Character)
return char;
pragma Inline (To_char);
function To_C (Item : Character) return char
renames To_char;
-- extended
function To_Character (
Item : char;
Substitute : Character) -- Windows only
return Character;
function To_Character (
Item : char)
return Character;
pragma Inline (To_Character);
function To_Ada (Item : char) return Character
renames To_Character;
type char_array is array (size_t range <>) of aliased char;
for char_array'Component_Size use CHAR_BIT;
function Is_Nul_Terminated (Item : char_array) return Boolean;
-- extended
function Length (Item : char_array) return size_t;
-- extended
function To_char_array (
Item : String;
Append_Nul : Boolean := True;
Substitute : char_array := (0 => '?')) -- Windows only
return char_array;
pragma Inline (To_char_array);
-- modified
function To_C (
Item : String;
Append_Nul : Boolean := True;
Substitute : char_array := (0 => '?')) -- additional
return char_array
renames To_char_array;
-- extended
function To_String (
Item : char_array;
Trim_Nul : Boolean := True;
Substitute : String := "?") -- unreferenced
return String;
pragma Inline (To_String);
-- modified
function To_Ada (
Item : char_array;
Trim_Nul : Boolean := True;
Substitute : String := "?") -- additional
return String
renames To_String;
-- extended
procedure To_char_array (
Item : String;
Target : out char_array;
Count : out size_t;
Append_Nul : Boolean := True;
Substitute : char_array := (0 => '?')); -- Windows only
pragma Inline (To_char_array);
-- modified
procedure To_C (
Item : String;
Target : out char_array;
Count : out size_t;
Append_Nul : Boolean := True;
Substitute : char_array := (0 => '?')) -- additional
renames To_char_array;
-- extended
procedure To_String (
Item : char_array;
Target : out String;
Count : out Natural;
Trim_Nul : Boolean := True;
Substitute : String := "?"); -- unreferenced
pragma Inline (To_String);
-- modified
procedure To_Ada (
Item : char_array;
Target : out String;
Count : out Natural;
Trim_Nul : Boolean := True;
Substitute : String := "?") -- additional
renames To_String;
-- Wide Character and Wide String
type wchar_t is
mod 2 ** Standard'Wchar_T_Size; -- implementation-defined character type
for wchar_t'Size use Standard'Wchar_T_Size;
wide_nul : constant wchar_t := wchar_t'Val (0); -- implementation-defined
-- extended
function To_wchar_t (
Item : Wide_Character;
Substitute : wchar_t) -- POSIX only
return wchar_t;
function To_wchar_t (
Item : Wide_Character)
return wchar_t;
pragma Inline (To_wchar_t);
function To_C (Item : Wide_Character) return wchar_t
renames To_wchar_t;
-- extended
function To_Wide_Character (
Item : wchar_t;
Substitute : Wide_Character) -- POSIX only
return Wide_Character;
function To_Wide_Character (
Item : wchar_t)
return Wide_Character;
pragma Inline (To_Wide_Character);
function To_Ada (Item : wchar_t) return Wide_Character
renames To_Wide_Character;
type wchar_array is array (size_t range <>) of aliased wchar_t;
pragma Pack (wchar_array);
function Is_Nul_Terminated (Item : wchar_array) return Boolean;
-- extended
function Length (Item : wchar_array) return size_t;
-- extended
function To_wchar_array (
Item : Wide_String;
Append_Nul : Boolean := True;
Substitute : wchar_array := (0 => Character'Pos ('?'))) -- POSIX only
return wchar_array;
pragma Inline (To_wchar_array);
-- modified
function To_C (
Item : Wide_String;
Append_Nul : Boolean := True;
Substitute : wchar_array := (0 => Character'Pos ('?'))) -- additional
return wchar_array
renames To_wchar_array;
-- extended
function To_Wide_String (
Item : wchar_array;
Trim_Nul : Boolean := True;
Substitute : Wide_String := "?") -- POSIX only
return Wide_String;
pragma Inline (To_Wide_String);
-- modified
function To_Ada (
Item : wchar_array;
Trim_Nul : Boolean := True;
Substitute : Wide_String := "?") -- additional
return Wide_String
renames To_Wide_String;
-- extended
procedure To_wchar_array (
Item : Wide_String;
Target : out wchar_array;
Count : out size_t;
Append_Nul : Boolean := True;
Substitute : wchar_array := (0 => Character'Pos ('?'))); -- POSIX only
pragma Inline (To_wchar_array);
-- modified
procedure To_C (
Item : Wide_String;
Target : out wchar_array;
Count : out size_t;
Append_Nul : Boolean := True;
Substitute : wchar_array := (0 => Character'Pos ('?'))) -- additional
renames To_wchar_array;
-- extended
procedure To_Wide_String (
Item : wchar_array;
Target : out Wide_String;
Count : out Natural;
Trim_Nul : Boolean := True;
Substitute : Wide_String := "?"); -- POSIX only
pragma Inline (To_Wide_String);
-- modified
procedure To_Ada (
Item : wchar_array;
Target : out Wide_String;
Count : out Natural;
Trim_Nul : Boolean := True;
Substitute : Wide_String := "?") -- additional
renames To_Wide_String;
-- extended
-- Wide Wide Character and Wide Wide String:
function To_wchar_t (
Item : Wide_Wide_Character;
Substitute : wchar_t := Character'Pos ('?')) -- Windows only
return wchar_t;
pragma Inline (To_wchar_t);
-- extended
function To_Wide_Wide_Character (
Item : wchar_t;
Substitute : Wide_Wide_Character := '?') -- Windows only
return Wide_Wide_Character;
pragma Inline (To_Wide_Wide_Character);
-- extended
function To_wchar_array (
Item : Wide_Wide_String;
Append_Nul : Boolean := True;
Substitute : wchar_array := (0 => Character'Pos ('?'))) -- Windows only
return wchar_array;
pragma Inline (To_wchar_array);
-- extended
function To_Wide_Wide_String (
Item : wchar_array;
Trim_Nul : Boolean := True;
Substitute : Wide_Wide_String := "?") -- Windows only
return Wide_Wide_String;
pragma Inline (To_Wide_Wide_String);
-- extended
procedure To_wchar_array (
Item : Wide_Wide_String;
Target : out wchar_array;
Count : out size_t;
Append_Nul : Boolean := True;
Substitute : wchar_array := (0 => Character'Pos ('?'))); -- Windows only
pragma Inline (To_wchar_array);
-- extended
procedure To_Wide_Wide_String (
Item : wchar_array;
Target : out Wide_Wide_String;
Count : out Natural;
Trim_Nul : Boolean := True;
Substitute : Wide_Wide_String := "?"); -- Windows only
pragma Inline (To_Wide_Wide_String);
-- ISO/IEC 10646:2003 compatible types defined by ISO/IEC TR 19769:2004.
type char16_t is
new Wide_Character; -- implementation-defined character type
char16_nul : constant char16_t :=
char16_t'Val (0); -- implementation-defined
function To_C (Item : Wide_Character) return char16_t;
pragma Inline (To_C);
function To_Ada (Item : char16_t) return Wide_Character;
pragma Inline (To_Ada);
type char16_array is array (size_t range <>) of aliased char16_t;
pragma Pack (char16_array);
function Is_Nul_Terminated (Item : char16_array) return Boolean;
-- extended
function Length (Item : char16_array) return size_t;
-- modified
function To_C (
Item : Wide_String;
Append_Nul : Boolean := True;
Substitute : char16_array := "?") -- additional, and unreferenced
return char16_array;
pragma Inline (To_C);
-- modified
function To_Ada (
Item : char16_array;
Trim_Nul : Boolean := True;
Substitute : Wide_String := "?") -- additional, and unreferenced
return Wide_String;
pragma Inline (To_Ada);
-- modified
procedure To_C (
Item : Wide_String;
Target : out char16_array;
Count : out size_t;
Append_Nul : Boolean := True;
Substitute : char16_array := "?"); -- additional, and unreferenced
pragma Inline (To_C);
-- modified
procedure To_Ada (
Item : char16_array;
Target : out Wide_String;
Count : out Natural;
Trim_Nul : Boolean := True;
Substitute : Wide_String := "?"); -- additional, and unreferenced
pragma Inline (To_Ada);
type char32_t is
new Wide_Wide_Character; -- implementation-defined character type
char32_nul : constant char32_t :=
char32_t'Val (0); -- implementation-defined
function To_C (Item : Wide_Wide_Character) return char32_t;
pragma Inline (To_C);
function To_Ada (Item : char32_t) return Wide_Wide_Character;
pragma Inline (To_Ada);
type char32_array is array (size_t range <>) of aliased char32_t;
pragma Pack (char32_array);
function Is_Nul_Terminated (Item : char32_array) return Boolean;
-- extended
function Length (Item : char32_array) return size_t;
-- modified
function To_C (
Item : Wide_Wide_String;
Append_Nul : Boolean := True;
Substitute : char32_array := "?") -- additional, and unreferenced
return char32_array;
pragma Inline (To_C);
-- modified
function To_Ada (
Item : char32_array;
Trim_Nul : Boolean := True;
Substitute : Wide_Wide_String := "?") -- additional, and unreferenced
return Wide_Wide_String;
pragma Inline (To_Ada);
-- modified
procedure To_C (
Item : Wide_Wide_String;
Target : out char32_array;
Count : out size_t;
Append_Nul : Boolean := True;
Substitute : char32_array := "?"); -- additional, and unreferenced
pragma Inline (To_C);
-- modified
procedure To_Ada (
Item : char32_array;
Target : out Wide_Wide_String;
Count : out Natural;
Trim_Nul : Boolean := True;
Substitute : Wide_Wide_String := "?"); -- additional, and unreferenced
pragma Inline (To_Ada);
Terminator_Error : exception;
-- extended
-- Common to instances of Interfaces.C.Pointers.
Pointer_Error : exception;
-- extended
-- Common to instances of Interfaces.C.Generic_Strings.
Dereference_Error : exception;
Update_Error : exception;
end Interfaces.C;
|
build/gnat/rts/4.9/adainclude/interfac.ads | Lucretia/bare_bones | 70 | 5767 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- I N T E R F A C E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2002-2013, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the implementation dependent sections of this file. --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
pragma Compiler_Unit_Warning;
package Interfaces is
pragma Pure;
-- All identifiers in this unit are implementation defined
pragma Implementation_Defined;
type Integer_8 is range -2 ** 7 .. 2 ** 7 - 1;
for Integer_8'Size use 8;
type Integer_16 is range -2 ** 15 .. 2 ** 15 - 1;
for Integer_16'Size use 16;
type Integer_32 is range -2 ** 31 .. 2 ** 31 - 1;
for Integer_32'Size use 32;
type Integer_64 is range -2 ** 63 .. 2 ** 63 - 1;
for Integer_64'Size use 64;
type Unsigned_8 is mod 2 ** 8;
for Unsigned_8'Size use 8;
type Unsigned_16 is mod 2 ** 16;
for Unsigned_16'Size use 16;
type Unsigned_32 is mod 2 ** 32;
for Unsigned_32'Size use 32;
type Unsigned_64 is mod 2 ** 64;
for Unsigned_64'Size use 64;
function Shift_Left
(Value : Unsigned_8;
Amount : Natural) return Unsigned_8;
function Shift_Right
(Value : Unsigned_8;
Amount : Natural) return Unsigned_8;
function Shift_Right_Arithmetic
(Value : Unsigned_8;
Amount : Natural) return Unsigned_8;
function Rotate_Left
(Value : Unsigned_8;
Amount : Natural) return Unsigned_8;
function Rotate_Right
(Value : Unsigned_8;
Amount : Natural) return Unsigned_8;
function Shift_Left
(Value : Unsigned_16;
Amount : Natural) return Unsigned_16;
function Shift_Right
(Value : Unsigned_16;
Amount : Natural) return Unsigned_16;
function Shift_Right_Arithmetic
(Value : Unsigned_16;
Amount : Natural) return Unsigned_16;
function Rotate_Left
(Value : Unsigned_16;
Amount : Natural) return Unsigned_16;
function Rotate_Right
(Value : Unsigned_16;
Amount : Natural) return Unsigned_16;
function Shift_Left
(Value : Unsigned_32;
Amount : Natural) return Unsigned_32;
function Shift_Right
(Value : Unsigned_32;
Amount : Natural) return Unsigned_32;
function Shift_Right_Arithmetic
(Value : Unsigned_32;
Amount : Natural) return Unsigned_32;
function Rotate_Left
(Value : Unsigned_32;
Amount : Natural) return Unsigned_32;
function Rotate_Right
(Value : Unsigned_32;
Amount : Natural) return Unsigned_32;
function Shift_Left
(Value : Unsigned_64;
Amount : Natural) return Unsigned_64;
function Shift_Right
(Value : Unsigned_64;
Amount : Natural) return Unsigned_64;
function Shift_Right_Arithmetic
(Value : Unsigned_64;
Amount : Natural) return Unsigned_64;
function Rotate_Left
(Value : Unsigned_64;
Amount : Natural) return Unsigned_64;
function Rotate_Right
(Value : Unsigned_64;
Amount : Natural) return Unsigned_64;
pragma Import (Intrinsic, Shift_Left);
pragma Import (Intrinsic, Shift_Right);
pragma Import (Intrinsic, Shift_Right_Arithmetic);
pragma Import (Intrinsic, Rotate_Left);
pragma Import (Intrinsic, Rotate_Right);
-- IEEE Floating point types. Note that the form of these definitions
-- ensures that the work on VMS, even if the standard library is compiled
-- using a Float_Representation pragma for Vax_Float.
pragma Warnings (Off);
-- Turn off warnings for targets not providing IEEE floating-point types
type IEEE_Float_32 is digits 6;
pragma Float_Representation (IEEE_Float, IEEE_Float_32);
for IEEE_Float_32'Size use 32;
type IEEE_Float_64 is digits 15;
pragma Float_Representation (IEEE_Float, IEEE_Float_64);
for IEEE_Float_64'Size use 64;
-- If there is an IEEE extended float available on the machine, we assume
-- that it is available as Long_Long_Float.
-- Note: it is harmless, and explicitly permitted, to include additional
-- types in interfaces, so it is not wrong to have IEEE_Extended_Float
-- defined even if the extended format is not available.
type IEEE_Extended_Float is new Long_Long_Float;
end Interfaces;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.