hexsha
stringlengths 40
40
| size
int64 6
1.05M
| ext
stringclasses 3
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
232
| max_stars_repo_name
stringlengths 7
106
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
7
| max_stars_count
int64 1
33.5k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
232
| max_issues_repo_name
stringlengths 7
106
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
7
| max_issues_count
int64 1
37.5k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
232
| max_forks_repo_name
stringlengths 7
106
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
7
| max_forks_count
int64 1
12.6k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 6
1.05M
| avg_line_length
float64 1.16
19.7k
| max_line_length
int64 2
938k
| alphanum_fraction
float64 0
1
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16773dac4de1c2773fd5294fbfd5a8644df50020
| 4,616
|
asm
|
Assembly
|
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0.log_21829_809.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0.log_21829_809.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0.log_21829_809.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x14df1, %rsi
lea addresses_D_ht+0x6471, %rdi
nop
xor $10179, %rbp
mov $83, %rcx
rep movsb
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_A_ht+0xf471, %r14
nop
nop
nop
nop
and $57479, %r15
movb $0x61, (%r14)
nop
nop
nop
nop
add $64268, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r9
push %rbp
push %rdx
push %rsi
// Load
lea addresses_normal+0x1f571, %rbp
nop
nop
sub $62148, %r12
mov (%rbp), %r14d
nop
and $50414, %r11
// Faulty Load
lea addresses_US+0x1b571, %r14
nop
nop
nop
nop
sub $48594, %r9
movb (%r14), %r11b
lea oracles, %r14
and $0xff, %r11
shlq $12, %r11
mov (%r14,%r11,1), %r11
pop %rsi
pop %rdx
pop %rbp
pop %r9
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 8, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}}
{'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
*/
| 48.589474
| 2,999
| 0.661179
|
1ec37fded6e93c9eca33dc3636bcc9460302a966
| 4,653
|
asm
|
Assembly
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2_notsx.log_29_1566.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2_notsx.log_29_1566.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2_notsx.log_29_1566.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0xa23e, %rcx
and %r11, %r11
mov (%rcx), %di
nop
nop
add %r14, %r14
lea addresses_UC_ht+0x1e3b5, %rsi
lea addresses_WT_ht+0xc33e, %rdi
nop
nop
nop
nop
and %r13, %r13
mov $36, %rcx
rep movsl
inc %r11
lea addresses_normal_ht+0x7b92, %r11
sub %rdx, %rdx
mov $0x6162636465666768, %r14
movq %r14, %xmm2
vmovups %ymm2, (%r11)
nop
nop
nop
nop
nop
inc %r11
lea addresses_D_ht+0x1e30e, %rsi
lea addresses_UC_ht+0x13e3e, %rdi
clflush (%rsi)
nop
nop
lfence
mov $68, %rcx
rep movsq
nop
nop
nop
nop
nop
add $52791, %rdi
lea addresses_WC_ht+0x8e3e, %rsi
nop
nop
add $62374, %r13
movb (%rsi), %dl
nop
nop
nop
nop
nop
sub %r14, %r14
lea addresses_A_ht+0x16dbe, %rsi
lea addresses_A_ht+0x1b5e, %rdi
dec %r13
mov $74, %rcx
rep movsw
nop
nop
nop
nop
sub $2060, %r11
lea addresses_UC_ht+0x8fcc, %rsi
lea addresses_normal_ht+0x1c63e, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
xor $51074, %rbp
mov $75, %rcx
rep movsb
nop
nop
nop
nop
nop
and $55243, %rdi
lea addresses_UC_ht+0x11b3e, %r13
nop
nop
add %rsi, %rsi
movl $0x61626364, (%r13)
nop
nop
nop
cmp $56542, %rcx
lea addresses_A_ht+0x11236, %rcx
nop
nop
nop
nop
nop
inc %r11
vmovups (%rcx), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $0, %xmm2, %rsi
nop
nop
cmp %r13, %r13
lea addresses_A_ht+0x18e3e, %r13
nop
nop
nop
nop
nop
add %r11, %r11
mov (%r13), %rbp
nop
nop
add $18349, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
mov $0x43e, %rsi
lea addresses_PSE+0x14246, %rdi
nop
nop
nop
nop
and %r13, %r13
mov $2, %rcx
rep movsq
nop
nop
nop
nop
nop
and $654, %r15
// Load
lea addresses_A+0x73e, %r15
xor %rsi, %rsi
mov (%r15), %rcx
nop
nop
nop
add $18839, %rdi
// Load
lea addresses_PSE+0x148be, %r15
nop
inc %rbx
mov (%r15), %esi
cmp $46381, %rdi
// Store
lea addresses_RW+0x16e3e, %rbx
clflush (%rbx)
nop
nop
nop
nop
xor $20111, %rsi
mov $0x5152535455565758, %rcx
movq %rcx, %xmm7
vmovups %ymm7, (%rbx)
nop
nop
nop
add %r10, %r10
// Faulty Load
lea addresses_RW+0x16e3e, %rcx
cmp $59774, %rsi
mov (%rcx), %rbx
lea oracles, %r10
and $0xff, %rbx
shlq $12, %rbx
mov (%r10,%rbx,1), %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_P', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_PSE', 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': True}}
{'58': 29}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
| 19.969957
| 153
| 0.648829
|
38be09dd67431dc9e0779cfd623f354f3bf61343
| 474
|
asm
|
Assembly
|
programs/oeis/315/A315886.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | 1
|
2021-03-15T11:38:20.000Z
|
2021-03-15T11:38:20.000Z
|
programs/oeis/315/A315886.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
programs/oeis/315/A315886.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
; A315886: Coordination sequence Gal.6.527.6 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,6,8,14,16,22,24,30,36,38,44,46,52,54,60,66,68,74,76,82,84,90,96,98,104,106,112,114,120,126,128,134,136,142,144,150,156,158,164,166,172,174,180,186,188,194,196,202,204,210
mul $0,2
mov $1,3
sub $1,$0
trn $1,2
add $1,$0
add $0,$1
trn $0,3
mov $2,6
lpb $0
sub $0,1
trn $0,$2
add $1,4
lpe
| 27.882353
| 177
| 0.685654
|
6492a5586a8e61c4ca30250cbf8e91720161d038
| 407
|
asm
|
Assembly
|
oeis/155/A155181.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/155/A155181.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/155/A155181.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A155181: a(n)=5*a(n-1)+a(n-2), n>2 ; a(0)=1, a(1)=4, a(2)=20 .
; Submitted by Christian Krause
; 1,4,20,104,540,2804,14560,75604,392580,2038504,10585100,54964004,285405120,1481989604,7695353140,39958755304,207489129660,1077404403604,5594511147680,29049960142004,150844311857700,783271519430504
mov $3,1
lpb $0
sub $0,1
mov $2,$3
mul $3,5
add $3,$1
mov $1,$2
div $3,2
mul $3,2
lpe
mov $0,$3
| 25.4375
| 198
| 0.690418
|
4b3932cf322b0fc6f29de8017dd1cca6f744d8ff
| 2,394
|
asm
|
Assembly
|
GBRoms/GB2Twitter/Graphics/lowercase.asm
|
Pegmode/GB2Twitter
|
6fe571a6bdf8991b4284b3c6bee564a861c73415
|
[
"MIT"
] | 4
|
2019-12-31T18:53:39.000Z
|
2021-04-29T20:30:59.000Z
|
GBRoms/GB2Twitter/Graphics/lowercase.asm
|
Pegmode/GB2Twitter
|
6fe571a6bdf8991b4284b3c6bee564a861c73415
|
[
"MIT"
] | null | null | null |
GBRoms/GB2Twitter/Graphics/lowercase.asm
|
Pegmode/GB2Twitter
|
6fe571a6bdf8991b4284b3c6bee564a861c73415
|
[
"MIT"
] | null | null | null |
; LOWERCASE.Z80
;
; Tile Source File.
;
; Info:
; Section : Tiles
; Bank : 0
; Form : All tiles as one unit.
; Format : Gameboy 4 color.
; Compression : None.
; Counter : None.
; Tile size : 8 x 8
; Tiles : 0 to 25
;
; Palette colors : None.
; SGB Palette : None.
; CGB Palette : None.
;
; Convert to metatiles : No.
;
; This file was generated by GBTD v2.2
; Start of tile array.
LowerCase::
DB $00,$00,$00,$00,$00,$00,$00,$00
DB $7C,$78,$7C,$48,$6C,$48,$7E,$74
DB $00,$00,$00,$00,$00,$00,$60,$40
DB $60,$40,$7E,$7C,$7E,$44,$7E,$7C
DB $00,$00,$00,$00,$00,$00,$00,$00
DB $7E,$7C,$7C,$40,$60,$40,$7E,$7C
DB $00,$00,$00,$00,$00,$00,$06,$04
DB $06,$04,$7E,$7C,$7E,$44,$7E,$7C
DB $00,$00,$00,$00,$00,$00,$7E,$7C
DB $7E,$44,$7E,$7C,$60,$40,$7E,$7C
DB $00,$00,$00,$00,$00,$00,$3E,$3C
DB $3C,$20,$7E,$7C,$7C,$20,$30,$20
DB $00,$00,$00,$00,$00,$00,$3C,$38
DB $7E,$44,$7E,$3C,$3E,$04,$7C,$78
DB $00,$00,$00,$00,$00,$00,$60,$40
DB $60,$40,$7E,$7C,$7E,$44,$66,$44
DB $00,$00,$00,$00,$00,$00,$18,$10
DB $10,$00,$18,$10,$18,$10,$18,$10
DB $00,$00,$00,$00,$00,$00,$06,$04
DB $04,$00,$06,$04,$06,$04,$7E,$7C
DB $00,$00,$00,$00,$00,$00,$66,$44
DB $6C,$48,$78,$70,$7C,$48,$6E,$44
DB $00,$00,$00,$00,$00,$00,$60,$40
DB $60,$40,$60,$40,$60,$40,$60,$40
DB $00,$00,$00,$00,$00,$00,$3C,$38
DB $7E,$54,$7E,$54,$7E,$54,$7E,$54
DB $00,$00,$00,$00,$00,$00,$3C,$38
DB $66,$44,$66,$44,$66,$44,$66,$44
DB $00,$00,$00,$00,$00,$00,$3C,$38
DB $7E,$44,$66,$44,$66,$44,$7C,$38
DB $00,$00,$00,$00,$00,$00,$7C,$78
DB $7C,$44,$7C,$78,$78,$40,$60,$40
DB $00,$00,$00,$00,$00,$00,$3C,$38
DB $7C,$48,$7C,$78,$7C,$08,$0E,$0C
DB $00,$00,$00,$00,$00,$00,$60,$40
DB $7C,$78,$7E,$44,$60,$40,$60,$40
DB $00,$00,$00,$00,$00,$00,$3C,$38
DB $78,$40,$7C,$38,$3E,$04,$7E,$7C
DB $00,$00,$00,$00,$18,$10,$18,$10
DB $3C,$38,$18,$10,$18,$10,$18,$10
DB $00,$00,$00,$00,$00,$00,$66,$44
DB $66,$44,$66,$44,$66,$44,$3C,$38
DB $00,$00,$00,$00,$00,$00,$66,$44
DB $66,$44,$66,$44,$3C,$28,$18,$10
DB $00,$00,$00,$00,$00,$00,$66,$44
DB $66,$44,$7E,$54,$7E,$54,$7C,$38
DB $00,$00,$00,$00,$00,$00,$66,$44
DB $7C,$28,$38,$10,$3C,$28,$6E,$44
DB $00,$00,$00,$00,$00,$00,$66,$44
DB $66,$44,$7E,$3C,$3E,$04,$7C,$78
DB $00,$00,$00,$00,$00,$00,$7E,$7C
DB $7E,$04,$3C,$38,$78,$40,$7E,$7C
; End of LOWERCASE.Z80
| 29.925
| 49
| 0.503759
|
8e49552c194228184b0e4090298c8b8046234b02
| 306
|
asm
|
Assembly
|
programs/oeis/093/A093148.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | 1
|
2021-03-15T11:38:20.000Z
|
2021-03-15T11:38:20.000Z
|
programs/oeis/093/A093148.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | null | null | null |
programs/oeis/093/A093148.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | null | null | null |
; A093148: a(n) = gcd(Fibonacci(n+5), Fibonacci(n+1)).
; 1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,1,3,1
mov $1,$0
mod $0,2
mod $1,4
pow $1,$0
| 38.25
| 211
| 0.519608
|
5620b20684683b34ac4bde1a2a4aee7ea666125a
| 112
|
asm
|
Assembly
|
asm/Boot-Sector Programing - Nick Blundell/lecture_2.2.asm
|
m-ahmadi/exref
|
1f76ea029995d2f60f19443b29c04c7628125ce3
|
[
"MIT"
] | 9
|
2019-08-28T16:06:21.000Z
|
2022-01-31T10:36:08.000Z
|
asm/Boot-Sector Programing - Nick Blundell/lecture_2.2.asm
|
m-ahmadi/exref
|
1f76ea029995d2f60f19443b29c04c7628125ce3
|
[
"MIT"
] | 1
|
2022-02-23T05:50:57.000Z
|
2022-02-25T16:56:02.000Z
|
asm/Boot-Sector Programing - Nick Blundell/lecture_2.2.asm
|
m-ahmadi/exref
|
1f76ea029995d2f60f19443b29c04c7628125ce3
|
[
"MIT"
] | 5
|
2019-08-28T16:06:23.000Z
|
2022-02-19T20:24:41.000Z
|
mov ah, 0x0e ; BIOS scrolling teletype function
mov al, 'H'
int 0x10
jmp $
times (510-($-$$)) db 0
db 0x55, 0xaa
| 18.666667
| 47
| 0.669643
|
22ebaba2f49093ac0152cc3004d999df3d489ee9
| 594
|
asm
|
Assembly
|
libsrc/sdcard/UNSTUFF_BITS_callee.asm
|
meesokim/z88dk
|
5763c7778f19a71d936b3200374059d267066bb2
|
[
"ClArtistic"
] | null | null | null |
libsrc/sdcard/UNSTUFF_BITS_callee.asm
|
meesokim/z88dk
|
5763c7778f19a71d936b3200374059d267066bb2
|
[
"ClArtistic"
] | null | null | null |
libsrc/sdcard/UNSTUFF_BITS_callee.asm
|
meesokim/z88dk
|
5763c7778f19a71d936b3200374059d267066bb2
|
[
"ClArtistic"
] | null | null | null |
;
; Bit unpacking code for SD/MMC card
;
; Stefano, 2012
;
; unsigned long UNSTUFF_BITS(unsigned char *resp, unsigned int start, unsigned int size)
;
PUBLIC UNSTUFF_BITS_callee
PUBLIC ASMDISP_UNSTUFF_BITS_CALLEE
EXTERN extract_bits_sub
.UNSTUFF_BITS_callee
pop hl
pop bc
pop de
ex (sp),hl
.asmentry
push hl
ld hl,128 ; bit count start on the rightmost bit of the 16 bytes block
and a
sbc hl,de ; 'reverse' the bit position
sbc hl,bc ; also the bit size
ex de,hl
pop hl
jp extract_bits_sub
DEFC ASMDISP_UNSTUFF_BITS_CALLEE = # asmentry - UNSTUFF_BITS_callee
| 18.5625
| 88
| 0.737374
|
4b3e5cbbdabd5220ad3061b0eed9aced8838bbb7
| 756
|
asm
|
Assembly
|
src/strchr.asm
|
areltfc/ASM-MiniLibC
|
1895ee459b0dc5e2a8d94db7ee916b218b671828
|
[
"MIT"
] | null | null | null |
src/strchr.asm
|
areltfc/ASM-MiniLibC
|
1895ee459b0dc5e2a8d94db7ee916b218b671828
|
[
"MIT"
] | null | null | null |
src/strchr.asm
|
areltfc/ASM-MiniLibC
|
1895ee459b0dc5e2a8d94db7ee916b218b671828
|
[
"MIT"
] | null | null | null |
; ASM MiniLibC
; strchr
; arthur.delattre@epitech.eu
%ifndef __MINILIBC_STRCHR__
%define __MINILIBC_STRCHR__ __MINILIBC_STRCHR__
[BITS 64]
SECTION .text
global strchr:function
;; char *strchr(const char *s, int c);
strchr:
push r11
mov rax, rdi ; Move s into RAX so that we don't have to later
xor r11, r11
.check_char:
cmp byte [rax+r11], 0
je .check_eos ; If s[i] == 0, c was not found inside s
cmp byte [rax+r11], sil
je .found ; s[i] == c
inc r11
jmp .check_char
.check_eos:
cmp sil, 0h ; Maybe c == '\0', in which case NULL mustn't be returned
jne .not_found
add rax, r11
jmp .ret
.not_found:
xor rax, rax
jmp .ret
.found:
add rax, r11
jmp .ret
.ret:
pop r11
ret
%else
%warning "attempting to redeclare strchr"
%endif
| 15.75
| 71
| 0.689153
|
3540fc04c599ce6c9281ad584dbeb1d0db9feabe
| 1,171
|
asm
|
Assembly
|
bootloader/source/bootloader.asm
|
DotfileDev/veloxos
|
3f6e8fd6b1bf114d1575e576564adaad2225f3c1
|
[
"MIT"
] | null | null | null |
bootloader/source/bootloader.asm
|
DotfileDev/veloxos
|
3f6e8fd6b1bf114d1575e576564adaad2225f3c1
|
[
"MIT"
] | null | null | null |
bootloader/source/bootloader.asm
|
DotfileDev/veloxos
|
3f6e8fd6b1bf114d1575e576564adaad2225f3c1
|
[
"MIT"
] | null | null | null |
bits 16
org 0x7C00
%include "bootsector.asm"
load_kernel:
call enable_a20
cli
lgdt [gdt32_descriptor]
; Set PM (Protected Mode) bit in CR0.
mov eax, cr0
or eax, 1
mov cr0, eax
jmp 0x08:enter_protected_mode
align 4
bits 32
enter_protected_mode:
mov ax, 0x0010
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov esp, 0x7C00
lgdt [gdt64_descriptor]
call setup_paging
lea eax, [0xB8000]
mov [eax], dword 0x0F420F42
jmp 0x08:enter_long_mode
align 8
bits 64
enter_long_mode:
lea rax, [0xB8000]
mov rbx, 0x0F410F410F410F41
mov [rax], rbx
jmp $
; Here we'll jump to kernel someday :)
NULL equ 0x00
KERNEL_ADDRESS equ 0x00100000
%include "enable_a20.asm"
%include "global_descriptor_table.asm"
%include "paging.asm"
align 512, db 0x00
load_kernel_end:
| 19.516667
| 46
| 0.496157
|
e2c03267ed1e4a6c19c6ebe430ffe540b981648f
| 966
|
asm
|
Assembly
|
Student/examples/Correct/CPRL0/Correct_108.asm
|
SoftMoore/CPRL-Kt
|
c2dfdbd5b30ed6175f419398071e2f98e582d23a
|
[
"Unlicense"
] | 6
|
2021-02-02T10:08:02.000Z
|
2022-03-24T08:10:44.000Z
|
Student/examples/Correct/CPRL0/Correct_108.asm
|
SoftMoore/CPRL-Kt
|
c2dfdbd5b30ed6175f419398071e2f98e582d23a
|
[
"Unlicense"
] | 1
|
2021-02-27T21:55:26.000Z
|
2021-02-28T12:39:29.000Z
|
Student/examples/Correct/CPRL0/Correct_108.asm
|
SoftMoore/CPRL-Kt
|
c2dfdbd5b30ed6175f419398071e2f98e582d23a
|
[
"Unlicense"
] | 6
|
2020-02-24T13:51:32.000Z
|
2021-06-05T19:02:05.000Z
|
PROGRAM 10
LDCSTR "Enter value for n1: "
PUTSTR
LDGADDR 2
GETINT
STOREW
LDCSTR "Enter value for n2: "
PUTSTR
LDGADDR 6
GETINT
STOREW
LDCSTR "n1 = "
PUTSTR
LDGADDR 2
LOADW
PUTINT
LDCSTR "; n2 = "
PUTSTR
LDGADDR 6
LOADW
PUTINT
PUTEOL
LDGADDR 0
LDGADDR 2
LOADW
LDCINT 0
CMP
BZ L0
LDCB 1
BR L1
L0:
LDCB 0
L1:
STOREB
LDGADDR 1
LDGADDR 6
LOADW
LDCINT 0
CMP
BZ L2
LDCB 1
BR L3
L2:
LDCB 0
L3:
STOREB
LDCSTR "b1 and b2 = "
PUTSTR
LDGADDR 0
LOADB
BNZ L4
LDCB 0
BR L5
L4:
LDGADDR 1
LOADB
L5:
BZ L6
LDCSTR "true"
PUTSTR
PUTEOL
BR L7
L6:
LDCSTR "false"
PUTSTR
PUTEOL
L7:
LDCSTR "b1 or b2 = "
PUTSTR
LDGADDR 0
LOADB
BZ L8
LDCB 1
BR L9
L8:
LDGADDR 1
LOADB
L9:
BZ L10
LDCSTR "true"
PUTSTR
PUTEOL
BR L11
L10:
LDCSTR "false"
PUTSTR
PUTEOL
L11:
HALT
| 10.733333
| 33
| 0.557971
|
9cae26887cb92b72571a1f4cb14ff989930afeda
| 5,541
|
asm
|
Assembly
|
Transynther/x86/_processed/NONE/_ht_zr_un_/i3-7100_9_0x84_notsx.log_102_1738.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/NONE/_ht_zr_un_/i3-7100_9_0x84_notsx.log_102_1738.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/NONE/_ht_zr_un_/i3-7100_9_0x84_notsx.log_102_1738.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1129, %rdi
nop
nop
nop
nop
cmp $47910, %r10
movb (%rdi), %r13b
nop
nop
inc %r15
lea addresses_D_ht+0xeec9, %rbp
nop
nop
and %r13, %r13
movw $0x6162, (%rbp)
nop
nop
nop
sub %r10, %r10
lea addresses_normal_ht+0x7479, %rsi
lea addresses_WC_ht+0x19e79, %rdi
nop
nop
nop
nop
nop
add %r13, %r13
mov $21, %rcx
rep movsw
nop
nop
nop
nop
dec %r13
lea addresses_D_ht+0xae99, %r10
clflush (%r10)
nop
nop
nop
nop
nop
cmp $43890, %r15
movb $0x61, (%r10)
nop
nop
nop
nop
add $12924, %rdi
lea addresses_WT_ht+0x1a379, %r13
nop
nop
nop
nop
nop
add %rdi, %rdi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm1
movups %xmm1, (%r13)
sub $56250, %rsi
lea addresses_D_ht+0x13299, %rbp
nop
nop
nop
nop
nop
cmp %r13, %r13
movw $0x6162, (%rbp)
nop
and $44300, %r13
lea addresses_WC_ht+0xd1b7, %rsi
lea addresses_A_ht+0x722d, %rdi
nop
nop
and %r12, %r12
mov $49, %rcx
rep movsl
nop
nop
nop
add %rbp, %rbp
lea addresses_normal_ht+0xcb39, %rcx
nop
nop
nop
nop
cmp %r13, %r13
mov $0x6162636465666768, %rsi
movq %rsi, %xmm7
vmovups %ymm7, (%rcx)
nop
nop
nop
nop
nop
sub $62231, %rsi
lea addresses_D_ht+0x118f9, %rsi
lea addresses_WT_ht+0x7ddf, %rdi
nop
xor $28842, %r13
mov $9, %rcx
rep movsb
nop
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_D_ht+0x148d9, %rdi
nop
cmp %r13, %r13
mov $0x6162636465666768, %rcx
movq %rcx, (%rdi)
xor $9461, %rsi
lea addresses_normal_ht+0x12679, %rsi
lea addresses_WT_ht+0x14af9, %rdi
nop
sub $3939, %r12
mov $50, %rcx
rep movsw
nop
xor %r10, %r10
lea addresses_normal_ht+0x1e479, %rsi
nop
nop
nop
nop
nop
inc %r12
movups (%rsi), %xmm0
vpextrq $1, %xmm0, %r13
nop
sub %rcx, %rcx
lea addresses_D_ht+0x6b17, %rsi
lea addresses_WC_ht+0x7739, %rdi
nop
nop
nop
nop
nop
dec %rbp
mov $21, %rcx
rep movsb
nop
inc %rdi
lea addresses_A_ht+0xa79, %r15
nop
nop
nop
nop
nop
sub $34968, %rcx
mov (%r15), %r13d
nop
nop
nop
nop
nop
inc %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_normal+0x3479, %r14
nop
cmp %rsi, %rsi
mov $0x5152535455565758, %r8
movq %r8, %xmm5
movups %xmm5, (%r14)
nop
nop
cmp $17796, %r8
// REPMOV
lea addresses_US+0x1a803, %rsi
lea addresses_PSE+0x138b9, %rdi
nop
nop
sub $31737, %rbp
mov $30, %rcx
rep movsl
nop
nop
nop
nop
cmp %rdi, %rdi
// Faulty Load
lea addresses_A+0x6c79, %rbp
sub $30249, %rdi
movups (%rbp), %xmm1
vpextrq $0, %xmm1, %r10
lea oracles, %rbp
and $0xff, %r10
shlq $12, %r10
mov (%rbp,%r10,1), %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 16, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_US', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_PSE', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'same': True, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': True, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D_ht', 'same': True, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'28': 8, '00': 85, '48': 3, '47': 1, '44': 5}
00 00 00 00 00 00 00 44 00 44 00 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 28 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 28 00 00 44 00 48 00 00 00 00 00 00 00 00 00 00 00 00 28 00 44 00 00 00 28 00 00 47 00 00 00 28 00 00 00 28 00 00 00 00 00 00 00 28 00 44 00 00 00 00 00 00 00 00 00 48 00
*/
| 21.311538
| 305
| 0.65259
|
09b046ef45593419d77a60dbe1ec3288c9c81ba8
| 3,769
|
asm
|
Assembly
|
Windows/FastContains16.asm
|
clayne/FastExtrema
|
9d38cdcd095f7ea07e94c9690b79bcd9ac1228b3
|
[
"MIT"
] | 6
|
2021-04-02T16:09:13.000Z
|
2022-01-24T11:15:48.000Z
|
Windows/FastContains16.asm
|
komrad36/FastArrayOps
|
9d38cdcd095f7ea07e94c9690b79bcd9ac1228b3
|
[
"MIT"
] | null | null | null |
Windows/FastContains16.asm
|
komrad36/FastArrayOps
|
9d38cdcd095f7ea07e94c9690b79bcd9ac1228b3
|
[
"MIT"
] | 1
|
2021-02-17T21:51:17.000Z
|
2021-02-17T21:51:17.000Z
|
; /*******************************************************************
; *
; * Author: Kareem Omar
; * kareem.h.omar@gmail.com
; * https://github.com/komrad36
; *
; * Last updated Mar 12, 2021
; *******************************************************************/
_TEXT$FastContains16 SEGMENT ALIGN(64)
FastContains16 PROC
vmovd xmm0,r8d
vpbroadcastw ymm0,xmm0
cmp rdx,127
ja CASE_LARGE
vpxor xmm1,xmm1,xmm1
lea r9,JUMP_TABLE
movzx eax,word ptr [r9+2*rdx]
add r9,rax
mov eax,edx
lea rdx,[rcx+2*rdx]
and al,-16
lea rcx,[rcx+2*rax]
mov r10b,1
jmp r9
db 27 DUP (0CCh)
JUMP_TABLE:
dw 1 DUP ( CASE_0 - JUMP_TABLE)
dw 1 DUP ( CASE_1 - JUMP_TABLE)
dw 1 DUP ( CASE_2 - JUMP_TABLE)
dw 1 DUP ( CASE_3 - JUMP_TABLE)
dw 4 DUP ( CASE_4 - JUMP_TABLE)
dw 8 DUP ( CASE_8 - JUMP_TABLE)
dw 16 DUP ( CASE_16 - JUMP_TABLE)
dw 16 DUP ( CASE_32 - JUMP_TABLE)
dw 16 DUP ( CASE_48 - JUMP_TABLE)
dw 16 DUP ( CASE_64 - JUMP_TABLE)
dw 16 DUP ( CASE_80 - JUMP_TABLE)
dw 16 DUP ( CASE_96 - JUMP_TABLE)
dw 16 DUP (CASE_112 - JUMP_TABLE)
CASE_112:
vpcmpeqw ymm1,ymm0,ymmword ptr [rcx-224]
CASE_96:
vpcmpeqw ymm2,ymm0,ymmword ptr [rcx-192]
vpor ymm1,ymm1,ymm2
CASE_80:
vpcmpeqw ymm2,ymm0,ymmword ptr [rcx-160]
vpor ymm1,ymm1,ymm2
CASE_64:
vpcmpeqw ymm2,ymm0,ymmword ptr [rcx-128]
vpor ymm1,ymm1,ymm2
CASE_48:
vpcmpeqw ymm2,ymm0,ymmword ptr [rcx-96]
vpor ymm1,ymm1,ymm2
CASE_32:
vpcmpeqw ymm2,ymm0,ymmword ptr [rcx-64]
vpor ymm1,ymm1,ymm2
CASE_16:
vpcmpeqw ymm2,ymm0,ymmword ptr [rcx-32]
vpor ymm1,ymm1,ymm2
vpcmpeqw ymm2,ymm0,ymmword ptr [rdx-32]
vpor ymm1,ymm1,ymm2
vptest ymm1,ymm1
setnz al
ret
CASE_8:
vpcmpeqw xmm1,xmm0,xmmword ptr [rcx]
vpcmpeqw xmm2,xmm0,xmmword ptr [rdx-16]
vpor xmm1,xmm1,xmm2
vptest xmm1,xmm1
setnz al
ret
CASE_4:
vpbroadcastq xmm1,qword ptr [rcx]
vpcmpeqw xmm1,xmm0,xmm1
vpbroadcastq xmm2,qword ptr [rdx-8]
vpcmpeqw xmm2,xmm0,xmm2
vpor xmm1,xmm1,xmm2
vptest xmm1,xmm1
setnz al
ret
CASE_3:
cmp r8w,word ptr [rdx-6]
sete al
CASE_2:
cmp r8w,word ptr [rdx-4]
cmove eax,r10d
CASE_1:
cmp r8w,word ptr [rdx-2]
cmove eax,r10d
CASE_0:
ret
CASE_LARGE:
lea rdx,[rcx+2*rdx]
add rcx,256
LOOP_TOP:
vpcmpeqw ymm1,ymm0,ymmword ptr [rcx-256]
vpcmpeqw ymm2,ymm0,ymmword ptr [rcx-224]
vpor ymm1,ymm1,ymm2
vpcmpeqw ymm3,ymm0,ymmword ptr [rcx-192]
vpcmpeqw ymm4,ymm0,ymmword ptr [rcx-160]
vpor ymm3,ymm3,ymm4
vpor ymm1,ymm1,ymm3
vpcmpeqw ymm2,ymm0,ymmword ptr [rcx-128]
vpcmpeqw ymm3,ymm0,ymmword ptr [rcx-96]
vpor ymm2,ymm2,ymm3
vpcmpeqw ymm4,ymm0,ymmword ptr [rcx-64]
vpcmpeqw ymm5,ymm0,ymmword ptr [rcx-32]
vpor ymm4,ymm4,ymm5
vpor ymm2,ymm2,ymm4
vpor ymm1,ymm1,ymm2
vptest ymm1,ymm1
jnz FOUND
add rcx,256
cmp rcx,rdx
jb LOOP_TOP
vpcmpeqw ymm1,ymm0,ymmword ptr [rdx-256]
vpcmpeqw ymm2,ymm0,ymmword ptr [rdx-224]
vpor ymm1,ymm1,ymm2
vpcmpeqw ymm3,ymm0,ymmword ptr [rdx-192]
vpcmpeqw ymm4,ymm0,ymmword ptr [rdx-160]
vpor ymm3,ymm3,ymm4
vpor ymm1,ymm1,ymm3
vpcmpeqw ymm2,ymm0,ymmword ptr [rdx-128]
vpcmpeqw ymm3,ymm0,ymmword ptr [rdx-96]
vpor ymm2,ymm2,ymm3
vpcmpeqw ymm4,ymm0,ymmword ptr [rdx-64]
vpcmpeqw ymm5,ymm0,ymmword ptr [rdx-32]
vpor ymm4,ymm4,ymm5
vpor ymm2,ymm2,ymm4
vpor ymm1,ymm1,ymm2
vptest ymm1,ymm1
FOUND:
setnz al
ret
FastContains16 ENDP
_TEXT$FastContains16 ENDS
END
| 25.815068
| 70
| 0.611568
|
2d25e39682de2ed3f518d45a4d27421ac6f3c5e7
| 574
|
asm
|
Assembly
|
src/test/ref/preprocessor-17.asm
|
jbrandwood/kickc
|
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
|
[
"MIT"
] | 2
|
2022-03-01T02:21:14.000Z
|
2022-03-01T04:33:35.000Z
|
src/test/ref/preprocessor-17.asm
|
jbrandwood/kickc
|
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
|
[
"MIT"
] | null | null | null |
src/test/ref/preprocessor-17.asm
|
jbrandwood/kickc
|
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
|
[
"MIT"
] | null | null | null |
// Demonstrates a problem where a preprocessor macro with parameters name is used without any call parenthesis.
// Commodore 64 PRG executable file
.file [name="preprocessor-17.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.segment Code
main: {
.label SCREEN = $400
// SCREEN[0] = CLEAR
lda #$7f
sta SCREEN
// SCREEN[1] = CLEAR
lda #0
sta SCREEN+1
// }
rts
}
| 26.090909
| 111
| 0.681185
|
b53f0dbd54391db366fbe33bb627ad991d755d82
| 1,732
|
asm
|
Assembly
|
Engine Hacks/DragonVeins/asm/Dragon Vein Usability.asm
|
sme23/MekkahRestrictedHackComp1
|
1cc9d2fec557424f358b6bfa21f9f3bb6faf2978
|
[
"CC0-1.0"
] | 3
|
2020-06-15T14:22:38.000Z
|
2020-06-28T19:44:52.000Z
|
Wizardry/SmeHax/TrapRework/Modules/DragonVeins/asm/DragonVeinUsability.s
|
sme23/WhatHeck
|
746a2be83358aaa4e855182176b47c4808f2587a
|
[
"CC0-1.0"
] | null | null | null |
Wizardry/SmeHax/TrapRework/Modules/DragonVeins/asm/DragonVeinUsability.s
|
sme23/WhatHeck
|
746a2be83358aaa4e855182176b47c4808f2587a
|
[
"CC0-1.0"
] | null | null | null |
.thumb
.equ SkillTester, DVTrapID+4
.equ DragonsBloodID, SkillTester+4
push {r14}
ldr r0, CurrentUnit @Active unit
ldr r2,[r0]
@ ldr r0,[r2]
@ ldr r1,[r2,#0x4]
@ ldr r0,[r0,#0x28] @Skills
@ ldr r1,[r1,#0x28]
@ orr r0,r1
@ mov r1,#0x20
@ lsl r1, #0x8
@ and r0,r1 @Lord skill
@ cmp r0,#0x0
@check for DragonsBlood skill
ldr r0, SkillTester
mov lr, r0
mov r0, r2
ldr r1, DragonsBloodID
.short 0xF800
cmp r0, #0
beq retFalse @No
ldr r0, CurrentUnit @Active unit
ldr r2,[r0]
ldr r0,[r2,#0xC] @Turn status
mov r1,#0x60 @0x60 - being rescued, has moved
and r0,r1
cmp r0,#0x0
bne retFalse @No
@080248E8 480A ldr r0,=#0x202BCB0 @Something about current/selected unit data? Map state? Skirmish?
@080248EA 303D add r0,#0x3D
@080248EC 7801 ldrb r1,[r0]
@080248EE 2008 mov r0,#0x8
@080248F0 4008 and r0,r1
@080248F2 2800 cmp r0,#0x0
@080248F4 D110 bne #0x8024918
mov r0,#0x10 @X
ldsb r0,[r2,r0]
mov r1,#0x11 @Y
ldsb r1,[r2,r1]
ldr r3, GetTrap @Gets the (first) trap that is on the same XY as this unit.
bl goto_r3
@mov lr, r3
@.short 0xF800 @bl lr
cmp r0,#0x0
beq retFalse @If no trap
ldrb r0,[r0,#0x2] @trap type
ldr r1, DVTrapID
cmp r0,r1 @DV
bne retFalse @
mov r0,#0x1
b end
.align
CurrentUnit:
.long 0x03004E50
GetTrap:
.long 0x0802E1F1
retFalse:
mov r0,#0x3
end:
pop {r3}
goto_r3:
bx r3
.align
.ltorg
DVTrapID:
@WORD DVTrapID
@POIN SkillTester
@WORD DragonsBloodID
| 22.789474
| 110
| 0.564088
|
db931309cddb958760bc1d66090f0e2d40650371
| 510
|
asm
|
Assembly
|
Tests/TestLineData.asm
|
ped7g/EliteNext
|
6e930f9b9924b295d7281ee6acb879600d7e597f
|
[
"Unlicense"
] | 9
|
2021-09-29T22:08:15.000Z
|
2022-03-23T05:35:43.000Z
|
Tests/TestLineData.asm
|
ped7g/EliteNext
|
6e930f9b9924b295d7281ee6acb879600d7e597f
|
[
"Unlicense"
] | 1
|
2022-01-21T12:35:42.000Z
|
2022-01-21T17:47:24.000Z
|
Tests/TestLineData.asm
|
ped7g/EliteNext
|
6e930f9b9924b295d7281ee6acb879600d7e597f
|
[
"Unlicense"
] | 1
|
2022-01-15T10:13:49.000Z
|
2022-01-15T10:13:49.000Z
|
TestLineData DB 20,20,30,30,23,25,54,65,23,34,56,76,34,12,64,56,23,65,34,14,65,37,75,57
TestClip:
ld hl,$0020
ld (UBnkX1),hl
ld hl,$0030
ld (UBnkY1),hl
ld hl,$0250
ld (UBnkX2),hl
ld hl,$0060
ld (UBnkY2),hl
TESTBFR:
ld a,$50
ld (varQ),a
ld a,$30
call BFRDIV
call CLIP
ld bc,(UBnkPoint1Clipped)
ld de,(UBnkPoint2Clipped)
ld a,$FF
MMUSelectLayer2
call l2_draw_any_line ; call version of LOIN that used BCDE
ret
| 19.615385
| 88
| 0.584314
|
ee411a4d5ea1d24eb5ebdb6ffe1a2923cc6b4a6f
| 295
|
asm
|
Assembly
|
programs/oeis/047/A047469.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/047/A047469.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/047/A047469.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A047469: Numbers that are congruent to {0, 1, 2} mod 8.
; 0,1,2,8,9,10,16,17,18,24,25,26,32,33,34,40,41,42,48,49,50,56,57,58,64,65,66,72,73,74,80,81,82,88,89,90,96,97,98,104,105,106,112,113,114,120,121,122,128,129,130,136,137,138,144,145,146,152,153,154
mov $1,$0
div $1,3
mul $1,5
add $0,$1
| 36.875
| 197
| 0.661017
|
3a06e04e4efd87085965633eca81c2b6976a199e
| 349
|
asm
|
Assembly
|
programs/oeis/089/A089410.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | 1
|
2021-03-15T11:38:20.000Z
|
2021-03-15T11:38:20.000Z
|
programs/oeis/089/A089410.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
programs/oeis/089/A089410.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
; A089410: Least common multiple of all cycle sizes (also the maximum cycle size) in range [A014137(n-1)..A014138(n-1)] of permutation A074679/A074680.
; 1,1,2,5,14,18,22,26,30,34,38,42,46,50,54,58,62,66,70,74,78
mov $1,$0
sub $1,1
mov $2,$0
add $0,$1
trn $2,1
add $1,$2
lpb $0
trn $0,3
add $0,$2
sub $1,$1
add $2,$0
lpe
add $1,$0
add $1,1
| 19.388889
| 151
| 0.633238
|
9a93d0b4c8b97b518090f85bf6036b119d6b678c
| 556
|
asm
|
Assembly
|
oeis/001/A001954.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/001/A001954.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/001/A001954.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A001954: a(n) = floor((n+1/2)*(2+sqrt(2))); winning positions in the 2-Wythoff game.
; 1,5,8,11,15,18,22,25,29,32,35,39,42,46,49,52,56,59,63,66,69,73,76,80,83,87,90,93,97,100,104,107,110,114,117,121,124,128,131,134,138,141,145,148,151,155,158,162,165,169,172,175,179,182,186,189,192,196,199,203,206,209,213,216,220,223,227,230,233,237,240,244,247,250,254,257,261,264,268,271,274,278,281,285,288,291,295,298,302,305,308,312,315,319,322,326,329,332,336,339
mov $2,$0
seq $0,1953 ; a(n) = floor((n + 1/2) * sqrt(2)).
add $0,$2
add $3,$2
add $0,$3
add $0,1
| 55.6
| 369
| 0.669065
|
1daab93dcddc993e224e1e868a2d9d10052316db
| 2,604
|
asm
|
Assembly
|
programs/oeis/100/A100160.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | null | null | null |
programs/oeis/100/A100160.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | null | null | null |
programs/oeis/100/A100160.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | null | null | null |
; A100160: Structured disdyakis triacontahedral numbers (vertex structure 5).
; 1,62,299,828,1765,3226,5327,8184,11913,16630,22451,29492,37869,47698,59095,72176,87057,103854,122683,143660,166901,192522,220639,251368,284825,321126,360387,402724,448253,497090,549351,605152,664609,727838,794955,866076,941317,1020794,1104623,1192920,1285801,1383382,1485779,1593108,1705485,1823026,1945847,2074064,2207793,2347150,2492251,2643212,2800149,2963178,3132415,3307976,3489977,3678534,3873763,4075780,4284701,4500642,4723719,4954048,5191745,5436926,5689707,5950204,6218533,6494810,6779151,7071672,7372489,7681718,7999475,8325876,8661037,9005074,9358103,9720240,10091601,10472302,10862459,11262188,11671605,12090826,12519967,12959144,13408473,13868070,14338051,14818532,15309629,15811458,16324135,16847776,17382497,17928414,18485643,19054300,19634501,20226362,20829999,21445528,22073065,22712726,23364627,24028884,24705613,25394930,26096951,26811792,27539569,28280398,29034395,29801676,30582357,31376554,32184383,33005960,33841401,34690822,35554339,36432068,37324125,38230626,39151687,40087424,41037953,42003390,42983851,43979452,44990309,46016538,47058255,48115576,49188617,50277494,51382323,52503220,53640301,54793682,55963479,57149808,58352785,59572526,60809147,62062764,63333493,64621450,65926751,67249512,68589849,69947878,71323715,72717476,74129277,75559234,77007463,78474080,79959201,81462942,82985419,84526748,86087045,87666426,89265007,90882904,92520233,94177110,95853651,97549972,99266189,101002418,102758775,104535376,106332337,108149774,109987803,111846540,113726101,115626602,117548159,119490888,121454905,123440326,125447267,127475844,129526173,131598370,133692551,135808832,137947329,140108158,142291435,144497276,146725797,148977114,151251343,153548600,155869001,158212662,160579699,162970228,165384365,167822226,170283927,172769584,175279313,177813230,180371451,182954092,185561269,188193098,190849695,193531176,196237657,198969254,201726083,204508260,207315901,210149122,213008039,215892768,218803425,221740126,224702987,227692124,230707653,233749690,236818351,239913752,243036009,246185238,249361555,252565076,255795917,259054194,262340023,265653520,268994801,272363982,275761179,279186508,282640085,286122026,289632447,293171464,296739193,300335750
mov $1,$0
mov $2,$0
mov $7,$0
lpb $2,1
add $1,11
mov $3,0
add $3,$0
add $0,$2
add $1,$3
sub $2,1
lpe
add $1,1
mov $5,$7
mov $8,$7
lpb $5,1
sub $5,1
add $6,$8
lpe
mov $4,29
mov $8,$6
lpb $4,1
add $1,$8
sub $4,1
lpe
mov $5,$7
mov $6,0
lpb $5,1
sub $5,1
add $6,$8
lpe
mov $4,19
mov $8,$6
lpb $4,1
add $1,$8
sub $4,1
lpe
| 65.1
| 2,179
| 0.831413
|
085df3eb66eb123c62b8e4fe4f2eac360d4ba08f
| 712
|
asm
|
Assembly
|
oeis/160/A160295.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/160/A160295.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/160/A160295.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A160295: Numerator of Hermite(n, 17/30).
; Submitted by Christian Krause
; 1,17,-161,-18037,-89279,30948857,727008319,-71202772477,-3500523336959,196821084188897,17523077945895199,-587802553769818117,-96731879246268143039,1529691843170459400137,591886254924566446580479,425007721743735371005043,-3988007089471180013111147519,-70856176117564954894125817423,29303699240455922867100139624159,1072097913640026823383121494737003,-232320963974017684516193128376030399,-13598337610318542047223376635025543783,1964261370179051903875227660358053026239
add $0,1
mov $3,1
lpb $0
sub $0,1
add $3,$1
add $2,$3
mov $3,$1
mov $1,$2
mul $2,8
add $1,$2
mul $3,-25
mul $3,$0
mul $3,2
lpe
mov $0,$1
div $0,9
| 33.904762
| 469
| 0.797753
|
f226eb1f95394c9225a2f9a48c6080554774650c
| 602
|
asm
|
Assembly
|
oeis/088/A088732.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/088/A088732.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/088/A088732.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A088732: First prime in the arithmetic progression n+k*(n+1) with k>0.
; Submitted by Jon Maiga
; 2,3,5,7,19,11,13,23,17,19,43,23,103,41,29,31,67,53,37,59,41,43,137,47,149,103,53,83,173,59,61,127,131,67,139,71,73,113,233,79,163,83,257,131,89,137,281,191,97,149,101,103,211,107,109,167,113,173,353,179,487,433,251,127,389,131,401,271,137,139,283,359,1021,443,149,151,307,233,157,239,647,163,331,167,509,257,173,263,1423,179,181,367,557,281,379,191,193,293,197,199
mov $2,$0
seq $0,196660 ; Smallest k>0 such that k*n+(n-1) is prime.
add $2,1
add $3,$0
add $3,2
mul $3,$2
sub $3,$2
mov $0,$3
sub $0,1
| 43
| 366
| 0.69103
|
039916b9bba3de85c1f46e1ee40ad121dea482a2
| 499
|
asm
|
Assembly
|
libsrc/stdio_new/file/stream-out/stdio_outbuff.asm
|
andydansby/z88dk-mk2
|
51c15f1387293809c496f5eaf7b196f8a0e9b66b
|
[
"ClArtistic"
] | 1
|
2020-09-15T08:35:49.000Z
|
2020-09-15T08:35:49.000Z
|
libsrc/stdio_new/file/stream-out/stdio_outbuff.asm
|
andydansby/z88dk-MK2
|
51c15f1387293809c496f5eaf7b196f8a0e9b66b
|
[
"ClArtistic"
] | null | null | null |
libsrc/stdio_new/file/stream-out/stdio_outbuff.asm
|
andydansby/z88dk-MK2
|
51c15f1387293809c496f5eaf7b196f8a0e9b66b
|
[
"ClArtistic"
] | null | null | null |
; stdio_outbuff
; 05.2008 aralbrec
XLIB stdio_outbuff
LIB stdio_outchar
; output string of chars to file / device from temporary buffer
;
; enter : b = number of chars from buffer to output
; hl = & buffer - 1
; ix = & attached file / device output function
; exit : carry set if error on stream, ERRNO set appropriately
; uses : af, b, hl, exx
.stdio_outbuff
ld a,b
or a
ret z
.loop
inc hl
ld a,(hl)
call stdio_outchar
ret c
djnz loop
ret
| 16.633333
| 63
| 0.641283
|
e5577cc0178c358d709a5da84d1126c799a4a5eb
| 168,551
|
asm
|
Assembly
|
src/kernel/wdosx.asm
|
amindlost/wdosx
|
1e256d22c1547e7b1f1ccd23e400f5b81b8bd013
|
[
"Unlicense"
] | 7
|
2022-01-20T08:27:54.000Z
|
2022-03-17T10:15:31.000Z
|
src/kernel/wdosx.asm
|
amindlost/wdosx
|
1e256d22c1547e7b1f1ccd23e400f5b81b8bd013
|
[
"Unlicense"
] | null | null | null |
src/kernel/wdosx.asm
|
amindlost/wdosx
|
1e256d22c1547e7b1f1ccd23e400f5b81b8bd013
|
[
"Unlicense"
] | null | null | null |
; ############################################################################
; ## WDOSX DOS Extender Copyright (c) 1996, 2002, Michael Tippach ##
; ## ##
; ## Released under the terms of the WDOSX license agreement. ##
; ############################################################################
;
; $Header: E:/RCS/WDOSX/0.95/SRC/KERNEL/wdosx.asm 1.41 2003/04/16 02:46:07 MikeT Exp MikeT $
;
; ----------------------------------------------------------------------------
;
; $Log: wdosx.asm $
; Revision 1.41 2003/04/16 02:46:07 MikeT
; Fix bug when reading WFSE files bigger than 4MB.
;
; Revision 1.40 2002/02/05 20:07:13 MikeT
; Dymdns URL now pointing to some valid place on the Internet.
;
; Revision 1.39 2002/01/31 21:09:38 MikeT
; Updated copuright and 0.97 version number.
;
; Revision 1.38 2001/02/22 22:15:26 MikeT
; Wdosx-Depack upgraded. The whole kernel is now compressed as one block.
;
; Revision 1.37 2001/02/21 21:29:10 MikeT
; Updated year in copyright one more time, added one more email address.
;
; Revision 1.36 2001/02/21 21:24:56 MikeT
; Callbacks under NT now fixed for good (I hope). Actually, this is a rather
; a workaround for an NTVDM bug.
;
; Revision 1.35 2001/02/04 15:50:00 MikeT
; Fix spawn problem under Windows where the application crashes when the child
; returns. Technical: Save and restore PM- interrupt vectors around the spawn
; call in int 21h function 4B.
;
; Revision 1.34 2000/07/12 16:33:54 MikeT
; Implemented a temporary fix to make the mouse callback work under NT. NTVDM
; has a bug in that only the SI and DI portions of ESI and EDI are valid when
; a DPMI callback procedure is entered. The final solution would fix this in
; the callback redirector instead of the mouse hook.
;
; Revision 1.33 2000/06/30 16:08:33 MikeT
; Sign extend esi and edi on the mouse callback (thks Jim Hutchinson).
;
; Revision 1.32 2000/04/11 17:53:01 MikeT
; Updated copyright in (c) string.
;
; Revision 1.31 2000/04/11 17:50:22 MikeT
; Add a thing that is supposed to fix a problem with callbacks in NTVDM (would
; ignore high word of target EIP). Not tested yet.
;
; Revision 1.30 2000/02/29 23:51:24 MikeT
; Clear the high word of ESP on entry into PM in RAW (non- V86) mode. The VCPI
; mode switch routine has been clearing the high word of ESP ever since. This
; is supposed to fix a problem where the system would crash on a real mode
; callback if the real mode code (for whatever reason) makes use of ESP 31:16
;
; Revision 1.29 2000/02/27 12:53:08 MikeT
; If an application decides to go resident, what we generally do not support,
; HIMEM.SYS would disable the A20 on every EXEC call, making installed
; callback handlers and IRQ autopassup go ballistic. Implemented sort of a
; means to frequently check and conditionally re-enable A20, which makes it
; work somewhat better but there are still problems.
;
; Revision 1.28 2000/01/30 18:39:15 MikeT
; File open mode set back to compatibility mode. Implemented a means to
; temporarily close the EXE normally held open by WFSE. Use the WFSE Alternate
; function call with an empty string to close the EXE. Re- open with the EXE
; file name as input argument to WFSE Alternate.
;
; Revision 1.27 1999/12/12 18:46:27 MikeT
; Implemented INT 1Ch autopassup. File open mode for program file is deny write
; now (as opposed to compatibility mode before). We'll do some testing and see
; whether this has any negative side effects or not.
;
; Revision 1.26 1999/11/17 21:27:57 MikeT
; Implement workaround for a DJGPP "thing": When CTRL+C or CTRL+BRK is pressed,
; the DJGPP run time alters the DS (and SS) segment limit of the main program.
; This caused a stack fault (and consequently a triple fault) when kernel code
; attempted to dwitch back to the application's stack in order to IRETD from a
; hardware interrupt or the like.
;
; We now check the validity of the application's stack first and if it turns
; out to have been tampered with, we generate kind of a "software-stackfault".
;
; Revision 1.25 1999/11/11 22:15:51 MikeT
; Fixed a bug where DPMI functions 204 and 205 would not work correctly with
; int numbers 10 thru 1Fh. The index into the table of shadowed handlers was
; off by 128 bytes.
;
; Revision 1.24 1999/06/20 16:10:20 MikeT
; Numerous changes:
;
;
;
; 1. Implemented Joergen Ibsen's WDOSX - DEPACK decompressor as the default
; one. Old LZ77 compressed WFSE attachments are still supported, so there
; should be no problem when re-stubbing existing executables with this
; version. Also, Wudebug should work with compressed executables of either
; kind.
;
; 2. Implemented a means to restrict the internal DPMI host from grabbing all
; the memory in the system. This allowes spawning child programs which need
; some extended memory themselfs. The maximum amount of pages that the DPMI
; host will allocate is defined in WdosxInfo.XMemAlloc and the mechanism
; should work with all types of memory allocation (INT 15, XMS, VCPI).
;
; 3. Save all general purpose registers when calling a real mode IRQ handler.
; This is because some buggy DOS drivers and SCSI BIOSes trash the high
; portion of registers in their IRQ handlers.
;
; 4. I think that was it...
;
; Revision 1.23 1999/05/27 22:56:33 MikeT
; Fixed INT 21/4B00h to always copy the trailing 0Dh, 00h, even if the
; command tail is otherwise empty.
;
; Revision 1.22 1999/02/17 22:11:45 MikeT
; Some changes to not only make it assemble with TASM 5.0 but to also
; produce identical binary results compared with these obtained with
; TASM 3.1.
;
; Revision 1.21 1999/02/16 23:25:41 MikeT
; Fix for the fix for the fix... Well, what happened was, that if we've got
; only XMS 2 and the E801 check was being done, we would not have taken into
; consideration that an XMS 2 manager does not intercept E801. Therfore, the
; memory below 16MB ended up beeing allocated twice, with all kinds of
; interesting crashes as a result. Also, the XMS3 check has been corrected
; so as to not rely on BL being nonzero for the Caldera DOS workaround.
; We only consider the XMS manager being Caldera's buggy one if the return
; code is exactly 80h (unsupported function). The reason for this change was
; that according to the XMS 3 spec. any XMS 3 manager has to return 0A0h in
; BL if all extended memory has been allocated.
;
; Revision 1.20 1999/02/13 14:07:47 MikeT
; Let INT 21 function FFFF check the caller's CS. If it doesn't match the
; initial application code segment, return an error. This allowes us to
; remove INT 21 FFFF blocking code from the true flat model executable
; loaders.
;
; Revision 1.19 1999/02/13 13:50:41 MikeT
; Updated year in EEFF copyright string.
;
; Revision 1.18 1999/02/08 23:26:49 MikeT
; If XMS version is < 3, call INT 15 E801 anyway to allow above 64M
; also on newer computers running older DOSes.
; This needs some more testing, though.
;
; Revision 1.17 1999/02/07 17:35:29 MikeT
; Updated copyright + some cosmetics. No code changes.
;
; Revision 1.16 1999/02/06 16:23:57 MikeT
; Make wdxinfo.inc local.
;
; Revision 1.15 1999/02/06 15:13:18 MikeT
; Pulled in code includes.
;
; Revision 1.14 1999/01/10 16:31:57 MikeT
; Increase the amount of DPMI memory handles from 128 to 512. That
; should let get us rid of complaints WRT available handles for good.
;
; Revision 1.13 1999/01/06 00:31:05 MikeT
; Implemented workaround for the Caldera DOS HIMEM.SYS screwup.
;
; Revision 1.12 1998/12/08 02:11:44 MikeT
; If there is a DPMI host in real mode, it usually had claimed all
; available memory anyway. Therefore, we have to negotiate.
; Fixes "Insufficient extended memory" error with 32rtm resident.
;
; Revision 1.11 1998/11/18 23:04:29 MikeT
; Some code cleanup, no change in the binary result.
;
; Revision 1.10 1998/11/18 21:10:59 MikeT
; Function EEFF now correctly returns 0 in CH if in raw (BIOS) mode.
;
; Revision 1.9 1998/10/28 00:10:51 MikeT
; Implemented INT 2F function 1686 as the braindamaged bgivga.dll of
; Borland fame is actually calling it. Why calling this function from
; within 32 bit PM is pointless should be obvious and is otherwise left
; as an exercise to the reader.
;
; Revision 1.8 1998/10/25 14:40:40 MikeT
; Fixed XMS memory size calculation bug. Workaround for a common BIOS bug
; where int 15/E801 would not reflect an extended memory hole correctly.
;
; Revision 1.7 1998/10/10 15:02:59 MikeT
; Permanently enable the 2GB check as this is the maximum memory size we can
; handle anyway.
;
; Revision 1.6 1998/10/07 20:04:17 MikeT
; Partially rewrote DPMI function 501/502/503h. This fixes a bug with
; DPMI memory allocation/deallocation.
;
; Revision 1.5 1998/09/25 00:31:31 MikeT
; Reset DTA after child program has finished. This fixes the problem
; where FindFirst/ FindNext would not work anymore after int21h 4Bh had
; been called.
;
; Revision 1.4 1998/09/12 23:13:19 MikeT
; Some corrections WRT the free XMS memory calculation when using XMS 3.0
;
; Revision 1.3 1998/09/12 18:13:31 MikeT
; First implementation of above 64MB support. Using XMS 3.0 and
; INT 15h E801h now to gather big memory information. Subject to
; further testing on as much as possible platforms before it can
; be released.
;
; Revision 1.2 1998/09/12 17:10:55 MikeT
; Change CPUID level 1 call to not expect level 0 return < 256 in EAX
; The reason for this is that I've already learned that nowadays
; BIT 31 is used to obtain extended capabilities and we don't want to
; break the extender just because of a stupid thing like this do we?
;
; Revision 1.1 1998/08/03 01:59:29 MikeT
; Initial check in
;
;
; ----------------------------------------------------------------------------
; ############################################################################
; ## File: wdosx.asm - DOS extender kernel code ##
; ############################################################################
; Uncommenting this line unconditionally produces the Watcom - variant
;__WATCOM__ = 1
include wdxinfo.inc
MajorVersion = 0
MinorVersion = 97
;
; Maximum DPMI memory blocks
; 8 bytes per block, maximum is (8k- 1) - sizeof WDOSX / 8
; The reason for chosing 512 is that this is in the range of what most DPMI
; hosts support and it makes no sense whatsoever to allow for considerably more
; handles in here.
;
MAX_MEM_HANDLES EQU 512
;
; Maximum Wfse - FCBs (each uses 16 bytes additional memory)
;
MAX_WFSE_FCBS EQU 20
;
; Pre - VCS Revision history:
; ---------------------------
;
; [96/06/10] Wuschel:
;
; complete rewrite started. Goals are size optimization, some exception
; handling, DPMI- support, "cleaner" code, more stuff...
;
; [96/07/02] Wuschel:
;
; added INT32-API
;
; [96/07/22] Wuschel:
;
; added INT21H API, supported so far: 09H/3CH/3DH/3FH/40H
; will add more as I need it.
;
; [96/08/02] Wuschel:
;
; moved INT32/0000 to INT21/FFFF, INT32API died (r.i.p.:)
;
; V 0.9 released!!!
;
; [96/08/14] Wuschel:
;
; BUG, BUG! : 21/FFFF did not set carry on error (not enough mem) - fixed
; Some jumps "hand- shorted", saved 40 bytes!
; Not enough memory for flatmode overlay error message is now
; "error loading flatmode overlay" rather than "dpmi error"
;
; [96/09/14] Wuschel:
;
; Yet another Bug fixed: 21/40 now returns bytes written correctly
;
; [96/09/17] Wuschel:
;
; More functions added to INT 21 API. (39, 3A, 3B, 41, 43, 5B)
; Fixed 2 Bugs in translation services - Aaaarrgggghhh!!!
; WDOSX now supports callbacks :)
;
; [96/10/06] Wuschel:
;
; Major bugfix. Crashes because of stack reentrancy while hardware
; interrupts occur the same time a mode switch for a software interrupt
; processing is in progress. Still no idea why this could happen when
; ints are disabled...
;
; [96/12/05] Wuschel:
;
; Some minor changes in DPMI.INC
; - 31/0500 not filling the entire buffer - fixed
; - Get/Set/Reset VI did reset the carry flag - fixed
;
; Uninitialized variables are zeroed out right at startup
;
; [97/01/21] Wuschel:
;
; Added support for INT 31/0202 and 0203 - get/set exception handler
; They do work to some extent but the stack has to be intact...
;
; [97/01/31] Wuschel:
;
; Call to INT 21/62 now returns a selector rather than a segment
;
; [97/02/15] Wuschel:
;
; Certain issues fixed with 21/FFFF memory leaks
;
; [97/03/15] Wuschel:
;
; Fixed 31/500h to return the exact amount of free memory
;
; [97/03/18] Wuschel:
;
; Fixed int 21/56 swapping ebx and edi
;
; [97/04/02]
;
; Added support for more extended DOS functions
; Includes sucked in so we have only one source file for WDOSX.DX
;
; [97/04/16] Wuschel:
;
; Added support for exceptions 10h - 1fh
;
; [97/04/27] Wuschel:
;
; What made me think 31/90x shouldn't reset the carry flag?
;
; [97/05/28] Wuschel:
;
; Added Extended 21/4b00h
;
; [97/09/03] Wuschel:
;
; Fixed find first/next copying more than 2ch bytes up/down
;
; [97/10/14] Wuschel:
;
; Fixed find next returning CF set on success/ CF clear on error
;
; [97/11/05] Wuschel:
;
; Completely rewrote int 31/0800 and 0801 due to public demand. It's now
; possible to map insane amounts of address space such as 256 or even 512
; megabytes at the cost of 4k DOS memory / 4Mb address space - have a nice
; mapping time!
;
; [97/11/06] Wuschel:
;
; When looking back at all the change descriptions to this file I must admit
; that I recorded only every other change (on average) up here. Finally, who
; cares, considering that this sourcecode isn't to be released ever...
;
; [97/11/06] Wuschel:
;
; And while we're at it: just a minor thingy fixed with int 31 / 070x. Not that
; anyone cares, though...
;
; [97/11/10] Wuschel:
;
; Long delay during cleanup under VCPI. Reason was that the address space
; above 2g was included into the cleanup check.
;
; [98/01/17] Wuschel:
;
; Added support for WdoxInfo structure, changed the way we access unitialized
; data (no runtime implication either)
;
; [98/02/17] Wuschel:
;
; Made the maximum number of DPMI memory handles one can have allocated at a
; time a parameter controlled by a single EQUate (MAX_MEM_HANDLES). Up to 256
; are possible, 128 should be sufficient.
;
; [98/02/22] Wuschel:
;
; First implementation of WFSE.
;
; [98/02/27] Wuschel:
;
; Implemented workaround for an NT bug: free the allocated callback on exit.
;
; [98/03/01] Wuschel:
;
; Updated copyright.
;
; [98/03/08] Wuschel:
;
; Fix 32/0006 succeeding on a zero selector.
;
; [98/03/17] Wuschel:
;
; When running under RAW/XMS, include HMA into page tables. This solves some
; problems with DJGPP.
;
; [98/03/20] Wuschel:
; Start implementing the decompressor.
;
; [98/04/05] Wuschel:
; Decompressor (first shot) implemented. Supports:
; - load time decopression of the kernel itself
; - run time decompression of WFSE images
; Fixed bug where wfseSeek would return an error when there actually was none.
;
; [98/04/14] Wuschel:
; Clear high wor of EAX before chaining into the old handler for int21h/40h
; ecx = 0 (truncate file)
;
; [98/07/10] Wuschel:
; Moved copyright string into non-compresable area.
;
;------------------------------------------------------------------------------
;... so here we go:
;
; GDT selectors (Used in RAW/XMS/VCPI mode only)
;
dosx_sel_code16 EQU 0800h
dosx_sel_data16 EQU 0808h
dosx_sel_tss EQU 0810h
dosx_sel_data0 EQU 0818h ; use32 4g
dosx_sel_bigdos EQU 0820h ; use16 big
dosx_selector1 EQU 0830h
dosx_selector_vcpi1 EQU dosx_selector1
dosx_selector_vcpi2 EQU dosx_selector1 + 8
dosx_selector_vcpi3 EQU dosx_selector1 + 16
dosx_sel_psp EQU dosx_selector1 + 24
dosx_sel_env EQU dosx_selector1 + 32
dosx_sel_start EQU 282*8 ; first one for user program
dosx_sel_end EQU 512*8 ; last one + 1
dosx_gdtsize EQU 512 * 8
dosx_idtsize EQU 256 * 8
dosx_tsssize EQU 104
.386p
stacksize EQU 2048
dosx_intstacksize EQU 1024
;
; PUSHAD- stackframe and DPMI realmode call structure:
;
s struc
_edi LABEL DWORD
_di dw ?
dw ?
_esi LABEL DWORD
_si dw ?
dw ?
_ebp LABEL DWORD
_bp dw ?
dw ?
_esp LABEL DWORD
_spl dw ?
dw ?
_ebx LABEL DWORD
_bx LABEL WORD
_bl db ?
_bh db ?
dw ?
_edx LABEL DWORD
_dx LABEL WORD
_dl db ?
_dh db ?
dw ?
_ecx LABEL DWORD
_cx LABEL WORD
_cl db ?
_ch db ?
dw ?
_eax LABEL DWORD
_ax LABEL WORD
_al db ?
_ah db ?
dw ?
_oldesp LABEL DWORD
;
; appendix for realmode call structure
;
_flags dw ?
_es dw ?
_oldss LABEL WORD
_ds dw ?
_fs dw ?
_gs dw ?
_ip dw ?
_cs dw ?
_sp dw ?
_ss dw ?
s ends
dosx_int31strucsize EQU (OFFSET _ss - OFFSET _edi) + 2
;------------------------------------------------------------------------------
; start of mixed rm and 16 bit pm- code + datasegment
;------------------------------------------------------------------------------
code16 segment para public use16 'code'
ASSUME cs:code16, ds:code16
dosx_maxintstack EQU OFFSET dosx_stack
dosx_dosmemory EQU OFFSET ((dosx_top_of_memory-OFFSET dosx_startsegment)+15)/16
;-----------------------------------------------------------------------------
; This label indicates the start of the segment and MUST BE at offset 0!
;
dosx_startsegment LABEL NEAR
;- 0.95 - Insert WdosX info structure (MUST be the first thing) --------------
WdosxInfo WdxInfo <>
;-----------------------------------------------------------------------------
; Anything that cannot be compressed such as the decompressor itself goes
; between here and the "start:" label. The decopressed size is calculated at
; assembly time.
;
dosx_thats_me db 'WDOSX ', MajorVersion+30h, '.'
db (MinorVersion/10)+30h
db MinorVersion-((MinorVersion/10)*10)+30h
db ' DOS extender Copyright (c) 1996-2002 Michael Tippach', 0dh, 0ah
db '<mtippach@gmx.net> http://wdosx.homeip.net/', 0dh, 0ah, 0
;**************************************************************************
;* WDOSX-Depack v1.07 Copyright (c) 1999-2001 by Joergen Ibsen / Jibz *
;* All Rights Reserved *
;* *
;* For data and executable compression software: http://apack.cjb.net/ *
;* jibz@hotmail.com *
;**************************************************************************
;
; In: DS:SI -> source data
; ES:DI -> dest. buffer
; BX -> number of bytes to decompress
;
; Out: DS:SI -> next byte in input stream
;
; Destroys flags including DF and all general purpose registers except BP
;
WdosxDepack PROC NEAR
push bp
cld
mov dl, 80h
add bx, di
literal:
movsb
mov dh, 80h ; lastwasmatch = 0
nexttagbit:
cmp di, bx ; test for EOD
jnc DecompDone ;
call getbit
jnc literal
mov ax, 1
mov cx, ax ; get length
more_cx: ;
call getbit ;
adc cx, cx ;
call getbit ;
jc more_cx ;
more_axh: ; get high part of position
call getbit ;
adc ax, ax ;
call getbit ;
jc more_axh ;
add dh, dh ; check lastwasmatch (and clear dh)
sbb ax, 2 ; same position as last match?
jc lastpos ;
or ax, 0400h ; get 6 low bits of position
more_axl: ;
call getbit ;
adc ax, ax ;
jnc more_axl ;
inc ax
cmp ax, 1921
sbb cx, -1
mov bp, ax
lastpos:
mov ax, bp
push si ; copy match
mov si, di ;
sub si, ax ;
rep movsb ;
pop si ;
jmp short nexttagbit
getbit:
add dl, dl ; get a bit from tagbyte
jnz bitsleft ;
mov dl, [si] ;
inc si ;
adc dl, dl ;
bitsleft:
ret
DecompDone:
pop bp
ret
WdosxDepack ENDP
;-----------------------------------------------------------------------------
wdosx_decompress:
;
; Move the compressed data up in memory. Actually, we move more than that as
; we don't know the size of the compressed data.
;
push cs
pop ds
push ds
pop es
mov si, OFFSET dosx_endsegment - 1
mov di, OFFSET dosx_endsegment + 4095 + 4096
std
mov cx, OFFSET dosx_endsegment - OFFSET start
rep movsb
xchg di, si
inc si
inc di
mov bx, (OFFSET dosx_endsegment - OFFSET start)
call WdosxDepack
retn
;-----------------------------------------------------------------------------
; Alternate program entry point
;
; The compressor will move the entry point in the executable header 3 bytes
; down so we would start right here if the executable was compressed.
;
call wdosx_decompress
; --------------------------> Program entry point <---------------------------
; Some 1 - 2k after this point must not contain run time code as this area
; is reused for temporary data storage during run time.
;
start:
; push cs
; pop ds
mov ah, 62h
int 21h
mov es, bx ; the decompressor might have
; killed es
mov ax, bx
mov bx, cs ; get code16
;
; Patch modeswitches, there must be no fixups left in the EXE header.
;
mov ds: dosx_patch1, bx
mov ds: dosx_patch2, bx
mov ds: dosx_patch3, bx
sub bx, ax ; get psp size
;
; Set memory block
;
add bx, dosx_dosmemory
mov ah, 4Ah
int 21h
jnc SHORT dosx_no_memerror
lea dx, dosx_msg_nomem
jmp dosx_exit_raw
dosx_no_memerror:
mov sp, OFFSET dosx_top_of_memory
;
;- 0.94 ------- set dta ------------------------------------------------------
;
mov ah, 1Ah
mov dx, OFFSET dosx_dta
int 21h
;
;- 0.93 ------- zero out uninitialized variables -----------------------------
;
push es
push cs
pop es
cld
sub ax, ax
mov cx, OFFSET dosx_stackbegin
mov di, OFFSET variables
sub cx, di
shr cx, 1
rep stosw
pop es
mov dosx_pspseg, es
mov es, es:[2Ch]
mov dosx_envseg, es
;-------------- detect if at least 386 CPU ------------------------------------
; We throw out the 8086 detection. It did not work at all since the 8086 does
; not support the "push immediate" in the first place. The final reason why I
; throw this out is that the decompressor itself won't run on an 8086 so we'll
; never get here anyway. Bottom line: If there is this moron running a program
; like this on an 8068 they probably deserve it when we fsck up big time.
;
; pushf ; save flags
; mov bx, 0f000h ; bx = cpu - info
; push 0 ; check for 8086/88
; popf ; bits 12- 15 cannot be cleared
; pushf
; pop ax
; and ah, bh
; cmp ah, bh
; ... blah, blah, blah....
;
; Quick check for NOT 286 instead.
;
pushf
push 0F000h
popf ; bits 12- 15 always clear on 286
pushf
pop ax
popf
and ah, 0F0h
jnz SHORT dosx_is386
lea dx, dosx_msg_wrongcpu ; the "BUY A COMPUTER!"- one
jmp dosx_exit_raw
;
; O.K. to use 386 ops from now on
;
dosx_is386:
mov cl, 3 ; set to 386
mov dosx_mode, 0 ; init mode
pushfd ; save flags
mov esi, 200000h ; check for CPUID
call dosx_toggle
jnz SHORT dosx_has_cpuid
dosx_no_cpuid:
shr esi, 7
call dosx_toggle
jz SHORT dosx_cpu_done ; no AC-support->is 386
inc cl ; else is 486
jmp SHORT dosx_cpu_done
dosx_has_cpuid:
sub eax, eax
db 0Fh, 0A2h ; CPUID
IFDEF PARANOID
test eax, eax
jz SHORT dosx_no_cpuid
ENDIF
mov eax, 1
db 0Fh, 0A2h ; CPUID
and ah, 0Fh ; only family of interest
mov cl, ah ; override cpu type
dosx_cpu_done:
popfd
mov dosx_cpu_type, cl
;-------------- CPU detection complete, now check some DOS stuff -------------
;
; Scan for program name + path
;
sub di, di
sub ax, ax
mov cx, 0FFFFh
cld
dosx_nextenv:
repne scasb
jcxz dosx_envbad
scasb
jne SHORT dosx_nextenv
inc ax
scasw
mov al, ah
jne SHORT dosx_nextenv
;
; es:di is pointing to program file now
;
push ds
push es
pop ds
mov dx, di
mov ax, 3d00h
int 21h
pop ds
jnc SHORT dosx_gethandle
dosx_openerr:
lea dx, dosx_msg_openerr
jmp dosx_exitmsg
dosx_envbad:
;
; dunno, will this ever happen?
;
lea dx, dosx_msg_envbad
jmp dosx_exitmsg
dosx_gethandle:
;
; overwrite startup code
;
mov bx, ax
mov dosx_fhandle, ax
mov dx, OFFSET start
mov cx, 10 ; read .EXE size
mov ah, 3Fh
int 21h
cmp ax, cx
jnz SHORT dosx_openerr
;
; get physical file size
;
mov ax, 4202h
sub cx, cx
sub dx, dx
int 21h
jc SHORT dosx_openerr
shrd edi, eax, 16
shrd edi, edx, 16
;
; Calculate start of overlay
;
movzx eax, WORD PTR ds:[2+OFFSET start]
movzx edx, WORD PTR ds:[4+OFFSET start]
neg ax
and ax, 1FFh
shl edx, 9
sub edx, eax
;
; Calculate overlay size
;
sub edi, edx
jz SHORT dosx_openerr ; no overlay
shld ecx, edx, 16
mov ax, 4200h
int 21h
jc SHORT dosx_openerr
;
; the DOS file pointer is now set to start of OVL data
;
;
; This check has been removed in order to make it work with 32rtm loaded
;
; smsw ax
; test al, 1
; jz SHORT dosx_makedpmi
;
;-------------- Check if DPMI- host installed ---------------------------------
;
mov dosx_PMSys_EEFF, 3 ; 0.94
mov ax, 1687h
int 2Fh
test ax, ax
jz dosx_havedpmi
dosx_makedpmi:
mov dosx_PMSys_EEFF, 0 ; 0.94
;
;-------------- create a very simple DPMI-host --------------------------------
;
protmode_used EQU 80h
vcpi_used EQU 2
xms_used EQU 1
is_tsr EQU 4
a20_used EQU 8
ints_hooked EQU 40h
pic1_used EQU 20h
pages_allocated EQU 10h
;
; Store default gdt+ idt
;
sidt dosx_rm_idt
sgdt dosx_rm_gdt
;
;-------------- XAM the machine -----------------------------------------------
;
smsw ax ; get low cr0
test al, 1 ; PE?
jz SHORT dosx_is_rm
dosx_check_vcpi:
mov dosx_PMSys_EEFF, 2 ; 0.94
mov ax, 3567h ; check if handler installed
int 21h
mov ax, es
or ax, bx
jnz SHORT dosx_have_int67
dosx_noidea:
lea dx, dosx_msg_nomode
jmp dosx_exitmsg
dosx_have_int67:
mov ax, 0DE00h
int 67h
or ah, ah
jnz SHORT dosx_noidea
;
;-------------- We have a VCPI server installed -------------------------------
;
or dosx_mode, vcpi_used+protmode_used
dosx_is_rm:
;
;-------------- Check for XMS- driver -----------------------------------------
;
; Check if already been here
;
test dosx_mode, xms_used
jnz dosx_mode_bios
mov ax, 4300h
int 2Fh
cmp al, 80h
jnz dosx_mode_bios
;
;-------------- XMS installed -------------------------------------------------
;
; Get driver entry point
;
mov ax, 4310h
int 2Fh
mov WORD PTR [OFFSET dosx_himem], bx
mov WORD PTR [OFFSET dosx_himem + 2], es
or dosx_mode, xms_used
;
; Better to grab the mem right now so we wouldn't have to store a huge amount
; of XMS- handles. Get largest mem area out there...
;
mov eax, 800h
call dosx_xms3
call DWORD PTR [dosx_himem]
test eax, eax
jz SHORT dosx_mode_bios
;
; Check against the XMemAlloc parameter so as to not allocate more memory than
; necessary.
;
mov edx, WdosxInfo.XMemAlloc
shl edx, 2 ; to kb
cmp edx, eax
jnc SHORT sizeNotTooBig
mov eax, edx
sizeNotTooBig:
mov edx, eax
push eax ; need it for adjust to page boundary
;
; Allocate the mem (hopefully not allocated by an interrupt handler inbetween)
; disable interrupts if you use this to control nuclear facilities :)
;
mov ah, 9
call dosx_xms3
call DWORD PTR [dosx_himem]
mov dosx_xmshandle, dx
;
; For we speek of linear addresses here, this is not entirely correct.
; Actually we are dealing with PHYSICAL adresses in this place!
; Anyway, Wuschel ist too lazy to change this for you, flames welcome! :)
; lock mem + get linear address
;
mov ah, 0Ch
call DWORD PTR [dosx_himem]
shrd eax, edx, 16
mov ax, bx ; eax=linear start of block
pop edx ; Get size of block
shl edx, 10 ; Kb to bytes
add edx, eax ; EDX = end of block
add eax, 0FFFh ; Adjust start of block to
and ax, 0F000h ; page boundary.
sub edx, eax ; EDX = adjusted size
shr edx, 12 ; To pages
mov dosx_xmssize, edx ; store size in pages
mov dosx_linear_start, eax ; store linear start of xms
smsw ax
and al, 1
inc ax
mov dosx_PMSys_EEFF, al ; 0.94
cmp al, 1
jnz dosx_check_vcpi
dosx_mode_bios:
;
; Preload cx with the maximum ext mem size. This will be adjusted by E801 or
; maybe not. The reason why we're doing this is that extended memory functions
; are badly broken in many BIOSes as soon as an extended memory hole is
; enabled. The AMI BIOS on the machine I'm writing this on, for instance, will
; still return 3C00h in ax and cx even though there is a memory hole at 15MB.
;
mov cx, -1
;
; If XMS used and XMS version is < 3, then memory above 64MB should be
; untouched so we call E801 anyway. We do, however need to adjust the
; allocation base to 65MB instead of 16MB.
;
test dosx_mode, (xms_used OR vcpi_used)
jz safeToDoE801
test dosx_mode, xms_used
jz useLegacyInt15
mov ah, 8
call dosx_xms3
cmp ah, 8
jnz useLegacyInt15
;
; Now we know that we're on XMS 2 or less. Yet we have to adjust the alloc
; base.
;
mov dosx_E801start, 4100000h ; start at 65MB
safeToDoE801:
;
; Check E801h first and use legacy function as a fall trough
;
mov ax, 0E801h
int 15h
jc SHORT useLegacyInt15
mov ax, cx ; memory below 16k
mov esi, dosx_E801start
sub esi, 1000000h
shr esi, 12 ; to pages
movzx edx, dx
shl edx, 4 ; to pages
sub edx, esi
jna useLegacyInt15
mov dosx_E801size, edx
;
; Perform sanity check in case the BIOS fucked up on a memory hole. Most of
; the time, the return value of function 88h will be correct, though.
;
; jmp SHORT fromInt15
useLegacyInt15:
mov ah, 88h
int 15h
cmp ax, cx
jna fromInt15
mov ax, cx
fromInt15:
;
; We don't need no stinkin' error checking...
;
shr ax, 2 ; get pages
mov dosx_extsize, ax ; save size in pages
;
; No further adjust since the physical start using INT15 top down is 1MB or N/A
; though int15 should give AX=0 at least if HMA is in use. Hook int15 anyway,
; it doesn't hurt!
;
; Hook all hardware int + int 15, 1C, 21, 23, 24
;
cli
;
; Save all interruptvectors
;
push cs
pop es
cld
mov cx, 256
sub si, si
mov ds, si
mov di, OFFSET dosx_intvectors
rep movs DWORD PTR es:[di], ds:[si]
;
; A copy of the old irq- vectors goes into the chain handler table.
;
mov si, 8 * 4
mov cl, 8
mov di, OFFSET dosx_oldirqs
rep movs DWORD PTR es:[di], ds:[si]
mov si, 70h * 4
mov cl, 8
rep movs DWORD PTR es:[di], ds:[si]
;
; Now hook into irqs.
;
mov ax, cs
mov es, cx
mov cl, 8
mov di, 8 * 4
shl eax, 16
mov ax, OFFSET dosx_start_irqs
dosx_setirqloop1:
stos DWORD PTR es:[di]
add ax, 4
loop dosx_setirqloop1
mov cl, 8
mov di, 70h * 4
dosx_setirqloop2:
stos DWORD PTR es:[di]
add ax, 4
loop dosx_setirqloop2
mov di, 15h * 4
mov ax, OFFSET dosx_new15
stos DWORD PTR es:[di]
mov di, 1Ch * 4
mov ax, OFFSET dosx_new1C
stos DWORD PTR es:[di]
mov di, 21h * 4
mov ax, OFFSET dosx_new21
stos DWORD PTR es:[di]
mov di, 23h * 4
mov ax, OFFSET dosx_new23
stos DWORD PTR es:[di]
mov ax, OFFSET dosx_new24
stos DWORD PTR es:[di]
dosx_old15vec EQU DWORD PTR [OFFSET dosx_intvectors + 4 * 15h]
dosx_old1Cvec EQU DWORD PTR [OFFSET dosx_intvectors + 4 * 1Ch]
dosx_old21vec EQU DWORD PTR [OFFSET dosx_intvectors + 4 * 21h]
dosx_old23vec EQU DWORD PTR [OFFSET dosx_intvectors + 4 * 23h]
dosx_old24vec EQU DWORD PTR [OFFSET dosx_intvectors + 4 * 24h]
push cs
pop ds
or dosx_mode, ints_hooked
;
;----------------------------- enable A20 -----------------------------------
;
cli
call dosx_testa20
jnz SHORT dosx_a20_enabled
;
; Hmm... this one is for qemm (refuses A20 enable when HMA is not in use by
; trapping port accesses)
;
test dosx_mode, xms_used
jz SHORT dosx_qemma20
mov ah, 5
call DWORD PTR [dosx_himem]
dosx_qemma20:
or dosx_mode, a20_used
call dosx_testa20
jnz SHORT dosx_a20_enabled
in al, 92h
or al, 2
out 92h, al
;
; Newer chipsets have a rather long delay opening the A20 through the port 92h
; The danger here is that we end up dealing with the keyboard controller even
; though the port 92 would have worked. Considering that it's unlikely to have
; fatal consequences, we leave it this way.
;
call dosx_testa20
jnz SHORT dosx_a20_enabled
call dosx_wait8042
mov al, 0D1h
out 64h, al
call dosx_wait8042
mov al, 0FFh
out 60h, al
call dosx_wait8042
mov al, 0FFh
out 64h, al
call dosx_wait8042
call dosx_testa20
jnz SHORT dosx_a20_enabled
;
; No idea now...
;
lea dx, dosx_msg_a20
jmp dosx_exitmsg
dosx_a20_enabled:
sti
;
; Allocate page directory + 1st page. Get memory block.
;
mov bx, 3 * 256
mov ah, 48h
int 21h
jnc SHORT dosx_gottablemem
lea dx, dosx_msg_nomem
jmp dosx_exitmsg
dosx_gottablemem:
;
; Get the mem page aligned.
;
mov bx, ax
mov es, ax
mov dosx_tableblock, ax
neg bl
mov bh, 2
mov ah, 4Ah
int 21h
;
; Unaligned mem is wasted.
;
mov ax, es
add ax, 0FFh
sub al, al
mov es, ax
movzx eax, ax
;
; Store adress in page directory[0]
;
sub di, di
mov ebx, eax
inc ah
shl eax, 4
mov al, 7
stosd
shl ebx, 4
mov dosx_cr3_base, ebx
;
; Zero out pagedirectory + first page
;
sub eax, eax
mov cx, 2046 - 1024
rep stosw
mov al, 7
;
; Preset the remaining entries for use by int 31h function 800h.
;
dosx_set31800loop:
stos DWORD PTR es:[di]
add eax, 1000h
inc cl
jnz SHORT dosx_set31800loop
sub ax, ax
mov cx, 512 + 2048
rep stosw
;
; Prepare to fill
;
mov di, 4096
test dosx_mode, vcpi_used
jnz SHORT dosx_de01
mov dosx_raw2rm, OFFSET dosx_prot2rm
mov dosx_raw2pm, OFFSET dosx_rm2prot
;
; Realmode fill goes from 0 to 1 Meg.
; 0.95: we inlude the HMA as some sick software really scans the HMA from
; within protected mode.
;
sub eax, eax
mov al, 7
mov cx, 256 + 16
dosx_fillfirsttableloop:
stos DWORD PTR es:[di]
add eax, 1000h
loop dosx_fillfirsttableloop
jmp SHORT dosx_pagesdone
dosx_de01:
mov dosx_raw2rm, OFFSET dosx_prot2v86
mov dosx_raw2pm, OFFSET dosx_v862prot
mov si, OFFSET dosx_gdt + dosx_selector_vcpi1
mov ax, 0DE01h
int 67h
mov dosx_vcpiOFFSET, ebx
mov dosx_vcpisel, dosx_selector_vcpi1
dosx_pagesdone:
;
;-------------- IDT setup -----------------------------------------------------
;
; INTEL vs. IBM :(
; First 16 interrupts are exceptions (IOW don't call the printscreen handler
; as INT 05 from pm)
;
push cs
pop es
mov di, OFFSET dosx_idt
mov edx, 8E00h ; type = interrupt gate
mov eax, 80000h
mov ebx, eax
mov cl, 16
mov ax, OFFSET dosx_hnd_exception
call dosx_storeidt
;
; (V 0.93) set #1 and #3 to trap gate
;
mov BYTE PTR ds:[OFFSET dosx_idt + 8+5], 8Fh
mov BYTE PTR ds:[OFFSET dosx_idt + 3*8+5], 8Fh
;
; WDOSX 0.94 supports exceptions 10h - 1Fh
;
mov cl, 16
mov ax, OFFSET dosx_hnd_10to1F
call dosx_storeidt
;
; Now 224 interrupts (patch INT 31H later)
;
mov cl, 224
mov ax, OFFSET dosx_hnd_interrupt
call dosx_storeidt
;
; Now patch int31
;
mov WORD PTR ds:[OFFSET dosx_idt + 8 * 31h], OFFSET dosx_int31
;
; WDOSX 0.94: Initialize Interrupt table for interrupts 10..1F
;
mov ax, OFFSET dosx_hnd_interrupt
mov dx, 88h ; first cs: selector
mov si, OFFSET dosx_int10to1F
mov cx, 16
dosx_highExc:
mov [si], ax
mov [si + 4], dx
add si, 8
add dx, 8
loop SHORT dosx_highExc
;
; Prepare for IDT fixup.
;
mov bx, 8
mov cx, 70h
test dosx_mode, vcpi_used
jz SHORT dosx_nopicfixup
mov ax, 0DE0Ah
int 67h
dosx_nopicfixup:
mov dosx_pic1map, bl
mov dosx_pic2map, cl
push cx
shl bx, 3
lea si, [bx+OFFSET dosx_idt]
mov di, OFFSET dosx_pic1backup
push si
mov cl, 8
;
; Get old "non-irqs"
;
dosx_picloop1:
lods DWORD PTR ds:[si]
add si, 4
stosw
stos DWORD PTR es:[di]
mov WORD PTR [di-4], 0
mov WORD PTR [di], 0
add di, 2
loop dosx_picloop1
mov edx, 8E00h ; type = interrupt gate
mov eax, 80000h * 8 + OFFSET dosx_hnd_checkpic1
mov ebx, 80000h
pop di
mov cl, 8
call dosx_storeidt
pop bx
shl bx, 3
lea si, [bx+OFFSET dosx_idt]
mov di, OFFSET dosx_pic2backup
push si
mov cl, 8
dosx_picloop2:
lods DWORD PTR ds:[si]
add si, 4
stosw
stos DWORD PTR es:[di]
mov WORD PTR [di-4], 0
mov WORD PTR [di], 0
add di, 2
loop dosx_picloop2
mov eax, 80000h * 16 + OFFSET dosx_hnd_checkpic2
mov ebx, 80000h
pop di
mov cl, 8
call dosx_storeidt
;
; Now initialize default irq handlers.
;
mov cl, 16
mov eax, OFFSET dosx_hnd_irq + 80000h * 8
mov di, OFFSET dosx_pmirqtab
dosx_picloop3:
stosw
stos DWORD PTR es:[di]
mov WORD PTR [di-4], 0
mov WORD PTR [di], 0
add di, 2
add eax, ebx
loop dosx_picloop3
;
; Set up VCPI switch structure (even w/o VCPI it doesn't hurt)
;
mov eax, OFFSET dosx_v862prot1
mov dosx_pm_selector, dosx_sel_code16
mov dosx_pm_offset, eax
mov dosx_gdtr_linear, OFFSET dosx_gdtr
mov dosx_idtr_linear, OFFSET dosx_idtr
mov dosx_v86struc, OFFSET dosx_cr3_base
mov dosx_tr_dummy, dosx_sel_tss
mov dosx_ldt_dummy, 0
;
;-------------- IDT setup now complete, build GDT ----------------------------
;
; selectors 1 up to 257 are base code16 use16, limit 64k BYTE granularity....
;
mov di, OFFSET dosx_gdt + 8
sub dx, dx
sub eax, eax
mov ax, cs
sub ebx, ebx
shld edx, eax, 20
shl eax, 20
mov dh, 9Eh
dec ax ; limit = 0ffffh
mov cx, 257
call dosx_storeidt ; abuse of idtloopproc
;
; Adjust the last one to be a data descriptor instead.
;
mov BYTE PTR [di - 3], 92h
;
; TSS - descriptor:
;
add eax, LARGE (OFFSET dosx_dummytss - OFFSET dosx_startsegment) * 10000h - 0fffffh + dosx_tsssize -1
adc dx, 8900h - 9E00h
stosd
mov [di], edx
;
; Huge 4g use32 data base 0. 2DO: check whether this one's still used.
;
mov DWORD PTR [di + 4], 0FFFFh
mov DWORD PTR [di + 8], 0CF9200h
;
; Another huge one use16
;
mov DWORD PTR [di + 12], 0FFFFh
mov DWORD PTR [di + 16], 8F9200h
;
; Next one is unused so far
;
; Skip vcpi descriptors, create psp- descritor.
;
movzx eax, dosx_pspseg
mov es, ax
shl eax, 4
add eax, 92000000h
mov WORD PTR [di + 52], 0FFh
mov DWORD PTR [di + 54], eax
;
; 0.93 make it accessible by DPMI calls. 2DO: this seems unnecessary now...
;
mov WORD PTR [di + 58], 10h
;
; Create environment- descritor
;
movzx eax, WORD PTR es:[2Ch]
mov WORD PTR es:[2Ch], dosx_sel_env
shl eax, 4
add eax, 92000000h
mov WORD PTR [di + 60], 0FFFFh
mov DWORD PTR [di + 62], eax
;
; 0.93 as above. Again, this is most likely obsolete...
;
mov WORD PTR [di + 66], 10h
;
;------------------------------------------------------------------------------
;
; Now set some pointers.
;
mov WORD PTR [OFFSET dosx_gdtr], dosx_gdtsize - 1
mov WORD PTR [OFFSET dosx_idtr], dosx_idtsize - 1
sub eax, eax
mov ax, cs
shl eax, 4
;
; Fixup linear adresses
;
add dosx_gdtr_linear, eax
add dosx_idtr_linear, eax
add dosx_v86struc, eax
;
; Store values to load into gdtr, idtr
;
add eax, LARGE OFFSET dosx_gdt
mov DWORD PTR [OFFSET dosx_gdtr + 2], eax
add eax, LARGE (OFFSET dosx_idt - OFFSET dosx_gdt)
mov DWORD PTR [OFFSET dosx_idtr + 2], eax
call WORD PTR [dosx_raw2pm]
;
; Now we are either crashed or in 16:16 PM.
; Build huge linear block until no more pages avail.
; Make sure we can access all the memory.
;
sti
mov ax, dosx_sel_data0
mov es, ax
;
; esi ^ pagedirectory
;
mov esi, dosx_cr3_base
add si, 4 ; index second entry
;
; now the sequence is: - get page for pagetable
; - update pagedir
; - zero out pagetable
; - 1024 times get page, store in pagetable
; - loop
; abort anytime if no more pages available
;
dosx_next_page_table:
call dosx_getpage
jc SHORT dosx_malloc_done
mov es:[esi], edx
;
; Use last page table entry in first page table as scratchpad to access
; the page table itself.
;
call dosx_set_edi
;
; edi ^first entry in pagetable
;
add esi, 4
mov ecx, 1024
dosx_next_page_entry:
call dosx_getpage
jc SHORT dosx_zero_out
inc DWORD PTR ds:[OFFSET dosx_memavail]
;
; When running that thing on an 8GB machine (I did), we don't want to crash...
;
cmp DWORD PTR ds:[OFFSET dosx_memavail], 80000h
jnc SHORT dosx_malloc_done
mov es:[edi], edx
add edi, 4
loop SHORT dosx_next_page_entry
jmp SHORT dosx_next_page_table
dosx_zero_out:
sub eax, eax
rep stos DWORD PTR es:[edi]
dosx_malloc_done:
;
; Clear the TLB
;
mov eax, cr3
mov cr3, eax
push ds
pop es
;
; Initialize MCB area to not used
;
mov cx, MAX_MEM_HANDLES * 4
mov di, OFFSET dosx_mcb
sub ax, ax
rep stosw
;
; Set ES according to dpmi spec, leave fs, gs initialized
;
mov ax, dosx_sel_psp
mov es, ax
;
; Now that we can sucessfully pretend to be a DPMI host, jump to the point
; where we don't care anymore about how we did the mode switch.
;
cli
jmp SHORT dosx_welcomepm
;
; Here we go if there was a DPMI- host already hanging around
;
dosx_havedpmi:
test bl, 1 ; is host 32 bit?
; jnz SHORT dosx_host_is32
jz dosx_makedpmi ; If not, pray that we have
; other means to get into PM
; lea dx, dosx_msg_dpmi16
; jmp SHORT dosx_exitmsg
;dosx_host_is32:
;
; Store entry point
;
mov WORD PTR [OFFSET dosx_dpmi], di
mov WORD PTR [OFFSET dosx_dpmi+2], es
;
; Do we need memory?
;
test si, si
jz SHORT dosx_modeswitch
;
; Grab some if yes.
;
mov bx, si
mov ah, 48h
int 21h
jnc SHORT dosx_modeswitch
lea dx, dosx_msg_nomem
jmp SHORT dosx_exitmsg
dosx_modeswitch:
mov es, ax
mov ax, 1
call DWORD PTR [dosx_dpmi]
jnc SHORT dosx_welcomepm
lea dx, dosx_msg_dpmierr
jmp SHORT dosx_exitmsg
;
; Everything from the START label up to this point could be used as rm- stack!
; (startup code that we don't need anymore)
;
ALIGN WORD
dosx_dpmierror:
;
; Called if dpmi-host returns carry during startup. At this point we cannot
; make the assumption that our extended API has been initialized.
;
lea dx, dosx_msg_dpmi
dosx_pm_error:
mov ds, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
push ds
pop es
mov edi, OFFSET dosx_int31struc
mov _ah[di], 9
mov ax, dosx_patch1
mov _ds[di], ax
mov _dx[di], dx
sub cx, cx
mov bl, 21h
mov ax, 300h
int 31h
mov ax, 4CFFh
int 21h
dosx_exitmsg:
push dx
call dosx_killdpmi
pop dx
dosx_exit_raw:
push cs
pop ds
mov ah, 9
int 21h
mov ax, 4CFFh
int 21h
;
; Now in pm, if there was no DPMI- host installed, the makedpmi- "function"
; will jmp right here.
;
dosx_welcomepm:
;- 0.94 ------- initialize DTA to PSP to stay compatible with 0.93 ------------
mov DWORD PTR ds:[OFFSET dosx_dta_offset], 80h
mov WORD PTR ds:[OFFSET dosx_dta_selector], es
;
; Initialize int31 callback structure
;
mov ax, ds
mov ss, ax
mov sp, OFFSET dosx_top_of_memory
mov ax, dosx_patch1
mov WORD PTR dosx_int31struc._ss, ax
mov WORD PTR dosx_int31struc._sp, \
((OFFSET dosx_dpmierror \
- OFFSET dosx_startsegment \
- 4) / 4) * 4
mov WORD PTR dosx_int31struc._flags, 0
;
; Enable VI
;
mov ax, 0901h
int 31h
mov dosx_flat_sel_data16, ds
mov dosx_pspsel, es
;
; Set default exception handlers
;
mov cx, cs
mov edx, OFFSET Exc0To15
sub bx, bx
E0to15Loop:
mov ax, 0203h
int 31h
inc bx
add dx, 6
cmp bl, 16
jne SHORT EndOfExLoop
mov dx, OFFSET Exc16To32
EndOfExLoop:
cmp bl, 32
jne E0to15Loop
;
; Get int 21 handler NOW, otherwise DPMI call 100 etc would crash
;
mov bl, 21h
mov ax, 204h
int 31h
jc dosx_dpmierror
mov dosx_old21_sel, cx
mov dosx_old21_ofs, edx
;
; Save old int 31h vector
;
mov bl, 31h
mov ax, 204h
int 31h
jc dosx_dpmierror
mov dosx_old31_sel, cx
mov dosx_old31_ofs, edx
;
; Hook int 31 for identification call
;
mov cx, cs
mov edx, OFFSET dosx_hook31
inc ax
int 31h
jc dosx_dpmierror
;
; Save old int 33h vector
;
mov bl, 33h
dec ax
int 31h
jc dosx_dpmierror
mov dosx_old33sel, cx
mov dosx_old33ofs, edx
;
; Hook int 33 for extended mouse API
;
mov cx, cs
mov edx, OFFSET dosx_new_int33
inc ax
int 31h
jc dosx_dpmierror
;
; Allocate callback for ext. mouse function
;
push es
push ds
pop es
push ds
push cs
pop ds
mov esi, OFFSET dosx_int33callback
mov edi, OFFSET dosx_int33struc
mov ax, 303h
int 31h
jc dosx_dpmierror
pop ds
mov dosx_mouse_rmcallback_ofs, dx
mov dosx_mouse_rmcallback_seg, cx
pop es
; allocate transfer buffer
mov bx, 400h ; 16k to allocate
mov ax, 100h
int 31h
jc dosx_dpmierror
;
; Returns: AX base, DX selector
; Store base in int31 struc
;
mov dosx_flat_sel_dos, dx
mov dosx_flat_seg_dos, ax
mov dosx_int31struc._ds, ax
mov dosx_int31struc._es, ax
;
; Allocate code and data descriptor for flat segment
;
sub ax, ax
mov cx, 2
int 31h
jc dosx_dpmierror
;
; Store selector in bp for later use
;
mov bp, ax
mov dosx_flat_sel_data, ax
;
; Get increment
;
mov ax, 3
int 31h
add ax, bp
;
; Set code selector for far jmp
;
mov dosx_jmpinto_sel, ax
mov dosx_flat_sel_code, ax
mov bx, ax
mov ax, 8
mov cx, -1
mov dx, cx
int 31h
jc dosx_dpmierror
mov bx, bp
int 31h
jc dosx_dpmierror
;
; Get cpl to use in "set access rights"
;
lar cx, bx
mov cl, ch
and cl, 060h
or cl, 092h
mov ch, 0c0h
mov ax, 9
int 31h
jc dosx_dpmierror
mov bx, dosx_jmpinto_sel
or cl, 9ah
int 31h
jc dosx_dpmierror
;
; Move dos- related api to int21h
;
mov bl, 21h
mov ax, 205h
mov cx, cs
mov edx, OFFSET dosx_int21api
int 31h
jc dosx_dpmierror
IFDEF __WATCOM__
sub bx, bx
mov cx, (OFFSET dosx_lestruc_end-OFFSET dosx_lestruc_start+1024+15) and 0fff0h
push bp
;
; bx:cx will be popped as esp at the very end of this
;
push bx
push cx
mov ax, 501h
int 31h
lea dx, dosx_msg_noextmem
jc dosx_pm_error
mov WORD PTR ds:[OFFSET dosx_flat_handle], di
mov WORD PTR ds:[OFFSET dosx_flat_handle+2], si
;
; Set descriptor base for new cs, ds
;
mov ax, 7
mov dx, cx
mov cx, bx
mov bx, dosx_jmpinto_sel
int 31h
jc dosx_dpmierror
mov bx, bp
int 31h
jc dosx_dpmierror
;
; Copy executable image
;
mov es, bx
sub di, di
mov cx, (OFFSET dosx_lestruc_end-OFFSET dosx_lestruc_start+1)/2
cld
mov si, OFFSET dosx_lestruc_start
rep movsw
;
; Set entry parameters
;
mov bx, dosx_fhandle
mov ax, 0900h
int 31h
lss esp, [esp]
mov es, dosx_pspsel
mov ds, bp
;
; jmp to LE loader
;
db 0EAh
dosx_jmpinto_offset dw 0
dosx_jmpinto_sel dw ?
ELSE ; !__WATCOM__
;
; Get current file pointer
;
mov bx, dosx_fhandle
sub cx, cx
sub dx, dx
mov ax, 4201h
int 21h
push ax
push dx
;
; Read first 22 BYTE
;
mov edx, OFFSET start
mov ah, 3Fh
mov ecx, 22
mov bx, dosx_fhandle
int 21h
lea dx, dosx_msg_openerr
jc dosx_pm_error
cmp ax, 22
jc SHORT dosx_is_binary
;
; Check for .exe - header
;
cmp WORD PTR ds:[OFFSET start], 'ZM'
jnz SHORT dosx_is_binary
;-------------- MZ EXE ------------------------
; check for no relocation
; removed 0.94 to support David Lindauers compiler
;
; cmp WORD PTR ds:[6], 0
; jnz dosx_pm_error
; calc needed memory
movzx eax, WORD PTR ds:[20+OFFSET start]
mov dosx_jmpinto_offset, eax
movzx eax, WORD PTR ds:[4+OFFSET start]
movzx edx, WORD PTR ds:[8+OFFSET start]
shl eax, 9
movzx esi, WORD PTR ds:[2+OFFSET start]
neg si
and si, 511
sub eax, esi
shl dx, 4
sub eax, edx
push eax
sub cx, cx
sub dx, 22
mov ax, 4201h
jmp SHORT dosx_getfmem
;
; FLAT FORM BINARY ONLY:
;
dosx_is_binary:
;
; Set fp to eof
;
sub cx, cx
sub dx, dx
mov ax, 4202h
int 21h
;
; Calc needed memory
;
mov si, dx
pop cx
pop dx
sub ax, dx
sbb si, cx
;
; Required amount of memory in si:ax
;
push si
push ax
;
; Set filepointer back to where it's been before
;
mov ax, 4200h
dosx_getfmem:
int 21h
pop cx
pop bx
;
; Zero- test
;
mov ax, bx
or ax, cx
lea dx, dosx_msg_openerr
jz dosx_pm_error
;
; Get # of bytes to read
;
mov di, bx
shl edi, 16
mov di, cx
;
; Align on DWORD and add stack
;
add cx, 1027
adc bx, 0
and cl, 0FCh
;
; Save initial esp
;
push bx
push cx
;
; Allocate memory block for application
;
push edi
mov ax, 501h
int 31h
lea dx, dosx_msg_noextmem
jc dosx_pm_error
mov WORD PTR ds:[OFFSET dosx_flat_handle], di
mov WORD PTR ds:[OFFSET dosx_flat_handle+2], si
;
; Set descriptor base for new cs, ds
;
mov ax, 7
mov dx, cx
mov cx, bx
mov bx, dosx_jmpinto_sel
int 31h
jc dosx_dpmierror
mov bx, bp
int 31h
jc dosx_dpmierror
pop edi
;
; Read file into memory
;
sub edx, edx
mov bx, dosx_fhandle
push ds
mov ds, bp
mov ecx, edi
mov ah, 3Fh
int 21h
pop ds
lea dx, dosx_msg_openerr
jc dosx_pm_error
cmp eax, edi
jnz dosx_pm_error
;
; Close file if WFSE not present.
;
test cs: WdosxInfo.WdxInfo.WfseStart, -1
jnz SHORT wfse_skip_close
mov ah, 3eh
int 21h
;
; This may fail, but it's not a fatal condition so what?
;
wfse_skip_close:
;
; starting convention:
; es = psp- selector
; cs, ds, ss = flat segment
; esp = user file size + stack size (1k), DWORD aligned
; eip = 0
; interrupts disabled!
; all other registers - undefined
;
; Switch stacks
;
mov ax, 0900h
int 31h
pop esp
mov ss, bp
mov ds, bp
;
; jmp to user program
;
dw 0EA66h
dosx_jmpinto_offset dd 0
dosx_jmpinto_sel dw ?
ENDIF ; __WATCOM__/ELSE
; ############################################################################
;
; Partially rewritten INT21 API
;
; ############################################################################
dosx_32dsdx db 09h, 39h, 3Ah, 3Bh, 3Ch, 3Dh, 41h, 43h, 4Eh, 5Ah, 5Bh
db 3Fh, 40h, 56h, 47h, 51h, 62h, 1Ah, 2Fh, 4Fh, 25h, 35h
db 1Bh, 1Ch, 1Fh, 32h, 34h, 48h, 49h, 4Ah, 44h, 4Bh, 4Ch
db 0FFh
align WORD
dosx_whatapi dw OFFSET dosx_dosopencreate
dw OFFSET dosx_dosopencreate
dw OFFSET dosx_dosopencreate
dw OFFSET dosx_dosopencreate
dw OFFSET dosx_dosopencreate
dw OFFSET dosx_dosopencreate
dw OFFSET dosx_dosopencreate
dw OFFSET dosx_dosopencreate
dw OFFSET dosx_dosopencreate
dw OFFSET dosx_dosopencreate
dw OFFSET dosx_dosopencreate
dw OFFSET dosx_dosread
dw OFFSET dosx_doswrite
dw OFFSET dosx_rename
dw OFFSET dosx_getdir
dw OFFSET dosx_getpsp
dw OFFSET dosx_getpsp
dw OFFSET dosx_setdta
dw OFFSET dosx_getdta
dw OFFSET dosx_findnext
dw OFFSET dosx_setintvec
dw OFFSET dosx_getintvec
dw OFFSET dosx_conv_dsbx
dw OFFSET dosx_conv_dsbx
dw OFFSET dosx_conv_dsbx
dw OFFSET dosx_conv_dsbx
dw OFFSET dosx_conv_esbx
dw OFFSET dosx_2148
dw OFFSET dosx_2149
dw OFFSET dosx_214A
dw OFFSET dosx_2144
dw OFFSET dosx_214b
dw OFFSET dosx_upon_exit
;
; ############################################################################
;
dosx_int21api:
; decide whether our proprietary API has been called
cmp ah, 0ffh
jnz dosx_is_DOS_fn
;
; 0.95 intercept WFSE calls
;
cmp al, 0FDh ; WFSE?
jne dosx_notwfse
shr eax, 16
push si
sub si, si
WfseCheckApi:
cmp ah, BYTE PTR cs: [si+OFFSET WfseFunctionTable]
jz SHORT WfseApiGet
inc si
cmp BYTE PTR cs: [si+OFFSET WfseFunctionTable], 0FFh
jnz SHORT WfseCheckApi
jmp dosx_int21_chain
WfseApiGet:
add si, si
mov si, WORD PTR cs: [si+OFFSET WfseFunctions]
xchg si, [esp]
retn
;-----------------------------------------------------------------------------
; Invalidate wfse context
;
WfseInvalidate PROC NEAR
push ds
mov ds, cs: dosx_flat_sel_data16
mov WORD PTR ds: wfse_current_handle, 0
pop ds
retn
WfseInvalidate ENDP
WfseAlternate:
;
; Check for an empty string and just close the EXE in that case
;
cmp BYTE PTR ds:[edx], 0
jne WfseAltRealfile
;
; Mark all WFSE related info as invalid
;
push ds
push bx
mov ds, cs: dosx_flat_sel_data16
sub bx, bx
mov WORD PTR ds: wfse_current_handle, bx
xchg bx, ds: dosx_fhandle
mov ah, 3Eh
int 21h
pop bx
pop ds
jmp WfseCommonOk
WfseAltRealfile:
;
; DS:EDX -> File name
;
mov ax, 3D00h
int 21h
jc WfseCommonError
push ds
push bx
push ecx
push edx
mov ds, cs:[dosx_flat_sel_dos]
call WfseInvalidate
mov bx, ax
mov ah, 3Fh
sub edx, edx
mov ecx, 10
int 21h
jc WfseAltFail
cmp ax, cx
jne WfseAltFail
mov dx, WORD PTR ds:[8]
shl dx, 4
sub cx, cx
mov ax, 4200h
int 21h
jc WfseAltFail
mov ecx, WDXINFO_REV1_SIZE
mov ah, 3Fh
sub edx, edx
int 21h
jc WfseAltFail
cmp ax, cx
jne WfseAltFail
cmp DWORD PTR ds:[0], 'XdW$'
jne WfseAltFail
mov eax, DWORD PTR ds:[OFFSET WdxInfo.WfseStart]
mov ds, cs:[dosx_flat_sel_data16]
xchg bx, ds:dosx_fhandle
test ds: WdosxInfo.WdxInfo.WfseStart, -1
mov ds: WdosxInfo.WdxInfo.WfseStart, eax
jz WfseAltNoclose
test bx, bx
jz WfseAltNoclose
mov ah, 3Eh
int 21h
WfseAltNoclose:
clc
jmp WfseAltOk
WfseAltFail:
mov ah, 3Eh
int 21h
stc
WfseAltOk:
pop edx
pop ecx
pop bx
pop ds
jc WfseCommonError
jmp WfseCommonOk
WfseInstall:
mov eax, 57465345h
mov ebx, 1
WfseCommonOk:
and BYTE PTR [esp+8], 0FEh
iretd
WfseOpen:
;
; - 0.95 quick WFSE install check -------------------------------------------
;
cmp cs: WdosxInfo.WdxInfo.WfseStart, 0
jz WfseCommonError
;
; Handle closed?
;
cmp cs: dosx_fhandle, 0
jz WfseCommonError
cmp al, 0
jne WfseCommonError
;
; Find a free FCB
;
sub eax, eax
WfseGetHandle:
test DWORD PTR cs:[eax*8].WfseFcbs.WfseFCB.WfseFileStart, -1
je SHORT WfseGotHandle
inc ax
inc ax
cmp ax, MAX_WFSE_FCBS*2
jc SHORT WfseGetHandle
jmp WfseCommonError
WfseGotHandle:
push es
push edx
push ecx
push eax
mov es, cs:dosx_flat_sel_dos
call WfseInvalidate
call HWfseFindFirst
jnc SHORT WfseNameCmpFirst
WfseOpenPopError:
pop eax
pop ecx
pop edx
pop es
jmp WfseCommonError
WfseDoFindNext:
call HWfseFindNext
jc SHORT WfseOpenPopError
WfseNameCmpFirst:
sub ecx, ecx
WfseNameCmpNext:
mov al, ds:[edx+ecx]
mov ah, es:[ecx+ OFFSET WfseInfo.WfseFileName]
inc ecx
call HWfseToLower
xchg al, ah
call HWfseToLower
cmp al, ah
jne WfseDoFindNext
or al, ah
jne SHORT WfseNameCmpNext
pop edx
call HWfseGetFilePointer ; This probably wouldn't fail
;
; eax = File pointer
; edx = table index * 2
; ecx = size of WFSE string
;
push ds
mov ds, cs:[dosx_flat_sel_data16]
lea eax, [eax+ecx+OFFSET WfseInfo.WfseFileName]
mov ds:[edx*8].WfseFcbs.WfseFCB.WfseFileStart, eax
and ds:[edx*8].WfseFcbs.WfseFCB.WfseFilePos, 0
;
; As the only form currently allowed is uncompressed, the logical size of the
; file is the size of raw data
;
mov eax, DWORD PTR es:[OFFSET WfseInfo.WfseVirtualSize]
mov ds:[edx*8].WfseFcbs.WfseFCB.WfseFileSize, eax
mov eax, DWORD PTR es:[OFFSET WfseInfo.WfseFlags]
mov [edx*8].WfseFcbs.WfseFCB.WfseFlags, eax
lea eax, [edx*8+8000h]
pop ds
pop ecx
pop edx
pop es
jmp WfseCommonOk
WfseCommonError:
or BYTE PTR [esp+8], 1
iretd
WfseClose:
call HWfseVerifyHandle
jc WfseCommonError
push ds
mov ds, cs:[dosx_flat_sel_data16]
and ds:[bx-8000h].WfseFcbs.WfseFCB.WfseFileStart, 0
pop ds
jmp WfseCommonOk
WfseRead:
call HWfseVerifyHandle
jc WfseCommonError
;
; Check whether the file is compressed
test cs: [bx-8000h].WfseFcbs.WfseFCB.WfseFlags, WFSE_COMP_ANY
jz WfseIsUncompressed
call WfseReadDecomp
jc WfseCommonError
jmp WfseCommonOk
WfseIsUncompressed:
push ecx
push es
mov es, cs:[dosx_flat_sel_data16]
mov eax, es:[bx-8000h].WfseFcbs.WfseFCB.WfseFileStart
add eax, es:[bx-8000h].WfseFcbs.WfseFCB.WfseFilePos
call HWfseSetFilePointer
jc WfseReadError
mov eax, es:[bx-8000h].WfseFcbs.WfseFCB.WfseFileSize
sub eax, es:[bx-8000h].WfseFcbs.WfseFCB.WfseFilePos
jz WfseReadError
cmp eax, ecx
jnc WfseDoRead
mov ecx, eax
WfseDoRead:
push bx
mov bx, cs:dosx_fhandle
mov ah, 3Fh
int 21h
pop bx
jc WfseReadError
add es:[bx-8000h].WfseFcbs.WfseFCB.WfseFilePos, eax
WfseReadError:
pop es
pop ecx
jc WfseCommonError
jmp WfseCommonOk
WfseSeek:
cmp al, 3
jnc WfseCommonError
call HWfseVerifyHandle
jc WfseCommonError
push ds
push ecx
mov ds, cs:[dosx_flat_sel_data16]
shl ecx, 16
mov cx, dx
cmp al, 0
jz WfseSeekDoIt
cmp al, 1
jnz WfseSeekEnd
add ecx, ds:[bx-8000h].WfseFcbs.WfseFCB.WfseFilePos
jmp WfseSeekDoIt
WfseSeekEnd:
add ecx, ds:[bx-8000h].WfseFcbs.WfseFCB.WfseFileSize
WfseSeekDoIt:
cmp ecx, ds:[bx-8000h].WfseFcbs.WfseFCB.WfseFileSize
ja WfseSeekExit
mov ds:[bx-8000h].WfseFcbs.WfseFCB.WfseFilePos, ecx
mov ax, cx
shr ecx, 16
mov dx, cx
sub cx, cx ; set flags to na
WfseSeekExit:
pop ecx
pop ds
ja WfseCommonError
jmp WfseCommonOk
;-----------------------------------------------------------------------------
; INCLUDE THE CACHEING DECOMPRESSION READER
;
;#############################################################################
; The structure of a WFSE compressed file is a follows:
;
; OFFSET
; 0 WFSE header with compression flag set ("H")
; H + 0 Offset to block directory from H + 0
; H + 2 Size of last compressed block
; H + 4 size of decompressor (max 2048 bytes) if 0: use build-in;
; H + 6.. decompressor (if any)
;
; The block directory is an array of file offsets relative to H + 0
; if the difference between two block offsets is 4k then the block is not
; compressed. Block offsets are relative to the start of the raw compressed
; data (makes compressing easier)
;#############################################################################
;-----------------------------------------------------------------------------
; WfseReadDecomp - read from a compressed file
;
; Entry:
; ECX = bytes to read
; BX = file handle (already verified)
; DS: EDX -> dest
;
; Exit:
; we will exit, of course
;
WfseReadDecomp PROC NEAR
;
; ecx -= read (min (ecx, ((not (file pointer)) and (FFF)) + 1)) (file pointer+++)
; while ecx >= 4096 ecx -= read(4096) (file pointer+++)
; if ecx != 0 then read ecx file pointer
;
push ds
push es
push ecx
push ds
pop es
mov ds, cs: dosx_flat_sel_data16
mov eax, [bx-8000h].WfseFcbs.WfseFcb.WfseFileSize
sub eax, [bx-8000h].WfseFcbs.WfseFcb.WfseFilePos
cmp eax, ecx
jnc wfseEcxSanitized
mov ecx, eax
WfseEcxSanitized:
mov eax, ecx
test ecx, ecx
jz WfseEarlyOut
push esi
push edi
push ecx
mov edi, edx
mov esi, [bx-8000h].WfseFcbs.WfseFCB.WfseFilePos
or eax, -1
xor eax, esi
and esi, 0FFFh
and eax, 0FFFh
add esi, 3000h
inc eax
cmp eax, ecx
jna wfseFirstBlockSizeOk
wfseLastBlockOk:
mov eax, ecx
wfseFirstBlockSizeOk:
call ReadVirtualBlock
jc wfseReadDecompDone
call CopyDecompData
add [bx-8000h].WfseFcbs.WfseFCB.WfseFilePos, eax
sub ecx, eax
jz wfseReadDecompDone
mov eax, 4096
cmp ecx, eax
jc wfseLastBlockOk
jmp wfseFirstBlockSizeOk
wfseReadDecompDone:
mov eax, edi
sub eax, edx
pop ecx
cmp eax, ecx
pop edi
pop esi
WfseEarlyOut:
pop ecx
pop es
pop ds
retn
WfseReadDecomp ENDP
;-----------------------------------------------------------------------------
; Quick helper, EAX = # bytes to copy from transfer buffer
;
CopyDecompData PROC NEAR
push ds
mov ds, dosx_flat_sel_dos
push ecx
mov ecx, eax
cld
shr cx, 2
rep movs DWORD PTR es: [edi], ds: [esi]
mov cx, ax
and cx, 3
rep movs BYTE PTR es: [edi], ds: [esi]
mov esi, 3000h
pop ecx
pop ds
ret
CopyDecompData ENDP
;-----------------------------------------------------------------------------
; ReadVirtualBlock - Reads and decompresses a virtual block at bx = handle
; using the current virtual file pointer. This procedure
; just makes sure the addressed virtual block is in the
; transfer buffer.
;
; Entry:
; WFSE handle
;
; Exit: Decompressed block available at Buffer[3000h], certain globals
; updated (but NOT the virtual file pointer!)
; CF set on error, ax = DOS error code
;
ReadVirtualBlock PROC NEAR
pushad
push ds
push es
mov ds, cs: dosx_flat_sel_data16
mov es, dosx_flat_sel_dos
;
; if not current file
;
cmp bx, wfse_current_handle
je wfseCurrentHandleOk
mov eax, [bx-8000h].WfseFcbs.WfseFCB.WfseFileStart
call HWfseSetFilePointer
mov cx, 4096
sub si, si
call ReadBlockSICX
jc readVirtualExit
cmp ax, 12
jc readVirtualExit
;
; if custom decompressor store decompressor, this is todo
; Currently, we support JIBZ' WPACK and the old LZ77 one for backwards
; compatibility.
;
mov wfse_current_decomp, OFFSET LZ77Decompress
test cs: [bx-8000h].WfseFcbs.WfseFCB.WfseFlags, WFSE_COMP_LZ77
jnz SHORT wfseGotDecomp
mov wfse_current_decomp, OFFSET WdosxDepack
wfseGotDecomp:
mov wfse_current_handle, bx
movzx eax, es: [WfseCompHeader.LastBlockSize]
mov wfse_current_last, eax
mov wfse_current_block, -1
movzx eax, es: [WfseCompHeader.HeaderSize]
add eax, [bx-8000h].WfseFcbs.WfseFCB.WfseFileStart
mov wfse_current_dir_offset, eax
mov edx, [bx-8000h].WfseFcbs.WfseFCB.WfseFileSize
add edx, 0FFFh
shr edx, 12
lea eax, [edx * 4 +eax]
mov wfse_current_raw_offset, eax
wfseCurrentHandleOk:
mov eax, [bx-8000h].WfseFcbs.WfseFCB.WfseFilePos
shr eax, 12
mov edx, wfse_current_block
shr edx, 12
cmp eax, edx
je wfseKeepContext
;
; if not current directory block (determined from file offset upper 10 bits)
; - get directory block we need (upper 10 bits of file offset to read from)
;
shr eax, 10
shr edx, 10
cmp ax, dx
je wfseCurrentDirOk
;
; wfse_dir_offset = filepointer shr 22 (EAX)
; size = (((virtual size + FFF) shr 12) - wfse_dir_offset shl 10) shl 2
;
mov ecx, [bx-8000h].WfseFcbs.WfseFCB.WfseFileSize
shl eax, 10
add ecx, 0FFFh
shr ecx, 12
sub ecx, eax
shl ecx, 2
cmp ecx, 4100
jc wfseDirSizeOk
mov cx, 4100
wfseDirSizeOk:
shl eax, 2
add eax, wfse_current_dir_offset
call HWfseSetFilePointer
sub si, si
call ReadBlockSICX
jc readVirtualExit
cmp ax, cx
mov ax, 01Ch ; ???
jc readVirtualExit
cmp cx, 4100
jnc wfseCurrentDirOk
mov si, cx
mov eax, es: [si - 4]
add eax, wfse_current_last
mov es: [si], eax
wfseCurrentDirOk:
mov eax, [bx-8000h].WfseFcbs.WfseFCB.WfseFilePos
shr eax, 12
mov edx, [bx-8000h].WfseFcbs.WfseFCB.WfseFileSize
shr edx, 12
cmp eax, edx
je wfseIsLastBlock
;
; if block != last block {
; csize = dir[block + 1] - dir[block]
; size = 4096
; }
;
and eax, 03FFh
mov ecx, es: [eax * 4 + 4]
sub ecx, es: [eax * 4]
mov dx, 4096
jmp wfseSizeCalcOk
;
; else {
; csize = last_block_size
; size = Virtual size and FFF
; }
;
wfseIsLastBlock:
mov cx, WORD PTR wfse_current_last
and eax, 03FFh
mov dx, WORD PTR [bx-8000h].WfseFcbs.WfseFCB.WfseFileSize
and dx, 0FFFh
wfseSizeCalcOk:
mov eax, es: [eax * 4]
add eax, wfse_current_raw_offset
call HWfseSetFilePointer
mov si, 8192
call ReadBlockSICX
jc readVirtualExit
cmp ax, cx
mov ax, 01Ch ; ???
jc readVirtualExit
; movzx eax, cx
mov eax, [bx-8000h].WfseFcbs.WfseFCB.WfseFilePos
; add eax, wfse_current_block
mov wfse_current_block, eax
;
; if csize != size then decomp(size) else move(size)
;
mov di, 3000h
push es
pop ds
xchg cx, dx
cmp cx, dx
; cmp dx, 1000h
je wfseJustMove
mov bx, cx
call [cs: wfse_current_decomp]
clc
jmp wfseKeepContext
wfseJustMove:
cld
rep movsb
clc
jmp wfseKeepContext
readVirtualExit:
call WfseInvalidate
wfseKeepContext:
pop es
pop ds
popad
retn
ReadVirtualBlock ENDP
;-----------------------------------------------------------------------------
; ReadBlockSICX
;
; Entry:
; SI = target offset in transfer buffer
; CX = number of bytes to read
;
; Exit:
; CF clear on success, AX = bytes read
; CF set on error, AX = DOS error code
;
ReadBlockSICX PROC NEAR
push es
push edi
push bx
mov es, cs:dosx_flat_sel_data16
mov edi, OFFSET dosx_int31struc
mov ax, cs: dosx_fhandle
mov es: dosx_int31struc._bx, ax
mov es: dosx_int31struc._dx, si
mov es: dosx_int31struc._cx, cx
mov es: dosx_int31struc._ah, 3Fh
sub cx, cx
mov bl, 21h
mov ax, 300h
call dosx_call31
mov ax, es: dosx_int31struc._flags
shr ax, 1
mov ax, es: dosx_int31struc._ax
mov cx, es: dosx_int31struc._cx
pop bx
pop edi
pop es
retn
ReadBlockSICX ENDP
; ############################################################################
; ## Realmode and 16 bit PM LZ77 decompressor ##
; ############################################################################
;
; In: DS:SI -> source data
; ES:DI -> dest. buffer
; BX -> number of bytes to decompress
;
; Out: DS:SI -> next byte in input stream
;
; Destroys flags including DF and all general purpose registers except BP
;
; This is a very silly implementation, obviously.
;
Lz77Decompress PROC NEAR
cld
add bx, di
NewTag:
mov dh, 8
mov dl, [si]
inc si
TestTag:
add dl, dl
jc processMatch
movsb
TestEnd:
cmp di, bx
jnc LZDecompDone
dec dh
jnz TestTag
jmp NewTag
processMatch:
lodsw
push si
mov cx, ax
mov si, di
and cx, 15
shr ax, 4
sub si, ax
add cx, 3
rep movsb
pop si
jmp TestEnd
LZDecompDone:
ret
Lz77Decompress ENDP
;-----------------------------------------------------------------------------
WfseFunctionTable db 0, 03Dh, 03Eh, 03Fh, 042h, 0FEh, 0FFh
WfseFunctions dw OFFSET WfseInstall
dw OFFSET WfseOpen
dw OFFSET WfseClose
dw OFFSET WfseRead
dw OFFSET WfseSeek
dw OFFSET WfseAlternate
;----------------------- WFSE helper functions -------------------------------
HWfseVerifyHandle PROC NEAR
cmp bh, 80h
jc @@VerifyDone
cmp bx, 8000h+MAX_WFSE_FCBS*SIZE_OF_FCB
cmc
jc @@VerifyDone
test bl, SIZE_OF_FCB-1
jnz @@VerifyError
test cs:[bx-8000h].WfseFcbs.WfseFCB.WfseFileStart, -1
jnz @@VerifyDone
@@VerifyError:
stc
@@VerifyDone:
ret
HWfseVerifyHandle ENDP
HWfseTolower PROC NEAR
cmp al, 'A'
jc SHORT WfseUpcase0
cmp al, 'Z'
ja SHORT WfseUpcase0
or al, 20h
WfseUpcase0:
ret
HWfseTolower ENDP
;-----------------------------------------------------------------------------
; HWfseFindFirst
;
; Out: CF clear on success, transfer buffer filled with WFSE header
; master file pointer at the beginning of WFSE
; header.
; CF set on error
;
HWfseFindFirst PROC NEAR
pushad
mov bx, cs:dosx_fhandle
mov eax, cs:WdosxInfo.WdxInfo.WfseStart
FindNextEntry:
call HWfseSetFilePointer
jc SHORT @@error
push eax
push ds
mov ds, cs:dosx_flat_sel_dos
sub edx, edx
mov ecx, 16+256 ; size of header
mov ah, 3Fh
int 21h
jc SHORT @@noError
cmp eax, 16+2
jc SHORT @@noError
cmp DWORD PTR ds:[0], 45534657h
je SHORT @@noError
stc
@@noError:
pop ds
pop eax
jc SHORT @@error
call HWfseSetFilePointer
jc SHORT @@error
@@error:
popad
ret
HWfseFindFirst ENDP
;-----------------------------------------------------------------------------
; HWfseSetFilePointer
;
; In: EAX = file pointer
;
; Out: CF clear = O.K.
; CF set = error
;
HWfseSetFilePointer PROC NEAR
pushad
mov bx, cs: dosx_fhandle
shld ecx, eax, 16
mov dx, ax
mov ax, 4200h
int 21h
popad
ret
HWfseSetFilePointer ENDP
;-----------------------------------------------------------------------------
; HWfseGetFilePointer
;
; Out: CF clear = O.K. EAX = file pointer
; CF set = error
;
HWfseGetFilePointer PROC NEAR
push cx
push dx
push bx
mov bx, cs:dosx_fhandle
sub cx, cx
sub dx, dx
mov ax, 4201h
int 21h
pushf
shl eax, 16
mov ax, dx
ror eax, 16
popf
pop bx
pop dx
pop cx
ret
HWfseGetFilePointer ENDP
;-----------------------------------------------------------------------------
; HWfseFindNext
;
; In: file pointer at the beginning of a WFSE header
; transfer buffer filled with header data from
; previous call to FindFirst/Next
;
; Out: CF clear on success, transfer buffer filled with WFSE header
; master file pointer at the beginning of WFSE
; header.
; CF set on error
;
HWfseFindNext PROC NEAR
pushad
mov bx, cs:dosx_fhandle
call HWfseGetFilePointer
push ds
mov ds, cs:dosx_flat_sel_dos
add eax, ds:[WfseInfo.WfseSize]
pop ds
jmp FindNextEntry
HWfseFindNext ENDP
;
; ############# End of WFSE API ##############################################
;
dosx_notwfse:
cmp al, 0ffh
jnz dosx_int21_chain_01
;
; If caller's CS does not match dosx_flat_sel_code, return an error.
;
push eax
mov ax, [esp + 8]
cmp ax, WORD PTR cs:[OFFSET dosx_flat_sel_code]
pop eax
je SHORT callerOkFor21FFFF
or BYTE PTR [esp + 8], 1
iretd
callerOkFor21FFFF:
mov ds, cs:[dosx_flat_sel_data16]
pop DWORD PTR ds:[OFFSET dosx_32api_return_offset]
pop DWORD PTR ds:[OFFSET dosx_32api_return_selector]
pop DWORD PTR ds:[OFFSET dosx_api_return_flags]
or BYTE PTR ds:[OFFSET dosx_api_return_flags], 1
mov dosx_api_return_esp, esp
mov ss, ds:[dosx_flat_sel_data16]
mov esp, OFFSET dosx_top_of_memory
push es
push fs
push gs
pushad
mov ecx, edx
dosx_21FF_common:
shld ebx, ecx, 16
mov ax, 0503h
mov di, WORD PTR ds:[OFFSET dosx_flat_handle]
mov si, WORD PTR ds:[OFFSET dosx_flat_handle+2]
call dosx_call31
jc SHORT dosx_32api_fail
mov WORD PTR ds:[OFFSET dosx_flat_handle], di
mov WORD PTR ds:[OFFSET dosx_flat_handle+2], si
mov dx, cx
mov cx, bx
mov bx, dosx_flat_sel_code
mov ax, 7
call dosx_call31
jc dosx_dpmierror
mov bx, dosx_flat_sel_data
call dosx_call31
jc dosx_dpmierror
and BYTE PTR ds:[OFFSET dosx_api_return_flags], 0feh
dosx_32api_fail:
popad
pop gs
pop fs
pop es
push DWORD PTR ds:[OFFSET dosx_api_return_flags]
popfd
mov ss, dosx_flat_sel_data
mov esp, dosx_api_return_esp
mov ds, dosx_flat_sel_data
dw 0EA66h
dosx_32api_return_offset dd ?
dosx_32api_return_selector dd ?
dosx_call31 LABEL NEAR
pushfd
db 66h
push cs
db 66h
push OFFSET dosx_from_old31
dw 0
jmp SHORT dosx_chain31
dosx_chain31:
dw 0EA66h
dosx_old31_ofs dd ?
dosx_old31_sel dw ?
dosx_from_old31:
ret
fix_callbacks_for_nt PROC NEAR
;
; workaround for an NT bug: the high word of ESI is invalid...
;
mov ax, ds
lsl eax, eax
cmp eax, esi
ja ntBugDone
movzx esi, si
movzx edi, di
ntBugDone:
ret
fix_callbacks_for_nt ENDP
dosx_hook31:
;
; Workaround for an NTVDM bug, which zeroes out the high 16 bits of target
; EIP
;
cmp ax, 0303h
jne check304
;
; Scan the handler table for a free entry
;
push bx
push bp
mov bp, ds
mov ds, cs:[dosx_flat_sel_data16]
sub bx, bx
dpmi_cb_cont_scan:
cmp DWORD PTR [bx + OFFSET dpmi_cb_addx], 0
je dpmi_cb_found_free
add bx, 4
cmp bx, 4 * 16
jc dpmi_cb_cont_scan
dpmi_cb_fail:
mov ds, bp
pop bp
pop bx
or BYTE PTR [esp + 8], 1
iretd
dpmi_cb_found_free:
push bx
imul bx, 3
mov BYTE PTR ds: [bx + OFFSET dpmi_cb_dest], 0E8h
mov WORD PTR ds: [bx + OFFSET dpmi_cb_dest + 3], 0EA66h
mov DWORD PTR ds: [bx + OFFSET dpmi_cb_dest + 5], esi
mov WORD PTR ds: [bx + OFFSET dpmi_cb_dest + 9], bp
;
; Calculate displacement for near call
;
mov si, OFFSET fix_callbacks_for_nt - OFFSET dpmi_cb_dest - 3
sub si, bx
mov WORD PTR ds: [bx + OFFSET dpmi_cb_dest + 1], si
lea si, [bx + OFFSET dpmi_cb_dest]
push cs
pop ds
movzx esi, si
call dosx_call31
mov ds, cs:[dosx_flat_sel_data16]
mov esi, DWORD PTR [bx + OFFSET dpmi_cb_dest + 5]
pop bx
jc dpmi_cb_fail
mov WORD PTR [bx + OFFSET dpmi_cb_addx], dx
mov WORD PTR [bx + OFFSET dpmi_cb_addx + 2], cx
dpmi_cb_ok:
mov ds, bp
pop bp
pop bx
and BYTE PTR [esp + 8], 0FEh
iretd
check304:
cmp ax, 0304h
jne checkIdent
push bx
push bp
mov bp, ds
mov ds, cs:[dosx_flat_sel_data16]
sub bx, bx
dpmi_cb_cont_search:
cmp WORD PTR [bx + OFFSET dpmi_cb_addx], dx
jne dpmi_cb_found_next
cmp WORD PTR [bx + OFFSET dpmi_cb_addx + 2], cx
jne dpmi_cb_found_next
call dosx_call31
jc dpmi_cb_fail
mov DWORD PTR [bx + OFFSET dpmi_cb_addx], 0
jmp dpmi_cb_ok
dpmi_cb_found_next:
add bx, 4
cmp bx, 4 * 16
jc dpmi_cb_cont_search
jmp dpmi_cb_fail
;
; End of NTVDM callback workaround
;
checkIdent:
cmp ax, 0eeffh
jnz dosx_chain31
mov eax, 'WDSX'
mov dx, MajorVersion*256+MinorVersion
mov ch, 0
org $-1
dosx_PMSys_EEFF db ?
mov cl, BYTE PTR cs:[OFFSET dosx_cpu_type]
and BYTE PTR [esp+8], 0feh
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov ebx, OFFSET dosx_thats_me
iretd
; ############################################################################
; ## Extended DOS API functions ##
; ############################################################################
dosx_is_DOS_fn:
cld
and BYTE PTR [esp+8], 0feh
push si
sub si, si
dosx_int21_checkapi:
cmp ah, BYTE PTR cs:[si+OFFSET dosx_32dsdx]
jz SHORT dosx_int21apiget
inc si
cmp BYTE PTR cs:[si+OFFSET dosx_32dsdx], 0ffh
jnz SHORT dosx_int21_checkapi
dosx_int21_chain:
pop si
dosx_int21_chain_01:
dw 0EA66h
dosx_old21_ofs dd 0
dosx_old21_sel dw 0
dosx_int21apiget:
add si, si
mov si, WORD PTR cs:[si + OFFSET dosx_whatapi]
xchg si, [esp]
retn
dosx_upon_exit:
push ax
mov dx, cs:dosx_mouse_rmcallback_ofs
mov cx, cs:dosx_mouse_rmcallback_seg
mov ax, 0304h
int 31h
pop ax
jmp SHORT dosx_int21_chain_01
; ############################################################################
; ## INT 21/4b00h Execute child program ##
; ############################################################################
dosx_214b:
test al, al
jz SHORT dosx_214b_ok
or BYTE PTR [esp+8], 1
iretd
dosx_214b_ok:
and BYTE PTR [esp+8], 0FEh
pushad
push es
push fs
push ds
mov fs, WORD PTR cs:[OFFSET dosx_flat_sel_dos] ; transfer buffer
call WfseInvalidate
mov di, 24 ; reserve space for parameter block
;
; Copy filename
;
dosx_4b00_00:
mov al, [edx]
inc edx
mov fs:[di], al
inc di
test al, al
jnz SHORT dosx_4b00_00
;
; Setup first part of parameter block
;
mov fs:[2], di
mov DWORD PTR fs:[6], 0
mov DWORD PTR fs:[0Ah], 0
;
; Copy command tail
;
lds edx, FWORD PTR es:[ebx+6]
;
; Always copy at least one byte w/o zero checking
;
movzx cx, BYTE PTR [edx]
inc edx
mov fs:[di], cl
inc di
add cl, 2 ; maximum size is real size + 0Dh, 00h
dosx_4b00_01:
mov al, [edx]
inc edx
mov fs:[di], al
inc di
test al, al
jz SHORT dosx_4b00_01_01
loop SHORT dosx_4b00_01
dosx_4b00_01_01:
;
; Check whether caller's environment should be copied or not
;
les edi, FWORD PTR es:[ebx]
dosx_4b00_02:
sub ax, ax
cld
or ecx, -1
dosx_4b00_04:
repne scas BYTE PTR es:[edi]
dec ecx
scas BYTE PTR es:[edi]
jne SHORT dosx_4b00_04
lea esi, [edi + ecx + 1]
not ecx
lea ebx, [ecx + 15]
shr ebx, 4
and bx, 0FFFh
mov ds, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov ax, 100h
int 31h
mov dosx_int31struc._ax, 1Fh ; general failure
jc dosx_4b00_error
push es
pop ds
mov es, dx
mov fs:[0], ax
sub edi, edi
rep movs BYTE PTR es:[edi], ds:[esi]
dosx_4b00_05:
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov edi, OFFSET dosx_int31struc
mov ax, es:_ds[di]
mov fs:[4], ax
mov es:_bx[di], 0
mov es:_dx[di], 24
mov es:_ax[di], 4B00h
push dx
mov ax, 204h
mov bl, 33h
int 31h
push cx
push edx
mov cx, es:dosx_old33sel
mov edx, es:dosx_old33ofs
inc ax
int 31h
dec ax
mov bl, 21h
int 31h
push cx
push edx
mov cx, es:dosx_old21_sel
mov edx, es:dosx_old21_ofs
inc ax
int 31h
dec ax
mov bl, 31h
int 31h
push cx
push edx
mov cx, es:dosx_old31_sel
mov edx, es:dosx_old31_ofs
inc ax
int 31h
mov bx, 21h
mov ax, 300h
sub cx, cx
int 31h
mov ax, 205h
pop edx
pop cx
mov bl, 31h
int 31h
pop edx
pop cx
mov bl, 21h
int 31h
pop edx
pop cx
mov bl, 33h
int 31h
pop dx
mov ax, 101h
int 31h
test es:_flags[di], 1
jz SHORT dosx_4b00_07
dosx_4b00_error:
stc
dosx_4b00_07:
pop ds
pop fs
pop es
popad
jnc SHORT dosx_4b00_noerr
or BYTE PTR [esp+8], 1
mov ax, WORD PTR cs:[OFFSET dosx_int31struc._ax]
dosx_4b00_noerr:
;
; Either way, reset the DTA to where it belongs
;
pushad
push es
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov edi, OFFSET dosx_int31struc
push es:dosx_int31struc._ds
mov ax, cs:dosx_patch1
mov es:dosx_int31struc._ds, ax
mov es:dosx_int31struc._dx, OFFSET dosx_dta
mov es:dosx_int31struc._ah, 1Ah
sub cx, cx
mov ax, 300h
mov bl, 21h
int 31h
pop es:dosx_int31struc._ds
pop es
popad
iretd
; ############################################################################
; ## INT 21/44 IOCTL dispatcher ##
; ############################################################################
dosx_2144:
cmp al, 2
jz SHORT dosx_21442
cmp al, 4
jz SHORT dosx_21442
cmp al, 3
jz dosx_doswrite
cmp al, 5
jz dosx_doswrite
jmp dosx_int21_chain_01
dosx_21442:
;
; copy max (ecx, 16k) down to buffer
;
push es
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_dos]
call WfseInvalidate
push esi
push edi
push ecx
;
; Only use cx and make the default 256 bytes
;
movzx ecx, cx
; cmp ecx, 4000h
;
cmp cx, 100h
jc SHORT dosx_21442_1
;
; mov ecx, 4000h
mov cx, 100h
dosx_21442_1:
mov esi, edx
sub edi, edi
rep movs BYTE PTR es:[edi], ds:[esi]
pop ecx
pop edi
pop esi
pop es
jmp dosx_dosread
; ############################################################################
; ## INT 21/48 Allocate DOS memory block ##
; ############################################################################
dosx_2148:
push dx
mov eax, 100h
int 31h
jc SHORT dosx_2148_01
movzx eax, dx
dosx_2148_01:
pop dx
movzx ebx, bx
jnc SHORT dosx_2148_02
or BYTE PTR [esp+8], 1
dosx_2148_02:
iretd
; ############################################################################
; ## INT 21/49 Free DOS memory block ##
; ############################################################################
dosx_2149:
push cx
mov cx, ax
push dx
mov dx, es
mov ax, 101h
int 31h
pop dx
jc SHORT dosx_2149_01
mov ax, cx
push 0
pop es
dosx_2149_01:
pop cx
jnc SHORT dosx_2149_02
or BYTE PTR [esp+8], 1
dosx_2149_02:
iretd
; ############################################################################
; ## INT 21/4a Resize DOS memory block ##
; ############################################################################
dosx_214A:
push cx
mov cx, ax
push dx
mov dx, es
mov ax, 102h
int 31h
pop dx
movzx ebx, bx
jc SHORT dosx_214A_01
mov ax, cx
dosx_214A_01:
pop cx
jnc SHORT dosx_214A_02
or BYTE PTR [esp + 8], 1
dosx_214A_02:
iretd
; ############################################################################
; ## INT 21/34 Get address of Indos flag ##
; ############################################################################
dosx_conv_esbx:
push ds
push edi
push bx
push cx
mov edi, OFFSET dosx_int31struc
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
push es
pop ds
mov _ax[di], ax
push _es[di]
mov bl, 21h
sub cx, cx
mov ax, 300h
int 31h
mov bx, _es[di]
mov ax, 2
int 31h
pop _es[di]
movzx ebx, _bx[di]
mov es, ax
mov ax, _ax[di]
pop cx
pop bx
pop edi
pop ds
iretd
; ############################################################################
; ## Common function for returning a pointer in ds:ebx ##
; ############################################################################
dosx_conv_dsbx:
push es
push edi
mov edi, OFFSET dosx_int31struc
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
push es
pop ds
mov _bx[di], bx
mov _cx[di], cx
mov _dx[di], dx
mov _ax[di], ax
inc ah
and ah, 0FEh
cmp ah, 01Ch
jne SHORT dosx_cv_01
sub edx, edx
sub ecx, ecx
dosx_cv_01:
push _ds[di]
mov bl, 21h
sub cx, cx
mov ax, 300h
int 31h
mov bx, _ds[di]
mov ax, 2
int 31h
pop _ds[di]
movzx ebx, _bx[di]
mov cx, _cx[di]
mov dx, _dx[di]
mov ds, ax
mov ax, es:_ax[di]
pop edi
pop es
iretd
; ############################################################################
; ## INT 21/25 SET interrupt vector ##
; ############################################################################
dosx_setintvec:
push bx
push cx
mov cx, ds
push ax
mov bl, al
mov ax, 205h
int 31h
pop ax
pop cx
pop bx
iretd
; ############################################################################
; ## INT 21/35 GET interrupt vector ##
; ############################################################################
dosx_getintvec:
mov bl, al
push edx
push cx
push ax
mov ax, 204h
int 31h
mov es, cx
mov ebx, edx
pop ax
pop cx
pop edx
iretd
; ############################################################################
; ## INT 21/1A SET DTA ##
; ############################################################################
dosx_setdta:
push es
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov DWORD PTR es:[OFFSET dosx_dta_offset], edx
mov WORD PTR es:[OFFSET dosx_dta_selector], ds
pop es
iretd
; ############################################################################
; ## INT 21/2F GET DTA ##
; ############################################################################
dosx_getdta:
les ebx, PWORD PTR cs:[OFFSET dosx_dta_offset]
iretd
; ############################################################################
; ## INT 21/4F FIND NEXT ##
; ############################################################################
dosx_findnext:
push ds
push es
push esi
push edi
push ecx
push bx
;
; User dta -> dta buffer
;
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
lds esi, PWORD PTR cs:[OFFSET dosx_dta_offset]
mov edi, OFFSET dosx_dta
mov ecx, 11
rep movs DWORD PTR es:[edi], ds:[esi]
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov edi, OFFSET dosx_int31struc
mov es:_ax[di], ax
sub cx, cx
mov ax, 300h
mov bl, 21h
int 31h
mov ax, es:_ax[di]
test BYTE PTR es:_flags[di], 1
;
; crashes in a Windows DOS box...
; pushfd
; call PWORD PTR cs:[OFFSET dosx_old21_ofs]
;
; dta buffer -> user dta
;
mov ds, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
les edi, PWORD PTR cs:[OFFSET dosx_dta_offset]
mov esi, OFFSET dosx_dta
mov ecx, 11
rep movs DWORD PTR es:[edi], ds:[esi]
pop bx
pop ecx
pop edi
pop esi
pop es
pop ds
jz SHORT dosx_fn_ok
or BYTE PTR [esp+8], 1
dosx_fn_ok:
iretd
;
; ############################################################################
;
dosx_rename:
push es
push gs
mov gs, WORD PTR cs:[OFFSET dosx_flat_sel_dos] ; target
call WfseInvalidate
push ebx
push edi
sub ebx, ebx
dosx_ren1:
mov ah, es:[edi+ebx]
mov gs:[bx], ah
inc bx
test ah, ah
jnz SHORT dosx_ren1
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov edi, OFFSET dosx_int31struc
mov es:_dx[di], bx
push esi
sub esi, esi
dosx_ren2:
mov ah, ds:[edx+esi]
mov gs:[bx+si], ah
inc si
test ah, ah
jnz SHORT dosx_ren2
pop esi
mov ah, 56h
mov es:_ax[di], ax
mov es:_cx[di], cx
mov ax, es:_ds[di]
mov es:_es[di], ax
mov es:_di[di], 0
mov bl, 21h
sub cx, cx
mov ax, 0300h
int 31h
mov cx, es:_cx[di]
mov ax, es:_ax[di]
test BYTE PTR es:_flags[di], 1
pop edi
pop ebx
pop gs
pop es
jz SHORT dosx_ren3
or BYTE PTR [esp+8], 1
dosx_ren3:
iretd
; ############################################################################
dosx_getdir:
push es
push edi
push esi
push cx
push bx
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov edi, OFFSET dosx_int31struc
mov es:_dx[di], dx
mov es:_ax[di], ax
mov es:_si[di], 0
sub cx, cx
mov bl, 21h
mov ax, 300h
int 31h
sub bx, bx
push es
mov es, WORD PTR cs:[dosx_flat_sel_dos]
call WfseInvalidate
dosx_getdirloop:
mov al, es:[bx]
mov ds:[esi], al
inc esi
inc bx
cmp bx, 64
jnz SHORT dosx_getdirloop
pop es
mov ax, es:_ax[di]
test BYTE PTR es:_flags[di], 1
pop bx
pop cx
pop esi
pop edi
pop es
jz SHORT dosx_getdir1
or BYTE PTR [esp+8], 1
dosx_getdir1:
iretd
; ############################################################################
dosx_getpsp:
mov bx, WORD PTR cs:[OFFSET dosx_pspsel]
iretd
; ############################################################################
dosx_dosopencreate:
push ds
push es
push esi
push edi
sub edi, edi
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_dos] ; target
call WfseInvalidate
mov esi, edx ; source
dosx_copyfilename:
cmp ah, 9
jnz SHORT dosx_api_0term
cmp BYTE PTR ds:[esi], '$' ; end of string?
jmp SHORT dosx_api_cond
dosx_api_0term:
cmp BYTE PTR ds:[esi], 0 ; end of name?
dosx_api_cond:
movs BYTE PTR es:[edi], ds:[esi] ; copy BYTE
jnz SHORT dosx_copyfilename
cmp ah, 5ah
jnz SHORT dosx_bcopy_done
mov al, 12
dosx_fillz_0:
mov WORD PTR es:[di], 0
inc di
dec al
jnz SHORT dosx_fillz_0
dosx_bcopy_done:
push ds
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov ds, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov edi, LARGE OFFSET dosx_int31struc
mov _cx[di], cx
mov _ax[di], ax
mov _bx[di], ax
mov _dx[di], 0
push bx
mov bl, 21h
sub cx, cx
mov ax, 0300h
int 31h
pop bx
mov cx, _cx[di]
mov ax, _ax[di]
pop es
cmp _bh[di], 5ah
jnz SHORT dosx_nomaket
push ds
mov ds, WORD PTR ds:[OFFSET dosx_flat_sel_dos]
call WfseInvalidate
mov edi, edx
sub esi, esi
dosx_copy_tf:
cmp BYTE PTR [si], 0
movs BYTE PTR es:[edi], ds:[esi]
jnz SHORT dosx_copy_tf
pop ds
dosx_nomaket:
;
; If function 4e, copy dta
;
cmp _bh[di], 4Eh
jnz SHORT dosx_not_4e
push edi
les edi, PWORD PTR ds:[OFFSET dosx_dta_offset]
push ecx
mov ecx, 11
mov esi, OFFSET dosx_dta
rep movs DWORD PTR es:[edi], ds:[esi]
pop ecx
pop edi
dosx_not_4e:
test BYTE PTR _flags[di], 1
pop edi
pop esi
pop es
pop ds
jz SHORT dosx_oc_ok
or BYTE PTR [esp+8], 1
dosx_oc_ok:
iretd
;
; ############################################################################
;
dosx_dosread:
;
; Could havwe been called from 2144
;
push ds
push es
push esi
push edi
push ecx
push edx
push ds
mov ds, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov esi, edx
sub edx, edx
mov edi, OFFSET dosx_int31struc
mov _bx[di], bx
mov _di[di], ax
dosx_api32_readloop:
mov ax, _di[di]
mov _ax[di], ax
mov _cx[di], 4000h ; default:read 16k
mov _dx[di], 0
sub ecx, 4000h
jnc SHORT dosx_api32_rlblock
add _cx[di], cx
jz SHORT dosx_api32_rdarnspecialcase
dosx_api32_rlblock:
mov es, WORD PTR ds:[OFFSET dosx_flat_sel_data16]
mov ax, 300h
mov bl, 21h
push cx
sub cx, cx
int 31h
pop cx
test BYTE PTR _flags[di], 1
pop es
jnz SHORT dosx_32api_readerror
push ds
push ecx
movzx ecx, WORD PTR _ax[di]
add edx, ecx
mov ds, [dosx_flat_sel_dos]
call WfseInvalidate
mov edi, esi
sub esi, esi
shr cx, 1
pushf
shr cx, 1
pushf
rep movs DWORD PTR es:[edi], ds:[esi]
popf
jnc SHORT dosx_rnomovsw
movs WORD PTR es:[edi], ds:[esi]
dosx_rnomovsw:
popf
jnc SHORT dosx_rnomovsb
movs BYTE PTR es:[edi], ds:[esi]
dosx_rnomovsb:
mov esi, edi
pop ecx
pop ds
;
; Now check some conditions:
;
mov edi, OFFSET dosx_int31struc
cmp _cx[di], 4000h
jnz SHORT dosx_api32_rdone
cmp _ax[di], 4000h
jnz SHORT dosx_api32_rdone
push es
jmp SHORT dosx_api32_readloop
dosx_api32_rdarnspecialcase:
pop es
dosx_api32_rdone:
mov eax, edx
clc
dosx_api32_rcommon:
pop edx
pop ecx
mov bx, _bx[di]
pop edi
pop esi
pop es
pop ds
jnc SHORT dosx_rd_ok
or BYTE PTR [esp+8], 1
dosx_rd_ok:
iretd
dosx_32api_readerror:
mov ax, _ax[di]
stc
jmp SHORT dosx_api32_rcommon
;
; ############################################################################
;
dosx_doswrite:
;
; Test for ecx = 0 ( truncate file )
;
movzx eax, ax
test ecx, ecx
jz dosx_int21_chain_01
;
; If zero, no buffer operation involved, just chain into old int 21h
;
push ds
push es
push esi
push edi
push ebp
sub ebp, ebp
push ecx
push fs
push ds
pop fs
mov ds, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov esi, edx
mov edi, OFFSET dosx_int31struc
mov _bx[di], bx
mov es, WORD PTR ds: [OFFSET dosx_flat_sel_data16]
mov _di[di], ax
dosx_api32_writeloop:
mov ax, _di[di]
mov _ax[di], ax
mov _cx[di], 4000h
mov _dx[di], 0
sub ecx, 4000h
jnc SHORT dosx_api32_wlblock
add _cx[di], cx
jz SHORT dosx_api32_wdarnspecialcase
dosx_api32_wlblock:
push ds
push es
push ecx
push edi
movzx ecx, WORD PTR _cx[di]
mov es, WORD PTR ds:[OFFSET dosx_flat_sel_dos]
call WfseInvalidate
push fs
pop ds
sub edi, edi
push cx
shr cx, 2
rep movs DWORD PTR es: [edi], ds: [esi]
pop cx
and cx, 3
rep movs BYTE PTR es: [edi], ds: [esi]
pop edi
pop ecx
pop es
pop ds
mov ax, 300h
mov bl, 21h
mov es, WORD PTR ds: [OFFSET dosx_flat_sel_data16]
push cx
sub cx, cx
int 31h
pop cx
test BYTE PTR _flags[di], 1
jnz SHORT dosx_32api_writeerror
movzx eax, _ax[di]
add ebp, eax
cmp ax, _cx[di]
jnz SHORT dosx_api32_wdarnspecialcase
cmp _ch[di], 40h
jz SHORT dosx_api32_writeloop
dosx_api32_wdarnspecialcase:
mov eax, ebp
clc
dosx_wr_common:
pop fs
pop ecx
pop ebp
mov bx, _bx[di]
pop edi
pop esi
pop es
pop ds
jnc SHORT dosx_wr_ok
or BYTE PTR [esp], 1
dosx_wr_ok:
iretd
dosx_32api_writeerror:
mov ax, _ax[di]
stc
jmp SHORT dosx_wr_common
; ############################################################################
; ## Extended mouse functions ##
; ############################################################################
dosx_new_int33:
cmp ax, 9
jnz dosx_int33_01
push edi
push ax
push bx
push cx
push ds
push es
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov edi, OFFSET dosx_int31struc
mov es:_cx[di], cx
mov es:_bx[di], bx
mov bx, OFFSET dosx_mouse_bitmap
mov es:_dx[di], bx
push es:_es[di]
mov es:_es[di], es
mov es:_ax[di], ax
mov ds, [esp]
mov cx, 32
dosx_int33_00:
mov ax, [edx]
add edx, 2
mov es:[bx], ax
add bx, 2
loop SHORT dosx_int33_00
sub edx, 64
mov ax, 300h
mov bl, 33h
int 31h
pop es:_es[di]
pop es
pop ds
pop cx
pop bx
pop ax
pop edi
iretd
dosx_int33_01:
cmp ax, 0ch
jnz dosx_int33_02
push edi
push ax
push cx
push es
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov edi, OFFSET dosx_int31struc
mov es:_cx[di], cx
mov es:_ax[di], ax
mov ax, WORD PTR es:[OFFSET dosx_mouse_rmcallback_seg]
mov cx, [esp]
push es:_es[di]
mov es:_es[di], ax
mov ax, WORD PTR es:[OFFSET dosx_mouse_rmcallback_ofs]
mov es:_dx[di], ax
mov DWORD PTR es:[OFFSET dosx_mouse_proc], edx
mov WORD PTR es:[OFFSET dosx_mouse_proc + 4], cx
test cx, cx
jnz dosx_int33_03
mov es:_es[di], cx
mov es:_dx[di], cx
dosx_int33_03:
mov bl, 33h
sub cx, cx
mov ax, 0300h
int 31h
pop es:_es[di]
pop es
pop cx
pop ax
pop edi
iretd
dosx_int33_02:
cmp ax, 16h
jnz dosx_int33_04
push edi
push esi
push ecx
push ax
push ds
push es
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov edi, OFFSET dosx_int31struc
mov es:_bx[di], bx
mov es:_ax[di], ax
mov ax, es:_ds[di]
mov es:_es[di], ax
mov es:_dx[di], 0
sub cx, cx
mov bl, 33h
mov ax, 300h
int 31h
movzx ecx, es:_bx[di]
mov edi, edx
sub esi, esi
mov ds, WORD PTR cs:[OFFSET dosx_flat_sel_dos]
call WfseInvalidate
cld
pop es
rep movs BYTE PTR es:[edi], ds:[esi]
pop ds
pop ax
pop ecx
pop esi
pop edi
iretd
dosx_int33_04:
cmp ax, 17h
jnz dosx_int33_05
push edi
push esi
push ecx
push ax
push bx
push ds
push es
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_dos]
call WfseInvalidate
pop ds
mov esi, edx
sub edi, edi
cld
movzx ecx, bx
rep movs BYTE PTR es:[edi], ds:[esi]
push ds
mov es, WORD PTR cs:[OFFSET dosx_flat_sel_data16]
mov edi, OFFSET dosx_int31struc
mov es:_ax[di], ax
mov es:_bx[di], bx
mov es:_dx[di], 0
mov ax, es:_ds[di]
mov es:_es[di], ax
sub cx, cx
mov bl, 33h
mov ax, 300h
int 31h
pop es
pop ds
pop bx
pop ax
pop ecx
pop esi
pop edi
iretd
dosx_int33_05:
dw 0EA66h
dosx_old33ofs dd ?
dosx_old33sel dw ?
; ############################################################################
; ## The mouse callback glue code ##
; ############################################################################
dosx_int33callback:
mov ax, ds:[esi]
mov es:_ip[edi], ax
mov ax, ds:[esi+2]
mov es:_cs[edi], ax
add es:_sp[edi], 4
push esi
push edi
movzx eax, es:_ax[edi]
movzx ebx, es:_bx[edi]
movzx ecx, es:_cx[edi]
movzx edx, es:_dx[edi]
movsx esi, es:_si[edi]
movsx edi, es:_di[edi]
db 66h
call DWORD PTR cs:[OFFSET dosx_mouse_proc]
pop edi
pop esi
iretd
;
; ############################################################################
;
dosx_set_edi PROC
;
; Set EDI to scratch page and clear TLB
; in: edx - physical adress
;
mov dl, 7
mov edi, dosx_cr3_base
add edi, 4096 * 2 - 4
mov es:[edi], edx
mov edi, 400000h-4096 ; constant adress
mov eax, cr3
mov cr3, eax
ret
dosx_set_edi ENDP
dosx_getpage PROC NEAR
;
; returns physical address of page in edx, cf clear, u/s + present set
; if cf set: memorino finito
; check if int15 malloc avail
;
mov edx, WdosxInfo.XMemAlloc
dec edx
cmp edx, dosx_pagecount
jnc SHORT canMalloc
ret
canMalloc:
cmp dosx_E801size, 0
jz SHORT dosx_alloc88
dec dosx_E801size
; mov edx, dosx_E801start
mov edx, dosx_E801size
shl edx, 12
add edx, dosx_E801start
; add dosx_E801start, 1000h
jmp SHORT dosx_alloc_fromvcpi
dosx_alloc88:
;
; As of WDOSX 0.95 we support INT 15h E801 for memory above 64MB
;
cmp dosx_extsize, 0
jz SHORT dosx_alloc_xms
;
; physical address = pagecount * 4096 + 100000h
;
; MikeT 99/06/20 We have to change this so that memory gets allocated top-down
;
dec dosx_extsize
; mov edx, dosx_pagecount
movzx edx, dosx_extsize
shl edx, 12
add edx, 100000h
;
; note that cf is clear here, isn't it?
;
jmp SHORT dosx_alloc_fromvcpi
dosx_alloc_xms:
cmp dosx_xmssize, 0
jz SHORT dosx_alloc_vcpi
dec dosx_xmssize
;
; physical = dosx_linear_start
;
mov edx, dosx_linear_start
add dosx_linear_start, 4096 ;does not carry
dosx_alloc_fromvcpi:
mov dl, 7
inc DWORD PTR ds:[OFFSET dosx_pagecount]
ret
dosx_alloc_vcpi:
test dosx_mode, vcpi_used
jz SHORT dosx_alloc_fail
or dosx_mode, pages_allocated
mov ax, 0DE04h
push ds
push dosx_sel_data0
pop ds
call PWORD PTR cs:[OFFSET dosx_vcpi_entry]
pop ds
;
; mark page as allocated from vcpi
;
or dh, 2
test al, al
jz SHORT dosx_alloc_fromvcpi
dosx_alloc_fail:
stc
ret
dosx_getpage ENDP
dosx_killdpmi PROC
cli
push cs
pop ds
mov dosx_pmhands, 0
mov es, dosx_pspseg
mov ax, dosx_envseg
mov es:[2ch], ax
cld
test dosx_mode, pages_allocated
jz SHORT dosx_exit_novcpi
;
; release pages.
; since pagetables are stored above 1MB we need pm here
;
call WORD PTR ds:[OFFSET dosx_raw2pm]
mov ax, dosx_sel_data0
mov es, ax
mov esi, dosx_cr3_base
mov cx, 512
dosx_nov_v_entr:
add si, 4 ; start check here
mov edx, es:[esi]
test dl, 1 ;valid entry ?
loope SHORT dosx_nov_v_entr
jcxz dosx_dealloc_done
;
; Found a valid entry
;
call dosx_set_edi
push cx
mov cx, 1024
dosx_check4vcpipage:
mov edx, es:[edi]
add edi, 4
test dh, 2 ; vcpi-page?
jz SHORT dosx_novcpipage
and dx, 0F000h
mov ax, 0DE05h
push ds
push dosx_sel_data0
pop ds
call PWORD PTR cs:[OFFSET dosx_vcpi_entry]
pop ds
dosx_novcpipage:
loop SHORT dosx_check4vcpipage
pop cx
;
; test page table entry for beeing vcpi-mem
;
mov edx, es:[esi]
test dh, 2
jz SHORT dosx_nov_v_entr
and dx, 0F000h
mov ax, 0DE05h
push ds
push dosx_sel_data0
pop ds
call PWORD PTR cs:[OFFSET dosx_vcpi_entry]
pop ds
jmp SHORT dosx_nov_v_entr
dosx_dealloc_done:
call WORD PTR cs:[OFFSET dosx_raw2rm]
dosx_exit_novcpi:
sti
;
; Release XMS- handle
;
mov dx, dosx_xmshandle
test dx, dx
jz SHORT dosx_exit_noxms
mov ah, 0Dh
call DWORD PTR [dosx_himem]
mov ah, 0Ah
call DWORD PTR [dosx_himem]
dosx_exit_noxms:
test dosx_mode, a20_used
jz SHORT dosx_exit_noa20
;
; Locally disable A20
;
test dosx_mode, xms_used
jz SHORT dosx_exit_alta20
mov ah, 6
call DWORD PTR [dosx_himem]
dosx_exit_alta20:
cli
call dosx_testa20
jz SHORT dosx_exit_noa20
;
; Restore a20 state
;
in al, 92h
and al, 0fdh
out 92h, al
call dosx_testa20
jz SHORT dosx_exit_noa20
call dosx_wait8042
mov al, 0d1h
out 64h, al
call dosx_wait8042
mov al, 0fdh
out 60h, al
call dosx_wait8042
mov al, 0ffh
out 64h, al
call dosx_wait8042
dosx_exit_noa20:
sti
test dosx_mode, ints_hooked
jz SHORT dosx_exit_noints
;
; Unhook all hooked ints
;
cli
push ds
pop es
cld
mov cx, 512
sub di, di
mov es, di
mov si, OFFSET dosx_intvectors
rep movs WORD PTR es:[di], ds:[si]
dosx_exit_noints:
ret
dosx_killdpmi ENDP
dosx_testa20 PROC
sub ax, ax
mov fs, ax
dec ax
mov gs, ax
mov ax, WORD PTR fs:[0]
push ax
cmp ax, gs:[16]
jnz SHORT dosx_testa20_done
dec WORD PTR fs:[0]
mov ax, WORD PTR fs:[0]
cmp ax, gs:[16]
dosx_testa20_done:
pop WORD PTR fs:[0]
ret
dosx_testa20 ENDP
dosx_xms3 PROC
pushad
mov ah, 0
call DWORD PTR [dosx_himem]
cmp ah, 3
jc skipxms3
;
; The following is a workaround for a Caldera DOS bug, where HIMEM.SYS would
; report XMS 3.0 where it actually only supports XMS 2
;
mov ah, 88h
sub bx, bx
call DWORD PTR [dosx_himem]
cmp bl, 80h ; set CF if BL > 0
setne bl
cmp bl, 1
skipxms3:
popad
jc xms3end
or ah, 80h
xms3end:
ret
dosx_xms3 ENDP
dosx_toggle PROC
pushfd ; try to toggle bit
pop eax
mov ebx, eax
xor eax, esi
push eax
popfd
pushfd
pop eax
xor eax, ebx
and eax, esi
ret
dosx_toggle ENDP
dosx_storeidt PROC
dosx_storeidtloop:
stos DWORD PTR es:[di]
mov ds:[di], edx
add eax, ebx
add di, 4
loop SHORT dosx_storeidtloop
ret
dosx_storeidt ENDP
dosx_xms_a20_enable PROC NEAR
test cs:dosx_mode, is_tsr
jz SHORT dxae_exit
push eax
push fs
push gs
call dosx_testa20
jnz SHORT dxae_enabled
;
; Do something really evil: temporarily replace int 21h vector with an
; old one. Same for INT 15h. These are the ones himem.sys is likely to use
;
sub ax, ax
mov fs, ax
push DWORD PTR fs:[21h * 4]
push DWORD PTR fs:[15h * 4]
mov eax, cs:dosx_old21vec
mov fs:[21h * 4], eax
mov eax, cs:dosx_old15vec
mov fs:[15h * 4], eax
;
; Also, mask the PICS, so that no H/W interrupt can occur, should these become
; enabled throughout the XMS fn. call
;
; Locally enable A20 for current application
;
in al, 21h
push ax
mov ax, 5FFh
out 21h, al
call DWORD PTR cs: [dosx_himem]
pop ax
out 21h, al
pop DWORD PTR fs:[15h * 4]
pop DWORD PTR fs:[21h * 4]
dxae_enabled:
pop gs
pop fs
pop eax
dxae_exit:
ret
dosx_xms_a20_enable ENDP
dosx_wait8042 PROC
dosx_w8042:
in al, 64h
test al, 2
jnz SHORT dosx_w8042
ret
dosx_wait8042 ENDP
dosx_new15 PROC
push ds
push cs
pop ds
cmp ax, 0E801h
jne SHORT dosx_noE801call
mov cx, dosx_extsize ; return what's left
shl cx, 2 ; to kB
push eax
mov eax, dosx_E801size
;
; If we're under XMS 2, we can give away all the memory. It is the reponsiblity
; of the child program to not use the portion that has been allocated by XMS 2
;
shl eax, 12 ; to bytes
add eax, dosx_E801start
shr eax, 16 ; to 64k units
dec ah ; sub 16MB
mov bx, ax
mov dx, ax
pop eax
jmp SHORT noInt15Mem
dosx_noE801call:
cmp ah, 88h
jnz SHORT dosx_chain15
noInt15Mem:
mov ax, dosx_extsize ; return what's left
shl ax, 2 ; to kB
pop ds
iret
dosx_chain15:
pop ds
jmp cs:dosx_old15vec
dosx_new15 ENDP
dosx_new21 PROC
cmp ah, 31h ; resident?
je SHORT dosx_checkPSP
cmp ah, 4Ch ; terminate?
jnz SHORT dosx_chain21
dosx_checkPSP:
;
; Get process id
;
push ax
push bx
mov ah, 62h
int 21h
cmp bx, cs:dosx_pspseg
pop bx
pop ax
jnz SHORT dosx_chain21 ; if not our program
cmp ah, 4Ch
je SHORT dosx_term4C
;
; If XMS driver installed, set the is_tsr bit to allow the call back and IRQ
; passup handlers to re- enable the A20 line.
;
test cs:dosx_mode, xms_used
jz SHORT dosx_chain21
or cs:dosx_mode, is_tsr
;
; Release all interrupt stacks (we do not return to PM)
;
cli
mov cs:dosx_lastintstack, OFFSET dosx_intstacks
dosx_term4C:
;
; Set up main stack
;
mov bx, cs
mov ss, bx
mov sp, OFFSET dosx_top_of_memory
cmp ah, 4Ch
jne SHORT dosx_chain21
;
; kill DPMI
;
push ax
call dosx_killdpmi
pop ax
dosx_kill_done:
;
; Now terminate
;
int 21h ; old vector may be invalid now
dosx_chain21:
jmp cs:dosx_old21vec
dosx_new21 ENDP
dosx_new23 PROC
iret ; return with clear carry=break off
; 2do: if it really stays just an iret, point
; it to another arbitrary iret! (1 BYTE saved)
dosx_new23 ENDP
dosx_new24 PROC
mov al, 3
test ah, 8 ; fail allowed?
jz SHORT dosx_int24makesproblems
iret
dosx_int24makesproblems:
call dosx_killdpmi ; auto- terminate
mov al, 2
iret
dosx_new24 ENDP
;
; ############## Protmode irq handling ########################################
;
dosx_nointstacks:
;
; here we arrive if there was a problem allocating an interrupt stack in pm
;
mov ax, dosx_sel_data16
mov ss, ax
mov ds, ax
mov sp, OFFSET dosx_top_of_memory
call WORD PTR ds:[dosx_raw2rm]
jmp dosx_rmnostacks
dosx_hnd_checkpic2:
push ax
mov ax, cs ; get int
shr ax, 3 ; get irq
sub al, 8
bts ax, ax
mov al, 0bh ; else check if it actually is one
out 0a0h, al
in al, 0a0h ; get in service mask
jmp SHORT dosx_hnd_haveisr
dosx_hnd_checkpic1 PROC
push ax
mov ax, cs ; get int
shr ax, 3 ; get irq
bts ax, ax
mov al, 0bh ; else check if it actually is one
out 20h, al
in al, 20h ; get in service mask
;
; Nuke spurious irq 7
;
or al, 80h
dosx_hnd_haveisr:
test al, ah
pop ax
;
; on ZF decide where to call the handler from
; get room for far ret, do not change flags:
;
lea esp, [esp-8]
push ebx
push esi
mov bx, OFFSET dosx_pmirqtab
jnz SHORT dosx_hnd_isirq
mov bx, OFFSET dosx_pic1backup
dosx_hnd_isirq:
mov si, cs
add esp, 16
push DWORD PTR cs:[si+bx-60]
push DWORD PTR cs:[si+bx-64]
sub esp, 8
pop esi
pop ebx
db 066h
retf
dosx_hnd_checkpic1 ENDP
dosx_hnd_irq PROC
;
; There are instances of real mode drivers and BIOSes that clobber the high
; word of general purpose registers. One known case is the Adaptec 2940UW
; SCSI BIOS ver. 1.23, which destroys the high word of EAX in its IRQ handler.
; Therefore, we play safe when calling code that has been written by dodgy
; 16 bit C programmers.
;
pushad
push ds
push es
push fs
push gs
push dosx_sel_data16
pop ds
;
; o.k. to access 16 bit data now
;
mov ds:dosx_isr_ss, ss
mov ds:dosx_isr_esp, esp
;
; switch stack to interrupt stack
;
push ds
pop ss
add dosx_lastintstack, dosx_intstacksize
cmp dosx_lastintstack, dosx_maxintstack
jnc dosx_nointstacks
movzx esp, dosx_lastintstack
push ds:dosx_isr_ss
push ds:dosx_isr_esp
;
; Get irq
;
mov ax, cs
shr ax, 1
movzx eax, ax
mov eax, ds:[eax+OFFSET dosx_oldirqs-32]
;
; irq in eax, set farcall
;
mov ds:dosx_irqfarcall, eax
;
; switch to realmode
;
call WORD PTR ds:[dosx_raw2rm]
;
; do the farcall
;
pushf
db 9Ah
dosx_irqfarcall dd ?
;
; back to pm again
;
call WORD PTR ds:[dosx_raw2pm]
pop ds:dosx_isr_esp
;
; Check stack for validity, otherwise we'd end up with a triple fault.
;
pop ax
push ax
lsl eax, eax
cmp eax, ds:dosx_isr_esp
ja irqStackValid
;
; Something has messed with the stack in our IRQ handler. Whoever did that
; would probably want to fix this in their stack fault handler (DJGPP)
;
pop ax
push eax
push ds:dosx_isr_esp
pushfd
db 66h
push cs
db 66h
push OFFSET irqFaultLoc
mov eax, 12 ; stack fault
mov ds:dosx_exc_ds, ds
jmp dosx_simulate_exc
;
; IRQ stack will be released by exception handling code
;
irqStackValid:
;
; restore stack
;
pop ss
mov esp, ds:dosx_isr_esp
sub dosx_lastintstack, dosx_intstacksize
;
; restore selectors
;
irqFaultLoc:
pop gs
pop fs
pop es
pop ds
popad
iretd
dosx_hnd_irq ENDP
dosx_hnd_interrupt PROC
cli
;
; Quick check for INT 2F/1686
;
cmp ax, 1686h
jne dosx_no1686
push ax
mov ax, cs
cmp ax, 30h * 8
pop ax
jne dosx_no1686
sub ax, ax
iretd
dosx_no1686:
push ds
push es
push fs
push gs
push dosx_sel_data16
pop ds
;
; o.k. to access 16 bit data now
;
mov dosx_isr_ss, ss
mov dosx_isr_esp, esp
pushf
add ds:dosx_lastintstack, dosx_intstacksize
cmp ds:dosx_lastintstack, dosx_maxintstack
jnc dosx_nointstacks
popf
push ds
pop ss
movzx esp, ds:dosx_lastintstack
;
; stack o.k.
;
push ds:dosx_isr_ss
push ds:dosx_isr_esp
push eax
pushf
;
; get interrupt
;
mov ax, cs
shr ax, 3
dec ax
mov ds:dosx_isr_int, al
;
; switch to realmode
;
call WORD PTR ds:[OFFSET dosx_raw2rm]
popf
pop eax
db 0CDh
dosx_isr_int db ?
cli ; BIOS calls will re-enable ints
push eax
pushf
call WORD PTR ds:[OFFSET dosx_raw2pm]
popf
pop eax
pop ds:dosx_isr_esp
;
; restore stack
;
pop ss
mov esp, ds:dosx_isr_esp
;
; release int stack
;
pushf
sub ds:dosx_lastintstack, dosx_intstacksize
popf
;
; restore selectors
;
pop gs
pop fs
pop es
pop ds
;
; restore stack
; give some flags back to user program
;
push ax
pushf
pop ax
and ax, 0DFFh
and WORD PTR [esp + 10], 0F200h
or WORD PTR [esp + 10], ax
pop ax
iretd
dosx_hnd_interrupt ENDP
dosx_hnd_10to1F PROC
push eax
push ebx
push ecx
mov bx, ds
mov ax, cs
shl ax, 5
dec ah
mov al, 0CDh
mov ds, [esp + 16]
mov ecx, [esp + 12]
;
; check whether the code at cs:eip-2 is INT nn
; this is not quite correct since the next instruction
; may have caused the exception... oh well!
;
cmp WORD PTR ds:[ecx - 2], ax
mov ds, bx
pop ecx
movzx eax, ah
jz SHORT dosx_is_int10to1f
pop ebx
pop eax
jmp SHORT dosx_hnd_exception
dosx_is_int10to1f:
;
; it is an interrupt, so call the handler
;
mov ebx, DWORD PTR cs:[eax*8+OFFSET dosx_int10to1F-80h]
mov eax, DWORD PTR cs:[eax*8+OFFSET dosx_int10to1F-7ch]
xchg ebx, [esp]
xchg eax, [esp+4]
db 66h
retf
dosx_hnd_10to1F ENDP
dosx_hnd_exception:
;
; check for user installed handler, otherwise throw out registers
; use startup code to overwrite
;
dosx_exc_errcode EQU DWORD PTR ds:[OFFSET start + 0]
dosx_exc_offset EQU DWORD PTR ds:[OFFSET start + 4]
dosx_exc_selector EQU DWORD PTR ds:[OFFSET start + 8]
dosx_exc_eflags EQU DWORD PTR ds:[OFFSET start + 12]
dosx_exc_eax EQU DWORD PTR ds:[OFFSET start + 16]
dosx_exc_esp EQU DWORD PTR ds:[OFFSET start + 20]
dosx_rep_errcode EQU DWORD PTR ds:[OFFSET start + 24]
dosx_rep_offset EQU DWORD PTR ds:[OFFSET start + 28]
dosx_rep_selector EQU WORD PTR ds:[OFFSET start + 32]
dosx_rep_eflags EQU DWORD PTR ds:[OFFSET start + 36]
dosx_rep_eax EQU DWORD PTR ds:[OFFSET start + 40]
dosx_rep_esp EQU DWORD PTR ds:[OFFSET start + 44]
;dosx_exc_cr0 EQU DWORD PTR ds:[OFFSET start + 48]
;dosx_exc_cr2 EQU DWORD PTR ds:[OFFSET start + 52]
;dosx_exc_cr3 EQU DWORD PTR ds:[OFFSET start + 56]
;dosx_exc_es EQU WORD PTR ds:[OFFSET start + 60]
;dosx_exc_fs EQU WORD PTR ds:[OFFSET start + 62]
;dosx_exc_gs EQU WORD PTR ds:[OFFSET start + 64]
dosx_exc_ds EQU WORD PTR ds:[OFFSET start + 66]
dosx_exc_ss EQU WORD PTR ds:[OFFSET start + 68]
dosx_rep_ds EQU WORD PTR ds:[OFFSET start + 70]
dosx_rep_ss EQU WORD PTR ds:[OFFSET start + 76]
;dosx_exc_ldt EQU WORD PTR ds:[OFFSET start + 82]
;dosx_exc_tr EQU WORD PTR ds:[OFFSET start + 84]
dosx_exc_number EQU BYTE PTR ds:[OFFSET start + 86]
;
; Stackframe now:
; (errorcode)
; (E)IP
; CS
; (E)flags
;
push ds
push dosx_sel_data16
pop ds
pop dosx_exc_ds
mov dosx_exc_eax, eax ; save eax
mov ax, cs ; get exc nr.
shr ax, 3
dec ax
mov dosx_exc_number, al ; save exception number
test al, 8
jz SHORT dosx_exc_noerrcode
pop dosx_exc_errcode
dosx_exc_noerrcode:
;
; check for exceptions 10h - 1fh
;
cmp al, 17
jnz SHORT dosx_exc_really_noerrcode
pop dosx_exc_errcode
;
; (V 0.93) check whether exception handler set V.094 do it for higher ones too
; (V 0.95) There will be an exception handler set REGARDLESS, so remove this
; check.
;
dosx_exc_really_noerrcode:
cwde
pop dosx_exc_offset
pop dosx_exc_selector
pop dosx_exc_eflags
mov dosx_exc_ss, ss
mov dosx_exc_esp, esp
push ds
pop ss
;
; (V 0.93) call the user exception handler
; try to get an interrupt stack
;
add ds:dosx_lastintstack, dosx_intstacksize
cmp ds:dosx_lastintstack, dosx_maxintstack
jnc dosx_nointstacks ; now completely fucked up
movzx esp, dosx_lastintstack
;
; build stack frame
;
push 0
push dosx_exc_ss
push dosx_exc_esp
push dosx_exc_eflags
push dosx_exc_selector
push dosx_exc_offset
;
; Entry point from simulated stack fault
;
dosx_simulate_exc:
push dosx_exc_errcode
push 0
push cs
dw 6866h ;push DWORD
dd OFFSET dosx_from_exc
push DWORD PTR ds:[eax * 8 + OFFSET dosx_ehandlers + 4]
push DWORD PTR ds:[eax * 8 + OFFSET dosx_ehandlers]
mov eax, dosx_exc_eax
mov ds, dosx_exc_ds
db 66h
retf
dosx_from_exc:
push ds
push dosx_sel_data16
pop ds
pop dosx_exc_ds
add esp, 4
pop dosx_exc_offset
pop dosx_exc_selector
pop dosx_exc_eflags
lss esp, [esp]
sub ds:dosx_lastintstack, dosx_intstacksize
push dosx_exc_eflags
push dosx_exc_selector
push dosx_exc_offset
mov ds, dosx_exc_ds
iretd
;-----------------------------------------------------------------------------
; Common exception handler code. The difficulty is to deal with both, 16 and
; 32 bit stacks.
;
CommonException:
;
; Stack: EAX
; R EIP
; R CS
; ERROR CODE
; F EIP
; F CS
; F EFLAGS
; F ESP
; F SS
;
push ebx
mov bx, ds ; "push ds" might push just
push ebx ; 2 bytes...
mov ds, cs:[dosx_flat_sel_data16]
mov dosx_rep_ds, bx
;
; Grab information from stack
;
mov ebx, [esp+20]
mov dosx_rep_errcode, ebx
mov ebx, [esp+24]
mov dosx_rep_offset, ebx
mov bx, [esp+28]
mov dosx_rep_selector, bx
mov ebx, [esp+32]
mov dosx_rep_eflags, ebx
mov ebx, [esp+36]
mov dosx_rep_esp, ebx
mov bx, [esp+40]
mov dosx_rep_ss, bx
mov dosx_exc_number, al
mov ebx, OFFSET fatalException
mov [esp+24], ebx
mov bx, cs
mov [esp+28], bx
mov bx, 200h
mov [esp+36], ebx ; high word already 0!
mov bx, ds
mov [esp+40], bx
pop ebx
mov ds, bx
pop ebx
pop eax
db 66h
retf
;
; As 32 iterations wouldn't allow for short jumps anymore, we split the
; exception vector tables.
;
Exc0to15 LABEL NEAR
i = 0
REPT 16
elabel CATSTR <Exception>, %i
elabel:
push eax
mov al, i
jmp SHORT JmpToCommon
i = i + 1
ENDM
JmpToCommon:
jmp CommonException
Exc16to32 LABEL NEAR
i = 16
REPT 16
push eax
mov al, i
jmp SHORT JmpToCommon
i = i + 1
ENDM
fatalException:
push ss ; sanitize DS
pop ds
;
; Push a lot of things onto the stack and print them out. When done, terminate.
; At this point we know that we have a 16 bit stack, so things are safe.
;
push gs
push fs
push es
push dosx_rep_ds
push dosx_rep_ss
push dosx_rep_errcode
push dosx_rep_eflags
push dosx_rep_esp
push ebp
push edi
push esi
push edx
push ecx
push ebx
push eax
push dosx_rep_offset
push dosx_rep_selector
movzx ax, dosx_exc_number
push ax
;
; Now that we have all the relevant information on the stack, do the output.
;
mov ah, 0Fh
int 10h
and al, 7Fh
cmp al, 3
jz dosx_exc_noset
mov ax, 3
int 10h
dosx_exc_noset:
cld
mov si, OFFSET dosx_exc_string
dosx_exc_loop:
lodsb
test al, al
jz dosx_exc_done
cmp al, '%'
jnz dosx_exc_out
lodsb
pop di
cmp al, '8'
jnz dosx_exc_out4
xchg bp, di
pop di
call dosx_hexout_di
xchg bp, di
dosx_exc_out4:
call dosx_hexout_di
jmp dosx_exc_loop
dosx_exc_out:
mov ah, 2
mov dl, al
int 21h
jmp dosx_exc_loop
dosx_exc_done:
mov ah, 4ch
int 21h
dosx_hexout_di PROC
mov cx, 4
dosx_o16_loop:
rol di, 4
mov dx, di
and dl, 0Fh
cmp dl, 10
jc dosx_o16_num
add dl, 7
dosx_o16_num:
add dl, 30h
mov ah, 2
int 21h
loop dosx_o16_loop
ret
dosx_hexout_di ENDP
dosx_new1C:
test BYTE PTR cs:[OFFSET dosx_pmhands + 3], 10h
jnz passup1c
chain1c:
jmp cs:dosx_old1Cvec
passup1c:
bts WORD PTR cs:[OFFSET dosx_pmhands + 2], 15
jc SHORT chain1c
push OFFSET dosx_start_irqs + 3 + (1Ch * 4)
jmp SHORT dosx_gen_rmirq
;
; ############## Generic realmode irq handler #################################
;
; realmode irq entry points
dosx_start_irqs LABEL WORD
rept 16
call dosx_gen_rmirq
nop
endm
dosx_end_irqs LABEL WORD
dosx_gen_rmirq:
assume ds:nothing, es:nothing, fs:nothing, gs:nothing, ss:nothing
cli
sub sp, 2
push bp
mov bp, sp
push eax
movzx eax, WORD PTR [bp+4]
sub ax, OFFSET dosx_start_irqs+3
shr ax, 2
;
; irq number in eax
; check if pm- handler set
;
bt cs:dosx_pmhands, eax
jc SHORT dosx_int2pm
dosx_chain_irq:
add sp, 10
push DWORD PTR cs:[eax * 4 + OFFSET dosx_oldirqs]
mov eax, ss:[bp-4]
mov bp, ss:[bp]
retf
dosx_int2pm:
call dosx_xms_a20_enable
;
; This one sucks: reflecting a real mode interrupt into pm, not knowing
; what the pm-handler does...
;
; get selector/OFFSET of pm- handler
;
push DWORD PTR cs:[eax*8 + OFFSET dosx_pmirqtab]
push WORD PTR cs:[eax*8 + OFFSET dosx_pmirqtab+4]
pop cs:dosx_irq_sel
pop DWORD PTR cs:[OFFSET dosx_irq_offset]
;
; restore original stack
;
pop eax
pop bp
add sp, 4
;
; save caller stack
;
mov cs:dosx_switch_ss, ss
mov cs:dosx_switch_esp, esp
add cs:dosx_lastintstack, dosx_intstacksize
cmp cs:dosx_lastintstack, dosx_maxintstack
jc SHORT dosx_gotintstack
;
; we have a problem right now
;
dosx_rmnostacks:
mov al, 20h
out 0a0h, al
out 20h, al
mov ax, cs
mov ss, ax
mov sp, OFFSET dosx_top_of_memory
call dosx_killdpmi
lea dx, dosx_msg_nointstacks
jmp dosx_exitmsg
dosx_gotintstack:
mov ss, cs:dosx_patch1 ; get ss
movzx esp, cs:dosx_lastintstack
;
; o.k. to access stack
;
push cs:dosx_switch_ss
push ds
push es
push fs
push gs
push cs:dosx_switch_esp
push eax
;
; switch to pm
;
call WORD PTR cs:[OFFSET dosx_raw2pm]
;
; now in pm, call protected mode handler
; no reentrancy as of here
; reentrancy only matters if the handler enables interrupts or does an int call
;
pushfd
dw 9A66h ; call far use32
dosx_irq_offset dd ?
dosx_irq_sel dw ?
;
; hope it will finally IRETD _here_ (god knows)
;
call WORD PTR cs:[OFFSET dosx_raw2rm]
;
; back again in rm
;
pop eax
cli
btr WORD PTR ds:[OFFSET dosx_pmhands + 2], 15
pop ds:dosx_switch_esp
pop gs
pop fs
pop es
pop ds
pop ss
;
; stack switched now!
;
mov esp, cs:dosx_switch_esp
sub cs:dosx_lastintstack, dosx_intstacksize
iret
;
; ############# Realmode callback support ####################################
;
align 4
dosx_callback_entry LABEL NEAR
rept 16
call callback_proc
db 0 ; free indicator
endm
callback_proc PROC NEAR
pushf
cli
pop WORD PTR cs:[OFFSET dosx_callback_fltemp]
call dosx_xms_a20_enable
;
; save caller's ss:sp, callback id
;
pop WORD PTR cs:[OFFSET dosx_callback_idtemp]
mov WORD PTR cs:[OFFSET dosx_callback_sstemp], ss
mov WORD PTR cs:[OFFSET dosx_callback_sptemp], sp
;
; now get an interrupt stack
;
push cs
pop ss
add cs:dosx_lastintstack, dosx_intstacksize
cmp cs:dosx_lastintstack, dosx_maxintstack
jnc dosx_rmnostacks
mov sp, cs:dosx_lastintstack
;
; ajust return ip
;
sub WORD PTR cs:[OFFSET dosx_callback_idtemp], 3
push ax ; (mis)align stack
push WORD PTR cs:[OFFSET dosx_callback_sstemp]
push WORD PTR cs:[OFFSET dosx_callback_sptemp]
push cs
push WORD PTR cs:[OFFSET dosx_callback_idtemp]
push gs
push fs
push ds
push es
push WORD PTR cs:[OFFSET dosx_callback_fltemp]
pushad
;
; switch to pm
;
call WORD PTR cs:[dosx_raw2pm]
;
; prepare dest
;
mov bx, ds:dosx_callback_idtemp
sub bx, OFFSET dosx_callback_entry
add bx, bx
les edi, PWORD PTR ds:[bx+OFFSET dosx_callback_strucs]
;
; prepare source
;
mov esi, esp
;
; copy stuff
;
push edi
cld
mov ecx, 12
rep movs DWORD PTR es:[edi], ds:[esi]
movs WORD PTR es:[edi], ds:[esi]
pop edi
;
; adjust stack, if stackspace is a concern
; add esp, 52
pushfd ; iret frame
;
; prepare stack reference OFFSET
;
movzx edx, ds:[dosx_callback_sstemp]
shl edx, 4
movzx esi, ds:[dosx_callback_sptemp]
add esi, edx
mov ax, dosx_sel_data0
mov ds, ax
call PWORD PTR cs:[bx+OFFSET dosx_callback_procs]
;
; here we return if nothing crashed
; swap some selectors
;
push es
pop ds
push ss
pop es
mov esi, edi
;
; if we ajusted the stack above we had to sub esp, 52 here
;
mov edi, esp
mov ecx, 12
;
; in 999.999 out of 1.000.000 cases we could just move 52 bytes, but what...?
;
rep movs DWORD PTR es:[edi], ds:[esi]
movs WORD PTR es:[edi], ds:[esi]
;
; switch back to RM
;
call WORD PTR cs:[dosx_raw2rm]
;
; pop stuff
;
popad
pop WORD PTR ds:[OFFSET dosx_callback_fltemp]
pop es
pop ds
pop fs
pop gs
pop WORD PTR cs:[OFFSET dosx_callback_iptemp]
pop WORD PTR cs:[OFFSET dosx_callback_cstemp]
pop WORD PTR cs:[OFFSET dosx_callback_sptemp]
pop ss
mov sp, WORD PTR cs:[OFFSET dosx_callback_sptemp]
;
; release interrupt stack
;
sub cs:dosx_lastintstack, dosx_intstacksize
;
; build iret stack frame
;
push WORD PTR cs:[OFFSET dosx_callback_fltemp]
push WORD PTR cs:[OFFSET dosx_callback_cstemp]
push WORD PTR cs:[OFFSET dosx_callback_iptemp]
iret
callback_proc ENDP
;
; ############## very, very raw mode switch proc's ###########################
; trashes eax, high WORD of esp return:ax=16 bit data selector or realmode cs
; req'd: ss = code16 or dosx_sel_data16!, sp set to valid stack
;
dosx_rm2prot PROC NEAR
;
; clear NT+ INT-flag
;
push 0
popf
lgdt cs:dosx_gdtr
lidt cs:dosx_idtr
;
; set cr3
;
mov eax, cs:dosx_cr3_base
mov cr3, eax
;
; enter pm
;
mov eax, cr0
or eax, 80000001h
mov cr0, eax
db 0EAh
dw OFFSET dosx_rm2prot1
dw dosx_sel_code16
dosx_rm2prot1:
mov ax, dosx_sel_data16
mov ss, ax
movzx esp, sp
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
ret
dosx_rm2prot ENDP
dosx_prot2rm PROC
push 0
popf
mov ax, dosx_sel_data16
mov ds, ax
mov es, ax
mov ss, ax
mov fs, ax
mov gs, ax
mov eax, cr0
and eax, 7FFFFFFEh
mov cr0, eax
sub eax, eax
mov cr3, eax
db 0EAh
dw OFFSET dosx_prot2rm1
dosx_patch1 dw ?
dosx_prot2rm1:
lgdt cs:dosx_rm_gdt
lidt cs:dosx_rm_idt
dosx_retfrompm:
mov ax, cs
mov ss, ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
movzx esp, sp
ret
dosx_prot2rm ENDP
dosx_v862prot PROC NEAR
push 0
popf
push esi
push bp
mov bp, sp
mov esi, cs:dosx_v86struc
mov ax, 0DE0Ch
int 67h
dosx_v862prot1:
mov ax, dosx_sel_data16
mov ds, ax
mov es, ax
mov ss, ax
movzx esp, bp
mov fs, ax
mov gs, ax
pop bp
pop esi
ret
dosx_v862prot ENDP
dosx_prot2v86 PROC
push 0
popf
movzx eax, sp
sub sp, 16 ; skip ds, es, fs, gs
dw 6866h ; push DWORD
dosx_patch2 dw ?
dw 0
push eax
pushfd
dw 6866h ; push DWORD
dosx_patch3 dw ?
dw 0
dw 6866h ; push DWORD
dd OFFSET dosx_retfrompm
mov ax, dosx_sel_data0
mov ds, ax
mov ax, 0de0ch
sub sp, 8
dw 0EA66h
dosx_vcpi_entry LABEL PWORD
dosx_vcpiOFFSET dd ?
dosx_vcpisel dw ?
dw 0
dosx_prot2v86 ENDP
; ############################################################################
; ## The DPMI 0.9 emulation ##
; ############################################################################
dosx_int31:
;
; speedup for virtual interrupts
;
cmp ah, 9
jnz SHORT dpmi_no_vint
;
; clear carry flag
;
and BYTE PTR [esp+8], 0FEh
cmp al, 2
jz SHORT dpmi_get
cmp al, 1
jz SHORT dpmi_set
btr WORD PTR [esp+8], 9
setc al
iretd
dpmi_set:
bts WORD PTR [esp+8], 9
setc al
iretd
dpmi_get:
bt WORD PTR [esp+8], 9
setc al
iretd
assume ds:code16
dpmi_no_vint:
cld
push es
push fs
push ds
pop fs ; orig. ds needed for callback
push ds
push gs
push dosx_sel_data16
pop ds
;
; o.k. to access 16 bit data now
;
mov dosx_isr_ss, ss
mov dosx_isr_esp, esp
add ds:dosx_lastintstack, dosx_intstacksize
cmp ds:dosx_lastintstack, dosx_maxintstack
jnc dosx_nointstacks
push ds
pop ss
movzx esp, ds:dosx_lastintstack
;
; stack o.k., store user program stack on temp stack
;
push ds:dosx_isr_ss
push ds:dosx_isr_esp
pushad
mov bp, sp
;
; get function to jump to
;
mov si, OFFSET dpmi_groups
sub bx, bx
xchg bl, ah
cmp bx, [si]
jnc dpmi_exitcarry
add bx, bx
mov si, [bx + si + 2]
mov bx, ax
cmp bx, [si]
jnc dpmi_exitcarry
add bx, bx
jmp WORD PTR [bx + si + 2]
align 2
dpmi_groups LABEL WORD
dw 09h ; highest group supported+1
dw OFFSET dpmi_00
dw OFFSET dpmi_01
dw OFFSET dpmi_02
dw OFFSET dpmi_03
dw OFFSET dpmi_04
dw OFFSET dpmi_05
dw OFFSET dpmi_06
dw OFFSET dpmi_07
dw OFFSET dpmi_08
dpmi_00 LABEL WORD
dw 0Dh ; highest function supported +1
dw OFFSET int310000
dw OFFSET int310001
dw OFFSET int310002
dw OFFSET int310003
dw OFFSET dpmi_exitcarry
dw OFFSET dpmi_exitcarry
dw OFFSET int310006
dw OFFSET int310007
dw OFFSET int310008
dw OFFSET int310009
dw OFFSET int31000a
dw OFFSET int31000b
dw OFFSET int31000c
dpmi_01 LABEL WORD
dw 03h ; highest function supported +1
dw OFFSET int310100
dw OFFSET int310101
dw OFFSET int310102
dpmi_02 LABEL WORD
dw 06h ; highest function supported +1
dw OFFSET int310200
dw OFFSET int310201
dw OFFSET int310202
dw OFFSET int310203
dw OFFSET int310204
dw OFFSET int310205
dpmi_03 LABEL WORD
dw 05h
dw OFFSET int310300
dw OFFSET int310301
dw OFFSET int310302
dw OFFSET int310303
dw OFFSET int310304
dpmi_04 LABEL WORD
dw 01h
dw OFFSET int310400
dpmi_05 LABEL WORD
dw 04h
dw OFFSET int310500
dw OFFSET int310501
dw OFFSET int310502
dw OFFSET int310503
dpmi_06 LABEL WORD
dw 05h
dw OFFSET dpmi_exitok
dw OFFSET dpmi_exitok
dw OFFSET dpmi_exitok
dw OFFSET dpmi_exitok
dw OFFSET int310604
dpmi_07 LABEL WORD
dw 04h
dw OFFSET dpmi_exitcarry
dw OFFSET dpmi_exitcarry
dw OFFSET dpmi_exitok
dw OFFSET dpmi_exitok
dpmi_08 LABEL WORD
dw 02h
dw OFFSET int310800
dw OFFSET int310801
;******************************************************************************
;- HELPER PROCS
;******************************************************************************
dpmi_index_gdt PROC
test bl, 7
jnz dpmi_exitcarry
cmp bx, 0848h ; 0.93
jc dpmi_exitcarry
cmp bx, 512*8
jnc dpmi_exitcarry
mov si, OFFSET dosx_gdt
ret
dpmi_index_gdt ENDP
dpmi_check_gdt PROC
;
; bx = selector to start with
; cx = number of descriptors to check
; returns: bx = base selector or never returns
; never, never call with cx=0!
;
mov dx, cx
sub si, si
dpmi_find_one:
test BYTE PTR [si+bx+OFFSET dosx_gdt + 6], 10h
jnz SHORT dpmi_try_next
;
; well, at least this one is free
;
dec cx
jz SHORT dpmi_gdt_fine
;
; check subsequent descriptors
;
add si, 8
lea ax, [bx+si]
cmp ax, 512*8
jc SHORT dpmi_find_one
;
; executing the next instructions will also result in error and save some space
;
dpmi_try_next:
lea bx, [bx + si + 8]
cmp bx, 512 * 8
jnc dpmi_exitcarry
mov cx, dx ; restore count
jmp SHORT dpmi_find_one
dpmi_gdt_fine:
;
; mark descriptors as used, initialize do data r/w everything
; else = 0 /Wuschel 10/96: make sure the base actually is zero
;
mov DWORD PTR [si+bx+OFFSET dosx_gdt], 0
mov DWORD PTR [si+bx+OFFSET dosx_gdt+4], 109200h
sub si, 8
jnc SHORT dpmi_gdt_fine
mov cx, dx
ret
dpmi_check_gdt ENDP
dpmi_xam_int PROC
mov ax, dosx_sel_bigdos
mov fs, ax
sub si, si
call dpmi_xam_pmint
jnc SHORT dpmi_dosvec
mov si, OFFSET dosx_oldirqs
push ds
pop fs
dpmi_dosvec:
shl bx, 2
ret
dpmi_xam_int ENDP
dpmi_xam_pmint PROC
;
; check if the caller wants an irq- vector cf set if in 8..15, 70h..77h
;
mov bl, _bl[bp]
sub bh, bh
cmp bl, 8
jc SHORT dpmi_get_vec
cmp bl, 78h
jnc SHORT dpmi_get_vec
cmp bl, 10h
jc SHORT dpmi_get_irq
cmp bl, 70h
jc SHORT dpmi_get_vec
dpmi_get_irq:
and bl, 1fh
sub bl, 8
stc
ret
dpmi_get_vec:
clc
ret
dpmi_xam_pmint ENDP
dpmi_xam_picmap PROC
;
; check if the handler rEQUested is in pic shadow
;
mov ax, WORD PTR ds:[OFFSET dosx_pic1map]
cmp bl, al
jc SHORT dpmi_notinpic1
add al, 8
cmp bl, al
jnc SHORT dpmi_notinpic1
;
; is in pic1-shadow, index goes from 0..7
;
and bl, 7
stc
ret
dpmi_notinpic1:
cmp bl, ah
jc SHORT dpmi_notinpic2
add ah, 8
cmp bl, ah
jnc SHORT dpmi_notinpic2
;
; is in pic2-shadow, index goes from 8..15
;
or bl, 8
and bl, 0fh
stc
ret
dpmi_notinpic2:
shl bx, 3 ; clears carry!
ret
dpmi_xam_picmap ENDP
;******************************************************************************
;- INT 31h
;******************************************************************************
;------------------------------------------------------------------------------
;AX = 0000h ALLOCATE LDT DESCRIPTORS
; CX = # of descriptors to alloc.
; RET CF clear -> ok. AX = base selector /all have BASE 0 LIMIT 0 /data
; add the increment froom AX = 3 to get subsEQUent
;------------------------------------------------------------------------------
int310000:
;
; parse gdt for the requested block of descriptors (AVL= 0)
; start at gdt.282
;
mov bx, 282*8
mov cx, _cx[bp]
call dpmi_check_gdt
mov _ax[bp], bx
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0001h FREE LDT DESCRIPTOR
; BX = selector
; RET CF clear (1.0 sets all segregs containing bx to 0)
;------------------------------------------------------------------------------
int310001:
;
; mask bx to gdt/rpl0, refuse any call for selector < gdt.282 or > gdt.511
;
mov bx, _bx[bp]
call dpmi_index_gdt
;
; zero out the descriptor's AVL
;
mov BYTE PTR [bx+si+6], 0
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0002h SEGMENT 2 DESCRIPTOR
; BX = real mode segment
; RET CF clear AX = selector 64k /data???
; returned descriptor can never be modified or freed
; multiple calls return the same selector
;------------------------------------------------------------------------------
int310002:
;
; parse gdt for 64k 286 data descriptor that would fit, if not found, make one
; if gdt full, carry
;
mov eax, _ebx[bp-2]
mov edx, 109200h/16
shld edx, eax, 4
shl eax, 4
mov ax, 0ffffh
mov edi, edx ;be aware of acessed bit
or di, 100h
mov bx, 8
mov cx, 511
dpmi_findgdtloop1:
cmp eax, [bx+OFFSET dosx_gdt]
jnz SHORT dpmi_this_descriptor_is_not_the_one_we_are_looking_for
cmp edx, [bx+OFFSET dosx_gdt+4]
jz SHORT dpmi_finally_we_found_a_suitable_descriptor
cmp edi, [bx+OFFSET dosx_gdt+4]
jz SHORT dpmi_finally_we_found_a_suitable_descriptor
dpmi_this_descriptor_is_not_the_one_we_are_looking_for:
add bx, 8
loop SHORT dpmi_findgdtloop1
push eax
push edx
mov bx, 282*8
mov cx, 1
call dpmi_check_gdt
pop DWORD PTR [bx+OFFSET dosx_gdt+4]
pop DWORD PTR [bx+OFFSET dosx_gdt]
dpmi_finally_we_found_a_suitable_descriptor:
mov _ax[bp], bx
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0003h GET NEXT SELECTOR INC
; RET CF clear AX = INC
;------------------------------------------------------------------------------
int310003:
;
; return(8)
;
mov _al[bp], 8
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0004/0005 LOCK/UNLOCK SELECTOR (RESERVED)
; WE DO NOT SUPPORT THIS, SETTING CF
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;AX = 0006h GET SEGMENT BASE ADDRESS
; BX = SELECTOR
; RET CF clear CX:DX = linear base address
;------------------------------------------------------------------------------
int310006:
;
; only accept selectors 282..511, return the base from gdt if selector valid
; V 0.93 : Accept PSP, environment... as well
;
mov bx, _bx[bp]
test bx, 0FFF8h
jz dpmi_exitcarry
test bl, 7
jnz dpmi_exitcarry
cmp bx, 512*8
jnc dpmi_exitcarry
mov si, OFFSET dosx_gdt
cmp bx, 850h
jc SHORT @@skiptest
test BYTE PTR [bx+si+6], 10h
jz dpmi_exitcarry
@@skiptest:
mov eax, [bx+si+1]
mov al, [bx+si+7]
ror eax, 24
mov _cx[bp], ax
ror eax, 16
mov _dx[bp], ax
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0007h SET SEGMENT BASE ADDRESS
; BX = SELECTOR
; CX:DX = linear base
; RET CF clear
; (1.0 reloads segregs)
;------------------------------------------------------------------------------
int310007:
; only accept selectors 282..511, set base in gdt if selector valid
mov bx, _bx[bp]
call dpmi_index_gdt
test BYTE PTR [bx+si+6], 10h
jz dpmi_exitcarry
mov ax, _dx[bp]
ror eax, 16
mov ax, _cx[bp]
rol eax, 24
mov [bx+si+7], al
mov al, [bx+si+1]
mov [bx+si+1], eax
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0008h SET SEGMENT LIMIT
; BX = SELECTOR
; CX:DX = limit (-1 as in descriptor)
; RET CF clear
; limits > 1MB page aligned
; (1.0 reloads segregs)
;------------------------------------------------------------------------------
int310008:
;
; only accept selectors 282..511, shr limit 12 if limit > 100000h-1,
; set B- bit then, set limit in gdt if selector valid
;
mov bx, _bx[bp]
call dpmi_index_gdt
test BYTE PTR [bx+si+6], 10h
jz dpmi_exitcarry
mov ax, _cx[bp]
and BYTE PTR [bx+si+6], 70h ; reset granularity+limit high
test ax, ax
jz SHORT int310007001
or BYTE PTR [bx+si+6], 40h ; set B
int310007001:
ror eax, 16
mov ax, _dx[bp]
test eax, 0fff00000h ; greater 1MB?
jz SHORT dpmi_is_below_1meg
IFDEF NUCLEAR_FACILITY
mov cx, ax
and cx, 0fffh
inc cx
jnz dpmi_exitcarry
ENDIF
shr eax, 12 ; to pages
or BYTE PTR [bx + si + 6], 080h ; set granularity
dpmi_is_below_1meg:
mov [bx + si], ax
shr eax, 16
or BYTE PTR [bx + si + 6], al
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0009h SET ACC
; BX = SELECTOR
; CL = ACC/TYP - BYTE
; CH = EXT/TYP (32 bit stuff)
; RET CF clear
; if present bit clear, CL.0-3 may have any val.
; (1.0 reloads segregs)
;------------------------------------------------------------------------------
int310009:
;
; only accept selectors 282..511, set ACC if selector valid
;
mov bx, _bx[bp]
call dpmi_index_gdt
test BYTE PTR [bx + si + 6], 10h
jz dpmi_exitcarry
mov ax, _cx[bp]
;
; force dpl0+this one that must be zero:
;
and ax, 0C09Eh
;
; do not let the user program screw up our descr. management
;
and WORD PTR [bx+si+5], 01F00h
or WORD PTR [bx+si+5], ax
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 000Ah CREATE ALIAS
; BX = SELECTOR (CODESEG!)
; RET CF clear AX = datasel
;------------------------------------------------------------------------------
int31000A:
; only accept selectors 282..511, check if descriptor = code
; store acc modified descriptor, error if gdt full
mov bx, _bx[bp]
call dpmi_index_gdt
test BYTE PTR [bx + si + 6], 10h
jz dpmi_exitcarry
mov al, BYTE PTR [bx + si + 5]
;
; V 0.94 Don't do this since there seems to be software (DJGPP?) relying on
; this call to NOT fail for a data type selector even though the DPMI spec
; says it should fail. It doesn't fail in Win 95 either...
;
test al, 10h ; S=1?
jz dpmi_exitcarry
push DWORD PTR [bx + si]
push DWORD PTR [bx + si + 4]
mov cx, 1
mov bx, 8*282
call dpmi_check_gdt
pop eax
and ah, 0F0h ; modify type to data r/w
or ah, 2
pop DWORD PTR [bx + OFFSET dosx_gdt]
mov [bx + OFFSET dosx_gdt+4], eax
;
; V 0.94: it's always a good idea to give the selector back to the caller
;
mov _ax[bp], bx
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 000Bh GET DESCRIPTOR
; BX = LDT selector
; ES:(E)DI ^8 BYTE buffer (type of es descriptor!)
; RET CF clear, buffer filled
; (1.0 reloads segregs)
;------------------------------------------------------------------------------
int31000B:
;
; if gdt.282 < selector < gdt.511 return gdt.selector in ES:EDI
;
mov bx, _bx[bp]
call dpmi_index_gdt
test BYTE PTR [bx+si+6], 10h
jz dpmi_exitcarry
add si, bx
movzx esi, si
mov edi, _edi[bp]
movs DWORD PTR es:[edi], ds:[esi]
movs DWORD PTR es:[edi], ds:[esi]
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 000Ch SET DESCRIPTOR
; BX = LDT selector
; ES:(E)DI ^8 BYTE buffer (type of es descriptor!)
; RET CF clear, descriptor set
; (1.0 reloads segregs)
;------------------------------------------------------------------------------
int31000C:
;
; if selector > gdt.282 < gdt.511 get gdt.selector from ES:EDI
;
mov bx, _bx[bp]
call dpmi_index_gdt
test BYTE PTR [bx + si + 6], 10h
jz dpmi_exitcarry
mov edi, _edi[bp]
mov eax, DWORD PTR es:[edi]
mov DWORD PTR [bx + si], eax
mov eax, DWORD PTR es:[edi + 4]
or eax, 100000h ; set in use bit
mov DWORD PTR [bx + si + 4], eax
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 000Dh ALLOC SPECIFIC DESCRIPTOR
; BX = LDT selector
; RET CF clear
; (0004 - 007C)
; free with 0001
;------------------------------------------------------------------------------
; - not supported, return (carry), we have no LDT!
;------------------------------------------------------------------------------
;AX = 0100h DOS - ALLOC
; BX = # paras
; RET cf clear : AX = realmode seg /DX = first selector if called from 16bit
; cf set : BX = # paras free /AX = DOS ERROR CODE (21/59)
; never modify!
;------------------------------------------------------------------------------
int310100:
;
; issue int21- call, on success: create selectors
; check gdt for free descriptors to allocate + allocate
; calc how many selectors we would need
;
mov _ax[bp], 1Fh
;
; ...who is this damn "General Failure" and why is he reading MY harddisk?
;
movzx ecx, _bx[bp]
add ecx, 0fffh
shr ecx, 12
jz dpmi_exitcarry ; don't allocate 0 BYTE!
mov bx, 282*8
call dpmi_check_gdt
;
; - 0.94 call the old handler to avoid infinite recursion --
;
push bx
pushfd
mov ah, 48h
mov bx, _bx[bp]
call PWORD PTR cs:[OFFSET dosx_old21_ofs]
jnc SHORT dpmi_dosmem_ok
mov _ax[bp], ax
mov _bx[bp], bx
;
; deallocate gdt descriptors
;
pop bx
dpmi_stupid_deallocation_loop_resulting_from_bad_program_design:
mov BYTE PTR [bx+ OFFSET dosx_gdt+6], 0
add bx, 8
loop SHORT dpmi_stupid_deallocation_loop_resulting_from_bad_program_design
jmp dpmi_exitcarry
dpmi_dosmem_ok:
mov _ax[bp], ax ; store base
dpmi_from_310102:
pop bx
mov _dx[bp], bx ; store first selector
;
; cx=descriptor count
; Set base
;
mov edx, 500000h+9200h/16 ; B- bit doesn't hurt
shld dx, ax, 4
shl eax, 20
;
; get number of paras
;
mov si, _bx[bp]
mov ax, -1
push cx
dpmi_setgdtloop2:
sub si, 1000h
jnc SHORT dpmi_sgdtl_limit64k ; limit < 64k?
lea ax, [si+1000h] ; adjust limit
shl ax, 4
dec ax
dpmi_sgdtl_limit64k:
mov [bx + OFFSET dosx_gdt], eax
mov [bx + OFFSET dosx_gdt + 4], edx
add bx, 8 ; next selector
inc dl ; base=base+64k
loop SHORT dpmi_setgdtloop2
pop cx
dec cx
;
; Adjust limit of first descriptor to the overall limit
;
mov bx, _dx[bp] ; get first selector
mov [bx + OFFSET dosx_gdt], ax ; store limit low
or [bx + OFFSET dosx_gdt+6], cl ; store limit high
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0101h FREE DOS MEM
; DX = SELECTOR
; RET cf clear
; cf set : AX = DOS ERROR CODE (21/59)
; descriptors freed (1.0 zeros segregs)
;------------------------------------------------------------------------------
int310101:
;
; get segment(bx), switch to realmode, load segment into es, call int21/49
; back to pm, on success: free selectors calculated according to the limit
; field of bx
;
push _ax[bp]
mov _ax[bp], 1fh ; default error
mov bx, _dx[bp]
call dpmi_index_gdt
test BYTE PTR [bx + si + 6], 10h
jz dpmi_exitcarry
pop _ax[bp]
;
; get base
;
mov ecx, [bx + si + 2]
shr ecx, 4
;
; switch to realmode
;
call WORD PTR [dosx_raw2rm]
mov es, cx
mov ah, 49h
int 21h
pushf
push ax
;
; back to pm
;
call WORD PTR [dosx_raw2pm]
pop ax
popf
jnc SHORT dpmi_freeselec
mov _al[bp], al
jmp dpmi_exitcarry
dpmi_freeselec:
mov cl, [bx+si+6]
and cx, 0fh
inc cx
;
; cx = #descriptors to be freed
;
dpmi_freedescriptorloop:
mov BYTE PTR [bx+si+6], 0
add si, 8
loop SHORT dpmi_freedescriptorloop
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0102h MODIFY DOS MEM
; DX = SELECTOR, BX = NEW SIZE
; RET cf clear
; cf set : AX = DOS ERROR CODE (21/59) BX = MAXSIZE
; descriptors maybe freed (1.0 zeros segregs)
; increase will fail while next descriptor in use
;------------------------------------------------------------------------------
int310102:
;
; if increase check for descriptors
; get segment(dx), switch to realmode, load segment into es, call int21/4ah
; back to pm, on success: create/free selectors and so...
;
push _ax[bp]
mov _ax[bp], 1Fh
mov bx, _dx[bp]
call dpmi_index_gdt
mov dx, WORD PTR [bx + si + 6]
test dl, 10h
jz dpmi_exitcarry
;
; check for increase/decrease
;
and dx, 0Fh
;
; dx = #of descriptor allocated-1
;
inc dx
mov cx, _bx[bp]
add cx, 0FFFh
shr cx, 12 ; resize to zero = free
jz int310101
;
; cx = #of descriptor needed
;
push bx
push dx
push cx
sub cx, dx
jng SHORT dpmi_no_new_descriptors
;
; check gdt for cx free descriptors at dx*8
;
shl dx, 3
add bx, dx
dpmi_checkgdtloop2:
test BYTE PTR [bx+si+6], 10h ; already in use?
jnz dpmi_exitcarry ; so fail
add bx, 8
loop SHORT dpmi_checkgdtloop2
dpmi_no_new_descriptors:
;
; note the order we pop dx, cx!
;
pop dx
pop cx
pop bx
pop _ax[bp]
push bx
;
; get segment
;
mov edi, [bx + si + 2]
shr edi, 4
;
; switch to realmode
;
call WORD PTR [dosx_raw2rm]
mov es, di
mov ah, 4Ah
int 21h
pushf
push ax
;
; back to pm
;
call WORD PTR [dosx_raw2pm]
pop ax
popf
jnc SHORT dpmi_modify_dosmem
mov _al[bp], al
mov _bx[bp], bx
jmp dpmi_exitcarry
dpmi_modify_dosmem:
cmp cx, dx
mov ax, di
jng dpmi_from_310102
;
; free just all descriptors
;
pop bx
push bx
dpmi_setgdtloop3:
mov BYTE PTR [bx + si + 6], 0
add bx, 8
loop SHORT dpmi_setgdtloop3
;
; just have the base in ax and reuse 310100
;
jmp dpmi_from_310102
;------------------------------------------------------------------------------
;AX = 0200h GET RM IRVEC
; BL = INTNR
; RET CF clear CX:DX seg/ofs
;------------------------------------------------------------------------------
int310200:
;
; if bl not in (8...0fh, 70h..77h) get vector from memory, else get vector
; from oldirq- array
;
call dpmi_xam_int
mov ax, fs:[bx + si]
mov _dx[bp], ax
mov ax, fs:[bx + si + 2]
mov _cx[bp], ax
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0201h SET RM IRVEC
; BL = INTNR
; CX:DX seg/ofs
; RET CF clear
; don't forget to lock all IRQ mem via 0600!
;------------------------------------------------------------------------------
int310201:
;
; if bl not in (8...0fh, 70h..77h) set vector in memory, else set vector
; in oldirq- array
;
call dpmi_xam_int
mov ax, _dx[bp]
mov fs:[bx + si], ax
mov ax, _cx[bp]
mov fs:[bx + si + 2], ax
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0202h GET EXCEPTION HANDLER
; BL = EXC (0..1F)
; RET CF clear CX:(E)DX SEL/OFS
;------------------------------------------------------------------------------
INT310202:
movzx eax, _bl[bp]
cmp al, 32
jnc dpmi_exitcarry
mov edx, [eax * 8 + OFFSET dosx_ehandlers]
mov _edx[bp], edx
mov dx, [eax * 8 + OFFSET dosx_ehandlers+4]
mov _cx[bp], dx
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0203h SET EXCEPTION HANDLER
; BL = EXC (0..1F)
; CX/(E)DX sel/ofs
; RET CF clear
; refer to intlist for stackframe /handler does far ret
;------------------------------------------------------------------------------
INT310203:
movzx eax, _bl[bp]
cmp al, 32
jnc dpmi_exitcarry
mov edx, _edx[bp]
mov [eax * 8 + OFFSET dosx_ehandlers], edx
mov dx, _cx[bp]
mov [eax * 8 + OFFSET dosx_ehandlers + 4], dx
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0204h GET INTERRUPT HANDLER
; BL = INT
; RET CF clear CX:(E)DX SEL/OFS
;------------------------------------------------------------------------------
INT310204:
call dpmi_xam_pmint ; check if irq wanted
jc SHORT dpmi_pmget_isirq
call dpmi_xam_picmap ; check if in pic shadow
jc SHORT dpmi_pmget_shadow
;
; not an irq, not in pic shadow, so address the idt
; 0.94 check whether shadow for exceptions 10-1F
; if so, bx is in the range 80h...0f8h
;
test bh, bh
jnz SHORT dpmi_pmget_noes
test bl, bl
mov si, OFFSET dosx_int10to1F - 80h
js SHORT dpmi_getpm_ex
dpmi_pmget_noes:
mov ax, WORD PTR [bx+OFFSET dosx_idt+2] ; selector
mov _cx[bp], ax
mov ax, WORD PTR [bx+OFFSET dosx_idt]
mov _dx[bp], ax ; OFFSET low
mov ax, WORD PTR [bx+OFFSET dosx_idt+6]
mov _dx[bp+2], ax ; OFFSET high
jmp dpmi_exitok
dpmi_pmget_isirq:
mov si, OFFSET dosx_pmirqtab
jmp SHORT dpmi_getpm_tab
dpmi_pmget_shadow:
mov si, OFFSET dosx_pic1backup
dpmi_getpm_tab:
shl bx, 3
dpmi_getpm_ex:
mov eax, [bx+si]
mov _edx[bp], eax
mov ax, [bx+si+4]
mov _cx[bp], ax
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0205h SET INTERRUPT HANDLER
; BL = INT
; CX/(E)DX sel/ofs
; RET CF clear
; refer to intlist for stackframe /handler does far ret
;------------------------------------------------------------------------------
INT310205:
call dpmi_xam_pmint ; check if irq wanted
jc SHORT dpmi_pmset_isirq
call dpmi_xam_picmap ; check if in pic shadow
jc SHORT dpmi_pmset_shadow
;
; not an irq, not in pic shadow, so address the idt
; 0.94 check whether shadow for exceptions 10-1F
; if so, bx is in the range 80h...0f8h
;
test bh, bh
jnz SHORT dpmi_pmset_noes
test bl, bl
mov si, OFFSET dosx_int10to1F - 80h
js SHORT dpmi_setpm_ex
dpmi_pmset_noes:
mov ax, _cx[bp]
mov WORD PTR [bx + OFFSET dosx_idt + 2], ax ; selector
mov ax, _dx[bp] ; OFFSET low
mov WORD PTR [bx + OFFSET dosx_idt], ax
mov ax, _dx[bp + 2] ; OFFSET high
mov WORD PTR [bx + OFFSET dosx_idt + 6], ax
jmp dpmi_exitok
dpmi_pmset_isirq:
movzx ebx, bl
btr dosx_pmhands, ebx ; reset handler installed bit
cmp _cx[bp], 0800h ; check for old handler
jc SHORT dpmi_set_oldhandler
bts dosx_pmhands, ebx ; set handler installed bit
dpmi_set_oldhandler:
mov si, OFFSET dosx_pmirqtab
jmp SHORT dpmi_setpm_tab
dpmi_pmset_shadow:
mov si, OFFSET dosx_pic1backup
dpmi_setpm_tab:
shl bx, 3
dpmi_setpm_ex:
mov eax, _edx[bp]
mov [bx + si], eax
mov cx, _cx[bp]
mov [bx + si + 4], cx
shr bx, 3
cmp bl, 1Ch
jne dpmi_exitok
movzx ebx, bl
btr dosx_pmhands, ebx ; reset handler installed bit
cmp cx, 8 + (1Ch * 8)
je dpmi_exitok
bts dosx_pmhands, ebx ; set handler installed bit
jmp dpmi_exitok
;------------------------------------------------------------------------------
; TRANSLATION SERVICES
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;AX = 0300h SIMULATE RM INTERRUPT
;------------------------------------------------------------------------------
INT310300:
; check if we are _really_ reentrant
mov bl, _bl[bp]
mov ax, 200h
int 31h
jmp SHORT dpmi_300
;------------------------------------------------------------------------------
;AX = 0301h CALL REALMODE PROC / RETF
;------------------------------------------------------------------------------
INT310301:
;------------------------------------------------------------------------------
;AX = 0302h CALL REALMODE PROC / IRET
;------------------------------------------------------------------------------
INT310302:
mov esi, _edi[bp]
mov cx, es:[esi._cs]
mov dx, es:[esi._ip]
dpmi_300:
mov dpmi_rmcall_o, dx
mov dpmi_rmcall_s, cx
;
; set up realmode stack
;
push ds ; xchg ds, es
push es
pop ds
pop es
push ds ; save callers es
movzx edi, sp ; default = DPMISTACK
sub di, 6 ; make sure we're free
;
; at this point we had to check for user stack.
; we avoid alot of trouble by using an internal stack no matter of ss:sp
; in caller struc
;
mov dx, ds ; caller struc selector
std
;
; copy a couple of wordss from caller stack
;
movzx ecx, _cx[bp]
mov esi, _oldesp[bp]
;
; skip iretd frame+4 selectors pushed, address to - down
;
lea esi, [esi+ecx*2 +12 +8]
mov ds, _oldss[bp]
rep movs WORD PTR es:[edi], ds:[esi]
mov esi, _edi[bp] ; get call struc address
mov ds, dx
;
; if not ax=0301 store flags
;
cmp _al[bp], 1
jz SHORT dpmi_isfarcall
mov ax, ds:[esi._flags]
;
; mask some off
;
and ah, 0Ch
stosw ; on stack
dpmi_isfarcall:
;
; prepare popad, pop segreg
;
add esi, 26h ; fs in caller struc
movs DWORD PTR es:[edi], ds:[esi] ; gs, fs
movs DWORD PTR es:[edi], ds:[esi] ; ds, es
sub esi, 2 ; ignore flags so far
mov cl, 8
;
; move general registers
;
rep movs DWORD PTR es:[edi], ds:[esi]
;
; adjust stack
;
add di, 4
mov sp, di
push ax ; fire off flags
;
; switch to realmode
; look at the trouble we've gone through to get it looking _that_ nice,
; ooooh, doesn't this look nice? (would look even better if it really works :)
; so, here we go:
;
;------------------------------------------------------------------------------
; REALMODE FARCALL:
;------------------------------------------------------------------------------
call WORD PTR cs:[OFFSET dosx_raw2rm]
popf
popad
pop es
pop ds
pop fs
pop gs
db 09ah
dpmi_rmcall_o dw ?
dpmi_rmcall_s dw ?
push gs
push fs
push ds
push es
pushad
pushf
call WORD PTR cs:[OFFSET dosx_raw2pm]
;"...DAMN, I'M LOOKING GOOD!" (D.NUKEM)
;------------------------------------------------------------------------------
; REALMODE FARCALL DONE
;------------------------------------------------------------------------------
;
; now it's time to cleanup
;
cld ; copying upwards
movzx esi, sp
mov edx, esi
;
; Q: "where's the caller's es ?"
; A: "hmm, long story...!"
;
; on stack there were: old ss 2
; old esp 4
; pushad 32
; push es 2
; ------------------------------------------
; sum (bytes) 40
;
mov bp, dosx_lastintstack
sub bp, 38
mov sp, bp
sub sp, 2
pop es
add si, 2 ; ignore flags
;
; copy general registers
;
mov ecx, 8
mov edi, _edi[bp]
rep movs DWORD PTR es:[edi], ds:[esi]
;
; restore flags
;
mov ax, ds:[edx]
and ah, 0Ch
and WORD PTR es:[edi], 0F000h
or WORD PTR es:[edi], ax
add edi, 2
;
; copy segment registers
;
movs DWORD PTR es:[edi], ds:[esi]
movs DWORD PTR es:[edi], ds:[esi]
;
; copy stack parameters
;
mov cx, _cx[bp]
mov edi, _oldesp[bp]
add edi, 20
mov dx, es
mov es, _oldss[bp]
rep movs WORD PTR es:[edi], ds:[esi]
mov es, dx
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0303h ALLOCATE REALMODE CALLBACK
;------------------------------------------------------------------------------
INT310303:
; find free callback address
mov si, OFFSET dosx_callback_entry+3
mov cx, 16
dpmi_findcallback:
cmp BYTE PTR [si], 0
jz SHORT dpmi_callbackfound
add si, 4
loop SHORT dpmi_findcallback
jmp dpmi_exitcarry
dpmi_callbackfound:
mov BYTE PTR [si], 1
sub si, 3
mov _dx[bp], si
sub si, OFFSET dosx_callback_entry
mov ax, dosx_patch1
mov _cx[bp], ax
add si, si
mov eax, _esi[bp]
mov ebx, _edi[bp]
mov DWORD PTR [si+OFFSET dosx_callback_procs], eax
mov DWORD PTR [si+OFFSET dosx_callback_strucs], ebx
mov WORD PTR [si+4+OFFSET dosx_callback_procs], fs
mov WORD PTR [si+4+OFFSET dosx_callback_strucs], es
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0304h FREE REALMODE CALLBACK
;------------------------------------------------------------------------------
INT310304:
;
; 2do: error checking in case the user has a terroristic mentality
;
mov si, _dx[bp]
mov BYTE PTR [si + 3], 0
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0400h GET VERSION
;
; RET CF clear
; AX = MAJOR/MINOR VERSION
; BX = FLAGS
; CL = CPU
; DH = MASTER PIC
; DL = SLAVE PIC
;------------------------------------------------------------------------------
INT310400:
;
; stupid moves
;
mov _ax[bp], 9
mov _bx[bp], 1
test dosx_mode, vcpi_used
jnz SHORT dpmi_reflect_v86
mov _bl[bp], 3
dpmi_reflect_v86:
mov al, dosx_cpu_type
mov _cl[bp], al
mov ah, dosx_pic1map
mov al, dosx_pic2map
mov _dx[bp], ax
jmp dpmi_exitok
; ############################################################################
;
; memory management:
; a block handle is an index in mcb- array
; the mcb-table'first entry is linear start, the second entry contains
; the end address (linear) +1 of that block
; so we can handle resizing / releasing of blocks to some extend
; translation structure handle - OFFSET in mcb
;
;
; Oviously not the high- tech way to sort a small table, but small size and
; it took me 4 minutes to type in :)
;
dpmi_bsort PROC
dpmi_bsort_start:
sub dx, dx
mov cx, MAX_MEM_HANDLES
mov di, dosx_free_mcbs
sub cx, di
jz @@bsortDone
;
; We include one more block into the sort if di ! = 0
;
shl di, 3
lea di, [di + OFFSET dosx_mcb - 8]
jnz dpmi_bsort_loop
add di, 8
dec cx
dpmi_bsort_loop:
mov eax, [di]
cmp eax, [di + 8]
jna SHORT dpmi_bsort_noxchg
xchg eax, [di + 8]
mov [di], eax
mov eax, [di + 4]
xchg [di + 12], eax
mov [di + 4], eax
inc dx
dpmi_bsort_noxchg:
add di, 8
loop SHORT dpmi_bsort_loop
test dx, dx
jnz SHORT dpmi_bsort_start
@@bsortDone:
ret
dpmi_bsort ENDP
dpmi_getblock PROC
;
; ebx = blocksize (bytes)
; returns: linear base of block in edx or carry
; 0.93 force DWORD aligment
;
add ebx, 3
and bl, 0FCh
mov di, OFFSET dosx_mcb
mov edx, 400000h ;suggested start address
mov cx, MAX_MEM_HANDLES
dpmi_findblockloop:
mov eax, [di]
test eax, eax ;skip unused entries
jz SHORT dpmi_ignore_mcb
dpmi_check_edx:
;
; check if there there is room below that block
;
sub eax, ebx
jc SHORT dpmi_adjust_edx
cmp eax, edx
jnc SHORT dpmi_checkmemmax
dpmi_adjust_edx:
;
; if not, base address >= address of this block
;
mov edx, [di + 4]
dpmi_ignore_mcb:
add di, 8
loop dpmi_findblockloop
dpmi_checkmemmax:
mov eax, dosx_memavail
shl eax, 12
add eax, 400000h ; add start of user mem
sub eax, ebx ; sub desired size
jc SHORT dpmi_gp_end
cmp eax, edx ; must be >=min possible start address
dpmi_gp_end:
ret
dpmi_getblock ENDP
dpmi_findblock PROC NEAR
;
; In: EAX = block start
; Out: EDI = block # or CF set on error
;
mov edi, MAX_MEM_HANDLES
@@fbLoop:
sub di, 1
jc @@fbError
cmp DWORD PTR [edi * 8 + OFFSET dosx_mcb], eax
jc @@fbError
jne @@fbLoop
@@fbError:
ret
dpmi_findblock ENDP
; ############################################################################
;------------------------------------------------------------------------------
;AX = 0500h GET FREE MEMORY (ADVISORY)
;------------------------------------------------------------------------------
INT310500:
;
; "zero-1" out the buffer
;
mov eax, -1
mov ecx, 12
mov edi, _edi[bp]
rep stos DWORD PTR es:[edi]
mov edi, _edi[bp]
;
; sum up used memory ( all new in 0.93 )
;
sub edx, edx
mov bx, OFFSET dosx_mcb
dosx093_fix31500_0:
mov eax, [bx]
test eax, eax
jz SHORT dosx093_fix31500_1
sub eax, [bx + 4]
add edx, eax
dosx093_fix31500_1:
add bx, 8
cmp bx, OFFSET dosx_mcb + ((MAX_MEM_HANDLES - 1) * 8)
jna SHORT dosx093_fix31500_0
mov eax, dosx_memavail
mov es:[edi + 18h], eax
shl eax, 12
add edx, eax
mov es:[edi], edx
shr edx, 12
mov es:[edi + 4], edx
mov es:[edi + 8], edx
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0501h ALLOC MEMORY BLOCK
; BX:CX = LINEAR SIZE
;RETURNS
; BX:CX = LINEAR START
; SI:DI = MEMORY BLOCK HANDLE
;------------------------------------------------------------------------------
INT310501:
cmp dosx_free_mcbs, 0
je dpmi_exitcarry
mov ebx, DWORD PTR _bx[bp - 2] ; get high WORD of linear size
mov bx, _cx[bp] ; get low WORD
call dpmi_getblock
jc dpmi_exitcarry
dec dosx_free_mcbs
movzx ecx, dosx_free_mcbs
;
; store mcb
;
dpmi_from_310503:
mov [ecx * 8 + OFFSET dosx_mcb], edx
add ebx, edx
mov [ecx * 8 + OFFSET dosx_mcb + 4], ebx
mov _cx[bp], dx
mov _di[bp], dx
ror edx, 16
mov _bx[bp], dx
mov _si[bp], dx
call dpmi_bsort
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0502h FREE MEMORY BLOCK
; SI:DI = MEMORY BLOCK HANDLE
;RETURNS
; CF cler/set
;------------------------------------------------------------------------------
INT310502:
mov eax, _esi[bp-2]
mov ax, _di[bp]
call dpmi_findblock
jc dpmi_exitcarry
;
; edi = mcb #
;
mov DWORD PTR [edi * 8 + OFFSET dosx_mcb], 0
call dpmi_bsort
inc dosx_free_mcbs
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0503h RESIZE MEMORY BLOCK
; BX:CX = LINEAR SIZE
; SI:DI = MEMORY BLOCK HANDLE
;RETURNS
; BX:CX = LINEAR START
; SI:DI = MEMORY BLOCK HANDLE
;------------------------------------------------------------------------------
INT310503:
mov eax, _esi[bp-2]
mov ax, _di[bp]
call dpmi_findblock
jc dpmi_exitcarry
mov ebx, DWORD PTR _bx[bp-2] ; get high WORD of linear size
mov bx, _cx[bp] ; get low WORD
;
; 0.93 force alignment to DWORD
;
add ebx, 03
and bl, 0FCh
mov eax, [edi * 8 + OFFSET dosx_mcb]
mov edx, eax
;
; ebx = new size rEQUested
; eax = old start address of block
; edi = #mcb (0..MAX_MEM_HANDLES-1)
;
add eax, ebx
;
; eax = desired new end address
;
sub eax, [edi * 8 + OFFSET dosx_mcb + 4]
jbe dpmi_shrink
;
; eax = size difference
; now try to resize the block + EAX bytes
;
mov edx, 400000h
;
; 1. special case: first block?
;
test di, di
jz SHORT dpmi_firstblock
cmp DWORD PTR [edi * 8 + OFFSET dosx_mcb - 8], 0
jz SHORT dpmi_firstblock
;
; nope, get end address from previous block
;
mov edx, [edi * 8 + OFFSET dosx_mcb - 4]
dpmi_firstblock:
;
; edx = start of block to resize
; eax = size difference
;
mov ecx, dosx_memavail
shl ecx, 12
add ecx, 400000h
;
; ecx = maximum possible end address
; 2. special case: last block?
;
cmp di, MAX_MEM_HANDLES - 1
jz SHORT dpmi_lastblock
mov ecx, [edi * 8 + OFFSET dosx_mcb + 8]
dpmi_lastblock:
;
; the hole is now the range from edx up to ecx
; temporary fix (0.93)
;
push ebx
mov ebx, [edi*8 + OFFSET dosx_mcb + 4]
add ebx, eax
cmp ebx, ecx
pop ebx
ja SHORT dpmi_moveblock
;
; now we know that the block fits into the hole
; check if start adresses are the same
;
cmp edx, [edi * 8 + OFFSET dosx_mcb]
jz SHORT dpmi_shrink ;just update end
;
; else do a memcopy
;
dpmi_from_below:
;
; get old start
;
sub esi, esi
xchg esi, [edi*8 + OFFSET dosx_mcb]
;
; get old size
;
mov ecx, [edi*8 + OFFSET dosx_mcb+4]
sub ecx, esi
;
; get target
;
push edi
mov edi, edx
push ds
push dosx_sel_data0
pop ds
push ds
pop es
rep movs BYTE PTR es:[edi], ds:[esi]
pop ds
pop ecx
;
; Pass info back
;
jmp dpmi_from_310503
dpmi_moveblock:
;
; here we go if the block did not fit into its old "hole"
;
push edi
call dpmi_getblock
;
; new block address in edx
;
pop edi
jc dpmi_exitcarry
jmp SHORT dpmi_from_below
dpmi_shrink:
;
; trivial case edx=linear start
;
add [edi*8+OFFSET dosx_mcb+4], eax
mov _cx[bp], dx
shr edx, 16
mov _bx[bp], dx
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0604h GET PAGE SIZE
;RETURNS
; BX:CX = SIZE IN bytes
;------------------------------------------------------------------------------
INT310604:
mov _cx[bp], 4096
mov _bx[bp], 0
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0800h MAP PHYSICAL REGION
; BX:CX = PHYSICAL OFFST
; SI:DI = SIZE
;RETURNS
; BX:CX = LINEAR ADRESS
;------------------------------------------------------------------------------
INT310800:
;
; major change in 0.94 final: reserve the entire linear memory space between
; 2Gb and 3Gb as potential candidate for physical adress mappings
; during initialization, this part of the page directory is set up as if the
; entire first megaBYTE was filled up with page tables. Furthermore, the
; HIGH 16 bits of the corresponding entry in the first page table contain
; the segment we obtained from DOS while allocating space for the page tables.
;
movzx ebx, _cx[bp] ; get lower 16 bits
and bh, 0Fh ; mask off don't care
mov ax, _si[bp]
shl eax, 16
mov ax, _di[bp] ; EAX = size
lea ebx, [eax + ebx + 0FFFh]
shr ebx, 12 ; EBX = number of pages
jnz SHORT dpmi_310800_0
inc bx
dpmi_310800_0:
;
; EBX now contains the needed DOS memory in DWORDS. Since we can only store
; 256 different segment adresses, we must make sure that we allocate at least
; 4k page table memory.
;
push ebx
shr ebx, 2 ; DWORD to paragraphs
test bh, bh
jnz SHORT dpmi_310800_1
mov bx, 100h ; allocate 4k
dpmi_310800_1:
mov ah, 48h
pushfd
call PWORD PTR cs:[OFFSET dosx_old21_ofs]
pop ebx
jc dpmi_exitcarry
;
; the linear address to return is 2GB + AH * 4Mb + AL * 16k + lower 12 bits
; of physical base (or AX shl 14 + 2GB + lower 12 bits for that matter)
;
push dosx_sel_data0
pop es
movzx esi, ah
mov edi, dosx_cr3_base
;
; now that we've got our index, store real mode segment
;
mov es:[edi + esi * 4 + 4096 + 2048 + 2], ax
;
; fill the page table(s) accordingly
;
movzx eax, ax
mov cx, _bx[bp]
shl ecx, 16
mov cx, _cx[bp]
and cx, 0f000h
shl ebx, 12
lea ecx, [ebx + ecx + 1fh - 1000h]
shr ebx, 12
shl eax, 4
dpmi_310800_2:
mov es:[eax + ebx * 4 - 4], ecx
sub ecx, 1000h
dec ebx
jnz SHORT dpmi_310800_2
shl eax, 10
and _cx[bp], 0fffh ; isolate odd bits
or _cx[bp], ax ; bits 15 and 14
shr eax, 16
or ah, 80h ; start at 2Gb
mov _bx[bp], ax
jmp dpmi_exitok
;------------------------------------------------------------------------------
;AX = 0801h UNMAP PHYSICAL REGION
; BX:CX = LINEAR ADDRESS
;RETURNS
; CF ON ERROR, AX = 8025h
;------------------------------------------------------------------------------
INT310801:
movzx eax, _bx[bp]
and ah, 03fh
shr eax, 6
push dosx_sel_data0
pop es
mov edi, dosx_cr3_base
mov si, es:[edi + eax * 4 + 4096 + 2048 + 2]
test si, si
jz SHORT dpmi31801f
mov WORD PTR es:[edi + eax * 4 + 4096 + 2048 + 2], 0
call WORD PTR [dosx_raw2rm]
mov es, si
mov ah, 49h
int 21h
pushf
call WORD PTR [dosx_raw2pm]
popf
jnc dpmi_exitok
dpmi31801f:
mov _ax[bp], 8025h
; jmp dpmi_exitcarry
; DON'T FORGET TO PUT THAT IN AGAIN IF SOMETHING COMES INBETWEEN!
; ############################################################################
dpmi_exitcarry:
mov sp, bp
popad
;
; release int stack
;
sub ds:dosx_lastintstack, dosx_intstacksize
pop ds:dosx_isr_esp
;
; restore stack
;
pop ss
mov esp, ds:dosx_isr_esp
;
; restore selectors
;
pop gs
pop ds
pop fs
pop es
or BYTE PTR [esp+8], 1
iretd
dpmi_exitok:
mov sp, bp
popad
pop ds:dosx_isr_esp
;
; DJGPP: Check stack for validity, otherwise we'd end up with a triple fault.
;
push eax
mov ax, [esp + 4]
lsl eax, eax
cmp eax, ds:dosx_isr_esp
ja int31StackValid
;
; Something has messed with the stack somewhere. Whoever did that
; would probably want to fix this in their stack fault handler (DJGPP)
;
pop ds:dosx_exc_eax
pop ax
push eax
push ds:dosx_isr_esp
pushfd
db 66h
push cs
db 66h
push OFFSET int31FaultLoc
mov eax, 12 ; stack fault
mov ds:dosx_exc_ds, ds
jmp dosx_simulate_exc
int31StackValid:
;
; restore stack
;
pop eax
pop ss
mov esp, ds:dosx_isr_esp
;
; release int stack
;
sub ds:dosx_lastintstack, dosx_intstacksize
;
; restore selectors
;
int31FaultLoc:
pop gs
pop ds
pop fs
pop es
and BYTE PTR [esp + 8], 0FEh
iretd
; ############################################################################
; ## Initialized global data ##
; ############################################################################
align DWORD
dosx_lastintstack dw OFFSET dosx_intstacks
dosx_free_mcbs dw MAX_MEM_HANDLES
dosx_pmhands dd 0
dosx_pagecount dd 0 ; total pages allocated > 1MB
dosx_memavail dd 0 ; pages available at init
dosx_E801size dd 0 ; above 16MB in pages
dosx_E801start dd 1000000h
; dosx_api_flag db 0 ; 1 = DOS/4G - mode
dosx_exc_string db 0dh, 0ah, 'Hi, I', 39, 'm exception %4 at %4:%8 !'
db 0dh, 0ah, 'EAX=%8 EBX=%8 ECX=%8 EDX=%8'
db 0dh, 0ah, 'ESI=%8 EDI=%8 EBP=%8 ESP=%8'
db 0dh, 0ah, 'EFLAGS=%8 ERRORCODE=%8 (may be rubbish)'
db 0dh, 0ah, 'SS=%4 DS=%4 ES=%4 FS=%4 GS=%4'
db 0dh, 0ah, 0
trm EQU 0Dh, 0Ah, '$'
dosx_msg_nomode db 'V86 but no DPMI/VCPI!', trm
dosx_msg_noextmem db 'Insufficient extended memory!', trm
dosx_msg_wrongcpu db 'Need 386+ CPU!', trm
dosx_msg_envbad db 'Bad program environment!', trm
;dosx_msg_dpmi16 db 'DPMI error: host not 32 bit!', trm
dosx_msg_nomem db 'Insufficient DOS- memory!', trm
dosx_msg_openerr db 'Error loading 32 bit overlay!', trm
dosx_msg_dpmierr db 'DPMI mode switch error!', trm
dosx_msg_nointstacks db 'Out of interrupt stacks!', trm
dosx_msg_a20 db 'A20 error!', trm
dosx_msg_dpmi db 'INT 31 error!', trm
IFDEF __WATCOM__
;#############################################################################
dosx_lestruc_start LABEL BYTE
include loadle.inc
dosx_lestruc_end LABEL BYTE
;#############################################################################
ENDIF
align DWORD
dosx_endsegment LABEL NEAR
;---------------------- uninitialized data ------------------------------------
variables LABEL NEAR
;
; Wfse cacheing status
;
wfse_current_handle dw ?
wfse_current_decomp dw ?
wfse_current_block dd ?
wfse_current_last dd ?
wfse_current_dir_offset dd ?
wfse_current_raw_offset dd ?
dosx_linear_start dd ?
dosx_intvectors dd 256 dup (?)
dosx_idt dq 256 dup (?)
dosx_gdt dq 512 dup (?)
dosx_pic1backup dq 8 dup (?)
dosx_pic2backup dq 8 dup (?)
dosx_himem dd ?
dosx_v86struc dd ?
;VCPI modeswitch struc
dosx_cr3_base dd ?
dosx_gdtr_linear dd ?
dosx_idtr_linear dd ?
dosx_ldt_dummy dw ?
dosx_tr_dummy dw ?
dosx_pm_offset dd ?
dosx_pm_selector dw ?
dw ? ; I'm here for alignment
;end modeswitch struc
dosx_switch_ss dw ?
dw ?
dosx_esp_new dd ?
dosx_switch_esp dd ?
dosx_r2p_int dd ?
dosx_dpmi dd ?
dosx_gdtr LABEL PWORD
dosx_gdt_limit dw ?
dosx_gdt_base dd ?
dosx_idtr LABEL PWORD
dosx_idt_limit dw ?
dosx_idt_base dd ?
dosx_isr_esp dd ?
dosx_rm_idt dp ?
dosx_rm_gdt dp ?
dosx_envseg dw ?
dosx_raw2rm dw ?
dosx_raw2pm dw ?
dosx_isr_ss dw ?
dosx_xmshandle dw ?
dw ? ; padding
dosx_xmssize dd ?
dosx_extsize dw ?
dosx_fhandle dw ?
dosx_pspseg dw ?
dosx_tableblock dw ?
dosx_cpu_type db ?
dosx_mode db ?
dosx_pic1map db ?
dosx_pic2map db ?
dosx_oldirqs LABEL DWORD
dd 16 dup (?) ;16 IRQ
;
; Note: These must remain in that order!
;
dosx_pmirqtab LABEL QWORD
dq 16 dup (?) ;16 IRQ
dosx_int10to1F dq 16 dup (?) ;INT Redirector from IDT (0.94)
;
; Resulting "IRQ" assignment for INT 1Ch passup = IRQ 1Ch
;
; End of "these must remain in that order"
;
dosx_ehandlers dq 32 dup (?) ;16 Exception handlers (V0.93)
;32 Exception handlers (V0.94)
dosx_dummytss db 104 dup (?)
dosx_int31struc db dosx_int31strucsize dup (?)
dosx_int33struc db dosx_int31strucsize dup (?)
dosx_mouse_proc dq ?
dosx_mouse_rmcallback_seg dw ?
dosx_mouse_rmcallback_ofs dw ?
dosx_callback_procs dq 16 dup (?)
dosx_callback_strucs dq 16 dup (?)
dpmi_cb_addx dd 16 dup (?)
dpmi_cb_dest dq 16 + 8 dup (?)
dosx_callback_sstemp dw ?
dosx_callback_sptemp dw ?
dosx_callback_cstemp dw ?
dosx_callback_iptemp dw ?
dosx_callback_fltemp dw ?
dosx_callback_idtemp dw ?
dosx_mouse_bitmap dw 32 dup (?)
dosx_mcb dd MAX_MEM_HANDLES*2 dup (?)
;flat segment maintainance
dosx_api_return_flags dd ?
dosx_api_return_esp dd ?
dosx_flat_handle dd ?
dosx_dta_offset dd ?
dosx_dta_selector dw ?
dw ? ; filler
dosx_flat_sel_data dw ?
dosx_flat_sel_code dw ?
dosx_flat_sel_data16 dw ?
dosx_pspsel dw ?
dosx_flat_sel_dos dw ?
dosx_flat_seg_dos dw ?
dosx_dta db 80h dup (?)
; dpmi_xref db MAX_MEM_HANDLES dup (?)
WfseFcbs db MAX_WFSE_FCBS*SIZE_OF_FCB dup (?)
dosx_intstacks LABEL NEAR
dw 16 * dosx_intstacksize/2 dup (?)
dosx_stack LABEL NEAR
dosx_stackbegin db stacksize dup (?)
align DWORD
dosx_top_of_memory LABEL NEAR
code16 ends
end start
| 20.821618
| 103
| 0.625134
|
94c5bc11062247ec32023363639415f525f794b5
| 556
|
asm
|
Assembly
|
libsrc/_DEVELOPMENT/stdio/c/sdcc_iy/fgetpos_callee.asm
|
meesokim/z88dk
|
5763c7778f19a71d936b3200374059d267066bb2
|
[
"ClArtistic"
] | null | null | null |
libsrc/_DEVELOPMENT/stdio/c/sdcc_iy/fgetpos_callee.asm
|
meesokim/z88dk
|
5763c7778f19a71d936b3200374059d267066bb2
|
[
"ClArtistic"
] | null | null | null |
libsrc/_DEVELOPMENT/stdio/c/sdcc_iy/fgetpos_callee.asm
|
meesokim/z88dk
|
5763c7778f19a71d936b3200374059d267066bb2
|
[
"ClArtistic"
] | null | null | null |
; int fgetpos_callee(FILE *stream, fpos_t *pos)
INCLUDE "clib_cfg.asm"
SECTION code_stdio
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_MULTITHREAD & $02
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC _fgetpos_callee
EXTERN asm_fgetpos
_fgetpos_callee:
pop hl
pop ix
ex (sp),hl
jp asm_fgetpos
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ELSE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC _fgetpos_callee
EXTERN _fgetpos_unlocked_callee
defc _fgetpos_callee = _fgetpos_unlocked_callee
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
| 15.027027
| 47
| 0.507194
|
75fd1ae45b6998bff2ce4691cc475e42d303f143
| 606
|
asm
|
Assembly
|
oeis/173/A173805.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/173/A173805.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/173/A173805.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A173805: a(n) = (6*10^n-51)/9 for n>0.
; 1,61,661,6661,66661,666661,6666661,66666661,666666661,6666666661,66666666661,666666666661,6666666666661,66666666666661,666666666666661,6666666666666661,66666666666666661,666666666666666661,6666666666666666661,66666666666666666661,666666666666666666661,6666666666666666666661,66666666666666666666661,666666666666666666666661,6666666666666666666666661,66666666666666666666666661,666666666666666666666666661,6666666666666666666666666661,66666666666666666666666666661,666666666666666666666666666661
mov $1,10
pow $1,$0
mul $1,12
div $1,9
mul $1,5
sub $1,4
mov $0,$1
| 55.090909
| 496
| 0.863036
|
bb02e0f44a6aff476399a5c86e92aa3769dd7e31
| 8,690
|
asm
|
Assembly
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_1573.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_1573.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_1573.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x108d0, %rsi
lea addresses_A_ht+0xbac0, %rdi
nop
nop
nop
nop
nop
dec %rbx
mov $95, %rcx
rep movsl
nop
nop
nop
nop
nop
cmp $30965, %r10
lea addresses_normal_ht+0x13300, %r14
nop
cmp $57611, %r12
mov (%r14), %esi
nop
nop
xor %r12, %r12
lea addresses_WC_ht+0x123c0, %rsi
lea addresses_WT_ht+0xd640, %rdi
clflush (%rdi)
nop
nop
nop
nop
and %rdx, %rdx
mov $4, %rcx
rep movsl
nop
nop
nop
nop
sub $51490, %rbx
lea addresses_normal_ht+0x12d40, %rsi
lea addresses_UC_ht+0x10ade, %rdi
nop
nop
nop
nop
nop
and $61838, %rbx
mov $108, %rcx
rep movsw
dec %rbx
lea addresses_A_ht+0x1b780, %rsi
lea addresses_normal_ht+0x7a71, %rdi
nop
nop
add %r10, %r10
mov $90, %rcx
rep movsw
inc %rsi
lea addresses_WT_ht+0x5dc0, %rsi
lea addresses_WC_ht+0x6ac0, %rdi
nop
nop
nop
nop
nop
add $25831, %rbx
mov $92, %rcx
rep movsq
xor $16634, %rcx
lea addresses_A_ht+0x9c0, %rcx
nop
nop
nop
nop
add $42771, %rdi
mov (%rcx), %r12
nop
nop
add %rsi, %rsi
lea addresses_UC_ht+0x3fb8, %rsi
lea addresses_WC_ht+0xccfc, %rdi
dec %rdx
mov $108, %rcx
rep movsb
nop
nop
nop
nop
inc %rbx
lea addresses_UC_ht+0x17680, %rsi
lea addresses_UC_ht+0x14f10, %rdi
nop
add %rdx, %rdx
mov $118, %rcx
rep movsl
and $3878, %r10
lea addresses_A_ht+0x13600, %rsi
lea addresses_normal_ht+0x1d780, %rdi
nop
nop
nop
nop
xor %r10, %r10
mov $108, %rcx
rep movsq
nop
xor %rbx, %rbx
lea addresses_WT_ht+0xf45e, %rsi
lea addresses_A_ht+0x10dc0, %rdi
nop
nop
nop
nop
nop
dec %rdx
mov $36, %rcx
rep movsl
inc %rdi
lea addresses_A_ht+0x14b08, %rbx
nop
nop
nop
cmp %rdx, %rdx
movb (%rbx), %r10b
cmp %r12, %r12
lea addresses_WC_ht+0x14cc0, %rbx
nop
nop
nop
add %rdi, %rdi
vmovups (%rbx), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %rsi
sub $19922, %rcx
lea addresses_UC_ht+0xb9c0, %r10
clflush (%r10)
nop
nop
nop
nop
cmp %rdi, %rdi
movb $0x61, (%r10)
nop
nop
nop
nop
dec %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r9
push %rbp
push %rdx
push %rsi
// Store
lea addresses_US+0x3ec0, %r12
nop
nop
cmp %r9, %r9
movl $0x51525354, (%r12)
nop
nop
nop
xor $40702, %rbp
// Store
lea addresses_normal+0x1f3c0, %rsi
nop
nop
nop
nop
nop
add $9133, %rbp
movb $0x51, (%rsi)
nop
nop
inc %r9
// Store
mov $0x3e542200000000c0, %r10
nop
xor $59016, %r11
mov $0x5152535455565758, %rsi
movq %rsi, (%r10)
nop
inc %rsi
// Store
mov $0x6a8, %r10
nop
nop
nop
nop
nop
add %rbp, %rbp
mov $0x5152535455565758, %r11
movq %r11, %xmm7
vmovups %ymm7, (%r10)
nop
nop
nop
and %r10, %r10
// Faulty Load
lea addresses_UC+0x1edc0, %rbp
nop
nop
nop
nop
and $64772, %r11
movb (%rbp), %r10b
lea oracles, %r11
and $0xff, %r10
shlq $12, %r10
mov (%r11,%r10,1), %r10
pop %rsi
pop %rdx
pop %rbp
pop %r9
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_US'}}
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal'}}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_NC'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_P'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': True, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': True, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 8, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 4, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_UC_ht'}}
{'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
*/
| 31.6
| 2,999
| 0.657998
|
973526c2e8c5dd573d77c5494f4e6dfc236207e4
| 486
|
asm
|
Assembly
|
engine/tilesets/map_palettes.asm
|
AtmaBuster/pokeplat-gen2
|
fa83b2e75575949b8f72cb2c48f7a1042e97f70f
|
[
"blessing"
] | 6
|
2021-06-19T06:41:19.000Z
|
2022-02-15T17:12:33.000Z
|
engine/tilesets/map_palettes.asm
|
AtmaBuster/pokeplat-gen2-old
|
01e42c55db5408d72d89133dc84a46c699d849ad
|
[
"blessing"
] | null | null | null |
engine/tilesets/map_palettes.asm
|
AtmaBuster/pokeplat-gen2-old
|
01e42c55db5408d72d89133dc84a46c699d849ad
|
[
"blessing"
] | 2
|
2021-08-11T19:47:07.000Z
|
2022-01-01T07:07:56.000Z
|
SwapTextboxPalettes::
hlcoord 0, 0
decoord 0, 0, wAttrMap
ld b, SCREEN_HEIGHT
.loop
push bc
ld c, SCREEN_WIDTH
call GetBGMapTilePalettes
pop bc
dec b
jr nz, .loop
ret
ScrollBGMapPalettes::
ld hl, wBGMapBuffer
ld de, wBGMapPalBuffer
; fallthrough
GetBGMapTilePalettes:
.loop
ld a, [hl]
push hl
ld hl, wTilesetPalettes
add [hl]
ld l, a
ld a, [wTilesetPalettes + 1]
adc 0
ld h, a
ld a, [hl]
pop hl
ld [de], a
res 7, [hl]
inc hl
inc de
dec c
jr nz, .loop
ret
| 13.135135
| 29
| 0.685185
|
31686ab04566e879e8d9dea885a8d72f7cf88831
| 205
|
asm
|
Assembly
|
solutions/22 - Number Royale/size-6_speed-9.asm
|
behrmann/7billionhumans
|
36d53daf278ef4f3729bc5cba2f2398d5411bd6d
|
[
"MIT"
] | 45
|
2018-09-05T04:56:59.000Z
|
2021-11-22T08:57:26.000Z
|
solutions/22 - Number Royale/size-6_speed-9.asm
|
behrmann/7billionhumans
|
36d53daf278ef4f3729bc5cba2f2398d5411bd6d
|
[
"MIT"
] | 36
|
2018-09-01T11:34:26.000Z
|
2021-05-19T23:20:49.000Z
|
solutions/22 - Number Royale/size-6_speed-9.asm
|
behrmann/7billionhumans
|
36d53daf278ef4f3729bc5cba2f2398d5411bd6d
|
[
"MIT"
] | 36
|
2018-09-01T07:44:19.000Z
|
2021-09-10T19:07:35.000Z
|
-- 7 Billion Humans (2056) --
-- 22: Number Royale --
-- Author: ansvonwa
-- Size: 6
-- Speed: 9
-- Speed Tests: 9, 9, 9
pickup s
a:
if myitem < e or
myitem < w:
b:
step s
jump b
endif
step w
jump a
| 10.789474
| 29
| 0.595122
|
9ef66b3354301e0f4665f21a3890b8e9bd194872
| 790
|
asm
|
Assembly
|
libsrc/math/genmath/floor.asm
|
andydansby/z88dk-mk2
|
51c15f1387293809c496f5eaf7b196f8a0e9b66b
|
[
"ClArtistic"
] | 1
|
2020-09-15T08:35:49.000Z
|
2020-09-15T08:35:49.000Z
|
libsrc/genmath/floor.asm
|
dex4er/deb-z88dk
|
9ee4f23444fa6f6043462332a1bff7ae20a8504b
|
[
"ClArtistic"
] | null | null | null |
libsrc/genmath/floor.asm
|
dex4er/deb-z88dk
|
9ee4f23444fa6f6043462332a1bff7ae20a8504b
|
[
"ClArtistic"
] | null | null | null |
; Small C+ Math Library
; ceil(x)
XLIB floor
LIB int2
LIB norma
XREF fa
;
; return largest integer not greater than
.FLOOR LD HL,FA+5
LD A,(HL) ;fetch exponent
CP $A8
LD A,(FA)
RET NC ;nc => binary point is right of lsb
LD A,(HL)
CALL INT2
LD (HL),$A8 ;place binary pt at end of fraction
LD A,E
PUSH AF
LD A,C
RLA
CALL NORMA
POP AF
RET
;
;Huh..dunno what this is doing here..
; LD HL,FA+5
; LD (HL),$A8
; INC HL
; LD (HL),$80
; LD A,C
; RLA
; JP NORMA
| 18.809524
| 61
| 0.381013
|
3fad936f264141280fc8c86a1b1e0c62ccef2bcd
| 580
|
asm
|
Assembly
|
oeis/027/A027806.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/027/A027806.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/027/A027806.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A027806: 30*(n+1)*C(n+4,10).
; 210,2640,17820,85800,330330,1081080,3123120,8168160,19691100,44341440,94225560,190466640,368588220,686439600,1235591280,2157381600,3665097150,6074125200,9842332500,15623407800,24336462150,37255818600,56125648800,83304936000,121949170200,176236220160,251644987440,355296738720,496370443800,686605027680,940903186080,1278053325120,1721588278410,2300801739600,3051945836940,4019635980360,5258492043090,6835048111320,8829966459600,11340595099680,14483912219700,18399905092800,23255435603400
mov $1,$0
add $0,10
bin $0,$1
add $1,7
mul $0,$1
mul $0,30
| 58
| 488
| 0.848276
|
dab2b70c2ec5e5a30853c92e9ea02081de5de32b
| 400
|
asm
|
Assembly
|
oeis/165/A165186.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/165/A165186.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/165/A165186.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A165186: a(n) = Sum_{k=1..n} (k*(n-k) mod n).
; Submitted by Jamie Morken(s4)
; 0,1,4,6,10,17,28,36,30,45,66,82,78,105,140,136,136,141,190,230,238,253,322,380,250,325,360,434,406,505,558,592,572,561,700,678,666,741,910,980,820,917,946,1122,1050,1173,1316,1432,1078,1125,1394,1430,1378,1449
add $0,1
mov $2,$0
mul $0,2
lpb $0
sub $0,1
add $3,$0
sub $0,1
mod $3,$2
add $1,$3
lpe
mov $0,$1
| 25
| 211
| 0.6375
|
7a0ea62fea53b0317d4bb68caa546827a34d38b3
| 329
|
asm
|
Assembly
|
programs/oeis/108/A108678.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/108/A108678.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/108/A108678.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A108678: a(n) = (n+1)^2*(n+2)(2n+3)/6.
; 1,10,42,120,275,546,980,1632,2565,3850,5566,7800,10647,14210,18600,23936,30345,37962,46930,57400,69531,83490,99452,117600,138125,161226,187110,215992,248095,283650,322896,366080,413457,465290,521850,583416,650275,722722
add $0,2
mul $0,2
mov $2,$0
sub $0,2
bin $2,3
mul $0,$2
div $0,8
| 29.909091
| 221
| 0.714286
|
35aaa38a5a165edda71fb03127527c7148a98513
| 1,255
|
asm
|
Assembly
|
programs/oeis/087/A087289.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/087/A087289.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/087/A087289.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A087289: a(n) = 2^(2*n+1) + 1.
; 3,9,33,129,513,2049,8193,32769,131073,524289,2097153,8388609,33554433,134217729,536870913,2147483649,8589934593,34359738369,137438953473,549755813889,2199023255553,8796093022209,35184372088833,140737488355329,562949953421313,2251799813685249,9007199254740993,36028797018963969,144115188075855873,576460752303423489,2305843009213693953,9223372036854775809,36893488147419103233,147573952589676412929,590295810358705651713,2361183241434822606849,9444732965739290427393,37778931862957161709569,151115727451828646838273,604462909807314587353089,2417851639229258349412353,9671406556917033397649409,38685626227668133590597633,154742504910672534362390529,618970019642690137449562113,2475880078570760549798248449,9903520314283042199192993793,39614081257132168796771975169,158456325028528675187087900673,633825300114114700748351602689,2535301200456458802993406410753,10141204801825835211973625643009,40564819207303340847894502572033,162259276829213363391578010288129,649037107316853453566312041152513,2596148429267413814265248164610049,10384593717069655257060992658440193,41538374868278621028243970633760769,166153499473114484112975882535043073,664613997892457936451903530140172289
mov $1,4
pow $1,$0
mul $1,2
add $1,1
mov $0,$1
| 139.444444
| 1,173
| 0.917131
|
7244765cca4fff8889d110cebacc0d393186e1d7
| 377
|
asm
|
Assembly
|
programs/oeis/195/A195014.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/195/A195014.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/195/A195014.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A195014: Vertex number of a square spiral whose edges have length A195013.
; 0,2,5,9,15,21,30,38,50,60,75,87,105,119,140,156,180,198,225,245,275,297,330,354,390,416,455,483,525,555,600,632,680,714,765,801,855,893,950,990,1050,1092,1155,1199,1265,1311,1380,1428,1500,1550,1625,1677
mov $2,$0
add $2,$0
add $0,1
add $2,3
lpb $0
trn $0,2
sub $2,3
add $1,$2
lpe
mov $0,$1
| 26.928571
| 205
| 0.689655
|
a030c599f272ded5e5aec4dbcbf42e7495407530
| 794
|
asm
|
Assembly
|
MSDOS/Virus.MSDOS.Unknown.weflow.asm
|
fengjixuchui/Family
|
2abe167082817d70ff2fd6567104ce4bcf0fe304
|
[
"MIT"
] | 3
|
2021-05-15T15:57:13.000Z
|
2022-03-16T09:11:05.000Z
|
MSDOS/Virus.MSDOS.Unknown.weflow.asm
|
fengjixuchui/Family
|
2abe167082817d70ff2fd6567104ce4bcf0fe304
|
[
"MIT"
] | null | null | null |
MSDOS/Virus.MSDOS.Unknown.weflow.asm
|
fengjixuchui/Family
|
2abe167082817d70ff2fd6567104ce4bcf0fe304
|
[
"MIT"
] | 3
|
2021-05-15T15:57:15.000Z
|
2022-01-08T20:51:04.000Z
|
;|
;| WEFLOW 1993 VIRUS BY TESLA 5
;|
;| THIS VIRUS IS BASED ON THE TRIDENT OVERWRITING VIRUS. SORRY FOR
;| LAMING AROUND, BUT IT KEEPS VARIANTS RISING. GREETINGS TO TRIDENT,
;| NUKE, PHALCON/SKISM AND YAM. YOU DON'T KNOW ME, BUT I DO...
;|
ORG 100H
MAIN: MOV AH,4EH
NOTSOCOOL: LEA DX,FF
INT 21H
JNC COOL
RET
COOL: MOV AX,3D02H
MOV DX,9EH
INT 21H
XCHG AX,BX
MOV CL,VLEN
MOV AH,40H
INT 21H
MOV AH,3EH
INT 21H
MOV AH,4FH
JMP NOTSOCOOL
FF DB '*.*',0
DB 'WEFLOW93'
VLEN EQU $-MAIN
| 22.055556
| 74
| 0.428212
|
ed1ae47b102bd612dd9910849764e63bb587517c
| 58,062
|
asm
|
Assembly
|
uuu/src/cells/thread/strontium/strontium.asm
|
ekscrypto/Unununium
|
4b67e7c5e63cf1be2157382ffd4c1e9d12957a1f
|
[
"BSD-2-Clause"
] | 7
|
2019-03-04T08:53:33.000Z
|
2022-01-28T19:32:12.000Z
|
uuu/src/cells/thread/strontium/strontium.asm
|
ekscrypto/Unununium
|
4b67e7c5e63cf1be2157382ffd4c1e9d12957a1f
|
[
"BSD-2-Clause"
] | null | null | null |
uuu/src/cells/thread/strontium/strontium.asm
|
ekscrypto/Unununium
|
4b67e7c5e63cf1be2157382ffd4c1e9d12957a1f
|
[
"BSD-2-Clause"
] | null | null | null |
;; $Header: /cvsroot/uuu/uuu/src/cells/thread/strontium/strontium.asm,v 2.6 2002/01/04 18:44:42 lukas2000 Exp $
;;
;; strontium ][ thread engine
;; Copyright 2001 Phil Frost
;; based on original strontium by Dave Poirier
;;
;; known issues:
;; -------------
;; scheduling is a simple rotation with no reguard to priority
;; yield_self will actually steal some of the next thread's CPU time
; -----------------------------------
; config
;==============================================================================
; _VISUAL_ACTIVITY_ is used mainly for test purposes. It will increase a dword
; on screen which indicate if we are still alive or if interrupts have been
; disabled
;%define _VISUAL_ACTIVITY_
; This is the frequency (Hz) of the context switches
%define FREQ 200
; This value is used to control the default stack size of newly created threads
%define DEF_STACK_SIZE 2 * 1024
; and this is the size of the large stack, specified by a flag in the thread
%define LARGE_STACK_SIZE 8 * 1024
; This will enable a signature in the strucs which will be checked to see if
; a bad pointer has been followed or a struc has been corrupted
%define _MAGIC_CHECKS_
; This will store the EIP of each thread a seccond time, in the thread struc
; as well as on the stack. Good for detecting memory corruption. This probally
; won't work as it was part of a debugging attempt long ago, but if it's needed
; again it's a good place to start :P
;%define _EIP_CHECKS_
; This will create an ICS channel that will be called on each tick. This is
; really slow, but hey...
;%define _TICK_CHANNEL_
; This will display in the upper left corner the number of active threads.
;%define _SHOW_THREAD_COUNT_
; This will enable some useless prattle to the DEBUG log
;%define _DEBUG_
; -----------------------------------
; macros
;==============================================================================
%macro mcheck_thread 1 ; check the magic of a thread
%ifdef _MAGIC_CHECKS_
cmp dword[%1+thread.magic], THREAD_MAGIC
jnz .magic_error
%endif
%endmacro
%macro mcheck_proc 1 ; check the magic of a process
%ifdef _MAGIC_CHECKS_
cmp dword[%1+proc.magic], PROC_MAGIC
jnz .magic_error
%endif
%endmacro
%macro mcheck_timer 1 ; check the magic of a process
%ifdef _MAGIC_CHECKS_
cmp dword[%1+proc.magic], TIMER_MAGIC
jnz .magic_error
%endif
%endmacro
; -----------------------------------
; strucs
;==============================================================================
;; The .threads pointer must always be valid; a process may not exist without
;; a thread.
;;
;; A process can be created with a parent, by setting .parent to non-zero.
;; If a process has a parent, the parent will recieve notice when the child
;; process is terminated. Also, if PROCESS_F_KILL_WITH_PARENT is set, the
;; child process will be killed when the parent process terminates.
struc proc
%ifdef _MAGIC_CHECKS_
.magic: resd 1 ; magic number, 'THps'
%define PROC_MAGIC 'THps'
%endif
.next: resd 1 ; ptr to next process or 0 for none
.prev: resd 1 ; prt to prev process or 0 for none
.threads: resd 1 ; ptr to first child thread (must be at least 1)
.callback: resd 1 ; to be called on termination, or 0 for none
.children: resd 1 ; linked list of child processes, 0 for none
.flags: resd 1 ; process flags, see below
.info: resb process_info_size ; the process info we all know and love
.reserved: resb process_info_size % 4 ; maintain alignment
endstruc
; kill child process with the parent
%define PROCESS_F_KILL_WITH_PARENT 1
;; The .next and .prev pointers in the thread struc form a loop, not a chain.
;; If there is only one thread, both pointers should point to itself.
struc thread
%ifdef _MAGIC_CHECKS_
.magic: resd 1 ; magic number, 'THth'
%define THREAD_MAGIC 'THth'
%endif
%ifdef _EIP_CHECKS_
.eip: resd 1 ; extra copy to verify EIP
%endif
.next: resd 1 ; ptr to next thread struc
.prev: resd 1 ; ptr to previous thread struc
.proc_next: resd 1 ; ptr to next thread in this process, 0 for none
.proc_prev: resd 1 ; ptr to previous thread in this process, 0 for none
.process: resd 1 ; ptr to parrent process struc
.esp: resd 1 ; saved ESP
.stack_base: resd 1 ; base address (top, low end) of thread's stack
.flags: resd 1 ; thread flags; see below.
.priority: resb 1 ; ignored atm
.reserved: resb 3
endstruc
%define THREAD_F_FPU 1 ; thread is using FPU
%define THREAD_F_LARGE_STACK 2 ; use a large stack (LARGE_STACK_SIZE)
%define THREAD_F_SLEEPING 4 ; thread is currently sleeping
struc timer
%ifdef _MAGIC_CHECKS_
.magic: resd 1 ; magic number, 'THtm'
%define TIMER_MAGIC 'THtm'
%endif
.expire: resq 1 ; tick count timer expires on
.next: resd 1 ; ptr to next timer in chain (sorted by .expire)
.prev: resd 1 ; ptr to prev timer node
.callback: resd 1 ; func to call on expire
.rememberme: resd 1 ; value to be restored when timer expires
endstruc
section .c_info
db 1,0,0,"a"
dd str_author
dd str_copyrights
dd str_title
str_title:
db "Strontium $Revision: 1.00",0
str_author:
db "indigo",0
str_copyrights:
db "BSD Licensed",0
; -----------------------------------
; cell init
;==============================================================================
section .c_init
init:
jmp short .start
.error:
dmej 0x7EDE0001
.start:
pushad ;
; allocate space for process strucs
;----------------------------------
mov edx, proc_size ;
mov ecx, 4 ; 16 blocks at a time
externfunc mem.fixed.alloc_space ;
jc .error ;
mov [proc_memspace], edi ;
; and more space for thread strucs
;---------------------------------
mov edx, thread_size ;
mov ecx, 5 ; 32 blocks at a time
externfunc mem.fixed.alloc_space ;
jc .error ;
mov [thread_memspace], edi ;
; and more space for timer strucs
;--------------------------------
mov edx, timer_size ;
mov ecx, 5 ; 32 blocks at a time
externfunc mem.fixed.alloc_space ;
jc .error ;
mov [timer_memspace], edi ;
; and some space for linked list nodes
;-------------------------------------
mov edx, 8 ;
mov ecx, 5 ; 32 blocks at a time
externfunc mem.fixed.alloc_space ;
jc .error ;
mov [ll_memspace], edi ;
; allocate stack for the idle thread
;-----------------------------------
mov ecx, DEF_STACK_SIZE ;
externfunc mem.alloc ;
jc .error ;
mov [idle_thread+thread.stack_base], edi
; create an init thread
;-----------------------
mov edi, [thread_memspace] ;
externfunc mem.fixed.alloc ; allocate memory for thread
jc .error ;
dbg lprint {"init thread created at 0x%x",0xa}, DEBUG, edi
%ifdef _MAGIC_CHECKS_ ;
mov dword[edi+thread.magic], THREAD_MAGIC
%endif ;
xor eax, eax ;
mov [edi+thread.next], edi ;
mov [edi+thread.prev], edi ; form a loop with 1 node in it
mov [edi+thread.proc_next], eax ;
mov [edi+thread.proc_prev], eax ;
; we don't care about .esp yet ;
mov [edi+thread.stack_base], eax ; XXX this will be passed in the options
mov [edi+thread.flags], eax ;
mov byte[edi+thread.priority], 50 ; medium priority
mov ebx, edi ; EBX = ptr to thread
;
; create the init process
;------------------------
mov edi, [proc_memspace] ;
externfunc mem.fixed.alloc ; allocate memory for process
%ifdef _MAGIC_CHECKS_ ;
mov dword[edi+proc.magic], PROC_MAGIC ;
%endif ;
xor eax, eax ;
mov [edi+proc.next], eax ; zero out the process list pointers
mov [edi+proc.prev], eax ;
mov [processes], edi ; make this root of process list
mov [edi+proc.threads], ebx ; add thread to process
mov [edi+proc.callback], eax ; no callback
mov [edi+proc.children], eax ; no children
mov [edi+proc.flags], eax ; no flags
mov dword[edi+proc.info+process_info.argv], init_argv
mov [ebx+thread.process], edi ; link thread to process
;
inc dword[thread_count] ;
mov [cur_thread], ebx ;
; reprogram PIT (channel 0)
;-----------------------------------
mov al, 0x34 ;
out 0x43, al ;
mov al, 0x1234DD / FREQ % 0x100 ;
out 0x40, al ;
mov al, 0x1234DD / FREQ / 0x100 ;
out 0x40, al ;
; hook IRQ 0
;-----------
mov esi, _timer_handler ;
mov al, 0x20 ;
externfunc int.hook ;
mov al, 0x00 ;
externfunc int.unmask_irq ;
;
popad ;
sti ; engage!
; -----------------------------------
; section .text
;==============================================================================
section .text
; -----------------------------------
; thread.sleep
;==============================================================================
globalfunc thread.sleep
;>
;; This function will unschedule the thread specified, making it effectively
;; 'sleep'. If the thread id is the one currently running, the control will
;; be redirected to thread.sleep_self
;;
;; parameters:
;; -----------
;; eax = thread id
;;
;; returned values:
;; ----------------
;; eax = (unmodified)
;; ebx = (unmodified)
;; ecx = (unmodified)
;; edx = (unmodified)
;; esi = (undetermined)
;; edi = (undetermined)
;; esp = (unmodified)
;; ebp = (unmodified)
;<
%ifdef _TICK_CHANNEL_
; -----------------------------------
; timer.set_tick_notification_client
;==============================================================================
globalfunc timer.set_tick_notification_client
;>
;; parameters:
;;------------
;; esi = pointer to client, must be ICS compliant
;;
;; returned values:
;;-----------------
;; if cf = 0, sucessful
;; eax = (undetermined)
;; ebx = (undetermined)
;; ecx = entry number in the client node
;; edx = pointer to client node holding client entry pointer
;; esi = (unmodified)
;; edi = pointer to channel data
;; esp = (unmodified)
;; ebp = (unmodified)
;;
;; if cf = 1, failed
;; eax = error code
;; ebx = (undetermined)
;; ecx = (undetermined)
;; edx = (undetermined)
;; esi = (unmodified)
;; edi = (undetermined)
;; esp = (unmodified)
;; ebp = (unmodified)
;<
; -----------------------------------
; timer.get_resolution
;==============================================================================
globalfunc timer.get_resolution
;>
;; parameters: none
;; returned values: eax = number of nanosecond between ticks
;<
%endif ; %ifdef _TICK_CHANNEL_
; -----------------------------------
; timer.destroy
;==============================================================================
globalfunc timer.destroy
;>
;; parameters:
;; -----------
;; EBX = pointer to timer entry to free
;;
;; returned values:
;; ----------------
;; all registers unmodified
;; errors as usual
;<
; -----------------------------------
; thread.create_semaphore
;==============================================================================
globalfunc thread.create_semaphore
;>
;; This function allow to create semaphore, which can be use to control mutual
;; exclusions also called mutex
;;
;; parameters:
;; -----------
;; eax = atomic count starting value, normally 0
;;
;; returned values:
;; ----------------
;; all registers unmodified
;; errors as usual
;<
; -----------------------------------
; thread.destroy_semaphore
;==============================================================================
globalfunc thread.destroy_semaphore
;>
;; parameters:
;; -----------
;; ebx = pointer to mutex entry to free
;;
;; returned values:
;; ----------------
;; all registers unmodified
;; XXX errors?
;<
; -----------------------------------
; thread.lock_read_semaphore_garanteed
;==============================================================================
globalfunc thread.lock_read_semaphore_garanteed
;>
;; Acquire a read lock on a semaphore. If the semaphore is write locked or have
;; pending write locks, the thread will be appended to the read lock waiting
;; queue.
;;
;; parameters:
;; -----------
;; EAX = semaphore id
;;
;; returned values:
;; ----------------
;; all registers unmodified
;<
; -----------------------------------
; thread.lock_write_semaphore_garanteed
;==============================================================================
globalfunc thread.lock_write_semaphore_garanteed
;>
;; Acquire a write lock on a semaphore. If the semaphore is already locked
;; either by other write lock of by other read lock, the thread will be placed
;; in the waiting queue
;;
;; parameters:
;; -----------
;; EAX = semaphore id
;;
;; returned values:
;; ----------------
;; all registers unmodified
;<
; -----------------------------------
; thread.lock_read_semaphore
;==============================================================================
globalfunc thread.lock_read_semaphore
;>
;; Try to lock a read semaphore, if the semaphore is currently locked for write
;; or have pending write locks, this routine will fail returning CF=1 otherwise
;; it will lock the semaphore and return CF=0
;;
;; parameters:
;; -----------
;; EAX = semaphore id
;;
;; returned values:
;; ----------------
;; all registers unmodified
;; CF = completion status, 0: semaphore was locked; 1: lock failed
;<
; -----------------------------------
; thread.lock_write_semaphore
;==============================================================================
globalfunc thread.lock_write_semaphore
;>
;; Try to lock a write semaphore. Will return CF=1 if the semaphore is in any
;; other state than free
;;
;; parameters:
;; -----------
;; EAX = semaphore id
;;
;; returned values:
;; ----------------
;; all registers unmodified
;; CF = completion status, 0: semaphore was locked; 1: lock failed
;<
; -----------------------------------
; thread.unlock_write_semaphore
;==============================================================================
globalfunc thread.unlock_write_semaphore
;>
;; Release a write lock on a semaphore
;;
;; parameters:
;; -----------
;; EAX = semaphore id
;;
;; returned values:
;; ----------------
;; all registres unmodified
;<
; -----------------------------------
; thread.unlock_read_semaphore
;==============================================================================
globalfunc thread.unlock_read_semaphore
;>
;; Release a read lock acquired on a semaphore
;;
;; parameters:
;; -----------
;; EAX = semaphore id
;;
;; returned values:
;; ----------------
;; all registers unmodified
;<
xor eax, eax
dec eax
stc
retn
; -----------------------------------
; timer.set
;==============================================================================
globalfunc timer.set
;>
;; create a new timer. When the timer expires it will be destroyed and the
;; callback will be called.
;;
;; parameters:
;; -----------
;; EAX = number of nanoseconds until timer expires
;; EDX = pointer to callback, must be valid until timer expires or is destroyed
;; EBP = value to be restored when callback is called
;;
;; returned values:
;; ----------------
;; EDX = timer ID
;; registers and errors as usual
;;
;; the callback is called with:
;; ----------------------------
;; EBP = remembered value
;; EDX = timer ID
;;
;; The callback may destroy all registers. The callback is called within an
;; interupt handler. Listen to your mother. Don't stare at the sun.
;;
;; TODO: make linking search check all 64 bits in case tick counter rolls over.
;; At 200Hz this will take 248.551 days, but Unununium is rock solid and faster
;; frequencies may be used.
;<
pushad
%if FREQ <> 200
%error "frequency was assumed to be 200Hz but it's not"
%endif
mov ebx, eax ; divide by 5 mil
shr ebx, 22 ;
shr eax, 25 ;
sub ebx, eax ; EBX = delay in ticks
test ebx, ebx ; if count == 0 timer is too fast
jz near .too_fast ;
; allocate memory for timer struc
;---------------------------------
mov edi, [timer_memspace] ;
externfunc mem.fixed.alloc ; EDI = ptr to timer struc
jc .failed
dbg lprint {"timer created at %x",0xa}, DEBUG, edi
%ifdef _MAGIC_CHECKS_ ;
mov dword[edi+timer.magic], TIMER_MAGIC
%endif ;
mov [edi+timer.callback], edx ; fill out the callback
mov [edi+timer.rememberme], ebp ; save rememberme value
;
; calculate expiration tick count
;--------------------------------
call thread.enter_critical_section ; don't want tick count to roll over
mov eax, [timer.tick_count+4] ; EAX = MSW of count
add ebx, [timer.tick_count] ; EBX = LSW of calculated count
adc eax, byte 0 ; inc eax if result rolls over
mov [edi+timer.expire], ebx ; put expiration time in struc
mov [edi+timer.expire+4], eax ;
; link timer node into list
;--------------------------
mov ecx, [timers] ; ECX = root timer
xor esi, esi ; ESI = 0 (will be the prev. timer)
test ecx, ecx ; if root timer is 0
jz .found_it ; we are done
.compare_node: ;
cmp [ecx+timer.expire], ebx ; compare LSW of expire times
jae .found_it ; if new timer is less or equal, done
mov esi, ecx ; ESI = prev. timer
mov ecx, [ecx+timer.next] ; ECX = next timer
test ecx, ecx ; if next timer is not null
jnz .compare_node ; compare the next one
;
; link the timer into the list
.found_it: ;-----------------------------
; ECX = node to put after new
; ESI = node to put before new
; (either may be 0)
mov [edi+timer.next], ecx ; new -> next
mov [edi+timer.prev], esi ; new -> prev
test ecx, ecx ; if next timer is null
jz .no_next ; don't try to link it
mov [ecx+timer.prev], edi ; next -> new
.no_next: ;
test esi, esi ; if prev timer is null don't try to
jz .no_prev ; link it and update root timer
mov [esi+timer.next], edi ; prev -> new
;
.done: ;
call thread.leave_critical_section ;
mov [esp+20], edi ; return our edi in edx (thread ID)
popad ;
clc ;
retn ;
.no_prev: ; linking new timer and prev. is null
mov [timers], edi ; update root node
jmp short .done ;
.too_fast: ; delay is too short for us
mov eax, __ERROR_INVALID_PARAMETERS__ ;
.failed: ;
call thread.leave_critical_section ;
mov [esp+28], eax ; return error code
popad ;
stc ;
retn ;
; -----------------------------------
; process.get_info_struc
;==============================================================================
globalfunc process.get_info_struc
;>
;; Returns a pointer to the process information including stdin/out/err,
;; environment, and possibly more in the future. This is the same thing that's
;; passed to the app in EBX when it's called. See struc process_info in
;; include/proc.inc
;;
;; parameters:
;; -----------
;; none
;;
;; returned values:
;; ----------------
;; ESI = ptr to process info
;; all other registers unmodified
;<
mov esi, [cur_thread] ; ESI = cur thread
mcheck_thread esi ;
mov esi, [esi+thread.process] ; ESI = cur process
mcheck_proc esi ;
add esi, byte proc.info ; ESI = ptr to process info
retn ;
%ifdef _MAGIC_CHECKS_
.magic_error:
lprint {"strontium: bad magic",0xa}, FATALERR
dmej 0x7EDE0002
%endif
; -----------------------------------
; thread.clear_stack
;==============================================================================
globalfunc thread.clear_stack
;>
;; This clears everything off your stack except for the final return address.
;; For when you came from somewhere, and you never want to go back :P
;;
;; parameters:
;; -----------
;; none
;;
;; returned values:
;; ----------------
;; EAX = destroyed
;; ESP = back to top
;; all other registers unmodified
;<
mov eax, [cur_thread] ; EAX = cur thread
mov eax, [eax+thread.stack_base] ; EAX = base of cur stack
add eax, DEF_STACK_SIZE-4 ; EAX = top of stack
xchg esp, eax ; EAX = old stack
push dword[eax] ; push return address
retn ; return
; The fancy return address dancing is done so that the retn pairs with the call
; on an athlon. Also, a ptr to thread.kill_self is left on the stack always,
; hence the DEF_STACK_SIZE-4
; -----------------------------------
; thread.get_self
;==============================================================================
globalfunc thread.get_self
;>
;; get some!
;;
;; parameters:
;; -----------
;; none
;;
;; returned values:
;; ----------------
;; EAX = thread ID of calling thread
;; all other registers unmodified
;<
mov eax, [cur_thread] ;
retn ;
; -----------------------------------
; process.get_self
;==============================================================================
globalfunc process.get_self
;>
;; get some more!
;;
;; parameters:
;; -----------
;; none
;;
;; returned values:
;; ----------------
;; EAX = process ID of calling process
;; all other registers unmodified
;<
mov eax, [cur_thread] ; EAX = cur thread
mov eax, [eax+thread.process] ; EAX = cur process
retn ;
; -----------------------------------
; thread.kill_others_in_proc
;==============================================================================
globalfunc thread.kill_others_in_proc
;>
;; Kill all the other threads in a proc, except the one that calls this
;;
;; parameters:
;; -----------
;; none
;;
;; returned values:
;; ----------------
;; regisers and errors as usual
;<
dbg lprint {"thread_kill_others_in_proc called",0xa}, DEBUG
mov eax, [cur_thread] ; EAX = cur thread
;
; kill all the previous threads
;------------------------------
call thread.enter_critical_section ; so no one creates new threads on us
mov eax, [eax+thread.proc_prev] ; EAX = 1st prev thread
test eax, eax ; if EAX = 0 there are no prev.
jz .prev_killed ; threads so we are half done
.kill_prev: ;
call thread.kill ; DIE!
jc .retn ;
mov eax, [eax+thread.proc_prev] ; EAX = next prev thread
test eax, eax ; if it's not zero there are more to
jnz .kill_prev ; kill >:}
.prev_killed: ;
; kill all the next threads
;--------------------------
mov eax, [cur_thread] ; EAX = cur thread
mov eax, [eax+thread.proc_next] ; EAX = ptr to 1st next thread
test eax, eax ; if EAX = 0 there are no next
jz .retn ; threads so we are done
.kill_next: ;
call thread.kill ; PSCHEWW!
jc .retn ;
mov eax, [eax+thread.proc_next] ; EAX = next next thread
test eax, eax ; kill more until we hit a null ptr
jnz .kill_next ;
.retn: ;
call thread.leave_critical_section ;
retn ;
; -----------------------------------
; thread.enter_critical_section
;==============================================================================
globalfunc thread.enter_critical_section
;>
;;
;<
dbg lprint {"thread.enter_critical_section called",0xa}, DEBUG
cmp dword[crit_sect_depth], byte 0 ; if we are already in a crit sect
jnz .not_1st ; skip saving the flags
pushfd ; save our flags so if IF=0 when we
pop dword [crit_sect_flags] ; entered it isn't set when we leave
.not_1st: ;
cli ; leave us alone!
inc dword[crit_sect_depth] ; a level deeper...
retn ;
; -----------------------------------
; thread.leave_critical_section
;==============================================================================
globalfunc thread.leave_critical_section
;>
;;
;<
dbg lprint {"thread.leave_critical_section called",0xa}, DEBUG
dec dword[crit_sect_depth] ; if we are more than 1 level deep
jnz .still_critical ; don't restore the flags
push dword[crit_sect_flags] ;
popfd ; restore flags
.still_critical: ;
retn ;
; -----------------------------------
; thread.yield_self
;==============================================================================
globalfunc thread.yield_self
;>
;; Forfit the rest of your CPU time to the next thread. If there is some event
;; like a callback or an interupt (you are not polling something) it is better
;; to use thread.sleep_self and have the interupt or callback wake the thread
;; back up.
;;
;; parameters:
;; -----------
;; none
;;
;; returned values:
;; ----------------
;; EAX = destroyed
;; everything else = unmodified (including flags)
;<
; make the stack match iretd
;---------------------------
pop eax ; pop EIP
pushfd ; push flags
push cs ; push CS
push eax ; push EIP
pushad ; push all registers
mov ebx, [cur_thread] ; EBX = cur thread
mcheck_thread ebx ;
cli ; leave us alone please
mov [ebx+thread.esp], esp ; save esp
%ifdef _EIP_CHECKS_ ;
mov [ebx+thread.eip], eax ; save copy of EIP
%endif ;
mov ebx, [ebx+thread.next] ; EBX = next thread
mcheck_thread ebx ;
mov esp, [ebx+thread.esp] ; ESP = TOS of next thread
popad ; restore registers
iretd ; go to it
%ifdef _MAGIC_CHECKS_
.magic_error:
dmej 0x7EDE0013
%endif
; -----------------------------------
; thread.create
;==============================================================================
globalfunc thread.create
;>
;; general use registers = passed on to thread
;; TOS = address where to start execution of new thread (EIP)
;; +4 = scheduling priority
;; +8 = flags (just 0 for now, but later will indicate FPU usage)
;;
;; requires at least 128 bytes of additional free stack
;;
;; returned values:
;; ----------------
;; EAX = thread id of newly created thread
;; stack is cleared
;; errors and registers as usual
;<
dbg lprint {"thread.create called",0xa}, DEBUG
pushad ; save all registers
;
; create new thread
;------------------
mov ebp, [esp+36] ; EBP = starting EIP
call _create_thread ; EBX = new thread
jc .error ; NOTE: in critical section now
;
; add thread to cur. process
;---------------------------
mov eax, [cur_thread] ; EAX = curent thread
mcheck_thread eax ;
mov eax, [eax+thread.process] ; EAX = curent process
mcheck_proc eax ;
mov ecx, [eax+proc.threads] ; ECX = first thread in proc chain
mcheck_thread ecx ;
xor esi, esi ; ESI = 0
mov [ebx+thread.process], eax ; new thread -> process
mov [eax+proc.threads], ebx ; new thread is new root in thread list
mov [ebx+thread.proc_next], ecx ; old root is next node
mov [ecx+thread.proc_prev], ebx ; old root's prev is new node
mov [ebx+thread.proc_prev], esi ; zero prev pointer of new node
;
; make final touches to new thread
;---------------------------------
mov eax, [esp+40] ; EAX = priority
mov ecx, [esp+44] ; ECX = flags
mov [ebx+thread.priority], al ;
mov [ebx+thread.flags], ecx ;
; done
;-----
call thread.leave_critical_section ;
mov [esp+28], ebx ; return our ebx in eax (thread id)
clc ;
.error: ;
popad ;
retn 12 ;
%ifdef _MAGIC_CHECKS_
.magic_error:
lprint {"strontium: bad magic",0xa}, FATALERR
dmej 0x7EDE0003
%endif
; -----------------------------------
; thread.kill
;==============================================================================
%ifdef _MAGIC_CHECKS_
thread.kill.magic_error:
dmej 0x7EDE0004
%endif
globalfunc thread.kill
;>
;; Kill a specified thread. If thread specified is the currently running
;; thread, the control will be pased to the thread.kill_self function (of
;; course if that happens this function will never return ;) )
;;
;; parameters:
;; -----------
;; EAX = thread id
;;
;; returned values:
;; ----------------
;; errors and registers as usual
;<
dbg lprint {"thread.kill called",0xa}, DEBUG
mcheck_thread eax
cmp eax, [cur_thread] ; redirect call if killing curent
jz near thread.kill_self ; thread
;
dec dword[thread_count] ; one down...
jz near _no_threads ; and hopefully there are some left
;
push edx ; save used registers
push ebx ;
;
call thread.enter_critical_section ;
mov edx, [eax+thread.next] ; EDX = next thread
mcheck_thread edx ;
mov ebx, [eax+thread.prev] ; EBX = prev. thread
mcheck_thread ebx ;
; remove thread from active loop
;-------------------------------
mov [ebx+thread.next], edx ; we can assume there's at least 1
mov [edx+thread.prev], ebx ; other thread
;
; remove thread from process
;---------------------------
mov edx, [eax+thread.proc_next] ; EDX = next thread in proc
mov ebx, [eax+thread.proc_prev] ; EBX = prev thread in proc
test edx, edx ; skip linking if there is no next
jz .no_proc_next ; thread in the proc
mov [edx+thread.proc_prev], ebx ; next->prev
.no_proc_next: ;
test ebx, ebx ; skip linking if there is no prev
jz .no_proc_prev ; thread in the proc
mov [ebx+thread.proc_next], edx ; prev -> next
;
.done_removing: ;
call thread.leave_critical_section ; we are done messing with active data
;
pop ebx ; restore used registers
pop edx ;
; clean up thread
;----------------
mov eax, [eax+thread.stack_base] ; EAX = base of thread's stack
test eax, eax ; if it's zero, don't dealloc it
jz .skip_stack_dealloc ;
externfunc mem.dealloc ; deallocate stack
jc .retn ;
.skip_stack_dealloc: ;
push edi ;
mov edi, [thread_memspace] ; EDI = ptr to thread memory space
externfunc mem.fixed.dealloc ; deallocate thread struc
pop edi ;
;
.retn: ;
retn ;
.kill_last_in_proc: ;
dmej 0x7EDE0006 ;
.no_proc_prev:
test edx, edx ; if there is no next either we are
jz .kill_last_in_proc ; killing the last thread in the proc
mov edx, [eax+thread.process] ; EDX = ptr to process
mcheck_proc edx ;
mov [edx+proc.threads], ebx ; make next thread new root
jmp short .done_removing ;
; -----------------------------------
; thread.kill_self
;==============================================================================
globalfunc thread.kill_self
;>
;; arakiri!
;;
;; parameters:
;; -----------
;; none
;;
;; returned values:
;; ----------------
;; be realistic ;)
;<
dbg lprint {"thread.kill_self called",0xa}, DEBUG
dec dword[thread_count] ; one less scumbag in the world
jz near _no_threads ;
mov ecx, eax ; save EAX of thread; we may need it if
cli ; we have to terminate the process
;
; get prev & next & cur threads
;------------------------------
mov ebx, [cur_thread] ; EBX = cur thread that we are removing
mcheck_thread ebx ;
mov esi, [ebx+thread.process] ; ESI = cur process
mcheck_proc esi ;
mov edx, [ebx+thread.prev] ; EDX = prev. thread
mcheck_thread edx ;
cmp edx, ebx ; if the prev pointer points back to
jz .kill_last_thread ; the cur thread there is only 1
mov eax, [ebx+thread.next] ; EAX = next thread
mcheck_thread eax ;
; remove thread from active loop
;---------------------------------
mov [edx+thread.next], eax ;
mov [eax+thread.prev], edx ;
; switch to next context
.switch_context: ;-----------------------
mov [cur_thread], eax ;
mov esp, [eax+thread.esp] ;
; clean up thread
;----------------
mov eax, [ebx+thread.stack_base] ; EAX = base of cur. stack
test eax, eax ; if it's zero, skip deallocating it
jz .skip_stack_dealloc ;
externfunc mem.dealloc ; deallocate stack
.skip_stack_dealloc: ;
mov eax, ebx ; EAX = cur thread
mov edi, [thread_memspace] ; EDI = thread memspace
externfunc mem.fixed.dealloc ; dealloc thread struc
;
; remove thread from process
;---------------------------
mov ebp, [ebx+thread.proc_next] ; EBP = next thread in proc
mov edx, [ebx+thread.proc_prev] ; EDX = prev thread in proc
test ebp, ebp ;
jz .no_proc_next ; if there's no next skip linking it
mov [ebp+thread.proc_prev], edx ; next -> prev
.no_proc_next: ;
test edx, edx ; if there's no prev, skip linking it
jz .no_proc_prev ; and update the process root thread
mov [edx+thread.proc_next], ebp ; prev -> next
popad
iretd ; goodbye cruel world!
%ifdef _MAGIC_CHECKS_
.magic_error:
lprint {"strontium: bad magic",0xa}, FATALERR
dmej 0x7EDE0007
%endif
.kill_last_thread:
mov eax, idle_thread ; EAX = idle_thread
mov esp, [idle_thread+thread.stack_base]
add esp, DEF_STACK_SIZE ; ESP = top of idle stack
push dword 0x00000202 ; push flags
push cs ; push cs
push dword _idle ; push eip
sub esp, byte 32 ; pseudo-pushad
mov [eax+thread.esp], esp ; save esp
%ifdef _EIP_CHECKS_ ;
mov dword[eax+thread.eip], _idle ;
%endif ;
jmp short .switch_context ;
.no_proc_prev:
mov esi, [ebx+thread.process] ; ESI = cur process
mcheck_proc esi ;
test ebp, ebp ; if ebp (next) is also null, there
jz .kill_last_in_proc ; are no other nodes
mov [esi+proc.threads], ebp ; update root thread
popad ;
iretd ; go to next thread
.kill_last_in_proc:
; ESI = cur process
; ECX = exit status (what was in EAX when this function was called)
dbg lprint {"strontium: terminating process with status %d",0xa}, DEBUG, ecx
; take process out of process list
;---------------------------------
mov ebx, [esi+proc.prev] ; EBX = prev process
mov ebp, [esi+proc.next] ; EBP = next process
;
test ebp, ebp ;
jz .no_next ;
mov [ebp+proc.prev], ebx ; next -> prev
.no_next: ;
test ebx, ebx ;
jz .no_prev ;
mov [ebx+proc.next], ebp ; prev -> next
jmp short .removed ;
.no_prev: ;
mov [processes], ebp ; update root thread in process
.removed: ;
; clean up process
;-----------------
mov edi, [proc_memspace] ; EDI = process memspace
mov eax, esi ; EAX = ptr to process
externfunc mem.fixed.dealloc ; dealloc process struc
;
mov ebp, [esi+proc.callback] ; EBP = callback
test ebp, ebp ;
jz .no_callback ; if it's zero, skip it
;
mov ebx, esi ; EBX = process
mov eax, ecx ; EAX = exit status
call ebp ;
;
.no_callback: ;
popad ;
dbg lprint {"strontium: process terminated",0xa}, DEBUG
iretd ;
; -----------------------------------
; process.create
;==============================================================================
globalfunc process.create
;>
;; parameters:
;; -----------
;; EAX = ptr to callback func to call when process terminates, or 0 for none
;; EBX = ptr to process_info struc (see uuu/include/proc.inc)
;; ECX = number of args
;; EDI = ptr to array of pointers to args
;; ESI = ptr to string of file to execute
;;
;; returned values:
;; ----------------
;; EBX = process ID of created process
;; errors and registers as usual
;;
;; arg[0] is the name the command was invoked as, so if you give no args to
;; a program ECX = 1.
;;
;; The process info is copied, so it must only be valid until this function
;; returns, at which point it can be maimed, mangled, or mutilated, or even
;; deallocated.
;;
;; callback function:
;; ------------------
;; use this to monitor when the created process termitates. The function will
;; be called with these parameters:
;; EAX = return status of process, this is what's in EAX when the last thread
;; terminates or one of the threads calls proc.kill_self
;; EBX = process ID of terminated process
;; the registers may be destroyed on return. The callback must remain valid for
;; the entire life of the calling proc. When the parent process terminates
;; (the one that called this function), the callback will be set to 0.
;<
dbg lprint {"process.create called",0xa}, DEBUG
pushad ; save registers
pushad ; save regs again for _create_thread
;
; allocate memory for process
;----------------------------
mov edi, [proc_memspace] ;
externfunc mem.fixed.alloc ;
jc near .error ;
%ifdef _MAGIC_CHECKS_ ;
mov dword[edi+proc.magic], PROC_MAGIC ; fill out magic field
%endif ;
push edi ;
;
; link up the file
;-----------------
mov edi, [esp+36] ; EDI = edi (argv) from call
externfunc file.link ;
jc near .pop1error ;
mov [esp+4], edi ; put our edi in thread's edi
;
; set up process info
;--------------------
pop edi ; EDI = ptr to process
mov [esp+28], edi ; save ptr to process in thread's eax
mov esi, [esp+32+16] ; ESI = ptr to source process info
mov ecx, process_info_size / 4 ; ECX = dwords in struc process_info
add edi, byte proc.info ; EDI = ptr to process info of new proc
mov [esp+16], edi ; put our edi in thread's ebx
rep movsd ; copy src->dest
sub edi, byte process_info_size ; EDI = ptr to process info again
mov ecx, [esp] ; ECX = ptr to argv
mov [edi+process_info.cleanup], eax ; save cleanup from file.link
mov [edi+process_info.argv], ecx ; save ptr to argv
;
; create new thread and set it up
;--------------------------------
mov ebp, edx ; set starting eip from file.link's edx
call _create_thread ; EBX = ptr to new thread
jc .error ;
%ifdef _EIP_CHECKS_ ;
mov [ebx+thread.eip], ebp ;
%endif ;
xor edx, edx ; NOTE: in critical section now
mov edi, [esp+28] ; EDI = ptr to process
mov [ebx+thread.proc_next], edx ; zero out the process thread list
mov [ebx+thread.proc_prev], edx ; pointers
mov [ebx+thread.process], edi ; fill process field
mov [ebx+thread.flags], edx ;
;
; put finishing touches on process
;---------------------------------
mov eax, [esp+32+28] ; EAX = ptr to callback; eax from call
mov [edi+proc.threads], ebx ;
mov [edi+proc.callback], eax ;
mov [edi+proc.children], edx ;
mov [edi+proc.flags], edx ;
mov eax, [processes] ; EAX = root node of process list
mov [edi+proc.next], eax ; add our node
mov [edi+proc.prev], edx ;
test eax, eax ;
jz .no_processes ;
mov [eax+proc.prev], edi ;
.no_processes: ;
mov [processes], edi ;
; done; clean up and return
;--------------------------
call thread.leave_critical_section ; whee!
add esp, byte 32 ;
popad ; restore registers
retn ;
.pop1error:
add esp, byte 4
.error:
add esp, byte 32
mov [esp+28], eax
popad
stc
retn
; -----------------------------------
; process.kill_self
;==============================================================================
globalfunc process.kill_self
;>
;; Kills the current process and all it's threads.
;;
;; parameters:
;; -----------
;; none
;;
;; returned values:
;; ----------------
;; NEVER :P
;<
dbg lprint {"process.kill_self called",0xa}, DEBUG
push eax ; save exit code
call thread.kill_others_in_proc ; kill everyone else
pop eax ; restore exit code
call thread.kill_self ; NOW we can kill ourself :)
; -----------------------------------
; thread.sleep_self
;==============================================================================
globalfunc thread.sleep_self
;>
;; parameters:
;; -----------
;; none
;;
;; returned values:
;; ----------------
;; EAX = destroyed
;; everything else (including flags) unmodified
;<
dbg lprint {"thread.sleep_self called",0xa}, DEBUG
; save state of curent thread
;----------------------------
pop eax ; pop EIP
pushfd ; push flags
push cs ; push cs
push eax ; push EIP
pushad ; push all registers
mov ebx, [cur_thread] ; EBX = cur thread
mcheck_thread ebx ;
mov [ebx+thread.esp], esp ; save ESP
%ifdef _EIP_CHECKS_ ;
mov [ebx+thread.eip], eax ; save EIP
%endif ;
; get next and prev threads
;--------------------------
cli ; playing with data strucs, hold on
mov eax, [ebx+thread.next] ; EAX = next thread
mcheck_thread eax ;
cmp eax, ebx ; if the next pointer points back to
jz .sleep_last ; the cur thread there is 1 active
mov edx, [ebx+thread.prev] ; EDX = prev thread
mcheck_thread edx ;
;
; take cur thread out of active loop
;-----------------------------------
mov [edx+thread.next], eax ; prev -> next
mov [eax+thread.prev], edx ; next -> prev
;
; add cur thread to sleeping list
.add_to_sleep_list: ;--------------------------------
xor edx, edx ; EDX = 0
mov ecx, [sleeping_threads] ; ECX = root sleeping node
mov [ebx+thread.prev], edx ; no prev sleeping thread
mov [ebx+thread.next], ecx ; old root is next sleeping thread
test ecx, ecx ;
jz .none_sleeping ; skip linking if there was no old root
mov [ecx+thread.prev], ebx ; link root -> cur
.none_sleeping: ;
or dword[ebx+thread.flags], THREAD_F_SLEEPING ; mark as sleeping
mov [sleeping_threads], ebx ; cur thread is new root sleeping
;
; activate next thread
;---------------------
mov [cur_thread], eax ; update cur_thread
mov esp, [eax+thread.esp] ; switch to new stack
;
%ifdef _DEBUG_ ;
call _dump_threads ;
%endif ;
;
popad ; restore registers of new thread
iretd ; go to it!
%ifdef _MAGIC_CHECKS_
.magic_error:
lprint {"strontium: bad magic",0xa}, FATALERR
dmej 0x7EDE0009
%endif
.sleep_last: ;
mov eax, idle_thread ; next thread = idle_thread
mov esp, [idle_thread+thread.stack_base]
add esp, DEF_STACK_SIZE ; use idle thread's stack
push dword 0x00000202 ; push flags
push cs ; push CS
push dword _idle ; push EIP
sub esp, byte 32 ; act like we did pushad
mov [idle_thread+thread.esp], esp ; save esp
jmp short .add_to_sleep_list ;
; -----------------------------------
; thread.wake
;==============================================================================
globalfunc thread.wake
;>
;; parameters:
;; -----------
;; EAX = thread id
;;
;; returned values:
;; ----------------
;; all registers unmodified
;<
dbg lprint {"thread.wake called: waking thread at 0x%x",0xa}, DEBUG, eax
mcheck_thread eax
test dword[eax+thread.flags], THREAD_F_SLEEPING
jz .retn ; if it's already awake, cool :P
;
push ebx ;
push ecx ;
call thread.enter_critical_section ;
;
mov ebx, [eax+thread.next] ; EBX = next thread
mov ecx, [eax+thread.prev] ; ECX = prev thread
;
; remove thread from sleeping list
;---------------------------------
test ebx, ebx ;
jz .no_next ; jmp if next pointer is null
mcheck_thread ebx ;
mov [ebx+thread.prev], ecx ; link next -> prev
.no_next: ;
test ecx, ecx ;
jz .no_prev ; jmp if prev pointer is null
mcheck_thread ecx ;
mov [ecx+thread.next], ebx ; link prev -> next
;
; add thread to active loop
.add_to_active_loop: ;--------------------------
mov ecx, [cur_thread] ; ECX = cur thread
mcheck_thread ecx ;
mov ebx, [ecx+thread.next] ; EBX = next thread
mcheck_thread ebx ;
mov [ecx+thread.next], eax ; cur -> new
mov [ebx+thread.prev], eax ; next -> new
mov [eax+thread.next], ebx ; new -> next
mov [eax+thread.prev], ecx ; new -> cur
;
call thread.leave_critical_section ;
pop ecx ;
pop ebx ;
;
.retn: ;
dbg call _dump_threads ;
retn ;
;
.no_prev: ;
mov [sleeping_threads], ebx ; no prev, so next is new root
jmp short .add_to_active_loop ;
; let's hope we never have to use this
;-------------------------------------
%ifdef _MAGIC_CHECKS_ ;
.magic_error: ;
lprint {"strontium: bad magic",0xa}, FATALERR
dmej 0x7EDE000B ;
%endif ;
; -----------------------------------
; _dump_threads
;==============================================================================
%ifdef _DEBUG_
_dump_threads: ; dumps the contents of the active and sleeping thread
; lists to the DEBUG log
pushad
pushfd
cli
lprint {"ACTIVE LOOP",0xa}, DEBUG
mov eax, [cur_thread]
mcheck_thread eax
mov edx, eax
.loop_active:
lprint {" %x",0xa}, DEBUG, edx
mov ebx, [edx+thread.next]
mcheck_thread ebx
cmp [ebx+thread.prev], edx
jnz .bad_prev
mov edx, ebx
cmp edx, eax
jnz .loop_active
lprint {"SLEEPING LIST",0xa}, DEBUG
mov eax, [sleeping_threads]
test eax, eax
jz .done
.loop_sleep:
mcheck_thread eax
lprint {" %x",0xa}, DEBUG, eax
mov eax, [eax+thread.next]
test eax, eax
jnz .loop_sleep
.done:
popfd
popad
retn
.magic_error:
lprint {"strontium: bad magic",0xa}, FATALERR
dmej 0x7EDE0012
.bad_prev:
lprint {"strontium: bad prev pointer in thread",0xa}, DEBUG
dmej 0x7EDE0013
%endif
; -----------------------------------
; _idle
;==============================================================================
_idle:
dbg lprint {"strontium: entering idle loop",0xa}, DEBUG
.loop:
cmp dword[idle_thread+thread.next], idle_thread
jz .loop ; wait for another thread to be linked
;
; remove idle thread from active loop
;------------------------------------
cli ;
mov eax, [idle_thread+thread.next] ; EAX = next thread
mov ebx, [idle_thread+thread.prev] ; EBX = prev thread
dbg lprint {"strontium: leaving idle loop; next: %x; prev: %x",0xa}, DEBUG, eax, ebx
mov [eax+thread.prev], ebx ;
mov [ebx+thread.next], eax ;
mov [cur_thread], eax ;
mov esp, [eax+thread.esp] ;
mov dword[idle_thread+thread.next], idle_thread ; get ready for next use
mov dword[idle_thread+thread.prev], idle_thread
popad ;
iretd ;
; -----------------------------------
; process.list
;==============================================================================
globalfunc process.list
;>
;; Gives a listing of all the existing processes
;;
;; parameters:
;; -----------
;; EAX = ptr to callback function
;;
;; returned values:
;; ----------------
;; registers as usual
;;
;; the callback function is called with:
;; -------------------------------------
;; EDX = process ID, or 0 to terminate listing
;; ESI = ptr to process info struc
;;
;; the callback function may return all registers destroyed.
;<
call thread.enter_critical_section
mov edx, [processes]
lea esi, [edx+proc.info]
push edx
push eax
call eax
pop eax
pop edx
test edx, edx
jz .done
.next:
mov edx, [edx+proc.next]
lea esi, [edx+proc.info]
push edx
push eax
call eax
pop eax
pop edx
test edx, edx
jnz .next
.done:
call thread.leave_critical_section
_create_thread.error:
retn
; -----------------------------------
; _create_thread
;==============================================================================
_create_thread:
;; parameters:
;; -----------
;; TOS = registers to pass on to thread, pushad style
;; EBP = starting EIP
;;
;; returned values:
;; ----------------
;; EBX = ptr to new thread
;; EBP = unmodified
;; all other registers = destroyed
;; errors as usual
;;
;; this fills in the scheduling and magic info, but the proc_*, process, flags,
;; and priority fields are unfilled.
;;
;; if this function exits with an error, the thread was not created and the
;; critical section is not entered.
;;
;; note: this function enters a critical section when needed; the calling
;; function should call thread.leave_critical_section after it's done.
; allocate memory for thread struc
;---------------------------------
mov edi, [thread_memspace] ; EDI = thread memory space
externfunc mem.fixed.alloc ; EDI = ptr to new thread
jc .error ;
;
%ifdef _MAGIC_CHECKS_ ;
mov dword[edi+thread.magic], THREAD_MAGIC
%endif ;
; allocate stack for new thread
;------------------------------
mov ebx, edi ; EBX = ptr to new thread
mov ecx, DEF_STACK_SIZE ; ECX = stack size
externfunc mem.alloc ; EDI = ptr to thread's stack
jc .error ;
mov [ebx+thread.stack_base], edi ; save stack base address
lea edi, [edi+eax-48] ; EDI = ptr to TOS with room for stuff
mov [ebx+thread.esp], edi ; save ESP
;
; fill in starting values on the stack
;-----------------------------------------------------------------------------
; we want this: |
; TOS edi +24 ecx |
; +4 esi +28 eax |
; +8 ebp +32 starting eip |
; +12 --- +36 cs |
; +16 ebx +40 starting eflags (all clear but IF) |
; +20 edx +44 return point, thread.kill_self |
;--------------------------------------------------------
mov dword[edi+44], thread.kill_self ; if the thread does a retn, kill it
mov dword[edi+40], 0x00000202 ; set start EFLAGS to all 0 except IF
mov dword[edi+36], 0x00000008 ; CS = 8
mov dword[edi+32], ebp ; starting EIP
mov eax, [esp+4] ; EAX = starting EDI
mov ecx, [esp+8] ; ECX = starting ESI
mov edx, [esp+12] ; EDX = starting EBP
mov [edi], eax ; edi
mov [edi+4], ecx ; esi
mov [edi+8], edx ; ebp
mov eax, [esp+20] ; EAX = starting EBX
mov ecx, [esp+24] ; ECX = starting EDX
mov edx, [esp+28] ; EDX = starting ECX
mov esi, [esp+32] ; ESI = starting EAX
mov [edi+16], eax ; ebx
mov [edi+20], ecx ; edx
mov [edi+24], edx ; ecx
mov [edi+28], esi ; eax
;
; add thread to active loop
;--------------------------
call thread.enter_critical_section ; because we screw the data structures
mov eax, [cur_thread] ; EAX = ptr to current thread
mcheck_thread eax ;
mov edx, [eax+thread.next] ; EDX = ptr to next thread
mcheck_thread edx ; insert new thread between cur. and next
mov [ebx+thread.next], edx ; new -> next
mov [ebx+thread.prev], eax ; new -> cur
mov [eax+thread.next], ebx ; cur -> new
mov [edx+thread.prev], ebx ; next -> new
inc dword[thread_count] ; inc total thread count
clc ; no error
dbg lprint {"created thread at 0x%x",0xa}, DEBUG, ebx
retn ; done
.magic_error:
lprint {"strontium: bad magic",0xa}, FATALERR
dmej 0x7EDE000C
; .error is in the function above this
; -----------------------------------
; _no_threads
;==============================================================================
_no_threads:
lprint {"All threads have been killed; press enter to reboot",0xa}, FATALERR
externfunc debug.diable.wait
mov al, 0xFE
out 0x64, al
mov al, 0x01
out 0x92, al
; should have rebooted, but lock to be sure
cli
hlt
; -----------------------------------
; _timer_handler
;==============================================================================
_timer_handler:
; TODO: update timer stuff to handle 32 bit rollover
pushad ; save registers
%ifdef _VISUAL_ACTIVITY_ ;
inc dword [0xb8000 + 0xA0 - 4] ;
%endif ;
; increment the tick count
;-------------------------
inc dword[timer.tick_count] ; increment the LSW
jc near .tick_overflow ; if it rolls over, inc the MSW
.tick_done: ;
; check for timer expirations
;----------------------------
mov edx, [timers] ; EDX = ptr to root timer
.check_timer: ;
test edx, edx ; if timer is zero there are no timers
jz .timers_done ; so we are done
mcheck_timer edx ; (check magic)
mov eax, [timer.tick_count] ; EAX = tick count
cmp [edx+timer.expire], eax ; compare expire time with tick count
jne .timers_done ; if they arn't equal we are done
mov ebp, [edx+timer.rememberme] ; restore saved value
push edx ; save curent timer
call [edx+timer.callback] ; call the callback
pop eax ; EAX = curent timer (just expired)
mov edx, [eax+timer.next] ; EDX = next timer
mov edi, [timer_memspace] ; EDI = timer memspace
externfunc mem.dealloc ; deallocate the timer struc
test edx, edx ; if the next node is 0
jz .timers_done ; no more timers, take a break
mov dword[edx+timer.prev], 0 ; zero prev ptr of next timer
jmp short .check_timer ; check next timer for expiration
;
.timers_done: ;
mov [timers], edx ; save new root timer
; switch to next thread
mov eax, [cur_thread] ; EAX = cur thread
mcheck_thread eax ; (check magic)
;
%ifdef _EIP_CHECKS_ ;
mov ebx, [esp+32] ; (save eip)
mov [eax+thread.eip], ebx ;
%endif ;
;
%ifdef _SHOW_THREAD_COUNT_ ;
xor ecx, ecx ; ECX = 0
mov ebx, eax ; EBX = cur thread
.find_num: ;
inc ecx ; inc count of threads
mov ebx, [ebx+thread.next] ; EBX = next thread
cmp ebx, eax ; compare next with first thread
jnz .find_num ; loop until we find the first thread
dme ecx ; display the count
%endif ; %ifdef _SHOW_THREAD_COUNT_ ;
;
mov [eax+thread.esp], esp ; save esp
mov eax, [eax+thread.next] ; EAX = next thread
mcheck_thread eax ; (check magic)
mov esp, [eax+thread.esp] ; switch to new stack
mov [cur_thread], eax ; cur_thread = eax now
;
%ifdef _EIP_CHECKS_ ;
mov ebx, [eax+thread.eip] ; EBX = saved eip of thread
test ebx, ebx ;
jz .skip_eip_check ; if it's zero skip it with a warning
cmp ebx, [esp+32] ; compare the eips
jnz .eip_error ; if they don't match, that's bad
.eip_done: ;
%endif ;
; done, send EOI
;---------------
mov al, 0x60 ;
out 0x20, al ;
popad ; restore registers
iretd ;
.tick_overflow: ; used when LSW of timer count overflows
inc dword[timer.tick_count+4] ; inc MSW
jmp near .tick_done ;
%ifdef _MAGIC_CHECKS_
.magic_error:
lprint {"strontium: bad magic",0xa}, FATALERR
dmej 0x7EDE000D
%endif
%ifdef _EIP_CHECKS_
.eip_error:
mov ecx, [esp+32]
lprint {"strontium: eip mismatch: 0x%x in thread struc, 0x%x on stack",0xa}, FATALERR, ebx, ecx
dmej 0x7EDE000E
.skip_eip_check:
lprint {"strontium: skiping eip check",0xa}, DEBUG
jmp short .eip_done
%endif
; -----------------------------------
; data
;==============================================================================
section .data
align 4, db 0
timer.tick_count: dd 0, 0
vglobal timer.tick_count
proc_memspace: dd 0
thread_memspace: dd 0
timer_memspace: dd 0
ll_memspace: dd 0 ; 8 byte linked list mem.fixed space
cur_thread: dd 0 ; ptr to current thread; always valid
sleeping_threads: dd 0 ; ptr to first sleeping thread or 0 for none
crit_sect_depth: dd 0
crit_sect_flags: dd 0
thread_count: dd 0 ; number of existant threads, active or not
processes: dd 0 ; ptr to first process in chain
timers: dd 0 ; ptr to root timer (next to expire)
init_argv: dd init_name, 0
idle_thread: istruc thread
%ifdef _MAGIC_CHECKS_
at thread.magic, dd THREAD_MAGIC
%endif
at thread.next, dd idle_thread
at thread.prev, dd idle_thread
iend
init_name: db "init",0
| 31.745216
| 111
| 0.538476
|
575bf3ee374c63e43c5e4ed1883aeb3545fd9635
| 162
|
asm
|
Assembly
|
scratchpad/scratch.asm
|
MasterQ32/spu-mark-ii
|
e6ee2a8206cbf32cf81ea217c087bd47a0fd0ec5
|
[
"MIT"
] | 13
|
2020-05-03T15:47:51.000Z
|
2021-09-18T04:44:57.000Z
|
scratchpad/scratch.asm
|
MasterQ32/spu-mark-ii
|
e6ee2a8206cbf32cf81ea217c087bd47a0fd0ec5
|
[
"MIT"
] | null | null | null |
scratchpad/scratch.asm
|
MasterQ32/spu-mark-ii
|
e6ee2a8206cbf32cf81ea217c087bd47a0fd0ec5
|
[
"MIT"
] | 3
|
2020-06-24T16:04:44.000Z
|
2021-07-20T10:54:11.000Z
|
.dw 10
.dw 10+10
.dw 10*10
.dw 10-5
.dw 5+10*10 ; => 105
.dw 5*10+10 ; => 60
.equ twenty, 20
.equ ten, 10
.dw twenty + ten * 10
.dw 1 << 8
.dw 255 & (1<<4)
| 9
| 21
| 0.512346
|
3e75a6b098ab362f275646da9aa40a7c5caee2de
| 696
|
asm
|
Assembly
|
oeis/069/A069856.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/069/A069856.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/069/A069856.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A069856: E.g.f.: exp(x)/(1+LambertW(x)).
; Submitted by Christian Krause
; 1,0,3,-17,169,-2079,31261,-554483,11336753,-262517615,6791005621,-194103134499,6074821125385,-206616861429575,7588549099814957,-299320105069298459,12619329503201165281,-566312032570838608863,26952678355224681891685,-1355996947326697731660371,71904964190241365448411641,-4008313012385215161770122679,234333641814966127729230789085,-14336372656322054567805124314699,916048391563337306608914673430353,-61021973794988845640823245243921999,4230773519996754978701976398226481301
mov $4,$0
add $0,1
lpb $0
sub $0,1
mov $2,0
sub $2,$1
pow $2,$1
mov $3,$4
bin $3,$1
add $1,1
mul $3,$2
add $5,$3
lpe
mov $0,$5
| 36.631579
| 474
| 0.791667
|
f21e9b155e4696bc732716c6095223ac1f2eadef
| 1,501
|
asm
|
Assembly
|
Day-04/smallest_number.asm
|
MasumBhai/50-Day-challenge-with-Assembly-Language
|
aadeb6c4a022d089afb10fd22ffd2a768c32036e
|
[
"CC0-1.0"
] | 1
|
2021-04-07T09:50:40.000Z
|
2021-04-07T09:50:40.000Z
|
Day-04/smallest_number.asm
|
MasumBhai/50-Day-challenge-with-Assembly-Language
|
aadeb6c4a022d089afb10fd22ffd2a768c32036e
|
[
"CC0-1.0"
] | null | null | null |
Day-04/smallest_number.asm
|
MasumBhai/50-Day-challenge-with-Assembly-Language
|
aadeb6c4a022d089afb10fd22ffd2a768c32036e
|
[
"CC0-1.0"
] | null | null | null |
;Day 04 Date (10/04/21)
;problem - Read Three Numbers from User and Display Smallest Number
.model small
.stack 100h
include 'emu8086.inc'
.data
n_line db 0ah,0dh,"$" ;for new line
var1 db ?
var2 db ?
var3 db ?
msg1 db "Enter First Number : $"
msg2 db 10,13,"Enter Second Number : $"
msg3 db 10,13,"Enter Third Number : $"
f_msg db 10,13,"Smallest Number is : $"
.code
main proc
mov ax,@data
mov ds,ax
lea dx,msg1
mov ah,9
int 21h
mov ah,1
int 21h
mov var1,al
;lea dx,n_line ; new line
;mov ah,9
;int 21h
lea dx,msg2
mov ah,9
int 21h
mov ah,1
int 21h
mov var2,al
lea dx,msg3
mov ah,9
int 21h
mov ah,1
int 21h
mov var3,al
;now for comparison
mov dl,var1
cmp dl,var2
jb number1
jae number2
number1:
mov dl,var1
cmp dl,var3
jb num1_smaller
jae num3_smaller
number2:
mov dl,var2
cmp dl,var3
jb num2_smaller
jae num3_smaller
stop:
mov ah,4ch ; terminate
int 21h
main endp
num1_smaller:
lea dx,f_msg
mov ah,9
int 21h
mov dl,var1
mov ah,2
int 21h
jmp stop
num2_smaller:
lea dx,f_msg
mov ah,9
int 21h
mov dl,var2
mov ah,2
int 21h
jmp stop
num3_smaller:
lea dx,f_msg
mov ah,9
int 21h
mov dl,var3
mov ah,2
int 21h
jmp stop
end main
| 14.572816
| 67
| 0.550966
|
28b6a7b84d5f6642f42916bd519ca86c5f548cb0
| 353
|
asm
|
Assembly
|
programs/oeis/292/A292540.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | 1
|
2021-03-15T11:38:20.000Z
|
2021-03-15T11:38:20.000Z
|
programs/oeis/292/A292540.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | null | null | null |
programs/oeis/292/A292540.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | null | null | null |
; A292540: Number of 3-cycles in the n-Sierpinski tetrahedron graph.
; 4,20,80,320,1280,5120,20480,81920,327680,1310720,5242880,20971520,83886080,335544320,1342177280,5368709120,21474836480,85899345920,343597383680,1374389534720,5497558138880,21990232555520,87960930222080,351843720888320,1407374883553280
mov $1,4
pow $1,$0
mul $1,5
div $1,4
mul $1,4
| 39.222222
| 236
| 0.818697
|
aa2fee465862920ac3c38dc6545b617c0a7aee0a
| 8,309
|
asm
|
Assembly
|
maps/CeruleanGym.asm
|
Dev727/ancientplatinum
|
8b212a1728cc32a95743e1538b9eaa0827d013a7
|
[
"blessing"
] | 28
|
2019-11-08T07:19:00.000Z
|
2021-12-20T10:17:54.000Z
|
maps/CeruleanGym.asm
|
Dev727/ancientplatinum
|
8b212a1728cc32a95743e1538b9eaa0827d013a7
|
[
"blessing"
] | 13
|
2020-01-11T17:00:40.000Z
|
2021-09-14T01:27:38.000Z
|
maps/CeruleanGym.asm
|
Dev727/ancientplatinum
|
8b212a1728cc32a95743e1538b9eaa0827d013a7
|
[
"blessing"
] | 22
|
2020-05-28T17:31:38.000Z
|
2022-03-07T20:49:35.000Z
|
object_const_def ; object_event constants
const CERULEANGYM_ROCKET
const CERULEANGYM_MISTY
const CERULEANGYM_SWIMMER_GIRL1
const CERULEANGYM_SWIMMER_GIRL2
const CERULEANGYM_SWIMMER_GUY
const CERULEANGYM_GYM_GUY
CeruleanGym_MapScripts:
db 2 ; scene scripts
scene_script .DummyScene0 ; SCENE_CERULEANGYM_NOTHING
scene_script .GruntRunsOut ; SCENE_CERULEANGYM_GRUNT_RUNS_OUT
db 0 ; callbacks
.DummyScene0:
end
.GruntRunsOut:
prioritysjump .GruntRunsOutScript
end
.GruntRunsOutScript:
applymovement CERULEANGYM_ROCKET, CeruleanGymGruntRunsDownMovement
playsound SFX_TACKLE
applymovement CERULEANGYM_ROCKET, CeruleanGymGruntRunsIntoYouMovement
playmusic MUSIC_ROCKET_ENCOUNTER
opentext
writetext CeruleanGymGruntIntroText
waitbutton
closetext
showemote EMOTE_SHOCK, CERULEANGYM_ROCKET, 15
applymovement CERULEANGYM_ROCKET, CeruleanGymGruntBacksAwayMovement
opentext
writetext CeruleanGymGruntBigMistakeText
waitbutton
closetext
applymovement CERULEANGYM_ROCKET, CeruleanGymGruntMovesCloseMovement
opentext
writetext CeruleanGymGruntByeText
waitbutton
closetext
applymovement CERULEANGYM_ROCKET, CeruleanGymGruntRunsOutMovement
playsound SFX_EXIT_BUILDING
disappear CERULEANGYM_ROCKET
setevent EVENT_MET_ROCKET_GRUNT_AT_CERULEAN_GYM
clearevent EVENT_ROUTE_24_ROCKET
clearevent EVENT_ROUTE_25_MISTY_BOYFRIEND
setscene SCENE_CERULEANGYM_NOTHING
setmapscene ROUTE_25, SCENE_ROUTE25_MISTYS_DATE
setmapscene POWER_PLANT, SCENE_POWERPLANT_NOTHING
waitsfx
special RestartMapMusic
pause 15
turnobject PLAYER, DOWN
pause 15
end
CeruleanGymMistyScript:
faceplayer
opentext
checkflag ENGINE_CASCADEBADGE
iftrue .FightDone
writetext MistyIntroText
waitbutton
closetext
winlosstext MistyWinLossText, 0
loadtrainer MISTY, MISTY1
startbattle
reloadmapafterbattle
setevent EVENT_BEAT_MISTY
setevent EVENT_BEAT_SWIMMERF_DIANA
setevent EVENT_BEAT_SWIMMERF_BRIANA
setevent EVENT_BEAT_SWIMMERM_PARKER
opentext
writetext ReceivedCascadeBadgeText
playsound SFX_GET_BADGE
waitsfx
setflag ENGINE_CASCADEBADGE
.FightDone:
writetext MistyFightDoneText
waitbutton
closetext
end
TrainerSwimmerfDiana:
trainer SWIMMERF, DIANA, EVENT_BEAT_SWIMMERF_DIANA, SwimmerfDianaSeenText, SwimmerfDianaBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext SwimmerfDianaAfterBattleText
waitbutton
closetext
end
TrainerSwimmerfBriana:
trainer SWIMMERF, BRIANA, EVENT_BEAT_SWIMMERF_BRIANA, SwimmerfBrianaSeenText, SwimmerfBrianaBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext SwimmerfBrianaAfterBattleText
waitbutton
closetext
end
TrainerSwimmermParker:
trainer SWIMMERM, PARKER, EVENT_BEAT_SWIMMERM_PARKER, SwimmermParkerSeenText, SwimmermParkerBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext SwimmermParkerAfterBattleText
waitbutton
closetext
end
CeruleanGymGuyScript:
faceplayer
opentext
checkevent EVENT_BEAT_MISTY
iftrue .CeruleanGymGuyWinScript
writetext CeruleanGymGuyText
waitbutton
closetext
end
.CeruleanGymGuyWinScript:
writetext CeruleanGymGuyWinText
waitbutton
closetext
end
CeruleanGymHiddenMachinePart:
hiddenitem MACHINE_PART, EVENT_FOUND_MACHINE_PART_IN_CERULEAN_GYM
CeruleanGymStatue1:
checkevent EVENT_TRAINERS_IN_CERULEAN_GYM
iffalse CeruleanGymStatue
opentext
writetext CeruleanGymNote1Text
waitbutton
closetext
end
CeruleanGymStatue2:
checkevent EVENT_TRAINERS_IN_CERULEAN_GYM
iffalse CeruleanGymStatue
opentext
writetext CeruleanGymNote2Text
waitbutton
closetext
end
CeruleanGymStatue:
checkflag ENGINE_CASCADEBADGE
iftrue .Beaten
jumpstd gymstatue1
.Beaten:
gettrainername STRING_BUFFER_4, MISTY, MISTY1
jumpstd gymstatue2
CeruleanGymGruntRunsDownMovement:
big_step DOWN
big_step DOWN
big_step DOWN
big_step DOWN
step_end
CeruleanGymGruntRunsOutMovement:
big_step RIGHT
big_step DOWN
step_end
CeruleanGymGruntRunsIntoYouMovement:
fix_facing
set_sliding
jump_step UP
remove_sliding
remove_fixed_facing
step_sleep 8
step_sleep 8
step DOWN
step DOWN
step_end
CeruleanGymGruntMovesCloseMovement:
big_step DOWN
step_end
CeruleanGymGruntBacksAwayMovement:
fix_facing
slow_step UP
remove_fixed_facing
step_end
CeruleanGymGruntIntroText:
text "Oops! I so sorry!"
line "You not hurt,"
cont "okay?"
para "I very busy."
line "No time for talk-"
cont "ing with you. Not"
cont "good for me if"
cont "seen by somebody."
done
CeruleanGymGruntBigMistakeText:
text "Oh no! You seen"
line "me already! I make"
cont "big mistake!"
done
CeruleanGymGruntByeText:
text "Hey, you! Forget"
line "you see me, okay?"
para "You see, hear,"
line "know nothing,"
para "okay?"
line "Bye, kid! Nothing!"
para "Bye-bye a go-go!"
done
CeruleanGymNote1Text:
text "Sorry, I'll be out"
line "for a while."
cont "MISTY, GYM LEADER"
done
CeruleanGymNote2Text:
text "Since MISTY's out,"
line "we'll be away too."
cont "GYM TRAINERS"
done
MistyIntroText:
text "MISTY: I was ex-"
line "pecting you, you"
cont "pest!"
para "You may have a"
line "lot of JOHTO GYM"
para "BADGES, but you'd"
line "better not take me"
cont "too lightly."
para "My water-type"
line "#MON are tough!"
done
MistyWinLossText:
text "MISTY: You really"
line "are good…"
para "I'll admit that"
line "you are skilled…"
para "Here you go. It's"
line "CASCADEBADGE."
done
ReceivedCascadeBadgeText:
text "<PLAYER> received"
line "CASCADEBADGE."
done
MistyFightDoneText:
text "MISTY: Are there"
line "many strong train-"
cont "ers in JOHTO? Like"
cont "you, I mean."
para "I'm going to"
line "travel one day, so"
para "I can battle some"
line "skilled trainers."
done
SwimmerfDianaSeenText:
text "Sorry about being"
line "away. Let's get on"
cont "with it!"
done
SwimmerfDianaBeatenText:
text "I give up! You're"
line "the winner!"
done
SwimmerfDianaAfterBattleText:
text "I'll be swimming"
line "quietly."
done
SwimmerfBrianaSeenText:
text "Don't let my ele-"
line "gant swimming un-"
cont "nerve you."
done
SwimmerfBrianaBeatenText:
text "Ooh, you calmly"
line "disposed of me…"
done
SwimmerfBrianaAfterBattleText:
text "Don't be too smug"
line "about beating me."
para "MISTY will destroy"
line "you if you get"
cont "complacent."
done
SwimmermParkerSeenText:
text "Glub…"
para "I'm first! Come"
line "and get me!"
done
SwimmermParkerBeatenText:
text "This can't be…"
done
SwimmermParkerAfterBattleText:
text "MISTY has gotten"
line "much better in the"
cont "past few years."
para "Don't let your"
line "guard down, or"
cont "you'll be crushed!"
done
CeruleanGymGuyText:
text "Yo! CHAMP in"
line "making!"
para "Since MISTY was"
line "away, I went out"
para "for some fun too."
line "He-he-he."
done
CeruleanGymGuyWinText:
text "Hoo, you showed me"
line "how tough you are."
para "As always, that"
line "was one heck of a"
cont "great battle!"
done
CeruleanGym_MapEvents:
db 0, 0 ; filler
db 2 ; warp events
warp_event 4, 15, CERULEAN_CITY, 5
warp_event 5, 15, CERULEAN_CITY, 5
db 0 ; coord events
db 3 ; bg events
bg_event 3, 8, BGEVENT_ITEM, CeruleanGymHiddenMachinePart
bg_event 2, 13, BGEVENT_READ, CeruleanGymStatue1
bg_event 6, 13, BGEVENT_READ, CeruleanGymStatue2
db 6 ; object events
object_event 4, 10, SPRITE_ROCKET, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, ObjectEvent, EVENT_CERULEAN_GYM_ROCKET
object_event 5, 3, SPRITE_MISTY, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, CeruleanGymMistyScript, EVENT_TRAINERS_IN_CERULEAN_GYM
object_event 4, 6, SPRITE_SWIMMER_GIRL, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_TRAINER, 3, TrainerSwimmerfDiana, EVENT_TRAINERS_IN_CERULEAN_GYM
object_event 1, 9, SPRITE_SWIMMER_GIRL, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_TRAINER, 1, TrainerSwimmerfBriana, EVENT_TRAINERS_IN_CERULEAN_GYM
object_event 8, 9, SPRITE_SWIMMER_GUY, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 3, TrainerSwimmermParker, EVENT_TRAINERS_IN_CERULEAN_GYM
object_event 7, 13, SPRITE_GYM_GUY, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, CeruleanGymGuyScript, EVENT_TRAINERS_IN_CERULEAN_GYM
| 21.638021
| 179
| 0.800217
|
a0c1d2daf795e393329e40b05c4f1058f6e3cc2f
| 741
|
asm
|
Assembly
|
programs/oeis/194/A194139.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/194/A194139.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/194/A194139.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A194139: a(n) = Sum_{j=1..n} floor(j*(2+sqrt(2))); n-th partial sum of Beatty sequence for 2+sqrt(2).
; 3,9,19,32,49,69,92,119,149,183,220,260,304,351,402,456,514,575,639,707,778,853,931,1012,1097,1185,1277,1372,1471,1573,1678,1787,1899,2015,2134,2256,2382,2511,2644,2780,2919,3062,3208,3358,3511,3668,3828,3991,4158,4328,4502,4679,4859,5043,5230,5421,5615,5813,6014,6218,6426,6637,6852,7070,7291,7516,7744,7976,8211,8449,8691,8936,9185,9437,9693,9952,10214,10480,10749,11022,11298,11577,11860,12146,12436,12729,13026,13326,13629,13936,14246,14560,14877,15197,15521,15848,16179,16513,16851,17192
lpb $0
mov $2,$0
sub $0,1
seq $2,286927 ; Positions of 1 in A286925; complement of A286926.
add $1,$2
lpe
div $1,2
add $1,3
mov $0,$1
| 57
| 493
| 0.735493
|
75233d420b8962248f9514ae61fcf7511afcdb35
| 885
|
asm
|
Assembly
|
pause.asm
|
vorburger/empty-container
|
4df61ae0e781482e3261b7033a00b60ddb8447f4
|
[
"Unlicense"
] | 2
|
2017-06-19T10:12:54.000Z
|
2020-04-19T12:49:22.000Z
|
pause.asm
|
vorburger/empty-container
|
4df61ae0e781482e3261b7033a00b60ddb8447f4
|
[
"Unlicense"
] | 1
|
2020-04-19T13:24:45.000Z
|
2020-04-29T18:35:44.000Z
|
pause.asm
|
vorburger/empty-container
|
4df61ae0e781482e3261b7033a00b60ddb8447f4
|
[
"Unlicense"
] | 2
|
2017-12-07T22:06:01.000Z
|
2020-04-19T13:00:15.000Z
|
; pause.asm
;
; Just waits forever. Calls the pause syscall.
;
; This is a convenient program for replacing /bin/sh
; inside a docker container that shouldn't actually run
; anything, for instance a pure storage container.
;
; This results in a container of only a about one hundred bytes,
; (before copying in the files to be shared in a volume,)
; and will only consume a few KB of ram.
;
; see /usr/include/asm/unistd_64.h for syscall definitions.
;
; Build with:
; nasm -f elf64 pause.asm
; ld -s -o pause pause.o && rm -f pause.o
;
; Then in the Dockerfile do something like ...
; FROM scratch
; COPY pause /bin/sh
; COPY /files_to_be_shared/ shared/
; VOLUME ['/shared']
; USER 65535
; CMD ['']
bits 64
global _start
section .text
_start:
mov rax,34 ; pause()
syscall
| 26.029412
| 70
| 0.627119
|
388b24e53b291ee2c2c5bafe0e5273fd4bc9b97b
| 4,638
|
asm
|
Assembly
|
tools-src/gnu/gcc/gcc/config/ia64/crtbegin.asm
|
enfoTek/tomato.linksys.e2000.nvram-mod
|
2ce3a5217def49d6df7348522e2bfda702b56029
|
[
"FSFAP"
] | 80
|
2015-01-02T10:14:04.000Z
|
2021-06-07T06:29:49.000Z
|
tools-src/gnu/gcc/gcc/config/ia64/crtbegin.asm
|
unforgiven512/tomato
|
96f09fab4929c6ddde5c9113f1b2476ad37133c4
|
[
"FSFAP"
] | 9
|
2015-05-14T11:03:12.000Z
|
2018-01-04T07:12:58.000Z
|
tools-src/gnu/gcc/gcc/config/ia64/crtbegin.asm
|
unforgiven512/tomato
|
96f09fab4929c6ddde5c9113f1b2476ad37133c4
|
[
"FSFAP"
] | 69
|
2015-01-02T10:45:56.000Z
|
2021-09-06T07:52:13.000Z
|
/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Contributed by Jes Sorensen, <Jes.Sorensen@cern.ch>
The GNU C 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 C 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 C 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. */
.section .ctors,"aw","progbits"
.align 8
__CTOR_LIST__:
data8 -1
.section .dtors,"aw","progbits"
.align 8
__DTOR_LIST__:
data8 -1
.section .jcr,"aw","progbits"
.align 8
__JCR_LIST__:
.section .sdata
.type dtor_ptr#,@object
.size dtor_ptr#,8
dtor_ptr:
data8 @gprel(__DTOR_LIST__# + 8)
/* A handle for __cxa_finalize to manage c++ local destructors. */
.global __dso_handle#
.type __dso_handle#,@object
.size __dso_handle#,8
#ifdef SHARED
.section .data
__dso_handle:
data8 __dso_handle#
#else
.section .bss
__dso_handle:
data8 0
#endif
.hidden __dso_handle#
/*
* Fragment of the ELF _fini routine that invokes our dtor cleanup.
*
* We make the call by indirection, because in large programs the
* .fini and .init sections are not in range of the destination, and
* we cannot allow the linker to insert a stub at the end of this
* fragment of the _fini function. Further, Itanium does not implement
* the long branch instructions, and we do not wish every program to
* trap to the kernel for emulation.
*
* Note that we require __do_global_dtors_aux to preserve the GP,
* so that the next fragment in .fini gets the right value.
*/
.section .fini,"ax","progbits"
{ .mlx
movl r2 = @pcrel(__do_global_dtors_aux# - 16)
}
{ .mii
mov r3 = ip
;;
add r2 = r2, r3
;;
}
{ .mib
mov b6 = r2
br.call.sptk.many b0 = b6
;;
}
/* Likewise for _init. */
.section .init,"ax","progbits"
{ .mlx
movl r2 = @pcrel(__do_jv_register_classes# - 16)
}
{ .mii
mov r3 = ip
;;
add r2 = r2, r3
;;
}
{ .mib
mov b6 = r2
br.call.sptk.many b0 = b6
;;
}
.section .text
.align 16
.proc __do_global_dtors_aux#
__do_global_dtors_aux:
#ifndef SHARED
{ .mii
alloc loc3 = ar.pfs, 0, 4, 1, 0
addl loc0 = @gprel(dtor_ptr#), gp
mov loc1 = b0
}
{ .mib
mov loc2 = gp
br.sptk.few 1f
;;
}
#else
/*
if (__cxa_finalize)
__cxa_finalize(__dso_handle)
*/
{ .mii
alloc loc3 = ar.pfs, 0, 4, 1, 0
addl loc0 = @gprel(dtor_ptr#), gp
addl r16 = @ltoff(@fptr(__cxa_finalize#)), gp
;;
}
{ .mmi
ld8 r16 = [r16]
;;
addl out0 = @ltoff(__dso_handle#), gp
cmp.ne p7, p0 = r0, r16
;;
}
{ .mmi
ld8 out0 = [out0]
(p7) ld8 r18 = [r16], 8
mov loc1 = b0
;;
}
{ .mfi
mov loc2 = gp
(p7) mov b6 = r18
}
{
.mfb
(p7) ld8 gp = [r16]
(p7) br.call.sptk.many b0 = b6
}
{ .mfb
br.sptk.few 1f
}
#endif
/*
do {
dtor_ptr++;
(*(dtor_ptr-1)) ();
} while (dtor_ptr);
*/
0:
{ .mmi
st8 [loc0] = r15
ld8 r17 = [r16], 8
;;
}
{ .mib
ld8 gp = [r16]
mov b6 = r17
br.call.sptk.many b0 = b6
}
1:
{ .mmi
ld8 r15 = [loc0]
;;
add r16 = r15, loc2
adds r15 = 8, r15
;;
}
{ .mmi
ld8 r16 = [r16]
mov gp = loc2
mov b0 = loc1
;;
}
{ .mib
cmp.ne p6, p0 = r0, r16
mov ar.pfs = loc3
(p6) br.cond.sptk.few 0b
}
{ .bbb
br.ret.sptk.many b0
;;
}
.endp __do_global_dtors_aux#
.align 16
.proc __do_jv_register_classes#
__do_jv_register_classes:
{ .mlx
alloc loc2 = ar.pfs, 0, 3, 1, 0
movl out0 = @gprel(__JCR_LIST__)
;;
}
{ .mmi
addl r14 = @ltoff(@fptr(_Jv_RegisterClasses)), gp
add out0 = out0, gp
;;
}
{ .mmi
ld8 r14 = [r14]
ld8 r15 = [out0]
cmp.ne p6, p0 = r0, r0
;;
}
{ .mib
cmp.eq.or p6, p0 = r0, r14
cmp.eq.or p6, p0 = r0, r15
(p6) br.ret.sptk.many b0
}
{ .mii
ld8 r15 = [r14], 8
mov loc0 = b0
mov loc1 = gp
;;
}
{ .mib
ld8 gp = [r14]
mov b6 = r15
br.call.sptk.many b0 = b6
;;
}
{ .mii
mov gp = loc1
mov b0 = loc0
mov ar.pfs = loc2
}
{ .bbb
br.ret.sptk.many b0
;;
}
.endp __do_jv_register_classes#
#ifdef SHARED
.weak __cxa_finalize#
#endif
.weak _Jv_RegisterClasses
| 18.777328
| 76
| 0.623545
|
525e3829d796a2ab25756427410951139d8067ce
| 81,313
|
asm
|
Assembly
|
cmd/share/gshare2.asm
|
minblock/msdos
|
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
|
[
"Apache-2.0"
] | null | null | null |
cmd/share/gshare2.asm
|
minblock/msdos
|
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
|
[
"Apache-2.0"
] | null | null | null |
cmd/share/gshare2.asm
|
minblock/msdos
|
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
|
[
"Apache-2.0"
] | null | null | null |
Title Share_2
;/*
; * Microsoft Confidential
; * Copyright (C) Microsoft Corporation 1991
; * All Rights Reserved.
; */
;
; Revision History
; ================
;
; M000 SR 08/03/90 Fixed ShComndParse so that it exits
; after displaying help text on a
; Share /?
;
; M001 SR 9/10/90 Removed all /NC support from the code
; and rewrote the init code to not use
; all the special Share int 2fh calls.
;
; M002 SR 9/26/90 Bug #3013. The installed message and
; parse error message had identical
; message numbers. Also check the class.
;
; M004 HKN 10/18/90 To determine whether the SFT is a
; net SFT or a device we must check
; the sf_flags. bug #3584
;
; M005 SR 10/16/90 Bug #2914. Changed to ignore the /NC
; switch instead of making it an
; invalid switch.
;
; M006 SR 10/22/90 Bug #3583. Changed parsing to check
; for multiple occurrences of a switch
; and give out an error message. Share
; still continues to load and uses the
; parameter value first specified.
;
; M007 SR 11/16/90 Bug #4240. Added check to ShareInit
; to look for switcher and fail to load
; if switcher is present.
;
include SHAREHDR.INC
;
; Label: "The DOS SHARE Utility"
;
;******************* END OF SPECIFICATIONS *************************************
NAME Sharer2
; INCLUDE DOSSYM.INC
; INCLUDE SYSMSG.INC
.xlist
.xcref
INCLUDE DOSSYM.INC
INCLUDE SYSMSG.INC
include filemode.inc
include arena.inc
include cpmfcb.inc
include sf.inc
include pdb.inc
include sysvar.inc
include syscall.inc
include mult.inc
include version.inc
include vector.inc
include int2a.inc
.cref
.list
page 80,132
MSG_UTILNAME <SHARE>
ShareDataVersion = 1
AsmVars <IBM, Installed>
Installed = TRUE ; for installed version
OFF Macro reg,val
IF installed
mov reg,OFFSET val
ELSE
mov si,OFFSET DOSGROUP:val
ENDIF
ENDM
ERRNZ Macro x
IF x NE 0
%out ERRNZ failed
ENDIF
ENDM
;---------------------------------------
; if we are installed, then define the
; base code segment of the sharer first
;---------------------------------------
; $SALUT (4,9,17,36)
IF Installed
Share SEGMENT BYTE PUBLIC 'SHARE'
Share ENDS
include dosseg.inc
ENDIF
;---------------------------------------
; include the rest of the segment
; definitions for normal msdos
; segment ordering for MSDOS
;---------------------------------------
DOSDATA SEGMENT
extrn DataVersion:BYTE ; version number of DOS data.
extrn JShare:BYTE ; location of DOS jump table.
extrn sftFCB:DWORD ; [SYSTEM] pointer to FCB cache table
extrn KeepCount:WORD ; [SYSTEM] LRU count for FCB cache
extrn CurrentPDB:WORD
extrn ThisSFT:DWORD ; pointer to SFT entry
extrn WFP_start:WORD ; pointer to name string
extrn User_ID:WORD
extrn Proc_ID:WORD
extrn SFT_addr:DWORD
extrn Arena_Head:WORD
extrn fshare:BYTE
extrn pJFN:DWORD
extrn JFN:WORD
IF DEBUG
extrn BugLev:WORD
extrn BugTyp:WORD
include bugtyp.inc
ENDIF
DOSDATA ENDS
;---------------------------------------
; if we are not installed, then the
; code here is just part of the normal
; MSDOS code segment otherwise,
; define our own code segment
;---------------------------------------
.sall
IF NOT INSTALLED
CODE SEGMENT BYTE PUBLIC 'CODE'
ASSUME SS:DOSGROUP,CS:DOSCODE
ELSE
Share SEGMENT BYTE PUBLIC 'SHARE'
ASSUME SS:DOSDATA,CS:SHARE
ENDIF
Extrn FreLock:WORD,Serial:WORD
Extrn MFT_Enter:NEAR,MFTClose:NEAR,MFTClu:NEAR,MFTCloseP:NEAR
Extrn MFTCloN:NEAR
Extrn Set_Mult_Block:NEAR,Clr_Mult_Block:NEAR,Chk_Block:NEAR
Extrn MFT_Get:NEAR
include mft.inc
; $SALUT (4,4,9,41)
BREAK <FNM - Find name in MFT>
;******************* START OF SPECIFICATIONS ***********************************
;
; FNM - Find name in MFT
;
; FNM searches the MFT for a name record.
;
; ENTRY (DS:SI) = pointer to name string (.asciz)
; (al) = 1 to create record if non exists
; = 0 otherwise
; EXIT 'C' clear if found or created
; (DS:BX) = address of MFT name record
; 'C' set if error
; If not to create, item not found
; (DS:SI) unchanged
; If to create, am out of space
; (ax) = error code
; USES ALL
;
;******************* END OF SPECIFICATIONS *************************************
Procedure FNM,NEAR
push ds ; save string address
push si
xchg bh,al ; (bh) = create flag
or bh,bh ; if not creating
jz fnm01 ; skip sft test
;---------------------------------------
; run down through string counting
; and summing
;---------------------------------------
fnm01: sub dx,dx ; (dx) = byte count
sub bl,bl ; (bl) = sum
fnm1: lodsb ; (al) = next char
add bl,al
adc bl,0
inc dx
and al,al
jnz fnm1 ; terminate after null char
;---------------------------------------
; Info computed.
; Start searching name list
; (bh) = create flag
; (bl) = sum byte
; (dx) = byte count
; (TOS+2:TOS) = name string address
;---------------------------------------
push cs
pop ds
Off SI,mft
fnm2: cmp [si].mft_flag,MFLG_FRE
jl fnm10 ; at end - name not found
jz fnm4 ; is free, just skip it
cmp bl,[si].mft_sum ; do sums compare?
jz fnm5 ; its a match - look further
fnm4: add si,[si].mft_len ; not a match... skip it
JMP SHORT fnm2
;---------------------------------------
; name checksums match
; - compare the actual strings
;
; (dx) = length
; (ds:si = MFT address
; (bh) = create flag
; (bl) = sum byte
; (dx) = byte count
; (TOS+2:TOS) = name string address
;---------------------------------------
fnm5: mov cx,dx ; (cx) = length to match
pop di
pop es ; (ES:DI) = fba given name
push es
push di
push si ; save MFT offset
add si,mft_name ; (ds:si) = fwa string in record
repz cmpsb
pop si ; (ds:si) = fwa name record
jnz fnm4 ; not a match
;---------------------------------------
; Yes, we've found it. Return the info
;
; (TOS+2:TOS) = name string address
;---------------------------------------
fmt TypShare,LevMFTSrch,<"FNM found name record at $x\n">,<si>
pop ax ; discard unneeded stack stuff
pop ax
mov bx,si ; (ds:bx) = fwa name record
clc
ret
;---------------------------------------
;**
;** Its not in the list
;** - lets find a free spot and put
;** it there
;
; (bh) = create flag
; (bl) = sum byte
; (dx) = string length
; (TOS+2:TOS) = ASCIZ string address
; (ds) = SEG CODE
;---------------------------------------
fnm10:
and bh,bh
jnz fnm10$5 ; yes, insert it
pop si
pop ds ; no insert, its a "not found"
stc
fmt TypShare,LevMFTSrch,<"FNM failing\n">
mov ax,error_path_not_found
ret
fnm10$5:
add dx,mft_name ; (dx) = minimum space needed
off SI,mft
fnm11: cmp [si].mft_flag,MFLG_FRE
IF NOT DEBUG
jl fnm20 ; at END, am out of space
ELSE
jl fnm20j
ENDIF
jz fnm12 ; is a free record
add si,[si].mft_len ; skip name record
JMP SHORT fnm11
IF DEBUG
fnm20j: jmp fnm20
ENDIF
fnm12: mov ax,[si].mft_len ; Have free record, (ax) = total length
cmp ax,dx
jnc fnm13 ; big enough
add si,ax
JMP SHORT fnm11 ; not large enough - move on
;---------------------------------------
; OK, we have a record which is big
; enough. If its large enough to hold
; another name record of 6 characters
; than we'll split the block, else
; we'll just use the whole thing
;
; (ax) = size of free record
; (dx) = size needed
; (ds:si) = address of free record
; (bl) = sum byte
; (TOS+2:TOS) = name string address
;---------------------------------------
fnm13: sub ax,dx ; (ax) = total size of proposed fragment
cmp ax,mft_name+6
jc fnm14 ; not big enough to split
push bx ; save sum byte
mov bx,dx ; (bx) = offset to start of new name record
mov [bx][si].mft_flag,MFLG_FRE
mov [bx][si].mft_len,ax ; setup tail as free record
sub ax,ax ; don't extend this record
pop bx ; restore sum byte
fnm14: add dx,ax ; (dx) = total length of this record
mov [si].mft_len,dx
mov [si].mft_sum,bl
mov [si].mft_flag,MFLG_NAM
fmt TypShare,LevMFTSrch,<"FNM creating record at $x\n">,<si>
push ds
pop es ; (es) = MFT segment for "stow"
sub ax,ax
mov di,si
add di,mft_lptr
stosw ; zero LCK pointer
ERRNZ mft_sptr-mft_lptr-2
; add di,mft_sptr-mft_lptr-2
stosw ; zero SFT pointer
stosw ; zero SFT pointer
inc serial ; bump serial number
mov ax,serial
ERRNZ mft_serl-mft_sptr-4
; ADD di,mft_serl-mft_sptr-4
stosw
;---------------------------------------
; We're all setup except for the name.
; Note that we'll block copy the whole
; name field, even though the name may
; be shorter than that (we may have
; declined to fragment this memory block)
;
; (dx) = total length of this record
; (ds:si) = address of working record
; (es) = (ds)
; (TOS+2:TOS) = name string address
;---------------------------------------
mov cx,dx
sub cx,mft_name ; compute total size of name area
ERRNZ mft_name-mft_serl-2
; add di,mft_name-mft_serl-2 ; (ES:DI) = target address
mov ax,si ; save name record offset
pop si
pop ds
rep movsb
mov bx,ax ; (bx) = name record offset
push es
pop ds ; (DS:BX) = name record offset
clc
ret
;**
;** OUT OF FREE SPACE
;**
;** This is tough, folks. Lets trigger a garbage collection and see if
;** there is enough room. If there is, we'll hop back and relook for a
;** free hunk; if there isnt enough space, its error-city!
;
; WARNING: it is important that the garbage collector be told how big a
; name record hole we're looking for... if the size given GCM
; is too small we'll loop doing "no space; collect; no space;
; ...)
;
; (dx) = total length of desired name record
; (ds) = SEG CODE
; (bl) = sum byte
; (TOS+2:TOS) = name string address
fnm20:
mov ax,dx ; (ax) = size wanted
sub dx,mft_name ; (dx) = string length for reentry at fnm10
push dx
push bx
call GCM ; garbage collect MFT
pop bx
pop dx
IF DEBUG
jnc fnm10j
ELSE
jnc fnm10 ; go back and find that space
ENDIF
;---------------------------------------
; no space, return w/error
;---------------------------------------
fnm50: pop ax
pop ax ; clean stack
mov ax,error_sharing_buffer_exceeded
stc
ret
IF DEBUG
fnm10j: jmp fnm10
ENDIF
EndProc FNM
BREAK <GCM - Garbage Collect MFT>
;******************* START OF SPECIFICATIONS ***********************************
;
; GCM - Garbage Collect MFT
;
; GCM runs down the MFT structure squeezing out the free space and
; putting it into one free block at the end. This is a traditional heap
; collection process. We must be sure to update the pointer in the
; SFTs. This presumes no adjacent free blocks.
;
; ENTRY (ax) = space desired in last free block
; (DS) + SEG CODE
; EXIT 'C' clear if enough space in block
; 'C' set if not enough space
;
;******************* END OF SPECIFICATIONS *************************************
Procedure GCM,NEAR
push ax ; save target
off si,mft ; (si) = from pointer
mov di,si ; (di) = to pointer
;---------------------------------------
; (DI) points to the beginning of
; a free space block
; (SI) points to the next block.
;---------------------------------------
gcm1: mov cx,[si].mft_len ; (cx) = size of whatever it is
cmp [si].mft_flag,MFLG_FRE
jl gcm10 ; END marker
jnz gcm2 ; have a name record
;---------------------------------------
; (SI) points to a free block.
; We coalesce it by changing the size.
;---------------------------------------
cmp si,di
jz gcm15 ; do NOT coalesce a block with itself
add [di].mft_len,cx ; coalesce
gcm15:
add si,cx ; skip the empty one
JMP SHORT gcm1
;---------------------------------------
; (SI) points to a non-free,
; non-last block.
; (DI) points to the beginning of a
; free block.
;
; We move the non-free block down over
; the free block
;---------------------------------------
gcm2: cmp si,di
jnz gcm3 ; have to copy
;---------------------------------------
; SI = DI => we are at a boundary
; between allocated blocks.
; We do no copying.
;---------------------------------------
add si,cx
mov di,si ; no emptys yet... no need to copy
JMP SHORT gcm1
;---------------------------------------
; CX is length of allocated block.
; - Move it
;---------------------------------------
gcm3: mov bx,di ; (DS:BX) = new home for this record
mov ax,ds
mov es,ax
rep movsb
;---------------------------------------
; We've moved the record, now fix up
; the pointers in the SFT chain
;
; (si) = address of next record
; (di) = address of next free byte
; (bx) = address of record in its new home
; (TOS) = needed space
;---------------------------------------
push di
push ds
lds di,[bx].mft_sptr ; (ds:di) = chain of SFT
gcm4: or di,di
jz gcm5 ; no more SFT
mov [di].sf_mft,bx ; install new MFT position
lds di,[di].sf_chain ; link to next
JMP gcm4 ; fix next SFT
gcm5: pop ds
pop di
;---------------------------------------
; (DI) points to beginning of
; new free record (moved)
; (SI) points to next record
;
; Make sure that the (DI) record
; has correct format
;---------------------------------------
mov [di].mft_flag,MFLG_FRE ; indicate free record
mov [di].mft_len,si ; calculate correct length
sub [di].mft_len,di
;---------------------------------------
; MFT now has correct record structure.
; Go find more free blocks
;---------------------------------------
JMP SHORT gcm1
;---------------------------------------
; We have scanned the entire table,
; compacting all empty records together.
;
; (di) = first free byte in table
; (si) = address of END record
; (TOS) = size needed
;
; Be extra careful!!!
;---------------------------------------
gcm10: mov ax,si
sub ax,di ; (ax) = free space
pop bx ; (bx) = space wanted
sub ax,bx
ret
EndProc GCM
BREAK <RMN - Remove MFT Name record>
;******************* START OF SPECIFICATIONS ***********************************
;
; RMN - Remove MFT Name record
;
; RMN removes a name record from the MFT list. The record is marked
; free and all free space is coalesced.
;
; ENTRY (DS:BX) = FBA MFT name record
; EXIT to INTERR if lock and SFT chains are not empty
; USES ALL
;
;******************* END OF SPECIFICATIONS *************************************
Procedure RMN,NEAR
mov si,bx
mov ax,word ptr [si].mft_sptr
or ax,word ptr [si].mft_lptr
jnz RMNIER1 ; not clean - internal error
mov si,bx ; (ds:si) = fwa name record
mov [si].mft_flag,MFLG_FRE ; mark free
call mrg ; coalesce all free space
ret
RMNIER1:push ax
off ax,RmnErr1
RMNIER: call INTERR ; internal error
EndProc RMN
Break <MRG - merge all free space>
;******************* START OF SPECIFICATIONS ***********************************
;
; MRG - merge all free space
;
; MRG - walk through mft merging adjacent free space.
;
; Inputs: ds = CS
; Outputs: none (all free space coalesced)
; Registers Revised: none
;
;******************* END OF SPECIFICATIONS *************************************
Procedure MRG,near
assume ds:nothing,es:nothing
push si
push bx
off si,mft ; start at beginning
mrg1: mov bx,[si].mft_len ; get length
cmp [si].mft_flag,MFLG_FRE ; is record free?
jl mrg9 ; done.
jz mrg2 ; yes, try to merge with next
mrg15: add si,bx ; advance to next
jmp mrg1
;---------------------------------------
; (si) points to free record.
; - See if next is free
;---------------------------------------
mrg2: cmp [bx][si].mft_flag,MFLG_FRE
jnz mrg15 ; not free, go scan again
mov bx,[bx][si].mft_len ; get length of next guy
add [si].mft_len,bx ; increase our length
jmp mrg1 ; and check again
mrg9: pop bx
pop si
ret
EndProc MRG
BREAK <RSC - Remove SFT from SFT chain>
;******************* START OF SPECIFICATIONS ***********************************
;
; RSC - Remove SFT from SFT chain
;
; RSC removes a given SFT from its chain. The caller must insure that
; any locks have been cleared and that the SFT is indeed free. The
; sf_mft field is zeroed to indicate that this SFT is no longer chained.
;
; NOTE - RSC does NOT remove the name record if this was the last SFT on
; it. The caller must check for this and remove it, if
; necessary.
;
; ENTRY (ES:DI) = SFT address
; EXIT (DS:BX) = FBA name record for this SFT
; 'Z' set if this is the last SFT
; USES ALL
;
;******************* END OF SPECIFICATIONS *************************************
Procedure RSC,NEAR
push cs
pop ds
mov ax,es ; easy spot for compare
mov bx,es:[di].sf_mft
lea si,[bx].mft_sptr-sf_chain ; ds:[si].sf_chain point to prev link
rsc1: or si,si
jz rscier
cmp word ptr [si].sf_chain,di
jnz rsc15
cmp word ptr [si].sf_chain+2,ax
jz rsc2
rsc15: lds si,[si].sf_chain
jmp rsc1
;---------------------------------------
; (es:di) is sft
; (ds:si) is prev sft link
;---------------------------------------
rsc2: mov ax,word ptr es:[di].sf_chain
mov word ptr ds:[si].sf_chain,ax
mov ax,word ptr es:[di].sf_chain+2
mov word ptr ds:[si].sf_chain+2,ax
push cs
pop ds
xor bx,bx
xchg bx,es:[di].sf_MFT ; (DS:bx) = MFT address
; and 0 MFT pointer (show free)
cmp word ptr [bx].mft_sptr,0 ; set z flag if no more sft
ret
rscier: push ax
off ax,RscErr
call interr
EndProc RSC
BREAK <SLE - Scan for Lock Entry>
;******************* START OF SPECIFICATIONS ***********************************
;
; SLE - Scan for Lock Entry
;
; SLE scans a lock list looking for a lock range that overlaps the
; caller-supplied range. SLE indicates:
;
; no overlap
; partial overlay
; 1-to-1 match
;
; ENTRY (AX:BX) = FBA of area
; (CX:DX) = LBA of area
; (DS:SI) = address of name record
; (DI) = 0 to ignore locks by User_ID Proc_ID ThisSFT
; = 1 to consider all locks
; EXIT 'C' clear if no overlap
; AX,BX,CX,DX preserved
; 'C' set if overlap
; (di) = address of pointer to found record
; (i.e., DS:((di)) = address of lock record)
; 'Z' set if 1-to-1 match
; USES ALL but (ds), (es) (also see EXIT)
;
;******************* END OF SPECIFICATIONS *************************************
Procedure SLE,NEAR
push es
and di,di
pushf ; Z set to ignore own locks
lea di,[si].mft_lptr ; (ds:di) = addr of ptr to lock record
mov si,[di] ; (ds:si) = address of 1st lock record
;---------------------------------------
; check out next lock
;
; (ds:si) = address of next lock record
; (ds:di) = address of pointer to next
; lock record
; (TOS) = flags (Z set to ignore
; own locks)
; (TOS+1) = Saved ES
;---------------------------------------
sle1: and si,si
jz sle9 ; list exhaused, ergo no overlap
popf ;
pushf
jnz sle2 ; am to check all locks
;---------------------------------------
; am to ignore own locks...
; check the user and proc IDs on this one
;---------------------------------------
;dcl - this code used to compare the process id in the sft pointed to by the
; lock. now we compare the lock process id to the current process id. this
; allows a child process to lock an area and then do i/o with it. before,
; the child could lock it, but then could not access it
mov bp,[si].rlr_pid ;dcl
cmp bp,Proc_id ;dcl
jnz sce1$5 ;dcl
les si,[si].rlr_sptr ; (si) = sft address ;dcl
mov bp,es:[si].sf_UID ;dcl
cmp bp,User_ID ;dcl
jnz sce1$5 ; doesn't belong to user ;dcl
mov bp,es ;dcl
cmp bp,WORD PTR ThisSFT+2
jnz sce1$5
cmp si,WORD PTR ThisSFT
sce1$5: mov si,[di] ; (ds:si) = address of next lock record
jz sle3 ; owned by user - ignore
sle2: mov bp,dx
sub bp,[si].rlr_fba ; compare proposed last to first of record
mov bp,cx
sbb bp,[si].rlr_fba+2
jc sle3 ; proposed is above current
mov bp,[si].rlr_lba
sub bp,bx ; compare proposed first to last of record
mov bp,[si].rlr_lba+2
sbb bp,ax
jnc sle5 ; we have a hit
;---------------------------------------
; This entry is harmless...
; chain to the next one
;---------------------------------------
ERRNZ rlr_next
sle3: mov di,si ; save addr of pointer to next
mov si,[di]
JMP SHORT sle1
;---------------------------------------
; We have an overlap.
; - See if its an exact match
;
; (ds:di) = address of pointer
; (offset only) to the lock record
; (ds:si) = address of lock record
; (TOS) = flags ('Z' set if to ignore
; own locks)
; (TOS+1) = saved (es)
;---------------------------------------
sle5: xor ax,[si].rlr_fba+2 ; require a 4-word match
xor bx,[si].rlr_fba
xor cx,[si].rlr_lba+2
xor dx,[si].rlr_lba
or ax,bx
or ax,cx
or ax,dx ; 'Z' set if exact match
stc ; flag an overlap
mov ax,error_lock_violation
sle9: pop bp ; discard flags (pushf)
pop es ; restore (es)
;---------------------------------------
; (ds:si) = address of lock record
; for Chk_Block
;---------------------------------------
ret
EndProc SLE
BREAK <OFL - obtain free lock-record>
;******************* START OF SPECIFICATIONS ***********************************
;
; OFL - obtain free lock-record
;
; OFL returns a free lock-record, if one can be had.
;
; ENTRY (DS) = MFT Segment
; EXIT 'C' clear if OK
; (DI) = FBA lock record
; 'C' set if no space
; (ax) = error code
; USES DI, FLAGS
;
;******************* END OF SPECIFICATIONS *************************************
Procedure OFL,NEAR
mov di,Frelock
and di,di
; $if nz ; if something there
JZ $$IF1
push [di].rlr_next
pop Frelock ; chain off of the list
; exit with 'C' clear
; $else ; none on free list
JMP SHORT $$EN1
$$IF1:
mov ax,error_sharing_buffer_exceeded ; None on free list, give up until
stc ; garbage collector is ready
; $endif
$$EN1:
ret
EndProc OFL
Break <CPS - close process SFT>
;******************* START OF SPECIFICATIONS ***********************************
;
; CPS - close process SFT.
;
; During maintenance, it is necessary to close a
; file given ONLY the SFT. This necessitates walking all PDB's JFN
; tables looking for the SFN. The difficult part is in generating the
; SFN from the SFT. This is done by enumerating SFT's and comparing for
; the correct SFT. Finding all PDBs is easy: walk arena and check
; owner fields
;
; Inputs: ThisSFT points to SFT of interest
; Outputs: Handle is closed on user
; Registers Revised: none
;
;******************* END OF SPECIFICATIONS *************************************
Procedure CPS,NEAR
ASSUME DS:NOTHING,ES:NOTHING
SaveReg <DS,SI,ES,DI,AX,BX,CX>
lds si,ThisSFT
xor bx,bx
cps01:
CallInstall SFFromSFN,multDOS,22,bx,bx
jc cps31 ; no more SFN's. Must be FCB.
CallInstall PointComp,multDOS,20
jz cps02 ; found matching SFN, go scan.
inc bx ; did not match, go back for more
jmp cps01
;---------------------------------------
; BL is the sfn we want to find. Walk
; the memory arena enumerating all PDB's
; and zap the handle tables for the
; specified sfn.
;---------------------------------------
cps02:
mov al,bl
mov ds,Arena_Head ; get first arena pointer
;---------------------------------------
; DS:[0] is the arena header.
; AL is sfn to be closed
;---------------------------------------
cps1:
mov cx,ds:[arena_owner]
mov bx,ds
inc bx ; is the owner the same as the current
cmp cx,bx ; block?
jnz cps2 ; no, go skip some more...
;---------------------------------------
; CX:0 is the correct pointer to a PDB.
;---------------------------------------
push ds
mov ds,cx
;---------------------------------------
; Given a PDB at DS:0, scan his handle
; table and then loop through the next
; PDB link.
;---------------------------------------
cps15:
call CPJ ; free for this PDB
lds cx,DS:[PDB_Next_PDB] ; advance to next
cmp cx,-1
jnz cps15 ; there is another link to process
pop ds
;---------------------------------------
; We have processed the current
; allocation block pointed to by DS.
; DS:[0] is the allocation block
;---------------------------------------
cps2:
cmp ds:[arena_signature],arena_signature_end
jz cps3 ; no more blocks to do
mov bx,ds ; get current address
add bx,DS:[Arena_size] ; add on size of block
inc bx ; remember size of header
mov ds,bx ; link to next
jmp cps1
;---------------------------------------
; Just for good measure, use CurrentPDB
; and clean off him
;---------------------------------------
cps3:
mov ds,CurrentPDB
call CPJ
cps31:
RestoreReg <
RestoreReg <CX,BX,AX,DI,ES,SI,DS>
ret
EndProc CPS
;******************* START OF SPECIFICATIONS ***********************************
;
; CPJ -
;
; Scan JFN table for SFT # and put in -1 if found
;
; Input: DS:0 is PDB
; AL is SFT index # of interest
;
; Output: None
;
; Uses: Flags,CX,ES,DI
;
;******************* END OF SPECIFICATIONS *************************************
Procedure CPJ,NEAR
assume ds:nothing,es:nothing
mov cx,ds:[PDB_JFN_length]
les di,ds:[PDB_JFN_pointer]
cld
cpj1: repne scasb
retnz ; none found
mov byte ptr es:[di-1],-1 ; free this
jcxz CPJret ; Found one in last JFN entry
jmp cpj1 ; keep looking
CPJret:
ret
EndProc CPJ
Break <SFM - convert an mft pointer into a serial number>
;******************* START OF SPECIFICATIONS ***********************************
;
; SFM - convert a pointer to a mft entry into the serial number for that
; entry. We keep these around to see if a FCB really points to the correct
; SFT.
;
; Inputs: BX is the mft pointer
; Outputs: BX is the serial number
; Registers Revised: none
;
;******************* END OF SPECIFICATIONS *************************************
Procedure SFM,NEAR
ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSDATA
mov bx,cs:[bx].mft_serl
ret
EndProc SFM
Break <ShChk - check a fcb for share related information>
;******************* START OF SPECIFICATIONS ***********************************
;
; ShChk - check a fcb for share related information
;
; ShChk - checks the reserved field contents of an FCB with a SFT to see
; if they represent the same file. The open ref count must be > 0.
;
; Inputs: DS:SI point to FCB
; ES:DI point to SFT
; Outputs: Carry Set if contents do not match
; Carry clear if contents match
; BX has first cluster
; Registers Revised: none
;
;******************* END OF SPECIFICATIONS *************************************
Procedure ShChk,NEAR
ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSDATA
CMP ES:[DI].sf_ref_count,0
JZ BadSFT
MOV BX,ES:[DI].sf_mft ; Local file or dev with sharing
call SFM
CMP BX,[SI].fcb_l_mfs
JNZ BadSFT
MOV BX,[SI].fcb_l_firclus
ret
BadSFT: stc
ret
EndProc ShChk
Break <ShSave - save information from SFT into an FCB>
;******************* START OF SPECIFICATIONS ***********************************
;
; ShSave - save information from SFT into an FCB
;
; ShSave - copy information into the reserved area of an FCB from a SFT.
; This is so that we can later match the SFT with the FCB.
;
; Inputs: ES:DI point to SFT
; DS:SI point to FCB
; Outputs: FCB reserved field is filled in
; BL = FCBSHARE
; Registers Revised: AX,BX
;
;******************* END OF SPECIFICATIONS *************************************
Procedure ShSave,NEAR
ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSDATA
MOV AL,ES:[DI].sf_attr ; move attribute (for reopen)
MOV [SI].FCB_l_attr,AL
MOV AX,ES:[DI].sf_firclus ; get first cluster
MOV [SI].FCB_l_firclus,AX
MOV BX,ES:[DI].sf_mft ; get sharing pointer
call SFM
MOV [SI].FCB_l_mfs,BX
MOV BL,FCBSHARE
ret
EndProc ShSave
Break <ShCol - collapse identical handle SFTs in mode 70 only>
;******************* START OF SPECIFICATIONS ***********************************
;
; ShCol - collapse identical handle SFTs in mode 70 only
;
; ShCol - collapse same 70-mode handles together. This represents network
; originated FCBs. Since FCB's are incredibly mis-behaved, we collapse the
; SFT's for identical files, thus using a single sft for each file instead
; of a separate sft for each instance of the file.
;
; Note that the redirectors will collapse multiple instances of these
; files together. FCB's are pretty misbehaved, so the redirector will
; inform us of EACH close done on an FCB. Therefore, we must increment
; the ref count each time we see a collapse here.
;
; Inputs: DS:SI ThisSFT has new sft to find.
; Outputs: Carry set - no matching SFT was found
; Carry clear - matching SFT was found and all collapsing done.
; AX has proper handle
; Registers Revised: all.
;
;******************* END OF SPECIFICATIONS *************************************
Procedure ShCol,NEAR
ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSDATA
;---------------------------------------
; Collapse the files ONLY if
; the mode is for net FCB's
;---------------------------------------
MOV AL,BYTE PTR [SI].sf_mode
AND AL,sharing_mask
CMP AL,sharing_net_FCB
JNZ UseJFN
;---------------------------------------
; In share support
;---------------------------------------
XOR BX,BX ; for (i=0; sffromsfn(i); i++) {
OpenScan:
CallInstall SFFromSFN,multDOS,22,bx,bx
JC UseJFN
CallInstall PointComp,multDOS,20 ; if (!pointcomp (s,d))
JZ OpenNext
CMP ES:[DI].sf_ref_count,0
JZ OpenNext
MOV AX,ES:[DI].sf_mode
CMP AX,[SI].sf_mode
JNZ OpenNext
MOV AX,ES:[DI].sf_mft
CMP AX,[SI].sf_mft
JNZ OpenNext
MOV AX,WORD PTR ES:[DI].sf_UID
CMP AX,WORD PTR [SI].sf_uid
JNZ OpenNext
MOV AX,WORD PTR ES:[DI].sf_pid
CMP AX,WORD PTR [SI].sf_pid
JZ OpenFound
OpenNext:
INC BX
JMP OpenScan
;--------------------------------------
; DS:SI points to an sft which is a
; duplicate of that found in
; ES:DI is the older one.
;
; We call mftclose to release the
; appropriate info.
;--------------------------------------
OpenFound:
MOV [SI].sf_ref_count,0 ; free 'new' sft
SaveReg <DS,SI,ES,DI,BX>
Context DS
LES DI,ThisSFT
call MFTClose
RestoreReg <AX,DI,ES,SI,DS>
ASSUME DS:NOTHING
INC ES:[DI].sf_ref_count ; d->refcount++;
XOR BX,BX ; find jfn with sfn as contents
JFNScan:
CallInstall pJFNFromHandle,multDOS,32,AX,AX
JC UseJFN ; ran out of handles?
CMP AL,BYTE PTR ES:[DI] ; does JFN have SFN?
jz JFNfound ; YES, go return JFN
INC BX ; no, look at next
JMP JFNScan
JFNFound:
LDS SI,pJFN
MOV BYTE PTR [SI],0FFh ; free JFN
MOV AX,BX ; return JFN
ret
UseJFN:
MOV AX,JFN
ret
EndProc ShCol
Break <ShCloseFile - close a particular file for a particular UID/PID>
;******************* START OF SPECIFICATIONS ***********************************
;
; ShCloseFile - close a particular file for a particular UID/PID
;
; ShCloseFile - Compatability mode programs will often delete files that
; they had open. This was perfectly valid in the 2.0 days, but this
; presents a reliability problem in the network based operating environment.
; As a result, both RENAME and DELETE will call us to see if the file is
; open by is only. If it is not open or is open by us only, we close it.
; Note that we will ONLY close compatability SFTs.
; Otherwise, we signal and error.
;
; Inputs: WFT_Start has a DOSDATA offset to the file name
; DS is DOSData
; Outputs: nothing relevant.
; Registers Revised: None.
;
;******************* END OF SPECIFICATIONS *************************************
Procedure ShCloseFile,NEAR
ASSUME DS:DOSDATA,ES:NOTHING,SS:DOSDATA
SaveReg <AX,BX,CX,DX,SI,DI,BP,DS,ES>
EnterCrit critShare
ShCl:
MOV SI,WFP_Start
XOR AL,AL
call FNM ; attempt to find name in list
ASSUME DS:NOTHING
JC ShCloseDone ; can't find, signal success
;--------------------------------------
; We have found a file in the MFT.
; Walk the open sft list to find
; the SFTs for the current UID/PID.
;--------------------------------------
MOV CX,DS
LDS SI,[BX].mft_sptr
ShClCheck:
MOV AX,Proc_ID
CMP [SI].sf_PID,AX
JNZ ShCloseDone
MOV AX,User_ID
CMP [SI].sf_UID,AX
JNZ ShCloseDone
MOV AX,[SI].sf_mode
AND AX,sharing_mask
CMP AX,sharing_net_fcb
jz ShClNext
CMP AX,sharing_compat
jnz ShCloseDOne
ShClNext:
LDS SI,[SI].sf_chain
OR SI,SI
JNZ ShClCheck
MOV DS,CX
LDS SI,[BX].mft_sptr
;--------------------------------------
; Everything matches. Set up ThisSFT
; and walk the chain from the beginning.
;--------------------------------------
MOV WORD PTR ThisSFT,SI
MOV WORD PTR ThisSFT+2,DS
;--------------------------------------
; Close all handles for this SFT
;--------------------------------------
call CPS
;--------------------------------------
; Close the sft itself.
;--------------------------------------
Context DS
CallInstall DOS_Close,multDos,1
;--------------------------------------
; The SFT may be free and we have no
; idea where the next is. Go and loop
; all over.
;--------------------------------------
JMP ShCl
;--------------------------------------
; There are no more SFTs to close. Leave
;---------------------------------------
ShCloseDone:
LeaveCrit critShare
STC
RestoreReg <ES,DS,BP,DI,SI,DX,CX,BX,AX>
ret
EndProc ShCloseFile
.xall
Break <ShSU - update all SFTs for a specified change>
;******************* START OF SPECIFICATIONS ***********************************
;
; NAME: ShSU - update all SFTs for a specified change>
;
; FUNCTION: In a shared environment, we want to propogate the SFT
; changes for a particular file to all other SFTs for that
; file. The types of things we propogate are:
;
; - Time of last write - we only do this on CLOSE and on
; FILETIMES.
;
; - Size and allocation information - we do this ONLY when
; we change sf_size.
;
; We achieve this by walking the linked list of SFTs for the
; file. See PSEUDOCODE below
;
; INPUT: ES.DI has SFT that was just Revised.
; AX = 0 for updating of time from ES:DI into old sfts
; AX = 1 for updating of size/allocation for growth from ES:DI
; AX = 2 for updating of size/allocation for shrink from ES:DI
; AX = 3 for new instance copy into ES:DI
; AX = 4 for update of codepage and high attribute
;
; OUTPUT: All relevant SFTs are updated.
;
; REGISTERS USED: All except ES:DI and DS:SI
; (NOT RESTORED)
;
; LINKAGE: DOS Jump Table
;
; EXTERNAL Invoke: New_Sft, Call_IFS
; REFERENCES: Callinstall
;
; NORMAL -
; EXIT:
;
; ERROR -
; EXIT:
;
; CHANGE 04/15/87 - Major overhaul and IFS support
; LOG:
;
;******************* END OF SPECIFICATIONS *************************************
;******************+ START OF PSEUDOCODE +**************************************
;
; START ShSU
;
; if not a device and
; if not a network
; search
; if our SFT
; advance to next SFT
; endif
; leave if no more SFT's
; exitif cx = 3
; invoke New_Sft
; orelse
; if cx = 0
; update time
; update date
; if non - FAT file system
; call IFSFUNC
; endif
; else cx = 1 or 2
; update size
; if non - FAT file system
; call IFSFUNC
; else
; update first cluster
; if cx = 2 or
; if lstclus un-set from create
; update cluster position
; update last cluster
; endif
; endif
; endif
; advance to next SFT
; endloop
; endsearch
; endif
; return
;
; END ShSU
;
;******************+ END OF PSEUDOCODE +**************************************
Procedure ShSU,near
ASSUME DS:NOTHING,ES:NOTHING
nop
; int 3
nop
ifs_flag equ 8000h ; ;AN000;
;---------------------------------------
; Do nothing for device or network
;---------------------------------------
mov bx,es:[di].sf_flags ; M004: must check sf_flags field
;; mov bx,es:[di].sf_mode ; M004: sf_mode
and bx,sf_isnet + devid_device
; $if z,and,long ; if not device and ;AC000;
JZ $$XL1
JMP $$IF4
$$XL1:
mov bx,es:[di].sf_MFT
or bx,bx
; $if nz,,long ; if not network ;AC000;
JNZ $$XL2
JMP $$IF4
$$XL2:
EnterCrit critShare
;---------------------------------------
; Walk the sft chain for this file and
; skip the current SFT (ES:DI)
;---------------------------------------
SaveReg <DS,SI>
lds si,cs:[bx].MFT_SPTR
mov cx,ax
; $search ; ;AC000;
$$DO5:
CallInstall PointComp,multDOS,20 ; pointers different?
; $if z ; if ourselves ;AC000;
JNZ $$IF6
lds si,[si].sf_chain ; move to next ;AC000;
; $endif ; endif - ourselves ;AC000;
$$IF6:
or si,si
; $leave z ; ;AC000;
JZ $$EN5
;---------------------------------------
; CX = 0 for updating of time
; CX = 1 for updating of size/allocation
; for growth
; CX = 2 for updating of size/allocation
; for shrink
; CX = 3 for new instance copy.
;---------------------------------------
cmp cx,2 ; ;AC000;
; $exitif a ; ;AC000;
JNA $$IF5
;---------------------------------------
; CX = 3 for new instance copy.
; CX = 4 for codepage and high attrib update
;---------------------------------------
cmp cx,3 ; cx = 3 ? ;an000;
; $if e ; yes ;an000;
JNE $$IF10
call New_Sft ; ;AN000;
;; $else ; cx = 4 ;an000;
;; call New_CP_Attrib ; update codepage and high attrib ;an000;
; $endif ; ;an000;
$$IF10:
; $orelse ; ;AC000;
JMP SHORT $$SR5
$$IF5:
or cx,cx
; $if z ; if cx = 0 then ;AC000;
JNZ $$IF13
;---------------------------------------
; CX = 0 for updating of time
;
; Copy time from ES:DI into DS:SI
;---------------------------------------
mov bx,es:[di].sf_time
mov [si].sf_time,bx
mov bx,es:[di].sf_date
mov [si].sf_date,bx
test [si].sf_flags,ifs_flag ; ;AN000;
; $if nz ; if non-FAT ;AC003;
JZ $$IF14
call Call_IFS ; tell IFS of SFT change ;AN000;
; $endif ; endif non- FAT ;AN000;
$$IF14:
; $else ; else - must be >0 and <2 ;AC000;
JMP SHORT $$EN13
$$IF13:
;---------------------------------------
; CX = 1 for updating of size/allocation
; for growth
; CX = 2 for updating of size/allocation
; for shrink
;
; We always copy size and firclus
;---------------------------------------
mov bx,word ptr es:[di].sf_size
mov word ptr [si].sf_size,bx
mov bx,word ptr es:[di].sf_size+2
mov word ptr [si].sf_size+2,bx
test [si].sf_flags,ifs_flag ; ;AN000;
; $if nz ; if non-FAT ;AC003;
JZ $$IF17
invoke Call_IFS ; tell IFS of SFT change ;AN000;
; $else ; else - its FAT ;AN000;
JMP SHORT $$EN17
$$IF17:
mov bx,es:[di].sf_firclus
mov [si].sf_firclus,bx
cmp cx,2 ; ;AC000;
; $if z,or ; if SFT is shrinking or ;AC000;
JZ $$LL19
cmp [si].sf_lstclus,0 ; lstclus UN-set from a create? ;AC000;
; $if z ; If it is, set lstclus and cluspos too;AC000;
JNZ $$IF19
$$LL19:
;---------------------------------------
; Shrink the file, move in new cluspos
; and lstclus
;---------------------------------------
mov [si].sf_cluspos,0 ; retrace from start
mov [si].sf_lstclus,bx ; ditto
; $endif ; endif - set lstclus and cluspos ;AC000;
$$IF19:
; $endif ; endif FAT ;AN000;
$$EN17:
; $endif ; enndif - > 0 ;AC000;
$$EN13:
;---------------------------------------
; Link to next SFT
;---------------------------------------
lds si,[si].sf_chain
; $endloop ; ;AC000;
JMP SHORT $$DO5
$$EN5:
; $endsrch ; ;AC000;
$$SR5:
;---------------------------------------
; All Done
;---------------------------------------
RestoreReg <SI,DS>
LeaveCrit critShare
; $endif ; endif - device and network ;AC000;
$$IF4:
ret
EndProc ShSU
Break <New_Sft - update a new SFT>
;******************* START OF SPECIFICATIONS ***********************************
;
; NAME: New_Sft - update a new SFT
;
; FUNCTION: Copy all SFT information into a NEW sft of a SHARED file.
;
;
; INPUT: ES.DI has SFT that was just Revised.
; DS:SI has SFT that is to be updated
;
; OUTPUT: SFT is updated.
;
; REGISTERS USED: AX, BX
; (NOT RESTORED)
;
; LINKAGE: Invoked by: ShSU
;
; EXTERNAL Invoke: Call_IFS
; REFERENCES:
;
; CHANGE 04/15/87 - First release
; LOG:
;
;******************* END OF SPECIFICATIONS *************************************
;******************+ START OF PSEUDOCODE +**************************************
;
; START New_Sft
;
; update time
; update date
; update size
; if non - FAT file system
; call IFSFUNC
; else
; update first cluster
; update cluster position
; update last cluster
; endif
; return
;
; END New_Sft
;
;******************+ END OF PSEUDOCODE +**************************************
Procedure New_Sft,near ; ;AN000;
mov bx,[si].sf_time ; update time
mov es:[di].sf_time,bx
mov bx,[si].sf_date ; update date
mov es:[di].sf_date,bx
mov bx,word ptr [si].sf_size ; update size
mov word ptr es:[di].sf_size,bx
mov bx,word ptr [si].sf_size+2
mov word ptr es:[di].sf_size+2,bx
test es:[di].sf_flags,ifs_flag ; ;AN000;
; $if nz ; if non-FAT ;AC003;
JZ $$IF26
call Call_IFS ; tell IFS of SFT change ;AN000;
; $else ; else - its FAT ;AN000;
JMP SHORT $$EN26
$$IF26:
mov bx,[si].sf_firclus ; update first cluster
mov es:[di].sf_firclus,bx
mov es:[di].sf_cluspos,0 ; retrace from start
mov es:[di].sf_lstclus,bx ; ditto
; $endif ; endif FAT ;AN000;
$$EN26:
ret ; we'er done ;AN000;
EndProc New_Sft ; ;AN000;
Break <New_CP_Attrib - update the codepage and attrib in SFT>
;******************* START OF SPECIFICATIONS ***********************************
;
; NAME: New_CP_Attrib - Update codepage and attrib in SFT
;
; FUNCTION: Copy all codepage and attrib into SFT of a SHARED file.
;
;
; INPUT: ES.DI has SFT that was just Revised.
; DS:SI has SFT that is to be updated
;
; OUTPUT: SFT is updated.
;
; REGISTERS USED: AX, BX
; (NOT RESTORED)
;
; LINKAGE: Invoked by: ShSU
;
; EXTERNAL Invoke: Call_IFS
; REFERENCES:
;
; CHANGE 10/06/87 - First release - D. M. Sewell
; LOG:
;
;******************* END OF SPECIFICATIONS *************************************
;******************+ START OF PSEUDOCODE +**************************************
;
; START New_CP_Attrib
;
; Update codepage
; Update high attribute
; $if ifs_flag
; call Call_IFS
; $endif
; return
;
; END New_CP_Attrib
;
;******************+ END OF PSEUDOCODE +**************************************
;; Procedure New_CP_Attrib,near ; ;AN000;
;; mov bx,es:[di].SF_Codepage ; update codepage ;an000;
;; mov [si].SF_Codepage,bx ;an000; dms;
;; mov bl,es:[di].SF_Attr_Hi ; update high attribute ;an000;
;; mov [si].SF_Attr,bl ;an000; dms;
;; test es:[di].sf_flags,ifs_flag ; ;AN000;
;; $if nz ; if non-FAT ;AC003;
;; call Call_IFS ; tell IFS of SFT change ;AN000;
;; $endif ; endif FAT ;AN000;
;; ret ; we'er done ;AN000;
;; EndProc New_CP_Attrib ; ;AN000;
Break <Call_IFS - warn IFS that SFT has changed>
;******************* START OF SPECIFICATIONS ***********************************
;
; NAME: Call_IFS - warn IFS that SFT has changed
;
; FUNCTION: Call IFS thru 2F interupt.
;
; INPUT: DS.SI points to SFT that was just Revised.
;
; OUTPUT: none
;
; REGISTERS USED: AX
; (NOT RESTORED)
;
; LINKAGE: Invoked by: ShSU, New_SFT
;
; EXTERNAL Callinstall
; REFERENCES:
;
; CHANGE 04/15/87 - First release
; LOG:
;
;******************* END OF SPECIFICATIONS *************************************
;******************+ START OF PSEUDOCODE +**************************************
;
; START Call_IFS
;
; set up for INT
; INT 2F
; return
;
; END Call_IFS
;
;******************+ END OF PSEUDOCODE +**************************************
Procedure Call_IFS,near ; ;AN000;
CallInstall BlockUpdate,MultIFS,44,CX,CX ; ;AC005;
ret ; ;AN000;
EndProc Call_IFS ; ;AN000;
Break <Internal error routines>
;******************* START OF SPECIFICATIONS ***********************************
;
; INTERR - INTernal ERRor routines
;
;******************* END OF SPECIFICATIONS *************************************
Procedure INTERR,NEAR
ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING
SaveReg <BX,SI,DS> ; save registers that get clobbered
push cs ; gain addressability
pop ds
mov si,ax ; get message to print
call gout
off si,IntErrMsg
call gout
RestoreReg <ds,si,bx>
INTERRL:jmp INTERRL ; hang here - we're sick
gout: lodsb
or al,al
retz
mov ah,14
int 10h
jmp gout
EndProc INTERR
Break <INT 2F handler>
IF installed
Cont dd ?
INT2F PROC FAR
ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:NOTHING
cmp ah,multSHARE
jnz ContJ
;
; 00h its anyone else - return 0FFh - loaded
;
or al,al ;
jnz ContJ ;not our function, pass it on
loaded:
mov al,0ffh ;indicate that Share is loaded
iret
ContJ:
jmp Cont ;chain on to next handler
INT2F ENDP
ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:DOSData
IRP rtn,<MFT_enter, MFTClose, MFTclU, MFTCloseP, MFTCloN, set_mult_block, clr_mult_block>
J&rtn proc far
call rtn
ret
j&rtn endp
endm
IRP rtn,<chk_block, MFT_get, ShSave, ShChk, ShCol, ShCloseFile, ShSU>
J&rtn proc far
call rtn
ret
j&rtn endp
endm
IRP sect,<critShare>
Procedure E§,NEAR
PUSH AX
MOV AX,8000h+sect
INT int_ibm
POP AX
ret
EndProc E§
Procedure L§,NEAR
PUSH AX
MOV AX,8100h+sect
INT int_ibm
POP AX
ret
EndProc L§
ENDM
ENDIF
;SR;
; The internal error messages are being included here. These have all been
;moved into a single file so that it is easy to internationalize the messages
;
include shmsg.inc
BREAK <MFT and Lock Record Data Area>
;******************* START OF SPECIFICATIONS ***********************************
;
; first MFT record
;
; Note that the name field can have garbage after the trailing
; 00 byte. This is because the field might be too long, but
; not long enough (at least 16 extra bytes) to fragment.
; in this case we copy the length of the string area, not
; the length of the string and thus may copy tailing garbage.
;
;******************* END OF SPECIFICATIONS *************************************
PoolSize = 2048
PUBLIC MFT
MFT DB 0 ; free
DW PoolSize ; PoolSize bytes long
IF not Installed
DB (PoolSize-3) DUP(0) ; leave rest of record
MEND DB -1 ; END record
lck1 DW 0 ; link
DB SIZE RLR_entry-2 DUP(0)
lck2 DW OFFSET DOSDATA:lck1 ; link
DB SIZE RLR_entry-2 DUP(0)
lck3 DW OFFSET DOSDATA:lck2 ; link
DB SIZE RLR_entry-2 DUP(0)
lck4 DW OFFSET DOSData:lck3 ; link
DB SIZE RLR_entry-2 DUP(0)
lck5 DW OFFSET DOSDATA:lck4 ; link
DB SIZE RLR_entry-2 DUP(0)
lck6 DW OFFSET DOSDATA:lck5 ; link
DB SIZE RLR_entry-2 DUP(0)
lck7 DW OFFSET DOSDATA:lck6 ; link
DB SIZE RLR_entry-2 DUP(0)
lck8 DW OFFSET DOSDATA:lck7 ; link
DB SIZE RLR_entry-2 DUP(0)
CODE ENDS
%out Ignore this END error (blasted assembler)
ENDIF
IF Installed
ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:NOTHING
IF1
InitSpace DW PoolSize
ELSE
IF shareinit-MFT LT PoolSize
InitSpace DW PoolSize
ELSE
InitSpace DW shareinit-MFT
ENDIF
ENDIF
InitLocks DW 20
JTable LABEL BYTE
DD ?
DD JMFT_Enter ; 1 MFT_enter
DD JMFTClose ; 2 MFTClose
DD JMFTclU ; 3 MFTclU
DD JMFTcloseP ; 4 MFTCloseP
DD JMFTcloN ; 5 MFTCloN
DD JSet_Mult_Block ; 6 Set_Mult_Block
DD JClr_Mult_Block ; 7 Clr_Mult_Block
DD JChk_Block ; 8 Chk_Block
DD JMFT_Get ; 9 MFT_get
DD JShSave ; 10 ShSave
DD JShChk ; 11 ShChk
DD JShCol ; 12 ShCol
DD JShCloseFile ; 13 ShCloseFile
DD JShSU ; 14 ShSU
JTableLen = $ - JTable
; $SALUT (4,9,17,36)
;---------------------------------------
; STRUCTURE TO DEFINE ADDITIONAL
; COMMAND LINE PARAMETERS
;---------------------------------------
PARMS LABEL DWORD
DW OFFSET PARMSX ; POINTER TO PARMS STRUCTURE
DB 0 ; NO DELIMITER LIST FOLLOWS
DB 0 ; NUMBER OF ADDITIONAL DELIMITERS
;---------------------------------------
; STRUCTURE TO DEFINE SORT
; SYNTAX REQUIREMENTS
;---------------------------------------
PARMSX LABEL BYTE
DB 0,0 ; THERE ARE NO POSITIONAL PARAMETERS
DB 2 ; THERE ARE TWO TYPES OF SWITCH
DW OFFSET SW ; POINTER TO THE SWITCH DEFINITION AREA
DW OFFSET SW_OPT ; POINTER TO THE SWITCH DEFINITION AREA
DW 0 ; THERE ARE NO KEYWORDS IN SHARE SYNTAX
;---------------------------------------
; STRUCTURE TO DEFINE THE SWITCHES
;---------------------------------------
SW LABEL WORD
DW 08001H ; MUST BE NUMERIC
DW 0 ; NO FUNCTION FLAGS
DW OFFSET SWITCH_BUFF ; PLACE RESULT IN SWITCH BUFFER
DW OFFSET VALUES ; NEED VALUE LIST
DB 3 ; TWO SWITCHES IN FOLLOWING LIST
F_SW DB "/F",0 ; /F: INDICATES n FILESPACE REQUESTED
L_SW DB "/L",0 ; /L: INDICATES m LOCKS REQUESTED
N_SW DB "/NC",0 ; /NC: INDICATES no checking required
PUBLIC SW_OPT, ?_SW
SW_OPT LABEL WORD
DW 0 ; MATCH MASK
DW 0 ; FUNCTION MASK
DW OFFSET SWITCH_BUFF ; PLACE RESULT IN SWITCH BUFFER
DW OFFSET VALUES ; NEED VALUE LIST
DB 1 ; 1 SWITCH IN FOLLOWING LIST
?_SW DB "/?",0 ; /? INDICATES give options help
;---------------------------------------
; VALUE LIST DEFINITION FOR n
;---------------------------------------
VALUES LABEL BYTE
DB 1 ; ONE VALUE ALLOWED
DB 1 ; ONLY ONE RANGE
DB FILE_SWITCH ; IDENTIFY IT AS n
DD 1,65535 ; USER CAN SPECIFY /+1 THROUGH /+65535
;---------------------------------------
; RETURN BUFFER FOR SWITCH INFORMATION
;---------------------------------------
; $SALUT (4,17,27,36)
SWITCH_BUFF LABEL BYTE
SW_TYPE DB ? ; TYPE RETURNED
SW_ITEM_TAG DB ? ; SPACE FOR ITEM TAG
SW_SYN DW ? ; POINTER TO SWITCH LIST ENTRY
SW_VALUE DD ? ; SPACE FOR VALUE
Exit_Msg db 0 ;flag set if no exit on ShDispMsg ;M006
Fswitch db 0 ;flag set if /F given ;M006
Lswitch db 0 ;flag set if /L given ;M006
; $SALUT (4,4,9,41)
Break <INIT - INITalization routines>
;******************* START OF SPECIFICATIONS ***********************************
;
; INIT - INITalization routines
;
;******************* END OF SPECIFICATIONS *************************************
Procedure Init,NEAR
PUSH CS
POP DS
ASSUME DS:SHARE
MOV BX,InitSpace
SUB BX,3
MOV SI,OFFSET MFT
MOV WORD PTR [SI+1],BX ; length of first item
ADD SI,BX ; link to end of structure
MOV BYTE PTR [SI],-1 ; signal end
INC SI ; point to next free byte
MOV CX,initlocks ; count for loop
MOV AX,0
; $do ; ;AC000;
$$DO48:
MOV [SI].RLR_next,AX ; link in previous
MOV AX,SI ; this is now previous
ADD SI,SIZE RLR_Entry ; move to next object
; $enddo loop ; ;AC000;
LOOP $$DO48
MOV FreLock,AX ; point to beginning of free list
MOV DX,CS
MOV BX,ES
SUB DX,BX
ADD SI,15
RCR SI,1
SHR SI,1
SHR SI,1
SHR SI,1
ADD SI,DX
PUSH SI ; # of paras for share on stack
MOV AX,(Get_Interrupt_Vector SHL 8) + 2Fh
INT 21h
MOV WORD PTR CONT,BX
MOV WORD PTR CONT+2,ES
MOV AX,(Set_Interrupt_Vector SHL 8) + 2Fh
MOV DX,OFFSET INT2F
INT 21h
;---------------------------------------
; Notify the DOS that we are around so that
; the DOS can make expensive calls to us.
;---------------------------------------
MOV AH,Get_In_Vars
INT 21h
ASSUME ES:DOSDATA
MOV fShare,-1 ; tell DOS we are here ;AC011;
;---------------------------------------
; Cram in the new jump table
;---------------------------------------
CLI
MOV SI,OFFSET JTable
MOV DI,OFFSET JShare
MOV CX,JTableLen/2
REP MOVSW
;---------------------------------------
; Examine the size of the FCB cache.
; If it is NOT the system default of 4,0
; change it (via reallocation) to 16,8.
; The old table is lost.
;---------------------------------------
ASSUME DS:NOTHING
CMP KeepCount,0
; $if z,and ; if the ",0" part and ;AC000;
JNZ $$IF52
LDS SI,ES:[BX].SYSI_FCB ; point to the existing cache
CMP [SI].sfCount,4
; $if z ; if the "4," part then ;AC000;
JNZ $$IF52
;---------------------------------------
; Whammo, we need to allocate 16 * size
; of SF_entry + size of sfTable.
; Compute this size in paragraphs
;---------------------------------------
MOV AX,16
MOV CX,size sf_entry
MUL CX
ADD AX,(size sf) - 2
;---------------------------------------
; This size is in bytes...
; Round up to paragraph size
;---------------------------------------
ADD AX,0Fh
RCR AX,1
SHR AX,1
SHR AX,1
SHR AX,1
;---------------------------------------
; AX is the number of paragraphs to add.
; Word on stack is current TNR size.
; Make dos point to new table
;---------------------------------------
MOV WORD PTR ES:[BX].SYSI_FCB,0
MOV WORD PTR ES:[BX].SYSI_FCB+2,SS
POP SI
ADD WORD PTR ES:[BX].SYSI_FCB+2,SI
;---------------------------------------
; Initialize table parts, next link
; and size
;---------------------------------------
MOV DS,WORD PTR ES:[BX].SYSI_FCB+2
MOV WORD PTR DS:[sfLink],-1
MOV WORD PTR DS:[sfLink+2],-1
MOV DS:[sfcount],16
;---------------------------------------
; Set up succeeding LRU size
;---------------------------------------
MOV KeepCount,8
ADD SI,AX
PUSH SI
; $endif ; endif - "4,0" ;AC000;
$$IF52:
;---------------------------------------
; Clean out the FCB Cache
;---------------------------------------
LES DI,ES:[BX].SYSI_FCB
ASSUME ES:Nothing
MOV CX,ES:[DI].SFCount
LEA DI,[DI].SFTable
; $do ; ;AC000;
$$DO54:
MOV ES:[DI].sf_ref_count,0
MOV WORD PTR ES:[DI].sf_position,0
MOV WORD PTR ES:[DI].sf_position+2,0
ADD DI,SIZE sf_entry
; $enddo loop ; ;AC000;
LOOP $$DO54
STI
ASSUME ES:NOTHING
XOR BX,BX
MOV CX,5 ; StdIN,StdOUT,StdERR,StdAUX,StdPRN
; $do ; Close STD handles before ;AC000;
$$DO56:
; keep process
MOV AH,CLOSE
INT 21H
INC BX
; $enddo loop ; ;AC000;
LOOP $$DO56
POP DX ; T+R size in DX
MOV AX,(Keep_Process SHL 8) + 0
INT 21h
MOV AX,(EXIT SHL 8) + 1
INT 21h ; We'er now resident, return to DOS
EndProc Init
Break <SHAREINIT - Share initialization entry point>
;******************* START OF SPECIFICATIONS ***********************************
;
; SHAREINIT - Share initialization entry point
;
;******************* END OF SPECIFICATIONS *************************************
Procedure SHAREINIT,NEAR
ASSUME CS:SHARE,DS:NOTHING,ES:NOTHING,SS:STACK
; int 3
nop
nop
PUSH DS ; save PSP segment for later stack ;AC001;
; relocation
;---------------------------------------
; Load Messages
;---------------------------------------
call ShLoadMsg ; ;AN000;
;---------------------------------------
; At this point, the DOS version is OK.
; (checked by SYSLOADMSG)
; Now - Check the DOS data version
;---------------------------------------
; $if c,or ; if not same as us ;AC009;
JC $$LL58
MOV AH,Get_In_Vars
INT 21h
ASSUME ES:DOSDATA
CMP DataVersion,ShareDataVersion
ASSUME ES:NOTHING
; $if ne ; if not same as us ;AC000;
JE $$IF58
$$LL58:
mov ax,(Utility_Msg_CLASS shl 8) + Bad_DOS_Ver ; ;AN000;
call ShDispMsg ; ;AN000;
; $endif ; endif - not same as us ;AC000;
$$IF58:
;---------------------------------------
; Deallocate memory if possible
;---------------------------------------
mov ax,ds:[pdb_environ]
or ax,ax
; $if nz ; if > 0 deallocate memory ;AC000;
JZ $$IF60
mov es,ax
mov ah,dealloc
int 21h
; $endif ; endif - > 0 deallocate memory ;AC000;
$$IF60:
;---------------------------------------
; Parse the command line
;---------------------------------------
call ShComndParse ; ;AN000;
;---------------------------------------
; Check to see if share already installed.
;---------------------------------------
mov ah,multShare ; ;AC010;
xor al,al
INT 2Fh ; ;AC010;
CMP AL,0FFh ; ;AC010;
JNZ $$IF62
;Share is already loaded
mov ax,(UTILITY_MSG_CLASS shl 8) + Sh_Already_Loaded ; ;AC010;
call ShDispMsg ; ;AC010;
$$IF62:
;
;M007; Begin changes
; Check to see if we are under the Dosshell. If so, we issue an error
;message and exit
;
mov ax,4b02h ; see if switcher enabled
xor bx,bx
push es
mov es,bx
mov di,bx ; es:di <- 0 on entry
int 2fh
mov ax,es
pop es
or ax,di ; es:di == 0 =>no switcher
jz Sh_noshell ;switcher not present, continue
mov ax,(UTILITY_MSG_CLASS shl 8) + SH_DOSSHELL ;switcher present
call ShDispMsg ;display error message & terminate
Sh_noshell:
;---------------------------------------
; All set to initialize the world.
; Make sure that we have enough memory
; for everything in our little 64K here.
; First get avail count of paras.
;---------------------------------------
pop es ; recover PSP segment ;AC002;
push es ; ;AC002;
MOV BX,CS
MOV AX,ES:[PDB_Block_Len]
SUB AX,BX
;---------------------------------------
; AX has the number of paragraphs
; available to us after the beginning
; of CS. Max this out at 64K.
;---------------------------------------
CMP AX,1000h
; $if a ; if more than we can handle ;AC000;
JNA $$IF66
MOV AX,1000h ; force it
; $endif ; endif - more than we can handle ;AC000;
$$IF66:
;---------------------------------------
; Take AX paragraphs and convert them
; into BX:CX bytes.
;---------------------------------------
XOR BX,BX
SHL AX,1
SHL AX,1
SHL AX,1
SHL AX,1
ADC BX,0
MOV CX,AX
;---------------------------------------
; compute in DX:AX, the size
; requested by the user
;---------------------------------------
MOV AX,initlocks
MOV SI,size RLR_Entry
MUL SI
ADD AX,OFFSET MFT
ADC DX,0
ADD AX,InitSpace
ADC DX,0
;---------------------------------------
; Compare the 32 bit sizes DX:AX and BX:CX.
; If BX:CX is smaller, then we
; are out of memory.
;---------------------------------------
CMP DX,BX ; try upper half first
; $if a,or ; if most significant is bigger or ;AC000;
JA $$LL68
; $if e,and ; if equal and ;AC000;
JNE $$IF68
CMP AX,CX ;
; $if a ; if least significant is bigger ;AC000;
JNA $$IF68
$$LL68:
mov ax,(EXT_ERR_CLASS shl 8) + No_Mem_Error ; issue error message ;AN000;
call ShDispMsg ; ;AN000;
; $endif ; endif - bigger ;AC000;
$$IF68:
;SR;
; Display the installed message here
;
mov ax,(UTILITY_MSG_CLASS shl 8) + SH_LOADED
mov Exit_Msg,1 ;do not exit after message ;M006
call ShDispMsg ;will return for this call
mov Exit_Msg,0 ;reset exit flag ;M006
;--------------------------------------
; Move stack to PSP area. Otherwise we
; will run into problems with growing
; the stack into the lock records.
;---------------------------------------
POP AX ; this is the entry value for DS (PSP) ;AC001;
MOV SS,AX ; ;AC001;
MOV SP,100h ; ;AC001;
ASSUME SS:NOTHING
;---------------------------------------
; Continue with rest of initialization
;---------------------------------------
JMP INIT
EndProc SHAREINIT
Break <ShLoadMsg - Share Load Message>
;******************* START OF SPECIFICATIONS ***********************************
;
; NAME: ShLoadMsg - Share Load Message
;
; FUNCTION: Load the Share messages into the message buffer.
;
; INPUT: None
;
; OUTPUT: Messages loaded into the message buffer and Message
; Sevices code initalized
;
; REGISTERS USED: DI AX CX DX
; (NOT RESTORED)
;
; LINKAGE: Call near
;
; NORMAL CF = O
; EXIT:
;
; ERROR CF = 1
; EXIT:
;
; CHANGE 04/15/87 - First release
; LOG:
;
;******************* END OF SPECIFICATIONS *************************************
;---------------------------------------
; Message Equates
;---------------------------------------
; $SALUT (4,27,34,41)
Bad_DOS_Ver equ 1 ; Incorrect DOS version ;AN000;
Sh_Already_Loaded equ 2 ; SHARE already loaded message number ;AN000;
No_Mem_Error equ 8 ; insufficient memory message number ;AN000;
;SR;
; Share installed messafe
SH_LOADED equ 9 ; Share loaded message
SH_DOSSHELL equ 3 ; Share cannot load under dosshell
; $SALUT (4,4,9,41)
Procedure ShLoadMsg,near ; ;AN000;
;---------------------------------------
; Load the Messages
;---------------------------------------
EXTRN SYSLOADMSG:NEAR ; ;AN000;
call SYSLOADMSG ; ;AN000;
; $IF C ; if we have a MAJOR problem ;AN000;
JNC $$IF70
mov ah,dh ; save the class
call ShDispMsg ; ;AN000;
; For pre DOS 2.0, we may come back
xor ax,ax ; here - so do it the old way
push ss ; just in case
push ax ;
xxx proc far ; ;AN000;
ret ; ;AN000;
xxx endp ; ;AN000;
; $ENDIF ; endif - we have a MAJOR problem ;AN000;
$$IF70:
ret ; ;AN000;
EndProc ShLoadMsg ;
Break <ShDispMsg - Share Display Message>
;******************* START OF SPECIFICATIONS ***********************************
;
; NAME: ShDispMsg - Share Display Message
;
; FUNCTION: Display the messages for share
;
; INPUT: AX = message number - AH - Class
; AL - Number
;
; OUTPUT: - Messages output to Output Device
; - Exit to DOS
;
; REGISTERS USED: CX DX
; (NOT RESTORED)
;
; LINKAGE: Call near
;
; NORMAL CF = O
; EXIT:
;
; ERROR CF = 1
; EXIT: CX = 0 - INCORRECT DOS VERSION
;
; CHANGE 04/15/87 - First release
; LOG:
;
;******************* END OF SPECIFICATIONS *************************************
; $SALUT (4,27,34,41)
; The following structure is a
; SYSMSG SUBLIST control block.
; It is initalized for the "already
; installed " message. The parse
; routine will set it up to work
; for parseing.
SUBLIST LABEL WORD
db sub_size ; size of sublist
db 0 ; reserved
msg_offset dw offset SHARE_Name ; insert 'SHARE'
msg_segment LABEL WORD
IF NOT INSTALLED
dw CODE
ELSE
dw SHARE
ENDIF
num_ins db 1 ; only one insert
db Char_Field_ASCIIZ ; data type flag - ascii z string
max_ins db SHARE_Name_Size ; maximum field size
min_ins db SHARE_Name_Size ; minimum field size
db " " ; pad character
sub_size equ $ - SUBLIST
SHARE_Name LABEL WORD
db "SHARE"
SHARE_Name_Size equ $ - Share_Name
db 0 ; make it a Z string
; $SALUT (4,4,9,41)
Procedure ShDispMsg,near ; ;AN000;
;---------------------------------------
; Set up required parameters
;--------------------------------------
MOV BX,STDERR ;display message on STD ERROR ;AN000;
XOR CX,CX ;no substitution required ;AN000;
XOR DX,DX ;set flags to 0 ;AN000;
DEC DH ;and class to utility ;AN000;
cmp ah,PARSE_ERR_CLASS ;
; $if be,and ; ;AC009;
JNBE $$IF72
mov dh,ah ;
; $if e ; set up implied substitution ;AC009;
JNE $$IF72
ASSUME DS:nothing,ES:DOSDATA
mov num_ins,cl ; set number of inserts to 0 ;AN009;
mov BYTE PTR max_ins,030h ; set maximum size of insert ;AN009;
mov BYTE PTR min_ins,1 ; set minimum size of insert ;AN009;
push ds ; set up segment ;AN009;
pop [msg_segment] ; ;AN009;
mov BYTE PTR ds:[si],0 ; turn it into a ASCIIZ string ;AN009;
cmp si,msg_offset ; is there something there? ;AN009;
; $if a ; if it is... ;AN009;
JNA $$IF73
inc cx ; ;AN009;
; $endif ; ;AN009;
$$IF73:
; $endif ;
$$IF72:
cmp al,Sh_Already_Loaded ; SHARE already loaded message ? ;AN000;
; $if e ; if it is... ;AN000;
JNE $$IF76
mov num_ins,1 ;Set inserts to 1 ;M006
push cs ;M006
pop msg_segment ;Set segment for name ;M006
inc cx ;
mov msg_offset,OFFSET SHARE_name ; ensure the pointer is right ;AN010;
jmp short not_loadmsg
; $endif ;
$$IF76:
;M002;
; Parse error message has the same number. Make sure the message does not
;belong to the parse class.
;
cmp dh,PARSE_ERR_CLASS ;M002
je not_loadmsg ;M002
;SR;
; If this is the Share Installed message, ensure that pointer is at name
;
cmp al, SH_LOADED
jne not_loadmsg
mov num_ins,1 ;Set inserts to 1 ;M006
push cs ;M006
pop msg_segment ;Set segment for name ;M006
inc cx
mov msg_offset,OFFSET SHARE_name
not_loadmsg:
push cs ; ensure that SYSMSG has proper ;AC009;
pop ds ; addressability ;AC009;
lea si,SUBLIST ; point to sublist ;AC009;
push ax ;SR; save for later check
xor ah,ah ; ;AN000;
;--------------------------------------
; Output the Message
;---------------------------------------
EXTRN SYSDISPMSG:NEAR ; ;AN000;
CALL SYSDISPMSG ; ;AN000;
pop ax ;restore ax
; $IF C ; if error occured ;AN000;
JNC $$IF78
CALL Get_DOS_Error ; a DOS extended error occured ;AN000;
CALL SYSDISPMSG ; try to issue it ;AN000;
; $ENDIF ; endif - error occured ;AN000;
$$IF78:
;M006
; Check if flag for no exit is set. If so, do not exit.
;
cmp Exit_Msg,1 ; should we exit? ;M006
jnz doexit ; yes
ret
doexit:
MOV AX,(EXIT SHL 8) + 0FFH ; exit to DOS ;AN000;
INT 21h ; ;AN000;
ret ; may return if pre DOS 2.0 ;AN000;
EndProc ShDispMsg ; ;AN000;
BREAK < Get_DOS_Error >
;******************* START OF SPECIFICATIONS ***********************************
;Routine name: Get_DOS_Error
;*******************************************************************************
;
;Description: Call DOS to obtain DOS extended error #
;
;Called Procedures: None
;
;Input: None
;
;Output: AX = error number
; DH = DOS extended error class
;
;Change History: Created 5/01/87 FG
;
;******************* END OF SPECIFICATIONS *************************************
;******************+ START OF PSEUDOCODE +**************************************
;
; START Get_DOS_Error
;
; call DOS for extended error (INT21 GetExtendedError + 00 <5900>)
; set up registers for return
; ret
;
; END Get_DOS_Error
;
;******************- END OF PSEUDOCODE -**************************************
public Get_DOS_Error
Get_DOS_Error PROC NEAR
mov ax,(GetExtendedError shl 8) ; DOS ext. error ;AN000;
xor bx,bx
push es ; ;AN000;
INT 21h ; GetExtendedError + not_used <5900>;AN000;
pop es
mov bx,STDERR ; fix up bx ;AN000;
xor cx,cx ; fix up cx ;AN000;
mov dh,EXT_ERR_CLASS ; set class to dos error
ret ; ;AN000;
ENDPROC Get_DOS_Error
Break <ShComndParse - Share Command line Parser>
;******************* START OF SPECIFICATIONS ***********************************
;
; NAME: ShComndParse - Share Command line Parser
;
; FUNCTION: Call the DOS PARSE Service Routines to process the command
; line. Search for valid switches (/F:n and /L:m) and
; update the values for file size and number of locks accordingly
;
; INPUT: Parameter string from command line in the PSP
;
; OUTPUT: INITspace and INITlocks are updated.
;
; REGISTERS USED: ES DI AX BX CX DX
; (NOT RESTORED)
;
; LINKAGE: Call
;
; NORMAL - If /F:n specified, then INITspace is updated.
; EXIT: - If /L:m specified, then INITlocks is updated.
;
; ERROR If user enters:
; EXIT: - any parameter or switch other than /F:n or /L:m
; - an invalid value for "n" or "m"
; then this routine will display the "Invalid Parameter"
; error message and terminate.
;
; EXTERNAL - System parse service routines
; REFERENCES: - INT21 - GET PSP Function Call 062h
;
; CHANGE 04/15/87 - First release
; LOG:
;
;******************* END OF SPECIFICATIONS *************************************
;******************+ START OF PSEUDOCODE +**************************************
;
; START
;
; return
;
; END
;
;******************- END OF PSEUDOCODE -*************************************
; $SALUT (4,27,34,41)
;--------------------------------------
; Parse Equates
;--------------------------------------
EOL equ -1 ; Indicator for End-Of-Line ;AN000;
NOERROR equ 0 ; Return Indicator for No Errors ;AN000;
FILE_SWITCH equ 1 ; this is a file switch ;AN000;
LOCK_SWITCH equ 2 ; this is a lock switch ;AN000;
Syntax_Error equ 9 ; maximum PARSE error # ;AN000;
INV_SWITCH equ 3 ;invalid switch ( for /NC)
TOOMANYPARMS equ 1 ;too many parameters ;M006
MSG_OPTIONS_FIRST equ 300 ; first line of options msg
MSG_OPTIONS_LAST equ 303 ; last line of options msg
; $SALUT (4,4,9,41)
Procedure ShComndParse,near ; ;AN000;
;--------------------------------------
; Get address of command line
;--------------------------------------
EXTRN SYSPARSE:NEAR ; ;AN000;
MOV SI,0081H ; OFFSET OF COMMAND LINE IN PSP ;AN000;
MOV AH,62H ; AH=GET PSP ADDRESS FUNCTION CALL ;AN000;
INT 21H ; PSP SEGMENT RETURNED IN BX ;AN000;
MOV DS,BX ; PUT PSP SEG IN DS ;AN000;
MOV CX,0 ; NUMBER OF PARMS PROCESSED SO FAR ;AN000;
PUSH CS ; ;AN000;
POP ES ; ;AN000;
ASSUME ES:SHARE ; ;AN000;
;--------------------------------------
; Loop for each operand at DS:SI
;--------------------------------------
; $do ; ;AN000;
$$DO80:
LEA DI,PARMS ; ADDRESS OF PARSE CONTROLS ;AN000;
MOV DX,0 ; RESERVED ;AN000;
mov msg_offset,si ; save the start scan point ;AC009;
CALL SYSPARSE ; PARSE IT! ;AN000;
CMP AX,EOL ; ARE WE AT END OF COMMAND LINE ? ;AN000;
; $leave e ; ;AN000;
JnE @f ;M006
jmp $$EN80 ;M006
@@: ;M006
CMP AX,NOERROR ; ANY ERRORS? ;AN000;
; $if ne,or ; if parse says error or ;AN000;
JNE $$LL82
MOV AX,Syntax_Error ; Parse syntax error - just in case ;AN000;
MOV BX,DX ; PLACE RESULT ADDRESS IN BX ;AN000;
CMP BX,OFFSET SWITCH_BUFF ; ;AN000;
; $if ne ; if no pointer ;AN000;
JE $$IF82
$$LL82:
call PARSE_ERROR ; call error routine ;AN000;
; $endif ; endif - error ;AN000;
$$IF82:
MOV AX,WORD PTR SW_VALUE ; load the value ;AN000;
MOV BX,SW_SYN ; load pointer to synonym ;AN000;
; DS = PSP segment
; ES = CS = Parse structures segment
; See if the user put /? on the command line.
; If so, they're asking for the options help
; message.
CMP BX, OFFSET ?_SW ; /? ?
JNE PARSE_NOT_OPHELP ; skip if not
CALL DisplayOptions ; display the user's options
mov ax,(EXIT shl 8) + 0 ;normal exit ; M000
int 21h ; M000
PARSE_NOT_OPHELP:
;--------------------------------------
; If user said /F:n, then
;--------------------------------------
CMP BX,OFFSET F_SW ; IF USER SPECIFIED /F ;AN000;
; $if e ; ;AN000;
JNE $$IF84
cmp Fswitch,1 ;switch already given? ;M006
jz err_too_many ;yes, flag error ;M006
mov Fswitch,1 ;no, indicate /F found ;M006
CMP INITspace,AX ; is default < requested ? ;AN000;
; $if b ; if default is < ;AN000;
JNB $$IF85
MOV INITspace,AX ; save the new value ;AN000;
; $endif ; endif (else leave it alone) ;AN000;
$$IF85:
; $else ; else - CHECK FOR LOCKS ;AN000;
JMP SHORT $$EN84
;
;M006; Start block changes
;
err_too_many:
mov ax,TOOMANYPARMS ;too many parameters
mov Exit_Msg,1 ;do not exit after msg
push ds ;save regs
push si
push es
push di
push cx
mov dl,byte ptr ds:[si] ;save byte zeroed out by ShDispMsg
push dx
call Parse_Error ;display error message
pop dx
pop cx
pop di
pop es
pop si
pop ds ;restore regs
mov byte ptr ds:[si],dl ;restore saved byte to continue
mov Exit_Msg,0 ;reset exit flag
jmp short $$EN84 ;continue
;
;M006; End block changes
;
$$IF84:
;---------------------------------------
; If user said /L:m, then update INITlocks
;---------------------------------------
CMP BX,OFFSET L_SW ; IF USER SPECIFIED /L ;AN000;
; $if e ; if it is ;AN000;
JNE $$IF88
cmp Lswitch,1 ;switch already given? ;M006
jz err_too_many ;yes, flag error ;M006
mov Lswitch,1 ;no, indicate /L found ;M006
CMP INITlocks,AX ; is default < requested ? ;AN000;
; $if b ; if default is < ;AN000;
JNB $$IF89
MOV INITlocks,AX ; save the value ;AN000;
; $endif ; endif (else leave it alone) ;AN000;
$$IF89:
; $else ; else - CHECK FOR TOGGLE ;AN010;
JMP SHORT $$EN88
$$IF88:
;SR;
; /NC switch will not be allowed for DOS 5.0. This was needed only for
;automatic installation of Share. This will not be done in DOS 5.0 and so
;the /NC switch is not needed. Just display an error message and terminate
;
;---------------------------------------
; If user said /NC, then ignore it
;---------------------------------------
CMP BX,OFFSET N_SW ; IF USER SPECIFIED /NC ;AN010;
JE $$EN84 ; ignore /NC and continue ;M005
MOV AX,INV_SWITCH ; Parse syntax error ;AN000;
call PARSE_ERROR ; call error routine ;AN000;
;;;$$IF92:
;;;
; $endif ; endif - CHECK FOR TOGGLE ;AN010;
$$EN88:
; $endif ; endif - CHECK FOR LOCKS ;AN000;
$$EN84:
; $enddo ; CHECK FOR NEXT PARM ;AN000;
JMP $$DO80
$$EN80:
ShComndParseExit:
ret ; NORMAL RETURN TO CALLER ;AN000;
;---------------------------------------
; If any other parameter specified,
; display message and quit
;---------------------------------------
PARSE_ERROR: ; ;AN000;
cmp al,Syntax_Error ; error 1 to 9 ? ;AN000;
; $if a ; if parse error ;AN000;
JNA $$IF97
mov al,Syntax_Error ; Parse syntax error
; $endif ; endif errors ;AN000;
$$IF97:
lea bx,Parse_Ret_Code
xlat cs:[bx]
mov ah,PARSE_ERR_CLASS ; set class to parse error ;AN000;
CALL ShDispMsg ; display the parse error ;AN000;
ret ; this should never be used
Parse_Ret_Code label byte
db 0 ; Ret Code 0 -
db 1 ; Ret Code 1 - Too many parameters
db 9 ; Ret Code 2 - Required parameter missing
db 3 ; Ret Code 3 - Invalid switch
db 9 ; Ret Code 4 - Invalid keyword
db 9 ; Ret Code 5 - (reserved)
db 6 ; Ret Code 6 - Parm val out of range
db 9 ; Ret Code 7 - Parameter val not allowed
db 9 ; Ret Code 8 - Parameter val not allowed
db 9 ; Ret Code 9 - Parm format not correct
EndProc ShComndParse ; ;AN000;
Break <DisplayOptions - Display Options Help Message>
;******************* START OF SPECIFICATIONS ***********************************
;
; NAME: DisplayOptions - Display Options Help Message
;
; FUNCTION: Display each of the lines of the options help message
; on standard output.
;
; INPUT: No value passed.
;
; OUTPUT: No value returned.
;
; REGISTERS USED: AX BX CX DX SI
; (NOT RESTORED)
;
; LINKAGE: Call
;
; NORMAL
; EXIT:
;
; ERROR
; EXIT:
;
; EXTERNAL
; REFERENCES: - SYSDISPMSG
;
; CHANGE 05/01/90 - First release
; LOG:
;
;******************* END OF SPECIFICATIONS *************************************
Procedure DisplayOptions, near
push ds ; save caller's DS
mov ax, cs ; set
mov ds, ax ; ds = cs
mov ax, MSG_OPTIONS_FIRST ; message to display
mov bx, STDOUT ; output handle
mov cx, 0 ; no substitutions
mov dh, UTILITY_MSG_CLASS ; message class
mov dl, NO_INPUT ; no input wanted
mov si, 0 ; no substitution list
DispOptLoop:
call SYSDISPMSG ; send this message
cmp ax, MSG_OPTIONS_LAST ; last message?
je DispOptDone ; we're done if so
inc ax ; else get next message
jmp short DispOptLoop ; and go do it
DispOptDone:
pop ds
ret
EndProc DisplayOptions
include msgdcl.inc
SHARE ENDS
STACK SEGMENT STACK
DB 278 + 128 DUP (?) ; 278 == IBM's ROM requirements
STACK ENDS
ENDIF
END shareinit
| 25.986897
| 92
| 0.522303
|
ac89c12d7745b43fca0002fc3a84c7f7ba30c354
| 2,022
|
asm
|
Assembly
|
programs/oeis/056/A056451.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/056/A056451.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/056/A056451.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A056451: Number of palindromes using a maximum of five different symbols.
; 1,5,5,25,25,125,125,625,625,3125,3125,15625,15625,78125,78125,390625,390625,1953125,1953125,9765625,9765625,48828125,48828125,244140625,244140625,1220703125,1220703125,6103515625,6103515625,30517578125,30517578125,152587890625,152587890625,762939453125,762939453125,3814697265625,3814697265625,19073486328125,19073486328125,95367431640625,95367431640625,476837158203125,476837158203125,2384185791015625,2384185791015625,11920928955078125,11920928955078125,59604644775390625,59604644775390625,298023223876953125,298023223876953125,1490116119384765625,1490116119384765625,7450580596923828125,7450580596923828125,37252902984619140625,37252902984619140625,186264514923095703125,186264514923095703125,931322574615478515625,931322574615478515625,4656612873077392578125,4656612873077392578125,23283064365386962890625,23283064365386962890625,116415321826934814453125,116415321826934814453125,582076609134674072265625,582076609134674072265625,2910383045673370361328125,2910383045673370361328125,14551915228366851806640625,14551915228366851806640625,72759576141834259033203125,72759576141834259033203125,363797880709171295166015625,363797880709171295166015625,1818989403545856475830078125,1818989403545856475830078125,9094947017729282379150390625,9094947017729282379150390625,45474735088646411895751953125,45474735088646411895751953125,227373675443232059478759765625,227373675443232059478759765625,1136868377216160297393798828125,1136868377216160297393798828125,5684341886080801486968994140625,5684341886080801486968994140625,28421709430404007434844970703125,28421709430404007434844970703125,142108547152020037174224853515625,142108547152020037174224853515625,710542735760100185871124267578125,710542735760100185871124267578125,3552713678800500929355621337890625,3552713678800500929355621337890625,17763568394002504646778106689453125,17763568394002504646778106689453125,88817841970012523233890533447265625
add $0,1
div $0,2
mov $1,5
pow $1,$0
mov $0,$1
| 224.666667
| 1,897
| 0.930762
|
25685fabcc94601615df16a375c6273cf0ff0e56
| 2,228
|
asm
|
Assembly
|
lab_05/src/io.asm
|
migregal/bmstu_iu7_asm
|
f33e37b38af3e801dd4c4e9d5171272f6293c417
|
[
"MIT"
] | 2
|
2021-04-09T14:34:37.000Z
|
2021-05-24T20:03:30.000Z
|
lab_05/src/io.asm
|
migregal/bmstu_iu7_asm
|
f33e37b38af3e801dd4c4e9d5171272f6293c417
|
[
"MIT"
] | null | null | null |
lab_05/src/io.asm
|
migregal/bmstu_iu7_asm
|
f33e37b38af3e801dd4c4e9d5171272f6293c417
|
[
"MIT"
] | null | null | null |
.186
EXTRN M: byte
EXTRN MAX_M: byte
EXTRN N: byte
EXTRN MAX_N: byte
EXTRN MATRIX: byte
DS2 SEGMENT PARA 'DATA'
MSG1 db "Enter N:$"
MSG2 db "Enter M:$"
MSG3 db "Enter Matrix values:$"
MSG4 db "Result:$"
DS2 ENDS
SC2 SEGMENT PARA PUBLIC 'CODE'
assume CS:SC2, DS:DS2
newline proc
push DX
mov DL, 10
mov AH, 02h
int 21h
mov DL, 13
mov AH, 02h
int 21h
pop DX
ret
newline endp
read_num proc
push DX
mov DL, ' '
mov AH, 02h
int 21h
mov AH, 01h
int 21h
sub AL, '0'
pop DX
ret
read_num endp
read_data proc
pusha
mov AX, SEG M
mov ES, AX
xor BX, BX
read:
cmp BL, ES:N
je read_end
xor CL, CL
mov AX, BX
mul ES:MAX_M
mov SI, AX
read_row:
cmp CL, ES:M
je read_row_end
call read_num
mov ES:Matrix[SI], AL
inc CL
inc SI
jmp read_row
read_row_end:
inc BX
call newline
jmp read
read_end:
popa
ret
read_data endp
read_matrix proc far
pusha
mov AX, DS2
mov DS, AX
mov AX, SEG N
mov ES, AX
;N
mov DX, OFFSET MSG1
mov AH, 09h
int 21h
call read_num
mov ES:N, AL
call newline
; M
mov DX, OFFSET MSG2
mov AH, 09h
int 21h
call read_num
mov ES:M, AL
call newline
; Matrix
mov DX, OFFSET MSG3
mov AH, 09h
int 21h
call newline
call read_data
popa
ret
read_matrix endp
print_num proc
push DX
mov DL, ' '
mov AH, 02h
int 21h
pop DX
add DL, '0'
mov AH, 02h
int 21h
ret
print_num endp
print_matrix proc far
pusha
mov AX, DS2
mov DS, AX
mov AX, SEG N
mov ES, AX
; Matrix
mov DX, OFFSET MSG4
mov AH, 09h
int 21h
call newline
xor CH, CH
print:
cmp CH, ES:N
je print_end
xor AX, AX
mov AL, CH
mul ES:MAX_M
mov BX, AX
xor CL, CL
print_row:
cmp CL, ES:M
je print_row_end
mov DL, ES:Matrix[BX]
call print_num
inc CL
inc BX
jmp print_row
print_row_end:
inc CH
call newline
jmp print
print_end:
popa
ret
print_matrix endp
SC2 ENDS
PUBLIC read_matrix
PUBLIC print_matrix
END
| 11.425641
| 35
| 0.575404
|
c5078af34b00ae2bb3844aef00bfd7b700f7cc81
| 530
|
asm
|
Assembly
|
oeis/265/A265804.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/265/A265804.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/265/A265804.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A265804: Coefficient of x^2 in minimal polynomial of the continued fraction [1^n,5,1,1,1,...], where 1^n means n ones.
; Submitted by Jon Maiga
; 1,19,29,95,229,619,1601,4211,11005,28831,75461,197579,517249,1354195,3545309,9281759,24299941,63618091,166554305,436044851,1141580221,2988695839,7824507269,20484825995,53629970689,140405086099,367585287581,962350776671
mov $3,6
mov $4,2
lpb $0
sub $0,1
add $1,1
mov $2,$1
add $4,$1
add $3,$4
mov $1,$3
mov $3,$2
sub $2,1
add $4,$2
lpe
mov $0,$1
mul $0,2
add $0,1
| 25.238095
| 220
| 0.703774
|
97ede39d1c3ed0c2447c5e6a741667354c621d3b
| 864
|
asm
|
Assembly
|
projects/07/MemoryAccess/PointerTest/PointerTest.asm
|
feliposz/nand2tetris
|
c54766ceb70ccbe85689e0b79bb9073b232b092b
|
[
"MIT"
] | null | null | null |
projects/07/MemoryAccess/PointerTest/PointerTest.asm
|
feliposz/nand2tetris
|
c54766ceb70ccbe85689e0b79bb9073b232b092b
|
[
"MIT"
] | null | null | null |
projects/07/MemoryAccess/PointerTest/PointerTest.asm
|
feliposz/nand2tetris
|
c54766ceb70ccbe85689e0b79bb9073b232b092b
|
[
"MIT"
] | null | null | null |
// push constant 3030
@3030
D=A
@SP
A=M
M=D
@SP
M=M+1
// pop pointer 0
@SP
M=M-1
A=M
D=M
@THIS
M=D
// push constant 3040
@3040
D=A
@SP
A=M
M=D
@SP
M=M+1
// pop pointer 1
@SP
M=M-1
A=M
D=M
@THAT
M=D
// push constant 32
@32
D=A
@SP
A=M
M=D
@SP
M=M+1
// pop this 2
@2
D=A
@THIS
D=D+M
@R13
M=D
@SP
M=M-1
A=M
D=M
@R13
A=M
M=D
// push constant 46
@46
D=A
@SP
A=M
M=D
@SP
M=M+1
// pop that 6
@6
D=A
@THAT
D=D+M
@R13
M=D
@SP
M=M-1
A=M
D=M
@R13
A=M
M=D
// push pointer 0
@THIS
D=M
@SP
A=M
M=D
@SP
M=M+1
// push pointer 1
@THAT
D=M
@SP
A=M
M=D
@SP
M=M+1
// add
@SP
M=M-1
A=M
D=M
@SP
M=M-1
A=M
D=D+M
@SP
A=M
M=D
@SP
M=M+1
// push this 2
@2
D=A
@THIS
A=D+M
D=M
@SP
A=M
M=D
@SP
M=M+1
// sub
@SP
M=M-1
A=M
D=M
@SP
M=M-1
A=M
D=M-D
@SP
A=M
M=D
@SP
M=M+1
// push that 6
@6
D=A
@THAT
A=D+M
D=M
@SP
A=M
M=D
@SP
M=M+1
// add
@SP
M=M-1
A=M
D=M
@SP
M=M-1
A=M
D=D+M
@SP
A=M
M=D
@SP
M=M+1
| 5.61039
| 21
| 0.549769
|
18b56537cd9f4b4bb01ab238a3997c56e7519c75
| 2,498
|
asm
|
Assembly
|
vp8/common/arm/neon/iwalsh_neon.asm
|
mrchapp/libvpx
|
c2a8d8b54c7ebefd1cd9c55f53b9e8378f088e8b
|
[
"BSD-3-Clause"
] | 1
|
2015-05-03T19:25:39.000Z
|
2015-05-03T19:25:39.000Z
|
vp8/common/arm/neon/iwalsh_neon.asm
|
mrchapp/libvpx
|
c2a8d8b54c7ebefd1cd9c55f53b9e8378f088e8b
|
[
"BSD-3-Clause"
] | null | null | null |
vp8/common/arm/neon/iwalsh_neon.asm
|
mrchapp/libvpx
|
c2a8d8b54c7ebefd1cd9c55f53b9e8378f088e8b
|
[
"BSD-3-Clause"
] | null | null | null |
;
; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
EXPORT |vp8_short_inv_walsh4x4_neon|
EXPORT |vp8_short_inv_walsh4x4_1_neon|
ARM
REQUIRE8
PRESERVE8
AREA |.text|, CODE, READONLY ; name this block of code
;short vp8_short_inv_walsh4x4_neon(short *input, short *output)
|vp8_short_inv_walsh4x4_neon| PROC
; read in all four lines of values: d0->d3
vldm.64 r0, {q0, q1}
; first for loop
vadd.s16 d4, d0, d3 ;a = [0] + [12]
vadd.s16 d5, d1, d2 ;b = [4] + [8]
vsub.s16 d6, d1, d2 ;c = [4] - [8]
vsub.s16 d7, d0, d3 ;d = [0] - [12]
vadd.s16 d0, d4, d5 ;a + b
vadd.s16 d1, d6, d7 ;c + d
vsub.s16 d2, d4, d5 ;a - b
vsub.s16 d3, d7, d6 ;d - c
vtrn.32 d0, d2 ;d0: 0 1 8 9
;d2: 2 3 10 11
vtrn.32 d1, d3 ;d1: 4 5 12 13
;d3: 6 7 14 15
vtrn.16 d0, d1 ;d0: 0 4 8 12
;d1: 1 5 9 13
vtrn.16 d2, d3 ;d2: 2 6 10 14
;d3: 3 7 11 15
; second for loop
vadd.s16 d4, d0, d3 ;a = [0] + [3]
vadd.s16 d5, d1, d2 ;b = [1] + [2]
vsub.s16 d6, d1, d2 ;c = [1] - [2]
vsub.s16 d7, d0, d3 ;d = [0] - [3]
vadd.s16 d0, d4, d5 ;e = a + b
vadd.s16 d1, d6, d7 ;f = c + d
vsub.s16 d2, d4, d5 ;g = a - b
vsub.s16 d3, d7, d6 ;h = d - c
vmov.i16 q2, #3
vadd.i16 q0, q0, q2 ;e/f += 3
vadd.i16 q1, q1, q2 ;g/h += 3
vshr.s16 q0, q0, #3 ;e/f >> 3
vshr.s16 q1, q1, #3 ;g/h >> 3
vtrn.32 d0, d2
vtrn.32 d1, d3
vtrn.16 d0, d1
vtrn.16 d2, d3
vstmia.16 r1!, {q0}
vstmia.16 r1!, {q1}
bx lr
ENDP ; |vp8_short_inv_walsh4x4_neon|
;short vp8_short_inv_walsh4x4_1_neon(short *input, short *output)
|vp8_short_inv_walsh4x4_1_neon| PROC
; load a full line into a neon register
vld1.16 {q0}, [r0]
; extract first element and replicate
vdup.16 q1, d0[0]
; add 3 to all values
vmov.i16 q2, #3
vadd.i16 q3, q1, q2
; right shift
vshr.s16 q3, q3, #3
; write it back
vstmia.16 r1!, {q3}
vstmia.16 r1!, {q3}
bx lr
ENDP ; |vp8_short_inv_walsh4x4_1_neon|
END
| 25.752577
| 70
| 0.563651
|
4672286110348ba07ed4080a95e5a28c71db7c5f
| 454
|
asm
|
Assembly
|
oeis/111/A111878.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/111/A111878.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/111/A111878.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A111878: a(n) = denominator(digamma(n+7/2)/2 + log(2) + euler_gamma/2)/15; a(n)=denominator(f(n+2)/15) = A111877(n+1)/5.
; Submitted by Christian Krause
; 1,7,21,231,3003,3003,51051,969969,969969,22309287,111546435,334639305,9704539845,300840735195,300840735195,300840735195,11131107202215,11131107202215,456375395290815,19624141997505045,19624141997505045
add $0,1
mov $2,2
add $2,$0
add $0,$2
seq $0,217858 ; Odd part of lcm(1,2,3,...,n).
div $0,15
| 41.272727
| 203
| 0.740088
|
31fa72afb03ac673ca0d351a7f029c1a6a0867a6
| 5,815
|
asm
|
Assembly
|
iod/con2/ptr/sysspr.asm
|
olifink/smsqe
|
c546d882b26566a46d71820d1539bed9ea8af108
|
[
"BSD-2-Clause"
] | null | null | null |
iod/con2/ptr/sysspr.asm
|
olifink/smsqe
|
c546d882b26566a46d71820d1539bed9ea8af108
|
[
"BSD-2-Clause"
] | null | null | null |
iod/con2/ptr/sysspr.asm
|
olifink/smsqe
|
c546d882b26566a46d71820d1539bed9ea8af108
|
[
"BSD-2-Clause"
] | null | null | null |
; System sprites code V1.00 1991 Tony Tebby
; 2003 Marcel Kilgus
; 2003 W. Lenerz
;
; 2004-04-02 1.01 xdef'd sp_error (wl)
section driver
xdef pt_ssref
xdef pt_isspr
xdef pt_sspr
xdef sp_error
xref gu_achpp
include 'dev8_keys_con'
include 'dev8_keys_err'
include 'dev8_keys_sys'
include 'dev8_keys_sysspr'
;+++
; Convert references to a system sprite into a real address.
;
; A1 cr ptr to sprite / real ptr to sprite
; A3 c p ptr to console linkage block
;---
pt_ssref
movem.l d0/a2,-(sp)
moveq #0,d0
pt_stable
move.l pt_sstb(a3),a2 ; pointer to sprite table
cmp.w #sp.max,a1 ; is ptr small enough to be in table?
bge.s pts_fspr ; no, go on
add.l a1,a1
add.l a1,a1 ; get offset in table
move.l 2(a2,a1.l),a1 ; thus absolute pointer to sprite
move.l a1,d0
bne.s pts_exit
lea sp_error,a1
bra.s pts_exit
pts_fspr
tst.l d0 ; already checked for system sprite?
bne.s pts_exit ; yep
tst.b (a1) ; mode 0 = system sprite
bne.s pts_exit
move.w (a1),d0 ; take number from definition
move.l d0,a1
moveq #1,d0 ; second run
bra.s pt_stable ; and try to locate sprite
pts_exit
movem.l (sp)+,d0/a2
rts
;+++
; Init system sprite table
;
; A3 c p ptr to console linkage block
;---
pt_isspr
move.l a0,-(sp)
move.l #sp.max,d0
lsl.w #2,d0 ; long words
addq.l #8,d0 ; plus header
jsr gu_achpp ; allocate memory for it
bne.s pis_rts
move.w #sp.max,d0
move.w d0,(a0)+ ; save max number
move.l a0,pt_sstb(a3) ; save pointer
clr.w (a0)+ ; currently no sprite in table
subq.w #1,d0
pis_loop
clr.l (a0)+
dbf d0,pis_loop ; ensure table is clean
moveq #0,d0
pis_rts
movem.l (sp)+,a0
rts
;+++
; CON vector $0C PV_SSPR
;
; Set system sprites/Get system sprite address
;
; Call parameters Return parameters
;
; D1.w sprite number / -ve D1 pres. / Max allowed | max current
; D2 D2 preserved
; D3 D3+ all preserved
;
; A0 A0 preserved
; A1 pointer to sprite / 0 A1 preserved / pointer to sprite
; A2 A2 preserved
; A3 pointer to CON linkage block A3 preserved
; A4 A4 preserved
; A5 not used by any routine
; A6 not used by any routine
;
;
; this gets or sets a system sprite or returns the max nbr of system sprites
; * if d1 is a negative nbr (-1 is suggested), then on return d1 contains:
; max nbr of space in table for sys sprites | highest nbr of current system sprite
; else:
; * if a1 = 0, then one gets the address of the system sprite the number
; of which is passed in D1. The address is returned in a1.
; This address MAY be 0, in which case the system sprite requested does
; not exist. This will only happen if somebody fiddled with the table
; contrary to recommendations
; * if a1 <> then it contains the address of a sprite that will be a system
; sprite, d1 contains the number of that sprite. This sprite is not
; " copied to a safe place", it is the responsibility of the calling
; job to make sure that the sprite doesn't just disappear
;
; Error returns:
; IPAR Illegal sprite number (set/get)
; ICHN Channel not open/ invalid channel ID (from general trap handler)
; NC not complete (from general trap handler)
; ITNF there are no system sprites !
;---
; the sprite table has the following format:
;
; -2 max nbr of sprites possible in table
; 0 nbr of sprites currently in table
; 2+ long word absolute pointers (i.e real addresses of sprites)
; ========
; sprite nbr too big for table
sspr_ipar
moveq #err.ipar,d0
bra.s sspr_out
; no sprite table
sspr_nf
moveq #err.itnf,d0
bra.s sspr_out
pt_sspr
move.l a2,-(sp)
move.l pt_sstb(a3),d0 ; pointer to sprite table
beq.s sspr_nf ; ... but there is none
move.l d0,a2 ; point to sprite table
tst.w d1 ; do we want to get the nbr of sprites?
bmi.s sspr_nbr ; ... yes
move.w -2(a2),d0 ; max nbr of sprite
cmp.w d0,d1
bgt.s sspr_ipar ; sprite wished exceeds max nbr
move.l a1,d0 ; get/set?
bne.s sspr_set ; set sprite
sspr_get
moveq #0,d0
move.w d1,d0
lsl.l #2,d0 ; long word pointers
move.l 2(a2,d0.l),a1 ; absolute pointer to sprite
sspr_ok
moveq #0,d0 ; no error
sspr_out
move.l (sp)+,a2
rts
sspr_set
move.w (a2),d0 ; current highest nbr of system sprites
cmp.w d1,d0 ; is sprite wished higher?
bge.s sspr_no ; ...no
move.w d1,(a2) ; new higest current sprite
sspr_no
moveq #0,d0
move.w d1,d0
lsl.l #2,d0 ; pointers are long words
lea 2(a2,d0.l),a2 ; + nbr word
move.l a1,(a2) ; put it in
bra.s sspr_ok ;
sspr_nbr
move.l -2(a2),d1 ; max space | current highest nbr
bra.s sspr_ok
; Sprite that is shown in case of an error
sp_error
dc.w $0100,$0000 ;form, time/adaption
dc.w $0009,$0008 ;x size, y size
dc.w $0000,$0000 ;x origin, y origin
dc.l cp4_err-* ;pointer to colour pattern
dc.l pm4_err-* ;pointer to pattern mask
dc.l s8_err-* ;pointer to next definition
cp4_err
dc.w $00C1,$0080
dc.w $0063,$0000
dc.w $0036,$0000
dc.w $001C,$0000
dc.w $001C,$0000
dc.w $0036,$0000
dc.w $0063,$0000
dc.w $00C1,$0080
pm4_err
dc.w $C1C1,$8080
dc.w $6363,$0000
dc.w $3636,$0000
dc.w $1C1C,$0000
dc.w $1C1C,$0000
dc.w $3636,$0000
dc.w $6363,$0000
dc.w $C1C1,$8080
s8_err
dc.w $0101,$0000 ;form, time/adaption
dc.w $000A,$000A ;x size, y size
dc.w $0000,$0000 ;x origin, y origin
dc.l cp8_err-* ;pointer to colour pattern
dc.l pm8_err-* ;pointer to pattern mask
dc.l 0 ;pointer to next definition
cp8_err
dc.w $0080,$0080
dc.w $0080,$0080
dc.w $0022,$0000
dc.w $0022,$0000
dc.w $0008,$0000
dc.w $0008,$0000
dc.w $0022,$0000
dc.w $0022,$0000
dc.w $0080,$0080
dc.w $0080,$0080
pm8_err
dc.w $C0C0,$C0C0
dc.w $C0C0,$C0C0
dc.w $3333,$0000
dc.w $3333,$0000
dc.w $0C0C,$0000
dc.w $0C0C,$0000
dc.w $3333,$0000
dc.w $3333,$0000
dc.w $C0C0,$C0C0
dc.w $C0C0,$C0C0
end
| 24.535865
| 86
| 0.67515
|
fc32ce151e2ef98219d9c6015650700a965fb313
| 406
|
asm
|
Assembly
|
ASM/Z80-Emulator-Test/hello.asm
|
insom/LittleComputer
|
d1e3079c07656b3a98e27f5b5f59077300983fe9
|
[
"Unlicense"
] | 2
|
2017-08-02T03:44:37.000Z
|
2017-11-25T00:27:36.000Z
|
ASM/Z80-Emulator-Test/hello.asm
|
insom/LittleComputer
|
d1e3079c07656b3a98e27f5b5f59077300983fe9
|
[
"Unlicense"
] | null | null | null |
ASM/Z80-Emulator-Test/hello.asm
|
insom/LittleComputer
|
d1e3079c07656b3a98e27f5b5f59077300983fe9
|
[
"Unlicense"
] | null | null | null |
org 00000h
ld c, 0
start:
; fetch data+c into a
ld h, 0
ld a, data
add c
ld l, a
ld a, (hl)
; print a
ld l, a
ld a, 1
rst 8
; increment c
ld a, c
inc a
ld c, a
; check if c > 13
sub 13
jr c, start
end:
jr end
data:
dm "Hello, world"
db 10
| 14
| 25
| 0.364532
|
97d52acca88407d4fc44d21b4113887e7d40ce84
| 762
|
asm
|
Assembly
|
xnlib/xnclib/setjmp.asm
|
manaskamal/aurora-xeneva
|
fe277f7ac155a40465c70f1db3c27046e4d0f7b5
|
[
"BSD-2-Clause"
] | 8
|
2021-07-19T04:46:35.000Z
|
2022-03-12T17:56:00.000Z
|
xnlib/xnclib/setjmp.asm
|
manaskamal/aurora-xeneva
|
fe277f7ac155a40465c70f1db3c27046e4d0f7b5
|
[
"BSD-2-Clause"
] | null | null | null |
xnlib/xnclib/setjmp.asm
|
manaskamal/aurora-xeneva
|
fe277f7ac155a40465c70f1db3c27046e4d0f7b5
|
[
"BSD-2-Clause"
] | null | null | null |
;;-------------------------------------------------------
;; Copyright (C) Manas Kamal Choudhury
;;
;; /PROJECT - Aurora's Xeneva
;; /AUTHOR - Manas Kamal Choudhury
;;
;;-------------------------------------------------------
section .text
[BITS 64]
global setjmp
setjmp:
mov [rcx], rbx
mov [rcx + 8], rbp
mov [rcx + 16], r12
mov [rcx + 24], r13
mov [rcx + 32], r14
mov [rcx + 40],r15
pop r15
mov rdx, rsp
mov [rcx + 48], rdx
push r15
mov rdx,[rsp]
mov [rcx + 56], rdx
xor eax, eax
ret
global longjmp
longjmp:
xor rax, rax
cmp rdx, 1
adc rax, rdx
mov rbx, [rcx]
mov rbp, [rcx + 8]
mov r12, [rcx + 16]
mov r13, [rcx + 24]
mov r14, [rcx + 32]
mov r15, [rcx + 40]
mov rsp, [rcx + 48]
jmp [rcx + 56]
| 18.142857
| 57
| 0.47769
|
b3c87f5d8e671bbad265476857e099b46e16ea34
| 568
|
asm
|
Assembly
|
PRG/objects/3-4.asm
|
narfman0/smb3_pp1
|
38a58adafff67a403591e38875e9fae943a5fe76
|
[
"Unlicense"
] | null | null | null |
PRG/objects/3-4.asm
|
narfman0/smb3_pp1
|
38a58adafff67a403591e38875e9fae943a5fe76
|
[
"Unlicense"
] | null | null | null |
PRG/objects/3-4.asm
|
narfman0/smb3_pp1
|
38a58adafff67a403591e38875e9fae943a5fe76
|
[
"Unlicense"
] | null | null | null |
.byte $01 ; Unknown purpose
.byte OBJ_GOOMBA, $0F, $17
.byte OBJ_GOOMBA, $11, $18
.byte OBJ_REDPIRANHA, $14, $17
.byte OBJ_VENUSFIRETRAP, $22, $17
.byte OBJ_GOOMBA, $34, $15
.byte OBJ_GOOMBA, $36, $16
.byte OBJ_GOOMBA, $38, $17
.byte OBJ_GREENCHEEP, $41, $19
.byte OBJ_GREENTROOPA, $52, $14
.byte OBJ_GREENTROOPA, $54, $15
.byte OBJ_GREENTROOPA, $56, $16
.byte OBJ_PARAGOOMBAWITHMICROS, $65, $18
.byte OBJ_GREENPIRANHA_FIREC, $66, $11
.byte OBJ_PARAGOOMBA, $6B, $18
.byte OBJ_LAKITU, $92, $12
.byte OBJ_ENDLEVELCARD, $C8, $15
.byte $FF ; Terminator
| 28.4
| 41
| 0.68662
|
20092bfbc4863c080729cda2752b095002e2f168
| 1,434
|
asm
|
Assembly
|
AVR/pooling.asm
|
StxGuy/EmbeddedSystems
|
6d9bc8b295724d361ea1d82e701e6530f74e2300
|
[
"MIT"
] | null | null | null |
AVR/pooling.asm
|
StxGuy/EmbeddedSystems
|
6d9bc8b295724d361ea1d82e701e6530f74e2300
|
[
"MIT"
] | null | null | null |
AVR/pooling.asm
|
StxGuy/EmbeddedSystems
|
6d9bc8b295724d361ea1d82e701e6530f74e2300
|
[
"MIT"
] | null | null | null |
;-------------------------------------;
; GPIO POOLING FOR ATMEL328p ;
; ;
; Por: Prof. Carlo Requiao ;
; 13/Oct/2021 ;
;-------------------------------------;
.device ATmega328P
;-------------------------------------;
; MACROS ;
;-------------------------------------;
.macro initstack
ldi R16,low(RAMEND)
out spl,R16
ldi R16,high(RAMEND)
out sph,R16
.endmacro
;-------------------------------------;
; DEFINITIONS ;
;-------------------------------------;
.def geral1=R18
.def geral2=R19
;-------------------------------------;
; MEMORY SEGMENTS ;
;-------------------------------------;
.dseg
.cseg
.org 0x00 ; Program starts at 0x00
rjmp INICIO
;-------------------------------------;
; CODE ;
;-------------------------------------;
INICIO:
initstack
in R16,MCUCR
ori R16,(1<<PUD)
out MCUCR,R16 ; Disable pull-up
sbi DDRB,5 ; On-board LED is output
cbi DDRB,0 ; GPIO8 (PB0) is input
LOOP:
sbi PORTB,5 ; Turn LED on
L1:
sbic PINB,0 ; Skip if PB[0] == 0
rjmp L1
cbi PORTB,5 ; Turn LED off
L2:
sbis PINB,0 ; Skip if PB[0] == 1
rjmp L2
rjmp LOOP
| 24.305085
| 56
| 0.315202
|
856dd98b81c74e4ef2c14102eda655483f760ee2
| 5,429
|
asm
|
Assembly
|
MIPS_Course/lab1/sum.asm
|
akellermann97/college-dump
|
5c82d93767038709ad71b8f212fdb6243eeb0aec
|
[
"MIT"
] | null | null | null |
MIPS_Course/lab1/sum.asm
|
akellermann97/college-dump
|
5c82d93767038709ad71b8f212fdb6243eeb0aec
|
[
"MIT"
] | null | null | null |
MIPS_Course/lab1/sum.asm
|
akellermann97/college-dump
|
5c82d93767038709ad71b8f212fdb6243eeb0aec
|
[
"MIT"
] | null | null | null |
#
# FILE: $File$
# AUTHOR: P. White
# Contributors:
# W. Carithers
# K. Reek
# Alexander Kellermann Nieves (akn1736)
#
# DESCRIPTION:
# This program reads up to 10 of numbers (or until the user
# enters the value 9999) from the standard input, and then
# computes and prints their sum.
#
# ARGUMENTS:
# None
#
# INPUT:
# The numbers to be summed.
#
# OUTPUT:
# A "before" line with the 10 numbers in the order they were
# entered, and an "Sum=" and then the sum of all the numbers
#
#
# REVISION HISTORY:
# Aug 2013 - P. White converted to MIPS
#
#-------------------------------
#
# CONSTANTS
#
MAX_SIZE= 10 # number of array elements
PRINT_STRING = 4 # arg for syscall to tell it to write
PRINT_INT = 1
#-------------------------------
#
# DATA AREAS
#
.data
.align 2 # word data must be on word boundaries
array:
.space 4*MAX_SIZE # Reserve space for array to hold data
# the array is up to MAX_SIZE words (4byte
# each). Note the array isn't initialized
size:
.word 0 # Actual number of values in the array
.align 0 # string data doesn't have to be aligned
space:
.asciiz " "
lf:
.asciiz "\n"
before:
.asciiz "Values entered: "
sum_msg:
.asciiz "Sum= "
prompt:
.asciiz "Enter Number: "
reprompt:
.asciiz "Number not positive.\nRe-Enter Number: "
#
# CODE AREAS
#
.text # this is program code
.align 2 # instructions must be on word boundaries
.globl main # main is a global label
# ######################################
# ##### BEGIN STUDENT CODE BLOCK 1 #####
#
# Name: main
#
# Description: EXECUTION BEGINS HERE
# Arguments: none
# Returns: none
# Destroys: t0,t1,t2,t3
#
FRAMESIZE = 8
main:
# allocate space for the stack frame
addi $sp,$sp,-FRAMESIZE
sw $ra,4($sp) # store the ra on the stack
sw $s0,0($sp) # store the s0 on the stack
la $a0,array # Pass the address of the array in a0
li $a1,MAX_SIZE # and its max size in a1
jal readarray
#
# The number of elements in the array is returned in v0
# store it into memory then print the array
#
la $t0,size
sw $v0,0($t0) # store num. of val. entered
li $v0,PRINT_STRING # print a "Values:"
la $a0,before
syscall
jal parray
#
# Sum up the elements in the array
#
li $t0,0 # t0 loop counter
la $t1,size # t1 is addr in mem of the size val
lw $t1,0($t1) # t1 is number of elements read
la $s0,array # s0 is pointer into array
li $t2,0 # t2 is the running total
sum_loop:
beq $t0,$t1,sum_loop_end
lw $t3,0($s0) # read the value
add $t2,$t2,$t3 # add it to the sum
addi $t0,$t0,1 # increment counter
addi $s0,$s0,4 # increment array pointer
j sum_loop
sum_loop_end:
li $v0,PRINT_STRING # print "Sum= "
la $a0,sum_msg
syscall
li $v0,PRINT_INT # print the sum
move $a0,$t2
syscall
li $v0,PRINT_STRING
la $a0,lf
syscall # print a newline
lw $ra,4($sp) # restore the registers
lw $s0,0($sp)
addi $sp,$sp,FRAMESIZE
jr $ra # return from main and exit program
#
# Name: parray
#
# Description: prints the "size" number of integers from the
# array "array"
# Arguments: none
# Returns: none
# Destroys: t0,t1
#
parray:
la $a0,array # a0 is the location of the array
la $t0,size
lw $a1, 0($t0) # a1 is the number of elements entered
li $t0,0 # i=0;
move $t1,$a0 # t1 is pointer to array
pa_loop:
beq $t0,$a1,done # done if i==n
lw $a0,0($t1) # get a[i]
li $v0,PRINT_INT
syscall # print one int
li $v0,PRINT_STRING
la $a0,space
syscall # print a space
addi $t1,$t1,4 # update pointer
addi $t0,$t0,1 # and count
j pa_loop
done:
li $v0,PRINT_STRING
la $a0,lf
syscall # print a newline
jr $ra
#
# Name: readnumber
#
# Description: reads in a positive integers
# Arguments: none
# Returns: return the number read in (in v0)
# Destroys: none
#
readnumber:
li $v0,PRINT_STRING
la $a0,prompt
syscall # print string
readloop:
li $v0,5
syscall
slti $t0, $v0, 0
beq $t0, $zero, goodnumber
li $v0,PRINT_STRING
la $a0,reprompt
syscall # print string
j readloop
goodnumber:
jr $ra
#
# Name: readarray
#
# Description: reads in an array of integers, can read up to MAX_SIZE
# elements or until the user enters the sentinal 9999
# Arguments: $a0 the address of the array
# $a1 the max number of elements that can be in the array
# Returns: return the number of values read in
# Destroys: t0,t1,t9
#
readarray:
addi $sp, $sp, -4
sw $ra, 0($sp) # save ra on stack
addi $sp, $sp, -4
sw $s0, 0($sp) # save s0 on stack
addi $sp, $sp, -4
sw $s1, 0($sp) # save s1 on stack
li $s0,0 # t0 will hold the num. of ele. entered
move $s1,$a0 # t1 is pointer to array
ra_loop:
beq $s0,$a1,ra_done # done if num_ele == max allowed
jal readnumber
li $t9,9999 # sentinal to leave loop
beq $v0,$t9,ra_done
sw $v0,0($s1)
addi $s1,$s1,4 # update pointer
addi $s0,$s0,1 # and increment the count
j ra_loop
ra_done:
li $v0,PRINT_STRING
la $a0,lf
syscall # print a message
move $v0,$s0 # return the number of values read in
lw $s1, 0($sp) # restore the ra from the stack
addi $sp, $sp, 4
lw $s0, 0($sp) # restore the ra from the stack
addi $sp, $sp, 4
lw $ra, 0($sp) # restore the ra from the stack
addi $sp, $sp, 4
jr $ra
# ###### END STUDENT CODE BLOCK 1 ######
# ######################################
| 20.257463
| 71
| 0.624793
|
03fd1e299a6bb7765b4765b221d2940efae73001
| 3,683
|
asm
|
Assembly
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_405.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_405.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_405.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r15
push %rcx
push %rsi
// Faulty Load
lea addresses_D+0x12bf2, %rsi
and %r12, %r12
mov (%rsi), %r10d
lea oracles, %rcx
and $0xff, %r10
shlq $12, %r10
mov (%rcx,%r10,1), %r10
pop %rsi
pop %rcx
pop %r15
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 92.075
| 2,999
| 0.663318
|
fca7037eb5401b6eb7da54cccdce750735f0a22a
| 353
|
asm
|
Assembly
|
programs/oeis/295/A295905.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | 1
|
2021-03-15T11:38:20.000Z
|
2021-03-15T11:38:20.000Z
|
programs/oeis/295/A295905.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | null | null | null |
programs/oeis/295/A295905.asm
|
karttu/loda
|
9c3b0fc57b810302220c044a9d17db733c76a598
|
[
"Apache-2.0"
] | null | null | null |
; A295905: Number of (not necessarily maximum) cliques in the n X n knight graph.
; 2,5,18,41,74,117,170,233,306,389,482,585,698,821,954,1097,1250,1413,1586,1769,1962,2165,2378,2601,2834,3077,3330,3593,3866,4149,4442,4745,5058,5381,5714,6057,6410,6773,7146,7529,7922,8325,8738,9161,9594,10037,10490,10953
mov $1,$0
mul $0,5
sub $0,2
mul $1,$0
add $1,2
| 39.222222
| 222
| 0.736544
|
6492c4dc92b0baf1a27e9fdfa951974c1f1294ca
| 560
|
asm
|
Assembly
|
oeis/104/A104583.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/104/A104583.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/104/A104583.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A104583: Triangle read by rows: T(i,j) is the (i,j)-entry (1 <= j <= i) of the product A*B of the matrices A = [1; 3,1; 5,3,1; 7,5,3,1;...]; B = [1; 1,2; 1,2,1; 1,2,1,2; ...] (both infinite lower triangular matrices).
; Submitted by Jon Maiga
; 1,4,2,9,8,1,16,18,4,2,25,32,9,8,1,36,50,16,18,4,2,49,72,25,32,9,8,1,64,98,36,50,16,18,4,2,81,128,49,72,25,32,9,8,1,100,162,64,98,36,50,16,18,4,2,121,200,81,128,49,72,25,32,9,8,1,144,242,100,162,64,98,36,50,16,18
lpb $0
add $1,1
sub $0,$1
lpe
sub $1,$0
mod $0,2
add $0,1
add $1,1
pow $1,2
mul $1,$0
mov $0,$1
| 35
| 219
| 0.596429
|
1910c5de3bf2f5caf409a2ba06f1fbb9538e6050
| 400
|
asm
|
Assembly
|
wof/lcs/base/2B4.asm
|
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
|
a4a0c86c200241494b3f1834cd0aef8dc02f7683
|
[
"Apache-2.0"
] | 6
|
2020-10-14T15:29:10.000Z
|
2022-02-12T18:58:54.000Z
|
wof/lcs/base/2B4.asm
|
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
|
a4a0c86c200241494b3f1834cd0aef8dc02f7683
|
[
"Apache-2.0"
] | null | null | null |
wof/lcs/base/2B4.asm
|
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
|
a4a0c86c200241494b3f1834cd0aef8dc02f7683
|
[
"Apache-2.0"
] | 1
|
2020-12-17T08:59:10.000Z
|
2020-12-17T08:59:10.000Z
|
copyright zengfr site:http://github.com/zengfr/romhack
002A5A bne $2a5e [base+294, base+2B4, base+2D4]
002A90 cmpi.b #$4, ($c,A4) [base+295, base+2B5, base+2D5]
002A96 bne $2a9a [base+294, base+2B4, base+2D4]
002C2C move.b D1, ($c,A4) [123p+ 29]
002C30 cmpi.b #$4, D1 [base+294, base+2B4, base+2D4]
01A74C dbra D7, $1a74a
copyright zengfr site:http://github.com/zengfr/romhack
| 36.363636
| 59
| 0.67
|
717ec4ca25a92eb845cfd3999bf482fa4ab5f336
| 985
|
asm
|
Assembly
|
programs/oeis/081/A081004.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/081/A081004.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/081/A081004.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A081004: a(n) = Fibonacci(4n+2) + 1, or Fibonacci(2n+2)*Lucas(2n).
; 2,9,56,378,2585,17712,121394,832041,5702888,39088170,267914297,1836311904,12586269026,86267571273,591286729880,4052739537882,27777890035289,190392490709136,1304969544928658,8944394323791465,61305790721611592,420196140727489674,2880067194370816121,19740274219868223168,135301852344706746050,927372692193078999177,6356306993006846248184,43566776258854844738106,298611126818977066918553,2046711111473984623691760,14028366653498915298923762,96151855463018422468774569,659034621587630041982498216,4517090495650391871408712938,30960598847965113057878492345,212207101440105399533740733472,1454489111232772683678306641954,9969216677189303386214405760201,68330027629092351019822533679448,468340976726457153752543329995930,3210056809456107725247980776292057,22002056689466296922983322104048464,150804340016807970735635273952047186
mul $0,2
mov $1,1
mov $2,2
lpb $0
sub $0,1
add $1,$2
add $2,$1
lpe
add $1,1
mov $0,$1
| 70.357143
| 822
| 0.881218
|
e10af53f4ee996e7f60cd6e48fc6be8ab59bbcb1
| 545
|
asm
|
Assembly
|
programs/oeis/079/A079057.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/079/A079057.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/079/A079057.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A079057: a(n)=sum(k=1,n,bigomega(tau(k))).
; 0,1,2,3,4,6,7,9,10,12,13,15,16,18,20,21,22,24,25,27,29,31,32,35,36,38,40,42,43,46,47,49,51,53,55,57,58,60,62,65,66,69,70,72,74,76,77,79,80,82,84,86,87,90,92,95,97,99,100,103,104,106,108,109,111,114,115,117,119,122,123,126,127,129,131,133,135,138,139,141,142,144,145,148,150,152,154,157,158,161,163,165,167,169,171,174,175,177,179,181
lpb $0
mov $2,$0
sub $0,1
seq $2,58061 ; Number of prime factors (counted with multiplicity) of d(n), the number of divisors of n.
add $1,$2
lpe
mov $0,$1
| 49.545455
| 335
| 0.67156
|
523806c1d641515c421f0d339c141c7be7acd303
| 145
|
asm
|
Assembly
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/NES_Ver2/us_asm/zel_int0.asm
|
prismotizm/gigaleak
|
d082854866186a05fec4e2fdf1def0199e7f3098
|
[
"MIT"
] | null | null | null |
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/NES_Ver2/us_asm/zel_int0.asm
|
prismotizm/gigaleak
|
d082854866186a05fec4e2fdf1def0199e7f3098
|
[
"MIT"
] | null | null | null |
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/NES_Ver2/us_asm/zel_int0.asm
|
prismotizm/gigaleak
|
d082854866186a05fec4e2fdf1def0199e7f3098
|
[
"MIT"
] | null | null | null |
Name: zel_int0.asm
Type: file
Size: 4887
Last-Modified: '2016-05-13T04:27:09Z'
SHA-1: 958ADDD6F2C52ACDFB91C5D11F90285E7C22238A
Description: null
| 20.714286
| 47
| 0.813793
|
3f5f8ded70a00bb1b46bb0f9a3f01731dff59217
| 1,004
|
asm
|
Assembly
|
PRG/levels/Fortress/3-F2A.asm
|
narfman0/smb3_pp1
|
38a58adafff67a403591e38875e9fae943a5fe76
|
[
"Unlicense"
] | null | null | null |
PRG/levels/Fortress/3-F2A.asm
|
narfman0/smb3_pp1
|
38a58adafff67a403591e38875e9fae943a5fe76
|
[
"Unlicense"
] | null | null | null |
PRG/levels/Fortress/3-F2A.asm
|
narfman0/smb3_pp1
|
38a58adafff67a403591e38875e9fae943a5fe76
|
[
"Unlicense"
] | null | null | null |
; Original address was $AB0B
; World 3 2nd Fortress parts 1 and 3
.word W3F2L ; Alternate level layout
.word W3F2O ; Alternate object layout
.byte LEVEL1_SIZE_06 | LEVEL1_YSTART_0F0
.byte LEVEL2_BGPAL_03 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18
.byte LEVEL3_TILESET_02 | LEVEL3_VSCROLL_LOCKED | LEVEL3_PIPENOTEXIT
.byte LEVEL4_BGBANK_INDEX(2) | LEVEL4_INITACT_NOTHING
.byte LEVEL5_BGM_FORTRESS | LEVEL5_TIME_300
.byte $19, $00, $E1, $5F, $4F, $00, $89, $0F, $0F, $00, $E1, $0F, $11, $00, $E2, $04
.byte $13, $07, $E5, $02, $34, $01, $D1, $16, $0A, $E0, $00, $17, $0A, $E0, $01, $18
.byte $0A, $E0, $02, $4F, $10, $89, $0F, $0F, $10, $E1, $0F, $14, $11, $02, $35, $1C
.byte $00, $4F, $20, $89, $0F, $0F, $20, $E1, $0F, $14, $25, $02, $34, $2E, $92, $17
.byte $28, $E0, $07, $18, $27, $E0, $08, $E2, $51, $02, $0F, $30, $E9, $0F, $6F, $40
.byte $3A, $1F, $0F, $40, $E0, $1F, $0F, $44, $E5, $0C, $16, $45, $62, $2F, $41, $D1
.byte $0F, $5F, $EB, $00, $14, $54, $E0, $00, $15, $5B, $E0, $00, $FF
| 55.777778
| 85
| 0.581673
|
4b82c0462dc1c026bdc43d554b051169a208c2f7
| 1,257
|
asm
|
Assembly
|
test/decoder/arm/fasmarm/arithmetic.asm
|
matanlurey/armv4t.dart
|
06235938d16cb1f2b09d26f564b985854e4155c0
|
[
"MIT"
] | 8
|
2020-06-21T22:05:00.000Z
|
2021-10-06T19:59:20.000Z
|
test/decoder/arm/fasmarm/arithmetic.asm
|
matanlurey/armv4t.dart
|
06235938d16cb1f2b09d26f564b985854e4155c0
|
[
"MIT"
] | 82
|
2020-06-21T22:02:00.000Z
|
2020-08-04T01:48:42.000Z
|
test/decoder/arm/fasmarm/arithmetic.asm
|
matanlurey/armv4t.dart
|
06235938d16cb1f2b09d26f564b985854e4155c0
|
[
"MIT"
] | 1
|
2020-06-22T15:16:02.000Z
|
2020-06-22T15:16:02.000Z
|
; ARM MODE.
code32
processor CPU32_V1
mov r0,1
mov r0,1,2
mov r0,r1
mov r0,r1,rrx
mov r0,r1,lsl 2
mov r0,r1,lsr 2
mov r0,r1,asr 2
mov r0,r1,ror 2
mov r0,r1,lsl r2
mov r0,r1,lsr r2
mov r0,r1,asr r2
mov r0,r1,ror r2
movs r0,1
movs r0,1,2
movs r0,r1
movs r0,r1,rrx
movs r0,r1,lsl 2
movs r0,r1,lsr 2
movs r0,r1,asr 2
movs r0,r1,ror 2
movs r0,r1,lsl r2
movs r0,r1,lsr r2
movs r0,r1,asr r2
movs r0,r1,ror r2
orr r0,1
orr r0,1,2
orr r0,r1
orr r0,r1,rrx
orr r0,r1,lsl 2
orr r0,r1,lsr 2
orr r0,r1,asr 2
orr r0,r1,ror 2
orr r0,r1,lsl r2
orr r0,r1,lsr r2
orr r0,r1,asr r2
orr r0,r1,ror r2
orr r0,r1,2
orr r0,r1,2,4
orr r0,r1,r2
orr r0,r1,r2,rrx
orr r0,r1,r2,lsl 3
orr r0,r1,r2,lsr 3
orr r0,r1,r2,asr 3
orr r0,r1,r2,ror 3
orr r0,r1,r2,lsl r3
orr r0,r1,r2,lsr r3
orr r0,r1,r2,asr r3
orr r0,r1,r2,ror r3
teq r0,1
teq r0,1,2
teq r0,r1
teq r0,r1,rrx
teq r0,r1,lsl 2
teq r0,r1,lsr 2
teq r0,r1,asr 2
teq r0,r1,ror 2
teq r0,r1,lsl r2
teq r0,r1,lsr r2
teq r0,r1,asr r2
teq r0,r1,ror r2
processor CPU32_26BIT
teqp r0,1
teqp r0,1,2
teqp r0,r1
teqp r0,r1,rrx
teqp r0,r1,lsl 2
teqp r0,r1,lsr 2
teqp r0,r1,asr 2
teqp r0,r1,ror 2
teqp r0,r1,lsl r2
teqp r0,r1,lsr r2
teqp r0,r1,asr r2
teqp r0,r1,ror r2
| 15.329268
| 21
| 0.660302
|
5dee76351ed061110048d58cc7d635d9d449a7a9
| 431
|
asm
|
Assembly
|
programs/oeis/138/A138430.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | 1
|
2021-03-15T11:38:20.000Z
|
2021-03-15T11:38:20.000Z
|
programs/oeis/138/A138430.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
programs/oeis/138/A138430.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
; A138430: (prime(n)^5 - prime(n))/30.
; 1,8,104,560,5368,12376,47328,82536,214544,683704,954304,2311464,3861872,4900280,7644832,13939848,23830808,28153208,45004168,60140976,69102384,102568544,131301352,186135312,286244672,350336680,386424688,467517240,512874648
cal $0,40 ; The prime numbers.
add $1,$0
mov $2,$0
mul $0,13
div $0,$1
sub $0,2
pow $1,5
sub $1,$2
mul $1,$0
div $1,22
sub $1,24
mul $1,2
add $1,32
div $1,30
add $1,1
| 22.684211
| 223
| 0.721578
|
3bdcd4242852264667cad079e0ea9cc9c57909ea
| 1,320
|
asm
|
Assembly
|
week_7/dataset/Assembly/056591.asm
|
Dumebi35/DumebiCSC102
|
56985f4852bc01c94dce2ee368c9612ad368f619
|
[
"MIT"
] | null | null | null |
week_7/dataset/Assembly/056591.asm
|
Dumebi35/DumebiCSC102
|
56985f4852bc01c94dce2ee368c9612ad368f619
|
[
"MIT"
] | null | null | null |
week_7/dataset/Assembly/056591.asm
|
Dumebi35/DumebiCSC102
|
56985f4852bc01c94dce2ee368c9612ad368f619
|
[
"MIT"
] | null | null | null |
; Write three short procedures that set the cursor size to
; (1) a solid block, (2) top line, and (3) normal size.
;
; Note: On a VGA display, the cursor can either be on top, on
; bottom, or a solid block. Therefore, the mid-height cursor
; mentioned in the Exercise 14 is not possible. This error
; was corrected in the second printing.
.model small
.stack 100h
.data
solidMsg db "Solid cursor: ",0
topMsg db "Top-line cursor: ",0
normalMsg db "Normal cursor: ",0
.code
include library.inc
main proc
mov ax,@data
mov ds,ax
call solid_cursor
call top_cursor
call default_cursor
mov ax,4C00h
int 21h
main endp
solid_cursor proc
mov dx,offset solidMsg
call Writestring
mov ah,1
mov ch,0
mov cl,7
int 10h
call getch
call Crlf
ret
solid_cursor endp
top_cursor proc
mov dx,offset topMsg
call Writestring
mov ah,1
mov ch,0
mov cl,1
int 10h
call getch
call Crlf
ret
top_cursor endp
default_cursor proc
mov dx,offset normalMsg
call Writestring
mov ah,1
mov ch,6
mov cl,7
int 10h
call getch
call Crlf
ret
default_cursor endp
getch proc
mov ah,1 ; wait for keystroke
int 21h
ret
getch endp
end main
| 19.130435
| 61
| 0.637121
|
286920e6b000a2efd541eef65b248449d29ab1d2
| 433
|
asm
|
Assembly
|
programs/oeis/287/A287394.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/287/A287394.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/287/A287394.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A287394: Domination number for camel's graph on a 2 X n board.
; 0,2,4,6,6,6,6,6,6,6,8,10,12,12,12,12,12,12,12,14,16,18,18,18,18,18,18,18,20,22,24,24,24,24,24,24,24,26,28,30,30,30,30,30,30,30,32,34,36,36,36,36,36,36,36,38,40,42,42,42,42,42,42,42,44,46,48,48,48,48,48,48,48,50,52,54,54,54,54,54,54,54,56,58,60,60,60,60,60,60,60,62,64,66,66,66,66,66,66,66
lpb $0
mov $2,$0
trn $0,9
min $2,3
add $1,$2
lpe
mul $1,2
mov $0,$1
| 36.083333
| 290
| 0.632794
|
ef1697ac5c25bc7d8c734b1648e2669b3a3ec1bf
| 684
|
asm
|
Assembly
|
oeis/054/A054413.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/054/A054413.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/054/A054413.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A054413: a(n) = 7*a(n-1) + a(n-2), with a(0)=1 and a(1)=7.
; Submitted by Christian Krause
; 1,7,50,357,2549,18200,129949,927843,6624850,47301793,337737401,2411463600,17217982601,122937341807,877779375250,6267392968557,44749530155149,319514104054600,2281348258537349,16288951913816043,116304011655249650,830417033500563593,5929223246159194801,42334979756614927200,302274081542463685201,2158253550553860723607,15410048935419488750450,110028596098490281976757,785610221624851462587749,5609300147472450520091000,40050711253932005103224749,285964278924996486242664243,2041800663728907408801874450
mov $3,1
lpb $0
sub $0,1
mov $2,$3
mul $3,7
add $3,$1
mov $1,$2
lpe
mov $0,$3
| 48.857143
| 501
| 0.824561
|
6abff7edd860f2590160e91d6d02b68c293372f6
| 6,649
|
asm
|
Assembly
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1641.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1641.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1641.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0xf20c, %r11
nop
nop
add %rdx, %rdx
mov (%r11), %rsi
nop
nop
nop
inc %r9
lea addresses_normal_ht+0x1cb0c, %r15
nop
nop
nop
cmp %r14, %r14
mov (%r15), %r8
nop
nop
xor %rsi, %rsi
lea addresses_D_ht+0x4fe9, %rsi
lea addresses_UC_ht+0x1ca96, %rdi
nop
nop
nop
nop
xor $63442, %r14
mov $34, %rcx
rep movsq
nop
nop
nop
nop
nop
add $23007, %rsi
lea addresses_A_ht+0x1bfcc, %rsi
nop
nop
nop
inc %rdx
mov $0x6162636465666768, %r8
movq %r8, %xmm2
vmovups %ymm2, (%rsi)
nop
add %r14, %r14
lea addresses_D_ht+0xe5c6, %r9
nop
nop
sub %r11, %r11
movb (%r9), %r15b
nop
nop
nop
nop
nop
and $40436, %rsi
lea addresses_WC_ht+0xb35c, %r15
add $30728, %r14
mov (%r15), %edi
and %r15, %r15
lea addresses_D_ht+0x3d0c, %rsi
lea addresses_UC_ht+0x1c80c, %rdi
nop
nop
nop
nop
nop
cmp $35152, %rdx
mov $70, %rcx
rep movsw
nop
nop
sub %r11, %r11
lea addresses_normal_ht+0x105c, %rsi
lea addresses_A_ht+0x9b0c, %rdi
nop
nop
nop
nop
add %rdx, %rdx
mov $40, %rcx
rep movsl
nop
nop
nop
nop
xor %rdx, %rdx
lea addresses_UC_ht+0x1c2d8, %rdi
xor %rsi, %rsi
movw $0x6162, (%rdi)
nop
nop
cmp $53793, %r14
lea addresses_WT_ht+0xcc4c, %r15
nop
nop
nop
sub $35889, %r14
and $0xffffffffffffffc0, %r15
movaps (%r15), %xmm0
vpextrq $0, %xmm0, %r8
nop
nop
nop
cmp $47755, %rdi
lea addresses_WC_ht+0x1050c, %rcx
nop
nop
nop
nop
and %r8, %r8
movl $0x61626364, (%rcx)
add %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r9
push %rax
push %rbp
push %rdi
push %rdx
// Faulty Load
lea addresses_A+0x11d0c, %rbp
cmp $34705, %rdx
mov (%rbp), %r9
lea oracles, %rdx
and $0xff, %r9
shlq $12, %r9
mov (%rdx,%r9,1), %r9
pop %rdx
pop %rdi
pop %rbp
pop %rax
pop %r9
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 7, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 1, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': True, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
| 36.938889
| 2,999
| 0.65664
|
88850f35b9b32f8164bf01ceaf39fe7e4d421735
| 384
|
asm
|
Assembly
|
data/mapObjects/CeladonChiefHouse.asm
|
AmateurPanda92/pokemon-rby-dx
|
f7ba1cc50b22d93ed176571e074a52d73360da93
|
[
"MIT"
] | 9
|
2020-07-12T19:44:21.000Z
|
2022-03-03T23:32:40.000Z
|
data/mapObjects/CeladonChiefHouse.asm
|
JStar-debug2020/pokemon-rby-dx
|
c2fdd8145d96683addbd8d9075f946a68d1527a1
|
[
"MIT"
] | 7
|
2020-07-16T10:48:52.000Z
|
2021-01-28T18:32:02.000Z
|
data/mapObjects/CeladonChiefHouse.asm
|
JStar-debug2020/pokemon-rby-dx
|
c2fdd8145d96683addbd8d9075f946a68d1527a1
|
[
"MIT"
] | 2
|
2021-03-28T18:33:43.000Z
|
2021-05-06T13:12:09.000Z
|
CeladonChiefHouse_Object:
db $f ; border block
db 2 ; warps
warp 2, 7, 11, -1
warp 3, 7, 11, -1
db 0 ; signs
db 3 ; objects
object SPRITE_OLD_PERSON, 4, 2, STAY, DOWN, 1 ; person
object SPRITE_ROCKET, 1, 4, WALK, 0, 2 ; person
object SPRITE_SAILOR, 5, 6, STAY, LEFT, 3 ; person
; warp-to
warp_to 2, 7, CELADON_CHIEF_HOUSE_WIDTH
warp_to 3, 7, CELADON_CHIEF_HOUSE_WIDTH
| 21.333333
| 55
| 0.690104
|
42651578e5575dbf98347a3709a10d83fea85635
| 455
|
asm
|
Assembly
|
programs/oeis/047/A047395.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/047/A047395.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/047/A047395.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A047395: Numbers that are congruent to {0, 2, 6} mod 8.
; 0,2,6,8,10,14,16,18,22,24,26,30,32,34,38,40,42,46,48,50,54,56,58,62,64,66,70,72,74,78,80,82,86,88,90,94,96,98,102,104,106,110,112,114,118,120,122,126,128,130,134,136,138,142,144,146,150,152,154,158,160,162,166,168,170,174,176,178,182,184,186,190,192,194,198,200,202,206,208,210,214,216,218,222,224,226,230,232,234,238,240,242,246,248,250,254,256,258,262,264
mul $0,4
add $0,1
div $0,3
mul $0,2
| 56.875
| 359
| 0.696703
|
07de23336bb18715954b29907da35daf61967d99
| 4,750
|
asm
|
Assembly
|
terminal/lib1.asm
|
dsarlis/8086
|
061bb646ef34e21005f6b12ee80f63000d251a68
|
[
"MIT"
] | 1
|
2020-04-09T11:49:54.000Z
|
2020-04-09T11:49:54.000Z
|
terminal/lib1.asm
|
dsarlis/8086
|
061bb646ef34e21005f6b12ee80f63000d251a68
|
[
"MIT"
] | null | null | null |
terminal/lib1.asm
|
dsarlis/8086
|
061bb646ef34e21005f6b12ee80f63000d251a68
|
[
"MIT"
] | null | null | null |
;**********************************************************
; PRINT_DEC
; INPUT: DX
; MODIFIED: AX
;**********************************************************
INCLUDE MACROS.TXT
PUBLIC PRINT_DEC
PUBLIC PRINT_HEX
PUBLIC SCAN_KEY
PUBLIC CALCULATE
STACK SEGMENT
DB 80 DUP(?)
STACK ENDS
CODE_SEG SEGMENT
ASSUME CS:CODE_SEG
PRINT_DEC PROC FAR
PUSH DX
PUSH CX
PUSH BX
MOV CX,0 ;upologismos twn BCD psifiwn kai
MOV AX,DX ;apothikeusi sti stoiba
SHL DX,1
JNC ADDR1
PRINT '-'
NEG AX
ADDR1:
MOV DX,0
MOV BX,10
DIV BX ;diairesi arithmou me 10
PUSH DX ;apothikeusi upoloipou sti stoiba
INC CX ;metritis psifiwn++
CMP AX,0 ;elegxos an uparxei allo psifio
JNZ ADDR1
ADDR5:
POP DX ;anagnwsi apo tin stoiba
ADD DX,30H ;upologismos ASCII kwdikou
PRINT DL ;ektupwsi antistoixou psifiou stin othoni
LOOP ADDR5
POP BX
POP CX
POP DX
RET
PRINT_DEC ENDP
;**********************************************************
; PRINT_HEX
; INPUT: DX
; MODIFIED: NONE
;**********************************************************
PRINT_HEX PROC FAR
PUSH DX ;apothikeusi kataxwritwn sti stoiba
PUSH CX
PUSH BX
PUSH BP
MOV BP,0
CMP DX,0
JNE LAB
PRINT '0'
JMP EX
LAB:
MOV BX,DX ;metafora arithmou ston BX
SHL DX,1
JNC POSITIVE
PRINT '-'
NEG BX
POSITIVE:
MOV CX,4 ;metritis psifiwn
ADDR2:
ROL BX,1 ;4 aristeres peristrofes wste ta 4 epomena bit
ROL BX,1 ;na erthoun stis 4 dexioteres theseis
ROL BX,1
ROL BX,1
MOV DX,BX
AND DX,000FH ;apomonwsi twn 4 LSB's
CMP DL,00
JNE CONT
CMP BP,0
JE NO_PRINT
CONT:
CMP DL,09 ;elegxos an einai psifio 0-9
JLE ADDR3 ;elegxos an einai gramma A-F
ADD DL,37H ;metatropi se ASCII
JMP ADDR4
ADDR3:
ADD DL,30H ;metatropi se ASCII gia psifio
ADDR4:
PRINT DL ;ektupwsi hex psifiou
MOV BP,1
NO_PRINT:
LOOP ADDR2
EX: POP BP
POP BX ;epanafora periexomenou kataxwritwn
POP CX
POP DX
RET
PRINT_HEX ENDP
;**********************************************************
; SCAN_KEYB
; INPUT: NONE
; MODIFIED: AX,DX
; OUTPUT: DX[NUM],AX[OPERATOR]
;
;**********************************************************
SCAN_KEY PROC FAR
PUSH SI
MOV CX,4 ;metritis psifiwn arithmou
MOV SI,0
IGNORE:
READ ;anagnwsi pliktrologiou
CMP AL,'Q' ;an einai 'Q' , termatismos
JE ADDRR2
CMP AL,'+' ;elegxos an einai '+'
JNE CHECK_MINUS ;an oxi elegxos an einai '-'
CMP CX,4 ;an einai '+'
JE IGNORE ;elegxoume an exei dothei pshfio
JMP HEL ;an oxi to agnooume alliws teleiwse h eisagwgh tou prwtou arithmou
CHECK_MINUS:
CMP AL,'-' ;elegxos an einai '-'
JNE CHECK_ENTER ;an oxi elegxos an einai enter
CMP CX,4 ;an einai meion elegxos an exei dothei pshfio
JE NEGAT ;an oxi pame na doume an einai to prwto meion wste na epitrepsoume arnhtikous arithmous
HEL:CMP BP,0
JNE IGNORE
PRINT AL
JMP ADDRR2
NEGAT:
CMP SI,0 ;an einai 0 tote einai to prwto meion kai to kratame
JNE IGNORE ;alliws to agnooume giati exoume parei hdh ena meion
PRINT AL
MOV SI,1 ;allazoume th shmaia meta to prwto meion
JMP IGNORE
CHECK_ENTER:
CMP AL,0DH ;elegxos gia enter
JNE CHECK_NUM ;an oxi tote pame ston elegxo an einai pshfio
CMP CX,4 ;an nai elegxoume an exei dothei toulaxiston ena pshfio alliws
JE IGNORE ;to agnooume
JMP ADDRR2
CHECK_NUM:
CMP AL,30H ;elegxos an einai pshfio
JL IGNORE
CMP AL,39H
JG IGNORE
CMP CX,0 ;an exoun dothei 4 pshfia
JE IGNORE ;agnooume ola ta ypoloipa
PRINT AL ;to typwnoume sthn othoni
SUB AL,30H
AND AX,000FH
PUSH AX ;kai to apothikeuoume ston DX
MOV AX,DX
MUL BX
MOV DX,AX
POP AX
ADD DX,AX
LOOP IGNORE
JMP IGNORE
ADDRR2:
CMP SI,0 ;an dothike arnhtikos arithmos
JE ADDRR3
NEG DX ;pairnoume to symplhrwma tou ws pros 2
ADDRR3:
POP SI
RET
SCAN_KEY ENDP
;**********************************************************
; CALCULATE
; INPUT: AX,BX,DX
; MODIFIED: BX,DX
; OUTPUT: DX
;
;**********************************************************
CALCULATE PROC FAR
CMP AL,'+' ;elegxos an einai prosthesi
JNE MINUS ;an oxi afairoume tous arithmous
ADD BX,DX ;alliws tous prosthetoume
JMP ADDRR1
MINUS:
SUB BX,DX
ADDRR1:
MOV DX,BX ;to apotelesma ston DX
RET
CALCULATE ENDP
CODE_SEG ENDS
END
| 23.75
| 102
| 0.559368
|
6e3e0aeb6e553ae299dcba01e65ce0096fd241fd
| 7,157
|
asm
|
Assembly
|
Transynther/x86/_processed/NC/_st_zr_4k_/i7-7700_9_0xca.log_19052_1861.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/NC/_st_zr_4k_/i7-7700_9_0xca.log_19052_1861.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/NC/_st_zr_4k_/i7-7700_9_0xca.log_19052_1861.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x8f43, %rdx
nop
nop
add $36054, %r9
mov $0x6162636465666768, %r13
movq %r13, %xmm5
movups %xmm5, (%rdx)
nop
and $21258, %r15
lea addresses_A_ht+0x7487, %r13
nop
nop
nop
nop
nop
sub $55077, %r8
mov (%r13), %r11w
nop
nop
nop
nop
nop
cmp $15981, %r11
lea addresses_WT_ht+0x18f43, %r9
nop
nop
nop
nop
sub $61033, %r15
mov (%r9), %r13w
nop
nop
nop
nop
cmp %rdx, %rdx
lea addresses_WT_ht+0x11c3, %r15
nop
nop
nop
nop
and %rdx, %rdx
movb (%r15), %r13b
nop
nop
add %r13, %r13
lea addresses_D_ht+0x5f43, %r11
nop
nop
xor $53857, %rdx
movups (%r11), %xmm4
vpextrq $1, %xmm4, %r8
nop
cmp %r9, %r9
lea addresses_A_ht+0x1aab3, %rsi
lea addresses_WC_ht+0x12743, %rdi
nop
nop
inc %r15
mov $61, %rcx
rep movsq
nop
nop
nop
nop
nop
dec %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %rax
push %rbp
push %rbx
push %rcx
push %rdx
// Store
lea addresses_D+0x10f43, %rbp
nop
nop
nop
nop
xor %rcx, %rcx
movb $0x51, (%rbp)
nop
nop
nop
nop
add %rbp, %rbp
// Store
mov $0x34d430000000b5b, %r13
nop
nop
dec %r14
mov $0x5152535455565758, %rbx
movq %rbx, %xmm1
movups %xmm1, (%r13)
nop
nop
nop
and $4717, %rcx
// Store
lea addresses_WC+0xff43, %rdx
cmp %rbp, %rbp
mov $0x5152535455565758, %r14
movq %r14, (%rdx)
nop
nop
nop
dec %rbx
// Store
lea addresses_PSE+0x18e63, %rax
nop
nop
and $12724, %rbp
movb $0x51, (%rax)
nop
nop
nop
nop
cmp %r14, %r14
// Store
lea addresses_A+0x10743, %rax
nop
cmp %rcx, %rcx
movl $0x51525354, (%rax)
add $6081, %rax
// Load
mov $0x63d9410000000303, %rbx
nop
and %rcx, %rcx
mov (%rbx), %dx
nop
nop
nop
nop
nop
xor $18952, %rbx
// Load
lea addresses_A+0xf343, %rcx
nop
nop
nop
nop
nop
sub %rax, %rax
vmovups (%rcx), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %rbp
and $43693, %rdx
// Faulty Load
mov $0x58be120000000743, %rax
nop
nop
cmp $38886, %rbx
movb (%rax), %r14b
lea oracles, %rax
and $0xff, %r14
shlq $12, %r14
mov (%rax,%r14,1), %r14
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_D'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_NC'}}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC'}}
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_PSE'}}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A'}}
{'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}}
{'00': 428, '54': 18624}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54
*/
| 32.238739
| 2,999
| 0.650692
|
9a9e09717acb01071a5e936fcd36faab8c04b564
| 7,487
|
asm
|
Assembly
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca.log_21829_1364.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca.log_21829_1364.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca.log_21829_1364.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r14
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x763c, %r13
nop
nop
nop
add %r12, %r12
mov (%r13), %r8d
nop
nop
nop
xor %rsi, %rsi
lea addresses_D_ht+0x1d1bc, %r12
nop
nop
nop
nop
nop
cmp %rdi, %rdi
movl $0x61626364, (%r12)
nop
nop
nop
nop
add $9570, %rdi
lea addresses_normal_ht+0xfe3c, %r8
nop
nop
nop
nop
dec %r14
mov $0x6162636465666768, %rsi
movq %rsi, %xmm4
movups %xmm4, (%r8)
nop
nop
cmp %r13, %r13
lea addresses_WT_ht+0x583c, %r12
nop
nop
nop
nop
dec %r8
mov $0x6162636465666768, %rbx
movq %rbx, %xmm1
vmovups %ymm1, (%r12)
nop
add $56041, %rbx
lea addresses_WT_ht+0x1d83c, %r14
nop
nop
nop
nop
nop
xor $40670, %rdi
mov $0x6162636465666768, %r12
movq %r12, %xmm0
vmovups %ymm0, (%r14)
nop
nop
nop
xor %r14, %r14
lea addresses_WC_ht+0x1bffc, %rsi
lea addresses_normal_ht+0x1903c, %rdi
nop
nop
sub $13389, %r14
mov $53, %rcx
rep movsl
nop
nop
nop
nop
and $33078, %rdi
lea addresses_UC_ht+0x8ca4, %rsi
lea addresses_A_ht+0xd43c, %rdi
nop
nop
nop
nop
nop
add $41506, %r14
mov $5, %rcx
rep movsw
nop
nop
and %rbx, %rbx
lea addresses_WT_ht+0x5ee0, %r8
nop
add %rsi, %rsi
mov (%r8), %bx
nop
nop
dec %r12
lea addresses_WC_ht+0x1063c, %r14
nop
nop
nop
nop
cmp $8992, %r8
mov (%r14), %r13
nop
nop
nop
nop
nop
inc %rdi
lea addresses_normal_ht+0xc3c, %rcx
nop
dec %rsi
mov $0x6162636465666768, %rbx
movq %rbx, (%rcx)
nop
add %rdi, %rdi
lea addresses_WT_ht+0x11b5e, %rbx
nop
nop
nop
nop
nop
sub %r12, %r12
movl $0x61626364, (%rbx)
nop
nop
nop
nop
nop
add %r13, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %r9
push %rax
push %rdi
// Store
lea addresses_normal+0x47bc, %r11
nop
nop
nop
nop
nop
cmp $42299, %r13
mov $0x5152535455565758, %r10
movq %r10, (%r11)
nop
nop
nop
nop
nop
dec %r10
// Load
lea addresses_PSE+0x11c3c, %r9
nop
nop
add %rax, %rax
movb (%r9), %r11b
nop
nop
nop
cmp $60249, %rax
// Store
lea addresses_WT+0xd73c, %r11
nop
nop
nop
dec %rdi
movw $0x5152, (%r11)
nop
nop
nop
nop
xor $34432, %rax
// Faulty Load
lea addresses_D+0x1543c, %rdi
nop
nop
cmp %rax, %rax
mov (%rdi), %r13
lea oracles, %r11
and $0xff, %r13
shlq $12, %r13
mov (%r11,%r13,1), %r13
pop %rdi
pop %rax
pop %r9
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': True, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WT', 'same': True, 'AVXalign': False, 'congruent': 8}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': True, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': True, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': True, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': True, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 31.06639
| 2,999
| 0.657406
|
30ed13e77718a5b12454b7402f664541ea765507
| 569
|
asm
|
Assembly
|
oeis/115/A115098.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/115/A115098.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/115/A115098.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A115098: a(0)=2, a(n)=3*a(n-1)-3.
; 2,3,6,15,42,123,366,1095,3282,9843,29526,88575,265722,797163,2391486,7174455,21523362,64570083,193710246,581130735,1743392202,5230176603,15690529806,47071589415,141214768242,423644304723,1270932914166,3812798742495,11438396227482,34315188682443,102945566047326,308836698141975,926510094425922,2779530283277763,8338590849833286,25015772549499855,75047317648499562,225141952945498683,675425858836496046,2026277576509488135,6078832729528464402,18236498188585393203,54709494565756179606
mov $1,3
pow $1,$0
div $1,2
add $1,2
mov $0,$1
| 63.222222
| 484
| 0.8471
|
89d42c29d90fe9ffe8aa42f25d0b2b6e9f5b6da5
| 8,479
|
nasm
|
Assembly
|
asmlib/system.nasm
|
fengjixuchui/napoca
|
ed26609ab9a3ea12d12882b311dcb332dc759d32
|
[
"Apache-2.0"
] | 170
|
2020-07-30T15:04:59.000Z
|
2022-03-24T10:59:29.000Z
|
asmlib/system.nasm
|
a-cristi/napoca
|
ed6691125bf703366581e47a1fe789167009c24a
|
[
"Apache-2.0"
] | 3
|
2020-08-10T09:16:56.000Z
|
2022-02-18T21:40:43.000Z
|
asmlib/system.nasm
|
a-cristi/napoca
|
ed6691125bf703366581e47a1fe789167009c24a
|
[
"Apache-2.0"
] | 44
|
2020-07-30T15:06:55.000Z
|
2022-02-25T08:55:55.000Z
|
;
; Copyright (c) 2020 Bitdefender
; SPDX-License-Identifier: Apache-2.0
;
%ifndef _SYSTEM_YASM_
%define _SYSTEM_YASM_
%include "macros.nasm"
%include "if.nasm"
%include "struct.nasm"
%ifdef DOC_FILE
system.nasm - Contains generic definitions of data types, data structures and macros for defining and interacting with hardware defined structures.
%endif
;
; generic constants
;
KILO equ 1024
MEGA equ KILO * KILO
GIGA equ KILO * MEGA
TERA equ KILO * GIGA
PAGE_SIZE equ 4096
PAGE_MASK equ (0xFFFFFFFF - 4095)
%idefine NULL 0
;
; system definitions
;
FLAT_DESCRIPTOR_CODE64 equ 0x002F9A000000FFFF ; Code: Execute/Read
FLAT_DESCRIPTOR_DATA64 equ 0x00CF92000000FFFF ; Data: Read/Write
FLAT_DESCRIPTOR_CODE32 equ 0x00CF9A000000FFFF ; Code: Execute/Read
FLAT_DESCRIPTOR_DATA32 equ 0x00CF92000000FFFF ; Data: Read/Write
FLAT_DESCRIPTOR_CODE16 equ 0x00009B000000FFFF ; Code: Execute/Read, accessed
FLAT_DESCRIPTOR_DATA16 equ 0x000093000000FFFF ; Data: Read/Write, accessed
RFLAGS_CF equ 1
RFLAGS_PF equ (1<<2)
RFLAGS_ZF equ (1<<6)
RFLAGS_SF equ (1<<7)
RFLAGS_TF equ (1<<8)
RFLAGS_IF equ (1<<9)
RFLAGS_DF equ (1<<10)
RFLAGS_OF equ (1<<11)
RFLAGS_IOPL equ (3<<12)
RFLAGS_NT equ (1<<14)
RFLAGS_RF equ (1<<16)
RFLAGS_VM equ (1<<17)
RFLAGS_ID equ (1<<21)
IA32_EFER equ 0xC0000080
IA32_EFER_LME equ 0x100
IA32_EFER_NXE equ 0x800
IA32_MISC_ENABLE equ 0x1A0
; paging access and rights for VA to PA translations
VA_PRESENT equ bit(0)
VA_WRITE_ACCESS equ bit(1)
VA_USER_ACCESS equ bit(2)
VA_WRITETHROUGH equ bit(3)
VA_CACHE_DISABLE equ bit(4)
VA_ACCESSED equ bit(5)
VA_DIRTY equ bit(6)
VA_PAGE_SIZE equ bit(7)
VA_GLOBAL equ bit(8)
VA_MASK equ 0x1FF
; CPUID bits
CPUID_LEAF_1_XSAVE_ENABLED equ 26
; MEM-MAP
MEM_TYPE_AVAILABLE equ 1 ; RAM usable by the operating system
MEM_TYPE_RESERVED equ 2 ; reserved by the system
MEM_TYPE_ACPI_RECLAIM equ 3 ; available RAM usable by the OS after it reads the ACPI tables
MEM_TYPE_ACPI_NVS equ 4 ; reserved, required to be saved and restored across an NVS sleep
MEM_TYPE_UNUSABLE equ 5 ; range must not be used by OSPM
MEM_TYPE_DISABLED equ 6 ; memory that is not enabled
MEM_ATTR_NON_VOLATILE equ 1 ; permananent memory, avoid use as RAM
MEM_ATTR_SLOW_ACCESS equ 2 ; may incur considerable latencies
MEM_ATTR_ERROR_LOG equ 3 ; memory used for logging hardware errors
_struc MEM_MAP_ENTRY_RAW
QWORD (BaseAddress)
QWORD (Length)
DWORD (Type) ; MEM_TYPE..
DWORD (Attributes) ; MEM_ATTR..
_endstruc
_struc MEM_MAP_ENTRY
;;;DWORD (StructureSize) ; how much space do the other fields occupy
QWORD (BaseAddress)
QWORD (Length)
DWORD (Type) ; MEM_TYPE..
DWORD (Attributes) ; MEM_ATTR..
_endstruc
; registers saved on stack by PUSHA
_struc PUSHA16
WORD (Di)
WORD (Si)
WORD (Bp)
WORD (Sp)
WORD (Bx)
WORD (Dx)
WORD (Cx)
WORD (Ax)
_endstruc
_struc PUSHA32
DWORD (Edi)
DWORD (Esi)
DWORD (Ebp)
DWORD (Esp)
DWORD (Ebx)
DWORD (Edx)
DWORD (Ecx)
DWORD (Eax)
_endstruc
_struc PUSHA64
QWORD (r15)
QWORD (r14)
QWORD (r13)
QWORD (r12)
QWORD (r11)
QWORD (r10)
QWORD (r9)
QWORD (r8)
QWORD (rsi)
QWORD (rdi)
QWORD (rdx)
QWORD (rcx)
QWORD (rbx)
QWORD (rax)
_endstruc
startenum 0, CR0
enumbit PE, MP, EM, TS, ET, NE
enumpos 16
enumbit WP
enumpos 18
enumbit AM
enumpos 29
enumbit NW, CD, PG
stopenum
startenum 0, XCR0
enumbit X87, SSE, AVX, BNDREG, BNDCSR, OPMASK, ZMM_HI256, HI16_ZMM
enumpos 9
enumbit PKRU
enumpos 11
enumbit CET_USER_STATE, CET_SUPERVISOR_STATE
enumbit XAAD
stopenum
startenum 0, CR4
enumbit VME, PVI, TSD, DE, PSE, PAE, MCE, PGE, PCE, OSFXSR, OSXMMEXCPT
enumpos 13
enumbit VMXE, SMXE
enumpos 16
enumbit FSGSBASE, PCIDE, OSXSAVE
enumpos 20
enumbit SMAP, PKE
stopenum
startenum 0, IA32_MISC_ENABLE
enumbit FAST_STRINGS
enumpos 3
enumbit AUTO_THERMAL_CONTROL
enumpos 7
enumbit PERF_MON
enumpos 16
enumbit ENHANCED_SPEEDSTEP
enumpos 18
enumbit MONITOR
enumpos 22
enumbit LIMIT_CPUID
enumpos 34
enumbit XD_DISABLE
stopenum
%ifdef DOC_METHOD
Pushes all x64 general purpose registers onto the stack
%endif
%macro pusha64 0
mpush rax,rbx,rcx,rdx,rdi,rsi,r8,r9,r10,r11,r12,r13,r14,r15
%endmacro
%ifdef DOC_METHOD
Pops all x64 general purpose registers from the stack
%endif
%macro popa64 0
mpop rax,rbx,rcx,rdx,rdi,rsi,r8,r9,r10,r11,r12,r13,r14,r15
%endmacro
%ifdef DOC_METHOD
CONFIGURE_IA32_MISC(set_mask, clear_mask) CONFIGURE_IA32_MISC Activate, Deactivate
%endif
%macro CONFIGURE_IA32_MISC 2
mov ecx, IA32_MISC_ENABLE
rdmsr
%if (%1 & 0xFFFFFFFF)
or eax, ((%1) & 0xFFFFFFFF)
%endif
%if (%1 >> 32)
or edx, ((%1) >> 32)
%endif
%if (%2 & 0xFFFFFFFF)
and eax, 0xFFFFFFFF - ((%2) & 0xFFFFFFFF)
%endif
%if (%2 >> 32)
and edx, 0xFFFFFFFF - ((%2) >> 32)
%endif
wrmsr
%endmacro
%ifdef DOC_METHOD
Enables IA32_EFER_NXE bit
Eax is 0 on error
Note: alters EAX, ECX, EDX and EFLAGS
%endif
%macro ENABLE_XD 0
mov eax, 0x80000001
cpuid
test edx, 0x00100000
if nz
mov ecx, IA32_EFER
rdmsr
or eax, IA32_EFER_NXE
wrmsr
mov al, 1
else
xor eax, eax
endif
%endmacro
%ifdef DOC_METHOD
Set CR0.PG bit
%endif
%macro ENABLE_PAGING 0 ;
mov eax, cr0
or eax, CR0.PG
mov cr0, eax
%endmacro
%ifdef DOC_METHOD
Clear CR0.PG bit
%endif
%macro DISABLE_PAGING 0
mov eax, cr0
and eax, 0xFFFFFFFF - CR0.PG
mov cr0, eax
%endmacro
%ifdef DOC_METHOD
Set CR4.PAE bit
%endif
%macro ENABLE_PAE 0
mov eax, cr4
or eax, CR4.PAE
mov cr4, eax
%endmacro
%ifdef DOC_METHOD
Clear CR4.PAE bit
%endif
%macro DISABLE_PAE 0
mov eax, cr4
and eax, 0xFFFFFFFF - CR4.PAE
mov cr4, eax
%endmacro
%ifdef DOC_METHOD
Set IA32_EFER_LME bit
%endif
%macro ENABLE_LME 0 ;
mov ecx, IA32_EFER ; Read EFER MSR
rdmsr
or eax, IA32_EFER_LME ; Set the LME bit in EFER
wrmsr
%endmacro
%ifdef DOC_METHOD
Clear IA32_EFER_LME bit
%endif
%macro DISABLE_LME 0 ;
mov ecx, IA32_EFER ; Read EFER MSR
rdmsr
and eax, ~IA32_EFER_LME ; clear the LME bit
wrmsr
%endmacro
%endif ; _SYSTEM_YASM_
| 28.076159
| 151
| 0.523057
|
1f9501f03e8a309bdf5642b1f89683e7e80ce5a7
| 668
|
asm
|
Assembly
|
oeis/237/A237617.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/237/A237617.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/237/A237617.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A237617: a(n) = n*(n + 1)*(17*n - 14)/6.
; Submitted by Jamie Morken(s1.)
; 0,1,20,74,180,355,616,980,1464,2085,2860,3806,4940,6279,7840,9640,11696,14025,16644,19570,22820,26411,30360,34684,39400,44525,50076,56070,62524,69455,76880,84816,93280,102289,111860,122010,132756,144115,156104,168740,182040,196021,210700,226094,242220,259095,276736,295160,314384,334425,355300,377026,399620,423099,447480,472780,499016,526205,554364,583510,613660,644831,677040,710304,744640,780065,816596,854250,893044,932995,974120,1016436,1059960,1104709,1150700,1197950,1246476,1296295,1347424
lpb $0
sub $0,1
add $2,$3
add $2,1
add $4,$2
add $1,$4
mov $3,16
lpe
mov $0,$1
| 47.714286
| 499
| 0.754491
|
089dc3ee9bbe8277c533eba99632f0cd220bb9db
| 757
|
asm
|
Assembly
|
8_kyu/Enumerable_Magic_3_Does_My_List_Include_This.asm
|
UlrichBerntien/Codewars-Katas
|
bbd025e67aa352d313564d3862db19fffa39f552
|
[
"MIT"
] | null | null | null |
8_kyu/Enumerable_Magic_3_Does_My_List_Include_This.asm
|
UlrichBerntien/Codewars-Katas
|
bbd025e67aa352d313564d3862db19fffa39f552
|
[
"MIT"
] | null | null | null |
8_kyu/Enumerable_Magic_3_Does_My_List_Include_This.asm
|
UlrichBerntien/Codewars-Katas
|
bbd025e67aa352d313564d3862db19fffa39f552
|
[
"MIT"
] | null | null | null |
SECTION .text
global include
; bool include(const int* arr, size_t size, int item)
; sizeof(int) = 4
; sizeof(size_t) = 8
; input:
; rdi - pointer to list of int
; rsi - number of elements in the list
; edx - value of int to seach
; output:
; rax - true if and only if edx is in the list
include:
test rdi, rdi
jz .false ; no array
test rsi, rsi
jz .false ; empty array, size = 0
.loop:
cmp edx,[rdi]
je .true ; value found
add rdi, 4 ; to next int
dec rsi ; counter
jnz .loop ; until all items comapred
.false
xor rax, rax ; empty or not found: return false
ret
.true
mov rax, 1 ; value found: return true
ret
| 25.233333
| 58
| 0.560106
|
5ea6550c2a700e5899ed0f57f5899adfea1343f1
| 9,080
|
asm
|
Assembly
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_541.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_541.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_541.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x22c0, %r15
nop
nop
nop
nop
nop
xor %rbx, %rbx
movups (%r15), %xmm3
vpextrq $0, %xmm3, %rax
nop
xor %rdx, %rdx
lea addresses_D_ht+0x1e165, %rsi
nop
nop
nop
nop
nop
cmp $39191, %r13
mov $0x6162636465666768, %r11
movq %r11, %xmm1
vmovups %ymm1, (%rsi)
nop
nop
and %rdx, %rdx
lea addresses_D_ht+0x2565, %rbx
nop
dec %rsi
mov (%rbx), %r13
nop
sub $54741, %rsi
lea addresses_normal_ht+0x16f65, %rdx
nop
nop
add %r15, %r15
mov $0x6162636465666768, %r13
movq %r13, (%rdx)
and $16808, %rsi
lea addresses_A_ht+0x15365, %rsi
lea addresses_UC_ht+0xfda5, %rdi
nop
nop
nop
xor $57749, %r13
mov $19, %rcx
rep movsb
nop
cmp %rdi, %rdi
lea addresses_normal_ht+0x16a85, %rbx
nop
nop
xor $31488, %r13
mov $0x6162636465666768, %rax
movq %rax, %xmm3
movups %xmm3, (%rbx)
nop
nop
nop
nop
nop
add %rbx, %rbx
lea addresses_UC_ht+0x1cb41, %rdx
nop
nop
lfence
mov (%rdx), %rcx
nop
nop
nop
nop
nop
add $38469, %rcx
lea addresses_WT_ht+0x142b9, %rcx
nop
nop
nop
nop
dec %rdx
movb (%rcx), %bl
nop
nop
nop
nop
and %rdx, %rdx
lea addresses_normal_ht+0x12565, %rbx
clflush (%rbx)
nop
nop
nop
nop
add %r13, %r13
vmovups (%rbx), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %rax
nop
nop
nop
cmp $1120, %r11
lea addresses_WC_ht+0x8b65, %rax
inc %r15
mov (%rax), %edx
nop
nop
nop
inc %r11
lea addresses_WC_ht+0xd65, %rsi
lea addresses_UC_ht+0x11971, %rdi
sub $64614, %r15
mov $80, %rcx
rep movsb
nop
nop
nop
nop
nop
and $43331, %rdi
lea addresses_UC_ht+0x1bc0b, %r11
nop
nop
nop
nop
cmp $3601, %rax
and $0xffffffffffffffc0, %r11
movaps (%r11), %xmm7
vpextrq $0, %xmm7, %rsi
nop
add $14638, %rbx
lea addresses_WT_ht+0x5565, %rsi
lea addresses_normal_ht+0x17fa5, %rdi
cmp %rbx, %rbx
mov $108, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $30575, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_PSE+0xc4a5, %rbx
nop
nop
nop
inc %r13
movl $0x51525354, (%rbx)
nop
nop
nop
nop
add %rbx, %rbx
// Store
lea addresses_D+0x1e965, %rdi
nop
nop
nop
cmp $8898, %r11
mov $0x5152535455565758, %r13
movq %r13, %xmm4
movups %xmm4, (%rdi)
dec %r10
// REPMOV
lea addresses_A+0xf3e5, %rsi
lea addresses_WC+0xaf65, %rdi
nop
nop
nop
nop
nop
xor %r15, %r15
mov $79, %rcx
rep movsb
dec %rdi
// Store
mov $0x525, %r11
nop
sub $64246, %rbx
mov $0x5152535455565758, %rsi
movq %rsi, (%r11)
dec %rbx
// Store
lea addresses_WT+0x1b178, %r11
nop
cmp %rsi, %rsi
movw $0x5152, (%r11)
nop
sub $65209, %r11
// Store
lea addresses_A+0xb065, %r11
cmp %r13, %r13
movb $0x51, (%r11)
nop
nop
nop
and $24042, %rdi
// Store
mov $0xbb9b0000000325, %rdi
clflush (%rdi)
nop
cmp $1213, %r11
movb $0x51, (%rdi)
nop
nop
add $63551, %rsi
// Faulty Load
lea addresses_PSE+0x1a565, %rdi
clflush (%rdi)
nop
and $45589, %r10
mov (%rdi), %ecx
lea oracles, %rbx
and $0xff, %rcx
shlq $12, %rcx
mov (%rbx,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_PSE', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_D', 'size': 16, 'AVXalign': False}}
{'src': {'type': 'addresses_A', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_P', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 2, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_A', 'size': 1, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_NC', 'size': 1, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False}}
{'src': {'same': True, 'congruent': 1, 'NT': False, 'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}}
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
| 30.989761
| 2,999
| 0.653524
|
9cafc2f36483e0161ede48fa76e35975078d8196
| 1,178
|
asm
|
Assembly
|
programs/oeis/138/A138402.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/138/A138402.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/138/A138402.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A138402: a(n) = (n-th prime)^4-(n-th prime)^2.
; 12,72,600,2352,14520,28392,83232,129960,279312,706440,922560,1872792,2824080,3416952,4877472,7887672,12113880,13842120,20146632,25406640,28392912,38943840,47451432,62734320,88519872,104050200,112540272,131068152,141146280,163034592,260128512,294482760,352256592,373281720,492862200,519862800,607548552,705885192,777768432,895715112,1026593640,1073250360,1330826880,1387450752,1506099672,1568199600,1982074920,2472923712,2655186312,2750006040,2947241232,3262751520,3373344480,3969063000,4362404352,4784281392,5236041960,5393507040,5887262712,6234760560,6414167832,7369964952,8882779752,9354855120,9597826992,10097938632,12003503160,12897804192,14498206872,14835361800,15527278272,16610183280,18140992032,19356739512,20632593240,21517516032,22897893720,24840439272,25856800800,27982765680,30821489160,31414194840,34506963360,35151937632,37141191120,38513473752,40642761600,43617695952,45164962920,45953853792,47562593832,52642943040,56248897392,58119807480,62001249000,64013301072,67122705480,73679945040,74817840312,85661875080
seq $0,6005 ; The odd prime numbers together with 1.
pow $0,2
max $0,4
bin $0,2
div $0,6
mul $0,12
| 117.8
| 1,028
| 0.865025
|
c00f48d548dc0b6f2d58131d945e782acc30ea5b
| 5,058
|
asm
|
Assembly
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_20985_1542.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_20985_1542.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2.log_20985_1542.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r8
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x5420, %r12
nop
nop
nop
add %r8, %r8
movl $0x61626364, (%r12)
sub $57762, %rdx
lea addresses_D_ht+0x5cb8, %rsi
lea addresses_A_ht+0x136de, %rdi
nop
sub $10994, %rax
mov $65, %rcx
rep movsl
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_WC_ht+0xf9d8, %r8
nop
nop
nop
add $50414, %rcx
mov (%r8), %rdx
nop
nop
nop
nop
cmp %rax, %rax
lea addresses_A_ht+0x1e9d8, %rsi
nop
nop
nop
nop
nop
and $17362, %rcx
mov (%rsi), %edi
nop
nop
nop
nop
nop
add $21169, %rax
lea addresses_normal_ht+0x1a908, %rcx
nop
dec %rdi
movb $0x61, (%rcx)
nop
nop
nop
sub %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %rax
push %rbp
push %rbx
push %rsi
// Faulty Load
lea addresses_D+0x75d8, %rsi
nop
nop
nop
nop
nop
cmp %rax, %rax
movaps (%rsi), %xmm5
vpextrq $0, %xmm5, %rbx
lea oracles, %rsi
and $0xff, %rbx
shlq $12, %rbx
mov (%rsi,%rbx,1), %rbx
pop %rsi
pop %rbx
pop %rbp
pop %rax
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'00': 20985}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 44.368421
| 2,999
| 0.658956
|
dc8bf86be9e2afa96d00ede74efefe4d0e462f28
| 4,845
|
asm
|
Assembly
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1028.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1028.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1028.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r15
push %r8
push %rax
push %rbx
push %rcx
push %rdx
lea addresses_WT_ht+0x179fd, %rcx
nop
nop
nop
nop
nop
add %rdx, %rdx
movb $0x61, (%rcx)
nop
nop
nop
nop
nop
inc %rbx
lea addresses_normal_ht+0x1b15d, %r15
nop
nop
nop
nop
nop
add %rdx, %rdx
movb (%r15), %al
nop
nop
inc %r8
lea addresses_WT_ht+0x53dd, %r8
nop
nop
nop
nop
inc %rcx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm4
vmovups %ymm4, (%r8)
nop
nop
nop
nop
cmp $10499, %r8
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %r8
push %r9
push %rbp
push %rdi
// Load
lea addresses_WC+0x9c9d, %r8
nop
nop
nop
nop
nop
sub $42727, %r9
movb (%r8), %r15b
nop
nop
nop
nop
inc %rbp
// Faulty Load
lea addresses_D+0x1b5d, %r13
nop
cmp %rdi, %rdi
vmovups (%r13), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %r8
lea oracles, %r15
and $0xff, %r8
shlq $12, %r8
mov (%r15,%r8,1), %r8
pop %rdi
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 8, 'size': 1, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 5, 'size': 32, 'same': False, 'NT': False}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 42.876106
| 2,999
| 0.659443
|
5c3cfcb2a631f5da109871c1e0d53f47da69c41a
| 112
|
asm
|
Assembly
|
Levels/LBZ/Misc Object Data/Anim - Unused Unknown 2.asm
|
NatsumiFox/AMPS-Sonic-3-Knuckles
|
af951b39f0ca103a905d7492448ac5245a2e8104
|
[
"Apache-2.0"
] | 5
|
2021-07-09T08:17:56.000Z
|
2022-02-27T19:57:47.000Z
|
Levels/LBZ/Misc Object Data/Anim - Unused Unknown 2.asm
|
NatsumiFox/AMPS-Sonic-3-Knuckles
|
af951b39f0ca103a905d7492448ac5245a2e8104
|
[
"Apache-2.0"
] | null | null | null |
Levels/LBZ/Misc Object Data/Anim - Unused Unknown 2.asm
|
NatsumiFox/AMPS-Sonic-3-Knuckles
|
af951b39f0ca103a905d7492448ac5245a2e8104
|
[
"Apache-2.0"
] | null | null | null |
dc.w byte_269F0-Ani_LBZUnusedUnknown_2
byte_269F0: dc.b $B, 0, 1, 2, 1, 0, 3, 4, 3, $FF
even
| 28
| 63
| 0.5625
|
6617068e521c1aedc7a6de5dbcd43929f820e507
| 6,266
|
asm
|
Assembly
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_628.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 9
|
2020-08-13T19:41:58.000Z
|
2022-03-30T12:22:51.000Z
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_628.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 1
|
2021-04-29T06:29:35.000Z
|
2021-05-13T21:02:30.000Z
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_628.asm
|
ljhsiun2/medusa
|
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
|
[
"MIT"
] | 3
|
2020-07-14T17:07:07.000Z
|
2022-03-21T01:12:22.000Z
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x3a2b, %r12
nop
nop
nop
nop
sub $58362, %rdx
mov (%r12), %ebx
add $374, %rdx
lea addresses_A_ht+0xecb, %r14
nop
nop
nop
add $28174, %rbp
mov $0x6162636465666768, %r10
movq %r10, (%r14)
nop
nop
xor %rdx, %rdx
lea addresses_UC_ht+0x1022b, %r10
sub %rax, %rax
movups (%r10), %xmm0
vpextrq $0, %xmm0, %rdx
nop
nop
nop
inc %r14
lea addresses_normal_ht+0x1aaeb, %rsi
lea addresses_WT_ht+0x19d5b, %rdi
nop
nop
nop
inc %r12
mov $109, %rcx
rep movsl
nop
nop
nop
nop
and $4364, %rsi
lea addresses_WT_ht+0x7a37, %r10
nop
nop
nop
and %rdx, %rdx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
vmovups %ymm3, (%r10)
nop
nop
nop
nop
nop
inc %r14
lea addresses_normal_ht+0x17e2b, %rsi
nop
inc %r14
mov (%rsi), %rdi
cmp %rax, %rax
lea addresses_normal_ht+0x1917b, %rsi
lea addresses_D_ht+0xdc84, %rdi
clflush (%rsi)
nop
nop
cmp %rdx, %rdx
mov $4, %rcx
rep movsb
nop
nop
nop
cmp $3878, %rbx
lea addresses_A_ht+0x1a9eb, %rsi
lea addresses_D_ht+0x2ab, %rdi
nop
nop
nop
nop
sub %rax, %rax
mov $7, %rcx
rep movsl
nop
nop
nop
and %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %r8
push %r9
push %rbx
push %rdi
// Load
lea addresses_D+0x11acb, %rbx
add $41012, %rdi
movb (%rbx), %r13b
nop
nop
nop
nop
nop
and $27000, %rbx
// Faulty Load
lea addresses_WC+0xa22b, %r15
nop
nop
nop
nop
and %r9, %r9
movups (%r15), %xmm2
vpextrq $0, %xmm2, %rbx
lea oracles, %r15
and $0xff, %rbx
shlq $12, %rbx
mov (%r15,%rbx,1), %rbx
pop %rdi
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_D_ht'}}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
| 37.297619
| 2,999
| 0.659113
|
cbf776d48f893ce3fbe5510ef5fc58dd9649c534
| 241
|
asm
|
Assembly
|
tests/t32.asm
|
mras0/sasm
|
342f57570e79b2aa1c42a9064aaea4d198577be2
|
[
"MIT"
] | 26
|
2019-08-13T19:54:42.000Z
|
2022-03-11T16:58:31.000Z
|
tests/t32.asm
|
mras0/sasm
|
342f57570e79b2aa1c42a9064aaea4d198577be2
|
[
"MIT"
] | null | null | null |
tests/t32.asm
|
mras0/sasm
|
342f57570e79b2aa1c42a9064aaea4d198577be2
|
[
"MIT"
] | 2
|
2019-08-20T10:23:56.000Z
|
2020-09-24T20:08:00.000Z
|
xchg ax, ax
xchg cx, ax
xchg dx, ax
xchg bx, ax
xchg sp, ax
xchg bp, ax
xchg si, ax
xchg di, ax
xchg ax, dx
test al, 0x12
test ax, 0x3456
| 17.214286
| 24
| 0.390041
|
7e88c797bca4bc0eb713ce4949505f84428756c5
| 3,361
|
asm
|
Assembly
|
source/float/fpparts.asm
|
paulscottrobson/mega65-basic
|
33c87e8b67f6c39b47286264976f6a63ab2673d6
|
[
"MIT"
] | null | null | null |
source/float/fpparts.asm
|
paulscottrobson/mega65-basic
|
33c87e8b67f6c39b47286264976f6a63ab2673d6
|
[
"MIT"
] | null | null | null |
source/float/fpparts.asm
|
paulscottrobson/mega65-basic
|
33c87e8b67f6c39b47286264976f6a63ab2673d6
|
[
"MIT"
] | null | null | null |
; *******************************************************************************************
; *******************************************************************************************
;
; Name : fpparts.asm
; Purpose : Get Fractional/Integer part of a float.
; Date : 15th August 2019
; Author : Paul Robson (paul@robsons.org.uk)
;
; *******************************************************************************************
; *******************************************************************************************
; *******************************************************************************************
;
; Get Fractional Part
;
; *******************************************************************************************
FPFractionalPart:
lda XS_Exponent,x ; if exponent $00-$7F then unchanged as fractional.
sec ; this flag tells us to keep the fractional part
bmi FPGetPart
rts
; *******************************************************************************************
;
; Get Integer Part
;
; *******************************************************************************************
FPIntegerPart:
lda XS_Exponent,x ; if exponent -ve then the result is zero (must be < 1.0)
clc ; this flag says keep the integer part.
bmi FPGetPart ; -ve exponents are 0..127
pha
lda #$40 ; set the Zero Flag
sta XS_Type,x
pla
rts
; *******************************************************************************************
;
; Get one part or the other
;
; *******************************************************************************************
FPGetPart:
pha
phy ; save Y
;
php ; save action
bit XS_Type,x ; if zero, return zero for int and frac
bvs _FPGP_Exit ; then do nothing.
;
lda #$FF ; set the mask long to -1
sta zLTemp1+0 ; this mask is applied to chop out the
sta zLTemp1+1 ; bits you would keep/lose if it was exponent 32.
sta zLTemp1+2
sta zLTemp1+3
;
lda XS_Exponent,x ; the number of shifts.
sec
sbc #128 ; is the exponent value-128
beq _FPGP_NoShift ; ... if any
cmp #32
bcc _FPGP_NotMax
lda #32 ; max of 32.
_FPGP_NotMax:
tay ; Y is the mask shift count.
_FPGP_ShiftMask:
#lsr32 zLTemp1 ; shift mask right that many times.
dey
bne _FPGP_ShiftMask
_FPGP_NoShift:
;
ldy #0 ; now mask each part in turn.
stx ExpTemp ; save X
_FPGP_MaskLoop:
lda zlTemp1,y ; get mask byte
plp ; if CC we keep the top part, so we
php ; flip the mask.
bcs _FPGP_NoFlip
eor #$FF
_FPGP_NoFlip:
and XS_Mantissa,x ; and into the mantissa.
sta XS_Mantissa,x
inx
iny
cpy #4 ; until done 32 bits.
bne _FPGP_MaskLoop
ldx ExpTemp ; restore X
;
plp
php ; get action flag on the stack
bcc _FPGP_NotFractional ; if fractional part always return +ve.
lda #0
sta XS_Type,x
_FPGP_NotFractional:
;
#iszero32x XS_Mantissa ; is the result zero
beq _FPGP_Zero ; if zero, return zero
;
jsr FPUNormalise
bra _FPGP_Exit ; and exit
;
_FPGP_Zero:
lda #$40 ; set zero flag
sta XS_Type,x
;
_FPGP_Exit:
pla ; throw saved action flag.
ply
pla
rts
| 28.974138
| 93
| 0.436775
|
990b2d1f22fc065f4fb9d2384c41c9a393ea8a32
| 4,336
|
asm
|
Assembly
|
apps/breakfast/pde_fw/toast/examples/Assembly (CCE)/msp430x24x_flashwrite_01.asm
|
tp-freeforall/breakfast
|
0399619cdb7a81b3c3cc4c5a1b7d69f5c32b8c65
|
[
"BSD-3-Clause"
] | 1
|
2020-05-15T18:08:48.000Z
|
2020-05-15T18:08:48.000Z
|
apps/breakfast/toast/msp430-code-examples/Assembly (CCE)/msp430x24x_flashwrite_01.asm
|
tp-freeforall/breakfast
|
0399619cdb7a81b3c3cc4c5a1b7d69f5c32b8c65
|
[
"BSD-3-Clause"
] | null | null | null |
apps/breakfast/toast/msp430-code-examples/Assembly (CCE)/msp430x24x_flashwrite_01.asm
|
tp-freeforall/breakfast
|
0399619cdb7a81b3c3cc4c5a1b7d69f5c32b8c65
|
[
"BSD-3-Clause"
] | null | null | null |
;*******************************************************************************
; MSP430x24x Demo - Flash In-System Programming, Copy SegC to SegD
;
; Description: This program first erases flash seg C, then it increments all
; values in seg C, then it erases seg C, then copies seg C to seg D.
; Seg C starts @ 0x1040 and Seg D starts @0x01000
; ACLK = n/a, MCLK = SMCLK = CALxxx_1MHZ = 1MHz
; //* Set Breakpoint in the Mainloop to avoid Stressing Flash *//
;
; MSP430F249
; -----------------
; /|\| XIN|-
; | | |
; --|RST XOUT|-
; | |
;
; JL Bile
; Texas Instruments Inc.
; May 2008
; Built Code Composer Essentials: v3 FET
;*******************************************************************************
.cdecls C,LIST, "msp430x24x.h"
;-------------------------------------------------------------------------------
value .equ R4
;-------------------------------------------------------------------------------
.text ; Program Start
;-------------------------------------------------------------------------------
RESET mov.w #0500h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
CheckCal cmp.b #0FFh,&CALBC1_1MHZ ; Calibration constants erased?
jeq Trap
cmp.b #0FFh,&CALDCO_1MHZ
jne Load
Trap jmp $ ; Trap CPU!!
Load mov.b &CALBC1_1MHZ,&BCSCTL1 ; Set DCO to 1MHz
mov.b &CALDCO_1MHZ,&DCOCTL ;
SetupFTG mov.w #FWKEY+FSSEL0+FN1,&FCTL2; Flash Timing generator = MCLK/3
clr.b value ; value = value to write to flash
;
Mainloop call #Write_SegC ; Copy value to segment C
inc.b value ;
call #CopyC2D ;
jmp Mainloop ; Repeat, SET BREAKPOINT HERE
;
;-------------------------------------------------------------------------------
Write_SegC ;Input = value, holds value to write to Seg C, R5 used as working reg
;-------------------------------------------------------------------------------
mov.w #01040h,R5 ;
Erase_SegC mov.w #FWKEY,&FCTL3 ; Lock = 0
mov.w #FWKEY+ERASE,&FCTL1 ; Erase bit = 1, allow interrupts
mov.w #0,&01040h ; Dummy write to SegC to erase
Prog_SegC mov.w #FWKEY+WRT,&FCTL1 ; Write bit = 1, block interrupts
Prog_L1 mov.b value,0(R5) ; Write value to flash
inc.w R5 ;
cmp.w #01080h,R5 ;
jne Prog_L1 ;
mov.w #FWKEY,&FCTL1 ; Write bit = 0
mov.w #FWKEY+LOCK,&FCTL3 ; Lock = 1
ret ;
;-------------------------------------------------------------------------------
CopyC2D ;Copy Seg C to Seg D, R5 used as working reg.
;-------------------------------------------------------------------------------
Erase_SegD mov.w #FWKEY,&FCTL3 ; Lock = 0
mov.w #FWKEY+ERASE,&FCTL1 ; Erase bit = 1
mov.w #0,&01000h ; Dummy write to SegD to erase
mov.w #01040h,R5 ; R5 = First byte in Seg C
Prog_SegD mov.w #FWKEY+WRT,&FCTL1 ; Write bit = 1, block interrupts
mov.w #FWKEY,&FCTL3 ; Lock = 0
Prog_L2 mov.b @R5+,-65(R5) ; Copy Seg C to Seg D
cmp.w #01080h,R5 ;
jne Prog_L2 ;
mov.w #FWKEY,&FCTL1 ; Write bit = 0
mov.w #FWKEY+LOCK,&FCTL3 ; Lock = 1
ret ;
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; POR, ext. Reset
.short RESET
.end
| 54.2
| 81
| 0.356089
|
d99fb17231ad50d95082f372e3b0fb4e327a7215
| 2,106
|
asm
|
Assembly
|
src/pletter.asm
|
fjpena/sword-of-ianna-msx2
|
f104f46a677e4b21f42fbed478307a0bb1d372f3
|
[
"Apache-2.0"
] | 43
|
2017-10-21T23:01:25.000Z
|
2022-02-21T17:45:11.000Z
|
src/pletter.asm
|
fjpena/sword-of-ianna-msx2
|
f104f46a677e4b21f42fbed478307a0bb1d372f3
|
[
"Apache-2.0"
] | null | null | null |
src/pletter.asm
|
fjpena/sword-of-ianna-msx2
|
f104f46a677e4b21f42fbed478307a0bb1d372f3
|
[
"Apache-2.0"
] | 6
|
2017-10-23T05:48:50.000Z
|
2022-01-06T03:11:49.000Z
|
;---------------------------------------------------------------------------
; Descompresión a VRAM por Manuel Pazos 2007
;---------------------------------------------------------------------------
uitpakmode EQU 1
unpackVRAM:
ld iy,.loop
ld a,128
exx
ld de,1
exx
.looplit
;ldi
di
ex af,af';'
ld a,d
rlca
rlca
and %11
out (#99),a ; VRAM address A14-A15
ld a,#80+14
out (#99),a ; VRAM access base address register
ld a,e
out (#99),a ; VRAM a0-7
ld a,d
and %00111111
or %01000000 ; Write
out (#99),a ; VRAM a8-13
ld a, (hl)
out (#98),a
inc hl
inc de
ex af,af' ;'
ei
.loop
add a,a
jp nz,.hup
ld a,(hl)
inc hl
rla
.hup
jr nc,.looplit
exx
ld l,e
ld h,d
.getlen
add a,a
call z,.getbyteexx
jr nc,.lenok
add a,a
call z,.getbyteexx
adc hl,hl
jp nc,.getlen
exx
ret
.lenok
inc hl
exx
ld c,(hl)
inc hl
ld b,0
if uitpakmode !=8
bit 7,c
jp z,.offsok
add a,a
call z,.getbyte
if uitpakmode !=9
rl b
add a,a
call z,.getbyte
if uitpakmode !=0
rl b
add a,a
call z,.getbyte
if uitpakmode !=1
rl b
add a,a
call z,.getbyte
if uitpakmode !=2
rl b
add a,a
call z,.getbyte
if uitpakmode !=3
rl b
add a,a
call z,.getbyte
endif
endif
endif
endif
endif
rl b
add a,a
call z,.getbyte
jr nc,.offsok
or a
inc b
res 7,c
.offsok
endif
inc bc
push hl
exx
push hl
exx
ld l,e
ld h,d
sbc hl,bc
pop bc
;ldir
di
push af
.repite
ld a,h
rlca
rlca
and %11
out (#99),a ; VRAM address A14-A15
ld a,#80+14
out (#99),a ; VRAM access base address register
ld a,l
out (#99),a ; VRAM a0-7
ld a,h
and %00111111 ; Read
out (#99),a ; VRAM a8-13
nop
nop
in a,(#98)
ex af,af' ;'
ld a,d
rlca
rlca
and %11
out (#99),a ; VRAM address A14-A15
ld a,#80+14
out (#99),a ; VRAM access base address register
ld a,e
out (#99),a ; VRAM a0-7
ld a,d
and %00111111
or %01000000 ; Write
out (#99),a ; VRAM a8-13
ex af,af' ;'
out (#98),a
inc hl
inc de
dec bc
ld a,b
or c
jp nz,.repite
pop af
ei
pop hl
jp (iy)
.getbyte
ld a,(hl)
inc hl
rla
ret
.getbyteexx
exx
ld a,(hl)
inc hl
exx
rla
ret
| 11.965909
| 76
| 0.564577
|
95951b09dc3ce022e8748b3fab768138e4dbd1c0
| 7,877
|
asm
|
Assembly
|
Asteroids/AsteroidsASM/softmath.asm
|
ragibson/FPGA-Asteroids
|
316fc6063791c43060809be4b802104f2f9ab13d
|
[
"MIT"
] | 5
|
2018-12-04T15:17:01.000Z
|
2021-04-02T16:13:18.000Z
|
Asteroids/AsteroidsASM/softmath.asm
|
ragibson/FPGA-Asteroids
|
316fc6063791c43060809be4b802104f2f9ab13d
|
[
"MIT"
] | null | null | null |
Asteroids/AsteroidsASM/softmath.asm
|
ragibson/FPGA-Asteroids
|
316fc6063791c43060809be4b802104f2f9ab13d
|
[
"MIT"
] | null | null | null |
# Implements fixed-point arithmetic with 6 bits for the decimal part and 10
# bits for the integer part (referred to as fp16_t).
#
# This effectively lets the game perform calculations on each pixel at the
# level of 64x64 subpixels.
#
# Integer and fixed-point multiplication/division are implemented in software.
#
# A lookup table for cosine is used to compute sine and cosine for fp16_t.
.data TABLE_START
# lookup table for cos(d), 0 <= d < 360 (values in fp16_t)
fpcos_table:
.word 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62,
62, 62, 61, 61, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57, 56,
55, 55, 54, 54, 53, 52, 52, 51, 50, 50, 49, 48, 48, 47, 46,
45, 44, 44, 43, 42, 41, 40, 39, 39, 38, 37, 36, 35, 34, 33,
32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18,
17, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 3, 2, 1,
0, -1, -2, -3, -4, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15,
-17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, -30, -31,
-32, -33, -34, -35, -36, -37, -38, -39, -39, -40, -41, -42, -43, -44, -44,
-45, -46, -47, -48, -48, -49, -50, -50, -51, -52, -52, -53, -54, -54, -55,
-55, -56, -57, -57, -58, -58, -58, -59, -59, -60, -60, -61, -61, -61, -62,
-62, -62, -62, -63, -63, -63, -63, -63, -64, -64, -64, -64, -64, -64, -64,
-64, -64, -64, -64, -64, -64, -64, -64, -63, -63, -63, -63, -63, -62, -62,
-62, -62, -61, -61, -61, -60, -60, -59, -59, -58, -58, -58, -57, -57, -56,
-55, -55, -54, -54, -53, -52, -52, -51, -50, -50, -49, -48, -48, -47, -46,
-45, -44, -44, -43, -42, -41, -40, -39, -39, -38, -37, -36, -35, -34, -33,
-32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18,
-17, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -4, -3, -2, -1,
0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 44,
45, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 54, 55,
55, 56, 57, 57, 58, 58, 58, 59, 59, 60, 60, 61, 61, 61, 62,
62, 62, 62, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64
.text
# Computes $v0 = ($a0 << FP_SHIFT_AMOUNT)
int_to_fp:
sll $v0, $a0, FP_SHIFT_AMOUNT
jr $ra
# Computes $v0 = ($a0 >> FP_SHIFT_AMOUNT)
fp_ipart:
srl $v0, $a0, FP_SHIFT_AMOUNT
jr $ra
# Computes $v0 = ($a0 & FP_FRAC_MASK)
fp_fpart:
andi $v0, $a0, FP_FRAC_MASK
jr $ra
# Computes $v0 = ($a0 * $a1), saves no registers, uses $t0-$t5
imult:
slt $t0, $a0, $0
slt $t1, $a1, $0
xor $t2, $t0, $t1 # neg_result = (a < 0) ^ (b < 0)
beq $t0, $0, skip_imult_negate_a # if (a < 0)
sub $a0, $0, $a0 # a = -a
skip_imult_negate_a:
beq $t1, $0, skip_imult_negate_b # if (b < 0)
sub $a1, $0, $a1 # b = -b
skip_imult_negate_b:
li $t3, 0 # res = 0
start_imult_while:
slt $t4, $0, $a1
beq $t4, $0, end_imult_while # while (b < 0)
andi $t5, $a1, 0x1
beq $t5, $0, skip_imult_add # if (b & 1)
add $t3, $t3, $a0 # res += a
skip_imult_add:
sll $a0, $a0, 1
sra $a1, $a1, 1
beq $0, $0, start_imult_while
end_imult_while:
beq $t2, $0, skip_neg_result # if (neg_result)
sub $t3, $0, $t3 # res = -res
skip_neg_result:
move $v0, $t3
jr $ra # return res
# Computes $v0 = ($a0 / $a1), saves no registers, uses $t0-$t5
idiv:
slt $t0, $a0, $0 # neg_result = a < 0
beq $t0, $0, skip_idiv_negate_a # if (neg_result)
sub $a0, $0, $a0 # a = -a
skip_idiv_negate_a:
li $t1, 1 # place = 1
li $t2, 0 # res = 0
start_idiv_while1:
slt $t3, $a0, $a1 # while (a >= b)
bne $t3, $0, end_idiv_while1
sll $t1, $t1, 1 # place <<= 1
sll $a1, $a1, 1 # b <<= 1
beq $0, $0, start_idiv_while1
end_idiv_while1:
start_idiv_while2:
slt $t4, $0, $t1
beq $t4, $0, end_idiv_while2 # while (place > 0)
slt $t5, $a0, $a1
bne $t5, $0, skip_idiv_sub # if (a >= b)
sub $a0, $a0, $a1 # a -= b
add $t2, $t2, $t1 # res += place
skip_idiv_sub:
sra $t1, $t1, 1 # place >>= 1
sra $a1, $a1, 1 # b >>= 1
beq $0, $0, start_idiv_while2
end_idiv_while2:
beq $t0, $0, skip_idiv_negate_res # if (neg_result)
sub $t2, $0, $t2 # res = -res
skip_idiv_negate_res:
move $v0, $t2
jr $ra # return res
# Computes "rounded" $v0 = (a >> FP_SHIFT_AMOUNT), saves no registers, uses $t0-$t1
round_fp_to_int:
sra $t0, $a0, FP_SHIFT_AMOUNT # res = a >> FP_SHIFT_AMOUNT
and $t1, $a0, FP_ROUND_MASK
beq $t1, $0, skip_round_increment # if (a & FP_ROUND_MASK)
addi $t0, $t0, 1 # res++
skip_round_increment:
move $v0, $t0
jr $ra # return res
# Computes $v0 = abs($a0), saves no registers, uses $t0
abs:
slt $t0, $a0, $0
beq $t0, $0, skip_abs_negate # if (a < 0)
sub $a0, $0, $a0 # a = -a
skip_abs_negate:
move $v0, $a0
jr $ra # return a
# Computes $v0 = imult($a0, $a1) >> FP_SHIFT_AMOUNT, saves $ra, uses $t0-$t5
fpmult:
addi $sp, $sp, -4
sw $ra, 0($sp)
jal imult
sra $v0, $v0, FP_SHIFT_AMOUNT
lw $ra, 0($sp)
addi $sp, $sp, 4
jr $ra # return imult(a, b) >> FP_SHIFT_AMOUNT
# Computes $v0 = idiv($a0 << FP_SHIFT_AMOUNT, $a1), saves $ra, uses $t0-$t5
fpdiv:
addi $sp, $sp, -4
sw $ra, 0($sp)
sll $a0, $a0, FP_SHIFT_AMOUNT # a <<= FP_SHIFT_AMOUNT
jal idiv
lw $ra, 0($sp)
addi $sp, $sp, 4
jr $ra # return idiv(a, b)
# Computes ($a0 % $a1), saves no registers, uses $t0-$t1
mod:
slt $t0, $a0, $a1
bne $t0, $0, skip_mod_sub # if (x >= m)
sub $a0, $a0, $a1 # x -= m
beq $0, $0, skip_mod_add
skip_mod_sub:
slt $t0, $a0, $0
beq $t0, $0, skip_mod_add # else if (x < 0)
add $a0, $a0, $a1 # x += m
skip_mod_add:
move $v0, $a0
jr $ra # return x
# Computes $v0 = cos($a0) ($a0 in degrees, result in fp16_t), saves $ra, uses $t0-$t1
fpcos:
addi $sp, $sp, -4
sw $ra, 0($sp)
jal round_fp_to_int # ideg = round_fp_to_int(degrees)
move $a0, $v0
li $a1, 360
jal mod # ideg %= 360
sll $v0, $v0, 2 # word-align array index
lw $v0, fpcos_table($v0)
lw $ra, 0($sp)
addi $sp, $sp, 4
jr $ra # return fpcos_table[ideg]
# Computes $v0 = sin($a0) ($a0 in degrees, result in fp16_t), saves $ra, uses $t0-$t1
fpsin:
addi $sp, $sp, -4
sw $ra, 0($sp)
subi $a0, $a0, FP_90_DEG # degrees -= INT_TO_FP(90)
jal fpcos
lw $ra, 0($sp)
addi $sp, $sp, 4
jr $ra # return fpcos(degrees)
| 37.870192
| 86
| 0.43938
|
cf73c07a93f716acad53dc525c2fa95c7892bfd4
| 686
|
asm
|
Assembly
|
oeis/254/A254641.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11
|
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/254/A254641.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9
|
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/254/A254641.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3
|
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A254641: Third partial sums of seventh powers (A001015).
; 1,131,2577,23723,141694,636426,2331462,7323954,20396871,51550213,120271151,262391493,540659756,1060489444,1992739932,3605846676,6310148349,10717864983,17722868317,28605158351,45165823626,69899222030,106210179010,158685165990,233427698595,338469587001,484271184411,684325419337,955882168088,1320811430664,1806625821176,2447685077992,3286607644089,4375916869611,5779952051433,7577077353651,9862224653398,12749809533266,16377062999934,20907825053402,26536849967551,33494677075629,42053124988743
lpb $0
mov $2,$0
sub $0,1
seq $2,250212 ; Second partial sums of seventh powers (A001015).
add $1,$2
lpe
add $1,1
mov $0,$1
| 57.166667
| 493
| 0.838192
|
5851dbf18e8dec4e95f5b9b93af50906e34d52b4
| 34,542
|
asm
|
Assembly
|
45/runtime/rt/iotty.asm
|
minblock/msdos
|
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
|
[
"Apache-2.0"
] | null | null | null |
45/runtime/rt/iotty.asm
|
minblock/msdos
|
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
|
[
"Apache-2.0"
] | null | null | null |
45/runtime/rt/iotty.asm
|
minblock/msdos
|
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
|
[
"Apache-2.0"
] | null | null | null |
TITLE IOTTY - Console driver for BASCOM-86
;***
; IOTTY - Console driver for BASCOM-86
;
; Copyright <C> 1986, Microsoft Corporation
;
;Purpose:
;
; BASIC Syntax mapping to included runtime entry points:
;
; - BEEP Statement:
;
; BEEP
; |
; B$BEEP
;
; - WIDTH Statement:
;
; WIDTH size
; |
; B$WIDT
;
;******************************************************************************
include switch.inc
INCLUDE rmacros.inc ; Runtime Macro Defintions
USESEG _DATA
USESEG _BSS
USESEG DV_TEXT
USESEG OI_TEXT
INCLUDE seg.inc
include baslibma.inc
include devdef.inc
include files.inc
include ascii.inc
INCLUDE const.inc
INCLUDE rtps.inc ; constants shared with QBI
sBegin _DATA
globalW b$pLHDALC_CPCT,Near_Ret,1
globalW b$pKYBD_OPEN,Near_Ret,1
globalW b$pSCRN_OPEN,Near_Ret,1
globalW b$pLPTECHO,LPTECHO,1 ; conditional vector to B$LPTECHO
externW b$CURSOR ; (1,1)-relative screen cursor
externB b$CSRX ; 1-relative x-coordinate cursor
externB b$LINCNT
externB b$WDOTOP
externB b$WDOBOT
externB b$KEY_SW
externW b$vKEYDSP ; vector for indirect call to B$KEYDSP
externB b$CRTWIDTH ; physical width of screen (40 or 80)
externB b$SCRNWIDTH ; logical width of SCRN:
externB b$IOFLAG ; Misc. IO flags. Defined in GWINI.ASM
staticB b$REDCSRX,01h ; 1-relative X-coordinate cursor for
; redirected output.
sEnd _DATA
sBegin _BSS
externW b$PTRFIL ;defined in GOSTOP.ASM
externB b$LPTFDB ; defined in GLOBAL.INC
externB b$FILMOD ; defined in GLOBAL.INC
globalB b$TTY_BAKCHR,?,1 ; <>0 <=> contains pushed char for TTY
staticB TWOBYT,?,1 ; <>0 means it contains the first half of a
; two-byte (not necessarily KANJI) character
staticB TEMPFLAG,?,1 ; temporary flag to store results of
; CHKCHAR
; equates for use with the results of CHKCHAR
SCN_CHR = 01h ; char should be printed on the screen
RED_CHR = 02h ; char should be printed to redirected file
LPR_CHR = 04h ; char should be echoed to line printer
sEnd _BSS
sBegin OI_TEXT
externNP B$ERR_IOE
sEnd OI_TEXT
assumes CS,DV_TEXT
sBegin DV_TEXT
; Run-time entries
PUBLIC B$D_KYBD
PUBLIC B$D_SCRN
PUBLIC B$TTY_BAKC
PUBLIC B$TTY_SINP
PUBLIC B$TTY_SOUT
PUBLIC B$TTY_GWID
PUBLIC B$TTY_BLKIN
PUBLIC B$TTY_BLKOUT
; Run-time externals
externNP B$ERR_FC
externNP B$SWIDTH
externNP B$SCROUT
externNP B$INFMAP ; OEM's mapping routine
externNP B$PRTMAP
externNP B$BLEEP
externNP B$USRCSR ; display user cursor
externNP B$SCNLOC ; update b$CURSOR and display user cursor
externNP B$TTYGetChar
externNP B$CLRSCN ; clear screen
externNP B$CRLF ; update cursor for scrolling
externNP B$FKYMAP
externNP B$SCROLL ; OEM scroll routine
externNP B$STDPUT
; Illegal Device Functions
KYBD_EOF EQU B$ERR_FC
KYBD_LOC EQU B$ERR_FC
KYBD_LOF EQU B$ERR_FC
KYBD_WIDTH EQU B$ERR_FC
KYBD_RANDIO EQU B$ERR_FC
KYBD_SOUT EQU B$ERR_FC
KYBD_GPOS EQU B$ERR_FC
KYBD_GWID EQU B$ERR_FC
KYBD_BLKIN EQU B$ERR_FC
KYBD_BLKOUT EQU B$ERR_FC
KYBD_DWID EQU B$ERR_FC
SCRN_EOF EQU B$ERR_FC
SCRN_LOC EQU B$ERR_FC
SCRN_LOF EQU B$ERR_FC
SCRN_RANDIO EQU B$ERR_FC
SCRN_BAKC EQU B$ERR_FC
SCRN_SINP EQU B$ERR_FC
SCRN_BLKIN EQU B$ERR_FC
SCRN_BLKOUT EQU B$ERR_FC
; Device Close Routines
SCRN_WIDTH EQU B$SCNSWD
SCRN_DWID EQU B$SCNSWD
;
; SCRN_DWID: ; set width for next open
; MOV b$SCRNWIDTH,DL ; set logical screen width
; RET
;
; Device Independent Console Interface
DSPMAC MACRO func
DW SCRN_&func
ENDM
B$D_SCRN:
DSPNAM
DSPMAC MACRO func
DW KYBD_&func
ENDM
B$D_KYBD:
DSPNAM
PAGE
devio PROC NEAR
KYBD_CLOSE:
SCRN_CLOSE:
JMP [b$pLHDALC_CPCT]
KYBD_OPEN:
JMP [b$pKYBD_OPEN]
SCRN_OPEN:
JMP [b$pSCRN_OPEN]
;***
;B$TTY_SINP,KYBD_SINP - Get a byte from the keyboard (non-redirectable)
;
;Purpose:
; Retreive a byte from the keyboard and return it to the user.
; This routine also alows a one character push back though
; the routine B$TTY_BAKC. If a character is not immediately
; ready, this routine will wait until one becomes available.
; There is no echoing of characters.
;
; Note that when supporting double byte characters, the low
; level routines will return two bytes of data. Since this routine
; will only return one byte, the second byte has to be saved. It
; is saved in the backup mechanism, which is extended to hold
; two bytes.
;
;Entry:
; None.
;
;Exit:
; AL = character
; PSW.C = clear (indicates character available)
;
;Uses:
; Per Convention
;
;Preserves:
; BX, CX, DX
;
;Exceptions:
; None.
;****
B$TTY_SINP:
KYBD_SINP:
XOR AL,AL ;Get a zero value
XCHG AL,[b$TTY_BAKCHR] ;Get the value of/zero out BACKUP flag/char
OR AL,AL ;Was there a character pushed back?
JNE NoDblCh ;Yes, return it.
keyin:
PUSH DX ; DX gets 2nd and 3rd of 3 byte codes
XOR DL,DL ;No ^BREAK checking
cCALL B$TTYGetChar ;And get the character
cCALL B$INFMAP ; OEM's mapping routine
POP DX
JZ keyin ; OEM filtered out the key - get the next
jnc NoDblCh ; BRIF not 2 byte char (kanji or scan)
call B$TTY_BAKC ; save second half of 2-byte code
mov al,ah ; Return first half
KYBD_Clr_Ret:
xor ah,ah ; Clear High order byte
NoDblCh:
CLC ;Clear carry
Near_Ret: ;Near return for vectors
RET
;***
;B$TTY_BAKC, KYBD_BAKC - Back up a byte for the keyboard
;
;Purpose:
; Push a single character "back into the keyboard" so that the
; next call to B$TTY_SINP will re-read it. There is room for
; only one byte of data.
;
; The value is stored in the variable [b$TTY_BAKCHR]. If this
; variable has a zero value, there is no character pushed back.
; If it is non-zero, the value is the byte that was pushed back.
;
; If Double Byte Characters are supported, then this routine is
; enhanced to be able to store two bytes of information. This is
; not to store a full character, but to store 1/2 of a character
; gotten from B$TTYIN and 1/2 of a charcter that was pushed back.
; In this case, b$TTY_BAKCHR is a word and has the following possible
; values:
; HIGH BYTE LOW BYTE MEANING
; undef 0 No bytes pushed back
; 0 non 0 One Byte (Low) pushed back
; non 0 non 0 Two Bytes pushed back
; (HI, then LOW)
;
;Entry:
; AL = byte to be saved
;
;Exit:
; None (state variables updated)
;
;Uses:
; Per Convention
;
;Preserves:
; AX, BX, CX, DX
;
;Exceptions:
; None.
;****
B$TTY_BAKC:
KYBD_BAKC:
MOV [b$TTY_BAKCHR],AL ;Save Char (non-zero value indicates char)
RET
SUBTTL B$TTY_SOUT and B$KanjiFlush
PAGE
; Support code for B$TTY_SOUT/SCRN_SOUT - - - code that has been pulled
; out of the "mainstream" code, so typical use of B$TTY_SOUT falls through
; all conditional jumps
SCND_BYTE: ;here if just got second of 2 bytes
;AX = two byte character
MOV TWOBYT,0 ;Clear TWOBYT flag
CMP AL,0FFH ;test if FFFF needs to be mapped
JNE SCNSO3 ;if not, just output both bytes
; AL = FF only if it is FFFF.
XOR AH,AH ;change FFFF to FF for output
JMP SHORT SCNSO3 ;jump to output the one byte
FIRST_BYTE:
;here if have the first byte of a two-byte char
MOV TWOBYT,AL ;save char for next time
POP AX
RET
CR_OUT:
;here if char received is a CR
MOV AH,0FFh ; carriage return is NEVER
JMP SHORT SCNOUT ; graphics character! (Prevents
; infinite recursion in CHWRAP)
SCNSO6:
;here if F_EDIT was non-zero, i.e., in INPUT mode
MOV AH,TWOBYT ;if 2nd of two bytes, first byte was
;0FFh, and was put in TWOBYT
OR AH,AH ;is this the second of two bytes?
JNZ SCND_BYTE ;brif so
CMP AL,255 ;first of two bytes?
JZ FIRST_BYTE ;brif so
JMP SHORT SCNSO3 ;back to mainstream
;***
; B$TTY_SOUT, SCRN_SOUT - send a character to the screen
;
;Purpose:
; Send a char to the screen. Handle 2-byte chars at this level.
; A two byte character is managed by calling this routine twice,
; once with the first byte and once with the second byte. After
; the second call, the two byte character will be processed.
;
; If we do not have FK_KANJI, then the only legal two byte
; characters are FFxx (Screen Editor Function Code) and then only
; if F_EDIT is true. Everything else must be a single byte. Note
; that 0x80 and 0xFE are codes to be printed, not part of multiple
; character sequences.
;
; If we do have FK_KANJI on, then we can also print any two byte
; character that has a first byte that is valid according to
; B$CKDBLC.
;
; Note that any control characters or double byte characters are
; sent through B$PRTMAP before printing. This may introduce
; a Screen Editor Function which will be resolved internally or
; it might indicate that there is no character to be printed.
;
;Input:
; [AL] == character to send to screen
;
;Output:
; NONE
;
;Modifies:
; F
;****
B$TTY_SOUT:
SCRN_SOUT:
PUSH AX
;
;If last char B$TTY_SOUT was called with was the 1st byte of a 2-byte char,
; B$TTY_SOUT saved it in TWOBYT so they will be both output as one 16-bit
; character. If we are not running with FK_KANJI, then the only possible
; 2-byte characters are FFxx (for function codes and special characters).
XOR AH,AH
;if not KANJI, can only be a non-zero value in
;TWOBYT if F_EDIT is TRUE - - - use this to
;reduce code executed in typical case.
TEST b$IOFLAG,F_EDIT ; in INPUT statement?
JNZ SCNSO6 ;brif in INPUT
SCNSO3: ;AH guaranteed 0 if single byte char
CMP AL,ASCCR ; Is this a carriage return?
JZ CR_OUT ; BRIF so
; Fall through into SCNOUT
;***
; SCNOUT - Output character
;
;Purpose:
; Output a character to one or more of three places: the screen, [13]
; redirected stdout, and the line printer. [13]
; For each char processed, checks to see which of the possible [13]
; destinations are to be written to. Handles chars requiring [13]
; mapping (???), and escape sequences. Only updates the screen [13]
; if there is a char to go to the screen. SCNOUT is recursively [13]
; called in order to output a destructive tab to the screen. [13]
;
;Input:
; [AL] == character
; [AH] == 0 if standard character, 0xFF if [AL] == <CR>
; IF FO_REDIRECT , RED_OUT is set if we're going to redirect stdout [13]
; b$PTRFIL == 0 if stdout is tty
; LPR_ECHO is set if we're going to echo to line printer [13]
; NOTE: Expects AX to be on stack, pops it back to AX at end
;
;Output:
; NONE
;
;Modifies:
; F
;****
SCNOUT:
PUSH DX
MOV DL,SCN_CHR ; assume only SCN_CHAR (speed)
TEST b$IOFLAG,RED_OUT OR LPR_ECHO ; Printer echo or redir out?
JZ SAV_FLGS ; brif not -- don't do slow checks
CALL CHKCHAR ; set RED_CHR, SCN_CHR and LPR_CHR flags
SAV_FLGS:
MOV TEMPFLAG,DL ; save flags in TEMPFLAG
MOV DX,b$CURSOR ; put b$CSRY in DL, b$CSRX in DH
TEST TEMPFLAG,RED_CHR ; Is output redirected?
JNZ REDOUT ; BRIF redirection of output
REDOUT_RETURN:
; Do control char logic
; Input:
; [AX] == control character
; [DH] == Current screen column position
; [DL] == Current screen row position
; Jumps to CTLDSX if AX=valid character to output, else
; Jumps to SCNOTC_XIT if AX is undefined, and not to be printed to screen
; Map the given character to a new character. This is where we take
; our internal representation of a character and turn it into something
; useful. If after mapping the character it contains a screen editor
; function implement the function at this point.
;
; Note that if we are in the screen editor (GWLIN.ASM), we have already
; done the mapping (using EDTMAP instead of PRTMAP). We know to avoid
; the mapping because F_EDIT was set in __bIOFLAG.
OR AH,AH ;test if two-byte character
JNZ CALL_PRTMAP1 ;[12] jump to map the character
CMP AL,31 ; is this a CTL character?
JBE CALL_PRTMAP2 ;[12] branch if so
CTLDSX: ; end of CTLDSP
; PUTSCR - Now print the char to the screen
; [AX] == character to put to screen
; [DX] == prospective destination char. (cursor) position
TEST TEMPFLAG,SCN_CHR ; print char on screen?
JZ SCNOTC_XIT ; brif not
;Force CR if char in AX won't fit
PUSH AX ; save char
CALL B$CHKLASTCOL ; DH past last column of screen?
JBE NO_WRAP ; brif not -- no wrap required
CALL B$SCNCRLF ; output a CR/LF (updates DX)
NO_WRAP:
CALL B$SCROUT ; Send char in AX to BIOS at DX posn
INC DH ; increment cursor location
CALL B$UPDATE_CSR ; update cursor variables, and display
POP AX ; restore char
SCNOTC_XIT:
TEST TEMPFLAG,LPR_CHR ; Is printer echo wanted?
JNE SCNOTLE ; Brif want to echo
SCNOTLE_RETURN:
POP DX ; end of SCNOUT
POP AX ;NOTE: caller must push AX ...
RET ; end of B$TTY_SOUT
REDOUT:
; Here if char to go to redirected file. Map and output char to stdout.
PUSH BX ;save across next two calls
CALL REDMAP ; do redirection mapping
CALL PUTSTD ; Put char to stdout (if char exists)
POP BX
JMP SHORT REDOUT_RETURN ; Jump back to main code sequence
SCNOTLE:
;here if want to echo to line printer
CMP AX,0FF0DH ;test if code for CR
JNE SCNOTLE_NO_CR ;if not, then jump
XOR AH,AH ;make one-byte char for printer
SCNOTLE_NO_CR:
CALL [b$pLPTECHO] ;Echo to line printer if necessary
JMP SHORT SCNOTLE_RETURN
CTLDP1_1:
;here if function key display mode
CMP AH,1 ; Set PSW.C if two byte character
CMC
cCALL B$FKYMAP ; Map function key display character
JMP SHORT CTLEDT
CALL_PRTMAP2:
;here if character in AL is <= 31d
TEST b$IOFLAG,F_KDSP ; Test for function key display mode
JNZ CTLDP1_1 ; BRIF function key display mode
CALL_PRTMAP1:
;here if we don't have a normal char, i.e., it must be mapped
TEST b$IOFLAG,F_EDIT ; Test for Screen Edit mode
JNZ CTLPRN ; BRIF edit mode
CMP AH,1 ; Set PSW.C if one byte character
CMC ; Set PSW.C if two byte character
cCALL B$PRTMAP ; Map print function/output character codes
CTLEDT: JZ SCNOTC_XIT ; Ignore this character
; Print or perform the editor function
CTLPRN:
CMP AH,255 ; Is it an editor function (&HFF)?
JE NOT_CTLDSX ;if so, then jump around
JMP CTLDSX ;if not, near jump
NOT_CTLDSX:
XOR AH,AH ; Clear (no longer needed) editor function flag
CMP AL,177O ; Delete function?
JNZ CTLNDL ; BRIF not DEL
MOV AL," " ; DEL code
CTLNDL: CMP AL,255 ;++Compiler ignores 0FFh
JZ SCNOTC_XIT ; BRIF "mark line for deletion" - don't print
CMP AL," "+1 ; Test for legal function code
JNB CTLEND
TEST TEMPFLAG,SCN_CHR; screen char?
JZ CTLEND ; brif not -- don't process control char
PUSH AX
; get proper index into FUNTAB -- asumes AL in range [0..31]
SUB AL,7 ; adjust so ascii [7..13] = [0..6]
CMP AL,6 ; ascii chars [7..13]?
JBE TBL_ADJ ; brif so -- table entry = [0..6]
SUB AL,14 ; adjust so ascii [28..31] = [7..10]
CMP AL,7 ; < ascii char 28?
JL CTLIGN ; brif so -- don't process char
CMP AL,10 ; ascii chars [28..31]?
JG CTLIGN ; brif not -- don't process char
TBL_ADJ:
PUSH BX
PUSH CX
ADD AX,AX ; Two bytes per entry
XCHG BX,AX
MOV AX,OFFSET CS:CTLDPX
PUSH AX ; Put CTLPDX: as return address on stack
CLC
JMP WORD PTR CS:FUNTAB[BX] ; Go do control routine
;All control chars come here after processing
; Update b$CURSOR, display new cursor, restore registers, return
CTLDPX:
CALL B$SCNLOC ; update B$CURSOR and display user cursor
POP CX
POP BX
CTLIGN:
POP AX
CTLEND: JMP SCNOTC_XIT ; do not to print this char to screen
;--------------------------------------------------------------------------
; Control character processing routines.
; All routines will return to CTLDPX.
;-- END SUBROUTINE SCNOUT
PAGE
SUBTTL Control Character processing
;CONTROL CHARACTER DISPATCH TABLE
;--
;Interpreter supports more control characters than compiler.
; Dispatch address Action (compiler ignores some) [13]
FUNTAB:
DW OFFSET B$BLEEP ; ^G - Beep
DW 0 ; unused position
DW OFFSET LTAB ; ^I - Destructive tab
DW OFFSET B$SCNCRLF ; ^J - Linefeed outputs CR/LF.
DW OFFSET WHOME ; ^K - Home within window
DW OFFSET CCLRSN ; ^L - Clear window, home cursor
DW OFFSET B$SCNCRLF ; ^M - carriage return
DW OFFSET WCSADV ; ^\ - Cursor advance within window
DW OFFSET WCSREG ; ^] - Cursor regress within window
DW OFFSET WCSUP ; ^^ - Cursor up within window
DW OFFSET WCSDWN ; ^_ - Cursor down within window
;***
;LPTECHO
;Purpose:
; Echo to the line printer.
; Added with revision [32].
;Entry:
; [AX] = character code
;Exit:
; none
;Modifies:
; None ([AX-DX] is preserved)
;****
cProc LPTECHO,<NEAR>,<AX,BX,CX,DX> ; preserve the world
cBegin
EchoAnother:
PUSH AX ;store byte in stack
MOV DX,SP ;[DS:DX] points to data to be output
.ERRE ID_SSEQDS ;assumes DS=SS
MOV BX,0004H ;file handle for stdprn
MOV CX,1 ;[CX] = # of bytes to be written
MOV AH,40H ;write operation
INT 21H ;do the write
POP AX ;even stack and restore AX
JNC LPTECHOExit ;jump if no error on write
JMP B$ERR_IOE ;give generic Device I/O Error
LPTECHOExit:
CMP AL,ASCCR ; just printed a CR?
MOV AL,ASCLF ; Assume so -- then we want a LF, too
JE EchoAnother ; brif CR -- add a Line feed
cEnd
;***
; PUTSTD - Put character to redirected standard output.
;
; Purpose:
; Writes a char to redirected stdout. If given character is a <cr>, [13]
; put out an <lf> also, as stdout needs one. Adjust the redirected [13]
; file cursor position (used to do line wrapping) appropriately. [13]
;
; Entry: [BX] = character (or zero)
; Exit: none
; Modifies:
; F, AX
;****
PUTSTD:
OR BX,BX ; Test to see if character exists
JZ PUTSTDX ; BRIF not
MOV AX,BX ; place char in AX as well
CMP AX,0AH ; about to output an <lf>?
je PUT_CR_FIRST ; brif <lf> to put a <cr> first
PUTSTD2:
CLC ;PWS.C reset indicates a 1 byte character
CALL B$STDPUT ; Write the character
MOV AX,BX ; restore character into AX
CMP AL,9 ; ASCII code < 9 (HT)?
JB INC_CSR ; brif if so -- increment cursor.
JE TAB_CHAR ; brif HT
CMP AL,0DH ; <lf>,<vt>,<ff>,<cr> ?
JE PUT_LF_TOO ; brif <cr> to put an <lf> too
JBE RESET_CSR ; brif <LF>,<VT>, or <FF>
INC_CSR:
INC b$REDCSRX ; increment redirected file cursor
PUTSTDX:
RET
PUT_CR_FIRST: ;here if we're about to put out an lf
MOV AX,0DH ; output a <cr> first
CLC ;Writing a single byte
CALL B$STDPUT ; write it out
MOV AX,0AH ; restore <lf>
JMP SHORT PUTSTD2
PUT_LF_TOO: ;here if we've just sent a <cr> to stdout and
;need to put in an <lf> now
MOV AX,0Ah ;put <lf> in AX
CLC ;Writing a single byte
CALL B$STDPUT ; write it out, and reset cursor position
RESET_CSR:
XOR AX,AX ; reset redirected file cursor to 1 for
JMP SHORT TAB_DONE ; <LF>,<VT>,<FF>,<CR>
TAB_CHAR: ; adjust cursor when TAB printed
MOV AL,b$REDCSRX ; load redirected file cursor (1-relative)
ADD AL,8 ; move to next modulo-8 position.
AND AL,0F8H
TAB_DONE:
INC AX ; make it 1-relative
MOV b$REDCSRX,AL ; store redirected file cursor
RET ; and return from PUTSTD
;***
; B$CHKLASTCOL -- check for last column on screen. Added with revision [19]
;
;Purpose:
; Sets flags according to whether DH is [<,=,>] the last printable
; screen location.
;
;Entry:
; DH = 1-relative screen column
;Exit:
; Flags set as if CMP DH,LAST_POS was done.
;Uses:
; None
;Preserves:
; All
;Exceptions:
; None
;
;******************************************************************************
cProc B$CHKLASTCOL,<PUBLIC,NEAR>
cBegin
CMP b$PTRFIL,0 ; Test if TTY (=0) or SCRN: (>0)
JE CHK_PHYS ; If TTY then check physical width
CMP DH,b$SCRNWIDTH ; Test if over logical (SCRN:) width
JAE CHK_EXIT ; Brif if greater than or equal
CHK_PHYS:
CMP DH,b$CRTWIDTH ; Check for last physical column
CHK_EXIT:
cEnd
;***
; B$UPDATE_CSR -- Update cursor after a screen write.
; Added with revision [19]
;
;Purpose:
; Updates the high-level cursor position, and displays the user
; cursor at the appropriate place. If we have just printed into
; the last column of the screen, the cursor is NOT displayed at
; the first position of the next line. Instead, it is backed up
; on top of the character just written.
;
;Entry:
; DX = new cursor position
;Exit:
; b$CURSOR updated
;
; DX = position at which cursor was displayed
;Uses:
; None
;Preserves:
; All
;Exceptions:
; None
;
;******************************************************************************
cProc B$UPDATE_CSR,<PUBLIC,NEAR>
cBegin
MOV b$CURSOR,DX ; update logical cursor b$CURSOR
CALL B$CHKLASTCOL ; past last column?
JBE NO_DEC ; brif not
DEC DH ; back up one position to display cursor
NO_DEC:
JMP B$USRCSR ; Redisplay user cursor and return
cEnd <nogen>
;***
; CHKCHAR -- Sets fields of DL to facilitate complicated checks. Added with
; revision [13].
;
; Purpose:
; Decide whether a character should be printed on the screen, to the
; redirected file, and/or to the printer, according to the following chart:
;
;------------------------------------------------------------------------
; | | | | INPUT statement |
; Redirection | FKEY | SCRN: | CONS: | with edits | without edits |
;---------------|-------|-------|-------|---------------|---------------|
; No redirection| S | S,P | S,P | S | S,P |
; Red OUT | --- | S,P | F | S | F,P |
; Red INP | S | S,P | S,P | S | S,P |
; Red INP & OUT | --- | S,P | F | --- | F |
;------------------------------------------------------------------------
;
; S = print char to screen
; P = print char to printer
; F = print char to redirected output
;
; Function key display when F_KDSP.
; Printing to SCRN: when b$PTRFIL <> 0.
; INPUT statement with user edits when IN_INPUT.
; INPUT statement without user edits when
; (F_EDIT and NOT IN_INPUT).
; Printing to CONS: at all other times.
;
;
; Algorithm summary:
;
; Char should be printed to redirected file (RED_CHR) if:
; RED_OUT and NOT (SCRN: or IN_INPUT or F_KDSP)
;
; Character should be printed to the screen (SCN_CHR) if:
; SCRN: or NOT RED_OUT or (NOT RED_INP and IN_INPUT)
;
; Character should be echoed to the printer (LPR_CHR) if:
; LPR_ECHO and NOT F_KDSP and NOT IN_INPUT and
; (SCRN: or NOT RED_OUT or
; (RED_OUT and NOT IN_INPUT and F_EDIT))
; Input:
; b$PTRFIL set correctly.
; Exit:
; SCN_CHR, RED_CHR, and LPR_CHR fields of DL set correctly.
; Modifies:
; DX, F
;****
cProc CHKCHAR,<NEAR>,<AX>
cBegin
XOR DX,DX ; initially all flags are false
MOV AL,b$IOFLAG ; keep b$IOFLAG in AL
TEST AL,RED_OUT ; is output redirected?
JZ SCN_CHAR ; brif not -- screen char
CMP b$PTRFIL,DX ; Test if TTY (=0) or SCRN: (>0)
JNZ SCN_CHAR ; brif SCRN: -- screen char
TEST AL,F_KDSP OR IN_INPUT ; function key display or
; INPUT statement?
JNZ CHK_SCN ; brif so -- not a redir char
OR DL,RED_CHR ; set bit to indicate redir char
JMP SHORT CHK_LPR ; skip check for screen char
CHK_SCN: ; RED_OUT = TRUE here
TEST AL,RED_INP ; redirected input?
JNZ CHK_LPR ; brif so -- not screen char
TEST AL,IN_INPUT ; INPUT statement?
JZ CHK_LPR ; brif not -- not screen char
SCN_CHAR:
OR DL,SCN_CHR ; set bit to indicate screen char
CHK_LPR:
TEST AL,LPR_ECHO ; printer echo wanted?
JZ CHKCHAR_EXIT ; brif not -- not a printer char
TEST AL,F_KDSP OR IN_INPUT ; function key display or IN_INPUT?
JNZ CHKCHAR_EXIT ; brif so -- not a printer char
CMP b$PTRFIL,0 ; Test if TTY (=0) or SCRN: (>0)
JNZ LPR_CHAR ; brif SCRN: -- printer char
TEST AL,RED_OUT ; redirected output?
JZ LPR_CHAR ; brif not -- printer char
AND AL,RED_INP OR F_EDIT ; redisplaying line and not
CMP AL,F_EDIT ; redirected input ?
JNZ CHKCHAR_EXIT ; brif not -- not a printer char
LPR_CHAR:
OR DL,LPR_CHR ; set bit to indicate printer char
CHKCHAR_EXIT:
cEnd
;***
; REDMAP - Map character for redirected std. output file
;
; Purpose:
; Given a character to be printed to redirected stdout, return
; the mapped character in BX or 0 character should be ignored.
; Input:
; [AX] = unmapped control character for screen
; Output:
; [BX] = mapped char for std output (0 if it should be ignored)
; may be a 1- or a 2-byte character
; Modifies:
; F
;****
REDMAP: PUSH AX
XOR BX,BX ;Assume no character for standard output
CMP AH,1 ;Set PSW.C for two byte character
CMC
cCALL B$PRTMAP ; Map as if a print statement
JZ REDMAX ;No character to print
MOV BX,AX ;Assume character will be used as mapped
JNB REDMAX ;Print character as mapped
CMP AH,255D ;Test for control character
JNZ REDMAX ;Must be KANJI or other FK_KANJI
XOR BH,BH ;Map to single byte char
REDMAX:
POP AX
RET
PAGE
SUBTTL CONTROL CHARACTER ROUTINES - Beep, form feed, home, backspace, tab.
;***
; B$BEEP - BEEP stmt
;
; Purpose:
; Runtime Entry Point.
; beep the speaker
; Input:
; NONE
; Output:
; NONE
; Modifies:
; NONE
;****
cProc B$BEEP,<PUBLIC,FAR>
cBegin
cCALL B$BLEEP
cEnd
;Clear the screen
CCLRSN:
MOV AL,2 ; specify text only
CALL B$CLRSCN ; OEM supplied Clear-Screen Routine
CALL [b$vKEYDSP] ; clear or output status line
; fall into WHOME
;***
; WHOME - Home the text cursor [36]
; Public equivalent B$WHOME moved into gwini.asm with revision [36].
; Note: These 2 routines (WHONE & B$WHOME) must be kept in sync!
;
; Input:
; b$WDOTOP set
; Output:
; [DL] == home row of cursor
; [DH] == home column of cursor
; Modifies:
; NONE
;****
WHOME: ; moved public version to gwini.asm
MOV DL,b$WDOTOP
MOV DH,1
SHORT_RET: ; label to jump to for a RET
RET
; LTAB - Destructive TAB to modulo 8 column
LTAB:
MOV AX,OFFSET CODE:LTAB_RET ;push the return address first
PUSH AX ;and then the letter value...
MOV AX,0020h ;Blank out chars
PUSH AX ;NOTE: SCNOUT pops AX, but doesn't push it -
; this is for B$TTY_SOUT speed
JMP SCNOUT ;jump with stack set up
LTAB_RET:
MOV DX,b$CURSOR ; put b$CSRY in DL, b$CSRX in DH
DEC DH ;TAB stops at 8th column, 16th, ...
TEST DH,7
JNZ LTAB ;More spacing to next column
INC DH
RET ;New position set on exit.
PAGE
SUBTTL CONTROL CHARACTER ROUTINES
;***
; B$SCNCRLF -- Output a CR/LF to the screen. Re-written with [19].
;
;Purpose:
; This code is used for either <CR> or <LF>.
; This routine may find that erasing function key line,scrolling
; whole screen and redisplaying function key line, is faster than
; scrolling 1-24.
;
;Entry:
; DX = present cursor position
;
;Exit:
; DX = new cursor position
; Screen possibly scrolled
;Uses:
; None
;Preserves:
; AX,BX,CX
;Exceptions:
; None
;
;******************************************************************************
cProc B$SCNCRLF,<NEAR>
cBegin
CALL B$CRLF ; adjust DX if necessary
JNZ SHORT_RET ; if no need to scroll, just return
JMP B$SCROLL ; scroll screen and return
cEnd <nogen>
PAGE
SUBTTL CONTROL CHARACTER ROUTINES - Function key display and advance
;B$LABELK - If function key display is off then turn on and exit.
; If function key display is on then advance display line and
; redisplay.
;ENTRY - DX = cursor position
;EXIT - None [13]
;USES - None [13]
PUBLIC B$LABELK ;Can be called by $RDLIN directly.
B$LABELK:
NOT b$KEY_SW ; toggle function key display switch
JMP [b$vKEYDSP] ; Display function keys
PAGE
SUBTTL CONTROL CHARACTER ROUTINES - Cursor movement by character and line
; The control character routines are entered with DH=current column and
; DL=current line. They return updated posn in the same registers. They
; can modify AX, BX, CX but must save any other registers used.
;***
; WCSADV, WCSREG, WCSUP, WCSDWN - cursor control
;
; Purpose:
; CURSOR CONTROL
; The cursor control routines allow moving the cursor right (and left)
; with wraparound to following (or previous) line unless it is at the
; very bottom (or top) of the screen. Attempts to move the cursor up
; from the top line of the screen or to move the cursor down from the
; bottom line on the screen are ignored.
;
; Inputs:
; [DL] == current line
; [DH] == current column
; Outputs:
; updated line position in DL
; updated column position in DH
;
; These routines return CF=1 when they do not change the posn.
; Modify:
; AL
;****
;Cursor right within window
WCSADV:
INC DH ; Next column
CALL B$CHKLASTCOL ; past last valid column?
JBE CSRRET ; BRIF Good value
CSRADV_DOWN:
DEC DH
CALL WCSDWN
JB CSRRET ; BRIF can't change physical lines
MOV DH,1 ;First column
CSRRET:
RET ; update position and redisplay cursor
;Cursor left within window(or within physical line if outside window)
WCSREG:
DEC DH ; Previous column
JNZ CSRRET ; BRIF good value (1 or greater)
INC DH ; Restore column
CALL WCSUP
JB CSRRET ; BRIF can't change physical lines
; fall into B$GETLASTCOL
B$GETLASTCOL: ; DH = last column (anybody need this FN?)
MOV DH,BYTE PTR b$CRTWIDTH ; Last column of physical screen
CMP b$PTRFIL,0 ; Test if TTY (=0) or SCRN: (>0)
JE CSRRET ; If TTY, then jump to redisplay cursor
CMP b$SCRNWIDTH,255 ; Check for infinite width
JE CSRRET ; If so, then use b$CRTWIDTH, redisplay
MOV DH,b$SCRNWIDTH ; Else use logical width
RET ; return and redisplay cursor
;Cursor up within window(or NOP if outside window)
WCSUP:
CMP b$WDOBOT,DL
JB CSRRET ; BRIF outside of window
CMP DL,b$WDOTOP
JB CSRRET
STC
JZ CSRRET ; BRIF at top or outside of window
CLC
DEC DX
RET ; return and redisplay cursor
;Cursor down within window(or NOP if outside window)
WCSDWN:
CMP DL,b$WDOTOP
JB CSRRET ; BRIF outside window
CMP b$WDOBOT,DL
JB CSRRET ; BRIF at bottom or outside of window
STC
JZ CSRRET
CLC
INC_DX:
INC DX ; Next line
RET ; return and redisplay cursor
;***
; B$TTY_GPOS, B$SCRN_GPOS - return screen position
;
; Input:
; b$CSRX contains current cursor position on screen
; or b$REDCSRX contains the current redirected file position [13]
; Output:
; [AH] == screen position
; Modifies:
; F
;****
labelNP <PUBLIC,B$TTY_GPOS>
TEST b$IOFLAG,RED_OUT ; redirected output?
MOV AH,b$REDCSRX ; return redirected file position
JNZ GPOS_RET ; brif so -- return redir file cursor
labelNP <PUBLIC,B$SCRN_GPOS>
SCRN_GPOS:
MOV AH,b$CSRX ; return screen cursor position
GPOS_RET:
DEC AH ; return 0-relative value
RET
;***
; B$TTY_GWID, SCRN_GWID - return screen width
;
; Input:
; b$CRTWIDTH contains current tty width
; b$SCRNWIDTH contains current SCRN: width
; Output:
; [AH] == screen width
; Modifies:
; NONE
;****
B$TTY_GWID:
MOV AH,b$CRTWIDTH ; (AH) = physical screen width
RET
SCRN_GWID:
MOV AH,b$SCRNWIDTH ; (AH) = logical screen width
RET
PAGE
;***
; B$TTY_BLKIN - block input
; NOT IMPLENTED --DMA support for BLOAD
; Entry [bx] = offset of destination
; [cx] = maximum number of bytes to read
; [dx] = DS of destination
; [di] -> device number
; [si] -> FDB of file to be loaded
; exit ? (This routine is provided to allow the user
; to trash himself beyond all recognition!
; Exit [bx] = 1 past last byte read
; CF set if EOF encountered
;****
B$TTY_BLKIN: ;fall into B$ERR_FC jump
;***
; B$TTY_BLKOUT - block output
; NOT IMPLEMENTED --DMA support for BSAVE
; Entry [bx] = offset of source
; [cx] = maximum number of bytes to write
; [dx] = DS of source
; [di] = device number
; [si] -> FDB of file to be loaded
; Exit [bx] = 1 past last byte written
; CF set if insufficient space
;****
B$TTY_BLKOUT:
width_error: jmp B$ERR_FC
devio ENDP
;
; Moved here from GWINI with [41]
;
;***
;B$SCNSWD - set screen width (called by WIDTH"scrn:",n)
;
;Purpose:
; Sets the width of the SCRN: device to the specified amount.
;
;Entry:
; DL = new width
;
;Exit
; b$SCRNWIDTH (logical width) set
; physical screen width possibly changed (if 80 or 40 columns specified)
;
;Uses:
; Per convention
;****
cProc B$SCNSWD,<NEAR>
cBegin
XCHG AX,DX ;keep width in AL
DEC AX ;map [1-255] to [0-254]
CMP AX,254 ;in range [0-254]?
JA WIDTH_ERROR ;brif not -- illegal function call error
INC AX ;restore width from entry
CMP AL,255 ;infinite width?
JZ SCNWD2 ;Brif so
SCNWD1:
CMP AL,b$CRTWIDTH ;new width different from physical?
JE SCNWD2 ;brif not
PUSH AX ;save logical width
MOV CL,B$LINCNT ;pass Height in CL
cCALL B$SWIDTH ;Let OEM call B$SCNSWI if legal
;if OEM didn't like it, b$CRTWIDTH unchanged
POP AX ;restore logical width
CMP AL,b$CRTWIDTH ;Test if logical < physical width
JB SCNWD2 ;If so, then use given width
MOV AL,b$CRTWIDTH ;Get physical width
SCNWD2:
MOV b$SCRNWIDTH,AL ;set the SCRN: logical screen width
cEnd
;
;Merged in B$SCNWID from GWINI.ASM
;
;***
;B$WIDT - WIDTH wid,hgt statement
;
;Purpose:
; Runtime Entry Point.
; Set the WIDTH for the screen
;
;Input:
; wid - requested width (-1 if default)
; height - requested height (-1 if default)
;
;Output:
; None
;
;Uses:
; Per Convention
;
;Exceptions:
; NONE
;****
cProc B$WIDT,<PUBLIC,FAR>
parmW wid
parmW height
cBegin
MOV BX,wid ;get width
MOV DX,height ;get height
CMP DX,-1 ;Is height specified?
JNE H_Specified ; Yes:
MOV DL,B$LINCNT ; No: set to full screen
XOR DH,DH
H_Specified:
OR DH,DH ;Height < 256?
JNZ width_error
CMP BX,-1 ; Is Width specified?
JNE W_Specified ; Yes:
MOV BL,b$CRTWIDTH ; No: set to full screen
XOR BH,BH ; Make Hi-Byte zero
W_specified:
OR BH,BH ;Width < 256?
JNZ width_error
CMP BL,b$CRTWIDTH ; Test if physical width changed
JNE SCNWID0 ;Yes:
CMP DL,B$LINCNT ; Has height changed?
JE SCNRET ; wrong jump sense
;Yes: call B$SWIDTH to set $CRTWID if legal.
SCNWID0: ;if either changed, go set hardware.
PUSH CX ;If width has changed, set hardware
PUSH AX
XCHG AX,BX ; pass Width in AL
XCHG CX,DX ; pass Height in CL
CALL B$SWIDTH ;Let OEM call B$SCNSWI if legal
JB WIDTH_ERROR ;OEM didn't like it.
POP AX
POP CX
SCNRET:
cEnd
;***
; B$IfScrnDev - Check if current device printing to screen.
;
; Purpose:
; Used by QB4 to determine if they have to do debug screen swapping.
; Added with [20].
;
; Returns true if the current I/O device is TTY, SCRN:, CONS:,
; or a console I/O DOS file.
;
; Note: This routine MUST preserve ES and CANNOT cause heap movement.
; Entry:
; b$PTRFIL set correctly.
; Exit:
; AX = 0 if no screen output possible
; AX = -1 if screen output possible
; Modifies:
; BX,CX
; Preserves:
; DX,ES
; Exceptions:
; None
;****
cProc B$IfScrnDev,<PUBLIC,FAR>
cBegin
XOR AX,AX ; assume no screen output
MOV BX,b$PTRFIL ; pointer to current file/device
OR BX,BX ; TTY?
JZ ScrnDevice ; brif so -- screen device
MOV CL,[BX].FD_DEVICE ; AX = device number
XOR CH,CH ; clear high byte
JCXZ DiskFile ; brif disk file
CMP CL,DN_SCRN ; SCRN:?
JE ScrnDevice ; brif so -- screen device
CMP CL,DN_CONS ; CONS:?
JE ScrnDevice ; brif so -- screen device
JMP SHORT NoScrnDevice ; otherwise, not a screen device
DiskFile:
TEST [BX].FD_FLAGS,FL_CONOUT+FL_CONINP ; console I/O?
JZ NoScrnDevice ; brif not -- not a screen device
ScrnDevice:
DEC AX ; AX = -1 ==> screen output
NoScrnDevice:
cEnd
sEnd DV_TEXT
END
| 25.893553
| 79
| 0.692664
|
224c7dea5260d8ac8a60a16980d96ac0cc171abd
| 464
|
asm
|
Assembly
|
programs/oeis/173/A173661.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/173/A173661.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/173/A173661.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A173661: Logarithmic derivative of the squares of the Fibonacci numbers (A007598, with offset).
; 1,7,16,47,121,322,841,2207,5776,15127,39601,103682,271441,710647,1860496,4870847,12752041,33385282,87403801,228826127,599074576,1568397607,4106118241,10749957122,28143753121,73681302247,192900153616,505019158607
add $0,1
mov $2,$0
seq $0,240926 ; a(n) = 2 + L(2*n) = 2 + A005248(n), n >= 0, with the Lucas numbers (A000032).
gcd $2,2
mul $2,2
add $0,$2
sub $0,6
| 42.181818
| 213
| 0.743534
|
ff8df9d151aab38162ca45358cebe705110daf57
| 1,063
|
asm
|
Assembly
|
llvm/test/tools/llvm-ml/feat00.asm
|
mkinsner/llvm
|
589d48844edb12cd357b3024248b93d64b6760bf
|
[
"Apache-2.0"
] | 2,338
|
2018-06-19T17:34:51.000Z
|
2022-03-31T11:00:37.000Z
|
llvm/test/tools/llvm-ml/feat00.asm
|
mkinsner/llvm
|
589d48844edb12cd357b3024248b93d64b6760bf
|
[
"Apache-2.0"
] | 3,740
|
2019-01-23T15:36:48.000Z
|
2022-03-31T22:01:13.000Z
|
llvm/test/tools/llvm-ml/feat00.asm
|
mkinsner/llvm
|
589d48844edb12cd357b3024248b93d64b6760bf
|
[
"Apache-2.0"
] | 500
|
2019-01-23T07:49:22.000Z
|
2022-03-30T02:59:37.000Z
|
; RUN: llvm-ml -m32 %s /Fo - | llvm-readobj --syms - | FileCheck %s --check-prefix=CHECK-OBJ --check-prefix=CHECK-OBJ-NOSAFESEH
; RUN: llvm-ml -m64 %s /Fo - | llvm-readobj --syms - | FileCheck %s --check-prefix=CHECK-OBJ --check-prefix=CHECK-OBJ-NOSAFESEH
; RUN: llvm-ml -m32 -safeseh %s /Fo - | llvm-readobj --syms - | FileCheck %s --check-prefix=CHECK-OBJ --check-prefix=CHECK-OBJ-SAFESEH
; RUN: llvm-ml -m64 -safeseh %s /Fo %t.obj 2>&1 | FileCheck %s --check-prefix=CHECK-SAFESEH64
; RUN: llvm-readobj --syms %t.obj | FileCheck %s --check-prefix=CHECK-OBJ --check-prefix=CHECK-OBJ-NOSAFESEH
; CHECK-SAFESEH64: warning: /safeseh applies only to 32-bit X86 platforms; ignoring.
.code
noop:
ret
end
; CHECK-OBJ: Symbol {
; CHECK-OBJ: Name: @feat.00
; CHECK-OBJ-NOSAFESEH: Value: 2
; CHECK-OBJ-SAFESEH: Value: 3
; CHECK-OBJ-NEXT: Section: IMAGE_SYM_ABSOLUTE
; CHECK-OBJ-NEXT: BaseType: Null
; CHECK-OBJ-NEXT: ComplexType: Null
; CHECK-OBJ-NEXT: StorageClass: External
; CHECK-OBJ-NEXT: AuxSymbolCount: 0
; CHECK-OBJ-NEXT: }
| 42.52
| 134
| 0.680151
|
aaba7dcd95021d6ca8cd59deeebeee1e7c352672
| 510
|
asm
|
Assembly
|
src/firmware-tests/Platform/TemperatureSensor/Poll/PollChainTest.asm
|
pete-restall/Cluck2Sesame-Prototype
|
99119b6748847a7b6aeadc4bee42cbed726f7fdc
|
[
"MIT"
] | 1
|
2019-12-12T09:07:08.000Z
|
2019-12-12T09:07:08.000Z
|
src/firmware-tests/Platform/TemperatureSensor/Poll/PollChainTest.asm
|
pete-restall/Cluck2Sesame-Prototype
|
99119b6748847a7b6aeadc4bee42cbed726f7fdc
|
[
"MIT"
] | null | null | null |
src/firmware-tests/Platform/TemperatureSensor/Poll/PollChainTest.asm
|
pete-restall/Cluck2Sesame-Prototype
|
99119b6748847a7b6aeadc4bee42cbed726f7fdc
|
[
"MIT"
] | null | null | null |
#include "Platform.inc"
#include "FarCalls.inc"
#include "TemperatureSensor.inc"
#include "TestFixture.inc"
#include "../PollAfterTemperatureSensorMock.inc"
radix decimal
PollChainTest code
global testArrange
testArrange:
fcall initialisePollAfterTemperatureSensorMock
fcall initialiseTemperatureSensor
testAct:
fcall pollTemperatureSensor
testAssert:
banksel calledPollAfterTemperatureSensor
.assert "calledPollAfterTemperatureSensor != 0, 'Next poll in chain was not called.'"
return
end
| 20.4
| 86
| 0.813725
|
c9c2fc038f2a84cb22773e247b70337f0a21005d
| 535
|
asm
|
Assembly
|
programs/oeis/206/A206787.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 22
|
2018-02-06T19:19:31.000Z
|
2022-01-17T21:53:31.000Z
|
programs/oeis/206/A206787.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 41
|
2021-02-22T19:00:34.000Z
|
2021-08-28T10:47:47.000Z
|
programs/oeis/206/A206787.asm
|
neoneye/loda
|
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
|
[
"Apache-2.0"
] | 5
|
2021-02-24T21:14:16.000Z
|
2021-08-09T19:48:05.000Z
|
; A206787: Sum of the odd squarefree divisors of n.
; 1,1,4,1,6,4,8,1,4,6,12,4,14,8,24,1,18,4,20,6,32,12,24,4,6,14,4,8,30,24,32,1,48,18,48,4,38,20,56,6,42,32,44,12,24,24,48,4,8,6,72,14,54,4,72,8,80,30,60,24,62,32,32,1,84,48,68,18,96,48,72,4,74,38,24,20,96,56,80,6,4,42,84,32,108,44,120,12,90,24,112,24,128,48,120,4,98,8,48,6
lpb $0
sub $0,1
mul $0,2
dif $0,4
lpe
seq $0,75423 ; rad(n) - 1, where rad(n) is the squarefree kernel of n (A007947).
seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
| 48.636364
| 272
| 0.637383
|
c61e65f771465fc2d84b03c30632e391b57e09ac
| 893
|
asm
|
Assembly
|
src/unison/test/fast/Hexagon/speed/gobmk.owl_vital_apat.autohelperowl_vital_apat34.asm
|
Patstrom/disUnison
|
94731ad37cefa9dc3b6472de3adea8a8d5f0a44b
|
[
"BSD-3-Clause"
] | 88
|
2016-09-27T15:20:07.000Z
|
2022-03-24T15:23:06.000Z
|
src/unison/test/fast/Hexagon/speed/gobmk.owl_vital_apat.autohelperowl_vital_apat34.asm
|
Patstrom/disUnison
|
94731ad37cefa9dc3b6472de3adea8a8d5f0a44b
|
[
"BSD-3-Clause"
] | 56
|
2018-02-26T16:44:15.000Z
|
2019-02-23T17:07:32.000Z
|
src/unison/test/fast/Hexagon/speed/gobmk.owl_vital_apat.autohelperowl_vital_apat34.asm
|
Patstrom/disUnison
|
94731ad37cefa9dc3b6472de3adea8a8d5f0a44b
|
[
"BSD-3-Clause"
] | 10
|
2016-11-22T15:03:46.000Z
|
2020-07-13T21:34:31.000Z
|
.text
.file "gobmk.owl_vital_apat.autohelperowl_vital_apat34.ll"
.hidden autohelperowl_vital_apat34
.globl autohelperowl_vital_apat34
.align 16
.type autohelperowl_vital_apat34,@function
autohelperowl_vital_apat34: // @autohelperowl_vital_apat34
// BB#0:
{
r4 = r1
r1:0 = combine(#0, r2)
r3 = r0
allocframe(#16)
}
{
r3 = add(##transformation, asl(r3, #2))
r2 = #1
memw(r29 + #8) = r4
}
{
r3 = memw(r3 + ##24256)
memw(r29+#0) = r4
}
{
call play_attack_defend2_n
r3 = add(r3, r4)
memw(r29+#4) = r3.new
}
{
dealloc_return
}
.Lfunc_end0:
.size autohelperowl_vital_apat34, .Lfunc_end0-autohelperowl_vital_apat34
.ident "clang version 3.8.0 (http://llvm.org/git/clang.git 2d49f0a0ae8366964a93e3b7b26e29679bee7160) (http://llvm.org/git/llvm.git 60bc66b44837125843b58ed3e0fd2e6bb948d839)"
.section ".note.GNU-stack","",@progbits
| 23.5
| 174
| 0.693169
|
2910cfabebc6dd95c4e9de87bf5b9d35dbc8842f
| 198
|
asm
|
Assembly
|
libsrc/genmath/dadd.asm
|
dex4er/deb-z88dk
|
9ee4f23444fa6f6043462332a1bff7ae20a8504b
|
[
"ClArtistic"
] | 1
|
2018-09-04T23:07:24.000Z
|
2018-09-04T23:07:24.000Z
|
libsrc/genmath/dadd.asm
|
dex4er/deb-z88dk
|
9ee4f23444fa6f6043462332a1bff7ae20a8504b
|
[
"ClArtistic"
] | null | null | null |
libsrc/genmath/dadd.asm
|
dex4er/deb-z88dk
|
9ee4f23444fa6f6043462332a1bff7ae20a8504b
|
[
"ClArtistic"
] | null | null | null |
;
; Z88dk Generic Floating Point Math Library
;
;
; $Id: dadd.asm,v 1.1 2002/01/21 20:35:22 dom Exp $:
XLIB dadd
LIB fadd
.dadd
pop hl
pop de
pop ix
pop bc
push hl
jp fadd
| 10.421053
| 58
| 0.60101
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.