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 |
|---|---|---|---|---|
1-base/math/source/generic/pure/algebra/any_math-any_algebra-any_linear.ads | charlie5/lace | 20 | 7331 | generic
package any_Math.any_Algebra.any_linear
is
pragma Pure;
----------
-- Vector
--
function Norm_squared (Self : in Vector) return Real; -- Length squared.
function Normalised (Self : in Vector) return Vector;
procedure Normalise (Self : in out Vector);
function Normalised (Self : in Vector_2) return Vector_2;
procedure Normalise (Self : in out Vector_2);
function Normalised (Self : in Vector_3) return Vector_3;
procedure Normalise (Self : in out Vector_3);
function Min (Left, Right : in Vector) return Vector;
function Max (Left, Right : in Vector) return Vector;
function Scaled (Self : in Vector; By : in Vector) return Vector;
----------
-- Matrix
--
function to_Matrix (Row_1,
Row_2,
Row_3 : in Vector_3) return Matrix_3x3;
function Identity (Size : in Index := 3) return Matrix;
function Min (Self : in Matrix) return Real;
function Max (Self : in Matrix) return Real;
function Image (Self : in Matrix) return String;
procedure invert (Self : in out Matrix);
function is_Square (Self : in Matrix) return Boolean;
function sub_Matrix (Self : in Matrix;
start_Row, end_Row : in Index;
start_Col, end_Col : in Index) return Matrix;
---------------
-- Quaternion
--
function to_Quaternion (axis_X,
axis_Y,
axis_Z : in Real;
Angle : in Real) return Quaternion;
--
-- Returns a quaternion defined by a rotation about an axis.
-- (TODO: rid this and use Vector_3 version instead.)
function to_Quaternion (Axis : in Vector_3;
Angle : in Real) return Quaternion;
--
-- Returns a quaternion defined by a rotation about an axis.
function to_Quaternion (Self : in Matrix_3x3) return Quaternion;
function "*" (Self : in Quaternion; By : in Quaternion) return Quaternion;
--
-- Grassmann product.
function Unit (Self : in Quaternion) return Quaternion;
function Conjugate (Self : in Quaternion) return Quaternion;
--
-- (TODO: only for unit quaternions.)
function euler_Angles (Self : in Quaternion) return Vector_3;
function infinitesimal_Rotation_from
(Self : in Quaternion; angular_Velocity : in Vector_3) return Quaternion;
--
-- An infinitesimal rotation may be multiplied by a duration and then added to the original attitude
-- to produce the attitude at the given time.
function Normalised (Self : in Quaternion) return Quaternion;
procedure normalise (Self : in out Quaternion);
private
pragma Inline ("*");
pragma Inline_Always (Norm_squared);
pragma Inline_Always (Normalise);
end any_Math.any_Algebra.any_linear;
|
oeis/141/A141722.asm | neoneye/loda-programs | 11 | 17495 | <gh_stars>10-100
; A141722: a(n) = 8*4^n - 7.
; 1,25,121,505,2041,8185,32761,131065,524281,2097145,8388601,33554425,134217721,536870905,2147483641,8589934585,34359738361,137438953465,549755813881,2199023255545,8796093022201,35184372088825,140737488355321,562949953421305,2251799813685241,9007199254740985,36028797018963961,144115188075855865,576460752303423481,2305843009213693945,9223372036854775801,36893488147419103225,147573952589676412921,590295810358705651705,2361183241434822606841,9444732965739290427385,37778931862957161709561
mov $1,4
pow $1,$0
mul $1,8
sub $1,7
mov $0,$1
|
programs/oeis/122/A122760.asm | karttu/loda | 0 | 244315 | <filename>programs/oeis/122/A122760.asm
; A122760: Triangle read by rows: t(n,m) = 2*3^m*(n mod 2).
; 0,2,6,0,0,0,2,6,18,54,0,0,0,0,0,2,6,18,54,162,486,0,0,0,0,0,0,0,2,6,18,54,162,486,1458,4374,0,0,0,0,0,0,0,0,0,2,6,18,54,162,486,1458,4374,13122,39366,0,0,0,0,0,0,0,0,0,0,0
lpb $0,1
add $2,4
sub $0,$2
sub $0,1
lpe
sub $0,1
add $1,3
pow $1,$0
mul $1,2
|
ada/original_2008/ada-gui/agar-gui-widget-box.ads | auzkok/libagar | 286 | 6454 | <filename>ada/original_2008/ada-gui/agar-gui-widget-box.ads
package agar.gui.widget.box is
use type c.unsigned;
type type_t is (BOX_HORIZ, BOX_VERT);
for type_t use (BOX_HORIZ => 0, BOX_VERT => 1);
for type_t'size use c.unsigned'size;
pragma convention (c, type_t);
type flags_t is new c.unsigned;
BOX_HOMOGENOUS : constant flags_t := 16#01#;
BOX_HFILL : constant flags_t := 16#02#;
BOX_VFILL : constant flags_t := 16#04#;
BOX_FRAME : constant flags_t := 16#08#;
BOX_EXPAND : constant flags_t := BOX_HFILL or BOX_VFILL;
type box_t is limited private;
type box_access_t is access all box_t;
pragma convention (c, box_access_t);
function allocate
(parent : widget_access_t;
box_type : type_t;
flags : flags_t) return box_access_t;
pragma import (c, allocate, "AG_BoxNew");
function allocate_horizontal
(parent : widget_access_t;
flags : flags_t) return box_access_t;
pragma inline (allocate_horizontal);
function allocate_vertical
(parent : widget_access_t;
flags : flags_t) return box_access_t;
pragma inline (allocate_vertical);
procedure set_homogenous
(box : box_access_t;
homogenous : boolean);
pragma inline (set_homogenous);
procedure set_padding
(box : box_access_t;
padding : natural);
pragma inline (set_padding);
procedure set_spacing
(box : box_access_t;
spacing : natural);
pragma inline (set_spacing);
procedure set_depth
(box : box_access_t;
depth : natural);
pragma inline (set_depth);
function widget (box : box_access_t) return widget_access_t;
pragma inline (widget);
private
type box_t is record
widget : aliased widget_t;
box_type : type_t;
flags : flags_t;
padding : c.int;
spacing : c.int;
depth : c.int;
end record;
pragma convention (c, box_t);
end agar.gui.widget.box;
|
Transynther/x86/_processed/US/_ht_zr_un_/i9-9900K_12_0xca_notsx.log_183_1284.asm | ljhsiun2/medusa | 9 | 20351 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r8
push %r9
push %rbx
push %rdi
// Store
lea addresses_PSE+0x1f2e8, %r14
nop
nop
sub %r15, %r15
mov $0x5152535455565758, %r11
movq %r11, %xmm0
vmovups %ymm0, (%r14)
nop
nop
sub %r14, %r14
// Load
lea addresses_US+0x19068, %r11
nop
nop
add %rdi, %rdi
mov (%r11), %r15
nop
nop
nop
add $25095, %rdi
// Faulty Load
lea addresses_US+0x19068, %r9
nop
nop
nop
nop
sub $31021, %r11
movb (%r9), %bl
lea oracles, %r11
and $0xff, %rbx
shlq $12, %rbx
mov (%r11,%rbx,1), %rbx
pop %rdi
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
<gen_prepare_buffer>
{'68': 2, '00': 180, 'd0': 1}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
engine.asm | ISSOtm/Aevilia-GB | 53 | 10571 | <reponame>ISSOtm/Aevilia-GB
INCLUDE "macros.asm"
INCLUDE "constants.asm"
INCLUDE "engine/animations.asm"
INCLUDE "engine/debug_menus.asm"
INCLUDE "engine/credits.asm"
INCLUDE "engine/error_handler.asm"
INCLUDE "engine/intro_cutscene.asm"
INCLUDE "engine/save.asm"
INCLUDE "engine/start_menu.asm"
INCLUDE "engine/text.asm"
INCLUDE "engine/thread2.asm"
INCLUDE "engine/title_screen.asm"
|
oeis/081/A081903.asm | neoneye/loda-programs | 11 | 17593 | ; A081903: A sequence related to binomial(n+5, 5).
; Submitted by <NAME>
; 1,10,85,660,4830,33876,230030,1522400,9866375,62828750,394146875,2440812500,14944687500,90590625000,544242187500,3243437500000,19189111328125,112777832031250,658804931640625,3827075195312500,22117736816406250,127216186523437500,728480529785156250,4154296875000000000,23599224090576171875,133574485778808593750,753476619720458984375,4236650466918945312500,23749828338623046875000,132756233215332031250000,740067958831787109375000,4115009307861328125000000,22824861109256744384765625
mov $1,1
mov $2,1
mov $3,$0
mov $0,5
mov $4,1
lpb $3
add $0,1
mul $1,$3
mul $1,$0
mul $2,4
sub $3,1
add $5,$4
div $1,$5
add $2,$1
add $4,2
lpe
mov $0,$2
|
libsrc/_DEVELOPMENT/string/c/sccz80/strset_callee.asm | Frodevan/z88dk | 640 | 169204 |
; char* strset(char *s, int c)
SECTION code_clib
SECTION code_string
PUBLIC strset_callee
EXTERN asm_strset
strset_callee:
IF __CPU_GBZ80__
pop bc
pop de
pop hl
push bc
call asm_strset
ld d,h
ld e,l
ret
ELSE
pop hl
pop de
ex (sp),hl
jp asm_strset
ENDIF
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _strset_callee
defc _strset_callee = strset_callee
ENDIF
|
libsrc/input/spectrum/INMouseKemp.asm | andydansby/z88dk-mk2 | 1 | 105439 | ; Read Kempston Mouse
; 08.2003 aralbrec
; based on <NAME>'s Kempston Mouse
; driver for Spectrum Basic (2003)
XLIB INMouseKemp
XREF _in_KempcoordX, _in_KempcoordY
XREF _in_KemprawX, _in_KemprawY
; exit : C = button state 000000RL active high
; B = X coordinate (0..255)
; A = Y coordinate (0..191)
; uses : AF,BC,E
.INMouseKemp
ld a,(_in_KempcoordX)
ld b,a
ld a,(_in_KemprawX)
ld e,a
ld a,$fb
in a,($df)
ld (_in_KemprawX),a
sub e ; A = delta X
jp pe, overflowX ; kill the X movement if overflow
jp m, negdx
.posdx
add a,b
jr nc, Xok
ld a,255
jp Xok
.negdx
add a,b
jp po, Xok
xor a
.Xok
ld (_in_KempcoordX),a
ld b,a
.overflowX
.dobuts
ld a,$fa
in a,($df)
and $03
ld c,a
rla
srl c
or $fc
or c
cpl
ld c,a ; c = buttons 000000RL active high
.doY
ld a,(_in_KemprawY)
ld e,a
ld a,$ff
in a,($df)
ld (_in_KemprawY),a
sub e
ld e,a ; E = delta Y
ld a,(_in_KempcoordY)
sub e
cp 192
jr c, Yok
add a,e ; Y moved off screen, were we close to top or bottom?
cp 96
ld a,191
jr nc, Yok
xor a
.Yok
ld (_in_KempcoordY),a
ret
|
test/jzas/sintactic/valid/success38.asm | scoffey/jz80sim | 1 | 83867 | aseg
org 3000h
start0: jp start
transponer: ld (aux), BC
ld (aux+2), DE
ld (aux+4), IX
ld (aux+6), IY ; resguarda los registros
pop DE ; levanta dir de ret
pop IX ; IX = matriz
pop BC ; B = cant columnas, C = basura
push DE ; restaura dir de ret
push AF ; resguarda AF
ld D, 0
ld E, B ; DE = desplazamiento para sig. fila
dec B ; salteo la diagonal
ld C, B ; resguardo B en C
push IX ; resguardo IX = matriz
cicloFila: push IX
pop IY ; paso IX a IY
ld B, C ; recargo B
cicloCol: inc IX ; IX apunta al sig. elemento de la fila
add IY, DE ; IY apunta a la sig. columna
ld A, (IX)
ld (aux+8), A ; (aux+8) = (IX)
ld A, (IY)
ld (IX), A ; (IY) = (IX)
ld A, (aux+8)
ld (IY), A ; (IY) = (aux+8)
djnz cicloCol
pop IX ; IX recupera la dir inicial
add IX, DE ; y se desplaza por la diagonal
inc IX ; sumando cant. columnas +1
push IX ; se vuelve a pasar IX por el stack
dec C ; C-=1 (itera por filas)
jp NZ, cicloFila
pop IX ; restauraciones
pop AF
ld IY, (aux+6)
ld IX, (aux+4)
ld DE, (aux+2)
ld BC, (aux)
jr aux+9
aux: ds 9
ret
start: ld SP,0
ld B, 5
ld C, 0
push BC
ld BC, matriz
push BC
call transponer
rst 38h
matriz: db 11h,12h,13h,14h,15h,21h,22h,23h,24h,25h,31h,32h,33h,34h,35h,41h,42h,43h,44h,45h,51h,52h,53h,54h,55h
end start0
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_12034_1327.asm | ljhsiun2/medusa | 9 | 263 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x105b1, %rsi
lea addresses_A_ht+0x191b1, %rdi
nop
nop
nop
and %r15, %r15
mov $8, %rcx
rep movsq
nop
nop
nop
nop
sub $18206, %r12
lea addresses_A_ht+0x16cc4, %rsi
lea addresses_A_ht+0xb6b1, %rdi
nop
nop
sub %r11, %r11
mov $29, %rcx
rep movsw
add %r15, %r15
lea addresses_WC_ht+0x7f31, %rsi
lea addresses_WC_ht+0xacb1, %rdi
nop
nop
nop
nop
add %rbx, %rbx
mov $14, %rcx
rep movsl
add $5267, %rcx
lea addresses_UC_ht+0x1dc0, %rsi
nop
xor %rcx, %rcx
mov $0x6162636465666768, %rbx
movq %rbx, (%rsi)
nop
nop
nop
nop
inc %rdi
lea addresses_UC_ht+0x1d531, %rcx
nop
and $56043, %r12
movb (%rcx), %bl
nop
nop
nop
nop
and %rbx, %rbx
lea addresses_A_ht+0x4611, %rsi
lea addresses_D_ht+0xa6b1, %rdi
nop
sub $9537, %r12
mov $109, %rcx
rep movsl
nop
nop
cmp $2037, %r15
lea addresses_D_ht+0x1bab1, %r12
nop
and $46942, %r15
mov (%r12), %rbx
nop
nop
nop
and %rcx, %rcx
lea addresses_A_ht+0x1182c, %rsi
lea addresses_WC_ht+0x162b1, %rdi
nop
nop
cmp $46712, %r9
mov $10, %rcx
rep movsq
add %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_WT+0x1c971, %rsi
lea addresses_D+0x1439d, %rdi
sub $53308, %rax
mov $99, %rcx
rep movsq
nop
nop
nop
nop
nop
and %rsi, %rsi
// Faulty Load
lea addresses_PSE+0xcab1, %rbp
sub %r12, %r12
mov (%rbp), %r14d
lea oracles, %rcx
and $0xff, %r14
shlq $12, %r14
mov (%rcx,%r14,1), %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 2, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'33': 12034}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
oeis/062/A062159.asm | neoneye/loda-programs | 11 | 13418 | <reponame>neoneye/loda-programs
; A062159: a(n) = n^5 - n^4 + n^3 - n^2 + n - 1.
; -1,0,21,182,819,2604,6665,14706,29127,53144,90909,147630,229691,344772,501969,711914,986895,1340976,1790117,2352294,3047619,3898460,4929561,6168162,7644119,9390024,11441325,13836446,16616907,19827444,23516129,27734490,32537631,37984352,44137269,51062934,58831955,67519116,77203497,87968594,99902439,113097720,127651901,143667342,161251419,180516644,201580785,224566986,249603887,276825744,306372549,338390150,373030371,410451132,450816569,494297154,541069815,591318056,645232077,703008894,764852459
mov $1,2
mov $2,$0
add $2,1
mov $3,2
add $3,$0
sub $1,$3
pow $1,6
sub $1,1
div $1,$2
mov $0,$1
|
libsrc/_DEVELOPMENT/adt/p_forward_list_alt/z80/asm_p_forward_list_alt_front.asm | jpoikela/z88dk | 640 | 91969 | <reponame>jpoikela/z88dk
; ===============================================================
; Dec 2013
; ===============================================================
;
; void *p_forward_list_alt_front(p_forward_list_alt_t *list)
;
; Return item at front of list without removing it from the list.
;
; ===============================================================
SECTION code_clib
SECTION code_adt_p_forward_list_alt
PUBLIC asm_p_forward_list_alt_front
EXTERN asm_p_forward_list_front
defc asm_p_forward_list_alt_front = asm_p_forward_list_front
; enter : hl = p_forward_list_alt_t *list
;
; exit : success
;
; hl = void *item (item at front)
; nz flag set
;
; fail if list is empty
;
; hl = 0
; z flag set
;
; uses : af, hl
|
src/bootc/mbr.asm | devcfei/bootstrap-x86 | 0 | 104225 | %define org_start 7c00h
boot:
org org_start
jmp start
;******************************************************************************
; GDT MANUAL
;******************************************************************************
; GDT is an 8 byte QWORD value that describes properties for the descriptor.
; They are of the format:
;
; Bits 0-15: Bits 0-15 of the Segment Limit
; Bits 16-39: Bits 0-23 of the Base Address
; Bit 40: Access bit (Used with Virtual Memory)
; Bits 41-43: Descriptor Type
; Bit 43: Executable segment
; 0: Data Segment
; 1: Code Segment
; Bit 42: Expansion direction (Data segments), conforming (Code Segments)
; Bit 41: Readable and Writable
; 0: Read only (Data Segments); Execute only (Code Segments)
; 1: Read and write (Data Segments); Read and Execute (Code Segments)
; Bit 44: Descriptor Bit
; 0: System Descriptor
; 1: Code or Data Descriptor
; Bits 45-46: Descriptor Privilege Level
; 0: (Ring 0) Highest
; 3: (Ring 3) Lowest
; Bit 47 Segment is in memory (Used with Virtual Memory)
; Bits 48-51: Bits 16-19 of the segment limit
; Bits 52: Reserved for OS use (we can do whatever we want here)
; Bit 53: Reserved-Should be zero
; Bit 54: Segment type
; 0: 16 bit
; 1: 32 bit
; Bit 55: Granularity
; 0: None
; 1: Limit gets multiplied by 4K
; Bits 56-63: Bits 24-32 of the base address
;******************************************************************************
GDT_START:
DESC_SG_NULL:
dd 0x00000000
dd 0x00000000
DESC_SG_CODE:
dw 0xFFFF ; Bits 0-15
dw 0x0000 ; Bits 16-31
db 0x00 ; Bits 32-39
db 10011010b; Bits 40-47
db 11001111b; Bits 48-55
db 0x00 ; Bits 56-63
DESC_SG_DATA:
dw 0xFFFF ; Bits 0-15
dw 0x0000 ; Bits 16-31
db 0x00 ; Bits 32-39
db 10010010b; Bits 40-47
db 11001111b; Bits 48-55
db 0x00 ; Bits 56-63
DESC_SG_VIDEO:
dd 0x8000FFFF ; Base: 0x000b8000, Length 0xffff
dd 0x0040920B
DESC_SG_STACK:
dd 0x0000FFFF ; Base: 0x00000000, Length 0xffff
dd 0x00409600
GDT_END:
;Selector
SLCT_NULL equ DESC_SG_NULL - GDT_START
SLCT_CODE equ DESC_SG_CODE - GDT_START
SLCT_DATA equ DESC_SG_DATA - GDT_START
SLCT_VIDEO equ DESC_SG_VIDEO - GDT_START
SLCT_STACK equ DESC_SG_STACK - GDT_START
GDT_SIZE_DWORD equ (GDT_END - GDT_START) / 4
GDTR:
GDT_BOUND dw GDT_END - GDT_START - 1
GDT_BASE dd 0x7E00
[bits 16]
start:
mov ax, cs
mov ss, ax
mov sp, 0x7C00
;-----------------------------------------
; Clean the screen
;-----------------------------------------
call CleanScreen
;jmp $
;-----------------------------------------
; Read the Sector 1(LBA1) from HDD to 0x8000
;-----------------------------------------
call SectorRead
;mov ax, 800h ; Set ES:DI to 800h:0000h
;mov es, ax
;mov di, 0000h
;call do_e820
;call SectorWrite
;jmp $
;-----------------------------------------
; Setup GDT and jmp to 32bit mode
;-----------------------------------------
; ds:si source GDT
mov ax, cs
mov ds, ax
mov si, GDT_START
; es:di destination GDT
mov ax, [cs:GDT_BASE]
mov dx, [cs:GDT_BASE+2]
mov bx, 16
div bx
mov es, ax
mov di, 0
; copy the GDT
mov cx, GDT_SIZE_DWORD
cld
rep movsd
; load GDT
lgdt [cs: GDTR]
cli ; clear Interrupt
; Enalbe Protected Mode
mov eax, cr0
or eax, 0x1
mov cr0, eax
jmp dword SLCT_CODE:(pm32_start); now CS is the Selector
CleanScreen:
mov ah, 07h ; tells BIOS to scroll down window
mov al, 00h ; clear entire window
mov bh, 07h ; white on black
mov cx, 00h ; specifies top left of screen as (0,0)
mov dh, 18h ; 18h = 24 rows of chars
mov dl, 4fh ; 4fh = 79 cols of chars
int 10h ; calls video interrupt
ret
SectorRead:
mov ax, 800h ; Set ES:BX to 800h:0000h
mov es, ax
mov bx, 0000h
mov al, 16 ; Sector count = 1, 64K=128 sectors
mov dl, 80h ; Hard disk 80h=C: 81h=D:
mov dh, 0 ; Disk heads
mov ch, 0 ; Disk cylinders
mov cl, 2 ; Sector number
mov ah, 2 ; Read
int 13h
ret
SectorWrite:
mov ax, 800h ; Set ES:BX to 800h:0000h
mov es, ax
mov bx, 0000h
mov al, 1 ; Sector count = 1
mov dl, 80h ; Hard disk 80h=C: 81h=D:
mov dh, 0 ; Disk heads
mov ch, 0 ; Disk cylinders
mov cl, 3 ; Sector number
mov ah, 3 ; Write
int 13h
ret
; use the INT 0x15, eax= 0xE820 BIOS function to get a memory map
; inputs: es:di -> destination buffer for 24 byte entries
; outputs: bp = entry count, trashes all registers except esi
mmap_ent:
dw 0xfafa
do_e820:
xor ebx, ebx ; ebx must be 0 to start
xor bp, bp ; keep an entry count in bp
mov edx, 0x0534D4150 ; Place "SMAP" into edx
mov eax, 0xe820
mov [es:di + 20], dword 1 ; force a valid ACPI 3.X entry
mov ecx, 24 ; ask for 24 bytes
int 0x15
jc short .failed ; carry set on first call means "unsupported function"
mov edx, 0x0534D4150 ; Some BIOSes apparently trash this register?
cmp eax, edx ; on success, eax must have been reset to "SMAP"
jne short .failed
test ebx, ebx ; ebx = 0 implies list is only 1 entry long (worthless)
je short .failed
jmp short .jmpin
.e820lp:
mov eax, 0xe820 ; eax, ecx get trashed on every int 0x15 call
mov [es:di + 20], dword 1 ; force a valid ACPI 3.X entry
mov ecx, 24 ; ask for 24 bytes again
int 0x15
jc short .e820f ; carry set means "end of list already reached"
mov edx, 0x0534D4150 ; repair potentially trashed register
.jmpin:
jcxz .skipent ; skip any 0 length entries
cmp cl, 20 ; got a 24 byte ACPI 3.X response?
jbe short .notext
test byte [es:di + 20], 1 ; if so: is the "ignore this data" bit clear?
je short .skipent
.notext:
mov ecx, [es:di + 8] ; get lower uint32_t of memory region length
or ecx, [es:di + 12] ; "or" it with upper uint32_t to test for zero
jz .skipent ; if length uint64_t is 0, skip entry
inc bp ; got a good entry: ++count, move to next storage spot
add di, 24
.skipent:
test ebx, ebx ; if ebx resets to 0, list is complete
jne short .e820lp
.e820f:
mov [mmap_ent], bp ; store the entry count
clc ; there is "jc" on end of list to this point, so the carry must be cleared
ret
.failed:
stc ; "function unsupported" error exit
ret
[bits 32]
pm32_start:
; Set data segment
mov eax, SLCT_VIDEO
mov ds, eax
mov ebx, MSG
mov esi, 0
mov edi, 0
.lp:
mov al, [cs: ebx+esi]
test al, al
je .end
mov ah, 0x4 ; set Red
mov [edi], ax
inc esi
add edi, 2
jmp .lp
.end:
start_code:
mov ax, SLCT_DATA
mov ds, ax
mov ss, ax
mov es, ax
mov esp, 0x90000 ; stack begins from 0x90000
jmp dword SLCT_CODE:8000h
.tail:
jmp $
MSG db 'Already in protect mode...',0
.fill:
times 510-($-$$) db 0
dw 0xaa55 ; MBR signature |
extern/gnat_sdl/gnat_sdl2/src/intrin_impl_h.ads | AdaCore/training_material | 15 | 22299 | <reponame>AdaCore/training_material<gh_stars>10-100
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
package intrin_impl_h is
--*
-- * This file has no copyright assigned and is placed in the Public Domain.
-- * This file is part of the mingw-w64 runtime package.
-- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
--
-- There are 3 separate ways this file is intended to be used:
-- 1) Included from intrin.h. In this case, all intrinsics in this file get declarations and
-- implementations. No special #defines are needed for this case.
-- 2) Included from the library versions of these functions (ie mingw-w64-crt\intrincs\*.c). All
-- intrinsics in this file must also be included in the library. In this case, only the
-- specific functions requested will get defined, and they will not be defined as inline. If
-- you have followed the instructions (below) for adding functions to this file, then all you
-- need to have in the .c file is the following:
-- #define __INTRINSIC_ONLYSPECIAL
-- #define __INTRINSIC_SPECIAL___stosb // Causes code generation in intrin-impl.h
-- #include <intrin.h>
-- 3) Included from various platform sdk headers. Some platform sdk headers (such as winnt.h)
-- define a subset of intrinsics. To avoid potential conflicts, this file is designed to
-- allow for specific subsets of functions to be defined. This is done by defining the
-- appropriate variable before including this file:
-- #define __INTRINSIC_GROUP_WINNT
-- #include <psdk_inc/intrin-impl.h>
-- In all cases, it is acceptable to include this file multiple times in any order (ie include
-- winnt.h to get its subset, then include intrin.h to get everything, or vice versa).
-- See also the comments at the top of intrin.h.
--
-- To add an implementation for a new intrinsic to this file, you should comment out the current prototype in intrin.h.
-- If the function you are adding is not in intrin.h, you should not be adding it to this file. This file is only
-- for MSVC intrinsics.
-- Make sure you put your definition in the right section (x86 vs x64), and use this outline when adding definitions
-- to this file:
--#if __INTRINSIC_PROLOG(__int2c)
--<prototype goes here>
--__INTRINSICS_USEINLINE
--<code goes here>
--#define __INTRINSIC_DEFINED___int2c
--#endif
--
-- Note that there is no file-wide #if to prevent intrin-impl.h from being
-- included multiple times. This is because this file might be included multiple
-- times to define various subsets of the functions it contains.
-- However we do check for __MINGW_INTRIN_INLINE. In theory this means we
-- can work with other compilers.
-- These macros are used by the routines below. While this file may be included
-- multiple times, these macros only need to be defined once.
-- This macro is used by __stosb, __stosw, __stosd, __stosq
-- Parameters: (FunctionName, DataType, Operator)
-- FunctionName: Any valid function name
-- DataType: BYTE, WORD, DWORD or DWORD64
-- InstructionSizeIntel: b, w, d, q (not b,w,l,q)
-- While we don't need the output values for Dest or Count, we
-- must still inform the compiler the asm changes them.
-- This macro is used by InterlockedAnd, InterlockedOr, InterlockedXor, InterlockedAnd64, InterlockedOr64, InterlockedXor64
-- Parameters: (FunctionName, DataType, Operator)
-- FunctionName: Any valid function name
-- DataType: __LONG32 or __int64
-- Operator: One of xor, or, and
-- This macro is used by InterlockedBitTestAndSet, InterlockedBitTestAndReset, InterlockedBitTestAndComplement,
-- InterlockedBitTestAndSet64, InterlockedBitTestAndReset64, InterlockedBitTestAndComplement64
-- _interlockedbittestandset, _interlockedbittestandreset, _interlockedbittestandcomplement
-- _interlockedbittestandset64, _interlockedbittestandreset64, _interlockedbittestandcomplement64
-- Parameters: (FunctionName, DataType, AsmCode, OffsetConstraint, Volatile)
-- FunctionName: Any valid function name
-- DataType: __LONG32 or __int64
-- OffsetConstraint: either "I" for 32bit data types or "J" for 64.
-- Volatile: either volatile or blank.
-- This macro is used by YieldProcessor when compiling x86 w/o SSE2.
--It generates the same opcodes as _mm_pause.
-- This macro is used by DbgRaiseAssertionFailure and __int2c
--Parameters: (IntNum)
--IntNum: Interrupt number in hex
-- This macro is used by MemoryBarrier when compiling x86 w/o SSE2.
--Note that on i386, xchg performs an implicit lock.
-- This macro is used by __readfsbyte, __readfsword, __readfsdword
-- __readgsbyte, __readgsword, __readgsdword, __readgsqword
--Parameters: (FunctionName, DataType, Segment)
-- FunctionName: Any valid function name
-- DataType: char, short, __LONG32 or __int64
-- Segment: fs or gs
-- This macro is used by __writefsbyte, __writefsword, __writefsdword
-- __writegsbyte, __writegsword, __writegsdword, __writegsqword
--Parameters: (FunctionName, DataType, Segment)
-- FunctionName: Any valid function name
-- DataType: char, short, __LONG32 or __int64
-- Segment: fs or gs
-- This macro is used by _BitScanForward, _BitScanForward64, _BitScanReverse _BitScanReverse64
--Parameters: (FunctionName, DataType, Segment)
-- FunctionName: Any valid function name
-- DataType: unsigned __LONG32 or unsigned __int64
-- Statement: BSF or BSR
-- This macro is used by _bittest & _bittest64
--Parameters: (FunctionName, DataType, OffsetConstraint)
-- FunctionName: Any valid function name
-- DataType: __LONG32 or __int64
-- OffsetConstraint: either "I" for 32bit data types or "J" for 64.
--
-- This macro is used by _bittestandset, _bittestandreset, _bittestandcomplement,
-- _bittestandset64, _bittestandreset64, _bittestandcomplement64
--Parameters: (FunctionName, DataType, Statement, OffsetConstraint)
-- FunctionName: Any valid function name
-- DataType: __LONG32 or __int64
-- Statement: asm statement (bts, btr, btc)
-- OffsetConstraint: either "I" for 32bit data types or "J" for 64.
--
-- This macro is used by __inbyte, __inword, __indword
--Parameters: (FunctionName, DataType)
-- FunctionName: Any valid function name
-- DataType: unsigned char, unsigned short, unsigned __LONG32
--
-- This macro is used by __outbyte, __outword, __outdword
--Parameters: (FunctionName, DataType)
-- FunctionName: Any valid function name
-- DataType: unsigned char, unsigned short, unsigned __LONG32
--
-- This macro is used by __inbytestring, __inwordstring, __indwordstring
--Parameters: (FunctionName, DataType, InstructionSizeAtt, InstructionSizeIntel)
-- FunctionName: Any valid function name
-- DataType: unsigned char, unsigned short, unsigned __LONG32
-- InstructionSizeAtt: b, w, l
-- InstructionSizeIntel: b, w, d (not b,w,l)
--
-- This macro is used by __outbytestring, __outwordstring, __outdwordstring
--Parameters: (FunctionName, DataType, InstructionSizeAtt, InstructionSizeIntel)
-- FunctionName: Any valid function name
-- DataType: unsigned char, unsigned short, unsigned __LONG32
-- InstructionSizeAtt: b, w, l
-- InstructionSizeIntel: b, w, d (not b,w,l)
--
-- This macro is used by __readcr0, __readcr2, __readcr3, __readcr4, __readcr8
--Parameters: (FunctionName, DataType, RegisterNumber)
-- FunctionName: Any valid function name
-- DataType: unsigned __LONG32, unsigned __int64
-- RegisterNumber: 0, 2, 3, 4, 8
--
-- This macro is used by __writecr0, __writecr2, __writecr3, __writecr4, __writecr8
--Parameters: (FunctionName, DataType, RegisterNumber)
-- FunctionName: Any valid function name
-- DataType: unsigned __LONG32, unsigned __int64
-- RegisterNumber: 0, 2, 3, 4, 8
--
-- This macro is used by __movsb, __movsd, __movsq, __movsw
--Parameters: (FunctionName, DataType, RegisterNumber)
-- FunctionName: Any valid function name
-- DataType: unsigned char, unsigned short, unsigned __LONG32, unsigned __int64
-- InstructionSize: b, w, d, q
--
-- The Barrier functions can never be in the library. Since gcc only
--supports ReadWriteBarrier, map all 3 to do the same.
-- The logic for this macro is:
-- if the function is not yet defined AND
-- (
-- (if we are not just defining special OR
-- (we are defining special AND this is one of the ones we are defining)
-- )
-- )
--
-- Normally __INTRINSIC_ONLYSPECIAL is used to indicate that we are
-- being included in the library version of the intrinsic (case 2). However,
-- that really only affects the definition of __INTRINSICS_USEINLINE.
-- So here we are letting it serve an additional purpose of only defining
-- the intrinsics for a certain file (case 3). For example, to create the
-- intrinsics for the functions in winnt.h, define __INTRINSIC_GROUP_WINNT.
-- Note that this file can be included multiple times, and as a result
-- there can be overlap (definitions that appear in more than one
-- file). This is handled by __INTRINSIC_DEFINED_*
-- If no groups are defined (such as what happens when including intrin.h),
-- all intrinsics are defined.
-- If __INTRINSIC_ONLYSPECIAL is defined at this point, we are processing case 2. In
-- that case, don't go looking for groups
-- Note that this gets undefined at the end of this file
-- Note that this gets undefined at the end of this file
-- To add an additional group, put the #ifdef and definitions here.
-- skipped func __faststorefence
-- Turns out this is actually faster than MS's "trick" on newer cpus. Note
-- that this builtin performs an implicit ReadWriteBarrier.
-- skipped func __stosq
-- unused param
-- skipped func _interlockedbittestandset64
-- unused param
-- skipped func _interlockedbittestandreset64
-- unused param
-- skipped func _interlockedbittestandcomplement64
function InterlockedBitTestAndSet64 (Base : access Long_Long_Integer; Offset : Long_Long_Integer) return unsigned_char; -- d:\install\gpl2018\x86_64-pc-mingw32\include\psdk_inc\intrin-impl.h:526
pragma Import (C, InterlockedBitTestAndSet64, "InterlockedBitTestAndSet64");
function InterlockedBitTestAndReset64 (Base : access Long_Long_Integer; Offset : Long_Long_Integer) return unsigned_char; -- d:\install\gpl2018\x86_64-pc-mingw32\include\psdk_inc\intrin-impl.h:533
pragma Import (C, InterlockedBitTestAndReset64, "InterlockedBitTestAndReset64");
function InterlockedBitTestAndComplement64 (Base : access Long_Long_Integer; Offset : Long_Long_Integer) return unsigned_char; -- d:\install\gpl2018\x86_64-pc-mingw32\include\psdk_inc\intrin-impl.h:540
pragma Import (C, InterlockedBitTestAndComplement64, "InterlockedBitTestAndComplement64");
-- skipped func _InterlockedAnd64
-- skipped func _InterlockedOr64
-- skipped func _InterlockedXor64
-- skipped func _InterlockedIncrement64
-- skipped func _InterlockedDecrement64
-- skipped func _InterlockedExchange64
-- skipped func _InterlockedExchangeAdd64
-- skipped func __readgsbyte
-- skipped func __readgsword
-- skipped func __readgsdword
-- skipped func __readgsqword
-- skipped func __writegsbyte
-- skipped func __writegsword
-- skipped func __writegsdword
-- skipped func __writegsqword
-- skipped func _BitScanForward64
-- skipped func _BitScanReverse64
-- skipped func _bittest64
-- skipped func _bittestandset64
-- skipped func _bittestandreset64
-- skipped func _bittestandcomplement64
-- skipped func __readcr0
-- skipped func __readcr2
-- skipped func __readcr3
-- skipped func __readcr4
-- skipped func __readcr8
-- skipped func __writecr0
-- skipped func __writecr3
-- skipped func __writecr4
-- skipped func __writecr8
-- skipped func __movsq
-- skipped func _umul128
-- skipped func _mul128
-- skipped func __shiftleft128
-- skipped func __shiftright128
-- *****************************************************
-- skipped func __int2c
-- skipped func __stosb
-- skipped func __stosw
-- skipped func __stosd
-- unused param
-- skipped func _interlockedbittestandset
-- unused param
-- skipped func _interlockedbittestandreset
-- unused param
-- skipped func _interlockedbittestandcomplement
function InterlockedBitTestAndSet (Base : access long; Offset : long) return unsigned_char; -- d:\install\gpl2018\x86_64-pc-mingw32\include\psdk_inc\intrin-impl.h:891
pragma Import (C, InterlockedBitTestAndSet, "InterlockedBitTestAndSet");
function InterlockedBitTestAndReset (Base : access long; Offset : long) return unsigned_char; -- d:\install\gpl2018\x86_64-pc-mingw32\include\psdk_inc\intrin-impl.h:898
pragma Import (C, InterlockedBitTestAndReset, "InterlockedBitTestAndReset");
function InterlockedBitTestAndComplement (Base : access long; Offset : long) return unsigned_char; -- d:\install\gpl2018\x86_64-pc-mingw32\include\psdk_inc\intrin-impl.h:905
pragma Import (C, InterlockedBitTestAndComplement, "InterlockedBitTestAndComplement");
-- skipped func _InterlockedAnd
-- skipped func _InterlockedOr
-- skipped func _InterlockedXor
-- skipped func _InterlockedIncrement16
-- skipped func _InterlockedDecrement16
-- skipped func _InterlockedCompareExchange16
-- skipped func _InterlockedExchangeAdd
-- skipped func _InterlockedCompareExchange
-- skipped func _InterlockedIncrement
-- skipped func _InterlockedDecrement
-- skipped func _InterlockedExchange
-- skipped func _InterlockedCompareExchange64
-- skipped func _InterlockedCompareExchangePointer
-- skipped func _InterlockedExchangePointer
-- skipped func _BitScanForward
-- skipped func _BitScanReverse
-- skipped func _bittest
-- skipped func _bittestandset
-- skipped func _bittestandreset
-- skipped func _bittestandcomplement
-- skipped func __inbyte
-- skipped func __inword
-- skipped func __indword
-- skipped func __outbyte
-- skipped func __outword
-- skipped func __outdword
-- skipped func __inbytestring
-- skipped func __inwordstring
-- skipped func __indwordstring
-- skipped func __outbytestring
-- skipped func __outwordstring
-- skipped func __outdwordstring
-- skipped func __cpuid
-- skipped func __readmsr
-- skipped func __writemsr
-- skipped func __movsb
-- skipped func __movsw
-- skipped func __movsd
-- *****************************************************
end intrin_impl_h;
|
programs/oeis/208/A208064.asm | jmorken/loda | 1 | 27155 | ; A208064: Number of n X 3 0..1 arrays avoiding 0 0 0 and 1 1 1 horizontally and 0 0 1 and 0 1 1 vertically.
; 6,36,72,144,216,324,432,576,720,900,1080,1296,1512,1764,2016,2304,2592,2916,3240,3600,3960,4356,4752,5184,5616,6084,6552,7056,7560,8100,8640,9216,9792,10404,11016,11664,12312,12996,13680,14400,15120,15876,16632
add $0,1
pow $0,2
div $0,2
mul $0,6
sub $0,1
div $0,2
mov $1,$0
mul $1,6
add $1,6
|
Interpreter.agda | mb64/cubical-free-monads | 1 | 10357 | {-# OPTIONS --cubical --safe #-}
module Interpreter where
open import Function.Base using (_$_)
open import FreeReader
-- Runs it in the reader monad
runFree : ∀ {R A} → R → FreeReader R A → A
runFree r (Pure x) = x
runFree r (Bind x f) = runFree r $ f $ runFree r x
runFree r Ask = r
-- Since it's so simple, all these compute nicely
runFree r (LeftId a f i) = runFree r $ f a
runFree r (RightId x i) = runFree r x
runFree r (Assoc x f g i) = runFree r $ g $ runFree r $ f $ runFree r x
|
alloy4fun_models/trashltl/models/9/gzmK2zyjetyCjYCTk.als | Kaixi26/org.alloytools.alloy | 0 | 5177 | open main
pred idgzmK2zyjetyCjYCTk_prop10 {
always all p: File | always (once p in Protected implies always p in Protected)
}
pred __repair { idgzmK2zyjetyCjYCTk_prop10 }
check __repair { idgzmK2zyjetyCjYCTk_prop10 <=> prop10o } |
program/keyboard.asm | doowzs/BuggyOS | 7 | 27358 | <filename>program/keyboard.asm
_init:
xor $k0, $k0, $k0
xor $k1, $k1, $k1
xor $s0, $s0, $s0
addi $k0, $k0, 0x10000000
addi $k1, $k1, 0x10000118
addi $s0, $s0, 0x0000000d # ENTER KEY
j _read
_read:
lw $a0, 0x100020D0 # read this key
lw $t0, 0x100020D4 # load last key
sw $a0, 0x100020D4 # save this key
beq $a0, $zero, _read # key != 0
beq $a0, $t0, _read # key != last
# if =0x8, goto backspace
# otherwise, print the character
add $t0, $zero, 0x8
beq $a0, $t0, _backspace
j _write
_write:
sw $a0, ($k0)
addi $k0, $k0, 0x4
beq $a0, $s0, _newline
beq $k0, $k1, _newline
j _read
_backspace:
subi $k1, $k1, 0x118
beq $k0, $k1, _backspace_ret
subi $k0, $k0, 0x4
sw $zero, ($k0)
_backspace_ret:
addi $k1, $k1, 0x118
j _read
_newline:
xor $k0, $k0, $k0
add $k0, $k0, $k1
addi $k1, $k1, 0x118 # 70 * 4
j _read
|
orka/src/gl/implementation/gl-runtime_loading.adb | onox/orka | 52 | 7033 | <reponame>onox/orka<filename>orka/src/gl/implementation/gl-runtime_loading.adb
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2013 <NAME> <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Unchecked_Conversion;
package body GL.Runtime_Loading is
generic
type Function_Reference is private;
function Load (Function_Name : String) return Function_Reference;
function Load (Function_Name : String) return Function_Reference is
function As_Function_Reference is new Ada.Unchecked_Conversion
(Source => System.Address, Target => Function_Reference);
begin
return As_Function_Reference (Raw_Subprogram_Reference (Function_Name));
end Load;
package body Function_Without_Params is
function Init return Return_Type is
function Load_Function is new Load (Function_Reference);
begin
Ref := Load_Function (Function_Name);
return Ref.all;
end Init;
end Function_Without_Params;
package body Function_With_1_Param is
function Init (Param1 : Param1_Type) return Return_Type is
function Load_Function is new Load (Function_Reference);
begin
Ref := Load_Function (Function_Name);
return Ref (Param1);
end Init;
end Function_With_1_Param;
package body Function_With_2_Params is
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type) return Return_Type
is
function Load_Function is new Load (Function_Reference);
begin
Ref := Load_Function (Function_Name);
return Ref (Param1, Param2);
end Init;
end Function_With_2_Params;
package body Function_With_3_Params is
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type) return Return_Type
is
function Load_Function is new Load (Function_Reference);
begin
Ref := Load_Function (Function_Name);
return Ref (Param1, Param2, Param3);
end Init;
end Function_With_3_Params;
package body Function_With_4_Params is
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type) return Return_Type
is
function Load_Function is new Load (Function_Reference);
begin
Ref := Load_Function (Function_Name);
return Ref (Param1, Param2, Param3, Param4);
end Init;
end Function_With_4_Params;
package body Function_With_8_Params is
function Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Param6 : Param6_Type;
Param7 : Param7_Type;
Param8 : Param8_Type) return Return_Type
is
function Load_Function is new Load (Function_Reference);
begin
Ref := Load_Function (Function_Name);
return Ref (Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8);
end Init;
end Function_With_8_Params;
package body Array_Getter_With_5_Params is
type Procedure_Reference is not null access procedure
(Param1 : Param1_Type;
Param2 : Param2_Type;
Max : Types.Size;
Size : in out Types.Size;
Values : in out Array_Type)
with Convention => StdCall;
procedure Internal_Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Max : Types.Size;
Size : in out Types.Size;
Values : in out Array_Type)
with Convention => StdCall;
Internal_Ref : Procedure_Reference := Internal_Init'Access;
procedure Internal_Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Max : Types.Size;
Size : in out Types.Size;
Values : in out Array_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Internal_Ref := Load_Procedure (Procedure_Name);
Internal_Ref (Param1, Param2, Max, Size, Values);
end Internal_Init;
function Ref
(Param1 : Param1_Type;
Param2 : Param2_Type;
Max_Size : Types.Size) return Array_Type
is
Actual_Size : Types.Size := 0;
Result : Array_Type (1 .. Max_Size);
begin
Internal_Ref (Param1, Param2, Max_Size, Actual_Size, Result);
if Actual_Size /= Max_Size then
return Result (1 .. Actual_Size);
else
return Result;
end if;
end Ref;
end Array_Getter_With_5_Params;
package body Array_Getter_With_8_Params is
type Procedure_Reference is not null access procedure
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Max : Types.Size;
Size : in out Types.Size;
Values : in out Array_Type)
with Convention => StdCall;
procedure Internal_Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Max : Types.Size;
Size : in out Types.Size;
Values : in out Array_Type)
with Convention => StdCall;
Internal_Ref : Procedure_Reference := Internal_Init'Access;
procedure Internal_Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Max : Types.Size;
Size : in out Types.Size;
Values : in out Array_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Internal_Ref := Load_Procedure (Procedure_Name);
Internal_Ref (Param1, Param2, Param3, Param4, Param5, Max, Size, Values);
end Internal_Init;
function Ref
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Max_Size : Types.Size) return Array_Type
is
Actual_Size : Types.Size := 0;
Result : Array_Type (1 .. Max_Size);
begin
Internal_Ref (Param1, Param2, Param3, Param4, Param5, Max_Size, Actual_Size, Result);
if Actual_Size /= Max_Size then
return Result (1 .. Actual_Size);
else
return Result;
end if;
end Ref;
end Array_Getter_With_8_Params;
package body Procedure_Without_Params is
procedure Init is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref.all;
end Init;
end Procedure_Without_Params;
package body Procedure_With_1_Param is
procedure Init (Param1 : Param1_Type) is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1);
end Init;
end Procedure_With_1_Param;
package body Procedure_With_2_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2);
end Init;
end Procedure_With_2_Params;
package body Procedure_With_3_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3);
end Init;
end Procedure_With_3_Params;
package body Procedure_With_4_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Param4);
end Init;
end Procedure_With_4_Params;
package body Procedure_With_5_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Param4, Param5);
end Init;
end Procedure_With_5_Params;
package body Procedure_With_6_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Param6 : Param6_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Param4, Param5, Param6);
end Init;
end Procedure_With_6_Params;
package body Procedure_With_7_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Param6 : Param6_Type;
Param7 : Param7_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Param4, Param5, Param6, Param7);
end Init;
end Procedure_With_7_Params;
package body Procedure_With_8_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Param6 : Param6_Type;
Param7 : Param7_Type;
Param8 : Param8_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Param4, Param5, Param6, Param7,
Param8);
end Init;
end Procedure_With_8_Params;
package body Procedure_With_9_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Param6 : Param6_Type;
Param7 : Param7_Type;
Param8 : Param8_Type;
Param9 : Param9_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Param4, Param5, Param6, Param7,
Param8, Param9);
end Init;
end Procedure_With_9_Params;
package body Procedure_With_10_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Param6 : Param6_Type;
Param7 : Param7_Type;
Param8 : Param8_Type;
Param9 : Param9_Type;
Param10 : Param10_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Param4, Param5, Param6, Param7,
Param8, Param9, Param10);
end Init;
end Procedure_With_10_Params;
package body Procedure_With_11_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Param6 : Param6_Type;
Param7 : Param7_Type;
Param8 : Param8_Type;
Param9 : Param9_Type;
Param10 : Param10_Type;
Param11 : Param11_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Param4, Param5, Param6, Param7,
Param8, Param9, Param10, Param11);
end Init;
end Procedure_With_11_Params;
package body Procedure_With_12_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Param6 : Param6_Type;
Param7 : Param7_Type;
Param8 : Param8_Type;
Param9 : Param9_Type;
Param10 : Param10_Type;
Param11 : Param11_Type;
Param12 : Param12_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Param4, Param5, Param6, Param7,
Param8, Param9, Param10, Param11, Param12);
end Init;
end Procedure_With_12_Params;
package body Procedure_With_15_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Param5 : Param5_Type;
Param6 : Param6_Type;
Param7 : Param7_Type;
Param8 : Param8_Type;
Param9 : Param9_Type;
Param10 : Param10_Type;
Param11 : Param11_Type;
Param12 : Param12_Type;
Param13 : Param13_Type;
Param14 : Param14_Type;
Param15 : Param15_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Param4, Param5, Param6, Param7,
Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15);
end Init;
end Procedure_With_15_Params;
package body Array_Proc_With_2_Params is
procedure Init
(Param1 : Size_Type;
Param2 : Array_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2);
end Init;
end Array_Proc_With_2_Params;
package body Array_Proc_With_3_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Size_Type;
Param3 : Array_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3);
end Init;
end Array_Proc_With_3_Params;
package body Getter_With_2_Params is
procedure Init
(Param1 : Param1_Type;
Value : in out Value_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Value);
end Init;
end Getter_With_2_Params;
package body Getter_With_3_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Value : in out Value_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Value);
end Init;
end Getter_With_3_Params;
package body Getter_With_4_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Value : in out Value_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Value);
end Init;
end Getter_With_4_Params;
package body Getter_With_5_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Param3 : Param3_Type;
Param4 : Param4_Type;
Value : in out Value_Type)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Param3, Param4, Value);
end Init;
end Getter_With_5_Params;
package body String_Getter_With_4_Params is
procedure Init
(Param1 : Param1_Type;
Buffer_Size : Size_Type;
Length : out Size_Type;
Value : in out String)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Buffer_Size, Length, Value);
end Init;
end String_Getter_With_4_Params;
package body String_Getter_With_5_Params is
procedure Init
(Param1 : Param1_Type;
Param2 : Param2_Type;
Buffer_Size : Size_Type;
Length : out Size_Type;
Value : in out String)
is
function Load_Procedure is new Load (Procedure_Reference);
begin
Ref := Load_Procedure (Procedure_Name);
Ref (Param1, Param2, Buffer_Size, Length, Value);
end Init;
end String_Getter_With_5_Params;
end GL.Runtime_Loading;
|
gcc-gcc-7_3_0-release/gcc/ada/a-stuten.adb | best08618/asylo | 7 | 7727 | <reponame>best08618/asylo<gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . U T F _ E N C O D I N G --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Ada.Strings.UTF_Encoding is
use Interfaces;
--------------
-- Encoding --
--------------
function Encoding
(Item : UTF_String;
Default : Encoding_Scheme := UTF_8) return Encoding_Scheme
is
begin
if Item'Length >= 2 then
if Item (Item'First .. Item'First + 1) = BOM_16BE then
return UTF_16BE;
elsif Item (Item'First .. Item'First + 1) = BOM_16LE then
return UTF_16LE;
elsif Item'Length >= 3
and then Item (Item'First .. Item'First + 2) = BOM_8
then
return UTF_8;
end if;
end if;
return Default;
end Encoding;
-----------------
-- From_UTF_16 --
-----------------
function From_UTF_16
(Item : UTF_16_Wide_String;
Output_Scheme : UTF_XE_Encoding;
Output_BOM : Boolean := False) return UTF_String
is
BSpace : constant Natural := 2 * Boolean'Pos (Output_BOM);
Result : UTF_String (1 .. 2 * Item'Length + BSpace);
Len : Natural;
C : Unsigned_16;
Iptr : Natural;
begin
if Output_BOM then
Result (1 .. 2) :=
(if Output_Scheme = UTF_16BE then BOM_16BE else BOM_16LE);
Len := 2;
else
Len := 0;
end if;
-- Skip input BOM
Iptr := Item'First;
if Iptr <= Item'Last and then Item (Iptr) = BOM_16 (1) then
Iptr := Iptr + 1;
end if;
-- UTF-16BE case
if Output_Scheme = UTF_16BE then
while Iptr <= Item'Last loop
C := To_Unsigned_16 (Item (Iptr));
Result (Len + 1) := Character'Val (Shift_Right (C, 8));
Result (Len + 2) := Character'Val (C and 16#00_FF#);
Len := Len + 2;
Iptr := Iptr + 1;
end loop;
-- UTF-16LE case
else
while Iptr <= Item'Last loop
C := To_Unsigned_16 (Item (Iptr));
Result (Len + 1) := Character'Val (C and 16#00_FF#);
Result (Len + 2) := Character'Val (Shift_Right (C, 8));
Len := Len + 2;
Iptr := Iptr + 1;
end loop;
end if;
return Result (1 .. Len);
end From_UTF_16;
--------------------------
-- Raise_Encoding_Error --
--------------------------
procedure Raise_Encoding_Error (Index : Natural) is
Val : constant String := Index'Img;
begin
raise Encoding_Error with
"bad input at Item (" & Val (Val'First + 1 .. Val'Last) & ')';
end Raise_Encoding_Error;
---------------
-- To_UTF_16 --
---------------
function To_UTF_16
(Item : UTF_String;
Input_Scheme : UTF_XE_Encoding;
Output_BOM : Boolean := False) return UTF_16_Wide_String
is
Result : UTF_16_Wide_String (1 .. Item'Length / 2 + 1);
Len : Natural;
Iptr : Natural;
begin
if Item'Length mod 2 /= 0 then
raise Encoding_Error with "UTF-16BE/LE string has odd length";
end if;
-- Deal with input BOM, skip if OK, error if bad BOM
Iptr := Item'First;
if Item'Length >= 2 then
if Item (Iptr .. Iptr + 1) = BOM_16BE then
if Input_Scheme = UTF_16BE then
Iptr := Iptr + 2;
else
Raise_Encoding_Error (Iptr);
end if;
elsif Item (Iptr .. Iptr + 1) = BOM_16LE then
if Input_Scheme = UTF_16LE then
Iptr := Iptr + 2;
else
Raise_Encoding_Error (Iptr);
end if;
elsif Item'Length >= 3 and then Item (Iptr .. Iptr + 2) = BOM_8 then
Raise_Encoding_Error (Iptr);
end if;
end if;
-- Output BOM if specified
if Output_BOM then
Result (1) := BOM_16 (1);
Len := 1;
else
Len := 0;
end if;
-- UTF-16BE case
if Input_Scheme = UTF_16BE then
while Iptr < Item'Last loop
Len := Len + 1;
Result (Len) :=
Wide_Character'Val
(Character'Pos (Item (Iptr)) * 256 +
Character'Pos (Item (Iptr + 1)));
Iptr := Iptr + 2;
end loop;
-- UTF-16LE case
else
while Iptr < Item'Last loop
Len := Len + 1;
Result (Len) :=
Wide_Character'Val
(Character'Pos (Item (Iptr)) +
Character'Pos (Item (Iptr + 1)) * 256);
Iptr := Iptr + 2;
end loop;
end if;
return Result (1 .. Len);
end To_UTF_16;
end Ada.Strings.UTF_Encoding;
|
ayacc/src/alsys_dos/lalrs.ada | irion7/aflex-ayacc-mirror | 1 | 13424 | -- $Header: /cf/ua/arcadia/alex-ayacc/ayacc/src/RCS/lalr_symbol_info.a,v 1.1 88/08/08 13:45:45 arcadia Exp $
--***************************************************************************
-- This file is subject to the Arcadia License Agreement.
--
-- (see notice in ayacc.a)
--
--***************************************************************************
-- Module : lalr_symbol_info.ada
-- Component of : ayacc
-- Version : 1.2
-- Date : 11/21/86 12:29:48
-- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxlalr_symbol_info.ada
-- $Header: /cf/ua/arcadia/alex-ayacc/ayacc/src/RCS/lalr_symbol_info.a,v 1.1 88/08/08 13:45:45 arcadia Exp $
-- $Log: lalr_symbol_info.a,v $
--Revision 1.1 88/08/08 13:45:45 arcadia
--Initial revision
--
-- Revision 0.1 86/04/01 15:04:35 ada
-- This version fixes some minor bugs with empty grammars
-- and $$ expansion. It also uses vads5.1b enhancements
-- such as pragma inline.
--
--
-- Revision 0.0 86/02/19 18:36:38 ada
--
-- These files comprise the initial version of Ayacc
-- designed and implemented by <NAME> and <NAME>.
-- Ayacc has been compiled and tested under the Verdix Ada compiler
-- version 4.06 on a vax 11/750 running Unix 4.2BSD.
--
with LR0_Machine, Ragged, Rule_Table, Symbol_Table, Symbol_Info, Set_Pack,
Stack_Pack;
use LR0_Machine, Rule_Table, Symbol_Table, Symbol_Info;
with Text_IO; use Text_IO;
package LALR_Symbol_Info is
procedure Make_LALR_Sets;
procedure Get_LA(State_ID : Parse_State;
Item_ID : Item;
Look_Aheads : in out Grammar_Symbol_Set);
end LALR_Symbol_Info;
-- Module : lalr_symbol_info.ada
-- Component of : ayacc
-- Version : 1.2
-- Date : 11/21/86 12:29:48
-- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxlalr_symbol_info.ada
-- $Header: /cf/ua/arcadia/alex-ayacc/ayacc/src/RCS/lalr_symbol_info.a,v 1.1 88/08/08 13:45:45 arcadia Exp $
-- $Log: lalr_symbol_info.a,v $
--Revision 1.1 88/08/08 13:45:45 arcadia
--Initial revision
--
-- Revision 0.1 86/04/01 15:04:35 ada
-- This version fixes some minor bugs with empty grammars
-- and $$ expansion. It also uses vads5.1b enhancements
-- such as pragma inline.
--
--
-- Revision 0.0 86/02/19 18:36:38 ada
--
-- These files comprise the initial version of Ayacc
-- designed and implemented by <NAME> and <NAME>.
-- Ayacc has been compiled and tested under the Verdix Ada compiler
-- version 4.06 on a vax 11/750 running Unix 4.2BSD.
--
-- --
-- Authors : <NAME> , <NAME> --
-- Copyright : 1987, University of California Irvine --
-- --
-- If you --
-- modify the source code or if you have any suggestions or questions --
-- regarding ayacc, we would like to hear from you. Our mailing --
-- addresses are : --
-- <EMAIL> --
-- <EMAIL> --
-- --
with LR0_Machine, Ragged, Rule_Table, Symbol_Table, Symbol_Info, Set_Pack,
Stack_Pack;
use LR0_Machine, Rule_Table, Symbol_Table, Symbol_Info;
with Text_IO; use Text_IO;
package LALR_Symbol_Info is
procedure Make_LALR_Sets;
procedure Get_LA(State_ID : Parse_State;
Item_ID : Item;
Look_Aheads : in out Grammar_Symbol_Set);
end LALR_Symbol_Info;
|
library/files/fileNameFromPath.applescript | NYHTC/applescript-fm-helper | 1 | 2340 | <filename>library/files/fileNameFromPath.applescript
-- fileNameFromPath({filePath:null, pathDelim:null})
-- <NAME>
-- Gets the file name from the path.
(*
HISTORY:
1.0 - first created.
*)
on run
fileNameFromPath({filePath:"/my/fake/path/someFile.txt", pathDelim:"/"})
end run
--------------------
-- START OF CODE
--------------------
on fileNameFromPath(prefs)
-- version 1.1, <NAME>
set filePath to filePath of prefs
set pathDelim to pathDelim of prefs
(reverse of characters of filePath) as string
text 1 thru ((offset of pathDelim in result) - 1) of result
return (reverse of characters of result) as string
end fileNameFromPath
--------------------
-- END OF CODE
--------------------
|
CommandLine/CommandLine.g4 | Butjok/CommandLine | 29 | 217 | <filename>CommandLine/CommandLine.g4
grammar CommandLine;
input: value? EOF;
value
: Identifier value* #command
| Null #null
| (True | False) #boolean
| Integer #integer
| Real #real
| String #string
| LeftParenthesis value RightParenthesis #parenthesis
| operator=(Minus | Exclamation | Tilde) value #unaryExpression
| value operator=(Asterisk | ForwardSlash | Percent) value #multiplication
| value operator=(Plus | Minus) value #summation
| value operator=(DoubleAmpersand | DoubleVerticalBar) value #junction
| Rgb r=value g=value b=value a=value? #color
| Int2 x=value y=value #int2
| Int3 x=value y=value z=value #int3
| Float2 x=value y=value #float2
| Float3 x=value y=value z=value #float3
;
Asterisk: '*';
DoubleAmpersand: '&&';
DoubleVerticalBar: '||';
Exclamation: '!';
False: 'false';
Float2: 'float2';
Float3: 'float3';
ForwardSlash: '/';
Int2: 'int2';
Int3: 'int3';
LeftParenthesis: '(';
LeftSquareBracket: '[';
Minus: '-';
Null: 'null';
Percent: '%';
Plus: '+';
Rgb: 'rgb';
RightParenthesis: ')';
RightSquareBracket: ']';
True: 'true';
Tilde: '~';
Identifier: [a-zA-Z_][a-zA-Z_0-9]* ('.' [a-zA-Z_][a-zA-Z_0-9]*)*;
Integer: '-'? INT;
Real: '-'? (INT '.' INT | '.' INT | INT '.');
String: '"' ('\\' ["\\bfnrt] | ~ ["\\\u0000-\u001F])* '"';
Whitespace: [ \r\n\t]+ -> channel(HIDDEN);
fragment INT: [0-9]+; |
Admin Tools/connect/connect.applescript | smaddock/BlueSkyConnect | 38 | 2074 | global serverAddr
on set_server()
set serverLoc to path to resource "server.txt" in bundle (path to me)
set serverPos to POSIX path of serverLoc
set serverAddr to do shell script "cat " & the quoted form of serverPos
end set_server
on open location this_URL
set_server()
-- When the link is clicked in thewebpage, this handler will be passed
-- the URL that triggered the action, similar to:
--> bluesky://com.solarwindsmsp.bluesky?key=value&key=value
-- EXTRACT ARGUMENTS
set x to the offset of "?" in this_URL
set the argument_string to text from (x + 1) to -1 of this_URL
set AppleScript's text item delimiters to "&"
set these_arguments to every text item of the argument_string
set AppleScript's text item delimiters to ""
set userName to ""
-- PROCESS ACTIONS
-- This loop will execute scripts located within the Resources folder
-- of this applet depending on the key and value passed in the URL
repeat with i from 1 to the count of these_arguments
set this_pair to item i of these_arguments
set AppleScript's text item delimiters to "="
copy every text item of this_pair to {this_key, this_value}
set AppleScript's text item delimiters to ""
if this_key is "blueSkyID" then
set blueSkyID to this_value
else if this_key is "user" then
set userName to this_value
else if this_key is "action" then
set actionStep to this_value
end if
end repeat
--here we go
if userName is "" then
set dialogTemp to display dialog "Please enter the user name on the remote computer:" default answer "" with icon path to resource "applet.icns" in bundle (path to me)
set userName to the text returned of dialogTemp
end if
set sshPort to (22000 + blueSkyID)
set vncPort to (24000 + blueSkyID)
if actionStep is "ssh" then
remote_shell(blueSkyID, sshPort, vncPort, serverAddr, userName)
else if actionStep is "vnc" then
screen_share(blueSkyID, sshPort, vncPort, serverAddr, userName)
else if actionStep is "scp" then
file_upload(blueSkyID, sshPort, serverAddr, userName)
end if
end open location
set_server()
-- This handler will load, then execute, a script file
-- located in the Resources folder of this applet.
-- This method allows you to change property values
-- within the loaded script before execution,
-- or to execute handlers within the loaded script.
set serverLoc to path to resource "server.txt" in bundle (path to me)
set serverPos to POSIX path of serverLoc
set serverAddr to do shell script "cat " & the quoted form of serverPos
--hard code and uncomment below if you'd rather
--set serverAddr to "serverFQDN"
set dialogTemp to display dialog "Please enter the BlueSky ID number you want to connect with:" default answer "" with icon path to resource "applet.icns" in bundle (path to me)
set blueSkyID to the text returned of dialogTemp
display dialog "Please choose the action that you would like to perform." buttons {"Screen Share", "File Upload", "Remote Shell"} default button "Remote Shell" with icon path to resource "applet.icns" in bundle (path to me)
set myChoice to the result
set sshPort to (22000 + blueSkyID)
set vncPort to (24000 + blueSkyID)
set dialogTemp to display dialog "Please enter the user name on the remote computer:" default answer "" with icon path to resource "applet.icns" in bundle (path to me)
set userName to the text returned of dialogTemp
if myChoice is {button returned:"Remote Shell"} then
remote_shell(blueSkyID, sshPort, vncPort, serverAddr, userName)
else if myChoice is {button returned:"Screen Share"} then
screen_share(blueSkyID, sshPort, vncPort, serverAddr, userName)
else if myChoice is {button returned:"File Upload"} then
file_upload(blueSkyID, sshPort, serverAddr, userName)
else
return 0
end if
on remote_shell(blueSkyID, sshPort, vncPort, serverAddr, userName)
tell application "Terminal"
activate
do script "ssh -t -o \"ProxyCommand ssh -p 3122 -i ~/.ssh/bluesky_admin admin@" & serverAddr & " /bin/nc %h %p\" -o \"LocalForward " & vncPort & " localhost:5900\" -o \"StrictHostKeyChecking=no\" -p " & sshPort & " " & userName & "@localhost"
end tell
end remote_shell
on screen_share(blueSkyID, sshPort, vncPort, serverAddr, userName)
set vncCheck to do shell script "ps -ax | grep ssh | grep " & vncPort & " | grep -v grep;exit 0"
if vncCheck is "" then
tell application "Terminal"
activate
do script "ssh -t -o \"ProxyCommand ssh -p 3122 -i ~/.ssh/bluesky_admin admin@" & serverAddr & " /bin/nc %h %p\" -o \"LocalForward " & vncPort & " localhost:5900\" -o \"StrictHostKeyChecking=no\" -p " & sshPort & " " & userName & "@localhost"
end tell
--delay 10
--seems to be broken in Dos Equis
do shell script "sleep 10"
set vncCheck2 to do shell script "ps -ax | grep ssh | grep " & vncPort & " | grep -v grep;exit 0"
if vncCheck2 is "" then
return 0
end if
display dialog "Click OK after you are logged in to SSH to proceed to VNC login." default button 1 buttons "OK" giving up after 295 with icon path to resource "applet.icns" in bundle (path to me)
end if
tell application "Screen Sharing"
activate
GetURL "vnc://" & userName & "@localhost:" & vncPort
end tell
end screen_share
on file_upload(blueSkyID, sshPort, serverAddr, userName)
display dialog "Do you want to upload a single file or a folder?" buttons {"File", "Folder", "Cancel"} default button "Folder" with icon path to resource "applet.icns" in bundle (path to me)
set myChoice to the result
if myChoice is {button returned:"Folder"} then
set the source_folder to choose folder with prompt "Select the folder to be uploaded:"
set posixSrc to the POSIX path of source_folder
tell application "Terminal"
activate
do script "scp -r -C -P " & sshPort & " -o \"StrictHostKeyChecking=no\" -o \"ProxyCommand ssh -p 3122 -i ~/.ssh/bluesky_admin admin@" & serverAddr & " /bin/nc %h %p\" " & the quoted form of posixSrc & " " & userName & "@localhost:/tmp && exit "
end tell
else if myChoice is {button returned:"File"} then
set the source_file to choose file with prompt "Select the file to be uploaded:"
set posixSrc to the POSIX path of source_file
tell application "Terminal"
activate
do script "scp -C -P " & sshPort & " -o \"StrictHostKeyChecking=no\" -o \"ProxyCommand ssh -p 3122 -i ~/.ssh/bluesky_admin admin@" & serverAddr & " /bin/nc %h %p\" " & the quoted form of posixSrc & " " & userName & "@localhost:/tmp && exit"
end tell
else
return 0
end if
end file_upload
|
programs/oeis/011/A011896.asm | neoneye/loda | 22 | 165819 | ; A011896: [ n(n-1)(n-2)/14 ].
; 0,0,0,0,1,4,8,15,24,36,51,70,94,122,156,195,240,291,349,415,488,570,660,759,867,985,1114,1253,1404,1566,1740,1926,2125,2338,2564,2805,3060,3330,3615,3916,4234,4568,4920,5289,5676,6081,6505,6949,7412,7896
bin $0,3
mul $0,3
div $0,7
|
MainCode/hello.asm | kirito71/xv6 | 0 | 104976 |
_hello: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "types.h"
#include "stat.h"
#include "user.h"
int main(int argc, char *argv[]){
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 51 push %ecx
e: 83 ec 0c sub $0xc,%esp
printf(1,"Hello world\n");
11: 68 38 07 00 00 push $0x738
16: 6a 01 push $0x1
18: e8 c3 03 00 00 call 3e0 <printf>
exit();
1d: e8 60 02 00 00 call 282 <exit>
22: 66 90 xchg %ax,%ax
24: 66 90 xchg %ax,%ax
26: 66 90 xchg %ax,%ax
28: 66 90 xchg %ax,%ax
2a: 66 90 xchg %ax,%ax
2c: 66 90 xchg %ax,%ax
2e: 66 90 xchg %ax,%ax
00000030 <strcpy>:
30: 55 push %ebp
31: 89 e5 mov %esp,%ebp
33: 53 push %ebx
34: 8b 45 08 mov 0x8(%ebp),%eax
37: 8b 4d 0c mov 0xc(%ebp),%ecx
3a: 89 c2 mov %eax,%edx
3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
40: 83 c1 01 add $0x1,%ecx
43: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
47: 83 c2 01 add $0x1,%edx
4a: 84 db test %bl,%bl
4c: 88 5a ff mov %bl,-0x1(%edx)
4f: 75 ef jne 40 <strcpy+0x10>
51: 5b pop %ebx
52: 5d pop %ebp
53: c3 ret
54: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
5a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000060 <strcmp>:
60: 55 push %ebp
61: 89 e5 mov %esp,%ebp
63: 53 push %ebx
64: 8b 55 08 mov 0x8(%ebp),%edx
67: 8b 4d 0c mov 0xc(%ebp),%ecx
6a: 0f b6 02 movzbl (%edx),%eax
6d: 0f b6 19 movzbl (%ecx),%ebx
70: 84 c0 test %al,%al
72: 75 1c jne 90 <strcmp+0x30>
74: eb 2a jmp a0 <strcmp+0x40>
76: 8d 76 00 lea 0x0(%esi),%esi
79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80: 83 c2 01 add $0x1,%edx
83: 0f b6 02 movzbl (%edx),%eax
86: 83 c1 01 add $0x1,%ecx
89: 0f b6 19 movzbl (%ecx),%ebx
8c: 84 c0 test %al,%al
8e: 74 10 je a0 <strcmp+0x40>
90: 38 d8 cmp %bl,%al
92: 74 ec je 80 <strcmp+0x20>
94: 29 d8 sub %ebx,%eax
96: 5b pop %ebx
97: 5d pop %ebp
98: c3 ret
99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
a0: 31 c0 xor %eax,%eax
a2: 29 d8 sub %ebx,%eax
a4: 5b pop %ebx
a5: 5d pop %ebp
a6: c3 ret
a7: 89 f6 mov %esi,%esi
a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000000b0 <strlen>:
b0: 55 push %ebp
b1: 89 e5 mov %esp,%ebp
b3: 8b 4d 08 mov 0x8(%ebp),%ecx
b6: 80 39 00 cmpb $0x0,(%ecx)
b9: 74 15 je d0 <strlen+0x20>
bb: 31 d2 xor %edx,%edx
bd: 8d 76 00 lea 0x0(%esi),%esi
c0: 83 c2 01 add $0x1,%edx
c3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
c7: 89 d0 mov %edx,%eax
c9: 75 f5 jne c0 <strlen+0x10>
cb: 5d pop %ebp
cc: c3 ret
cd: 8d 76 00 lea 0x0(%esi),%esi
d0: 31 c0 xor %eax,%eax
d2: 5d pop %ebp
d3: c3 ret
d4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
da: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000000e0 <memset>:
e0: 55 push %ebp
e1: 89 e5 mov %esp,%ebp
e3: 57 push %edi
e4: 8b 55 08 mov 0x8(%ebp),%edx
e7: 8b 4d 10 mov 0x10(%ebp),%ecx
ea: 8b 45 0c mov 0xc(%ebp),%eax
ed: 89 d7 mov %edx,%edi
ef: fc cld
f0: f3 aa rep stos %al,%es:(%edi)
f2: 89 d0 mov %edx,%eax
f4: 5f pop %edi
f5: 5d pop %ebp
f6: c3 ret
f7: 89 f6 mov %esi,%esi
f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000100 <strchr>:
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 53 push %ebx
104: 8b 45 08 mov 0x8(%ebp),%eax
107: 8b 5d 0c mov 0xc(%ebp),%ebx
10a: 0f b6 10 movzbl (%eax),%edx
10d: 84 d2 test %dl,%dl
10f: 74 1d je 12e <strchr+0x2e>
111: 38 d3 cmp %dl,%bl
113: 89 d9 mov %ebx,%ecx
115: 75 0d jne 124 <strchr+0x24>
117: eb 17 jmp 130 <strchr+0x30>
119: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
120: 38 ca cmp %cl,%dl
122: 74 0c je 130 <strchr+0x30>
124: 83 c0 01 add $0x1,%eax
127: 0f b6 10 movzbl (%eax),%edx
12a: 84 d2 test %dl,%dl
12c: 75 f2 jne 120 <strchr+0x20>
12e: 31 c0 xor %eax,%eax
130: 5b pop %ebx
131: 5d pop %ebp
132: c3 ret
133: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000140 <gets>:
140: 55 push %ebp
141: 89 e5 mov %esp,%ebp
143: 57 push %edi
144: 56 push %esi
145: 53 push %ebx
146: 31 f6 xor %esi,%esi
148: 89 f3 mov %esi,%ebx
14a: 83 ec 1c sub $0x1c,%esp
14d: 8b 7d 08 mov 0x8(%ebp),%edi
150: eb 2f jmp 181 <gets+0x41>
152: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
158: 8d 45 e7 lea -0x19(%ebp),%eax
15b: 83 ec 04 sub $0x4,%esp
15e: 6a 01 push $0x1
160: 50 push %eax
161: 6a 00 push $0x0
163: e8 32 01 00 00 call 29a <read>
168: 83 c4 10 add $0x10,%esp
16b: 85 c0 test %eax,%eax
16d: 7e 1c jle 18b <gets+0x4b>
16f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
173: 83 c7 01 add $0x1,%edi
176: 88 47 ff mov %al,-0x1(%edi)
179: 3c 0a cmp $0xa,%al
17b: 74 23 je 1a0 <gets+0x60>
17d: 3c 0d cmp $0xd,%al
17f: 74 1f je 1a0 <gets+0x60>
181: 83 c3 01 add $0x1,%ebx
184: 3b 5d 0c cmp 0xc(%ebp),%ebx
187: 89 fe mov %edi,%esi
189: 7c cd jl 158 <gets+0x18>
18b: 89 f3 mov %esi,%ebx
18d: 8b 45 08 mov 0x8(%ebp),%eax
190: c6 03 00 movb $0x0,(%ebx)
193: 8d 65 f4 lea -0xc(%ebp),%esp
196: 5b pop %ebx
197: 5e pop %esi
198: 5f pop %edi
199: 5d pop %ebp
19a: c3 ret
19b: 90 nop
19c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1a0: 8b 75 08 mov 0x8(%ebp),%esi
1a3: 8b 45 08 mov 0x8(%ebp),%eax
1a6: 01 de add %ebx,%esi
1a8: 89 f3 mov %esi,%ebx
1aa: c6 03 00 movb $0x0,(%ebx)
1ad: 8d 65 f4 lea -0xc(%ebp),%esp
1b0: 5b pop %ebx
1b1: 5e pop %esi
1b2: 5f pop %edi
1b3: 5d pop %ebp
1b4: c3 ret
1b5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000001c0 <stat>:
1c0: 55 push %ebp
1c1: 89 e5 mov %esp,%ebp
1c3: 56 push %esi
1c4: 53 push %ebx
1c5: 83 ec 08 sub $0x8,%esp
1c8: 6a 00 push $0x0
1ca: ff 75 08 pushl 0x8(%ebp)
1cd: e8 f0 00 00 00 call 2c2 <open>
1d2: 83 c4 10 add $0x10,%esp
1d5: 85 c0 test %eax,%eax
1d7: 78 27 js 200 <stat+0x40>
1d9: 83 ec 08 sub $0x8,%esp
1dc: ff 75 0c pushl 0xc(%ebp)
1df: 89 c3 mov %eax,%ebx
1e1: 50 push %eax
1e2: e8 f3 00 00 00 call 2da <fstat>
1e7: 89 1c 24 mov %ebx,(%esp)
1ea: 89 c6 mov %eax,%esi
1ec: e8 b9 00 00 00 call 2aa <close>
1f1: 83 c4 10 add $0x10,%esp
1f4: 8d 65 f8 lea -0x8(%ebp),%esp
1f7: 89 f0 mov %esi,%eax
1f9: 5b pop %ebx
1fa: 5e pop %esi
1fb: 5d pop %ebp
1fc: c3 ret
1fd: 8d 76 00 lea 0x0(%esi),%esi
200: be ff ff ff ff mov $0xffffffff,%esi
205: eb ed jmp 1f4 <stat+0x34>
207: 89 f6 mov %esi,%esi
209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000210 <atoi>:
210: 55 push %ebp
211: 89 e5 mov %esp,%ebp
213: 53 push %ebx
214: 8b 4d 08 mov 0x8(%ebp),%ecx
217: 0f be 11 movsbl (%ecx),%edx
21a: 8d 42 d0 lea -0x30(%edx),%eax
21d: 3c 09 cmp $0x9,%al
21f: b8 00 00 00 00 mov $0x0,%eax
224: 77 1f ja 245 <atoi+0x35>
226: 8d 76 00 lea 0x0(%esi),%esi
229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
230: 8d 04 80 lea (%eax,%eax,4),%eax
233: 83 c1 01 add $0x1,%ecx
236: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
23a: 0f be 11 movsbl (%ecx),%edx
23d: 8d 5a d0 lea -0x30(%edx),%ebx
240: 80 fb 09 cmp $0x9,%bl
243: 76 eb jbe 230 <atoi+0x20>
245: 5b pop %ebx
246: 5d pop %ebp
247: c3 ret
248: 90 nop
249: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000250 <memmove>:
250: 55 push %ebp
251: 89 e5 mov %esp,%ebp
253: 56 push %esi
254: 53 push %ebx
255: 8b 5d 10 mov 0x10(%ebp),%ebx
258: 8b 45 08 mov 0x8(%ebp),%eax
25b: 8b 75 0c mov 0xc(%ebp),%esi
25e: 85 db test %ebx,%ebx
260: 7e 14 jle 276 <memmove+0x26>
262: 31 d2 xor %edx,%edx
264: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
268: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
26c: 88 0c 10 mov %cl,(%eax,%edx,1)
26f: 83 c2 01 add $0x1,%edx
272: 39 d3 cmp %edx,%ebx
274: 75 f2 jne 268 <memmove+0x18>
276: 5b pop %ebx
277: 5e pop %esi
278: 5d pop %ebp
279: c3 ret
0000027a <fork>:
27a: b8 01 00 00 00 mov $0x1,%eax
27f: cd 40 int $0x40
281: c3 ret
00000282 <exit>:
282: b8 02 00 00 00 mov $0x2,%eax
287: cd 40 int $0x40
289: c3 ret
0000028a <wait>:
28a: b8 03 00 00 00 mov $0x3,%eax
28f: cd 40 int $0x40
291: c3 ret
00000292 <pipe>:
292: b8 04 00 00 00 mov $0x4,%eax
297: cd 40 int $0x40
299: c3 ret
0000029a <read>:
29a: b8 05 00 00 00 mov $0x5,%eax
29f: cd 40 int $0x40
2a1: c3 ret
000002a2 <write>:
2a2: b8 10 00 00 00 mov $0x10,%eax
2a7: cd 40 int $0x40
2a9: c3 ret
000002aa <close>:
2aa: b8 15 00 00 00 mov $0x15,%eax
2af: cd 40 int $0x40
2b1: c3 ret
000002b2 <kill>:
2b2: b8 06 00 00 00 mov $0x6,%eax
2b7: cd 40 int $0x40
2b9: c3 ret
000002ba <exec>:
2ba: b8 07 00 00 00 mov $0x7,%eax
2bf: cd 40 int $0x40
2c1: c3 ret
000002c2 <open>:
2c2: b8 0f 00 00 00 mov $0xf,%eax
2c7: cd 40 int $0x40
2c9: c3 ret
000002ca <mknod>:
2ca: b8 11 00 00 00 mov $0x11,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <unlink>:
2d2: b8 12 00 00 00 mov $0x12,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <fstat>:
2da: b8 08 00 00 00 mov $0x8,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <link>:
2e2: b8 13 00 00 00 mov $0x13,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <mkdir>:
2ea: b8 14 00 00 00 mov $0x14,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <chdir>:
2f2: b8 09 00 00 00 mov $0x9,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <dup>:
2fa: b8 0a 00 00 00 mov $0xa,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <getpid>:
302: b8 0b 00 00 00 mov $0xb,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <sbrk>:
30a: b8 0c 00 00 00 mov $0xc,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <sleep>:
312: b8 0d 00 00 00 mov $0xd,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <uptime>:
31a: b8 0e 00 00 00 mov $0xe,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <getNumProc>:
322: b8 16 00 00 00 mov $0x16,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <chpr>:
32a: b8 17 00 00 00 mov $0x17,%eax
32f: cd 40 int $0x40
331: c3 ret
332: 66 90 xchg %ax,%ax
334: 66 90 xchg %ax,%ax
336: 66 90 xchg %ax,%ax
338: 66 90 xchg %ax,%ax
33a: 66 90 xchg %ax,%ax
33c: 66 90 xchg %ax,%ax
33e: 66 90 xchg %ax,%ax
00000340 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
340: 55 push %ebp
341: 89 e5 mov %esp,%ebp
343: 57 push %edi
344: 56 push %esi
345: 53 push %ebx
346: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
349: 85 d2 test %edx,%edx
{
34b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
34e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
350: 79 76 jns 3c8 <printint+0x88>
352: f6 45 08 01 testb $0x1,0x8(%ebp)
356: 74 70 je 3c8 <printint+0x88>
x = -xx;
358: f7 d8 neg %eax
neg = 1;
35a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
361: 31 f6 xor %esi,%esi
363: 8d 5d d7 lea -0x29(%ebp),%ebx
366: eb 0a jmp 372 <printint+0x32>
368: 90 nop
369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
370: 89 fe mov %edi,%esi
372: 31 d2 xor %edx,%edx
374: 8d 7e 01 lea 0x1(%esi),%edi
377: f7 f1 div %ecx
379: 0f b6 92 4c 07 00 00 movzbl 0x74c(%edx),%edx
}while((x /= base) != 0);
380: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
382: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
385: 75 e9 jne 370 <printint+0x30>
if(neg)
387: 8b 45 c4 mov -0x3c(%ebp),%eax
38a: 85 c0 test %eax,%eax
38c: 74 08 je 396 <printint+0x56>
buf[i++] = '-';
38e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
393: 8d 7e 02 lea 0x2(%esi),%edi
396: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
39a: 8b 7d c0 mov -0x40(%ebp),%edi
39d: 8d 76 00 lea 0x0(%esi),%esi
3a0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
3a3: 83 ec 04 sub $0x4,%esp
3a6: 83 ee 01 sub $0x1,%esi
3a9: 6a 01 push $0x1
3ab: 53 push %ebx
3ac: 57 push %edi
3ad: 88 45 d7 mov %al,-0x29(%ebp)
3b0: e8 ed fe ff ff call 2a2 <write>
while(--i >= 0)
3b5: 83 c4 10 add $0x10,%esp
3b8: 39 de cmp %ebx,%esi
3ba: 75 e4 jne 3a0 <printint+0x60>
putc(fd, buf[i]);
}
3bc: 8d 65 f4 lea -0xc(%ebp),%esp
3bf: 5b pop %ebx
3c0: 5e pop %esi
3c1: 5f pop %edi
3c2: 5d pop %ebp
3c3: c3 ret
3c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
3c8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
3cf: eb 90 jmp 361 <printint+0x21>
3d1: eb 0d jmp 3e0 <printf>
3d3: 90 nop
3d4: 90 nop
3d5: 90 nop
3d6: 90 nop
3d7: 90 nop
3d8: 90 nop
3d9: 90 nop
3da: 90 nop
3db: 90 nop
3dc: 90 nop
3dd: 90 nop
3de: 90 nop
3df: 90 nop
000003e0 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
3e0: 55 push %ebp
3e1: 89 e5 mov %esp,%ebp
3e3: 57 push %edi
3e4: 56 push %esi
3e5: 53 push %ebx
3e6: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3e9: 8b 75 0c mov 0xc(%ebp),%esi
3ec: 0f b6 1e movzbl (%esi),%ebx
3ef: 84 db test %bl,%bl
3f1: 0f 84 b3 00 00 00 je 4aa <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
3f7: 8d 45 10 lea 0x10(%ebp),%eax
3fa: 83 c6 01 add $0x1,%esi
state = 0;
3fd: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
3ff: 89 45 d4 mov %eax,-0x2c(%ebp)
402: eb 2f jmp 433 <printf+0x53>
404: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
408: 83 f8 25 cmp $0x25,%eax
40b: 0f 84 a7 00 00 00 je 4b8 <printf+0xd8>
write(fd, &c, 1);
411: 8d 45 e2 lea -0x1e(%ebp),%eax
414: 83 ec 04 sub $0x4,%esp
417: 88 5d e2 mov %bl,-0x1e(%ebp)
41a: 6a 01 push $0x1
41c: 50 push %eax
41d: ff 75 08 pushl 0x8(%ebp)
420: e8 7d fe ff ff call 2a2 <write>
425: 83 c4 10 add $0x10,%esp
428: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
42b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
42f: 84 db test %bl,%bl
431: 74 77 je 4aa <printf+0xca>
if(state == 0){
433: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
435: 0f be cb movsbl %bl,%ecx
438: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
43b: 74 cb je 408 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
43d: 83 ff 25 cmp $0x25,%edi
440: 75 e6 jne 428 <printf+0x48>
if(c == 'd'){
442: 83 f8 64 cmp $0x64,%eax
445: 0f 84 05 01 00 00 je 550 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
44b: 81 e1 f7 00 00 00 and $0xf7,%ecx
451: 83 f9 70 cmp $0x70,%ecx
454: 74 72 je 4c8 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
456: 83 f8 73 cmp $0x73,%eax
459: 0f 84 99 00 00 00 je 4f8 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
45f: 83 f8 63 cmp $0x63,%eax
462: 0f 84 08 01 00 00 je 570 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
468: 83 f8 25 cmp $0x25,%eax
46b: 0f 84 ef 00 00 00 je 560 <printf+0x180>
write(fd, &c, 1);
471: 8d 45 e7 lea -0x19(%ebp),%eax
474: 83 ec 04 sub $0x4,%esp
477: c6 45 e7 25 movb $0x25,-0x19(%ebp)
47b: 6a 01 push $0x1
47d: 50 push %eax
47e: ff 75 08 pushl 0x8(%ebp)
481: e8 1c fe ff ff call 2a2 <write>
486: 83 c4 0c add $0xc,%esp
489: 8d 45 e6 lea -0x1a(%ebp),%eax
48c: 88 5d e6 mov %bl,-0x1a(%ebp)
48f: 6a 01 push $0x1
491: 50 push %eax
492: ff 75 08 pushl 0x8(%ebp)
495: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
498: 31 ff xor %edi,%edi
write(fd, &c, 1);
49a: e8 03 fe ff ff call 2a2 <write>
for(i = 0; fmt[i]; i++){
49f: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
4a3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
4a6: 84 db test %bl,%bl
4a8: 75 89 jne 433 <printf+0x53>
}
}
}
4aa: 8d 65 f4 lea -0xc(%ebp),%esp
4ad: 5b pop %ebx
4ae: 5e pop %esi
4af: 5f pop %edi
4b0: 5d pop %ebp
4b1: c3 ret
4b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
4b8: bf 25 00 00 00 mov $0x25,%edi
4bd: e9 66 ff ff ff jmp 428 <printf+0x48>
4c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
4c8: 83 ec 0c sub $0xc,%esp
4cb: b9 10 00 00 00 mov $0x10,%ecx
4d0: 6a 00 push $0x0
4d2: 8b 7d d4 mov -0x2c(%ebp),%edi
4d5: 8b 45 08 mov 0x8(%ebp),%eax
4d8: 8b 17 mov (%edi),%edx
4da: e8 61 fe ff ff call 340 <printint>
ap++;
4df: 89 f8 mov %edi,%eax
4e1: 83 c4 10 add $0x10,%esp
state = 0;
4e4: 31 ff xor %edi,%edi
ap++;
4e6: 83 c0 04 add $0x4,%eax
4e9: 89 45 d4 mov %eax,-0x2c(%ebp)
4ec: e9 37 ff ff ff jmp 428 <printf+0x48>
4f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
4f8: 8b 45 d4 mov -0x2c(%ebp),%eax
4fb: 8b 08 mov (%eax),%ecx
ap++;
4fd: 83 c0 04 add $0x4,%eax
500: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
503: 85 c9 test %ecx,%ecx
505: 0f 84 8e 00 00 00 je 599 <printf+0x1b9>
while(*s != 0){
50b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
50e: 31 ff xor %edi,%edi
s = (char*)*ap;
510: 89 cb mov %ecx,%ebx
while(*s != 0){
512: 84 c0 test %al,%al
514: 0f 84 0e ff ff ff je 428 <printf+0x48>
51a: 89 75 d0 mov %esi,-0x30(%ebp)
51d: 89 de mov %ebx,%esi
51f: 8b 5d 08 mov 0x8(%ebp),%ebx
522: 8d 7d e3 lea -0x1d(%ebp),%edi
525: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
528: 83 ec 04 sub $0x4,%esp
s++;
52b: 83 c6 01 add $0x1,%esi
52e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
531: 6a 01 push $0x1
533: 57 push %edi
534: 53 push %ebx
535: e8 68 fd ff ff call 2a2 <write>
while(*s != 0){
53a: 0f b6 06 movzbl (%esi),%eax
53d: 83 c4 10 add $0x10,%esp
540: 84 c0 test %al,%al
542: 75 e4 jne 528 <printf+0x148>
544: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
547: 31 ff xor %edi,%edi
549: e9 da fe ff ff jmp 428 <printf+0x48>
54e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
550: 83 ec 0c sub $0xc,%esp
553: b9 0a 00 00 00 mov $0xa,%ecx
558: 6a 01 push $0x1
55a: e9 73 ff ff ff jmp 4d2 <printf+0xf2>
55f: 90 nop
write(fd, &c, 1);
560: 83 ec 04 sub $0x4,%esp
563: 88 5d e5 mov %bl,-0x1b(%ebp)
566: 8d 45 e5 lea -0x1b(%ebp),%eax
569: 6a 01 push $0x1
56b: e9 21 ff ff ff jmp 491 <printf+0xb1>
putc(fd, *ap);
570: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
573: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
576: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
578: 6a 01 push $0x1
ap++;
57a: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
57d: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
580: 8d 45 e4 lea -0x1c(%ebp),%eax
583: 50 push %eax
584: ff 75 08 pushl 0x8(%ebp)
587: e8 16 fd ff ff call 2a2 <write>
ap++;
58c: 89 7d d4 mov %edi,-0x2c(%ebp)
58f: 83 c4 10 add $0x10,%esp
state = 0;
592: 31 ff xor %edi,%edi
594: e9 8f fe ff ff jmp 428 <printf+0x48>
s = "(null)";
599: bb 45 07 00 00 mov $0x745,%ebx
while(*s != 0){
59e: b8 28 00 00 00 mov $0x28,%eax
5a3: e9 72 ff ff ff jmp 51a <printf+0x13a>
5a8: 66 90 xchg %ax,%ax
5aa: 66 90 xchg %ax,%ax
5ac: 66 90 xchg %ax,%ax
5ae: 66 90 xchg %ax,%ax
000005b0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5b0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5b1: a1 f0 09 00 00 mov 0x9f0,%eax
{
5b6: 89 e5 mov %esp,%ebp
5b8: 57 push %edi
5b9: 56 push %esi
5ba: 53 push %ebx
5bb: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
5be: 8d 4b f8 lea -0x8(%ebx),%ecx
5c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5c8: 39 c8 cmp %ecx,%eax
5ca: 8b 10 mov (%eax),%edx
5cc: 73 32 jae 600 <free+0x50>
5ce: 39 d1 cmp %edx,%ecx
5d0: 72 04 jb 5d6 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5d2: 39 d0 cmp %edx,%eax
5d4: 72 32 jb 608 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
5d6: 8b 73 fc mov -0x4(%ebx),%esi
5d9: 8d 3c f1 lea (%ecx,%esi,8),%edi
5dc: 39 fa cmp %edi,%edx
5de: 74 30 je 610 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
5e0: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
5e3: 8b 50 04 mov 0x4(%eax),%edx
5e6: 8d 34 d0 lea (%eax,%edx,8),%esi
5e9: 39 f1 cmp %esi,%ecx
5eb: 74 3a je 627 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
5ed: 89 08 mov %ecx,(%eax)
freep = p;
5ef: a3 f0 09 00 00 mov %eax,0x9f0
}
5f4: 5b pop %ebx
5f5: 5e pop %esi
5f6: 5f pop %edi
5f7: 5d pop %ebp
5f8: c3 ret
5f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
600: 39 d0 cmp %edx,%eax
602: 72 04 jb 608 <free+0x58>
604: 39 d1 cmp %edx,%ecx
606: 72 ce jb 5d6 <free+0x26>
{
608: 89 d0 mov %edx,%eax
60a: eb bc jmp 5c8 <free+0x18>
60c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
610: 03 72 04 add 0x4(%edx),%esi
613: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
616: 8b 10 mov (%eax),%edx
618: 8b 12 mov (%edx),%edx
61a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
61d: 8b 50 04 mov 0x4(%eax),%edx
620: 8d 34 d0 lea (%eax,%edx,8),%esi
623: 39 f1 cmp %esi,%ecx
625: 75 c6 jne 5ed <free+0x3d>
p->s.size += bp->s.size;
627: 03 53 fc add -0x4(%ebx),%edx
freep = p;
62a: a3 f0 09 00 00 mov %eax,0x9f0
p->s.size += bp->s.size;
62f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
632: 8b 53 f8 mov -0x8(%ebx),%edx
635: 89 10 mov %edx,(%eax)
}
637: 5b pop %ebx
638: 5e pop %esi
639: 5f pop %edi
63a: 5d pop %ebp
63b: c3 ret
63c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000640 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
640: 55 push %ebp
641: 89 e5 mov %esp,%ebp
643: 57 push %edi
644: 56 push %esi
645: 53 push %ebx
646: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
649: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
64c: 8b 15 f0 09 00 00 mov 0x9f0,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
652: 8d 78 07 lea 0x7(%eax),%edi
655: c1 ef 03 shr $0x3,%edi
658: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
65b: 85 d2 test %edx,%edx
65d: 0f 84 9d 00 00 00 je 700 <malloc+0xc0>
663: 8b 02 mov (%edx),%eax
665: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
668: 39 cf cmp %ecx,%edi
66a: 76 6c jbe 6d8 <malloc+0x98>
66c: 81 ff 00 10 00 00 cmp $0x1000,%edi
672: bb 00 10 00 00 mov $0x1000,%ebx
677: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
67a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
681: eb 0e jmp 691 <malloc+0x51>
683: 90 nop
684: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
688: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
68a: 8b 48 04 mov 0x4(%eax),%ecx
68d: 39 f9 cmp %edi,%ecx
68f: 73 47 jae 6d8 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
691: 39 05 f0 09 00 00 cmp %eax,0x9f0
697: 89 c2 mov %eax,%edx
699: 75 ed jne 688 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
69b: 83 ec 0c sub $0xc,%esp
69e: 56 push %esi
69f: e8 66 fc ff ff call 30a <sbrk>
if(p == (char*)-1)
6a4: 83 c4 10 add $0x10,%esp
6a7: 83 f8 ff cmp $0xffffffff,%eax
6aa: 74 1c je 6c8 <malloc+0x88>
hp->s.size = nu;
6ac: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
6af: 83 ec 0c sub $0xc,%esp
6b2: 83 c0 08 add $0x8,%eax
6b5: 50 push %eax
6b6: e8 f5 fe ff ff call 5b0 <free>
return freep;
6bb: 8b 15 f0 09 00 00 mov 0x9f0,%edx
if((p = morecore(nunits)) == 0)
6c1: 83 c4 10 add $0x10,%esp
6c4: 85 d2 test %edx,%edx
6c6: 75 c0 jne 688 <malloc+0x48>
return 0;
}
}
6c8: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
6cb: 31 c0 xor %eax,%eax
}
6cd: 5b pop %ebx
6ce: 5e pop %esi
6cf: 5f pop %edi
6d0: 5d pop %ebp
6d1: c3 ret
6d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
6d8: 39 cf cmp %ecx,%edi
6da: 74 54 je 730 <malloc+0xf0>
p->s.size -= nunits;
6dc: 29 f9 sub %edi,%ecx
6de: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
6e1: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
6e4: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
6e7: 89 15 f0 09 00 00 mov %edx,0x9f0
}
6ed: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
6f0: 83 c0 08 add $0x8,%eax
}
6f3: 5b pop %ebx
6f4: 5e pop %esi
6f5: 5f pop %edi
6f6: 5d pop %ebp
6f7: c3 ret
6f8: 90 nop
6f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
700: c7 05 f0 09 00 00 f4 movl $0x9f4,0x9f0
707: 09 00 00
70a: c7 05 f4 09 00 00 f4 movl $0x9f4,0x9f4
711: 09 00 00
base.s.size = 0;
714: b8 f4 09 00 00 mov $0x9f4,%eax
719: c7 05 f8 09 00 00 00 movl $0x0,0x9f8
720: 00 00 00
723: e9 44 ff ff ff jmp 66c <malloc+0x2c>
728: 90 nop
729: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
730: 8b 08 mov (%eax),%ecx
732: 89 0a mov %ecx,(%edx)
734: eb b1 jmp 6e7 <malloc+0xa7>
|
commands/apps/spotify/play-spotify.applescript | rborn/script-commands | 0 | 4276 | <reponame>rborn/script-commands
#!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Play Spotify
# @raycast.mode compact
# Optional parameters:
# @raycast.icon images/logo.png
# @raycast.packageName Spotify
# Documentation:
# @raycast.description Play Spotify
# @raycast.author <NAME>
# @raycast.authorURL https://twitter.com/dan_tamas
tell application "Spotify" to play
|
demo-sharding/src/main/java/com/demo/sharding/advance/hello.g4 | qiub649691422/springboot-integration | 2 | 6601 | <reponame>qiub649691422/springboot-integration<gh_stars>1-10
grammar hello;
r: 'hello' ID;
ID: [0-9]+;
WS: [\t\r\n]->skip; |
programs/oeis/156/A156635.asm | karttu/loda | 1 | 170966 | <reponame>karttu/loda<gh_stars>1-10
; A156635: 144*n^2 - n.
; 143,574,1293,2300,3595,5178,7049,9208,11655,14390,17413,20724,24323,28210,32385,36848,41599,46638,51965,57580,63483,69674,76153,82920,89975,97318,104949,112868,121075,129570,138353,147424,156783,166430,176365,186588,197099,207898,218985,230360,242023,253974,266213,278740,291555,304658,318049,331728,345695,359950,374493,389324,404443,419850,435545,451528,467799,484358,501205,518340,535763,553474,571473,589760,608335,627198,646349,665788,685515,705530,725833,746424,767303,788470,809925,831668,853699,876018,898625,921520,944703,968174,991933,1015980,1040315,1064938,1089849,1115048,1140535,1166310,1192373,1218724,1245363,1272290,1299505,1327008,1354799,1382878,1411245,1439900,1468843,1498074,1527593,1557400,1587495,1617878,1648549,1679508,1710755,1742290,1774113,1806224,1838623,1871310,1904285,1937548,1971099,2004938,2039065,2073480,2108183,2143174,2178453,2214020,2249875,2286018,2322449,2359168,2396175,2433470,2471053,2508924,2547083,2585530,2624265,2663288,2702599,2742198,2782085,2822260,2862723,2903474,2944513,2985840,3027455,3069358,3111549,3154028,3196795,3239850,3283193,3326824,3370743,3414950,3459445,3504228,3549299,3594658,3640305,3686240,3732463,3778974,3825773,3872860,3920235,3967898,4015849,4064088,4112615,4161430,4210533,4259924,4309603,4359570,4409825,4460368,4511199,4562318,4613725,4665420,4717403,4769674,4822233,4875080,4928215,4981638,5035349,5089348,5143635,5198210,5253073,5308224,5363663,5419390,5475405,5531708,5588299,5645178,5702345,5759800,5817543,5875574,5933893,5992500,6051395,6110578,6170049,6229808,6289855,6350190,6410813,6471724,6532923,6594410,6656185,6718248,6780599,6843238,6906165,6969380,7032883,7096674,7160753,7225120,7289775,7354718,7419949,7485468,7551275,7617370,7683753,7750424,7817383,7884630,7952165,8019988,8088099,8156498,8225185,8294160,8363423,8432974,8502813,8572940,8643355,8714058,8785049,8856328,8927895,8999750
add $0,1
mul $0,144
bin $0,2
mov $1,$0
div $1,72
|
canonical-boxed-forms.agda | hazelgrove/hazelnut-agda | 0 | 15341 | <gh_stars>0
open import Nat
open import Prelude
open import contexts
open import dynamics-core
open import canonical-value-forms
module canonical-boxed-forms where
canonical-boxed-forms-num : ∀{Δ d} →
Δ , ∅ ⊢ d :: num →
d boxedval →
Σ[ n ∈ Nat ] (d == N n)
canonical-boxed-forms-num (TAVar _) (BVVal ())
canonical-boxed-forms-num wt (BVVal v) = canonical-value-forms-num wt v
-- this type gives somewhat nicer syntax for the output of the canonical
-- forms lemma for boxed values at arrow type
data cbf-arr : (Δ : hctx) (d : ihexp) (τ1 τ2 : htyp) → Set where
CBFALam : ∀{Δ d τ1 τ2} →
Σ[ x ∈ Nat ] Σ[ d' ∈ ihexp ]
((d == (·λ x ·[ τ1 ] d')) ×
(Δ , ■ (x , τ1) ⊢ d' :: τ2)
)
→ cbf-arr Δ d τ1 τ2
CBFACastArr : ∀{Δ d τ1 τ2} →
Σ[ d' ∈ ihexp ] Σ[ τ1' ∈ htyp ] Σ[ τ2' ∈ htyp ]
((d == (d' ⟨ τ1' ==> τ2' ⇒ τ1 ==> τ2 ⟩)) ×
(τ1' ==> τ2' ≠ τ1 ==> τ2) ×
(Δ , ∅ ⊢ d' :: τ1' ==> τ2') ×
(d' boxedval)
)
→ cbf-arr Δ d τ1 τ2
canonical-boxed-forms-arr : ∀{Δ d τ1 τ2 } →
Δ , ∅ ⊢ d :: (τ1 ==> τ2) →
d boxedval →
cbf-arr Δ d τ1 τ2
canonical-boxed-forms-arr (TAVar x₁) (BVVal ())
canonical-boxed-forms-arr (TALam f wt) (BVVal v) = CBFALam (canonical-value-forms-arr (TALam f wt) v)
canonical-boxed-forms-arr (TAAp wt wt₁) (BVVal ())
canonical-boxed-forms-arr (TAEHole x x₁) (BVVal ())
canonical-boxed-forms-arr (TANEHole x wt x₁) (BVVal ())
canonical-boxed-forms-arr (TACast wt x) (BVVal ())
canonical-boxed-forms-arr (TACast wt x) (BVArrCast x₁ bv) = CBFACastArr (_ , _ , _ , refl , x₁ , wt , bv)
canonical-boxed-forms-arr (TAFailedCast x x₁ x₂ x₃) (BVVal ())
-- this type gives somewhat nicer syntax for the output of the canonical
-- forms lemma for boxed values at sum type
data cbf-sum : (Δ : hctx) (d : ihexp) (τ1 τ2 : htyp) → Set where
CBFSInl : ∀{Δ d τ1 τ2} →
Σ[ d' ∈ ihexp ]
((d == (inl τ2 d')) ×
(Δ , ∅ ⊢ d' :: τ1) ×
(d boxedval)
)
→ cbf-sum Δ d τ1 τ2
CBFSInr : ∀{Δ d τ1 τ2} →
Σ[ d' ∈ ihexp ]
((d == (inr τ1 d')) ×
(Δ , ∅ ⊢ d' :: τ2) ×
(d boxedval)
)
→ cbf-sum Δ d τ1 τ2
CBFSCastSum : ∀{Δ d τ1 τ2} →
Σ[ d' ∈ ihexp ] Σ[ τ1' ∈ htyp ] Σ[ τ2' ∈ htyp ]
((d == (d' ⟨ τ1' ⊕ τ2' ⇒ τ1 ⊕ τ2 ⟩)) ×
(τ1' ⊕ τ2' ≠ τ1 ⊕ τ2) ×
(Δ , ∅ ⊢ d' :: τ1' ⊕ τ2') ×
(d' boxedval)
)
→ cbf-sum Δ d τ1 τ2
canonical-boxed-forms-sum : ∀{Δ d τ1 τ2 } →
Δ , ∅ ⊢ d :: (τ1 ⊕ τ2) →
d boxedval →
cbf-sum Δ d τ1 τ2
canonical-boxed-forms-sum (TAInl wt) x = CBFSInl (_ , refl , wt , x)
canonical-boxed-forms-sum (TAInr wt) x = CBFSInr (_ , refl , wt , x)
canonical-boxed-forms-sum (TACast wt x₁) (BVSumCast x bv) = CBFSCastSum (_ , _ , _ , refl , x , wt , bv)
canonical-boxed-forms-sum (TAVar x₁) (BVVal ())
canonical-boxed-forms-sum (TAAp wt wt₁) (BVVal ())
canonical-boxed-forms-sum (TACase wt _ wt₁ _ wt₂) (BVVal ())
canonical-boxed-forms-sum (TAFst wt) (BVVal ())
canonical-boxed-forms-sum (TASnd wt) (BVVal ())
canonical-boxed-forms-sum (TAEHole x₁ x₂) (BVVal ())
canonical-boxed-forms-sum (TANEHole x₁ wt x₂) (BVVal ())
canonical-boxed-forms-sum (TACast wt x₁) (BVVal ())
canonical-boxed-forms-sum (TAFailedCast wt x₁ x₂ x₃) (BVVal ())
-- this type gives somewhat nicer syntax for the output of the canonical
-- forms lemma for boxed values at product type
data cbf-prod : (Δ : hctx) (d : ihexp) (τ1 τ2 : htyp) → Set where
CBFPPair : ∀{Δ d τ1 τ2} →
Σ[ d1 ∈ ihexp ] Σ[ d2 ∈ ihexp ]
((d == ⟨ d1 , d2 ⟩) ×
(Δ , ∅ ⊢ d1 :: τ1) ×
(Δ , ∅ ⊢ d2 :: τ2) ×
(d1 boxedval) ×
(d2 boxedval)
)
→ cbf-prod Δ d τ1 τ2
CBFPCastProd : ∀{Δ d τ1 τ2} →
Σ[ d' ∈ ihexp ] Σ[ τ1' ∈ htyp ] Σ[ τ2' ∈ htyp ]
((d == (d' ⟨ τ1' ⊠ τ2' ⇒ τ1 ⊠ τ2 ⟩)) ×
(τ1' ⊠ τ2' ≠ τ1 ⊠ τ2) ×
(Δ , ∅ ⊢ d' :: τ1' ⊠ τ2') ×
(d' boxedval)
)
→ cbf-prod Δ d τ1 τ2
canonical-boxed-forms-prod : ∀{Δ d τ1 τ2 } →
Δ , ∅ ⊢ d :: (τ1 ⊠ τ2) →
d boxedval →
cbf-prod Δ d τ1 τ2
canonical-boxed-forms-prod (TAPair wt wt₁) (BVVal (VPair x x₁)) = CBFPPair (_ , _ , refl , wt , wt₁ , BVVal x , BVVal x₁)
canonical-boxed-forms-prod (TAPair wt wt₁) (BVPair bv bv₁) = CBFPPair (_ , _ , refl , wt , wt₁ , bv , bv₁)
canonical-boxed-forms-prod (TACast wt x) (BVProdCast x₁ bv) = CBFPCastProd (_ , _ , _ , refl , x₁ , wt , bv)
canonical-boxed-forms-hole : ∀{Δ d} →
Δ , ∅ ⊢ d :: ⦇-⦈ →
d boxedval →
Σ[ d' ∈ ihexp ] Σ[ τ' ∈ htyp ]
((d == d' ⟨ τ' ⇒ ⦇-⦈ ⟩) ×
(τ' ground) ×
(Δ , ∅ ⊢ d' :: τ'))
canonical-boxed-forms-hole (TAVar x₁) (BVVal ())
canonical-boxed-forms-hole (TAAp wt wt₁) (BVVal ())
canonical-boxed-forms-hole (TAEHole x x₁) (BVVal ())
canonical-boxed-forms-hole (TANEHole x wt x₁) (BVVal ())
canonical-boxed-forms-hole (TACast wt x) (BVVal ())
canonical-boxed-forms-hole (TACast wt x) (BVHoleCast x₁ bv) = _ , _ , refl , x₁ , wt
canonical-boxed-forms-hole (TAFailedCast x x₁ x₂ x₃) (BVVal ())
canonical-boxed-forms-coverage : ∀{Δ d τ} →
Δ , ∅ ⊢ d :: τ →
d boxedval →
τ ≠ num →
((τ1 : htyp) (τ2 : htyp) → τ ≠ (τ1 ==> τ2)) →
((τ1 : htyp) (τ2 : htyp) → τ ≠ (τ1 ⊕ τ2)) →
((τ1 : htyp) (τ2 : htyp) → τ ≠ (τ1 ⊠ τ2)) →
τ ≠ ⦇-⦈ →
⊥
canonical-boxed-forms-coverage TANum bv nn na ns np nh = nn refl
canonical-boxed-forms-coverage (TAPlus wt wt₁) bv nn na ns np nh = nn refl
canonical-boxed-forms-coverage (TALam x wt) bv nn na ns np nh = na _ _ refl
canonical-boxed-forms-coverage (TAAp wt wt₁) (BVVal ()) nn na ns np nh
canonical-boxed-forms-coverage (TAInl wt) bv nn na ns np nh = ns _ _ refl
canonical-boxed-forms-coverage (TAInr wt) bv nn na ns np nh = ns _ _ refl
canonical-boxed-forms-coverage (TACase wt _ wt₁ _ wt₂) (BVVal ()) nn na ns np nh
canonical-boxed-forms-coverage (TAEHole x x₁) (BVVal ()) nn na ns np nh
canonical-boxed-forms-coverage (TANEHole x wt x₁) (BVVal ()) nn na ns np nh
canonical-boxed-forms-coverage (TACast wt x) (BVArrCast x₁ bv) nn na ns np nh = na _ _ refl
canonical-boxed-forms-coverage (TACast wt x) (BVSumCast x₁ bv) nn na ns np nh = ns _ _ refl
canonical-boxed-forms-coverage (TACast wt x) (BVProdCast x₁ bv) nn na ns np nh = np _ _ refl
canonical-boxed-forms-coverage (TACast wt x) (BVHoleCast x₁ bv) nn na ns np nh = nh refl
canonical-boxed-forms-coverage (TAFailedCast wt x x₁ x₂) (BVVal ()) nn na ns np nh
canonical-boxed-forms-coverage (TAPair wt wt₁) bv nn na ns np nh = np _ _ refl
canonical-boxed-forms-coverage (TAFst wt) (BVVal ()) nn na ns np nh
canonical-boxed-forms-coverage (TASnd wt) (BVVal ()) nn na ns np nh
|
Praktikum2-1.asm | maxwellscode/mips | 0 | 175137 | <gh_stars>0
.text
.globl ___start
___start:
la $s0,ThisText
forEveryCharacterInString:
lb $t0,0($s0)
beq $t0,$zero,EndOfFile
addi $sp,$sp,-1 # Decrement stack pointer by 1
sb $t0,0($sp) # Save character to stack
addi $s0,$s0,1
j forEveryCharacterInString
EndOfFile:
#print text from stack
add $a0,$sp,0
li $v0,4
syscall
#end program
li $v0, 10
syscall
.data
ThisText: .asciiz "Das sollte nun auf dem Stack zu sehen sein" |
demo/adainclude/memory_set.adb | e3l6/SSMDev | 0 | 11408 | <gh_stars>0
with Ada.Unchecked_Conversion;
package body Memory_Set is
------------
-- memset --
------------
function Memset (M : Address; C : int; Size : size_t) return Address is
subtype Mem_Array is char_array (size_t);
type Mem_Ptr is access Mem_Array;
function To_Memptr is
new Ada.Unchecked_Conversion (Address, Mem_Ptr);
Dest : constant Mem_Ptr := To_Memptr (M);
begin
if Size > 0 then
for J in 0 .. Size - 1 loop
Dest (J) := char'Val (C);
end loop;
end if;
return M;
end Memset;
end Memory_Set;
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_1129_479.asm | ljhsiun2/medusa | 9 | 102914 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r14
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x14691, %rsi
lea addresses_normal_ht+0x63d1, %rdi
nop
nop
and $65189, %r14
mov $83, %rcx
rep movsl
add %rbx, %rbx
lea addresses_normal_ht+0x8ab1, %rsi
lea addresses_WT_ht+0x11ab1, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
add $63285, %r10
mov $74, %rcx
rep movsl
nop
nop
inc %rsi
lea addresses_normal_ht+0x1d615, %rcx
clflush (%rcx)
sub %r14, %r14
vmovups (%rcx), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %rsi
nop
nop
nop
nop
dec %rdi
lea addresses_normal_ht+0x5331, %rsi
lea addresses_WT_ht+0xfeb1, %rdi
nop
nop
nop
and $41721, %r10
mov $12, %rcx
rep movsq
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_D_ht+0xe31, %rbx
nop
sub %r12, %r12
movb (%rbx), %r10b
nop
nop
nop
nop
dec %r10
lea addresses_normal_ht+0x17fb1, %rsi
nop
nop
nop
cmp %r14, %r14
mov (%rsi), %bx
nop
nop
nop
nop
nop
cmp %r10, %r10
lea addresses_UC_ht+0x1e4b1, %rsi
lea addresses_A_ht+0xbd51, %rdi
add %r13, %r13
mov $112, %rcx
rep movsw
nop
nop
nop
sub %r10, %r10
lea addresses_A_ht+0x6811, %rcx
nop
nop
nop
nop
cmp $35851, %r12
movups (%rcx), %xmm6
vpextrq $1, %xmm6, %rdi
nop
nop
xor %r12, %r12
lea addresses_D_ht+0x13b71, %r13
nop
nop
nop
nop
add $49083, %r12
mov $0x6162636465666768, %r10
movq %r10, (%r13)
nop
nop
nop
nop
sub %r10, %r10
lea addresses_D_ht+0x18fb1, %rcx
nop
nop
nop
nop
nop
dec %rdi
movw $0x6162, (%rcx)
add $54269, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %rbp
push %rbx
push %rdx
// Load
lea addresses_PSE+0x1dab1, %r14
nop
cmp $58564, %rdx
mov (%r14), %r13
nop
nop
nop
nop
xor %rbp, %rbp
// Store
lea addresses_UC+0xd2b1, %r11
nop
nop
lfence
mov $0x5152535455565758, %r14
movq %r14, (%r11)
nop
sub $3213, %rbx
// Store
lea addresses_UC+0x7501, %r14
nop
nop
and %r12, %r12
movl $0x51525354, (%r14)
nop
nop
xor %rdx, %rdx
// Store
lea addresses_D+0x4211, %r14
nop
nop
nop
nop
nop
and %rbp, %rbp
mov $0x5152535455565758, %r11
movq %r11, (%r14)
nop
nop
nop
nop
nop
inc %rbp
// Store
lea addresses_WC+0x1e4b1, %r14
inc %r11
movb $0x51, (%r14)
nop
nop
dec %rdx
// Load
lea addresses_A+0x1ab1, %rbp
nop
nop
nop
xor %r13, %r13
mov (%rbp), %r14
nop
cmp $59897, %rbx
// Faulty Load
lea addresses_normal+0x52b1, %rdx
nop
nop
nop
nop
and $49809, %r11
movb (%rdx), %bl
lea oracles, %r14
and $0xff, %rbx
shlq $12, %rbx
mov (%r14,%rbx,1), %rbx
pop %rdx
pop %rbx
pop %rbp
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 6, 'same': False}}
{'34': 1129}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
programs/oeis/168/A168103.asm | neoneye/loda | 22 | 160032 | <filename>programs/oeis/168/A168103.asm<gh_stars>10-100
; A168103: a(n) = sum of natural numbers m such that n - 4 <= m <= n + 4.
; 10,15,21,28,36,45,54,63,72,81,90,99,108,117,126,135,144,153,162,171,180,189,198,207,216,225,234,243,252,261,270,279,288,297,306,315,324,333,342,351,360,369,378,387,396,405,414,423,432,441,450,459,468,477,486,495,504,513,522,531,540,549,558,567,576,585,594,603,612,621,630,639,648,657,666,675,684,693,702,711,720,729,738,747,756,765,774,783,792,801,810,819,828,837,846,855,864,873,882,891
mov $2,$0
mov $0,9
add $2,4
lpb $0
sub $0,1
add $1,$2
trn $2,1
lpe
mov $0,$1
|
char.agda | logicshan/IAL | 0 | 8314 | <filename>char.agda
module char where
open import bool
open import nat
open import eq
open import product
open import product-thms
----------------------------------------------------------------------
-- datatypes
----------------------------------------------------------------------
postulate
char : Set
{-# BUILTIN CHAR char #-}
----------------------------------------------------------------------
-- primitive operations
----------------------------------------------------------------------
private
primitive
primCharToNat : char → ℕ
primCharEquality : char → char → 𝔹
toNat : char → ℕ
toNat = primCharToNat
infix 4 _=char_
_=char_ : char → char → 𝔹
_=char_ = primCharEquality
postulate
≡char-to-= : (c1 c2 : char) → c1 ≡ c2 → _=char_ c1 c2 ≡ tt
=char-to-≡ : (c1 c2 : char) → _=char_ c1 c2 ≡ tt → c1 ≡ c2
=char-sym : (c1 c2 : char) → (c1 =char c2) ≡ (c2 =char c1)
=char-sym c1 c2 with keep (c1 =char c2)
=char-sym c1 c2 | tt , p rewrite =char-to-≡ c1 c2 p = refl
=char-sym c1 c2 | ff , p with keep (c2 =char c1)
=char-sym c1 c2 | ff , p | tt , p' rewrite =char-to-≡ c2 c1 p' = refl
=char-sym c1 c2 | ff , p | ff , p' rewrite p | p' = refl
postulate
_<char_ : char → char → 𝔹
{-# COMPILED _<char_ (<) #-}
----------------------------------------------------------------------
-- defined operations
----------------------------------------------------------------------
-- is a decimal digit
is-digit : char → 𝔹
is-digit '0' = tt
is-digit '1' = tt
is-digit '2' = tt
is-digit '3' = tt
is-digit '4' = tt
is-digit '5' = tt
is-digit '6' = tt
is-digit '7' = tt
is-digit '8' = tt
is-digit '9' = tt
is-digit _ = ff
|
programs/oeis/070/A070699.asm | karttu/loda | 1 | 89381 | ; A070699: a(n) = n^7 mod 17.
; 0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3,7,4,6,8,16,0,1,9,11,13,10,14,12,15,2,5,3
pow $0,7
mod $0,17
mov $1,$0
|
kill.asm | snowman789/xv6_scheduler | 0 | 177291 |
_kill: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char **argv)
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
11: 83 ec 08 sub $0x8,%esp
14: 8b 31 mov (%ecx),%esi
16: 8b 79 04 mov 0x4(%ecx),%edi
int i;
if(argc < 2){
19: 83 fe 01 cmp $0x1,%esi
1c: 7e 07 jle 25 <main+0x25>
printf(2, "usage: kill pid...\n");
exit();
}
for(i=1; i<argc; i++)
1e: bb 01 00 00 00 mov $0x1,%ebx
23: eb 2d jmp 52 <main+0x52>
printf(2, "usage: kill pid...\n");
25: 83 ec 08 sub $0x8,%esp
28: 68 0c 06 00 00 push $0x60c
2d: 6a 02 push $0x2
2f: e8 1e 03 00 00 call 352 <printf>
exit();
34: e8 af 01 00 00 call 1e8 <exit>
kill(atoi(argv[i]));
39: 83 ec 0c sub $0xc,%esp
3c: ff 34 9f pushl (%edi,%ebx,4)
3f: e8 46 01 00 00 call 18a <atoi>
44: 89 04 24 mov %eax,(%esp)
47: e8 cc 01 00 00 call 218 <kill>
for(i=1; i<argc; i++)
4c: 83 c3 01 add $0x1,%ebx
4f: 83 c4 10 add $0x10,%esp
52: 39 f3 cmp %esi,%ebx
54: 7c e3 jl 39 <main+0x39>
exit();
56: e8 8d 01 00 00 call 1e8 <exit>
0000005b <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
5b: 55 push %ebp
5c: 89 e5 mov %esp,%ebp
5e: 53 push %ebx
5f: 8b 45 08 mov 0x8(%ebp),%eax
62: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
65: 89 c2 mov %eax,%edx
67: 0f b6 19 movzbl (%ecx),%ebx
6a: 88 1a mov %bl,(%edx)
6c: 8d 52 01 lea 0x1(%edx),%edx
6f: 8d 49 01 lea 0x1(%ecx),%ecx
72: 84 db test %bl,%bl
74: 75 f1 jne 67 <strcpy+0xc>
;
return os;
}
76: 5b pop %ebx
77: 5d pop %ebp
78: c3 ret
00000079 <strcmp>:
int
strcmp(const char *p, const char *q)
{
79: 55 push %ebp
7a: 89 e5 mov %esp,%ebp
7c: 8b 4d 08 mov 0x8(%ebp),%ecx
7f: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
82: eb 06 jmp 8a <strcmp+0x11>
p++, q++;
84: 83 c1 01 add $0x1,%ecx
87: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
8a: 0f b6 01 movzbl (%ecx),%eax
8d: 84 c0 test %al,%al
8f: 74 04 je 95 <strcmp+0x1c>
91: 3a 02 cmp (%edx),%al
93: 74 ef je 84 <strcmp+0xb>
return (uchar)*p - (uchar)*q;
95: 0f b6 c0 movzbl %al,%eax
98: 0f b6 12 movzbl (%edx),%edx
9b: 29 d0 sub %edx,%eax
}
9d: 5d pop %ebp
9e: c3 ret
0000009f <strlen>:
uint
strlen(const char *s)
{
9f: 55 push %ebp
a0: 89 e5 mov %esp,%ebp
a2: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
a5: ba 00 00 00 00 mov $0x0,%edx
aa: eb 03 jmp af <strlen+0x10>
ac: 83 c2 01 add $0x1,%edx
af: 89 d0 mov %edx,%eax
b1: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
b5: 75 f5 jne ac <strlen+0xd>
;
return n;
}
b7: 5d pop %ebp
b8: c3 ret
000000b9 <memset>:
void*
memset(void *dst, int c, uint n)
{
b9: 55 push %ebp
ba: 89 e5 mov %esp,%ebp
bc: 57 push %edi
bd: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
c0: 89 d7 mov %edx,%edi
c2: 8b 4d 10 mov 0x10(%ebp),%ecx
c5: 8b 45 0c mov 0xc(%ebp),%eax
c8: fc cld
c9: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
cb: 89 d0 mov %edx,%eax
cd: 5f pop %edi
ce: 5d pop %ebp
cf: c3 ret
000000d0 <strchr>:
char*
strchr(const char *s, char c)
{
d0: 55 push %ebp
d1: 89 e5 mov %esp,%ebp
d3: 8b 45 08 mov 0x8(%ebp),%eax
d6: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
da: 0f b6 10 movzbl (%eax),%edx
dd: 84 d2 test %dl,%dl
df: 74 09 je ea <strchr+0x1a>
if(*s == c)
e1: 38 ca cmp %cl,%dl
e3: 74 0a je ef <strchr+0x1f>
for(; *s; s++)
e5: 83 c0 01 add $0x1,%eax
e8: eb f0 jmp da <strchr+0xa>
return (char*)s;
return 0;
ea: b8 00 00 00 00 mov $0x0,%eax
}
ef: 5d pop %ebp
f0: c3 ret
000000f1 <gets>:
char*
gets(char *buf, int max)
{
f1: 55 push %ebp
f2: 89 e5 mov %esp,%ebp
f4: 57 push %edi
f5: 56 push %esi
f6: 53 push %ebx
f7: 83 ec 1c sub $0x1c,%esp
fa: 8b 7d 08 mov 0x8(%ebp),%edi
int i, cc;
char c;
for(i=0; i+1 < max; ){
fd: bb 00 00 00 00 mov $0x0,%ebx
102: 8d 73 01 lea 0x1(%ebx),%esi
105: 3b 75 0c cmp 0xc(%ebp),%esi
108: 7d 2e jge 138 <gets+0x47>
cc = read(0, &c, 1);
10a: 83 ec 04 sub $0x4,%esp
10d: 6a 01 push $0x1
10f: 8d 45 e7 lea -0x19(%ebp),%eax
112: 50 push %eax
113: 6a 00 push $0x0
115: e8 e6 00 00 00 call 200 <read>
if(cc < 1)
11a: 83 c4 10 add $0x10,%esp
11d: 85 c0 test %eax,%eax
11f: 7e 17 jle 138 <gets+0x47>
break;
buf[i++] = c;
121: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
125: 88 04 1f mov %al,(%edi,%ebx,1)
if(c == '\n' || c == '\r')
128: 3c 0a cmp $0xa,%al
12a: 0f 94 c2 sete %dl
12d: 3c 0d cmp $0xd,%al
12f: 0f 94 c0 sete %al
buf[i++] = c;
132: 89 f3 mov %esi,%ebx
if(c == '\n' || c == '\r')
134: 08 c2 or %al,%dl
136: 74 ca je 102 <gets+0x11>
break;
}
buf[i] = '\0';
138: c6 04 1f 00 movb $0x0,(%edi,%ebx,1)
return buf;
}
13c: 89 f8 mov %edi,%eax
13e: 8d 65 f4 lea -0xc(%ebp),%esp
141: 5b pop %ebx
142: 5e pop %esi
143: 5f pop %edi
144: 5d pop %ebp
145: c3 ret
00000146 <stat>:
int
stat(const char *n, struct stat *st)
{
146: 55 push %ebp
147: 89 e5 mov %esp,%ebp
149: 56 push %esi
14a: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
14b: 83 ec 08 sub $0x8,%esp
14e: 6a 00 push $0x0
150: ff 75 08 pushl 0x8(%ebp)
153: e8 d0 00 00 00 call 228 <open>
if(fd < 0)
158: 83 c4 10 add $0x10,%esp
15b: 85 c0 test %eax,%eax
15d: 78 24 js 183 <stat+0x3d>
15f: 89 c3 mov %eax,%ebx
return -1;
r = fstat(fd, st);
161: 83 ec 08 sub $0x8,%esp
164: ff 75 0c pushl 0xc(%ebp)
167: 50 push %eax
168: e8 d3 00 00 00 call 240 <fstat>
16d: 89 c6 mov %eax,%esi
close(fd);
16f: 89 1c 24 mov %ebx,(%esp)
172: e8 99 00 00 00 call 210 <close>
return r;
177: 83 c4 10 add $0x10,%esp
}
17a: 89 f0 mov %esi,%eax
17c: 8d 65 f8 lea -0x8(%ebp),%esp
17f: 5b pop %ebx
180: 5e pop %esi
181: 5d pop %ebp
182: c3 ret
return -1;
183: be ff ff ff ff mov $0xffffffff,%esi
188: eb f0 jmp 17a <stat+0x34>
0000018a <atoi>:
int
atoi(const char *s)
{
18a: 55 push %ebp
18b: 89 e5 mov %esp,%ebp
18d: 53 push %ebx
18e: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
191: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
196: eb 10 jmp 1a8 <atoi+0x1e>
n = n*10 + *s++ - '0';
198: 8d 1c 80 lea (%eax,%eax,4),%ebx
19b: 8d 04 1b lea (%ebx,%ebx,1),%eax
19e: 83 c1 01 add $0x1,%ecx
1a1: 0f be d2 movsbl %dl,%edx
1a4: 8d 44 02 d0 lea -0x30(%edx,%eax,1),%eax
while('0' <= *s && *s <= '9')
1a8: 0f b6 11 movzbl (%ecx),%edx
1ab: 8d 5a d0 lea -0x30(%edx),%ebx
1ae: 80 fb 09 cmp $0x9,%bl
1b1: 76 e5 jbe 198 <atoi+0xe>
return n;
}
1b3: 5b pop %ebx
1b4: 5d pop %ebp
1b5: c3 ret
000001b6 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
1b6: 55 push %ebp
1b7: 89 e5 mov %esp,%ebp
1b9: 56 push %esi
1ba: 53 push %ebx
1bb: 8b 45 08 mov 0x8(%ebp),%eax
1be: 8b 5d 0c mov 0xc(%ebp),%ebx
1c1: 8b 55 10 mov 0x10(%ebp),%edx
char *dst;
const char *src;
dst = vdst;
1c4: 89 c1 mov %eax,%ecx
src = vsrc;
while(n-- > 0)
1c6: eb 0d jmp 1d5 <memmove+0x1f>
*dst++ = *src++;
1c8: 0f b6 13 movzbl (%ebx),%edx
1cb: 88 11 mov %dl,(%ecx)
1cd: 8d 5b 01 lea 0x1(%ebx),%ebx
1d0: 8d 49 01 lea 0x1(%ecx),%ecx
while(n-- > 0)
1d3: 89 f2 mov %esi,%edx
1d5: 8d 72 ff lea -0x1(%edx),%esi
1d8: 85 d2 test %edx,%edx
1da: 7f ec jg 1c8 <memmove+0x12>
return vdst;
}
1dc: 5b pop %ebx
1dd: 5e pop %esi
1de: 5d pop %ebp
1df: c3 ret
000001e0 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
1e0: b8 01 00 00 00 mov $0x1,%eax
1e5: cd 40 int $0x40
1e7: c3 ret
000001e8 <exit>:
SYSCALL(exit)
1e8: b8 02 00 00 00 mov $0x2,%eax
1ed: cd 40 int $0x40
1ef: c3 ret
000001f0 <wait>:
SYSCALL(wait)
1f0: b8 03 00 00 00 mov $0x3,%eax
1f5: cd 40 int $0x40
1f7: c3 ret
000001f8 <pipe>:
SYSCALL(pipe)
1f8: b8 04 00 00 00 mov $0x4,%eax
1fd: cd 40 int $0x40
1ff: c3 ret
00000200 <read>:
SYSCALL(read)
200: b8 05 00 00 00 mov $0x5,%eax
205: cd 40 int $0x40
207: c3 ret
00000208 <write>:
SYSCALL(write)
208: b8 10 00 00 00 mov $0x10,%eax
20d: cd 40 int $0x40
20f: c3 ret
00000210 <close>:
SYSCALL(close)
210: b8 15 00 00 00 mov $0x15,%eax
215: cd 40 int $0x40
217: c3 ret
00000218 <kill>:
SYSCALL(kill)
218: b8 06 00 00 00 mov $0x6,%eax
21d: cd 40 int $0x40
21f: c3 ret
00000220 <exec>:
SYSCALL(exec)
220: b8 07 00 00 00 mov $0x7,%eax
225: cd 40 int $0x40
227: c3 ret
00000228 <open>:
SYSCALL(open)
228: b8 0f 00 00 00 mov $0xf,%eax
22d: cd 40 int $0x40
22f: c3 ret
00000230 <mknod>:
SYSCALL(mknod)
230: b8 11 00 00 00 mov $0x11,%eax
235: cd 40 int $0x40
237: c3 ret
00000238 <unlink>:
SYSCALL(unlink)
238: b8 12 00 00 00 mov $0x12,%eax
23d: cd 40 int $0x40
23f: c3 ret
00000240 <fstat>:
SYSCALL(fstat)
240: b8 08 00 00 00 mov $0x8,%eax
245: cd 40 int $0x40
247: c3 ret
00000248 <link>:
SYSCALL(link)
248: b8 13 00 00 00 mov $0x13,%eax
24d: cd 40 int $0x40
24f: c3 ret
00000250 <mkdir>:
SYSCALL(mkdir)
250: b8 14 00 00 00 mov $0x14,%eax
255: cd 40 int $0x40
257: c3 ret
00000258 <chdir>:
SYSCALL(chdir)
258: b8 09 00 00 00 mov $0x9,%eax
25d: cd 40 int $0x40
25f: c3 ret
00000260 <dup>:
SYSCALL(dup)
260: b8 0a 00 00 00 mov $0xa,%eax
265: cd 40 int $0x40
267: c3 ret
00000268 <getpid>:
SYSCALL(getpid)
268: b8 0b 00 00 00 mov $0xb,%eax
26d: cd 40 int $0x40
26f: c3 ret
00000270 <sbrk>:
SYSCALL(sbrk)
270: b8 0c 00 00 00 mov $0xc,%eax
275: cd 40 int $0x40
277: c3 ret
00000278 <sleep>:
SYSCALL(sleep)
278: b8 0d 00 00 00 mov $0xd,%eax
27d: cd 40 int $0x40
27f: c3 ret
00000280 <uptime>:
SYSCALL(uptime)
280: b8 0e 00 00 00 mov $0xe,%eax
285: cd 40 int $0x40
287: c3 ret
00000288 <yield>:
SYSCALL(yield)
288: b8 16 00 00 00 mov $0x16,%eax
28d: cd 40 int $0x40
28f: c3 ret
00000290 <shutdown>:
SYSCALL(shutdown)
290: b8 17 00 00 00 mov $0x17,%eax
295: cd 40 int $0x40
297: c3 ret
00000298 <writecount>:
SYSCALL(writecount)
298: b8 18 00 00 00 mov $0x18,%eax
29d: cd 40 int $0x40
29f: c3 ret
000002a0 <setwritecount>:
SYSCALL(setwritecount)
2a0: b8 19 00 00 00 mov $0x19,%eax
2a5: cd 40 int $0x40
2a7: c3 ret
000002a8 <settickets>:
SYSCALL(settickets)
2a8: b8 1a 00 00 00 mov $0x1a,%eax
2ad: cd 40 int $0x40
2af: c3 ret
000002b0 <getprocessesinfo>:
2b0: b8 1b 00 00 00 mov $0x1b,%eax
2b5: cd 40 int $0x40
2b7: c3 ret
000002b8 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
2b8: 55 push %ebp
2b9: 89 e5 mov %esp,%ebp
2bb: 83 ec 1c sub $0x1c,%esp
2be: 88 55 f4 mov %dl,-0xc(%ebp)
write(fd, &c, 1);
2c1: 6a 01 push $0x1
2c3: 8d 55 f4 lea -0xc(%ebp),%edx
2c6: 52 push %edx
2c7: 50 push %eax
2c8: e8 3b ff ff ff call 208 <write>
}
2cd: 83 c4 10 add $0x10,%esp
2d0: c9 leave
2d1: c3 ret
000002d2 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
2d2: 55 push %ebp
2d3: 89 e5 mov %esp,%ebp
2d5: 57 push %edi
2d6: 56 push %esi
2d7: 53 push %ebx
2d8: 83 ec 2c sub $0x2c,%esp
2db: 89 c7 mov %eax,%edi
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
2dd: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
2e1: 0f 95 c3 setne %bl
2e4: 89 d0 mov %edx,%eax
2e6: c1 e8 1f shr $0x1f,%eax
2e9: 84 c3 test %al,%bl
2eb: 74 10 je 2fd <printint+0x2b>
neg = 1;
x = -xx;
2ed: f7 da neg %edx
neg = 1;
2ef: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%ebp)
} else {
x = xx;
}
i = 0;
2f6: be 00 00 00 00 mov $0x0,%esi
2fb: eb 0b jmp 308 <printint+0x36>
neg = 0;
2fd: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
304: eb f0 jmp 2f6 <printint+0x24>
do{
buf[i++] = digits[x % base];
306: 89 c6 mov %eax,%esi
308: 89 d0 mov %edx,%eax
30a: ba 00 00 00 00 mov $0x0,%edx
30f: f7 f1 div %ecx
311: 89 c3 mov %eax,%ebx
313: 8d 46 01 lea 0x1(%esi),%eax
316: 0f b6 92 28 06 00 00 movzbl 0x628(%edx),%edx
31d: 88 54 35 d8 mov %dl,-0x28(%ebp,%esi,1)
}while((x /= base) != 0);
321: 89 da mov %ebx,%edx
323: 85 db test %ebx,%ebx
325: 75 df jne 306 <printint+0x34>
327: 89 c3 mov %eax,%ebx
if(neg)
329: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
32d: 74 16 je 345 <printint+0x73>
buf[i++] = '-';
32f: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1)
334: 8d 5e 02 lea 0x2(%esi),%ebx
337: eb 0c jmp 345 <printint+0x73>
while(--i >= 0)
putc(fd, buf[i]);
339: 0f be 54 1d d8 movsbl -0x28(%ebp,%ebx,1),%edx
33e: 89 f8 mov %edi,%eax
340: e8 73 ff ff ff call 2b8 <putc>
while(--i >= 0)
345: 83 eb 01 sub $0x1,%ebx
348: 79 ef jns 339 <printint+0x67>
}
34a: 83 c4 2c add $0x2c,%esp
34d: 5b pop %ebx
34e: 5e pop %esi
34f: 5f pop %edi
350: 5d pop %ebp
351: c3 ret
00000352 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
352: 55 push %ebp
353: 89 e5 mov %esp,%ebp
355: 57 push %edi
356: 56 push %esi
357: 53 push %ebx
358: 83 ec 1c sub $0x1c,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
35b: 8d 45 10 lea 0x10(%ebp),%eax
35e: 89 45 e4 mov %eax,-0x1c(%ebp)
state = 0;
361: be 00 00 00 00 mov $0x0,%esi
for(i = 0; fmt[i]; i++){
366: bb 00 00 00 00 mov $0x0,%ebx
36b: eb 14 jmp 381 <printf+0x2f>
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
} else {
putc(fd, c);
36d: 89 fa mov %edi,%edx
36f: 8b 45 08 mov 0x8(%ebp),%eax
372: e8 41 ff ff ff call 2b8 <putc>
377: eb 05 jmp 37e <printf+0x2c>
}
} else if(state == '%'){
379: 83 fe 25 cmp $0x25,%esi
37c: 74 25 je 3a3 <printf+0x51>
for(i = 0; fmt[i]; i++){
37e: 83 c3 01 add $0x1,%ebx
381: 8b 45 0c mov 0xc(%ebp),%eax
384: 0f b6 04 18 movzbl (%eax,%ebx,1),%eax
388: 84 c0 test %al,%al
38a: 0f 84 23 01 00 00 je 4b3 <printf+0x161>
c = fmt[i] & 0xff;
390: 0f be f8 movsbl %al,%edi
393: 0f b6 c0 movzbl %al,%eax
if(state == 0){
396: 85 f6 test %esi,%esi
398: 75 df jne 379 <printf+0x27>
if(c == '%'){
39a: 83 f8 25 cmp $0x25,%eax
39d: 75 ce jne 36d <printf+0x1b>
state = '%';
39f: 89 c6 mov %eax,%esi
3a1: eb db jmp 37e <printf+0x2c>
if(c == 'd'){
3a3: 83 f8 64 cmp $0x64,%eax
3a6: 74 49 je 3f1 <printf+0x9f>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
3a8: 83 f8 78 cmp $0x78,%eax
3ab: 0f 94 c1 sete %cl
3ae: 83 f8 70 cmp $0x70,%eax
3b1: 0f 94 c2 sete %dl
3b4: 08 d1 or %dl,%cl
3b6: 75 63 jne 41b <printf+0xc9>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
3b8: 83 f8 73 cmp $0x73,%eax
3bb: 0f 84 84 00 00 00 je 445 <printf+0xf3>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
3c1: 83 f8 63 cmp $0x63,%eax
3c4: 0f 84 b7 00 00 00 je 481 <printf+0x12f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
3ca: 83 f8 25 cmp $0x25,%eax
3cd: 0f 84 cc 00 00 00 je 49f <printf+0x14d>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
3d3: ba 25 00 00 00 mov $0x25,%edx
3d8: 8b 45 08 mov 0x8(%ebp),%eax
3db: e8 d8 fe ff ff call 2b8 <putc>
putc(fd, c);
3e0: 89 fa mov %edi,%edx
3e2: 8b 45 08 mov 0x8(%ebp),%eax
3e5: e8 ce fe ff ff call 2b8 <putc>
}
state = 0;
3ea: be 00 00 00 00 mov $0x0,%esi
3ef: eb 8d jmp 37e <printf+0x2c>
printint(fd, *ap, 10, 1);
3f1: 8b 7d e4 mov -0x1c(%ebp),%edi
3f4: 8b 17 mov (%edi),%edx
3f6: 83 ec 0c sub $0xc,%esp
3f9: 6a 01 push $0x1
3fb: b9 0a 00 00 00 mov $0xa,%ecx
400: 8b 45 08 mov 0x8(%ebp),%eax
403: e8 ca fe ff ff call 2d2 <printint>
ap++;
408: 83 c7 04 add $0x4,%edi
40b: 89 7d e4 mov %edi,-0x1c(%ebp)
40e: 83 c4 10 add $0x10,%esp
state = 0;
411: be 00 00 00 00 mov $0x0,%esi
416: e9 63 ff ff ff jmp 37e <printf+0x2c>
printint(fd, *ap, 16, 0);
41b: 8b 7d e4 mov -0x1c(%ebp),%edi
41e: 8b 17 mov (%edi),%edx
420: 83 ec 0c sub $0xc,%esp
423: 6a 00 push $0x0
425: b9 10 00 00 00 mov $0x10,%ecx
42a: 8b 45 08 mov 0x8(%ebp),%eax
42d: e8 a0 fe ff ff call 2d2 <printint>
ap++;
432: 83 c7 04 add $0x4,%edi
435: 89 7d e4 mov %edi,-0x1c(%ebp)
438: 83 c4 10 add $0x10,%esp
state = 0;
43b: be 00 00 00 00 mov $0x0,%esi
440: e9 39 ff ff ff jmp 37e <printf+0x2c>
s = (char*)*ap;
445: 8b 45 e4 mov -0x1c(%ebp),%eax
448: 8b 30 mov (%eax),%esi
ap++;
44a: 83 c0 04 add $0x4,%eax
44d: 89 45 e4 mov %eax,-0x1c(%ebp)
if(s == 0)
450: 85 f6 test %esi,%esi
452: 75 28 jne 47c <printf+0x12a>
s = "(null)";
454: be 20 06 00 00 mov $0x620,%esi
459: 8b 7d 08 mov 0x8(%ebp),%edi
45c: eb 0d jmp 46b <printf+0x119>
putc(fd, *s);
45e: 0f be d2 movsbl %dl,%edx
461: 89 f8 mov %edi,%eax
463: e8 50 fe ff ff call 2b8 <putc>
s++;
468: 83 c6 01 add $0x1,%esi
while(*s != 0){
46b: 0f b6 16 movzbl (%esi),%edx
46e: 84 d2 test %dl,%dl
470: 75 ec jne 45e <printf+0x10c>
state = 0;
472: be 00 00 00 00 mov $0x0,%esi
477: e9 02 ff ff ff jmp 37e <printf+0x2c>
47c: 8b 7d 08 mov 0x8(%ebp),%edi
47f: eb ea jmp 46b <printf+0x119>
putc(fd, *ap);
481: 8b 7d e4 mov -0x1c(%ebp),%edi
484: 0f be 17 movsbl (%edi),%edx
487: 8b 45 08 mov 0x8(%ebp),%eax
48a: e8 29 fe ff ff call 2b8 <putc>
ap++;
48f: 83 c7 04 add $0x4,%edi
492: 89 7d e4 mov %edi,-0x1c(%ebp)
state = 0;
495: be 00 00 00 00 mov $0x0,%esi
49a: e9 df fe ff ff jmp 37e <printf+0x2c>
putc(fd, c);
49f: 89 fa mov %edi,%edx
4a1: 8b 45 08 mov 0x8(%ebp),%eax
4a4: e8 0f fe ff ff call 2b8 <putc>
state = 0;
4a9: be 00 00 00 00 mov $0x0,%esi
4ae: e9 cb fe ff ff jmp 37e <printf+0x2c>
}
}
}
4b3: 8d 65 f4 lea -0xc(%ebp),%esp
4b6: 5b pop %ebx
4b7: 5e pop %esi
4b8: 5f pop %edi
4b9: 5d pop %ebp
4ba: c3 ret
000004bb <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
4bb: 55 push %ebp
4bc: 89 e5 mov %esp,%ebp
4be: 57 push %edi
4bf: 56 push %esi
4c0: 53 push %ebx
4c1: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
4c4: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
4c7: a1 cc 08 00 00 mov 0x8cc,%eax
4cc: eb 02 jmp 4d0 <free+0x15>
4ce: 89 d0 mov %edx,%eax
4d0: 39 c8 cmp %ecx,%eax
4d2: 73 04 jae 4d8 <free+0x1d>
4d4: 39 08 cmp %ecx,(%eax)
4d6: 77 12 ja 4ea <free+0x2f>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
4d8: 8b 10 mov (%eax),%edx
4da: 39 c2 cmp %eax,%edx
4dc: 77 f0 ja 4ce <free+0x13>
4de: 39 c8 cmp %ecx,%eax
4e0: 72 08 jb 4ea <free+0x2f>
4e2: 39 ca cmp %ecx,%edx
4e4: 77 04 ja 4ea <free+0x2f>
4e6: 89 d0 mov %edx,%eax
4e8: eb e6 jmp 4d0 <free+0x15>
break;
if(bp + bp->s.size == p->s.ptr){
4ea: 8b 73 fc mov -0x4(%ebx),%esi
4ed: 8d 3c f1 lea (%ecx,%esi,8),%edi
4f0: 8b 10 mov (%eax),%edx
4f2: 39 d7 cmp %edx,%edi
4f4: 74 19 je 50f <free+0x54>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
4f6: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
4f9: 8b 50 04 mov 0x4(%eax),%edx
4fc: 8d 34 d0 lea (%eax,%edx,8),%esi
4ff: 39 ce cmp %ecx,%esi
501: 74 1b je 51e <free+0x63>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
503: 89 08 mov %ecx,(%eax)
freep = p;
505: a3 cc 08 00 00 mov %eax,0x8cc
}
50a: 5b pop %ebx
50b: 5e pop %esi
50c: 5f pop %edi
50d: 5d pop %ebp
50e: c3 ret
bp->s.size += p->s.ptr->s.size;
50f: 03 72 04 add 0x4(%edx),%esi
512: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
515: 8b 10 mov (%eax),%edx
517: 8b 12 mov (%edx),%edx
519: 89 53 f8 mov %edx,-0x8(%ebx)
51c: eb db jmp 4f9 <free+0x3e>
p->s.size += bp->s.size;
51e: 03 53 fc add -0x4(%ebx),%edx
521: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
524: 8b 53 f8 mov -0x8(%ebx),%edx
527: 89 10 mov %edx,(%eax)
529: eb da jmp 505 <free+0x4a>
0000052b <morecore>:
static Header*
morecore(uint nu)
{
52b: 55 push %ebp
52c: 89 e5 mov %esp,%ebp
52e: 53 push %ebx
52f: 83 ec 04 sub $0x4,%esp
532: 89 c3 mov %eax,%ebx
char *p;
Header *hp;
if(nu < 4096)
534: 3d ff 0f 00 00 cmp $0xfff,%eax
539: 77 05 ja 540 <morecore+0x15>
nu = 4096;
53b: bb 00 10 00 00 mov $0x1000,%ebx
p = sbrk(nu * sizeof(Header));
540: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax
547: 83 ec 0c sub $0xc,%esp
54a: 50 push %eax
54b: e8 20 fd ff ff call 270 <sbrk>
if(p == (char*)-1)
550: 83 c4 10 add $0x10,%esp
553: 83 f8 ff cmp $0xffffffff,%eax
556: 74 1c je 574 <morecore+0x49>
return 0;
hp = (Header*)p;
hp->s.size = nu;
558: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
55b: 83 c0 08 add $0x8,%eax
55e: 83 ec 0c sub $0xc,%esp
561: 50 push %eax
562: e8 54 ff ff ff call 4bb <free>
return freep;
567: a1 cc 08 00 00 mov 0x8cc,%eax
56c: 83 c4 10 add $0x10,%esp
}
56f: 8b 5d fc mov -0x4(%ebp),%ebx
572: c9 leave
573: c3 ret
return 0;
574: b8 00 00 00 00 mov $0x0,%eax
579: eb f4 jmp 56f <morecore+0x44>
0000057b <malloc>:
void*
malloc(uint nbytes)
{
57b: 55 push %ebp
57c: 89 e5 mov %esp,%ebp
57e: 53 push %ebx
57f: 83 ec 04 sub $0x4,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
582: 8b 45 08 mov 0x8(%ebp),%eax
585: 8d 58 07 lea 0x7(%eax),%ebx
588: c1 eb 03 shr $0x3,%ebx
58b: 83 c3 01 add $0x1,%ebx
if((prevp = freep) == 0){
58e: 8b 0d cc 08 00 00 mov 0x8cc,%ecx
594: 85 c9 test %ecx,%ecx
596: 74 04 je 59c <malloc+0x21>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
598: 8b 01 mov (%ecx),%eax
59a: eb 4d jmp 5e9 <malloc+0x6e>
base.s.ptr = freep = prevp = &base;
59c: c7 05 cc 08 00 00 d0 movl $0x8d0,0x8cc
5a3: 08 00 00
5a6: c7 05 d0 08 00 00 d0 movl $0x8d0,0x8d0
5ad: 08 00 00
base.s.size = 0;
5b0: c7 05 d4 08 00 00 00 movl $0x0,0x8d4
5b7: 00 00 00
base.s.ptr = freep = prevp = &base;
5ba: b9 d0 08 00 00 mov $0x8d0,%ecx
5bf: eb d7 jmp 598 <malloc+0x1d>
if(p->s.size >= nunits){
if(p->s.size == nunits)
5c1: 39 da cmp %ebx,%edx
5c3: 74 1a je 5df <malloc+0x64>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
5c5: 29 da sub %ebx,%edx
5c7: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
5ca: 8d 04 d0 lea (%eax,%edx,8),%eax
p->s.size = nunits;
5cd: 89 58 04 mov %ebx,0x4(%eax)
}
freep = prevp;
5d0: 89 0d cc 08 00 00 mov %ecx,0x8cc
return (void*)(p + 1);
5d6: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
5d9: 83 c4 04 add $0x4,%esp
5dc: 5b pop %ebx
5dd: 5d pop %ebp
5de: c3 ret
prevp->s.ptr = p->s.ptr;
5df: 8b 10 mov (%eax),%edx
5e1: 89 11 mov %edx,(%ecx)
5e3: eb eb jmp 5d0 <malloc+0x55>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
5e5: 89 c1 mov %eax,%ecx
5e7: 8b 00 mov (%eax),%eax
if(p->s.size >= nunits){
5e9: 8b 50 04 mov 0x4(%eax),%edx
5ec: 39 da cmp %ebx,%edx
5ee: 73 d1 jae 5c1 <malloc+0x46>
if(p == freep)
5f0: 39 05 cc 08 00 00 cmp %eax,0x8cc
5f6: 75 ed jne 5e5 <malloc+0x6a>
if((p = morecore(nunits)) == 0)
5f8: 89 d8 mov %ebx,%eax
5fa: e8 2c ff ff ff call 52b <morecore>
5ff: 85 c0 test %eax,%eax
601: 75 e2 jne 5e5 <malloc+0x6a>
return 0;
603: b8 00 00 00 00 mov $0x0,%eax
608: eb cf jmp 5d9 <malloc+0x5e>
|
programs/oeis/240/A240443.asm | neoneye/loda | 22 | 179407 | <filename>programs/oeis/240/A240443.asm<gh_stars>10-100
; A240443: Maximal number of points that can be placed on an n X n square grid so that no four of them are vertices of a square with any orientation.
; 1,3,6,10,15,21,27,34,42,50
mov $1,3
mul $1,$0
add $1,16
mul $1,$0
add $1,16
add $1,$0
div $1,8
sub $1,1
mov $0,$1
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca_notsx.log_21829_237.asm | ljhsiun2/medusa | 9 | 179636 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x19208, %r15
nop
nop
nop
and $24342, %rbp
movb (%r15), %bl
mfence
lea addresses_normal_ht+0xf8b4, %rsi
lea addresses_A_ht+0xe2e8, %rdi
clflush (%rsi)
nop
nop
nop
nop
sub %r11, %r11
mov $53, %rcx
rep movsq
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_D_ht+0x1a508, %r11
nop
nop
nop
inc %rcx
mov (%r11), %bx
add %r9, %r9
lea addresses_WT_ht+0x12608, %rsi
lea addresses_WC_ht+0x3488, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
inc %r11
mov $111, %rcx
rep movsw
nop
and %r11, %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r8
push %r9
push %rbx
push %rcx
// Store
lea addresses_RW+0x9e08, %r14
nop
nop
nop
inc %r8
movl $0x51525354, (%r14)
and %r14, %r14
// Store
lea addresses_RW+0x9e08, %r9
nop
and %r14, %r14
movb $0x51, (%r9)
nop
nop
nop
nop
nop
cmp %r11, %r11
// Store
lea addresses_normal+0x1e08, %rbx
nop
nop
nop
nop
and %r15, %r15
mov $0x5152535455565758, %r9
movq %r9, %xmm3
movups %xmm3, (%rbx)
nop
nop
nop
nop
nop
xor %rcx, %rcx
// Load
lea addresses_WC+0xfb88, %r14
nop
xor %rbx, %rbx
mov (%r14), %r11d
nop
nop
sub %r14, %r14
// Faulty Load
lea addresses_RW+0x9e08, %r15
sub $34576, %r11
movaps (%r15), %xmm4
vpextrq $1, %xmm4, %rcx
lea oracles, %rbx
and $0xff, %rcx
shlq $12, %rcx
mov (%rbx,%rcx,1), %rcx
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'STOR'}
{'dst': {'NT': True, 'AVXalign': True, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6, 'same': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 7, 'same': True, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/241/A241478.asm | neoneye/loda-programs | 11 | 240900 | <gh_stars>10-100
; A241478: a(n) = 4^n*(n/4 + binomial(n-1/2, -1/2)).
; Submitted by <NAME>(s4)
; 1,3,14,68,326,1532,7068,32104,143942,638444,2806196,12239768,53035804,228504408,979640696,4181649360,17780949574,75348050252,318312780612,1341015321784,5635404667700,23628002057736,98861122208008,412853709749168,1721097463947036,7163285024204152,29769316110856328,123544129364651504,512051848866255992,2119737493599451184,8765175866116213744,36205994996067517344,149406576730619003462,615961982866431469068,2537210235499739596516,10442362959094011750392,42943810886103643702468
mov $1,$0
add $1,$0
mov $2,$0
mov $0,4
pow $0,$2
div $0,2
bin $1,$2
mul $1,2
mul $2,$0
add $1,$2
mov $0,$1
div $0,2
|
oeis/041/A041880.asm | neoneye/loda-programs | 11 | 242406 | ; A041880: Numerators of continued fraction convergents to sqrt(462).
; Submitted by <NAME>(w1)
; 21,43,1827,3697,157101,317899,13508859,27335617,1161604773,2350545163,99884501619,202119548401,8588905534461,17379930617323,738545991462027,1494471913541377,63506366360199861,128507204633941099,5460808960985726019,11050125126605393137,469566064278412237773,950182253683429868683,40377220718982466722459,81704623691648363313601,3471971415768213725893701,7025647455228075815101003,298549164535347397960135827,604123976525922871735372657,25671756178624108010845787421,51947636333774138893426947499
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
dif $2,3
dif $2,7
mul $2,21
add $3,$2
lpe
mov $0,$3
|
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sccz80/esx_f_chdir.asm | Toysoft/z88dk | 0 | 87089 | ; unsigned char esx_f_chdir(unsigned char *pathname)
SECTION code_esxdos
PUBLIC esx_f_chdir
EXTERN asm_esx_f_chdir
defc esx_f_chdir = asm_esx_f_chdir
|
File and Folder Actions/OpenFileWhenConnected.applescript | rogues-gallery/applescript | 360 | 3660 | --- open a file when you regain an internet connection on your computer
--- the script will stay open and ping google until a connection has been established
set _choisir to button returned of (display dialog "Choose a file to open when you regain an internet connection" with icon note buttons {"OK", "Nevermind"} default button "OK" giving up after 10)
if _choisir is "OK" then
set new_file to choose file with prompt "Choose file or application to open"
end if
display dialog "The script will remain active until you regain an internet connection"
repeat
try
do shell script "ping -c 5 www.google.com"
exit repeat
on error
delay 2
end try
end repeat
tell application "Finder" to open new_file
--- http://www.github.com/unforswearing
|
cs61/lab_template.asm | bmoya217/ucr | 0 | 242686 | <filename>cs61/lab_template.asm
;===============================================================================
; Name: <NAME>
; Username: <EMAIL>
;
; Lab: lab 9.1
; Lab section: 021
; TA: <NAME>
;
;===============================================================================
.Orig x3000
;Instructions
LD R6, POINTER
ADD R0,R0,#10
ADD R0,R0,#-1
ST R6, POINTER
BRzp #-3
HALT
;Local data
POINTER .FILL x4000
;-------------------------------------------------------------------------------
; Subroutine: SUB_INSERT_NAME
; Parameter (R0): The value to push onto the stack
; Parameter (R1): stack_addr: A pointer to the beginning of the stack
; Parameter (R2): top: A pointer to the next place to PUSH an item
; Parameter (R3): capacity: The number of additional items the stack can hold
; Postcondition: The subroutine has pushed (R0) onto the stack. If an overflow
; occurred, the subroutine has printed an overflow error message
; and terminated.
; Return Value: R2 ← updated top value
; R3 ← updated capacity value
;-------------------------------------------------------------------------------
.ORIG x3200
SUB_INSERT_NAME
ST R7, R7_3200
LD R7, R7_3200
RET
;Subroutine data
R7_3200 .BLKW #1
;Remote Data
ARRAY .BLKW #100
.end |
test/asset/Test.agda | erydo/agda-mode | 58 | 5972 | <filename>test/asset/Test.agda
{-# OPTIONS --without-K #-}
module Test where
open import Level
infixl 4 _≡_
data _≡_ {a} {A : Set a} (x : A) : A → Set a where
refl : x ≡ x
J : {a b : Level} (A : Set a) (C : (x y : A) → x ≡ y → Set b)
→ ((x : A) → C x x refl)
→ (x y : A) (P : x ≡ y)
→ C x y P
J A C b x .x refl = b x
-- K : (A : Set) (x : A) (C : x ≡ x → Set)
-- → C refl
-- → (loop : x ≡ x)
-- → C loop
-- K A x C b p = {! p !}
-- Lemma 2.1.1 (inversion of paths)
infix 6 ¬_
¬_ : {a : Level} {A : Set a} {x y : A} → x ≡ y → y ≡ x
¬_ {a} {A} {x} {y} p = J A D d x y p
where
D : (x y : A) (p : x ≡ y) → Set a
D x y p = y ≡ x
d : (x : A) → D x x refl
d x = refl
-- Lemma 2.1.2 (concatenation of paths)
infixl 5 _∙_
_∙_ : {a : Level} {A : Set a} {x y z : A} → x ≡ y → y ≡ z → x ≡ z
_∙_ {a} {A} {x} {y} {z} p q = J {a} {a} A D d x y p z q
where
-- the predicate
D : (x y : A) (p : x ≡ y) → Set a
D x y p = (z : A) (q : y ≡ z) → x ≡ z
-- base case
d : (x : A) → D x x refl
d x z q = J A E e x z q
where
-- the predicate
E : (x z : A) (q : x ≡ z) → Set a
E x z q = x ≡ z
-- base case
e : (x : A) → E x x refl
e x = refl
-- Lemma 2.1.4.i (identity of path concatenation)
∙-identityʳ : {a : Level} {A : Set a} {x y : A} (p : x ≡ y) → p ≡ p ∙ refl
∙-identityʳ {a} {A} {x} {y} p = J A D d x y p
where
-- the predicate
D : (x y : A) (p : x ≡ y) → Set a
D x y p = p ≡ p ∙ refl
-- base case
d : (x : A) → D x x refl
d x = refl
∙-identityˡ : {a : Level} {A : Set a} {x y : A} (p : x ≡ y) → p ≡ refl ∙ p
∙-identityˡ {a} {A} {x} {y} p = J A D d x y p
where
-- the predicate
D : (x y : A) (p : x ≡ y) → Set a
D x y p = p ≡ refl ∙ p
-- base case
d : (x : A) → D x x refl
d x = refl
-- Lemma 2.1.4.ii (identity of path inversion)
¬-identityʳ : {a : Level} {A : Set a} {x y : A} (p : x ≡ y) → ¬ p ∙ p ≡ refl
¬-identityʳ {a} {A} {x} {y} p = J A D d x y p
where
-- the predicate
D : (x y : A) (p : x ≡ y) → Set a
D x y p = ¬ p ∙ p ≡ refl
-- base case
d : (x : A) → D x x refl
d x = refl
¬-identityˡ : {a : Level} {A : Set a} {x y : A} (p : x ≡ y) → p ∙ ¬ p ≡ refl
¬-identityˡ {a} {A} {x} {y} p = J A D d x y p
where
-- the predicate
D : (x y : A) (p : x ≡ y) → Set a
D x y p = p ∙ ¬ p ≡ refl
-- base case
d : (x : A) → D x x refl
d x = refl
-- Lemma 2.1.4.iii (involution of path inversion)
involution : {A : Set} {x y : A} (p : x ≡ y) → ¬ ¬ p ≡ p
involution {A} {x} {y} p = J A D d x y p
where
-- the predicate
D : (x y : A) (p : x ≡ y) → Set
D x y p = ¬ ¬ p ≡ p
-- base case
d : (x : A) → D x x refl
d x = refl
-- Lemma 2.1.4.iv (associativity of path concatenation)
∙-assoc : {a : Level} {A : Set a} {w x y z : A}
→ (p : w ≡ x) (q : x ≡ y) (r : y ≡ z)
→ p ∙ (q ∙ r) ≡ (p ∙ q) ∙ r
∙-assoc {a} {A} {w} {x} {y} {z} p q r = J A D d w x p y q z r
where
-- the predicate
D : (w x : A) (p : w ≡ x) → Set a
D w x p = (y : A) (q : x ≡ y)
→ (z : A) (r : y ≡ z)
→ p ∙ (q ∙ r) ≡ (p ∙ q) ∙ r
-- base case
d : (x : A) → D x x refl
d x y q z r = J A E e x y q z r
where
-- the predicate
E : (x y : A) (q : x ≡ y) → Set a
E x y q = (z : A) (r : y ≡ z)
→ refl ∙ (q ∙ r) ≡ refl ∙ q ∙ r
-- base case
e : (x : A) → E x x refl
e x z r = J A F f x z r
where
-- the predicate
F : (y z : A) (r : y ≡ z) → Set a
F y z r = refl ∙ (refl ∙ r) ≡ refl ∙ refl ∙ r
-- base case
f : (x : A) → F x x refl
f x = {! !}
|
rtas/examples/example1.adb | erlingrj/ktc | 0 | 25937 | <filename>rtas/examples/example1.adb<gh_stars>0
with Ada.Text_Io; use Ada.Text_Io;
package body Example1 is
procedure Sense is
begin
for I in Integer range 1 .. 1000000000 loop
Put("");
end loop;
Put_Line ("Sense end");
end Sense;
procedure Handle_Deadline is
begin
Put_Line ("Deadline Overshot");
end Handle_Deadline;
end Example1;
|
programs/oeis/053/A053638.asm | neoneye/loda | 22 | 87561 | ; A053638: a(n) = ceiling(2^n/n).
; 2,2,3,4,7,11,19,32,57,103,187,342,631,1171,2185,4096,7711,14564,27595,52429,99865,190651,364723,699051,1342178,2581111,4971027,9586981,18512791,35791395,69273667,134217728,260301049,505290271,981706811,1908874354,3714566311,7233629131,14096302921,27487790695,53634713551,104715393122,204560302843,399822410101,781874935308,1529755308211,2994414645859,5864062014806,11488774559619,22517998136853,44152937523241,86607685141741,169947155749831,333599972397815,655069036708436,1286742750677285,2528336632909753,4969489243995031,9770521225481755,19215358410114117,37800705069076951,74382032555280451,146402730743726601,288230376151711744,567592125344909281,1117984489315730401,2202596307308603179,4340410370284600381,8555011744329067417,16865594581677304335,33256101992039755027,65588423373189516857,129379903640264252431,255263053128088930471,503719091506095489461,994182417446241097621,1962541914958813595303,3874762242354580688161,7651429238067273257635,15111572745182864683828,29850020237398251227313,58971991200713618278351,116522970565265462622283,230271584688500795182129,455125014443154512830561,899665726224840316060411,1778649481731868211061961,3516875111606193962781603,6954719321827979072466991,13754889325393114165545825,27207473390887478569211522,53823479968929577169527141,106489465744978948378419289,210713198176234940408361571,416990329022443882071283950,825293359523586849932749483,1633570361118852321516370111,3233802551602626024226283688,6402275758728431320690420230,12676506002282294014967032054
add $0,1
mov $1,2
pow $1,$0
sub $1,1
div $1,$0
add $1,1
mov $0,$1
|
libsrc/_DEVELOPMENT/math/float/math32/lm32/z80/asm_dneg.asm | jpoikela/z88dk | 640 | 161764 | <filename>libsrc/_DEVELOPMENT/math/float/math32/lm32/z80/asm_dneg.asm<gh_stars>100-1000
; float _negf (float number) __z88dk_fastcall
SECTION code_clib
SECTION code_fp_math32
PUBLIC asm_dneg
EXTERN m32_fsneg
; negate DEHL'
;
; enter : DEHL'= double x
;
; exit : DEHL'= -x
;
; uses :
.asm_dneg
exx
call m32_fsneg
exx
ret
|
src/getters/getter-file.adb | python36/0xfa | 0 | 23329 | package body getter.file is
procedure close is
begin
ada.text_io.close(current_ptr.all);
free(current_ptr);
files_stack.delete_last;
if not files_stack_t.is_empty(files_stack) then
current_ptr := files_stack_t.last_element(files_stack).descriptor;
current_line := files_stack_t.last_element(files_stack).line;
set_line(current_line);
end if;
end close;
function get return character is
use type pos_count;
c : character;
begin
if ada.text_io.end_of_file(current_ptr.all) then
if not sended_last_lf then
sended_last_lf := true;
-- return ' ';
return ascii.lf;
end if;
sended_last_lf := false;
close;
return ascii.nul;
end if;
ada.text_io.get_immediate(current_ptr.all, c);
if c = ';' then
ada.text_io.get_immediate(current_ptr.all, c);
while c /= ascii.lf loop
if ada.text_io.end_of_file(current_ptr.all) then
c := ' ';
exit;
end if;
ada.text_io.get_immediate(current_ptr.all, c);
end loop;
end if;
if c = ascii.lf then
current_line := current_line + 1;
set_line(current_line);
-- return ' ';
elsif c = ascii.nul then
return ' ';
end if;
return c;
end get;
procedure open (path : string) is
begin
if not files_stack_t.is_empty(files_stack) then
files_stack.replace_element(files_stack_t.last(files_stack), (current_ptr, current_line));
end if;
current_ptr := new ada.text_io.file_type;
ada.text_io.open(current_ptr.all, ada.text_io.in_file, path);
files_stack.append((current_ptr, 1));
getter.push(get'access);
end open;
end getter.file; |
libsrc/_DEVELOPMENT/arch/sms/SMSlib/c/sdcc/SMS_updateSpritePosition_callee.asm | jpoikela/z88dk | 640 | 93510 | <gh_stars>100-1000
; void SMS_updateSpritePosition(signed char sprite, unsigned char x, unsigned char y)
SECTION code_clib
SECTION code_SMSlib
PUBLIC _SMS_updateSpritePosition_callee
EXTERN asm_SMSlib_updateSpritePosition
_SMS_updateSpritePosition_callee:
pop hl
pop de
ld c,d
dec sp
ex (sp),hl
ld a,h
jp asm_SMSlib_updateSpritePosition
|
programs/oeis/048/A048508.asm | neoneye/loda | 22 | 85427 | <gh_stars>10-100
; A048508: a(n) = T(3,n), array T given by A048505.
; 1,17,58,160,408,1000,2392,5624,13048,29944,68088,153592,344056,765944,1695736,3735544,8191992,17891320,38928376,84410360,182452216,393215992,845152248,1811939320,3875536888,8271167480,17616076792,37446746104,79456894968,168309030904,355945414648,751619276792,1584842932216,3337189588984,7017976561656,14740327759864,30923764531192,64802466562040,135652247076856,283673999966200,592636767371256,1236950581247992,2579454278762488,5374412836569080,11188630324248568,23274462136762360,48378511622143992,100486566685704184,208572957742596088,432627039204278264,896779275800150008,1857734846290329592,3846074081774403576,7957860541563666424,16456153038411792376,34011184385901985784,70256154186979737592,145051936798348935160,299327245633552646136,617389465716966555640,1272825341085959061496,2622896422980576870392,5402590170587684929528,11123386676446859624440,22892409395473553555448,47094537620180485275640,96845406386975145983992,199077262043473481039864,409074996578583016636408,840286086045617495212024,1725434653678496619954168,3541774862152233910271992,7267722017136383983878136,14908510986419469939638264,30572600610098083113467896,62675247960645931276173304,128448368334054349812531192,263168039357359588468850680,539029799820672783272116216,1103749273308156436506738680,2259482356859741927525842936,4624141260025956593251123192,9461053464304087921250533368,19352484520390983828696465400,39575395630904500663181377528,80910987255167901404734947320,165381052123281271099804876792,337957630724908815047460913144,690461056911420848324986535928,1410323189755869478178827272184,2880067501397437209552812507128,5880215186605556305770840063992,12003066620911047145421908475896,24496357497379104879703870144504,49983067026186513979327039668216,101966645155858202482891064082424,207973926599943886183052869631992,424108353938856999138240766148600,864696165680680980495938673967096,1762668159617352982781165807075320
add $0,4
mov $2,2
pow $2,$0
mul $2,$0
add $0,6
mul $0,$2
sub $0,$2
div $0,64
sub $0,8
|
vbox/src/VBox/Runtime/common/time/timesupA.asm | Nurzamal/rest_api_docker | 0 | 170394 | <filename>vbox/src/VBox/Runtime/common/time/timesupA.asm<gh_stars>0
; $Id: timesupA.asm 69219 2017-10-24 15:01:30Z vboxsync $
;; @file
; IPRT - Time using SUPLib, the Assembly Implementation.
;
;
; Copyright (C) 2006-2017 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
; VirtualBox OSE distribution, in which case the provisions of the
; CDDL are applicable instead of those of the GPL.
;
; You may elect to license modified versions of this file under the
; terms and conditions of either the GPL or the CDDL or both.
;
%ifndef IN_GUEST
%include "iprt/asmdefs.mac"
%include "VBox/sup.mac"
;
; Use the C reference implementation for now.
;
%error "This is out of date, use C code. Not worth it for a couple of ticks in some functions and equal or worse performance in others."
This is out of date
This is out of date
This is out of date
;; Keep this in sync with iprt/time.h.
struc RTTIMENANOTSDATA
.pu64Prev RTCCPTR_RES 1
.pfnBad RTCCPTR_RES 1
.pfnRediscover RTCCPTR_RES 1
.pvDummy RTCCPTR_RES 1
.c1nsSteps resd 1
.cExpired resd 1
.cBadPrev resd 1
.cUpdateRaces resd 1
endstruc
BEGINDATA
%undef IN_SUPLIB
%undef IMPORTED_SUPLIB
%ifdef IN_SUP_R0
%define IN_SUPLIB
%endif
%ifdef IN_SUP_R3
%define IN_SUPLIB
%endif
%ifdef IN_SUP_RC
%define IN_SUPLIB
%endif
%ifdef IN_SUPLIB
extern NAME(g_pSUPGlobalInfoPage)
%elifdef IN_RING0
%ifdef RT_OS_WINDOWS
%define IMPORTED_SUPLIB
extern IMPNAME(g_SUPGlobalInfoPage)
%else
extern NAME(g_SUPGlobalInfoPage)
%endif
%else
%ifdef RT_OS_WINDOWS
%define IMPORTED_SUPLIB
extern IMPNAME(g_pSUPGlobalInfoPage)
%else
extern NAME(g_pSUPGlobalInfoPage)
%endif
%endif
BEGINCODE
;
; The default stuff that works everywhere.
; Uses cpuid for serializing.
;
%undef ASYNC_GIP
%undef USE_LFENCE
%undef WITH_TSC_DELTA
%undef NEED_APIC_ID
%define NEED_TRANSACTION_ID
%define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacySyncNoDelta
%include "timesupA.mac"
%define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacyInvariantNoDelta
%include "timesupA.mac"
%define WITH_TSC_DELTA
%define NEED_APIC_ID
%define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacySyncWithDelta
%include "timesupA.mac"
%define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacyInvariantWithDelta
%include "timesupA.mac"
%define ASYNC_GIP
%undef WITH_TSC_DELTA
%define NEED_APIC_ID
%ifdef IN_RC
%undef NEED_TRANSACTION_ID
%endif
%define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacyAsync
%include "timesupA.mac"
;
; Alternative implementation that employs lfence instead of cpuid.
;
%undef ASYNC_GIP
%define USE_LFENCE
%undef WITH_TSC_DELTA
%undef NEED_APIC_ID
%define NEED_TRANSACTION_ID
%define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceSyncNoDelta
%include "timesupA.mac"
%define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceInvariantNoDelta
%include "timesupA.mac"
%define WITH_TSC_DELTA
%define NEED_APIC_ID
%define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceSyncWithDelta
%include "timesupA.mac"
%define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceInvariantWithDelta
%include "timesupA.mac"
%define ASYNC_GIP
%undef WITH_TSC_DELTA
%define NEED_APIC_ID
%ifdef IN_RC
%undef NEED_TRANSACTION_ID
%endif
%define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceAsync
%include "timesupA.mac"
%endif ; !IN_GUEST
|
Semana 14/FlujoCaja/FlujoCaja.g4 | ItsJavito/Repo-LP-Ulima-601 | 0 | 7307 | <filename>Semana 14/FlujoCaja/FlujoCaja.g4
grammar FlujoCaja;
// Seccion 1 : Gramatica libre de contexto
@parser::members{
int montoCaja = 0;
}
root: apertura operacion* EOF
{
System.out.println("\n\nEl monto final es : " + montoCaja);
};
apertura : MONTO FIN_SENTENCIA
{
montoCaja = Integer.parseInt($MONTO.text);
};
operacion : MONTO operador FIN_SENTENCIA
{
if($operador.op.equals('+')){
montoCaja += Integer.parseInt($MONTO.text);
}
else
{
montoCaja -= Integer.parseInt($MONTO.text);
}
};
operador returns [String op]:
OPERADOR_RESTA
{
$op = "-";
}
|
OPERADOR_SUMA
{
$op = "+";
};
// Seccion 2: Gramatica regular
// Simbolos especiales
OPERADOR_SUMA : '+';
OPERADOR_RESTA : '-';
FIN_SENTENCIA : '\n';
// literales
MONTO : '0' | [1-9][0-9]*;
IGNORED_CHARS : [ \t\r] -> skip;
|
out/Lens/Syntax.agda | JoeyEremondi/agda-soas | 39 | 11004 | {-
This second-order term syntax was created from the following second-order syntax description:
syntax Lens | L
type
S : 0-ary
A : 0-ary
term
get : S -> A
put : S A -> S
theory
(PG) s : S a : A |> get (put (s, a)) = a
(GP) s : S |> put (s, get(s)) = s
(PP) s : S a b : A |> put (put(s, a), b) = put (s, a)
-}
module Lens.Syntax where
open import SOAS.Common
open import SOAS.Context
open import SOAS.Variable
open import SOAS.Families.Core
open import SOAS.Construction.Structure
open import SOAS.ContextMaps.Inductive
open import SOAS.Metatheory.Syntax
open import Lens.Signature
private
variable
Γ Δ Π : Ctx
α : LT
𝔛 : Familyₛ
-- Inductive term declaration
module L:Terms (𝔛 : Familyₛ) where
data L : Familyₛ where
var : ℐ ⇾̣ L
mvar : 𝔛 α Π → Sub L Π Γ → L α Γ
get : L S Γ → L A Γ
put : L S Γ → L A Γ → L S Γ
open import SOAS.Metatheory.MetaAlgebra ⅀F 𝔛
Lᵃ : MetaAlg L
Lᵃ = record
{ 𝑎𝑙𝑔 = λ where
(getₒ ⋮ a) → get a
(putₒ ⋮ a , b) → put a b
; 𝑣𝑎𝑟 = var ; 𝑚𝑣𝑎𝑟 = λ 𝔪 mε → mvar 𝔪 (tabulate mε) }
module Lᵃ = MetaAlg Lᵃ
module _ {𝒜 : Familyₛ}(𝒜ᵃ : MetaAlg 𝒜) where
open MetaAlg 𝒜ᵃ
𝕤𝕖𝕞 : L ⇾̣ 𝒜
𝕊 : Sub L Π Γ → Π ~[ 𝒜 ]↝ Γ
𝕊 (t ◂ σ) new = 𝕤𝕖𝕞 t
𝕊 (t ◂ σ) (old v) = 𝕊 σ v
𝕤𝕖𝕞 (mvar 𝔪 mε) = 𝑚𝑣𝑎𝑟 𝔪 (𝕊 mε)
𝕤𝕖𝕞 (var v) = 𝑣𝑎𝑟 v
𝕤𝕖𝕞 (get a) = 𝑎𝑙𝑔 (getₒ ⋮ 𝕤𝕖𝕞 a)
𝕤𝕖𝕞 (put a b) = 𝑎𝑙𝑔 (putₒ ⋮ 𝕤𝕖𝕞 a , 𝕤𝕖𝕞 b)
𝕤𝕖𝕞ᵃ⇒ : MetaAlg⇒ Lᵃ 𝒜ᵃ 𝕤𝕖𝕞
𝕤𝕖𝕞ᵃ⇒ = record
{ ⟨𝑎𝑙𝑔⟩ = λ{ {t = t} → ⟨𝑎𝑙𝑔⟩ t }
; ⟨𝑣𝑎𝑟⟩ = refl
; ⟨𝑚𝑣𝑎𝑟⟩ = λ{ {𝔪 = 𝔪}{mε} → cong (𝑚𝑣𝑎𝑟 𝔪) (dext (𝕊-tab mε)) } }
where
open ≡-Reasoning
⟨𝑎𝑙𝑔⟩ : (t : ⅀ L α Γ) → 𝕤𝕖𝕞 (Lᵃ.𝑎𝑙𝑔 t) ≡ 𝑎𝑙𝑔 (⅀₁ 𝕤𝕖𝕞 t)
⟨𝑎𝑙𝑔⟩ (getₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (putₒ ⋮ _) = refl
𝕊-tab : (mε : Π ~[ L ]↝ Γ)(v : ℐ α Π) → 𝕊 (tabulate mε) v ≡ 𝕤𝕖𝕞 (mε v)
𝕊-tab mε new = refl
𝕊-tab mε (old v) = 𝕊-tab (mε ∘ old) v
module _ (g : L ⇾̣ 𝒜)(gᵃ⇒ : MetaAlg⇒ Lᵃ 𝒜ᵃ g) where
open MetaAlg⇒ gᵃ⇒
𝕤𝕖𝕞! : (t : L α Γ) → 𝕤𝕖𝕞 t ≡ g t
𝕊-ix : (mε : Sub L Π Γ)(v : ℐ α Π) → 𝕊 mε v ≡ g (index mε v)
𝕊-ix (x ◂ mε) new = 𝕤𝕖𝕞! x
𝕊-ix (x ◂ mε) (old v) = 𝕊-ix mε v
𝕤𝕖𝕞! (mvar 𝔪 mε) rewrite cong (𝑚𝑣𝑎𝑟 𝔪) (dext (𝕊-ix mε))
= trans (sym ⟨𝑚𝑣𝑎𝑟⟩) (cong (g ∘ mvar 𝔪) (tab∘ix≈id mε))
𝕤𝕖𝕞! (var v) = sym ⟨𝑣𝑎𝑟⟩
𝕤𝕖𝕞! (get a) rewrite 𝕤𝕖𝕞! a = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (put a b) rewrite 𝕤𝕖𝕞! a | 𝕤𝕖𝕞! b = sym ⟨𝑎𝑙𝑔⟩
-- Syntax instance for the signature
L:Syn : Syntax
L:Syn = record
{ ⅀F = ⅀F
; ⅀:CS = ⅀:CompatStr
; mvarᵢ = L:Terms.mvar
; 𝕋:Init = λ 𝔛 → let open L:Terms 𝔛 in record
{ ⊥ = L ⋉ Lᵃ
; ⊥-is-initial = record { ! = λ{ {𝒜 ⋉ 𝒜ᵃ} → 𝕤𝕖𝕞 𝒜ᵃ ⋉ 𝕤𝕖𝕞ᵃ⇒ 𝒜ᵃ }
; !-unique = λ{ {𝒜 ⋉ 𝒜ᵃ} (f ⋉ fᵃ⇒) {x = t} → 𝕤𝕖𝕞! 𝒜ᵃ f fᵃ⇒ t } } } }
-- Instantiation of the syntax and metatheory
open Syntax L:Syn public
open L:Terms public
open import SOAS.Families.Build public
open import SOAS.Syntax.Shorthands Lᵃ public
open import SOAS.Metatheory L:Syn public
|
samples/client/petstore/ada/src/samples.ads | matthias-schoeneich/swagger-codegen | 2 | 21297 | <reponame>matthias-schoeneich/swagger-codegen<gh_stars>1-10
package Samples is
end Samples; |
programs/oeis/101/A101870.asm | karttu/loda | 0 | 104229 | ; A101870: Row 3 of A101866.
; 13,26,34,47,60,68,81,89,102,115,123,136,149,157,170,178,191,204,212,225,233,246,259,267,280,293,301,314,322,335,348,356,369,382,390,403,411,424,437,445,458,466,479,492,500,513,526,534,547,555,568,581,589,602,610,623
mov $3,$0
mov $7,$0
add $7,1
lpb $7,1
mov $0,$3
sub $7,1
sub $0,$7
mov $11,$0
mov $13,2
lpb $13,1
mov $0,$11
sub $13,1
add $0,$13
sub $0,1
mov $2,$0
mov $0,32
add $2,1
mov $4,$6
mov $5,33
div $9,15
add $9,$2
mov $10,13
lpb $0,1
add $0,2
add $4,$0
mov $0,5
mul $10,$5
mul $10,$9
div $10,$4
add $10,2
mul $10,2
sub $10,2
lpe
mov $8,$13
mov $9,2
lpb $8,1
sub $8,1
mov $12,$10
lpe
lpe
lpb $11,1
mov $11,0
sub $12,$10
lpe
mov $10,$12
sub $10,24
div $10,2
mul $10,5
add $10,8
add $1,$10
lpe
|
scripts/safarizonesecrethouse.asm | etdv-thevoid/pokemon-rgb-enhanced | 1 | 169054 | <reponame>etdv-thevoid/pokemon-rgb-enhanced<filename>scripts/safarizonesecrethouse.asm<gh_stars>1-10
SafariZoneSecretHouseScript:
jp EnableAutoTextBoxDrawing
SafariZoneSecretHouseTextPointers:
dw SafariZoneSecretHouseText1
SafariZoneSecretHouseText1:
TX_ASM
CheckEvent EVENT_GOT_HM03
jr nz, .asm_20a9b
ld hl, SafariZoneSecretHouseText_4a350
call PrintText
lb bc, HM_03, 1
call GiveItem
jr nc, .BagFull
ld hl, ReceivedHM03Text
call PrintText
SetEvent EVENT_GOT_HM03
jr .asm_8f1fc
.BagFull
ld hl, HM03NoRoomText
call PrintText
jr .asm_8f1fc
.asm_20a9b
ld hl, HM03ExplanationText
call PrintText
.asm_8f1fc
jp TextScriptEnd
SafariZoneSecretHouseText_4a350:
TX_FAR _SecretHouseText_4a350
db "@"
ReceivedHM03Text:
TX_FAR _ReceivedHM03Text
TX_SFX_ITEM_1
db "@"
HM03ExplanationText:
TX_FAR _HM03ExplanationText
db "@"
HM03NoRoomText:
TX_FAR _HM03NoRoomText
db "@"
|
oeis/289/A289212.asm | neoneye/loda-programs | 11 | 105154 | ; A289212: a(n) = n! * Laguerre(n,-6).
; Submitted by <NAME>
; 1,7,62,654,7944,108696,1649232,27422352,495057024,9631281024,200682406656,4455296877312,104921038236672,2610989435003904,68430995893131264,1883330926998829056,54286270223002140672,1635031821385383247872,51347572582353094508544,1678195310912318891556864,56982315288824883002474496,2006890694209841944493555712,73208442973910481876092977152,2762295495671871074545860870144,107674394937410522038477441204224,4331009516050580973177843405029376,179571045579001539197088673334034432
add $0,1
mov $2,1
lpb $0
sub $0,1
add $2,$1
mul $1,$0
add $1,$2
add $1,$2
add $1,$2
mul $2,$0
add $2,$1
lpe
mov $0,$1
div $0,3
|
dv3/dv3/usep.asm | olifink/smsqe | 0 | 170855 | ; DV3 USE (prc interface) V3.00 1986 <NAME> QJUMP
section exten
xdef dv3_usep
include 'dev8_dv3_keys'
include 'dev8_keys_err'
;+++
; This is the model of the procedure RAM_USE, FLP_USE etc.
;
; XXX_USE yyy or XXX_USE
;
; a1 c p parameter list
; a2 c p thing linkage
;
; status return standard
;---
dv3_usep
move.l a0,-(sp)
lea ddl_dname+2-ddl_thing(a2),a0 ; standard name
move.l 4(a1),d0 ; any parameter?
beq.s dus_upnam ; ... no
move.l d0,a0 ; ... yes, this is it
cmp.w #3,(a0)+ ; 3 characters long?
bne.s dus_ipar ; ... oops
dus_upnam
move.l (a0),d0 ; get new name
and.l #$5f5f5f00,d0 ; in upper case
add.b #'0',d0 ; ending with '0'
move.l d0,ddl_dnuse+2-ddl_thing(a2) ; set new name (but not length)
moveq #0,d0
dus_exit
move.l (sp)+,a0
rts
dus_ipar
moveq #err.ipar,d0
bra.s dus_exit
end
|
programs/oeis/088/A088578.asm | neoneye/loda | 22 | 28900 | ; A088578: a(n) = n*x^n + (n-1)*x^(n-1) + . . . + x + 1 for x=2.
; 1,3,11,35,99,259,643,1539,3587,8195,18435,40963,90115,196611,425987,917507,1966083,4194307,8912899,18874371,39845891,83886083,176160771,369098755,771751939,1610612739,3355443203,6979321859,14495514627,30064771075,62277025795,128849018883,266287972355,549755813891,1133871366147,2336462209027,4810363371523,9895604649987,20340965113859,41781441855491,85761906966531,175921860444163,360639813910531,738871813865475,1512927999819779,3096224743817219,6333186975989763,12947848928690179,26458647810801667,54043195528445955,110338190870577155,225179981368524803,459367161991790595,936748722493063171,1909526242005090307,3891110078048108547,7926335344172072963,16140901064495857667,32858262881295138819,66869447267197124611,136044737543607943171,276701161105643274243,562625694248141324291,1143698132569992200195,2324289753287403503619,4722366482869645213699,9592306918328966840323,19479761741837286506499,39549819294033278664707,80280230208783968632835,162921643659002759872515,330565653800875164958723,670576040567489620344835,1360041547066457821544451,2757862025995872804798467,5591281915717659933016067,11333679558887148512870403,22969590572677954319417347,46543644055163223226187779,94296213929941075627081731,191010279499111409603575811,386856262276681335905976323,783383931110279705209602051,1586110675334393477214502915,3210906976896455088019603459,6499185206248246443220402179,13153112917407165420803194883,26615710844635675910331170819,53850391708914041958111903747,108938723457113464191122931715,220353326992797688932044111875,445658414142736898963684720643,901220348599756840126562435075,1822247737828079764651510857731,3684109556913291698099793690627,7447447276340847733793131331587,15053350877710224142773350563843,30423614405477505635920876929027,61481054111069125972590105460739,124229758822366481346676914126851
mov $1,$0
sub $0,1
mov $2,2
pow $2,$1
mul $0,$2
add $0,1
mul $0,2
add $0,1
|
src/HasTrace.agda | boystrange/FairSubtypingAgda | 4 | 4002 | <reponame>boystrange/FairSubtypingAgda
-- MIT License
-- Copyright (c) 2021 <NAME> and <NAME>
-- Permission is hereby granted, free of charge, to any person
-- obtaining a copy of this software and associated documentation
-- files (the "Software"), to deal in the Software without
-- restriction, including without limitation the rights to use,
-- copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following
-- conditions:
-- The above copyright notice and this permission notice shall be
-- included in all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-- OTHER DEALINGS IN THE SOFTWARE.
{-# OPTIONS --guardedness #-}
open import Data.Empty
open import Data.Product
open import Data.List using ([]; _∷_; _∷ʳ_; _++_)
open import Relation.Nullary
open import Relation.Unary using (_∈_; _⊆_;_∉_)
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
import Relation.Binary.HeterogeneousEquality as Het
open import Common
module HasTrace {ℙ : Set} (message : Message ℙ)
where
open import Trace message
open import SessionType message
open import Transitions message
_HasTrace_ : SessionType -> Trace -> Set
_HasTrace_ T φ = ∃[ S ] (Defined S × Transitions T φ S)
after : ∀{T φ} -> T HasTrace φ -> SessionType
after (S , _ , _) = S
-- data _HasTrace_ : SessionType -> Trace -> Set where
-- does : ∀{T φ S} (tr : Transitions T φ S) (def : Defined S) -> T Does φ
_HasTrace?_ : (T : SessionType) (φ : Trace) -> Dec (T HasTrace φ)
nil HasTrace? _ = no λ { (_ , () , refl)
; (_ , _ , step () _) }
inp f HasTrace? [] = yes (_ , inp , refl)
inp f HasTrace? (I x ∷ φ) with x ∈? f
... | no nfx = no λ { (_ , def , step inp tr) → nfx (transitions+defined->defined tr def) }
... | yes fx with f x .force HasTrace? φ
... | yes (_ , def , tr) = yes (_ , def , step inp tr)
... | no ntφ = no λ { (_ , def , step inp tr) → ntφ (_ , def , tr) }
inp f HasTrace? (O x ∷ φ) = no λ { (_ , _ , step () _) }
out f HasTrace? [] = yes (_ , out , refl)
out f HasTrace? (I x ∷ φ) = no λ { (_ , _ , step () _) }
out f HasTrace? (O x ∷ φ) with x ∈? f
... | no nfx = no λ { (_ , _ , step (out fx) _) → nfx fx }
... | yes fx with f x .force HasTrace? φ
... | yes (_ , def , tr) = yes (_ , def , step (out fx) tr)
... | no ntφ = no λ { (_ , def , step (out fx) tr) → ntφ (_ , def , tr) }
has-trace->defined : ∀{T φ} -> T HasTrace φ -> Defined T
has-trace->defined (_ , tdef , tr) = transitions+defined->defined tr tdef
inp-has-trace : ∀{f x φ} -> f x .force HasTrace φ -> inp f HasTrace (I x ∷ φ)
inp-has-trace (_ , def , tr) = _ , def , step inp tr
inp-has-no-trace : ∀{f x φ} -> ¬ f x .force HasTrace φ -> ¬ inp f HasTrace (I x ∷ φ)
inp-has-no-trace nφ (_ , def , step inp tr) = nφ (_ , def , tr)
out-has-trace : ∀{f x φ} -> f x .force HasTrace φ -> out f HasTrace (O x ∷ φ)
out-has-trace (_ , def , tr) = _ , def , step (out (transitions+defined->defined tr def)) tr
out-has-no-trace : ∀{f x φ} -> ¬ f x .force HasTrace φ -> ¬ out f HasTrace (O x ∷ φ)
out-has-no-trace nφ (_ , def , step (out fx) tr) = nφ (_ , def , tr)
out-has-no-trace->undefined : ∀{f x} -> ¬ out f HasTrace (O x ∷ []) -> ¬ Defined (f x .force)
out-has-no-trace->undefined {f} {x} nt with x ∈? f
... | yes fx = ⊥-elim (nt (_ , fx , step (out fx) refl))
... | no nfx = nfx
unprefix-some : ∀{α φ ψ} -> (α ∷ ψ) ⊑ (α ∷ φ) -> ψ ⊑ φ
unprefix-some (some pre) = pre
⊑-has-trace : ∀{T φ ψ} -> ψ ⊑ φ -> T HasTrace φ -> T HasTrace ψ
⊑-has-trace none (_ , tdef , tr) = _ , transitions+defined->defined tr tdef , refl
⊑-has-trace (some pre) (_ , tdef , step t tr) =
let _ , sdef , sr = ⊑-has-trace pre (_ , tdef , tr) in
_ , sdef , step t sr
split-trace : ∀{T φ ψ} (tφ : T HasTrace φ) -> T HasTrace (φ ++ ψ) -> after tφ HasTrace ψ
split-trace (_ , tdef , refl) tφψ = tφψ
split-trace (_ , tdef , step inp tr) (_ , sdef , step inp sr) = split-trace (_ , tdef , tr) (_ , sdef , sr)
split-trace (_ , tdef , step (out _) tr) (_ , sdef , step (out _) sr) = split-trace (_ , tdef , tr) (_ , sdef , sr)
join-trace : ∀{T φ ψ} (tφ : T HasTrace φ) -> after tφ HasTrace ψ -> T HasTrace (φ ++ ψ)
join-trace (_ , _ , refl) tφ/ψ = tφ/ψ
join-trace (_ , tdef , step t tr) tφ/ψ =
let (_ , sdef , sr) = join-trace (_ , tdef , tr) tφ/ψ in
_ , sdef , step t sr
⊑-has-co-trace : ∀{T φ ψ} -> φ ⊑ ψ -> T HasTrace (co-trace ψ) -> T HasTrace (co-trace φ)
⊑-has-co-trace le tψ = ⊑-has-trace (⊑-co-trace le) tψ
⊑-tran-has-trace : ∀{T φ ψ χ} (pre1 : φ ⊑ ψ) (pre2 : ψ ⊑ χ) ->
(tχ : T HasTrace χ) ->
⊑-has-trace pre1 (⊑-has-trace pre2 tχ) ≡ ⊑-has-trace (⊑-tran pre1 pre2) tχ
⊑-tran-has-trace none none tχ = refl
⊑-tran-has-trace none (some pre2) (fst , fst₁ , step t snd) = refl
⊑-tran-has-trace (some pre1) (some pre2) (_ , def , step _ tr) rewrite ⊑-tran-has-trace pre1 pre2 (_ , def , tr) = refl
⊑-has-trace-after : ∀{T φ} (tφ : T HasTrace φ) -> ⊑-has-trace (⊑-refl φ) tφ ≡ tφ
⊑-has-trace-after (_ , _ , refl) = refl
⊑-has-trace-after (_ , tdef , step inp tr) rewrite ⊑-has-trace-after (_ , tdef , tr) = refl
⊑-has-trace-after (_ , tdef , step (out _) tr) rewrite ⊑-has-trace-after (_ , tdef , tr) = refl
nil-has-no-trace : ∀{φ} -> ¬ nil HasTrace φ
nil-has-no-trace (_ , () , refl)
nil-has-no-trace (_ , _ , step () _)
end-has-empty-trace : ∀{φ T} -> End T -> T HasTrace φ -> φ ≡ []
end-has-empty-trace (inp U) (_ , _ , refl) = refl
end-has-empty-trace (inp U) (_ , def , step inp refl) = ⊥-elim (U _ def)
end-has-empty-trace (inp U) (_ , def , step inp (step t _)) = ⊥-elim (U _ (transition->defined t))
end-has-empty-trace (out U) (_ , _ , refl) = refl
end-has-empty-trace (out U) (_ , _ , step (out !x) _) = ⊥-elim (U _ !x)
has-trace-++ : ∀{T φ ψ} -> T HasTrace (φ ++ ψ) -> T HasTrace φ
has-trace-++ tφψ = ⊑-has-trace ⊑-++ tφψ
trace-coherence : ∀{T φ ψ₁ ψ₂ x y} -> T HasTrace (φ ++ I x ∷ ψ₁) -> T HasTrace (φ ++ O y ∷ ψ₂) -> ⊥
trace-coherence {_} {[]} (_ , _ , step inp _) (_ , _ , step () _)
trace-coherence {_} {I _ ∷ _} (_ , tdef , step inp tr) (_ , sdef , step inp sr) = trace-coherence (_ , tdef , tr) (_ , sdef , sr)
trace-coherence {_} {O _ ∷ _} (_ , tdef , step (out _) tr) (_ , sdef , step (out _) sr) = trace-coherence (_ , tdef , tr) (_ , sdef , sr)
defined->has-empty-trace : ∀{T} -> Defined T -> T HasTrace []
defined->has-empty-trace inp = _ , inp , refl
defined->has-empty-trace out = _ , out , refl
has-trace-double-negation : ∀{T φ} -> ¬ ¬ T HasTrace φ -> T HasTrace φ
has-trace-double-negation {T} {φ} p with T HasTrace? φ
... | yes tφ = tφ
... | no ntφ = ⊥-elim (p ntφ)
{- New -}
not-nil-has-trace : ∀{ϕ} → ¬ (nil HasTrace ϕ)
not-nil-has-trace (.(inp _) , inp , step () _)
not-nil-has-trace (.(out _) , out , step () _)
trace-after-in : ∀{f x ϕ} → (inp f) HasTrace (I x ∷ ϕ) → (f x .force) HasTrace ϕ
trace-after-in (_ , def , step inp red) = _ , def , red
trace-after-out : ∀{f x ϕ} → (out f) HasTrace (O x ∷ ϕ) → (f x .force) HasTrace ϕ
trace-after-out (_ , def , step (out _) red) = _ , def , red
inp-hastrace->defined : ∀{f x tr} → (inp f) HasTrace (I x ∷ tr) → x ∈ dom f
inp-hastrace->defined (_ , def , step inp refl) = def
inp-hastrace->defined (_ , def , step inp (step red _)) = transition->defined red
empty-inp-has-empty-trace : ∀{f ϕ} → EmptyContinuation f → (inp f) HasTrace ϕ → ϕ ≡ []
empty-inp-has-empty-trace e (_ , _ , refl) = refl
empty-inp-has-empty-trace {f} e (_ , _ , step (inp {x = x}) reds) with Defined? (f x .force)
empty-inp-has-empty-trace {f} e (_ , def , step (inp {x = _}) refl) | no ¬def = ⊥-elim (¬def def)
empty-inp-has-empty-trace {f} e (_ , _ , step (inp {x = _}) (step t _)) | no ¬def = ⊥-elim (¬def (transition->defined t))
... | yes def = ⊥-elim (e _ def)
empty-out-has-empty-trace : ∀{f ϕ} → EmptyContinuation f → (out f) HasTrace ϕ → ϕ ≡ []
empty-out-has-empty-trace e (_ , _ , refl) = refl
empty-out-has-empty-trace e (_ , _ , step (out def) _) = ⊥-elim (e _ def) |
alloy4fun_models/trainstlt/models/5/aB2NLTmBSDS9tWGMp.als | Kaixi26/org.alloytools.alloy | 0 | 5262 | open main
pred idaB2NLTmBSDS9tWGMp_prop6 {
always all s : Signal | always (s in Green implies s' not in Green) or
always (s not in Green implies s' in Green)
}
pred __repair { idaB2NLTmBSDS9tWGMp_prop6 }
check __repair { idaB2NLTmBSDS9tWGMp_prop6 <=> prop6o } |
test/Fail/Issue1023-MaskNonData.agda | KDr2/agda | 0 | 5584 | -- Andreas, 2014-01-10
-- Code by <NAME> and <NAME> and folks from the Coq-club
{-# OPTIONS --cubical-compatible #-}
-- An empty type.
data Zero : Set where
-- A unit type as W-type.
mutual
data WOne : Set where wrap : FOne -> WOne
FOne = Zero -> WOne
-- Type equality.
data _<->_ (X : Set) : Set -> Set₁ where
Refl : X <-> X
-- This postulate is compatible with univalence:
postulate
iso : WOne <-> FOne
-- But accepting that is incompatible with univalence:
auoo : WOne -> Zero
auoo (wrap f) = noo FOne iso f
where
noo : (X : Set) -> (WOne <-> X) -> X -> Zero
noo .WOne Refl w = auoo w
-- Matching against Refl silently applies the conversion
-- FOne -> WOne to f. But this conversion corresponds
-- to an application of wrap. Thus, f, which is really
-- (wrap f), should not be considered a subterm of (wrap f)
-- by the termination checker.
-- At least, if we want to be compatible with univalence.
absurd : Zero
absurd = auoo (wrap \ ())
-- noo should fail termination check.
|
core/x86/fixed_stub.asm | mshafiqsb/Amber | 0 | 12817 | ; x86 Reflective Stub Fixed (No relocation)
; Author: <NAME> <<EMAIL>>
; Version: 1.0
;
;#- stub.asm ------------------------------
; ESI = &PE
; RBP = &api.asm
; EBX = image_base
; STACK[0] = address_of_entry
; STACK[1] = image_base
[BITS 32]
[ORG 0]
cld
call stub ; ...
PE:
incbin "Mem.map" ; PE file image
image_size: equ $-PE ; Size of the PE image
stub:
pop esi ; Get the address of image to esi
call start ;
%include "api.asm";
start: ;
pop ebp ; Get the address of api to ebp
mov eax,[esi+0x3C] ; Get the offset of "PE" to eax
mov ebx,[eax+esi+0x34] ; Get the image base address to ebx
mov eax,[eax+esi+0x28] ; Get the address of entry point to eax
push eax ; Save the adress of entry to stack
push ebx ; Save the image base to stack
push 0x00000000 ; Allocate a DWORD variable inside stack
push esp ; lpflOldProtect
push byte 0x40 ; PAGE_EXECUTE_READWRITE
push image_size ; dwSize
push ebx ; lpAddress
push 0xC38AE110 ; hash( "kernel32.dll", "VirtualProtect" )
call ebp ; VirtualProtect( ImageBase, image_size, PAGE_EXECUTE_READWRITE, lpflOldProtect)
test eax,eax ; Check success
jz fail ; If VirtualProtect fails we are FUCKED !
pop eax ; Fix the stack
;#- resolve.asm ------------------------------
; ESI = &PE
; EBX = HANDLE(module)
; ECX = &IAT
; STACK[0] = address_of_entry
; STACK[1] = image_base
; STACK[2] = &_IMAGE_IMPORT_DESCRIPTOR
; STACK[3] = _IMAGE_IMPORT_DESCRIPTOR->IAT (RVA)
;
mov eax,[esi+0x3C] ; Offset to IMAGE_NT_HEADER ("PE")
mov eax,[eax+esi+0x80] ; Import table RVA
add eax,esi ; Import table memory address (first image import descriptor)
push eax ; Save the address of import descriptor to stack
get_modules:
cmp dword [eax],0x00 ; Check if the import names table RVA is NULL
jz complete ; If yes building process is done
mov eax,[eax+0x0C] ; Get RVA of dll name to eax
add eax,esi ; Get the dll name address
call LoadLibraryA ; Load the library
mov ebx,eax ; Move the dll handle to ebx
mov eax,[esp] ; Move the address of current _IMPORT_DESCRIPTOR to eax
call get_procs ; Resolve all windows API function addresses
add dword [esp],0x14 ; Move to the next import descriptor
mov eax,[esp] ; Set the new import descriptor address to eax
jmp get_modules
get_procs:
push ecx ; Save ecx to stack
push dword [eax+0x10] ; Save the current import descriptor IAT RVA
add [esp],esi ; Get the IAT memory address
mov eax,[eax] ; Set the import names table RVA to eax
add eax,esi ; Get the current import descriptor's import names table address
push eax ; Save it to stack
resolve:
cmp dword [eax],0x00 ; Check if end of the import names table
jz all_resolved ; If yes resolving process is done
mov eax,[eax] ; Get the RVA of function hint to eax
cmp eax,0x80000000 ; Check if the high order bit is set
js name_resolve ; If high order bit is not set resolve with INT entry
sub eax,0x80000000 ; Zero out the high bit
call GetProcAddress ; Get the API address with hint
jmp insert_iat ; Insert the address of API tı IAT
name_resolve:
add eax,esi ; Set the address of function hint
add dword eax,0x02 ; Move to function name
call GetProcAddress ; Get the function address to eax
insert_iat:
mov ecx,[esp+4] ; Move the IAT address to ecx
mov [ecx],eax ; Insert the function address to IAT
add dword [esp],0x04 ; Increase the import names table index
add dword [esp+4],0x04 ; Increase the IAT index
mov eax,[esp] ; Set the address of import names table address to eax
jmp resolve ; Loop
all_resolved:
mov ecx,[esp+4] ; Move the IAT address to ecx
mov dword [ecx],0x00 ; Insert a NULL dword
pop ecx ; Deallocate index values
pop ecx ; ...
pop ecx ; Put back the ecx value
ret ; <-
LoadLibraryA:
push ecx ; Save ecx to stack
push edx ; Save edx to stack
push eax ; Push the address of linrary name string
push 0x0726774C ; hash( "kernel32.dll", "LoadLibraryA" )
call ebp ; LoadLibraryA([esp+4])
pop edx ; Retreive edx
pop ecx ; Retreive ecx
ret ; <-
GetProcAddress:
push ecx ; Save ecx to stack
push edx ; Save edx to stack
push eax ; Push the address of proc name string
push ebx ; Push the dll handle
push 0x7802F749 ; hash( "kernel32.dll", "GetProcAddress" )
call ebp ; GetProcAddress(ebx,[esp+4])
pop edx ; Retrieve edx
pop ecx ; Retrieve ecx
ret ; <-
complete:
pop eax ; Clean out the stack
;----------------------------------------------------------------------
; All done, now copy the image to new base and start a new thread
; ESI = &PE
; STACK[0] = address_of_entry
; STACK[1] = image_base
;
xor ecx,ecx ; Zero out the ECX
pop ebx ; Pop the image base to EBX
add [esp],ebx ; Add image base to address of entry
mov ecx,image_size ; Move the image size to ECX
memcpy:
mov al,[esi] ; Move 1 byte of PE image to AL register
mov [ebx],al ; Move 1 byte of PE image to image base
inc esi ; Increase PE image index
inc ebx ; Increase image base index
loop memcpy ; Loop until ECX = 0
ret ; Return to the AOEP
fail:
ret ; <-
|
oeis/088/A088955.asm | neoneye/loda-programs | 11 | 175311 | <reponame>neoneye/loda-programs<filename>oeis/088/A088955.asm
; A088955: Primes of the form 60*n + 1.
; Submitted by <NAME>
; 61,181,241,421,541,601,661,1021,1201,1321,1381,1621,1741,1801,1861,2161,2221,2281,2341,2521,3001,3061,3121,3181,3301,3361,3541,4021,4201,4261,4441,4561,4621,4801,4861,5101,5281,5521,5581,5641,5701,5821,5881
mov $2,$0
add $2,6
pow $2,2
lpb $2
mov $3,$4
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $1,$0
max $1,0
cmp $1,$0
mul $2,$1
sub $2,1
add $4,60
lpe
mov $0,$4
add $0,1
|
45/runtime/rt/hexoct.asm | minblock/msdos | 0 | 15779 | TITLE HEXOCT - OCT, HEX functions
;***
; HEXOCT - OCT, HEX functions
;
; Copyright <C> 1986, Microsoft Corporation
;
;Purpose:
;
; BASIC Syntax mapping to included runtime entry points:
;
;
; - HEX$ Function - calls B$FHEX with 4-byte integer parm.
;
; v$ = HEX$(n)
; |
; B$FHEX
;
;
; - OCT$ Function - calls B$FOCT with 4-byte integer parm.
;
; v$ = OCT$(n)
; |
; B$FOCT
;
; - BIN$ Function - calls B$FBIN with 4-byte integer parm.
;
; v$ = BIN$(n)
; |
; B$FBIN
;
;******************************************************************************
INCLUDE switch.inc
INCLUDE rmacros.inc ; Runtime Macro Defintions
USESEG ST_TEXT
USESEG NH_TEXT
USESEG _DATA
INCLUDE seg.inc
sBegin NH_TEXT
externNP B$STALCTMPCPY
sEnd NH_TEXT
assumes CS,ST_TEXT
sBegin ST_TEXT
externNP B$FrameAFE ; advanced feature error + frame setup
;***
;B$FBIN,B$FHEX,B$FOCT - Convert I4 number to binary, hex, or octal string
;
;Purpose:
; Runtime Entry points.
; Create a string of minimum length (no leading zeros) that represents
; the value of the number in binary, octal or hex.
;Entry:
; parmD = I4 Integer value to be converted to a string
;Exit:
; AX = Address of string descriptor
;Uses:
; Per convention.
;Exceptions:
; B$ERR_OM
;****
cProc B$FBIN,<PUBLIC,FAR> ;BIN$ function
cBegin <nogen>
JMP B$FrameAFE ; advanced feature error + frame setup
cEnd <nogen> ;and convert to string
cProc B$FHEX,<PUBLIC,FAR> ;HEX$ function
cBegin <nogen>
MOV CX,0F04H ;CH=mask, CL=shift count
JMP SHORT CONVERT ;use common conversion routine to pick param
cEnd <nogen> ;and convert to string
cProc B$FOCT,<PUBLIC,FAR> ;OCT$ function
cBegin <nogen>
MOV CX,0703H ;CH=mask, CL=shift count
cEnd <nogen> ;fall into conversion routine
.erre ID_SSEQDS ;assumes SS=DS
cProc CONVERT,<FAR>,<ES,DI>
parmD Val ;I4 parameter for above routines
localW BufTop ;Top of string buffer
localV Buf,30 ;32 byte buffer for string
cBegin
PUSH DS ;set ES=DS
POP ES
MOV BX,WORD PTR[Val];DX:BX = I4 to be converted
MOV DX,WORD PTR[Val+2]
XOR AH,AH ;init char count
LEA DI,BufTop ;set up to build string on stack
STD ;move from high to low
; At this point the following conditions exist:
; AH = Character count
; CH = Mask
; CL = Shift count
; DX:BX = I4 to convert
; DI = pointer to digit buffer
; Perform the conversion by shifting DX:BX by CL bits and masm out
; unused bits with CH. Take this number and convert to ascii char
; representing digit. Stuff the char in the buffer, bump the char
; count and continue until no non-zero digits remain.
CONVERT_LOOP:
MOV AL,BL ;Bring number to accumulator
AND AL,CH ;Mask down to the bits that count
;Trick 6-byte hex conversion
ADD AL,90H
DAA
ADC AL,40H
DAA ;Number in hex now
STOSB ;Save in string
INC AH ;Count the digits
PUSH CX ;Save mask/shift count
XOR CH,CH ;zero out mask, leaving shift count
SHIFT_LOOP:
SHR DX,1 ;shift low bit into carry, zero high bit
RCR BX,1 ;rotate carry into low word
LOOP SHIFT_LOOP ;repeat shift count times
POP CX ;recover mask/shift count
PUSH BX
OR BX,DX ;is rest of I4 = 0?
POP BX
JNZ CONVERT_LOOP ;brif not, convert next digit
CLD ;Restore direction UP
INC DI ;Point to most significant digit
MOV BL,AH ;Digit count in BX (BH already zero)
MOV DX,DI ;Put string pointer in DX
CALL B$STALCTMPCPY ;Allocate string and copy data in
XCHG AX,BX ;return string descriptor in AX
cEnd
sEnd ST_TEXT
END
|
software/modules/estimator.ads | TUM-EI-RCS/StratoX | 12 | 25643 | -- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Module: Estimator
--
-- Authors: <NAME> (<EMAIL>)
--
-- Description: Estimates state data like orientation and velocity
--
-- ToDo:
-- [ ] Implementation
with Units; use Units;
with Units.Vectors; use Units.Vectors;
with Units.Navigation; use Units.Navigation;
with Interfaces; use Interfaces;
with Kalman;
-- @summary Sensor data fusion
package Estimator with SPARK_Mode is
-- init
procedure initialize;
procedure reset;
-- fetch fresh measurement data
procedure update( input : Kalman.Input_Vector );
procedure reset_log_calls;
procedure log_Info;
procedure lock_Home(position : GPS_Loacation_Type; baro_height : Altitude_Type);
function get_Orientation return Orientation_Type;
function get_Position return GPS_Loacation_Type;
function get_GPS_Fix return GPS_Fix_Type;
function get_Pos_Accuracy return Length_Type;
function get_Num_Sat return Unsigned_8;
function get_current_Height return Altitude_Type;
function get_relative_Height return Altitude_Type;
function get_max_Height return Altitude_Type;
function get_Baro_Height return Altitude_Type;
function get_Stable_Time return Time_Type;
private
function Orientation
(acc_vector : Linear_Acceleration_Vector) return Orientation_Type;
procedure update_Max_Height;
procedure check_stable_Time;
G_Object_Orientation : Orientation_Type := (0.0 * Degree, 0.0 * Degree, 0.0 * Degree);
G_Object_Position : GPS_Loacation_Type := (0.0 * Degree, 0.0 * Degree, 0.0 * Meter);
-- Object_Pose : Dynamics3D.Pose_Type := (
-- position => (0.0, 0.0, 0.0),
-- orientation => (others => 0.0) );
end Estimator;
|
old/old 2/kernel.asm | Mishin870/MOS | 1 | 171391 | <reponame>Mishin870/MOS<gh_stars>1-10
NEWLLEN = 5
org 500h ;этот сектор будет загружаться по адресу 0000:0500h
message:
mov ax, 0002h ;очищаем экран
int 10h
xor dx, dx ;Курсор в 0
mov dh, 1 ;Начальная линия - 1
call SetCursorPos
mov bp, title
mov cx, 24
call PrintMes
inc dh
call SetCursorPos
mov bp, msg
mov cx, 21
call PrintMes
inc dh
call SetCursorPos
call NewLine
xor si, si
MainLoop:
mov ah, 10h
int 16h
cmp ah, 0Eh ;BackSpase
jz Delete_symbol
cmp al, 0Dh ;Enter
jz Input_Command
mov [string + si], al
inc si
mov ah, 09h
mov bl, [color]
mov cx, 1
int 10h
inc dl
call SetCursorPos
jmp MainLoop
Input_Command: ;Если нажат Enter, то переходим в третий сектор
mov ax, cs
mov ds, ax
mov es, ax
push si ;так как содержание регистра si меняется, сохраним в стеке
include 'kernelCmds.asm'
.ErrCmd:
call NewLineSimple
mov bp, cmderr
mov cx, 18
call PrintMes
.PostCmd:
pop si
call NewLine
jmp MainLoop
Delete_symbol:
cmp dl, NEWLLEN
jz MainLoop
dec dl ;Двигаем каретку влево
call SetCursorPos
mov al, 20h ;Пробел
mov [string + si], al ;Стираем символ
mov ah, 09h
mov bx, 000fh ;Цвет курсора!
mov cx, 1
int 10h
dec si ;уменьшаем кол-во напечатанных символов
jmp MainLoop
SetCursorPos: ;установка курсора
mov ah, 2h
xor bh, bh
int 10h
ret
PrintMes: ;в регистре bp - строка, в регистре cx - длина этой строки
mov bl, [color] ;в регистре bl - цвет
mov ax, 1301h ;функция 13h прерывания 10h
int 10h
ret
NewLine:
cmp dh, 25
jne .next
mov bh, 02h
xor cx, cx
mov dx, 1950h
mov ax, 0700h
int 10h
xor dx, dx
.next:
xor dl, dl
inc dh
call SetCursorPos
mov bp, newl
mov cx, NEWLLEN
call PrintMes
mov dl, NEWLLEN
call SetCursorPos
xor si, si
ret
NewLineSimple:
cmp dh, 25
jne .next
mov bh, 02h
xor cx, cx
mov dx, 1950h
mov ax, 0700h
int 10h
xor dx, dx
.next:
xor dl, dl
inc dh
call SetCursorPos
ret
;=======КОМАНДЫ=======
endcmd db 'end', 0
write db 'write', 0
help db 'help', 0
echo db 'echo', 0
reboot db 'reboot', 0
clr db 'clr', 0
color_cmd db 'color', 0
hello db 'hello', 0
date_cmd db 'date', 0
;=====================
cmderr db 'Command not found!', 0 ;18
color_succ db 'Color changed!', 0 ;14
help1 db 'writer - start text writer', 0 ;26
help2 db 'help - show this help', 0 ;21
help3 db 'end - shutdown OS', 0 ;17
help4 db 'echo %txt - print text', 0 ;22
help5 db 'reboot - reboot OS', 0 ;18
help6 db 'clr - clear screen', 0 ;18
help7 db 'color %c - set color', 0 ;20
help8 db 'date - show date', 0 ;16
hello_world db 'Hello, world!', 0 ;13
title db 'Mishin870 OS Kernel v1.0', 0 ;24
msg db 'For help press "help"', 0 ;21
newl db 'MOS> ', 0 ;5
string db 20 dup(?) ;буфер для ввода команды
color db 2h ;цвет вывода
null db '0'
date_is db 'Date is: ', 0 ;9
date db 8 dup(?) ;буфер даты
times(2048-($-500h)) db 0 |
.build/ada/asis-gela-elements-def_names.adb | faelys/gela-asis | 4 | 18267 |
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of the <NAME>, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
package body Asis.Gela.Elements.Def_Names is
function New_Defining_Identifier_Node
(The_Context : ASIS.Context)
return Defining_Identifier_Ptr
is
Result : Defining_Identifier_Ptr :=
new Defining_Identifier_Node;
begin
Set_Enclosing_Compilation_Unit
(Result.all, Current_Unit (The_Context.all));
return Result;
end New_Defining_Identifier_Node;
function Defining_Name_Kind (Element : Defining_Identifier_Node)
return Asis.Defining_Name_Kinds is
begin
return A_Defining_Identifier;
end;
function Clone
(Element : Defining_Identifier_Node;
Parent : Asis.Element)
return Asis.Element
is
Result : constant Defining_Identifier_Ptr := new Defining_Identifier_Node;
begin
Result.Enclosing_Element := Parent;
Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit;
Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited;
Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance;
Result.Start_Position := Element.Start_Position;
Result.End_Position := Element.End_Position;
Result.Enclosing_Compilation_Unit :=
Enclosing_Compilation_Unit (Parent.all);
Result.Hash := Element.Hash;
Result.Defining_Name_Image := Element.Defining_Name_Image;
Result.Corresponding_Constant_Declaration := Element.Corresponding_Constant_Declaration;
null;
Result.Corresponding_Generic_Element := Element.Corresponding_Generic_Element;
Result.Override := Element.Override;
Result.Place := Element.Place;
return Asis.Element (Result);
end Clone;
function Position_Number_Image
(Element : Defining_Enumeration_Literal_Node) return Wide_String is
begin
return W.To_Wide_String (Element.Position_Number_Image);
end Position_Number_Image;
procedure Set_Position_Number_Image
(Element : in out Defining_Enumeration_Literal_Node;
Value : in Wide_String) is
begin
Element.Position_Number_Image := W.To_Unbounded_Wide_String (Value);
end Set_Position_Number_Image;
function Representation_Value_Image
(Element : Defining_Enumeration_Literal_Node) return Wide_String is
begin
return W.To_Wide_String (Element.Representation_Value_Image);
end Representation_Value_Image;
procedure Set_Representation_Value_Image
(Element : in out Defining_Enumeration_Literal_Node;
Value : in Wide_String) is
begin
Element.Representation_Value_Image := W.To_Unbounded_Wide_String (Value);
end Set_Representation_Value_Image;
function New_Defining_Enumeration_Literal_Node
(The_Context : ASIS.Context)
return Defining_Enumeration_Literal_Ptr
is
Result : Defining_Enumeration_Literal_Ptr :=
new Defining_Enumeration_Literal_Node;
begin
Set_Enclosing_Compilation_Unit
(Result.all, Current_Unit (The_Context.all));
return Result;
end New_Defining_Enumeration_Literal_Node;
function Defining_Name_Kind (Element : Defining_Enumeration_Literal_Node)
return Asis.Defining_Name_Kinds is
begin
return A_Defining_Enumeration_Literal;
end;
function Clone
(Element : Defining_Enumeration_Literal_Node;
Parent : Asis.Element)
return Asis.Element
is
Result : constant Defining_Enumeration_Literal_Ptr := new Defining_Enumeration_Literal_Node;
begin
Result.Enclosing_Element := Parent;
Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit;
Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited;
Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance;
Result.Start_Position := Element.Start_Position;
Result.End_Position := Element.End_Position;
Result.Enclosing_Compilation_Unit :=
Enclosing_Compilation_Unit (Parent.all);
Result.Hash := Element.Hash;
Result.Defining_Name_Image := Element.Defining_Name_Image;
Result.Corresponding_Constant_Declaration := Element.Corresponding_Constant_Declaration;
null;
Result.Corresponding_Generic_Element := Element.Corresponding_Generic_Element;
Result.Override := Element.Override;
Result.Place := Element.Place;
Result.Position_Number_Image := Element.Position_Number_Image;
Result.Representation_Value_Image := Element.Representation_Value_Image;
return Asis.Element (Result);
end Clone;
function New_Defining_Character_Literal_Node
(The_Context : ASIS.Context)
return Defining_Character_Literal_Ptr
is
Result : Defining_Character_Literal_Ptr :=
new Defining_Character_Literal_Node;
begin
Set_Enclosing_Compilation_Unit
(Result.all, Current_Unit (The_Context.all));
return Result;
end New_Defining_Character_Literal_Node;
function Defining_Name_Kind (Element : Defining_Character_Literal_Node)
return Asis.Defining_Name_Kinds is
begin
return A_Defining_Character_Literal;
end;
function Clone
(Element : Defining_Character_Literal_Node;
Parent : Asis.Element)
return Asis.Element
is
Result : constant Defining_Character_Literal_Ptr := new Defining_Character_Literal_Node;
begin
Result.Enclosing_Element := Parent;
Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit;
Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited;
Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance;
Result.Start_Position := Element.Start_Position;
Result.End_Position := Element.End_Position;
Result.Enclosing_Compilation_Unit :=
Enclosing_Compilation_Unit (Parent.all);
Result.Hash := Element.Hash;
Result.Defining_Name_Image := Element.Defining_Name_Image;
Result.Corresponding_Constant_Declaration := Element.Corresponding_Constant_Declaration;
null;
Result.Corresponding_Generic_Element := Element.Corresponding_Generic_Element;
Result.Override := Element.Override;
Result.Place := Element.Place;
Result.Position_Number_Image := Element.Position_Number_Image;
Result.Representation_Value_Image := Element.Representation_Value_Image;
return Asis.Element (Result);
end Clone;
function Operator_Kind
(Element : Defining_Operator_Symbol_Node) return Asis.Operator_Kinds is
begin
return Element.Operator_Kind;
end Operator_Kind;
procedure Set_Operator_Kind
(Element : in out Defining_Operator_Symbol_Node;
Value : in Asis.Operator_Kinds) is
begin
Element.Operator_Kind := Value;
end Set_Operator_Kind;
function New_Defining_Operator_Symbol_Node
(The_Context : ASIS.Context)
return Defining_Operator_Symbol_Ptr
is
Result : Defining_Operator_Symbol_Ptr :=
new Defining_Operator_Symbol_Node;
begin
Set_Enclosing_Compilation_Unit
(Result.all, Current_Unit (The_Context.all));
return Result;
end New_Defining_Operator_Symbol_Node;
function Defining_Name_Kind (Element : Defining_Operator_Symbol_Node)
return Asis.Defining_Name_Kinds is
begin
return A_Defining_Operator_Symbol;
end;
function Clone
(Element : Defining_Operator_Symbol_Node;
Parent : Asis.Element)
return Asis.Element
is
Result : constant Defining_Operator_Symbol_Ptr := new Defining_Operator_Symbol_Node;
begin
Result.Enclosing_Element := Parent;
Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit;
Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited;
Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance;
Result.Start_Position := Element.Start_Position;
Result.End_Position := Element.End_Position;
Result.Enclosing_Compilation_Unit :=
Enclosing_Compilation_Unit (Parent.all);
Result.Hash := Element.Hash;
Result.Defining_Name_Image := Element.Defining_Name_Image;
Result.Corresponding_Constant_Declaration := Element.Corresponding_Constant_Declaration;
null;
Result.Corresponding_Generic_Element := Element.Corresponding_Generic_Element;
Result.Override := Element.Override;
Result.Place := Element.Place;
Result.Operator_Kind := Element.Operator_Kind;
return Asis.Element (Result);
end Clone;
function Defining_Prefix
(Element : Defining_Expanded_Name_Node) return Asis.Name is
begin
return Element.Defining_Prefix;
end Defining_Prefix;
procedure Set_Defining_Prefix
(Element : in out Defining_Expanded_Name_Node;
Value : in Asis.Name) is
begin
Element.Defining_Prefix := Value;
end Set_Defining_Prefix;
function Defining_Selector
(Element : Defining_Expanded_Name_Node) return Asis.Defining_Name is
begin
return Element.Defining_Selector;
end Defining_Selector;
procedure Set_Defining_Selector
(Element : in out Defining_Expanded_Name_Node;
Value : in Asis.Defining_Name) is
begin
Element.Defining_Selector := Value;
end Set_Defining_Selector;
function New_Defining_Expanded_Name_Node
(The_Context : ASIS.Context)
return Defining_Expanded_Name_Ptr
is
Result : Defining_Expanded_Name_Ptr :=
new Defining_Expanded_Name_Node;
begin
Set_Enclosing_Compilation_Unit
(Result.all, Current_Unit (The_Context.all));
return Result;
end New_Defining_Expanded_Name_Node;
function Defining_Name_Kind (Element : Defining_Expanded_Name_Node)
return Asis.Defining_Name_Kinds is
begin
return A_Defining_Expanded_Name;
end;
function Children (Element : access Defining_Expanded_Name_Node)
return Traverse_List is
begin
return ((False, Element.Defining_Prefix'Access),
(False, Element.Defining_Selector'Access));
end Children;
function Clone
(Element : Defining_Expanded_Name_Node;
Parent : Asis.Element)
return Asis.Element
is
Result : constant Defining_Expanded_Name_Ptr := new Defining_Expanded_Name_Node;
begin
Result.Enclosing_Element := Parent;
Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit;
Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited;
Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance;
Result.Start_Position := Element.Start_Position;
Result.End_Position := Element.End_Position;
Result.Enclosing_Compilation_Unit :=
Enclosing_Compilation_Unit (Parent.all);
Result.Hash := Element.Hash;
Result.Defining_Name_Image := Element.Defining_Name_Image;
Result.Corresponding_Constant_Declaration := Element.Corresponding_Constant_Declaration;
null;
Result.Corresponding_Generic_Element := Element.Corresponding_Generic_Element;
Result.Override := Element.Override;
Result.Place := Element.Place;
return Asis.Element (Result);
end Clone;
procedure Copy
(Source : in Asis.Element;
Target : access Defining_Expanded_Name_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element)
is
begin
Target.Defining_Prefix :=
Copy (Cloner, Defining_Prefix (Source.all), Asis.Element (Target));
Target.Defining_Selector :=
Copy (Cloner, Defining_Selector (Source.all), Asis.Element (Target));
end Copy;
end Asis.Gela.Elements.Def_Names;
|
src/logging.ads | kqr/qweyboard | 33 | 11062 | <filename>src/logging.ads
with Unicode_Strings; use Unicode_Strings;
with Ada.Task_Termination;
with Ada.Task_Identification;
with Ada.Exceptions;
package Logging is
type Verbosity_Level is (Log_Error, Log_Warning, Log_Info, Log_Chatty);
task Log is
entry Set_Verbosity
(User_Verbosity : Verbosity_Level);
entry Chat
(Text : Wide_Wide_String;
Suffix : Wide_Wide_Character := Characters.LF);
entry Info
(Text : Wide_Wide_String;
Suffix : Wide_Wide_Character := Characters.LF);
entry Warning
(Text : Wide_Wide_String;
Suffix : Wide_Wide_Character := Characters.LF);
entry Error
(Text : Wide_Wide_String;
Suffix : Wide_Wide_Character := Characters.LF);
end Log;
use Ada.Task_Termination;
use Ada.Task_Identification;
use Ada.Exceptions;
protected Logging_Termination_Handler is
procedure Log_Termination_Cause
(C : Cause_Of_Termination; T : Task_Id; X : Exception_Occurrence);
end Logging_Termination_Handler;
end Logging;
|
Experiment/Applicative.agda | rei1024/agda-misc | 3 | 16706 | -- Applicative with law
{-# OPTIONS --without-K --safe #-}
module Experiment.Applicative where
open import Data.Product as Prod
open import Data.Unit
open import Function.Base
open import Relation.Binary.PropositionalEquality
record Functor (F : Set → Set) : Set₁ where
field
fmap : ∀ {A B} → (A → B) → F A → F B
field
fmap-id : ∀ {A} (x : F A) → fmap id x ≡ x
fmap-∘ : ∀ {A B C} (f : B → C) (g : A → B) (x : F A) →
fmap f (fmap g x) ≡ fmap (f ∘′ g) x
fmap-cong : ∀ {A B} {f g : A → B} {x : F A} →
(∀ v → f v ≡ g v) → fmap f x ≡ fmap g x
_<$>_ : ∀ {A B} → (A → B) → F A → F B
_<$>_ = fmap
×-assoc : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c} → (A × B) × C → A × (B × C)
×-assoc ((x , y) , z) = x , (y , z)
×-assoc⁻¹ : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c} → A × (B × C) → (A × B) × C
×-assoc⁻¹ (x , (y , z)) = (x , y) , z
app : ∀ {a} {b} {A : Set a} {B : Set b} → (A → B) × A → B
app = uncurry _$′_
record Applicative (F : Set → Set) : Set₁ where
infixl 5 _<*>_
field
functor : Functor F
unit : F ⊤
_<,>_ : ∀ {A B} → F A → F B → F (A × B)
open Functor functor public
field
natural : ∀ {A B C D} (f : A → C) (g : B → D) (fx : F A) (fy : F B) →
fmap f fx <,> fmap g fy ≡ fmap (Prod.map f g) (fx <,> fy)
assoc : ∀ {A B C} (fx : F A) (fy : F B) (fz : F C) →
fmap ×-assoc ((fx <,> fy) <,> fz) ≡ (fx <,> (fy <,> fz))
unitˡ : ∀ {B} (fy : F B) → fmap proj₂ (unit <,> fy) ≡ fy
unitʳ : ∀ {A} (fx : F A) → fmap proj₁ (fx <,> unit) ≡ fx
pure : ∀ {A} → A → F A
pure {A} x = fmap (λ _ → x) unit
_<*>_ : ∀ {A B} → F (A → B) → F A → F B
_<*>_ ff fx = fmap app (ff <,> fx)
liftA2 : ∀ {A B C} → (A → B → C) → F A → F B → F C
liftA2 f fx fy = fmap (uncurry f) (fx <,> fy)
natural₁ : ∀ {A B C} (f : A → C) (fx : F A) (fy : F B) →
fmap f fx <,> fy ≡ fmap (Prod.map₁ f) (fx <,> fy)
natural₁ f fx fy = begin
fmap f fx <,> fy ≡⟨ cong (fmap f fx <,>_) $ sym $ fmap-id fy ⟩
fmap f fx <,> fmap id fy ≡⟨ natural f id fx fy ⟩
fmap (Prod.map₁ f) (fx <,> fy) ∎
where open ≡-Reasoning
natural₂ : ∀ {A B D} (g : B → D) (fx : F A) (fy : F B) →
fx <,> fmap g fy ≡ fmap (Prod.map₂ g) (fx <,> fy)
natural₂ g fx fy = begin
fx <,> fmap g fy ≡⟨ cong (_<,> fmap g fy) $ sym $ fmap-id fx ⟩
fmap id fx <,> fmap g fy ≡⟨ natural id g fx fy ⟩
fmap (Prod.map₂ g) (fx <,> fy) ∎
where open ≡-Reasoning
assoc⁻¹ : ∀ {A B C} (fx : F A) (fy : F B) (fz : F C) →
fmap ×-assoc⁻¹ (fx <,> (fy <,> fz)) ≡ (fx <,> fy) <,> fz
assoc⁻¹ fx fy fz = begin
fmap ×-assoc⁻¹ (fx <,> (fy <,> fz))
≡⟨ sym $ cong (fmap ×-assoc⁻¹) (assoc fx fy fz) ⟩
fmap ×-assoc⁻¹ (fmap ×-assoc ((fx <,> fy) <,> fz))
≡⟨ fmap-∘ ×-assoc⁻¹ ×-assoc ((fx <,> fy) <,> fz) ⟩
fmap (×-assoc⁻¹ ∘′ ×-assoc) ((fx <,> fy) <,> fz)
≡⟨⟩
fmap id ((fx <,> fy) <,> fz)
≡⟨ fmap-id ((fx <,> fy) <,> fz) ⟩
(fx <,> fy) <,> fz
∎
where open ≡-Reasoning
unit-pure : unit ≡ pure tt
unit-pure = begin
unit ≡⟨ sym $ fmap-id unit ⟩
fmap id unit ≡⟨ refl ⟩
fmap (λ _ → tt) unit ∎
where open ≡-Reasoning
fmap-pure : ∀ {A B} (f : A → B) (x : A) → fmap f (pure x) ≡ pure (f x)
fmap-pure f x = begin
fmap f (fmap (λ _ → x) unit) ≡⟨ fmap-∘ f (λ _ → x) unit ⟩
fmap (λ _ → f x) unit ∎
where open ≡-Reasoning
unitˡʳ : ∀ {A} (fx : F A) → fmap proj₂ (unit <,> fx) ≡ fmap proj₁ (fx <,> unit)
unitˡʳ fx = trans (unitˡ fx) (sym $ unitʳ fx)
unitˡ′ : ∀ {B} (fy : F B) → unit <,> fy ≡ fmap (tt ,_) fy
unitˡ′ fy = begin
unit <,> fy
≡⟨ sym $ fmap-id (unit <,> fy) ⟩
fmap id (unit <,> fy)
≡⟨ fmap-cong (λ _ → refl) ⟩
fmap ((tt ,_) ∘′ proj₂) (unit <,> fy)
≡⟨ sym $ fmap-∘ (tt ,_) proj₂ (unit <,> fy) ⟩
fmap (tt ,_) (fmap proj₂ (unit <,> fy))
≡⟨ cong (fmap (tt ,_)) (unitˡ fy) ⟩
fmap (tt ,_) fy
∎
where open ≡-Reasoning
unitʳ′ : ∀ {A} (fx : F A) → fx <,> unit ≡ fmap (_, tt) fx
unitʳ′ fx = begin
fx <,> unit
≡⟨ sym $ fmap-id (fx <,> unit) ⟩
fmap id (fx <,> unit)
≡⟨⟩
fmap ((_, tt) ∘′ proj₁) (fx <,> unit)
≡⟨ sym $ fmap-∘ (_, tt) proj₁ (fx <,> unit) ⟩
fmap (_, tt) (fmap proj₁ (fx <,> unit))
≡⟨ cong (fmap (_, tt)) (unitʳ fx) ⟩
fmap (_, tt) fx
∎
where open ≡-Reasoning
<,>-pureˡ : ∀ {A B} (x : A) (fy : F B) → pure x <,> fy ≡ fmap (x ,_) fy
<,>-pureˡ x fy = begin
fmap (λ _ → x) unit <,> fy
≡⟨ natural₁ (λ _ → x) unit fy ⟩
fmap (Prod.map₁ (λ _ → x)) (unit <,> fy)
≡⟨ cong (fmap (Prod.map₁ (λ _ → x))) (unitˡ′ fy) ⟩
fmap (Prod.map₁ (λ _ → x)) (fmap (tt ,_) fy)
≡⟨ fmap-∘ (Prod.map₁ (λ _ → x)) (tt ,_) fy ⟩
fmap (Prod.map₁ (λ _ → x) ∘′ (tt ,_)) fy
≡⟨⟩
fmap (x ,_) fy
∎
where open ≡-Reasoning
<,>-pureʳ : ∀ {A B} (fx : F A) (y : B) → fx <,> pure y ≡ fmap (_, y) fx
<,>-pureʳ fx y = begin
fx <,> fmap (λ _ → y) unit
≡⟨ natural₂ (λ _ → y) fx unit ⟩
fmap (Prod.map₂ (λ _ → y)) (fx <,> unit)
≡⟨ cong (fmap (Prod.map₂ (λ _ → y))) (unitʳ′ fx) ⟩
fmap (Prod.map₂ (λ _ → y)) (fmap (_, tt) fx)
≡⟨ fmap-∘ (Prod.map₂ (λ _ → y)) (_, tt) fx ⟩
fmap (Prod.map₂ (λ _ → y) ∘′ (_, tt)) fx
≡⟨⟩
fmap (_, y) fx ∎
where open ≡-Reasoning
pure-<,> : ∀ {A B} (x : A) (y : B) → pure x <,> pure y ≡ pure (x , y)
pure-<,> x y = begin
pure x <,> pure y ≡⟨ <,>-pureˡ x (pure y) ⟩
fmap (x ,_) (pure y) ≡⟨ fmap-pure (x ,_) y ⟩
pure (x , y) ∎
where open ≡-Reasoning
<*>-fmap : ∀ {A B} (f : A → B) (fx : F A) → pure f <*> fx ≡ fmap f fx
<*>-fmap f fx = begin
fmap app (pure f <,> fx) ≡⟨ cong (fmap app) $ <,>-pureˡ f fx ⟩
fmap app (fmap (f ,_) fx) ≡⟨ fmap-∘ app (f ,_) fx ⟩
fmap (app ∘′ (f ,_)) fx ≡⟨⟩
fmap f fx ∎
where open ≡-Reasoning
<*>-identity : ∀ {A} (v : F A) → pure id <*> v ≡ v
<*>-identity v = begin
fmap (uncurry _$′_) (pure id <,> v) ≡⟨ cong (fmap (uncurry _$′_)) $ <,>-pureˡ id v ⟩
fmap (uncurry _$′_) (fmap (id ,_) v) ≡⟨ fmap-∘ (uncurry _$′_) (id ,_) v ⟩
fmap (uncurry _$′_ ∘′ (id ,_)) v ≡⟨ fmap-cong (λ _ → refl) ⟩
fmap id v ≡⟨ fmap-id v ⟩
v ∎
where open ≡-Reasoning
<*>-composition : ∀ {A B C} (u : F (A → C)) (v : F (B → A)) (w : F B) →
pure _∘′_ <*> u <*> v <*> w ≡ u <*> (v <*> w)
<*>-composition u v w = begin
pure _∘′_ <*> u <*> v <*> w
≡⟨ cong (λ t → t <*> v <*> w) $ <*>-fmap _∘′_ u ⟩
fmap _∘′_ u <*> v <*> w
≡⟨⟩
fmap app (fmap _∘′_ u <,> v) <*> w
≡⟨⟩
fmap app (fmap app (fmap _∘′_ u <,> v) <,> w)
≡⟨ cong (λ t → fmap app (fmap app t <,> w)) $ natural₁ _∘′_ u v ⟩
fmap app (fmap app (fmap (Prod.map₁ _∘′_) (u <,> v)) <,> w)
≡⟨ cong (fmap app) $ natural₁ app (fmap (Prod.map₁ _∘′_) (u <,> v)) w ⟩
fmap app (fmap (Prod.map₁ app) (fmap (Prod.map₁ _∘′_) (u <,> v) <,> w))
≡⟨ fmap-∘ app (Prod.map₁ app) _ ⟩
fmap (app ∘′ Prod.map₁ app) (fmap (Prod.map₁ _∘′_) (u <,> v) <,> w)
≡⟨ cong (fmap (app ∘′ Prod.map₁ app)) $ natural₁ (Prod.map₁ _∘′_) (u <,> v) w ⟩
fmap (app ∘′ Prod.map₁ app) (fmap (Prod.map₁ (Prod.map₁ _∘′_)) ((u <,> v) <,> w))
≡⟨ fmap-∘ (app ∘′ Prod.map₁ app) (Prod.map₁ (Prod.map₁ _∘′_)) _ ⟩
fmap (app ∘′ Prod.map₁ app ∘′ Prod.map₁ (Prod.map₁ _∘′_)) ((u <,> v) <,> w)
≡⟨ fmap-cong (λ _ → refl) ⟩
fmap (app ∘′ Prod.map₂ app ∘′ ×-assoc) ((u <,> v) <,> w)
≡⟨ sym $ fmap-∘ (app ∘′ Prod.map₂ app) ×-assoc ((u <,> v) <,> w) ⟩
fmap (app ∘′ Prod.map₂ app) (fmap ×-assoc ((u <,> v) <,> w))
≡⟨ cong (fmap (app ∘′ Prod.map₂ app)) (assoc u v w) ⟩
fmap (app ∘′ Prod.map₂ app) (u <,> (v <,> w))
≡⟨ sym $ fmap-∘ app (Prod.map₂ app) (u <,> (v <,> w)) ⟩
fmap app (fmap (Prod.map₂ app) (u <,> (v <,> w)))
≡⟨ sym $ cong (fmap app) $ natural₂ app u (v <,> w) ⟩
fmap app (u <,> fmap app (v <,> w))
≡⟨⟩
u <*> (v <*> w)
∎
where open ≡-Reasoning
<*>-homomorphism : ∀ {A B} (f : A → B) (x : A) → pure f <*> pure x ≡ pure (f x)
<*>-homomorphism f x = begin
pure f <*> pure x ≡⟨ <*>-fmap f (pure x) ⟩
fmap f (pure x) ≡⟨ fmap-pure f x ⟩
pure (f x) ∎
where open ≡-Reasoning
<*>-interchange : ∀ {A B} (u : F (A → B)) (y : A) →
u <*> pure y ≡ pure (_$ y) <*> u
<*>-interchange u y = begin
u <*> pure y ≡⟨⟩
fmap app (u <,> pure y) ≡⟨ cong (fmap app) (<,>-pureʳ u y) ⟩
fmap app (fmap (_, y) u) ≡⟨ fmap-∘ app (_, y) u ⟩
fmap (app ∘′ (_, y)) u ≡⟨⟩
fmap (_$ y) u ≡⟨ sym $ <*>-fmap (_$ y) u ⟩
pure (_$ y) <*> u ∎
where open ≡-Reasoning
liftA2-defn : ∀ {A B C} (f : A → B → C) (fx : F A) (fy : F B) →
liftA2 f fx fy ≡ pure f <*> fx <*> fy
liftA2-defn f fx fy = begin
fmap (uncurry f) (fx <,> fy) ≡⟨⟩
fmap (app ∘′ Prod.map₁ f) (fx <,> fy) ≡⟨ sym $ fmap-∘ app (Prod.map₁ f) (fx <,> fy) ⟩
fmap app (fmap (Prod.map₁ f) (fx <,> fy)) ≡⟨ cong (fmap app) $ sym $ natural₁ f fx fy ⟩
fmap app (fmap f fx <,> fy) ≡⟨⟩
fmap f fx <*> fy ≡⟨ sym $ cong (_<*> fy) $ <*>-fmap f fx ⟩
pure f <*> fx <*> fy ∎
where open ≡-Reasoning
liftA2-cong : ∀ {A B C} {f g : A → B → C} {fx : F A} {fy : F B} →
(∀ x y → f x y ≡ g x y) → liftA2 f fx fy ≡ liftA2 g fx fy
liftA2-cong {_} {_} {_} {f} {g} {fx} {gx} f≡g = fmap-cong λ v → f≡g (proj₁ v) (proj₂ v)
<*>-defn : ∀ {A B} (ff : F (A → B)) (fx : F A) → ff <*> fx ≡ liftA2 _$′_ ff fx
<*>-defn ff fx = refl
-- liftA2 f fx fy = pure f <*> fx <*> fy
{-
forall x y. p (q x y) = f x . g y
it follows from the above that
liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v
-}
record ApplicativeViaAp (F : Set → Set) : Set₁ where
infixl 5 _<*>_
field
functor : Functor F
pure : ∀ {A} → A → F A
_<*>_ : ∀ {A B} → F (A → B) → F A → F B
open Functor functor public
field
identity : ∀ {A} (fx : F A) → pure id <*> fx ≡ fx
composition : ∀ {A B C} (u : F (A → C)) (v : F (B → A)) (w : F B) →
pure _∘′_ <*> u <*> v <*> w ≡ u <*> (v <*> w)
homomorphism : ∀ {A B} (f : A → B) (x : A) → pure f <*> pure x ≡ pure (f x)
interchange : ∀ {A B} (u : F (A → B)) (y : A) →
u <*> pure y ≡ pure (_$ y) <*> u
<*>-fmap : ∀ {A B} (f : A → B) (fx : F A) → pure f <*> fx ≡ fmap f fx
_<,>_ : ∀ {A B} → F A → F B → F (A × B)
fx <,> fy = pure _,_ <*> fx <*> fy
liftA2 : ∀ {A B C} → (A → B → C) → F A → F B → F C
liftA2 f fx fy = fmap (uncurry f) (fx <,> fy)
unit : F ⊤
unit = pure tt
{-
<,>-natural : ∀ {A B C D} (f : A → C) (g : B → D) (fx : F A) (fy : F B) →
fmap f fx <,> fmap g fy ≡ fmap (Prod.map f g) (fx <,> fy)
<,>-natural f g fx fy = begin
pure _,_ <*> fmap f fx <*> fmap g fy
≡⟨ cong (_<*> fmap g fy) $ <*>-fmap _,_ (fmap f fx) ⟩
fmap _,_ (fmap f fx) <*> fmap g fy
≡⟨ cong (_<*> fmap g fy) $ fmap-∘ _,_ f fx ⟩
fmap (_,_ ∘′ f) fx <*> fmap g fy
≡⟨ {! !} ⟩
fmap (Prod.map f g) (fmap _,_ fx <*> fy)
≡⟨ sym $ cong (λ t → fmap (Prod.map f g) (t <*> fy)) $ <*>-fmap _,_ fx ⟩
fmap (Prod.map f g) (pure _,_ <*> fx <*> fy)
∎
where open ≡-Reasoning
liftA2-defn : ∀ {A B C} (f : A → B → C) (fx : F A) (fy : F B) →
liftA2 f fx fy ≡ pure f <*> fx <*> fy
liftA2-defn f fx fy = {! !}
-}
record Monad (F : Set → Set) : Set₁ where
infixl 5 _>>=_
field
functor : Functor F
return : ∀ {A} → A → F A
join : ∀ {A} → F (F A) → F A
open Functor functor public
field
assoc : ∀ {A} (fffx : F (F (F A))) → join (fmap join fffx) ≡ join (join fffx)
identityˡ : ∀ {A} (fx : F A) → join (fmap return fx) ≡ fx
identityʳ : ∀ {A} (fx : F A) → join (return fx) ≡ fx
join-natural : ∀ {A B} (f : A → B) (ffx : F (F A)) →
join (fmap (fmap f) ffx) ≡ fmap f (join ffx)
return-natural : ∀ {A B} (f : A → B) (x : A) → return (f x) ≡ fmap f (return x)
_>>=_ : ∀ {A B} → F A → (A → F B) → F B
_>>=_ m k = join (fmap k m)
_=<<_ : ∀ {A B} → (A → F B) → F A → F B
_=<<_ = flip _>>=_
liftM : ∀ {A B} → (A → B) → F A → F B
liftM f fx = fx >>= λ x → return (f x)
ap : ∀ {A B} → F (A → B) → F A → F B
ap ff fx = ff >>= λ f → fmap f fx
pair : ∀ {A B} → F A → F B → F (A × B)
pair fx fy = fx >>= λ x → fmap (λ y → x , y) fy
unitM : F ⊤
unitM = return tt
liftM-is-fmap : ∀ {A B} (f : A → B) (fx : F A) → liftM f fx ≡ fmap f fx
liftM-is-fmap f fx = begin
join (fmap (λ x → return (f x)) fx) ≡⟨ sym $ cong join $ fmap-∘ return f fx ⟩
join (fmap return (fmap f fx)) ≡⟨ identityˡ (fmap f fx) ⟩
fmap f fx ∎
where open ≡-Reasoning
>>=-cong : ∀ {A B} {f g : A → F B} {fx : F A} →
(∀ x → f x ≡ g x) → fx >>= f ≡ fx >>= g
>>=-cong f≡g = cong join (fmap-cong f≡g)
fmap-lemma : ∀ {A B C} (f : A → B) (fx : F A) (k : B → F C) →
fmap f fx >>= k ≡ fx >>= λ x → k (f x)
fmap-lemma f fx k = begin
fmap f fx >>= k ≡⟨⟩
join (fmap k (fmap f fx)) ≡⟨ cong join (fmap-∘ k f fx) ⟩
join (fmap (λ x → (k (f x))) fx) ∎
where open ≡-Reasoning
liftM-lemma : ∀ {A B C} (f : A → B) (fx : F A) (k : B → F C) →
liftM f fx >>= k ≡ fx >>= λ x → k (f x)
liftM-lemma f fx k = begin
liftM f fx >>= k ≡⟨ cong (_>>= k) $ liftM-is-fmap f fx ⟩
fmap f fx >>= k ≡⟨ fmap-lemma f fx k ⟩
fx >>= (λ x → k (f x)) ∎
where open ≡-Reasoning
{-
kleisli-assoc
-}
{-
kleisli-identityˡ : ∀ {A B : Set} (f : A → F B) (x : A) → join (fmap return (f x)) ≡ f x
kleisli-identityˡ f x = identityˡ (f x)
kleisli-identityʳ : ∀ {A B : Set} (f : A → F B) (x : A) → join (fmap f (return x)) ≡ f x
kleisli-identityʳ f x = >>=-identityˡ f x
-}
fmap-return : ∀ {A B} (f : A → B) (x : A) → fmap f (return x) ≡ return (f x)
fmap-return f x = sym $ return-natural f x
>>=-identityˡ : ∀ {A B} (a : A) (k : A → F B) → return a >>= k ≡ k a
>>=-identityˡ a k = begin
join (fmap k (return a)) ≡⟨ cong join $ fmap-return k a ⟩
join (return (k a)) ≡⟨ identityʳ (k a) ⟩
k a ∎
where open ≡-Reasoning
>>=-identityʳ : ∀ {A} (m : F A) → m >>= return ≡ m
>>=-identityʳ m = identityˡ m
>>=-assoc : ∀ {A B C} (m : F A) (k : A → F B) (h : B → F C) →
m >>= (λ x → k x >>= h) ≡ (m >>= k) >>= h
>>=-assoc m k h = begin
m >>= (λ x → k x >>= h)
≡⟨⟩
join (fmap (λ x → join (fmap h (k x))) m)
≡⟨ sym $ cong join $ fmap-∘ join (fmap h ∘′ k) m ⟩
join (fmap join (fmap (fmap h ∘′ k) m))
≡⟨ assoc (fmap (fmap h ∘′ k) m) ⟩
join (join (fmap (fmap h ∘′ k) m))
≡⟨ cong join (begin
join (fmap (fmap h ∘′ k) m) ≡⟨ sym $ cong join $ fmap-∘ (fmap h) k m ⟩
join (fmap (fmap h) (fmap k m)) ≡⟨ join-natural h (fmap k m) ⟩
fmap h (join (fmap k m)) ∎ ) ⟩
join (fmap h (join (fmap k m)))
≡⟨⟩
(m >>= k) >>= h
∎
where open ≡-Reasoning
fmap->>= : ∀ {A B C} (f : B → C) (m : F A) (k : A → F B) →
fmap f (m >>= k) ≡ m >>= (λ x → fmap f (k x))
fmap->>= f m k = begin
fmap f (m >>= k) ≡⟨⟩
fmap f (join (fmap k m)) ≡⟨ sym $ join-natural f (fmap k m) ⟩
join (fmap (fmap f) (fmap k m)) ≡⟨ cong join $ fmap-∘ (fmap f) k m ⟩
join (fmap (fmap f ∘′ k) m) ≡⟨⟩
m >>= (λ x → fmap f (k x)) ∎
where open ≡-Reasoning
fmap-move : ∀ {A B C D} (f : C → D) (g : A → B → C) (m1 : F A) (m2 : F B) →
fmap f (m1 >>= λ x → fmap (g x) m2) ≡ m1 >>= (λ x → fmap (f ∘′ g x) m2)
fmap-move f g m1 m2 = begin
fmap f (m1 >>= λ x → fmap (g x) m2) ≡⟨ fmap->>= f m1 (λ x → fmap (g x) m2) ⟩
m1 >>= (λ x → fmap f (fmap (g x) m2)) ≡⟨ >>=-cong (λ x → fmap-∘ f (g x) m2) ⟩
m1 >>= (λ x → fmap (f ∘′ g x) m2) ∎
where open ≡-Reasoning
{-
applicative : Applicative F
applicative = record
{ functor = functor
; unit = unitM
; _<,>_ = pair
; natural = λ f g fx fy → begin
pair (fmap f fx) (fmap g fy)
≡⟨⟩
fmap f fx >>= (λ x → fmap (λ y → x , y) (fmap g fy))
≡⟨ fmap-lemma f fx _ ⟩
fx >>= (λ x → fmap (λ y → f x , y) (fmap g fy) )
≡⟨ >>=-cong (λ x → fmap-∘ (f x ,_) g fy) ⟩
fx >>= (λ x → fmap (λ y → f x , g y) fy)
≡⟨⟩
fx >>= (λ x → fmap (λ y → Prod.map f g (x , y) ) fy )
≡⟨ sym $ fmap-move (Prod.map f g) _,_ fx fy ⟩
fmap (Prod.map f g) (fx >>= λ x → fmap (λ y → x , y) fy)
≡⟨⟩
fmap (Prod.map f g) (pair fx fy)
∎
; assoc = λ fx fy fz →
fmap ×-assoc (pair (pair fx fy) fz)
≡⟨⟩
fmap ×-assoc ((fx >>= λ x → fmap (x ,_) fy) >>= λ xy → fmap (xy ,_) fz)
≡⟨ {! sym $ >>=-assoc fx !} ⟩
fx >>= (λ x → fy >>= λ y → fmap (λ z → x , (y , z)) fz)
≡⟨ sym $ >>=-cong (λ x → fmap-move (x ,_) _,_ fy fz) ⟩
fx >>= (λ x → fmap (x ,_) (fy >>= λ y → fmap (y ,_) fz))
≡⟨⟩
pair fx (pair fy fz)
∎
; unitˡ = {! !}
; unitʳ = {! !}
}
where open ≡-Reasoning
-}
|
SysCore/Kernel/Debug/DebugDisplay.asm | pmache/heinanos | 0 | 104272 | <filename>SysCore/Kernel/Debug/DebugDisplay.asm<gh_stars>0
; Listing generated by Microsoft (R) Optimizing Compiler Version 14.00.50727.42
TITLE c:\Documents and Settings\Michael\Desktop\bte_lighter\Demos\Demo_8_new\SysCore\Kernel\DebugDisplay.cpp
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB LIBCMT
INCLUDELIB OLDNAMES
PUBLIC ?tbuf@@3PADA ; tbuf
PUBLIC ?video_memory@@3PAGA ; video_memory
PUBLIC ?cursor_x@@3EA ; cursor_x
PUBLIC ?cursor_y@@3EA ; cursor_y
PUBLIC ?_color@@3EA ; _color
PUBLIC ?bchars@@3PADA ; bchars
_BSS SEGMENT
?tbuf@@3PADA DB 020H DUP (?) ; tbuf
?cursor_x@@3EA DB 01H DUP (?) ; cursor_x
ALIGN 4
?cursor_y@@3EA DB 01H DUP (?) ; cursor_y
ALIGN 4
?_color@@3EA DB 01H DUP (?) ; _color
_BSS ENDS
_DATA SEGMENT
?video_memory@@3PAGA DD 0b8000H ; video_memory
?bchars@@3PADA DB 030H ; bchars
DB 031H
DB 032H
DB 033H
DB 034H
DB 035H
DB 036H
DB 037H
DB 038H
DB 039H
DB 041H
DB 042H
DB 043H
DB 044H
DB 045H
DB 046H
_DATA ENDS
PUBLIC ?DebugPutc@@YAXE@Z ; DebugPutc
; Function compile flags: /Ogtpy
; File c:\documents and settings\michael\desktop\bte_lighter\demos\demo_8_new\syscore\kernel\debugdisplay.cpp
_TEXT SEGMENT
_c$ = 8 ; size = 1
?DebugPutc@@YAXE@Z PROC ; DebugPutc
; 60 :
; 61 : uint16_t attribute = _color << 8;
xor eax, eax
mov ah, BYTE PTR ?_color@@3EA ; _color
movzx ecx, ax
; 62 :
; 63 : //! backspace character
; 64 : if (c == 0x08 && cursor_x)
mov al, BYTE PTR _c$[esp-4]
cmp al, 8
jne SHORT $LN10@DebugPutc
mov al, BYTE PTR ?cursor_x@@3EA ; cursor_x
test al, al
je SHORT $LN2@DebugPutc
; 65 : cursor_x--;
add al, 255 ; 000000ffH
mov BYTE PTR ?cursor_x@@3EA, al ; cursor_x
jmp SHORT $LN2@DebugPutc
$LN10@DebugPutc:
; 66 :
; 67 : //! tab character
; 68 : else if (c == 0x09)
cmp al, 9
jne SHORT $LN8@DebugPutc
; 69 : cursor_x = (cursor_x+8) & ~(8-1);
mov al, BYTE PTR ?cursor_x@@3EA ; cursor_x
add al, 8
and al, 248 ; 000000f8H
mov BYTE PTR ?cursor_x@@3EA, al ; cursor_x
jmp SHORT $LN2@DebugPutc
$LN8@DebugPutc:
; 70 :
; 71 : //! carriage return
; 72 : else if (c == '\r')
cmp al, 13 ; 0000000dH
; 73 : cursor_x = 0;
je SHORT $LN14@DebugPutc
; 74 :
; 75 : //! new line
; 76 : else if (c == '\n') {
cmp al, 10 ; 0000000aH
; 77 : cursor_x = 0;
; 78 : cursor_y++;
je SHORT $LN15@DebugPutc
; 79 : }
; 80 :
; 81 : //! printable characters
; 82 : else if(c >= ' ') {
cmp al, 32 ; 00000020H
jb SHORT $LN13@DebugPutc
; 83 :
; 84 : //! display character on screen
; 85 : uint16_t* location = video_memory + (cursor_y*80 + cursor_x);
; 86 : *location = c | attribute;
movzx dx, al
movzx eax, BYTE PTR ?cursor_y@@3EA ; cursor_y
or dx, cx
movzx ecx, BYTE PTR ?cursor_x@@3EA ; cursor_x
lea eax, DWORD PTR [eax+eax*4]
shl eax, 4
add eax, ecx
mov ecx, DWORD PTR ?video_memory@@3PAGA ; video_memory
mov WORD PTR [ecx+eax*2], dx
; 87 : cursor_x++;
mov al, BYTE PTR ?cursor_x@@3EA ; cursor_x
add al, 1
mov BYTE PTR ?cursor_x@@3EA, al ; cursor_x
jmp SHORT $LN2@DebugPutc
$LN13@DebugPutc:
mov al, BYTE PTR ?cursor_x@@3EA ; cursor_x
$LN2@DebugPutc:
; 88 : }
; 89 :
; 90 : //! if we are at edge of row, go to new line
; 91 : if (cursor_x >= 80) {
cmp al, 80 ; 00000050H
jb SHORT $LN1@DebugPutc
$LN15@DebugPutc:
; 94 : cursor_y++;
add BYTE PTR ?cursor_y@@3EA, 1 ; cursor_y
$LN14@DebugPutc:
; 92 :
; 93 : cursor_x = 0;
mov BYTE PTR ?cursor_x@@3EA, 0 ; cursor_x
$LN1@DebugPutc:
; 95 : }
; 96 : }
ret 0
?DebugPutc@@YAXE@Z ENDP ; DebugPutc
_TEXT ENDS
PUBLIC ?itoa@@YAXIIPAD@Z ; itoa
; Function compile flags: /Ogtpy
_TEXT SEGMENT
_i$ = 8 ; size = 4
_base$ = 12 ; size = 4
_buf$ = 16 ; size = 4
?itoa@@YAXIIPAD@Z PROC ; itoa
; 103 : int pos = 0;
; 104 : int opos = 0;
; 105 : int top = 0;
; 106 :
; 107 : if (i == 0 || base > 16) {
mov eax, DWORD PTR _i$[esp-4]
xor ecx, ecx
test eax, eax
push esi
je SHORT $LN6@itoa
mov esi, DWORD PTR _base$[esp]
cmp esi, 16 ; 00000010H
ja SHORT $LN6@itoa
$LL5@itoa:
; 110 : return;
; 111 : }
; 112 :
; 113 : while (i != 0) {
; 114 : tbuf[pos] = bchars[i % base];
xor edx, edx
div esi
; 115 : pos++;
add ecx, 1
test eax, eax
mov dl, BYTE PTR ?bchars@@3PADA[edx]
mov BYTE PTR ?tbuf@@3PADA[ecx-1], dl
jne SHORT $LL5@itoa
; 116 : i /= base;
; 117 : }
; 118 : top=pos--;
mov esi, ecx
sub ecx, 1
; 119 : for (opos=0; opos<top; pos--,opos++) {
test esi, esi
push edi
mov edi, DWORD PTR _buf$[esp+4]
jle SHORT $LN1@itoa
; 116 : i /= base;
; 117 : }
; 118 : top=pos--;
lea ecx, DWORD PTR ?tbuf@@3PADA[ecx]
npad 1
$LL3@itoa:
; 120 : buf[opos] = tbuf[pos];
mov dl, BYTE PTR [ecx]
mov BYTE PTR [eax+edi], dl
add eax, 1
sub ecx, 1
cmp eax, esi
jl SHORT $LL3@itoa
$LN1@itoa:
; 121 : }
; 122 : buf[opos] = 0;
mov BYTE PTR [eax+edi], 0
pop edi
pop esi
; 123 : }
ret 0
$LN6@itoa:
; 108 : buf[0] = '0';
mov eax, DWORD PTR _buf$[esp]
mov BYTE PTR [eax], 48 ; 00000030H
; 109 : buf[1] = '\0';
mov BYTE PTR [eax+1], cl
pop esi
; 123 : }
ret 0
?itoa@@YAXIIPAD@Z ENDP ; itoa
_TEXT ENDS
PUBLIC ?itoa_s@@YAXHIPAD@Z ; itoa_s
; Function compile flags: /Ogtpy
_TEXT SEGMENT
_i$ = 8 ; size = 4
_base$ = 12 ; size = 4
_buf$ = 16 ; size = 4
?itoa_s@@YAXHIPAD@Z PROC ; itoa_s
; 126 : if (base > 16) return;
mov edx, DWORD PTR _base$[esp-4]
cmp edx, 16 ; 00000010H
ja SHORT $LN3@itoa_s
; 127 : if (i < 0) {
mov eax, DWORD PTR _i$[esp-4]
test eax, eax
; 128 : *buf++ = '-';
mov ecx, DWORD PTR _buf$[esp-4]
jge SHORT $LN1@itoa_s
mov BYTE PTR [ecx], 45 ; 0000002dH
add ecx, 1
; 129 : i *= -1;
neg eax
$LN1@itoa_s:
; 130 : }
; 131 : itoa(i,base,buf);
mov DWORD PTR _buf$[esp-4], ecx
mov DWORD PTR _base$[esp-4], edx
mov DWORD PTR _i$[esp-4], eax
jmp ?itoa@@YAXIIPAD@Z ; itoa
$LN3@itoa_s:
; 132 : }
ret 0
?itoa_s@@YAXHIPAD@Z ENDP ; itoa_s
_TEXT ENDS
PUBLIC ?DebugSetColor@@YAII@Z ; DebugSetColor
; Function compile flags: /Ogtpy
_TEXT SEGMENT
_c$ = 8 ; size = 4
?DebugSetColor@@YAII@Z PROC ; DebugSetColor
; 140 :
; 141 : unsigned t=_color;
; 142 : _color=c;
mov cl, BYTE PTR _c$[esp-4]
movzx eax, BYTE PTR ?_color@@3EA ; _color
mov BYTE PTR ?_color@@3EA, cl ; _color
; 143 : return t;
; 144 : }
ret 0
?DebugSetColor@@YAII@Z ENDP ; DebugSetColor
_TEXT ENDS
PUBLIC ?DebugGotoXY@@YAXII@Z ; DebugGotoXY
; Function compile flags: /Ogtpy
_TEXT SEGMENT
_x$ = 8 ; size = 4
_y$ = 12 ; size = 4
?DebugGotoXY@@YAXII@Z PROC ; DebugGotoXY
; 148 :
; 149 : if (cursor_x <= 80)
cmp BYTE PTR ?cursor_x@@3EA, 80 ; cursor_x, 00000050H
ja SHORT $LN2@DebugGotoX
; 150 : cursor_x = x;
mov al, BYTE PTR _x$[esp-4]
mov BYTE PTR ?cursor_x@@3EA, al ; cursor_x
$LN2@DebugGotoX:
; 151 :
; 152 : if (cursor_y <= 25)
cmp BYTE PTR ?cursor_y@@3EA, 25 ; cursor_y, 00000019H
ja SHORT $LN1@DebugGotoX
; 153 : cursor_y = y;
mov cl, BYTE PTR _y$[esp-4]
mov BYTE PTR ?cursor_y@@3EA, cl ; cursor_y
$LN1@DebugGotoX:
; 154 : }
ret 0
?DebugGotoXY@@YAXII@Z ENDP ; DebugGotoXY
_TEXT ENDS
PUBLIC ?DebugClrScr@@YAXE@Z ; DebugClrScr
; Function compile flags: /Ogtpy
_TEXT SEGMENT
_c$ = 8 ; size = 1
?DebugClrScr@@YAXE@Z PROC ; DebugClrScr
; 158 :
; 159 : //! clear video memory by writing space characters to it
; 160 : for (int i = 0; i < 80*25; i++)
xor ecx, ecx
mov ch, BYTE PTR _c$[esp-4]
xor edx, edx
push esi
or ecx, 32 ; 00000020H
xor eax, eax
npad 2
$LL3@DebugClrSc:
; 161 : video_memory[i] = ' ' | (c << 8);
mov esi, DWORD PTR ?video_memory@@3PAGA ; video_memory
mov WORD PTR [eax+esi], cx
add eax, 2
cmp eax, 4000 ; 00000fa0H
jl SHORT $LL3@DebugClrSc
; 162 :
; 163 : //! move position back to start
; 164 : DebugGotoXY (0,0);
cmp BYTE PTR ?cursor_x@@3EA, 80 ; cursor_x, 00000050H
pop esi
ja SHORT $LN7@DebugClrSc
mov BYTE PTR ?cursor_x@@3EA, dl ; cursor_x
$LN7@DebugClrSc:
cmp BYTE PTR ?cursor_y@@3EA, 25 ; cursor_y, 00000019H
ja SHORT $LN6@DebugClrSc
mov BYTE PTR ?cursor_y@@3EA, dl ; cursor_y
$LN6@DebugClrSc:
; 165 : }
ret 0
?DebugClrScr@@YAXE@Z ENDP ; DebugClrScr
_TEXT ENDS
PUBLIC ?DebugPuts@@YAXPAD@Z ; DebugPuts
EXTRN ?strlen@@YAIPBD@Z:PROC ; strlen
; Function compile flags: /Ogtpy
_TEXT SEGMENT
_str$ = 8 ; size = 4
?DebugPuts@@YAXPAD@Z PROC ; DebugPuts
; 168 : void DebugPuts (char* str) {
push edi
; 169 :
; 170 : if (!str)
mov edi, DWORD PTR _str$[esp]
test edi, edi
je SHORT $LN1@DebugPuts
push esi
; 171 : return;
; 172 :
; 173 : //! err... displays a string
; 174 : for (unsigned int i=0; i<strlen(str); i++)
push edi
xor esi, esi
call ?strlen@@YAIPBD@Z ; strlen
add esp, 4
test eax, eax
jbe SHORT $LN9@DebugPuts
npad 7
$LL3@DebugPuts:
; 175 : DebugPutc (str[i]);
movzx eax, BYTE PTR [esi+edi]
push eax
call ?DebugPutc@@YAXE@Z ; DebugPutc
push edi
add esi, 1
call ?strlen@@YAIPBD@Z ; strlen
add esp, 8
cmp esi, eax
jb SHORT $LL3@DebugPuts
$LN9@DebugPuts:
pop esi
$LN1@DebugPuts:
pop edi
; 176 : }
ret 0
?DebugPuts@@YAXPAD@Z ENDP ; DebugPuts
_TEXT ENDS
PUBLIC ?DebugPrintf@@YAHPBDZZ ; DebugPrintf
EXTRN ?strcpy@@YAPADPADPBD@Z:PROC ; strcpy
; Function compile flags: /Ogtpy
_TEXT SEGMENT
_str$2746 = -64 ; size = 32
_str$2736 = -64 ; size = 32
_str$2725 = -64 ; size = 64
_str$ = 8 ; size = 4
?DebugPrintf@@YAHPBDZZ PROC ; DebugPrintf
; 179 : int DebugPrintf (const char* str, ...) {
sub esp, 64 ; 00000040H
push ebx
push ebp
; 180 :
; 181 : if(!str)
mov ebp, DWORD PTR _str$[esp+68]
xor ebx, ebx
cmp ebp, ebx
jne SHORT $LN15@DebugPrint
pop ebp
; 182 : return 0;
xor eax, eax
pop ebx
; 251 : }
add esp, 64 ; 00000040H
ret 0
$LN15@DebugPrint:
push esi
push edi
; 186 : size_t i;
; 187 : for (i=0; i<strlen(str);i++) {
push ebp
xor edi, edi
call ?strlen@@YAIPBD@Z ; strlen
add esp, 4
test eax, eax
jbe $LN12@DebugPrint
; 183 :
; 184 : va_list args;
; 185 : va_start (args, str);
lea esi, DWORD PTR _str$[esp+76]
$LL14@DebugPrint:
; 188 :
; 189 : switch (str[i]) {
movzx eax, BYTE PTR [edi+ebp]
cmp al, 37 ; 00000025H
je SHORT $LN9@DebugPrint
; 238 : }
; 239 :
; 240 : break;
; 241 :
; 242 : default:
; 243 : DebugPutc (str[i]);
push eax
call ?DebugPutc@@YAXE@Z ; DebugPutc
add esp, 4
; 244 : break;
jmp $LN13@DebugPrint
$LN9@DebugPrint:
; 190 :
; 191 : case '%':
; 192 :
; 193 : switch (str[i+1]) {
movsx eax, BYTE PTR [edi+ebp+1]
add eax, -88 ; ffffffa8H
cmp eax, 32 ; 00000020H
ja $LN2@DebugPrint
movzx eax, BYTE PTR $LN28@DebugPrint[eax]
jmp DWORD PTR $LN33@DebugPrint[eax*4]
$LN6@DebugPrint:
; 194 :
; 195 : /*** characters ***/
; 196 : case 'c': {
; 197 : char c = va_arg (args, char);
; 198 : DebugPutc (c);
movzx ecx, BYTE PTR [esi+4]
add esi, 4
push ecx
call ?DebugPutc@@YAXE@Z ; DebugPutc
add esp, 4
; 199 : i++; // go to next character
; 200 : break;
jmp $LN31@DebugPrint
$LN5@DebugPrint:
; 201 : }
; 202 :
; 203 : /*** address of ***/
; 204 : case 's': {
; 205 : int c = (int&) va_arg (args, char);
; 206 : char str[64];
; 207 : strcpy (str,(const char*)c);
mov edx, DWORD PTR [esi+4]
add esi, 4
push edx
lea eax, DWORD PTR _str$2725[esp+84]
push eax
call ?strcpy@@YAPADPADPBD@Z ; strcpy
; 208 : DebugPuts (str);
lea ecx, DWORD PTR _str$2725[esp+88]
push ecx
call ?DebugPuts@@YAXPAD@Z ; DebugPuts
add esp, 12 ; 0000000cH
; 209 : i++; // go to next character
; 210 : break;
jmp $LN31@DebugPrint
$LN4@DebugPrint:
; 211 : }
; 212 :
; 213 : /*** integers ***/
; 214 : case 'd':
; 215 : case 'i': {
; 216 : int c = va_arg (args, int);
; 217 : char str[32]={0};
xor eax, eax
add esi, 4
mov DWORD PTR _str$2736[esp+81], eax
mov DWORD PTR _str$2736[esp+85], eax
mov DWORD PTR _str$2736[esp+89], eax
mov DWORD PTR _str$2736[esp+93], eax
mov DWORD PTR _str$2736[esp+97], eax
mov DWORD PTR _str$2736[esp+101], eax
mov DWORD PTR _str$2736[esp+105], eax
mov WORD PTR _str$2736[esp+109], ax
mov BYTE PTR _str$2736[esp+111], al
; 218 : itoa_s (c, 10, str);
mov eax, DWORD PTR [esi]
cmp eax, ebx
mov BYTE PTR _str$2736[esp+80], bl
lea ecx, DWORD PTR _str$2736[esp+80]
jge SHORT $LN18@DebugPrint
mov BYTE PTR _str$2736[esp+80], 45 ; 0000002dH
lea ecx, DWORD PTR _str$2736[esp+81]
neg eax
$LN18@DebugPrint:
push ecx
push 10 ; 0000000aH
push eax
call ?itoa@@YAXIIPAD@Z ; itoa
; 219 : DebugPuts (str);
lea edx, DWORD PTR _str$2736[esp+92]
push edx
; 220 : i++; // go to next character
; 221 : break;
jmp SHORT $LN32@DebugPrint
$LN3@DebugPrint:
; 222 : }
; 223 :
; 224 : /*** display in hex ***/
; 225 : case 'X':
; 226 : case 'x': {
; 227 : int c = va_arg (args, int);
; 228 : char str[32]={0};
xor eax, eax
add esi, 4
mov DWORD PTR _str$2746[esp+81], eax
mov DWORD PTR _str$2746[esp+85], eax
mov DWORD PTR _str$2746[esp+89], eax
mov DWORD PTR _str$2746[esp+93], eax
mov DWORD PTR _str$2746[esp+97], eax
mov DWORD PTR _str$2746[esp+101], eax
mov DWORD PTR _str$2746[esp+105], eax
mov WORD PTR _str$2746[esp+109], ax
mov BYTE PTR _str$2746[esp+111], al
; 229 : itoa_s (c,16,str);
mov eax, DWORD PTR [esi]
cmp eax, ebx
mov BYTE PTR _str$2746[esp+80], bl
lea ecx, DWORD PTR _str$2746[esp+80]
jge SHORT $LN22@DebugPrint
mov BYTE PTR _str$2746[esp+80], 45 ; 0000002dH
lea ecx, DWORD PTR _str$2746[esp+81]
neg eax
$LN22@DebugPrint:
push ecx
push 16 ; 00000010H
push eax
call ?itoa@@YAXIIPAD@Z ; itoa
; 230 : DebugPuts (str);
lea eax, DWORD PTR _str$2746[esp+92]
push eax
$LN32@DebugPrint:
call ?DebugPuts@@YAXPAD@Z ; DebugPuts
add esp, 16 ; 00000010H
$LN31@DebugPrint:
; 231 : i++; // go to next character
add edi, 1
$LN13@DebugPrint:
; 186 : size_t i;
; 187 : for (i=0; i<strlen(str);i++) {
push ebp
add edi, 1
call ?strlen@@YAIPBD@Z ; strlen
add esp, 4
cmp edi, eax
jb $LL14@DebugPrint
$LN12@DebugPrint:
; 245 : }
; 246 :
; 247 : }
; 248 :
; 249 : va_end (args);
; 250 : return i;
mov eax, edi
pop edi
pop esi
pop ebp
pop ebx
; 251 : }
add esp, 64 ; 00000040H
ret 0
$LN2@DebugPrint:
pop edi
pop esi
pop ebp
; 232 : break;
; 233 : }
; 234 :
; 235 : default:
; 236 : va_end (args);
; 237 : return 1;
mov eax, 1
pop ebx
; 251 : }
add esp, 64 ; 00000040H
ret 0
npad 1
$LN33@DebugPrint:
DD $LN3@DebugPrint
DD $LN6@DebugPrint
DD $LN4@DebugPrint
DD $LN5@DebugPrint
DD $LN2@DebugPrint
$LN28@DebugPrint:
DB 0
DB 4
DB 4
DB 4
DB 4
DB 4
DB 4
DB 4
DB 4
DB 4
DB 4
DB 1
DB 2
DB 4
DB 4
DB 4
DB 4
DB 2
DB 4
DB 4
DB 4
DB 4
DB 4
DB 4
DB 4
DB 4
DB 4
DB 3
DB 4
DB 4
DB 4
DB 4
DB 0
?DebugPrintf@@YAHPBDZZ ENDP ; DebugPrintf
_TEXT ENDS
END
|
libsrc/_DEVELOPMENT/string/z80/asm_strrev.asm | meesokim/z88dk | 0 | 13654 | <reponame>meesokim/z88dk
; ===============================================================
; Dec 2013
; ===============================================================
;
; char *strrev(char *s)
;
; Reverse string in place.
;
; ===============================================================
SECTION code_string
PUBLIC asm_strrev
EXTERN __str_locate_nul
asm_strrev:
; enter: hl = char *s
;
; exit : hl = char *s (reversed)
; bc = 0
;
; uses : af, bc, de
; find end of string and string length
ld e,l
ld d,h ; de = char *s
call __str_locate_nul ; bc = -strlen(s) - 1
dec hl ; hl = ptr to char prior to terminating 0
push de ; save char *s
ld a,b ; bc = ceil(-((-strlen-1)/2)-1)
sra a ; = ceil((strlen-1)/2)
rr c ; -1 maps to 0 (strlen = 0)
cpl ; -2 maps to 0 (strlen = 1)
ld b,a ; -3 maps to 1 (strlen = 2)
ld a,c ; -4 maps to 1 (strlen = 3)
cpl ; etc, yields number of chars to swap
ld c,a
or b
jr z, exit ; if numswaps == 0, exit
loop:
ld a,(de) ; char at front of s
ldi ; char at rear written to front of s
dec hl
ld (hl),a ; char from front written to rear of s
dec hl
jp pe, loop
exit:
pop hl ; hl = char *s
ret
|
bootmgr/stage2/io.asm | avdgrinten/windozz | 1 | 98664 |
; The Windozz Project
; Copyright (C) 2018-2019 by the Windozz authors.
bits 16
print:
pusha
.loop:
lodsb
cmp al, 0
je .done
cmp al, 10
je .newline
mov ah, 0x0E
int 0x10
jmp .loop
.newline:
mov ah, 0x0E
mov al, 13
int 0x10
mov ah, 0x0E
mov al, 10
int 0x10
jmp .loop
.done:
popa
ret
error:
push si
mov ah, 5
mov al, 0
int 0x10
mov ah, 1
mov cx, 0x2807
int 0x10
mov ah, 2
mov bh, 0
xor dx, dx
int 0x10
mov ah, 9
xor al, al
xor bh, bh
mov bl, 0x1F
mov cx, 80*25
int 0x10
mov ah, 9
xor al, al
xor bh, bh
mov bl, 0x17
mov cx, 80*7
int 0x10
mov ah, 9
xor al, al
xor bh, bh
mov bl, 0x70
mov cx, 80
int 0x10
mov ah, 0x0E
mov al, 0
int 0x10
mov si, banner
call print
mov si, newline
call print
call print
mov si, .msg
call print
pop si
call print
.hang:
sti
hlt
jmp .hang
.msg: db " Windozz has failed to start. This is most likely caused due to incompatible", 10
db " hardware. Please report this error at http://windozz.github.io/ for it to be", 10
db " reviewed and solved. Press Ctrl+Alt+Delete to reboot your PC.", 10, 10
db " Error description: ", 10
db " *** ", 0
|
src/sets/nat/ordering/leq/alternative.agda | pcapriotti/agda-base | 20 | 3577 | module sets.nat.ordering.leq.alternative where
open import equality.core
open import equality.calculus
open import function.isomorphism
open import hott.equivalence.logical
open import hott.level.core
open import hott.level.sets
open import sets.nat.core
open import sets.nat.properties
open import sets.nat.ordering.leq.core
open import sets.nat.ordering.leq.level
open import sum
Less : ℕ → ℕ → Set _
Less n m = Σ ℕ λ d → n + d ≡ m
Less-level : ∀ {n m} → h 1 (Less n m)
Less-level {n}{m} = prop⇒h1 λ { (d₁ , p₁) (d₂ , p₂)
→ unapΣ ( +-left-cancel n (p₁ · sym p₂)
, h1⇒prop (nat-set _ _) _ _) }
leq-sum : ∀ {n m}(p : n ≤ m) → Less n m
leq-sum {m = m} z≤n = m , refl
leq-sum (s≤s p) with leq-sum p
leq-sum (s≤s p) | d , q = d , ap suc q
diff : ∀ {n m} → n ≤ m → ℕ
diff p = proj₁ (leq-sum p)
sum-leq : ∀ n d → n ≤ (n + d)
sum-leq n 0 = ≡⇒≤ (sym (+-right-unit _))
sum-leq n (suc d) = trans≤ (sum-leq n d)
(trans≤ suc≤ (≡⇒≤ ( ap suc (+-commutativity n d)
· +-commutativity (suc d) n)))
leq-sum-iso : ∀ {n m} → (n ≤ m) ≅ Less n m
leq-sum-iso = ↔⇒≅ ≤-level Less-level
( leq-sum
, (λ { (d , refl) → sum-leq _ d }))
|
Transynther/x86/_processed/US/_ht_/i9-9900K_12_0xca.log_21829_225.asm | ljhsiun2/medusa | 9 | 2562 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x9268, %rdi
nop
nop
nop
cmp %r8, %r8
vmovups (%rdi), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %r9
nop
nop
add %r12, %r12
lea addresses_A_ht+0xd7e8, %rax
clflush (%rax)
nop
nop
nop
add $36758, %r13
movl $0x61626364, (%rax)
nop
nop
nop
cmp %rdi, %rdi
lea addresses_WT_ht+0x8268, %r13
nop
nop
nop
add %rdi, %rdi
mov $0x6162636465666768, %r11
movq %r11, %xmm2
and $0xffffffffffffffc0, %r13
vmovaps %ymm2, (%r13)
nop
nop
dec %r8
lea addresses_A_ht+0x6028, %rdi
nop
nop
xor %r8, %r8
mov $0x6162636465666768, %r9
movq %r9, %xmm7
movups %xmm7, (%rdi)
nop
nop
nop
xor %r12, %r12
lea addresses_normal_ht+0x1b4f8, %rsi
lea addresses_A_ht+0x29e8, %rdi
nop
nop
nop
nop
nop
mfence
mov $75, %rcx
rep movsl
nop
nop
nop
nop
nop
dec %r9
lea addresses_WT_ht+0x13728, %rsi
lea addresses_WT_ht+0xb0e8, %rdi
clflush (%rsi)
and %r11, %r11
mov $14, %rcx
rep movsq
nop
nop
nop
nop
inc %rsi
lea addresses_WT_ht+0x17be8, %rsi
lea addresses_A_ht+0x4be8, %rdi
nop
nop
nop
add %r11, %r11
mov $19, %rcx
rep movsl
nop
nop
nop
nop
and $53341, %r8
lea addresses_WT_ht+0x14ff8, %rsi
lea addresses_D_ht+0x65e8, %rdi
nop
nop
sub %r11, %r11
mov $17, %rcx
rep movsl
nop
nop
nop
add $62373, %r13
lea addresses_WT_ht+0x1eedf, %rcx
xor %rax, %rax
mov $0x6162636465666768, %r8
movq %r8, %xmm2
movups %xmm2, (%rcx)
xor %r13, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r8
push %r9
push %rdi
push %rdx
// Store
lea addresses_RW+0x12ce8, %r8
nop
nop
nop
nop
nop
add $35059, %r9
mov $0x5152535455565758, %r10
movq %r10, (%r8)
nop
sub $7744, %r12
// Load
lea addresses_US+0x176c8, %r8
nop
xor %r11, %r11
mov (%r8), %r9w
nop
nop
nop
and %r10, %r10
// Load
lea addresses_D+0xbe8, %rdx
nop
nop
xor $26958, %r11
mov (%rdx), %r10d
nop
nop
inc %r12
// Faulty Load
lea addresses_US+0x161e8, %r9
and %r10, %r10
movups (%r9), %xmm1
vpextrq $1, %xmm1, %r12
lea oracles, %rdx
and $0xff, %r12
shlq $12, %r12
mov (%rdx,%r12,1), %r12
pop %rdx
pop %rdi
pop %r9
pop %r8
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': True, 'congruent': 6}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': True, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': True, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_WT_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'44': 18278, '45': 1982, '49': 1569}
44 44 45 44 49 44 45 44 44 44 45 44 49 44 45 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 49 44 49 44 44 44 44 44 44 44 44 44 45 44 44 44 44 44 44 44 44 44 44 44 45 44 49 44 44 44 44 45 44 44 49 44 44 44 49 44 44 44 44 44 44 44 49 44 44 44 45 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 49 44 45 44 44 44 44 44 44 44 44 44 44 44 44 44 44 45 44 44 44 45 44 44 44 44 44 44 44 49 44 44 44 44 45 44 44 44 44 49 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 44 44 44 44 45 44 49 44 44 44 44 44 49 44 45 44 45 44 45 44 44 44 44 44 45 44 45 44 44 45 44 44 49 44 49 44 49 44 45 44 49 44 44 44 44 44 44 49 44 44 44 45 44 44 44 45 44 44 44 44 44 44 45 44 44 44 44 45 44 44 44 44 49 44 49 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 45 44 44 44 44 44 44 44 45 44 44 44 44 44 44 44 44 44 49 44 44 44 49 44 44 44 45 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 44 45 44 45 44 44 44 44 44 44 44 44 44 45 44 45 44 44 44 44 44 44 44 45 44 44 44 44 44 44 49 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 45 44 44 49 44 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 49 44 44 44 44 44 44 45 44 44 44 44 45 44 44 44 44 44 44 49 44 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 49 44 44 44 44 44 45 44 49 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 49 44 45 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 45 44 44 44 44 44 44 44 44 44 45 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 45 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 44 44 44 44 44 44 45 44 44 49 44 44 49 44 44 44 44 44 44 44 45 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 45 44 45 44 44 45 44 45 44 45 44 45 44 44 44 45 44 49 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 45 44 44 44 45 44 44 44 45 44 44 44 44 44 45 44 45 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 45 44 44 44 45 44 44 44 45 44 44 44 45 44 45 44 44 45 44 44 44 45 44 44 44 49 44 44 44 44 44 45 44 45 44 44 44 45 44 44 44 44 44 49 44 49 44 45 44 49 44 44 44 44 44 44 44 49 44 44 44 49 44 44 44 44 44 44 44 44 44 44 44 45 44 45 44 49 44 44 44 45 44 44 44 44 44 44 44 44 44 44 44 49 44 49 44 44 44 44 44 44 44 49 44 44 49 44 44 44 44 44 45 44 44 44 44 44 45 44 44 44 44 44 49 44 45 44 44 44 44 44 49 44 44 44 44 44 44 44 44 44 49 44 44 44 44 45 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 49 44 44 44 44 44 44 44 44 44 44 44 44 44 45 44 49 44 44 44 49 44 44 44 45 44 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 49 44 49 44 44 44 44 44 44 44 44 44 45 44 45 44 45 44 49 44 44 44 44 44 45 44 44 44 44 44 44 45 44 44 44 44 45 44 49 44 44 44 45 44 49 44 44 44 45 44 44 44 44 44 49 44 49 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 45 44 49 44 44 44 44 45 44 45 44 44 44 45 44 44 44 44 44 44 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 49 44 44 44 44 44 44 44 45 44 44 44 44 44 44
*/
|
Testing Scripts/Hard Drive Test/Source/Extract Info from DriveDx Report.applescript | freegeek-pdx/macOS-Testing-and-Deployment-Scripts | 0 | 4674 | <filename>Testing Scripts/Hard Drive Test/Source/Extract Info from DriveDx Report.applescript
-- By: <NAME>
-- For: MacLand @ Free Geek
--
-- MIT License
--
-- Copyright (c) 2021 Free Geek
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--
-- This is just a proof-of-concept for a possible future applet.
set driveDxReport to read "/Users/Shared/DriveDxReport.txt"
set AppleScript's text item delimiters to " ###"
repeat with thisDriveDxReportSection in (every text item of driveDxReport)
set thisAdvancedSmartStatus to "UNKNOWN"
set thisOverallHealthRating to "UNKNOWN"
set thisOverallPerformanceRating to "UNKNOWN"
set thisSSDLifetimeLeftIndicator to "UNKNOWN"
set thisIssuesFound to "UNKNOWN"
set thisSerialNumber to "UNKNOWN"
repeat with thisDriveDxReportSectionLine in (paragraphs of thisDriveDxReportSection)
if (((offset of "### " in thisDriveDxReportSectionLine) is equal to 1) or ((offset of "Report Timestamp" in thisDriveDxReportSectionLine) is equal to 1)) then exit repeat
if ((length of thisDriveDxReportSectionLine) is not equal to 0) then
if ((offset of "Advanced SMART Status" in thisDriveDxReportSectionLine) is equal to 1) then set thisAdvancedSmartStatus to (text 40 thru -1 of thisDriveDxReportSectionLine)
if ((offset of "Overall Health Rating" in thisDriveDxReportSectionLine) is equal to 1) then set thisOverallHealthRating to (text 40 thru -1 of thisDriveDxReportSectionLine)
if ((offset of "Overall Performance Rating" in thisDriveDxReportSectionLine) is equal to 1) then set thisOverallPerformanceRating to (text 40 thru -1 of thisDriveDxReportSectionLine)
if ((offset of "SSD Lifetime Left Indicator" in thisDriveDxReportSectionLine) is equal to 1) then set thisSSDLifetimeLeftIndicator to (text 40 thru -1 of thisDriveDxReportSectionLine)
if ((offset of "Issues found" in thisDriveDxReportSectionLine) is equal to 1) then set thisIssuesFound to (text 40 thru -1 of thisDriveDxReportSectionLine)
if ((offset of "Serial Number" in thisDriveDxReportSectionLine) is equal to 1) then
set thisSerialNumber to (text 40 thru -1 of thisDriveDxReportSectionLine)
exit repeat -- Serial Number is the last row we care about
end if
end if
end repeat
if ((thisSerialNumber is not equal to "UNKNOWN") and (thisAdvancedSmartStatus is not equal to "UNKNOWN") and (thisOverallHealthRating is not equal to "UNKNOWN") and (thisIssuesFound is not equal to "UNKNOWN")) then
log "thisSerialNumber: " & thisSerialNumber
log "thisAdvancedSmartStatus: " & thisAdvancedSmartStatus
log "thisOverallHealthRating: " & thisOverallHealthRating
if (thisOverallPerformanceRating is not equal to "UNKNOWN") then log "thisOverallPerformanceRating: " & thisOverallPerformanceRating
if (thisSSDLifetimeLeftIndicator is not equal to "UNKNOWN") then log "thisSSDLifetimeLeftIndicator: " & thisSSDLifetimeLeftIndicator
log "thisIssuesFound: " & thisIssuesFound
log "-----"
end if
end repeat |
oeis/109/A109940.asm | neoneye/loda-programs | 11 | 99622 | <reponame>neoneye/loda-programs
; A109940: Largest k-digit multiple of n where k is the number of digits in n.
; Submitted by <NAME>(s1)
; 9,8,9,8,5,6,7,8,9,90,99,96,91,98,90,96,85,90,95,80,84,88,92,96,75,78,81,84,87,90,93,96,99,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,900
mov $1,$0
add $0,1
seq $1,97326 ; Largest integer m such that m*n has the same decimal digit length as n.
mul $0,$1
|
Cubical/Algebra/Group/Construct/Opposite.agda | bijan2005/univalent-foundations | 0 | 12730 | <reponame>bijan2005/univalent-foundations
{-# OPTIONS --cubical --no-import-sorts --safe #-}
open import Cubical.Core.Everything
open import Cubical.Algebra.Group
module Cubical.Algebra.Group.Construct.Opposite {ℓ} (G : Group ℓ) where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Prod using (_,_)
open Group G
import Cubical.Algebra.Monoid.Construct.Opposite monoid as OpMonoid
open OpMonoid public hiding (Op-isMonoid; Mᵒᵖ)
•ᵒᵖ-inverseˡ : LeftInverse ε _⁻¹ _•ᵒᵖ_
•ᵒᵖ-inverseˡ _ = inverseʳ _
•ᵒᵖ-inverseʳ : RightInverse ε _⁻¹ _•ᵒᵖ_
•ᵒᵖ-inverseʳ _ = inverseˡ _
•ᵒᵖ-inverse : Inverse ε _⁻¹ _•ᵒᵖ_
•ᵒᵖ-inverse = •ᵒᵖ-inverseˡ , •ᵒᵖ-inverseʳ
Op-isGroup : IsGroup Carrier _•ᵒᵖ_ ε _⁻¹
Op-isGroup = record
{ isMonoid = OpMonoid.Op-isMonoid
; inverse = •ᵒᵖ-inverse
}
Gᵒᵖ : Group ℓ
Gᵒᵖ = record { isGroup = Op-isGroup }
|
src/sub/r1_init.asm | Iambian/VANISH | 1 | 160821 | <gh_stars>1-10
.ASSUME ADL=1
systemInit:
POP HL \ POP DE \ PUSH DE \ PUSH HL ;GET PRGMPTR IN DE
PUSH IX \ LD A,MB \ PUSH AF
LD A,(rom0_base_adr>>16)&$FF \ LD MB,A
LD.SIS SP,$FFF0
LD (_sistk+1),SP
PUSH DE
CALL screenInit ;INIT LCD EMULATION
LD HL,ramStart ;\
LD BC,$8000 ; > RESET RAM TO ALL ZERO
CALL MemSet ;/
SET.S appAutoScroll,(IY+appFlags)
SET.S appTextSave,(IY+appFlags)
;TODO: INIT SYSTEM MEMORY
POP HL
;TODO: INSERMEM WITH INPUT PROGRAM AND THEN COPY FROM OUR HL TO $9D95
; UNTIL THEN, DON'T ATTEMPT TO EXECTE ANYTHING. JUST QUIT.
CALL updateScreen
_sistk: LD SP,(0)
POP AF \ LD MB,A \ POP IX
RET
;BEGIN SYSTEM INITIALIZATION
LD (_curStackLevel),SP
LD A,(rom0_base_adr>>16)&$FF
LD MB,A
CALL screenInit
LD IY,flags
;END SYSTEM INITIALIZATION
RES.S textInverse,(IY+textFlags) ;should be implemented soon
SET.S appAutoScroll,(IY+appFlags)
SET.S appTextSave,(IY+appFlags)
RES.S preClrForMode,(IY+newDispF)
RES.S textEraseBelow,(IY+textFlags) ;not implemented yet
RES.S textWrite,(IY+sGrFlags)
RES.S fracDrawLFont,(IY+fontFlags)
;END DEBUG INITIALIZATIONS
CALL execAsmPrgm
execExit:
_curStackLevel .EQU $+1
LD SP,0
CALL updateScreen
POP AF
LD MB,A
POP IX
RET
;===============================================================================
;Initialize LCD hardware
screenInit:
;resets all buffers to $00
LD HL,internal_state
PUSH HL \ POP DE \ INC DE
LD BC,(display_buffer+9600)-internal_state-1
LD (HL),$00
LDIR
;init screen state
LD A,%01010101
LD C,240
LD HL,display_buffer
_: LD B,40
_: LD (HL),A
INC HL
DJNZ -_
RLCA
DEC C
JR NZ,--_
;Set LCD controller ports
LD HL,defaultColorPalette
CALL SetColorPalette
LD IX,$E30200
SCF
SBC HL,HL
LD (IX+0),HL
INC HL
LD (IX+2),HL ;Set palette
LD IXH,$00 ;Set IX to $E30000
LD (IX+$18),%00100001 ;1bpp
LD HL,display_buffer
LD (IX+$10),HL ;Set buffer location
;Construct x3 zoom LUT
LD IX,display_lut
LD C,0
_: LD A,C
LD E,1 \ RRA \ RL E \ JR NC,$-3 \ LD A,E ;REVERSE REG A
LD B,8
_: RLCA \ ADC HL,HL \ RRCA \ RLCA \ ADC HL,HL \ RRCA \ RLCA \ ADC HL,HL
DJNZ -_
LD (IX+0),HL
LEA IX,IX+3
INC C
JR NZ,--_
RET
defaultColorPalette:
.dw -1,0
SetColorPalette: ;HL=ptr to palette
PUSH DE
PUSH BC
LD DE,$E30200
LD BC,4
LDIR
POP BC
POP DE
RET
|
source/numerics/a-nummt1.ads | ytomino/drake | 33 | 30270 | <gh_stars>10-100
pragma License (Unrestricted); -- BSD 3-Clause
-- translated unit from MT19937
--
-- A C-program for MT19937, with initialization improved 2002/1/26.
-- Coded by <NAME> and <NAME>.
--
-- Before using, initialize the state by using init_genrand(seed)
-- or init_by_array(init_key, key_length).
--
-- Copyright (C) 1997 - 2002, <NAME> and <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 names of its contributors 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 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.
--
--
-- Any feedback is very welcome.
-- http://www.math.keio.ac.jp/matumoto/emt.html
-- email: <EMAIL>
--
-- Ada version: 2010 yt
with Ada.IO_Exceptions;
with Interfaces;
package Ada.Numerics.MT19937 is
-- Mersenne Twister.
pragma Preelaborate;
subtype Unsigned_32 is Interfaces.Unsigned_32;
type Unsigned_32_Array is array (Natural range <>) of Unsigned_32;
type Generator is limited private;
function Random_32 (Gen : aliased in out Generator) return Unsigned_32;
function Initialize return Generator;
function Initialize (Initiator : Unsigned_32) return Generator;
function Initialize (Initiator : Unsigned_32_Array) return Generator;
procedure Reset (Gen : in out Generator);
procedure Reset (Gen : in out Generator; Initiator : Integer);
type State is private;
function Initialize return State;
function Initialize (Initiator : Unsigned_32) return State;
function Initialize (Initiator : Unsigned_32_Array) return State;
procedure Save (Gen : Generator; To_State : out State);
procedure Reset (Gen : in out Generator; From_State : State);
function Reset (From_State : State) return Generator;
Max_Image_Width : constant := (624 + 1) * (32 / 4 + 1) - 1;
function Image (Of_State : State) return String;
function Value (Coded_State : String) return State;
Default_Initiator : constant := 5489;
subtype Uniformly_Distributed is Long_Long_Float range 0.0 .. 1.0;
function Random_0_To_1 (Gen : aliased in out Generator)
return Uniformly_Distributed;
function Random_0_To_Less_Than_1 (Gen : aliased in out Generator)
return Uniformly_Distributed;
function Random_Greater_Than_0_To_Less_Than_1 (
Gen : aliased in out Generator)
return Uniformly_Distributed;
function Random_53_0_To_Less_Than_1 (Gen : aliased in out Generator)
return Uniformly_Distributed;
Use_Error : exception
renames IO_Exceptions.Use_Error;
-- Note: Initialize propagates Use_Error if it failed.
private
N : constant := 624;
M : constant := 397;
subtype Unsigned_32_Array_N is Unsigned_32_Array (0 .. N - 1);
type State is record
Vector : Unsigned_32_Array_N;
Condition : Unsigned_32;
end record;
type Generator is limited record
State : MT19937.State := Initialize (Default_Initiator);
end record;
-- Max_Image_Width : constant Positive := (N + 1) * Image_Column;
end Ada.Numerics.MT19937;
|
src/main/fragment/mos6502-common/vwum1=pwuz2_derefidx_vbuyy_plus_1.asm | jbrandwood/kickc | 2 | 11100 | <gh_stars>1-10
clc
lda ({z2}),y
adc #1
sta {m1}
iny
lda ({z2}),y
adc #0
sta {m1}+1
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3413b.ada | best08618/asylo | 7 | 5825 | -- CE3413B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT PAGE RAISES LAYOUT_ERROR WHEN THE VALUE OF THE
-- PAGE NUMBER EXCEEDS COUNT'LAST.
-- APPLICABILITY CRITERIA:
-- THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH SUPPORT
-- TEXT FILES.
-- *** NOTE: This test has been modified since ACVC version 1.11 to -- 9X
-- *** remove incompatibilities associated with the transition -- 9X
-- *** to Ada 9X. -- 9X
-- *** -- 9X
-- HISTORY:
-- JLH 07/27/88 CREATED ORIGINAL TEST.
-- MRM 03/30/93 REMOVED NUMERIC_ERROR FOR 9X COMPATIBILITY
WITH REPORT; USE REPORT;
WITH TEXT_IO; USE TEXT_IO;
PROCEDURE CE3413B IS
FILE : FILE_TYPE;
INCOMPLETE, INAPPLICABLE : EXCEPTION;
ITEM : STRING(1..3) := "ABC";
LST : NATURAL;
BEGIN
TEST ("CE3413B", "CHECK THAT PAGE RAISES LAYOUT_ERROR WHEN THE " &
"VALUE OF THE PAGE NUMBER EXCEEDS COUNT'LAST");
BEGIN
IF COUNT'LAST > 150000 THEN
RAISE INAPPLICABLE;
END IF;
BEGIN
CREATE (FILE, OUT_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED ON TEXT CREATE " &
"WITH OUT_FILE MODE");
RAISE INCOMPLETE;
WHEN NAME_ERROR =>
NOT_APPLICABLE ("NAME_ERROR RAISED ON TEXT " &
"CREATE WITH OUT_FILE MODE");
RAISE INCOMPLETE;
WHEN OTHERS =>
FAILED ("UNEXPECTED EXCEPTION RAISED ON TEXT " &
"CREATE");
RAISE INCOMPLETE;
END;
FOR I IN 1 .. COUNT'LAST-1 LOOP
NEW_PAGE (FILE);
END LOOP;
PUT (FILE, ITEM);
NEW_PAGE (FILE);
PUT (FILE, "DEF");
BEGIN
IF PAGE(FILE) <= POSITIVE_COUNT(COUNT'LAST) THEN
FAILED ("PAGE NUMBER INCORRECT AFTER PAGE SET - 1");
END IF;
FAILED ("LAYOUT_ERROR NOT RAISED FOR PAGE - 1");
EXCEPTION
WHEN LAYOUT_ERROR =>
NULL;
WHEN CONSTRAINT_ERROR =>
FAILED ("CONSTRAINT_ERROR RAISED FOR PAGE - 1");
WHEN OTHERS =>
FAILED ("UNEXPECTED EXCEPTION RAISED FOR PAGE - 1");
END;
CLOSE (FILE);
BEGIN
OPEN (FILE, IN_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED ON TEXT OPEN " &
"WITH IN_FILE MODE");
RAISE INCOMPLETE;
END;
FOR I IN 1 .. COUNT'LAST-1 LOOP
SKIP_PAGE (FILE);
END LOOP;
IF PAGE(FILE) /= COUNT'LAST THEN
FAILED ("INCORRECT PAGE NUMBER");
END IF;
GET_LINE (FILE, ITEM, LST);
IF ITEM /= "ABC" THEN
FAILED ("INCORRECT VALUE READ");
END IF;
SKIP_PAGE (FILE);
BEGIN
IF PAGE(FILE) <= POSITIVE_COUNT(COUNT'LAST) THEN
FAILED ("PAGE NUMBER INCORRECT AFTER PAGE SET - 2");
END IF;
FAILED ("LAYOUT_ERROR NOT RAISED FOR PAGE - 2");
EXCEPTION
WHEN LAYOUT_ERROR =>
NULL;
WHEN CONSTRAINT_ERROR =>
FAILED ("CONSTRAINT_ERROR RAISED FOR PAGE - 2");
WHEN OTHERS =>
FAILED ("UNEXPECTED EXCEPTION RAISED FOR PAGE - 2");
END;
BEGIN
DELETE (FILE);
EXCEPTION
WHEN USE_ERROR =>
NULL;
END;
EXCEPTION
WHEN INCOMPLETE =>
NULL;
WHEN INAPPLICABLE =>
NOT_APPLICABLE ("THE VALUE OF COUNT'LAST IS GREATER " &
"THAN 150000. THE CHECKING OF THIS " &
"OBJECTIVE IS IMPRACTICAL");
END;
RESULT;
END CE3413B;
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2.log_30_1690.asm | ljhsiun2/medusa | 9 | 6831 | .global s_prepare_buffers
s_prepare_buffers:
push %r15
push %r8
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x15684, %rcx
nop
nop
nop
nop
nop
sub %rax, %rax
mov (%rcx), %edi
nop
cmp $36651, %rdx
lea addresses_UC_ht+0x1a285, %rsi
nop
nop
nop
nop
and $30916, %rax
movups (%rsi), %xmm4
vpextrq $0, %xmm4, %rbx
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_normal_ht+0x1b47f, %rsi
lea addresses_UC_ht+0x7985, %rdi
and %r8, %r8
mov $125, %rcx
rep movsw
nop
cmp %rax, %rax
lea addresses_A_ht+0x13385, %rsi
lea addresses_normal_ht+0x1bd05, %rdi
clflush (%rdi)
nop
xor $28082, %r15
mov $49, %rcx
rep movsq
dec %rbx
lea addresses_UC_ht+0x1eef9, %rsi
lea addresses_WC_ht+0x2f05, %rdi
nop
nop
nop
add $16795, %rdx
mov $42, %rcx
rep movsq
nop
nop
sub $56198, %rsi
lea addresses_normal_ht+0xe535, %rsi
lea addresses_A_ht+0x14281, %rdi
nop
nop
nop
nop
nop
dec %r15
mov $96, %rcx
rep movsb
nop
and %rbx, %rbx
lea addresses_UC_ht+0x14585, %rdx
nop
nop
nop
sub %rcx, %rcx
and $0xffffffffffffffc0, %rdx
movntdqa (%rdx), %xmm6
vpextrq $1, %xmm6, %rax
sub $60752, %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r8
push %rax
push %rbx
push %rcx
// Store
lea addresses_UC+0x195a5, %r15
nop
sub %rax, %rax
mov $0x5152535455565758, %r14
movq %r14, (%r15)
nop
nop
cmp $15615, %r14
// Store
lea addresses_UC+0x18785, %r14
nop
nop
nop
sub %r11, %r11
mov $0x5152535455565758, %r8
movq %r8, %xmm4
movups %xmm4, (%r14)
nop
nop
xor $47238, %r15
// Store
lea addresses_US+0xbe85, %rbx
inc %r8
mov $0x5152535455565758, %r14
movq %r14, %xmm1
vmovups %ymm1, (%rbx)
nop
nop
sub %rcx, %rcx
// Faulty Load
lea addresses_UC+0x18785, %rcx
clflush (%rcx)
nop
nop
nop
nop
nop
sub %rax, %rax
mov (%rcx), %r14w
lea oracles, %rcx
and $0xff, %r14
shlq $12, %r14
mov (%rcx,%r14,1), %r14
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 9, 'same': False}}
{'58': 30}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
oeis/104/A104721.asm | neoneye/loda-programs | 11 | 244886 | ; A104721: Expansion of (1+x)^2/(1-4*x^2).
; 1,2,5,8,20,32,80,128,320,512,1280,2048,5120,8192,20480,32768,81920,131072,327680,524288,1310720,2097152,5242880,8388608,20971520,33554432,83886080,134217728,335544320,536870912,1342177280,2147483648,5368709120,8589934592,21474836480,34359738368,85899345920,137438953472,343597383680,549755813888,1374389534720,2199023255552,5497558138880,8796093022208,21990232555520,35184372088832,87960930222080,140737488355328,351843720888320,562949953421312,1407374883553280,2251799813685248,5629499534213120
mov $1,2
pow $1,$0
gcd $0,2
add $0,3
mul $0,$1
div $0,2
sub $0,2
div $0,2
add $0,1
|
oeis/119/A119580.asm | neoneye/loda-programs | 11 | 11455 | ; A119580: (n^2+n^3)*(binomial(2*n,n)).
; Submitted by <NAME>(s2)
; 0,4,72,720,5600,37800,232848,1345344,7413120,39382200,203231600,1024287264,5062180032,24607819600,117942804000,558423072000,2615901857280,12139419556440,55866532906800,255192804636000
mov $1,$0
add $0,1
mul $1,2
bin $1,$0
mul $1,$0
bin $0,2
mul $1,$0
mov $0,$1
mul $0,2
|
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/a-cgarso.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 16672 | <reponame>JCGobbi/Nucleo-STM32G474RE<filename>bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/a-cgarso.ads
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . G E N E R I C _ A R R A Y _ S O R T --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
generic
type Index_Type is (<>);
type Element_Type is private;
type Array_Type is array (Index_Type range <>) of Element_Type;
with function "<" (Left, Right : Element_Type) return Boolean is <>;
procedure Ada.Containers.Generic_Array_Sort (Container : in out Array_Type);
pragma Pure (Ada.Containers.Generic_Array_Sort);
-- Reorders the elements of Container such that the elements are sorted
-- smallest first as determined by the generic formal "<" operator provided.
-- Any exception raised during evaluation of "<" is propagated.
--
-- The actual function for the generic formal function "<" is expected to
-- return the same value each time it is called with a particular pair of
-- element values. It should not modify Container and it should define a
-- strict weak ordering relationship: irreflexive, asymmetric, transitive, and
-- in addition, if x < y for any values x and y, then for all other values z,
-- (x < z) or (z < y). If the actual for "<" behaves in some other manner,
-- the behavior of the instance of Generic_Array_Sort is unspecified. The
-- number of times Generic_Array_Sort calls "<" is unspecified.
|
libsrc/_DEVELOPMENT/math/integer/small/l_small_divu_64_64x8.asm | jpoikela/z88dk | 640 | 9 | <reponame>jpoikela/z88dk
; 2016 aralbrec
SECTION code_clib
SECTION code_math
PUBLIC l_small_divu_64_64x8
PUBLIC l0_small_divu_64_64x8
EXTERN error_llmc, error_divide_by_zero_mc
l_small_divu_64_64x8:
; unsigned division of a 64-bit number
; by an 8-bit number
;
; enter : dehl'dehl = 64-bit dividend
; c = 8-bit divisor
;
; exit : success
;
; dehl'dehl = 64-bit quotient
; a = remainder
; carry reset
;
; divide by zero
;
; dehl'dehl = ULLONG_MAX
; (dividend is lost)
; carry set, errno = EDOM
;
; uses : af, b, de, hl, de', hl'
ld a,c
or a
jr z, divide_by_zero
l0_small_divu_64_64x8:
xor a
ld b,64
loop_11:
add hl,hl
rl e
rl d
exx
adc hl,hl
rl e
rl d
exx
rla
jr c, loop_02
cp c
jr c, loop_03
loop_02:
sub c
inc l
loop_03:
djnz loop_11
or a
ret
divide_by_zero:
call error_llmc
jp error_divide_by_zero_mc
|
systembuffering.asm | pureforwhite/SystemBuffering | 0 | 21640 | <reponame>pureforwhite/SystemBuffering
;Author:<NAME>
;PURPOSE: use BUFFERED I/O with permissions, proper checks for return statements,
; and learns about the circular buffer all the proper words that match up are then written to a file
; called results.txt
section .data
; system commands
SYSTEM_OPEN equ 2
SYSTEM_CLOSE equ 3
SYSTEM_EXIT equ 60
SYSTEM_READ equ 0
SYSTEM_WRITE equ 1
SYSTEM_CREATE equ 85
; special files, for input and output
STANDARD_IN equ 0
STANDARD_OUT equ 1
; just for the end program
SUCCESS equ 0
NULL equ 0
LINEFEED equ 10
carriage equ 13
; this limits the string length
stringInputMaxLength equ 20
MAIN_BUFFER_SIZE equ 1
; Messages for the files and error messages for the input for arguments
errorIncorrectArguments db "Enter the filename and then the word to search for after ./a.out.", LINEFEED, NULL
errorOpeningFile db "Failed to open input file.", LINEFEED, NULL
errorReadingFile db "Error, failed to read file.", LINEFEED, NULL
errorStringLength db "Input string must be between 1 and 20 characters long.", LINEFEED, NULL
errorMakingFile db "Failed to create out going file.", LINEFEED, NULL
RESULT_FILE db "results.txt", NULL
stringPlacement db "Line: 0x00000000 Column: 0x00000000", LINEFEED, NULL
; all these variables have unique uses
linePositionPlace equ 6
columnPositionPlace equ 25
; used for saving the results and the input book
fileDescriptorIn dd 0
fileDescriptorOut dd 0
charactersFromBuffersBuffered dd 0
charactersFromBuffersRead dd 0
circularIndex dd 0
lineCount dd 1
columnCount dd 0
endOfFileReached db 0
charactersFromBuffersInLine db 0
charactersFromBuffer db 1
;permissions and accesses
O_RDONLY equ 000000q
O_WRONLY equ 000001q
O_RDWR equ 000002q
S_IRUSR equ 00400q
S_IWUSR equ 00200q
section .bss
mainBuffer resb 1
circularBuffer resb stringInputMaxLength
CIRCULAR_BUFFER_SIZE resb 1
fileName resb 100
findInputString resb stringInputMaxLength
section .text
global main
main:
;IMPORTANT PERSONAL NOTE
; rdi = argc (argument count)
; rsi = argv (starting address of argument vector)
;argument vector (table)
mov r8, rsi
;argument count
mov r13, rdi
mov rax, 3
cmp rax, r13
je passArgumentCount
mov rdi, errorIncorrectArguments
call findLength
mov rdx, rax
mov rsi, rdi
mov rax, SYSTEM_WRITE
mov rdi, STANDARD_OUT
syscall
; this here is to show and prove that the program is functioning
mov rax, SYSTEM_EXIT
mov rdi, SUCCESS
syscall
passArgumentCount:
; here we have this so that we take from the argumennt vector and
; the text file is obtained and stored properly
mov rdi, r8
mov rsi, 1
mov rdx, fileName
call argumentTableGrab
mov rdi, r8
mov rsi, 2
mov rdx, findInputString
call argumentTableGrab
; the same happens with getting the argument vector third value and
;storing it in findINputString
mov rdi, findInputString
call findLength
dec rax
cmp rax, stringInputMaxLength
jle passableStringLength
; this here finds the length of the input string that will be used to
; create the limit for the circular buffer
mov rdi, errorStringLength
call findLength
mov rdx, rax
mov rsi, rdi
mov rax, SYSTEM_WRITE
mov rdi, STANDARD_OUT
syscall
mov rax, SYSTEM_EXIT
mov rdi, SUCCESS
syscall
passableStringLength:
mov byte[CIRCULAR_BUFFER_SIZE], al
mov rax, SYSTEM_CREATE
mov rdi, RESULT_FILE
mov rsi, S_IRUSR | S_IWUSR
syscall
; with the proper permissions and commands
; the result file is made and we have the descirptor to it
cmp rax, 0
jge fileMade
mov rdi, errorMakingFile
call findLength
mov rdx, rax
mov rsi, rdi
mov rax, SYSTEM_WRITE
mov rdi, STANDARD_OUT
syscall
mov rax, SYSTEM_EXIT
mov rdi, SUCCESS
syscall
fileMade:
mov dword[fileDescriptorOut], eax
mov rax, SYSTEM_OPEN
mov rdi, fileName
mov rsi, O_RDONLY
syscall
cmp rax, 0
jge successfulFileOpen
mov rdi, errorOpeningFile
call findLength
mov rdx, rax
mov rsi, rdi
mov rax, SYSTEM_WRITE
mov rdi, STANDARD_OUT
syscall
mov rax, SYSTEM_EXIT
mov rdi, SUCCESS
syscall
successfulFileOpen:
mov dword[fileDescriptorIn], eax
readInMoreData:
mov rdi, mainBuffer
mov rsi, charactersFromBuffer
call getChar
cmp rax, 0
je fileReadAndSearchFinished
mov eax, dword[circularIndex]
mov rbx, 0
mov bl, byte[CIRCULAR_BUFFER_SIZE]
cqo
div rbx
mov dword[circularIndex], edx
; the code above calculates the adjusted index for the circular buffer and manages the storeage of
; the charactersFromBuffers below
mov rax, circularBuffer
mov rcx, 0
mov cl, byte[charactersFromBuffer]
mov ebx, dword[circularIndex]
mov byte[rax + rbx], cl
; this here compares if there is an end line line found, dependent on system of course
cmp byte[charactersFromBuffer], carriage
je readInMoreData
cmp byte[charactersFromBuffer], LINEFEED
jne noNewLineNeeded
inc dword[lineCount]
mov dword[columnCount], 0
jmp findInCircularBuffer
noNewLineNeeded:
inc dword[columnCount]
findInCircularBuffer:
mov rdi, circularBuffer
mov rsi, findInputString
mov r14b, byte[CIRCULAR_BUFFER_SIZE]
mov rbx, 0
mov ecx, dword[circularIndex]
add ecx, 1
mov rax, rcx
cqo
div r14
mov rcx, rdx
searchLoop:
mov al, byte[rsi+ rbx]
mov r15b, byte[rdi + rcx]
cmp al, r15b
jne endSearch
charactersFromBuffersMatch:
inc byte[charactersFromBuffersInLine]
cmp byte[charactersFromBuffersInLine], r14b
je identicalCharactersFound
inc rbx
inc rcx
mov rax, rcx
cqo
div r14
mov rcx, rdx
jmp searchLoop
identicalCharactersFound:
push rdi
push rsi
mov edi, dword[lineCount]
mov rsi, stringPlacement
add rsi, linePositionPlace
call convertIntToHex
mov edi, dword[columnCount]
sub dil, byte[CIRCULAR_BUFFER_SIZE]
add dil, 1
mov rsi, stringPlacement
add rsi, columnPositionPlace
call convertIntToHex
pop rsi
pop rdi
mov rdi, stringPlacement
call findLength
mov rdx, rax
mov rax, SYSTEM_WRITE
mov edi, dword[fileDescriptorOut]
mov rsi, stringPlacement
syscall
endSearch:
mov byte[charactersFromBuffersInLine], 0
inc dword[circularIndex]
jmp readInMoreData
endProgram:
fileReadAndSearchFinished:
mov rax, SYSTEM_CLOSE
mov rdi, qword[fileDescriptorOut]
syscall
mov rax, SYSTEM_CLOSE
mov rdi, qword[fileDescriptorIn]
syscall
mov rax, SYSTEM_EXIT
mov rdi, SUCCESS
syscall
global getChar
getChar:
charLoop:
; this here checks if charsRead is less than charsBuffered so that it will keep looping
; and storing the charactersFromBuffer into the from the main to the circular
mov ebx, dword[charactersFromBuffersRead]
cmp ebx, dword[charactersFromBuffersBuffered]
je doNotTake
mov cl, byte[rdi + rbx]
mov byte[charactersFromBuffer], cl
inc dword[charactersFromBuffersRead]
mov rax, 1
ret
doNotTake:
cmp byte[endOfFileReached], 1
jne bufferInsertion
mov rax, 0
ret
bufferInsertion:
push rdi
push rsi
mov edi, dword[fileDescriptorIn]
mov rsi, mainBuffer
mov rdx, MAIN_BUFFER_SIZE
mov rax, SYSTEM_READ
syscall
cmp rax, 0
jge infoReadInCorrecttly
mov rdi, errorReadingFile
call findLength
mov rdx, rax
mov rsi, rdi
mov rax, SYSTEM_WRITE
mov rdi, STANDARD_OUT
syscall
mov rax, SYSTEM_EXIT
mov rdi, SUCCESS
syscall
infoReadInCorrecttly:
mov qword[charactersFromBuffersBuffered], rax
pop rsi
pop rdi
cmp rax, MAIN_BUFFER_SIZE
je endFileFalse
mov byte[endOfFileReached], 1
jmp charLoop
endFileFalse:
mov dword[charactersFromBuffersBuffered], eax
mov dword[charactersFromBuffersRead], 0
jmp charLoop
ret
global argumentTableGrab
argumentTableGrab:
mov rax, qword[rdi + rsi * 8]
mov rbx, 0
argumentPlacement:
cmp byte[rax + rbx], NULL
je argumentPlacementFinished
mov cl, byte[rax + rbx]
mov byte[rdx + rbx], cl
inc rbx
loop argumentPlacement
argumentPlacementFinished:
ret
global convertIntToHex
convertIntToHex:
; arg1 dword int
; arg2 string size 10 byte arr passing by reference
push rbx
; these are necessary values that have to be used for the ascii
; converting for characters
mov r10, 16
mov r9, 48
mov r8, 55
mov rbx, 9
mov eax, edi
mov rdx, 0
convertToHex:
cmp rbx, 1
je endConversion
cdq
idiv r10d
cmp edx, 9
jg ontoAlphabet
add edx, r9d
mov byte[rsi + rbx], dl
dec rbx
jmp convertToHex
ontoAlphabet:
add edx, r8d
mov byte[rsi + rbx], dl
dec rbx
jmp convertToHex
endConversion:
pop rbx
ret
global findLength
findLength:
; The code in here is from an example that has been provided in a previous assignment
push rcx
mov rax, 1
countLettersLoop:
mov cl, byte[rdi + rax - 1]
cmp cl, NULL
je countLettersDone
inc rax
loop countLettersLoop
countLettersDone:
pop rcx
ret
|
AAOSL/Abstract/Advancement.agda | VictorCMiraldo/aaosl-agda | 1 | 9547 | {- Formal verification of authenticated append-only skiplists in Agda, version 1.0.
Copyright (c) 2020 Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import Data.Unit.NonEta
open import Data.Empty
open import Data.Sum
open import Data.Product
open import Data.Product.Properties
open import Data.Fin hiding (_<_; _≤_)
open import Data.Fin.Properties using () renaming (_≟_ to _≟Fin_)
open import Data.Nat renaming (_≟_ to _≟ℕ_; _≤?_ to _≤?ℕ_)
open import Data.Nat.Properties
open import Data.List renaming (map to List-map)
open import Data.List.Properties using (∷-injective; length-map)
open import Data.List.Relation.Unary.Any renaming (map to Any-map)
open import Data.List.Relation.Unary.All renaming (lookup to All-lookup; map to All-map)
open import Data.List.Relation.Unary.All.Properties hiding (All-map)
open import Data.List.Relation.Unary.Any.Properties renaming (map⁺ to Any-map⁺)
open import Data.List.Relation.Binary.Pointwise using (decidable-≡)
open import Data.Bool hiding (_<_; _≤_)
open import Data.Maybe renaming (map to Maybe-map)
open import Function
open import Relation.Binary.PropositionalEquality
open import Relation.Binary.Core
open import Relation.Nullary
open import AAOSL.Lemmas
open import AAOSL.Abstract.Hash
open import AAOSL.Abstract.DepRel
-- This module defines the DepRel type, which represents the class of AAOSLs we
-- consider, and proves properties about any DepRel.
module AAOSL.Abstract.Advancement
-- A Hash function maps a bytestring into a hash.
(hash : ByteString → Hash)
-- And is collision resistant
(hash-cr : ∀{x y} → hash x ≡ hash y → Collision hash x y ⊎ x ≡ y)
-- Indexes can be encoded in an injective way
(encodeI : ℕ → ByteString)
(encodeI-inj : (m n : ℕ) → encodeI m ≡ encodeI n → m ≡ n)
(dep : DepRel)
where
-- Brings the DepRel names into scope instantiated
-- for the module parameters in question.
open DepRel dep
hop-prog : ∀{m}(h : HopFrom m) → hop-tgt h ≢ m
hop-prog = <⇒≢ ∘ hop-<
hop-≤ : ∀{m}(h : HopFrom m) → hop-tgt h ≤ m
hop-≤ = <⇒≤ ∘ hop-<
depsof : ℕ → List ℕ
depsof 0 = []
depsof (suc i) = List-map hop-tgt (nats (lvlof (suc i)))
depsof-ne : ∀ m → depsof m ≡ [] → m ≡ 0
depsof-ne 0 hyp = refl
depsof-ne (suc m) hyp =
let le0 = trans (sym (length-map hop-tgt (nats (lvlof (suc m)))) )
(cong length hyp)
le-nz = nats-length (lvlof-s m)
in ⊥-elim (1≤0-⊥ (subst (1 ≤_) le0 le-nz))
hopFromZ-⊥ : (h : HopFrom 0) → ⊥
hopFromZ-⊥ h = fin0-⊥ (subst Fin lvlof-z h)
where fin0-⊥ : Fin 0 → ⊥
fin0-⊥ ()
hop-tgt-is-dep : {m : ℕ}(h : HopFrom m)
→ hop-tgt h ∈ depsof m
hop-tgt-is-dep {0} h = ⊥-elim (hopFromZ-⊥ h)
hop-tgt-is-dep {suc m} h = Any-map⁺ (Any-map (cong hop-tgt) (nats-correct h))
-- Two simple but useful lemmas made to work over our abstract
-- index type.
≤-≢-mon : ∀{i j tgt} → tgt ≢ j → tgt ≤ j → i ≤ tgt → i ≢ j
≤-≢-mon tgt≢j tgt≤j i≤tgt i≡j
= tgt≢j (sym (≤-antisym (subst (_≤ _) i≡j i≤tgt) tgt≤j))
≟ℕ-refl : (s : ℕ) → (s ≟ℕ s) ≡ yes refl
≟ℕ-refl s with s ≟ℕ s
...| no abs = ⊥-elim (abs refl)
...| yes refl = refl
⊥-prop : (a b : ⊥) → a ≡ b
⊥-prop () ()
≟ℕ-neg : (m n : ℕ) → (p : m ≢ n) → (m ≟ℕ n) ≡ no p
≟ℕ-neg m n p with m ≟ℕ n
...| yes imp = ⊥-elim (p imp)
...| no r = cong no (fun-ext (λ x → ⊥-prop (r x) (p x)))
HopFrom≢0 : ∀{j}(h : HopFrom j) → j ≢ 0
HopFrom≢0 {j} h refl = hopFromZ-⊥ h
open WithCryptoHash hash hash-cr
-- This function is total, even though we won't always know a hash for every
-- index. That's ok, we only use the hashes of the relevant indexes.
View : Set
View = ℕ → Hash
-- An inhabitant of 'Agree s t ixs' is a proof that the views s and t
-- agree on the hash of every index i ∈ ixs.
Agree : View → View → List ℕ → Set
Agree v u = All (λ s → v s ≡ u s)
-- Returns the list of hashes that the authenticator
-- at the given index depends on.
deps-hash : ℕ → View → List Hash
deps-hash s tbl = List-map tbl (depsof s)
-- TODO-2: Make auth, auth-inj-1 and auth-inj-2 module parameters
-- TODO-1: Make sure the names are consistent with the paper
--------------------------
-- Defining authenticators
-- Authenticators will depend on all p-auths of the
-- dependencies of a node.
auth : (s : ℕ) → Hash → View → Hash
auth s h tbl = hash-concat (hash (encodeI s) ∷ h ∷ deps-hash s tbl)
-- We will be using two separate injectivity functions. One is
-- for the hash of the data in a node, which can't be the
-- initial node!
auth-inj-1 : {j : ℕ}{h₁ h₂ : Hash}{t₁ t₂ : View}
→ j ≢ 0
→ auth j h₁ t₁ ≡ auth j h₂ t₂
→ HashBroke ⊎ h₁ ≡ h₂
auth-inj-1 {j} {h₁} {h₂} {t₁} {t₂} j≢s₀ hip
with hash-concat-inj { hash (encodeI j) ∷ h₁ ∷ deps-hash j t₁ }
{ hash (encodeI j) ∷ h₂ ∷ deps-hash j t₂ } hip
...| inj₁ hb = inj₁ hb
...| inj₂ r = inj₂ (proj₁ (∷-injective (proj₂ (∷-injective r))))
-- The second one does induction on the list of dependencies.
auth-inj-2 : {i : ℕ}{h : Hash}(t₁ t₂ : View)
→ auth i h t₁ ≡ auth i h t₂
→ HashBroke ⊎ Agree t₁ t₂ (depsof i)
auth-inj-2 {i} {h} t₁ t₂ hip
with hash-concat-inj { hash (encodeI i) ∷ h ∷ deps-hash i t₁ }
{ hash (encodeI i) ∷ h ∷ deps-hash i t₂ } hip
...| inj₁ hb = inj₁ hb
...| inj₂ r = inj₂ (auth-inj-2-aux t₁ t₂ (depsof i) (proj₂ (∷-injective (proj₂ (∷-injective r)))))
where
auth-inj-2-aux : (t₁ t₂ : View)(l : List ℕ)
→ List-map t₁ l ≡ List-map t₂ l
→ Agree t₁ t₂ l
auth-inj-2-aux t1 t2 [] hyp = []
auth-inj-2-aux t1 t2 (x ∷ l) hyp = proj₁ (∷-injective hyp) ∷ auth-inj-2-aux t1 t2 l (proj₂ (∷-injective hyp))
------------------------
------------------------
-- Advancement Proofs --
------------------------
------------------------
-- Finally, advancement proofs in their simple variant
data AdvPath : ℕ → ℕ → Set where
AdvDone : ∀{i} → AdvPath i i
AdvThere : ∀{j i}
→ Hash -- datum digest
→ (h : HopFrom j)
→ AdvPath (hop-tgt h) i
→ AdvPath j i
-- Override a view with a hash for a specific index.
_∪₁_ : View → ℕ × Hash → View
_∪₁_ tbl (s , h) s'
with s ≟ℕ s'
...| yes _ = h
...| no _ = tbl s'
-- The rebuild function is, essentially, a transformer over
-- the current view of the skiplog. It is PARAMOUNT to return
-- a new 'view' of the world, as we can see in rebuild-⊕ lemma.
-- Otherwise, it becomes seriously intricate to express
-- that rebuilding the hash of index j "depends on" the rebuilt
-- hashes of j's dependencies.
rebuild : ∀{i j} → AdvPath j i → View → View
rebuild {i} AdvDone tbl = tbl
rebuild (AdvThere {j = j} x h prf) tbl
= let tbl' = rebuild prf tbl
in tbl' ∪₁ (j , auth j x tbl')
lemma1 : ∀{j i} → AdvPath j i → i ≤ j
lemma1 AdvDone = ≤-refl
lemma1 {j} (AdvThere x h a) = ≤-trans (lemma1 a) (hop-≤ h)
rebuild-tgt-lemma : ∀{j i}(a : AdvPath j i){t : View}
→ rebuild a t i ≡ t i
rebuild-tgt-lemma AdvDone = refl
rebuild-tgt-lemma {j} {i} (AdvThere x h a)
rewrite ≟ℕ-neg j i (<⇒≢ (≤-<-trans (lemma1 a) (hop-< h)) ∘ sym)
= rebuild-tgt-lemma a
lemma2 : ∀{i}(a : AdvPath i i) → a ≡ AdvDone
lemma2 AdvDone = refl
lemma2 (AdvThere x h a)
= ⊥-elim (hop-prog h (sym (≤-antisym (lemma1 a) (hop-≤ h))))
-- Lemma3 states that if a hop exists, then it is not from
-- s₀. This is necessary to eliminate some nasty cases.
lemma3 : ∀{j i} → (h : HopFrom j) → AdvPath (hop-tgt h) i → j ≢ 0
lemma3 h a = HopFrom≢0 h
----------------------
-- Proof Splitting --
----------------------
_⊕_ : ∀{j k i} → AdvPath j k → AdvPath k i → AdvPath j i
AdvDone ⊕ rest = rest
(AdvThere d h a) ⊕ rest = AdvThere d h (a ⊕ rest)
⊕-id-r : ∀{j i}(a : AdvPath j i) → a ⊕ AdvDone ≡ a
⊕-id-r AdvDone = refl
⊕-id-r (AdvThere x h a) = cong (AdvThere x h) (⊕-id-r a)
-- A value of type 'i ∈AP a' illustrates index i as a dependency
-- of 'a'.
data _∈AP_ (i₀ : ℕ) : {j i : ℕ} → AdvPath j i → Set where
hereTgtDone : i₀ ∈AP (AdvDone {i₀})
hereTgtThere : ∀{i}{d : Hash}{hop : HopFrom i₀}{a : AdvPath (hop-tgt hop) i}
→ i₀ ∈AP (AdvThere d hop a)
step : ∀{i j}{d : Hash}{hop : HopFrom j}{a : AdvPath (hop-tgt hop) i}
→ i₀ ≢ j
→ i₀ ∈AP a
→ i₀ ∈AP (AdvThere d hop a)
∈AP-src : ∀{j i}{a : AdvPath j i}
→ j ∈AP a
∈AP-src {a = AdvDone} = hereTgtDone
∈AP-src {a = AdvThere x h a} = hereTgtThere
∈AP-tgt : ∀{j i}{a : AdvPath j i}
→ i ∈AP a
∈AP-tgt {a = AdvDone} = hereTgtDone
∈AP-tgt {a = AdvThere x h a} = step (<⇒≢ (≤-<-trans (lemma1 a) (hop-< h))) ∈AP-tgt
∈AP-≤ : ∀{j i}{a : AdvPath j i}
→ {i0 : ℕ} → i0 ∈AP a
→ i0 ≤ j
∈AP-≤ hereTgtDone = ≤-refl
∈AP-≤ hereTgtThere = ≤-refl
∈AP-≤ (step _ hyp) = ≤-trans (∈AP-≤ hyp) (hop-≤ _)
∈AP-≥ : ∀{j i}{a : AdvPath j i}
→ {i0 : ℕ} → i0 ∈AP a
→ i ≤ i0
∈AP-≥ hereTgtDone = ≤-refl
∈AP-≥ {a = a} hereTgtThere = lemma1 a
∈AP-≥ (step _ hyp) = ∈AP-≥ hyp
rebuild-⊕' : ∀{j k i}
→ {t : View}
→ (a₁ : AdvPath j k)
→ (a₂ : AdvPath k i)
→ ∀{l} → l ∈AP a₂
→ rebuild (a₁ ⊕ a₂) t l ≡ rebuild a₂ t l
rebuild-⊕' AdvDone a₂ hyp = refl
rebuild-⊕' {j} (AdvThere x h a₁) a₂ {l} hyp
with j ≟ℕ l
...| yes nope = ⊥-elim (≤-≢-mon (hop-prog h) (hop-≤ h)
(≤-trans (∈AP-≤ hyp) (lemma1 a₁)) (sym nope))
...| no ok = rebuild-⊕' a₁ a₂ hyp
∈AP-cut : ∀{j k i}
→ (a : AdvPath j i)
→ k ∈AP a
→ Σ (AdvPath j k × AdvPath k i)
(λ { (x , y) → a ≡ x ⊕ y })
∈AP-cut AdvDone hereTgtDone
= (AdvDone , AdvDone) , refl
∈AP-cut (AdvThere d h a) hereTgtThere
= (AdvDone , AdvThere d h a) , refl
∈AP-cut (AdvThere d h a) (step x prf)
with ∈AP-cut a prf
...| xy , ind = (AdvThere d h (proj₁ xy) , proj₂ xy)
, cong (AdvThere d h) ind
∈AP-cut₁ : ∀{j k i}
→ (a : AdvPath j i)
→ k ∈AP a
→ AdvPath k i
∈AP-cut₁ a prf = proj₂ (proj₁ (∈AP-cut a prf))
∈AP-∈-cut
: ∀{j k i}
→ (a : AdvPath j i)
→ (prf : k ∈AP a)
→ ∀{m} → m ∈AP a → m ≤ k
→ m ∈AP (∈AP-cut₁ a prf)
∈AP-∈-cut AdvDone hereTgtDone m∈ap hyp = m∈ap
∈AP-∈-cut (AdvThere _ _ _) hereTgtThere m∈ap hyp = m∈ap
∈AP-∈-cut (AdvThere d h a) (step x prf) hereTgtThere hyp
= ⊥-elim (<⇒≱ (hop-< h) (≤-trans hyp (∈AP-≤ prf)))
∈AP-∈-cut (AdvThere d h a) (step x prf) (step x₁ m∈ap) hyp
= ∈AP-∈-cut a prf m∈ap hyp
∈AP-cut₁-rebuild
: ∀{j k i}
→ (a : AdvPath j i)
→ (prf : k ∈AP a)
→ {s : ℕ} → (s ∈AP (∈AP-cut₁ a prf))
→ ∀{t} → rebuild a t s ≡ rebuild (∈AP-cut₁ a prf) t s
∈AP-cut₁-rebuild a prf s∈cut {t}
with ∈AP-cut a prf
...| (x , y) , refl = rebuild-⊕' x y s∈cut
rebuild-⊕ : ∀{j k i}
→ {t : View}
→ (a₁ : AdvPath j k)
→ (a₂ : AdvPath k i)
→ rebuild (a₁ ⊕ a₂) t k ≡ rebuild a₂ t k
rebuild-⊕ {k = k} a₁ AdvDone = rebuild-⊕' a₁ AdvDone {k} hereTgtDone
rebuild-⊕ {k = k} {i = i} a₁ (AdvThere .{k} d h p) = rebuild-⊕' a₁ (AdvThere d h p) hereTgtThere
∈AP-⊕ : ∀{j i₁ k i₂ i}
→ {e : AdvPath j k}{a₁ : AdvPath k i₁}
→ {a₂ : AdvPath k i₂}
→ i ∈AP (e ⊕ a₁)
→ i ∈AP a₂
→ i ∈AP a₁
∈AP-⊕ {e = AdvDone} hyp1 hyp2 = hyp1
∈AP-⊕ {e = AdvThere x h e} hereTgtThere hyp2
with ≤-antisym (∈AP-≤ hyp2) (lemma1 (AdvThere x h e))
...| refl = ⊥-elim (hop-prog h (≤-antisym (hop-≤ h) (lemma1 e)))
∈AP-⊕ {e = AdvThere x h e} (step x₁ hyp1) hyp2 = ∈AP-⊕ hyp1 hyp2
∈AP-point' : ∀{j k i}
→ {a₁ : AdvPath j k}
→ {a₂ : AdvPath k i}
→ {m : ℕ} → m ∈AP a₁ → m ∈AP a₂
→ m ≡ k
∈AP-point' hereTgtDone h2 = refl
∈AP-point' {a₁ = AdvThere d h a₁} {a₂} hereTgtThere h2
= ⊥-elim (≤-≢-mon (≤-≢-mon (hop-prog h) (hop-≤ h) (lemma1 a₁) ∘ sym)
(∈AP-≤ h2)
(lemma1 (AdvThere d h a₁)) refl)
∈AP-point' (step x h1) h2 = ∈AP-point' h1 h2
∈AP-point'' : ∀{j₁ j₂ i₁ i₂}
→ {a₁ : AdvPath j₁ i₁}
→ {a₂ : AdvPath j₂ i₂}
→ j₂ < i₁
→ {i : ℕ} → i ∈AP a₁ → i ∈AP a₂
→ ⊥
∈AP-point'' j<i hereTgtDone h2
= (<⇒≢ j<i) (≤-antisym (<⇒≤ j<i) (∈AP-≤ h2))
∈AP-point'' {a₁ = a₁} j<i hereTgtThere h2
= (<⇒≢ j<i) (≤-antisym (<⇒≤ j<i) (≤-trans (lemma1 a₁) (∈AP-≤ h2)))
∈AP-point'' j<i (step x h1) h2 = ∈AP-point'' j<i h1 h2
∈AP-point : ∀{j₁ j₂ i₁ i₂}
→ {a₁ : AdvPath j₁ i₁}
→ {a₂ : AdvPath j₂ i₂}
→ j₂ ≤ i₁
→ {i : ℕ} → i ∈AP a₁ → i ∈AP a₂
→ j₂ ≡ i₁ × i ≡ j₂
∈AP-point {j₂ = j₂} {i₁ = i₁} j₂≤i₁ h1 h2
with j₂ ≟ℕ i₁
...| no abs = ⊥-elim (∈AP-point'' (≤∧≢⇒< j₂≤i₁ abs) h1 h2)
...| yes refl = refl , ∈AP-point' h1 h2
∈AP-AdvDone-≡ : ∀{i j}
→ i ∈AP (AdvDone {j})
→ i ≡ j
∈AP-AdvDone-≡ hereTgtDone = refl
-- It is important that we can split proofs. Here, we know that 'a'
-- and the guide are proofs that come from jump from the same source, j.
split-⊕ : ∀{J j i}
→ {H : HopFrom J}
→ {h : HopFrom j}
→ j ≤ J
→ hop-tgt H < hop-tgt h
→ i ≤ hop-tgt H
→ (a : AdvPath (hop-tgt h) i)
→ Σ (AdvPath (hop-tgt h) (hop-tgt H) × AdvPath (hop-tgt H) i)
(λ { (x , y) → a ≡ x ⊕ y })
split-⊕ j≤J H<h i≤H AdvDone
= ⊥-elim (≤-≢-mon (<⇒≢ H<h) (<⇒≤ H<h) i≤H refl)
split-⊕ {i = i} {H} {h} j≤J H<h i≤H (AdvThere d h' a)
with hop-tgt h' ≟ℕ hop-tgt H
...| yes sameHop = (AdvThere d h' (subst (AdvPath (hop-tgt h')) sameHop AdvDone)
, subst (λ P → AdvPath P i) sameHop a)
, aux sameHop a
where
aux : ∀{i j k}{h : HopFrom j} → (stop : hop-tgt h ≡ k)
→ (a : AdvPath (hop-tgt h) i)
→ AdvThere d h a
≡ (AdvThere d h (subst (AdvPath (hop-tgt h)) stop AdvDone)
⊕ subst (λ P → AdvPath P i) stop a)
aux refl a = refl
...| no diffHop
with ≤-total (hop-tgt h') (hop-tgt H)
...| inj₁ crossover with hops-nested-or-nonoverlapping (≤∧≢⇒< crossover diffHop)
H<h
...| abs = ⊥-elim (≤-≢-mon (mmm (hop-≤ h) (hop-prog h) j≤J) (≤-trans (hop-≤ h) j≤J) abs refl)
where mmm : ∀{h j J} → h ≤ j → h ≢ j → j ≤ J → h ≢ J
mmm h≤j h≢j j≤J refl = h≢j (≤-antisym h≤j j≤J)
split-⊕ {i = i} {H} {h} j≤J H<h i≤H (AdvThere d h' a)
| no diffHop
| inj₂ go
with split-⊕ {H = H} (≤-trans (hop-≤ h) j≤J) (≤∧≢⇒< go (diffHop ∘ sym)) i≤H a
...| ((x , y) , prf) = (AdvThere d h' x , y) , cong (AdvThere d h') prf
---------------------
-- Evolutionary CR --
---------------------
-- The type 'AgreeOnCommon t₁ t₂ a₁ a₂', or 'AOC' for short, is inhabited if
-- and only if the advancement proofs a₁ and a₂ agree on the hash they rebuild
-- for every index that is visited by both. Moreover, the views must also
-- agree on the dependencies of said indexes.
data AOC (t₁ t₂ : View)
: ∀{i₁ i₂ j} → AdvPath j i₁ → AdvPath j i₂ → Set where
PDoneDone : ∀{i} → t₁ i ≡ t₂ i → AOC t₁ t₂ {i} {i} AdvDone AdvDone
-- h
-- ⌜⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⌝
-- | |
-- | ⌜⁻⁻⁻ a₁ ⁻⁻⁻⁻|
-- | | |
-- i₂ ⋯ hop-tgt h ≤ i₁ j
PDoneL : ∀{j i₁ i₂}{d}{h : HopFrom j}
→ (a₁ : AdvPath j i₁)
→ (a₂ : AdvPath (hop-tgt h) i₂)
→ hop-tgt h ≤ i₁
→ rebuild a₁ t₁ j ≡ rebuild (AdvThere d h a₂) t₂ j
→ AOC t₁ t₂ a₁ (AdvThere d h a₂)
PDoneR : ∀{j i₁ i₂}{d}{h : HopFrom j}
→ (a₁ : AdvPath (hop-tgt h) i₁)
→ (a₂ : AdvPath j i₂)
→ hop-tgt h ≤ i₂
→ rebuild (AdvThere d h a₁) t₁ j ≡ rebuild a₂ t₂ j
→ AOC t₁ t₂ (AdvThere d h a₁) a₂
PCong : ∀{j i₁ i₂}{d}{h : HopFrom j}
→ i₁ ≤ i₂
→ (a₁ : AdvPath (hop-tgt h) i₁)
→ (a₂ : AdvPath (hop-tgt h) i₂)
→ Agree (rebuild a₁ t₁) (rebuild a₂ t₂) (depsof j)
→ AOC t₁ t₂ a₁ a₂
→ AOC t₁ t₂ (AdvThere d h a₁)
(AdvThere d h a₂)
PMeetR : ∀{j i₁ i₂ d}{h₁ h₂ : HopFrom j}
→ (e : AdvPath (hop-tgt h₁) (hop-tgt h₂))
→ (a₁ : AdvPath (hop-tgt h₂) i₁)
→ (a₂ : AdvPath (hop-tgt h₂) i₂)
→ hop-tgt h₂ < hop-tgt h₁
→ Agree (rebuild (e ⊕ a₁) t₁) (rebuild a₂ t₂) (depsof j)
→ AOC t₁ t₂ a₁ a₂
→ AOC t₁ t₂ (AdvThere d h₁ (e ⊕ a₁))
(AdvThere d h₂ a₂)
PMeetL : ∀{j i₁ i₂ d}{h₁ h₂ : HopFrom j}
→ (e : AdvPath (hop-tgt h₂) (hop-tgt h₁))
→ (a₁ : AdvPath (hop-tgt h₁) i₁)
→ (a₂ : AdvPath (hop-tgt h₁) i₂)
→ hop-tgt h₁ < hop-tgt h₂
→ Agree (rebuild a₁ t₁) (rebuild (e ⊕ a₂) t₂) (depsof j)
→ AOC t₁ t₂ a₁ a₂
→ AOC t₁ t₂ (AdvThere d h₁ a₁)
(AdvThere d h₂ (e ⊕ a₂))
-- We use the 'TERMINATING' pragma because we use a recursive call on
-- an argument that Agda can't infer being structurally smaller.
-- TODO-1: provide clear and detailed explanation of this, which argument, why smaller?
-- An interesting longer-term TODO-2 would be to use 'Sized Types' to inform
-- the typechecker of this fact, or perhaps a custom-made moral equivalent.
{-# TERMINATING #-}
aoc : ∀{i₁ i₂ j}
→ i₁ ≤ i₂ -- wlog
→ (t₁ t₂ : View)(a₁ : AdvPath j i₁)(a₂ : AdvPath j i₂)
→ rebuild a₁ t₁ j ≡ rebuild a₂ t₂ j
→ HashBroke ⊎ AOC t₁ t₂ a₁ a₂
aoc _ t1 t2 AdvDone AdvDone hip
= inj₂ (PDoneDone hip)
aoc _ t1 t2 AdvDone (AdvThere x h a2) hip
= inj₂ (PDoneL AdvDone a2 (hop-≤ h) hip)
aoc _ t1 t2 (AdvThere x h a1) AdvDone hip
= inj₂ (PDoneR a1 AdvDone (hop-≤ h) hip)
aoc {i₁} {i₂} {j} k t₁ t₂ (AdvThere d₁ h₁ a₁) (AdvThere d₂ h₂ a₂) hip
with ≤-total i₂ (hop-tgt h₁)
...| inj₂ h₁≤i₂ = inj₂ (PDoneR a₁ (AdvThere d₂ h₂ a₂) h₁≤i₂ hip)
...| inj₁ go
rewrite ≟ℕ-refl j
with auth-inj-1 {j} {d₁} {d₂} (lemma3 h₁ a₁) hip
...| inj₁ hb = inj₁ hb
...| inj₂ refl
with auth-inj-2 {j} {d₁} (rebuild a₁ t₁) (rebuild a₂ t₂) hip
...| inj₁ hb = inj₁ hb
...| inj₂ agree
with h₁ ≟Hop h₂
...| yes refl
with witness (hop-tgt-is-dep h₁) agree
...| wit rewrite (≟ℕ-refl (hop-tgt h₁))
with aoc k t₁ t₂ a₁ a₂ wit
...| inj₁ hb = inj₁ hb
...| inj₂ rec = inj₂ (PCong k a₁ a₂ agree rec)
aoc {i₁} {i₂} {j} k t₁ t₂ (AdvThere d₁ h₁ a₁) (AdvThere d₂ h₂ a₂) hip
| inj₁ go
| inj₂ refl
| inj₂ agree
| no diffHop
with ≤-total (hop-tgt h₁) (hop-tgt h₂)
...| inj₁ h₁<h₂ with split-⊕ ≤-refl (≤∧≢⇒< h₁<h₂ (diffHop ∘ hop-tgt-inj)) go a₂
...| ((x , y) , refl)
with aoc k t₁ t₂ a₁ y (trans (witness (hop-tgt-is-dep h₁) agree) (rebuild-⊕ x y))
...| inj₁ hb = inj₁ hb
...| inj₂ res = inj₂ (PMeetL x a₁ y (≤∧≢⇒< h₁<h₂ (diffHop ∘ hop-tgt-inj)) agree res)
aoc {j = j} k t₁ t₂ (AdvThere d₁ h₁ a₁) (AdvThere d₂ h₂ a₂) hip
| inj₁ go
| inj₂ refl
| inj₂ agree
| no diffHop
| inj₂ h₂<h₁ with split-⊕ ≤-refl (≤∧≢⇒< h₂<h₁ (diffHop ∘ hop-tgt-inj ∘ sym))
(≤-trans k (lemma1 a₂)) a₁
...| ((x , y) , refl)
with aoc k t₁ t₂ y a₂ (trans (sym (rebuild-⊕ x y))
(witness (hop-tgt-is-dep h₂) agree))
...| inj₁ hb = inj₁ hb
...| inj₂ res = inj₂ (PMeetR x y a₂ (≤∧≢⇒< h₂<h₁ (diffHop ∘ hop-tgt-inj ∘ sym)) agree res)
-- TODO: rename AGREEONCOMMON for consistency with paper, or comment to make connection
aoc-correct : ∀{j i₁ i₂}{a₁ : AdvPath j i₁}{a₂ : AdvPath j i₂}
→ {t₁ t₂ : View}
→ AOC t₁ t₂ a₁ a₂
→ {i : ℕ} → i ∈AP a₁ → i ∈AP a₂
→ HashBroke ⊎ rebuild a₁ t₁ i ≡ rebuild a₂ t₂ i
aoc-correct (PDoneDone x) hereTgtDone hereTgtDone = inj₂ x
aoc-correct (PDoneL a₁ a₂ x x₁) hyp1 hereTgtThere = inj₂ x₁
aoc-correct {j} {t₁ = t₁} {t₂} (PDoneL {d = d} {h} a₁ a₂ x x₁) {i} hyp1 (step x₂ hyp2)
with j ≟ℕ i
...| yes nope = ⊥-elim (x₂ (sym nope))
...| no ok
with a₁
...| AdvDone rewrite ∈AP-AdvDone-≡ hyp1 = ⊥-elim (x₂ refl)
...| AdvThere d₁ h₁ a₁'
with ∈AP-point x hyp1 hyp2
...| refl , refl
with j ≟ℕ hop-tgt h
...| yes nope = ⊥-elim (x₂ (sym nope))
...| no ok' rewrite ≟ℕ-refl j
with auth-inj-1 {h₁ = d₁} {d} (HopFrom≢0 h) x₁
...| inj₁ hb = inj₁ hb
...| inj₂ refl
with auth-inj-2 {j} {d₁} (rebuild a₁' t₁) (rebuild a₂ t₂) x₁
...| inj₁ hb = inj₁ hb
...| inj₂ r = inj₂ (witness (hop-tgt-is-dep h) r)
aoc-correct (PDoneR a₁ a₂ x x₁) hereTgtThere hyp2 = inj₂ x₁
aoc-correct {j} {t₁ = t₁} {t₂} (PDoneR {d = d} {h} a₁ a₂ x x₁) {i} (step x₂ hyp1) hyp2
with j ≟ℕ i
...| yes nope = ⊥-elim (x₂ (sym nope))
...| no ok
with a₂
...| AdvDone rewrite ∈AP-AdvDone-≡ hyp2 = ⊥-elim (x₂ refl)
...| AdvThere d₂ h₂ a₂'
with ∈AP-point x hyp2 hyp1
...| refl , refl
with j ≟ℕ hop-tgt h
...| yes nope = ⊥-elim (x₂ (sym nope))
...| no ok' rewrite ≟ℕ-refl j
with auth-inj-1 {h₁ = d₂} {d} (HopFrom≢0 h) (sym x₁)
...| inj₁ hb = inj₁ hb
...| inj₂ refl
with auth-inj-2 {j} {d₂} (rebuild a₁ t₁) (rebuild a₂' t₂) x₁
...| inj₁ hb = inj₁ hb
...| inj₂ r = inj₂ (witness (hop-tgt-is-dep h) r)
aoc-correct {j} {t₁ = t₁} {t₂} (PCong x a₁ a₂ x₁ aoc₁) hereTgtThere hereTgtThere
rewrite ≟ℕ-refl j
| List-map-≡-All (rebuild a₁ t₁) (rebuild a₂ t₂) (depsof j) x₁
= inj₂ refl
aoc-correct (PCong x a₁ a₂ x₁ aoc₁) hereTgtThere (step x₂ hyp2)
= ⊥-elim (x₂ refl)
aoc-correct (PCong x a₁ a₂ x₁ aoc₁) (step x₂ hyp1) hereTgtThere
= ⊥-elim (x₂ refl)
aoc-correct {j} (PCong x a₁ a₂ x₁ aoc₁) {i} (step x₂ hyp1) (step x₃ hyp2)
with j ≟ℕ i
...| yes nope = ⊥-elim (x₂ (sym nope))
...| no ok = aoc-correct aoc₁ hyp1 hyp2
aoc-correct {j} {t₁ = t₁} {t₂} (PMeetR e a₁ a₂ x₁ x₂ aoc₁) hereTgtThere hereTgtThere
rewrite ≟ℕ-refl j
| List-map-≡-All (rebuild (e ⊕ a₁) t₁) (rebuild a₂ t₂) (depsof j) x₂
= inj₂ refl
aoc-correct (PMeetR e a₁ a₂ x₁ x₂ aoc₁) hereTgtThere (step x₃ hyp2)
= ⊥-elim (x₃ refl)
aoc-correct (PMeetR e a₁ a₂ x₁ x₂ aoc₁) (step x₃ hyp1) hereTgtThere
= ⊥-elim (x₃ refl)
aoc-correct {j} (PMeetR e a₁ a₂ x₁ x₂ aoc₁) {i} (step x₃ hyp1) (step x₄ hyp2)
with j ≟ℕ i
...| yes nope = ⊥-elim (x₃ (sym nope))
...| no ok
with aoc-correct aoc₁ (∈AP-⊕ hyp1 hyp2) hyp2
...| inj₁ hb = inj₁ hb
...| inj₂ r = inj₂ (trans (rebuild-⊕' e a₁ (∈AP-⊕ hyp1 hyp2)) r)
aoc-correct {j} {t₁ = t₁} {t₂} (PMeetL e a₁ a₂ x₁ x₂ aoc₁) hereTgtThere hereTgtThere
rewrite ≟ℕ-refl j
| List-map-≡-All (rebuild a₁ t₁) (rebuild (e ⊕ a₂) t₂) (depsof j) x₂
= inj₂ refl
aoc-correct (PMeetL e a₁ a₂ x₁ x₂ aoc₁) hereTgtThere (step x₃ hyp2)
= ⊥-elim (x₃ refl)
aoc-correct (PMeetL e a₁ a₂ x₁ x₂ aoc₁) (step x₃ hyp1) hereTgtThere
= ⊥-elim (x₃ refl)
aoc-correct {j} (PMeetL e a₁ a₂ x₁ x₂ aoc₁) {i} (step x₃ hyp1) (step x₄ hyp2)
with j ≟ℕ i
...| yes nope = ⊥-elim (x₃ (sym nope))
...| no ok
with aoc-correct aoc₁ hyp1 (∈AP-⊕ hyp2 hyp1)
...| inj₁ hb = inj₁ hb
...| inj₂ r = inj₂ (trans r (sym (rebuild-⊕' e a₂ (∈AP-⊕ hyp2 hyp1))))
AgreeOnCommon : ∀{j i₁ i₂}
→ {t₁ t₂ : View}
→ (a₁ : AdvPath j i₁)(a₂ : AdvPath j i₂)
→ rebuild a₁ t₁ j ≡ rebuild a₂ t₂ j
→ {i : ℕ} → i ∈AP a₁ → i ∈AP a₂
→ HashBroke ⊎ rebuild a₁ t₁ i ≡ rebuild a₂ t₂ i
AgreeOnCommon {i₁ = i₁} {i₂} {t₁} {t₂} a₁ a₂ rebuild-to-j i∈a₁ i∈a₂
with ≤-total i₁ i₂
...| inj₁ i₁≤i₂ with aoc i₁≤i₂ t₁ t₂ a₁ a₂ rebuild-to-j
...| inj₁ hb = inj₁ hb
...| inj₂ xx = aoc-correct xx i∈a₁ i∈a₂
AgreeOnCommon {i₁ = i₁} {i₂} {t₁} {t₂} a₁ a₂ rebuild-to-j i∈a₁ i∈a₂
| inj₂ i₂≤i₁ with aoc i₂≤i₁ t₂ t₁ a₂ a₁ (sym rebuild-to-j)
...| inj₁ hb = inj₁ hb
...| inj₂ xx with aoc-correct xx i∈a₂ i∈a₁
...| inj₁ hb = inj₁ hb
...| inj₂ xx1 = inj₂ (sym xx1)
AgreeOnCommon-∈ : ∀{j₁ j₂ i₁ i₂}
→ {t₁ t₂ : View}
→ (a₁ : AdvPath j₁ i₁)(a₂ : AdvPath j₂ i₂)
→ j₂ ∈AP a₁
→ rebuild a₁ t₁ j₂ ≡ rebuild a₂ t₂ j₂
→ {i : ℕ} → i ∈AP a₁ → i ∈AP a₂
→ HashBroke ⊎ rebuild a₁ t₁ i ≡ rebuild a₂ t₂ i
AgreeOnCommon-∈ a₁ a₂ j2∈a1 hyp ia1 ia2
with ∈AP-cut a₁ j2∈a1
...| ((a₁₁ , a₁₂) , refl)
with AgreeOnCommon a₁₂ a₂ (trans (sym (rebuild-⊕' a₁₁ a₁₂ ∈AP-src)) hyp) (∈AP-⊕ ia1 ia2) ia2
...| inj₁ hb = inj₁ hb
...| inj₂ res = inj₂ (trans (rebuild-⊕' a₁₁ a₁₂ (∈AP-⊕ ia1 ia2)) res)
-----------------------
-- Membership Proofs --
-----------------------
-- A membership proof for i is simply an advancement proof from j to i,
-- a digest of the data in i and the authenticators that i depends on (which
-- come in the view)
MembershipProof : ℕ → ℕ → Set
MembershipProof j i = AdvPath j i × Hash × i ≢ 0
mbr-datum : ∀{j i} → MembershipProof j i → Hash
mbr-datum (_ , d , _) = d
mbr-proof : ∀{j i} → MembershipProof j i → AdvPath j i
mbr-proof (p , _ , _) = p
mbr-not-init : ∀{j i} → MembershipProof j i → i ≢ 0
mbr-not-init (_ , _ , m) = m
-- Rebuilding it is the same as rebuilding an advancement proof, but we
-- explicitely compute the authenticator at i.
rebuildMP : ∀{j i} → MembershipProof j i → View → View
rebuildMP {j} {i} mbr t = rebuild (mbr-proof mbr)
(t ∪₁ (i , auth i (mbr-datum mbr) t))
semi-evo-cr : ∀{j i₁ i₂}{t₁ t₂ : View}
→ (a₁ : AdvPath j i₁)
→ (a₂ : AdvPath j i₂)
→ rebuild a₁ t₁ j ≡ rebuild a₂ t₂ j
→ ∀{s₁ s₂ tgt}{u₁ u₂ : View}
→ (m₁ : MembershipProof s₁ tgt)(m₂ : MembershipProof s₂ tgt)
→ s₁ ∈AP a₁ → s₂ ∈AP a₂
→ tgt ∈AP a₁ → tgt ∈AP a₂
→ tgt ≢ 0
→ rebuildMP m₁ u₁ s₁ ≡ rebuild a₁ t₁ s₁
→ rebuildMP m₂ u₂ s₂ ≡ rebuild a₂ t₂ s₂
→ HashBroke ⊎ (mbr-datum m₁ ≡ mbr-datum m₂)
semi-evo-cr {t₁ = t₁} {t₂} a₁ a₂ hyp {tgt = tgt} {u₁} {u₂} m₁ m₂ s₁∈a₁ s₂∈a₂ t∈a₁ t∈a₂ t≢0 c₁ c₂
with AgreeOnCommon (mbr-proof m₁) (∈AP-cut₁ a₁ s₁∈a₁)
(trans c₁ (∈AP-cut₁-rebuild a₁ s₁∈a₁ ∈AP-src {t₁}))
∈AP-tgt (∈AP-∈-cut a₁ s₁∈a₁ t∈a₁ (lemma1 (mbr-proof m₁)))
...| inj₁ hb = inj₁ hb
...| inj₂ hyp1
with AgreeOnCommon (mbr-proof m₂) (∈AP-cut₁ a₂ s₂∈a₂)
(trans c₂ (∈AP-cut₁-rebuild a₂ s₂∈a₂ ∈AP-src {t₂}))
∈AP-tgt (∈AP-∈-cut a₂ s₂∈a₂ t∈a₂ (lemma1 (mbr-proof m₂)))
...| inj₁ hb = inj₁ hb
...| inj₂ hyp2
with AgreeOnCommon a₁ a₂ hyp t∈a₁ t∈a₂
...| inj₁ hb = inj₁ hb
...| inj₂ hyp3
rewrite sym (∈AP-cut₁-rebuild a₁ s₁∈a₁
(∈AP-∈-cut a₁ s₁∈a₁ t∈a₁ (lemma1 (mbr-proof m₁))) {t₁})
| sym (∈AP-cut₁-rebuild a₂ s₂∈a₂
(∈AP-∈-cut a₂ s₂∈a₂ t∈a₂ (lemma1 (mbr-proof m₂))) {t₂})
with trans hyp1 (trans hyp3 (sym hyp2))
...| half with rebuild-tgt-lemma (mbr-proof m₁)
{u₁ ∪₁ (tgt , auth tgt (mbr-datum m₁) u₁) }
| rebuild-tgt-lemma (mbr-proof m₂)
{u₂ ∪₁ (tgt , auth tgt (mbr-datum m₂) u₂) }
...| l1 | l2
rewrite ≟ℕ-refl tgt = auth-inj-1 {tgt} {mbr-datum m₁} {mbr-datum m₂} t≢0 (trans (sym l1) (trans half l2))
|
oeis/126/A126930.asm | neoneye/loda-programs | 11 | 178955 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A126930: Inverse binomial transform of A005043.
; 1,-1,2,-3,6,-10,20,-35,70,-126,252,-462,924,-1716,3432,-6435,12870,-24310,48620,-92378,184756,-352716,705432,-1352078,2704156,-5200300,10400600,-20058300,40116600,-77558760,155117520,-300540195,601080390,-1166803110,2333606220,-4537567650,9075135300,-17672631900,35345263800,-68923264410,137846528820,-269128937220,538257874440,-1052049481860,2104098963720,-4116715363800,8233430727600,-16123801841550,32247603683100,-63205303218876,126410606437752,-247959266474052,495918532948104,-973469712824056
mov $1,$0
div $1,2
mov $2,-1
pow $2,$0
bin $0,$1
mul $0,$2
|
src/qweyboard/qweyboard-languages-parser.ads | kqr/qweyboard | 33 | 26077 | <gh_stars>10-100
private with Unicode_Strings;
private with Ada.Finalization;
private with Logging;
package Qweyboard.Languages.Parser is
-- <language spec> ::= <section> *
-- <section> ::= '.' <section type>
-- <section type> ::= <substitutions> | <keys>
-- <substitutions> ::= <substitution type> NL <substitution body> *
-- <substitution type> ::= 'left' | 'middle' | 'right'
-- <substitution body> ::= <string> '=' <string> NL
-- <string> ::= <character> *
-- <keys> ::= <key name> NL <keys body>*
-- <keys body> ::= <key name> '=' <character> NL
-- <key name> ::= 'LZ' | 'RJ' | 'MSHI' | 'NOKEY' | ...
-- <character> ::= Is_Graphic
--
-- TOKENS: . = <string>
-- <string> can be special case inits, tails, key name and character
Unexpected_Symbol : exception;
Parse_Error : exception;
procedure Parse (File_Name : String);
private
use Unicode_Strings;
use Unbounded;
use Logging;
type Token_Variant is
(Token_String,
Token_Period,
Token_Equals,
Token_End_Of_File);
type Token_Type (Variant : Token_Variant := Token_End_Of_File) is record
case Variant is
when Token_String =>
String_Value : Unbounded_Wide_Wide_String;
when others =>
null;
end case;
end record;
type Lexer_State is new Ada.Finalization.Limited_Controlled with record
File : IO.File_Type;
Buffer : Unbounded_Wide_Wide_String;
In_String_State : Boolean;
String_Terminator : Wide_Wide_Character;
Current_Token : Token_Type;
Line_Number : Positive := 1;
end record;
procedure Finalize (State : in out Lexer_State);
procedure Advance (State : Lexer_State);
procedure Next_Token (State : in out Lexer_State);
procedure Language_Spec (State : in out Lexer_State);
procedure Section (State : in out Lexer_State);
function New_Section (State : Lexer_State) return Boolean;
procedure Substitutions (State : in out Lexer_State);
procedure Position_Name (State : in out Lexer_State; Position : out Substitution_Type);
procedure Substitution_Body (State : in out Lexer_State; Pattern : out Unbounded_Wide_Wide_String; Replacement : out Unbounded_Wide_Wide_String);
procedure Graphic_String (State : in out Lexer_State; Out_String : out Unbounded_Wide_Wide_String);
procedure Keys (State : in out Lexer_State);
procedure Key_Name (State : in out Lexer_State; Out_Key : out Softkey);
procedure Keys_Body (State : in out Lexer_State; Out_Key : out Softkey; Out_Character : out Wide_Wide_Character);
procedure Graphic_Character (State : in out Lexer_State; Out_Character : out Wide_Wide_Character);
function Expecting (State : Lexer_State; Variant : Token_Variant) return Token_Type;
end Qweyboard.Languages.Parser;
|
tests/mobs-protomobrecord_test_data-protomobrecord_tests.ads | thindil/steamsky | 80 | 12790 | <gh_stars>10-100
-- This package has been generated automatically by GNATtest.
-- Do not edit any part of it, see GNATtest documentation for more details.
-- begin read only
with GNATtest_Generated;
package Mobs.ProtoMobRecord_Test_Data.ProtoMobRecord_Tests is
type Test_ProtoMobRecord is new GNATtest_Generated.GNATtest_Standard.Mobs
.ProtoMobRecord_Test_Data
.Test_ProtoMobRecord with
null record;
end Mobs.ProtoMobRecord_Test_Data.ProtoMobRecord_Tests;
-- end read only
|
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_60.asm | ljhsiun2/medusa | 9 | 246915 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x14b5c, %r11
clflush (%r11)
nop
nop
xor $7968, %r13
movw $0x6162, (%r11)
nop
nop
nop
inc %rbp
lea addresses_UC_ht+0xea5c, %rsi
lea addresses_normal_ht+0x14bdc, %rdi
nop
nop
xor $10043, %rbp
mov $75, %rcx
rep movsq
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0x4afc, %rcx
nop
add $7962, %r14
mov $0x6162636465666768, %r13
movq %r13, %xmm0
vmovups %ymm0, (%rcx)
add %rcx, %rcx
lea addresses_WC_ht+0x12e5c, %rcx
xor $8738, %r14
and $0xffffffffffffffc0, %rcx
vmovaps (%rcx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rdi
nop
nop
nop
add %r13, %r13
lea addresses_WT_ht+0x1045c, %rsi
lea addresses_UC_ht+0x66dc, %rdi
nop
nop
nop
nop
sub $51155, %rbx
mov $114, %rcx
rep movsl
nop
nop
cmp $28778, %rcx
lea addresses_WT_ht+0x1eeb8, %r11
nop
nop
nop
nop
add $57789, %r14
movb $0x61, (%r11)
nop
nop
nop
inc %rsi
lea addresses_normal_ht+0x1e5dc, %rcx
nop
nop
nop
cmp %rbp, %rbp
movups (%rcx), %xmm7
vpextrq $1, %xmm7, %rbx
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_UC_ht+0xe05c, %r11
nop
nop
dec %rdi
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
and $0xffffffffffffffc0, %r11
vmovntdq %ymm5, (%r11)
nop
nop
nop
xor $8253, %r14
lea addresses_WT_ht+0xd05c, %rsi
lea addresses_UC_ht+0xcc5c, %rdi
nop
nop
nop
cmp %rbx, %rbx
mov $17, %rcx
rep movsw
nop
nop
nop
nop
nop
xor $26289, %rsi
lea addresses_normal_ht+0xab0c, %r11
nop
add $62000, %rbp
movups (%r11), %xmm4
vpextrq $1, %xmm4, %rsi
nop
nop
nop
add %r14, %r14
lea addresses_UC_ht+0xf05c, %rsi
lea addresses_UC_ht+0x15c5c, %rdi
nop
nop
and %r11, %r11
mov $65, %rcx
rep movsb
nop
nop
nop
xor $4058, %rcx
lea addresses_WT_ht+0x985c, %r13
nop
nop
and %rsi, %rsi
mov (%r13), %rbx
nop
nop
nop
sub $49862, %rbx
lea addresses_WC_ht+0x1a85c, %rcx
and %r11, %r11
movb $0x61, (%rcx)
nop
nop
nop
nop
cmp %r11, %r11
lea addresses_WT_ht+0x19a5c, %rbx
nop
nop
xor $19008, %rcx
movb $0x61, (%rbx)
nop
nop
nop
cmp %rsi, %rsi
lea addresses_WT_ht+0x1935c, %rbp
nop
nop
nop
nop
nop
sub $4108, %rdi
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
vmovups %ymm4, (%rbp)
nop
nop
nop
nop
dec %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r14
push %r8
push %rbp
push %rsi
// Store
lea addresses_A+0x19d5c, %rsi
sub $24845, %r12
mov $0x5152535455565758, %r13
movq %r13, %xmm2
and $0xffffffffffffffc0, %rsi
vmovntdq %ymm2, (%rsi)
nop
nop
nop
xor $4252, %rbp
// Store
lea addresses_WT+0x16c5c, %r14
nop
nop
nop
nop
nop
and %r10, %r10
mov $0x5152535455565758, %r8
movq %r8, %xmm7
vmovups %ymm7, (%r14)
nop
nop
nop
nop
nop
sub %rsi, %rsi
// Load
lea addresses_UC+0xf65c, %r10
clflush (%r10)
nop
nop
nop
nop
nop
sub $2475, %r14
mov (%r10), %si
nop
nop
xor %r13, %r13
// Store
lea addresses_RW+0x17240, %r14
nop
nop
nop
nop
nop
cmp $41888, %r8
movl $0x51525354, (%r14)
nop
nop
nop
add %rsi, %rsi
// Store
lea addresses_PSE+0x1cd1c, %r14
nop
nop
nop
nop
nop
cmp $51033, %r12
mov $0x5152535455565758, %rsi
movq %rsi, %xmm3
movups %xmm3, (%r14)
nop
nop
nop
nop
nop
sub $5008, %r8
// Faulty Load
lea addresses_WT+0x1585c, %rsi
nop
nop
nop
nop
nop
add $14028, %r14
movups (%rsi), %xmm3
vpextrq $0, %xmm3, %r10
lea oracles, %rbp
and $0xff, %r10
shlq $12, %r10
mov (%rbp,%r10,1), %r10
pop %rsi
pop %rbp
pop %r8
pop %r14
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 7, 'type': 'addresses_A', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WT', 'AVXalign': False, 'size': 32}}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_RW', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 16}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2}}
{'src': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}}
{'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 32}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}}
{'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 11, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}}
{'src': {'same': True, 'congruent': 5, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}}
{'src': {'NT': True, 'same': False, 'congruent': 11, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}}
{'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
*/
|
project/adl/components/src/io_expander/MCP23xxx/mcp23x08.adb | corentingay/ada_epita | 2 | 28962 | <reponame>corentingay/ada_epita
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with HAL.GPIO; use HAL.GPIO;
package body MCP23x08 is
function To_UInt8 is
new Ada.Unchecked_Conversion (Source => ALl_IO_Array,
Target => UInt8);
function To_All_IO_Array is
new Ada.Unchecked_Conversion (Source => UInt8,
Target => ALl_IO_Array);
procedure Loc_IO_Write
(This : in out MCP23x08_IO_Expander'Class;
WriteAddr : Register_Address;
Value : UInt8)
with Inline_Always;
procedure Loc_IO_Read
(This : MCP23x08_IO_Expander'Class;
ReadAddr : Register_Address;
Value : out UInt8)
with Inline_Always;
procedure Set_Bit
(This : in out MCP23x08_IO_Expander;
RegAddr : Register_Address;
Pin : MCP23x08_Pin);
procedure Clear_Bit
(This : in out MCP23x08_IO_Expander;
RegAddr : Register_Address;
Pin : MCP23x08_Pin);
function Read_Bit
(This : MCP23x08_IO_Expander;
RegAddr : Register_Address;
Pin : MCP23x08_Pin)
return Boolean;
------------------
-- Loc_IO_Write --
------------------
procedure Loc_IO_Write
(This : in out MCP23x08_IO_Expander'Class;
WriteAddr : Register_Address;
Value : UInt8)
is
begin
IO_Write (This, WriteAddr, Value);
end Loc_IO_Write;
-----------------
-- Loc_IO_Read --
-----------------
procedure Loc_IO_Read
(This : MCP23x08_IO_Expander'Class;
ReadAddr : Register_Address;
Value : out UInt8)
is
begin
IO_Read (This, ReadAddr, Value);
end Loc_IO_Read;
-------------
-- Set_Bit --
-------------
procedure Set_Bit
(This : in out MCP23x08_IO_Expander;
RegAddr : Register_Address;
Pin : MCP23x08_Pin)
is
Prev, Next : UInt8;
begin
Loc_IO_Read (This, RegAddr, Prev);
Next := Prev or Pin'Enum_Rep;
if Next /= Prev then
Loc_IO_Write (This, RegAddr, Next);
end if;
end Set_Bit;
---------------
-- Clear_Bit --
---------------
procedure Clear_Bit
(This : in out MCP23x08_IO_Expander;
RegAddr : Register_Address;
Pin : MCP23x08_Pin)
is
Prev, Next : UInt8;
begin
Loc_IO_Read (This, RegAddr, Prev);
Next := Prev and (not Pin'Enum_Rep);
if Next /= Prev then
Loc_IO_Write (This, RegAddr, Next);
end if;
end Clear_Bit;
--------------
-- Read_Bit --
--------------
function Read_Bit
(This : MCP23x08_IO_Expander;
RegAddr : Register_Address;
Pin : MCP23x08_Pin)
return Boolean
is
Reg : UInt8;
begin
Loc_IO_Read (This, RegAddr, Reg);
return (Reg and Pin'Enum_Rep) /= 0;
end Read_Bit;
---------------
-- Configure --
---------------
procedure Configure (This : in out MCP23x08_IO_Expander;
Pin : MCP23x08_Pin;
Output : Boolean;
Pull_Up : Boolean)
is
begin
This.Configure_Mode (Pin, Output);
This.Configure_Pull (Pin, Pull_Up);
end Configure;
procedure Configure_Mode (This : in out MCP23x08_IO_Expander;
Pin : MCP23x08_Pin;
Output : Boolean)
is
begin
if Output then
Clear_Bit (This, IO_DIRECTION_REG, Pin);
else
Set_Bit (This, IO_DIRECTION_REG, Pin);
end if;
end Configure_Mode;
---------------
-- Is_Output --
---------------
function Is_Output (This : in out MCP23x08_IO_Expander;
Pin : MCP23x08_Pin)
return Boolean
is
begin
return not Read_Bit (This, IO_DIRECTION_REG, Pin);
end Is_Output;
--------------------
-- Configure_Pull --
--------------------
procedure Configure_Pull (This : in out MCP23x08_IO_Expander;
Pin : MCP23x08_Pin;
Pull_Up : Boolean)
is
begin
if Pull_Up then
Set_Bit (This, PULL_UP_REG, Pin);
else
Clear_Bit (This, PULL_UP_REG, Pin);
end if;
end Configure_Pull;
-------------
-- Pull_Up --
-------------
function Pull_Up (This : MCP23x08_IO_Expander;
Pin : MCP23x08_Pin) return Boolean
is
begin
return Read_Bit (This, PULL_UP_REG, Pin);
end Pull_Up;
---------
-- Set --
---------
function Set (This : MCP23x08_IO_Expander;
Pin : MCP23x08_Pin) return Boolean
is
Val : UInt8;
begin
Loc_IO_Read (This, LOGIC_LEVLEL_REG, Val);
return (Pin'Enum_Rep and Val) /= 0;
end Set;
---------
-- Set --
---------
procedure Set (This : in out MCP23x08_IO_Expander;
Pin : MCP23x08_Pin)
is
begin
Set_Bit (This, LOGIC_LEVLEL_REG, Pin);
end Set;
-----------
-- Clear --
-----------
procedure Clear (This : in out MCP23x08_IO_Expander;
Pin : MCP23x08_Pin)
is
begin
Clear_Bit (This, LOGIC_LEVLEL_REG, Pin);
end Clear;
------------
-- Toggle --
------------
procedure Toggle (This : in out MCP23x08_IO_Expander;
Pin : MCP23x08_Pin)
is
begin
if This.Set (Pin) then
This.Clear (Pin);
else
This.Set (Pin);
end if;
end Toggle;
------------
-- All_IO --
------------
function All_IO (This : in out MCP23x08_IO_Expander) return ALl_IO_Array is
Val : UInt8;
begin
Loc_IO_Read (This, LOGIC_LEVLEL_REG, Val);
return To_All_IO_Array (Val);
end All_IO;
----------------
-- Set_All_IO --
----------------
procedure Set_All_IO (This : in out MCP23x08_IO_Expander; IOs : ALl_IO_Array) is
begin
Loc_IO_Write (This, LOGIC_LEVLEL_REG, To_UInt8 (IOs));
end Set_All_IO;
-------------------
-- As_GPIO_Point --
-------------------
function As_GPIO_Point (This : in out MCP23x08_IO_Expander;
Pin : MCP23x08_Pin)
return not null HAL.GPIO.Any_GPIO_Point
is
begin
This.Points (Pin) := (Device => This'Unchecked_Access,
Pin => Pin);
return This.Points (Pin)'Unchecked_Access;
end As_GPIO_Point;
----------
-- Mode --
----------
overriding
function Mode (This : MCP23_GPIO_Point) return HAL.GPIO.GPIO_Mode is
pragma Unreferenced (This);
begin
return HAL.GPIO.Output;
end Mode;
--------------
-- Set_Mode --
--------------
overriding
function Set_Mode (This : in out MCP23_GPIO_Point;
Mode : HAL.GPIO.GPIO_Config_Mode) return Boolean
is
begin
This.Device.Configure_Mode (Pin => This.Pin,
Output => (Mode = HAL.GPIO.Output));
return True;
end Set_Mode;
-------------------
-- Pull_Resistor --
-------------------
overriding
function Pull_Resistor (This : MCP23_GPIO_Point)
return HAL.GPIO.GPIO_Pull_Resistor
is
begin
return (if This.Device.Pull_Up (This.Pin) then
HAL.GPIO.Pull_Up
else
HAL.GPIO.Floating);
end Pull_Resistor;
-----------------------
-- Set_Pull_Resistor --
-----------------------
overriding
function Set_Pull_Resistor (This : in out MCP23_GPIO_Point;
Pull : HAL.GPIO.GPIO_Pull_Resistor)
return Boolean
is
begin
if Pull = HAL.GPIO.Pull_Down then
return False;
else
This.Device.Configure_Pull (This.Pin, Pull = HAL.GPIO.Pull_Up);
return True;
end if;
end Set_Pull_Resistor;
---------
-- Set --
---------
overriding
function Set (This : MCP23_GPIO_Point) return Boolean is
begin
return This.Device.Set (This.Pin);
end Set;
---------
-- Set --
---------
overriding
procedure Set (This : in out MCP23_GPIO_Point) is
begin
This.Device.Set (This.Pin);
end Set;
-----------
-- Clear --
-----------
overriding
procedure Clear (This : in out MCP23_GPIO_Point) is
begin
This.Device.Clear (This.Pin);
end Clear;
------------
-- Toggle --
------------
overriding
procedure Toggle (This : in out MCP23_GPIO_Point) is
begin
This.Device.Toggle (This.Pin);
end Toggle;
end MCP23x08;
|
oeis/097/A097769.asm | neoneye/loda-programs | 11 | 161424 | ; A097769: Pell equation solutions (12*a(n))^2 - 145*b(n)^2 = -1 with b(n):=A097770(n), n >= 0.
; Submitted by <NAME>
; 1,579,334661,193433479,111804216201,64622643530699,37351776156527821,21589261995829549839,12478556081813323279121,7212583826026105025782099,4168860972887006891578774101,2409594429744863957227505648279,1392741411531558480270606685931161,805002126270811056732453436962562779,465289836243117259232877815957675355101,268936720346395505025546645170099392685599,155444959070380358787506728030501491296921121,89846917405959500983673863254984691870227722339
lpb $0
mov $2,$0
sub $0,1
mul $2,2
seq $2,90316 ; a(n) = 24*a(n-1) + a(n-2), starting with a(0) = 2 and a(1) = 24.
add $1,$2
lpe
mov $0,$1
add $0,1
|
source/tasking/a-astaco.ads | ytomino/drake | 33 | 16031 | <reponame>ytomino/drake<filename>source/tasking/a-astaco.ads<gh_stars>10-100
pragma License (Unrestricted);
-- with Ada.Task_Identification;
package Ada.Asynchronous_Task_Control is
pragma Preelaborate;
-- procedure Hold (T : Task_Identification.Task_Id);
-- procedure Continue (T : Task_Identification.Task_Id);
-- function Is_Held (T : Task_Identification.Task_Id)
-- return Boolean;
end Ada.Asynchronous_Task_Control;
|
AppleScript/openQnA.scpt | jgstew/tools | 17 | 4617 | <gh_stars>10-100
-- http://www-01.ibm.com/support/docview.wss?uid=swg21506026
-- https://github.com/jgstew/tools/blob/master/bash/openQnA.sh
-- http://alvinalexander.com/blog/post/mac-os-x/applescript-use-comments
tell application "Terminal"
if not (exists window 1) then reopen
activate
do script "/Library/BESAgent/BESAgent.app/Contents/MacOS/QnA -showtypes" in window 1
end tell
-- http://stackoverflow.com/questions/5288161/converting-to-one-line-applescript
-- osascript -e 'tell application "Terminal"' -e 'if not (exists window 1) then reopen' -e 'activate' -e 'do script "/Library/BESAgent/BESAgent.app/Contents/MacOS/QnA -showtypes" in window 1' -e 'end tell'
|
sk/music-optimized/LBZ2.asm | Cancer52/flamedriver | 9 | 102426 | <gh_stars>1-10
Snd_LBZ2_Header:
smpsHeaderStartSong 3, 1
smpsHeaderVoice Snd_LBZ_Voices
smpsHeaderChan $06, $03
smpsHeaderTempo $01, $2F
smpsHeaderDAC Snd_LBZ2_DAC
smpsHeaderFM Snd_LBZ2_FM1, $00, $0C
smpsHeaderFM Snd_LBZ2_FM2, $0C, $08
smpsHeaderFM Snd_LBZ2_FM3, $00, $0C
smpsHeaderFM Snd_LBZ2_FM4, $00, $0C
smpsHeaderFM Snd_LBZ2_FM5, $0C, $0C
smpsHeaderPSG Snd_LBZ2_PSG1, $F4, $02, $00, $00
smpsHeaderPSG Snd_LBZ2_PSG2, $F4, $04, $00, $00
smpsHeaderPSG Snd_LBZ_PSG3, $00, $02, $00, $00
; FM1 Data
Snd_LBZ2_FM1:
smpsSetvoice $02
dc.b nRst, $60, nRst, nRst, nRst
Snd_LBZ2_Jump05:
dc.b nRst, $60, nRst, nRst, nRst
smpsCall Snd_LBZ2_Call0A
smpsCall Snd_LBZ2_Call0B
dc.b nRst, $60, nRst, nRst, nRst, nRst, nRst, nRst, nRst
Snd_LBZ2_Loop06:
smpsCall Snd_LBZ2_Call0B
smpsLoop $00, $02, Snd_LBZ2_Loop06
dc.b nRst, $0C, nC5, nRst, $48
smpsJump Snd_LBZ2_Jump05
Snd_LBZ2_Call0A:
smpsSetvoice $02
dc.b nRst, $60, nRst, nRst, nRst, $48
smpsSetvoice $03
smpsModSet $06, $01, $12, $01
dc.b nEb5, $0C
smpsModSet $01, $01, $01, $04
dc.b nEb5, $0C
smpsReturn
Snd_LBZ2_Call0B:
smpsSetvoice $02
dc.b nRst, $06, nEb4, nRst, $0C, nEb4, $12, nEb4, $06, nRst, $18, nC4
dc.b $06, nBb3, nG3, nF3, nRst, $18, nEb4, $12, nEb4, $06, nRst, $18
smpsSetvoice $03
smpsModSet $01, $01, $03, $05
dc.b nEb5
smpsModSet $01, $01, $01, $04
smpsSetvoice $02
dc.b nRst, $06, nEb4, nRst, $0C, nEb4, $12, nEb4, $06, nRst, $18, nC4
dc.b $06, nBb3, nG3, nF3
smpsModSet $01, $01, $01, $04
dc.b nRst, $18, nEb4, $12, nEb4, $06, nRst, $18
smpsSetvoice $03
smpsModSet $06, $01, $12, $01
dc.b nEb5, $0C
smpsModSet $01, $01, $01, $04
dc.b nEb5, $0C
smpsReturn
; FM2 Data
Snd_LBZ2_FM2:
smpsSetvoice $00
smpsCall Snd_LBZ2_Call07
smpsLoop $00, $04, Snd_LBZ2_FM2
Snd_LBZ2_Jump04:
dc.b nRst, $60, nRst, nRst, nRst
smpsCall Snd_LBZ2_Call08
smpsCall Snd_LBZ2_Call09
smpsCall Snd_LBZ2_Call08
smpsCall Snd_LBZ2_Call08
dc.b nRst, $60, nRst, nRst, nRst, nRst, nRst, nRst, nRst
smpsCall Snd_LBZ2_Call08
smpsCall Snd_LBZ2_Call09
smpsCall Snd_LBZ2_Call08
smpsCall Snd_LBZ2_Call08
dc.b nC2, nC1, nC3, nRst, $4E
smpsJump Snd_LBZ2_Jump04
Snd_LBZ2_Call07:
dc.b nG1, $12, nD2, nA2, $1E, nD2, $06, nG2, $0C, nD2
smpsReturn
Snd_LBZ2_Call08:
dc.b nC2, $06, nRst, nC2, $0C, nBb1, $12, nA1, $06, nRst, $2A, nA1
dc.b $06, nF1, nRst, nF1, $0C, nFs1, $12, nG1, $06, nRst, $18, nD2
dc.b $0C, nG2, $06, nD2
smpsReturn
Snd_LBZ2_Call09:
dc.b nC2, nRst, nC2, $0C, nBb1, $12, nA1, $06, nRst, $2A, nA1, $06
dc.b nF1, nRst, nF1, $0C, nFs1, $12, nG1, $06, nRst, $18, nD2
smpsReturn
; FM3 Data
Snd_LBZ2_FM3:
smpsSetvoice $03
dc.b nRst, $60, nRst, nRst, nRst
Snd_LBZ2_Jump03:
dc.b nRst, $60, nRst, nRst, nRst
smpsSetvoice $03
smpsCall Snd_LBZ2_Call05
smpsCall Snd_LBZ2_Call06
smpsFMAlterVol $06
smpsModSet $01, $01, $01, $06
smpsSetvoice $01
dc.b nF4, $48, nE4, $18, nD4, $5A, nRst, $06, nF4, $48, nG4, $18
dc.b nD4, $5A, nRst, $06
smpsFMAlterVol $FA
dc.b nRst, $60, nRst, nRst, nRst
Snd_LBZ2_Loop05:
smpsSetvoice $03
smpsCall Snd_LBZ2_Call06
smpsLoop $00, $02, Snd_LBZ2_Loop05
smpsSetvoice $03
dc.b nRst, $0C, nC4, $0C, nRst, $48
smpsJump Snd_LBZ2_Jump03
Snd_LBZ2_Call05:
dc.b nRst, $60, nRst, nRst, $60, nRst, $48
smpsFMAlterVol $03
smpsModSet $06, $01, $12, $01
dc.b nC5, $0C
smpsModSet $01, $01, $01, $04
dc.b nC5, $0C
smpsFMAlterVol $FD
smpsReturn
Snd_LBZ2_Call06:
dc.b nRst, $60, nRst, $48
smpsModSet $01, $01, $03, $05
dc.b nC5, $18
smpsModSet $01, $01, $01, $04
dc.b nRst, $60, nRst, $48
smpsFMAlterVol $03
smpsModSet $06, $01, $12, $01
dc.b nC5, $0C
smpsModSet $01, $01, $01, $04
dc.b nC5, $0C
smpsFMAlterVol $FD
smpsReturn
; FM4 Data
Snd_LBZ2_FM4:
smpsSetvoice $03
dc.b nRst, $60, nRst, nRst, nRst
Snd_LBZ2_Jump02:
dc.b nRst, $60, nRst, nRst, nRst
smpsSetvoice $03
smpsCall Snd_LBZ2_Call03
smpsCall Snd_LBZ2_Call04
smpsFMAlterVol $09
smpsModSet $01, $01, $01, $06
smpsSetvoice $01
dc.b nRst, $05, nF4, $48, nE4, $18, nD4, $5A, nRst, $06, nF4, $48
dc.b nG4, $18, nD4, $55, nRst, $06
smpsFMAlterVol $F7
smpsSetvoice $03
dc.b nRst, $60, nRst, nRst, nRst
Snd_LBZ2_Loop04:
smpsCall Snd_LBZ2_Call04
smpsLoop $00, $02, Snd_LBZ2_Loop04
smpsSetvoice $03
dc.b nRst, $0C, nC4, $0C, nRst, $48
smpsJump Snd_LBZ2_Jump02
Snd_LBZ2_Call03:
dc.b nRst, $60, nRst, nRst, $60, nRst, $48
smpsModSet $06, $01, $12, $01
dc.b nBb4, $0C
smpsModSet $01, $01, $01, $04
dc.b nBb4, $0C
smpsReturn
Snd_LBZ2_Call04:
dc.b nRst, $60, nRst, $48
smpsModSet $01, $01, $03, $05
dc.b nBb4, $18
smpsModSet $01, $01, $01, $04
dc.b nRst, $60, nRst, $48
smpsModSet $06, $01, $12, $01
dc.b nBb4, $0C
smpsModSet $01, $01, $01, $04
dc.b nBb4, $0C
smpsReturn
; FM5 Data
Snd_LBZ2_FM5:
smpsSetvoice $02
dc.b nRst, $60, nRst, nRst, nRst
Snd_LBZ2_Jump01:
dc.b nRst, $60, nRst, nRst, nRst
smpsCall Snd_LBZ2_Call01
smpsCall Snd_LBZ2_Call02
dc.b nRst, $60, nRst, nRst, nRst, nRst, nRst, nRst, nRst
Snd_LBZ2_Loop03:
smpsCall Snd_LBZ2_Call02
smpsLoop $00, $02, Snd_LBZ2_Loop03
dc.b nRst, $0C, nC4, nRst, $48
smpsJump Snd_LBZ2_Jump01
Snd_LBZ2_Call01:
dc.b nRst, $60, nRst, nRst, nRst, $48
smpsSetvoice $03
smpsModSet $06, $01, $12, $01
dc.b nG4, $0C
smpsModSet $01, $01, $01, $04
dc.b nG4, $0C
smpsReturn
Snd_LBZ2_Call02:
smpsSetvoice $02
dc.b nRst, $06, nBb3, $04, nRst, $0E, nBb3, $12, nBb3, $06, nRst, $18
dc.b nRst, $30, nBb3, $12, nBb3, $06, nRst, $18
smpsSetvoice $03
smpsModSet $01, $01, $03, $05
dc.b nG4
smpsModSet $01, $01, $01, $04
smpsSetvoice $02
dc.b nRst, $06, nBb3, $04, nRst, $0E, nBb3, $12, nBb3, $06, nRst, $18
dc.b nRst, $30, nBb3, $12, nBb3, $06, nRst, $18
smpsSetvoice $03
smpsFMAlterVol $05
smpsModSet $06, $01, $12, $01
dc.b nG4, $0C
smpsModSet $01, $01, $01, $04
smpsFMAlterVol $FB
dc.b nG4, $0C
smpsReturn
; PSG1 Data
Snd_LBZ2_PSG1:
smpsNoteFill $05
smpsPSGvoice sTone_11
dc.b nRst, $60, nRst, nRst
smpsCall Snd_LBZ2_Call0D
Snd_LBZ2_Jump06:
smpsCall Snd_LBZ2_Call0D
dc.b nF5, $06, nRst, nG5, nRst, nD5, nRst, nF5, nF5, nRst, nF5, nG5
dc.b nRst, $1E, nRst, $60, nRst, nRst, nRst, nRst, nRst, nRst, nRst, nRst
Snd_LBZ2_Loop0B:
dc.b nRst, $60, nRst
smpsLoop $00, $04, Snd_LBZ2_Loop0B
dc.b nRst, $60, nRst, nRst, nRst, nRst, nRst, nRst, nRst, nRst
smpsJump Snd_LBZ2_Jump06
Snd_LBZ2_Call0D:
dc.b nF5, $06, nRst, nG5, nRst, nD5, nRst, nF5, nF5, nRst, nF5, nG5
dc.b nRst, nD5, nRst, nF5, nRst, nRst, $60
smpsReturn
; PSG2 Data
Snd_LBZ2_PSG2:
dc.b nRst, $01
smpsModChange $01
smpsJump Snd_LBZ2_PSG1
; PSG3 Data
Snd_LBZ_PSG3:
smpsPSGform $E7
Snd_LBZ2_Loop07:
smpsCall Snd_LBZ2_Call0C
smpsLoop $00, $10, Snd_LBZ2_Loop07
Snd_LBZ2_Loop08:
smpsCall Snd_LBZ2_Call0C
smpsLoop $00, $0C, Snd_LBZ2_Loop08
smpsPSGvoice sTone_13
dc.b nRst, $60
Snd_LBZ2_Loop09:
smpsCall Snd_LBZ2_Call0C
smpsLoop $00, $1C, Snd_LBZ2_Loop09
smpsPSGvoice sTone_13
dc.b nRst, $60
Snd_LBZ2_Loop0A:
smpsCall Snd_LBZ2_Call0C
smpsLoop $00, $40, Snd_LBZ2_Loop0A
smpsPSGvoice sTone_02
dc.b nMaxPSG1, $06, nMaxPSG1
smpsPSGvoice sTone_13
dc.b nRst, $54
smpsJump Snd_LBZ2_Loop08
Snd_LBZ2_Call0C:
smpsPSGvoice sTone_02
dc.b nMaxPSG1, $06, nMaxPSG1
smpsPSGvoice sTone_13
dc.b nMaxPSG1, $06
smpsPSGvoice sTone_02
dc.b nMaxPSG1, $06
smpsReturn
; DAC Data
Snd_LBZ2_DAC:
dc.b dModLooseKick, $12, nRst, dModLooseKick, $3C
Snd_LBZ2_Loop00:
dc.b dModLooseKick, $06, dHiHitDrum, nRst, dHiHitDrum, dLowHitDrum, nRst, dModLooseKick, dHiHitDrum, nRst, dHiHitDrum, dLowHitDrum
dc.b dPowerTom, dPowerTom, $18
smpsLoop $00, $02, Snd_LBZ2_Loop00
dc.b dModLooseKick, $0C, dHiWoodBlock, $06, dModLooseKick, dLowWoodBlock, dLowWoodBlock, dModLooseKick, dHiWoodBlock, nRst, dHiWoodBlock, dLowWoodBlock
dc.b dLowWoodBlock, dLowWoodBlock, dLowWoodBlock, dLowWoodBlock, dLowWoodBlock
Snd_LBZ2_Jump00:
smpsCall Snd_LBZ2_Call00
dc.b dModLooseKick, $06, dHiHitDrum, nRst, dModLooseKick, dSnareGo, nRst, dModLooseKick, dHiHitDrum, nRst, dHiHitDrum, dLowHitDrum
dc.b dSnareGo, dSnareGo, nRst, dLowWoodBlock, dLowWoodBlock
smpsCall Snd_LBZ2_Call00
dc.b dModLooseKick, $06, nRst, dHiWoodBlock, nRst, dLowWoodBlock, dLowWoodBlock, dLowWoodBlock, dHiWoodBlock, nRst, nRst, $2A
dc.b dModLooseKick, $12, dModLooseKick, $06, nRst, $12, dModLooseKick, $1E, dMetalCrashHit, $24, dScratchS3, $24
dc.b dPowerTom, $18, dScratchS3
Snd_LBZ2_Loop01:
dc.b dModLooseKick, $0C, dModLooseKick, nRst, $12, dModLooseKick, $06, nRst, $2A, dModLooseKick, $06, dModLooseKick
dc.b $0C, dModLooseKick, nRst, $12, dModLooseKick, $06, nRst, $30
smpsLoop $00, $02, Snd_LBZ2_Loop01
dc.b dModLooseKick, $0C, dModLooseKick, nRst, $12, dModLooseKick, $06, nRst, $2A, dModLooseKick, $06, nRst
dc.b $36, dQuietGlassCrash, $12, dMetalCrashHit, $0B, dMetalCrashHit, $0D
Snd_LBZ2_Loop02:
dc.b dModLooseKick, $06, nRst, dHiHitDrum, dModLooseKick, dLowHitDrum, dLowHitDrum, dModLooseKick, dHiHitDrum, nRst, dHiHitDrum, dLowHitDrum
dc.b dPowerTom, dPowerTom, nRst, dLowHitDrum, nRst, dModLooseKick, $0C, dHiWoodBlock, $06, dModLooseKick, dLowWoodBlock, dLowWoodBlock
dc.b dModLooseKick, dHiWoodBlock, nRst, dHiWoodBlock, dLowWoodBlock, dLowWoodBlock, dLowWoodBlock, dLowWoodBlock, dLowWoodBlock, dLowWoodBlock
smpsLoop $00, $02, Snd_LBZ2_Loop02
dc.b dModLooseKick, $06, dHiHitDrum, nRst, dModLooseKick, dSnareGo, nRst, dModLooseKick, dHiHitDrum, nRst, dHiHitDrum, dLowHitDrum
dc.b dPowerTom, dSnareGo, nRst, dLowWoodBlock, dLowWoodBlock, dModLooseKick, nRst, dHiWoodBlock, dModLooseKick, dSnareGo, nRst, dModLooseKick
dc.b dHiWoodBlock, nRst, dHiWoodBlock, dLowWoodBlock, dSnareGo, dSnareGo, nRst, dLowWoodBlock, dLowWoodBlock, dModLooseKick, $06, dHiHitDrum
dc.b nRst, dModLooseKick, dSnareGo, nRst, dModLooseKick, dHiHitDrum, nRst, dHiHitDrum, dLowHitDrum, dPowerTom, dSnareGo, nRst
dc.b dLowWoodBlock, dLowWoodBlock, dModLooseKick, nRst, dHiWoodBlock, dModLooseKick, dSnareGo, nRst, dModLooseKick, dHiWoodBlock, nRst, dSnareGo
dc.b nRst, dSnareGo, dSnareGo, nRst, dSnareGo, nRst, nRst, $60, nRst, dModLooseKick, $0C, dModLooseKick
dc.b nRst, $48, nRst, $60, dModLooseKick, $06, nRst, dGo, nRst, dModLooseKick, nRst, dGo
dc.b dModLooseKick, nRst, nRst, dGo, nRst, nRst, nRst, dGo, dModLooseKick, dModLooseKick, $06, nRst
dc.b dGo, nRst, dModLooseKick, nRst, dGo, dModLooseKick, nRst, nRst, dGo, nRst, nRst, nRst
dc.b dGo, dModLooseKick, dModLooseKick, nRst, dGo, nRst, dSnareGo, nRst, dGo, dModLooseKick, nRst, nRst
dc.b dGo, nRst, dSnareGo, nRst, dGo, dModLooseKick, dModLooseKick, nRst, dGo, nRst, dSnareGo, nRst
dc.b dGo, dModLooseKick, dModLooseKick, dSnareGo, dGo, dSnareGo, dSnareGo, nRst, dSnareGo, nRst, dModLooseKick, dModLooseKick
dc.b dSnareGo, nRst, $4E
smpsJump Snd_LBZ2_Jump00
Snd_LBZ2_Call00:
dc.b dModLooseKick, $06, dHiHitDrum, nRst, dHiHitDrum, dSnareGo, nRst, dModLooseKick, dHiHitDrum, nRst, dHiHitDrum, dLowHitDrum
dc.b dPowerTom, dSnareGo, nRst, dLowWoodBlock, dLowWoodBlock
smpsReturn
Snd_LBZ_Voices:
; Voice $00
; $03
; $62, $40, $44, $31, $1F, $1F, $1F, $1C, $0B, $0A, $02, $01
; $08, $0B, $04, $06, $1F, $1F, $1F, $1F, $2A, $1A, $2B, $80
smpsVcAlgorithm $03
smpsVcFeedback $00
smpsVcUnusedBits $00
smpsVcDetune $03, $04, $04, $06
smpsVcCoarseFreq $01, $04, $00, $02
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1C, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $01, $02, $0A, $0B
smpsVcDecayRate2 $06, $04, $0B, $08
smpsVcDecayLevel $01, $01, $01, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $80, $2B, $1A, $2A
; Voice $01
; $3D
; $01, $02, $02, $02, $1F, $08, $8A, $0A, $08, $08, $08, $08
; $00, $01, $00, $00, $0F, $1F, $1F, $1F, $1F, $88, $88, $87
smpsVcAlgorithm $05
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $00, $00, $00
smpsVcCoarseFreq $02, $02, $02, $01
smpsVcRateScale $00, $02, $00, $00
smpsVcAttackRate $0A, $0A, $08, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $08, $08, $08, $08
smpsVcDecayRate2 $00, $00, $01, $00
smpsVcDecayLevel $01, $01, $01, $00
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $87, $88, $88, $1F
; Voice $02
; $3A
; $31, $7F, $61, $0A, $9C, $DB, $9C, $9A, $04, $08, $03, $09
; $03, $01, $00, $00, $1F, $0F, $FF, $FF, $23, $25, $1B, $84
smpsVcAlgorithm $02
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $06, $07, $03
smpsVcCoarseFreq $0A, $01, $0F, $01
smpsVcRateScale $02, $02, $03, $02
smpsVcAttackRate $1A, $1C, $1B, $1C
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $09, $03, $08, $04
smpsVcDecayRate2 $00, $00, $01, $03
smpsVcDecayLevel $0F, $0F, $00, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $84, $1B, $25, $23
; Voice $03
; $3A
; $01, $07, $31, $11, $8E, $8E, $8D, $53, $0E, $0E, $0E, $03
; $00, $00, $00, $07, $1F, $FF, $1F, $0F, $18, $28, $17, $82
smpsVcAlgorithm $02
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $01, $03, $00, $00
smpsVcCoarseFreq $01, $01, $07, $01
smpsVcRateScale $01, $02, $02, $02
smpsVcAttackRate $13, $0D, $0E, $0E
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $03, $0E, $0E, $0E
smpsVcDecayRate2 $07, $00, $00, $00
smpsVcDecayLevel $00, $01, $0F, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $82, $17, $28, $18
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.