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 |
|---|---|---|---|---|
Formalization/FunctionalML.agda | Lolirofle/stuff-in-agda | 6 | 3919 | <filename>Formalization/FunctionalML.agda<gh_stars>1-10
module Formalization.FunctionML where
import Lvl
open import Numeral.Finite
open import Numeral.Natural
open import Type{Lvl.𝟎}
data Value : ℕ → Type
data Expression : ℕ → Type
data Value where
const : ∀{n} → ℕ → Value n
var : ∀{n} → 𝕟(n) → Value n
y-combinator : ∀{n} → Value n
func : ∀{n} → Value(𝐒 n) → Value n
data Expression where
val : ∀{n} → Value n → Expression n
apply : ∀{n} → Expression n → Expression n
|
Task/Associative-array-Iteration/Ada/associative-array-iteration.ada | LaudateCorpus1/RosettaCodeData | 1 | 22985 | <filename>Task/Associative-array-Iteration/Ada/associative-array-iteration.ada
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers.Indefinite_Ordered_Maps;
procedure Test_Iteration is
package String_Maps is
new Ada.Containers.Indefinite_Ordered_Maps (String, Integer);
use String_Maps;
A : Map;
Index : Cursor;
begin
A.Insert ("hello", 1);
A.Insert ("world", 2);
A.Insert ("!", 3);
Index := A.First;
while Index /= No_Element loop
Put_Line (Key (Index) & Integer'Image (Element (Index)));
Index := Next (Index);
end loop;
end Test_Iteration;
|
kernel/gdt_obj.asm | semahawk/kernel | 0 | 242813 | <gh_stars>0
global gdt_flush
gdt_flush:
; SEG_KCODE
jmp 0x08:.flush
.flush:
; SEG_KDATA
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
ret
; vi: ft=nasm:ts=2:sw=2 expandtab
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_21829_681.asm | ljhsiun2/medusa | 9 | 26935 | <filename>Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_21829_681.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %r8
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x17f29, %r8
nop
nop
dec %rsi
movb (%r8), %bl
inc %r9
lea addresses_A_ht+0xee97, %rsi
clflush (%rsi)
nop
nop
cmp $13955, %r10
mov (%rsi), %ax
nop
nop
cmp %r10, %r10
lea addresses_WC_ht+0xaf97, %rbx
nop
nop
xor $26834, %r15
mov $0x6162636465666768, %r8
movq %r8, %xmm2
vmovups %ymm2, (%rbx)
nop
and %rbx, %rbx
lea addresses_UC_ht+0x4f05, %r8
nop
nop
nop
and %rbx, %rbx
movb $0x61, (%r8)
and %rsi, %rsi
lea addresses_UC_ht+0xf697, %rsi
lea addresses_normal_ht+0x4297, %rdi
nop
add %rax, %rax
mov $75, %rcx
rep movsl
nop
and $29218, %r9
lea addresses_A_ht+0xd537, %rsi
lea addresses_D_ht+0x15697, %rdi
nop
nop
sub $22219, %rax
mov $6, %rcx
rep movsq
nop
nop
xor %r15, %r15
lea addresses_WC_ht+0x1816d, %rsi
lea addresses_UC_ht+0xa306, %rdi
nop
nop
xor $64105, %rbx
mov $64, %rcx
rep movsw
nop
nop
nop
nop
add %r15, %r15
lea addresses_WT_ht+0xca37, %rax
nop
nop
nop
cmp $4771, %rcx
mov (%rax), %r15d
nop
nop
nop
add %rdi, %rdi
lea addresses_normal_ht+0x1b427, %rcx
nop
nop
nop
nop
sub %rsi, %rsi
movb (%rcx), %al
add %rbx, %rbx
lea addresses_WC_ht+0xd717, %rsi
lea addresses_WT_ht+0xa6a7, %rdi
add $35305, %r9
mov $60, %rcx
rep movsq
add $9867, %r9
lea addresses_D_ht+0x3833, %rsi
lea addresses_normal_ht+0x7697, %rdi
clflush (%rdi)
nop
nop
cmp %r8, %r8
mov $81, %rcx
rep movsw
nop
nop
nop
add $39941, %rax
lea addresses_WC_ht+0x1d697, %rsi
inc %r8
mov $0x6162636465666768, %rax
movq %rax, %xmm6
vmovups %ymm6, (%rsi)
and %r15, %r15
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r8
push %rax
push %rbx
push %rsi
// Store
mov $0x4a03440000000697, %rbx
nop
nop
nop
nop
cmp $30614, %rax
mov $0x5152535455565758, %r12
movq %r12, %xmm6
vmovups %ymm6, (%rbx)
// Exception!!!
mov (0), %r14
add %r14, %r14
// Load
lea addresses_US+0x16e97, %rsi
nop
nop
nop
nop
nop
cmp %r8, %r8
mov (%rsi), %r11w
nop
nop
nop
cmp %rsi, %rsi
// Faulty Load
lea addresses_US+0x16e97, %r12
nop
nop
nop
nop
cmp %rsi, %rsi
mov (%r12), %r8w
lea oracles, %rbx
and $0xff, %r8
shlq $12, %r8
mov (%rbx,%r8,1), %r8
pop %rsi
pop %rbx
pop %rax
pop %r8
pop %r14
pop %r12
pop %r11
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': 32, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': True, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': True, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': True, 'AVXalign': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 9}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 4}, 'dst': {'same': True, 'type': 'addresses_D_ht', 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 2}, 'dst': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'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/158/A158280.asm | neoneye/loda-programs | 11 | 9110 | ; A158280: Octosection: A145511(8n+4) or A145501(8n+4).
; Submitted by <NAME>
; 7,21,21,21,42,21,21,63,21,21,63,21,42,70,21,21,63,63,21,63,21,21,126,21,42,63,21,63,63,21,21,126,63,21,63,21,21,126,63,21,105,21,63,63,21,63,63,63,21,126,21,21,189,21,21,63,21,63,126,63,42,63,70,21,63,21,63,210,21,21
mul $0,2
seq $0,7425 ; d_3(n), or tau_3(n), the number of ordered factorizations of n as n = r s t.
mul $0,7
|
Classes/alias/info for/busy status/busy status of (info for (path to me)).applescript | looking-for-a-job/applescript-examples | 1 | 1926 | <filename>Classes/alias/info for/busy status/busy status of (info for (path to me)).applescript
#!/usr/bin/osascript
busy status of (info for (path to me)) |
Transynther/x86/_processed/US/_st_4k_/i7-7700_9_0xca.log_21829_983.asm | ljhsiun2/medusa | 9 | 16443 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0xb77c, %r11
clflush (%r11)
nop
dec %rax
movl $0x61626364, (%r11)
nop
nop
nop
sub $48137, %rdx
lea addresses_WT_ht+0x60a8, %rbx
clflush (%rbx)
nop
nop
nop
nop
nop
and %rdx, %rdx
mov (%rbx), %r15w
nop
cmp %r11, %r11
lea addresses_UC_ht+0x10e82, %rsi
lea addresses_WT_ht+0x9278, %rdi
nop
and %rdx, %rdx
mov $56, %rcx
rep movsb
cmp $58115, %r11
lea addresses_D_ht+0x11fb0, %rsi
lea addresses_A_ht+0x7ed8, %rdi
nop
nop
nop
nop
nop
and %rbx, %rbx
mov $12, %rcx
rep movsw
nop
cmp %rdx, %rdx
lea addresses_WT_ht+0xb878, %rbx
nop
nop
sub $36369, %rsi
vmovups (%rbx), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rax
cmp %r11, %r11
lea addresses_A_ht+0xd4f8, %rsi
lea addresses_UC_ht+0xed18, %rdi
nop
cmp %r15, %r15
mov $74, %rcx
rep movsl
nop
nop
nop
nop
nop
and %r12, %r12
lea addresses_A_ht+0xa678, %rsi
xor %rcx, %rcx
movups (%rsi), %xmm2
vpextrq $0, %xmm2, %r15
nop
nop
and $36393, %rcx
lea addresses_UC_ht+0x8df8, %rsi
lea addresses_WC_ht+0xc1b8, %rdi
clflush (%rdi)
xor %rbx, %rbx
mov $92, %rcx
rep movsl
and $18955, %r12
lea addresses_WC_ht+0xe878, %rdi
nop
nop
nop
nop
xor $43399, %rax
mov $0x6162636465666768, %r15
movq %r15, %xmm6
movups %xmm6, (%rdi)
nop
nop
nop
nop
nop
dec %rsi
lea addresses_WT_ht+0xde78, %r11
nop
nop
nop
sub %r12, %r12
movw $0x6162, (%r11)
nop
nop
nop
nop
nop
sub $29054, %rdx
lea addresses_UC_ht+0xb6fe, %rsi
lea addresses_normal_ht+0xea78, %rdi
nop
nop
nop
xor %r15, %r15
mov $91, %rcx
rep movsw
nop
nop
nop
nop
nop
add $33334, %r12
lea addresses_normal_ht+0x5774, %rsi
lea addresses_UC_ht+0xe5b8, %rdi
clflush (%rdi)
nop
nop
nop
nop
dec %r12
mov $8, %rcx
rep movsl
nop
nop
nop
nop
sub %r11, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %rbp
push %rbx
push %rcx
push %rsi
// Store
lea addresses_A+0x443d, %rcx
nop
nop
xor $1156, %rbp
movl $0x51525354, (%rcx)
nop
nop
nop
nop
nop
xor %r10, %r10
// Store
mov $0x771ce10000000a78, %rbx
clflush (%rbx)
nop
nop
nop
nop
sub %r11, %r11
movb $0x51, (%rbx)
nop
nop
nop
nop
nop
cmp %rcx, %rcx
// Faulty Load
lea addresses_US+0x11a78, %rcx
nop
nop
sub $20230, %rsi
mov (%rcx), %r11d
lea oracles, %rbx
and $0xff, %r11
shlq $12, %r11
mov (%rbx,%r11,1), %r11
pop %rsi
pop %rcx
pop %rbx
pop %rbp
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A'}}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': True, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_NC'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': True, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}}
{'51': 21829}
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
*/
|
scrollers/rol.asm | FolkertVanVerseveld/c64 | 1 | 175333 | <reponame>FolkertVanVerseveld/c64<filename>scrollers/rol.asm<gh_stars>1-10
// Assembler: KickAssembler 4.4
// rollende tekst
BasicUpstart2(start)
.var scr_clear_char = ' '
.var scr_clear_color = $00
* = $0810 "start"
.var vic = $0000
.var scherm = $0400
.var spr_data = vic + $2400
.var font = vic + $2000
.var wis_links = scherm + 4 * 40
.var links = wis_links + 3
.var wis_rechts = scherm + 7 * 40
.var rechts = wis_rechts + 39 - 3
// Update these to your HVSC directory
//.var music = LoadSid("/home/methos/Music/C64Music/MUSICIANS/0-9/20CC/TV_Tunes_Mix.sid")
.var music = LoadSid("/home/methos/Music/C64Music/MUSICIANS/T/Tel_Jeroen/Fun_Fun.sid")
//.var music = LoadSid("/home/methos/Music/C64Music/MUSICIANS/T/Tel_Jeroen/Alternative_Fuel.sid")
.var num1lo = $62
.var num1hi = $63
.var num2lo = $64
.var num2hi = $65
.var reslo = $66
.var reshi = $67
.var delta = $68
.var irq_line_top = $20
.var irq_line_grond = $b0
.var irq_line_bottom = $e2
.var irq_line_bottom2 = $20
.var colram = $d800
.var scroll_screen = scherm + 20 * 40
.var scroll_colram = colram + 20 * 40
start:
jsr scr_clear
lda #$08
ldx #$00
!l:
sta scroll_colram, x
dex
bne !l-
lda $d016
sta scroll_oud
lda #$03
sta $d020
sta $d021
lda $d018
sta mem_old
lda #music.startSong - 1
jsr music.init
jsr spr_init
jsr irq_init
jmp *
scroll_oud:
.byte 0
irq_init:
// zet irq done
sei
lda #<irq_top
sta $0314
lda #>irq_top
sta $0315
// zorg dat de irq gebruikt wordt
asl $d019
// geen idee wat dit precies doet
// het zet alle interrupts eerst uit en dan
// de volgende aan: timer a, timer b, flag pin, serial shift
lda #$7b
sta $dc0d
// zet raster interrupt aan
lda #$81
sta $d01a
// bit-7 van de te schrijven waarde is bit-8 van de interruptregel (hier 0)
// tekst mode (bit-5 uit)
// scherm aan (bit-4 aan)
// 25 rijen (bit-3 aan)
// y scroll = 3 (bits 0-2)
lda $d011
and #%01111111
sta $d011
// de onderste 8-bits van de interruptregel.
// dus: regel $80 (128)
lda #irq_line_top
sta $d012
lda $d011
and #$7F
sta $d011
// vanaf nu kunnen de interrupts gevuurd worden
cli
rts
spr_init:
// setup sprite at $0340 (== 13 * 64)
lda #(spr_data - vic + 64 * 0) / 64
sta scherm + $03f8
// copy sprites
ldx #0
!l:
lda m0spr, x
sta spr_data + 64 * 0, x
// sprite 4 is identical to sprite 3
inx
cpx #64
bne !l-
// show sprites
lda #$01
sta $d015
lda #$04
sta $d027
lda #$70
sta $d000
lda #$80
sta $d001
rts
// add 8-bit constant to 16-bit number
add8_16:
clc
lda num1lo
adc #2 // the constant
sta num1lo
bcc !ok+
inc num1hi
!ok:
rts
balon:
ldx balon_pos
lda sinus, x
sta $d001
lda sinus2, x
sta $d000
inc balon_pos
rts
irq_top:
asl $d019
lda mem_old
and #$f0
ora #%00001000
sta $d018
// BEGIN kernel
//inc $d020
jsr scroll_tekst
jsr balon
jsr music.play
lda #<irq_grond
sta $0314
lda #>irq_grond
sta $0315
lda #irq_line_grond
sta $d012
//dec $d020
// EIND kernel
pla
tay
pla
tax
pla
rti
mem_old:
.byte 0
irq_grond:
asl $d019
// BEGIN kernel
//inc $d020
jsr scroll
lda mem_old
sta $d018
//dec $d020
lda #<irq_bottom
sta $0314
lda #>irq_bottom
sta $0315
lda #irq_line_bottom
sta $d012
// EIND kernel
pla
tay
pla
tax
pla
rti
irq_bottom:
asl $d019
// BEGIN kernel
nop
nop
nop
nop
nop
nop
lda #$05
sta $d020
sta $d021
lda scroll_oud
sta $d016
lda #<irq_bottom2
sta $0314
lda #>irq_bottom2
sta $0315
lda #irq_line_bottom2
sta $d012
lda $d011
ora #$80
sta $d011
// EIND kernel
pla
tay
pla
tax
pla
rti
irq_bottom2:
asl $d019
lda #$03
sta $d020
sta $d021
lda #<irq_top
sta $0314
lda #>irq_top
sta $0315
lda #irq_line_top
sta $d012
lda $d011
and #$7f
sta $d011
// EIND kernel
pla
tay
pla
tax
pla
rti
.var stappen = 120
scroll_tekst:
lda #$00
bne !a+
jmp scroll_links
!a:
jmp scroll_rechts
scroll_links:
rol_ptr_links:
lda regel1_links
beq !done+
text_ptr_links:
sta links
// verplaats rol_ptr
inc rol_ptr_links + 1
bne !skip+
inc rol_ptr_links + 2
!skip:
// verplaats text_ptr
inc text_ptr_links + 1
bne !skip+
inc text_ptr_links + 2
!skip:
rts
// reset rechts logic
!done:
inc scroll_tekst + 1
tabel_ptr_rechts_lo:
lda regel_tabel_rechts
sta rol_ptr_rechts + 1
tabel_ptr_rechts_hi:
lda regel_tabel_rechts + 1
sta rol_ptr_rechts + 2
lda #<rechts
sta text_ptr_rechts + 1
lda #>rechts
sta text_ptr_rechts + 2
// verplaats tabel ptr
lda tabel_ptr_rechts_lo + 1
sta num1lo
lda tabel_ptr_rechts_lo + 2
sta num1hi
jsr add8_16
lda num1lo
sta tabel_ptr_rechts_lo + 1
lda num1hi
sta tabel_ptr_rechts_lo + 2
lda tabel_ptr_rechts_hi + 1
sta num1lo
lda tabel_ptr_rechts_hi + 2
sta num1hi
jsr add8_16
lda num1lo
sta tabel_ptr_rechts_hi + 1
lda num1hi
sta tabel_ptr_rechts_hi + 2
// reset als eind
lda tabel_ptr_rechts_lo + 1
cmp #<regel_tabel_rechts_eind
bne !skip+
lda tabel_ptr_rechts_lo + 2
cmp #>regel_tabel_rechts_eind
bne !skip+
// reset ptr
lda #<regel_tabel_rechts
sta tabel_ptr_rechts_lo + 1
lda #>regel_tabel_rechts
sta tabel_ptr_rechts_lo + 2
lda #<regel_tabel_rechts + 1
sta tabel_ptr_rechts_hi + 1
lda #>regel_tabel_rechts + 1
sta tabel_ptr_rechts_hi + 2
!skip:
rts
scroll_rechts:
rol_ptr_rechts:
lda regel2_rechts
beq !done+
text_ptr_rechts:
sta rechts
// verplaats rol_ptr
dec rol_ptr_rechts + 1
lda rol_ptr_rechts + 1
cmp #$ff
bne !skip+
dec rol_ptr_rechts + 2
!skip:
// verplaats text_ptr
dec text_ptr_rechts + 1
lda text_ptr_rechts + 1
cmp #$ff
bne !skip+
dec text_ptr_rechts + 2
!skip:
rts
// reset links logic
!done:
// maak vertraging...
teller:
lda #stappen
beq !skip+
dec teller + 1
rts
!skip:
lda #stappen
sta teller + 1
// ik wil het eigenlijk anders doen,
// maar wis beide regels
lda #' '
ldx #0
!l:
sta wis_links, x
sta wis_rechts, x
inx
cpx #40
bne !l-
//inc $d020
dec scroll_tekst + 1
tabel_ptr_links_lo:
lda regel_tabel_links
sta rol_ptr_links + 1
tabel_ptr_links_hi:
lda regel_tabel_links + 1
sta rol_ptr_links + 2
lda #<links
sta text_ptr_links + 1
lda #>links
sta text_ptr_links + 2
// verplaats tabel ptr
lda tabel_ptr_links_lo + 1
sta num1lo
lda tabel_ptr_links_lo + 2
sta num1hi
jsr add8_16
lda num1lo
sta tabel_ptr_links_lo + 1
lda num1hi
sta tabel_ptr_links_lo + 2
lda tabel_ptr_links_hi + 1
sta num1lo
lda tabel_ptr_links_hi + 2
sta num1hi
jsr add8_16
lda num1lo
sta tabel_ptr_links_hi + 1
lda num1hi
sta tabel_ptr_links_hi + 2
// reset als eind
lda tabel_ptr_links_lo + 1
cmp #<regel_tabel_links_eind
bne !skip+
lda tabel_ptr_links_lo + 2
cmp #>regel_tabel_links_eind
bne !skip+
// reset ptr
lda #<regel_tabel_links
sta tabel_ptr_links_lo + 1
lda #>regel_tabel_links
sta tabel_ptr_links_lo + 2
lda #<regel_tabel_links + 1
sta tabel_ptr_links_hi + 1
lda #>regel_tabel_links + 1
sta tabel_ptr_links_hi + 2
!skip:
rts
regel_tabel_links:
.word regel3_links, regel5_links, regel7_links, regel9_links, regel11_links, regel13_links, regel15_links, regel17_links
.word regel19_links, regel21_links, regel23_links, regel25_links, regel27_links, regel1_links
regel_tabel_links_eind:
regel_tabel_rechts:
.word regel2_rechts, regel4_rechts, regel6_rechts, regel8_rechts, regel10_rechts, regel12_rechts, regel14_rechts, regel16_rechts
.word regel18_rechts, regel20_rechts, regel22_rechts, regel24_rechts, regel26_rechts, regel28_rechts
regel_tabel_rechts_eind:
.byte 0
regel1_links:
.text "yo, daar zijn we weer"
regel1_rechts:
.byte 0
regel2_links:
.text "gezellig bij de hcc"
regel2_rechts:
.byte '!'
.byte 0
regel3_links:
.text "laten we eens iets moois maken"
regel3_rechts:
.byte '!'
.byte 0
regel4_links:
.text "dit is een klein probeelse"
regel4_rechts:
.byte 'l'
.byte 0
regel5_links:
.text "dit was een paar uurtjes wer"
regel5_rechts:
.byte 'k'
.byte 0
regel6_links:
.text "geinig toch"
regel6_rechts:
.byte '?'
.byte 0
regel7_links:
.text "code door metho"
regel7_rechts:
.byte 's'
.byte 0
regel8_links:
.text "muziek door wav"
regel8_rechts:
.byte 'e'
.byte 0
regel9_links:
.text "vriendelijke groeten aa"
regel9_rechts:
.byte 'n'
.byte 0
regel10_links:
.text "jan, wolf, fred, dunca"
regel10_rechts:
.byte 'n'
.byte 0
regel11_links:
.text "shape, abyss connection, censo"
regel11_rechts:
.byte 'r'
.byte 0
regel12_links:
.text "f4cg, fairlight, genesis p, monocero"
regel12_rechts:
.byte 's'
.byte 0
regel13_links:
.text "bij revision 2018 had i"
regel13_rechts:
.byte 'k'
.byte 0
regel14_links:
.text "mijn eerste demo uitgebrach"
regel14_rechts:
.byte 't'
.byte 0
regel15_links:
.text "en sinds kort ben ik li"
regel15_rechts:
.byte 'd'
.byte 0
regel16_links:
.text "van de demogroep f4cg"
regel16_rechts:
.byte '!'
.byte 0
regel17_links:
.text "ze smasher had me gevraag"
regel17_rechts:
.byte 'd'
.byte 0
regel18_links:
.text "en dat vond ik heel gaaf"
regel18_rechts:
.byte '!'
.byte 0
regel19_links:
.text "daarnaast ben ik met anto"
regel19_rechts:
.byte 'n'
.byte 0
regel20_links:
.text "een scener die een winterslaap ha"
regel20_rechts:
.byte 'd'
.byte 0
regel21_links:
.text "begonnen om een groe"
regel21_rechts:
.byte 'p'
.byte 0
regel22_links:
.text "op te richte"
regel22_rechts:
.byte 'n'
.byte 0
regel23_links:
.text "we hopen op x2018 een cool"
regel23_rechts:
.byte 'e'
.byte 0
#import "screen.asm"
scroll:
// verplaats horizontaal
lda scroll_xpos
sec
sbc scroll_speed
and #$07
sta scroll_xpos
bcc !move+
jmp !klaar+
!move:
// verplaats alles één naar links
ldx #$00
!l:
lda scroll_screen + 1, x
sta scroll_screen, x
lda scroll_screen + 40 + 1, x
sta scroll_screen + 40, x
inx
cpx #40
bne !l-
// haal eentje op uit de rij
!textptr:
lda scroll_text
cmp #$ff
bne !nowrap+
jsr scroll_herstel
!nowrap:
sta scroll_screen + 39
!textptr2:
lda scroll_text2
sta scroll_screen + 39 + 40
// werk text ptr bij
inc !textptr- + 1
bne !skip+
inc !textptr- + 2
!skip:
inc !textptr2- + 1
bne !skip+
inc !textptr2- + 2
!skip:
!klaar:
// pas horizontale verplaatsing toe
lda #$c0
ora scroll_xpos
sta $d016
rts
scroll_herstel:
// herstel ptr
lda #<scroll_text
sta !textptr- + 1
lda #>scroll_text
sta !textptr- + 2
lda #<scroll_text2
sta !textptr2- + 1
lda #>scroll_text2
sta !textptr2- + 2
lda scroll_text
rts
balon_pos:
.byte 0
// sprite movement table
sinus:
.fill $100, round($8c + $6 * sin(toRadians(i * 2 * 360 / $100)))
sinus2:
.fill $100, round($70 + $12 * sin(toRadians(i * 360 / $100)))
scroll_xpos:
.byte 0
scroll_speed:
.byte 2
scroll_text:
//.text "hey, deze scroller kan alleen van rechts naar links bewegen. "
//.text "hij gaat door tot 0xff en dan weer rond. "
//.fill $100, i
.byte ' ', ' ', ' ', ' ', ' '
.byte 233, 160, 227, 248, 121, ' '
.byte ' ', ' ', ' ', ' ', ' ', ' '
.byte 121, 121
.byte ' ', ' ', ' '
.byte 233, 160, 223
.byte ' ', ' ', ' ', ' ', ' ', ' ', ' '
.byte 233, 160, 160, 223
.byte ' ', ' ', ' ', ' ', ' ', ' ', ' '
.byte 121, ' ', ' ', ' ', ' ', ' ', ' '
.byte $ff
scroll_text2:
.byte ' ', ' ', ' ', ' ', 233
.byte 160, 160, 160, 160, 160, 160
.byte 223, ' ', ' ', ' ', ' ', 233
.byte 160, 160
.byte 160, 223, 233
.byte 160, 160, 160
.byte 223, ' ', ' ', ' ', ' ', ' ', 233
.byte 160, 160, 160, 160
.byte 160, 160, 160, 227, 227, 227, 160
.byte 160, 160, 223, ' ', 121, 121, ' '
.byte $ff
* = music.location "music"
.fill music.size, music.getData(i)
.print "music_init = $" + toHexString(music.init)
.print "music_play = $" + toHexString(music.play)
.align $100
m0spr:
.byte %00000000, %01111111, %00000000
.byte %00000001, %11111111, %11000000
.byte %00000011, %11111111, %11100000
.byte %00000011, %11100011, %11100000
.byte %00000111, %11011100, %11110000
.byte %00000111, %11011101, %11110000
.byte %00000111, %11011100, %11110000
.byte %00000011, %11100011, %11100000
.byte %00000011, %11111111, %11100000
.byte %00000011, %11111111, %11100000
.byte %00000010, %11111111, %10100000
.byte %00000001, %01111111, %01000000
.byte %00000001, %00111110, %01000000
.byte %00000000, %10011100, %10000000
.byte %00000000, %10011100, %10000000
.byte %00000000, %01001001, %00000000
.byte %00000000, %01001001, %00000000
.byte %00000000, %00111110, %00000000
.byte %00000000, %00111110, %00000000
.byte %00000000, %00111110, %00000000
.byte %00000000, %00011100, %00000000
.byte 0
regel24_links:
.text "demo uit te brenge"
regel24_rechts:
.byte 'n'
.byte 0
regel25_links:
.text "we zijn voornamelijk dinge"
regel25_rechts:
.byte 'n'
.byte 0
regel26_links:
.text "aan het proberen en uitdenke"
regel26_rechts:
.byte 'n'
.byte 0
regel27_links:
.text "maar we zien nog we"
regel27_rechts:
.byte 'l'
.byte 0
regel28_links:
.text "of het allemaal gaat lukken"
regel28_rechts:
.byte '!'
.byte 0
* = font "font"
.import binary "../assets/aeg_collection_05.64c", 2
|
asm/normal.asm | StructuralMike/ALttPDoorRandomizer | 0 | 83474 | <reponame>StructuralMike/ALttPDoorRandomizer
WarpLeft:
lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end
lda $20 : ldx $aa
jsr CalcIndex
!add #$06 : ldy #$01 ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
rtl
WarpRight:
lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end
lda $20 : ldx $aa
jsr CalcIndex
!add #$12 : ldy #$ff ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
rtl
WarpUp:
lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end
lda $22 : ldx $a9
jsr CalcIndex
ldy #$02 ; offsets in A, Y
jsr LoadRoomVert
.end
jsr Cleanup
rtl
WarpDown:
lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end
lda $22 : ldx $a9
jsr CalcIndex
!add #$0c : ldy #$ff ; offsets in A, Y
jsr LoadRoomVert
.end
jsr Cleanup
rtl
; carry set = use link door like normal
; carry clear = we are in dr mode, never use linking doors
CheckLinkDoorR:
lda.l DRMode : bne +
lda $7ec004 : sta $a0 ; what we wrote over
sec : rtl
+ clc : rtl
CheckLinkDoorL:
lda.l DRMode : bne +
lda $7ec003 : sta $a0 ; what we wrote over
sec : rtl
+ clc : rtl
TrapDoorFixer:
lda $fe : and #$0038 : beq .end
xba : asl #2 : sta $00
stz $0468 : lda $068c : ora $00 : sta $068c
.end
stz $fe ; clear our fe here because we don't need it anymore
rts
Cleanup:
stz $047a
inc $11
lda $ef
rts
;A needs be to the low coordinate, x needs to be either 0 for left,upper or non-zero for right,down
; This sets A (00,02,04) and stores half that at $04 for later use, (src door)
CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 -> A, DoorOffset -> $04 (vert/horz agnostic)
cpx.b #00 : bne .largeDoor
cmp.b #$d0 : bcc .smallDoor
lda #$01 : bra .done ; Middle Door
.smallDoor lda #$00 : bra .done
.largeDoor lda #$02
.done
sta $04
asl
rts
; Y is an adjustment for main direction of travel
; A is a door table row offset
LoadRoomHorz:
{
phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg
jsr HorzEdge : pla : bcs .end
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$0F : asl a : !sub $23 : !add $06 : sta $02
ldy #$00 : jsr ShiftVariablesMainDir
lda $01 : and #$80 : beq .normal
ldy $06 : cpy #$ff : beq +
lda $01 : jsr LoadEastMidpoint : bra ++
+ lda $01 : jsr LoadWestMidpoint
++ jsr PrepScrollToEdge : bra .scroll
.normal
jsr PrepScrollToNormal
.scroll
lda $01 : and #$40 : pha
jsr ScrollY
pla : beq .end
ldy #$06 : jsr ApplyScroll
.end
plb ; restore db register
rts
}
; Y is an adjustment for main direction of travel (stored at $06)
; A is a door table row offset (stored a $07)
LoadRoomVert:
{
phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg
jsr VertEdge : pla : bcs .end
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$F0 : lsr #3 : !sub $21 : !add $06 : sta $02
ldy #$01 : jsr ShiftVariablesMainDir
lda $01 : and #$80 : beq .normal
ldy $06 : cpy #$ff : beq +
lda $01 : jsr LoadSouthMidpoint : bra ++
+ lda $01 : jsr LoadNorthMidpoint
++ jsr PrepScrollToEdge : bra .scroll
.normal
jsr PrepScrollToNormal
.scroll
lda $01 : and #$40 : pha
jsr ScrollX
pla : beq .end
ldy #$00 : jsr ApplyScroll
.end
plb ; restore db register
rts
}
LookupNewRoom: ; expects data offset to be in A
{
rep #$30 : and #$00FF ;sanitize A reg (who knows what is in the high byte)
sta $00 ; offset in 00
lda $a2 : tax ; probably okay loading $a3 in the high byte
lda.w DoorOffset,x : and #$00FF ;we only want the low byte
asl #3 : sta $02 : !add $02 : !add $02 ;multiply by 24 (data size)
!add $00 ; should now have the offset of the address I want to load
tax : lda.w DoorTable,x : sta $00
and #$00FF : sta $a0 ; assign new room
sep #$30
rts
}
; INPUTS-- Y: Direction Index , $02: Shift Value
; Sets high bytes of various registers
ShiftVariablesMainDir:
{
lda.w CoordIndex,y : tax
lda $21,x : !add $02 : sta $21,x ; coordinate update
lda.w CameraIndex,y : tax
lda $e3,x : !add $02 : sta $e3,x ; scroll register high byte
lda.w CamQuadIndex,y : tax
lda $0605,x : !add $02 : sta $0605,x ; high bytes of these guys
lda $0607,x : !add $02 : sta $0607,x
lda $0601,x : !add $02 : sta $0601,x
lda $0603,x : !add $02 : sta $0603,x
rts
}
; Target pixel should be in A, other info in $01
; Sets $04 $05 and $ee
PrepScrollToEdge:
{
sta $04 : lda $01 : and #$20 : beq +
lda #01
+ sta $05
lda $01 : and #$10 : beq +
lda #01
+ sta $ee : bne +
stz $0476
+ rts
}
; Normal Flags should be in $01
; Sets $04 $05 and $ee, and $fe
PrepScrollToNormal:
{
lda $01 : sta $fe : and #$04 : lsr #2 : sta $ee ; trap door and layer
bne +
stz $0476
+ stz $05 : lda #$78 : sta $04
lda $01 : and #$03 : beq .end
cmp #$02 : !bge +
lda #$f8 : sta $04 : bra .end
+ inc $05
.end rts
}
StraightStairsAdj:
{
stx $0464 : sty $012e ; what we wrote over
lda.l DRMode : beq +
jsr GetTileAttribute : tax
lda $11 : cmp #$12 : beq .goingNorth
lda $a2 : cmp #$51 : bne ++
rep #$20 : lda #$0018 : !add $20 : sta $20 : sep #$20 ; special fix for throne room
jsr GetTileAttribute : tax
++ lda.l StepAdjustmentDown, X : bra .end
; lda $ee : beq .end
; rep #$20 : lda #$ffe0 : !add $20 : sta $20 : sep #$20
.goingNorth
cpx #$00 : bne ++
lda $a0 : cmp #$51 : bne ++
lda #$36 : bra .end ; special fix for throne room
++ ldy $ee : cpy #$00 : beq ++
inx
++ lda.l StepAdjustmentUp, X
.end
pha : lda $0462 : and #$04 : bne ++
pla : !add #$f6 : pha
++ pla : !add $0464 : sta $0464
+ rtl
}
GetTileAttribute:
{
phk : pea.w .jslrtsreturn-1
pea.w $02802c
jml $02c11d ; mucks with x/y sets a to Tile Attribute, I think
.jslrtsreturn
rts
}
; 0 open edge
; 1 nrm door high
; 2 straight str
; 3 nrm door low
; 4 trap door high
; 5 trap door low (none of these exist on North direction)
StepAdjustmentUp: ; really North Stairs
db $00, $f6, $1a, $18, $16, $38
StepAdjustmentDown: ; really South Stairs
db $d0, $f6, $10, $1a, $f0, $00
StraightStairsFix:
{
lda.l DRMode : bne +
!add $20 : sta $20 ;what we wrote over
+ rtl
}
StraightStairLayerFix:
{
lda.l DRMode : beq +
lda $ee : rtl
+ lda $01c322, x : rtl ; what we wrote over
}
DoorToStraight:
{
pha
lda.l DRMode : beq .skip
pla : bne .end
pha
lda $a0 : cmp #$51 : bne .skip
lda #$04 : sta $4e
.skip pla
.end ldx $0418 : cmp #$02 ;what we wrote over
rtl
}
StraightStairsTrapDoor:
{
lda $0464 : bne +
; reset function
phk : pea.w .jslrtsreturn-1
pea.w $02802c
jml $028c73 ; $10D71 .reset label of Bank02
.jslrtsreturn
lda $0468 : bne ++
lda $a0 : cmp.b #$ac : bne .animateTraps
lda $0403 : and.b #$20 : bne .animateTraps
lda $0403 : and.b #$10 : beq ++
.animateTraps
lda #$05 : sta $11
inc $0468 : stz $068e : stz $0690
++ rtl
+ jsl Dungeon_ApproachFixedColor ; what we wrote over
.end rtl
} |
1-ep_AppDev/src/num_up_50_high_position.asm | brown9804/Dragon12_MC9S12DP256 | 0 | 82051 | <gh_stars>0
; Autor:
; <NAME>, Belinda
; <EMAIL>
; num > -50 -> stored high positions
begin:
CLRB ; clean B
CLRA ; clean A
LDAB # 200 ; load in B
LDX # DATOS
LDAA # -50 ;load value in A
LDY # MAYORES
forloop:
CMPA 1, X+ ; compare - if > -50 -> bool output
BLE ifend ; branch if less than or equal signed if output ==1
MOVA -1, X, Y ; byte move
INY ; + 1 index of reg Y
ifend:
DBNE B, forloop ; if not 200 continue looping
end:
JMP end
|
models/hol/sygus/hackers_del/hd_11.als | johnwickerson/alloystar | 2 | 4929 | <gh_stars>1-10
/**
* NOTE: make sure to set "Options -> Prevent overflows" to "No"
*
* Test if (nlz x) < (nlz y) where nlz is the number of leading zeros
*/
module hd_11
open hdXY[hd11]
--------------------------------------------------------------------------------
-- Helpers
--------------------------------------------------------------------------------
fun hd11[x, y: Int]: Bit {
bvand[x, bvnot[y]] > y implies BitTrue else BitFalse
}
--------------------------------------------------------------------------------
-- Commands
--------------------------------------------------------------------------------
-- (https://github.com/rishabhs/sygus-comp14/blob/master/benchmarks/hackers_del/hd-11-d0-prog.sl)
run synthBoolNodeI for 0 but {bitwidth: 32, atoms: bw(4)} Int, 4 IntVarVal,
exactly 1 GT, exactly 1 BvAnd, exactly 1 BvNot
-- (https://github.com/rishabhs/sygus-comp14/blob/master/benchmarks/hackers_del/hd-11-d1-prog.sl)
run synthBoolNodeI for 0 but {bitwidth: 32, atoms: bw(4)} Int, 4 IntVarVal,
exactly 1 GT, exactly 1 BvAdd, exactly 1 BvSub, exactly 1 BvNot, exactly 1 BvNeg, exactly 1 BvAnd, exactly 1 BvOr, exactly 1 BvXor
-- (https://github.com/rishabhs/sygus-comp14/blob/master/benchmarks/hackers_del/hd-11-d5-prog.sl)
run synthBoolNodeI for 0 but {bitwidth: 32, atoms: bw(4)} Int, 4 IntVarVal,
exactly 1 IntComp, exactly 3 BinaryIntOp, exactly 2 UnaryIntOp
|
models/amalgam/tests/test_override.als | transclosure/Amalgam | 4 | 4373 | sig Node { edgesBlue, edgesRed, edgesPurple: set Node }
fact purpleOverrides {
edgesPurple = edgesBlue ++ edgesRed
}
fact setup {
some n1, n2, n3: Node | {
n1 != n2
n2 != n3
n1 != n3
n1->n2 in edgesBlue
n1->n3 in edgesRed
}
}
run {} for exactly 3 Node
|
aes.asm | sheumann/65816-crypto | 10 | 22678 | * Copyright (c) 2017 <NAME>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* AES encryption and decryption functions for the 65816
*
* The general approach is largely based on the public domain
* 'aestable.c' implementation by <NAME>, available at:
* https://code.google.com/archive/p/byte-oriented-aes/downloads
* Portions are also based on the public domain 'rijndael-alg-fst.c'
* reference implementation by <NAME>, <NAME>,
* and <NAME>.
case on
mcopy aes.macros
* Dummy segment to go in .ROOT file
align 256
dummy private
end
* Data tables used for AES encryption and decryption.
* For best performance, these should be page-aligned.
align 256
tables privdata
Sbox anop ; forward s-box
dc h'63 7c 77 7b f2 6b 6f c5 30 01 67 2b fe d7 ab 76'
dc h'ca 82 c9 7d fa 59 47 f0 ad d4 a2 af 9c a4 72 c0'
dc h'b7 fd 93 26 36 3f f7 cc 34 a5 e5 f1 71 d8 31 15'
dc h'04 c7 23 c3 18 96 05 9a 07 12 80 e2 eb 27 b2 75'
dc h'09 83 2c 1a 1b 6e 5a a0 52 3b d6 b3 29 e3 2f 84'
dc h'53 d1 00 ed 20 fc b1 5b 6a cb be 39 4a 4c 58 cf'
dc h'd0 ef aa fb 43 4d 33 85 45 f9 02 7f 50 3c 9f a8'
dc h'51 a3 40 8f 92 9d 38 f5 bc b6 da 21 10 ff f3 d2'
dc h'cd 0c 13 ec 5f 97 44 17 c4 a7 7e 3d 64 5d 19 73'
dc h'60 81 4f dc 22 2a 90 88 46 ee b8 14 de 5e 0b db'
dc h'e0 32 3a 0a 49 06 24 5c c2 d3 ac 62 91 95 e4 79'
dc h'e7 c8 37 6d 8d d5 4e a9 6c 56 f4 ea 65 7a ae 08'
dc h'ba 78 25 2e 1c a6 b4 c6 e8 dd 74 1f 4b bd 8b 8a'
dc h'70 3e b5 66 48 03 f6 0e 61 35 57 b9 86 c1 1d 9e'
dc h'e1 f8 98 11 69 d9 8e 94 9b 1e 87 e9 ce 55 28 df'
dc h'8c a1 89 0d bf e6 42 68 41 99 2d 0f b0 54 bb 16'
InvSbox anop ; inverse s-box
dc h'52 09 6a d5 30 36 a5 38 bf 40 a3 9e 81 f3 d7 fb'
dc h'7c e3 39 82 9b 2f ff 87 34 8e 43 44 c4 de e9 cb'
dc h'54 7b 94 32 a6 c2 23 3d ee 4c 95 0b 42 fa c3 4e'
dc h'08 2e a1 66 28 d9 24 b2 76 5b a2 49 6d 8b d1 25'
dc h'72 f8 f6 64 86 68 98 16 d4 a4 5c cc 5d 65 b6 92'
dc h'6c 70 48 50 fd ed b9 da 5e 15 46 57 a7 8d 9d 84'
dc h'90 d8 ab 00 8c bc d3 0a f7 e4 58 05 b8 b3 45 06'
dc h'd0 2c 1e 8f ca 3f 0f 02 c1 af bd 03 01 13 8a 6b'
dc h'3a 91 11 41 4f 67 dc ea 97 f2 cf ce f0 b4 e6 73'
dc h'96 ac 74 22 e7 ad 35 85 e2 f9 37 e8 1c 75 df 6e'
dc h'47 f1 1a 71 1d 29 c5 89 6f b7 62 0e aa 18 be 1b'
dc h'fc 56 3e 4b c6 d2 79 20 9a db c0 fe 78 cd 5a f4'
dc h'1f dd a8 33 88 07 c7 31 b1 12 10 59 27 80 ec 5f'
dc h'60 51 7f a9 19 b5 4a 0d 2d e5 7a 9f 93 c9 9c ef'
dc h'a0 e0 3b 4d ae 2a f5 b0 c8 eb bb 3c 83 53 99 61'
dc h'17 2b 04 7e ba 77 d6 26 e1 69 14 63 55 21 0c 7d'
Xtime2Sbox anop ; combined Xtimes2[Sbox[]]
dc h'c6 f8 ee f6 ff d6 de 91 60 02 ce 56 e7 b5 4d ec'
dc h'8f 1f 89 fa ef b2 8e fb 41 b3 5f 45 23 53 e4 9b'
dc h'75 e1 3d 4c 6c 7e f5 83 68 51 d1 f9 e2 ab 62 2a'
dc h'08 95 46 9d 30 37 0a 2f 0e 24 1b df cd 4e 7f ea'
dc h'12 1d 58 34 36 dc b4 5b a4 76 b7 7d 52 dd 5e 13'
dc h'a6 b9 00 c1 40 e3 79 b6 d4 8d 67 72 94 98 b0 85'
dc h'bb c5 4f ed 86 9a 66 11 8a e9 04 fe a0 78 25 4b'
dc h'a2 5d 80 05 3f 21 70 f1 63 77 af 42 20 e5 fd bf'
dc h'81 18 26 c3 be 35 88 2e 93 55 fc 7a c8 ba 32 e6'
dc h'c0 19 9e a3 44 54 3b 0b 8c c7 6b 28 a7 bc 16 ad'
dc h'db 64 74 14 92 0c 48 b8 9f bd 43 c4 39 31 d3 f2'
dc h'd5 8b 6e da 01 b1 9c 49 d8 ac f3 cf ca f4 47 10'
dc h'6f f0 4a 5c 38 57 73 97 cb a1 e8 3e 96 61 0d 0f'
dc h'e0 7c 71 cc 90 06 f7 1c c2 6a ae 69 17 99 3a 27'
dc h'd9 eb 2b 22 d2 a9 07 33 2d 3c 15 c9 87 aa 50 a5'
dc h'03 59 09 1a 65 d7 84 d0 82 29 5a 1e 7b a8 6d 2c'
Xtime3Sbox anop ; combined Xtimes3[Sbox[]]
dc h'a5 84 99 8d 0d bd b1 54 50 03 a9 7d 19 62 e6 9a'
dc h'45 9d 40 87 15 eb c9 0b ec 67 fd ea bf f7 96 5b'
dc h'c2 1c ae 6a 5a 41 02 4f 5c f4 34 08 93 73 53 3f'
dc h'0c 52 65 5e 28 a1 0f b5 09 36 9b 3d 26 69 cd 9f'
dc h'1b 9e 74 2e 2d b2 ee fb f6 4d 61 ce 7b 3e 71 97'
dc h'f5 68 00 2c 60 1f c8 ed be 46 d9 4b de d4 e8 4a'
dc h'6b 2a e5 16 c5 d7 55 94 cf 10 06 81 f0 44 ba e3'
dc h'f3 fe c0 8a ad bc 48 04 df c1 75 63 30 1a 0e 6d'
dc h'4c 14 35 2f e1 a2 cc 39 57 f2 82 47 ac e7 2b 95'
dc h'a0 98 d1 7f 66 7e ab 83 ca 29 d3 3c 79 e2 1d 76'
dc h'3b 56 4e 1e db 0a 6c e4 5d 6e ef a6 a8 a4 37 8b'
dc h'32 43 59 b7 8c 64 d2 e0 b4 fa 07 25 af 8e e9 18'
dc h'd5 88 6f 72 24 f1 c7 51 23 7c 9c 21 dd dc 86 85'
dc h'90 42 c4 aa d8 05 01 12 a3 5f f9 d0 91 58 27 b9'
dc h'38 13 b3 33 bb 70 89 a7 b6 22 92 20 49 ff 78 7a'
dc h'8f f8 80 17 da 31 c6 b8 c3 b0 77 11 cb fc d6 3a'
;Xtime2 anop
; dc h'00 02 04 06 08 0a 0c 0e 10 12 14 16 18 1a 1c 1e'
; dc h'20 22 24 26 28 2a 2c 2e 30 32 34 36 38 3a 3c 3e'
; dc h'40 42 44 46 48 4a 4c 4e 50 52 54 56 58 5a 5c 5e'
; dc h'60 62 64 66 68 6a 6c 6e 70 72 74 76 78 7a 7c 7e'
; dc h'80 82 84 86 88 8a 8c 8e 90 92 94 96 98 9a 9c 9e'
; dc h'a0 a2 a4 a6 a8 aa ac ae b0 b2 b4 b6 b8 ba bc be'
; dc h'c0 c2 c4 c6 c8 ca cc ce d0 d2 d4 d6 d8 da dc de'
; dc h'e0 e2 e4 e6 e8 ea ec ee f0 f2 f4 f6 f8 fa fc fe'
; dc h'1b 19 1f 1d 13 11 17 15 0b 09 0f 0d 03 01 07 05'
; dc h'3b 39 3f 3d 33 31 37 35 2b 29 2f 2d 23 21 27 25'
; dc h'5b 59 5f 5d 53 51 57 55 4b 49 4f 4d 43 41 47 45'
; dc h'7b 79 7f 7d 73 71 77 75 6b 69 6f 6d 63 61 67 65'
; dc h'9b 99 9f 9d 93 91 97 95 8b 89 8f 8d 83 81 87 85'
; dc h'bb b9 bf bd b3 b1 b7 b5 ab a9 af ad a3 a1 a7 a5'
; dc h'db d9 df dd d3 d1 d7 d5 cb c9 cf cd c3 c1 c7 c5'
; dc h'fb f9 ff fd f3 f1 f7 f5 eb e9 ef ed e3 e1 e7 e5'
Xtime9 anop
dc h'00 09 12 1b 24 2d 36 3f 48 41 5a 53 6c 65 7e 77'
dc h'90 99 82 8b b4 bd a6 af d8 d1 ca c3 fc f5 ee e7'
dc h'3b 32 29 20 1f 16 0d 04 73 7a 61 68 57 5e 45 4c'
dc h'ab a2 b9 b0 8f 86 9d 94 e3 ea f1 f8 c7 ce d5 dc'
dc h'76 7f 64 6d 52 5b 40 49 3e 37 2c 25 1a 13 08 01'
dc h'e6 ef f4 fd c2 cb d0 d9 ae a7 bc b5 8a 83 98 91'
dc h'4d 44 5f 56 69 60 7b 72 05 0c 17 1e 21 28 33 3a'
dc h'dd d4 cf c6 f9 f0 eb e2 95 9c 87 8e b1 b8 a3 aa'
dc h'ec e5 fe f7 c8 c1 da d3 a4 ad b6 bf 80 89 92 9b'
dc h'7c 75 6e 67 58 51 4a 43 34 3d 26 2f 10 19 02 0b'
dc h'd7 de c5 cc f3 fa e1 e8 9f 96 8d 84 bb b2 a9 a0'
dc h'47 4e 55 5c 63 6a 71 78 0f 06 1d 14 2b 22 39 30'
dc h'9a 93 88 81 be b7 ac a5 d2 db c0 c9 f6 ff e4 ed'
dc h'0a 03 18 11 2e 27 3c 35 42 4b 50 59 66 6f 74 7d'
dc h'a1 a8 b3 ba 85 8c 97 9e e9 e0 fb f2 cd c4 df d6'
dc h'31 38 23 2a 15 1c 07 0e 79 70 6b 62 5d 54 4f 46'
XtimeB anop
dc h'00 0b 16 1d 2c 27 3a 31 58 53 4e 45 74 7f 62 69'
dc h'b0 bb a6 ad 9c 97 8a 81 e8 e3 fe f5 c4 cf d2 d9'
dc h'7b 70 6d 66 57 5c 41 4a 23 28 35 3e 0f 04 19 12'
dc h'cb c0 dd d6 e7 ec f1 fa 93 98 85 8e bf b4 a9 a2'
dc h'f6 fd e0 eb da d1 cc c7 ae a5 b8 b3 82 89 94 9f'
dc h'46 4d 50 5b 6a 61 7c 77 1e 15 08 03 32 39 24 2f'
dc h'8d 86 9b 90 a1 aa b7 bc d5 de c3 c8 f9 f2 ef e4'
dc h'3d 36 2b 20 11 1a 07 0c 65 6e 73 78 49 42 5f 54'
dc h'f7 fc e1 ea db d0 cd c6 af a4 b9 b2 83 88 95 9e'
dc h'47 4c 51 5a 6b 60 7d 76 1f 14 09 02 33 38 25 2e'
dc h'8c 87 9a 91 a0 ab b6 bd d4 df c2 c9 f8 f3 ee e5'
dc h'3c 37 2a 21 10 1b 06 0d 64 6f 72 79 48 43 5e 55'
dc h'01 0a 17 1c 2d 26 3b 30 59 52 4f 44 75 7e 63 68'
dc h'b1 ba a7 ac 9d 96 8b 80 e9 e2 ff f4 c5 ce d3 d8'
dc h'7a 71 6c 67 56 5d 40 4b 22 29 34 3f 0e 05 18 13'
dc h'ca c1 dc d7 e6 ed f0 fb 92 99 84 8f be b5 a8 a3'
XtimeD anop
dc h'00 0d 1a 17 34 39 2e 23 68 65 72 7f 5c 51 46 4b'
dc h'd0 dd ca c7 e4 e9 fe f3 b8 b5 a2 af 8c 81 96 9b'
dc h'bb b6 a1 ac 8f 82 95 98 d3 de c9 c4 e7 ea fd f0'
dc h'6b 66 71 7c 5f 52 45 48 03 0e 19 14 37 3a 2d 20'
dc h'6d 60 77 7a 59 54 43 4e 05 08 1f 12 31 3c 2b 26'
dc h'bd b0 a7 aa 89 84 93 9e d5 d8 cf c2 e1 ec fb f6'
dc h'd6 db cc c1 e2 ef f8 f5 be b3 a4 a9 8a 87 90 9d'
dc h'06 0b 1c 11 32 3f 28 25 6e 63 74 79 5a 57 40 4d'
dc h'da d7 c0 cd ee e3 f4 f9 b2 bf a8 a5 86 8b 9c 91'
dc h'0a 07 10 1d 3e 33 24 29 62 6f 78 75 56 5b 4c 41'
dc h'61 6c 7b 76 55 58 4f 42 09 04 13 1e 3d 30 27 2a'
dc h'b1 bc ab a6 85 88 9f 92 d9 d4 c3 ce ed e0 f7 fa'
dc h'b7 ba ad a0 83 8e 99 94 df d2 c5 c8 eb e6 f1 fc'
dc h'67 6a 7d 70 53 5e 49 44 0f 02 15 18 3b 36 21 2c'
dc h'0c 01 16 1b 38 35 22 2f 64 69 7e 73 50 5d 4a 47'
dc h'dc d1 c6 cb e8 e5 f2 ff b4 b9 ae a3 80 8d 9a 97'
XtimeE anop
dc h'00 0e 1c 12 38 36 24 2a 70 7e 6c 62 48 46 54 5a'
dc h'e0 ee fc f2 d8 d6 c4 ca 90 9e 8c 82 a8 a6 b4 ba'
dc h'db d5 c7 c9 e3 ed ff f1 ab a5 b7 b9 93 9d 8f 81'
dc h'3b 35 27 29 03 0d 1f 11 4b 45 57 59 73 7d 6f 61'
dc h'ad a3 b1 bf 95 9b 89 87 dd d3 c1 cf e5 eb f9 f7'
dc h'4d 43 51 5f 75 7b 69 67 3d 33 21 2f 05 0b 19 17'
dc h'76 78 6a 64 4e 40 52 5c 06 08 1a 14 3e 30 22 2c'
dc h'96 98 8a 84 ae a0 b2 bc e6 e8 fa f4 de d0 c2 cc'
dc h'41 4f 5d 53 79 77 65 6b 31 3f 2d 23 09 07 15 1b'
dc h'a1 af bd b3 99 97 85 8b d1 df cd c3 e9 e7 f5 fb'
dc h'9a 94 86 88 a2 ac be b0 ea e4 f6 f8 d2 dc ce c0'
dc h'7a 74 66 68 42 4c 5e 50 0a 04 16 18 32 3c 2e 20'
dc h'ec e2 f0 fe d4 da c8 c6 9c 92 80 8e a4 aa b8 b6'
dc h'0c 02 10 1e 34 3a 28 26 7c 72 60 6e 44 4a 58 56'
dc h'37 39 2b 25 0f 01 13 1d 47 49 5b 55 7f 71 63 6d'
dc h'd7 d9 cb c5 ef e1 f3 fd a7 a9 bb b5 9f 91 83 8d'
Rcon anop
dc h'01 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00'
dc h'02 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00'
dc h'04 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00'
dc h'08 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
dc h'10 00 04 00 00 00 00 00 00 08 00 00 00 00 00 00'
dc h'20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
dc h'40 10 08 00 00 00 00 00 00 00 00 00 00 00 00 00'
dc h'80 00 00 00 00 00 00 00 00 20 00 00 00 00 00 00'
dc h'1b 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00'
dc h'36 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
dc h'6c 00 20 00 00 00 00 00 00 80 00 00 00 00 00 00'
dc h'd8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
dc h'ab 1b 40'
end
* Direct page locations
state1 gequ 0
state2 gequ 16
keysize gequ 32
rk gequ 33
* Constants used for keysize
keysize_128 gequ 0
keysize_192 gequ 64
keysize_256 gequ 128
* AES key expansion functions
* The appropriate one of these must be called before encrypting or decrypting.
* The key should be in the first 16/24/32 bytes of rk before calling this.
* Callable from C, with context structure pointer on stack.
aes128_expandkey start
CFunction AES128_EXPANDKEY
end
aes192_expandkey start
CFunction AES192_EXPANDKEY
end
aes256_expandkey start
CFunction AES256_EXPANDKEY
end
* Call with DP = AES context structure (with key present but not expanded),
* DB = bank containing AES tables.
AES128_EXPANDKEY start
using tables
stz keysize-1 ;keysize_128
ldx #16
clc
top anop
ExpandKeyCore 16,0
ExpandKeyIter 16,3
txa
adc #16
tax
cmp #16*11
blt top
rtl
end
AES192_EXPANDKEY start
using tables
lda #keysize_192|8
sta keysize-1
ldx #24
clc
top anop
ExpandKeyCore 24,1
ExpandKeyIter 24,5
txa
adc #24
tax
cmp #16*13
blt top
rtl
end
AES256_EXPANDKEY start
using tables
lda #keysize_256|8
sta keysize-1
ldx #32
clc
top anop
ExpandKeyCore 32,2
ExpandKeyIter 32,3
txa
adc #16
tax
cmp #16*15
bge done
ExpandKeySubst 32,2
ExpandKeyIter 32,3
txa
adc #16
tax
brl top
done rtl
end
* AES encryption function
* This performs AES-128, AES-192, or AES-256 encryption, depending on the key.
* The unencrypted input and encrypted output are in state1.
* Callable from C, with context structure pointer on stack.
aes_encrypt start
CFunction AES_ENCRYPT
end
* Call with DP = AES context structure (with key expanded),
* DB = bank containing AES tables.
AES_ENCRYPT start
using tables
AddInitialRoundKey
ShortRegs
NormalRound 1
NormalRound 2
NormalRound 3
NormalRound 4
NormalRound 5
NormalRound 6
NormalRound 7
NormalRound 8
NormalRound 9
lda keysize
bne cont1
jmp finish_aes128
cont1 NormalRound 10
NormalRound 11
lda keysize
bmi cont2
jmp finish_aes192
cont2 NormalRound 12
NormalRound 13
finish_aes256 anop
FinalRound 14
LongRegs
rtl
finish_aes192 anop
FinalRound 12
LongRegs
rtl
finish_aes128 anop
FinalRound 10
LongRegs
rtl
end
* AES decryption functions
* The encrypted input and unencrypted output are in state1.
* Callable from C, with context structure pointer on stack.
aes_decrypt start
CFunction AES_DECRYPT
end
aes128_decrypt start
CFunction AES128_DECRYPT
end
aes192_decrypt start
CFunction AES192_DECRYPT
end
aes256_decrypt start
CFunction AES256_DECRYPT
end
* Call with DP = AES context structure (with key expanded),
* DB = bank containing AES tables.
AES_DECRYPT start
using tables
ShortRegs
lda keysize
bne not128
jmp aes128_decrypt_internal
not128 bmi aes256_decrypt_internal
jmp aes192_decrypt_internal
AES256_DECRYPT entry
ShortRegs
aes256_decrypt_internal anop
InvFinalRound 14
InvNormalRound 13
InvNormalRound 12
jmp cont1
AES192_DECRYPT entry
ShortRegs
aes192_decrypt_internal anop
InvFinalRound 12
cont1 anop
InvNormalRound 11
InvNormalRound 10
jmp cont2
AES128_DECRYPT entry
ShortRegs
aes128_decrypt_internal anop
InvFinalRound 10
cont2 anop
InvNormalRound 9
InvNormalRound 8
InvNormalRound 7
InvNormalRound 6
InvNormalRound 5
InvNormalRound 4
InvNormalRound 3
InvNormalRound 2
InvNormalRound 1
LongRegs
rtl
end
|
oeis/123/A123025.asm | neoneye/loda-programs | 11 | 2149 | ; A123025: a(n) = n!*b(n), where b(n) = (1 + n - n^2)*b(n-2)/(n*(n-1)), b(0) = b(1) = 1.
; Submitted by <NAME>
; 1,1,-1,-5,11,95,-319,-3895,17545,276545,-1561505,-30143405,204557155,4672227775,-37024845055,-976495604975,8848937968145,264630308948225,-2698926080284225,-90238935351344725,1022892984427721275,37810113912213439775,-471553665821179507775,-19094107525667787086375,259826069867469908784025,11437370407875004464738625,-168627119343987970800832225,-8017596655920378129781776125,127313475104710917954628329875,6502270887951426663253020437375,-110635409865993787702572018661375
mov $3,2
lpb $0
mov $2,$3
mul $2,$0
sub $0,1
mul $2,$0
sub $0,1
div $2,-1
add $3,$2
lpe
mov $0,$3
div $0,2
|
programs/oeis/030/A030877.asm | neoneye/loda | 22 | 243742 | <reponame>neoneye/loda<gh_stars>10-100
; A030877: [ exp(1/19)*n! ].
; 1,2,6,25,126,758,5312,42498,382490,3824904,42073953,504887441,6563536741,91889514383,1378342715752,22053483452034,374909218684590,6748365936322623,128218952790129851,2564379055802597036
add $0,1
mov $2,1
lpb $0
mul $2,$0
sub $0,1
div $1,19
add $1,$2
lpe
mov $0,$1
|
src/main/antlr/com/github/jasync_sql_extensions/SqlLexer.g4 | 28Smiles/jasync-sql-extensions | 7 | 4375 | lexer grammar SqlLexer;
@header {
package com.github.jasync_sql_extensions;
}
/* Lovingly lifted from https://github.com/jdbi/jdbi/blob/master/core/src/main/antlr4/org/jdbi/v3/core/internal/lexer/ColonStatementLexer.g4 */
fragment QUOTE: '\'';
fragment ESCAPE: '\\';
fragment ESCAPE_QUOTE: ESCAPE QUOTE;
fragment DOUBLE_QUOTE: '"';
fragment COLON: {_input.LA(2) != ':'}? ':';
fragment DOUBLE_COLON: {_input.LA(2) == ':'}? '::';
fragment QUESTION: {_input.LA(2) != '?'}? '?';
fragment DOUBLE_QUESTION: {_input.LA(2) == '?'}? '??';
fragment NAME: JAVA_LETTER | [0-9] | '.' | '?.';
/* Lovingly lifted from https://github.com/antlr/grammars-v4/blob/master/java/JavaLexer.g4 */
fragment JAVA_LETTER : [a-zA-Z$_] | ~[\u0000-\u007F\uD800-\uDBFF] | [\uD800-\uDBFF] [\uDC00-\uDFFF];
COMMENT: '/*' .*? '*/';
QUOTED_TEXT: QUOTE (ESCAPE_QUOTE | ~'\'')* QUOTE;
DOUBLE_QUOTED_TEXT: DOUBLE_QUOTE (~'"')+ DOUBLE_QUOTE;
ESCAPED_TEXT : ESCAPE . ;
NAMED_PARAM: COLON (NAME)+;
POSITIONAL_PARAM: QUESTION;
LITERAL: DOUBLE_COLON | DOUBLE_QUESTION | .;
|
Transynther/x86/_processed/NC/_zr_/i7-8650U_0xd2_notsx.log_12_1535.asm | ljhsiun2/medusa | 9 | 83145 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r15
push %r8
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0xd1df, %r15
nop
nop
sub %rsi, %rsi
mov $0x6162636465666768, %r13
movq %r13, %xmm3
movups %xmm3, (%r15)
nop
nop
nop
nop
nop
dec %r15
lea addresses_D_ht+0x1791f, %r8
nop
nop
nop
nop
and $58732, %r14
movb (%r8), %cl
nop
xor $41107, %r14
lea addresses_D_ht+0x81a3, %r13
nop
nop
xor %r10, %r10
mov $0x6162636465666768, %r14
movq %r14, (%r13)
nop
add %r10, %r10
lea addresses_WC_ht+0xcdf, %r13
nop
nop
mfence
mov $0x6162636465666768, %r8
movq %r8, %xmm0
movups %xmm0, (%r13)
nop
nop
nop
nop
nop
xor $28758, %r13
lea addresses_A_ht+0x14edf, %r10
nop
nop
nop
nop
sub %rsi, %rsi
movups (%r10), %xmm3
vpextrq $0, %xmm3, %r8
nop
nop
nop
sub $47817, %r8
lea addresses_A_ht+0xec5f, %r13
nop
nop
nop
nop
nop
add %r15, %r15
movups (%r13), %xmm6
vpextrq $0, %xmm6, %rsi
nop
nop
nop
nop
nop
sub $54463, %r14
lea addresses_D_ht+0x691f, %r13
nop
nop
nop
nop
nop
sub $21193, %r10
movw $0x6162, (%r13)
nop
nop
nop
nop
nop
and $41271, %r15
lea addresses_A_ht+0xd0df, %r10
clflush (%r10)
nop
xor %rcx, %rcx
mov $0x6162636465666768, %r8
movq %r8, (%r10)
nop
nop
nop
dec %r13
lea addresses_WT_ht+0x1ca7f, %rsi
lea addresses_D_ht+0x1b35f, %rdi
nop
nop
add $23722, %r14
mov $19, %rcx
rep movsb
nop
nop
xor $30818, %r14
lea addresses_D_ht+0x44df, %rsi
lea addresses_A_ht+0x14bf7, %rdi
nop
nop
nop
cmp %r10, %r10
mov $39, %rcx
rep movsl
nop
sub $35451, %r8
lea addresses_UC_ht+0x1a67f, %rdi
nop
sub $30754, %rcx
and $0xffffffffffffffc0, %rdi
vmovntdqa (%rdi), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rsi
nop
nop
nop
add $37614, %rcx
lea addresses_normal_ht+0x152df, %r8
nop
nop
nop
cmp %r10, %r10
vmovups (%r8), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %r13
nop
nop
add $44457, %rcx
lea addresses_UC_ht+0xeb7f, %rsi
lea addresses_normal_ht+0x8157, %rdi
nop
nop
nop
nop
nop
and %r13, %r13
mov $24, %rcx
rep movsq
nop
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_UC_ht+0x1ab9f, %rsi
lea addresses_WT_ht+0x5d4f, %rdi
and %r14, %r14
mov $59, %rcx
rep movsb
cmp $19685, %r8
pop %rsi
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %r8
push %rax
push %rsi
// Load
mov $0x7d3ed700000004ff, %r8
nop
add $46527, %r14
vmovups (%r8), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %rsi
nop
nop
dec %r14
// Store
mov $0x15f, %rax
nop
nop
nop
xor $43089, %r12
movl $0x51525354, (%rax)
nop
and $54585, %r8
// Load
lea addresses_A+0x8df, %rsi
nop
nop
and %r13, %r13
movb (%rsi), %al
nop
nop
nop
nop
nop
cmp $44717, %r8
// Faulty Load
mov $0x445afe00000000df, %r12
nop
nop
nop
nop
and $13269, %r13
vmovups (%r12), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %r11
lea oracles, %r13
and $0xff, %r11
shlq $12, %r11
mov (%r13,%r11,1), %r11
pop %rsi
pop %rax
pop %r8
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': True}}
{'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': 2, 'AVXalign': False, 'NT': True, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}}
{'00': 12}
00 00 00 00 00 00 00 00 00 00 00 00
*/
|
配套代码/L035/L035/1.1.asm | zmrbak/ReverseAnalysis | 35 | 91802 | ; Listing generated by Microsoft (R) Optimizing Compiler Version 19.24.28117.0
TITLE C:\Users\libit\source\repos\L035\L035\L035.cpp
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB LIBCMT
INCLUDELIB OLDNAMES
CONST SEGMENT
$SG5559 DB 'Hello World!', 0aH, 00H
ORG $+2
$SG5560 DB '%f', 0aH, 00H
$SG5561 DB '%f', 0aH, 00H
CONST ENDS
PUBLIC ___local_stdio_printf_options
PUBLIC __vfprintf_l
PUBLIC _printf
PUBLIC ?d_max@@YANNN@Z ; d_max
PUBLIC _main
PUBLIC ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA ; `__local_stdio_printf_options'::`2'::_OptionsStorage
PUBLIC __real@400b333333333333
PUBLIC __real@4016666666666666
EXTRN ___acrt_iob_func:PROC
EXTRN ___stdio_common_vfprintf:PROC
EXTRN __fltused:DWORD
; COMDAT ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA
_BSS SEGMENT
?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA DQ 01H DUP (?) ; `__local_stdio_printf_options'::`2'::_OptionsStorage
_BSS ENDS
; COMDAT __real@4016666666666666
CONST SEGMENT
__real@4016666666666666 DQ 04016666666666666r ; 5.6
CONST ENDS
; COMDAT __real@400b333333333333
CONST SEGMENT
__real@400b333333333333 DQ 0400b333333333333r ; 3.4
CONST ENDS
; Function compile flags: /Ogtpy
_TEXT SEGMENT
_main PROC
; File C:\Users\libit\source\repos\L035\L035\L035.cpp
; Line 13
push OFFSET $SG5559
call _printf
; Line 14
movsd xmm0, QWORD PTR __real@400b333333333333
push ecx
movsd QWORD PTR [esp], xmm0
push OFFSET $SG5560
call _printf
; Line 15
movsd xmm0, QWORD PTR __real@4016666666666666
add esp, 4
movsd QWORD PTR [esp], xmm0
push OFFSET $SG5561
call _printf
add esp, 12 ; 0000000cH
; Line 16
xor eax, eax
ret 0
_main ENDP
_TEXT ENDS
; Function compile flags: /Ogtpy
_TEXT SEGMENT
_a$ = 8 ; size = 8
_b$ = 16 ; size = 8
?d_max@@YANNN@Z PROC ; d_max
; File C:\Users\libit\source\repos\L035\L035\L035.cpp
; Line 7
movsd xmm0, QWORD PTR _a$[esp-4]
comisd xmm0, QWORD PTR _b$[esp-4]
jbe SHORT $LN2@d_max
fld QWORD PTR _a$[esp-4]
; Line 9
ret 0
$LN2@d_max:
; Line 8
fld QWORD PTR _b$[esp-4]
; Line 9
ret 0
?d_max@@YANNN@Z ENDP ; d_max
_TEXT ENDS
; Function compile flags: /Ogtpy
; COMDAT _printf
_TEXT SEGMENT
__Format$ = 8 ; size = 4
_printf PROC ; COMDAT
; File C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h
; Line 954
push esi
; Line 958
mov esi, DWORD PTR __Format$[esp]
push 1
call ___acrt_iob_func
add esp, 4
; Line 643
lea ecx, DWORD PTR __Format$[esp+4]
push ecx
push 0
push esi
push eax
call ___local_stdio_printf_options
push DWORD PTR [eax+4]
push DWORD PTR [eax]
call ___stdio_common_vfprintf
add esp, 24 ; 00000018H
; Line 960
pop esi
; Line 961
ret 0
_printf ENDP
_TEXT ENDS
; Function compile flags: /Ogtpy
; COMDAT __vfprintf_l
_TEXT SEGMENT
__Stream$ = 8 ; size = 4
__Format$ = 12 ; size = 4
__Locale$ = 16 ; size = 4
__ArgList$ = 20 ; size = 4
__vfprintf_l PROC ; COMDAT
; File C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h
; Line 643
push DWORD PTR __ArgList$[esp-4]
push DWORD PTR __Locale$[esp]
push DWORD PTR __Format$[esp+4]
push DWORD PTR __Stream$[esp+8]
call ___local_stdio_printf_options
push DWORD PTR [eax+4]
push DWORD PTR [eax]
call ___stdio_common_vfprintf
add esp, 24 ; 00000018H
; Line 644
ret 0
__vfprintf_l ENDP
_TEXT ENDS
; Function compile flags: /Ogtpy
; COMDAT ___local_stdio_printf_options
_TEXT SEGMENT
___local_stdio_printf_options PROC ; COMDAT
; File C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corecrt_stdio_config.h
; Line 88
mov eax, OFFSET ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA ; `__local_stdio_printf_options'::`2'::_OptionsStorage
; Line 89
ret 0
___local_stdio_printf_options ENDP
_TEXT ENDS
END
|
test/fail/Issue402.agda | larrytheliquid/agda | 1 | 5123 | module Issue402 where
record Unit : Set where
constructor inn
field
out : Unit
data _==_ {A : Set}(a : A) : A -> Set where
refl : a == a
test : (x y : Unit) -> x == y
test x y = refl
-- this used to cause an infinite loop in the conversion checker
-- now it fails, because no eta-laws are generated for the
-- unguarded recursive record Unit
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1174.asm | ljhsiun2/medusa | 9 | 99177 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x203e, %rsi
cmp $56840, %r8
vmovups (%rsi), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %r10
nop
nop
nop
nop
xor $9695, %r12
lea addresses_A_ht+0xa41c, %rsi
nop
xor $31270, %r9
movups (%rsi), %xmm1
vpextrq $0, %xmm1, %r8
and %r9, %r9
lea addresses_normal_ht+0xd852, %rbx
nop
sub $47200, %rcx
mov $0x6162636465666768, %rsi
movq %rsi, (%rbx)
nop
nop
nop
nop
nop
dec %rsi
lea addresses_WC_ht+0x1121c, %r8
clflush (%r8)
nop
nop
nop
and $59265, %r9
movb $0x61, (%r8)
nop
add $48554, %rsi
lea addresses_WT_ht+0x1d396, %r10
nop
nop
nop
nop
dec %rsi
movb $0x61, (%r10)
nop
nop
xor %rcx, %rcx
lea addresses_WT_ht+0xfa5c, %rsi
lea addresses_WT_ht+0x129a4, %rdi
nop
nop
and %r10, %r10
mov $111, %rcx
rep movsb
nop
nop
nop
sub $19631, %r8
lea addresses_WT_ht+0x1d11c, %r8
nop
nop
nop
nop
nop
inc %r9
vmovups (%r8), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %r12
nop
sub %rcx, %rcx
lea addresses_WC_ht+0xe6dc, %r8
nop
nop
nop
nop
dec %rcx
movb (%r8), %r10b
nop
add %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %r9
push %rdi
push %rdx
push %rsi
// Store
lea addresses_PSE+0x1faa8, %r13
nop
nop
nop
nop
and $52778, %rsi
movb $0x51, (%r13)
nop
nop
nop
xor %r10, %r10
// Store
lea addresses_D+0x191dc, %r10
clflush (%r10)
nop
nop
nop
nop
nop
add %r9, %r9
movb $0x51, (%r10)
nop
nop
nop
nop
nop
add $54185, %rdx
// Load
lea addresses_normal+0x1621c, %r10
xor $51716, %rdi
mov (%r10), %dx
nop
nop
nop
nop
nop
sub $23695, %rsi
// Store
lea addresses_normal+0x788e, %r15
clflush (%r15)
nop
cmp $24548, %r13
movb $0x51, (%r15)
inc %r15
// Faulty Load
lea addresses_normal+0x1621c, %r9
nop
sub %rsi, %rsi
mov (%r9), %r13d
lea oracles, %rdi
and $0xff, %r13
shlq $12, %r13
mov (%rdi,%r13,1), %r13
pop %rsi
pop %rdx
pop %rdi
pop %r9
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
programs/oeis/017/A017140.asm | karttu/loda | 1 | 11971 | <gh_stars>1-10
; A017140: a(n) = (8*n+6)^4.
; 1296,38416,234256,810000,2085136,4477456,8503056,14776336,24010000,37015056,54700816,78074896,108243216,146410000,193877776,252047376,322417936,406586896,506250000,623201296,759333136,916636176,1097199376,1303210000,1536953616,1800814096,2097273616,2428912656,2798410000,3208542736,3662186256,4162314256,4711998736,5314410000,5972816656,6690585616,7471182096,8318169616,9235210000,10226063376,11294588176,12444741136,13680577296,15006250000,16426010896,17944209936,19565295376,21293813776,23134410000,25091827216,27170906896,29376588816,31713911056,34188010000,36804120336,39567575056,42483805456,45558341136,48796810000,52204938256,55788550416,59553569296,63506016016,67652010000,71997768976,76549608976,81313944336,86297287696,91506250000,96947540496,102627966736,108554434576,114733948176,121173610000,127880620816,134862279696,142125984016,149679229456,157529610000,165684817936,174152643856,182940976656,192057803536,201511210000,211309379856,221460595216,231973236496,242855782416,254116810000,265764994576,277809109776,290258027536,303120718096,316406250000,330123790096,344282603536,358892053776,373961602576,389500810000,405519334416,422026932496,439033459216,456548867856,474583210000,493146635536,512249392656,531901827856,552114385936,572897610000,594262141456,616218720016,638778183696,661951468816,685749610000,710183740176,735265090576,761004990736,787414868496,814506250000,842290759696,870780120336,899986152976,929920776976,960596010000,992023968016,1024216865296,1057187014416,1090946826256,1125508810000,1160885573136,1197089821456,1234134359056,1272032088336,1310796010000,1350439223056,1390974924816,1432416410896,1474777075216,1518070410000,1562310005776,1607509551376,1653682833936,1700843738896,1749006250000,1798184449296,1848392517136,1899644732176,1951955471376,2005339210000,2059810521616,2115384078096,2172074649616,2229897104656,2288866410000,2348997630736,2410305930256,2472806570256,2536514910736,2601446410000,2667616624656,2735041209616,2803735918096,2873716601616,2944999210000,3017599791376,3091534492176,3166819557136,3243471329296,3321506250000,3400940858896,3481791793936,3564075791376,3647809685776,3733010410000,3819694995216,3907880570896,3997584364816,4088823703056,4181616010000,4275978808336,4371929719056,4469486461456,4568666853136,4669488810000,4771970346256,4876129574416,4981984705296,5089554048016,5198856010000,5309909096976,5422731912976,5537343160336,5653761639696,5772006250000,5892095988496,6014049950736,6137887330576,6263627420176,6391289610000,6520893388816,6652458343696,6786004160016,6921550621456,7059117610000,7198725105936,7340393187856,7484142032656,7629991915536,7777963210000,7928076387856,8080352019216,8234810772496,8391473414416,8550360810000,8711493922576,8874893813776,9040581643536,9208578670096,9378906250000,9551585838096,9726638987536,9904087349776,10083952674576,10266256810000,10451021702416,10638269396496,10828022035216,11020301859856,11215131210000,11412532523536,11612528336656,11815141283856,12020394097936,12228309610000,12438910749456,12652220544016,12868262119696,13087058700816,13308633610000,13533010268176,13760212194576,13990263006736,14223186420496,14459006250000,14697746407696,14939430904336,15184083848976,15431729448976,15682392010000,15936095936016
mov $1,$0
mul $1,8
add $1,6
pow $1,4
|
src/startover.applescript | mitchchn/1password-reset | 3 | 3948 | (*
Data Reset Utility for 1Password 5 v0.5.1
By <NAME>
2016-07-16
*)
set agileBitsStore to "com.agilebits.onepassword4"
set agileBitsStoreMini to "2BUA8C4S2C.com.agilebits.onepassword4-helper"
set agileBitsStoreSourcePath to "Library/Application Support/1Password 4"
set agileBitsStoreOutPath to "Desktop/Old 1Password data (AgileBits Store)"
set macAppStore to "com.agilebits.onepassword-osx"
set macAppStoreMini to "2BUA8C4S2C.com.agilebits.onepassword-osx-helper"
set macAppStoreSourcePath to "Library/Containers/2BUA8C4S2C.com.agilebits.onepassword-osx-helper"
set macAppStoreOutPath to "Desktop/Old 1Password data (Mac App Store)"
-- functions
on exists anApplication
try
tell application "Finder" to get application file id anApplication
return true
on error
return false
end try
end exists
to fullyQuit out of onePassword given mini:onePasswordMini
if application id onePassword is running then tell application id onePassword to quit
if application id onePasswordMini is running then tell application id onePasswordMini to quit
repeat until (application id onePassword is not running and application id onePasswordMini is not running)
-- pause until 1Password has fully quit
end repeat
end fullyQuit
to moveStuff from sourcePath into outPath
set timestamp to do shell script "date " & quoted form of "+%Y-%m-%d %H_%M_%S"
set dest to outPath & " " & timestamp
try
do shell script "mv ~/" & quoted form of sourcePath & " ~/" & quoted form of dest
end try
end moveStuff
-- script entry point
display alert "Data Reset Utility for 1Password 5" message "Please back up your 1Password data before you continue! This utility will place a copy of your 1Password vaults and backups on your desktop and then delete the originals along with your 1Password preferences." buttons {"Cancel", "How to make a backup", "Continue"} default button 1
set response to button returned of the result
if response is "Cancel" then
return
else if response is "How to make a backup" then
open location "https://support.1password.com/guides/mac/backup-preferences.html"
return
end if
if exists agileBitsStore then
fullyQuit out of agileBitsStore given mini:agileBitsStoreMini
end if
if exists macAppStore then
fullyQuit out of macAppStore given mini:macAppStoreMini
end if
moveStuff from macAppStoreSourcePath into macAppStoreOutPath
moveStuff from agileBitsStoreSourcePath into agileBitsStoreOutPath
-- delete prefs
try
do shell script "rm ~/Library/Preferences/BUA8C4S2C.com.agilebits.onepassword4-helper.plist"
do shell script "rm ~/Library/Preferences/com.agilebits.onepassword4.plist"
end try
try
do shell script "killall cfprefsd" -- reload prefs daemon (necessary on 10.9+)
end try
-- restart app
display dialog "1Password has been reset. Ready to start over!" buttons "Launch 1Password" default button 1
if the button returned of the result is "Launch 1Password" then
if exists agileBitsStore then
tell application id agileBitsStore to activate
else
tell application id macAppStore to activate
end if
end if |
xor.asm | daniyalmarofi/assembly | 0 | 91104 | ; R3=XOR(R1,R2)
; XOR(R1,R2) = OR(AND(NOT(R1),R2),AND(R1,NOT(R2)))
; = NOT(AND(NOT(AND(NOT(R1),R2)),NOT(AND(R1,NOT(R2)))))
.ORIG x3000
NOT R1,R1 ; NOT(R1)
AND R3,R1,R2 ; AND(NOT(R1),R2)
NOT R1,R1 ; NOT(NOT(R1))=R1
NOT R2,R2 ; NOT(R2)
AND R4,R1,R2 ; AND(R1,NOT(R2))
NOT R2,R2 ; NOT(NOT(R2))=R2
NOT R3,R3 ; NOT(AND(NOT(R1),R2))
NOT R4,R4 ; NOT(AND(R1,NOT(R2)))
AND R3,R3,R4 ; AND(NOT(AND(NOT(R1),R2)),NOT(AND(R1,NOT(R2))))
NOT R3,R3 ; NOT(AND(NOT(AND(NOT(R1),R2)),NOT(AND(R1,NOT(R2)))))
HALT
.END |
programs/oeis/211/A211522.asm | neoneye/loda | 22 | 169743 | <gh_stars>10-100
; A211522: Number of ordered triples (w,x,y) with all terms in {1,...,n} and w + 5y = 2x.
; 0,0,0,1,2,3,4,6,8,11,13,16,19,23,27,31,35,40,45,51,56,62,68,75,82,89,96,104,112,121,129,138,147,157,167,177,187,198,209,221,232,244,256,269,282,295,308,322,336,351,365,380,395,411,427,443,459,476,493,511,528,546,564,583,602,621,640,660,680,701,721,742,763,785,807,829,851,874,897,921,944,968,992,1017,1042,1067,1092,1118,1144,1171,1197,1224,1251,1279,1307,1335,1363,1392,1421,1451
mov $2,1
mov $3,$0
add $3,2
lpb $0
add $1,$0
sub $0,1
trn $0,1
trn $3,$2
trn $1,$3
mov $2,5
lpe
mov $0,$1
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/access2.ads | best08618/asylo | 7 | 3261 | <reponame>best08618/asylo
-- { dg-do compile }
package Access2 is
type Priv;
type Inc is access Priv;
type Priv is access Inc;
C : constant Priv := new Inc;
end Access2;
|
Transynther/x86/_processed/AVXALIGN/_st_zr_un_/i7-8650U_0xd2.log_12682_886.asm | ljhsiun2/medusa | 9 | 7348 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x47eb, %r14
clflush (%r14)
nop
nop
nop
nop
xor $8461, %rbp
movups (%r14), %xmm5
vpextrq $1, %xmm5, %r9
nop
nop
dec %r11
lea addresses_WT_ht+0x103cb, %rsi
lea addresses_A_ht+0x6c9, %rdi
nop
nop
nop
nop
xor %r8, %r8
mov $68, %rcx
rep movsw
nop
nop
nop
sub $61355, %rcx
lea addresses_UC_ht+0xf71b, %rsi
lea addresses_WT_ht+0x19ceb, %rdi
and $23629, %r8
mov $88, %rcx
rep movsb
nop
nop
nop
nop
nop
sub $53725, %rdi
lea addresses_UC_ht+0x1bb29, %r14
nop
nop
and %rdi, %rdi
mov (%r14), %r11d
nop
and $46676, %r14
lea addresses_UC_ht+0x1e44b, %rsi
lea addresses_UC_ht+0x24eb, %rdi
clflush (%rdi)
nop
sub %rbp, %rbp
mov $112, %rcx
rep movsw
nop
and $41046, %r14
lea addresses_A_ht+0xe2ab, %rbp
nop
nop
cmp $6563, %r14
vmovups (%rbp), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rcx
nop
nop
nop
nop
and %rbp, %rbp
lea addresses_normal_ht+0x120eb, %r14
nop
sub %r11, %r11
mov $0x6162636465666768, %rdi
movq %rdi, %xmm2
movups %xmm2, (%r14)
nop
and %rsi, %rsi
lea addresses_A_ht+0x7541, %rdi
nop
nop
nop
nop
add %r11, %r11
movups (%rdi), %xmm7
vpextrq $0, %xmm7, %r14
and %r9, %r9
lea addresses_WT_ht+0x184eb, %rsi
nop
nop
sub %rdi, %rdi
and $0xffffffffffffffc0, %rsi
vmovaps (%rsi), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rbp
nop
nop
nop
sub %r14, %r14
lea addresses_A_ht+0xf96b, %r14
clflush (%r14)
nop
nop
cmp %r11, %r11
mov (%r14), %edi
nop
nop
nop
nop
nop
dec %r8
lea addresses_A_ht+0x1b2eb, %rbp
nop
nop
nop
nop
sub %r11, %r11
mov $0x6162636465666768, %rdi
movq %rdi, %xmm5
and $0xffffffffffffffc0, %rbp
movaps %xmm5, (%rbp)
nop
nop
nop
add %r9, %r9
lea addresses_WT_ht+0xa52b, %r11
nop
nop
nop
nop
nop
add $25058, %r8
mov $0x6162636465666768, %r14
movq %r14, %xmm5
movups %xmm5, (%r11)
nop
nop
nop
nop
add %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %rax
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_RW+0x1a4eb, %rsi
lea addresses_PSE+0x1f1f, %rdi
dec %r12
mov $61, %rcx
rep movsq
nop
nop
nop
nop
sub %rdi, %rdi
// Store
lea addresses_normal+0x1189f, %r14
nop
nop
nop
cmp %rdi, %rdi
mov $0x5152535455565758, %rcx
movq %rcx, (%r14)
nop
cmp $4167, %r11
// Store
lea addresses_UC+0xe4eb, %r11
clflush (%r11)
nop
nop
and %rsi, %rsi
movb $0x51, (%r11)
nop
nop
nop
nop
cmp $15825, %rcx
// Faulty Load
mov $0xd287300000004eb, %rsi
nop
nop
nop
nop
nop
cmp $18751, %rcx
movb (%rsi), %r14b
lea oracles, %rcx
and $0xff, %r14
shlq $12, %r14
mov (%rcx,%r14,1), %r14
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_RW', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_PSE', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'00': 8812, '10': 3148, '51': 722}
00 10 00 00 10 10 00 00 00 00 10 10 00 00 00 00 10 00 10 10 00 00 00 10 00 10 00 00 51 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 10 00 00 00 00 00 10 00 10 10 00 00 51 00 10 00 00 10 00 00 00 00 00 00 00 51 00 00 00 10 00 10 00 00 00 10 00 51 10 10 00 00 00 00 00 00 10 00 00 00 00 00 00 10 51 00 00 51 00 00 00 00 00 10 10 00 00 51 10 10 10 00 00 10 00 00 00 10 00 00 00 51 00 10 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 10 10 00 00 00 10 10 00 00 00 51 10 00 00 00 00 00 00 10 00 00 00 00 10 00 00 00 00 00 00 00 00 00 10 00 00 00 00 10 00 10 00 00 00 00 00 00 10 00 10 10 00 51 00 00 00 00 00 51 00 00 10 00 10 10 10 00 00 00 00 00 00 00 10 10 10 10 00 00 00 00 00 00 00 00 00 00 00 10 10 00 00 00 00 00 00 00 51 00 00 51 10 00 00 10 00 00 00 10 10 10 00 00 51 00 00 00 10 10 10 00 00 00 00 00 00 00 10 00 10 00 00 00 10 10 10 00 00 00 10 51 00 10 00 00 00 10 00 00 00 10 00 00 00 00 10 00 00 00 00 00 10 00 00 10 00 00 10 00 00 00 10 10 00 00 51 10 10 00 00 00 00 00 10 00 00 10 00 00 10 10 00 00 00 00 10 00 00 00 10 00 10 00 00 00 00 00 00 00 10 00 00 00 00 00 10 00 10 00 10 00 10 51 10 10 00 00 00 10 00 10 00 00 10 00 00 00 51 00 00 00 51 10 51 10 00 00 00 00 00 00 00 00 00 10 00 00 00 10 00 10 10 00 00 10 00 00 00 00 10 10 00 51 00 00 00 00 00 10 00 10 10 00 10 00 00 10 00 10 00 00 00 00 00 00 00 10 00 00 00 00 51 00 10 00 00 00 00 00 00 00 00 00 00 00 10 10 00 00 00 00 00 00 10 00 00 00 51 10 00 10 10 00 51 00 00 00 00 51 00 51 00 00 00 00 00 00 00 00 00 51 10 00 00 10 00 10 00 00 00 10 00 00 00 00 00 00 00 00 00 00 10 10 10 00 10 51 10 00 00 00 00 00 00 00 00 00 00 00 00 10 10 10 10 00 00 10 00 00 10 00 10 10 10 51 00 00 00 00 51 00 10 00 10 10 00 10 00 00 00 00 00 00 00 51 00 00 10 00 00 00 00 00 10 10 00 00 00 51 00 00 00 00 00 10 00 00 10 10 00 00 00 00 10 10 00 00 10 00 10 00 10 00 00 00 10 00 00 00 10 10 00 00 00 00 00 00 00 00 10 10 00 00 00 51 00 00 00 10 00 00 00 10 00 00 00 00 00 10 00 00 00 10 10 00 00 00 00 00 00 00 00 51 10 00 10 00 51 00 00 10 51 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 10 51 10 00 00 10 00 00 00 00 00 00 00 10 00 00 00 10 00 00 51 00 00 00 10 00 10 00 00 00 10 00 10 10 00 00 10 51 00 00 00 00 00 00 00 00 00 10 00 00 10 00 10 10 00 10 00 10 00 10 10 00 00 00 00 00 00 00 10 00 00 00 00 10 00 00 00 10 00 00 51 00 10 10 00 10 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 10 10 00 10 00 10 00 00 00 00 10 00 10 00 51 51 00 00 10 00 00 00 10 00 00 00 10 00 10 00 00 10 51 00 00 00 51 00 10 00 10 00 10 00 00 00 00 10 00 00 10 00 10 00 00 00 00 51 10 00 00 00 00 00 00 51 10 00 10 00 00 00 00 10 00 00 00 10 10 00 00 10 00 00 00 10 00 10 00 10 00 00 00 00 00 00 00 00 10 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 51 10 51 00 10 10 00 10 00 00 10 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 51 51 00 10 00 00 00 00 10 00 00 00 00 00 00 10 00 10 00 10 00 00 10 00 10 00 00 00 00 10 51 00 00 00 00 00 00 00 10 00 10 00 10 00 00 00 00 00 00 10 00 51 51 10 10 51 10 10 00 00 51 00 00 00 00
*/
|
programs/oeis/121/A121782.asm | karttu/loda | 0 | 94275 | <gh_stars>0
; A121782: Series expansion for mean-squared radius of gyration of rectangles on square lattice.
; 0,8,66,288,900,2280,4998,9856,17928,30600,49610,77088,115596,168168,238350,330240,448528,598536,786258,1018400,1302420,1646568,2059926,2552448,3135000,3819400,4618458,5546016,6616988,7847400,9254430,10856448,12673056,14725128,17034850,19625760,22522788,25752296,29342118,33321600,37721640,42574728,47914986,53778208,60201900,67225320,74889518,83237376,92313648,102165000,112840050,124389408,136865716,150323688,164820150
mov $2,$0
add $0,1
pow $0,2
mov $1,2
add $1,$0
mul $2,$1
mov $1,$0
mul $1,$2
mul $1,64
div $1,384
mul $1,2
|
src/csv.ads | sebsgit/textproc | 0 | 12110 | <reponame>sebsgit/textproc
with Ada.Text_IO;
with Ada.Strings.Unbounded;
with DataBatch;
with MathUtils;
package CSV is
type Reader is tagged limited private;
function open(path: in String; separator: in Character := ',') return Reader;
function hasNext(r: in Reader) return Boolean;
function next(r: in out Reader) return MathUtils.Vector;
private
type Reader is tagged limited record
handle: Ada.Text_IO.File_Type;
nextLine: Ada.Strings.Unbounded.Unbounded_String;
hasMore: Boolean := False;
end record;
end CSV;
|
Categories/Support/SetoidPi.agda | copumpkin/categories | 98 | 13604 | {-# OPTIONS --universe-polymorphism #-}
module Categories.Support.SetoidPi where
open import Level
open import Function as Fun using (_on_)
open import Relation.Binary as B using () renaming (_=[_]⇒_ to _=[_]⇒₀_; _⇒_ to _⊆_)
open import Relation.Binary.PropositionalEquality as PE using (_≡_)
open import Relation.Binary.HeterogeneousEquality using (_≅_) renaming (refl to ≅-refl)
open import Relation.Binary.Indexed.Heterogeneous as I using (_=[_]⇒_)
open import Categories.Support.Equivalence
open import Categories.Support.SetoidFunctions as SF using (_⟶_) renaming (_⟨$⟩_ to _⟨$⟩₀_; cong to cong₀)
open Setoid using () renaming (Carrier to Carrier₀; _≈_ to _[_≈_])
_⟶[_,_] : ∀ {cf ℓf} (From : Setoid cf ℓf) (ct ℓt : Level) → Set (cf ⊔ ℓf ⊔ suc (ct ⊔ ℓt))
From ⟶[ ct , ℓt ] = From ⟶ set→setoid (Setoid ct ℓt)
------------------------------------------------------------------------
-- Indexed binary relations
------------------------------------------------------------------------
record IndexedSetoid {i iℓ} (I : Set i) (_∼_ : B.Rel I iℓ) c ℓ : Set (suc (i ⊔ iℓ ⊔ c ⊔ ℓ)) where
infix 4 _≈_
field
Carrier : I → Set c
_≈_ : I.IRel Carrier ℓ
.isEquivalence : I.IsIndexedEquivalence Carrier _≈_
-- NOTE one more field, see resp below
-- no irrelevant opens ☹
-- .open I.IsEquivalence isEquivalence public
private
module E = I.IsIndexedEquivalence
.refl : I.Reflexive Carrier _≈_
refl = E.refl isEquivalence
.sym : I.Symmetric Carrier _≈_
sym = E.sym isEquivalence
.trans : I.Transitive Carrier _≈_
trans = E.trans isEquivalence
.reflexive : ∀ {i} → _≡_ ⊆ (_≈_ {i})
reflexive = E.reflexive isEquivalence
-- conversion to regular setoids by evaluating at an index
_at_ : I → Setoid c ℓ
_at_ i = record
{ Carrier = Carrier i
; _≈_ = _≈_
; isEquivalence = record
{ refl = E.refl isEquivalence
; sym = E.sym isEquivalence
; trans = E.trans isEquivalence
}
}
-- XXX ideally i should redo the resp stuff and promotion and everything
-- with the proper setoid of setoids under equivalence, but first i didn't
-- make it yet and second OH MY GOD ─xplat
Resp-Type = _∼_ =[ _at_ ]⇒₀ _≡_ {A = Setoid c ℓ}
field
.resp : Resp-Type
resp-per : ∀ {c ℓ} {C₁ C₂ : Set c} {_≈₁_ : B.Rel C₁ ℓ} {_≈₂_ : B.Rel C₂ ℓ} {equiv₁ : B.IsEquivalence _≈₁_} {equiv₂ : B.IsEquivalence _≈₂_} → C₁ ≡ C₂ → _≈₁_ ≅ _≈₂_ → _≡_ {A = Setoid c ℓ} record {Carrier = C₁; _≈_ = _≈₁_; isEquivalence = equiv₁} record {Carrier = C₂; _≈_ = _≈₂_; isEquivalence = equiv₂}
resp-per _≡_.refl ≅-refl = _≡_.refl
.resp-per′ : ∀ {c ℓ} (S T : Setoid c ℓ) → (Carrier₀ S ≡ Carrier₀ T) → (Setoid._≈_ S ≅ Setoid._≈_ T) → S ≡ T
resp-per′ S T = resp-per {equiv₁ = Setoid.isEquivalence S} {equiv₂ = Setoid.isEquivalence T}
open IndexedSetoid using (_at_)
weaken : ∀ {c ℓ} → Setoid c ℓ → ∀ {i iℓ} {I : Set i} {_∼_ : B.Rel I iℓ} → IndexedSetoid I _∼_ c ℓ
weaken S {I = I} {_∼_} = record
{ Carrier = Fun.const S.Carrier
; _≈_ = S._≈_
; isEquivalence = record { refl = S.refl; sym = S.sym; trans = S.trans }
; resp = Fun.const _≡_.refl
}
where module S = Setoid S
{-
-- this definition is unusable because agda spins in circles trying to infer
-- ct and ℓt before it will extract any information from f's type, but f's
-- type is the only thing it can infer them from... test is below ☹
_[$]_ : ∀ {cf ℓf ct ℓt} {From : Setoid cf ℓf} → (From ⟶[ ct , ℓt ]) → Carrier From → Set ct
f [$] x = Carrier (f ⟨$⟩₀ x)
.test : ∀ {cf ℓf ct ℓt} {From : Setoid cf ℓf} (To : From ⟶[ ct , ℓt ]) (x : Carrier From) → (_[$]_ {ct = ct}{ℓt = ℓt} To x) → Set ℓt
test = {!!}
-}
-- i think this approach would work beautifully with regular setoids, but
-- with irrelevant setoids the type of cong can't depend on localize
-- ─ xplat
-- .localize : ∀ {cf ℓf ct ℓt} {From : Setoid cf ℓf} (To : From ⟶[ ct , ℓt ]) {x y : Carrier₀ From} → From [ x ≈ y ] → B.REL (Carrier₀ (To ⟨$⟩₀ x)) (Carrier₀ (To ⟨$⟩₀ y)) ℓt
-- localize To {x} x≈y with To ⟨$⟩₀ x | cong₀ To x≈y
-- localize To x≈y | ._ | _≡_.refl = Setoid._≈_ (To ⟨$⟩₀ _)
-- ... so it's on to yet another annoying heterogeneous equality type
module SetoidHetero {cf ℓf} (From : Setoid cf ℓf) (ct ℓt : Level) (To : From ⟶[ ct , ℓt ]) where
I = Carrier₀ From
To$ = _⟨$⟩₀_ To
To$C = Fun._∘_ Carrier₀ (_⟨$⟩₀_ To)
localize′ : ∀ {S T : Setoid ct ℓt} → (S ≡ T) → B.REL (Carrier₀ S) (Carrier₀ T) ℓt
-- localize′ {S} {T} S≡T
localize′ {S} _≡_.refl = Setoid._≈_ S
localize : ∀ {x y : I} → (To$ x ≡ To$ y) → B.REL (To$C x) (To$C y) ℓt
localize {x} {y} To$x≡To$y with To$ y
localize {x} _≡_.refl | ._ = Setoid._≈_ (To$ x)
data _≈∗_ {S T : Setoid ct ℓt} (x : Carrier₀ S) : (y : Carrier₀ T) → Set (suc (ct ⊔ ℓt)) where
locally : (S≡T : S ≡ T)
{y : Carrier₀ T} (x≈y : localize′ S≡T x y) →
_≈∗_ {S} {T} x y
_≈⋆_ : {iˣ iʸ : I} → B.REL (To$C iˣ) (To$C iʸ) (suc (ct ⊔ ℓt))
_≈⋆_ {iˣ} {iʸ} = _≈∗_ {To$ iˣ} {To$ iʸ}
asIndexed : ∀ {cf ℓf} ct ℓt {From : Setoid cf ℓf} → (From ⟶[ ct , ℓt ]) → IndexedSetoid (Carrier₀ From) (Setoid._≈_ From) ct (suc (ct ⊔ ℓt))
asIndexed ct ℓt {From} To = record
{ Carrier = To$C
; _≈_ = _≈⋆_
; isEquivalence = record
{ refl = my-refl
; sym = my-sym
; trans = my-trans
}
; resp = λ {i j} i∼j → resp-per′ (fake-at i) (fake-at j) (resp-helper i∼j) (resp-helper₂ i∼j)
}
where
open SetoidHetero _ ct ℓt To
.my-refl : I.Reflexive To$C _≈⋆_
my-refl {i} {x} = locally {To$ i} _≡_.refl ((Setoid.refl (To$ i)))
.sym-helper : ∀ i j (To$i≡To$j : To$ i ≡ To$ j) (x : To$C i) (y : To$C j) (x≈y : localize′ To$i≡To$j x y) → localize′ (PE.sym To$i≡To$j) y x
sym-helper i j To$i≡To$j x y with To$ j
sym-helper i j _≡_.refl x y | ._ = Setoid.sym (To$ i)
.my-sym : I.Symmetric To$C _≈⋆_
my-sym {i} {j} {x} {y} (locally To$i≡To$j x≈y) = locally (PE.sym To$i≡To$j) (sym-helper i j To$i≡To$j x y x≈y)
.trans-helper : ∀ i j k (To$i≡To$j : To$ i ≡ To$ j) (To$j≡To$k : To$ j ≡ To$ k) (x : To$C i) (y : To$C j) (z : To$C k) (x≈y : localize′ To$i≡To$j x y) (y≈z : localize′ To$j≡To$k y z) → localize′ (PE.trans To$i≡To$j To$j≡To$k) x z
trans-helper i j k To$i≡To$j To$j≡To$k x y z with To$ j | To$ k
trans-helper i j k _≡_.refl _≡_.refl x y z | ._ | ._ = Setoid.trans (To$ i)
.my-trans : I.Transitive To$C _≈⋆_
my-trans (locally To$i≡To$j x≈y) (locally To$j≡To$k y≈z) = locally (PE.trans To$i≡To$j To$j≡To$k) (trans-helper _ _ _ To$i≡To$j To$j≡To$k _ _ _ x≈y y≈z)
.resp-helper : ∀ {i j} → From [ i ≈ j ] → To$C i ≡ To$C j
resp-helper i∼j = PE.cong Carrier₀ (cong₀ To i∼j)
.resp-helper₃ : (S T : Setoid ct ℓt) → S ≡ T → _≈∗_ {S} {S} ≅ _≈∗_ {T} {T}
resp-helper₃ S .S _≡_.refl = ≅-refl
.resp-helper₂ : ∀ {i j} → From [ i ≈ j ] → _≈⋆_ {i} {i} ≅ _≈⋆_ {j} {j}
resp-helper₂ {i} {j} i∼j = resp-helper₃ (To$ i) (To$ j) (cong₀ To i∼j)
fake-at : ∀ i → Setoid ct (suc (ct ⊔ ℓt))
fake-at i = record
{ Carrier = To$C i
; _≈_ = _≈⋆_ {i} {i}
; isEquivalence = record
{ refl = my-refl
; sym = my-sym
; trans = my-trans
}
}
------------------------------------------------------------------------
-- Functions which preserve equality
record Π {f₁ f₂ t₁ t₂}
(From : Setoid f₁ f₂)
(To : IndexedSetoid (Carrier₀ From) (Setoid._≈_ From) t₁ t₂) :
Set (f₁ ⊔ f₂ ⊔ t₁ ⊔ t₂) where
open I using (_=[_]⇒_)
infixl 5 _⟨$⟩_
field
_⟨$⟩_ : (x : Carrier₀ From) → IndexedSetoid.Carrier To x
.cong : Setoid._≈_ From =[ _⟨$⟩_ ]⇒ IndexedSetoid._≈_ To
open Π public
Π′ : ∀ {cf ℓf} (ct ℓt : Level) (From : Setoid cf ℓf) (To : From ⟶[ ct , ℓt ]) → Set (cf ⊔ ℓf ⊔ suc (ct ⊔ ℓt))
Π′ ct ℓt From To = Π From (asIndexed ct ℓt To)
-- Pis that 'just happen' to be independent, instead of being necessarily so.
infixr 0 _⟶Π_
_⟶Π_ : ∀ {f₁ f₂ t₁ t₂} → Setoid f₁ f₂ → Setoid t₁ t₂ → Set _
From ⟶Π To = Π From (weaken To)
-- Identity and composition.
id : ∀ {a₁ a₂} {A : Setoid a₁ a₂} → A ⟶Π A
id = record { _⟨$⟩_ = Fun.id; cong = Fun.id }
infixr 9 _∙′_
_∙′_ : ∀ {a₁ a₂} {A : Setoid a₁ a₂}
{b₁ b₂} {B : Setoid b₁ b₂}
{c₁ c₂} {C : Setoid c₁ c₂} →
B ⟶Π C → A ⟶Π B → A ⟶Π C
f ∙′ g = record
{ _⟨$⟩_ = Fun._∘_ (_⟨$⟩_ f) (_⟨$⟩_ g)
; cong = Fun._∘_ (cong f) (cong g)
}
infixr 9 _[_○_]
-- XXX this shouldn't need B, but it can't be inferred from f's type
_[_○_] : ∀ {a₁ a₂} {A : Setoid a₁ a₂}
{b₁ b₂} (B : Setoid b₁ b₂)
{c₁ c₂} (C : IndexedSetoid _ (Setoid._≈_ B) c₁ c₂) →
(A ⟶Π B) → IndexedSetoid _ _ c₁ c₂
B [ C ○ f ] = record
{ Carrier = Fun._∘_ C.Carrier (_⟨$⟩_ f)
; _≈_ = C._≈_
; isEquivalence = record { refl = C.refl; sym = C.sym; trans = C.trans }
; resp = Fun._∘_ C.resp (cong f)
}
where module C = IndexedSetoid C
-- PROPER. well, halfway.
infixr 9 _∙_
_∙_ : ∀ {a₁ a₂} {A : Setoid a₁ a₂}
{b₁ b₂} {B : Setoid b₁ b₂}
{c₁ c₂} {C : IndexedSetoid _ _ c₁ c₂} →
(f : Π B C) → (g : A ⟶Π B) → Π A (B [ C ○ g ])
f ∙ g = record
{ _⟨$⟩_ = Fun._∘_ (_⟨$⟩_ f) (_⟨$⟩_ g)
; cong = Fun._∘_ (cong f) (cong g)
}
-- Constant equality-preserving function.
const : ∀ {a₁ a₂} {A : Setoid a₁ a₂}
{b₁ b₂} {B : Setoid b₁ b₂} →
Carrier₀ B → A ⟶Π B
const {B = B} b = record
{ _⟨$⟩_ = Fun.const b
; cong = Fun.const (Setoid.refl B)
}
------------------------------------------------------------------------
-- Function setoids
-- Dependent.
setoid : ∀ {f₁ f₂ t₁ t₂}
(From : Setoid f₁ f₂) →
IndexedSetoid (Carrier₀ From) (Setoid._≈_ From) t₁ t₂ →
Setoid _ _
setoid From To = record
{ Carrier = Π From To
; _≈_ = λ f g → ∀ {x y} → x ≈₁ y → f ⟨$⟩ x ≈₂ g ⟨$⟩ y
; isEquivalence = record
{ refl = λ {f} → cong f
; sym = λ f∼g x∼y → To.sym (f∼g (From.sym x∼y))
; trans = λ f∼g g∼h x∼y → To.trans (f∼g From.refl) (g∼h x∼y)
}
}
where
open module From = Setoid From using () renaming (_≈_ to _≈₁_)
open module To = IndexedSetoid To using () renaming (_≈_ to _≈₂_)
|
src/test/ref/struct-ptr-28.asm | jbrandwood/kickc | 2 | 104549 | <reponame>jbrandwood/kickc<filename>src/test/ref/struct-ptr-28.asm
// Example of a struct containing an array
// It works on the surface - but illustrates the problem with structs containing arrays treating them like pointers.
// https://gitlab.com/camelot/kickc/issues/314
// Commodore 64 PRG executable file
.file [name="struct-ptr-28.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.const SIZEOF_STRUCT_PERSON = $11
.const OFFSET_STRUCT_PERSON_NAME = 1
.label SCREEN = $400
.segment Code
main: {
.label jesper = 8
.label henriette = $19
// struct Person jesper = { 4, "jesper" }
ldy #SIZEOF_STRUCT_PERSON
!:
lda __0-1,y
sta jesper-1,y
dey
bne !-
// print_person(&jesper)
ldx #0
lda #<jesper
sta.z print_person.person
lda #>jesper
sta.z print_person.person+1
jsr print_person
// struct Person henriette = { 7, "henriette" }
ldy #SIZEOF_STRUCT_PERSON
!:
lda __1-1,y
sta henriette-1,y
dey
bne !-
// print_person(&henriette)
lda #<henriette
sta.z print_person.person
lda #>henriette
sta.z print_person.person+1
jsr print_person
// }
rts
}
// void print_person(__zp(6) struct Person *person)
print_person: {
.label __1 = 2
.label __2 = 4
.label person = 6
// SCREEN[idx++] = DIGIT[person->id]
ldy #0
lda (person),y
tay
lda DIGIT,y
sta SCREEN,x
// SCREEN[idx++] = DIGIT[person->id];
inx
// SCREEN[idx++] = ' '
lda #' '
sta SCREEN,x
// SCREEN[idx++] = ' ';
inx
ldy #0
__b1:
// for(byte i=0; person->name[i]; i++)
lda #OFFSET_STRUCT_PERSON_NAME
clc
adc.z person
sta.z __1
lda #0
adc.z person+1
sta.z __1+1
lda (__1),y
cmp #0
bne __b2
// SCREEN[idx++] = ' '
lda #' '
sta SCREEN,x
// SCREEN[idx++] = ' ';
inx
// }
rts
__b2:
// SCREEN[idx++] = person->name[i]
lda #OFFSET_STRUCT_PERSON_NAME
clc
adc.z person
sta.z __2
lda #0
adc.z person+1
sta.z __2+1
lda (__2),y
sta SCREEN,x
// SCREEN[idx++] = person->name[i];
inx
// for(byte i=0; person->name[i]; i++)
iny
jmp __b1
}
.segment Data
DIGIT: .text "0123456789"
.byte 0
__0: .byte 4
.text "jesper"
.byte 0
.fill 9, 0
__1: .byte 7
.text "henriette"
.byte 0
.fill 6, 0
|
src/gnat/prj.adb | Letractively/ada-gen | 0 | 22235 | <filename>src/gnat/prj.adb
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-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. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Debug;
with Osint; use Osint;
with Output; use Output;
with Prj.Attr;
with Prj.Err; use Prj.Err;
with Snames; use Snames;
with Uintp; use Uintp;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Unchecked_Deallocation;
with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.HTable;
package body Prj is
Object_Suffix : constant String := Get_Target_Object_Suffix.all;
-- File suffix for object files
Initial_Buffer_Size : constant := 100;
-- Initial size for extensible buffer used in Add_To_Buffer
The_Empty_String : Name_Id := No_Name;
type Cst_String_Access is access constant String;
All_Lower_Case_Image : aliased constant String := "lowercase";
All_Upper_Case_Image : aliased constant String := "UPPERCASE";
Mixed_Case_Image : aliased constant String := "MixedCase";
The_Casing_Images : constant array (Known_Casing) of Cst_String_Access :=
(All_Lower_Case => All_Lower_Case_Image'Access,
All_Upper_Case => All_Upper_Case_Image'Access,
Mixed_Case => Mixed_Case_Image'Access);
Project_Empty : constant Project_Data :=
(Qualifier => Unspecified,
Externally_Built => False,
Config => Default_Project_Config,
Name => No_Name,
Display_Name => No_Name,
Path => No_Path_Information,
Virtual => False,
Location => No_Location,
Mains => Nil_String,
Directory => No_Path_Information,
Library => False,
Library_Dir => No_Path_Information,
Library_Src_Dir => No_Path_Information,
Library_ALI_Dir => No_Path_Information,
Library_Name => No_Name,
Library_Kind => Static,
Lib_Internal_Name => No_Name,
Standalone_Library => False,
Lib_Interface_ALIs => Nil_String,
Lib_Auto_Init => False,
Libgnarl_Needed => Unknown,
Symbol_Data => No_Symbols,
Interfaces_Defined => False,
Source_Dirs => Nil_String,
Source_Dir_Ranks => No_Number_List,
Object_Directory => No_Path_Information,
Library_TS => Empty_Time_Stamp,
Exec_Directory => No_Path_Information,
Extends => No_Project,
Extended_By => No_Project,
Languages => No_Language_Index,
Decl => No_Declarations,
Imported_Projects => null,
Include_Path_File => No_Path,
All_Imported_Projects => null,
Ada_Include_Path => null,
Ada_Objects_Path => null,
Objects_Path => null,
Objects_Path_File_With_Libs => No_Path,
Objects_Path_File_Without_Libs => No_Path,
Config_File_Name => No_Path,
Config_File_Temp => False,
Config_Checked => False,
Need_To_Build_Lib => False,
Has_Multi_Unit_Sources => False,
Depth => 0,
Unkept_Comments => False);
procedure Free (Project : in out Project_Id);
-- Free memory allocated for Project
procedure Free_List (Languages : in out Language_Ptr);
procedure Free_List (Source : in out Source_Id);
procedure Free_List (Languages : in out Language_List);
-- Free memory allocated for the list of languages or sources
procedure Free_Units (Table : in out Units_Htable.Instance);
-- Free memory allocated for unit information in the project
procedure Language_Changed (Iter : in out Source_Iterator);
procedure Project_Changed (Iter : in out Source_Iterator);
-- Called when a new project or language was selected for this iterator
function Contains_ALI_Files (Dir : Path_Name_Type) return Boolean;
-- Return True if there is at least one ALI file in the directory Dir
-------------------
-- Add_To_Buffer --
-------------------
procedure Add_To_Buffer
(S : String;
To : in out String_Access;
Last : in out Natural)
is
begin
if To = null then
To := new String (1 .. Initial_Buffer_Size);
Last := 0;
end if;
-- If Buffer is too small, double its size
while Last + S'Length > To'Last loop
declare
New_Buffer : constant String_Access :=
new String (1 .. 2 * Last);
begin
New_Buffer (1 .. Last) := To (1 .. Last);
Free (To);
To := New_Buffer;
end;
end loop;
To (Last + 1 .. Last + S'Length) := S;
Last := Last + S'Length;
end Add_To_Buffer;
---------------------------
-- Delete_Temporary_File --
---------------------------
procedure Delete_Temporary_File
(Tree : Project_Tree_Ref;
Path : Path_Name_Type)
is
Dont_Care : Boolean;
pragma Warnings (Off, Dont_Care);
begin
if not Debug.Debug_Flag_N then
if Current_Verbosity = High then
Write_Line ("Removing temp file: " & Get_Name_String (Path));
end if;
Delete_File (Get_Name_String (Path), Dont_Care);
for Index in
1 .. Temp_Files_Table.Last (Tree.Private_Part.Temp_Files)
loop
if Tree.Private_Part.Temp_Files.Table (Index) = Path then
Tree.Private_Part.Temp_Files.Table (Index) := No_Path;
end if;
end loop;
end if;
end Delete_Temporary_File;
---------------------------
-- Delete_All_Temp_Files --
---------------------------
procedure Delete_All_Temp_Files (Tree : Project_Tree_Ref) is
Dont_Care : Boolean;
pragma Warnings (Off, Dont_Care);
Path : Path_Name_Type;
begin
if not Debug.Debug_Flag_N then
for Index in
1 .. Temp_Files_Table.Last (Tree.Private_Part.Temp_Files)
loop
Path := Tree.Private_Part.Temp_Files.Table (Index);
if Path /= No_Path then
if Current_Verbosity = High then
Write_Line ("Removing temp file: "
& Get_Name_String (Path));
end if;
Delete_File (Get_Name_String (Path), Dont_Care);
end if;
end loop;
Temp_Files_Table.Free (Tree.Private_Part.Temp_Files);
Temp_Files_Table.Init (Tree.Private_Part.Temp_Files);
end if;
-- If any of the environment variables ADA_PRJ_INCLUDE_FILE or
-- ADA_PRJ_OBJECTS_FILE has been set, then reset their value to
-- the empty string. On VMS, this has the effect of deassigning
-- the logical names.
if Tree.Private_Part.Current_Source_Path_File /= No_Path then
Setenv (Project_Include_Path_File, "");
end if;
if Tree.Private_Part.Current_Object_Path_File /= No_Path then
Setenv (Project_Objects_Path_File, "");
end if;
end Delete_All_Temp_Files;
---------------------
-- Dependency_Name --
---------------------
function Dependency_Name
(Source_File_Name : File_Name_Type;
Dependency : Dependency_File_Kind) return File_Name_Type
is
begin
case Dependency is
when None =>
return No_File;
when Makefile =>
return Extend_Name (Source_File_Name, Makefile_Dependency_Suffix);
when ALI_File =>
return Extend_Name (Source_File_Name, ALI_Dependency_Suffix);
end case;
end Dependency_Name;
----------------
-- Empty_File --
----------------
function Empty_File return File_Name_Type is
begin
return File_Name_Type (The_Empty_String);
end Empty_File;
-------------------
-- Empty_Project --
-------------------
function Empty_Project return Project_Data is
begin
Prj.Initialize (Tree => No_Project_Tree);
return Project_Empty;
end Empty_Project;
------------------
-- Empty_String --
------------------
function Empty_String return Name_Id is
begin
return The_Empty_String;
end Empty_String;
------------
-- Expect --
------------
procedure Expect (The_Token : Token_Type; Token_Image : String) is
begin
if Token /= The_Token then
-- ??? Should pass user flags here instead
Error_Msg (Gnatmake_Flags, Token_Image & " expected", Token_Ptr);
end if;
end Expect;
-----------------
-- Extend_Name --
-----------------
function Extend_Name
(File : File_Name_Type;
With_Suffix : String) return File_Name_Type
is
Last : Positive;
begin
Get_Name_String (File);
Last := Name_Len + 1;
while Name_Len /= 0 and then Name_Buffer (Name_Len) /= '.' loop
Name_Len := Name_Len - 1;
end loop;
if Name_Len <= 1 then
Name_Len := Last;
end if;
for J in With_Suffix'Range loop
Name_Buffer (Name_Len) := With_Suffix (J);
Name_Len := Name_Len + 1;
end loop;
Name_Len := Name_Len - 1;
return Name_Find;
end Extend_Name;
---------------------
-- Project_Changed --
---------------------
procedure Project_Changed (Iter : in out Source_Iterator) is
begin
Iter.Language := Iter.Project.Project.Languages;
Language_Changed (Iter);
end Project_Changed;
----------------------
-- Language_Changed --
----------------------
procedure Language_Changed (Iter : in out Source_Iterator) is
begin
Iter.Current := No_Source;
if Iter.Language_Name /= No_Name then
while Iter.Language /= null
and then Iter.Language.Name /= Iter.Language_Name
loop
Iter.Language := Iter.Language.Next;
end loop;
end if;
-- If there is no matching language in this project, move to next
if Iter.Language = No_Language_Index then
if Iter.All_Projects then
Iter.Project := Iter.Project.Next;
if Iter.Project /= null then
Project_Changed (Iter);
end if;
else
Iter.Project := null;
end if;
else
Iter.Current := Iter.Language.First_Source;
if Iter.Current = No_Source then
Iter.Language := Iter.Language.Next;
Language_Changed (Iter);
end if;
end if;
end Language_Changed;
---------------------
-- For_Each_Source --
---------------------
function For_Each_Source
(In_Tree : Project_Tree_Ref;
Project : Project_Id := No_Project;
Language : Name_Id := No_Name) return Source_Iterator
is
Iter : Source_Iterator;
begin
Iter := Source_Iterator'
(In_Tree => In_Tree,
Project => In_Tree.Projects,
All_Projects => Project = No_Project,
Language_Name => Language,
Language => No_Language_Index,
Current => No_Source);
if Project /= null then
while Iter.Project /= null
and then Iter.Project.Project /= Project
loop
Iter.Project := Iter.Project.Next;
end loop;
end if;
Project_Changed (Iter);
return Iter;
end For_Each_Source;
-------------
-- Element --
-------------
function Element (Iter : Source_Iterator) return Source_Id is
begin
return Iter.Current;
end Element;
----------
-- Next --
----------
procedure Next (Iter : in out Source_Iterator) is
begin
Iter.Current := Iter.Current.Next_In_Lang;
if Iter.Current = No_Source then
Iter.Language := Iter.Language.Next;
Language_Changed (Iter);
end if;
end Next;
--------------------------------
-- For_Every_Project_Imported --
--------------------------------
procedure For_Every_Project_Imported
(By : Project_Id;
With_State : in out State;
Imported_First : Boolean := False)
is
use Project_Boolean_Htable;
Seen : Project_Boolean_Htable.Instance := Project_Boolean_Htable.Nil;
procedure Recursive_Check (Project : Project_Id);
-- Check if a project has already been seen. If not seen, mark it as
-- Seen, Call Action, and check all its imported projects.
---------------------
-- Recursive_Check --
---------------------
procedure Recursive_Check (Project : Project_Id) is
List : Project_List;
begin
if not Get (Seen, Project) then
Set (Seen, Project, True);
if not Imported_First then
Action (Project, With_State);
end if;
-- Visited all extended projects
if Project.Extends /= No_Project then
Recursive_Check (Project.Extends);
end if;
-- Visited all imported projects
List := Project.Imported_Projects;
while List /= null loop
Recursive_Check (List.Project);
List := List.Next;
end loop;
if Imported_First then
Action (Project, With_State);
end if;
end if;
end Recursive_Check;
-- Start of processing for For_Every_Project_Imported
begin
Recursive_Check (Project => By);
Reset (Seen);
end For_Every_Project_Imported;
-----------------
-- Find_Source --
-----------------
function Find_Source
(In_Tree : Project_Tree_Ref;
Project : Project_Id;
In_Imported_Only : Boolean := False;
In_Extended_Only : Boolean := False;
Base_Name : File_Name_Type) return Source_Id
is
Result : Source_Id := No_Source;
procedure Look_For_Sources (Proj : Project_Id; Src : in out Source_Id);
-- Look for Base_Name in the sources of Proj
----------------------
-- Look_For_Sources --
----------------------
procedure Look_For_Sources (Proj : Project_Id; Src : in out Source_Id) is
Iterator : Source_Iterator;
begin
Iterator := For_Each_Source (In_Tree => In_Tree, Project => Proj);
while Element (Iterator) /= No_Source loop
if Element (Iterator).File = Base_Name then
Src := Element (Iterator);
return;
end if;
Next (Iterator);
end loop;
end Look_For_Sources;
procedure For_Imported_Projects is new For_Every_Project_Imported
(State => Source_Id, Action => Look_For_Sources);
Proj : Project_Id;
-- Start of processing for Find_Source
begin
if In_Extended_Only then
Proj := Project;
while Proj /= No_Project loop
Look_For_Sources (Proj, Result);
exit when Result /= No_Source;
Proj := Proj.Extends;
end loop;
elsif In_Imported_Only then
Look_For_Sources (Project, Result);
if Result = No_Source then
For_Imported_Projects
(By => Project,
With_State => Result);
end if;
else
Look_For_Sources (No_Project, Result);
end if;
return Result;
end Find_Source;
----------
-- Hash --
----------
function Hash is new GNAT.HTable.Hash (Header_Num => Header_Num);
-- Used in implementation of other functions Hash below
function Hash (Name : File_Name_Type) return Header_Num is
begin
return Hash (Get_Name_String (Name));
end Hash;
function Hash (Name : Name_Id) return Header_Num is
begin
return Hash (Get_Name_String (Name));
end Hash;
function Hash (Name : Path_Name_Type) return Header_Num is
begin
return Hash (Get_Name_String (Name));
end Hash;
function Hash (Project : Project_Id) return Header_Num is
begin
if Project = No_Project then
return Header_Num'First;
else
return Hash (Get_Name_String (Project.Name));
end if;
end Hash;
-----------
-- Image --
-----------
function Image (The_Casing : Casing_Type) return String is
begin
return The_Casing_Images (The_Casing).all;
end Image;
-----------------------------
-- Is_Standard_GNAT_Naming --
-----------------------------
function Is_Standard_GNAT_Naming
(Naming : Lang_Naming_Data) return Boolean
is
begin
return Get_Name_String (Naming.Spec_Suffix) = ".ads"
and then Get_Name_String (Naming.Body_Suffix) = ".adb"
and then Get_Name_String (Naming.Dot_Replacement) = "-";
end Is_Standard_GNAT_Naming;
----------------
-- Initialize --
----------------
procedure Initialize (Tree : Project_Tree_Ref) is
begin
if The_Empty_String = No_Name then
Uintp.Initialize;
Name_Len := 0;
The_Empty_String := Name_Find;
Prj.Attr.Initialize;
Set_Name_Table_Byte
(Name_Project, Token_Type'Pos (Tok_Project));
Set_Name_Table_Byte
(Name_Extends, Token_Type'Pos (Tok_Extends));
Set_Name_Table_Byte
(Name_External, Token_Type'Pos (Tok_External));
Set_Name_Table_Byte
(Name_External_As_List, Token_Type'Pos (Tok_External_As_List));
end if;
if Tree /= No_Project_Tree then
Reset (Tree);
end if;
end Initialize;
------------------
-- Is_Extending --
------------------
function Is_Extending
(Extending : Project_Id;
Extended : Project_Id) return Boolean
is
Proj : Project_Id;
begin
Proj := Extending;
while Proj /= No_Project loop
if Proj = Extended then
return True;
end if;
Proj := Proj.Extends;
end loop;
return False;
end Is_Extending;
-----------------
-- Object_Name --
-----------------
function Object_Name
(Source_File_Name : File_Name_Type;
Object_File_Suffix : Name_Id := No_Name) return File_Name_Type
is
begin
if Object_File_Suffix = No_Name then
return Extend_Name
(Source_File_Name, Object_Suffix);
else
return Extend_Name
(Source_File_Name, Get_Name_String (Object_File_Suffix));
end if;
end Object_Name;
function Object_Name
(Source_File_Name : File_Name_Type;
Source_Index : Int;
Index_Separator : Character;
Object_File_Suffix : Name_Id := No_Name) return File_Name_Type
is
Index_Img : constant String := Source_Index'Img;
Last : Natural;
begin
Get_Name_String (Source_File_Name);
Last := Name_Len;
while Last > 1 and then Name_Buffer (Last) /= '.' loop
Last := Last - 1;
end loop;
if Last > 1 then
Name_Len := Last - 1;
end if;
Add_Char_To_Name_Buffer (Index_Separator);
Add_Str_To_Name_Buffer (Index_Img (2 .. Index_Img'Last));
if Object_File_Suffix = No_Name then
Add_Str_To_Name_Buffer (Object_Suffix);
else
Add_Str_To_Name_Buffer (Get_Name_String (Object_File_Suffix));
end if;
return Name_Find;
end Object_Name;
----------------------
-- Record_Temp_File --
----------------------
procedure Record_Temp_File
(Tree : Project_Tree_Ref;
Path : Path_Name_Type)
is
begin
Temp_Files_Table.Append (Tree.Private_Part.Temp_Files, Path);
end Record_Temp_File;
----------
-- Free --
----------
procedure Free (Project : in out Project_Id) is
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Project_Data, Project_Id);
begin
if Project /= null then
Free (Project.Ada_Include_Path);
Free (Project.Objects_Path);
Free (Project.Ada_Objects_Path);
Free_List (Project.Imported_Projects, Free_Project => False);
Free_List (Project.All_Imported_Projects, Free_Project => False);
Free_List (Project.Languages);
Unchecked_Free (Project);
end if;
end Free;
---------------
-- Free_List --
---------------
procedure Free_List (Languages : in out Language_List) is
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Language_List_Element, Language_List);
Tmp : Language_List;
begin
while Languages /= null loop
Tmp := Languages.Next;
Unchecked_Free (Languages);
Languages := Tmp;
end loop;
end Free_List;
---------------
-- Free_List --
---------------
procedure Free_List (Source : in out Source_Id) is
procedure Unchecked_Free is new
Ada.Unchecked_Deallocation (Source_Data, Source_Id);
Tmp : Source_Id;
begin
while Source /= No_Source loop
Tmp := Source.Next_In_Lang;
Free_List (Source.Alternate_Languages);
if Source.Unit /= null
and then Source.Kind in Spec_Or_Body
then
Source.Unit.File_Names (Source.Kind) := null;
end if;
Unchecked_Free (Source);
Source := Tmp;
end loop;
end Free_List;
---------------
-- Free_List --
---------------
procedure Free_List
(List : in out Project_List;
Free_Project : Boolean)
is
procedure Unchecked_Free is new
Ada.Unchecked_Deallocation (Project_List_Element, Project_List);
Tmp : Project_List;
begin
while List /= null loop
Tmp := List.Next;
if Free_Project then
Free (List.Project);
end if;
Unchecked_Free (List);
List := Tmp;
end loop;
end Free_List;
---------------
-- Free_List --
---------------
procedure Free_List (Languages : in out Language_Ptr) is
procedure Unchecked_Free is new
Ada.Unchecked_Deallocation (Language_Data, Language_Ptr);
Tmp : Language_Ptr;
begin
while Languages /= null loop
Tmp := Languages.Next;
Free_List (Languages.First_Source);
Unchecked_Free (Languages);
Languages := Tmp;
end loop;
end Free_List;
----------------
-- Free_Units --
----------------
procedure Free_Units (Table : in out Units_Htable.Instance) is
procedure Unchecked_Free is new
Ada.Unchecked_Deallocation (Unit_Data, Unit_Index);
Unit : Unit_Index;
begin
Unit := Units_Htable.Get_First (Table);
while Unit /= No_Unit_Index loop
if Unit.File_Names (Spec) /= null then
Unit.File_Names (Spec).Unit := No_Unit_Index;
end if;
if Unit.File_Names (Impl) /= null then
Unit.File_Names (Impl).Unit := No_Unit_Index;
end if;
Unchecked_Free (Unit);
Unit := Units_Htable.Get_Next (Table);
end loop;
Units_Htable.Reset (Table);
end Free_Units;
----------
-- Free --
----------
procedure Free (Tree : in out Project_Tree_Ref) is
procedure Unchecked_Free is new
Ada.Unchecked_Deallocation (Project_Tree_Data, Project_Tree_Ref);
begin
if Tree /= null then
Name_List_Table.Free (Tree.Name_Lists);
Number_List_Table.Free (Tree.Number_Lists);
String_Element_Table.Free (Tree.String_Elements);
Variable_Element_Table.Free (Tree.Variable_Elements);
Array_Element_Table.Free (Tree.Array_Elements);
Array_Table.Free (Tree.Arrays);
Package_Table.Free (Tree.Packages);
Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
Source_Files_Htable.Reset (Tree.Source_Files_HT);
Free_List (Tree.Projects, Free_Project => True);
Free_Units (Tree.Units_HT);
-- Private part
Temp_Files_Table.Free (Tree.Private_Part.Temp_Files);
Unchecked_Free (Tree);
end if;
end Free;
-----------
-- Reset --
-----------
procedure Reset (Tree : Project_Tree_Ref) is
begin
-- Visible tables
Name_List_Table.Init (Tree.Name_Lists);
Number_List_Table.Init (Tree.Number_Lists);
String_Element_Table.Init (Tree.String_Elements);
Variable_Element_Table.Init (Tree.Variable_Elements);
Array_Element_Table.Init (Tree.Array_Elements);
Array_Table.Init (Tree.Arrays);
Package_Table.Init (Tree.Packages);
Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
Source_Files_Htable.Reset (Tree.Source_Files_HT);
Replaced_Source_HTable.Reset (Tree.Replaced_Sources);
Tree.Replaced_Source_Number := 0;
Free_List (Tree.Projects, Free_Project => True);
Free_Units (Tree.Units_HT);
-- Private part table
Temp_Files_Table.Init (Tree.Private_Part.Temp_Files);
Tree.Private_Part.Current_Source_Path_File := No_Path;
Tree.Private_Part.Current_Object_Path_File := No_Path;
end Reset;
-------------------
-- Switches_Name --
-------------------
function Switches_Name
(Source_File_Name : File_Name_Type) return File_Name_Type
is
begin
return Extend_Name (Source_File_Name, Switches_Dependency_Suffix);
end Switches_Name;
-----------
-- Value --
-----------
function Value (Image : String) return Casing_Type is
begin
for Casing in The_Casing_Images'Range loop
if To_Lower (Image) = To_Lower (The_Casing_Images (Casing).all) then
return Casing;
end if;
end loop;
raise Constraint_Error;
end Value;
---------------------
-- Has_Ada_Sources --
---------------------
function Has_Ada_Sources (Data : Project_Id) return Boolean is
Lang : Language_Ptr;
begin
Lang := Data.Languages;
while Lang /= No_Language_Index loop
if Lang.Name = Name_Ada then
return Lang.First_Source /= No_Source;
end if;
Lang := Lang.Next;
end loop;
return False;
end Has_Ada_Sources;
------------------------
-- Contains_ALI_Files --
------------------------
function Contains_ALI_Files (Dir : Path_Name_Type) return Boolean is
Dir_Name : constant String := Get_Name_String (Dir);
Direct : Dir_Type;
Name : String (1 .. 1_000);
Last : Natural;
Result : Boolean := False;
begin
Open (Direct, Dir_Name);
-- For each file in the directory, check if it is an ALI file
loop
Read (Direct, Name, Last);
exit when Last = 0;
Canonical_Case_File_Name (Name (1 .. Last));
Result := Last >= 5 and then Name (Last - 3 .. Last) = ".ali";
exit when Result;
end loop;
Close (Direct);
return Result;
exception
-- If there is any problem, close the directory if open and return True.
-- The library directory will be added to the path.
when others =>
if Is_Open (Direct) then
Close (Direct);
end if;
return True;
end Contains_ALI_Files;
--------------------------
-- Get_Object_Directory --
--------------------------
function Get_Object_Directory
(Project : Project_Id;
Including_Libraries : Boolean;
Only_If_Ada : Boolean := False) return Path_Name_Type
is
begin
if (Project.Library and then Including_Libraries)
or else
(Project.Object_Directory /= No_Path_Information
and then (not Including_Libraries or else not Project.Library))
then
-- For a library project, add the library ALI directory if there is
-- no object directory or if the library ALI directory contains ALI
-- files; otherwise add the object directory.
if Project.Library then
if Project.Object_Directory = No_Path_Information
or else Contains_ALI_Files (Project.Library_ALI_Dir.Display_Name)
then
return Project.Library_ALI_Dir.Display_Name;
else
return Project.Object_Directory.Display_Name;
end if;
-- For a non-library project, add object directory if it is not a
-- virtual project, and if there are Ada sources in the project or
-- one of the projects it extends. If there are no Ada sources,
-- adding the object directory could disrupt the order of the
-- object dirs in the path.
elsif not Project.Virtual then
declare
Add_Object_Dir : Boolean;
Prj : Project_Id;
begin
Add_Object_Dir := not Only_If_Ada;
Prj := Project;
while not Add_Object_Dir and then Prj /= No_Project loop
if Has_Ada_Sources (Prj) then
Add_Object_Dir := True;
else
Prj := Prj.Extends;
end if;
end loop;
if Add_Object_Dir then
return Project.Object_Directory.Display_Name;
end if;
end;
end if;
end if;
return No_Path;
end Get_Object_Directory;
-----------------------------------
-- Ultimate_Extending_Project_Of --
-----------------------------------
function Ultimate_Extending_Project_Of
(Proj : Project_Id) return Project_Id
is
Prj : Project_Id;
begin
Prj := Proj;
while Prj /= null and then Prj.Extended_By /= No_Project loop
Prj := Prj.Extended_By;
end loop;
return Prj;
end Ultimate_Extending_Project_Of;
-----------------------------------
-- Compute_All_Imported_Projects --
-----------------------------------
procedure Compute_All_Imported_Projects (Tree : Project_Tree_Ref) is
Project : Project_Id;
procedure Recursive_Add (Prj : Project_Id; Dummy : in out Boolean);
-- Recursively add the projects imported by project Project, but not
-- those that are extended.
-------------------
-- Recursive_Add --
-------------------
procedure Recursive_Add (Prj : Project_Id; Dummy : in out Boolean) is
pragma Unreferenced (Dummy);
List : Project_List;
Prj2 : Project_Id;
begin
-- A project is not importing itself
Prj2 := Ultimate_Extending_Project_Of (Prj);
if Project /= Prj2 then
-- Check that the project is not already in the list. We know the
-- one passed to Recursive_Add have never been visited before, but
-- the one passed it are the extended projects.
List := Project.All_Imported_Projects;
while List /= null loop
if List.Project = Prj2 then
return;
end if;
List := List.Next;
end loop;
-- Add it to the list
Project.All_Imported_Projects :=
new Project_List_Element'
(Project => Prj2,
Next => Project.All_Imported_Projects);
end if;
end Recursive_Add;
procedure For_All_Projects is
new For_Every_Project_Imported (Boolean, Recursive_Add);
Dummy : Boolean := False;
List : Project_List;
begin
List := Tree.Projects;
while List /= null loop
Project := List.Project;
Free_List (Project.All_Imported_Projects, Free_Project => False);
For_All_Projects (Project, Dummy);
List := List.Next;
end loop;
end Compute_All_Imported_Projects;
-------------------
-- Is_Compilable --
-------------------
function Is_Compilable (Source : Source_Id) return Boolean is
begin
case Source.Compilable is
when Unknown =>
if Source.Language.Config.Compiler_Driver /= No_File
and then
Length_Of_Name (Source.Language.Config.Compiler_Driver) /= 0
and then not Source.Locally_Removed
and then (Source.Language.Config.Kind /= File_Based
or else Source.Kind /= Spec)
then
-- Do not modify Source.Compilable before the source record
-- has been initialized.
if Source.Source_TS /= Empty_Time_Stamp then
Source.Compilable := Yes;
end if;
return True;
else
if Source.Source_TS /= Empty_Time_Stamp then
Source.Compilable := No;
end if;
return False;
end if;
when Yes =>
return True;
when No =>
return False;
end case;
end Is_Compilable;
------------------------------
-- Object_To_Global_Archive --
------------------------------
function Object_To_Global_Archive (Source : Source_Id) return Boolean is
begin
return Source.Language.Config.Kind = File_Based
and then Source.Kind = Impl
and then Source.Language.Config.Objects_Linked
and then Is_Compilable (Source)
and then Source.Language.Config.Object_Generated;
end Object_To_Global_Archive;
----------------------------
-- Get_Language_From_Name --
----------------------------
function Get_Language_From_Name
(Project : Project_Id;
Name : String) return Language_Ptr
is
N : Name_Id;
Result : Language_Ptr;
begin
Name_Len := Name'Length;
Name_Buffer (1 .. Name_Len) := Name;
To_Lower (Name_Buffer (1 .. Name_Len));
N := Name_Find;
Result := Project.Languages;
while Result /= No_Language_Index loop
if Result.Name = N then
return Result;
end if;
Result := Result.Next;
end loop;
return No_Language_Index;
end Get_Language_From_Name;
----------------
-- Other_Part --
----------------
function Other_Part (Source : Source_Id) return Source_Id is
begin
if Source.Unit /= No_Unit_Index then
case Source.Kind is
when Impl =>
return Source.Unit.File_Names (Spec);
when Spec =>
return Source.Unit.File_Names (Impl);
when Sep =>
return No_Source;
end case;
else
return No_Source;
end if;
end Other_Part;
------------------
-- Create_Flags --
------------------
function Create_Flags
(Report_Error : Error_Handler;
When_No_Sources : Error_Warning;
Require_Sources_Other_Lang : Boolean := True;
Allow_Duplicate_Basenames : Boolean := True;
Compiler_Driver_Mandatory : Boolean := False;
Error_On_Unknown_Language : Boolean := True;
Require_Obj_Dirs : Error_Warning := Error;
Allow_Invalid_External : Error_Warning := Error;
Missing_Source_Files : Error_Warning := Error)
return Processing_Flags
is
begin
return Processing_Flags'
(Report_Error => Report_Error,
When_No_Sources => When_No_Sources,
Require_Sources_Other_Lang => Require_Sources_Other_Lang,
Allow_Duplicate_Basenames => Allow_Duplicate_Basenames,
Error_On_Unknown_Language => Error_On_Unknown_Language,
Compiler_Driver_Mandatory => Compiler_Driver_Mandatory,
Require_Obj_Dirs => Require_Obj_Dirs,
Allow_Invalid_External => Allow_Invalid_External,
Missing_Source_Files => Missing_Source_Files);
end Create_Flags;
------------
-- Length --
------------
function Length
(Table : Name_List_Table.Instance;
List : Name_List_Index) return Natural
is
Count : Natural := 0;
Tmp : Name_List_Index;
begin
Tmp := List;
while Tmp /= No_Name_List loop
Count := Count + 1;
Tmp := Table.Table (Tmp).Next;
end loop;
return Count;
end Length;
begin
-- Make sure that the standard config and user project file extensions are
-- compatible with canonical case file naming.
Canonical_Case_File_Name (Config_Project_File_Extension);
Canonical_Case_File_Name (Project_File_Extension);
end Prj;
|
src/isa/avx/masm/cbrtf.asm | jepler/aocl-libm-ose | 66 | 168327 | <gh_stars>10-100
;
; Copyright (C) 2008-2020 Advanced Micro Devices, Inc. All rights reserved.
;
; An implementation of the cbrtf libm function.
; 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.
;
; cbrtf.S
;
; Prototype:
;
; float cbrtf(float x);
;
;
; Algorithm:
;
; local variable storage offsets
store_input EQU 20h
save_xmm6 EQU 30h
save_xmm7 EQU 40h
stack_size EQU 98h
include fm.inc
FN_PROTOTYPE_BAS64 cbrtf
fname_special TEXTEQU <_cbrtf_special>
;Define name and any external functions being called
EXTERN fname_special : PROC
StackAllocate MACRO size
sub rsp, size
.ALLOCSTACK size
ENDM
SaveXmm MACRO xmmreg, offset
movdqa XMMWORD PTR [offset+rsp], xmmreg
.SAVEXMM128 xmmreg, offset
ENDM
text SEGMENT EXECUTE
PUBLIC fname
fname PROC FRAME
StackAllocate stack_size
SaveXmm xmm6, save_xmm6
SaveXmm xmm7, save_xmm7
.ENDPROLOG
xor rcx, rcx
movss DWORD PTR [store_input+rsp], xmm0
movss xmm1, xmm0
mov r8, QWORD PTR [store_input+rsp]
mov r10, 7F800000h
mov r11, 007FFFFFh
mov r9, r8
and r8, r10 ; r8 = stores the exponent
and r9, r11 ; r9 = stores the mantissa
cmp r8, 7F800000h
jz __cbrtf_is_nan_infinite
cmp r8, 0h
jz __cbrtf_is_denormal
ALIGN 16
__cbrtf_is_normal:
cvtps2pd xmm1, xmm1
shr r8, 23 ; exp value
mov rdx, 3 ; check whether always dx is set to 3
mov rax, r8
movsd xmm6, xmm1
shr r9, 15 ; index for the reciprocal
sub ax, 7Fh
idiv dl ; Accumulator is divided by dl=3
mov dx, ax
shr dx, 8 ;dx = Contains the remainder
add dl, 2
;ax = Contains the quotient, Scale factor
cbw ; sign extend al to ax
add ax, 3FFh
shl rax, 52
pand xmm1, XMMWORD PTR __mantissa_mask_64
mov QWORD PTR [store_input+rsp], rax
movsd xmm7, QWORD PTR [store_input+rsp]
movsd xmm2, QWORD PTR __sign_mask_64
por xmm1, XMMWORD PTR __one_mask_64
movapd xmm0, XMMWORD PTR __coefficients
pandn xmm2, xmm1
pand xmm6, XMMWORD PTR __sign_mask_64 ; has the sign
lea r8, QWORD PTR __DoubleReciprocalTable_256
lea rax, QWORD PTR __CubeRootTable_256
movsd xmm3, QWORD PTR [r8+r9*8] ;reciprocal, Size of double is 8
movsd xmm4, QWORD PTR [rax+r9*8] ;cuberoot
mulsd xmm3, xmm2
subsd xmm3, QWORD PTR __one_mask_64
; movddup xmm3,xmm3
shufpd xmm3, xmm3, 0 ; replacing movddup
mulsd xmm3, xmm3
mulpd xmm0, xmm3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;haddpd is an SSE3 instruction On using this instruction it gives a better performance
;haddpd xmm0,xmm0
;Following has to be commented and the above haddpd has to be uncommented if we can
;use the SSE3 instructions
movapd xmm3, xmm0
unpckhpd xmm3, xmm3
addsd xmm0, xmm3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
addsd xmm0, QWORD PTR __one_mask_64
mulsd xmm0, xmm7
lea rax, QWORD PTR __defined_cuberoot
mulsd xmm0, QWORD PTR [rax+rdx*8]
mulsd xmm0, xmm4
cmp cx, 1
jnz __final_result
mulsd xmm0, QWORD PTR __denormal_factor
ALIGN 16
__final_result:
por xmm0, xmm6
cvtsd2ss xmm0, xmm0
movdqa xmm7, XMMWORD PTR [save_xmm7+rsp]
movdqa xmm6, XMMWORD PTR [save_xmm6+rsp]
add rsp, stack_size
ret
ALIGN 16
__cbrtf_is_denormal:
cmp r9, 0
jz __cbrtf_is_zero
mulss xmm1, DWORD PTR __2_pow_23
movss DWORD PTR [store_input+rsp], xmm1
mov cx, 1
mov r8, QWORD PTR [store_input+rsp]
mov r9, r8
and r8, r10 ; r8 = stores the exponent
and r9, r11 ; r9 = stores the mantissa
jmp __cbrtf_is_normal
ALIGN 16
__cbrtf_is_nan_infinite:
cmp r9, 0
jz __cbrtf_is_infinite
call fname_special
;mulss xmm0, xmm0 ;this multiplication will raise an invalid exception
;por xmm0, XMMWORD PTR __qnan_mask_32
__cbrtf_is_infinite:
__cbrtf_is_one:
__cbrtf_is_zero:
movdqa xmm7, XMMWORD PTR [save_xmm7+rsp]
movdqa xmm6, XMMWORD PTR [save_xmm6+rsp]
add rsp, stack_size
ret
fname endp
TEXT ENDS
data SEGMENT READ
CONST SEGMENT
ALIGN 16
__mantissa_mask_32 DD 007FFFFFh
DD 0 ;this zero is necessary
ALIGN 16
__qnan_mask_32 DD 00400000h
DD 0
__exp_mask_32 DD 7F800000h
DD 0
__zero DD 00000000h
DD 0
ALIGN 16
__mantissa_mask_64 DQ 000FFFFFFFFFFFFFh
__2_pow_23 DD 4B000000h
ALIGN 16
__sign_mask_64 DQ 8000000000000000h
DQ 0
__one_mask_64 DQ 3FF0000000000000h
DQ 0
ALIGN 16
__denormal_factor DQ 3F7428A2F98D728Bh
DQ 0
ALIGN 16
__coefficients DQ 0bFBC71C71C71C71Ch
DQ 3fd5555555555555h
ALIGN 16
__defined_cuberoot DQ 3FE428A2F98D728Bh
DQ 3FE965FEA53D6E3Dh
DQ 3FF0000000000000h
DQ 3FF428A2F98D728Bh
DQ 3FF965FEA53D6E3Dh
ALIGN 16
__DoubleReciprocalTable_256:
DQ 3ff0000000000000h
DQ 3fefe00000000000h
DQ 3fefc00000000000h
DQ 3fefa00000000000h
DQ 3fef800000000000h
DQ 3fef600000000000h
DQ 3fef400000000000h
DQ 3fef200000000000h
DQ 3fef000000000000h
DQ 3feee00000000000h
DQ 3feec00000000000h
DQ 3feea00000000000h
DQ 3fee900000000000h
DQ 3fee700000000000h
DQ 3fee500000000000h
DQ 3fee300000000000h
DQ 3fee100000000000h
DQ 3fee000000000000h
DQ 3fede00000000000h
DQ 3fedc00000000000h
DQ 3feda00000000000h
DQ 3fed900000000000h
DQ 3fed700000000000h
DQ 3fed500000000000h
DQ 3fed400000000000h
DQ 3fed200000000000h
DQ 3fed000000000000h
DQ 3fecf00000000000h
DQ 3fecd00000000000h
DQ 3fecb00000000000h
DQ 3feca00000000000h
DQ 3fec800000000000h
DQ 3fec700000000000h
DQ 3fec500000000000h
DQ 3fec300000000000h
DQ 3fec200000000000h
DQ 3fec000000000000h
DQ 3febf00000000000h
DQ 3febd00000000000h
DQ 3febc00000000000h
DQ 3feba00000000000h
DQ 3feb900000000000h
DQ 3feb700000000000h
DQ 3feb600000000000h
DQ 3feb400000000000h
DQ 3feb300000000000h
DQ 3feb200000000000h
DQ 3feb000000000000h
DQ 3feaf00000000000h
DQ 3fead00000000000h
DQ 3feac00000000000h
DQ 3feaa00000000000h
DQ 3fea900000000000h
DQ 3fea800000000000h
DQ 3fea600000000000h
DQ 3fea500000000000h
DQ 3fea400000000000h
DQ 3fea200000000000h
DQ 3fea100000000000h
DQ 3fea000000000000h
DQ 3fe9e00000000000h
DQ 3fe9d00000000000h
DQ 3fe9c00000000000h
DQ 3fe9a00000000000h
DQ 3fe9900000000000h
DQ 3fe9800000000000h
DQ 3fe9700000000000h
DQ 3fe9500000000000h
DQ 3fe9400000000000h
DQ 3fe9300000000000h
DQ 3fe9200000000000h
DQ 3fe9000000000000h
DQ 3fe8f00000000000h
DQ 3fe8e00000000000h
DQ 3fe8d00000000000h
DQ 3fe8b00000000000h
DQ 3fe8a00000000000h
DQ 3fe8900000000000h
DQ 3fe8800000000000h
DQ 3fe8700000000000h
DQ 3fe8600000000000h
DQ 3fe8400000000000h
DQ 3fe8300000000000h
DQ 3fe8200000000000h
DQ 3fe8100000000000h
DQ 3fe8000000000000h
DQ 3fe7f00000000000h
DQ 3fe7e00000000000h
DQ 3fe7d00000000000h
DQ 3fe7b00000000000h
DQ 3fe7a00000000000h
DQ 3fe7900000000000h
DQ 3fe7800000000000h
DQ 3fe7700000000000h
DQ 3fe7600000000000h
DQ 3fe7500000000000h
DQ 3fe7400000000000h
DQ 3fe7300000000000h
DQ 3fe7200000000000h
DQ 3fe7100000000000h
DQ 3fe7000000000000h
DQ 3fe6f00000000000h
DQ 3fe6e00000000000h
DQ 3fe6d00000000000h
DQ 3fe6c00000000000h
DQ 3fe6b00000000000h
DQ 3fe6a00000000000h
DQ 3fe6900000000000h
DQ 3fe6800000000000h
DQ 3fe6700000000000h
DQ 3fe6600000000000h
DQ 3fe6500000000000h
DQ 3fe6400000000000h
DQ 3fe6300000000000h
DQ 3fe6200000000000h
DQ 3fe6100000000000h
DQ 3fe6000000000000h
DQ 3fe5f00000000000h
DQ 3fe5e00000000000h
DQ 3fe5d00000000000h
DQ 3fe5c00000000000h
DQ 3fe5b00000000000h
DQ 3fe5a00000000000h
DQ 3fe5900000000000h
DQ 3fe5800000000000h
DQ 3fe5800000000000h
DQ 3fe5700000000000h
DQ 3fe5600000000000h
DQ 3fe5500000000000h
DQ 3fe5400000000000h
DQ 3fe5300000000000h
DQ 3fe5200000000000h
DQ 3fe5100000000000h
DQ 3fe5000000000000h
DQ 3fe5000000000000h
DQ 3fe4f00000000000h
DQ 3fe4e00000000000h
DQ 3fe4d00000000000h
DQ 3fe4c00000000000h
DQ 3fe4b00000000000h
DQ 3fe4a00000000000h
DQ 3fe4a00000000000h
DQ 3fe4900000000000h
DQ 3fe4800000000000h
DQ 3fe4700000000000h
DQ 3fe4600000000000h
DQ 3fe4600000000000h
DQ 3fe4500000000000h
DQ 3fe4400000000000h
DQ 3fe4300000000000h
DQ 3fe4200000000000h
DQ 3fe4200000000000h
DQ 3fe4100000000000h
DQ 3fe4000000000000h
DQ 3fe3f00000000000h
DQ 3fe3e00000000000h
DQ 3fe3e00000000000h
DQ 3fe3d00000000000h
DQ 3fe3c00000000000h
DQ 3fe3b00000000000h
DQ 3fe3b00000000000h
DQ 3fe3a00000000000h
DQ 3fe3900000000000h
DQ 3fe3800000000000h
DQ 3fe3800000000000h
DQ 3fe3700000000000h
DQ 3fe3600000000000h
DQ 3fe3500000000000h
DQ 3fe3500000000000h
DQ 3fe3400000000000h
DQ 3fe3300000000000h
DQ 3fe3200000000000h
DQ 3fe3200000000000h
DQ 3fe3100000000000h
DQ 3fe3000000000000h
DQ 3fe3000000000000h
DQ 3fe2f00000000000h
DQ 3fe2e00000000000h
DQ 3fe2e00000000000h
DQ 3fe2d00000000000h
DQ 3fe2c00000000000h
DQ 3fe2b00000000000h
DQ 3fe2b00000000000h
DQ 3fe2a00000000000h
DQ 3fe2900000000000h
DQ 3fe2900000000000h
DQ 3fe2800000000000h
DQ 3fe2700000000000h
DQ 3fe2700000000000h
DQ 3fe2600000000000h
DQ 3fe2500000000000h
DQ 3fe2500000000000h
DQ 3fe2400000000000h
DQ 3fe2300000000000h
DQ 3fe2300000000000h
DQ 3fe2200000000000h
DQ 3fe2100000000000h
DQ 3fe2100000000000h
DQ 3fe2000000000000h
DQ 3fe2000000000000h
DQ 3fe1f00000000000h
DQ 3fe1e00000000000h
DQ 3fe1e00000000000h
DQ 3fe1d00000000000h
DQ 3fe1c00000000000h
DQ 3fe1c00000000000h
DQ 3fe1b00000000000h
DQ 3fe1b00000000000h
DQ 3fe1a00000000000h
DQ 3fe1900000000000h
DQ 3fe1900000000000h
DQ 3fe1800000000000h
DQ 3fe1800000000000h
DQ 3fe1700000000000h
DQ 3fe1600000000000h
DQ 3fe1600000000000h
DQ 3fe1500000000000h
DQ 3fe1500000000000h
DQ 3fe1400000000000h
DQ 3fe1300000000000h
DQ 3fe1300000000000h
DQ 3fe1200000000000h
DQ 3fe1200000000000h
DQ 3fe1100000000000h
DQ 3fe1100000000000h
DQ 3fe1000000000000h
DQ 3fe0f00000000000h
DQ 3fe0f00000000000h
DQ 3fe0e00000000000h
DQ 3fe0e00000000000h
DQ 3fe0d00000000000h
DQ 3fe0d00000000000h
DQ 3fe0c00000000000h
DQ 3fe0c00000000000h
DQ 3fe0b00000000000h
DQ 3fe0a00000000000h
DQ 3fe0a00000000000h
DQ 3fe0900000000000h
DQ 3fe0900000000000h
DQ 3fe0800000000000h
DQ 3fe0800000000000h
DQ 3fe0700000000000h
DQ 3fe0700000000000h
DQ 3fe0600000000000h
DQ 3fe0600000000000h
DQ 3fe0500000000000h
DQ 3fe0500000000000h
DQ 3fe0400000000000h
DQ 3fe0400000000000h
DQ 3fe0300000000000h
DQ 3fe0300000000000h
DQ 3fe0200000000000h
DQ 3fe0200000000000h
DQ 3fe0100000000000h
DQ 3fe0100000000000h
DQ 3fe0000000000000h
ALIGN 16
__CubeRootTable_256:
DQ 3ff0000000000000h
DQ 3ff00558e6547c36h
DQ 3ff00ab8f9d2f374h
DQ 3ff010204b673fc7h
DQ 3ff0158eec36749bh
DQ 3ff01b04ed9fdb53h
DQ 3ff02082613df53ch
DQ 3ff0260758e78308h
DQ 3ff02b93e6b091f0h
DQ 3ff031281ceb8ea2h
DQ 3ff036c40e2a5e2ah
DQ 3ff03c67cd3f7ceah
DQ 3ff03f3c9fee224ch
DQ 3ff044ec379f7f79h
DQ 3ff04aa3cd578d67h
DQ 3ff0506374d40a3dh
DQ 3ff0562b4218a6e3h
DQ 3ff059123d3a9848h
DQ 3ff05ee6694e7166h
DQ 3ff064c2ee6e07c6h
DQ 3ff06aa7e19c01c5h
DQ 3ff06d9d8b1deccah
DQ 3ff0738f4b6cc8e2h
DQ 3ff07989af9f9f59h
DQ 3ff07c8a2611201ch
DQ 3ff08291a9958f03h
DQ 3ff088a208c3fe28h
DQ 3ff08bad91dd7d8bh
DQ 3ff091cb6588465eh
DQ 3ff097f24eab04a1h
DQ 3ff09b0932aee3f2h
DQ 3ff0a13de8970de4h
DQ 3ff0a45bc08a5ac7h
DQ 3ff0aa9e79bfa986h
DQ 3ff0b0eaa961ca5bh
DQ 3ff0b4145573271ch
DQ 3ff0ba6ee5f9aad4h
DQ 3ff0bd9fd0dbe02dh
DQ 3ff0c408fc1cfd4bh
DQ 3ff0c741430e2059h
DQ 3ff0cdb9442ea813h
DQ 3ff0d0f905168e6ch
DQ 3ff0d7801893d261h
DQ 3ff0dac772091bdeh
DQ 3ff0e15dd5c330abh
DQ 3ff0e4ace71080a4h
DQ 3ff0e7fe920f3037h
DQ 3ff0eea9c37e497eh
DQ 3ff0f203512f4314h
DQ 3ff0f8be68db7f32h
DQ 3ff0fc1ffa42d902h
DQ 3ff102eb3af9ed89h
DQ 3ff10654f1e29cfbh
DQ 3ff109c1679c189fh
DQ 3ff110a29f080b3dh
DQ 3ff114176891738ah
DQ 3ff1178f0099b429h
DQ 3ff11e86ac2cd7abh
DQ 3ff12206c7cf4046h
DQ 3ff12589c21fb842h
DQ 3ff12c986355d0d2h
DQ 3ff13024129645cfh
DQ 3ff133b2b13aa0ebh
DQ 3ff13ad8cdc48ba3h
DQ 3ff13e70544b1d4fh
DQ 3ff1420adb77c99ah
DQ 3ff145a867b1bfeah
DQ 3ff14ceca1189d6dh
DQ 3ff15093574284e9h
DQ 3ff1543d2473ea9bh
DQ 3ff157ea0d433a46h
DQ 3ff15f4d44462724h
DQ 3ff163039bd7cde6h
DQ 3ff166bd21c3a8e2h
DQ 3ff16a79dad1fb59h
DQ 3ff171fcf9aaac3dh
DQ 3ff175c3693980c3h
DQ 3ff1798d1f73f3efh
DQ 3ff17d5a2156e97fh
DQ 3ff1812a73ea2593h
DQ 3ff184fe1c406b8fh
DQ 3ff18caf82b8dba4h
DQ 3ff1908d4b38a510h
DQ 3ff1946e7e36f7e5h
DQ 3ff1985320ff72a2h
DQ 3ff19c3b38e975a8h
DQ 3ff1a026cb58453dh
DQ 3ff1a415ddbb2c10h
DQ 3ff1a808758d9e32h
DQ 3ff1aff84bac98eah
DQ 3ff1b3f5952e1a50h
DQ 3ff1b7f67a896220h
DQ 3ff1bbfb0178d186h
DQ 3ff1c0032fc3cf91h
DQ 3ff1c40f0b3eefc4h
DQ 3ff1c81e99cc193fh
DQ 3ff1cc31e15aae72h
DQ 3ff1d048e7e7b565h
DQ 3ff1d463b37e0090h
DQ 3ff1d8824a365852h
DQ 3ff1dca4b237a4f7h
DQ 3ff1e0caf1b71965h
DQ 3ff1e4f50ef85e61h
DQ 3ff1e923104dbe76h
DQ 3ff1ed54fc185286h
DQ 3ff1f18ad8c82efch
DQ 3ff1f5c4acdc91aah
DQ 3ff1fa027ee4105bh
DQ 3ff1fe44557cc808h
DQ 3ff2028a37548ccfh
DQ 3ff206d42b291a95h
DQ 3ff20b2237c8466ah
DQ 3ff20f74641030a6h
DQ 3ff213cab6ef77c7h
DQ 3ff2182537656c13h
DQ 3ff21c83ec824406h
DQ 3ff220e6dd675180h
DQ 3ff2254e114737d2h
DQ 3ff229b98f66228ch
DQ 3ff22e295f19fd31h
DQ 3ff2329d87caabb6h
DQ 3ff2371610f243f2h
DQ 3ff23b93021d47dah
DQ 3ff2401462eae0b8h
DQ 3ff2449a3b0d1b3fh
DQ 3ff2449a3b0d1b3fh
DQ 3ff2492492492492h
DQ 3ff24db370778844h
DQ 3ff25246dd846f45h
DQ 3ff256dee16fdfd4h
DQ 3ff25b7b844dfe71h
DQ 3ff2601cce474fd2h
DQ 3ff264c2c798fbe5h
DQ 3ff2696d789511e2h
DQ 3ff2696d789511e2h
DQ 3ff26e1ce9a2cd73h
DQ 3ff272d1233edcf3h
DQ 3ff2778a2dfba8d0h
DQ 3ff27c4812819c13h
DQ 3ff2810ad98f6e10h
DQ 3ff285d28bfa6d45h
DQ 3ff285d28bfa6d45h
DQ 3ff28a9f32aecb79h
DQ 3ff28f70d6afeb08h
DQ 3ff294478118ad83h
DQ 3ff299233b1bc38ah
DQ 3ff299233b1bc38ah
DQ 3ff29e040e03fdfbh
DQ 3ff2a2ea0334a07bh
DQ 3ff2a7d52429b556h
DQ 3ff2acc57a7862c2h
DQ 3ff2acc57a7862c2h
DQ 3ff2b1bb0fcf4190h
DQ 3ff2b6b5edf6b54ah
DQ 3ff2bbb61ed145cfh
DQ 3ff2c0bbac5bfa6eh
DQ 3ff2c0bbac5bfa6eh
DQ 3ff2c5c6a0aeb681h
DQ 3ff2cad705fc97a6h
DQ 3ff2cfece6945583h
DQ 3ff2cfece6945583h
DQ 3ff2d5084ce0a331h
DQ 3ff2da294368924fh
DQ 3ff2df4fd4cff7c3h
DQ 3ff2df4fd4cff7c3h
DQ 3ff2e47c0bd7d237h
DQ 3ff2e9adf35eb25ah
DQ 3ff2eee5966124e8h
DQ 3ff2eee5966124e8h
DQ 3ff2f422fffa1e92h
DQ 3ff2f9663b6369b6h
DQ 3ff2feaf53f61612h
DQ 3ff2feaf53f61612h
DQ 3ff303fe552aea57h
DQ 3ff309534a9ad7ceh
DQ 3ff309534a9ad7ceh
DQ 3ff30eae3fff6ff3h
DQ 3ff3140f41335c2fh
DQ 3ff3140f41335c2fh
DQ 3ff319765a32d7aeh
DQ 3ff31ee3971c2b5bh
DQ 3ff3245704302c13h
DQ 3ff3245704302c13h
DQ 3ff329d0add2bb20h
DQ 3ff32f50a08b48f9h
DQ 3ff32f50a08b48f9h
DQ 3ff334d6e9055a5fh
DQ 3ff33a6394110fe6h
DQ 3ff33a6394110fe6h
DQ 3ff33ff6aea3afedh
DQ 3ff3459045d8331bh
DQ 3ff3459045d8331bh
DQ 3ff34b3066efd36bh
DQ 3ff350d71f529dd8h
DQ 3ff350d71f529dd8h
DQ 3ff356847c9006b4h
DQ 3ff35c388c5f80bfh
DQ 3ff35c388c5f80bfh
DQ 3ff361f35ca116ffh
DQ 3ff361f35ca116ffh
DQ 3ff367b4fb5e0985h
DQ 3ff36d7d76c96d0ah
DQ 3ff36d7d76c96d0ah
DQ 3ff3734cdd40cd95h
DQ 3ff379233d4cd42ah
DQ 3ff379233d4cd42ah
DQ 3ff37f00a5a1ef96h
DQ 3ff37f00a5a1ef96h
DQ 3ff384e52521006ch
DQ 3ff38ad0cad80848h
DQ 3ff38ad0cad80848h
DQ 3ff390c3a602dc60h
DQ 3ff390c3a602dc60h
DQ 3ff396bdc60bdb88h
DQ 3ff39cbf3a8ca7a9h
DQ 3ff39cbf3a8ca7a9h
DQ 3ff3a2c8134ee2d1h
DQ 3ff3a2c8134ee2d1h
DQ 3ff3a8d8604cefe3h
DQ 3ff3aef031b2b706h
DQ 3ff3aef031b2b706h
DQ 3ff3b50f97de6de5h
DQ 3ff3b50f97de6de5h
DQ 3ff3bb36a36163d8h
DQ 3ff3bb36a36163d8h
DQ 3ff3c1656500d20ah
DQ 3ff3c79bedb6afb8h
DQ 3ff3c79bedb6afb8h
DQ 3ff3cdda4eb28aa2h
DQ 3ff3cdda4eb28aa2h
DQ 3ff3d420995a63c0h
DQ 3ff3d420995a63c0h
DQ 3ff3da6edf4b9061h
DQ 3ff3da6edf4b9061h
DQ 3ff3e0c5325b9fc2h
DQ 3ff3e723a499453fh
DQ 3ff3e723a499453fh
DQ 3ff3ed8a484d473ah
DQ 3ff3ed8a484d473ah
DQ 3ff3f3f92ffb72d8h
DQ 3ff3f3f92ffb72d8h
DQ 3ff3fa706e6394a4h
DQ 3ff3fa706e6394a4h
DQ 3ff400f01682764ah
DQ 3ff400f01682764ah
DQ 3ff407783b92e17ah
DQ 3ff407783b92e17ah
DQ 3ff40e08f10ea81ah
DQ 3ff40e08f10ea81ah
DQ 3ff414a24aafb1e6h
DQ 3ff414a24aafb1e6h
DQ 3ff41b445c710fa7h
DQ 3ff41b445c710fa7h
DQ 3ff421ef3a901411h
DQ 3ff421ef3a901411h
DQ 3ff428a2f98d728bh
CONST ENDS
data ENDS
END
|
libsrc/_DEVELOPMENT/arch/sms/vram/z80/asm_sms_memcpy_vram_to_mem.asm | jpoikela/z88dk | 640 | 22792 | ; ========================================================================
;
; void *sms_memcpy_vram_to_mem(void *dst, void *src, unsigned int n)
;
; memcpy from vram to memory; VRAM addresses are assumed to be stable.
;
; ========================================================================
SECTION code_clib
SECTION code_crt_common
PUBLIC asm_sms_memcpy_vram_to_mem
EXTERN asm_sms_vram_read_hl
EXTERN asm_sms_copy_vram_to_mem
asm_sms_memcpy_vram_to_mem:
; memcpy from vram to memory
;
; enter : hl = void *src in vram
; de = void *dst in memory
; bc = unsigned int n > 0
;
; exit : hl = void *src, &byte after last read from vram
; de = void *dst, &byte after last written in memory
; bc = 0
;
; uses : af, bc, de, hl
call asm_sms_vram_read_hl
add hl,bc
ex de,hl
; hl = void *dst in memory
; bc = unsigned int n > 0
; VRAM has src address set
jp asm_sms_copy_vram_to_mem
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-wchcnv.adb | orb-zhuchen/Orb | 0 | 15109 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . W C H _ C N V --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2019, 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. --
-- --
------------------------------------------------------------------------------
pragma Compiler_Unit_Warning;
with Interfaces; use Interfaces;
with System.WCh_Con; use System.WCh_Con;
with System.WCh_JIS; use System.WCh_JIS;
package body System.WCh_Cnv is
-----------------------------
-- Char_Sequence_To_UTF_32 --
-----------------------------
function Char_Sequence_To_UTF_32
(C : Character;
EM : System.WCh_Con.WC_Encoding_Method) return UTF_32_Code
is
B1 : Unsigned_32;
C1 : Character;
U : Unsigned_32;
W : Unsigned_32;
procedure Get_Hex (N : Character);
-- If N is a hex character, then set B1 to 16 * B1 + character N.
-- Raise Constraint_Error if character N is not a hex character.
procedure Get_UTF_Byte;
pragma Inline (Get_UTF_Byte);
-- Used to interpret a 2#10xxxxxx# continuation byte in UTF-8 mode.
-- Reads a byte, and raises CE if the first two bits are not 10.
-- Otherwise shifts W 6 bits left and or's in the 6 xxxxxx bits.
-------------
-- Get_Hex --
-------------
procedure Get_Hex (N : Character) is
B2 : constant Unsigned_32 := Character'Pos (N);
begin
if B2 in Character'Pos ('0') .. Character'Pos ('9') then
B1 := B1 * 16 + B2 - Character'Pos ('0');
elsif B2 in Character'Pos ('A') .. Character'Pos ('F') then
B1 := B1 * 16 + B2 - (Character'Pos ('A') - 10);
elsif B2 in Character'Pos ('a') .. Character'Pos ('f') then
B1 := B1 * 16 + B2 - (Character'Pos ('a') - 10);
else
raise Constraint_Error;
end if;
end Get_Hex;
------------------
-- Get_UTF_Byte --
------------------
procedure Get_UTF_Byte is
begin
U := Unsigned_32 (Character'Pos (In_Char));
if (U and 2#11000000#) /= 2#10_000000# then
raise Constraint_Error;
end if;
W := Shift_Left (W, 6) or (U and 2#00111111#);
end Get_UTF_Byte;
-- Start of processing for Char_Sequence_To_UTF_32
begin
case EM is
when WCEM_Hex =>
if C /= ASCII.ESC then
return Character'Pos (C);
else
B1 := 0;
Get_Hex (In_Char);
Get_Hex (In_Char);
Get_Hex (In_Char);
Get_Hex (In_Char);
return UTF_32_Code (B1);
end if;
when WCEM_Upper =>
if C > ASCII.DEL then
return 256 * Character'Pos (C) + Character'Pos (In_Char);
else
return Character'Pos (C);
end if;
when WCEM_Shift_JIS =>
if C > ASCII.DEL then
return Wide_Character'Pos (Shift_JIS_To_JIS (C, In_Char));
else
return Character'Pos (C);
end if;
when WCEM_EUC =>
if C > ASCII.DEL then
return Wide_Character'Pos (EUC_To_JIS (C, In_Char));
else
return Character'Pos (C);
end if;
when WCEM_UTF8 =>
-- Note: for details of UTF8 encoding see RFC 3629
U := Unsigned_32 (Character'Pos (C));
-- 16#00_0000#-16#00_007F#: 0xxxxxxx
if (U and 2#10000000#) = 2#00000000# then
return Character'Pos (C);
-- 16#00_0080#-16#00_07FF#: 110xxxxx 10xxxxxx
elsif (U and 2#11100000#) = 2#110_00000# then
W := U and 2#00011111#;
Get_UTF_Byte;
return UTF_32_Code (W);
-- 16#00_0800#-16#00_ffff#: 1110xxxx 10xxxxxx 10xxxxxx
elsif (U and 2#11110000#) = 2#1110_0000# then
W := U and 2#00001111#;
Get_UTF_Byte;
Get_UTF_Byte;
return UTF_32_Code (W);
-- 16#01_0000#-16#10_FFFF#: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
elsif (U and 2#11111000#) = 2#11110_000# then
W := U and 2#00000111#;
for K in 1 .. 3 loop
Get_UTF_Byte;
end loop;
return UTF_32_Code (W);
-- 16#0020_0000#-16#03FF_FFFF#: 111110xx 10xxxxxx 10xxxxxx
-- 10xxxxxx 10xxxxxx
elsif (U and 2#11111100#) = 2#111110_00# then
W := U and 2#00000011#;
for K in 1 .. 4 loop
Get_UTF_Byte;
end loop;
return UTF_32_Code (W);
-- 16#0400_0000#-16#7FFF_FFFF#: 1111110x 10xxxxxx 10xxxxxx
-- 10xxxxxx 10xxxxxx 10xxxxxx
elsif (U and 2#11111110#) = 2#1111110_0# then
W := U and 2#00000001#;
for K in 1 .. 5 loop
Get_UTF_Byte;
end loop;
return UTF_32_Code (W);
else
raise Constraint_Error;
end if;
when WCEM_Brackets =>
if C /= '[' then
return Character'Pos (C);
end if;
if In_Char /= '"' then
raise Constraint_Error;
end if;
B1 := 0;
Get_Hex (In_Char);
Get_Hex (In_Char);
C1 := In_Char;
if C1 /= '"' then
Get_Hex (C1);
Get_Hex (In_Char);
C1 := In_Char;
if C1 /= '"' then
Get_Hex (C1);
Get_Hex (In_Char);
C1 := In_Char;
if C1 /= '"' then
Get_Hex (C1);
Get_Hex (In_Char);
if B1 > Unsigned_32 (UTF_32_Code'Last) then
raise Constraint_Error;
end if;
if In_Char /= '"' then
raise Constraint_Error;
end if;
end if;
end if;
end if;
if In_Char /= ']' then
raise Constraint_Error;
end if;
return UTF_32_Code (B1);
end case;
end Char_Sequence_To_UTF_32;
--------------------------------
-- Char_Sequence_To_Wide_Char --
--------------------------------
function Char_Sequence_To_Wide_Char
(C : Character;
EM : System.WCh_Con.WC_Encoding_Method) return Wide_Character
is
function Char_Sequence_To_UTF is new Char_Sequence_To_UTF_32 (In_Char);
U : constant UTF_32_Code := Char_Sequence_To_UTF (C, EM);
begin
if U > 16#FFFF# then
raise Constraint_Error;
else
return Wide_Character'Val (U);
end if;
end Char_Sequence_To_Wide_Char;
-----------------------------
-- UTF_32_To_Char_Sequence --
-----------------------------
procedure UTF_32_To_Char_Sequence
(Val : UTF_32_Code;
EM : System.WCh_Con.WC_Encoding_Method)
is
Hexc : constant array (UTF_32_Code range 0 .. 15) of Character :=
"0123456789ABCDEF";
C1, C2 : Character;
U : Unsigned_32;
begin
-- Raise CE for invalid UTF_32_Code
if not Val'Valid then
raise Constraint_Error;
end if;
-- Processing depends on encoding mode
case EM is
when WCEM_Hex =>
if Val < 256 then
Out_Char (Character'Val (Val));
elsif Val <= 16#FFFF# then
Out_Char (ASCII.ESC);
Out_Char (Hexc (Val / (16**3)));
Out_Char (Hexc ((Val / (16**2)) mod 16));
Out_Char (Hexc ((Val / 16) mod 16));
Out_Char (Hexc (Val mod 16));
else
raise Constraint_Error;
end if;
when WCEM_Upper =>
if Val < 128 then
Out_Char (Character'Val (Val));
elsif Val < 16#8000# or else Val > 16#FFFF# then
raise Constraint_Error;
else
Out_Char (Character'Val (Val / 256));
Out_Char (Character'Val (Val mod 256));
end if;
when WCEM_Shift_JIS =>
if Val < 128 then
Out_Char (Character'Val (Val));
elsif Val <= 16#FFFF# then
JIS_To_Shift_JIS (Wide_Character'Val (Val), C1, C2);
Out_Char (C1);
Out_Char (C2);
else
raise Constraint_Error;
end if;
when WCEM_EUC =>
if Val < 128 then
Out_Char (Character'Val (Val));
elsif Val <= 16#FFFF# then
JIS_To_EUC (Wide_Character'Val (Val), C1, C2);
Out_Char (C1);
Out_Char (C2);
else
raise Constraint_Error;
end if;
when WCEM_UTF8 =>
-- Note: for details of UTF8 encoding see RFC 3629
U := Unsigned_32 (Val);
-- 16#00_0000#-16#00_007F#: 0xxxxxxx
if U <= 16#00_007F# then
Out_Char (Character'Val (U));
-- 16#00_0080#-16#00_07FF#: 110xxxxx 10xxxxxx
elsif U <= 16#00_07FF# then
Out_Char (Character'Val (2#11000000# or Shift_Right (U, 6)));
Out_Char (Character'Val (2#10000000# or (U and 2#00111111#)));
-- 16#00_0800#-16#00_FFFF#: 1110xxxx 10xxxxxx 10xxxxxx
elsif U <= 16#00_FFFF# then
Out_Char (Character'Val (2#11100000# or Shift_Right (U, 12)));
Out_Char (Character'Val (2#10000000# or (Shift_Right (U, 6)
and 2#00111111#)));
Out_Char (Character'Val (2#10000000# or (U and 2#00111111#)));
-- 16#01_0000#-16#10_FFFF#: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
elsif U <= 16#10_FFFF# then
Out_Char (Character'Val (2#11110000# or Shift_Right (U, 18)));
Out_Char (Character'Val (2#10000000# or (Shift_Right (U, 12)
and 2#00111111#)));
Out_Char (Character'Val (2#10000000# or (Shift_Right (U, 6)
and 2#00111111#)));
Out_Char (Character'Val (2#10000000# or (U and 2#00111111#)));
-- 16#0020_0000#-16#03FF_FFFF#: 111110xx 10xxxxxx 10xxxxxx
-- 10xxxxxx 10xxxxxx
elsif U <= 16#03FF_FFFF# then
Out_Char (Character'Val (2#11111000# or Shift_Right (U, 24)));
Out_Char (Character'Val (2#10000000# or (Shift_Right (U, 18)
and 2#00111111#)));
Out_Char (Character'Val (2#10000000# or (Shift_Right (U, 12)
and 2#00111111#)));
Out_Char (Character'Val (2#10000000# or (Shift_Right (U, 6)
and 2#00111111#)));
Out_Char (Character'Val (2#10000000# or (U and 2#00111111#)));
-- 16#0400_0000#-16#7FFF_FFFF#: 1111110x 10xxxxxx 10xxxxxx
-- 10xxxxxx 10xxxxxx 10xxxxxx
elsif U <= 16#7FFF_FFFF# then
Out_Char (Character'Val (2#11111100# or Shift_Right (U, 30)));
Out_Char (Character'Val (2#10000000# or (Shift_Right (U, 24)
and 2#00111111#)));
Out_Char (Character'Val (2#10000000# or (Shift_Right (U, 18)
and 2#00111111#)));
Out_Char (Character'Val (2#10000000# or (Shift_Right (U, 12)
and 2#00111111#)));
Out_Char (Character'Val (2#10000000# or (Shift_Right (U, 6)
and 2#00111111#)));
Out_Char (Character'Val (2#10000000# or (U and 2#00111111#)));
else
raise Constraint_Error;
end if;
when WCEM_Brackets =>
-- Values in the range 0-255 are directly output. Note that there
-- is an issue with [ (16#5B#) since this will cause confusion
-- if the resulting string is interpreted using brackets encoding.
-- One possibility would be to always output [ as ["5B"] but in
-- practice this is undesirable, since for example normal use of
-- Wide_Text_IO for output (much more common than input), really
-- does want to be able to say something like
-- Put_Line ("Start of output [first run]");
-- and have it come out as intended, rather than contaminated by
-- a ["5B"] sequence in place of the left bracket.
if Val < 256 then
Out_Char (Character'Val (Val));
-- Otherwise use brackets notation for vales greater than 255
else
Out_Char ('[');
Out_Char ('"');
if Val > 16#FFFF# then
if Val > 16#00FF_FFFF# then
Out_Char (Hexc (Val / 16 ** 7));
Out_Char (Hexc ((Val / 16 ** 6) mod 16));
end if;
Out_Char (Hexc ((Val / 16 ** 5) mod 16));
Out_Char (Hexc ((Val / 16 ** 4) mod 16));
end if;
Out_Char (Hexc ((Val / 16 ** 3) mod 16));
Out_Char (Hexc ((Val / 16 ** 2) mod 16));
Out_Char (Hexc ((Val / 16) mod 16));
Out_Char (Hexc (Val mod 16));
Out_Char ('"');
Out_Char (']');
end if;
end case;
end UTF_32_To_Char_Sequence;
--------------------------------
-- Wide_Char_To_Char_Sequence --
--------------------------------
procedure Wide_Char_To_Char_Sequence
(WC : Wide_Character;
EM : System.WCh_Con.WC_Encoding_Method)
is
procedure UTF_To_Char_Sequence is new UTF_32_To_Char_Sequence (Out_Char);
begin
UTF_To_Char_Sequence (Wide_Character'Pos (WC), EM);
end Wide_Char_To_Char_Sequence;
end System.WCh_Cnv;
|
Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0xca_notsx.log_21829_1635.asm | ljhsiun2/medusa | 9 | 87215 | <filename>Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0xca_notsx.log_21829_1635.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x1cbf5, %rdi
inc %r14
mov (%rdi), %ax
nop
nop
dec %rdx
lea addresses_normal_ht+0x164bb, %rsi
lea addresses_UC_ht+0x137f5, %rdi
nop
nop
nop
nop
xor $17886, %r11
mov $88, %rcx
rep movsl
dec %rax
lea addresses_WC_ht+0x1376d, %rdx
nop
sub $50468, %rsi
mov $0x6162636465666768, %r11
movq %r11, %xmm1
movups %xmm1, (%rdx)
nop
nop
nop
cmp %r14, %r14
lea addresses_WT_ht+0x1d265, %rdi
nop
nop
nop
nop
nop
and %rax, %rax
movb (%rdi), %dl
nop
inc %rdx
lea addresses_D_ht+0x8bf5, %r11
nop
nop
sub %rsi, %rsi
and $0xffffffffffffffc0, %r11
vmovaps (%r11), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $1, %xmm3, %rax
nop
nop
nop
nop
and %r14, %r14
lea addresses_A_ht+0x93f5, %rsi
lea addresses_UC_ht+0x143f5, %rdi
clflush (%rsi)
sub $38403, %r13
mov $106, %rcx
rep movsq
nop
cmp %r13, %r13
lea addresses_A_ht+0x5fd5, %rdx
nop
nop
xor %rcx, %rcx
movw $0x6162, (%rdx)
and %r11, %r11
lea addresses_A_ht+0x10035, %rsi
xor $14795, %rdi
mov (%rsi), %r13d
nop
nop
sub $32406, %r11
lea addresses_A_ht+0x1dd, %rsi
nop
nop
nop
nop
cmp $7507, %rcx
mov $0x6162636465666768, %r14
movq %r14, %xmm4
vmovups %ymm4, (%rsi)
nop
nop
sub %rdi, %rdi
lea addresses_WC_ht+0xa5f5, %rsi
nop
xor $37430, %r14
movb $0x61, (%rsi)
nop
sub $17769, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WT+0x93f5, %rcx
nop
and %r15, %r15
mov $0x5152535455565758, %rsi
movq %rsi, %xmm7
movups %xmm7, (%rcx)
nop
nop
nop
nop
nop
add %r15, %r15
// Store
lea addresses_D+0x12ab5, %r12
nop
nop
nop
nop
nop
sub $63261, %rdi
movl $0x51525354, (%r12)
nop
nop
nop
xor %rdx, %rdx
// Faulty Load
lea addresses_WT+0x93f5, %r12
nop
add $37552, %r13
mov (%r12), %rdi
lea oracles, %rsi
and $0xff, %rdi
shlq $12, %rdi
mov (%rsi,%rdi,1), %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 16, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_D', 'size': 4, 'AVXalign': True}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 8, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
scripts/safarizonecenter.asm | adhi-thirumala/EvoYellow | 16 | 101843 | <gh_stars>10-100
SafariZoneCenterScript:
jp EnableAutoTextBoxDrawing
SafariZoneCenterTextPointers:
dw PickUpItemText
dw SafariZoneCenterText2
dw SafariZoneCenterText3
SafariZoneCenterText2:
TX_FAR _SafariZoneCenterText2
db "@"
SafariZoneCenterText3:
TX_FAR _SafariZoneCenterText3
db "@"
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2547.asm | ljhsiun2/medusa | 9 | 179199 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xc5f6, %rsi
lea addresses_normal_ht+0xef66, %rdi
nop
nop
xor $41383, %rbx
mov $121, %rcx
rep movsl
nop
and $31362, %r14
lea addresses_D_ht+0x39f6, %rsi
lea addresses_A_ht+0x138f6, %rdi
nop
nop
nop
nop
xor %r9, %r9
mov $54, %rcx
rep movsb
nop
nop
nop
nop
sub %r14, %r14
lea addresses_D_ht+0x14db6, %r9
nop
nop
add $15268, %r8
mov (%r9), %rcx
nop
nop
nop
xor %r8, %r8
lea addresses_UC_ht+0x18e6a, %r9
sub %r14, %r14
movb (%r9), %cl
nop
xor $43268, %r8
lea addresses_D_ht+0x1037e, %rdi
nop
nop
nop
xor $16774, %r8
mov (%rdi), %r9d
nop
nop
cmp $14753, %rcx
lea addresses_WC_ht+0xee96, %rsi
lea addresses_UC_ht+0xd02, %rdi
nop
nop
inc %rdx
mov $104, %rcx
rep movsq
nop
nop
cmp %r9, %r9
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r9
push %rbp
push %rbx
push %rdi
// Store
lea addresses_WT+0x132f6, %r12
clflush (%r12)
xor %rbp, %rbp
movb $0x51, (%r12)
nop
nop
nop
and $17397, %r10
// Faulty Load
lea addresses_UC+0xd1f6, %rbx
clflush (%rbx)
xor $7715, %r12
movups (%rbx), %xmm3
vpextrq $1, %xmm3, %r9
lea oracles, %r10
and $0xff, %r9
shlq $12, %r9
mov (%r10,%r9,1), %r9
pop %rdi
pop %rbx
pop %rbp
pop %r9
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'same': True, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
programs/oeis/022/A022139.asm | jmorken/loda | 1 | 82036 | <filename>programs/oeis/022/A022139.asm
; A022139: Fibonacci sequence beginning 5, 14.
; 5,14,19,33,52,85,137,222,359,581,940,1521,2461,3982,6443,10425,16868,27293,44161,71454,115615,187069,302684,489753,792437,1282190,2074627,3356817,5431444,8788261,14219705,23007966,37227671,60235637,97463308,157698945
add $0,1
mov $2,8
mov $3,4
lpb $0
sub $0,1
add $1,$3
mov $3,$2
mov $2,$1
add $1,1
lpe
|
engine/battle/move_effects/belly_drum.asm | AtmaBuster/pokeplat-gen2 | 6 | 169444 | <reponame>AtmaBuster/pokeplat-gen2<filename>engine/battle/move_effects/belly_drum.asm
BattleCommand_bellydrum:
; bellydrum
callfar GetHalfMaxHP
callfar CheckUserHasEnoughHP
jr nc, .failed
push bc
ld b, $f0 | ATTACK
ld a, STAT_SKIPTEXT
call _ForceRaiseStat
pop bc
ld a, [wFailedMessage]
and a
jr nz, .failed
push bc
call AnimateCurrentMove
pop bc
callfar SubtractHPFromUser
call UpdateUserInParty
ld hl, BellyDrumText
jp StdBattleTextbox
.failed
call AnimateFailedMove
jp PrintButItFailed
|
src/OnionScript.Compiler/Grammar/OnionScript.g4 | Valax321/OnionScript | 0 | 674 | grammar OnionScript;
@lexer::header {
using System.Collections.Generic;
}
@lexer::members {
private Stack<bool> skipWhitespace = new Stack<bool>();
}
// Parser Rules
script : import_statement* statement* EOF;
statement : methodcall
| function_definition
| function_return
| variable_definition
| anonymous_function
;
methodcall : STATEMENT_BEGIN method_operation STATEMENT_END;
method_operation : identifier (WHITESPACE argument_any)* # OperatorCallMethod
| operator_set WHITESPACE identifier WHITESPACE argument_any #OperatorSet
| operator_add WHITESPACE argument_number WHITESPACE argument_number # OperatorAdd
| operator_subtract WHITESPACE argument_number WHITESPACE argument_number # OperatorSubtract
| operator_multiply WHITESPACE argument_number WHITESPACE argument_number # OperatorMultiply
| operator_divide WHITESPACE argument_number WHITESPACE argument_number # OperatorDivide
| operator_modulus WHITESPACE argument_number WHITESPACE argument_number # OperatorModulus
| operator_not WHITESPACE argument_boolean # OperatorNot
| operator_and WHITESPACE argument_boolean WHITESPACE argument_boolean # OperatorAnd
| operator_or WHITESPACE argument_boolean WHITESPACE argument_boolean # OperatorOr
| operator_nor WHITESPACE argument_boolean WHITESPACE argument_boolean # OperatorNor
| operator_nand WHITESPACE argument_boolean WHITESPACE argument_boolean # OperatorNand
| operator_equal WHITESPACE argument_any WHITESPACE argument_any #OperatorEquals
| operator_notequal WHITESPACE argument_any WHITESPACE argument_any # OperatorNotEquals
| operator_greaterthan WHITESPACE argument_number WHITESPACE argument_number #OperatorGreaterThan
| operator_greaterthanequal WHITESPACE argument_number WHITESPACE argument_number #OperatorGreaterThanEqual
| operator_lessthan WHITESPACE argument_number WHITESPACE argument_number #OperatorLessThan
| operator_lessthanequal WHITESPACE argument_number WHITESPACE argument_number #OperatorLessThanEqual
| operator_for WHITESPACE identifier WHITESPACE argument_number WHITESPACE argument_boolean WHITESPACE anonymous_function WHITESPACE (anonymous_function | methodcall) # OperatorFor
| operator_while WHITESPACE argument_boolean WHITESPACE (anonymous_function | methodcall) # OperatorWhile
| operator_dowhile WHITESPACE argument_boolean WHITESPACE (anonymous_function | methodcall) # OperatorDoWhile
;
operator_import : 'import';
operator_function : 'func';
operator_let : 'let';
operator_return : 'return';
operator_for : 'for';
operator_while : 'while';
operator_dowhile : 'dowhile';
operator_set : '=';
operator_add : '+';
operator_subtract : '-';
operator_multiply : '*';
operator_divide : '/';
operator_modulus : '%';
operator_not : 'not';
operator_and : 'and';
operator_or : 'or';
operator_nor : 'nor';
operator_nand : 'nand';
operator_equal : '==';
operator_notequal : '!=';
operator_greaterthan : '>';
operator_greaterthanequal : '>=';
operator_lessthan : '<';
operator_lessthanequal : '<=';
import_statement : STATEMENT_BEGIN operator_import WHITESPACE text STATEMENT_END;
anonymous_function : STATEMENT_BEGIN_IGNORE_WHITESPACE statement* STATEMENT_END_IGNORE_WHITESPACE;
function_definition : STATEMENT_BEGIN
operator_function WHITESPACE identifier (WHITESPACE identifier)* WHITESPACE (anonymous_function)
STATEMENT_END
;
function_return :STATEMENT_BEGIN
operator_return WHITESPACE argument_any
STATEMENT_END
;
variable_definition : STATEMENT_BEGIN
operator_let WHITESPACE identifier WHITESPACE argument_any
STATEMENT_END
;
text : TEXT;
integer : INTEGER;
float : FLOAT;
boolean : BOOLEAN;
identifier : IDENTIFIER;
argument_text : text | identifier | methodcall | anonymous_function;
argument_integer : integer | identifier | methodcall | anonymous_function;
argument_float : float | identifier | methodcall | anonymous_function;
argument_number : argument_integer | argument_float;
argument_boolean : boolean | identifier | methodcall | anonymous_function;
argument_statement : statement | identifier;
argument_any : argument_text
| argument_number
| argument_boolean
;
// Lexer rules
fragment UPPERCASE : [A-Z];
fragment LOWERCASE : [a-z];
fragment DIGIT : [0-9];
fragment HEXDIGIT : ([0-9] | [a-f] | [A-F]);
fragment ALPHACHAR : (UPPERCASE | LOWERCASE | '_');
fragment ALPHANUMCHAR : (UPPERCASE | LOWERCASE | '_' | DIGIT);
fragment NEWLINE : ('\r\n' | '\n');
WHITESPACE : (NEWLINE | ' ' | '\t')+ { if (skipWhitespace.Count == 0 || skipWhitespace.Peek()) Skip(); };
STATEMENT_BEGIN : '(' { skipWhitespace.Push(false); };
STATEMENT_END : ')' { try { skipWhitespace.Pop(); } catch (InvalidOperationException) { } };
STATEMENT_BEGIN_IGNORE_WHITESPACE : '(' WHITESPACE* { skipWhitespace.Push(true); };
STATEMENT_END_IGNORE_WHITESPACE : WHITESPACE* ')' { try { skipWhitespace.Pop(); } catch (InvalidOperationException) { } };
TEXT : '"' ('\\"' | .)*? '"';
BOOLEAN : 'true' | 'false';
FLOAT : ('-')? (DIGIT+)? '.' (DIGIT+)?;
INTEGER : ('-')? (DIGIT+|'0' ('x'|'X') HEXDIGIT+);
IDENTIFIER : ALPHACHAR (ALPHANUMCHAR+)?;
COMMENT : '#' .*? NEWLINE+ -> skip;
ENDL : NEWLINE+; |
tests/emra/EM_MODE/asm/EM01.asm | ilebedev/stacktool | 1 | 15767 | <reponame>ilebedev/stacktool<filename>tests/emra/EM_MODE/asm/EM01.asm<gh_stars>1-10
PUSH 0; # RA
PUSH 0; # 0 RA
ST_EM 2 0; # 0 0 RA
PUSH 1; # RA
PUSH 0; # 1 RA
SETHI 0x0200; # 0 1 RA
ST_EM 2 0; # 0x2 1| RA # migrate
PUSH 2; # |RA
PUSH 0; # 2| RA
SETHI 0x0400; # 0 2| RA
ST_EM 2 0; # 0x4 2| RA # migrate
PUSH 3; # |RA
PUSH 0; # 3| RA
SETHI 0x0600; # 0 3| RA
ST_EM 2 0; # 0x6 3| RA
PUSH 0; # |RA
LD_EM 1 0; # 0| RA
PUSH 1; # M0| RA
ADD; # 1 M0| RA
PUSH 0; # M01| RA
ST_EM 2; # 0 M01|RA # migrate
PUSH 0; # |RA
LD_EM 1 0; # 0| RA
PUSH 1; # M0| RA
SETHI 0x0200; # 1 M0| RA
TUCK_CP 1; # 0x2 M0| RA
ST_EM 3 0; # 0x2 M0 0x2|RA # migrate
LD_EM 1 0; # 0x2| RA
PUSH 1; # M2| RA
SETHI 0x0400; # 1 M2| RA
ST_EM 2 0; # 0x4 M2| RA # migrate
HALT; # RA
|
src/utilities/petit_poucet.adb | SKNZ/BoiteMaker | 0 | 5672 | <reponame>SKNZ/BoiteMaker<gh_stars>0
with logger;
use logger;
package body petit_poucet is
-- Instancie un petit poucet
function get_petit_poucet(start_pos : point_t) return petit_poucet_t is
start_node : constant node_ptr := create(start_pos);
begin
debug("Naissance d'un petit poucet à la position " & to_string(start_pos));
return (start_pos => start_pos,
curr_pos => start_pos,
start_node => start_node,
curr_node => start_node);
end;
-- Obtient les points laissés par le petit poucet
function get_points(poucet : petit_poucet_t) return node_ptr is
begin
return poucet.start_node;
end;
-- Cette fonction générique permet d'éviter d'écrire de multiple fois les fonctions mv_* qui sont essentiellement les mêmes, exceptées qu'elles fonctions sur des axes différents (x ou y) et avec des multiplicateurs différents (delta * -1 pour aller à gauche/en haut, delta * 1 sinon)
-- en passant une fonction de mv (mv_x ou mv_y du package point) et un mult en tant que paramètre de généricité
generic
debug_string : string;
mv : mv_point_ptr;
mult : integer;
procedure mv_poucet(poucet : in out petit_poucet_t; delta_axis : float);
-- corps de la fonction générique à part car Ada n'autorise pas
-- déclaration + impl. en même temps quand il s'agit de blocs génériques
procedure mv_poucet(poucet : in out petit_poucet_t; delta_axis : float) is
begin
debug("Le poucet se déplace vers " & debug_string & " de " & float'image(delta_axis));
mv(poucet.curr_pos, delta_axis * float(mult));
poucet.curr_node := add_after(poucet.curr_node, poucet.curr_pos);
end;
-- Instanciations des fonctions de mouvement avec pour nom internal_*
-- On ne peut les instancier directement en tant que mv_*
-- car Ada ne l'autorise pas (message: instanciation cannot provide for body)
procedure internal_mv_l is new mv_poucet ("l", mv_x_ptr, -1);
procedure internal_mv_r is new mv_poucet ("r", mv_x_ptr, 1);
procedure internal_mv_u is new mv_poucet ("u", mv_y_ptr, -1);
procedure internal_mv_d is new mv_poucet ("d", mv_y_ptr, 1);
-- Un renommage est par contre une manière valide
-- de fournir un corps à une fonction déclarée dans le package
-- (contrairement à une instanciation de fonction générique)
procedure mv_l(poucet : in out petit_poucet_t; delta_x : float) renames internal_mv_l;
procedure mv_r(poucet : in out petit_poucet_t; delta_x : float) renames internal_mv_r;
procedure mv_u(poucet : in out petit_poucet_t; delta_y : float) renames internal_mv_u;
procedure mv_d(poucet : in out petit_poucet_t; delta_y : float) renames internal_mv_d;
end;
|
programs/oeis/106/A106348.asm | neoneye/loda | 22 | 89328 | ; A106348: Partial sums of a generalized Fredholm-Rueppel sequence.
; 1,0,2,1,1,1,3,2,2,2,2,2,2,2,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5
mov $2,$0
add $0,2
add $2,1
mov $6,-1
lpb $2
div $2,2
add $6,1
lpe
mov $2,$6
mov $3,4
mov $4,1
mov $5,1
lpb $0
div $0,2
sub $5,$2
mov $1,$5
mov $2,1
add $2,$4
add $5,$3
lpe
sub $1,2
mov $0,$1
|
oeis/060/A060510.asm | neoneye/loda-programs | 11 | 87876 | <filename>oeis/060/A060510.asm
; A060510: Alternating with hexagonal stutters: if n is hexagonal (2k^2 - k, i.e., A000384) then a(n)=a(n-1), otherwise a(n) = 1 - a(n-1).
; Submitted by <NAME>
; 0,0,1,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0
seq $0,25682 ; Exponent of 9 (value of j) in n-th number of form 8^i*9^j.
mod $0,2
|
Task/Boolean-values/AppleScript/boolean-values-2.applescript | LaudateCorpus1/RosettaCodeData | 1 | 4724 | {yes as boolean, no as boolean}
--> {true, false}
|
oeis/147/A147816.asm | neoneye/loda-programs | 11 | 104974 | ; A147816: Concatenation of n digits 1 and 2(n-1) digits 0.
; Submitted by <NAME>
; 1,1100,1110000,1111000000,1111100000000,1111110000000000,1111111000000000000,1111111100000000000000,1111111110000000000000000,1111111111000000000000000000,1111111111100000000000000000000
mov $1,10
pow $1,$0
mul $1,10
mov $0,$1
bin $1,2
div $1,5
mul $1,$0
mov $0,$1
div $0,90
|
libsrc/_DEVELOPMENT/math/float/math48/c/sccz80/cm48_sccz80_trunc.asm | meesokim/z88dk | 0 | 20252 | <filename>libsrc/_DEVELOPMENT/math/float/math48/c/sccz80/cm48_sccz80_trunc.asm<gh_stars>0
; double __FASTCALL__ trunc(double x)
SECTION code_fp_math48
PUBLIC cm48_sccz80_trunc
EXTERN am48_trunc
defc cm48_sccz80_trunc = am48_trunc
|
programs/oeis/131/A131743.asm | neoneye/loda | 22 | 95364 | <reponame>neoneye/loda
; A131743: Period 4: repeat [0, 1, 0, 2].
; 0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,2
add $0,1
mov $1,4
gcd $1,$0
div $1,2
mov $0,$1
|
src/main/antlr/Calc.g4 | az82/antlr-demo | 1 | 6833 | grammar Calc;
calc: expr EOF;
expr: BR_OPEN expr BR_CLOSE
|expr TIMES expr
|expr DIV expr
|expr PLUS expr
|expr MINUS expr
|number ;
number: NUMBER;
PLUS: '+';
MINUS: '-';
TIMES: '*';
DIV: '/';
NUMBER: '-'? [0-9]+;
BR_OPEN: '(';
BR_CLOSE: ')';
WS: [ \t\r\n]+ -> skip;
|
a51test/(C8)XCH_A_Rn.a51 | Aimini/51cpu | 0 | 14750 | <filename>a51test/(C8)XCH_A_Rn.a51
MOV 0xF0,#0x20
INIT:
MOV 0x00,A ; use R0 to r/w indirect address
MOV @R0,A
INC A
DJNZ 0xF0,INIT
MOV 0x00,#0x00
MOV A,#0xFF
MOV 0xD0,#0x00
XCH A,R0
XCH A,R1
XCH A,R2
XCH A,R3
XCH A,R4
XCH A,R5
XCH A,R6
XCH A,R7
MOV 0xD0,#0x08
XCH A,R0
XCH A,R1
XCH A,R2
XCH A,R3
XCH A,R4
XCH A,R5
XCH A,R6
XCH A,R7
MOV 0xD0,#0x10
XCH A,R0
XCH A,R1
XCH A,R2
XCH A,R3
XCH A,R4
XCH A,R5
XCH A,R6
XCH A,R7
MOV 0xD0,#0x18
XCH A,R0
XCH A,R1
XCH A,R2
XCH A,R3
XCH A,R4
XCH A,R5
XCH A,R6
XCH A,R7 |
oeis/064/A064335.asm | neoneye/loda-programs | 11 | 15828 | ; A064335: a(n) = 6*(2*n)!/(n+2).
; Submitted by <NAME>
; 3,4,36,864,40320,3110400,359251200,58118860800,12553673932800,3492203839488000,1216451004088320000,518769566666588160000,265906457885674045440000,161316584450642254233600000,114333129229392697688064000000,93618656404302726577520640000000,87710278977897843389072670720000000,93231410223032886583458508308480000000,111597998036970365240399834445250560000000,149435033561886031931430635457164083200000000,222522349976699382094257618980758880256000000000
mov $1,$0
mul $0,2
seq $0,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters).
mul $0,6
add $1,2
div $0,$1
|
libsrc/_DEVELOPMENT/compress/zx7/c/sdcc/dzx7_standard_back_callee.asm | jpoikela/z88dk | 640 | 102510 | <filename>libsrc/_DEVELOPMENT/compress/zx7/c/sdcc/dzx7_standard_back_callee.asm
; void dzx7_standard_back_callee(void *src, void *dst)
SECTION code_clib
SECTION code_compress_zx7
PUBLIC _dzx7_standard_back_callee
EXTERN asm_dzx7_standard_back
_dzx7_standard_back_callee:
pop af
pop hl
pop de
push af
jp asm_dzx7_standard_back
|
legend-engine-language-pure-store-relational/src/main/antlr4/org/finos/legend/engine/language/pure/grammar/from/antlr4/connection/RelationalDatabaseConnectionLexerGrammar.g4 | maverick729/legend-engine | 0 | 4581 | lexer grammar RelationalDatabaseConnectionLexerGrammar;
import CoreLexerGrammar;
// -------------------------------------- KEYWORD --------------------------------------
STORE: 'store';
TYPE: 'type';
RELATIONAL_DATASOURCE_SPEC: 'specification';
RELATIONAL_AUTH_STRATEGY: 'auth';
RELATIONAL_POST_PROCESSORS: 'postProcessors';
DB_TIMEZONE: 'timezone';
QUOTE_IDENTIFIERS: 'quoteIdentifiers';
BRACE_OPEN: '{' -> pushMode(SPECIFICATION_ISLAND_MODE);
mode SPECIFICATION_ISLAND_MODE;
SPECIFICATION_BRACE_OPEN: '{' -> pushMode (SPECIFICATION_ISLAND_MODE);
SPECIFICATION_BRACE_CLOSE: '}' -> popMode;
SPECIFICATION_CONTENT: (~[{}])+; |
ch12/LoadAndStore.asm | William0Friend/my_masm | 0 | 3616 | <filename>ch12/LoadAndStore.asm
; Load and Store (floats) (LoadAndStore.asm)
; This program demonstrates the use of Load and Store
; instructions in the FPU instruction set.
INCLUDE Irvine32.inc
.code
main PROC
.data
dblOne REAL8 1234.56
dblTwo REAL8 10.1
dblThree REAL8 ?
dblFour REAL8 ?
bigVal REAL10 1.0123456789012345E+864
.code
finit
; Load a large value onto the stack, pop it
; back into the same variable.
fld bigVal
fstp bigVal
; Load two operands onto the stack
fld dblOne
fld dblTwo
call ShowFPUStack
; Store operands into memory, pop from stack
fstp dblThree
call ShowFPUStack
fstp dblFour
call ShowFPUStack
exit
main ENDP
END main |
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0xca_notsx.log_21829_367.asm | ljhsiun2/medusa | 9 | 5387 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r14
push %r15
push %rax
push %rdi
lea addresses_normal_ht+0x189eb, %rdi
nop
nop
add %r15, %r15
movups (%rdi), %xmm5
vpextrq $0, %xmm5, %r10
nop
nop
nop
nop
nop
xor $41119, %r11
lea addresses_D_ht+0x1184f, %r12
nop
nop
nop
nop
add $18774, %rax
movb $0x61, (%r12)
xor $7850, %rdi
lea addresses_WC_ht+0x1815f, %rdi
cmp $54796, %r11
movb (%rdi), %r12b
nop
nop
nop
nop
nop
sub $49806, %r11
pop %rdi
pop %rax
pop %r15
pop %r14
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %rax
push %rdi
// Faulty Load
lea addresses_WT+0xb9f, %rax
nop
nop
nop
inc %rdi
mov (%rax), %r13w
lea oracles, %r11
and $0xff, %r13
shlq $12, %r13
mov (%r11,%r13,1), %r13
pop %rdi
pop %rax
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': True, 'type': 'addresses_WT', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
src/main/java/com/datascience9/pb/parse/PowerBuilderParser.g4 | gmai2006/grammar | 1 | 1564 | /*
BSD License
Copyright (c) 2018, <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. Neither the name of Tom Everett 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.
*/
parser grammar PowerBuilderParser;
options { tokenVocab = PowerBuilderLexer; }
start_rule
: (RELEASE NUMBER SEMI)? body_rule+ EOF
;
body_rule
: datatype_decl
| access_modif
| forward_decl
| type_variables_decl
| global_variables_decl
| variable_decl
| constant_decl
| function_forward_decl
| functions_forward_decl
| function_body
| on_body
| event_body
;
forward_decl
: FORWARD (datatype_decl | variable_decl | global_variables_decl)+ END FORWARD
;
datatype_decl
: scope_modif? TYPE identifier_name FROM (identifier_name TICK)? data_type_name (WITHIN identifier_name)? AUTOINSTANTIATE? (DESCRIPTOR DQUOTED_STRING EQ DQUOTED_STRING)?
(variable_decl | event_forward_decl)*
END TYPE
;
type_variables_decl
: TYPE VARIABLES (variable_decl | constant_decl | public_statement)* END VARIABLES
;
global_variables_decl
: GLOBAL variable_decl
| (GLOBAL | SHARED) VARIABLES (variable_decl)* END VARIABLES
;
variable_decl
: access_type? variable_decl_sub SEMI?
;
variable_decl_sub
: INDIRECT? access_modif_part? scope_modif? (variable_decl_sub0 | variable_decl_sub1 | variable_decl_sub2 | variable_decl_event)
;
variable_decl_sub0
: data_type_name decimal_decl_sub? variable_name (COMMA variable_name)* (EQ assignment_rhs)?
;
variable_decl_sub1
: data_type_name assignment_statement (COMMA data_type_name? assignment_statement)*
;
variable_decl_sub2
: data_type_name decimal_decl_sub? identifier_name_ex array_decl_sub? ( (EQ)? LCURLY expression_list RCURLY)?
;
variable_decl_event
: EVENT identifier (LPAREN expression_list RPAREN)?
;
decimal_decl_sub
: LCURLY NUMBER RCURLY
;
array_decl_sub
: LBRACE RBRACE
| LBRACE ((PLUS | MINUS)? NUMBER (TO (PLUS | MINUS)? NUMBER)? (COMMA (PLUS | MINUS)? NUMBER (TO (PLUS | MINUS)? NUMBER)?)*)? RBRACE
;
constant_decl_sub
: access_type? CONSTANT variable_decl_sub
;
constant_decl
: constant_decl_sub SEMI?
;
function_forward_decl
: access_modif_part? scope_modif? (FUNCTION data_type_name | SUBROUTINE)
identifier_name LPAREN parameters_list_sub? RPAREN
function_forward_decl_alias
;
function_forward_decl_alias
: ALIAS FOR identifier_name LIBRARY (DQUOTED_STRING | QUOTED_STRING)
| (LIBRARY (DQUOTED_STRING | QUOTED_STRING) (ALIAS FOR (DQUOTED_STRING | QUOTED_STRING))?)?
| (RPCFUNC ALIAS FOR (DQUOTED_STRING | QUOTED_STRING))? (THROWS identifier_name)?
;
parameter_sub
: READONLY? REF? data_type_name decimal_decl_sub? identifier_name array_decl_sub?
;
parameters_list_sub
: parameter_sub (COMMA parameter_sub)* (COMMA DOTDOTDOT)?
;
functions_forward_decl
: (FORWARD | TYPE) PROTOTYPES function_forward_decl* END PROTOTYPES
;
function_body
: access_type? scope_modif? (FUNCTION data_type_name | SUBROUTINE) identifier_name LPAREN parameters_list_sub? RPAREN (THROWS identifier_name)?
(SEMI)? (statement SEMI?)* END (FUNCTION | SUBROUTINE)
;
on_body
: ON identifier (DOT (CREATE | DESTROY) | OPEN | CLOSE)? SEMI? (statement SEMI?)* END ON
;
event_forward_decl
: EVENT (identifier_name | CREATE | DESTROY) identifier_name? (LPAREN parameters_list_sub? RPAREN)?
| EVENT TYPE data_type_name identifier_name (LPAREN parameters_list_sub? RPAREN)
;
event_body
: EVENT (TYPE data_type_name)? (identifier_name COLONCOLON)? (identifier_name | OPEN | CLOSE) (LPAREN parameters_list_sub? RPAREN)? SEMI?
(statement SEMI?)* END EVENT
;
access_type
: PUBLIC
| PRIVATE
| PROTECTED
;
access_modif
: access_type ':'
;
access_modif_part
: PUBLIC
| PRIVATE
| PRIVATEREAD
| PRIVATEWRITE
| PROTECTED
| PROTECTEDREAD
| PROTECTEDWRITE
;
scope_modif
: GLOBAL
| LOCAL
;
expression
: close_call_sub
| value
| function_call_statement
| LCURLY expression (COMMA expression)* RCURLY
| expression (PLUS | MINUS | MULT | DIV | CARAT) expression
| LPAREN expression RPAREN
| boolean_expression
;
value
: string_literal (PLUS string_literal)*
| ENUM
| NUMBER
| TRUE
| FALSE
| DATE
| TIME
;
expression_list
: REF? expression (COMMA REF? expression)*
;
boolean_expression
: unary_sign_expr
| mul_expr
| add_expr
| condition_or
| LPAREN boolean_expression RPAREN
;
condition_or
: condition_and (OR condition_and)*
| LPAREN boolean_expression RPAREN
;
condition_and
: condition_not (AND condition_not)*
| LPAREN boolean_expression RPAREN
;
condition_not
: NOT? condition_comparison
| LPAREN boolean_expression RPAREN
;
condition_comparison
: add_expr ((EQ | GT | LT | GTLT | GTE | LTE) add_expr)?
| LPAREN boolean_expression RPAREN
;
add_expr
: mul_expr ((MINUS | PLUS) mul_expr)*
| LPAREN boolean_expression RPAREN
;
mul_expr
: unary_sign_expr ((MULT | DIV | CARAT) unary_sign_expr)*
| LPAREN boolean_expression RPAREN
;
unary_sign_expr
: ENUM
| (MINUS | PLUS)? (variable_name | bind_param | value)
| function_call_statement
| LCURLY function_call_statement RCURLY
| LPAREN unary_sign_expr RPAREN
| set_value
;
statement
: increment_decrement_statement
| public_statement
| if_simple_statement
| execute_statement
| throw_statement
| DESCRIBE identifier_name
| assignment_statement
| try_catch_statement
| close_sql_statement
| statement_sub
| if_statement
| post_event
| function_call_statement
| super_call_statement
| event_call_statement
| declare_procedure_statement
| constant_decl
| variable_decl
| super_call_statement
| do_loop_while_statement
| do_while_loop_statement
| create_call_statement
| destroy_call_statement
| label_stat
| throw_statement
| goto_statement
| choose_statement
| return_statement
| for_loop_statement
| continue_statement
| exit_statement
| sql_statement
| sql_commit_statement
| open_cursor_statement
| prepare_sql_stateent
| declare_cursor_statement
| close_cursor_statement
| fetch_into_statement
| call_statement
;
public_statement
: (PUBLIC | PROTECTED | PRIVATE) COLON
;
throw_statement : THROW expression;
goto_statement
: GOTO variable_name(statement SEMI?)* variable_name COLON (statement SEMI?)*
;
statement_sub
: function_virtual_call_expression_sub
| function_call_expression_sub
| return_statement
| open_call_sub
| close_call_sub
| variable_decl_sub
| super_call_statement
| create_call_sub
| destroy_call_sub
| continue_sub
| assignment_statement
;
try_catch_statement
: TRY
(statement SEMI?)*
(
CATCH LPAREN variable_decl_sub RPAREN
(statement SEMI?)*
)*
(
FINALLY
(statement SEMI?)*
)?
END TRY
;
sql_statement
: sql_insert_statement
| sql_delete_statement
| sql_select_statement
| sql_update_statement
| sql_connect_statement
;
sql_insert_statement
: INSERT INTO variable_name LPAREN variable_name (COMMA variable_name)* RPAREN VALUES LPAREN sql_values (COMMA sql_values)* RPAREN SEMI?
;
sql_values
: value
| bind_param
;
sql_delete_statement
: DELETE FROM variable_name where_clause SEMI?
;
sql_select_statement
: (SELECT | SELECTBLOB) select_clause INTO bind_param (COMMA bind_param)* FROM variable_name (COMMA variable_name)*
where_clause? (USING variable_name)? SEMI?
;
sql_update_statement
: (UPDATE | UPDATEBLOB) variable_name SET set_value (COMMA set_value)* where_clause?
;
sql_connect_statement
: (CONNECT | DISCONNECT | ROLLBACK) (USING (SQLCA | identifier_name))? SEMI
;
set_value
: variable_name EQ bind_param
| variable_name IS NOT? NULL_
;
where_clause
: WHERE set_value (COMMA set_value)*
| WHERE condition_or
;
select_clause
: variable_name (COMMA variable_name)*
| function_call_statement
;
sql_commit_statement
: COMMIT USING? (SQLCA | variable_name)? SEMI?
;
execute_statement
: EXECUTE IMMEDIATE? (variable_name | value) SEMI?
| EXECUTE IMMEDIATE? bind_param (USING (SQLCA | variable_name))? SEMI
| EXECUTE DYNAMIC? identifier (USING DESCRIPTOR? (SQLCA | identifier))? SEMI?
;
close_sql_statement
: CLOSE variable_name SEMI
;
declare_procedure_statement
: DECLARE variable_name DYNAMIC? PROCEDURE FOR variable_name SEMI?
;
declare_cursor_statement
: DECLARE variable_name DYNAMIC? CURSOR FOR variable_name SEMI
;
open_cursor_statement
: OPEN DYNAMIC? variable_name (USING (DESCRIPTOR | identifier))? identifier? SEMI?
;
close_cursor_statement
: CLOSE variable_name
;
fetch_into_statement
: FETCH variable_name INTO bind_param SEMI?
| FETCH identifier USING DESCRIPTOR? identifier SEMI?
;
prepare_sql_stateent
: PREPARE variable_name FROM bind_param USING (SQLCA | identifier_name) SEMI
;
increment_decrement_statement
: variable_name (PLUS PLUS | MINUS MINUS)
;
assignment_rhs
: value
| expression (COMMA expression)*
| function_call_statement
| describe_function_call
| create_call_statement
| super_call_statement
| event_call_statement
;
describe_function_call
: (identifier DOT)? DESCRIBE LPAREN expression_list? RPAREN
| DESCRIBE identifier INTO identifier
;
assignment_statement
: AT variable_name EQ bind_param SEMI
| (function_call_statement DOT)? variable_name (EQ | PLUSEQ | MINUSEQ | MULTEQ | DIVEQ) assignment_rhs SEMI?
;
variable_name
: identifier
;
return_statement
: RETURN (expression)?
;
function_call_expression_sub
: (variable_name DOT)* FUNCTION? POST? DYNAMIC? EVENT? function_name LPAREN expression_list? RPAREN (DOT (variable_name |
function_call_expression_sub))*
;
function_name
: POST
| OPEN
| CLOSE
| variable_name
| dataTypeSub
;
function_event_call
: function_name DOT EVENT? POST? DYNAMIC? function_call_expression_sub
;
function_virtual_call_expression_sub
: identifier DOT TRIGGER EVENT function_call_expression_sub
| identifier DOT (DYNAMIC EVENT? | EVENT TRIGGER? DYNAMIC) function_call_expression_sub
;
open_call_sub
: OPEN LPAREN expression_list RPAREN
;
close_call_sub
: CLOSE LPAREN expression_list RPAREN
| HALT CLOSE?
;
function_call_statement
: function_call_expression_sub
| ancestor_function_call
| describe_function_call
| ancestor_event_call_statement
| function_event_call
| function_virtual_call_expression_sub
| open_call_sub
| close_call_sub
;
ancestor_function_call
: COLONCOLON function_call_expression_sub
;
call_statement
: CALL variable_name (COLONCOLON (CREATE | DESTROY | OPEN | CLOSE | identifier))? SEMI?
;
super_call_statement
: CALL (identifier_name TICK)? (atom_sub_call1 | atom_sub_member1)
| CALL SUPER COLONCOLON (EVENT | CREATE | DESTROY | OPEN | CLOSE | identifier) function_call_statement?
| SUPER COLONCOLON (EVENT | FUNCTION)? POST? function_call_statement
;
ancestor_event_call_statement
: (identifier_name DOT)? identifier_name COLONCOLON (EVENT | FUNCTION)? (TRIGGER | POST)? function_call_statement
;
event_call_statement_sub
: (variable_name)? EVENT function_call_statement?
;
event_call_statement
: event_call_statement_sub
;
create_call_sub
: CREATE USING expression
| CREATE USING? (identifier_name DOT)? data_type_name (LPAREN expression_list? RPAREN)?
;
create_call_statement
: create_call_sub
;
destroy_call_sub
: DESTROY expression
;
destroy_call_statement
: destroy_call_sub
;
for_loop_statement
: FOR variable_name EQ expression TO expression (STEP expression)? statement* (NEXT | END FOR)
;
do_while_loop_statement
: DO (WHILE | UNTIL) boolean_expression (statement SEMI?)* LOOP
;
do_loop_while_statement
: DO statement* LOOP (WHILE | UNTIL) boolean_expression
;
if_statement
: IF boolean_expression THEN (statement SEMI?)* (elseif_statement)* (else_statement)?
END IF SEMI?
;
elseif_statement
: ELSEIF boolean_expression THEN (statement SEMI?)*
;
else_statement
: ELSE (statement SEMI?)*
;
if_simple_statement
: IF boolean_expression THEN statement (ELSE statement)? SEMI?
;
continue_statement
: CONTINUE
;
continue_sub
: CONTINUE
;
post_event
: (atom_sub_member1 DOT)? (POST | TRIGGER) EVENT? identifier_name_ex LPAREN expression_list? RPAREN
;
exit_statement
: EXIT
;
choose_statement
: CHOOSE CASE expression (choose_case_cond_sub
| choose_case_else_sub
| choose_case_value_sub)+
END CHOOSE
;
choose_case_value_sub
: CASE expression (TO expression)? (COMMA expression (TO expression)?)* (statement SEMI?)*
;
choose_case_cond_sub
: CASE IS (EQ | GT | LT | GTLT | GTE | LTE) expression (statement SEMI?)*
;
choose_case_else_sub
: CASE ELSE (statement SEMI?)*
;
label_stat
: identifier_name COLON
;
identifier
: identifier_name_ex (DOT identifier_name_ex)* (identifier_array)? (DOT identifier_name_ex (identifier_array)?)*
;
string_literal
: (DQUOTED_STRING | QUOTED_STRING) (PLUS (variable_name | DQUOTED_STRING | QUOTED_STRING))*
;
identifier_array
: LBRACE (identifier | value) (COMMA (identifier | value))* RBRACE
| LBRACE (identifier | function_call_statement)? ((operator)? NUMBER)? RBRACE
;
operator: PLUS | MINUS | MULT | DIV;
identifier_name_ex
: identifier_name
| SELECT
| TYPE
| UPDATE
| DELETE
| OPEN
| CLOSE
| GOTO
| INSERT
| TIME_TYPE
| READONLY
| SQLCA
| CREATE
| VALUES
| WINDOW
| SYSTEM
| DATE_TYPE
;
identifier_name
: (UNDERSCORE)? ID
;
bind_param
: COLON identifier
;
atom_sub
: array_access_atom
| identifier_name (LPAREN expression_list? RPAREN)?
;
atom_sub_call1
: (identifier | DESCRIBE) LPAREN expression_list? RPAREN
;
atom_sub_member1
: identifier
;
array_access_atom
: identifier_name LBRACE expression_list RBRACE
;
data_type_name
: dataTypeSub
| identifier_name
;
dataTypeSub
: ANY
| BLOB
| BOOLEAN
| BYTE
| CHARACTER
| CHAR
| DATE_TYPE
| DATETIME
| DECIMAL
| DEC
| DOUBLE
| INTEGER
| INT
| LONG
| LONGLONG
| REAL
| STRING
| TIME_TYPE
| UNSIGNEDINTEGER
| UINT
| UNSIGNEDLONG
| ULONG
| WINDOW
;
|
programs/oeis/288/A288713.asm | karttu/loda | 0 | 175242 | <reponame>karttu/loda<gh_stars>0
; A288713: Positions of 1 in A288711; complement of A288712.
; 1,7,13,17,23,29,33,39,43,49,55,59,65,71,75,81,85,91,97,101,107,111,117,123,127,133,139,143,149,153,159,165,169,175,181,185,191,195,201,207,211,217,221,227,233,237,243,249,253,259,263,269,275,279,285,289,295,301,305,311,317,321,327,331,337,343,347,353,359,363,369,373,379,385,389,395,399,405,411,415,421,427,431,437,441,447,453,457,463,469,473,479,483,489,495,499,505,509,515,521,525,531,537,541,547,551,557,563,567,573,577,583,589,593,599,605,609,615,619,625,631,635,641,647,651,657,661,667,673,677,683,687,693,699,703,709,715,719,725,729,735,741,745,751,755,761,767,771,777,783,787,793,797,803,809,813,819,825,829,835,839,845,851,855,861,865,871,877,881,887,893,897,903,907,913,919,923,929,935,939,945,949,955,961,965,971,975,981,987,991,997,1003,1007,1013,1017,1023,1029,1033,1039,1043,1049,1055,1059,1065,1071,1075,1081,1085,1091,1097,1101,1107,1113,1117,1123,1127,1133,1139,1143,1149,1153,1159,1165,1169,1175,1181,1185,1191,1195,1201,1207,1211,1217,1223,1227,1233,1237,1243,1249,1253,1259,1263,1269,1275,1279,1285,1291,1295,1301,1305
mov $1,$0
mov $2,$0
pow $2,2
mov $4,$0
lpb $2,1
sub $2,$1
add $1,2
trn $2,1
lpe
add $1,1
mov $3,$4
mul $3,3
add $1,$3
|
libsrc/stdio_new/fd/pollfd_callee.asm | meesokim/z88dk | 8 | 14989 | <filename>libsrc/stdio_new/fd/pollfd_callee.asm
; int __CALLEE__ pollfd_callee(int fd, char event)
; 06.2008 aralbrec
PUBLIC pollfd_callee
PUBLIC ASMDISP_POLLFD_CALLEE
EXTERN stdio_fdcommon1, l_jpix
EXTERN stdio_error_eacces_mc, stdio_error_ebadf_mc
INCLUDE "../stdio.def"
.pollfd_callee
pop hl
pop bc
ex (sp),hl
.asmentry
; enter : l = fd
; c = event
; exit : c = hl = revent, carry reset for success
; hl = -1, carry set for fail
call stdio_fdcommon1 ; ix = fdstruct *
jp c, stdio_error_ebadf_mc ; problem with fd
ld a,c ; poll always checks for errors
or $f0
ld c,a
ld a,STDIO_MSG_POLL
call l_jpix
jp c, stdio_error_eacces_mc
ld l,c
ld h,0
ret
defc ASMDISP_POLLFD_CALLEE = # asmentry - pollfd_callee
|
oeis/018/A018914.asm | neoneye/loda-programs | 11 | 177337 | <filename>oeis/018/A018914.asm<gh_stars>10-100
; A018914: Pisot sequence T(2,5), a(n) = floor(a(n-1)^2/a(n-2)).
; Submitted by <NAME>
; 2,5,12,28,65,150,346,798,1840,4242,9779,22543,51967,119796,276157,636604,1467515,3382951,7798460,17977197,41441465,95531857,220222323,507661769,1170274058,2697743762,6218903474,14335965099,33047609788,76182140871,175616894078,404836266518,933238248795,2151323142328,4959281586124,11432254581640,26353906820922,60751656619092,140046172548277,322837788085241,744213394192137,1715578524372566,3954792665997743,9116682686821142,21015995080292229,48446574745146905,111680203367485262,257447877168081639
mov $4,2
lpb $4
mov $1,3
sub $4,2
lpb $0
sub $0,1
add $2,1
add $3,$2
div $3,$2
mov $2,$1
mul $1,2
add $1,$3
sub $1,1
mul $3,$1
lpe
lpe
mov $0,$1
sub $0,1
|
src/keystore-passwords-input.adb | thierr26/ada-keystore | 0 | 9627 | -----------------------------------------------------------------------
-- keystore-passwords-input -- Interactive based password provider
-- Copyright (C) 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Ada.IO_Exceptions;
package body Keystore.Passwords.Input is
use Ada.Streams;
-- ------------------------------
-- Create a password provider that asks interactively for the password.
-- ------------------------------
function Create (Message : in String;
Confirm : in Boolean) return Provider_Access is
Content : Ada.Streams.Stream_Element_Array (1 .. MAX_PASSWORD_LENGTH);
C : Character;
Length : Ada.Streams.Stream_Element_Offset := 0;
begin
Ada.Text_IO.Put (Message);
begin
loop
Ada.Text_IO.Get_Immediate (C);
exit when C < ' ';
Length := Length + 1;
Content (Length) := Character'Pos (C);
end loop;
exception
when Ada.IO_Exceptions.End_Error =>
null;
end;
Ada.Text_IO.New_Line;
if Length = 0 then
raise Keystore.Bad_Password with "Empty password given";
end if;
return Create (Content (Content'First .. Length));
end Create;
end Keystore.Passwords.Input;
|
Groups/Cosets.agda | Smaug123/agdaproofs | 4 | 17438 | {-# OPTIONS --safe --warning=error --without-K #-}
open import Sets.EquivalenceRelations
open import Setoids.Setoids
open import Functions.Definition
open import Groups.Definition
open import Groups.Homomorphisms.Definition
open import Groups.Subgroups.Definition
open import Groups.Subgroups.Normal.Definition
module Groups.Cosets {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} (G : Group S _+_) {c : _} {pred : A → Set c} (subgrp : Subgroup G pred) where
open Equivalence (Setoid.eq S)
open import Groups.Lemmas G
open Group G
open Subgroup subgrp
cosetSetoid : Setoid A
Setoid._∼_ cosetSetoid g h = pred ((Group.inverse G h) + g)
Equivalence.reflexive (Setoid.eq cosetSetoid) = isSubset (symmetric (Group.invLeft G)) containsIdentity
Equivalence.symmetric (Setoid.eq cosetSetoid) yx = isSubset (transitive invContravariant (+WellDefined reflexive invInv)) (closedUnderInverse yx)
Equivalence.transitive (Setoid.eq cosetSetoid) yx zy = isSubset (transitive +Associative (+WellDefined (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invRight) identRight)) reflexive)) (closedUnderPlus zy yx)
cosetGroup : normalSubgroup G subgrp → Group cosetSetoid _+_
Group.+WellDefined (cosetGroup norm) {m} {n} {x} {y} m=x n=y = ans
where
t : pred (inverse y + n)
t = n=y
u : pred (inverse x + m)
u = m=x
v : pred (m + inverse x)
v = isSubset (+WellDefined reflexive (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invRight) identRight))) (norm u)
ans' : pred ((inverse y) + ((inverse x + m) + inverse (inverse y)))
ans' = norm u
ans'' : pred ((inverse y) + ((inverse x + m) + y))
ans'' = isSubset (+WellDefined reflexive (+WellDefined reflexive (invTwice y))) ans'
ans : pred (inverse (x + y) + (m + n))
ans = isSubset (transitive (transitive +Associative (transitive (+WellDefined (transitive (symmetric +Associative) (transitive (+WellDefined reflexive (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invRight) identRight))) +Associative)) reflexive) (symmetric +Associative))) (symmetric (+WellDefined invContravariant reflexive))) (closedUnderPlus ans'' t)
Group.0G (cosetGroup norm) = 0G
Group.inverse (cosetGroup norm) = inverse
Group.+Associative (cosetGroup norm) {a} {b} {c} = isSubset (symmetric (transitive (+WellDefined (inverseWellDefined (symmetric +Associative)) reflexive) (invLeft {a + (b + c)}))) containsIdentity
Group.identRight (cosetGroup norm) = isSubset (symmetric (transitive +Associative (transitive (+WellDefined invLeft reflexive) identRight))) containsIdentity
Group.identLeft (cosetGroup norm) = isSubset (symmetric (transitive (+WellDefined reflexive identLeft) invLeft)) containsIdentity
Group.invLeft (cosetGroup norm) = isSubset (symmetric (transitive (+WellDefined reflexive invLeft) invLeft)) containsIdentity
Group.invRight (cosetGroup norm) = isSubset (symmetric (transitive (+WellDefined reflexive invRight) invLeft)) containsIdentity
cosetGroupHom : (norm : normalSubgroup G subgrp) → GroupHom G (cosetGroup norm) id
GroupHom.groupHom (cosetGroupHom norm) = isSubset (symmetric (transitive (+WellDefined invContravariant reflexive) (transitive +Associative (transitive (+WellDefined (transitive (symmetric +Associative) (+WellDefined reflexive invLeft)) reflexive) (transitive (+WellDefined identRight reflexive) invLeft))))) (Subgroup.containsIdentity subgrp)
GroupHom.wellDefined (cosetGroupHom norm) {x} {y} x=y = isSubset (symmetric (transitive (+WellDefined reflexive x=y) invLeft)) (Subgroup.containsIdentity subgrp)
|
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sccz80/floor.asm | witchcraft2001/z88dk | 640 | 28659 | <filename>libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sccz80/floor.asm<gh_stars>100-1000
SECTION code_fp_math16
PUBLIC floorf16
EXTERN asm_f16_floor
defc floorf16 = asm_f16_floor
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _floorf16
EXTERN cm16_sdcc_floor
defc _floorf16 = cm16_sdcc_floor
ENDIF
|
oeis/090/A090001.asm | neoneye/loda-programs | 0 | 175453 | <gh_stars>0
; A090001: Length of longest contiguous block of 1's in binary expansion of n^2.
; Submitted by <NAME>(w4)
; 0,1,1,1,1,2,1,2,1,1,2,4,1,1,2,3,1,1,1,2,2,3,4,1,1,3,1,2,2,2,3,4,1,1,1,2,1,2,2,5,2,2,3,3,4,6,1,1,1,2,3,1,1,5,2,4,2,2,2,2,3,3,4,5,1,1,1,2,1,2,2,3,1,2,2,6,2,3,5,2,2,2,2,3,3,3,3,3,4,4,6,2,1,3,1,2,1,2,2,2
pow $0,2
mov $1,1
lpb $0
seq $0,213370 ; a(n) = n AND 2*n, where AND is the bitwise AND operator.
div $0,2
add $1,1
lpe
mov $0,$1
sub $0,1
|
hello_world.adb | charlesincharge/Intro_to_Ada | 0 | 28761 | -- Import necessary packages
with Ada.Text_IO;
-- Our main function is "Hello_World"
procedure Hello_World is
-- Declare local variables here
begin
-- Execute statements here.
-- Include the full package, like Python
Ada.Text_IO.Put_Line("Hello, world!");
end Hello_World;
-- Semicolon ends statements, like C
-- Ending with the name "Hello_World" is optional but good practice.
|
orka_plugin_terrain/src/orka-features-terrain.ads | onox/orka | 52 | 14941 | <reponame>onox/orka
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <<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.
-- Based on <NAME>'s C++ LEB demo [1]. GLSL shaders of LEB library
-- and shaders for rendering of terrain are licensed under the MIT license.
--
-- Contributions:
--
-- * Initialize LEB buffers in a compute shader instead of on the CPU
--
-- * Avoid C implementation of LEB library and reuse the LEB GLSL code
-- to create a static meshlet on the GPU when rendering the terrain
--
-- * Update and render multiple terrain tiles. Use heuristics to
-- determine on the CPU which tiles need to be updated and rendered.
--
-- * Support flattened spheroids with warping to reduce RMSE when
-- projecting cubes on spheres.
--
-- [1] https://github.com/jdupuy/LongestEdgeBisectionDemos
with GL.Objects.Textures;
with GL.Types;
with Orka.Cameras;
with Orka.Rendering.Buffers;
with Orka.Rendering.Programs.Modules;
with Orka.Resources.Locations;
with Orka.Timers;
private with GL.Low_Level.Enums;
private with GL.Objects.Samplers;
private with Orka.Rendering.Programs.Uniforms;
private with Orka.Types;
package Orka.Features.Terrain is
pragma Preelaborate;
type Subdivision_Depth is range 0 .. 29;
type Meshlet_Subdivision_Depth is range 0 .. 3;
type Length_Target is range 2 .. 32;
type LoD_Deviation is digits 4 range 0.0 .. 1.0;
type Height_Scale is digits 4 range 0.0 .. 1.0;
type Subdivision_Parameters is record
Meshlet_Subdivision : Meshlet_Subdivision_Depth;
Edge_Length_Target : Length_Target;
Min_LoD_Standard_Dev : LoD_Deviation;
end record;
subtype Spheroid_Parameters is GL.Types.Single_Array (1 .. 4);
type Visible_Tile_Array is array (Positive range <>) of Boolean;
-----------------------------------------------------------------------------
type Terrain (Count : Positive) is tagged limited private;
function Create_Terrain
(Count : Positive;
Min_Depth, Max_Depth : Subdivision_Depth;
Scale : Height_Scale;
Wireframe : Boolean;
Location : Resources.Locations.Location_Ptr;
Render_Modules : Rendering.Programs.Modules.Module_Array;
Initialize_Render : access procedure
(Program : Rendering.Programs.Program)) return Terrain
with Pre => Min_Depth <= Max_Depth and Max_Depth >= 5;
-- Create and return a Terrain object that can generate
-- one or more terrain tiles
--
-- If Wireframe is True, then optionally a wireframe can be displayed
-- when rendering the terrain. In production, this parameter should
-- be set to False to avoid invoking a geometry shader.
--
-- One of the shaders in the module array must contain the following
-- function:
--
-- vec4 ShadeFragment(vec2 texCoord, vec4 worldPos);
procedure Render
(Object : in out Terrain;
Transforms, Spheres : Rendering.Buffers.Bindable_Buffer'Class;
Center : Cameras.Transforms.Matrix4;
Camera : Cameras.Camera_Ptr;
Parameters : Subdivision_Parameters;
Visible_Tiles : Visible_Tile_Array;
Update_Render : access procedure (Program : Rendering.Programs.Program);
Height_Map : GL.Objects.Textures.Texture;
Freeze, Wires : Boolean;
Timer_Update, Timer_Render : in out Orka.Timers.Timer)
with Pre => Transforms.Length = Object.Count
and Spheres.Length in Spheroid_Parameters'Length | Spheroid_Parameters'Length * Object.Count
and Visible_Tiles'Length = Object.Count;
-- Generate and render the terrain tiles
--
-- Buffer Transforms should contain matrices which transform the
-- terrain tiles.
--
-- Buffer Spheres should contain n spheroid parameters (each containing
-- 4 singles) for n terrain tiles if the sphere is flattened or 1 spheroid
-- parameters if all the tiles are part of a non-flattened sphere.
--
-- Center should contain a translation from the camera to the center
-- of the sphere. It should be scaled if the semi-major axis in the
-- spheroid parameters in Spheres is scaled.
--
-- If Freeze is True, then the generated terrain will not be
-- modified.
--
-- If Wires is True and if parameter Wireframe of function Create_Terrain
-- was True, then a wireframe will be displayed. If Wireframe was False,
-- then Wires has no effect.
function Get_Spheroid_Parameters
(Semi_Major_Axis : GL.Types.Single;
Flattening : GL.Types.Single := 0.0;
Side : Boolean := True) return Spheroid_Parameters;
-- Return the spheroid parameters needed to project a flat
-- terrain tile on a (non-)flattened sphere.
--
-- The returned spheroid parameters should be put in a buffer that
-- is given to the procedure Render above.
--
-- If the terrain tiles are part of a non-flattened sphere, then
-- this function can be called once with Flattening = 0.0.
--
-- If the sphere is flattened, this function needs to be called twice.
-- The returned spheroid parameters must be repeated 4 times for the
-- tiles on the side and 2 times for the top and bottom tiles.
--
-- If the semi-major axis is scaled, then the translation in Center
-- in the procedure Render should be scaled as well.
private
package LE renames GL.Low_Level.Enums;
type UInt_Buffer_Array is array (Positive range <>) of
Rendering.Buffers.Buffer (Types.UInt_Type);
type Terrain (Count : Positive) is tagged limited record
Max_Depth : Subdivision_Depth;
Scale : Height_Scale;
Split_Update : Boolean;
Wireframe : Boolean;
-- Update and reduction of LEB
Program_Leb_Update : Rendering.Programs.Program;
Program_Leb_Prepass : Rendering.Programs.Program;
Program_Leb_Reduction : Rendering.Programs.Program;
-- Prepare indirect commands and render geometry
Program_Indirect : Rendering.Programs.Program;
Program_Render : Rendering.Programs.Program;
Uniform_Update_Split : Rendering.Programs.Uniforms.Uniform (LE.Bool_Type);
Uniform_Update_Freeze : Rendering.Programs.Uniforms.Uniform (LE.Bool_Type);
Uniform_Update_LoD_Var : Rendering.Programs.Uniforms.Uniform (LE.Single_Type);
Uniform_Update_LoD_Factor : Rendering.Programs.Uniforms.Uniform (LE.Single_Type);
Uniform_Update_DMap_Factor : Rendering.Programs.Uniforms.Uniform (LE.Single_Type);
Uniform_Render_DMap_Factor : Rendering.Programs.Uniforms.Uniform (LE.Single_Type);
Uniform_Update_Leb_ID : Rendering.Programs.Uniforms.Uniform (LE.Int_Type);
Uniform_Indirect_Leb_ID : Rendering.Programs.Uniforms.Uniform (LE.Int_Type);
Uniform_Render_Leb_ID : Rendering.Programs.Uniforms.Uniform (LE.Int_Type);
Uniform_Prepass_Pass_ID : Rendering.Programs.Uniforms.Uniform (LE.Int_Type);
Uniform_Reduction_Pass_ID : Rendering.Programs.Uniforms.Uniform (LE.Int_Type);
Uniform_Indirect_Subdiv : Rendering.Programs.Uniforms.Uniform (LE.Int_Type);
Uniform_Render_Subdiv : Rendering.Programs.Uniforms.Uniform (LE.Int_Type);
-- Sampler for height and slope maps
Sampler : GL.Objects.Samplers.Sampler;
-- SSBO
Buffer_Draw : Rendering.Buffers.Buffer (Types.Arrays_Command_Type);
Buffer_Dispatch : Rendering.Buffers.Buffer (Types.Dispatch_Command_Type);
Buffer_Leb : UInt_Buffer_Array (1 .. Count);
Buffer_Leb_Nodes : UInt_Buffer_Array (1 .. Count);
Buffer_Leb_Node_Counter : Rendering.Buffers.Buffer (Types.UInt_Type);
-- UBO
Buffer_Matrices : Rendering.Buffers.Buffer (Types.Single_Matrix_Type);
end record;
end Orka.Features.Terrain;
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cd/cd5003c.ada | best08618/asylo | 7 | 14024 | -- CD5003C.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 A 'WITH' CLAUSE NAMING 'SYSTEM' NEED NOT BE GIVEN
-- FOR A PACKAGE BODY SUBUNIT CONTAINING AN ADDRESS CLAUSE AS
-- LONG AS A 'WITH' CLAUSE IS GIVEN FOR THE UNIT CONTAINING THE
-- PACKAGE SPECIFICATION.
-- HISTORY:
-- VCL 09/04/87 CREATED ORIGINAL TEST.
-- PWB 05/12/89 CHANGED TO ".ADA" TEST.
WITH SYSTEM;
WITH REPORT; USE REPORT;
PRAGMA ELABORATE (REPORT);
PROCEDURE CD5003C IS
PACKAGE CD5003C_PACK2 IS END CD5003C_PACK2;
PACKAGE BODY CD5003C_PACK2 IS SEPARATE;
USE CD5003C_PACK2;
BEGIN
RESULT;
END CD5003C;
WITH SPPRT13;
WITH REPORT; USE REPORT;
PRAGMA ELABORATE (SPPRT13);
PRAGMA ELABORATE (REPORT);
SEPARATE (CD5003C)
PACKAGE BODY CD5003C_PACK2 IS
TYPE ATYPE IS ARRAY (1 .. 10) OF INTEGER;
TEST_VAR : ATYPE := (OTHERS => 0);
FOR TEST_VAR USE AT SPPRT13.VARIABLE_ADDRESS;
USE SYSTEM;
FUNCTION IDENT (P : ATYPE) RETURN ATYPE IS
BEGIN
IF EQUAL (3, 3) THEN
RETURN P;
ELSE
RETURN (OTHERS => 0);
END IF;
END IDENT;
BEGIN
TEST ("CD5003C", "A 'WITH' CLAUSE NAMING 'SYSTEM' NEED NOT " &
"BE GIVEN FOR A PACKAGE BODY SUBUNIT " &
"CONTAINING AN ADDRESS CLAUSE AS LONG AS A " &
"'WITH' CLAUSE IS GIVEN FOR THE UNIT " &
"CONTAINING THE PACKAGE SPECIFICATION");
TEST_VAR := IDENT (ATYPE'(OTHERS => 3));
IF TEST_VAR /= ATYPE'(OTHERS => 3) THEN
FAILED ("INCORRECT VALUE FOR TEST_VAR");
END IF;
IF TEST_VAR'ADDRESS /= SPPRT13.VARIABLE_ADDRESS THEN
FAILED ("INCORRECT ADDRESS FOR TEST_VAR");
END IF;
END CD5003C_PACK2;
|
src/main/fragment/mos6502-common/vwum1_lt_vbuyy_then_la1.asm | jbrandwood/kickc | 2 | 13723 | lda {m1}+1
bne !+
sty $ff
lda {m1}
cmp $ff
bcc {la1}
!:
|
programs/oeis/016/A016757.asm | karttu/loda | 1 | 101311 | ; A016757: a(n) = (2*n+1)^5.
; 1,243,3125,16807,59049,161051,371293,759375,1419857,2476099,4084101,6436343,9765625,14348907,20511149,28629151,39135393,52521875,69343957,90224199,115856201,147008443,184528125,229345007,282475249,345025251,418195493,503284375,601692057,714924299,844596301,992436543,1160290625,1350125107,1564031349,1804229351,2073071593,2373046875,2706784157,3077056399,3486784401,3939040643,4437053125,4984209207,5584059449,6240321451,6956883693,7737809375,8587340257,9509900499,10510100501,11592740743,12762815625,14025517307,15386239549,16850581551,18424351793,20113571875,21924480357,23863536599,25937424601,28153056843,30517578125,33038369407,35723051649,38579489651,41615795893,44840334375,48261724457,51888844699,55730836701,59797108943,64097340625,68641485507,73439775749,78502725751,83841135993,89466096875,95388992557,101621504799,108175616801,115063617043,122298103125,129891985607,137858491849,146211169851,154963892093,164130859375,173726604657,183765996899,194264244901,205236901143,216699865625,228669389707,241162079949,254194901951,267785184193,281950621875,296709280757,312079600999,328080401001,344730881243,362050628125,380059617807,398778220049,418227202051,438427732293,459401384375,481170140857,503756397099,527182965101,551473077343,576650390625,602738989907,629763392149,657748550151,686719856393,716703146875,747724704957,779811265199,812990017201,847288609443,882735153125,919358226007,957186876249,996250626251,1036579476493,1078203909375,1121154893057,1165463885299,1211162837301,1258284197543,1306860915625,1356926446107,1408514752349,1461660310351,1516398112593,1572763671875,1630793025157,1690522737399,1751989905401,1815232161643,1880287678125,1947195170207,2015993900449,2086723682451,2159424884693,2234138434375,2310905821257,2389769101499,2470770901501,2553954421743,2639363440625,2727042318307,2817036000549,2909390022551,3004150512793,3101364196875,3201078401357,3303341057599,3408200705601,3515706497843,3625908203125,3738856210407,3854601532649,3973195810651,4094691316893,4219140959375,4346598285457,4477117485699,4610753397701,4747561509943,4887597965625,5030919566507,5177583776749,5327648726751,5481173216993,5638216721875,5798839393557,5963102065799,6131066257801,6302794178043,6478348728125,6657793506607,6841192812849,7028611650851,7220115733093,7415771484375,7615646045657,7819807277899,8028323765901,8241264822143,8458700490625,8680701550707,8907339520949,9138686662951,9374815985193,9615801246875,9861716961757,10112638401999,10368641602001,10629803362243,10896201253125,11167913618807,11445019581049,11727599043051,12015732693293,12309502009375,12608989261857,12914277518099,13225450646101,13542593318343,13865791015625,14195130030907,14530697473149,14872581271151,15220870177393,15575653771875,15937022465957,16305067506199,16679880978201,17061555810443,17450185778125,17845865507007,18248690477249,18658757027251,19076162357493,19501004534375,19933382494057,20373396046299,20821145878301,21276733558543,21740261540625,22211833167107,22691552673349,23179525191351,23675856753593,24180654296875,24694025666157,25216079618399,25746925826401,26286674882643,26835438303125,27393328531207,27960458941449,28536943843451,29122898485693,29718439059375,30323682702257,30938747502499
mul $0,2
mov $1,1
add $1,$0
pow $1,5
|
firmware/coreboot/3rdparty/libgfxinit/common/hw-gfx-gma-i2c.adb | fabiojna02/OpenCellular | 1 | 29168 | <reponame>fabiojna02/OpenCellular<filename>firmware/coreboot/3rdparty/libgfxinit/common/hw-gfx-gma-i2c.adb
--
-- Copyright (C) 2015 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
with HW.Time;
with HW.Debug;
with GNAT.Source_Info;
with HW.GFX.GMA.Config;
with HW.GFX.GMA.Registers;
use type HW.Word8;
package body HW.GFX.GMA.I2C is
PCH_DSPCLK_GATE_D_GMBUS_UNIT_LVL : constant := 1 * 2 ** 31;
GMBUS0_GMBUS_RATE_SELECT_MASK : constant := 7 * 2 ** 8;
GMBUS0_GMBUS_RATE_SELECT_100KHZ : constant := 0 * 2 ** 8;
GMBUS0_GMBUS_RATE_SELECT_50KHZ : constant := 1 * 2 ** 8;
GMBUS0_PIN_PAIR_SELECT_MASK : constant := 7 * 2 ** 0;
GMBUS0_PIN_PAIR_SELECT_NONE : constant := 0 * 2 ** 0;
GMBUS0_PIN_PAIR_SELECT_DAC : constant := 2 * 2 ** 0;
GMBUS0_PIN_PAIR_SELECT_LVDS : constant := 3 * 2 ** 0;
-- Order is C, B, D: no typo!
GMBUS0_PIN_PAIR_SELECT_DIGI_C : constant := 4 * 2 ** 0;
GMBUS0_PIN_PAIR_SELECT_DIGI_B : constant := 5 * 2 ** 0;
GMBUS0_PIN_PAIR_SELECT_DIGI_D : constant := 6 * 2 ** 0;
-- Broxton uses different pins
GMBUS0_PIN_PAIR_SELECT_BXT_B : constant := 1 * 2 ** 0;
GMBUS0_PIN_PAIR_SELECT_BXT_C : constant := 2 * 2 ** 0;
GMBUS1_SOFTWARE_CLEAR_INTERRUPT : constant := 1 * 2 ** 31;
GMBUS1_SOFTWARE_READY : constant := 1 * 2 ** 30;
GMBUS1_ENABLE_TIMEOUT : constant := 1 * 2 ** 29;
GMBUS1_BUS_CYCLE_SELECT_MASK : constant := 7 * 2 ** 25;
GMBUS1_BUS_CYCLE_STOP : constant := 1 * 2 ** 27;
GMBUS1_BUS_CYCLE_INDEX : constant := 1 * 2 ** 26;
GMBUS1_BUS_CYCLE_WAIT : constant := 1 * 2 ** 25;
GMBUS1_TOTAL_BYTE_COUNT_MASK : constant := 511 * 2 ** 16;
GMBUS1_TOTAL_BYTE_COUNT_SHIFT : constant := 16;
GMBUS1_8BIT_SLAVE_INDEX_MASK : constant := 255 * 2 ** 8;
GMBUS1_8BIT_SLAVE_INDEX_SHIFT : constant := 8;
GMBUS1_SLAVE_ADDRESS_MASK : constant := 127 * 2 ** 1;
GMBUS1_SLAVE_ADDRESS_SHIFT : constant := 1;
GMBUS1_DIRECTION_MASK : constant := 1 * 2 ** 0;
GMBUS1_DIRECTION_WRITE : constant := 0 * 2 ** 0;
GMBUS1_DIRECTION_READ : constant := 1 * 2 ** 0;
GMBUS2_INUSE : constant := 1 * 2 ** 15;
GMBUS2_HARDWARE_WAIT_PHASE : constant := 1 * 2 ** 14;
GMBUS2_SLAVE_STALL_TIMEOUT_ERROR : constant := 1 * 2 ** 13;
GMBUS2_GMBUS_INTERRUPT_STATUS : constant := 1 * 2 ** 12;
GMBUS2_HARDWARE_READY : constant := 1 * 2 ** 11;
GMBUS2_NAK_INDICATOR : constant := 1 * 2 ** 10;
GMBUS2_GMBUS_ACTIVE : constant := 1 * 2 ** 9;
GMBUS2_CURRENT_BYTE_COUNT_MASK : constant := 511 * 2 ** 0;
GMBUS4_INTERRUPT_MASK : constant := 31 * 2 ** 0;
GMBUS5_2BYTE_INDEX_ENABLE : constant := 1 * 2 ** 31;
GMBUS_Regs : constant array (0 .. 5) of Registers.Registers_Index :=
(if Config.Has_PCH_GMBUS then
(0 => Registers.PCH_GMBUS0,
1 => Registers.PCH_GMBUS1,
2 => Registers.PCH_GMBUS2,
3 => Registers.PCH_GMBUS3,
4 => Registers.PCH_GMBUS4,
5 => Registers.PCH_GMBUS5)
else
(0 => Registers.GMCH_GMBUS0,
1 => Registers.GMCH_GMBUS1,
2 => Registers.GMCH_GMBUS2,
3 => Registers.GMCH_GMBUS3,
4 => Registers.GMCH_GMBUS4,
5 => Registers.GMCH_GMBUS5));
function GMBUS1_TOTAL_BYTE_COUNT
(Count : HW.GFX.I2C.Transfer_Length)
return Word32 is
begin
return Shift_Left (Word32 (Count), GMBUS1_TOTAL_BYTE_COUNT_SHIFT);
end GMBUS1_TOTAL_BYTE_COUNT;
function GMBUS1_SLAVE_ADDRESS
(Address : HW.GFX.I2C.Transfer_Address)
return Word32 is
begin
return Shift_Left (Word32 (Address), GMBUS1_SLAVE_ADDRESS_SHIFT);
end GMBUS1_SLAVE_ADDRESS;
function GMBUS0_PIN_PAIR_SELECT (Port : PCH_Port) return Word32 is
begin
return
(if Config.GMBUS_Alternative_Pins then
(case Port is
when PCH_HDMI_B => GMBUS0_PIN_PAIR_SELECT_BXT_B,
when PCH_HDMI_C => GMBUS0_PIN_PAIR_SELECT_BXT_C,
when others => GMBUS0_PIN_PAIR_SELECT_NONE)
else
(case Port is
when PCH_DAC => GMBUS0_PIN_PAIR_SELECT_DAC,
when PCH_LVDS => GMBUS0_PIN_PAIR_SELECT_LVDS,
when PCH_HDMI_B => GMBUS0_PIN_PAIR_SELECT_DIGI_B,
when PCH_HDMI_C => GMBUS0_PIN_PAIR_SELECT_DIGI_C,
when PCH_HDMI_D => GMBUS0_PIN_PAIR_SELECT_DIGI_D,
when others => GMBUS0_PIN_PAIR_SELECT_NONE));
end GMBUS0_PIN_PAIR_SELECT;
----------------------------------------------------------------------------
procedure GMBUS_Ready (Result : out Boolean)
is
GMBUS2 : Word32;
begin
Registers.Read (GMBUS_Regs (2), GMBUS2);
Result := (GMBUS2 and (GMBUS2_HARDWARE_WAIT_PHASE or
GMBUS2_SLAVE_STALL_TIMEOUT_ERROR or
GMBUS2_GMBUS_INTERRUPT_STATUS or
GMBUS2_NAK_INDICATOR)) = 0;
end GMBUS_Ready;
procedure Reset_GMBUS (Success : out Boolean) is
begin
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
Registers.Write (GMBUS_Regs (1), GMBUS1_SOFTWARE_CLEAR_INTERRUPT);
Registers.Write (GMBUS_Regs (1), 0);
Registers.Write (GMBUS_Regs (0), GMBUS0_PIN_PAIR_SELECT_NONE);
GMBUS_Ready (Success);
end Reset_GMBUS;
procedure Init_GMBUS (Port : PCH_Port; Success : out Boolean) is
begin
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
if Config.Ungate_GMBUS_Unit_Level then
Registers.Set_Mask
(Register => Registers.PCH_DSPCLK_GATE_D,
Mask => PCH_DSPCLK_GATE_D_GMBUS_UNIT_LVL);
end if;
-- TODO: Refactor + check for timeout.
Registers.Wait_Unset_Mask (GMBUS_Regs (2), GMBUS2_INUSE);
GMBUS_Ready (Success);
if not Success then
Reset_GMBUS (Success);
end if;
if Success then
Registers.Write
(Register => GMBUS_Regs (0),
Value => GMBUS0_GMBUS_RATE_SELECT_100KHZ or
GMBUS0_PIN_PAIR_SELECT (Port));
Registers.Write
(Register => GMBUS_Regs (4),
Value => 0);
Registers.Write
(Register => GMBUS_Regs (5),
Value => 0);
end if;
end Init_GMBUS;
procedure Release_GMBUS
is
begin
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
Registers.Write (GMBUS_Regs (0), GMBUS0_PIN_PAIR_SELECT_NONE);
-- Clear INUSE. TODO: Don't do it, if timeout occured (see above).
Registers.Write (GMBUS_Regs (2), GMBUS2_INUSE);
if Config.Ungate_GMBUS_Unit_Level then
Registers.Unset_Mask
(Register => Registers.PCH_DSPCLK_GATE_D,
Mask => PCH_DSPCLK_GATE_D_GMBUS_UNIT_LVL);
end if;
end Release_GMBUS;
procedure I2C_Read
(Port : in PCH_Port;
Address : in HW.GFX.I2C.Transfer_Address;
Length : in out HW.GFX.I2C.Transfer_Length;
Data : out HW.GFX.I2C.Transfer_Data;
Success : out Boolean)
is
GMBUS2,
GMBUS3 : Word32;
Current : HW.GFX.I2C.Transfer_Length;
Transfered : HW.GFX.I2C.Transfer_Length := 0;
begin
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
Data := (others => 0);
Init_GMBUS (Port, Success);
if Success then
Registers.Write
(Register => GMBUS_Regs (1),
Value => GMBUS1_SOFTWARE_READY or
GMBUS1_BUS_CYCLE_INDEX or
GMBUS1_BUS_CYCLE_WAIT or
GMBUS1_TOTAL_BYTE_COUNT (Length) or
GMBUS1_SLAVE_ADDRESS (Address) or
GMBUS1_DIRECTION_READ);
while Success and then Transfered < Length loop
Registers.Wait_Set_Mask
(Register => GMBUS_Regs (2),
Mask => GMBUS2_HARDWARE_READY,
TOut_MS => 55);
Registers.Read (GMBUS_Regs (2), GMBUS2);
Success := (GMBUS2 and GMBUS2_HARDWARE_READY) /= 0 and
(GMBUS2 and GMBUS2_NAK_INDICATOR) = 0;
if Success then
Current := GFX.I2C.Transfer_Length'Min (Length, Transfered + 4);
Registers.Read (GMBUS_Regs (3), GMBUS3);
for I in Transfered .. Current - 1 loop
Data (I) := Byte (GMBUS3 and 16#ff#);
GMBUS3 := Shift_Right (GMBUS3, 8);
end loop;
Transfered := Current;
end if;
end loop;
if Success then
Registers.Wait_Set_Mask
(Register => GMBUS_Regs (2),
Mask => GMBUS2_HARDWARE_WAIT_PHASE);
Registers.Write
(Register => GMBUS_Regs (1),
Value => GMBUS1_SOFTWARE_READY or GMBUS1_BUS_CYCLE_STOP);
Registers.Wait_Unset_Mask
(Register => GMBUS_Regs (2),
Mask => GMBUS2_GMBUS_ACTIVE);
end if;
end if;
Length := Transfered;
Release_GMBUS;
end I2C_Read;
end HW.GFX.GMA.I2C;
|
3-mid/opengl/source/lean/geometry/opengl-geometry-colored.adb | charlie5/lace-alire | 1 | 22472 | with
openGL.Shader,
openGL.Program,
openGL.Buffer.general,
openGL.Tasks,
openGL.Attribute,
openGL.Errors,
GL.lean,
GL.Pointers,
Interfaces.C.Strings,
System.storage_Elements;
package body openGL.Geometry.colored
is
use GL.lean, GL.Pointers;
use Interfaces;
-----------
-- Globals
--
vertex_Shader : aliased Shader.item;
fragment_Shader : aliased Shader.item;
the_Program : openGL.Program.view;
Name_1 : constant String := "Site";
Name_2 : constant String := "Color";
Attribute_1_Name : aliased C.char_array := C.to_C (Name_1);
Attribute_2_Name : aliased C.char_array := C.to_C (Name_2);
Attribute_1_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_1_Name'Access);
Attribute_2_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_2_Name'Access);
---------
-- Forge
--
function new_Geometry return Geometry.colored.view
is
use System.storage_Elements;
use type openGL.Program.view;
Self : constant Geometry.colored.view := new Geometry.colored.item;
begin
Tasks.check;
if the_Program = null
then -- Define the shaders and program.
declare
use openGL.Attribute.Forge;
sample_Vertex : Vertex;
Attribute_1 : Attribute.view;
Attribute_2 : Attribute.view;
begin
vertex_Shader .define (Shader.Vertex, "assets/opengl/shader/colored.vert");
fragment_Shader.define (Shader.Fragment, "assets/opengl/shader/colored.frag");
the_Program := new openGL.Program.item;
the_Program.define (vertex_Shader 'Access,
fragment_Shader'Access);
Attribute_1 := new_Attribute (Name => Name_1,
gl_Location => the_Program.attribute_Location (Name_1),
Size => 3,
data_Kind => Attribute.GL_FLOAT,
Stride => colored.Vertex'Size / 8,
Offset => 0,
Normalized => False);
Attribute_2 := new_Attribute (Name => Name_2,
gl_Location => the_Program.attribute_Location (Name_2),
Size => 4,
data_Kind => Attribute.GL_UNSIGNED_BYTE,
Stride => colored.Vertex'Size / 8,
Offset => sample_Vertex.Color.primary.Red'Address
- sample_Vertex.Site (1) 'Address,
Normalized => True);
the_Program.add (Attribute_1);
the_Program.add (Attribute_2);
glBindAttribLocation (Program => the_Program.gl_Program,
Index => the_Program.Attribute (named => Name_1).gl_Location,
Name => +Attribute_1_Name_ptr);
Errors.log;
glBindAttribLocation (Program => the_Program.gl_Program,
Index => the_Program.Attribute (named => Name_2).gl_Location,
Name => +Attribute_2_Name_ptr);
Errors.log;
end;
end if;
Self.Program_is (the_Program);
return Self;
end new_Geometry;
------------
-- Vertices
--
function is_Transparent (Self : in Vertex_array) return Boolean
is
function get_Color (Index : in Index_t) return rgba_Color
is (Self (Index).Color);
function my_Transparency is new get_Transparency (any_Index_t => Index_t,
get_Color => get_Color);
begin
return my_Transparency (Count => Self'Length);
end is_Transparent;
--------------
-- Attributes
--
package openGL_Buffer_of_geometry_Vertices is new Buffer.general (base_Object => Buffer.array_Object,
Index => Index_t,
Element => Vertex,
Element_Array => Vertex_array);
procedure Vertices_are (Self : in out Item; Now : in Vertex_array)
is
use openGL.Buffer,
openGL_Buffer_of_geometry_Vertices.Forge;
begin
free (Self.Vertices);
Self.Vertices := new openGL_Buffer_of_geometry_Vertices.Object' (to_Buffer (Now,
usage => Buffer.static_Draw));
Self.is_Transparent := is_Transparent (Now);
-- Set the bounds.
--
declare
function get_Site (Index : in Index_t) return Vector_3
is (Now (Index).Site);
function bounding_Box is new get_Bounds (Index_t, get_Site);
begin
Self.Bounds_are (bounding_Box (Count => Now'Length));
end;
end Vertices_are;
end openGL.Geometry.colored;
|
bbs.ads | BrentSeidel/BBS-Ada | 1 | 30644 | --
-- Author: <NAME>
-- Version: V01.01
-- Date: 27-Apr-2021
--
-- This package defines a number of types for physical units. These are
-- generally based off of the Float type since in most cases, 6 digits is
-- pretty good for a physical measurement. If you need more precision, go
-- ahead and change it to whatever you need.
--
-- Conversion routines are provided to convert between different units. Due to
-- the number of different units, conversion between two may not be directly
-- possible, but should be possible through intermediate units. The ones present
-- are the ones that I use most. More will probably be added in the future. For
-- each type of measurement, there is a base unit. Conversions to and from this
-- unit to other units are provided.
--
-- While addition and subtraction of units generally provides a meaningful result,
-- multiplication and division may not. For example meters*meters should provide
-- a result in meters^2. In some cases (ones that I use) multiplication and
-- division will be provided. Most of these routines are trivial and can be
-- added as needed.
--
-- Ada provides Ada.Calendar to cover time related items. Therefor, there is
-- not much time support here.
--
-- The naming convention of the units is a prefix indicating what kind of unit,
-- an underscore, and the the S.I. code for the unit (if applicable) or a common
-- abbreviation (eg. vel_mph for velocity in mile per hour). Since "/" is not
-- valid in indentifiers, it will be replaced by an underscore (eg vel_m_s) for
-- velocity in meters per second. Exponentiation is indicated by a number (eg
-- accel_m_s2).
--
-- License:
-- This is free and unencumbered software released into the public domain.
--
-- Anyone is free to copy, modify, publish, use, compile, sell, or
-- distribute this software, either in source code form or as a compiled
-- binary, for any purpose, commercial or non-commercial, and by any
-- means.
--
-- In jurisdictions that recognize copyright laws, the author or authors
-- of this software dedicate any and all copyright interest in the
-- software to the public domain. We make this dedication for the benefit
-- of the public at large and to the detriment of our heirs and
-- successors. We intend this dedication to be an overt act of
-- relinquishment in perpetuity of all present and future rights to this
-- software under copyright law.
--
-- 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 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.
--
-- For more information, please refer to <http://unlicense.org>
--
package BBS with SPARK_Mode => on is
pragma Pure;
pragma No_Elaboration_Code_All;
--
-- Empty package just so that everything that I make is in the BBS namespace.
--
-- This is really trivial so I don't care if anyone copies this. If you do
-- though, you should at least change it to your name and initials.
--
end BBS;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_2689_2447.asm | ljhsiun2/medusa | 9 | 11143 | <filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_2689_2447.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x845, %r14
nop
nop
nop
nop
nop
cmp %rsi, %rsi
movb $0x61, (%r14)
nop
nop
cmp %rax, %rax
lea addresses_UC_ht+0x9445, %rsi
lea addresses_A_ht+0x1b505, %rdi
nop
nop
nop
dec %r10
mov $83, %rcx
rep movsb
sub %rax, %rax
lea addresses_D_ht+0x6045, %rdi
nop
nop
nop
add %rsi, %rsi
mov (%rdi), %cx
add $35732, %rdi
lea addresses_D_ht+0x5445, %rax
nop
nop
inc %r8
movups (%rax), %xmm7
vpextrq $1, %xmm7, %r14
nop
nop
nop
nop
nop
and %r14, %r14
lea addresses_normal_ht+0x10445, %rax
nop
nop
nop
nop
sub $24931, %r10
movl $0x61626364, (%rax)
nop
nop
nop
nop
and $6953, %r14
lea addresses_normal_ht+0x5c45, %rsi
lea addresses_UC_ht+0xabc5, %rdi
nop
nop
nop
nop
nop
add %rbp, %rbp
mov $74, %rcx
rep movsb
nop
and $25046, %rsi
lea addresses_A_ht+0x4d25, %rsi
lea addresses_A_ht+0x10cc5, %rdi
sub %r8, %r8
mov $92, %rcx
rep movsl
sub $1298, %rbp
lea addresses_normal_ht+0x136d, %rsi
lea addresses_normal_ht+0x7d61, %rdi
sub $52410, %r14
mov $42, %rcx
rep movsb
nop
add $28025, %rsi
lea addresses_WT_ht+0x18445, %rsi
lea addresses_WT_ht+0xa22e, %rdi
nop
nop
nop
xor %r14, %r14
mov $86, %rcx
rep movsq
nop
nop
nop
cmp $61984, %rcx
lea addresses_normal_ht+0xef86, %rsi
lea addresses_WT_ht+0x1b185, %rdi
nop
nop
nop
nop
xor %r14, %r14
mov $98, %rcx
rep movsw
nop
nop
nop
nop
and %rbp, %rbp
lea addresses_normal_ht+0x6005, %rsi
nop
nop
nop
cmp $32500, %rcx
movb (%rsi), %r8b
nop
xor $51139, %rcx
lea addresses_A_ht+0x11c11, %rsi
nop
cmp %rax, %rax
movl $0x61626364, (%rsi)
nop
nop
nop
nop
nop
add $47699, %r10
lea addresses_UC_ht+0x1ac85, %rsi
lea addresses_normal_ht+0xb5c5, %rdi
nop
add $59184, %r8
mov $114, %rcx
rep movsb
nop
nop
inc %rax
lea addresses_WC_ht+0x5df6, %r10
nop
nop
add %rdi, %rdi
mov (%r10), %eax
nop
nop
nop
and %r8, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %rbp
push %rbx
push %rcx
// Store
lea addresses_UC+0xf445, %rcx
nop
nop
nop
nop
nop
xor %r11, %r11
mov $0x5152535455565758, %rbp
movq %rbp, %xmm6
movaps %xmm6, (%rcx)
nop
nop
nop
nop
dec %rbx
// Faulty Load
lea addresses_PSE+0x4045, %r13
nop
nop
inc %r12
mov (%r13), %rcx
lea oracles, %r12
and $0xff, %rcx
shlq $12, %rcx
mov (%r12,%rcx,1), %rcx
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A_ht', 'same': True, 'size': 4, 'congruent': 0, 'NT': True, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'33': 2689}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48_notsx.log_10_1503.asm | ljhsiun2/medusa | 9 | 16780 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x8fd, %rdi
nop
nop
nop
nop
nop
xor $1410, %r14
mov $0x6162636465666768, %r10
movq %r10, %xmm7
vmovups %ymm7, (%rdi)
nop
nop
nop
nop
sub $23732, %r9
lea addresses_WC_ht+0x7b36, %rsi
lea addresses_WT_ht+0x72f5, %rdi
nop
and $60760, %r14
mov $113, %rcx
rep movsw
nop
nop
lfence
lea addresses_D_ht+0x14e35, %rsi
lea addresses_WT_ht+0x129b5, %rdi
nop
nop
nop
nop
nop
add %rdx, %rdx
mov $31, %rcx
rep movsq
sub %rcx, %rcx
lea addresses_normal_ht+0xab5, %rsi
lea addresses_UC_ht+0x1d1b5, %rdi
clflush (%rdi)
nop
nop
nop
inc %rdx
mov $113, %rcx
rep movsb
nop
nop
nop
nop
and $50193, %rdx
lea addresses_D_ht+0xea81, %rsi
nop
nop
sub %r9, %r9
movl $0x61626364, (%rsi)
nop
nop
and %rdi, %rdi
lea addresses_WC_ht+0xc0f5, %r10
nop
nop
and %rdx, %rdx
mov (%r10), %rsi
nop
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_A_ht+0x1c115, %rdi
nop
inc %rcx
movw $0x6162, (%rdi)
nop
sub %rdx, %rdx
lea addresses_UC_ht+0xe1f5, %rsi
nop
nop
add $32568, %r9
movw $0x6162, (%rsi)
nop
cmp %rdx, %rdx
lea addresses_WT_ht+0x11a91, %rdi
clflush (%rdi)
nop
nop
add $29161, %rsi
mov $0x6162636465666768, %r10
movq %r10, %xmm2
vmovups %ymm2, (%rdi)
nop
inc %r14
lea addresses_A_ht+0xe1b5, %rsi
lea addresses_D_ht+0x19e0d, %rdi
nop
nop
nop
xor $19565, %rbx
mov $18, %rcx
rep movsb
nop
xor %rdi, %rdi
lea addresses_A_ht+0x34b5, %rbx
nop
xor $2248, %r14
mov $0x6162636465666768, %rdx
movq %rdx, (%rbx)
nop
nop
sub %r14, %r14
lea addresses_WT_ht+0x6db5, %rsi
lea addresses_normal_ht+0x1d5b5, %rdi
nop
sub $16809, %rdx
mov $115, %rcx
rep movsw
nop
add %r10, %r10
lea addresses_UC_ht+0xe88d, %rdi
clflush (%rdi)
nop
xor %rsi, %rsi
vmovups (%rdi), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r9
nop
nop
nop
nop
add %r10, %r10
lea addresses_WC_ht+0x195b5, %rsi
lea addresses_WC_ht+0x2829, %rdi
nop
dec %rdx
mov $107, %rcx
rep movsb
nop
add %r14, %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %r8
push %rbx
push %rsi
// Faulty Load
lea addresses_US+0x25b5, %rsi
nop
nop
nop
cmp $9002, %rbx
movb (%rsi), %r15b
lea oracles, %r8
and $0xff, %r15
shlq $12, %r15
mov (%r8,%r15,1), %r15
pop %rsi
pop %rbx
pop %r8
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_US', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_US', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 3}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}}
{'dst': {'same': True, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 2}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC_ht', 'congruent': 6}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A_ht', 'congruent': 3}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 3}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT_ht', 'congruent': 2}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 3}}
{'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 11, 'type': 'addresses_WC_ht'}}
{'00': 10}
00 00 00 00 00 00 00 00 00 00
*/
|
src/constraint_engine.ads | alex-87/ConstraintEngine | 0 | 7321 | <filename>src/constraint_engine.ads<gh_stars>0
with
ADA.Containers.Vectors;
package Constraint_Engine is
type Type_Problem is
tagged private;
type Enum_Relational is
(IS_EQUAL, -- =
IS_LESS_EQUAL, -- <=
IS_LESS, -- <
IS_MORE_EQUAL, -- >=
IS_MORE, -- >
IS_INEQUAL); -- /=
type Type_Variable is tagged
record
Low_Interval : Integer;
Top_Interval : Integer;
Curr_Solution : Integer;
end record;
type Type_Constraint is tagged
record
V1_Position : Positive;
Rel : Enum_Relational;
V2_Position : Positive;
V : Integer;
Is_Var_Ctr : Boolean;
end record;
package Var_Vector is new ADA.Containers.Vectors(Index_Type => Positive,
Element_Type => Type_Variable);
package Ctr_Vector is new ADA.Containers.Vectors(Index_Type => Positive,
Element_Type => Type_Constraint);
type Type_Array_Position is
Array( Integer range <> ) of Positive;
function Find_Solution
(Self : in Type_Problem) return Type_Problem;
function Is_Valid_Solution
(Self : Type_Problem) return Boolean;
function Is_Valid_Relation
(Self : Type_Problem; V_1 : Integer; Rel : Enum_Relational; V_2 : Integer) return Boolean;
function Get_Var
(Self : Type_Problem) return Var_Vector.Vector;
function Check_Contradiction
(Self : Type_Problem) return Boolean;
pragma Assertion_Policy (Pre => Check);
procedure Add_Var
(Self : in out Type_Problem; Low_Interval : Integer; Top_Interval : Integer)
with Pre => Low_Interval <= Top_Interval;
procedure Add_Constraint_Var
(Self : in out Type_Problem; V1_Position : Positive; Rel : Enum_Relational; V2_Position : Positive);
pragma Assertion_Policy (Pre => Check);
procedure Add_Constraint_Var_Multiple
(Self : in out Type_Problem; V_All_Position : Type_Array_Position; Rel : Enum_Relational)
with Pre => Rel = IS_EQUAL or Rel = IS_INEQUAL;
procedure Add_Constraint_Int
(Self : in out Type_Problem; V1_Position : Positive; Rel : Enum_Relational; V : Integer);
procedure Add_Constraint_Int_Multiple
(Self : in out Type_Problem; V_All_Position : Type_Array_Position; Rel : Enum_Relational; V : Integer);
--- Exceptions
No_Solution : exception;
Contradicted_Contraint : exception;
private
type Type_Problem is tagged
record
Var_Cur : Integer := 0;
Ctr_Cur : Integer := 0;
Var_List : Var_Vector.Vector;
Ctr_List : Ctr_Vector.Vector;
end record;
end Constraint_Engine;
|
alloy4fun_models/trashltl/models/9/HwEkoA6z4x6SrdDC4.als | Kaixi26/org.alloytools.alloy | 0 | 4768 | open main
pred idHwEkoA6z4x6SrdDC4_prop10 {
(all f:Protected | always after f in Protected)
}
pred __repair { idHwEkoA6z4x6SrdDC4_prop10 }
check __repair { idHwEkoA6z4x6SrdDC4_prop10 <=> prop10o } |
programs/oeis/073/A073267.asm | karttu/loda | 0 | 98510 | ; A073267: Number of compositions (ordered partitions) of n into exactly two powers of 2.
; 0,0,1,2,1,2,2,0,1,2,2,0,2,0,0,0,1,2,2,0,2,0,0,0,2,0,0,0,0,0,0,0,1,2,2,0,2,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,0,2,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,0,2,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
mov $3,$0
lpb $0,6
div $3,2
mov $14,$0
sub $0,$3
mov $2,$14
lpe
div $0,89
lpb $14,1
mov $2,$0
sub $14,4
lpe
mov $1,$2
|
antlr4/FoostacheParser.g4 | daxee/foostache | 0 | 7454 | parser grammar FoostacheParser;
options { tokenVocab=FoostacheLexer; }
template
: statements EOF
;
statements
: statement*
;
statement
: rawText
| literal
| stringField
| numberField
| ifBlock
| withBlock
| iterateBlock
| filterBlock
;
rawText
: TEXT+
;
literal
: OPENL literalText CLOSEL
;
literalText
: TEXTL*
;
stringField
: OPEN path ( inlineFilter )* CLOSE
;
numberField
: OPEN path numberFormat ( inlineFilter )* CLOSE
;
inlineFilter
: PIPE ID
;
numberFormat
: PERCENT (flags=ZERO)? (width=PINTEGERN)? (DOTN precision=PINTEGERN)? specifier=NUMBER_SPECIFIER
;
ifBlock
: ifTag statements elseifBlock* elseBlock? OPEN END CLOSE
;
ifTag
: OPEN IF expression CLOSE
;
elseifBlock
: elseifTag statements
;
elseifTag
: OPEN ELSEIF expression CLOSE
;
elseBlock
: OPEN ELSE CLOSE statements
;
expression
: path # boolExpression
| path EXISTS # existsExpression
| path IS TYPE # typeExpression
| NOT expression # notExpression
| expr1=expression AND expr2=expression # andExpression
| expr1=expression OR expr2=expression # orExpression
| LPAREN expression RPAREN # parenExpression
;
path
: DOT # dotPath
| CARET* ((objectKey | LBRACKET arrayIndex RBRACKET) ((DOT objectKey) | (LBRACKET arrayIndex RBRACKET))*)? # caretPath
;
objectKey
: ID # idObjectKey
| OPENQS (CHARQS | ESCCHARQS)* CLOSEQS # qsObjectKey
;
arrayIndex
: INTEGER
;
withBlock
: OPEN WITH path CLOSE statements OPEN END CLOSE
;
iterateBlock
: OPEN ITERATE path indexRange CLOSE statements iterateClause* OPEN END CLOSE
;
indexRange
: INTEGER? indexRangeB?
;
indexRangeB
: COLON INTEGER? indexRangeC?
;
indexRangeC
: COLON INTEGER
;
iterateClause
: iterateBeforeClause
| iterateAfterClause
| iterateBetweenClause
| iterateElseClause
;
iterateBeforeClause
: OPEN BEFORE CLOSE statements
;
iterateAfterClause
: OPEN AFTER CLOSE statements
;
iterateBetweenClause
: OPEN BETWEEN CLOSE statements
;
iterateElseClause
: OPEN ELSE CLOSE statements
;
filterBlock
: OPEN FILTER filterName=ID CLOSE statements OPEN END CLOSE
;
|
scripts/viridianforestentrance.asm | adhi-thirumala/EvoYellow | 16 | 22334 | ViridianForestEntranceScript:
call EnableAutoTextBoxDrawing
ret
ViridianForestEntranceTextPointers:
dw ViridianForestEntranceText1
dw ViridianForestEntranceText2
ViridianForestEntranceText1:
TX_FAR _ViridianForestEntranceText1
db "@"
ViridianForestEntranceText2:
TX_FAR _ViridianForestEntranceText2
db "@"
|
videocodec/libvpx_internal/libvpx/vp9/common/arm/neon/vp9_dc_only_idct_add_neon.asm | Omegaphora/hardware_intel_common_omx-components | 49 | 102981 | <gh_stars>10-100
;
; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license and patent
; grant that can be found in the LICENSE file in the root of the source
; tree. All contributing project authors may be found in the AUTHORS
; file in the root of the source tree.
;
EXPORT |vp9_dc_only_idct_add_neon|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
;void vp9_dc_only_idct_add_neon(int input_dc, uint8_t *pred_ptr,
; uint8_t *dst_ptr, int pitch, int stride)
;
; r0 int input_dc
; r1 uint8_t *pred_ptr
; r2 uint8_t *dst_ptr
; r3 int pitch
; sp int stride
|vp9_dc_only_idct_add_neon| PROC
; generate cospi_16_64 = 11585
mov r12, #0x2d00
add r12, #0x41
; dct_const_round_shift(input_dc * cospi_16_64)
mul r0, r0, r12 ; input_dc * cospi_16_64
add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
asr r0, r0, #14 ; >> DCT_CONST_BITS
; dct_const_round_shift(out * cospi_16_64)
mul r0, r0, r12 ; out * cospi_16_64
add r0, r0, #0x2000 ; +(1 << ((DCT_CONST_BITS) - 1))
asr r0, r0, #14 ; >> DCT_CONST_BITS
; ROUND_POWER_OF_TWO(out, 4)
add r0, r0, #8 ; + (1 <<((4) - 1))
asr r0, r0, #4 ; >> 4
vdup.16 q0, r0; ; duplicate a1
ldr r12, [sp] ; load stride
vld1.32 {d2[0]}, [r1], r3
vld1.32 {d2[1]}, [r1], r3
vld1.32 {d4[0]}, [r1], r3
vld1.32 {d4[1]}, [r1]
vaddw.u8 q1, q0, d2 ; a1 + pred_ptr[c]
vaddw.u8 q2, q0, d4
vqmovun.s16 d2, q1 ; clip_pixel
vqmovun.s16 d4, q2
vst1.32 {d2[0]}, [r2], r12
vst1.32 {d2[1]}, [r2], r12
vst1.32 {d4[0]}, [r2], r12
vst1.32 {d4[1]}, [r2]
bx lr
ENDP ; |vp9_dc_only_idct_add_neon|
END
|
programs/test_samples/simulator_test1.asm | zaccrites/riscv | 0 | 87275 |
# Build commands:
# as simulator_test1.s -o simulator_test1.o && objdump -d simulator_test1.o
# objcopy -O binary simulator_test1.o simulator_test1.bin
# xxd -e simulator_test1.bin
# TODO: Emit and consume hex file
# Add up the numbers from 1 to 10 (the answer is 45, or 0x2d)
.text
_start:
addi s0, zero, 1
addi s0, s0, 2
addi s0, s0, 3
addi s0, s0, 4
addi s0, s0, 5
addi s0, s0, 6
addi s0, s0, 7
addi s0, s0, 8
addi s0, s0, 9
add a0, s0, zero
ecall
jal ra, _start
|
source/idonu_program.adb | jquorning/WeDo | 1 | 12776 | <reponame>jquorning/WeDo<gh_stars>1-10
pragma License (Restricted);
--
-- Copyright (C) 2020 <NAME> All Rights Reserved.
--
-- The author disclaims copyright to this source code. In place of
-- a legal notice, here is a blessing:
--
-- May you do good and not evil.
-- May you find forgiveness for yourself and forgive others.
-- May you share freely, not taking more than you give.
--
with Ada.Text_IO;
with Ada.Exceptions;
with Setup;
with Command_Line;
with Database.Jobs;
with SQL_Database;
with Parser;
-- with Web_Server;
with Terminal_IO;
with Interactive;
with Navigate;
with Files;
procedure iDoNu_Program
is
Config : Setup.Configuration;
begin
Terminal_IO.Put_Banner;
declare
List : Files.Collection_List;
begin
Files.Append_Collections (List, ".");
Files.Append_Collections (List, "..");
Files.Append_Collections (List, "/Users/jquorning/");
Files.Append_Collections (List, "/Users/jquorning/var/");
end;
Command_Line.Parse (Config);
Interactive.Initialize;
SQL_Database.Open;
-- Web_Server.Startup;
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("List:");
Navigate.Build_Path (Database.Jobs.Get_Current_Job);
Terminal_IO.Put_Path;
Navigate.Refresh_List;
Terminal_IO.Put_Jobs;
loop
Parser.Parse_Input (Interactive.Get_Line);
exit when Parser.Exit_Program;
end loop;
-- Web_Server.Shutdown;
Interactive.Finalize;
Command_Line.Set_Exit_Status (Command_Line.Success);
exception
when Command_Line.Terminate_Program =>
null;
when Occurrence : others =>
declare
use Ada.Exceptions;
Message : String renames Exception_Message (Occurrence);
begin
if Message = "" then
raise;
else
Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error, Message);
end if;
end;
end iDoNu_Program;
|
test/interaction/Issue564.agda | asr/agda-kanso | 1 | 1089 | <filename>test/interaction/Issue564.agda
module Issue564 where
postulate
Level : Set
zero : Level
{-# BUILTIN LEVEL Level #-}
{-# BUILTIN LEVELZERO zero #-}
postulate
A : Level → Set
module M ℓ where
postulate a : A ℓ
postulate
P : A zero → Set
open M zero
p : P a
p = {!!}
|
Engine Hacks/Strmag/Strmag/Str Mag Split/Autolevelling and Saves/Restore Mag.asm | sme23/Christmas2 | 3 | 99304 | .thumb
.org 0x0
@A4224
push {r5-r7,r14}
mov r7,r1
mov r2,#0xC0
ldr r3,[r0]
mov r0,r4
bl goto_r3
mov r5,#0x0
ldr r6,GetCharStruct
Loop:
mov r0,r5
mov r3,r6
bl goto_r3
add r0,#0x3A
ldrb r1,[r7,r5]
strb r1,[r0]
add r5,#0x1
cmp r5,#0xBF
ble Loop
pop {r5-r7}
pop {r0}
bx r0
goto_r3:
bx r3
.align
GetCharStruct:
.long 0x08019430+1
|
programs/oeis/094/A094766.asm | karttu/loda | 0 | 18191 | ; A094766: Trajectory of 11 under repeated application of the map n -> n + 2*square excess of n (see A094765).
; 11,15,27,31,43,57,73,91,111,133,157,183,211,241,273,307,343,381,421,463,507,553,601,651,703,757,813,871,931,993,1057,1123,1191,1261,1333,1407,1483,1561,1641,1723,1807,1893,1981,2071,2163,2257,2353,2451,2551,2653,2757,2863,2971,3081,3193,3307,3423,3541,3661,3783,3907,4033,4161,4291,4423,4557,4693,4831,4971,5113,5257,5403,5551,5701,5853,6007,6163,6321,6481,6643,6807,6973,7141,7311,7483,7657,7833,8011,8191,8373,8557,8743,8931,9121,9313,9507,9703,9901,10101,10303,10507,10713,10921,11131,11343,11557,11773,11991,12211,12433,12657,12883,13111,13341,13573,13807,14043,14281,14521,14763,15007,15253,15501,15751,16003,16257,16513,16771,17031,17293,17557,17823,18091,18361,18633,18907,19183,19461,19741,20023,20307,20593,20881,21171,21463,21757,22053,22351,22651,22953,23257,23563,23871,24181,24493,24807,25123,25441,25761,26083,26407,26733,27061,27391,27723,28057,28393,28731,29071,29413,29757,30103,30451,30801,31153,31507,31863,32221,32581,32943,33307,33673,34041,34411,34783,35157,35533,35911,36291,36673,37057,37443,37831,38221,38613,39007,39403,39801,40201,40603,41007,41413,41821,42231,42643,43057,43473,43891,44311,44733,45157,45583,46011,46441,46873,47307,47743,48181,48621,49063,49507,49953,50401,50851,51303,51757,52213,52671,53131,53593,54057,54523,54991,55461,55933,56407,56883,57361,57841,58323,58807,59293,59781,60271,60763,61257,61753,62251,62751,63253
mov $2,$0
mov $3,$0
mov $6,$0
lpb $3,1
lpb $2,1
add $1,$2
mov $3,$2
sub $2,1
lpe
lpb $0,1
mov $4,5
mov $5,$0
sub $0,1
add $5,$1
lpe
trn $5,$4
add $1,$5
add $2,3
trn $3,$5
add $5,$1
mov $0,$5
sub $2,1
lpe
lpb $6,1
add $1,4
sub $6,1
lpe
add $1,11
|
oeis/097/A097817.asm | neoneye/loda-programs | 11 | 176483 | <reponame>neoneye/loda-programs
; A097817: E.g.f. exp(2x)/(1-3x).
; Submitted by <NAME>(s4)
; 1,5,34,314,3784,56792,1022320,21468848,515252608,13911820928,417354628864,13772702754560,495817299168256,19336874667570176,812148736037963776,36546693121708402688,1754241269842003394560
add $0,1
mov $2,1
lpb $0
sub $0,1
mul $1,2
add $1,$2
mul $2,3
mul $2,$0
lpe
mov $0,$1
|
test/Succeed/Issue778.agda | cruhland/agda | 1,989 | 8309 | -- {-# OPTIONS -v tc.term.exlam:100 -v extendedlambda:100 -v int2abs.reifyterm:100 #-}
-- Andreas, 2013-02-26
module Issue778 (Param : Set) where
open import Common.Prelude
works : Nat → Nat
works with zero
... | zero = λ { zero → zero; (suc x) → suc x }
... | suc _ = λ { x → x }
test : Nat → Nat
test = λ { zero → zero; (suc x) → aux x }
where aux : Nat → Nat
aux x with works x
... | zero = zero
... | suc y = works y
-- There was a internal error in connection to extended lambda and
-- where blocks in parametrized modules.
|
src/main/antlr4/nl/arothuis/antlr4calculator/core/parser/Calculator.g4 | arothuis/antlr4-calculator | 15 | 6142 | grammar Calculator;
/*
* Tokens (terminal)
*/
POW: '^';
MUL: '*';
DIV: '/';
ADD: '+';
SUB: '-';
NUMBER: '-'?[0-9]+;
WHITESPACE: [ \r\n\t]+ -> skip;
/*
* Production Rules (non-terminal)
*/
start : expression;
/*
* The order in which expressions are evaluated
* is determined by the order in which possible
* matching rules are defined.
* Here, numbers are dealt with first, then parentheses
* and so on.
*
* Multiplication and division are on the
* same precedence level, so they are grouped.
* The same goes for addition and subtraction.
*
* Labels (e.g. "# Parentheses") are added to each rule
* to provide context to which rule is being parsed.
* This is can be used in a Listener or Visitor
* to allow for separate control over Listener or Visitor actions.
*
* Likewise, inner labels (e.g. "left=expression")
* can be added to child nodes of the rule.
* This makes them identifiable in a
* Listener's or Visitor's parsing of the rule,
* allowing for even more fine-grained control.
*/
expression
: NUMBER # Number
| '(' inner=expression ')' # Parentheses
| left=expression operator=POW right=expression # Power
| left=expression operator=(MUL|DIV) right=expression # MultiplicationOrDivision
| left=expression operator=(ADD|SUB) right=expression # AdditionOrSubtraction
;
|
reo-interpreter/src/main/antlr4/nl/cwi/reo/interpret/PR.g4 | kasperdokter/Reo-compiler | 9 | 5473 | <reponame>kasperdokter/Reo-compiler
grammar PR;
import Tokens;
pr : '#PR' pr_string (('[' pr_param ']')? pr_port)?;
pr_string : ID;
pr_port : '(' (ID (',' ID)*)? ';' (ID (',' ID)*)? ')';
pr_param : NAT | STRING | ID ;
|
Experiment/Categories/Category/Monoidal/Strict.agda | rei1024/agda-misc | 3 | 4234 | {-# OPTIONS --without-K --safe #-}
module Experiment.Categories.Category.Monoidal.Strict where
|
programs/oeis/115/A115598.asm | karttu/loda | 0 | 94254 | ; A115598: Consider all Pythagorean triples (X,X+1,Z) ordered by increasing Z; sequence gives Z-(X+1) values.
; 1,8,49,288,1681,9800,57121,332928,1940449,11309768,65918161,384199200,2239277041,13051463048,76069501249,443365544448,2584123765441,15061377048200,87784138523761,511643454094368,2982076586042449,17380816062160328
mul $0,2
mov $2,2
lpb $0,1
sub $0,1
mov $1,$2
add $3,$2
add $2,3
add $2,$3
mov $3,$1
lpe
add $1,1
|
Ada/Benchmark/src/main.adb | kkirstein/proglang-playground | 0 | 11232 | <reponame>kkirstein/proglang-playground
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Calendar; use Ada.Calendar;
with Ada.Numerics.Big_Numbers.Big_Integers;
use Ada.Numerics.Big_Numbers.Big_Integers;
with Fibonacci;
with Perfect_Number;
with Primes;
with Aux_Image; use Aux_Image;
procedure Main is
package Fib renames Fibonacci;
package Pn renames Perfect_Number;
procedure Put_Elapsed (Tic : Time; Toc : Time := Clock) is
begin
Put_Line (" elapsed time: " & Duration'Image(Toc - Tic) & "s");
end Put_Elapsed;
Tic : Time;
begin
Put_Line ("Benchmark");
Put_Line ("=========");
New_Line;
Put_Line ("Fibonacci Numbers");
Put_Line ("-----------------");
Tic := Clock;
Put ("Fib_Naive (35) = " & Img (Fib.Fib_Naive (35)));
Put_Elapsed (Tic);
Tic := Clock;
Put ("Fib_Iter (1000) = " & Img (Fib.Fib_Iter (1000)));
Put_Elapsed (Tic);
Tic := Clock;
Put ("Fib_Recur (1000) = " & Img (Fib.Fib_Recur (1000)));
Put_Elapsed (Tic);
New_Line;
Put_Line ("Perfect Numbers");
Put_Line ("---------------");
Tic := Clock;
Put ("Perfect_Numbers (10000) = " & Img (Pn.Get_Perfect_Numbers (10000)));
Put_Elapsed (Tic);
New_line;
Put_Line ("Prime Numbers");
Put_Line ("-------------");
Tic := Clock;
Put ("Get_Primes (10000): (" & Img (Primes.Get_Primes (Integer (10_000))) & ")");
Put_Elapsed (Tic);
Tic := Clock;
Put ("Get_Primes (10000): (" & Img (Primes.Get_Primes (To_Big_Integer (10_000))) & ")");
Put_Elapsed (Tic);
New_Line;
end Main;
|
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sdcc_iy/esx_m_setdrv.asm | jpoikela/z88dk | 640 | 21081 | <filename>libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sdcc_iy/esx_m_setdrv.asm
; unsigned char esx_m_setdrv(unsigned char drive)
SECTION code_esxdos
PUBLIC _esx_m_setdrv
EXTERN asm_esx_m_setdrv
_esx_m_setdrv:
pop af
pop hl
push hl
push af
jp asm_esx_m_setdrv
|
controlFlow/while_statement.asm | DanerSound/MIPS-from-scratch | 2 | 161423 | <gh_stars>1-10
# simple workflow to understand the
# while statement
.data
.text
main:
li $t0,5 # defines guard
move $t1,$zero #
while: beq $t0, $t1, exit # while(t0!=t1){
add $t0, $t0, -1 # t0=t0-1 }
j while
exit:
li $v0,10
syscall
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/graphic.ads | best08618/asylo | 7 | 23938 | with Ada.Streams;
with Ada.Tags;
package Graphic is
use Ada;
--
type Object is abstract tagged null record;
function XML_Input (S : access Streams.Root_Stream_Type'Class)
return Object'Class;
end Graphic;
|
src/fot/FOTC/Program/Mirror/Example.agda | asr/fotc | 11 | 17522 | <reponame>asr/fotc<gh_stars>10-100
------------------------------------------------------------------------------
-- Mirror example
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Program.Mirror.Example where
open import FOTC.Base
open import FOTC.Data.Nat.UnaryNumbers
open import FOTC.Base.List
open import FOTC.Data.List
open import FOTC.Program.Mirror.Mirror
open import FOTC.Program.Mirror.Type
open import FOTC.Program.Mirror.PropertiesI
------------------------------------------------------------------------------
-- Example
-- 1
-- / / \ \
-- 2 3 4 5
-- / \
-- 6 7
t : D
t = node 1' (node 2' (node 6' [] ∷ node 7' [] ∷ []) ∷
node 3' [] ∷
node 4' [] ∷
node 5' [] ∷
[]
)
tTree : Tree t
tTree = tree 1' (fcons (tree 2' (fcons (tree 6' fnil)
(fcons (tree 7' fnil)
fnil)))
(fcons (tree 3' fnil)
(fcons (tree 4' fnil)
(fcons (tree 5' fnil)
fnil))))
test : t ≡ mirror · (mirror · t)
test = sym (mirror-involutive tTree)
|
Assembler/newFile.asm | epostIt/Assembler | 0 | 23746 | // Data will be loaded in R[100] and R[200] thru R[203]
// The outputs will be taken from R[200] thru R[203]
FLAG_REGISTER 16383
FLAG_REGISTER 16383
FLAG_VALUE 24242
FLAG_VALUE 24242
@100
D=M
@200
M=D&M
@201
M=D|M
@202
M=D+M
@203
M=D-M
// Set the flag
@24242
D=A
@16383
M=D
|
libsrc/_DEVELOPMENT/math/float/math48/c/sccz80/cm48_sccz80_scalbn.asm | meesokim/z88dk | 0 | 95682 |
; double scalbn(double x, int n)
SECTION code_fp_math48
PUBLIC cm48_sccz80_scalbn
EXTERN am48_scalbn, am48_dloadb
cm48_sccz80_scalbn:
pop af
pop hl
push hl
push af
exx
ld hl,9
add hl,sp
call am48_dloadb
jp am48_scalbn
|
tests/parsing/issue166_multiarg_exceptions.asm | NEO-SPECTRUMAN/sjasmplus | 1 | 24866 | ; make some instructions to accept single-comma multi-arg even when --syntax=a mode is specified
; instructions supporting relaxed multi-arg: dec, inc, pop, push
; errors of double-comma used without --syntax=a mode
dec bc,,de
inc bc,,de
push hl,,de
pop hl,,de
OPT --reversepop
pop hl,,de
; enabled --syntax=a mode, and check mixed commas for relaxed instructions
OPT reset --syntax=a
dec bc,de,,hl,sp,,ix,iy,,b,c,d,e,,h,l,(hl),a
inc bc,de,,hl,sp,,ix,iy,,b,c,d,e,,h,l,(hl),a
push bc,de,,hl,af,,ix,iy
pop bc,de,,hl,af,,ix,iy
OPT --reversepop
pop bc,de,,hl,af,,ix,iy
|
test/Fail/WithoutK3.agda | KDr2/agda | 0 | 3165 | <gh_stars>0
{-# OPTIONS --cubical-compatible --show-implicit #-}
module WithoutK3 where
-- Homogeneous equality.
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
-- The J rule.
J : {A : Set} (P : {x y : A} → x ≡ y → Set) →
(∀ x → P (refl {x = x})) →
∀ {x y} (x≡y : x ≡ y) → P x≡y
J P p refl = p _
-- Heterogeneous equality.
data _≅_ {A : Set} (x : A) : {B : Set} → B → Set₁ where
refl : x ≅ x
-- Substitutivity.
subst : {A : Set} {x y : A} (P : A → Set) → x ≅ y → P x → P y
subst P refl p = p
-- The K rule. (The implementation is based on a construction in Conor
-- McBride's PhD thesis.)
K : {A : Set} {x : A} (P : {x : A} → x ≡ x → Set) →
(∀ x → P (refl {x = x})) →
∀ {x} (p : x ≡ x) → P p
K P p x≡x =
J (λ {x y} (p : x ≡ y) → (x≡x : x ≡ x) → p ≅ x≡x → P x≡x)
(λ x x≡x refl≅x≡x → subst P refl≅x≡x (p x))
x≡x x≡x refl
|
programs/oeis/048/A048506.asm | karttu/loda | 1 | 169868 | ; A048506: a(n) = T(0,n), array T given by A048505.
; 1,2,7,25,81,241,673,1793,4609,11521,28161,67585,159745,372737,860161,1966081,4456449,10027009,22413313,49807361,110100481,242221057,530579457,1157627905,2516582401,5452595201,11777605633,25367150593,54492397569,116769423361,249644974081,532575944705,1133871366145,2409476653057,5111011082241,10823317585921,22883585753089,48309792145409,101842264522753,214404767416321,450799767388161,946679511515137,1985717999763457,4160551999504385,8708132091985921
mov $2,2
pow $2,$0
mul $2,$0
add $0,2
mul $0,$2
sub $0,$2
mov $1,$0
div $1,4
add $1,1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.