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
|
---|---|---|---|---|
_build/dispatcher/jmp_ippsGFpECPublicKey_7cc0eb97.asm | zyktrcn/ippcp | 1 | 24998 | <filename>_build/dispatcher/jmp_ippsGFpECPublicKey_7cc0eb97.asm
extern m7_ippsGFpECPublicKey:function
extern n8_ippsGFpECPublicKey:function
extern y8_ippsGFpECPublicKey:function
extern e9_ippsGFpECPublicKey:function
extern l9_ippsGFpECPublicKey:function
extern n0_ippsGFpECPublicKey:function
extern k0_ippsGFpECPublicKey:function
extern ippcpJumpIndexForMergedLibs
extern ippcpSafeInit:function
segment .data
align 8
dq .Lin_ippsGFpECPublicKey
.Larraddr_ippsGFpECPublicKey:
dq m7_ippsGFpECPublicKey
dq n8_ippsGFpECPublicKey
dq y8_ippsGFpECPublicKey
dq e9_ippsGFpECPublicKey
dq l9_ippsGFpECPublicKey
dq n0_ippsGFpECPublicKey
dq k0_ippsGFpECPublicKey
segment .text
global ippsGFpECPublicKey:function (ippsGFpECPublicKey.LEndippsGFpECPublicKey - ippsGFpECPublicKey)
.Lin_ippsGFpECPublicKey:
db 0xf3, 0x0f, 0x1e, 0xfa
call ippcpSafeInit wrt ..plt
align 16
ippsGFpECPublicKey:
db 0xf3, 0x0f, 0x1e, 0xfa
mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc]
movsxd rax, dword [rax]
lea r11, [rel .Larraddr_ippsGFpECPublicKey]
mov r11, qword [r11+rax*8]
jmp r11
.LEndippsGFpECPublicKey:
|
memsim-master/src/memory-transform-eor.ads | strenkml/EE368 | 0 | 29276 |
package Memory.Transform.EOR is
type EOR_Type is new Transform_Type with private;
type EOR_Pointer is access all EOR_Type'Class;
function Create_EOR return EOR_Pointer;
function Random_EOR(next : access Memory_Type'Class;
generator : Distribution_Type;
max_cost : Cost_Type) return Memory_Pointer;
overriding
function Clone(mem : EOR_Type) return Memory_Pointer;
overriding
procedure Permute(mem : in out EOR_Type;
generator : in Distribution_Type;
max_cost : in Cost_Type);
overriding
function Is_Empty(mem : EOR_Type) return Boolean;
overriding
function Get_Name(mem : EOR_Type) return String;
private
type EOR_Type is new Transform_Type with null record;
overriding
function Apply(mem : EOR_Type;
address : Address_Type;
dir : Boolean) return Address_Type;
overriding
function Get_Alignment(mem : EOR_Type) return Positive;
overriding
function Get_Transform_Length(mem : EOR_Type) return Natural;
end Memory.Transform.EOR;
|
assembly_code/chp7_05.asm | Nabeegh-Ahmed/BelalHashmi-Assembly-Exercise-Solutions | 104 | 179522 | ;Virtual Window on the Screen
[org 0x0100]
jmp start
character: dw 'H'
;top, left, bottom, right, current row, current column, normal attribute, cursor attribute
address: dw 0, 20, 10 , 70, 10, 25, 07, 10000111b
start: ;call clrscr
push word [character]
push address
call virtualWindow
exit: mov ax, 0x4c00
int 21h
;-----------------------------------------------------------------------------------------------------------------
;Clear Screen
clrscr: pusha
push es
mov ax, 0xb800
mov es, ax
xor di,di
mov ax,0x0720
mov cx,2000
cld
rep stosw
pop es
popa
ret
;-----------------------------------------------------------------------------------------------------------------
scrollUp: pusha
push es
push ds
;Calculating the starting point of the VW
mov al, 80
mul byte [si]
add ax, [si+2]
shl ax, 1
push ax
;Loading the video memory
mov ax, 0xb800
mov es, ax
mov ds, ax
pop ax
;Height times loop chaley ga
mov dx, [bp - 2]
inc dx
cld
a1: mov di, ax ;Destination Point
mov si, ax ;Source Point
add si, 160
;Width jitney character move hon ge har iteration mai
mov cx, [bp - 4]
rep movsw
add ax, 160
dec dx
jnz a1
;Width jitney character move hon ge har iteration mai
mov cx, [bp - 4]
sub ax, 160
mov di,ax
mov ax, 0x720
rep stosw
pop ds
pop es
popa
ret
;-----------------------------------------------------------------------------------------------------------------
virtualWindow: push bp
mov bp, sp
sub sp, 4 ; Making three local variables for storing length and width
; of the Virtual Window on the screen
;bp - 2 ;Height
;bp - 4 ;Width
;bp + 4 ;Address
;bp + 6 ;Character
;Address + 0 ;Top
;Address + 2 ;Left
;Address + 4 ;Bottom
;Address + 6 ;Right
;Address + 8 ;Current Row
;Address + 10 ;Current Column
;Address + 12 ;Normal Attribute
;Address + 14 ;Cursor Attribute
push es
pusha
mov si, [bp + 4]
;Calculating Height
mov ax, [si]
mov bx, [si + 4]
sub bx, ax
mov [bp - 2], bx ;Height
;Calculating Width
mov ax, [si + 2 ]
mov bx, [si + 6]
sub bx, ax
mov [bp - 4], bx ;Width
;-------------------------------------------------------------
;Calculating the required position
mov ax, 0xb800
mov es, ax
;Exact Row
mov ax, [si]
add ax, [si + 8]
mov bx, ax
;Exact Column
mov ax, [si + 2]
add ax, [si + 10]
mov dx, ax
;Exact Position
mov al, 80
mul bl
add ax, dx
shl ax, 1
mov di, ax
;Loading al with the character to be written
mov al, [bp + 6]
mov ah, [si + 12]
mov [es:di], ax
inc dx
cmp dx, [si + 6]
jle l2
mov dx, [si + 2]
inc bx
cmp bx, [si + 4]
jle l2
;call scroll Scroll Up
call scrollUp
;Exact Position
l2: mov al, 80
mul bl
add ax, dx
shl ax, 1
mov di, ax
;Loading the character to be written
mov ah, [si + 14]
mov al, '_'
mov [es:di], ax
return: popa
pop es
add sp, 4
pop bp
ret 4
|
source/Crinkler/modules/old/import10.asm | Vertver/Crinkler | 739 | 173549 | <reponame>Vertver/Crinkler<gh_stars>100-1000
;; -*- tab-width: 4 -*-
bits 32
global _Import
extern __imp__LoadLibraryA@4
extern _ImageBase
extern _DLLNames
extern _ImportList
; Format of DLL names:
; For each DLL
; Zero-terminated DLL name (omitted for kernel32)
; byte: Number of hash-entries for this DLL (including dummies)
; For each entry
; byte: Number of ordinals imported from this hash, minus one
; byte: -1
section .text align=1
_Import:
mov ebx, _ImageBase
mov esi, _DLLNames
mov edi, _ImportList
xor eax, eax
mov eax, [fs:eax+30h] ; PEB base
mov eax, [eax+0ch] ; goto PEB_LDR_DATA
; first entry in InInitializationOrderModuleList
mov eax, [eax+1ch]
mov eax, [byte eax+00h] ; forward to next LIST_ENTRY
mov ebp, [eax+08h] ; Kernel32 base memory
DLLLoop:
xor eax, eax
lodsb
xchg ecx, eax
HashLoop:
pusha
GetProcAddress:
mov eax, [ebp + 3ch] ; eax = PE header offset
add eax, ebp
mov edx, [eax + 78h] ; edx = exports directory table offset
add edx, ebp ; edx = exports directory table address
mov ecx, [edx + 18h] ; ecx = number of names
; Check all names of procedures for the right hash
ScanProcedureNamesLoop:
mov eax, [edx + 20h] ; edx = name pointers table offset
add eax, ebp ; edx = name pointers table address
mov esi, [eax + ecx*4 - 4] ; esi = name pointer offset
add esi, ebp ; esi = name pointer address
xor edi, edi
CalculateHashLoop:
rol edi, 6
xor eax, eax
lodsb
xor edi, eax
dec eax
jge CalculateHashLoop
cmp edi, [ebx] ; check computed hash
loopne ScanProcedureNamesLoop
; ; For debugging
; je .found
; pop edx
; popa
; mov eax, ebx
;.notfoundloop:
; stosd
; dec byte [esi]
; jge .notfoundloop
; jmp NextHash
;.found:
; Found, get the address from the table
mov eax, [edx + 24h] ; ebx = ordinals table RNA offset
add eax, ebp ; ebx = ordinals table RNA address
mov cx, [eax + ecx*2] ; ecx = function ordinal
mov eax, [edx + 1ch] ; ebx = address table RVA offset
add eax, ebp ; ebx = address table RVA address
lea eax, [eax + ecx*4] ; ebp = address of function RVA address
mov [esp + 20], eax ; stack position of edx
popa
mov eax, [edx]
add eax, ebp
stosd
NextHash:
add ebx, byte 4
loop HashLoop
push esi
call [__imp__LoadLibraryA@4]
xchg ebp, eax
NextDLL:
lodsb
dec al
jns NextDLL
inc al
jz DLLLoop |
test/agda-ocaml/Golden/Factorial.agda | agda/agda-ocaml | 48 | 15109 | <reponame>agda/agda-ocaml
module Golden.Factorial where
open import Agda.Builtin.Nat
fac : Nat -> Nat
fac 0 = 1
fac (suc n) = suc n * fac n
a = fac 0
b = fac 10
|
gcc-gcc-7_3_0-release/gcc/ada/switch.adb | best08618/asylo | 7 | 820 | <reponame>best08618/asylo
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S W I T C H --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Osint; use Osint;
with Output; use Output;
package body Switch is
----------------
-- Bad_Switch --
----------------
procedure Bad_Switch (Switch : Character) is
begin
Osint.Fail ("invalid switch: " & Switch);
end Bad_Switch;
procedure Bad_Switch (Switch : String) is
begin
Osint.Fail ("invalid switch: " & Switch);
end Bad_Switch;
------------------------------
-- Check_Version_And_Help_G --
------------------------------
procedure Check_Version_And_Help_G
(Tool_Name : String;
Initial_Year : String;
Version_String : String := Gnatvsn.Gnat_Version_String)
is
Version_Switch_Present : Boolean := False;
Help_Switch_Present : Boolean := False;
Next_Arg : Natural;
begin
-- First check for --version or --help
Next_Arg := 1;
while Next_Arg < Arg_Count loop
declare
Next_Argv : String (1 .. Len_Arg (Next_Arg));
begin
Fill_Arg (Next_Argv'Address, Next_Arg);
if Next_Argv = Version_Switch then
Version_Switch_Present := True;
elsif Next_Argv = Help_Switch then
Help_Switch_Present := True;
end if;
Next_Arg := Next_Arg + 1;
end;
end loop;
-- If --version was used, display version and exit
if Version_Switch_Present then
Set_Standard_Output;
Display_Version (Tool_Name, Initial_Year, Version_String);
Write_Str (Gnatvsn.Gnat_Free_Software);
Write_Eol;
Write_Eol;
Exit_Program (E_Success);
end if;
-- If --help was used, display help and exit
if Help_Switch_Present then
Set_Standard_Output;
Usage;
Write_Eol;
Write_Line ("Report bugs to <EMAIL>");
Exit_Program (E_Success);
end if;
end Check_Version_And_Help_G;
------------------------------------
-- Display_Usage_Version_And_Help --
------------------------------------
procedure Display_Usage_Version_And_Help is
begin
Write_Str (" --version Display version and exit");
Write_Eol;
Write_Str (" --help Display usage and exit");
Write_Eol;
Write_Eol;
end Display_Usage_Version_And_Help;
---------------------
-- Display_Version --
---------------------
procedure Display_Version
(Tool_Name : String;
Initial_Year : String;
Version_String : String := Gnatvsn.Gnat_Version_String)
is
begin
Write_Str (Tool_Name);
Write_Char (' ');
Write_Str (Version_String);
Write_Eol;
Write_Str ("Copyright (C) ");
Write_Str (Initial_Year);
Write_Char ('-');
Write_Str (Gnatvsn.Current_Year);
Write_Str (", ");
Write_Str (Gnatvsn.Copyright_Holder);
Write_Eol;
end Display_Version;
-------------------------
-- Is_Front_End_Switch --
-------------------------
function Is_Front_End_Switch (Switch_Chars : String) return Boolean is
Ptr : constant Positive := Switch_Chars'First;
begin
return Is_Switch (Switch_Chars)
and then
(Switch_Chars (Ptr + 1) = 'I'
or else (Switch_Chars'Length >= 5
and then Switch_Chars (Ptr + 1 .. Ptr + 4) = "gnat")
or else (Switch_Chars'Length >= 5
and then Switch_Chars (Ptr + 2 .. Ptr + 4) = "RTS"));
end Is_Front_End_Switch;
----------------------------
-- Is_Internal_GCC_Switch --
----------------------------
function Is_Internal_GCC_Switch (Switch_Chars : String) return Boolean is
First : constant Natural := Switch_Chars'First + 1;
Last : constant Natural := Switch_Last (Switch_Chars);
begin
return Is_Switch (Switch_Chars)
and then
(Switch_Chars (First .. Last) = "-param" or else
Switch_Chars (First .. Last) = "dumpbase" or else
Switch_Chars (First .. Last) = "auxbase-strip" or else
Switch_Chars (First .. Last) = "auxbase");
end Is_Internal_GCC_Switch;
---------------
-- Is_Switch --
---------------
function Is_Switch (Switch_Chars : String) return Boolean is
begin
return Switch_Chars'Length > 1
and then Switch_Chars (Switch_Chars'First) = '-';
end Is_Switch;
-----------------
-- Switch_last --
-----------------
function Switch_Last (Switch_Chars : String) return Natural is
Last : constant Natural := Switch_Chars'Last;
begin
if Last >= Switch_Chars'First
and then Switch_Chars (Last) = ASCII.NUL
then
return Last - 1;
else
return Last;
end if;
end Switch_Last;
-----------------
-- Nat_Present --
-----------------
function Nat_Present
(Switch_Chars : String;
Max : Integer;
Ptr : Integer) return Boolean
is
begin
return (Ptr <= Max
and then Switch_Chars (Ptr) in '0' .. '9')
or else
(Ptr < Max
and then Switch_Chars (Ptr) = '='
and then Switch_Chars (Ptr + 1) in '0' .. '9');
end Nat_Present;
--------------
-- Scan_Nat --
--------------
procedure Scan_Nat
(Switch_Chars : String;
Max : Integer;
Ptr : in out Integer;
Result : out Nat;
Switch : Character)
is
begin
Result := 0;
if not Nat_Present (Switch_Chars, Max, Ptr) then
Osint.Fail ("missing numeric value for switch: " & Switch);
end if;
if Switch_Chars (Ptr) = '=' then
Ptr := Ptr + 1;
end if;
while Ptr <= Max and then Switch_Chars (Ptr) in '0' .. '9' loop
Result :=
Result * 10 +
Character'Pos (Switch_Chars (Ptr)) - Character'Pos ('0');
Ptr := Ptr + 1;
if Result > Switch_Max_Value then
Osint.Fail ("numeric value out of range for switch: " & Switch);
end if;
end loop;
end Scan_Nat;
--------------
-- Scan_Pos --
--------------
procedure Scan_Pos
(Switch_Chars : String;
Max : Integer;
Ptr : in out Integer;
Result : out Pos;
Switch : Character)
is
Temp : Nat;
begin
Scan_Nat (Switch_Chars, Max, Ptr, Temp, Switch);
if Temp = 0 then
Osint.Fail ("numeric value out of range for switch: " & Switch);
end if;
Result := Temp;
end Scan_Pos;
end Switch;
|
programs/oeis/093/A093350.asm | neoneye/loda | 22 | 166973 | ; A093350: Primes congruent to 6 mod 13.
; 19,71,97,149,227,331,383,409,461,487,617,643,773,877,929,1033,1163,1319,1423,1553,1579,1657,1709,1787,2099,2203,2281,2333,2411,2437,2593,2671,2749,2801,2879,2957,3061,3191,3217,3347,3373,3529,3581,3607,3659,3919,4049,4127,4153,4231,4283,4517,4621,4673,4751,4933,5011,5167,5297,5323,5479,5531,5557,5791,5843,5869,6311,6337,6389,6571,6701,6779,6857,6883,6961,7013,7039,7247,7351,7481,7507,7559,7741,7793,7949,8053,8209,8287,8443,8521,8573,8599,8677,8807,8963,9041,9067,9431,9587,9613
mov $2,$0
add $2,1
pow $2,2
lpb $2
add $1,18
sub $2,1
mov $3,$1
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,8
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
div $1,2
sub $1,22
mul $1,2
add $1,37
mov $0,$1
|
weathercommon.adb | BrentSeidel/WeatherProject | 0 | 22384 | package body WeatherCommon is
procedure show_temp(servo: BBS.BBB.i2c.PCA9685.PS9685_ptr; temp : BBS.units.temp_c) is
servo_value : float := float((temp - temp_min)/(temp_max - temp_min));
error : integer;
begin
if (servo_value < 0.0)
then
servo_value := 0.0;
servo.set_full_on(temp_range_chan, error);
elsif (servo_value > 1.0) then
servo_value := 1.0;
servo.set_full_on(temp_range_chan, error);
else
servo.set_full_off(temp_range_chan, error);
end if;
servo_value := servo_value*2.0 - 1.0;
servo.set_servo(temp_chan, BBS.BBB.i2c.PCA9685.servo_range(servo_value), error);
end;
--
procedure show_press(servo: BBS.BBB.i2c.PCA9685.PS9685_ptr; press : BBS.units.press_p) is
servo_value : float := float((press - press_min)/(press_max - press_min));
error : integer;
begin
if (servo_value < 0.0)
then
servo_value := 0.0;
servo.set_full_on(press_range_chan, error);
elsif (servo_value > 1.0) then
servo_value := 1.0;
servo.set_full_on(press_range_chan, error);
else
servo.set_full_off(press_range_chan, error);
end if;
servo_value := servo_value*2.0 - 1.0;
servo.set_servo(press_chan, BBS.BBB.i2c.PCA9685.servo_range(servo_value), error);
end;
--
procedure show_hum(servo: BBS.BBB.i2c.PCA9685.PS9685_ptr; hum : float) is
servo_value : float := float((hum - hum_min)/(hum_max - hum_min));
error : integer;
begin
if (servo_value < 0.0)
then
servo_value := 0.0;
servo.set_full_on(hum_range_chan, error);
elsif (servo_value > 1.0) then
servo_value := 1.0;
servo.set_full_on(hum_range_chan, error);
else
servo.set_full_off(hum_range_chan, error);
end if;
servo_value := servo_value*2.0 - 1.0;
servo.set_servo(hum_chan, BBS.BBB.i2c.PCA9685.servo_range(servo_value), error);
end;
--
end;
|
deps/subhook/test/foo_64.asm | ziggi/samp-plugin-jit | 0 | 94480 | <filename>deps/subhook/test/foo_64.asm
extern puts
global foo
section .text
message:
db 'foo() called', 0
foo:
nop
push message
call puts
add esp, 8
ret
|
theorems/homotopy/PropJoinProp.agda | mikeshulman/HoTT-Agda | 0 | 11673 | <gh_stars>0
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
{- Proof that if [A] and [B] are two propositions, then so is [A * B]. -}
module homotopy.PropJoinProp
{i} {A : Type i} (pA : is-prop A)
{j} {B : Type j} (pB : is-prop B) where
contr-left : (a : A) → is-contr (A * B)
contr-left a = left a , Pushout-elim
(λ a' → ap left (prop-has-all-paths pA a a'))
(λ b' → glue (a , b'))
(λ {(a' , b') → ↓-cst=idf-in' $ ! $
↓-app=cst-out (apd (λ a → glue (a , b')) (prop-has-all-paths pA a a'))})
contr-right : (b : B) → is-contr (A * B)
contr-right b = right b , Pushout-elim
(λ a' → ! (glue (a' , b)))
(λ b' → ap right (prop-has-all-paths pB b b'))
(λ {(a' , b') → ↓-cst=idf-in' $
! (glue (a' , b)) ∙ glue (a' , b')
=⟨ ! (↓-cst=app-out' $ apd (λ b → glue (a' , b)) (prop-has-all-paths pB b b'))
|in-ctx ! (glue (a' , b)) ∙_ ⟩
! (glue (a' , b)) ∙ glue (a' , b) ∙ ap right (prop-has-all-paths pB b b')
=⟨ ! $ ∙-assoc (! (glue (a' , b))) (glue (a' , b)) (ap right (prop-has-all-paths pB b b')) ⟩
(! (glue (a' , b)) ∙ glue (a' , b)) ∙ ap right (prop-has-all-paths pB b b')
=⟨ !-inv-l (glue (a' , b)) |in-ctx _∙ ap right (prop-has-all-paths pB b b') ⟩
ap right (prop-has-all-paths pB b b')
=∎})
prop*prop-is-prop : is-prop (A * B)
prop*prop-is-prop = inhab-to-contr-is-prop $
Pushout-rec contr-left contr-right (λ _ → prop-has-all-paths is-contr-is-prop _ _)
|
experiments/test-suite/mutation-based/10/1/addr.als | kaiyuanw/AlloyFLCore | 1 | 5250 | pred test15 {
some disj Address0: Address {some disj Name0, Name1: Name {some disj Name0, Address0, Name1: Listing {some disj Book0, Book1, Book2: Book {
Address = Address0
Name = Name0 + Name1
Listing = Name0 + Address0 + Name1
Book = Book0 + Book1 + Book2
entry = Book0->Name0 + Book0->Name1 + Book1->Name0 + Book1->Name1 + Book2->Name0 + Book2->Name1
listed = Book0->Name0->Name1 + Book0->Name1->Address0 + Book1->Name0->Name1 + Book1->Name1->Address0 + Book2->Name0->Address0 + Book2->Name1->Name0
lookup[Book2,Name1] = Name0 + Address0
}}}}
}
run test15 for 3 expect 1
pred test29 {
some disj Address0: Address {some disj Name0, Name1: Name {some disj Name0, Name1, Address0: Listing {some disj Book0, Book1: Book {
Address = Address0
Name = Name0 + Name1
Listing = Name0 + Name1 + Address0
Book = Book0 + Book1
entry = Book1->Name0 + Book1->Name1
listed = Book1->Name0->Name0 + Book1->Name1->Name1
}}}}
}
run test29 for 3 expect 0
pred test6 {
some disj Name0, Name1: Name {some disj Name0, Name1: Listing {some disj Book0: Book {
no Address
Name = Name0 + Name1
Listing = Name0 + Name1
Book = Book0
no entry
no listed
}}}
}
run test6 for 3 expect 1
|
Exp7_8259_Interrupt/Exp7_1_8259_Interrupt.asm | LiamSho/assembly_language_course | 0 | 176350 | <reponame>LiamSho/assembly_language_course
SSTACK SEGMENT STACK
DW 32 DUP(?)
SSTACK ENDS
CODE SEGMENT
ASSUME CS:CODE
START:
PUSH DS
MOV AX, 0000H
MOV DS, AX
MOV AX, OFFSET MIR7 ;取中断入口地址
MOV SI, 003CH ;中断矢量地址
MOV [SI], AX ;填IRQ7的偏移矢量
MOV AX, CS ;段地址
MOV SI, 003EH
MOV [SI], AX ;填IRQ7的段地址矢量
CLI ;中断屏蔽clear interrupt
POP DS
;初始化主片8259
MOV AL, 11H ;0001 0001 级联,边沿触发,要ICW4
OUT 20H, AL ;ICW1
MOV AL, 08H ;0000 1000 中断类型号从8开始
OUT 21H, AL ;ICW2
MOV AL, 04H ;0000 0100
OUT 21H, AL ;ICW3
MOV AL, 01H ;0000 0001 非缓冲方式,8086/8088配置
OUT 21H, AL ;ICW4
MOV AL, 6FH ;OCW1 0110 1111 IR7,IR4引脚的中断开放
OUT 21H, AL
STI ;恢复中断 set interrupt
AA1:
NOP ;空指令
JMP AA1 ;无限循环
MIR7:
STI
CALL DELAY ;延时
MOV AX, 0037H ;37H
INT 10H ;显示字符7
MOV AX, 0020H
INT 10H
MOV AL, 20H
OUT 20H, AL ;中断结束命令
IRET
DELAY:
PUSH CX
MOV CX, 0F00H
AA0:
PUSH AX
POP AX
LOOP AA0
POP CX
RET
CODE ENDS
END START |
oeis/131/A131601.asm | neoneye/loda-programs | 11 | 97754 | ; A131601: The number of different configurations of an n-block of a shift space with k symbols where each symbol but the first must appear isolated and separated from others by an block of length at least m made of first symbol. Here k=49 and m=2.
; Submitted by <NAME>
; 49,97,145,2497,7153,14113,133969,477313,1154737,7585249,30496273,85923649,450015601,1913836705,6038171857,27638920705,119503082545,409335331681,1736003525521,7472151487681,27120247408369,110448416633377,469111688042065,1770883563643777
mov $2,1
lpb $0
sub $0,1
mul $1,3
add $1,1
mov $3,$1
mul $4,16
mov $1,$4
add $2,$3
mov $4,$2
sub $4,$3
lpe
mov $0,$2
sub $0,1
mul $0,48
add $0,49
|
src/main/fragment/mos6502-common/_stackpushstruct_1_=vssm1.asm | jbrandwood/kickc | 2 | 9009 | <reponame>jbrandwood/kickc<filename>src/main/fragment/mos6502-common/_stackpushstruct_1_=vssm1.asm<gh_stars>1-10
lda {m1}
pha |
src/Control/Exception/Primitive.agda | ilya-fiveisky/agda-exceptions | 0 | 1440 | <reponame>ilya-fiveisky/agda-exceptions
module Control.Exception.Primitive where
open import IO.Primitive
postulate
bracket : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c} → IO A → (A → IO B) → (A → IO C) → IO C
{-# IMPORT Control.Exception #-}
{-# COMPILED bracket (\_ _ _ _ _ _ -> Control.Exception.bracket) #-}
|
programs/oeis/017/A017661.asm | neoneye/loda | 22 | 15123 | ; A017661: (12n+11)^9.
; 2357947691,1801152661463,78815638671875,1119130473102767,8662995818654939,45848500718449031,186940255267540403,630249409724609375,1838459212420154507,4785448563124474679
mul $0,12
add $0,11
pow $0,9
|
ugbc/src/hw/gtia/text_at_graphic.asm | spotlessmind1975/ugbasic | 10 | 101533 | <reponame>spotlessmind1975/ugbasic
; /*****************************************************************************
; * ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
; *****************************************************************************
; * Copyright 2021-2022 <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.
; *----------------------------------------------------------------------------
; * Concesso in licenza secondo i termini della Licenza Apache, versione 2.0
; * (la "Licenza"); è proibito usare questo file se non in conformità alla
; * Licenza. Una copia della Licenza è disponibile all'indirizzo:
; *
; * http://www.apache.org/licenses/LICENSE-2.0
; *
; * Se non richiesto dalla legislazione vigente o concordato per iscritto,
; * il software distribuito nei termini della Licenza è distribuito
; * "COSì COM'è", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o
; * implicite. Consultare la Licenza per il testo specifico che regola le
; * autorizzazioni e le limitazioni previste dalla medesima.
; ****************************************************************************/
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
;* *
;* TEXT AT GIVEN POSITION ON GTIA *
;* *
;* by <NAME> *
;* *
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
TEXTATBITMAPMODE:
LDA TEXTADDRESS
STA COPYOFTEXTADDRESS
LDA TEXTADDRESS+1
STA COPYOFTEXTADDRESS+1
LDA #0
STA TABSTODRAW
LDA COLORMAPADDRESS
STA COPYOFCOLORMAPADDRESS
LDA COLORMAPADDRESS+1
STA COPYOFCOLORMAPADDRESS+1
LDA CURRENTMODE
CMP #8
BNE TEXTATANTIC8X
JMP TEXTATANTIC8
TEXTATANTIC8X:
CMP #9
BNE TEXTATANTIC9X
JMP TEXTATANTIC9
TEXTATANTIC9X:
CMP #10
BNE TEXTATANTIC10X
JMP TEXTATANTIC10
TEXTATANTIC10X:
CMP #11
BNE TEXTATANTIC11X
JMP TEXTATANTIC11
TEXTATANTIC11X:
CMP #12
BNE TEXTATANTIC12X
JMP TEXTATANTIC12
TEXTATANTIC12X:
CMP #13
BNE TEXTATANTIC13X
JMP TEXTATANTIC13
TEXTATANTIC13X:
CMP #14
BNE TEXTATANTIC14X
JMP TEXTATANTIC14
TEXTATANTIC14X:
CMP #15
BNE TEXTATANTIC15X
JMP TEXTATANTIC15
TEXTATANTIC15X:
RTS
CALCPOSG:
LDA CURRENTMODE
CMP #8
BNE CALCPOS8X
JMP CALCPOS8
CALCPOS8X:
CMP #9
BNE CALCPOS9X
JMP CALCPOS9
CALCPOS9X:
CMP #10
BNE CALCPOS10X
JMP CALCPOS10
CALCPOS10X:
CMP #11
BNE CALCPOS11X
JMP CALCPOS11
CALCPOS11X:
CMP #12
BNE CALCPOS12X
JMP CALCPOS12
CALCPOS12X:
CMP #13
BNE CALCPOS13X
JMP CALCPOS13
CALCPOS13X:
CMP #14
BNE CALCPOS14X
JMP CALCPOS14
CALCPOS14X:
CMP #15
BNE CALCPOS15X
JMP CALCPOS15
CALCPOS15X:
RTS
CALCPOS8:
LDA #2
STA PATTERN
LDA XCURSYS
ASL A
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA YCURSYS
CLC
ADC #1
ASL A
ASL A
ASL A
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
LDA PLOT4VBASELO,Y ;table of $9C40 row base addresses
; ADC PLOT4LO,X ;+ (4 * Xcell)
STA PLOTDEST ;= cell address
LDA PLOT4VBASEHI,Y ;do the high byte
; ADC PLOT4HI,X
STA PLOTDEST+1
RTS
CALCPOS9:
LDA #0
STA PATTERN
LDA XCURSYS
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA YCURSYS
CLC
ADC #1
ASL A
ASL A
ASL A
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT4VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT4VBASEHI,Y ;do the high byte
STA PLOTDEST+1
RTS
CALCPOS10:
LDA #2
STA PATTERN
LDA XCURSYS
ASL A
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA YCURSYS
CLC
ADC #1
ASL A
ASL A
ASL A
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT5VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT5VBASEHI,Y ;do the high byte
STA PLOTDEST+1
RTS
CALCPOS11:
LDA #0
STA PATTERN
LDA XCURSYS
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA YCURSYS
CLC
ADC #1
ASL A
ASL A
ASL A
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT5VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT5VBASEHI,Y ;do the high byte
STA PLOTDEST+1
RTS
CALCPOS12:
LDA #2
STA PATTERN
LDA XCURSYS
ASL A
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA YCURSYS
CLC
ADC #1
ASL A
ASL A
ASL A
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT5VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT5VBASEHI,Y ;do the high byte
STA PLOTDEST+1
RTS
CALCPOS13:
LDA #2
STA PATTERN
LDA XCURSYS
ASL A
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA YCURSYS
CLC
ADC #1
ASL A
ASL A
ASL A
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT6VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT6VBASEHI,Y ;do the high byte
STA PLOTDEST+1
RTS
CALCPOS14:
LDA #2
STA PATTERN
LDA XCURSYS
ASL A
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA YCURSYS
CLC
ADC #1
ASL A
ASL A
ASL A
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT5VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT5VBASEHI,Y ;do the high byte
STA PLOTDEST+1
RTS
CALCPOS15:
LDA #0
STA PATTERN
LDA XCURSYS
TAX ;tbl_8,x index
;-------------------------
;calc Y-cell
;-------------------------
LDA YCURSYS
CLC
ADC #1
ASL A
ASL A
ASL A
TAY ;tbl_8,y index
;----------------------------------
;add x & y to calc cell point is in
;----------------------------------
CLC
TXA
ADC PLOT6VBASELO,Y ;table of $9C40 row base addresses
STA PLOTDEST ;= cell address
LDA #0
ADC PLOT6VBASEHI,Y ;do the high byte
STA PLOTDEST+1
RTS
;-----------------------------------------------------------------------------
; BITMAP MODE
;-----------------------------------------------------------------------------
TEXTATANTIC8:
JSR CALCPOS8
JMP TEXTATBMCOMMON
TEXTATANTIC9:
JSR CALCPOS9
JMP TEXTATBMCOMMON
TEXTATANTIC10:
JSR CALCPOS10
JMP TEXTATBMCOMMON
TEXTATANTIC11:
JSR CALCPOS11
JMP TEXTATBMCOMMON
TEXTATANTIC12:
JSR CALCPOS12
JMP TEXTATBMCOMMON
TEXTATANTIC13:
JSR CALCPOS13
JMP TEXTATBMCOMMON
TEXTATANTIC14:
JSR CALCPOS14
JMP TEXTATBMCOMMON
TEXTATANTIC15:
JSR CALCPOS15
JMP TEXTATBMCOMMON
TEXTATBMCOMMON:
LDA TEXTWW
AND #$2
BEQ TEXTATBMCNOPEN
LDA _PEN
CMP $2C4
BEQ TEXTATC1
CMP $2C5
BEQ TEXTATC2
CMP $2C6
BEQ TEXTATC3
LDA LASTCOLOR
CMP #1
BEQ TEXTATC1
CMP #2
BEQ TEXTATC2
CMP #3
BEQ TEXTATC3
LDA #2
STA LASTCOLOR
JMP TEXTATSC1
TEXTATSC1:
LDA _PEN
STA $2C4
INC LASTCOLOR
TEXTATC1:
LDA #<TEXTATBMC1
STA MATHPTR5
LDA #>TEXTATBMC1
STA MATHPTR5+1
JMP TEXTATBMCNOPEN
TEXTATSC2:
LDA _PEN
STA $2C5
INC LASTCOLOR
TEXTATC2:
LDA #<TEXTATBMC2
STA MATHPTR5
LDA #>TEXTATBMC2
STA MATHPTR5+1
JMP TEXTATBMCNOPEN
TEXTATSC3:
LDA _PEN
STA $2C6
LDA #1
STA LASTCOLOR
TEXTATC3:
LDA #<TEXTATBMC3
STA MATHPTR5
LDA #>TEXTATBMC3
STA MATHPTR5+1
JMP TEXTATBMCNOPEN
TEXTATBMCNOPEN:
LDX TEXTSIZE
LDY #$0
TEXTATBMLOOP2:
LDA TABSTODRAW
BEQ TEXTATBMNSKIPTAB
JMP TEXTATBMSKIPTAB
TEXTATBMNSKIPTAB:
LDA (TEXTPTR),Y
STA SCREENCODE
CMP #$7f
BEQ TEXTATBMTAB
CMP #10
BCS TEXTATBMXCC
JMP TEXTATBMCC
TEXTATBMXCC:
JSR TEXTATDECODE
JMP TEXTATBMSP0
TEXTATBMTAB:
LDA XCURSYS
TEXTATBMTAB2:
CMP TABCOUNT
BCC TEXTATBMTAB3
SEC
SBC TABCOUNT
JMP TEXTATBMTAB2
TEXTATBMTAB3:
STA TMPPTR
LDA TABCOUNT
SEC
SBC TMPPTR
STA TABSTODRAW
JMP TEXTATBMNEXT
TEXTATBMCC:
CMP #13
BEQ TEXTATBMLF
CMP #10
BEQ TEXTATBMLF
CMP #09
BEQ TEXTATBMTAB
CMP #01
BEQ TEXTATBMPEN
CMP #02
BEQ TEXTATBMPAPER
CMP #03
BEQ TEXTATBMCMOVEPREPARE
CMP #04
BEQ TEXTATBMXAT
CMP #05
BEQ TEXTATBMCLS
JMP TEXTATBMNEXT
TEXTATBMCLS:
TYA
PHA
TXA
PHA
JSR CLS
PLA
TAX
PLA
TAY
JMP TEXTATBMNEXT
TEXTATBMXAT:
JMP TEXTATBMAT
TEXTATBMLF:
INC TEXTPTR
DEX
LDA #0
STA XCURSYS
INC YCURSYS
JSR CALCPOSG
JMP TEXTATBMNEXT2
TEXTATBMPEN:
INC TEXTPTR
DEX
LDA TEXTWW
AND #$2
BEQ TEXTATBMPENDISABLED
LDA (TEXTPTR), Y
ASL A
ASL A
ASL A
ASL A
STA _PEN
TEXTATBMPENDISABLED:
INC TEXTPTR
DEY
JMP TEXTATBMNEXT
TEXTATBMPAPER:
INC TEXTPTR
DEX
LDA TEXTWW
AND #$1
BEQ TEXTATBMPAPERDISABLED
LDA (TEXTPTR), Y
STA _PAPER
TEXTATBMPAPERDISABLED:
INC TEXTPTR
DEY
JMP TEXTATBMNEXT
TEXTATBMCMOVEPREPARE:
INC TEXTPTR
DEX
LDA (TEXTPTR), Y
STA CLINEX
INC TEXTPTR
DEX
LDA (TEXTPTR), Y
STA CLINEY
TEXTATBMCMOVE:
CLC
LDA CLINEX
ADC XCURSYS
STA XCURSYS
LDA CLINEY
ADC YCURSYS
STA YCURSYS
JMP TEXTATBMNEXT
TEXTATBMAT:
INC TEXTPTR
DEX
LDA (TEXTPTR), Y
SEC
SBC XCURSYS
STA CLINEX
INC TEXTPTR
DEX
LDA (TEXTPTR), Y
SEC
SBC YCURSYS
STA CLINEY
JMP TEXTATBMCMOVE
TEXTATBMSP0:
TXA
PHA
TYA
PHA
LDY #0
LDA SCREENCODE
STA TMPPTR
LDA #0
STA TMPPTR+1
CLC
ASL TMPPTR
ROL TMPPTR+1
CLC
ASL TMPPTR
ROL TMPPTR+1
CLC
ASL TMPPTR
ROL TMPPTR+1
CLC
LDA #$0
ADC TMPPTR
STA TMPPTR
LDA #$E0
ADC TMPPTR+1
STA TMPPTR+1
LDA PLOTDEST
STA TMPPTR2
LDA PLOTDEST+1
STA TMPPTR2+1
TEXTATBMSP0L1:
LDA CURRENTMODE
CMP #10
BEQ TEXTATBMSP0L1M
CMP #11
BEQ TEXTATBMSP0L1M
CMP #13
BEQ TEXTATBMSP0L1M
LDA (TMPPTR),Y
STA (TMPPTR2),Y
JMP TEXTATBMSP0L1M2
TEXTATBMSP0L1M:
TXA
PHA
TYA
PHA
LDA (TMPPTR),Y
AND #$F0
LSR A
LSR A
LSR A
LSR A
TAY
LDA (MATHPTR5), Y
TAX
PLA
TAY
TXA
STA (TMPPTR2),Y
PLA
TAX
CLC
LDA TMPPTR2
ADC #1
STA TMPPTR2
LDA TMPPTR2+1
ADC #0
STA TMPPTR2+1
TXA
PHA
TYA
PHA
LDA (TMPPTR),Y
AND #$0F
TAY
LDA (MATHPTR5), Y
TAX
PLA
TAY
TXA
STA (TMPPTR2),Y
PLA
TAX
JMP TEXTATBMSP0L1M2
TEXTATBMSP0L1M2:
CLC
LDA TMPPTR2
ADC CURRENTSL
STA TMPPTR2
LDA TMPPTR2+1
ADC #0
STA TMPPTR2+1
SEC
LDA TMPPTR2
SBC PATTERN
STA TMPPTR2
LDA TMPPTR2+1
SBC #0
STA TMPPTR2+1
INY
CPY #8
BEQ TEXTATBMSP0L1X
JMP TEXTATBMSP0L1
TEXTATBMSP0L1X:
CLC
LDA PLOTDEST
ADC PATTERN
STA PLOTDEST
LDA PLOTDEST+1
ADC #0
STA PLOTDEST+1
PLA
TAY
PLA
TAX
JMP TEXTATBMINCX
TEXTATBMSKIPTAB:
DEC TABSTODRAW
JMP TEXTATBMINCX
TEXTATBMINCX:
INC XCURSYS
LDA XCURSYS
CMP CURRENTWIDTH
BEQ TEXTATBMNEXT2
JMP TEXTATBMNEXT
TEXTATBMNEXT2:
LDA #0
STA XCURSYS
INC YCURSYS
LDA YCURSYS
CMP #23
BEQ TEXTATBMNEXT3
JMP TEXTATBMNEXT
TEXTATBMNEXT3:
; scrolling ?
TEXTATBMNEXT:
LDA TABSTODRAW
BEQ TEXTATBMXLOOP2
JMP TEXTATBMLOOP2
TEXTATBMXLOOP2:
INY
DEX
BEQ TEXTATBMEND
JMP TEXTATBMLOOP2
TEXTATBMEND:
RTS
TEXTATBMC1:
.BYTE %00000000
.BYTE %00000001
.BYTE %00000100
.BYTE %00000101
.BYTE %00010000
.BYTE %00010001
.BYTE %00010100
.BYTE %00010101
.BYTE %01000000
.BYTE %01000001
.BYTE %01000100
.BYTE %01000101
.BYTE %01010000
.BYTE %01010001
.BYTE %01010100
.BYTE %01010101
TEXTATBMC2:
.BYTE %00000000
.BYTE %00000010
.BYTE %00001000
.BYTE %00001010
.BYTE %00100000
.BYTE %00100010
.BYTE %00101000
.BYTE %00101010
.BYTE %10000000
.BYTE %10000010
.BYTE %10001000
.BYTE %10001010
.BYTE %10100000
.BYTE %10100010
.BYTE %10101000
.BYTE %10101010
TEXTATBMC3:
.BYTE %00000000
.BYTE %00000011
.BYTE %00001100
.BYTE %00001111
.BYTE %00110000
.BYTE %00110011
.BYTE %00111100
.BYTE %00111111
.BYTE %11000000
.BYTE %11000011
.BYTE %11001100
.BYTE %11001111
.BYTE %11110000
.BYTE %11110011
.BYTE %11111100
.BYTE %11111111
|
src/c64/init.asm | puzzud/retroleague | 4 | 165566 | .import _Init
.import _LoadFile
.import _CHARSET
.import _UpdateInput
.import _InitializeVideo
.import _ProcessMusic
.importzp _MusicStatus
.autoimport on
.importzp sp, sreg, regsave, regbank
.importzp tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
.macpack longbranch
.importzp sp
.import __BSS_START__, __BSS_SIZE__
.export Reset
.exportzp _InitScreen
.exportzp _CurrentScreenInit
.exportzp _CurrentScreenUpdate
.include "c64.asm"
.segment "ZEROPAGE"
_InitScreen:
.res 1
_CurrentScreenInit:
.res 2
_CurrentScreenUpdate:
.res 2
.segment "BSS"
.segment "CODE"
Reset:
sei
lda #%01111111
sta CIA1_ICR
sta CIA2_ICR
lda CIA1_ICR
lda CIA2_ICR
lda VIC_IMR
ora #%00000001
sta VIC_IMR
lda #248
sta VIC_HLINE
lda VIC_CTRL1
and #%01111111
sta VIC_CTRL1
; Set up interrupt routine.
lda #<DefaultInterrupt
sta $fffa
sta $fffc
sta $fffe
lda #>DefaultInterrupt
sta $fffb
sta $fffd
sta $ffff
; Set parameter stack pointer.
lda #<(__BSS_START__+__BSS_SIZE__)
sta sp
lda #>(__BSS_START__+__BSS_SIZE__)
sta sp+1
lda #%00110101
sta LORAM
jsr _InitializeVideo
jsr _InitializeAudio
cli
jsr _Init
@mainLoop:
jsr _UpdateInput
lda _InitScreen
beq @endInit
lda #>(@postInit-1)
pha
lda #<(@postInit-1)
pha
jmp (_CurrentScreenInit)
@postInit:
lda #0
sta _InitScreen
@endInit:
lda #>(@endUpdate-1)
pha
lda #<(@endUpdate-1)
pha
jmp (_CurrentScreenUpdate)
@endUpdate:
; Wait for the raster to reach line $f8 (248)
; This loop is keeping timing stable.
; Is the raster line $f8?
; If so, wait for the next full screen,
; preventing mistimings if called too fast.
@waitFrame:
lda VIC_HLINE
cmp #248
beq @waitFrame
; Wait for the raster to reach line $f8
; (should be closer to the start of this line this way).
@waitStep2:
lda VIC_HLINE
cmp #248
bne @waitStep2
jmp @mainLoop
;==================================================================
;------------------------------------------------------------------
DefaultInterrupt:
pha
txa
pha
tya
pha
lda _MusicStatus
beq @endProcessMusic
jsr _ProcessMusic
@endProcessMusic:
lda #$ff
sta VIC_IRR
pla
tay
pla
tax
pla
EmptyInterrupt:
rti
|
src/main/antlr4/com/github/haixing_hu/criteria/parser/sql/Criterion.g4 | Haixing-Hu/criteria | 2 | 6407 | /******************************************************************************
*
* Copyright (c) 2014 <NAME>
*
* 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.
*
******************************************************************************/
grammar Criterion;
/**
* If your top-level rule does not end with an explicit EOF, then ANTLR is not
* required to parse to the end of the input sequence. Rather than throw an
* exception, it simply parsed the valid portion of the sequence you gave it.
*/
line: criterion EOF;
criterion:
unaryCriterion
| binaryCriterion
| valueCriterion
| collectionCriterion
| likeCriterion
| combinedCriterion
;
unaryCriterion:
property operator=(IS_NULL | IS_NOT_NULL)
;
binaryCriterion:
property operator=(EQUAL | NOT_EQUAL | GREATER | GREATER_EQUAL | LESS | LESS_EQUAL) property
;
valueCriterion:
property operator=(EQUAL | NOT_EQUAL | GREATER | GREATER_EQUAL | LESS | LESS_EQUAL) value
;
collectionCriterion:
property operator=(IN | NOT_IN) '(' value (',' value)* ')'
;
likeCriterion:
property LIKE pattern
;
combinedCriterion :
'(' criterion ')' operator=AND '(' criterion ')' (AND '(' criterion ')')*
| '(' criterion ')' operator=OR '(' criterion ')' (OR '(' criterion ')')*
;
property:
ID
;
value:
type=(INTEGER_NUMBER
| HEX_NUMBER
| REAL_NUMBER
| BOOLEAN
| CHARACTER
| STRING
| PLACEHOLDER)
;
pattern:
STRING
;
fragment A:('a'|'A');
fragment B:('b'|'B');
fragment C:('c'|'C');
fragment D:('d'|'D');
fragment E:('e'|'E');
fragment F:('f'|'F');
fragment G:('g'|'G');
fragment H:('h'|'H');
fragment I:('i'|'I');
fragment J:('j'|'J');
fragment K:('k'|'K');
fragment L:('l'|'L');
fragment M:('m'|'M');
fragment N:('n'|'N');
fragment O:('o'|'O');
fragment P:('p'|'P');
fragment Q:('q'|'Q');
fragment R:('r'|'R');
fragment S:('s'|'S');
fragment T:('t'|'T');
fragment U:('u'|'U');
fragment V:('v'|'V');
fragment W:('w'|'W');
fragment X:('x'|'X');
fragment Y:('y'|'Y');
fragment Z:('z'|'Z');
IS: I S;
NOT: N O T;
NULL: N U L L;
IS_NULL: IS (SPACE)+ NULL;
IS_NOT_NULL: IS (SPACE)+ NOT (SPACE)+ NULL;
EQUAL: '=';
NOT_EQUAL: '!=';
GREATER: '>';
GREATER_EQUAL: '>=';
LESS: '<';
LESS_EQUAL: '<=';
IN: I N;
NOT_IN: NOT (SPACE)+ IN;
AND: A N D;
OR: O R;
LIKE: L I K E;
fragment DOUBLE_QUOTE_ESCAPE: '\\\\' | '\\"';
fragment NON_LINE_BREAK: ~('\n' | '\r');
STRING:
'"' ( DOUBLE_QUOTE_ESCAPE | NON_LINE_BREAK )*? '"';
fragment SINGLE_QUOTE_ESCAPE: '\\\'';
fragment NON_SINGLE_QUOTE: ~('\'');
CHARACTER:
'\'' (SINGLE_QUOTE_ESCAPE | NON_SINGLE_QUOTE ) '\'';
BOOLEAN:
T R U E
| F A L S E
;
PLACEHOLDER:
'?'
;
fragment LETTER: [a-zA-Z_];
fragment DIGIT: [0-9];
ID: LETTER (LETTER | DIGIT)*;
fragment SIGN: ('+' | '-');
INTEGER_NUMBER:
SIGN? DIGIT+
;
fragment HEX_LETTER: [a-fA-F];
HEX_NUMBER:
'0x' (HEX_LETTER | DIGIT)+
;
fragment EXP: ('E'|'e');
REAL_NUMBER:
SIGN? DIGIT+ '.' DIGIT* (EXP SIGN? DIGIT+)?
| SIGN? '.' DIGIT+ (EXP SIGN? DIGIT+)?
| SIGN? DIGIT+ EXP SIGN? DIGIT+
;
SPACE: [ \t] -> skip;
WHITE_SPACE:
[ \r\t\n]+ -> skip
;
|
oeis/129/A129090.asm | neoneye/loda-programs | 11 | 11656 | <filename>oeis/129/A129090.asm
; A129090: a(1)=1; a(n) = gcd(a(n-1), n) + lcm(a(n-1), n).
; Submitted by <NAME>
; 1,3,6,14,71,427,434,1738,15643,156431,156442,938654,12202503,170835043,2562525646,20500205170,348503487891,2091020927349,39729397619632,198646988098164,1390528916687151,30591636167117323,703607631843698430
add $0,1
mov $1,1
lpb $0
mov $3,$2
add $2,1
lpb $3
mov $4,$1
gcd $4,$2
div $1,$4
mov $3,$5
lpe
sub $0,1
mul $1,$2
add $1,$4
lpe
mov $0,$1
|
src/Web/Semantic/Everything.agda | agda/agda-web-semantic | 9 | 13483 | <gh_stars>1-10
-- A module which imports every Web.Semantic module.
module Web.Semantic.Everything where
import Web.Semantic.DL.ABox
import Web.Semantic.DL.ABox.Interp
import Web.Semantic.DL.ABox.Interp.Meet
import Web.Semantic.DL.ABox.Interp.Morphism
import Web.Semantic.DL.ABox.Model
import Web.Semantic.DL.ABox.Skolemization
import Web.Semantic.DL.Category
import Web.Semantic.DL.Category.Composition
import Web.Semantic.DL.Category.Morphism
import Web.Semantic.DL.Category.Object
import Web.Semantic.DL.Category.Properties
import Web.Semantic.DL.Category.Properties.Composition
import Web.Semantic.DL.Category.Properties.Composition.Assoc
import Web.Semantic.DL.Category.Properties.Composition.LeftUnit
import Web.Semantic.DL.Category.Properties.Composition.Lemmas
import Web.Semantic.DL.Category.Properties.Composition.RespectsEquiv
import Web.Semantic.DL.Category.Properties.Composition.RespectsWiring
import Web.Semantic.DL.Category.Properties.Composition.RightUnit
import Web.Semantic.DL.Category.Properties.Equivalence
import Web.Semantic.DL.Category.Properties.Tensor
import Web.Semantic.DL.Category.Properties.Tensor.AssocNatural
import Web.Semantic.DL.Category.Properties.Tensor.Coherence
import Web.Semantic.DL.Category.Properties.Tensor.Functor
import Web.Semantic.DL.Category.Properties.Tensor.Isomorphisms
import Web.Semantic.DL.Category.Properties.Tensor.Lemmas
import Web.Semantic.DL.Category.Properties.Tensor.RespectsEquiv
import Web.Semantic.DL.Category.Properties.Tensor.RespectsWiring
import Web.Semantic.DL.Category.Properties.Tensor.SymmNatural
import Web.Semantic.DL.Category.Properties.Tensor.UnitNatural
import Web.Semantic.DL.Category.Tensor
import Web.Semantic.DL.Category.Unit
import Web.Semantic.DL.Category.Wiring
import Web.Semantic.DL.Concept
import Web.Semantic.DL.Concept.Model
import Web.Semantic.DL.Concept.Skolemization
import Web.Semantic.DL.FOL
import Web.Semantic.DL.FOL.Model
import Web.Semantic.DL.Integrity
import Web.Semantic.DL.Integrity.Closed
import Web.Semantic.DL.Integrity.Closed.Alternate
import Web.Semantic.DL.Integrity.Closed.Properties
import Web.Semantic.DL.KB
import Web.Semantic.DL.KB.Model
import Web.Semantic.DL.KB.Skolemization
import Web.Semantic.DL.Role
import Web.Semantic.DL.Role.Model
import Web.Semantic.DL.Role.Skolemization
import Web.Semantic.DL.Sequent
import Web.Semantic.DL.Sequent.Model
import Web.Semantic.DL.Signature
import Web.Semantic.DL.TBox
import Web.Semantic.DL.TBox.Interp
import Web.Semantic.DL.TBox.Interp.Morphism
import Web.Semantic.DL.TBox.Minimizable
import Web.Semantic.DL.TBox.Model
import Web.Semantic.DL.TBox.Skolemization
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_276.asm | ljhsiun2/medusa | 9 | 91917 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x1b454, %rsi
lea addresses_UC_ht+0x8454, %rdi
nop
cmp %r12, %r12
mov $72, %rcx
rep movsb
nop
sub $53960, %r9
lea addresses_UC_ht+0x171d4, %rsi
lea addresses_D_ht+0x10854, %rdi
nop
nop
cmp $14673, %rdx
mov $44, %rcx
rep movsw
nop
nop
nop
nop
inc %r12
lea addresses_WC_ht+0x1ec54, %rsi
nop
xor $32693, %r11
mov $0x6162636465666768, %r12
movq %r12, (%rsi)
sub $16731, %rcx
lea addresses_A_ht+0x7454, %r12
sub %rdx, %rdx
mov (%r12), %edi
nop
add %rcx, %rcx
lea addresses_A_ht+0x6d44, %r11
nop
nop
nop
dec %r12
movb (%r11), %dl
nop
nop
nop
nop
nop
xor $22550, %rsi
lea addresses_normal_ht+0xceb4, %rsi
lea addresses_normal_ht+0x3473, %rdi
inc %rdx
mov $71, %rcx
rep movsl
nop
nop
nop
add %rsi, %rsi
lea addresses_WC_ht+0x4574, %rsi
lea addresses_A_ht+0xf154, %rdi
nop
nop
nop
nop
dec %rdx
mov $56, %rcx
rep movsw
nop
nop
nop
nop
nop
inc %r12
lea addresses_WC_ht+0x2854, %rsi
lea addresses_D_ht+0xcb0e, %rdi
nop
nop
add $59511, %rbp
mov $90, %rcx
rep movsq
nop
xor $44283, %r12
lea addresses_normal_ht+0x3f4a, %r12
nop
nop
dec %rdi
movl $0x61626364, (%r12)
and $56868, %rdi
lea addresses_A_ht+0x162d4, %rsi
lea addresses_UC_ht+0x1c0b4, %rdi
nop
nop
nop
and $35739, %r9
mov $56, %rcx
rep movsl
dec %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdx
// Store
mov $0x3b8, %rdx
nop
nop
nop
add %rbp, %rbp
movl $0x51525354, (%rdx)
// Exception!!!
mov (0), %rbp
inc %r8
// Load
lea addresses_PSE+0x14a36, %rdx
nop
nop
sub $19278, %r12
mov (%rdx), %r8
nop
nop
xor $58585, %rbx
// Store
lea addresses_WC+0xa50, %rbp
nop
nop
nop
nop
nop
sub %rbx, %rbx
movw $0x5152, (%rbp)
nop
nop
nop
nop
nop
sub $20312, %r8
// Store
mov $0xc54, %rcx
clflush (%rcx)
nop
nop
nop
nop
xor $29915, %rbp
mov $0x5152535455565758, %rdx
movq %rdx, %xmm7
vmovups %ymm7, (%rcx)
nop
nop
sub %r8, %r8
// Store
mov $0x6d4, %r8
nop
nop
nop
nop
cmp $17979, %rdx
mov $0x5152535455565758, %r9
movq %r9, %xmm7
movups %xmm7, (%r8)
nop
nop
nop
inc %rbp
// Store
lea addresses_WC+0x8854, %rbp
nop
nop
nop
cmp %r12, %r12
movb $0x51, (%rbp)
nop
nop
nop
and %rcx, %rcx
// Store
mov $0x51f, %rbp
clflush (%rbp)
nop
nop
nop
nop
cmp %r12, %r12
movl $0x51525354, (%rbp)
nop
nop
cmp $11425, %rbx
// Faulty Load
lea addresses_normal+0x17454, %rbp
nop
nop
inc %r12
vmovups (%rbp), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %r8
lea oracles, %rbp
and $0xff, %r8
shlq $12, %r8
mov (%rbp,%r8,1), %r8
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 2, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'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/281/A281858.asm | neoneye/loda-programs | 11 | 29624 | <reponame>neoneye/loda-programs
; A281858: Curious cubic identities based on the Armstrong number 370.
; Submitted by <NAME>(s3)
; 370,336700,333667000,333366670000,333336666700000,333333666667000000,333333366666670000000,333333336666666700000000,333333333666666667000000000,333333333366666666670000000000,333333333336666666666700000000000,333333333333666666666667000000000000,333333333333366666666666670000000000000,333333333333336666666666666700000000000000,333333333333333666666666666667000000000000000,333333333333333366666666666666670000000000000000,333333333333333336666666666666666700000000000000000
add $0,1
mov $2,10
pow $2,$0
mov $0,$2
mul $0,$2
add $0,$2
add $0,1
mul $2,$0
mov $0,$2
div $0,3
|
programs/oeis/004/A004920.asm | karttu/loda | 1 | 3033 | ; A004920: Floor of n*phi^5, where phi is the golden ratio, A001622.
; 0,11,22,33,44,55,66,77,88,99,110,121,133,144,155,166,177,188,199,210,221,232,243,255,266,277,288,299,310,321,332,343,354,365,377,388,399,410,421,432,443,454,465,476,487
mov $3,$0
mul $0,7
div $0,79
add $0,6
mov $1,1
mul $1,$0
sub $1,6
mov $2,$3
mul $2,11
add $1,$2
|
alloy4fun_models/trashltl/models/12/uBMEX9FJi6StphQuz.als | Kaixi26/org.alloytools.alloy | 0 | 3076 | <filename>alloy4fun_models/trashltl/models/12/uBMEX9FJi6StphQuz.als
open main
pred iduBMEX9FJi6StphQuz_prop13 {
some f : File | f in Trash implies once f not in Trash
}
pred __repair { iduBMEX9FJi6StphQuz_prop13 }
check __repair { iduBMEX9FJi6StphQuz_prop13 <=> prop13o } |
src/sdl_display.ads | Fabien-Chouteau/ada-voxel-space | 4 | 28566 | with Interfaces; use Interfaces;
generic
Screen_Width : Natural;
Screen_Height : Natural;
package SDL_Display is
subtype SDL_Pixel is Unsigned_16;
function Rendering return Boolean;
procedure Start_Render
with Pre => not Rendering,
Post => Rendering;
procedure Draw_Vertical_Line (X, Start_Y, Stop_Y : Integer; C : SDL_Pixel)
with Pre => Rendering;
procedure Fill (C : SDL_Pixel)
with Pre => Rendering;
procedure End_Render
with Pre => Rendering,
Post => not Rendering;
function To_SDL_Color (R, G, B : Unsigned_8) return SDL_Pixel;
end SDL_Display;
|
source/slim-read_file.adb | reznikmm/slimp | 0 | 3552 | <gh_stars>0
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Streams.Stream_IO;
with Ada.Text_IO;
with Slim.Messages;
with Slim.Messages.grfe;
with Slim.Messages.grfg;
with Slim.Messages.grfs;
with Slim.Message_Decoders;
with Slim.Message_Visiters;
with League.Application;
with League.Stream_Element_Vectors;
with League.Strings;
procedure Slim.Read_File is
procedure Client_Message
(Client : access Ada.Streams.Root_Stream_Type'Class);
procedure Server_Message
(Server : access Ada.Streams.Root_Stream_Type'Class);
package Dump is
type Visiter is new Slim.Message_Visiters.Visiter with record
Count : Positive := 1;
end record;
not overriding procedure Dump_File
(Self : in out Visiter;
Tag : Slim.Messages.Message_Tag;
Data : Ada.Streams.Stream_Element_Array);
overriding procedure grfe
(Self : in out Visiter;
Message : not null access Slim.Messages.grfe.Grfe_Message);
overriding procedure grfg
(Self : in out Visiter;
Message : not null access Slim.Messages.grfg.Grfg_Message);
overriding procedure grfs
(Self : in out Visiter;
Message : not null access Slim.Messages.grfs.Grfs_Message);
end Dump;
package body Dump is
overriding procedure grfe
(Self : in out Visiter;
Message : not null access Slim.Messages.grfe.Grfe_Message) is
begin
Self.Dump_File ("grfe", Message.Data);
end grfe;
overriding procedure grfg
(Self : in out Visiter;
Message : not null access Slim.Messages.grfg.Grfg_Message) is
begin
Self.Dump_File ("grfg", Message.Data);
end grfg;
overriding procedure grfs
(Self : in out Visiter;
Message : not null access Slim.Messages.grfs.Grfs_Message) is
begin
Self.Dump_File ("grfs", Message.Data);
end grfs;
not overriding procedure Dump_File
(Self : in out Visiter;
Tag : Slim.Messages.Message_Tag;
Data : Ada.Streams.Stream_Element_Array)
is
-- convert -size 32x160 -depth 1 gray:F1.dat -flop -rotate -90 image.png
Output : Ada.Streams.Stream_IO.File_Type;
Image : String := Positive'Image (Self.Count);
begin
Image (1) := 'F';
Self.Count := Self.Count + 1;
Ada.Streams.Stream_IO.Create
(File => Output,
Name => "/tmp/" & Image & Tag & ".dat");
Ada.Streams.Stream_IO.Write (Output, Data);
Ada.Streams.Stream_IO.Close (Output);
end Dump_File;
end Dump;
Visiter : Dump.Visiter;
--------------------
-- Client_Message --
--------------------
procedure Client_Message
(Client : access Ada.Streams.Root_Stream_Type'Class)
is
use type Ada.Streams.Stream_Element_Offset;
Tag : Slim.Messages.Message_Tag;
Raw_Tag : Ada.Streams.Stream_Element_Array (1 .. 4)
with Address => Tag'Address;
Word : Ada.Streams.Stream_Element_Array (1 .. 4);
Length : Ada.Streams.Stream_Element_Offset := 0;
Last : Ada.Streams.Stream_Element_Offset;
Data : aliased League.Stream_Element_Vectors.Stream_Element_Vector;
begin
Client.Read (Raw_Tag, Last);
pragma Assert (Last = Raw_Tag'Length);
Ada.Text_IO.Put_Line (Tag);
Client.Read (Word, Last);
pragma Assert (Last = Word'Length);
for Byte of Word loop
Length := Length * 256 + Ada.Streams.Stream_Element_Offset (Byte);
end loop;
while Length > 0 loop
declare
Piece : constant Ada.Streams.Stream_Element_Offset :=
Ada.Streams.Stream_Element_Offset'Min (Length, 256);
Input : Ada.Streams.Stream_Element_Array (1 .. Piece);
begin
Client.Read (Input, Last);
pragma Assert (Last = Input'Length);
Data.Append (Input);
Length := Length - Last;
end;
end loop;
declare
Decoder : Slim.Message_Decoders.Decoder;
Message : Slim.Messages.Message_Access;
pragma Unreferenced (Message);
begin
Decoder.Decode (Tag, Data'Unchecked_Access, Message);
Data.Clear;
end;
end Client_Message;
--------------------
-- Server_Message --
--------------------
procedure Server_Message
(Server : access Ada.Streams.Root_Stream_Type'Class)
is
use type Ada.Streams.Stream_Element_Offset;
Tag : Slim.Messages.Message_Tag;
Raw_Tag : Ada.Streams.Stream_Element_Array (1 .. 4)
with Address => Tag'Address;
Word : Ada.Streams.Stream_Element_Array (1 .. 2);
Length : Ada.Streams.Stream_Element_Offset := 0;
Last : Ada.Streams.Stream_Element_Offset;
Data : aliased League.Stream_Element_Vectors.Stream_Element_Vector;
begin
Server.Read (Word, Last);
pragma Assert (Last = Word'Length);
Server.Read (Raw_Tag, Last);
pragma Assert (Last = Raw_Tag'Length);
Ada.Text_IO.Put_Line (Tag);
for Byte of Word loop
Length := Length * 256 + Ada.Streams.Stream_Element_Offset (Byte);
end loop;
Length := Length - 4;
while Length > 0 loop
declare
Piece : constant Ada.Streams.Stream_Element_Offset :=
Ada.Streams.Stream_Element_Offset'Min (Length, 256);
Input : Ada.Streams.Stream_Element_Array (1 .. Piece);
begin
Server.Read (Input, Last);
pragma Assert (Last = Input'Length);
Data.Append (Input);
Length := Length - Last;
end;
end loop;
declare
Decoder : Slim.Message_Decoders.Decoder;
Message : Slim.Messages.Message_Access;
begin
Decoder.Decode (Tag, Data'Unchecked_Access, Message);
Message.Visit (Visiter);
Data.Clear;
end;
end Server_Message;
File_Name : constant League.Strings.Universal_String :=
League.Application.Arguments.Element (1);
Is_Client : constant Boolean := File_Name.Starts_With ("cli");
Input : Ada.Streams.Stream_IO.File_Type;
Stream : Ada.Streams.Stream_IO.Stream_Access;
begin
Ada.Streams.Stream_IO.Open
(File => Input,
Mode => Ada.Streams.Stream_IO.In_File,
Name => File_Name.To_UTF_8_String);
Stream := Ada.Streams.Stream_IO.Stream (Input);
while not Ada.Streams.Stream_IO.End_Of_File (Input) loop
if Is_Client then
Client_Message (Stream);
else
Server_Message (Stream);
end if;
end loop;
end Slim.Read_File;
|
benchmark/ac/AC.agda | asr/agda-kanso | 1 | 6256 | <filename>benchmark/ac/AC.agda
{-# OPTIONS --no-termination-check #-}
module AC where
import Nat
import Bool
import List
import Fin
import Logic
import Vec
import EqProof
open Nat hiding (_<_) renaming (_==_ to _=Nat=_)
open Bool
open List hiding (module Eq)
open Fin renaming (_==_ to _=Fin=_)
open Logic
open Vec
infix 20 _○_
infix 10 _≡_
ForAll : {A : Set}(n : Nat) -> (Vec n A -> Set) -> Set
ForAll zero F = F ε
ForAll {A} (suc n) F = (x : A) -> ForAll _ \xs -> F (x ∷ xs)
apply : {n : Nat}{A : Set}(F : Vec n A -> Set) -> ForAll n F -> (xs : Vec n A) -> F xs
apply {zero} F t (vec vnil) = t
apply {suc n} F f (vec (vcons x xs)) = apply _ (f x) xs
lambda : {n : Nat}{A : Set}(F : Vec n A -> Set) -> ((xs : Vec n A) -> F xs) -> ForAll n F
lambda {zero } F f = f ε
lambda {suc n} F f = \x -> lambda _ (\xs -> f (x ∷ xs))
data Expr (n : Nat) : Set where
zro : Expr n
var : Fin n -> Expr n
_○_ : Expr n -> Expr n -> Expr n
data Theorem (n : Nat) : Set where
_≡_ : Expr n -> Expr n -> Theorem n
theorem : (n : Nat) -> ({m : Nat} -> ForAll {Expr m} n \_ -> Theorem m) -> Theorem n
theorem n thm = apply _ thm (map var (fzeroToN-1 n))
module Provable where
NF : Nat -> Set
NF n = List (Fin n)
infix 12 _⊕_
_⊕_ : {n : Nat} -> NF n -> NF n -> NF n
[] ⊕ ys = ys
x :: xs ⊕ [] = x :: xs
x :: xs ⊕ y :: ys = if x < y
then x :: (xs ⊕ y :: ys)
else y :: (x :: xs ⊕ ys)
normalise : {n : Nat} -> Expr n -> NF n
normalise zro = []
normalise (var n) = n :: []
normalise (a ○ b) = normalise a ⊕ normalise b
infix 30 _↓
_↓ : {n : Nat} -> NF n -> Expr n
(i :: is) ↓ = var i ○ is ↓
[] ↓ = zro
infix 10 _=Expr=_ _=NF=_
_=NF=_ : {n : Nat} -> NF n -> NF n -> Bool
_=NF=_ = ListEq._==_
where
module ListEq = List.Eq _=Fin=_
substNF : {n : Nat}{xs ys : NF n}(P : NF n -> Set) -> IsTrue (xs =NF= ys) -> P xs -> P ys
substNF = List.Subst.subst _=Fin=_ (subst {_})
_=Expr=_ : {n : Nat} -> Expr n -> Expr n -> Bool
a =Expr= b = normalise a =NF= normalise b
provable : {n : Nat} -> Theorem n -> Bool
provable (a ≡ b) = a =Expr= b
module Semantics
{A : Set}
(_==_ : A -> A -> Set)
(_*_ : A -> A -> A)
(one : A)
(refl : {x : A} -> x == x)
(sym : {x y : A} -> x == y -> y == x)
(trans : {x y z : A} -> x == y -> y == z -> x == z)
(idL : {x : A} -> (one * x) == x)
(idR : {x : A} -> (x * one) == x)
(comm : {x y : A} -> (x * y) == (y * x))
(assoc : {x y z : A} -> (x * (y * z)) == ((x * y) * z))
(congL : {x y z : A} -> y == z -> (x * y) == (x * z))
(congR : {x y z : A} -> x == y -> (x * z) == (y * z))
where
open Provable
module EqP = EqProof _==_ refl trans
open EqP
expr[_] : {n : Nat} -> Expr n -> Vec n A -> A
expr[ zro ] ρ = one
expr[ var i ] ρ = ρ ! i
expr[ a ○ b ] ρ = expr[ a ] ρ * expr[ b ] ρ
eq[_] : {n : Nat} -> Theorem n -> Vec n A -> Set
eq[ a ≡ b ] ρ = expr[ a ] ρ == expr[ b ] ρ
data CantProve (A : Set) : Set where
no-proof : CantProve A
Prf : {n : Nat} -> Theorem n -> Bool -> Set
Prf thm true = ForAll _ \ρ -> eq[ thm ] ρ
Prf thm false = CantProve (Prf thm true)
Proof : {n : Nat} -> Theorem n -> Set
Proof thm = Prf thm (provable thm)
lem0 : {n : Nat} -> (xs ys : NF n) -> (ρ : Vec n A) ->
eq[ xs ↓ ○ ys ↓ ≡ (xs ⊕ ys) ↓ ] ρ
lem0 [] ys ρ = idL
lem0 (x :: xs) [] ρ = idR
lem0 (x :: xs) (y :: ys) ρ = if' x < y then less else more
where
lhs = (var x ○ xs ↓) ○ (var y ○ ys ↓)
lbranch = x :: (xs ⊕ y :: ys)
rbranch = y :: (x :: xs ⊕ ys)
P = \z -> eq[ lhs ≡ (if z then lbranch else rbranch) ↓ ] ρ
less : IsTrue (x < y) -> _
less x<y = BoolEq.subst {true}{x < y} P x<y
(spine (lem0 xs (y :: ys) ρ))
where
spine : forall {x' xs' y' ys' zs} h -> _
spine {x'}{xs'}{y'}{ys'}{zs} h =
eqProof> (x' * xs') * (y' * ys')
=== x' * (xs' * (y' * ys')) by sym assoc
=== x' * zs by congL h
more : IsFalse (x < y) -> _
more x>=y = BoolEq.subst {false}{x < y} P x>=y
(spine (lem0 (x :: xs) ys ρ))
where
spine : forall {x' xs' y' ys' zs} h -> _
spine {x'}{xs'}{y'}{ys'}{zs} h =
eqProof> (x' * xs') * (y' * ys')
=== (y' * ys') * (x' * xs') by comm
=== y' * (ys' * (x' * xs')) by sym assoc
=== y' * ((x' * xs') * ys') by congL comm
=== y' * zs by congL h
lem1 : {n : Nat} -> (e : Expr n) -> (ρ : Vec n A) -> eq[ e ≡ normalise e ↓ ] ρ
lem1 zro ρ = refl
lem1 (var i) ρ = sym idR
lem1 (a ○ b) ρ = trans step1 (trans step2 step3)
where
step1 : eq[ a ○ b ≡ normalise a ↓ ○ b ] ρ
step1 = congR (lem1 a ρ)
step2 : eq[ normalise a ↓ ○ b ≡ normalise a ↓ ○ normalise b ↓ ] ρ
step2 = congL (lem1 b ρ)
step3 : eq[ normalise a ↓ ○ normalise b ↓ ≡ (normalise a ⊕ normalise b) ↓ ] ρ
step3 = lem0 (normalise a) (normalise b) ρ
lem2 : {n : Nat} -> (xs ys : NF n) -> (ρ : Vec n A) -> IsTrue (xs =NF= ys) -> eq[ xs ↓ ≡ ys ↓ ] ρ
lem2 xs ys ρ eq = substNF {_}{xs}{ys} (\z -> eq[ xs ↓ ≡ z ↓ ] ρ) eq refl
prove : {n : Nat} -> (thm : Theorem n) -> Proof thm
prove thm = proof (provable thm) thm (\h -> h)
where
proof : {n : Nat}(valid : Bool)(thm : Theorem n) -> (IsTrue valid -> IsTrue (provable thm)) -> Prf thm valid
proof false _ _ = no-proof
proof true (a ≡ b) isValid = lambda eq[ a ≡ b ] \ρ ->
trans (step-a ρ) (trans (step-ab ρ) (step-b ρ))
where
step-a : forall ρ -> eq[ a ≡ normalise a ↓ ] ρ
step-a ρ = lem1 a ρ
step-b : forall ρ -> eq[ normalise b ↓ ≡ b ] ρ
step-b ρ = sym (lem1 b ρ)
step-ab : forall ρ -> eq[ normalise a ↓ ≡ normalise b ↓ ] ρ
step-ab ρ = lem2 (normalise a) (normalise b) ρ (isValid tt)
|
tests/bfp-006-cvttofix.asm | mtalexander/hyperion | 187 | 83926 | <reponame>mtalexander/hyperion<filename>tests/bfp-006-cvttofix.asm
TITLE 'bfp-006-cvttofix.asm: Test IEEE Convert To Fixed (int-32)'
***********************************************************************
*
*Testcase IEEE CONVERT TO FIXED 32
* Test case capability includes ieee exceptions trappable and
* otherwise. Test result, FPC flags, DXC, and condition code are
* saved for all tests.
*
***********************************************************************
SPACE 2
***********************************************************************
*
* bfp-006-cvttofix.asm
*
* This assembly-language source file is part of the
* Hercules Binary Floating Point Validation Package
* by <NAME>
*
* Copyright 2016 by <NAME>.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* DISCLAMER: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "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 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.
*
***********************************************************************
SPACE 2
***********************************************************************
*
* Tests the following three conversion instructions
* CONVERT TO FIXED (short BFP to int-32, RRE)
* CONVERT TO FIXED (long BFP to int-32, RRE)
* CONVERT TO FIXED (extended BFP to int-32, RRE)
* CONVERT TO FIXED (short BFP to int-32, RRF-e)
* CONVERT TO FIXED (long BFP to int-32, RRF-e)
* CONVERT TO FIXED (extended BFP to int-32, RRF-e)
*
* Test data is compiled into this program. The test script that runs
* this program can provide alternative test data through Hercules R
* commands.
*
* Test Case Order
* 1) Short BFP to Int-32
* 2) Short BFP to Int-32 with all rounding modes
* 3) Long BFP Int-32
* 3) Long BFP Int-32 with all rounding modes
* 4) Extended BFP to Int-32
* 4) Extended BFP to Int-32 with all rounding modes
*
* Provided test data is:
* 1, 2, 4, -2, QNaN, SNaN, 2 147 483 648, -2 147 483 648.
* The last two values will trigger inexact exceptions when converted
* To int-32. Underflow does not get raised during Convert to Fixed.
* Provided test data for rounding tests:
* -9.5, -5.5, -2.5, -1.5, -0.5, +0.5, +1.5, +2.5, +5.5, +9.5
* This data is taken from Table 9-11 on page 9-16 of SA22-7832-10.
* While the table illustrates LOAD FP INTEGER, the same results
* should be generated when creating an int-32 or int-64 integer.
*
* Note that three input test data sets are provided, one each for
* short, long, and extended precision BFP. All are converted to
* int-32.
*
* Also tests the following floating point support instructions
* LOAD (Short)
* LOAD (Long)
* LOAD FPC
* SET BFP ROUNDING MODE 2-BIT
* SET BFP ROUNDING MODE 3-BIT
* STORE (Short)
* STORE (Long)
* STORE FPC
*
***********************************************************************
SPACE 3
MACRO
PADCSECT &ENDLABL
.*
.* Macro to pad the CSECT to include result data areas if this test
.* program is not being assembled using asma. asma generates a core
.* image that is loaded by the loadcore command, and because the
.* core image is a binary stored in Github, it makes sense to make
.* this small effort to keep the core image small.
.*
AIF (D'&ENDLABL).GOODPAD
MNOTE 4,'Missing or invalid CSECT padding label ''&ENDLABL'''
MNOTE *,'No CSECT padding performed'
MEXIT
.*
.GOODPAD ANOP Label valid. See if we're on asma
AIF ('&SYSASM' EQ 'A SMALL MAINFRAME ASSEMBLER').NOPAD
ORG &ENDLABL-1 Not ASMA. Pad CSECT
MEXIT
.*
.NOPAD ANOP
MNOTE *,'asma detected; no CSECT padding performed'
MEND
*
* Note: for compatibility with the z/CMS test rig, do not change
* or use R11, R14, or R15. Everything else is fair game.
*
BFPCVTTF START 0
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
R9 EQU 9
R10 EQU 10
R11 EQU 11
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
*
* Floating Point Register equates to keep the cross reference clean
*
FPR0 EQU 0
FPR1 EQU 1
FPR2 EQU 2
FPR3 EQU 3
FPR4 EQU 4
FPR5 EQU 5
FPR6 EQU 6
FPR7 EQU 7
FPR8 EQU 8
FPR9 EQU 9
FPR10 EQU 10
FPR11 EQU 11
FPR12 EQU 12
FPR13 EQU 13
FPR14 EQU 14
FPR15 EQU 15
*
USING *,R15
*
* Above works on real iron (R15=0 after sysclear)
* and in z/CMS (R15 points to start of load module)
*
SPACE 2
***********************************************************************
*
* Low core definitions, Restart PSW, and Program Check Routine.
*
***********************************************************************
SPACE 2
ORG BFPCVTTF+X'8E' Program check interrution code
PCINTCD DS H
*
PCOLDPSW EQU BFPCVTTF+X'150' z/Arch Program check old PSW
*
ORG BFPCVTTF+X'1A0' z/Arch Restart PSW
DC X'0000000180000000',AD(START)
*
ORG BFPCVTTF+X'1D0' z/Arch Program check old PSW
DC X'0000000000000000',AD(PROGCHK)
*
* Program check routine. If Data Exception, continue execution at
* the instruction following the program check. Otherwise, hard wait.
* No need to collect data. All interesting DXC stuff is captured
* in the FPCR.
*
ORG BFPCVTTF+X'200'
PROGCHK DS 0H Program check occured...
CLI PCINTCD+1,X'07' Data Exception?
JNE PCNOTDTA ..no, hardwait (not sure if R15 is ok)
LPSWE PCOLDPSW ..yes, resume program execution
PCNOTDTA DS 0H
LTR R14,R14 Return address provided?
BNZR R14 Yes, return to z/CMS test rig.
LPSWE HARDWAIT Not data exception, enter disabled wait
EJECT
***********************************************************************
*
* Main program. Enable Advanced Floating Point, process test cases.
*
***********************************************************************
SPACE 2
START STCTL R0,R0,CTLR0 Store CR0 to enable AFP
OI CTLR0+1,X'04' Turn on AFP bit
LCTL R0,R0,CTLR0 Reload updated CR0
*
* Short BFP Input testing
*
LA R10,SHORTS Point to short BFP test inputs
BAS R13,CFEBR Convert values to fixed from short BFP
LA R10,RMSHORTS Point to inputs for rounding mode tests
BAS R13,CFEBRA Convert using all rounding mode options
*
* Short BFP Input testing
*
LA R10,LONGS Point to long BFP test inputs
BAS R13,CFDBR Convert values to fixed from long BFP
LA R10,RMLONGS Point to inputs for rounding mode tests
BAS R13,CFDBRA Convert using all rounding mode options
*
* Short BFP Input testing
*
LA R10,EXTDS Point to extended BFP test inputs
BAS R13,CFXBR Convert values to fixed from extended
LA R10,RMEXTDS Point to inputs for rounding mode tests
BAS R13,CFXBRA Convert using all rounding mode options
*
LTR R14,R14 Return address provided?
BNZR R14 ..Yes, return to z/CMS test rig.
LPSWE WAITPSW All done
*
DS 0D Ensure correct alignment for psw
WAITPSW DC X'0002000000000000',AD(0) Normal end - disabled wait
HARDWAIT DC X'0002000000000000',XL6'00',X'DEAD' Abnormal end
*
CTLR0 DS F
FPCREGNT DC X'00000000' FPCR, trap all IEEE exceptions, zero flags
FPCREGTR DC X'F8000000' FPCR, trap no IEEE exceptions, zero flags
*
* Input values parameter list, four fullwords:
* 1) Count,
* 2) Address of inputs,
* 3) Address to place results, and
* 4) Address to place DXC/Flags/cc values.
*
ORG BFPCVTTF+X'300'
SHORTS DS 0F Inputs for short BFP testing
DC A(SBFPCT/4)
DC A(SBFPIN)
DC A(SINTOUT)
DC A(SINTFLGS)
*
LONGS DS 0F Inputs for long BFP testing
DC A(LBFPCT/8)
DC A(LBFPIN)
DC A(LINTOUT)
DC A(LINTFLGS)
*
EXTDS DS 0F Inputs for Extended BFP testing
DC A(XBFPCT/16)
DC A(XBFPIN)
DC A(XINTOUT)
DC A(XINTFLGS)
*
RMSHORTS DS 0F Inputs for long BFP rounding mode tests
DC A(SBFPRMCT/4)
DC A(SBFPINRM) Short BFP rounding mode test inputs
DC A(SINTRMO) Space for rounding mode test results
DC A(SINTRMOF) Space for rounding mode test flags
*
RMLONGS DS 0F Inputs for long BFP rounding mode tests
DC A(LBFPRMCT/8)
DC A(LBFPINRM) Long BFP rounding mode test inputs
DC A(LINTRMO) Space for rounding mode tests results
DC A(LINTRMOF) Space for rounding mode test flags
*
RMEXTDS DS 0F Inputs for ext'd BFP rounding mode tests
DC A(XBFPRMCT/16)
DC A(XBFPINRM) Extended BFP rounding mode test inputs
DC A(XINTRMO) Space for rounding mode results
DC A(XINTRMOF) Space for rounding mode test flags
EJECT
***********************************************************************
*
* Convert short BFP to integer-32 format. A pair of results is
* generated for each input: one with all exceptions non-trappable, and
* the second with all exceptions trappable. The FPCR and condition
* code is stored for each result.
*
***********************************************************************
SPACE 3
CFEBR LM R2,R3,0(R10) Get count and address of test input values
LM R7,R8,8(R10) Get address of result area and flag area.
LTR R2,R2 Any test cases?
BZR R13 ..No, return to caller
BASR R12,0 Set top of loop
*
LE FPR8,0(,R3) Get short BFP test value
LFPC FPCREGNT Set exceptions non-trappable
CFEBR R1,0,FPR8 Cvt float in FPR8 to Int in GPR1
ST R1,0(,R7) Store int-32 result
STFPC 0(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGTR Set exceptions trappable
XR R1,R1 Clear any residual result in R1
SPM R1 Clear out any residual nz condition code
CFEBR R1,0,FPR8 Cvt float in FPR8 to Int in GPR1
ST R1,4(,R7) Store short BFP result
STFPC 4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,7(,R8) Save CC as low byte of FPCR
*
LA R3,4(,R3) Point to next input value
LA R7,8(,R7) Point to next int-32 converted value pair
LA R8,8(,R8) Point to next FPCR/CC result area
BCTR R2,R12 Convert next input value.
BR R13 All converted; return.
EJECT
***********************************************************************
*
* Convert short BFP to int-32 using each possible rounding mode.
* Ten test results are generated for each input. A 48-byte test
* result section is used to keep results sets aligned on a quad-double
* word.
*
* The first four tests use rounding modes specified in the FPC with
* the IEEE Inexact exception supressed. SRNM (2-bit) is used for the
* first two FPCR-controlled tests and SRNMB (3-bit) is used for the
* last two to get full coverage of that instruction pair.
*
* The next six results use instruction-specified rounding modes.
*
* The default rounding mode (0 for RNTE) is not tested in this section;
* prior tests used the default rounding mode. RNTE is tested
* explicitly as a rounding mode in this section.
*
***********************************************************************
SPACE 2
CFEBRA LM R2,R3,0(R10) Get count and address of test input values
LM R7,R8,8(R10) Get address of result area and flag area.
LTR R2,R2 Any test cases?
BZR R13 ..No, return to caller
BASR R12,0 Set top of loop
*
LE FPR8,0(,R3) Get short BFP test value
*
* Test cases using rounding mode specified in the FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNM 1 SET FPC to RZ, towards zero.
CFEBRA R1,0,FPR8,B'0100' FPC ctl'd rounding, inexact masked
ST R1,0*4(,R7) Store integer-32 result
STFPC 0(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNM 2 SET FPC to RP, to +infinity
CFEBRA R1,0,FPR8,B'0100' FPC ctl'd rounding inexact masked
ST R1,1*4(,R7) Store integer-32 result
STFPC 1*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(1*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNMB 3 SET FPC to RM, to -infinity
CFEBRA R1,0,FPR8,B'0100' FPC ctl'd rounding inexact masked
ST R1,2*4(,R7) Store integer-32 result
STFPC 2*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(2*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNMB 7 RFS, Prepare for Shorter Precision
CFEBRA R1,0,FPR8,B'0100' FPC ctl'd rounding inexact masked
ST R1,3*4(,R7) Store integer-32 result
STFPC 3*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(3*4)+3(,R8) Save CC as low byte of FPCR
*
* Test cases using rounding mode specified in the instruction M3 field
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFEBRA R1,1,FPR8,B'0000' RNTA, to nearest, ties away
ST R1,4*4(,R7) Store integer-32 result
STFPC 4*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(4*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFEBRA R1,3,FPR8,B'0000' RFS, prepare for shorter precision
ST R1,5*4(,R7) Store integer-32 result
STFPC 5*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(5*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFEBRA R1,4,FPR8,B'0000' RNTE, to nearest, ties to even
ST R1,6*4(,R7) Store integer-32 result
STFPC 6*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(6*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFEBRA R1,5,FPR8,B'0000' RZ, toward zero
ST R1,7*4(,R7) Store integer-32 result
STFPC 7*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(7*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFEBRA R1,6,FPR8,B'0000' RP, to +inf
ST R1,8*4(,R7) Store integer-32 result
STFPC 8*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(8*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFEBRA R1,7,FPR8,B'0000' RM, to -inf
ST R1,9*4(,R7) Store integer-32 result
STFPC 9*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(9*4)+3(,R8) Save CC as low byte of FPCR
*
LA R3,4(,R3) Point to next input value
LA R7,12*4(,R7) Point to next int-32 converted value set
LA R8,12*4(,R8) Point to next FPCR/CC result area
BCTR R2,R12 Convert next input value.
BR R13 All converted; return.
EJECT
***********************************************************************
*
* Convert long BFP inputs to integer-32. A pair of results is
* generated for each input: one with all exceptions non-trappable, and
* the second with all exceptions trappable. The FPCR and condition
* code is stored for each result.
*
***********************************************************************
SPACE 3
CFDBR LM R2,R3,0(R10) Get count and address of test input values
LM R7,R8,8(R10) Get address of result area and flag area.
LTR R2,R2 Any test cases?
BZR R13 ..No, return to caller
BASR R12,0 Set top of loop
*
LD FPR8,0(,R3) Get long BFP test value
LFPC FPCREGNT Set exceptions non-trappable
CFDBR R1,0,FPR8 Cvt float in FPR8 to Int in GPR1
ST R1,0(,R7) Store long BFP result
STFPC 0(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGTR Set exceptions trappable
XR R1,R1 Clear any residual result in R1
SPM R1 Clear out any residual nz condition code
CFDBR R1,0,FPR8 Cvt float in FPR8 to Int in GPR1
ST R1,4(,R7) Store int-32 result
STFPC 4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,7(,R8) Save CC as low byte of FPCR
*
LA R3,8(,R3) Point to next input value
LA R7,8(,R7) Point to next int-32 converted value pair
LA R8,8(,R8) Point to next FPCR/CC result area
BCTR R2,R12 Convert next input value.
BR R13 All converted; return.
EJECT
***********************************************************************
*
* Convert long BFP to int-32 using each possible rounding mode.
* Ten test results are generated for each input. A 48-byte test result
* section is used to keep results sets aligned on a quad-double word.
*
* The first four tests use rounding modes specified in the FPC with the
* IEEE Inexact exception supressed. SRNM (2-bit) is used for the first
* two FPCR-controlled tests and SRNMB (3-bit) is used for the last two
* to get full coverage of that instruction pair.
*
* The next six results use instruction-specified rounding modes.
*
* The default rounding mode (0 for RNTE) is not tested in this section;
* prior tests used the default rounding mode. RNTE is tested explicitly
* as a rounding mode in this section.
*
***********************************************************************
SPACE 2
CFDBRA LM R2,R3,0(R10) Get count and address of test input values
LM R7,R8,8(R10) Get address of result area and flag area.
LTR R2,R2 Any test cases?
BZR R13 ..No, return to caller
BASR R12,0 Set top of loop
*
LD FPR8,0(,R3) Get long BFP test value
*
* Test cases using rounding mode specified in the FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNM 1 SET FPC to RZ, towards zero.
CFDBRA R1,0,FPR8,B'0100' FPC ctl'd rounding inexact masked
ST R1,0*4(,R7) Store integer-32 result
STFPC 0(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNM 2 SET FPC to RP, to +infinity
CFDBRA R1,0,FPR8,B'0100' FPC ctl'd rounding inexact masked
ST R1,1*4(,R7) Store integer-32 result
STFPC 1*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(1*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNMB 3 SET FPC to RM, to -infinity
CFDBRA R1,0,FPR8,B'0100' FPC ctl'd rounding inexact masked
ST R1,2*4(,R7) Store integer-32 result
STFPC 2*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(2*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNMB 7 RFS, Prepare for Shorter Precision
CFDBRA R1,0,FPR8,B'0100' FPC ctl'd rounding inexact masked
ST R1,3*4(,R7) Store integer-32 result
STFPC 3*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(3*4)+3(,R8) Save CC as low byte of FPCR
*
* Test cases using rounding mode specified in the instruction M3 field
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFDBRA R1,1,FPR8,B'0000' RNTA, to nearest, ties away
ST R1,4*4(,R7) Store integer-32 result
STFPC 4*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(4*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFDBRA R1,3,FPR8,B'0000' RFS, prepare for shorter precision
ST R1,5*4(,R7) Store integer-32 result
STFPC 5*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(5*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFDBRA R1,4,FPR8,B'0000' RNTE, to nearest, ties to even
ST R1,6*4(,R7) Store integer-32 result
STFPC 6*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(6*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFDBRA R1,5,FPR8,B'0000' RZ, toward zero
ST R1,7*4(,R7) Store integer-32 result
STFPC 7*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(7*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFDBRA R1,6,FPR8,B'0000' RP, to +inf
ST R1,8*4(,R7) Store integer-32 result
STFPC 8*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(8*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFDBRA R1,7,FPR8,B'0000' RM, to -inf
ST R1,9*4(,R7) Store integer-32 result
STFPC 9*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(9*4)+3(,R8) Save CC as low byte of FPCR
*
LA R3,8(,R3) Point to next input values
LA R7,12*4(,R7) Point to next int-32 converted value set
LA R8,12*4(,R8) Point to next FPCR/CC result area
BCTR R2,R12 Convert next input value.
BR R13 All converted; return.
EJECT
***********************************************************************
*
* Convert extended BFP to integer-32. A pair of results is generated
* for each input: one with all exceptions non-trappable, and the
* second with all exceptions trappable. The FPCR and condition code
* are stored for each result.
*
***********************************************************************
SPACE 3
CFXBR LM R2,R3,0(R10) Get count and address of test input values
LM R7,R8,8(R10) Get address of result area and flag area.
LTR R2,R2 Any test cases?
BZR R13 ..No, return to caller
BASR R12,0 Set top of loop
*
LD FPR8,0(,R3) Get extended BFP test value part 1
LD FPR10,8(,R3) Get extended BFP test value part 1
LFPC FPCREGNT Set exceptions non-trappable
CFXBR R1,0,FPR8 Cvt float in FPR8-FPR10 to Int-32 in GPR1
ST R1,0(,R7) Store integer-32 result
STFPC 0(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGTR Set exceptions trappable
XR R1,R1 Clear any residual result in R1
SPM R1 Clear out any residual nz condition code
CFXBR R1,0,FPR8 Cvt float in FPR8-FPR10 to Int-32 in GPR1
ST R1,4(,R7) Store integer-32 result
STFPC 4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,7(,R8) Save CC as low byte of FPCR
*
LA R3,16(,R3) Point to next extended BFP input value
LA R7,8(,R7) Point to next int-32 converted value pair
LA R8,8(,R8) Point to next FPCR/CC result area
BCTR R2,R12 Convert next input value.
BR R13 All converted; return.
EJECT
***********************************************************************
*
* Convert extended BFP to int-32 using each possible rounding mode.
* Ten test results are generated for each input. A 48-byte test result
* section is used to keep results sets aligned on a quad-double word.
*
* The first four tests use rounding modes specified in the FPC with the
* IEEE Inexact exception supressed. SRNM (2-bit) is used for the
* first two FPCR-controlled tests and SRNMB (3-bit) is used for the
* last two To get full coverage of that instruction pair.
*
* The next six results use instruction-specified rounding modes.
*
* The default rounding mode (0 for RNTE) is not tested in this section;
* prior tests used the default rounding mode. RNTE is tested
* explicitly as a rounding mode in this section.
*
***********************************************************************
SPACE 2
CFXBRA LM R2,R3,0(R10) Get count and address of test input values
LM R7,R8,8(R10) Get address of result area and flag area.
LTR R2,R2 Any test cases?
BZR R13 ..No, return to caller
BASR R12,0 Set top of loop
*
LD FPR8,0(,R3) Get extended BFP test value part 1
LD R2,8(,R3) Get extended BFP test value part 2
*
* Test cases using rounding mode specified in the FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNMB 1 SET FPC to RZ, towards zero.
CFXBRA R1,0,FPR8,B'0100' FPC ctl'd rounding inexact masked
ST R1,0*4(,R7) Store integer-32 result
STFPC 0(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNMB 2 SET FPC to RP, to +infinity
CFXBRA R1,0,FPR8,B'0100' FPC ctl'd rounding inexact masked
ST R1,1*4(,R7) Store integer-32 result
STFPC 1*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(1*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNMB 3 SET FPC to RM, to -infinity
CFXBRA R1,0,FPR8,B'0100' FPC ctl'd rounding inexact masked
ST R1,2*4(,R7) Store integer-32 result
STFPC 2*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(2*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
SRNMB 7 RFS, Prepare for Shorter Precision
CFXBRA R1,0,FPR8,B'0100' FPC ctl'd rounding inexact masked
ST R1,3*4(,R7) Store integer-32 result
STFPC 3*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(3*4)+3(,R8) Save CC as low byte of FPCR
*
* Test cases using rounding mode specified in the instruction M3 field
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFXBRA R1,1,FPR8,B'0000' RNTA, to nearest, ties away
ST R1,4*4(,R7) Store integer-32 result
STFPC 4*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(4*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFXBRA R1,3,FPR8,B'0000' RFS, prepare for shorter precision
ST R1,5*4(,R7) Store integer-32 result
STFPC 5*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(5*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFXBRA R1,4,FPR8,B'0000' RNTE, to nearest, ties to even
ST R1,6*4(,R7) Store integer-32 result
STFPC 6*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(6*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFXBRA R1,5,FPR8,B'0000' RZ, toward zero
ST R1,7*4(,R7) Store integer-32 result
STFPC 7*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(7*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFXBRA R1,6,FPR8,B'0000' RP, to +inf
ST R1,8*4(,R7) Store integer-32 result
STFPC 8*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(8*4)+3(,R8) Save CC as low byte of FPCR
*
LFPC FPCREGNT Set exceptions non-trappable, clear flags
CFXBRA R1,7,FPR8,B'0000' RM, to -inf
ST R1,9*4(,R7) Store integer-32 result
STFPC 9*4(R8) Store resulting FPC flags and DXC
IPM R1 Get condition code and program mask
SRL R1,28 Isolate CC in low order byte
STC R1,(9*4)+3(,R8) Save CC as low byte of FPCR
*
LA R3,16(,R3) Point to next input value
LA R7,12*4(,R7) Point to next int-32 converted value set
LA R8,12*4(,R8) Point to next FPCR/CC result area
BCTR R2,R12 Convert next input value.
BR R13 All converted; return.
EJECT
***********************************************************************
*
* Floating point inputs for Convert To Fixed testing. The same test
* values in the appropriate input format are used for short, long,
* and extended format tests. The last four values should generate
* exceptions.
*
***********************************************************************
SPACE 3
*
* Inputs for basic tests of short BFP to int-32
*
SBFPIN DS 0F Inputs for short BFP testing
DC X'3F800000' +1.0
DC X'40000000' +2.0
DC X'40800000' +4.0
DC X'C0000000' -2.0
DC X'7F810000' SNaN
DC X'7FC10000' QNaN
* The following two will overflow int-32 regardless of rounding mode
DC X'4F000000' +max int-32 + 1. (2,147,483,647 + 1)
DC X'CF000001' -max int-32 - 2. (-2,147,483,647 - 2)
DC X'4EFFFFFF' Largest short bfp that fits in int-32
* ..2,147,483,520 = 0x7FFFFF80
*
SBFPCT EQU *-SBFPIN Count of short BFP in list * 4
*
* Inputs for exhaustive rounding mode tests of short BFP to int-32
*
SBFPINRM DS 0F
DC X'C1180000' -9.5
DC X'C0B00000' -5.5
DC X'C0200000' -2.5
DC X'BFC00000' -1.5
DC X'BF000000' -0.5
DC X'3F000000' +0.5
DC X'3FC00000' +1.5
DC X'40200000' +2.5
DC X'40B00000' +5.5
DC X'41180000' +9.5
DC X'3F400000' +0.75
DC X'3E800000' +0.25
DC X'BF400000' -0.75
DC X'BE800000' -0.25
*
* There is no short BFP represtation for values between 2,147,483,520
* and 2,147,483,648, making it difficult to come up with a test case
* that overflows for only some of the rounding modes available.
*
SBFPRMCT EQU *-SBFPINRM Count of short BFP in list * 4
*
* Inputs for basic tests of long BFP to int-32
*
LBFPIN DS 0F Inputs for long BFP testing
DC X'3FF0000000000000' +1.0
DC X'4000000000000000' +2.0
DC X'4010000000000000' +4.0
DC X'C000000000000000' -2.0
DC X'7FF0100000000000' SNaN
DC X'7FF8100000000000' QNaN
DC X'41E0000000000000' +max int-32 + 1 (+2147483647 + 1)
DC X'C1E0000000200000' -max int-32 - 2 (-2147483647 - 2)
DC X'41DFFFFFFFC00000' Largest long bfp that fits in
* ..int-32: 2,147,483,647 = 0x7FFFFFFF
DC X'41DFFFFFFFE00000' 2,147,483,647.5 - overflows on
* RNTE; test of traps
LBFPCT EQU *-LBFPIN Count of long BFP in list * 8
*
* Inputs for exhaustive rounding mode tests of long BFP to int-32
*
LBFPINRM DS 0F
DC X'C023000000000000' -9.5
DC X'C016000000000000' -5.5
DC X'C004000000000000' -2.5
DC X'BFF8000000000000' -1.5
DC X'BFE0000000000000' -0.5
DC X'3FE0000000000000' +0.5
DC X'3FF8000000000000' +1.5
DC X'4004000000000000' +2.5
DC X'4016000000000000' +5.5
DC X'4023000000000000' +9.5
DC X'3FE8000000000000' +0.75
DC X'3FD0000000000000' +0.25
DC X'BFE8000000000000' -0.75
DC X'BFD0000000000000' -0.25
DC X'41DFFFFFFFE00000' 2,147,483,647.5 - overflows on
* some but not all rounding modes
LBFPRMCT EQU *-LBFPINRM Count of long BFP in list * 8
*
* Inputs for basic tests of extended BFP to int-32
*
XBFPIN DS 0D Inputs for extended BFP testing
DC X'3FFF0000000000000000000000000000' +1.0
DC X'40000000000000000000000000000000' +2.0
DC X'40010000000000000000000000000000' +4.0
DC X'C0000000000000000000000000000000' -2.0
DC X'7FFF0100000000000000000000000000' SNaN
DC X'7FFF8100000000000000000000000000' QNaN
DC X'401E0000000000000000000000000000' +max int-32 + 1
DC X'C01E0000000200000000000000000000' -max int-32 - 2
DC X'401DFFFFFFFC00000000000000000000' Largest long bfp
* that fits in int-32: 2,147,483,647 = 0x7FFFFFFF
DC X'401DFFFFFFFE00000000000000000000' 2,147,483,647.5
* - overflows on RNTE; test of traps
XBFPCT EQU *-XBFPIN Count of extended BFP in list * 16
*
* Inputs for exhaustive rounding mode tests of long BFP to int-32
*
XBFPINRM DS 0D
DC X'C0023000000000000000000000000000' -9.5
DC X'C0016000000000000000000000000000' -5.5
DC X'C0004000000000000000000000000000' -2.5
DC X'BFFF8000000000000000000000000000' -1.5
DC X'BFFE0000000000000000000000000000' -0.5
DC X'3FFE0000000000000000000000000000' +0.5
DC X'3FFF8000000000000000000000000000' +1.5
DC X'40004000000000000000000000000000' +2.5
DC X'40016000000000000000000000000000' +5.5
DC X'40023000000000000000000000000000' +9.5
DC X'3FFE8000000000000000000000000000' +0.75
DC X'3FFD0000000000000000000000000000' +0.25
DC X'BFFE8000000000000000000000000000' -0.75
DC X'BFFD0000000000000000000000000000' -0.25
DC X'401DFFFFFFFE00000000000000000000' 2,147,483,647.5
* - overflows on some but not all rounding modes
XBFPRMCT EQU *-XBFPINRM Count of extended BFP in list * 16
*
* Locations for results
*
SINTOUT EQU BFPCVTTF+X'1000' uint-32 values from short BFP
* ..9 pairs used, room for 16
SINTFLGS EQU BFPCVTTF+X'1100' FPCR flags and DXC from short BFP
* ..9 pairs used, room for 16
SINTRMO EQU BFPCVTTF+X'1200' Short rounding mode test results
* ..14 sets used, room for 20
SINTRMOF EQU BFPCVTTF+X'1600' Short rounding mode FPCR contents
* ..14 sets used, room for 20
*
LINTOUT EQU BFPCVTTF+X'2000' uint-32 values from long BFP
* ..10 pairs used, room for 16
LINTFLGS EQU BFPCVTTF+X'2100' FPCR flags and DXC from long BFP
* ..10 pairs used, room for 16
LINTRMO EQU BFPCVTTF+X'2200' Long rounding mode test results
* ..14 sets used, room for 20
LINTRMOF EQU BFPCVTTF+X'2600' Long rounding mode FPCR contents
* ..14 sets used, room for 20
*
XINTOUT EQU BFPCVTTF+X'3000' uint-32 values from extended BFP
* ..10 pairs used, room for 16
XINTFLGS EQU BFPCVTTF+X'3100' FPCR flags and DXC from extended BFP
* ..10 pairs used, room for 16
XINTRMO EQU BFPCVTTF+X'3200' Extended rounding mode test results
* ..14 sets used, room for 20
XINTRMOF EQU BFPCVTTF+X'3600' Extended rounding mode FPCR contents
* ..14 sets used, room for 20
*
*
ENDLABL EQU BFPCVTTF+X'4000'
PADCSECT ENDLABL
END
|
release/src/router/gmp/source/mpn/x86/udiv.asm | zhoutao0712/rtn11pb1 | 184 | 81707 | <filename>release/src/router/gmp/source/mpn/x86/udiv.asm
dnl x86 mpn_udiv_qrnnd -- 2 by 1 limb division
dnl Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public License as
dnl published by the Free Software Foundation; either version 3 of the
dnl License, or (at your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C mp_limb_t mpn_udiv_qrnnd (mp_limb_t *remptr, mp_limb_t high, mp_limb_t low,
C mp_limb_t divisor);
defframe(PARAM_DIVISOR, 16)
defframe(PARAM_LOW, 12)
defframe(PARAM_HIGH, 8)
defframe(PARAM_REMPTR, 4)
TEXT
ALIGN(8)
PROLOGUE(mpn_udiv_qrnnd)
deflit(`FRAME',0)
movl PARAM_LOW, %eax
movl PARAM_HIGH, %edx
divl PARAM_DIVISOR
movl PARAM_REMPTR, %ecx
movl %edx, (%ecx)
ret
EPILOGUE()
|
src/Categories/Category/Monoidal/Instance/Setoids.agda | MirceaS/agda-categories | 0 | 12384 | <reponame>MirceaS/agda-categories
{-# OPTIONS --without-K --safe #-}
module Categories.Category.Monoidal.Instance.Setoids where
open import Level
open import Data.Product
open import Data.Product.Relation.Binary.Pointwise.NonDependent
open import Function.Equality
open import Relation.Binary using (Setoid)
open import Categories.Category
open import Categories.Category.Instance.Setoids
open import Categories.Category.Cartesian
open import Categories.Category.Instance.SingletonSet
module _ {o ℓ} where
Setoids-Cartesian : Cartesian (Setoids o ℓ)
Setoids-Cartesian = record
{ terminal = SingletonSetoid-⊤
; products = record
{ product = λ {A B} →
let module A = Setoid A
module B = Setoid B
in record
{ A×B = ×-setoid A B -- the stdlib doesn't provide projections!
; π₁ = record
{ _⟨$⟩_ = proj₁
; cong = proj₁
}
; π₂ = record
{ _⟨$⟩_ = proj₂
; cong = proj₂
}
; ⟨_,_⟩ = λ f g → record
{ _⟨$⟩_ = λ x → f ⟨$⟩ x , g ⟨$⟩ x
; cong = λ eq → cong f eq , cong g eq
}
; project₁ = λ {_ h i} eq → cong h eq
; project₂ = λ {_ h i} eq → cong i eq
; unique = λ {W h i j} eq₁ eq₂ eq → A.sym (eq₁ (Setoid.sym W eq)) , B.sym (eq₂ (Setoid.sym W eq))
}
}
}
module Setoids-Cartesian = Cartesian Setoids-Cartesian
open Setoids-Cartesian renaming (monoidal to Setoids-Monoidal) public
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca_notsx.log_21829_1863.asm | ljhsiun2/medusa | 9 | 241471 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r15
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x1f7f, %rcx
nop
nop
nop
nop
nop
dec %r15
mov $0x6162636465666768, %rdi
movq %rdi, (%rcx)
nop
nop
xor %rcx, %rcx
lea addresses_A_ht+0x193c9, %rdi
clflush (%rdi)
nop
nop
xor %r13, %r13
movw $0x6162, (%rdi)
nop
nop
nop
nop
nop
cmp $23523, %rdx
lea addresses_WC_ht+0x1a77f, %r11
cmp %r12, %r12
mov (%r11), %r15w
nop
nop
nop
nop
nop
dec %rdx
lea addresses_UC_ht+0x19b2f, %rdx
and %r12, %r12
movb $0x61, (%rdx)
nop
nop
nop
and %rcx, %rcx
lea addresses_normal_ht+0x65a7, %r15
nop
nop
nop
nop
nop
sub $26059, %rdi
mov $0x6162636465666768, %r13
movq %r13, (%r15)
nop
nop
nop
nop
add $43780, %r15
lea addresses_WC_ht+0x1af7f, %rdi
nop
dec %rdx
mov (%rdi), %ecx
nop
sub $49841, %r13
lea addresses_normal_ht+0x10b7f, %r13
nop
xor %r12, %r12
and $0xffffffffffffffc0, %r13
movntdqa (%r13), %xmm0
vpextrq $1, %xmm0, %r15
nop
nop
nop
add %rdi, %rdi
lea addresses_WT_ht+0x323f, %rdi
nop
nop
nop
nop
xor $42444, %rdx
mov $0x6162636465666768, %r12
movq %r12, %xmm1
movups %xmm1, (%rdi)
nop
nop
cmp %r13, %r13
lea addresses_WC_ht+0x114fd, %rsi
lea addresses_A_ht+0x19437, %rdi
nop
nop
nop
inc %r12
mov $107, %rcx
rep movsw
nop
add $25999, %r13
lea addresses_UC_ht+0x1dc7f, %rdi
nop
xor $51599, %r12
movb $0x61, (%rdi)
xor $31556, %rcx
lea addresses_normal_ht+0x1d7f, %r12
nop
nop
nop
nop
nop
sub %r11, %r11
movw $0x6162, (%r12)
nop
nop
xor $29082, %rsi
lea addresses_A_ht+0x6087, %rsi
lea addresses_WC_ht+0xf88f, %rdi
mfence
mov $101, %rcx
rep movsl
inc %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r15
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r9
push %rbx
push %rdx
// Store
lea addresses_UC+0x16567, %rdx
and %r11, %r11
mov $0x5152535455565758, %r14
movq %r14, %xmm0
movups %xmm0, (%rdx)
nop
nop
nop
nop
cmp %r11, %r11
// Faulty Load
lea addresses_US+0x1577f, %rbx
clflush (%rbx)
inc %r9
movaps (%rbx), %xmm4
vpextrq $0, %xmm4, %r15
lea oracles, %r11
and $0xff, %r15
shlq $12, %r15
mov (%r11,%r15,1), %r15
pop %rdx
pop %rbx
pop %r9
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 3, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
inst/scripts/get-slide-contents.applescript | gaborcsardi/keynote | 27 | 2458 |
on run argv
set out to "["
set cnt to 0
tell document id (item 1 of argv) of application "Keynote"
tell slide (item 2 of argv as number)
-- add title item if visible
if title showing then
set tit to my jsonrecord(default title item, ¬
"default title item")
set out to out & tit
set cnt to cnt + 1
end if
-- add body item if visible
if body showing then
set bod to my jsonrecord(default body item, ¬
"default body item")
if cnt > 0 then
set out to out & ", "
end if
set out to out & bod
set cnt to cnt + 1
end if
-- add the other items as well
repeat with i from 1 to the count of text items
try
if (text item i = default title item) then
error "counted already"
end if
if (text item i = default body item) then
error "counted already"
end if
set itm to my jsonrecord(item i, "text item")
if cnt > 0 then
set out to out & ", "
end if
set out to out & itm
set cnt to cnt + 1
end try
end repeat
end tell
end tell
set out to out & "]"
out
end run
on escape(str)
-- Save delimiter
set prevdelim to text item delimiters of AppleScript
-- Escape double quotes
set text item delimiters of AppleScript to "\""
set str to text items of str
set text item delimiters of AppleScript to "\\\""
set str to str as text
-- Escape newlines as well
set text item delimiters of Applescript to "\n"
set str to text items of str
set text item delimiters of Applescript to "\\n"
set str to str as text
-- restore delimiter
set text item delimiters of AppleScript to prevdelim
return str
end escape
on jsonrecord(itm, itmtype)
tell application "Keynote"
set pos to position of itm
set fill to background fill type of itm
set refsh to reflection showing of itm
set refval to reflection value of itm
set txt to my escape(object text of itm)
return "{" & ¬
"\"type\": \"" & itmtype & "\", " & ¬
"\"object_text\": \"" & txt & "\"," & ¬
"\"horizontal_position\": " & item 1 of pos as string & ", " & ¬
"\"vertial_position\": " & item 2 of pos as string & ", " & ¬
"\"width\": " & width of itm as string & ", " & ¬
"\"height\": " & height of itm as string & ", " & ¬
"\"background_fill_type\": \"" & fill & "\", " & ¬
"\"rotation\": " & rotation of itm as string & ", " & ¬
"\"locked\": " & locked of itm & ", " & ¬
"\"opacity\": " & opacity of itm & ", " & ¬
"\"reflection_showing\": " & refsh & ", " & ¬
"\"reflection_value\": " & refval & ¬
"}"
end tell
end jsonrecord
|
scripts/Create Bookmark from Current Tab in Safari Directly.applescript | ddeville/spillo-applescript | 67 | 3837 | <filename>scripts/Create Bookmark from Current Tab in Safari Directly.applescript
(*
*)
tell application "Safari"
if current tab of front window exists then
set current_tab to current tab of front window
set js_script to "
var selection = window.getSelection().toString();
if (!selection) {
var meta = document.getElementsByTagName('meta');
for (var idx = 0; idx < meta.length; idx++) {
if (meta[idx].name.toLowerCase() === 'description') {
selection = meta[idx].content;
break;
}
}
}
selection;
"
set tab_title to name of current_tab
set tab_address to URL of current_tab
set tab_description to do JavaScript js_script in current_tab
tell application "Spillo"
make new bookmark with properties {url:tab_address, title:tab_title, desc:tab_description}
save
refresh
end tell
end if
end tell |
Application Support/BBEdit/Scripts/Eval/Open in Excel.applescript | bhdicaire/bbeditSetup | 0 | 4690 | tell application "BBEdit"
set filename to file of front window
end tell
tell application "/Applications/Microsoft Office 2011/Microsoft Excel.app"
activate
open filename
end tell |
asm/first_asm/exit.asm | dmike16/study-notes | 0 | 6615 | ; Program: exit
;
; Input no
;
; Output: only set the exit code. ($? into the shell)
;
segment .text
global _start
_start:
mov eax,1 ; 1 is the exit syscall number
mov ebx,5 ; the status value to return
int 0x80 ; execute a syscall
|
Ada/src/fakelib/fakedsp-protected_buffers.adb | fintatarta/fakedsp | 0 | 22028 | <filename>Ada/src/fakelib/fakedsp-protected_buffers.adb
pragma Ada_2012;
pragma Assertion_Policy (disable);
package body Fakedsp.Protected_Buffers is
------------------
-- State_Buffer --
------------------
protected body State_Buffer is
---------
-- Set --
---------
procedure Set (S : State_Type)
is
begin
State := S;
Changed := True;
end Set;
---------
-- Get --
---------
entry Get (S : out State_Type) when Changed
is
begin
S := State;
Changed := False;
end Get;
function Peek return State_Type
is (State);
end State_Buffer;
-------------------
-- Sample_Buffer --
-------------------
protected body Sample_Buffer is
---------
-- Put --
---------
procedure Put (Item : Float_Array)
is
begin
Buffer := Item;
end Put;
function Length return Positive
is (Size);
function Get return Float_Array
is
begin
return Buffer;
end Get;
end Sample_Buffer;
end Fakedsp.Protected_Buffers;
|
programs/oeis/015/A015559.asm | neoneye/loda | 22 | 102833 | <gh_stars>10-100
; A015559: Expansion of x/(1 - 7*x - 3*x^2).
; 0,1,7,52,385,2851,21112,156337,1157695,8572876,63483217,470101147,3481157680,25778407201,190892323447,1413581485732,10467747370465,77514976050451,574008074464552,4250601449403217,31476234369216175,233085444932722876,1726026817636708657,12781444058255129227,94648188860696030560,700881654199637601601,5190116145979551302887,38433457984455771925012,284604554329129057383745,2107532254257270717461251,15606539442788282194379992,115568372862289787513043697,855798228364393359174445855,6337292717137622876760252076,46928443705056540214845102097,347510984086808650134196470907,2573362219722830171583910602640,19056068490320237151489963631201,141112566091410150575181477226327,1044956168110831765480740231477892,7738030875050052810090726052024225,57301084629682864967077303058603251,424321685032930213199813299566295432
lpb $0
mov $2,3
lpb $2
sub $2,1
add $5,$4
add $3,$5
lpe
sub $0,1
add $3,1
mov $1,$3
mov $4,$3
mov $3,0
lpe
mov $0,$1
|
S5/AO/Assembler/String/inverserChaine.asm | Momellouky/S5 | 1 | 11579 | ; multi-segment executable file template.
data segment
str dw "chaineInverser$"
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
;mov dx, offset str
mov cx, 0
mov si, 0
;mov dx, offset str
empiler:
mov dx, str[si]
push dx
inc cx
inc si
cmp dx, 36
je popDollar
jmp empiler
popDollar:
pop dx
dec cx
jmp afficher
afficher:
pop dx
mov ah, 2h
int 21h
dec cx
cmp cx, 0
je fin
jmp afficher
fin:
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.
|
fizzbuzz.applescript | KiYOKing/fizzbuzz | 0 | 2843 | -- FizzBuzzを返す関数の定義 --- (*1)
on fizzbuzz(i)
if i mod 15 is 0 then
return "FizzBuzz"
else if i mod 3 is 0 then
return "Fizz"
else if i mod 5 is 0 then
return "Buzz"
else
return i as string
end if
end fizzbuzz
-- 100回fizzbuzz関数を呼び出す --- (*2)
set res to ""
repeat with i from 1 to 100
set res to res & fizzbuzz(i) & "\n"
end repeat
|
base/boot/tftplib/i386/xsum.asm | npocmaka/Windows-Server-2003 | 17 | 245022 | <reponame>npocmaka/Windows-Server-2003
include xsum.x86
|
src/hyperion-monitoring-modules.adb | stcarrez/hyperion | 0 | 21115 | <reponame>stcarrez/hyperion
-----------------------------------------------------------------------
-- hyperion-monitoring-modules -- Module monitoring
-- Copyright (C) 2018 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Hash;
with AWA.Modules.Beans;
with AWA.Modules.Get;
with ADO.Utils.Streams;
with Util.Streams.Texts;
with Util.Log.Loggers;
with Util.Serialize.IO.JSON;
with Hyperion.Monitoring.Beans;
package body Hyperion.Monitoring.Modules is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Hyperion.Monitoring.Module");
package Register is new AWA.Modules.Beans (Module => Monitoring_Module,
Module_Access => Monitoring_Module_Access);
-- ------------------------------
-- Initialize the monitoring module.
-- ------------------------------
overriding
procedure Initialize (Plugin : in out Monitoring_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config) is
begin
Log.Info ("Initializing the monitoring module");
-- Register here any bean class, servlet, filter.
Register.Register (Plugin => Plugin,
Name => "Hyperion.Monitoring.Beans.Monitoring_Bean",
Handler => Hyperion.Monitoring.Beans.Create_Monitoring_Bean'Access);
AWA.Modules.Module (Plugin).Initialize (App, Props);
-- Add here the creation of manager instances.
end Initialize;
-- ------------------------------
-- Get the monitoring module.
-- ------------------------------
function Get_Monitoring_Module return Monitoring_Module_Access is
function Get is new AWA.Modules.Get (Monitoring_Module, Monitoring_Module_Access, NAME);
begin
return Get;
end Get_Monitoring_Module;
-- ------------------------------
-- Create a hash value for the host-source key.
-- ------------------------------
function Hash (Key : in Host_Source_Key) return Ada.Containers.Hash_Type is
use type Ada.Containers.Hash_Type;
begin
return ADO.Utils.Hash (Key.Host) xor Ada.Strings.Hash (Key.Name);
end Hash;
protected body All_Snapshots is
procedure Host_Snapshot (Host_Id : in ADO.Identifier;
Name : in String;
Snapshot : out Snapshot_Data_Access) is
Key : constant Host_Source_Key := Host_Source_Key '(Len => Name'Length,
Host => Host_Id,
Name => Name);
Source_Pos : constant Host_Source_Maps.Cursor := Source_Map.Find (Key);
Pos : Source_Snapshot_Maps.Cursor;
begin
if not Host_Source_Maps.Has_Element (Source_Pos) then
-- Create
null;
end if;
Pos := Snapshots.Find (Host_Source_Maps.Element (Source_Pos));
Snapshot := Source_Snapshot_Maps.Element (Pos);
end Host_Snapshot;
end All_Snapshots;
function Serialize (Data : in Value_Builders.Builder) return ADO.Blob_Ref is
Stream : aliased ADO.Utils.Streams.Blob_Output_Stream;
Printer : aliased Util.Streams.Texts.Print_Stream;
Json : Util.Serialize.IO.JSON.Output_Stream;
procedure Serialize_Values (Content : in Value_Array) is
begin
for V of Content loop
Json.Write_Long_Entity ("", V);
end loop;
end Serialize_Values;
begin
Stream.Initialize (Size => 100000);
Printer.Initialize (Output => Stream'Unchecked_Access,
Size => 100000);
Json.Initialize (Printer'Unchecked_Access);
Json.Start_Document;
Json.Start_Array ("");
Value_Builders.Iterate (Data, Serialize_Values'Access);
Json.End_Array ("");
Json.End_Document;
Json.Flush;
return Stream.Get_Blob;
end Serialize;
protected body Snapshot_Data is
procedure Collect (DB : in out ADO.Sessions.Master_Session;
From : in Ada.Calendar.Time;
To : in Ada.Calendar.Time;
Values : in UBO.Vectors.Vector_Bean) is
begin
for V of Values loop
Value_Builders.Append (Data, UBO.To_Long_Long_Integer (V));
end loop;
End_Time := To;
Serie.Set_Start_Date (Start_Time);
Serie.Set_End_Date (End_Time);
Serie.Set_Content (Serialize (Data));
Serie.Set_Count (Value_Builders.Length (Data));
Serie.Set_Format (Hyperion.Monitoring.Models.FORMAT_JSON);
Serie.Save (DB);
end Collect;
end Snapshot_Data;
end Hyperion.Monitoring.Modules;
|
data/trainers/class_names.asm | AtmaBuster/pokeplat-gen2 | 6 | 25320 | TrainerClassNames::
; entries correspond to trainer classes (see constants/trainer_constants.asm)
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "RIVAL@"
db "#MON PROF.@"
db "ELITE FOUR@"
db "ELITE FOUR@"
db "ELITE FOUR@"
db "ELITE FOUR@"
db "<PKMN> TRAINER@"
db "CHAMPION@"
db "WORKER@"
db "VETERAN@"
db "LEADER@"
db "SCIENTIST@"
db "LEADER@"
db "YOUNGSTER@"
db "SCHOOLBOY@"
db "BIRD KEEPER@"
db "LASS@"
db "LEADER@"
db "COOLTRAINER@"
db "COOLTRAINER@"
db "BEAUTY@"
db "#MANIAC@"
db "GALACTIC@"
db "GENTLEMAN@"
db "SKIER@"
db "TEACHER@"
db "LEADER@"
db "BUG CATCHER@"
db "FISHER@"
db "SWIMMER♂@"
db "SWIMMER♀@"
db "SAILOR@"
db "SUPER NERD@"
db "RIVAL@"
db "GUITARIST@"
db "HIKER@"
db "BIKER@"
db "LEADER@"
db "BURGLAR@"
db "FIREBREATHER@"
db "JUGGLER@"
db "BLACKBELT@"
db "ROCKET@"
db "PSYCHIC@"
db "PICNICKER@"
db "CAMPER@"
db "ROCKET@"
db "SAGE@"
db "MEDIUM@"
db "BOARDER@"
db "#FAN@"
db "KIMONO GIRL@"
db "TWINS@"
db "#FAN@"
db "<PKMN> TRAINER@"
db "LEADER@"
db "OFFICER@"
db "ROCKET@"
db "MYSTICALMAN@"
db "SCHOOLGIRL@"
|
Data/Binary/Isomorphism.agda | oisdk/agda-playground | 6 | 6280 | {-# OPTIONS --cubical --safe --postfix-projections #-}
module Data.Binary.Isomorphism where
open import Data.Binary.Definition
open import Data.Binary.Conversion
open import Data.Binary.Increment
open import Prelude
import Data.Nat as ℕ
inc-suc : ∀ x → ⟦ inc x ⇓⟧ ≡ suc ⟦ x ⇓⟧
inc-suc 0ᵇ i = 1
inc-suc (1ᵇ x) i = 2 ℕ.+ ⟦ x ⇓⟧ ℕ.* 2
inc-suc (2ᵇ x) i = suc (inc-suc x i ℕ.* 2)
inc-2*-1ᵇ : ∀ n → inc ⟦ n ℕ.* 2 ⇑⟧ ≡ 1ᵇ ⟦ n ⇑⟧
inc-2*-1ᵇ zero i = 1ᵇ 0ᵇ
inc-2*-1ᵇ (suc n) i = inc (inc (inc-2*-1ᵇ n i))
𝔹-rightInv : ∀ x → ⟦ ⟦ x ⇑⟧ ⇓⟧ ≡ x
𝔹-rightInv zero = refl
𝔹-rightInv (suc x) = inc-suc ⟦ x ⇑⟧ ; cong suc (𝔹-rightInv x)
𝔹-leftInv : ∀ x → ⟦ ⟦ x ⇓⟧ ⇑⟧ ≡ x
𝔹-leftInv 0ᵇ = refl
𝔹-leftInv (1ᵇ x) = inc-2*-1ᵇ ⟦ x ⇓⟧ ; cong 1ᵇ_ (𝔹-leftInv x)
𝔹-leftInv (2ᵇ x) = cong inc (inc-2*-1ᵇ ⟦ x ⇓⟧) ; cong 2ᵇ_ (𝔹-leftInv x)
𝔹⇔ℕ : 𝔹 ⇔ ℕ
𝔹⇔ℕ .fun = ⟦_⇓⟧
𝔹⇔ℕ .inv = ⟦_⇑⟧
𝔹⇔ℕ .rightInv = 𝔹-rightInv
𝔹⇔ℕ .leftInv = 𝔹-leftInv
|
programs/oeis/028/A028430.asm | neoneye/loda | 22 | 16800 | ; A028430: Clog sequence in base 9. Right to left concatenation of n, int(log_9(n)), int(log_9(int(log_9(n)))),... in base9.
; 1,2,3,4,5,6,7,8,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138
mov $1,1
mov $2,$0
mov $3,$0
sub $3,2
lpb $3
add $2,81
mod $3,6
lpe
add $1,$2
mov $0,$1
|
source/pkgsrc/devel/florist/patches/patch-posix-signals.adb | Scottx86-64/dotfiles-1 | 1 | 8157 | <gh_stars>1-10
$NetBSD: patch-posix-signals.adb,v 1.5 2014/04/30 16:27:04 marino Exp $
Fix style check violation for GNAT 4.9
--- posix-signals.adb.orig 2012-05-10 13:32:11.000000000 +0000
+++ posix-signals.adb
@@ -340,16 +340,18 @@ package body POSIX.Signals is
begin
for Sig in Signal loop
if Reserved_Signal (Sig) then
- if Sig /= SIGKILL and then Sig /= SIGSTOP and then
- sigismember (Set.C'Unchecked_Access, int (Sig)) = 1 then
- Raise_POSIX_Error (Invalid_Argument);
+ if Sig /= SIGKILL and then Sig /= SIGSTOP then
+ if sigismember (Set.C'Unchecked_Access, int (Sig)) = 1 then
+ Raise_POSIX_Error (Invalid_Argument);
+ end if;
end if;
else
-- This signal might be attached to a
-- task entry or protected procedure
if sigismember (Set.C'Unchecked_Access, int (Sig)) = 1
- and then (SI.Is_Entry_Attached (SIID (Sig))
- or else SI.Is_Handler_Attached (SIID (Sig))) then
+ and then (SI.Is_Entry_Attached (SIID (Sig))
+ or else SI.Is_Handler_Attached (SIID (Sig)))
+ then
Raise_POSIX_Error (Invalid_Argument);
end if;
end if;
@@ -466,7 +468,8 @@ package body POSIX.Signals is
(Set : Signal_Set; Sig : Signal) return Boolean is
begin
if Sig = Signal_Null
- or else sigismember (Set.C'Unchecked_Access, int (Sig)) = 1 then
+ or else sigismember (Set.C'Unchecked_Access, int (Sig)) = 1
+ then
return True;
end if;
return False;
@@ -500,8 +503,7 @@ package body POSIX.Signals is
if not Reserved_Signal (Sig) then
-- It is OK to modify this signal's masking, using the
-- interfaces of System.Interrupts.
- if sigismember
- (New_Mask.C'Unchecked_Access, int (Sig)) = 1 then
+ if sigismember (New_Mask.C'Unchecked_Access, int (Sig)) = 1 then
if not SI.Is_Blocked (SIID (Sig)) then
Disposition (Sig) := SI_To_Mask;
end if;
@@ -551,8 +553,7 @@ package body POSIX.Signals is
if not Reserved_Signal (Sig) then
-- It is OK to modify this signal's masking, using the
-- interfaces of System.Interrupts.
- if sigismember
- (Mask_to_Add.C'Unchecked_Access, int (Sig)) = 1 then
+ if sigismember (Mask_to_Add.C'Unchecked_Access, int (Sig)) = 1 then
if not SI.Is_Blocked (SIID (Sig)) then
Disposition (Sig) := SI_To_Mask;
end if;
@@ -602,7 +603,8 @@ package body POSIX.Signals is
-- It is OK to modify this signal's masking, using the
-- interfaces of System.Interrupts.
if sigismember
- (Mask_to_Subtract.C'Unchecked_Access, int (Sig)) = 1 then
+ (Mask_to_Subtract.C'Unchecked_Access, int (Sig)) = 1
+ then
if SI.Is_Blocked (SIID (Sig)) then
Disposition (Sig) := SI_To_Unmask;
end if;
@@ -639,7 +641,8 @@ package body POSIX.Signals is
-- may be more values in POSIX.Signal
-- than System.Interrupts.Interrupt_ID
if pthread_sigmask
- (SIG_BLOCK, null, Old_Mask.C'Unchecked_Access) = 0 then
+ (SIG_BLOCK, null, Old_Mask.C'Unchecked_Access) = 0
+ then
null;
end if;
-- Delete any ublocked signals from System.Interrupts.
@@ -1004,8 +1007,7 @@ package body POSIX.Signals is
Result : aliased int;
begin
Check_Awaitable (Set);
- if sigwait
- (Set.C'Unchecked_Access, Result'Unchecked_Access) = -1 then
+ if sigwait (Set.C'Unchecked_Access, Result'Unchecked_Access) = -1 then
Raise_POSIX_Error (Fetch_Errno);
end if;
return Signal (Result);
@@ -1156,7 +1158,8 @@ begin
if Integer (Sig) <= Integer (SIID'Last) then
if SI.Is_Reserved (SIID (Sig)) and then (Sig /= SIGKILL
- and Sig /= SIGSTOP) then
+ and Sig /= SIGSTOP)
+ then
Reserved_Signal (Sig) := True;
end if;
else
|
oldstuff/z80 ASM/test/test.asm | bcherry/bcherry | 3 | 92444 | <gh_stars>1-10
#include "ti86asm.inc"
.org _asm_exec_ram
nop
jp ProgStart
.dw 0
.dw ShellTitle
ShellTitle:
.db "New Assembly Program",0
ProgStart:
.end
|
src/norx_definitions.ads | jhumphry/SPARK_NORX | 9 | 15726 | -- NORX_Definitions
-- Some type / subtype definitions in common use in the NORX code.
-- As some uses of these types are in generic parameters, it is not possible
-- to hide them.
-- Copyright (c) 2016, <NAME> - see LICENSE file for details
pragma Restrictions(No_Implementation_Attributes,
No_Implementation_Identifiers,
No_Implementation_Units,
No_Obsolescent_Features);
package NORX_Definitions
with Pure, SPARK_Mode => On is
subtype Word_Size is Integer
with Static_Predicate => Word_Size in 8 | 16 | 32 | 64;
subtype Round_Count is Integer range 1..63;
subtype Key_Material_Position is Integer
with Static_Predicate => Key_Material_Position in 2 | 4;
type Rotation_Offsets is array (Integer range 0..3) of Natural;
end NORX_Definitions;
|
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_21829_915.asm | ljhsiun2/medusa | 9 | 22230 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x7cc9, %r13
nop
nop
cmp %rbx, %rbx
mov $0x6162636465666768, %rbp
movq %rbp, %xmm5
and $0xffffffffffffffc0, %r13
movaps %xmm5, (%r13)
nop
add $16157, %rax
lea addresses_UC_ht+0x5bc9, %rsi
lea addresses_normal_ht+0x142c9, %rdi
clflush (%rdi)
inc %r14
mov $99, %rcx
rep movsq
nop
nop
nop
add %rax, %rax
lea addresses_UC_ht+0x72c9, %rsi
lea addresses_WC_ht+0x5829, %rdi
clflush (%rdi)
nop
add $10623, %rbp
mov $39, %rcx
rep movsl
nop
xor %r14, %r14
lea addresses_UC_ht+0xcac9, %rsi
lea addresses_WT_ht+0x10549, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
add %rax, %rax
mov $11, %rcx
rep movsq
nop
dec %rbp
lea addresses_WT_ht+0x8c1d, %r13
nop
nop
sub $57528, %rdi
mov (%r13), %rsi
nop
nop
nop
nop
nop
and $59158, %rdi
lea addresses_A_ht+0x1c4c5, %rsi
lea addresses_normal_ht+0x7801, %rdi
clflush (%rdi)
nop
nop
nop
nop
dec %rax
mov $123, %rcx
rep movsq
xor $6752, %r14
lea addresses_A_ht+0xe7ab, %r14
and $64048, %rbp
movw $0x6162, (%r14)
nop
nop
nop
nop
xor $63697, %rbx
lea addresses_WT_ht+0x18494, %rax
nop
nop
nop
xor %rdi, %rdi
movups (%rax), %xmm0
vpextrq $0, %xmm0, %rsi
nop
nop
and $31105, %rax
lea addresses_UC_ht+0x1c4a9, %rsi
lea addresses_D_ht+0x1eac9, %rdi
clflush (%rdi)
nop
inc %rax
mov $89, %rcx
rep movsq
nop
nop
nop
nop
cmp $39620, %rbx
lea addresses_A_ht+0x19789, %rdi
nop
sub $48496, %r13
mov (%rdi), %rbx
nop
nop
add $55442, %r14
lea addresses_D_ht+0x18c9, %rbp
nop
nop
nop
and %rcx, %rcx
movb (%rbp), %r13b
nop
nop
nop
nop
nop
and %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %r9
push %rax
push %rbx
push %rsi
// Store
mov $0x5c9, %r13
nop
nop
nop
nop
nop
inc %rax
mov $0x5152535455565758, %r9
movq %r9, (%r13)
nop
nop
nop
nop
nop
cmp %r14, %r14
// Faulty Load
lea addresses_A+0xe2c9, %rbx
nop
nop
nop
nop
dec %r12
mov (%rbx), %rsi
lea oracles, %r14
and $0xff, %rsi
shlq $12, %rsi
mov (%r14,%rsi,1), %rsi
pop %rsi
pop %rbx
pop %rax
pop %r9
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': True, 'NT': True, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/modules/engines/gl_common/shader/font_frag_s3c6410.asm | tizenorg/framework.uifw.evas | 1 | 6465 | #-------------------------------------------------
# ORION - OpenGL ES 2.0 Shading Language Compiler
# SAMSUNG INDIA SOFTWARE OPERATIONS PVT. LTD.
# Compiler Version : v04.00.09
# Release Date : 19.01.2009
# FIMG VERSION : FIMGv1.5
# Optimizer Options : -O --nolodcalc
#-------------------------------------------------
# hand optimised - removed useless ops
ps_3_0
fimg_version 0x01020000
dcl_s2_tex s0
dcl_f4_col v1.x
dcl_f2_tex_c v0.x
label start
label main_
texld r0.xyzw, v0.xyzw, s0 # tex=s0
mul_sat oColor.xyzw, r0.wwww, v1.xyzw # gl_FragColor=oColor.xyzw, col=v1.xyzw
label main_end
ret
# 4 instructions, 4 C regs, 1 R regs
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_2133.asm | ljhsiun2/medusa | 9 | 95729 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r8
push %r9
push %rbp
push %rdx
// Faulty Load
lea addresses_WT+0x27ac, %r10
nop
nop
nop
nop
nop
sub %rbp, %rbp
mov (%r10), %dx
lea oracles, %rbp
and $0xff, %rdx
shlq $12, %rdx
mov (%rbp,%rdx,1), %rdx
pop %rdx
pop %rbp
pop %r9
pop %r8
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': True, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
♠ Spades/8 - Ada.ada | LoyaltyGamer72/Programmers-Playing-Cards | 80 | 30545 | <filename>♠ Spades/8 - Ada.ada
type Card is record
Rank : Integer;
Suit : String (1 .. 8);
end record;
This_Card : Card := (8, "spades "); |
Cubical/Categories/Adjoint.agda | Edlyr/cubical | 0 | 7198 | {-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Categories.Adjoint where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Sigma
open import Cubical.Categories.Category
open import Cubical.Categories.Functor
open import Cubical.Categories.NaturalTransformation
open import Cubical.Foundations.Isomorphism
open Functor
open Iso
open Precategory
{-
==============================================
Overview
==============================================
This module contains two definitions for adjoint
functors, and functions witnessing their
logical (and maybe eventually actual?)
equivalence.
-}
private
variable
ℓC ℓC' ℓD ℓD' : Level
{-
==============================================
Adjoint definitions
==============================================
We provide two alternative definitions for
adjoint functors: the unit-counit
definition, followed by the natural bijection
definition.
-}
module UnitCounit where
-- Adjoint def 1: unit-counit
record _⊣_ {C : Precategory ℓC ℓC'} {D : Precategory ℓD ℓD'} (F : Functor C D) (G : Functor D C)
: Type (ℓ-max (ℓ-max ℓC ℓC') (ℓ-max ℓD ℓD')) where
field
-- unit
η : 𝟙⟨ C ⟩ ⇒ (funcComp G F)
-- counit
ε : (funcComp F G) ⇒ 𝟙⟨ D ⟩
-- triangle identities
Δ₁ : PathP (λ i → NatTrans (F-lUnit {F = F} i) (F-rUnit {F = F} i))
(seqTransP F-assoc (F ∘ʳ η) (ε ∘ˡ F))
(1[ F ])
Δ₂ : PathP (λ i → NatTrans (F-rUnit {F = G} i) (F-lUnit {F = G} i))
(seqTransP (sym F-assoc) (η ∘ˡ G) (G ∘ʳ ε))
(1[ G ])
{-
Helper function for building unit-counit adjunctions between categories,
using that equality of natural transformations in a category is equality on objects
-}
module _ {ℓC ℓC' ℓD ℓD'}
{C : Precategory ℓC ℓC'} {D : Precategory ℓD ℓD'} {F : Functor C D} {G : Functor D C}
⦃ isCatC : isCategory C ⦄ ⦃ isCatD : isCategory D ⦄
(η : 𝟙⟨ C ⟩ ⇒ (funcComp G F))
(ε : (funcComp F G) ⇒ 𝟙⟨ D ⟩)
(Δ₁ : ∀ c → F ⟪ η ⟦ c ⟧ ⟫ ⋆⟨ D ⟩ ε ⟦ F ⟅ c ⟆ ⟧ ≡ D .id (F ⟅ c ⟆))
(Δ₂ : ∀ d → η ⟦ G ⟅ d ⟆ ⟧ ⋆⟨ C ⟩ G ⟪ ε ⟦ d ⟧ ⟫ ≡ C .id (G ⟅ d ⟆))
where
make⊣ : F ⊣ G
make⊣ ._⊣_.η = η
make⊣ ._⊣_.ε = ε
make⊣ ._⊣_.Δ₁ =
makeNatTransPathP F-lUnit F-rUnit
(funExt λ c → cong (D ._⋆_ (F ⟪ η ⟦ c ⟧ ⟫)) (transportRefl _) ∙ Δ₁ c)
make⊣ ._⊣_.Δ₂ =
makeNatTransPathP F-rUnit F-lUnit
(funExt λ d → cong (C ._⋆_ (η ⟦ G ⟅ d ⟆ ⟧)) (transportRefl _) ∙ Δ₂ d)
module NaturalBijection where
-- Adjoint def 2: natural bijection
record _⊣_ {C : Precategory ℓC ℓC'} {D : Precategory ℓD ℓD'} (F : Functor C D) (G : Functor D C) : Type (ℓ-max (ℓ-max ℓC ℓC') (ℓ-max ℓD ℓD')) where
field
adjIso : ∀ {c d} → Iso (D [ F ⟅ c ⟆ , d ]) (C [ c , G ⟅ d ⟆ ])
infix 40 _♭
infix 40 _♯
_♭ : ∀ {c d} → (D [ F ⟅ c ⟆ , d ]) → (C [ c , G ⟅ d ⟆ ])
(_♭) {_} {_} = adjIso .fun
_♯ : ∀ {c d} → (C [ c , G ⟅ d ⟆ ]) → (D [ F ⟅ c ⟆ , d ])
(_♯) {_} {_} = adjIso .inv
field
adjNatInD : ∀ {c : C .ob} {d d'} (f : D [ F ⟅ c ⟆ , d ]) (k : D [ d , d' ])
→ (f ⋆⟨ D ⟩ k) ♭ ≡ f ♭ ⋆⟨ C ⟩ G ⟪ k ⟫
adjNatInC : ∀ {c' c d} (g : C [ c , G ⟅ d ⟆ ]) (h : C [ c' , c ])
→ (h ⋆⟨ C ⟩ g) ♯ ≡ F ⟪ h ⟫ ⋆⟨ D ⟩ g ♯
{-
==============================================
Proofs of equivalence
==============================================
This first unnamed module provides a function
adj'→adj which takes you from the second
definition to the first.
The second unnamed module does the reverse.
-}
module _ {C : Precategory ℓC ℓC'} {D : Precategory ℓD ℓD'} (F : Functor C D) (G : Functor D C) where
open UnitCounit
open NaturalBijection renaming (_⊣_ to _⊣²_)
module _ (adj : F ⊣² G) where
open _⊣²_ adj
open _⊣_
-- Naturality condition implies that a commutative square in C
-- appears iff the transpose in D is commutative as well
-- Used in adj'→adj
adjNat' : ∀ {c c' d d'} {f : D [ F ⟅ c ⟆ , d ]} {k : D [ d , d' ]}
→ {h : C [ c , c' ]} {g : C [ c' , G ⟅ d' ⟆ ]}
-- commutativity of squares is iff
→ ((f ⋆⟨ D ⟩ k ≡ F ⟪ h ⟫ ⋆⟨ D ⟩ g ♯) → (f ♭ ⋆⟨ C ⟩ G ⟪ k ⟫ ≡ h ⋆⟨ C ⟩ g))
× ((f ♭ ⋆⟨ C ⟩ G ⟪ k ⟫ ≡ h ⋆⟨ C ⟩ g) → (f ⋆⟨ D ⟩ k ≡ F ⟪ h ⟫ ⋆⟨ D ⟩ g ♯))
adjNat' {c} {c'} {d} {d'} {f} {k} {h} {g} = D→C , C→D
where
D→C : (f ⋆⟨ D ⟩ k ≡ F ⟪ h ⟫ ⋆⟨ D ⟩ g ♯) → (f ♭ ⋆⟨ C ⟩ G ⟪ k ⟫ ≡ h ⋆⟨ C ⟩ g)
D→C eq = f ♭ ⋆⟨ C ⟩ G ⟪ k ⟫
≡⟨ sym (adjNatInD _ _) ⟩
((f ⋆⟨ D ⟩ k) ♭)
≡⟨ cong _♭ eq ⟩
(F ⟪ h ⟫ ⋆⟨ D ⟩ g ♯) ♭
≡⟨ sym (cong _♭ (adjNatInC _ _)) ⟩
(h ⋆⟨ C ⟩ g) ♯ ♭
≡⟨ adjIso .rightInv _ ⟩
h ⋆⟨ C ⟩ g
∎
C→D : (f ♭ ⋆⟨ C ⟩ G ⟪ k ⟫ ≡ h ⋆⟨ C ⟩ g) → (f ⋆⟨ D ⟩ k ≡ F ⟪ h ⟫ ⋆⟨ D ⟩ g ♯)
C→D eq = f ⋆⟨ D ⟩ k
≡⟨ sym (adjIso .leftInv _) ⟩
(f ⋆⟨ D ⟩ k) ♭ ♯
≡⟨ cong _♯ (adjNatInD _ _) ⟩
(f ♭ ⋆⟨ C ⟩ G ⟪ k ⟫) ♯
≡⟨ cong _♯ eq ⟩
(h ⋆⟨ C ⟩ g) ♯
≡⟨ adjNatInC _ _ ⟩
F ⟪ h ⟫ ⋆⟨ D ⟩ g ♯
∎
open NatTrans
-- note : had to make this record syntax because termination checker was complaining
-- due to referencing η and ε from the definitions of Δs
adj'→adj : ⦃ isCatC : isCategory C ⦄ ⦃ isCatD : isCategory D ⦄ → F ⊣ G
adj'→adj = record
{ η = η'
; ε = ε'
; Δ₁ = Δ₁'
; Δ₂ = Δ₂' }
where
-- ETA
-- trivial commutative diagram between identities in D
commInD : ∀ {x y} (f : C [ x , y ]) → (D .id _) ⋆⟨ D ⟩ F ⟪ f ⟫ ≡ F ⟪ f ⟫ ⋆⟨ D ⟩ (D .id _)
commInD f = (D .⋆IdL _) ∙ sym (D .⋆IdR _)
sharpen1 : ∀ {x y} (f : C [ x , y ]) → F ⟪ f ⟫ ⋆⟨ D ⟩ (D .id _) ≡ F ⟪ f ⟫ ⋆⟨ D ⟩ (D .id _) ♭ ♯
sharpen1 f = cong (λ v → F ⟪ f ⟫ ⋆⟨ D ⟩ v) (sym (adjIso .leftInv _))
η' : 𝟙⟨ C ⟩ ⇒ G ∘F F
η' .N-ob x = (D .id _) ♭
η' .N-hom f = sym (fst (adjNat') (commInD f ∙ sharpen1 f))
-- EPSILON
-- trivial commutative diagram between identities in C
commInC : ∀ {x y} (g : D [ x , y ]) → (C .id _) ⋆⟨ C ⟩ G ⟪ g ⟫ ≡ G ⟪ g ⟫ ⋆⟨ C ⟩ (C .id _)
commInC g = (C .⋆IdL _) ∙ sym (C .⋆IdR _)
sharpen2 : ∀ {x y} (g : D [ x , y ]) → (C .id _ ♯ ♭) ⋆⟨ C ⟩ G ⟪ g ⟫ ≡ (C .id _) ⋆⟨ C ⟩ G ⟪ g ⟫
sharpen2 g = cong (λ v → v ⋆⟨ C ⟩ G ⟪ g ⟫) (adjIso .rightInv _)
ε' : F ∘F G ⇒ 𝟙⟨ D ⟩
ε' .N-ob x = (C .id _) ♯
ε' .N-hom g = sym (snd adjNat' (sharpen2 g ∙ commInC g))
-- DELTA 1
expL : ∀ (c)
→ (seqTransP F-assoc (F ∘ʳ η') (ε' ∘ˡ F) .N-ob c)
≡ F ⟪ η' ⟦ c ⟧ ⟫ ⋆⟨ D ⟩ ε' ⟦ F ⟅ c ⟆ ⟧
expL c = seqTransP F-assoc (F ∘ʳ η') (ε' ∘ˡ F) .N-ob c
≡⟨ refl ⟩
seqP {C = D} {p = refl} (F ⟪ η' ⟦ c ⟧ ⟫) (ε' ⟦ F ⟅ c ⟆ ⟧)
≡⟨ seqP≡seq {C = D} _ _ ⟩
F ⟪ η' ⟦ c ⟧ ⟫ ⋆⟨ D ⟩ ε' ⟦ F ⟅ c ⟆ ⟧
∎
body : ∀ (c)
→ (idTrans F) ⟦ c ⟧ ≡ (seqTransP F-assoc (F ∘ʳ η') (ε' ∘ˡ F) .N-ob c)
body c = (idTrans F) ⟦ c ⟧
≡⟨ refl ⟩
D .id _
≡⟨ sym (D .⋆IdL _) ⟩
D .id _ ⋆⟨ D ⟩ D .id _
≡⟨ snd adjNat' (cong (λ v → (η' ⟦ c ⟧) ⋆⟨ C ⟩ v) (G .F-id)) ⟩
F ⟪ η' ⟦ c ⟧ ⟫ ⋆⟨ D ⟩ ε' ⟦ F ⟅ c ⟆ ⟧
≡⟨ sym (expL c) ⟩
seqTransP F-assoc (F ∘ʳ η') (ε' ∘ˡ F) .N-ob c
∎
Δ₁' : PathP (λ i → NatTrans (F-lUnit {F = F} i) (F-rUnit {F = F} i))
(seqTransP F-assoc (F ∘ʳ η') (ε' ∘ˡ F))
(1[ F ])
Δ₁' = makeNatTransPathP F-lUnit F-rUnit (sym (funExt body))
-- DELTA 2
body2 : ∀ (d)
→ seqP {C = C} {p = refl} ((η' ∘ˡ G) ⟦ d ⟧) ((G ∘ʳ ε') ⟦ d ⟧) ≡ C .id (G .F-ob d)
body2 d = seqP {C = C} {p = refl} ((η' ∘ˡ G) ⟦ d ⟧) ((G ∘ʳ ε') ⟦ d ⟧)
≡⟨ seqP≡seq {C = C} _ _ ⟩
((η' ∘ˡ G) ⟦ d ⟧) ⋆⟨ C ⟩ ((G ∘ʳ ε') ⟦ d ⟧)
≡⟨ refl ⟩
(η' ⟦ G ⟅ d ⟆ ⟧) ⋆⟨ C ⟩ (G ⟪ ε' ⟦ d ⟧ ⟫)
≡⟨ fst adjNat' (cong (λ v → v ⋆⟨ D ⟩ (ε' ⟦ d ⟧)) (sym (F .F-id))) ⟩
C .id _ ⋆⟨ C ⟩ C .id _
≡⟨ C .⋆IdL _ ⟩
C .id (G .F-ob d)
∎
Δ₂' : PathP (λ i → NatTrans (F-rUnit {F = G} i) (F-lUnit {F = G} i))
(seqTransP (sym F-assoc) (η' ∘ˡ G) (G ∘ʳ ε'))
(1[ G ])
Δ₂' = makeNatTransPathP F-rUnit F-lUnit (funExt body2)
module _ (adj : F ⊣ G) where
open _⊣_ adj
open _⊣²_
open NatTrans
-- helper functions for working with this Adjoint definition
δ₁ : ∀ {c} → (F ⟪ η ⟦ c ⟧ ⟫ ⋆⟨ D ⟩ ε ⟦ F ⟅ c ⟆ ⟧) ≡ D .id _
δ₁ {c} = (F ⟪ η ⟦ c ⟧ ⟫ ⋆⟨ D ⟩ ε ⟦ F ⟅ c ⟆ ⟧)
≡⟨ sym (seqP≡seq {C = D} _ _) ⟩
seqP {C = D} {p = refl} (F ⟪ η ⟦ c ⟧ ⟫) (ε ⟦ F ⟅ c ⟆ ⟧)
≡⟨ (λ j → (Δ₁ j) .N-ob c) ⟩
D .id _
∎
δ₂ : ∀ {d} → (η ⟦ G ⟅ d ⟆ ⟧ ⋆⟨ C ⟩ G ⟪ ε ⟦ d ⟧ ⟫) ≡ C .id _
δ₂ {d} = (η ⟦ G ⟅ d ⟆ ⟧ ⋆⟨ C ⟩ G ⟪ ε ⟦ d ⟧ ⟫)
≡⟨ sym (seqP≡seq {C = C} _ _) ⟩
seqP {C = C} {p = refl} (η ⟦ G ⟅ d ⟆ ⟧) (G ⟪ ε ⟦ d ⟧ ⟫)
≡⟨ (λ j → (Δ₂ j) .N-ob d) ⟩
C .id _
∎
adj→adj' : F ⊣² G
-- ∀ {c d} → Iso (D [ F ⟅ c ⟆ , d ]) (C [ c , G ⟅ d ⟆ ])
-- takes f to Gf precomposed with the unit
adj→adj' .adjIso {c = c} .fun f = η ⟦ c ⟧ ⋆⟨ C ⟩ G ⟪ f ⟫
-- takes g to Fg postcomposed with the counit
adj→adj' .adjIso {d = d} .inv g = F ⟪ g ⟫ ⋆⟨ D ⟩ ε ⟦ d ⟧
-- invertibility follows from the triangle identities
adj→adj' .adjIso {c = c} {d} .rightInv g
= η ⟦ c ⟧ ⋆⟨ C ⟩ G ⟪ F ⟪ g ⟫ ⋆⟨ D ⟩ ε ⟦ d ⟧ ⟫ -- step0 ∙ step1 ∙ step2 ∙ (C .⋆IdR _)
≡⟨ cong (λ v → η ⟦ c ⟧ ⋆⟨ C ⟩ v) (G .F-seq _ _) ⟩
η ⟦ c ⟧ ⋆⟨ C ⟩ (G ⟪ F ⟪ g ⟫ ⟫ ⋆⟨ C ⟩ G ⟪ ε ⟦ d ⟧ ⟫)
≡⟨ sym (C .⋆Assoc _ _ _) ⟩
η ⟦ c ⟧ ⋆⟨ C ⟩ G ⟪ F ⟪ g ⟫ ⟫ ⋆⟨ C ⟩ G ⟪ ε ⟦ d ⟧ ⟫
-- apply naturality
≡⟨ rPrecatWhisker {C = C} _ _ _ natu ⟩
(g ⋆⟨ C ⟩ η ⟦ G ⟅ d ⟆ ⟧) ⋆⟨ C ⟩ G ⟪ ε ⟦ d ⟧ ⟫
≡⟨ C .⋆Assoc _ _ _ ⟩
g ⋆⟨ C ⟩ (η ⟦ G ⟅ d ⟆ ⟧ ⋆⟨ C ⟩ G ⟪ ε ⟦ d ⟧ ⟫)
≡⟨ lPrecatWhisker {C = C} _ _ _ δ₂ ⟩
g ⋆⟨ C ⟩ C .id _
≡⟨ C .⋆IdR _ ⟩
g
∎
where
natu : η ⟦ c ⟧ ⋆⟨ C ⟩ G ⟪ F ⟪ g ⟫ ⟫ ≡ g ⋆⟨ C ⟩ η ⟦ G ⟅ d ⟆ ⟧
natu = sym (η .N-hom _)
adj→adj' .adjIso {c = c} {d} .leftInv f
= F ⟪ η ⟦ c ⟧ ⋆⟨ C ⟩ G ⟪ f ⟫ ⟫ ⋆⟨ D ⟩ ε ⟦ d ⟧
≡⟨ cong (λ v → v ⋆⟨ D ⟩ ε ⟦ d ⟧) (F .F-seq _ _) ⟩
F ⟪ η ⟦ c ⟧ ⟫ ⋆⟨ D ⟩ F ⟪ G ⟪ f ⟫ ⟫ ⋆⟨ D ⟩ ε ⟦ d ⟧
≡⟨ D .⋆Assoc _ _ _ ⟩
F ⟪ η ⟦ c ⟧ ⟫ ⋆⟨ D ⟩ (F ⟪ G ⟪ f ⟫ ⟫ ⋆⟨ D ⟩ ε ⟦ d ⟧)
-- apply naturality
≡⟨ lPrecatWhisker {C = D} _ _ _ natu ⟩
F ⟪ η ⟦ c ⟧ ⟫ ⋆⟨ D ⟩ (ε ⟦ F ⟅ c ⟆ ⟧ ⋆⟨ D ⟩ f)
≡⟨ sym (D .⋆Assoc _ _ _) ⟩
F ⟪ η ⟦ c ⟧ ⟫ ⋆⟨ D ⟩ ε ⟦ F ⟅ c ⟆ ⟧ ⋆⟨ D ⟩ f
-- apply triangle identity
≡⟨ rPrecatWhisker {C = D} _ _ _ δ₁ ⟩
(D .id _) ⋆⟨ D ⟩ f
≡⟨ D .⋆IdL _ ⟩
f
∎
where
natu : F ⟪ G ⟪ f ⟫ ⟫ ⋆⟨ D ⟩ ε ⟦ d ⟧ ≡ ε ⟦ F ⟅ c ⟆ ⟧ ⋆⟨ D ⟩ f
natu = ε .N-hom _
-- follows directly from functoriality
adj→adj' .adjNatInD {c = c} f k = cong (λ v → η ⟦ c ⟧ ⋆⟨ C ⟩ v) (G .F-seq _ _) ∙ (sym (C .⋆Assoc _ _ _))
adj→adj' .adjNatInC {d = d} g h = cong (λ v → v ⋆⟨ D ⟩ ε ⟦ d ⟧) (F .F-seq _ _) ∙ D .⋆Assoc _ _ _
|
45/beef/cw/kernel/krun.asm | minblock/msdos | 0 | 177000 | ;*
;* COW : Character Oriented Windows
;*
;* krun.asm : Run/Exec
TITLE KRUN - Kernel RUN
include kernel.inc
include galloc.inc
ifdef Exec_Alternate
include krun2.asm ;* REVIEW -- integrate better !!
else ; Use this file
.xlist
include pbi.inc
.list
;----------------------------------------------------------------------------
MovSeg MACRO srDest, srSrc
push srSrc
pop srDest
ENDM
;----------------------------------------------------------------------------
sBegin DATA
ifdef Debug
externB fCheckCwHeap
endif ; Debug
externW psLom
externW pGlobalHeap
externB fShellPresent ;* from kerninit.asm
ifndef NopCode
externW fNew ;* from interpreter
endif ; !NopCode
ifdef WINDOWS_OLD_APP
externW fWoaPresent
externW psDosRealloc
endif ; WINDOWS_OLD_APP
sEnd DATA
;----------------------------------------------------------------------------
IFDEF DEBPUB
PUBLIC FzGetEnv, ShrinkGlobalHeap, RestoreGlobalHeap
PUBLIC PromptMissingExec
ENDIF ;DEBPUB
IFDEF WINDOWS_OLD_APP
externFP <WoaToDos, WoaFromDos>
ENDIF ; WINDOWS_OLD_APP
;----------------------------------------------------------------------------
sBegin KERNEL
assumes DS,KERNEL
;* * data that MUST be in code space
ifdef QC_LINKER
globalD ShlLinkSave,? ;* save SS:SP
else ; ! QC_LINKER
staticW ssSave, ? ;* save SS
staticW spSave, ? ;* save SP
endif ; QCLINKER
;* * code strings
staticB szComspec, <"COMSPEC="> ;* COMSPEC name
cchComspec EQU $-szComspec
staticB szCmdProg, <"\COMMAND.COM", 0> ;* if COMSPEC not found
sEnd KERNEL
;----------------------------------------------------------------------------
externFPublic <AccessSwapFile> ;* for closing
externFPublic <PromptSwapDisk> ;* from App or stub.
;----------------------------------------------------------------------------
sBegin KERNEL
assumes CS,KERNEL
assumes DS,DGROUP
assumes SS,DATA
assumes ES,NOTHING
;********** PromptMissingExec **********
;* entry : lszPath = far pointer to path name
;* * Prompt for a missing EXEC program
;* * NOTE : this function must be in the EXIT module
;* exit : n/a (trashes SI/DI)
cProc PromptMissingExec, <FAR, ATOMIC>
parmD lszPath
cBegin PromptMissingExec
assumes DS,DGROUP
;* * assumes INIT module loaded (from call to BackToCow)
;* * this routine gets loaded from the EXIT module
;* * we will not swap from this point on (both INIT and EXIT resident)
;* * we must close the swap file in order to use the Kernel buffer
xor ax,ax
cCall AccessSwapFile,<ax>
ifndef NopCode
push fNew
endif ; !NopCode
mov es,psLom
lds si,lszPath
assumes DS,NOTHING
mov di,es:[offRlbLom] ;* ES:DI => far kernel buffer
push es
push di ;* TOS = lszPath
@@: lodsb
stosb
or al,al
jnz @B
MovSeg ds,ss
assumes DS,DGROUP
;* * (TOS) = lszPath
mov ax,-1 ;* special iexe for exec
push ax
cCall PromptSwapDisk ;* PromptSwapDisk(lszPath, -1);
mov ah,0DH
int 21h ;* reset disk to try again
ifndef NopCode
pop fNew ;* pcode may have changed fNew
endif ; !NopCode
cEnd PromptMissingExec
sEnd KERNEL
;----------------------------------------------------------------------------
sBegin EXIT
assumes CS,EXIT
assumes DS,NOTHING
assumes SS,DATA
;* * NOTE :
;* * GetEnv is in EXIT segment since LeaveCow will be called first
;********** FzGetEnv **********
;* entry : ES:DI => environment string to look for (with ending '=')
;* CX = length of string
;* * scan environment for Variable
;* exit : Z => DS:SI => contents on ENV variable
;* else NZ=> not found
;* * NOTE : uses AX/SI/DS
;*
cProc FzGetEnv,<FAR, ATOMIC>
cBegin FzGetEnv
AssertNE cx,0 ; Would produce a "found".
mov ds,psLom
mov ds,ds:[pdbLom.PDB_environ] ;* psEnvironment
assumes ds,nothing
xor si,si ;* ds:si => environment
cld
getenv_lp:
push di
push cx
repz cmpsb
pop cx
pop di
jz getenv_end
getenv_skip:
lodsb
or al,al
jnz getenv_skip
cmp byte ptr ds:[si],al ;* is this the real end ?
jnz getenv_lp
or cx,cx ;* NZ => not found
getenv_end:
cEnd FzGetEnv
assumes ds,nothing
sEnd EXIT
;----------------------------------------------------------------------------
externFP GlobalCompact
externFPublic <LeaveCow, BackToCow> ;* in INIT
;----------------------------------------------------------------------------
sBegin KERNEL
assumes CS,KERNEL
assumes DS,NOTHING
assumes SS,DATA
externNP <genter> ; GINTERF.ASM
externNP <gjoin,gmarkfree,gcheckfree> ; GALLOC.ASM
externNP <gnotify> ; GINTERF.ASM
;-----------------------------------------------
run_special_shell: ; It's up here to be within jcxz range.
mov ax,1801h ;* run shell
int 2fh ;* al = return code
xor ah,ah
jmp done_run_shell
;********** RerrExec **********
;* entry : szCmd = program name (or NULL => shell)
;* pchParm = parameter string:
;* Byte-length prefixed, 0Dh terminated.
;* Null is invalid, use 01,"0Dh" for subshell.
;* Use <length> "/C xxxxx" when szCmd == NULL.
;* rgchPrompt = "Press a key to resume MangoSoft$"; -1 if none.
;* fClearScreen = whether to clear it or not.
;* fRestoreScreenMode = whether to reset mode on way back in.
;* * shrink memory / run subshell / restore memory
;* exit : AX = 0 if ok, AX != 0 if error (interpreted as "rerr" code,
;* (see kmem.h).
;* DX = return code of child process (undefined if AX != 0)
cPublic RerrExec, <>, <DS, SI, DI> ;* NOT ATOMIC !
parmDP szCmd
parmDP pchParm
parmDP rgchPrompt ;* Dollar-sign terminated!
parmW fClearScreen
parmW fRestoreScreenMode
localD lszPath ;* far pointer to path
localV pbiT,<SIZE PBI> ;* parameter block
localW ChildCode
localW ExecCode
cBegin RerrExec
assumes DS,DGROUP
ifdef Debug
xor ax,ax ; Set fCheckCWHeap to false,
xchg al,fCheckCWHeap ; and push its old value.
push ax
endif ; Debug
;RetryRerrExec:
AssertNE pchParm,0 ;* NULL invalid
MovSeg es,cs
mov di,kernelOffset szComspec ;* ES:DI => string
mov cx,cchComspec
cCall FzGetEnv
assumes DS,NOTHING
jz got_comspec ;* DS:SI => comspec
MovSeg ds,cs
mov si,kernelOffset szCmdProg ;* use COMMAND.COM
got_comspec: ;* ds:si => path/file for COMMAND shell
mov OFF_lszPath,si
mov SEG_lszPath,ds
MovSeg ds,ss
assumes DS,DGROUP
cCall LeaveCow, <fClearScreen> ;* leave & maybe clear screen
cCall ShrinkGlobalHeap
mov di,pchParm ;* ss:di => string
;* * lszPath => cmd, SS:DI => parm.
;* * if szCmd != NULL then exec named program
mov cx,szCmd
jcxz exec_a_shell
mov OFF_lszPath,cx
mov SEG_lszPath,ss ;* szCmd
jmp short exec_command
exec_a_shell: ;* (ch == 0)
;* * if pchParm == "" then we can run a special shell if present
mov cl,fShellPresent ;* ch == 0.
jcxz exec_command
mov cl,ds:[di] ;* ds == ss, ch == 0.
ifdef QC_LINKER
jcxz F@
jmp short exec_command
F@: jmp run_special_shell
else ; !QC_LINKER
jcxz run_special_shell
endif ; QC_LINKER
exec_command:
;* * Exec a command (SS:DI => command line, lszPath => command).
;* * set up PBI
mov es,psLom
lea bx,pbiT
mov ax,es:[pdbLom+PDB_environ]
mov [bx].psEnviron,ax
mov [bx].offCmdLine,di
mov [bx].psCmdLine,ss ;* command (on stack)
mov [bx].offFcb1,5CH
mov [bx].psFcb1,es
mov [bx].offFcb2,6CH
mov [bx].psFcb2,es
;* * save the important part of the world
push ds
push bp
;* * Save DWORD PTR SS:[2E] since DOS 2.0 has a bug which thinks that SS
;* * is pointing to a PSP (and hence stuffs the old stack at this address)
push word ptr ss:[2EH]
push word ptr ss:[30H]
ifdef QC_LINKER
mov WORD PTR (ShlLinkSave+2),ss ;* Save SS
mov WORD PTR (ShlLinkSave),sp ;* Save SP
sub WORD PTR (ShlLinkSave),6 ;* Add some slop
else ; !QC_LINKER
mov ssSave,ss
mov spSave,sp
endif ; QC_LINKER
push ss
pop es
lds dx,lszPath ;* command path
mov ax,4B00H ;* exec : load + execute
int 21h
jc exec_error
xor ax,ax ;* no error
exec_error:
cli
ifdef QC_LINKER
mov ss, WORD PTR (ShlLinkSave+2) ;* Restore ss
mov sp, WORD PTR (ShlLInkSave) ;* Restore sp
add sp,6 ;* Remove slop
else ; ! QC_LINKER
mov ss,ssSave
mov sp,spSave
endif ; QC_LINKER
sti
pop word ptr ss:[30H]
pop word ptr ss:[2EH] ;* Dos 2.0 tromping restored
pop bp
pop ds
assumes DS,DGROUP
mov ExecCode,ax ;* save the exec return code
mov ChildCode,0 ;* init the child return code
cmp ax,2 ;* If file not found, then
je done_run_shell ;* don't bother with prompt
; je run_shell_not_found
mov dx,rgchPrompt ;* ds:dx -> "Press a key$"
or ax,ax ;* Don't get the child code
jnz CheckPrompt ;* if Exec failed.
mov ah,4Dh
int 21h
mov ChildCode,ax ;* save the child return code
ifndef FOR_QC ;* This should be ifdef'ed for project
cmp ax,4 ;* This is Word's special
je DoPrompt ;* "Do Prompt" return code.
endif ; !FOR_QC
CheckPrompt:
cmp dx,-1
je done_run_shell
DoPrompt:
mov ah,09h
int 21h ; Prompt to press any key
mov ax,0C07h
int 21h ; Wait for key input
done_run_shell:
;* * restore everything (and repaint screen)
cCall RestoreGlobalHeap
;* * the following call calls an INIT procedure
cCall BackToCow,<fRestoreScreenMode> ;* in INIT segment
ifdef Debug
pop ax ; Restore fCheckCWHeap to
mov fCheckCWHeap,al ; its old value.
endif ; Debug
mov ax,ExecCode ;* restore these for
mov dx,ChildCode ;* return values.
cEnd RerrExec
;* * special case if exec program is not found
;run_shell_not_found:
; cCall RestoreGlobalHeap
;;* * re-init CW for windowing
; cCall BackToCow ;* Load in INIT module
; cCall PromptMissingExec, <lszPath>
;
; jmp RetryRerrExec ;* retry
;-----------------------------------------------
;********** ShrinkGlobalHeap **********
;* entry : n/a
;* * shrink the global heap
;* exit : n/a
;* * NOTE : this code must be fixed since it throws everything out.
cProc ShrinkGlobalHeap, <NEAR, ATOMIC>, <DS, SI, DI>
cBegin ShrinkGlobalHeap
assumes DS,DGROUP
IFDEF WINDOWS_OLD_APP
;*
;* If win-old-app model is present then claim as much as
;* possible from it. It will also modify the address
;* which is to be used for reallocing the segment.
;*
cmp fWoaPresent,0
jz @F
cCall WoaToDos ;* Shut down win-old-app code
@@:
ENDIF ; WINDOWS_OLD_APP
;* * compact the heap (removing any free gaps) -- throw out code as well
mov es,pGlobalHeap
xor di,di
mov ax,1 ;* 1 reserved para
;* NOTE : kludge to get all code
;* discarded !!!
xchg ax,es:[di].gi_reserve ;* get old reserve
push ax
mov ax,-1
cCall GlobalCompact,<ax, ax> ;* (-1) throw everything out
mov es,pGlobalHeap
pop es:[di].gi_reserve ;* restore reserve size
mov es,es:[di].hi_last ;* es => end sentinal
mov dx,es
;* * scan from end till finding free block
find_free_loop:
mov es,es:[di].ga_prev ;* next block
mov cx,es:[di].ga_owner
jcxz found_free ;* 0 owner => free
inc cx
jnz find_free_loop ;* -1 owner => MOB or sentinal (stop)
jmp end_shrink ;* can't shrink
found_free:
;* * es:0 => free block, dx:0 => end sentinal
cmp es:[di].ga_next,dx
je dont_move_bound
;* * move the bound segments from high to low memory
mov ds,es:[di].ga_next ;* 1 after block
assumes ds,NOTHING
mov dx,es:[di].ga_prev
move_bound_seg_loop:
;* ds:0 => source, es:0 => dest
;* dx = prev link
mov ds:[di].ga_prev,dx
mov dx,ds
mov cx,ds:[di].ga_next
sub cx,dx
mov ax,es
add ax,cx ;* ax = new dest
;* * move from source to dest (dest before source => move up)
xor si,si
shl cx,1
shl cx,1
shl cx,1 ;* cpara -> cw (<64K blocks)
rep movsw ;* move arena + data
xor di,di
;* * notify everyone
push ds
push es
push ax
mov al,GN_MOVE
mov bx,es:[di].ga_handle ;* handle
mov cx,es
inc cx ;* psNew
mov dx,es:[di].ga_owner ;* set up owner for gnotify
mov ds,pGlobalHeap
push cx ;* new address
push bx ;* handle
call gnotify ; Call global notify procedure
pop bx
pop ds:[bx].he_address
pop ax
pop es
pop ds
;* * update link to next
mov dx,es ;* next link
mov bx,ax
xchg ax,es:[di].ga_next
mov es,bx ;* next destination
mov ds,ax ;* next block
cmp ds:[di].ga_owner,-1 ;* stop at sentinal
jne move_bound_seg_loop
;* * ds:0 => end sentinal, es:0 => where sentinal should be
mov bx,es
mov ds,bx
mov ds:[di].ga_prev,dx ;* back link
jmp update_end_sentinal
dont_move_bound:
;* * at the end of the heap MUST be a free block of a reasonably
;* * large size (the free block due to freeing all code)
cCall genter ;* DS:DI => mob
assumes ds,NOTHING
mov es,ds:[di].hi_last ;* pointer to sentinal
mov cx,es ;* last block
mov bx,es:[di].ga_prev ;* must be a free block
mov ds,bx
cmp ds:[di].ga_owner,0
jne end_shrink
;* * es:di => free block that should be sentinal
mov es,cx ;* es:di =>old sentinal
ifdef Debug
;* * check out state of old sentinal
cmp es:[di].ga_sig,GA_ENDSIG
je ok_old_sent
bad_old_sent:
bad_new_sent:
int 3
ok_old_sent:
cmp es:[di].ga_owner,-1
jne bad_old_sent
cmp es:[di].ga_size,GA_ALIGN
jne bad_old_sent
cmp es:[di].ga_flags,0
jne bad_old_sent
;* * check new sentinal
cmp ds:[di].ga_sig,GA_SIGNATURE
jne bad_new_sent
endif ; Debug
update_end_sentinal: ; ds==bx == para address of end block
mov ds:[di].ga_sig,GA_ENDSIG
mov ds:[di].ga_owner,-1
mov ds:[di].ga_size,GA_ALIGN
mov ds:[di].ga_flags,0
mov ds:[di].ga_next,ds ;* link to self
cCall genter ;* DS:DI => mob
mov ds:[di].hi_last,bx ;* now the last block
dec ds:[di].hi_count ;* remove free object
;* * now free up anything to DOS
IFDEF WINDOWS_OLD_APP
mov ax,psDosRealloc
ELSE ; !WINDOWS_OLD_APP
mov ax,psLom ;* 1 big block
ENDIF ; WINDOWS_OLD_APP
mov es,ax
sub bx,ax ;* size of new block (in para)
add bx,1+cparaRunShell ;* add slush (+1 to keep end sentinal)
mov ah,4ah ;* modify allocated memory
int 21h
;* * resume with smaller global heap
end_shrink:
cEnd ShrinkGlobalHeap
;-----------------------------------------------
;********** RestoreGlobalHeap **********
;* entry : n/a
;* * restore global heap after ShrinkGlobalHeap
;* exit : n/a
cProc RestoreGlobalHeap, <NEAR, ATOMIC>, <DS, SI, DI>
cBegin RestoreGlobalHeap
assumes ds,DGROUP
;* * modify block to make as large as possible
IFDEF WINDOWS_OLD_APP
mov es,psDosRealloc
ELSE ; !WINDOWS_OLD_APP
mov es,psLom ;* 1 big block
ENDIF ; WINDOWS_OLD_APP
mov bx,0ffffh ;* i want it all
mov ah,4ah
int 21h
ifdef Debug
jc ok_we_asked_for_too_much
int 3 ;* we got 1MB ???
ok_we_asked_for_too_much:
endif ; Debug
;* * now do it for real
mov ah,4ah
int 21h
ifdef Debug
jnc ok_we_got_it_back
int 3 ;* we got 1MB ???
ok_we_got_it_back:
endif ; Debug
;* * get address of new end sentinal
mov ax,es
add ax,bx ;* ax = new end
;* * check to make sure we are within the useable limits
IFDEF WINDOWS_OLD_APP
mov es,psLom
ENDIF ; WINDOWS_OLD_APP
cmp ax,es:[psUseMax]
jb have_high_limit
;* * we must adjust our block size (free the rest to DOS)
;* * (not efficient -- clean up later)
mov bx,es:[psUseMax]
push bx ;* limit
mov ax,es
sub bx,ax ;* size we will use
mov ah,4AH
int 21h ;* modify memory size
pop ax
AssertEQ ax,es:[psUseMax]
have_high_limit:
sub ax,GA_ALIGN ;* room for arena
and al,LOW(GA_MASK) ;* make even
mov ds,ax ;* es => new sentinal
assumes ds,NOTHING
;* * create new sentinal
xor bx,bx
mov ds:[bx].ga_sig,GA_ENDSIG
mov ds:[bx].ga_owner,-1 ;* sentinal
mov ds:[bx].ga_size,GA_ALIGN
mov ds:[bx].ga_flags,bl
mov ds:[bx].ga_handle,bx ;* no handle
mov ds:[bx].ga_next,ds ;* link to self
mov cx,ax ;* psNew
cCall genter ;* DS:DI => mob
xchg ax,ds:[bx].hi_last ;* set new last, get old
inc ds:[di].hi_count ;* adding free object
mov ds,ax
mov es,cx
mov es:[bx].ga_prev,ds ;* link to other free
ifdef Debug
cmp ds:[bx].ga_sig,GA_ENDSIG
je ok_end_sig
int 3
ok_end_sig:
endif ; Debug
sub cx,ax ;* psNew - psOld
sub cx,GA_ALIGN ;* less overhead
mov ds:[bx].ga_sig,GA_SIGNATURE
mov ds:[bx].ga_owner,bx ;* FREE !!!
mov ds:[bx].ga_flags,GA_MOVEABLE
mov ds:[bx].ga_size,cx ;* new size
mov ds:[bx].ga_next,es ;* point to new sentinal
IFDEF WINDOWS_OLD_APP
;* Restore win-old-app model if present
cmp fWoaPresent,0 ;* Is win-old-app segment present?
jz @F ;* No -- skip around
mov ax,DGROUP ;* Calling c procedure
mov ds,ax ;*
cCall WoaFromDos ;* Restore win-old-app code
@@:
ENDIF ; WINDOWS_OLD_APP
cEnd RestoreGlobalHeap
sEnd KERNEL
endif ; !Exec_Alternate
;*****************************************************************************
sBegin INIT
assumes CS,INIT
assumes DS,DGROUP
assumes SS,DGROUP
;********** GetProgDir **********
;* entry : szBuff => string buffer to put path name
;* (must be 66 characters or longer)
;* * copy startup directory to this near buffer
;* exit : n/a
assumes DS,DGROUP
cPublic GetProgDir, <ATOMIC>, <DS, SI, DI>
parmDP szBuff
cBegin GetProgDir
push ds
pop es ;* destination a near pointer
assumes ES,NOTHING
mov di,szBuff
mov ds,psLom
assumes DS,NOTHING
mov si,lomOffset szBootPathLom
@@: lodsb
stosb
or al,al
jnz @B ;* assumes zero terminated
szBPL equ lomOffset szBootPathLom
szBPLRoot equ szBPL + 4
cmp si,szBPLRoot
je AtRoot
mov es:[di-2],al
AtRoot:
cEnd GetProgDir
sEnd INIT
;*****************************************************************************
END
|
programs/oeis/166/A166060.asm | karttu/loda | 0 | 92861 | ; A166060: 4*3^n - 3*2^n.
; 1,6,24,84,276,876,2724,8364,25476,77196,233124,702444,2113476,6352716,19082724,57297324,171990276,516167436,1548895524,4647473004,13943991876,41835121356,125511655524,376547549484,1129667814276,3389053774476,10167261986724,30501987286764,91506364513476,274519898846796,823561307153124,2470687142684844,7412067870505476
mov $1,1
mov $3,2
lpb $0,1
sub $0,1
mul $1,2
add $2,$3
add $3,$2
add $1,$3
mov $2,$3
lpe
|
examples/AssemblerFuck.asm | JStearsman/hello-worlds | 81 | 176637 | <reponame>JStearsman/hello-worlds
ADD 8
UNTIL 0
MOV RIGHT, P
ADD 4
UNTIL 0
MOV RIGHT, P
ADD 2
MOV RIGHT, P
ADD 3
MOV RIGHT, P
ADD 3
MOV RIGHT, P
ADD 1
MOV LEFT, P
MOV LEFT, P
MOV LEFT, P
MOV LEFT, P
SUB 1
END
MOV RIGHT, P
ADD 1
MOV RIGHT, P
ADD 1
MOV RIGHT, P
SUB 1
MOV RIGHT, P
MOV RIGHT, P
ADD 1
UNTIL 0
MOV RIGHT, P
END
MOV LEFT, P
SUB 1
END
MOV RIGHT, P
MOV RIGHT, P
MOV OUT, P
MOV RIGHT, P
SUB 3
MOV OUT, P
ADD 7
MOV OUT, P
MOV OUT, P
ADD 3
MOV OUT, P
MOV RIGHT, P
MOV RIGHT, P
MOV OUT, P
MOV LEFT, P
SUB 1
MOV OUT, P
MOV LEFT, P
MOV OUT, P
ADD 3
MOV OUT, P
SUB 6
MOV OUT, P
SUB 8
MOV OUT, P
MOV RIGHT, P
MOV RIGHT, P
ADD 1
MOV OUT, P
MOV RIGHT, P
ADD 2
MOV OUT, P
|
4.0.x/LongVarHUD/HudUpdate_LongHudSupport.asm | chronosv2/NESMaker_Public_Code_Repository | 6 | 8706 | ;Addition to support "Long HUD" Items
LDA LongHudVar
STA hudElementTilesToLoad
LDA #$00
STA hudElementTilesMax
;End Addition
;;; So what does this stuff do?
;;; You can only update one HUD item at a time per frame.
;;; If you set both HUD bits to 1 and give this second variable, when the first HUD update completes
;;; it'll update the second one with the value in LongHudVar on the next frame.
|
src/open_weather_map-api-service-weather.ads | Jellix/open_weather_map_api | 1 | 18635 | <reponame>Jellix/open_weather_map_api
--------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>)
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
--------------------------------------------------------------------------------
pragma License (Unrestricted);
--------------------------------------------------------------------------------
--% @summary
--% Open_Weather_Map.API.Service.Weather
--
--% @description
--% Provides the query object implementing a single id based query.
--------------------------------------------------------------------------------
package Open_Weather_Map.API.Service.Weather is
-----------------------------------------------------------------------------
-- API: Current weather data (by city ID)
-----------------------------------------------------------------------------
type T is new Service.T with private;
-----------------------------------------------------------------------------
-- Initialize
-----------------------------------------------------------------------------
procedure Initialize
(Self : out T;
Configuration : in GNATCOLL.JSON.JSON_Value;
Connection : not null Client.T_Access;
Max_Cache_Interval : in Ada.Real_Time.Time_Span := Default_Cache_Interval;
Id : in City_Id);
--% Initializes an instance of a single query.
--
--% @param Self
--% Instance of the single query to initialize.
--
--% @param Configuration
--% Configuration data object containing connection relevant data (proxy
--% server, API key, etc.).
--
--% @param Connection
--% The connection to be used for client server communication.
--
--% @param Max_Cache_Interval
--% Denotes the maximum frequency at which actual queries are being sent to
--% the server.
--
--% @param Id
--% Location id of the place to be queried.
private
type T is new API. Service.T with null record;
-----------------------------------------------------------------------------
-- Decode_Response
-----------------------------------------------------------------------------
overriding function Decode_Response
(Self : in T;
Root : in GNATCOLL.JSON.JSON_Value) return Data_Set;
--% Decodes a single query response from the server.
--
--% @param Self
--% The single query instance.
--
--% @param Root
--% Root of the JSON data sent back by the server.
--
--% @return
--% The data set decoded from the response in Root.
end Open_Weather_Map.API.Service.Weather;
|
anims_zx.asm | jorgicor/altair | 0 | 4423 | ; ----------------------------------------------------------------------------
; Altair, CIDLESA's 1981 arcade game remade for the ZX Spectrum and
; Amstrad CPC.
; ----------------------------------------------------------------------------
ashot_am .db 2
.dw shot_it0, WHITE
.dw shot_it1, WHITE
fire_am .db 2
.dw fire_it0, RED
.dw fire_it0, YELLOW
explosion_am .db 5
.dw explosion_it0, RED
.dw explosion_it1, YELLOW
.dw explosion_it2, RED
.dw explosion_it1, YELLOW
.dw explosion_it0, RED
bird_grid_am .db 4
.dw bird_grid_it0, WHITE
.dw bird_grid_it1, WHITE
.dw bird_grid_it2, WHITE
.dw bird_grid_it3, WHITE
bird_lwing_am .db 2
.dw bird_lwing0_it, bird_wing_co
.dw bird_lwing1_it, bird_wing_co
bird_rwing_am .db 2
.dw bird_rwing0_it, bird_wing_co
.dw bird_rwing1_it, bird_wing_co
alien_am0 .db 2
.dw alient0, YELLOW
.dw alient1, YELLOW
alien_am1 .db 2
.dw alient0, CYAN
.dw alient1, CYAN
alien_am2 .db 2
.dw alient0, MAGENT
.dw alient1, MAGENT
alien_am3 .db 2
.dw alient0, WHITE
.dw alient0, GREEN
alien_am4 .db 2
.dw alient0, YELLOW
.dw alient1, YELLOW
alien_am5 .db 2
.dw alient0, RED
.dw alient1, RED
alien_am6 .db 2
.dw alient0, YELLOW
.dw alient0, GREEN
|
libsrc/_DEVELOPMENT/alloc/obstack/c/sdcc_iy/obstack_alloc_callee.asm | jpoikela/z88dk | 640 | 85407 |
; void *obstack_alloc_callee(struct obstack *ob, size_t size)
SECTION code_clib
SECTION code_alloc_obstack
PUBLIC _obstack_alloc_callee
EXTERN asm_obstack_alloc
_obstack_alloc_callee:
pop af
pop hl
pop bc
push af
jp asm_obstack_alloc
|
macros/scripts/audio.asm | AtmaBuster/pokeoctober | 1 | 164912 | channel_count: MACRO
assert 0 < (\1) && (\1) <= NUM_MUSIC_CHANS, \
"channel_count must be 1-{d:NUM_MUSIC_CHANS}"
_num_channels = \1 - 1
ENDM
channel: MACRO
assert 0 < (\1) && (\1) <= NUM_CHANNELS, \
"channel id must be 1-{d:NUM_CHANNELS}"
dn (_num_channels << 2), \1 - 1 ; channel id
dw \2 ; address
_num_channels = 0
ENDM
note: MACRO
dn (\1), (\2) - 1 ; pitch, length
ENDM
drum_note: MACRO
note \1, \2 ; drum instrument, length
ENDM
rest: MACRO
note 0, \1 ; length
ENDM
square_note: MACRO
db \1 ; length
if \3 < 0
dn \2, %1000 | (\3 * -1) ; volume envelope
else
dn \2, \3 ; volume envelope
endc
dw \4 ; frequency
ENDM
noise_note: MACRO
db \1 ; length
if \3 < 0
dn \2, %1000 | (\3 * -1) ; volume envelope
else
dn \2, \3 ; volume envelope
endc
db \4 ; frequency
ENDM
; MusicCommands indexes (see audio/engine.asm)
const_def $d0
FIRST_MUSIC_CMD EQU const_value
const octave_cmd ; $d0
octave: MACRO
assert 1 <= (\1) && (\1) <= 8, "octave must be 1-8"
db octave_cmd + 8 - (\1) ; octave
ENDM
const_value = const_value + 1 ; all octave values
const note_type_cmd ; $d8
note_type: MACRO
db note_type_cmd
db \1 ; note length
if _NARG >= 2
if \3 < 0
dn \2, %1000 | (\3 * -1) ; volume envelope
else
dn \2, \3 ; volume envelope
endc
endc
ENDM
; only valid on the noise channel
drum_speed: MACRO
note_type \1 ; note length
ENDM
const transpose_cmd ; $d9
transpose: MACRO
db transpose_cmd
dn \1, \2 ; num octaves, num pitches
ENDM
const tempo_cmd ; $da
tempo: MACRO
db tempo_cmd
bigdw \1 ; tempo
ENDM
const duty_cycle_cmd ; $db
duty_cycle: MACRO
db duty_cycle_cmd
db \1 ; duty cycle
ENDM
const volume_envelope_cmd ; $dc
volume_envelope: MACRO
db volume_envelope_cmd
if \2 < 0
dn \1, %1000 | (\2 * -1) ; volume envelope
else
dn \1, \2 ; volume envelope
endc
ENDM
const pitch_sweep_cmd ; $dd
pitch_sweep: MACRO
db pitch_sweep_cmd
if \2 < 0
dn \1, %1000 | (\2 * -1) ; pitch sweep
else
dn \1, \2 ; pitch sweep
endc
ENDM
const duty_cycle_pattern_cmd ; $de
duty_cycle_pattern: MACRO
db duty_cycle_pattern_cmd
db (\1 << 6) | (\2 << 4) | (\3 << 2) | (\4 << 0) ; duty cycle pattern
ENDM
const toggle_sfx_cmd ; $df
toggle_sfx: MACRO
db toggle_sfx_cmd
ENDM
const pitch_slide_cmd ; $e0
pitch_slide: MACRO
db pitch_slide_cmd
db \1 - 1 ; duration
dn 8 - \2, \3 % 12 ; octave, pitch
ENDM
const vibrato_cmd ; $e1
vibrato: MACRO
db vibrato_cmd
db \1 ; delay
if _NARG > 2
dn \2, \3 ; extent, rate
else
db \2 ; LEGACY: Support for 1-arg extent
endc
ENDM
const unknownmusic0xe2_cmd ; $e2
unknownmusic0xe2: MACRO
db unknownmusic0xe2_cmd
db \1 ; unknown
ENDM
const toggle_noise_cmd ; $e3
toggle_noise: MACRO
db toggle_noise_cmd
if _NARG > 0
db \1 ; drum kit
endc
ENDM
const force_stereo_panning_cmd ; $e4
force_stereo_panning: MACRO
db force_stereo_panning_cmd
dn %1111 * (1 && \1), %1111 * (1 && \2) ; left enable, right enable
ENDM
const volume_cmd ; $e5
volume: MACRO
db volume_cmd
if _NARG > 1
dn \1, \2 ; left volume, right volume
else
db \1 ; LEGACY: Support for 1-arg volume
endc
ENDM
const pitch_offset_cmd ; $e6
pitch_offset: MACRO
db pitch_offset_cmd
bigdw \1 ; pitch offset
ENDM
const unknownmusic0xe7_cmd ; $e7
unknownmusic0xe7: MACRO
db unknownmusic0xe7_cmd
db \1 ; unknown
ENDM
const unknownmusic0xe8_cmd ; $e8
unknownmusic0xe8: MACRO
db unknownmusic0xe8_cmd
db \1 ; unknown
ENDM
const tempo_relative_cmd ; $e9
tempo_relative: MACRO
db tempo_relative_cmd
bigdw \1 ; tempo adjustment
ENDM
const restart_channel_cmd ; $ea
restart_channel: MACRO
db restart_channel_cmd
dw \1 ; address
ENDM
const new_song_cmd ; $eb
new_song: MACRO
db new_song_cmd
bigdw \1 ; id
ENDM
const sfx_priority_on_cmd ; $ec
sfx_priority_on: MACRO
db sfx_priority_on_cmd
ENDM
const sfx_priority_off_cmd ; $ed
sfx_priority_off: MACRO
db sfx_priority_off_cmd
ENDM
const unknownmusic0xee_cmd ; $ee
unknownmusic0xee: MACRO
db unknownmusic0xee_cmd
dw \1 ; address
ENDM
const stereo_panning_cmd ; $ef
stereo_panning: MACRO
db stereo_panning_cmd
dn %1111 * (1 && \1), %1111 * (1 && \2) ; left enable, right enable
ENDM
const sfx_toggle_noise_cmd ; $f0
sfx_toggle_noise: MACRO
db sfx_toggle_noise_cmd
if _NARG > 0
db \1 ; drum kit
endc
ENDM
const music0xf1_cmd ; $f1
music0xf1: MACRO
db music0xf1_cmd
ENDM
const music0xf2_cmd ; $f2
music0xf2: MACRO
db music0xf2_cmd
ENDM
const music0xf3_cmd ; $f3
music0xf3: MACRO
db music0xf3_cmd
ENDM
const music0xf4_cmd ; $f4
music0xf4: MACRO
db music0xf4_cmd
ENDM
const music0xf5_cmd ; $f5
music0xf5: MACRO
db music0xf5_cmd
ENDM
const music0xf6_cmd ; $f6
music0xf6: MACRO
db music0xf6_cmd
ENDM
const music0xf7_cmd ; $f7
music0xf7: MACRO
db music0xf7_cmd
ENDM
const music0xf8_cmd ; $f8
music0xf8: MACRO
db music0xf8_cmd
ENDM
const unknownmusic0xf9_cmd ; $f9
unknownmusic0xf9: MACRO
db unknownmusic0xf9_cmd
ENDM
const set_condition_cmd ; $fa
set_condition: MACRO
db set_condition_cmd
db \1 ; condition
ENDM
const sound_jump_if_cmd ; $fb
sound_jump_if: MACRO
db sound_jump_if_cmd
db \1 ; condition
dw \2 ; address
ENDM
const sound_jump_cmd ; $fc
sound_jump: MACRO
db sound_jump_cmd
dw \1 ; address
ENDM
const sound_loop_cmd ; $fd
sound_loop: MACRO
db sound_loop_cmd
db \1 ; count
dw \2 ; address
ENDM
const sound_call_cmd ; $fe
sound_call: MACRO
db sound_call_cmd
dw \1 ; address
ENDM
const sound_ret_cmd ; $ff
sound_ret: MACRO
db sound_ret_cmd
ENDM
endchannel_cmd EQU const_value
endchannel: MACRO
db endchannel_cmd
ENDM
|
rom/src/sgb_border.asm | Gegel85/GBCGoogleMaps | 0 | 103395 | DATA_PART_1::
db $5D, $08, $00, $0B, $8C, $D0, $F4, $60, $00, $00, $00, $00, $00, $00, $00
DATA_PART_2::
db $52, $08, $00, $0B, $A9, $E7, $9F, $01, $C0, $7E, $E8, $E8, $E8, $E8, $E0
DATA_PART_3::
db $47, $08, $00, $0B, $C4, $D0, $16, $A5, $CB, $C9, $05, $D0, $10, $A2, $28
DATA_PART_4::
db $3C, $08, $00, $0B, $F0, $12, $A5, $C9, $C9, $C8, $D0, $1C, $A5, $CA, $C9
DATA_PART_5::
db $31, $08, $00, $0B, $0C, $A5, $CA, $C9, $7E, $D0, $06, $A5, $CB, $C9, $7E
DATA_PART_6::
db $26, $08, $00, $0B, $39, $CD, $48, $0C, $D0, $34, $A5, $C9, $C9, $80, $D0
DATA_PART_7::
db $1B, $08, $00, $0B, $EA, $EA, $EA, $EA, $EA, $A9, $01, $CD, $4F, $0C, $D0
DATA_PART_8::
db $10, $08, $00, $0B, $4C, $20, $08, $EA, $EA, $EA, $EA, $EA, $60, $EA, $EA
SECTION "SGBBorder", ROMX[$4000], BANK[2]
SGBBorderTileMap::
incbin "assets/border.sgbmap"
SECTION "SGBBorderPals", ROMX[$4800], BANK[2]
SGBBorderPalettes::
incbin "assets/border.sgbpal"
SGBBorderTileCharacters::
incbin "assets/border.sgbchr"
|
archive/agda-3/src/Test/ProblemWithLevelZero.agda | m0davis/oscar | 0 | 5498 | {-# OPTIONS --allow-unsolved-metas #-}
open import Everything
module Test.ProblemWithLevelZero where
module _ (𝔓 : Ø₀) where
open Substitunction 𝔓
open Term 𝔓
fails : ∀ {m n} (f : Substitunction m n) → Substitunction m n
fails f = transitivity f ε -- FIXME
refl-works : ∀ {m} → Substitunction m m
refl-works = ε
solution-1o solution-1a solution-2o solution-2a :
∀ {m n} (f : Substitunction m n) → Substitunction m n
solution-1o f = transitivity {𝔒 = ¶} f ε
solution-1a f = transitivity[ Substitunction ] f ε
solution-2o f = transitivity {𝔒 = Ø₀} f ε
solution-2a f = transitivity[ Function ] f ε
transitivity-hole : ∀ {m n} (f : Substitunction m n) → Substitunction m n
transitivity-hole f =
transitivity
⦃ {!!!} -- FIXME does not resolve instance
⦄
f
{!!}
|
tests/tk-toplevel-toplevel_create_options_test_data.ads | thindil/tashy2 | 2 | 3142 | <reponame>thindil/tashy2
-- This package is intended to set up and tear down the test environment.
-- Once created by GNATtest, this package will never be overwritten
-- automatically. Contents of this package can be modified in any way
-- except for sections surrounded by a 'read only' marker.
with Tk.TopLevel.TopLevel_Options_Test_Data.Toplevel_Options_Tests;
with GNATtest_Generated;
package Tk.TopLevel.TopLevel_Create_Options_Test_Data is
-- begin read only
type Test_TopLevel_Create_Options is new GNATtest_Generated
.GNATtest_Standard
.Tk
.TopLevel
.TopLevel_Options_Test_Data
.TopLevel_Options_Tests
.Test_TopLevel_Options
-- end read only
with
null record;
procedure Set_Up(Gnattest_T: in out Test_TopLevel_Create_Options);
procedure Tear_Down(Gnattest_T: in out Test_TopLevel_Create_Options);
end Tk.TopLevel.TopLevel_Create_Options_Test_Data;
|
src/main/antlr4/mx/infotec/dads/kukulkan/grammar/kukulkan.g4 | dads-software-brotherhood/kukulkan-grammar | 0 | 5935 | <reponame>dads-software-brotherhood/kukulkan-grammar
/*
[The "BSD licence"]
Copyright (c) 2017 <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** A kukulkan grammar 1.0 for ANTLR v4.
*
* @autor: <NAME>
*
* Grammar used in the kukulkan-core generator
*
*/
grammar kukulkan;
/**
* Domain Model Rule
*/
domainModel
:
entities += entity+
| settings += option
;
/**
* Entity Rule
*
*/
entity
:
'entity' name = ID
(
'(' tableName = ID ')'
)?
(
'{'
(
fields += entityField
(
','? fields += entityField
)*
)? '}'
)?
;
/**
* Entity Field Rule
*
*/
entityField
:
id = ID type = fieldType
;
/**
* Field Type Rule
*
*/
fieldType
:
stringFieldType
| numericFieldType
| booleanFieldType
| dateFieldType
| blobFieldType
| entityType
;
/**
* Entity Type Rule
*
*/
entityType
:
entity
;
/**
* String Field Type Rule
*
*/
stringFieldType
:
name = stringType constraints += stringValidators*
;
/**
* String Type Rule
*
*/
stringType
:
'String'
;
/**
* Numeric Field Type Rule
*
*/
numericFieldType
:
name = numericTypes constraints += numericValidators*
;
/**
* Numeric Types Rule
*
*/
numericTypes
:
INTEGER
| LONG
| BIG_DECIMAL
| FLOAT
| DOUBLE
;
/**
* INTEGER Token
*
*/
INTEGER
:
'Integer'
;
/**
* LONG Token
*
*/
LONG
:
'Long'
;
/**
* BIG_DECIMAL Token
*
*/
BIG_DECIMAL
:
'BigDecimal'
;
/**
* FLOAT Token
*
*/
FLOAT
:
'Float'
;
/**
* DOUBLE Token
*
*/
DOUBLE
:
'Double'
;
/**
* Boolean Field Type Token
*
*/
booleanFieldType
:
name= BOOLEAN_TYPE required=requiredValidator*
;
/**
* BOOLEAN_TYPE Token
*
*/
BOOLEAN_TYPE
:
'Boolean'
;
/**
* Date Field Type Rule
*
*/
dateFieldType
:
type = dateTypes required = requiredValidator?
;
/**
* Date Types Rule
*
*/
dateTypes
:
DATE
| LOCAL_DATE
| ZONED_DATETIME
| INSTANT
;
/**
* DATE Token
*
*/
DATE
:
'Date'
;
/**
* LOCAL_DATE Token
*
*/
LOCAL_DATE
:
'LocalDate'
;
/**
* ZONED_DATETIME Token
*
*/
ZONED_DATETIME
:
'ZonedDateTime'
;
/**
* INSTANT Token
*
*/
INSTANT
:
'Instant'
;
/**
* Blob Field Type Rule
*
*/
blobFieldType
:
name = blobTypes constraints += blobValidators*
;
/**
* Blob Types Rule
*
*/
blobTypes
:
BLOB
| ANY_BLOB
| IMAGE_BLOB
| TEXT_BLOB
;
/**
* BLOB Token
*
*/
BLOB
:
'Blob'
;
/**
* ANY_BLOB Token
*
*/
ANY_BLOB
:
'AnyBlob'
;
/**
* IMAGE_BLOB Token
*
*/
IMAGE_BLOB
:
'ImageBlob'
;
/**
* TEXT_BLOB Token
*
*/
TEXT_BLOB
:
'TextBlob'
;
/* =========================================================================
* VALIDATOR
* ========================================================================= */
stringValidators
:
required = requiredValidator
| minLenght = minLengthValidator
| maxLenght = maxLengthValidator
| pattern = patternValidator
;
numericValidators
:
required = requiredValidator
| minValue = minValidator
| maxValue = maxValidator
;
blobValidators
:
required = requiredValidator
| minBytesValue = minBytesValidator
| maxBytesValue = maxBytesValidator
;
requiredValidator
:
'required'
;
minLengthValidator
:
'minlength' '(' NUMERIC_VALUE ')'
;
maxLengthValidator
:
'maxlength' '(' NUMERIC_VALUE ')'
;
patternValidator
:
'pattern' '(' PATTERN_VALUE ')'
;
minValidator
:
'min' '(' NUMERIC_VALUE ')'
;
maxValidator
:
'max' '(' NUMERIC_VALUE ')'
;
minBytesValidator
:
'minbytes' '(' NUMERIC_VALUE ')'
;
maxBytesValidator
:
'maxbytes' '(' value = NUMERIC_VALUE ')'
;
cardinality
:
ONE_TO_MANY
| MANY_TO_ONE
| ONE_TO_ONE
| MANY_TO_MANY
;
/* =========================================================================
* OPTION
* ========================================================================= */
option
:
setting = optionSetting
;
optionSetting
:
dtoOption
;
/* =========================================================================
* DTO OPTION
* ========================================================================= */
dtoOption
:
'dto'?
;
dtoType
:
'mapstruct'
;
WS
:
[ \t\r\n\u000C]+ -> skip
;
COMMENT
:
'/*' .*? '*/' -> channel ( HIDDEN )
;
LINE_COMMENT
:
'//' ~[\r\n]* -> channel ( HIDDEN )
;
NUMERIC_VALUE
:
[0-9]+
;
PATTERN_VALUE
:
'"' .*? '"'
;
ID
:
[a-zA-Z$_]*
;
JavaLetterOrDigit
:
[a-zA-Z0-9$_] // these are the "java letters or digits" below 0x7F
| // covers all characters above 0x7F which are not a surrogate
~[\u0000-\u007F\uD800-\uDBFF]
| // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
[\uD800-\uDBFF] [\uDC00-\uDFFF]
;
ONE_TO_MANY
:
'OneToMany'
;
MANY_TO_ONE
:
'ManyToOne'
;
ONE_TO_ONE
:
'OneToOne'
;
MANY_TO_MANY
:
'ManyToMany'
;
|
oeis/143/A143254.asm | neoneye/loda-programs | 11 | 176325 | <reponame>neoneye/loda-programs
; A143254: Triangle read by rows, T(n,k) = (4n-3)*(4k-3); 1<=k<=n.
; Submitted by <NAME>
; 1,5,25,9,45,81,13,65,117,169,17,85,153,221,289,21,105,189,273,357,441,25,125,225,325,425,525,625,29,145,261,377,493,609,725,841,33,165,297,429,561,693,825,957,1089,37,185,333,481,629,777,925,1073,1221,1369,41,205,369,533,697,861,1025,1189,1353,1517,1681,45,225,405,585,765,945,1125,1305,1485,1665,1845,2025,49,245,441,637,833,1029,1225,1421,1617,1813,2009,2205,2401,53,265,477,689,901,1113,1325,1537,1749
mul $0,4
add $0,1
mov $2,1
lpb $0
sub $0,1
add $2,2
sub $0,$2
add $2,2
lpe
mul $2,$0
mov $0,$2
|
programs/oeis/173/A173013.asm | neoneye/loda | 22 | 175067 | <gh_stars>10-100
; A173013: a(1) = 1, for n >= 2; a(n) = the smallest number h such that sigma(h) = A000203(h) = a(n-1) + 3, a(n) = 0 if no such number exists.
; 1,3,5,7,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2
mul $0,2
mov $1,$0
add $0,2
sub $1,3
lpb $1
mod $1,4
mov $0,$1
lpe
sub $0,1
|
Miparcer.g4 | kevin12cama/compiladores-e-interpretes-P1 | 1 | 204 | parser grammar Miparcer;
options{
tokenVocab=Miscaner;}
program : singleCommand;
command : singleCommand ( Pyc singleCommand)*;
singleCommand :
Identifier ( Dpig expression
| expression )
| IF expression Then singleCommand (
Else singleCommand )*
| While expression Do Llave singleCommand Llave
| Let declaration In Llave singleCommand Llave
| Begin command End|Comi TEXT Comf |Lines Next;
declaration :
singleDeclaration (Pyc singleDeclaration)*;
singleDeclaration :
Const Identifier Lin expression
| Var Identifier Dp typedenoter|
Var Identifier Dp typedenoter Pc Digit
|Struct Llave (Var Identifier Dp typedenoter)* Llave;
typedenoter :
Identifier;
expression :
primaryExpression (Operator primaryExpression)* ;
primaryExpression :
Literal | Identifier | Parnt expression Parnt |Char|String;
metodDeclaration: Funtion Identifier Parnt Identifier+ Parnt Llave singleCommand Llave;
metodCall:Indetifier Parnt(expression)*Parnt ;
|
programs/oeis/340/A340627.asm | neoneye/loda | 22 | 11066 | ; A340627: a(n) = (11*2^n - 2*(-1)^n)/3 for n >= 0.
; 3,8,14,30,58,118,234,470,938,1878,3754,7510,15018,30038,60074,120150,240298,480598,961194,1922390,3844778,7689558,15379114,30758230,61516458,123032918,246065834,492131670,984263338,1968526678,3937053354,7874106710,15748213418,31496426838
mov $1,3
lpb $0
sub $0,1
sub $1,$2
cmp $2,0
add $1,$2
mul $1,2
lpe
mov $0,$1
|
programs/oeis/154/A154383.asm | karttu/loda | 0 | 172826 | ; A154383: Powers of 4 at even indices, two times powers of 4 at odd indices.
; 1,0,4,2,16,8,64,32,256,128,1024,512,4096,2048,16384,8192,65536,32768,262144,131072,1048576,524288,4194304,2097152,16777216,8388608,67108864,33554432,268435456,134217728,1073741824,536870912,4294967296,2147483648,17179869184,8589934592,68719476736,34359738368,274877906944,137438953472,1099511627776,549755813888,4398046511104,2199023255552,17592186044416,8796093022208,70368744177664,35184372088832,281474976710656,140737488355328,1125899906842624,562949953421312,4503599627370496,2251799813685248
mov $6,2
mov $7,$0
lpb $6,1
sub $6,1
add $0,$6
sub $0,1
mov $2,$0
mov $8,2
gcd $8,$0
mov $4,$8
lpb $2,1
mul $8,2
lpb $4,1
mov $3,1
sub $4,$4
lpe
sub $2,1
add $8,$3
lpe
mov $5,$6
lpb $5,1
mov $1,$8
sub $5,1
lpe
lpe
lpb $7,1
sub $1,$8
mov $7,0
lpe
div $1,2
|
oeis/338/A338854.asm | neoneye/loda-programs | 11 | 178456 | ; A338854: Product of the nonzero digits of (n written in base 4).
; Submitted by <NAME>(m3)
; 1,1,2,3,1,1,2,3,2,2,4,6,3,3,6,9,1,1,2,3,1,1,2,3,2,2,4,6,3,3,6,9,2,2,4,6,2,2,4,6,4,4,8,12,6,6,12,18,3,3,6,9,3,3,6,9,6,6,12,18,9,9,18,27,1,1,2,3,1,1,2,3,2,2,4,6,3,3,6,9,1
seq $0,7090 ; Numbers in base 4.
seq $0,51801 ; Product of the nonzero digits of n.
|
oeis/086/A086352.asm | neoneye/loda-programs | 11 | 161346 | ; A086352: Main diagonal of square array A086350.
; Submitted by <NAME>
; 1,2,10,74,740,9354,143144,2573586,53180944,1242078802,32358633632,930370449370,29264294868544,999646208968666,36852747307934336,1458402092927302178,61665517131334975744,2774522039432235946914
mov $1,$0
mov $2,1
mov $3,1
lpb $0
sub $0,1
mov $4,$3
mul $3,$1
add $3,$2
mul $2,$1
mul $4,2
add $2,$4
lpe
mov $0,$3
|
programs/oeis/313/A313682.asm | neoneye/loda | 22 | 100438 | <reponame>neoneye/loda<filename>programs/oeis/313/A313682.asm
; A313682: Coordination sequence Gal.5.55.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,5,10,15,19,23,27,31,36,41,46,51,56,61,65,69,73,77,82,87,92,97,102,107,111,115,119,123,128,133,138,143,148,153,157,161,165,169,174,179,184,189,194,199,203,207,211,215,220,225
max $2,$0
seq $0,315742 ; Coordination sequence Gal.5.302.5 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.
sub $0,$2
|
programs/Music.asm | TheLogicMaster/lm8 | 10 | 132 | ; Music player --- Run the fetch_songs.sh script to generate the song binaries before assembling
; Set buzzer pin (Arduino 2) to output mode
ldr $2,B
out {arduino_output},B
; Setup timer 0 for note duration
ldr {centiseconds},A
out {timer_unit_0},A
; Load song address
lda song
str [index_high],H
str [index_low],L
loop:
; Load current note address
ldr [index_high],H
ldr [index_low],L
; Load note length and check for end of song
ldr [HL],A
cmp $FF
jr done,Z
ina
; Start note length timer
out {timer_count_0},A
out {timer_0},A
; Load note
ldr [HL],A
push A
ina
ldr [HL],B
ina
; Store new note address
str [index_high],H
str [index_low],L
pop H
; Set A to 0 to enable the buzzer if the note isn't a rest
or B
jr rest,Z
ldr $0,A
jr play_note
rest:
ldr $2,A ; Disable buzzer
play_note:
ldr {milliseconds},L
out {timer_unit_1},L
out {timer_count_1},H
out {timer_1},L
note_millis:
in {timer_1},L
jr note_millis,Z
ldr {centimilliseconds},L
out {timer_unit_1},L
out {timer_count_1},B
out {timer_1},L
note_centimillis:
in {timer_1},L
jr note_centimillis,Z
; Toggle buzzer pin
xor $1
out {arduino_2},A
; Check if note ended
in {timer_0},L
jr play_note,Z
; Short note separation
ldr $1,L
out {timer_count_0},L
out {timer_0},L
separation:
in {timer_0},L
jr separation,Z
jmp loop
done:
ldr $1,A
out {led_0},A
halt
song: bin "songs/cannonind.bin"
data
index_high: var
index_low: var
|
oeis/099/A099483.asm | neoneye/loda-programs | 11 | 241117 | <reponame>neoneye/loda-programs<filename>oeis/099/A099483.asm<gh_stars>10-100
; A099483: A Fibonacci convolution.
; Submitted by <NAME>
; 0,1,3,7,18,48,126,329,861,2255,5904,15456,40464,105937,277347,726103,1900962,4976784,13029390,34111385,89304765,233802911,612103968,1602508992,4195423008,10983760033,28755857091,75283811239,197095576626
mul $0,2
add $0,1
seq $0,71 ; a(n) = Fibonacci(n) - 1.
add $0,2
div $0,3
|
agda/book/2015-Verified_Functional_programming_in_Agda-Stump/ial/z01-fp-with-booleans.agda | haroldcarr/learn-haskell-coq-ml-etc | 36 | 12219 | module z01-fp-with-booleans where
open import bool
{-
data 𝔹 : Set where
tt : 𝔹
ff : 𝔹
˜_ : 𝔹 → 𝔹
˜ tt = ff
˜ ff = tt
if_then_else_ : ∀ {ℓ} {A : Set ℓ} → 𝔹 → A → A → A
if tt then t else f = t
if ff then t else f = f
-}
-- load / type-check file
-- C-c, C-l
-- check type of expression
-- C-c, C-d ; then prompt for expression
------------------------------------------------------------------------------
-- p 24 1.8 Exercises
z01-1-8-01a : 𝔹
z01-1-8-01a = tt && (ff xor ~ ff)
z01-1-8-01b : 𝔹
z01-1-8-01b = ~ tt && (ff imp ff)
z01-1-8-01c : 𝔹
z01-1-8-01c = if tt xor tt then ff else ff
-- 1-8-4
data day : Set where
mon : day
tue : day
wed : day
thu : day
fri : day
sat : day
sun : day
-- 1-8-5
nextday : day → day
nextday mon = tue
nextday tue = wed
nextday wed = thu
nextday thu = fri
nextday fri = sat
nextday sat = sun
nextday sun = mon
-- 1-8-6
data suit : Set where
hearts : suit
spades : suit
diamonds : suit
clubs : suit
-- 1-8-7
is-red : suit → 𝔹
is-red hearts = tt
is-red spades = ff
is-red diamonds = tt
is-red clubs = ff
|
15/1/src/main.adb | Heziode/aoc-ada-2021 | 3 | 1493 | with Ada.Containers.Hashed_Maps,
Ada.Execution_Time,
Ada.Integer_Text_IO,
Ada.Long_Long_Integer_Text_IO,
Ada.Real_Time,
Ada.Text_IO;
with Utils,
Dijkstra;
procedure Main is
use Ada.Execution_Time,
Ada.Real_Time,
Ada.Text_IO;
use Utils;
Nb_Tiles : constant := 1;
subtype Risk_Level is Natural range 1 .. 9;
type Location is record
Line : Natural;
Column : Natural;
end record;
subtype Adjacent_Index is Integer range -1 .. 1;
type Adjacent_Location is record
Line : Adjacent_Index;
Column : Adjacent_Index;
end record;
type Adjacent is (Top, Right, Bottom, Left);
type Adjacent_Array is array (Adjacent) of Adjacent_Location;
-- This Hash function transform a 2 dimensional location to an unique ID using Cantor pairing enumeration.
-- @param Loc A 2 dimensional location
-- @returns Return the corresponding hash
-- @link https://en.wikipedia.org/wiki/Pairing_function#Cantor_pairing_function
function Hash (Loc : Location) return Ada.Containers.Hash_Type is
(Ada.Containers.Hash_Type (((Loc.Line + Loc.Column) * (Loc.Line + Loc.Column + 1) / 2) + Loc.Column));
package Location_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Location,
Element_Type => Risk_Level,
Hash => Hash,
Equivalent_Keys => "=",
"=" => "=");
use Location_Maps;
Adjacents : constant Adjacent_Array := (Top => (-1, 0),
Right => (0, 1),
Bottom => (1, 0),
Left => (0, -1));
function Equivalent_Keys (Left, Right : Location) return Boolean is
(Left.Line = Right.Line and Left.Column = Right.Column);
-- Display the location
procedure Put (Loc : Location);
---------
-- Put --
---------
procedure Put (Loc : Location) is
begin
Put ("(");
Ada.Integer_Text_IO.Put (Item => Loc.Line,
Width => 0);
Put (",");
Ada.Integer_Text_IO.Put (Item => Loc.Column,
Width => 0);
Put (")");
end Put;
package Chiton_Dijkstra is new Dijkstra (Node => Location,
Hash => Hash,
Equivalent_Keys => Equivalent_Keys,
Put => Put,
Is_Directed => True);
-- This heuristic compute the Manhattan distance from Current to To
function Heuristic (Current, To : Location) return Long_Long_Natural;
function Heuristic (Current, To : Location) return Long_Long_Natural is
begin
return Long_Long_Natural (abs (To.Line - Current.Line) + abs (To.Column - Current.Column));
end Heuristic;
use Chiton_Dijkstra;
File : File_Type;
Start_Time, End_Time : CPU_Time;
Execution_Duration : Time_Span;
Array_Width,
Array_Height : Natural := Natural'First;
Result : Long_Long_Natural := Long_Long_Natural'First;
Nodes : Map;
Edges : Edges_Lists.Vector := Edges_Lists.Empty_Vector;
Graph : Graph_Access;
begin
Get_File (File);
-- Get all values
while not End_Of_File (File) loop
declare
Str : constant String := Get_Line (File);
Value : Risk_Level;
Last : Positive;
Current_Colum : Natural := Natural'First;
begin
if Array_Width = Natural'First then
Array_Width := Str'Length;
end if;
for Char of Str loop
Ada.Integer_Text_IO.Get (Char & "", Value, Last);
Nodes.Insert ((Array_Height, Current_Colum), Value);
Current_Colum := Current_Colum + 1;
end loop;
Create_Horizontal_Tiles : for Column in Array_Width .. Array_Width * Nb_Tiles - 1 loop
Last := Nodes.Element ((Array_Height, Column - Array_Width)) + 1;
if Last > 9 then
Last := Last - 9;
end if;
Nodes.Insert ((Array_Height, Column), Last);
end loop Create_Horizontal_Tiles;
end;
Array_Height := Array_Height + 1;
end loop;
-- Exit the program if there is no values
if Nodes.Is_Empty then
Close_If_Open (File);
Put_Line ("The input file is empty.");
return;
end if;
Create_Vertical_Tiles : declare
Value : Natural;
begin
for Line in Array_Height .. Array_Height * Nb_Tiles - 1 loop
for Column in 0 .. Array_Width * Nb_Tiles - 1 loop
Value := Nodes.Element ((Line - Array_Height, Column)) + 1;
if Value > 9 then
Value := Value - 9;
end if;
Nodes.Insert ((Line, Column), Risk_Level (Value));
end loop;
end loop;
end Create_Vertical_Tiles;
Create_Graph : declare
Current_Loc : Location;
begin
for Line in 0 .. Array_Height * Nb_Tiles - 1 loop
for Column in 0 .. Array_Width * Nb_Tiles - 1 loop
for Adjacent : Adjacent_Location of Adjacents loop
if Line + Adjacent.Line in 0 .. Array_Height * Nb_Tiles - 1
and Column + Adjacent.Column in 0 .. Array_Width * Nb_Tiles - 1
then
Current_Loc := (Line + Adjacent.Line, Column + Adjacent.Column);
Edges.Append ((
Start_Node => (Line, Column),
End_Node => (Current_Loc.Line, Current_Loc.Column),
Cost =>
Long_Long_Natural (Nodes.Element ((Current_Loc.Line, Current_Loc.Column)))
));
end if;
end loop;
end loop;
end loop;
Graph := new Graph_T '(Initialize (Edges));
end Create_Graph;
-- Do the puzzle
Start_Time := Ada.Execution_Time.Clock;
Solve_Puzzle : declare
begin
Result := Graph.Shortest_Cost (From => (0, 0),
To => (Array_Height * Nb_Tiles - 1, Array_Width * Nb_Tiles - 1),
Heuristic => Heuristic'Access);
end Solve_Puzzle;
End_Time := Ada.Execution_Time.Clock;
Execution_Duration := End_Time - Start_Time;
Put ("Result: ");
Ada.Long_Long_Integer_Text_IO.Put (Item => Result,
Width => 0);
New_Line;
Put_Line ("(Took " & Duration'Image (To_Duration (Execution_Duration) * 1_000_000) & "µs)");
exception
when others =>
Close_If_Open (File);
raise;
end Main;
|
ffight/lcs/boss/0.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 23365 | copyright zengfr site:http://github.com/zengfr/romhack
0061C0 move.w ($2,A3), D2 [boss+0, container+ 0, enemy+ 0]
copyright zengfr site:http://github.com/zengfr/romhack
|
oeis/307/A307005.asm | neoneye/loda-programs | 11 | 27261 | ; A307005: Expansion of e.g.f. (2*exp(x)-2*x-x^2)/(2-2*x-x^2).
; Submitted by <NAME>
; 1,1,3,13,71,486,3982,38081,416145,5116222,69888746,1050168417,17214678241,305703953660,5846391071172,119794781201881,2618283427770737,60802908515558346,1495049717728972990,38803241993010963977,1060124286228724147641,30411290829335509535632,913937108364216487888976,28714610072198863133961345,941397283641296465872429657,32149315112692070586999144926,1141836310113415186670517406602,42113989977617126816140669847281,1610805844596150491413394335419425,63811649424200917738341547685159412
mov $2,$0
max $2,1
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
sub $3,$1
mul $1,$0
mov $6,$0
mul $6,$3
mov $3,$5
sub $3,$6
div $3,2
add $3,1
add $1,$3
lpe
mov $0,$1
|
exercises/02-classroom.als | xbreu/formal-methods | 0 | 425 | <reponame>xbreu/formal-methods
/// First-order logic revision exercises based on a simple model of a classroom
/// management system.
///
/// The model has 5 unary predicates (sets), Person, Student, Teacher, Group
/// and Class, Student and Teacher a sub-set of Person. There are two binary
/// predicates, Tutors a sub-set of Person x Person, and Teaches a sub-set of
/// Person x Teaches. There is also a ternary predicate Groups, sub-set of
/// Class x Person x Group.
///
/// The unsolved exercises and interface for running the file online can be
/// found at http://alloy4fun.inesctec.pt/Pdvipvrpr5hg7JKbs
// ----------------------------------------------------------------------------
// Definitions
// ----------------------------------------------------------------------------
// The registered persons.
sig Person {
// Each person tutors a set of persons.
Tutors : set Person,
// Each person teaches a set of classes.
Teaches : set Class
}
// The registered groups.
sig Group {}
// The registered classes.
sig Class {
// Each class has a set of persons assigned to a group.
Groups : Person -> Group
}
// Some persons are teachers.
sig Teacher in Person {}
// Some persons are students.
sig Student in Person {}
// ----------------------------------------------------------------------------
// Properties
// ----------------------------------------------------------------------------
// Every person is a student.
pred inv1 {
all p : Person | p in Student
}
// There are no teachers.
pred inv2 {
not some p : Person | p in Teacher
}
// No person is both a student and a teacher.
pred inv3 {
not some p : Person | (p in Teacher) and (p in Student)
}
// No person is neither a student nor a teacher.
pred inv4 {
all p : Person | (p in Teacher) or (p in Student)
}
// There classes assigned to teachers.
pred inv5 {
some c : Class, t : Teacher | t->c in Teaches
}
// Every teacher has classes assigned.
pred inv6 {
all t : Teacher | some c : Class | t->c in Teaches
}
// Every class has teachers assigned.
pred inv7 {
all c : Class | some t : Teacher | t->c in Teaches
}
// Teachers are assigned at most one class.
pred inv8 {
all t : Teacher, c1, c2 : Class |
(t->c1 in Teaches) and (t->c2 in Teaches) => (c1 = c2)
}
// No class has more than a teacher assigned.
pred inv9 {
all c : Class, t1, t2 : Teacher |
(t1->c in Teaches) and (t2->c in Teaches) => (t1 = t2)
}
// For every class, every student has a group assigned.
pred inv10 {
all c : Class, s : Student | some g : Group | c->s->g in Groups
}
// A class only has groups if it has a teacher assigned.
pred inv11 {
all c : Class, g : Group, p : Person |
(c->p->g in Groups) => (some t : Teacher | t->c in Teaches)
}
// Each teacher is responsible for some groups.
pred inv12 {
all t : Teacher | some c : Class, g : Group, p : Person |
(t->c in Teaches) and (c->p->g in Groups)
}
// Only teachers tutor, and only students are tutored.
pred inv13 {
all p1, p2 : Person |
(p1->p2 in Tutors) => (p1 in Teacher) and (p2 in Student)
}
// Every student in a class is at least tutored by the teachers assigned to
// that class.
pred inv14 {
all s : Person, g : Group, c : Class | (c->s->g in Groups) =>
(all t : Person | (t->c in Teaches) => (t->s in Tutors))
}
// Assuming a universe of 3 persons, the tutoring chain of every person
// eventually reaches a Teacher.
pred inv15 {
all p1 : Person | some p2, p3 : Person |
(p2->p1 in Tutors) and ((p2 in Teacher) or
(p3->p2 in Tutors) and ((p3 in Teacher) or
(p1->p3 in Tutors) and (p1 in Teacher)))
}
|
Cubical/Reflection/RecordEquiv.agda | bijan2005/univalent-foundations | 0 | 5778 | <reponame>bijan2005/univalent-foundations
{-
Reflection-based tools for converting between iterated record types, particularly between
record types and iterated Σ-types.
See end of file for examples.
-}
{-# OPTIONS --cubical --no-exact-split --safe #-}
module Cubical.Reflection.RecordEquiv where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Data.List as List
open import Cubical.Data.Nat
open import Cubical.Data.Maybe as Maybe
open import Cubical.Data.Sigma
open import Agda.Builtin.String
import Agda.Builtin.Reflection as R
open import Cubical.Reflection.Base
Projections = Maybe (List R.Name)
-- Describes a correspondence between two iterated record types
RecordAssoc = List (Projections × Projections)
-- Describes a correspondence between a record type and an iterated Σ-types;
-- more convenient than RecordAssoc for this special case
data ΣFormat : Type where
leaf : R.Name → ΣFormat
_,_ : ΣFormat → ΣFormat → ΣFormat
unit : ΣFormat
infixr 4 _,_
flipRecordAssoc : RecordAssoc → RecordAssoc
flipRecordAssoc = List.map λ {p .fst → p .snd; p .snd → p .fst}
fstIdRecordAssoc : RecordAssoc → RecordAssoc
fstIdRecordAssoc = List.map λ {p .fst → p .fst; p .snd → p .fst}
List→ΣFormat : List R.Name → ΣFormat
List→ΣFormat [] = unit
List→ΣFormat (x ∷ []) = leaf x
List→ΣFormat (x ∷ y ∷ xs) = leaf x , List→ΣFormat (y ∷ xs)
ΣFormat→RecordAssoc : ΣFormat → RecordAssoc
ΣFormat→RecordAssoc = go []
where
go : List R.Name → ΣFormat → RecordAssoc
go prefix unit = [ just prefix , nothing ]
go prefix (leaf fieldName) = [ just prefix , just [ fieldName ] ]
go prefix (sig₁ , sig₂) =
go (quote fst ∷ prefix) sig₁ ++ go (quote snd ∷ prefix) sig₂
-- Derive the shape of the compound Σ-type
ΣFormat→Ty : ΣFormat → R.Type
ΣFormat→Ty unit = R.def (quote Unit) []
ΣFormat→Ty (leaf _) = R.unknown
ΣFormat→Ty (sig₁ , sig₂) =
R.def (quote Σ) (ΣFormat→Ty sig₁ v∷ R.lam R.visible (R.abs "_" (ΣFormat→Ty sig₂)) v∷ [])
recordName→isoTy : R.Name → R.Term → R.TC R.Term
recordName→isoTy name σShape =
R.inferType (R.def name []) >>= R.normalise >>= go []
where
go : List R.ArgInfo → R.Type → R.TC R.Term
go acc (R.pi (R.arg i argTy) (R.abs s ty)) =
liftTC (λ t → R.pi (R.arg i' argTy) (R.abs s t)) (go (i ∷ acc) ty)
where
i' = R.arg-info R.hidden (R.modality R.relevant R.quantity-ω)
go acc (R.agda-sort _) =
R.returnTC (R.def (quote Iso) (R.def name (makeArgs 0 [] acc) v∷ σShape v∷ []))
where
makeArgs : ℕ → List (R.Arg R.Term) → List R.ArgInfo → List (R.Arg R.Term)
makeArgs n acc [] = acc
makeArgs n acc (i ∷ infos) = makeArgs (suc n) (R.arg i (v n) ∷ acc) infos
go _ _ = R.typeError (R.strErr "Not a record type name: " ∷ R.nameErr name ∷ [])
projNames→Patterns : List R.Name → List (R.Arg R.Pattern)
projNames→Patterns = go []
where
go : List (R.Arg R.Pattern) → List R.Name → List (R.Arg R.Pattern)
go acc [] = acc
go acc (π ∷ projs) = go (varg (R.proj π) ∷ acc) projs
projNames→Term : R.Term → List R.Name → R.Term
projNames→Term term [] = term
projNames→Term term (π ∷ projs) = R.def π [ varg (projNames→Term term projs) ]
convertClauses : RecordAssoc → R.Term → List R.Clause
convertClauses al term = fixIfEmpty (List.filterMap makeClause al)
where
makeClause : Projections × Projections → Maybe R.Clause
makeClause (projl , just projr) =
just (R.clause [] (goPat [] projr) (Maybe.rec R.unknown goTm projl))
where
goPat : List (R.Arg R.Pattern) → List R.Name → List (R.Arg R.Pattern)
goPat acc [] = acc
goPat acc (π ∷ projs) = goPat (varg (R.proj π) ∷ acc) projs
goTm : List R.Name → R.Term
goTm [] = term
goTm (π ∷ projs) = R.def π [ varg (goTm projs) ]
makeClause (_ , nothing) = nothing
fixIfEmpty : List R.Clause → List R.Clause
fixIfEmpty [] = [ R.clause [] [] R.unknown ]
fixIfEmpty (c ∷ cs) = c ∷ cs
mapClause :
(List (String × R.Arg R.Type) → List (String × R.Arg R.Type))
→ (List (R.Arg R.Pattern) → List (R.Arg R.Pattern))
→ (R.Clause → R.Clause)
mapClause f g (R.clause tel ps t) = R.clause (f tel) (g ps) t
mapClause f g (R.absurd-clause tel ps) = R.absurd-clause (f tel) (g ps)
recordIsoΣClauses : ΣFormat → List R.Clause
recordIsoΣClauses σ =
funClauses (quote Iso.fun) Σ↔R ++
funClauses (quote Iso.inv) R↔Σ ++
pathClauses (quote Iso.rightInv) R↔Σ ++
pathClauses (quote Iso.leftInv) Σ↔R
where
R↔Σ = ΣFormat→RecordAssoc σ
Σ↔R = flipRecordAssoc R↔Σ
funClauses : R.Name → RecordAssoc → List R.Clause
funClauses name al =
List.map
(mapClause
(("_" , varg R.unknown) ∷_)
(λ ps → R.proj name v∷ R.var 0 v∷ ps))
(convertClauses al (v 0))
pathClauses : R.Name → RecordAssoc → List R.Clause
pathClauses name al =
List.map
(mapClause
(λ vs → ("_" , varg R.unknown) ∷ ("_" , varg R.unknown) ∷ vs)
(λ ps → R.proj name v∷ R.var 1 v∷ R.var 0 v∷ ps))
(convertClauses (fstIdRecordAssoc al) (v 1))
recordIsoΣTerm : ΣFormat → R.Term
recordIsoΣTerm σ = R.pat-lam (recordIsoΣClauses σ) []
-- with a provided ΣFormat for the record
declareRecordIsoΣ' : R.Name → ΣFormat → R.Name → R.TC Unit
declareRecordIsoΣ' idName σ recordName =
let σTy = ΣFormat→Ty σ in
recordName→isoTy recordName σTy >>= λ isoTy →
R.declareDef (varg idName) isoTy >>
R.defineFun idName (recordIsoΣClauses σ)
-- using the right-associated Σ given by the record fields
declareRecordIsoΣ : R.Name → R.Name → R.TC Unit
declareRecordIsoΣ idName recordName =
R.getDefinition recordName >>= λ where
(R.record-type _ fs) →
let σ = List→ΣFormat (List.map (λ {(R.arg _ n) → n}) fs) in
declareRecordIsoΣ' idName σ recordName
_ →
R.typeError (R.strErr "Not a record type name:" ∷ R.nameErr recordName ∷ [])
private
module Example where
variable
ℓ ℓ' : Level
A : Type ℓ
B : A → Type ℓ'
record Example0 {A : Type ℓ} (B : A → Type ℓ') : Type (ℓ-max ℓ ℓ') where
no-eta-equality -- works with or without eta equality
field
cool : A
fun : A
wow : B cool
-- Declares a function `Example0IsoΣ` that gives an isomorphism between the record type and a
-- right-associated nested Σ-type (with the parameters to Example0 as implict arguments).
unquoteDecl Example0IsoΣ = declareRecordIsoΣ Example0IsoΣ (quote Example0)
-- `Example0IsoΣ` has the type we expect
test0 : Iso (Example0 B) (Σ[ a ∈ A ] (Σ[ _ ∈ A ] B a))
test0 = Example0IsoΣ
-- A record with no fields is isomorphic to Unit
record Example1 : Type where
unquoteDecl Example1IsoΣ = declareRecordIsoΣ Example1IsoΣ (quote Example1)
test1 : Iso Example1 Unit
test1 = Example1IsoΣ |
demos/SicDemos/hanoi/hanoi.asm | roycrippen/sicxe | 0 | 84191 | <reponame>roycrippen/sicxe<filename>demos/SicDemos/hanoi/hanoi.asm
Hanoi START 0
first JSUB stackinit
LDA =10
LDS =C'ACB'
JSUB hanoi
. death end
death J death
. Solves Towers of Hanoi puzzle
. Input: A - disk count, S - pegs conf $1$2$3 (src dest temp)
hanoi COMP =0 . if (n>1) then
JGT hanoi1 . goto hanoi1
RSUB . else return
hanoi1 STL @stackptr . push L
JSUB stackpush
STT @stackptr . push T
JSUB stackpush
STS @stackptr . push S
JSUB stackpush
SUB =1 . A=n-1
RMO A, T . save A into T
. manipulate S: $1$2$3 -> $1$3$2
RMO S, A . A = S
STCH hanoiS3
SHIFTR A, 8
STCH hanoiS2
LDCH hanoiS3
SHIFTL A, 8
LDCH hanoiS2
RMO A, S . S = A
. recurse hanoi A=n-1 S=$1$3$2
RMO T, A . restore A from T
JSUB hanoi
JSUB stackpop . pop S
LDS @stackptr
. echo $1>$2
RMO S, A
SHIFTR A, 16
JSUB echoch
LDCH =C'>'
JSUB echoch
RMO S, A
SHIFTR A, 8
JSUB echoch
JSUB echonl
. manipulate S: $1$2$3 - > $3$2$1
RMO S, A . A = S
STCH hanoiS3
SHIFTR A, 8
STCH hanoiS2
SHIFTR A, 8
STCH hanoiS1
LDCH hanoiS3
SHIFTL A, 8
LDCH hanoiS2
SHIFTL A, 8
LDCH hanoiS1
RMO A, S . S = A
. recurse hanoi n-1 $3$2$1
RMO T, A . restore A from T
JSUB hanoi
. finish
JSUB stackpop . pop T
LDT @stackptr
JSUB stackpop . pop L
LDL @stackptr
RSUB
hanoiS1 RESB 1
hanoiS2 RESB 1
hanoiS3 RESB 1
. ********* echo ************
echoch TD =X'01'
JEQ echoch
WD =X'01'
RSUB
. ***************************
echonl STCH echonlA
LDCH =X'0A'
TD =X'01'
JEQ echoch
WD =X'01'
LDCH echonlA
RSUB
echonlA RESB 1
. ********* stack ***********
stackinit LDA #stack
STA stackptr
RSUB
stackpush STA stacka
LDA stackptr
ADD =3
STA stackptr
LDA stacka
RSUB
stackpop STA stacka
LDA stackptr
SUB =3
STA stackptr
LDA stacka
RSUB
stacka RESW 1
stackptr RESW 1
stack RESW 10000
END first
|
specs/ada/server/ike/tkmrpc-operation_handlers-ike-isa_auth.ads | DrenfongWong/tkm-rpc | 0 | 27603 | with Tkmrpc.Request;
with Tkmrpc.Response;
package Tkmrpc.Operation_Handlers.Ike.Isa_Auth is
procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type);
-- Handler for the isa_auth operation.
end Tkmrpc.Operation_Handlers.Ike.Isa_Auth;
|
Transynther/x86/_processed/AVXALIGN/_zr_un_/i7-7700_9_0x48_notsx.log_21829_1448.asm | ljhsiun2/medusa | 9 | 103499 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r15
push %rdx
lea addresses_A_ht+0xbb47, %r15
nop
nop
nop
xor %r13, %r13
mov (%r15), %rdx
nop
nop
nop
add %r10, %r10
pop %rdx
pop %r15
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r8
push %r9
push %rbx
push %rdx
// Store
lea addresses_RW+0x13047, %r11
and %rbx, %rbx
mov $0x5152535455565758, %r8
movq %r8, %xmm3
movups %xmm3, (%r11)
nop
nop
nop
nop
sub %rdx, %rdx
// Store
lea addresses_WT+0x1c047, %r14
nop
nop
nop
nop
nop
inc %r9
mov $0x5152535455565758, %r11
movq %r11, %xmm2
movups %xmm2, (%r14)
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %r8
nop
sub $38914, %rbx
// Store
lea addresses_WT+0xe047, %r8
dec %rdx
mov $0x5152535455565758, %r15
movq %r15, (%r8)
// Exception!!!
nop
nop
nop
mov (0), %r11
nop
nop
nop
nop
sub %r15, %r15
// Store
lea addresses_PSE+0x1ac7, %rdx
nop
nop
nop
sub %rbx, %rbx
movw $0x5152, (%rdx)
nop
xor $35434, %r14
// Store
lea addresses_PSE+0x12047, %r9
nop
nop
nop
nop
xor %r15, %r15
movw $0x5152, (%r9)
nop
nop
nop
and $60597, %r11
// Faulty Load
lea addresses_WC+0x16047, %r11
nop
and %r9, %r9
movntdqa (%r11), %xmm4
vpextrq $1, %xmm4, %rdx
lea oracles, %rbx
and $0xff, %rdx
shlq $12, %rdx
mov (%rbx,%rdx,1), %rdx
pop %rdx
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_WC', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_RW', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_PSE', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_PSE', 'congruent': 7}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 8}}
{'0c': 2, '22': 2, '08': 9, '00': 21816}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/tom/engine/parser/antlr4/TomIslandLexer.g4 | rewriting/tom | 36 | 4517 | /*
*
* TOM - To One Matching Compiler
*
* Copyright (c) 2016-2017, Universite de Lorraine
* Nancy, France.
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* <NAME> e-mail: <EMAIL>
*
**/
lexer grammar TomIslandLexer;
@members {
public static final int WHITESPACE = 1;
public static final int COMMENTS = 2;
}
MATCH : '%match' ;
STRATEGY : '%strategy' ;
EXTENDS : 'extends' ;
VISIT : 'visit' ;
INCLUDE : '%include' ;
GOM : '%gom' ;
OP : '%op' ;
OPARRAY : '%oparray' ;
OPLIST : '%oplist' ;
TYPETERM : '%typeterm' ;
IS_FSYM : 'is_fsym' ;
IS_SORT : 'is_sort' ;
MAKE : 'make' ;
MAKE_EMPTY : 'make_empty' ;
MAKE_APPEND : 'make_append' ;
MAKE_INSERT : 'make_insert' ;
GET_SLOT : 'get_slot' ;
GET_DEFAULT : 'get_default' ;
GET_ELEMENT : 'get_element' ;
GET_HEAD : 'get_head' ;
GET_TAIL : 'get_tail' ;
GET_SIZE : 'get_size' ;
IS_EMPTY : 'is_empty' ;
IMPLEMENT : 'implement' ;
EQUALS : 'equals' ;
MATCH_SYMBOL : '<<' ;
EQUAL : '=' ;
LBRACE : '{' ;
RBRACE : '}' ;
LPAREN : '(' ;
RPAREN : ')' ;
LSQUAREBR : '[' ;
RSQUAREBR : ']' ;
ARROW : '->' ;
COMMA : ',' ;
COLON : ':' ;
STAR : '*' ;
UNDERSCORE : '_' ;
ANTI : '!' ;
AT : '@' ;
METAQUOTE : '%[' .*? ']%';
GREATEROREQ : '>=';
LOWEROREQ : '<=';
GREATERTHAN : '>';
LOWERTHAN : '<';
DOUBLEEQ : '==';
DIFFERENT : '!=';
AND : '&&';
OR : '||';
PIPE : '|';
QMARK : '?';
DQMARK : '??';
SLASH : '/';
BACKSLASH : '\\';
DOT : '.';
BQUOTE : '`' ;
ID : ('_')? LETTER (LETTER | DIGIT | '_' )*;
DMINUSID : '--' LETTER* ;
INTEGER : ('-')? (DIGIT)+;
DOUBLE : ('-')? UNSIGNED_DOUBLE;
LONG : ('-')? (DIGIT)+ LONG_SUFFIX;
STRING : '"' ( ESC | ~('"' |'\\'|'\n'|'\r') )* '"';
CHAR : '\'' ( ESC | ~('\''|'\\'|'\n'|'\r') )+ '\'';
fragment UNSIGNED_DOUBLE : (DIGIT)+'.'(DIGIT)* | '.' (DIGIT)+;
fragment LONG_SUFFIX : 'l'|'L' ;
fragment LETTER : 'A'..'Z' | 'a'..'z';
fragment DIGIT : '0'..'9';
fragment HEX_DIGIT : ('0'..'9'|'A'..'F'|'a'..'f');
fragment ESC :
'\\'
( 'n' | 'r' | 't' | 'b' | 'f' | '"' | '\'' | '\\'
| ('u')+ HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
| '0'..'3' ( '0'..'7' ( '0'..'7')?)?
| '4'..'7' ( '0'..'7')?
)
;
ACTION_ESCAPE : '\\' . ;
ACTION_STRING_LITERAL : '"' (ACTION_ESCAPE | ~["\\])* '"' ;
MLCOMMENT : '/*' .*? '*/' -> skip ;
SLCOMMENT : '//' ~[\r\n]* -> skip;
WS : [ \r\t]+ -> channel(HIDDEN) ;
NL : [\n]+ -> channel(HIDDEN) ;
ANY : . ;
|
oeis/160/A160295.asm | neoneye/loda-programs | 11 | 1817 | <gh_stars>10-100
; A160295: Numerator of Hermite(n, 17/30).
; Submitted by <NAME>
; 1,17,-161,-18037,-89279,30948857,727008319,-71202772477,-3500523336959,196821084188897,17523077945895199,-587802553769818117,-96731879246268143039,1529691843170459400137,591886254924566446580479,425007721743735371005043,-3988007089471180013111147519,-70856176117564954894125817423,29303699240455922867100139624159,1072097913640026823383121494737003,-232320963974017684516193128376030399,-13598337610318542047223376635025543783,1964261370179051903875227660358053026239
add $0,1
mov $3,1
lpb $0
sub $0,1
add $3,$1
add $2,$3
mov $3,$1
mov $1,$2
mul $2,8
add $1,$2
mul $3,-25
mul $3,$0
mul $3,2
lpe
mov $0,$1
div $0,9
|
src/005/animals.ads | xeenta/learning-ada | 0 | 24581 | package Animals is
type Animal is abstract tagged private;
function Legs
(A : Animal) return Natural;
function Wings
(A : Animal) return Natural;
procedure Add_Wings (A : in out Animal;
N : Positive);
procedure Add_Legs (A : in out Animal;
N : Positive);
private
type Animal is abstract tagged
record
Number_Of_Legs : Natural;
Number_Of_Wings : Natural;
end record;
end Animals;
|
Task/Equilibrium-index/AppleScript/equilibrium-index.applescript | LaudateCorpus1/RosettaCodeData | 1 | 3721 | -- equilibriumIndices :: [Int] -> [Int]
on equilibriumIndices(xs)
script balancedPair
on |λ|(a, pair, i)
set {x, y} to pair
if x = y then
{i - 1} & a
else
a
end if
end |λ|
end script
script plus
on |λ|(a, b)
a + b
end |λ|
end script
-- Fold over zipped pairs of sums from left
-- and sums from right
foldr(balancedPair, {}, ¬
zip(scanl1(plus, xs), scanr1(plus, xs)))
end equilibriumIndices
-- TEST -----------------------------------------------------------------------
on run
map(equilibriumIndices, {¬
{-7, 1, 5, 2, -4, 3, 0}, ¬
{2, 4, 6}, ¬
{2, 9, 2}, ¬
{1, -1, 1, -1, 1, -1, 1}, ¬
{1}, ¬
{}})
--> {{3, 6}, {}, {1}, {0, 1, 2, 3, 4, 5, 6}, {0}, {}}
end run
-- GENERIC FUNCTIONS ----------------------------------------------------------
-- foldl :: (a -> b -> a) -> a -> [b] -> a
on foldl(f, startValue, xs)
tell mReturn(f)
set v to startValue
set lng to length of xs
repeat with i from 1 to lng
set v to |λ|(v, item i of xs, i, xs)
end repeat
return v
end tell
end foldl
-- foldr :: (a -> b -> a) -> a -> [b] -> a
on foldr(f, startValue, xs)
tell mReturn(f)
set v to startValue
set lng to length of xs
repeat with i from lng to 1 by -1
set v to |λ|(v, item i of xs, i, xs)
end repeat
return v
end tell
end foldr
-- init :: [a] -> [a]
on init(xs)
set lng to length of xs
if lng > 1 then
items 1 thru -2 of xs
else if lng > 0 then
{}
else
missing value
end if
end init
-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
tell mReturn(f)
set lng to length of xs
set lst to {}
repeat with i from 1 to lng
set end of lst to |λ|(item i of xs, i, xs)
end repeat
return lst
end tell
end map
-- min :: Ord a => a -> a -> a
on min(x, y)
if y < x then
y
else
x
end if
end min
-- Lift 2nd class handler function into 1st class script wrapper
-- mReturn :: Handler -> Script
on mReturn(f)
if class of f is script then
f
else
script
property |λ| : f
end script
end if
end mReturn
-- scanl :: (b -> a -> b) -> b -> [a] -> [b]
on scanl(f, startValue, xs)
tell mReturn(f)
set v to startValue
set lng to length of xs
set lst to {startValue}
repeat with i from 1 to lng
set v to |λ|(v, item i of xs, i, xs)
set end of lst to v
end repeat
return lst
end tell
end scanl
-- scanl1 :: (a -> a -> a) -> [a] -> [a]
on scanl1(f, xs)
if length of xs > 0 then
scanl(f, item 1 of xs, tail(xs))
else
{}
end if
end scanl1
-- scanr :: (b -> a -> b) -> b -> [a] -> [b]
on scanr(f, startValue, xs)
tell mReturn(f)
set v to startValue
set lng to length of xs
set lst to {startValue}
repeat with i from lng to 1 by -1
set v to |λ|(v, item i of xs, i, xs)
set end of lst to v
end repeat
return reverse of lst
end tell
end scanr
-- scanr1 :: (a -> a -> a) -> [a] -> [a]
on scanr1(f, xs)
if length of xs > 0 then
scanr(f, item -1 of xs, init(xs))
else
{}
end if
end scanr1
-- tail :: [a] -> [a]
on tail(xs)
if length of xs > 1 then
items 2 thru -1 of xs
else
{}
end if
end tail
-- zip :: [a] -> [b] -> [(a, b)]
on zip(xs, ys)
set lng to min(length of xs, length of ys)
set lst to {}
repeat with i from 1 to lng
set end of lst to {item i of xs, item i of ys}
end repeat
return lst
end zip
|
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i3-7100_9_0x84_notsx.log_21829_526.asm | ljhsiun2/medusa | 9 | 98696 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x6d6e, %rcx
nop
sub $57975, %r14
movups (%rcx), %xmm1
vpextrq $0, %xmm1, %rbp
nop
nop
nop
nop
xor $6757, %r9
lea addresses_normal_ht+0x11ee, %rsi
lea addresses_normal_ht+0x1756e, %rdi
nop
nop
nop
nop
nop
and $27031, %rbx
mov $0, %rcx
rep movsw
nop
nop
nop
nop
and %rbp, %rbp
lea addresses_UC_ht+0xa16e, %rsi
lea addresses_A_ht+0x556e, %rdi
cmp %r8, %r8
mov $46, %rcx
rep movsw
nop
nop
nop
nop
sub $49315, %rsi
lea addresses_D_ht+0x1bb6e, %rbp
nop
nop
nop
nop
nop
add %r8, %r8
movb (%rbp), %bl
nop
nop
nop
nop
xor $34627, %r14
lea addresses_UC_ht+0xd922, %r14
sub $45733, %rcx
movb $0x61, (%r14)
nop
nop
nop
nop
nop
and $49852, %r14
lea addresses_D_ht+0x1c26e, %r8
nop
nop
cmp %rdi, %rdi
mov (%r8), %rbx
nop
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_WT_ht+0x1ef6e, %rsi
lea addresses_A_ht+0x150be, %rdi
nop
nop
nop
nop
and %rbp, %rbp
mov $122, %rcx
rep movsw
xor %rbx, %rbx
lea addresses_normal_ht+0x96fe, %rsi
lea addresses_WC_ht+0xdd6e, %rdi
xor %r9, %r9
mov $28, %rcx
rep movsb
inc %rsi
lea addresses_normal_ht+0x17086, %rsi
lea addresses_UC_ht+0x1416e, %rdi
nop
inc %r14
mov $10, %rcx
rep movsw
nop
nop
nop
sub $45587, %rbx
lea addresses_WT_ht+0x13bf6, %rdi
nop
nop
nop
nop
nop
xor $12633, %r14
mov $0x6162636465666768, %r9
movq %r9, %xmm2
vmovups %ymm2, (%rdi)
nop
nop
cmp $10597, %rcx
lea addresses_WC_ht+0x566e, %rcx
nop
inc %rdi
movb (%rcx), %r8b
nop
nop
nop
nop
and $1263, %rdi
lea addresses_A_ht+0x4cb2, %rbp
nop
nop
nop
nop
nop
and %r14, %r14
mov (%rbp), %rcx
nop
nop
add $47973, %rbx
lea addresses_normal_ht+0xd22e, %rsi
lea addresses_normal_ht+0x1682e, %rdi
nop
nop
sub %r14, %r14
mov $40, %rcx
rep movsl
nop
nop
nop
nop
nop
xor $41439, %rdi
lea addresses_UC_ht+0x72be, %rsi
lea addresses_UC_ht+0xf350, %rdi
nop
nop
nop
nop
nop
sub %r14, %r14
mov $25, %rcx
rep movsl
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_WT_ht+0x13a48, %r14
nop
nop
nop
nop
nop
inc %rsi
movw $0x6162, (%r14)
nop
nop
nop
cmp %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %r15
push %r8
push %r9
// Store
lea addresses_D+0x1046e, %r14
nop
nop
nop
nop
inc %r8
mov $0x5152535455565758, %r9
movq %r9, %xmm5
vmovups %ymm5, (%r14)
sub $56692, %r9
// Faulty Load
lea addresses_normal+0xdd6e, %r13
sub $24654, %r11
movntdqa (%r13), %xmm6
vpextrq $1, %xmm6, %r15
lea oracles, %r8
and $0xff, %r15
shlq $12, %r15
mov (%r8,%r15,1), %r15
pop %r9
pop %r8
pop %r15
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'same': True, 'size': 16, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'same': True, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT_ht', 'same': True, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'49': 605, '00': 15711, 'b7': 1, '45': 2933, '44': 2579}
00 00 00 00 00 00 00 00 00 49 44 44 44 00 45 45 45 45 00 00 00 00 44 44 44 00 00 00 45 45 00 00 00 00 00 00 44 00 00 00 00 45 45 00 00 00 00 00 00 44 00 44 00 00 00 00 45 00 00 00 00 00 49 44 44 44 00 00 45 45 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 44 44 44 00 00 00 00 00 00 00 00 00 44 00 00 00 45 00 00 00 00 00 00 44 44 00 00 00 45 45 00 00 00 00 49 44 44 00 00 00 45 00 00 00 44 44 00 00 45 45 45 00 00 00 00 00 44 00 00 00 00 00 00 00 44 49 00 44 00 45 45 45 45 00 00 00 00 00 00 44 44 44 44 00 00 00 45 00 00 00 00 00 00 44 44 00 45 45 00 00 00 00 44 44 00 00 00 00 00 00 45 00 00 00 00 00 44 44 00 00 00 00 00 00 00 00 00 49 44 00 00 45 45 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 44 44 00 00 00 45 45 45 00 00 00 00 00 49 44 00 00 00 45 00 00 00 00 00 00 00 00 00 49 44 44 00 00 00 45 00 00 00 00 00 49 44 00 44 44 00 00 00 00 00 00 45 00 00 00 00 44 00 00 45 45 45 00 00 00 00 00 00 00 00 45 45 45 00 00 00 44 00 00 00 00 00 00 00 00 00 44 00 00 00 45 00 00 00 00 00 49 44 00 00 00 00 45 45 45 00 00 00 00 00 00 49 00 00 45 45 45 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 44 44 00 00 45 45 00 00 00 00 00 00 00 00 44 44 00 00 00 00 45 00 00 00 00 00 00 49 00 00 00 00 00 00 00 45 45 00 00 00 00 00 44 44 00 00 00 00 00 00 44 00 00 00 45 45 00 00 00 00 00 00 00 49 44 44 00 00 00 00 00 00 00 00 00 44 44 44 00 00 45 00 00 00 00 44 00 00 00 45 00 00 00 00 00 00 44 44 00 00 00 00 00 00 00 49 44 00 00 45 00 00 00 00 00 00 00 00 44 44 45 00 45 00 45 00 00 00 00 00 00 44 00 00 45 45 00 00 00 00 00 49 00 00 00 45 45 45 45 00 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 44 00 00 00 45 45 45 00 00 00 00 00 44 44 00 00 00 45 00 00 00 00 00 44 00 00 45 00 00 00 00 00 00 44 00 00 45 45 00 00 00 00 00 44 44 00 45 00 00 45 00 00 00 00 00 44 44 45 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 44 45 00 00 00 00 00 00 49 44 00 00 00 00 00 00 45 00 00 00 00 00 00 44 00 00 00 49 00 44 00 00 00 45 00 00 00 00 00 44 00 00 00 00 45 45 45 00 00 00 00 00 00 44 00 00 00 45 45 00 00 00 00 00 00 00 44 44 00 45 45 45 00 00 00 00 00 44 00 00 00 45 00 00 00 00 44 00 00 00 00 00 45 45 45 00 00 00 00 44 00 00 00 00 00 00 00 45 45 00 00 00 49 44 00 00 00 00 00 00 00 00 00 00 00 44 44 00 00 45 45 45 00 00 00 00 00 44 44 00 00 00 45 00 00 00 00 00 00 44 44 00 00 00 45 45 00 00 00 00 00 00 49 44 00 45 45 45 00 00 00 00 00 00 00 00 44 44 44 00 00 00 00 00 45 00 00 00 00 00 44 44 00 00 00 45 45 00 00 00 00 49 49 44 44 00 00 00 45 45 00 45 00 00 00 00 00 00 49 44 00 00 00 45 00 00 00 00 00 44 44 00 00 45 45 00 00 00 00 00 00 00 44 00 00 00 00 00 44 44 44 45 00 00 00 00 00 44 00 00 00 00 00 45 45 00 00 00 00 44 00 00 00 45 45 45 00 00 00 00 49 00 00 00 00 00 45 45 00 00 00 00 44 00 00 00 49 44 44 00 00 45 45 00 00 00 00 00 00 00 44 00 00 45 45 45 00 00 00 00 44 44 00 45 45 45 00 00 00 00 44 00 00 00 45 00 00 00 44 00 00 00 00 00 00 00 00 49 44 44 00 00 00 00 00 00 44 44 44 00 00 45 45 45 00 00 44 44 00 00 45 45 00 45 00 00 00 00 00 00 44 00 00 00
*/
|
oeis/002/A002739.asm | neoneye/loda-programs | 11 | 5561 | <filename>oeis/002/A002739.asm
; A002739: a(n) = ((2*n-1)! /(2*n!*(n-2)!))*((n^3-3*n^2+2*n+2)/(n^2-1)).
; Submitted by <NAME>
; 1,10,91,651,4026,22737,120835,615043,3031678,14578928,68747966,319075550,1461581460,6621579135,29718121635,132302508195,584868588150,2569600678260,11227927978410,48822435838410,211370463290220,911509393468050,3916793943349326,16776146058210126,71641860657928876
mov $2,$0
add $0,2
seq $0,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!).
seq $2,158842 ; 1 + n*(n+1)*(n-1)/2.
mul $0,$2
div $0,2
|
GradeAlloc.asm | CallMeMengMeng/ASSEMBLY-LANGUAGE | 0 | 1013 | <filename>GradeAlloc.asm<gh_stars>0
; ALLOCATE THE GRADES OF 12 STUDENTS TO SIX SECTIONS: <60, 60-69, 70-79, 80-89, 90-99, 100
DATA SEGMENT
TABLE DB 76,69,82,90,54,42,59,68,71,86,91,100 ; STORE GRADES OF TWELVE STUDENTS
S10 DB (0) ; STORE THE NUMBER OF STUDENTS WHOSE GRADE IS 100
S9 DB (0) ; STORE THE NUMBER OF STUDENTS WHOSE GRADE IS BETWEEN 90 TO 99
S8 DB (0) ; STORE THE NUMBER OF STUDENTS WHOSE GRADE IS BETWEEN 80 TO 89
S7 DB (0) ; STORE THE NUMBER OF STUDENTS WHOSE GRADE IS BETWEEN 70 TO 79
S6 DB (0) ; STORE THE NUMBER OF STUDENTS WHOSE GRADE IS BETWEEN 60 TO 69
S5 DB (0) ; STORE THE NUMBER OF STUDENTS WHOSE GRADE IS BELOW 60
LEN EQU S10-TABLE ; THE QUANTITY OF STUDENTS
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START: MOV AX,DATA
MOV DS,AX
MOV CX,LEN
LEA SI,TABLE ; GET THE START ADDRESS OF TABLE
NEXT: MOV AL,[SI] ; MOVE THE FIRST GRADE TO AL
CMP AL,59 ; COMPARE WITH 59
JNA AGAIN1 ; IF GRADE IS NOT ABOVE 59 JUMP TO AGAIN1
CMP AL,69 ; 60-69?
JNA AGAIN2
CMP AL,79 ; 70-79?
JNA AGAIN3
CMP AL,89 ; 80-89?
JNA AGAIN4
CMP AL,99 ; 90-99?
JNA AGAIN5
CMP AL,100 ; 100?
JNA AGAIN6
AGAIN1: INC S5
INC SI
DEC CX
JNZ NEXT
HLT
AGAIN2: INC S6
INC SI
DEC CX
JNZ NEXT
HLT
AGAIN3: INC S7
INC SI
DEC CX
JNZ NEXT
HLT
AGAIN4: INC S8
INC SI
DEC CX
JNZ NEXT
HLT
AGAIN5: INC S9
INC SI
DEC CX
JNZ NEXT
HLT
AGAIN6: INC S10
INC SI
DEC CX
JNZ NEXT
HLT
CODE ENDS
END START |
src/ada-core/src/linted-tagged_accessors.ads | mstewartgallus/linted | 0 | 799 | -- Copyright 2017 <NAME>
--
-- 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.
private with System;
generic
type Element_T;
type Access_T is access Element_T;
package Linted.Tagged_Accessors is
pragma Preelaborate;
type Tagged_Access is private with
Preelaborable_Initialization;
type Tag_Bits is mod 2**22 with
Default_Value => 0;
function To (Ptr : Access_T) return Tagged_Access with
Inline_Always;
function To (Ptr : Access_T; Tag : Tag_Bits) return Tagged_Access with
Inline_Always;
function From (Ptr : Tagged_Access) return Access_T with
Inline_Always;
function Tag (Ptr : Tagged_Access) return Tag_Bits with
Inline_Always;
private
type Uintptr is mod System.Memory_Size;
type Tagged_Access is new Uintptr with
Default_Value => 0;
end Linted.Tagged_Accessors;
|
Cubical/Categories/NaturalTransformation.agda | dan-iel-lee/cubical | 0 | 5858 | {-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Categories.NaturalTransformation where
open import Cubical.Categories.NaturalTransformation.Base public
open import Cubical.Categories.NaturalTransformation.Properties public
|
programs/oeis/010/A010884.asm | neoneye/loda | 22 | 25328 | ; A010884: Simple periodic sequence: repeat 1,2,3,4,5.
; 1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1
mod $0,5
add $0,1
|
programs/oeis/105/A105337.asm | karttu/loda | 1 | 103523 | ; A105337: a(n) = n*(n+1)/2 mod 256.
; 0,1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153,171,190,210,231,253,20,44,69,95,122,150,179,209,240,16,49,83,118,154,191,229,12,52,93,135,178,222,11,57,104,152,201,251,46,98,151,205,4,60,117,175,234,38,99
mov $1,$0
pow $0,2
add $1,5
add $1,$0
div $1,2
mod $1,256
sub $1,2
|
alloy4fun_models/trashltl/models/10/M5scCMiShnzaL5F58.als | Kaixi26/org.alloytools.alloy | 0 | 2249 | <gh_stars>0
open main
pred idM5scCMiShnzaL5F58_prop11 {
File - Protected in Protected'
}
pred __repair { idM5scCMiShnzaL5F58_prop11 }
check __repair { idM5scCMiShnzaL5F58_prop11 <=> prop11o } |
safari.applescript | Kriechi/osx-application-backups | 0 | 4354 | <filename>safari.applescript<gh_stars>0
#!/usr/bin/osascript
# https://github.com/thepoch/iCloudBackup.git
on run argv
try
set filepath to item 1 of argv
on error
return "path required as first argument"
end try
try
set filename to item 2 of argv
on error
return "filename required as second argument without file extension"
end try
set SecondsDelay to 1
tell application "Safari"
activate
delay SecondsDelay
reopen
activate
end tell
tell application "System Events" to tell process "Safari"
click menu item "Export Bookmarks…" of menu "File" of menu bar item "File" of menu bar 1
delay SecondsDelay
tell application "System Events" to keystroke "g" using {command down, shift down}
delay SecondsDelay
tell application "System Events" to keystroke filepath
delay SecondsDelay
tell application "System Events" to keystroke return
delay SecondsDelay
tell application "System Events" to keystroke filename
delay SecondsDelay
tell application "System Events" to keystroke return
delay SecondsDelay
if sheet 1 of window "Export Bookmarks" exists then
click button "Replace" of sheet 1 of window "Export Bookmarks"
end if
end tell
end run
|
arch/RISC-V/SiFive/drivers/gpio0/sifive-gpio.ads | rocher/Ada_Drivers_Library | 192 | 15640 | <reponame>rocher/Ada_Drivers_Library
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017-2019, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with System.Storage_Elements;
with HAL.GPIO;
package SiFive.GPIO is
type GPIO_Pin_Index is range 0 .. 31;
-- Indentifier of
type GPIO_Pin_Number is range 1 .. 31;
-- Number of GPIO pins available on a controller
type GPIO_Controller
(Base_Address : System.Storage_Elements.Integer_Address)
is private;
type Any_GPIO_Controller is access all GPIO_Controller;
type GPIO_Point (Controller : not null Any_GPIO_Controller;
Pin : GPIO_Pin_Index)
is new HAL.GPIO.GPIO_Point
with
private;
procedure Invert (This : in out GPIO_Point;
Enabled : Boolean := True);
-- Invert the output level
function Inverted (This : GPIO_Point) return Boolean;
---------------
-- HAL.GPIO --
---------------
overriding
function Support (This : GPIO_Point;
Capa : HAL.GPIO.Capability)
return Boolean
is (case Capa is
when HAL.GPIO.Pull_Down => False,
when others => True);
overriding
function Mode (This : GPIO_Point) return HAL.GPIO.GPIO_Mode;
overriding
procedure Set_Mode (This : in out GPIO_Point;
Mode : HAL.GPIO.GPIO_Config_Mode);
overriding
function Pull_Resistor (This : GPIO_Point)
return HAL.GPIO.GPIO_Pull_Resistor;
overriding
procedure Set_Pull_Resistor (This : in out GPIO_Point;
Pull : HAL.GPIO.GPIO_Pull_Resistor);
overriding
function Set (This : GPIO_Point) return Boolean;
overriding
procedure Set (This : in out GPIO_Point);
overriding
procedure Clear (This : in out GPIO_Point);
overriding
procedure Toggle (This : in out GPIO_Point);
private
type GPIO_Controller
(Base_Address : System.Storage_Elements.Integer_Address)
is null record;
type GPIO_Point (Controller : not null Any_GPIO_Controller;
Pin : GPIO_Pin_Index)
is new HAL.GPIO.GPIO_Point
with null record;
end SiFive.GPIO;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_3101.asm | ljhsiun2/medusa | 9 | 103245 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WC+0x13215, %rdi
nop
nop
nop
nop
cmp %rcx, %rcx
movb $0x51, (%rdi)
nop
nop
nop
and $25427, %r8
// Load
lea addresses_WT+0xfa15, %rbp
nop
inc %rsi
mov (%rbp), %r8
nop
nop
and %rbp, %rbp
// Faulty Load
lea addresses_A+0x9a15, %rcx
nop
nop
nop
sub $65501, %r13
vmovups (%rcx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %rsi
lea oracles, %r8
and $0xff, %rsi
shlq $12, %rsi
mov (%r8,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
src/Categories/GlobularSet.agda | Trebor-Huang/agda-categories | 279 | 9929 | <filename>src/Categories/GlobularSet.agda
{-# OPTIONS --without-K --safe #-}
module Categories.GlobularSet where
-- Globular sets are defined in a Categorical context, but
-- should they be inside the Categories hierarchy?
open import Level
open import Data.Unit using (⊤)
open import Relation.Binary.PropositionalEquality using (refl)
open import Categories.Category
open import Categories.Category.Instance.Globe
open import Categories.Category.Instance.Sets
open import Categories.Functor
open import Categories.Functor.Presheaf
private
variable
o ℓ e : Level
GlobularSet : (o : Level) → Set (suc o)
GlobularSet o = Presheaf Globe (Sets o)
-- TODO? make universe polymorphic with polymorphic ⊤
Trivial : GlobularSet zero
Trivial = record
{ F₀ = λ _ → ⊤
; F₁ = λ _ x → x
; identity = refl
; homomorphism = refl
; F-resp-≈ = λ _ → refl
}
GlobularObject : Category o ℓ e → Set _
GlobularObject C = Functor (Category.op Globe) C
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.