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
sequencelengths
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
sequencelengths
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
sequencelengths
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
3a7ff00f2df847ac9c37afa81dea24afa8736a61
271
asm
Assembly
libsrc/strings/rindex.asm
grancier/z180
e83f35e36c9b4d1457e40585019430e901c86ed9
[ "ClArtistic" ]
8
2017-01-18T12:02:17.000Z
2021-06-12T09:40:28.000Z
libsrc/strings/rindex.asm
grancier/z180
e83f35e36c9b4d1457e40585019430e901c86ed9
[ "ClArtistic" ]
1
2017-03-06T07:41:56.000Z
2017-03-06T07:41:56.000Z
libsrc/strings/rindex.asm
RC2014Z80/z88dk
e5b9447b970e5fae26544b6d8aa5957c98ba0e6a
[ "ClArtistic" ]
3
2017-03-07T03:19:40.000Z
2021-09-15T17:59:19.000Z
; CALLER linkage for function pointers SECTION code_clib PUBLIC rindex PUBLIC _rindex EXTERN strrchr_callee EXTERN ASMDISP_STRRCHR_CALLEE .rindex ._rindex pop hl pop bc pop de push de push bc push hl jp strrchr_callee + ASMDISP_STRRCHR_CALLEE
13.55
45
0.756458
d76dca06c9026aab14553230eaba741d6c854c9b
471
asm
Assembly
oeis/176/A176213.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/176/A176213.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/176/A176213.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A176213: Decimal expansion of 2+sqrt(6). ; Submitted by Jon Maiga ; 4,4,4,9,4,8,9,7,4,2,7,8,3,1,7,8,0,9,8,1,9,7,2,8,4,0,7,4,7,0,5,8,9,1,3,9,1,9,6,5,9,4,7,4,8,0,6,5,6,6,7,0,1,2,8,4,3,2,6,9,2,5,6,7,2,5,0,9,6,0,3,7,7,4,5,7,3,1,5,0,2,6,5,3,9,8,5,9,4,3,3,1,0,4,6,4,0,2,3,4 mov $2,4 mov $3,$0 mul $3,4 mov $5,56 lpb $3 add $1,$5 mov $5,$1 add $5,$2 mov $2,$1 mul $1,2 sub $3,1 mul $5,2 lpe add $1,$5 mov $4,10 pow $4,$0 div $2,$4 div $1,$2 mov $0,$1 mod $0,10
18.84
201
0.530786
900b0d26e496e01e442a6f0421212991ad19fd39
794
asm
Assembly
oeis/141/A141974.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/141/A141974.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/141/A141974.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A141974: Primes congruent to 23 mod 28. ; Submitted by Jon Maiga ; 23,79,107,163,191,331,359,443,499,751,863,919,947,1031,1087,1171,1283,1367,1423,1451,1619,1759,1787,1871,2011,2039,2179,2207,2347,2459,2543,2683,2711,2767,2851,2879,2963,3019,3187,3271,3299,3467,3607,3691,3719,3803,3943,4027,4111,4139,4363,4391,4447,4643,4783,4951,5119,5147,5231,5399,5483,5623,5651,5791,5903,5987,6043,6211,6323,6379,6491,6547,6659,6827,6883,6911,6967,7079,7219,7247,7331,7499,7583,7639,7723,7919,8059,8087,8171,8311,8423,8563,8647,8731,9011,9067,9151,9319,9403,9431 mov $2,$0 add $2,6 pow $2,2 mov $4,22 lpb $2 mov $3,$4 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $1,$0 max $1,0 cmp $1,$0 mul $2,$1 sub $2,1 add $4,28 lpe mov $0,$4 add $0,1
36.090909
486
0.716625
2f27f192ea51831ed5cbaec6059195d389b87cf9
3,967
asm
Assembly
buildTools/win32-x64/gbdk/libc/reverse.asm
asiekierka/gb-studio
0ff8b7c5bd661a13c2b574e844ae7f2299b439e2
[ "MIT" ]
6,433
2019-04-17T14:58:27.000Z
2022-03-31T08:41:22.000Z
buildTools/win32-x64/gbdk/libc/reverse.asm
asiekierka/gb-studio
0ff8b7c5bd661a13c2b574e844ae7f2299b439e2
[ "MIT" ]
878
2019-04-18T18:57:48.000Z
2022-03-31T19:42:20.000Z
buildTools/win32-x64/gbdk/libc/reverse.asm
asiekierka/gb-studio
0ff8b7c5bd661a13c2b574e844ae7f2299b439e2
[ "MIT" ]
440
2019-04-18T18:10:50.000Z
2022-03-31T21:30:57.000Z
;-------------------------------------------------------- ; File Created by SDCC : FreeWare ANSI-C Compiler ; Version 2.3.1 Wed Sep 04 21:56:18 2019 ;-------------------------------------------------------- .module reverse ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- .globl _reverse ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- ;-------------------------------------------------------- ; special function bits ;-------------------------------------------------------- ;-------------------------------------------------------- ; internal ram data ;-------------------------------------------------------- .area _DATA ;-------------------------------------------------------- ; overlayable items in internal ram ;-------------------------------------------------------- .area _OVERLAY ;-------------------------------------------------------- ; indirectly addressable internal ram data ;-------------------------------------------------------- .area _ISEG ;-------------------------------------------------------- ; bit data ;-------------------------------------------------------- .area _BSEG ;-------------------------------------------------------- ; external ram data ;-------------------------------------------------------- .area _XSEG ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- .area _GSINIT .area _GSFINAL .area _GSINIT ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- .area _HOME .area _CODE ;-------------------------------------------------------- ; code ;-------------------------------------------------------- .area _CODE ; reverse.c 5 ; genLabel ; genFunction ; --------------------------------- ; Function reverse ; --------------------------------- ___reverse_start: _reverse: lda sp,-5(sp) ; reverse.c 11 ; genIpush ; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0 ; AOP_STK for lda hl,7(sp) ld a,(hl+) ld h,(hl) ld l,a push hl ; genCall call _strlen ld b,d ld c,e lda sp,2(sp) ; genMinus dec bc ; genCast ; Removed redundent load ; reverse.c 12 ; genAssign ; AOP_STK for _reverse_i_1_1 lda hl,4(sp) ld (hl),#0x00 ; genAssign ; AOP_STK for _reverse_j_1_1 dec hl ld (hl),c ; genLabel 00101$: ; genCmpLt ; AOP_STK for _reverse_i_1_1 ; AOP_STK for _reverse_j_1_1 lda hl,4(sp) ld a,(hl) dec hl sub a,(hl) jp nc,00103$ ; reverse.c 13 ; genPlus ; AOP_STK for ; AOP_STK for _reverse_i_1_1 ; AOP_STK for _reverse_sloc0_1_0 ; Can't optimise plus by inc, falling back to the normal way lda hl,7(sp) ld e,(hl) inc hl ld d,(hl) lda hl,4(sp) ld l,(hl) ld h,#0x00 add hl,de ld a,l ld d,h lda hl,0(sp) ; genPointerGet ; AOP_STK for _reverse_sloc0_1_0 ld (hl+),a ld (hl),d ld e,a ld a,(de) ld c,a ; genAssign ; AOP_STK for _reverse_c_1_1 inc hl ld (hl),c ; reverse.c 14 ; genPlus ; AOP_STK for ; AOP_STK for _reverse_j_1_1 ; Can't optimise plus by inc, falling back to the normal way lda hl,7(sp) ld e,(hl) inc hl ld d,(hl) lda hl,3(sp) ld l,(hl) ld h,#0x00 add hl,de ld c,l ld b,h ; genPointerGet ld a,(bc) ; genAssign (pointer) ; AOP_STK for _reverse_sloc0_1_0 lda hl,0(sp) ld e,(hl) inc hl ld d,(hl) ld (de),a ; reverse.c 15 ; genAssign (pointer) ; AOP_STK for _reverse_c_1_1 inc hl ld a,(hl) ld (bc),a ; reverse.c 16 ; genPlus ; AOP_STK for _reverse_i_1_1 ; genPlusIncr inc hl inc hl inc (hl) ; reverse.c 17 ; genMinus ; AOP_STK for _reverse_j_1_1 dec hl dec (hl) ; genGoto jp 00101$ ; genLabel 00103$: ; reverse.c 19 ; genRet ; AOP_STK for lda hl,7(sp) ld e,(hl) inc hl ld d,(hl) ; genLabel 00104$: ; genEndFunction lda sp,5(sp) ret ___reverse_end: .area _CODE
21.213904
69
0.437358
bfebca80ad9e33117cd51d822b17c4b5c5d04c0c
269
asm
Assembly
mc-sema/validator/x86_64/tests/FBLD.asm
randolphwong/mcsema
eb5b376736e7f57ff0a61f7e4e5a436bbb874720
[ "BSD-3-Clause" ]
2
2021-08-07T16:21:29.000Z
2021-11-17T10:58:37.000Z
mc-sema/validator/x86_64/tests/FBLD.asm
randolphwong/mcsema
eb5b376736e7f57ff0a61f7e4e5a436bbb874720
[ "BSD-3-Clause" ]
null
null
null
mc-sema/validator/x86_64/tests/FBLD.asm
randolphwong/mcsema
eb5b376736e7f57ff0a61f7e4e5a436bbb874720
[ "BSD-3-Clause" ]
null
null
null
BITS 64 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS= ;TEST_FILE_META_END ;TEST_BEGIN_RECORDING lea rdi, [rsp-0x10] mov dword [rdi], 0x12345678 mov dword [rdi+04], 0x12345678 mov dword [rdi+08], 0x00001234 FBLD tword [rdi] mov edi, 0 ;TEST_END_RECORDING
16.8125
30
0.788104
9086dea7203608990e748357372925eb4a1a50c3
237
asm
Assembly
libsrc/gfx/common/cclg.asm
ahjelm/z88dk
c4de367f39a76b41f6390ceeab77737e148178fa
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/gfx/common/cclg.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/gfx/common/cclg.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; ; Colour graphics routines ; ; cls () -- clear screen ; ; Stefano Bodrato - 2018 ; ; ; $Id: cclg.asm $ ; SECTION code_graphics PUBLIC cclg PUBLIC _cclg EXTERN clg .cclg ._cclg jp clg
10.772727
31
0.535865
d34da9eeaa98d55ffc4e50b97e9fd9dcce4db933
5,093
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2908.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_2908.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_2908.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 %r13 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0xfc17, %rsi lea addresses_normal_ht+0x16e2f, %rdi nop nop nop nop dec %r10 mov $1, %rcx rep movsw mfence lea addresses_D_ht+0x129ff, %rdx sub $32043, %r13 mov (%rdx), %rcx nop nop nop nop nop inc %rsi lea addresses_normal_ht+0x14e7f, %rdx nop nop nop nop add %r10, %r10 movb $0x61, (%rdx) nop nop dec %rcx lea addresses_WC_ht+0x12f2b, %rdx nop nop nop xor %rdi, %rdi movw $0x6162, (%rdx) nop nop nop nop sub $30459, %rbp pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %rax push %rbp push %rdx push %rsi // Store lea addresses_normal+0x1d67f, %r11 clflush (%r11) nop nop dec %r10 movl $0x51525354, (%r11) nop nop nop cmp $48320, %rax // Faulty Load lea addresses_RW+0xa67f, %rdx nop nop nop nop add $24736, %rbp movups (%rdx), %xmm1 vpextrq $0, %xmm1, %rax lea oracles, %rdx and $0xff, %rax shlq $12, %rax mov (%rdx,%rax,1), %rax pop %rsi pop %rdx pop %rbp pop %rax pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 10, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': True, 'NT': True}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
43.905172
2,999
0.661496
f90db332e1912816e7b2d946adc741dbd4795343
1,215
asm
Assembly
Testcases/Own Testcases/sum_sq/sum_sq20.asm
swapnil96/Cache_simulator
df7b0dd6132e45660ef2731fa4ec722fd7dab2c6
[ "Apache-2.0" ]
null
null
null
Testcases/Own Testcases/sum_sq/sum_sq20.asm
swapnil96/Cache_simulator
df7b0dd6132e45660ef2731fa4ec722fd7dab2c6
[ "Apache-2.0" ]
null
null
null
Testcases/Own Testcases/sum_sq/sum_sq20.asm
swapnil96/Cache_simulator
df7b0dd6132e45660ef2731fa4ec722fd7dab2c6
[ "Apache-2.0" ]
null
null
null
lui $1, 0x00000000 ori $t4,$1,0x00000014 # t4(Input register) is initialized to 10. and $t0, $0, $0 # i = 0 lui $1, 0x00001001 # Address of a ori $t1,$1,0x00000010 loop1: sll $t2, $t0, 2 # byte offset for ith element add $t2, $t2, $t1 # address of a[i] sw $t0, 0($t2) # put i into a[i] addi $t0, $t0, 1 # increment i slt $t5, $t0, $t4 # is $t0 < $t4 ? bne $t5, $0, loop1 # branch if so # Sum the array values and $s0, $0, $0 # sum = 0, Result Register and $t0, $0, $0 # i = 0 add $t2, $t1, $0 # address of a[i] loop2: lw $t3, 0($t2) # load a[i] mult $t3, $t3 # multiply a[i] with a[i] mflo $t3 # move product to $t3 add $s0, $s0, $t3 # increment sum addi $t0, $t0, 1 # increment i addi $t2, $t2, 4 # increment address of a[i] slt $t5, $t0, $t4 # is $t0 < $t4 ? bne $t5, $0, loop2 # branch if so # Output Sum li $v0, 1 # Load 1=print_int into $v0 add $a0, $s0, $zero # Load first number into $a0 jr $ra
36.818182
73
0.450206
0cedde06287f35085eb8846a6b7a35c69fa2ed1f
6,524
asm
Assembly
src/test/ref/examples/cx16/cx16-rasterbars.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
2
2022-03-01T02:21:14.000Z
2022-03-01T04:33:35.000Z
src/test/ref/examples/cx16/cx16-rasterbars.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
null
null
null
src/test/ref/examples/cx16/cx16-rasterbars.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
null
null
null
// Example program for the Commander X16 // Displays raster bars in the border .cpu _65c02 // Commodore 64 PRG executable file .file [name="cx16-rasterbars.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(__start) .const VERA_DCSEL = 2 .const VERA_LINE = 2 .const SIZEOF_CHAR = 1 /// $9F25 CTRL Control /// Bit 7: Reset /// Bit 1: DCSEL /// Bit 2: ADDRSEL .label VERA_CTRL = $9f25 /// $9F26 IEN Interrupt Enable /// Bit 7: IRQ line (8) /// Bit 3: AFLOW /// Bit 2: SPRCOL /// Bit 1: LINE /// Bit 0: VSYNC .label VERA_IEN = $9f26 /// $9F27 ISR Interrupt Status /// Interrupts will be generated for the interrupt sources set in the lower 4 bits of IEN. ISR will indicate the interrupts that have occurred. /// Writing a 1 to one of the lower 3 bits in ISR will clear that interrupt status. AFLOW can only be cleared by filling the audio FIFO for at least 1/4. /// Bit 4-7: Sprite Collisions. This field indicates which groups of sprites have collided. /// Bit 3: AFLOW /// Bit 2: SPRCOL /// Bit 1: LINE /// Bit 0: VSYNC .label VERA_ISR = $9f27 /// $9F28 IRQLINE_L IRQ line (7:0) /// IRQ_LINE specifies at which line the LINE interrupt will be generated. /// Note that bit 8 of this value is present in the IEN register. /// For interlaced modes the interrupt will be generated each field and the bit 0 of IRQ_LINE is ignored. .label VERA_IRQLINE_L = $9f28 /// $9F2C DC_BORDER (DCSEL=0) Border Color .label VERA_DC_BORDER = $9f2c /// $9F29 DC_HSTART (DCSEL=1) Active Display H-Start (9:2) .label VERA_DC_HSTART = $9f29 /// $9F2A DC_HSTOP (DCSEL=1) Active Display H-Stop (9:2) .label VERA_DC_HSTOP = $9f2a /// $9F2B DC_VSTART (DCSEL=1) Active Display V-Start (8:1) .label VERA_DC_VSTART = $9f2b /// $9F2C DC_VSTOP (DCSEL=1) Active Display V-Stop (8:1) .label VERA_DC_VSTOP = $9f2c /// $0314 (RAM) IRQ vector - The vector used when the KERNAL serves IRQ interrupts .label KERNEL_IRQ = $314 // The horizontal start .label hstart = 6 // The horizontal stop .label hstop = 7 // The vertical start .label vstart = 8 // The vertical stop .label vstop = 9 // The countdown .label cnt = 5 // The sin idx .label sin_idx = $a .segment Code __start: { // volatile char hstart = 0/4 lda #0 sta.z hstart // volatile char hstop = 640/4 lda #$280/4 sta.z hstop // volatile char vstart = 0/2 lda #0 sta.z vstart // volatile char vstop = 480/2 lda #$1e0/2 sta.z vstop // volatile char cnt = 2 lda #2 sta.z cnt // volatile char sin_idx = 100 lda #$64 sta.z sin_idx jsr main rts } // LINE Interrupt Routine irq_line: { .label idx = 4 .label bar = 2 // *VERA_CTRL |= VERA_DCSEL // Update the border lda #VERA_DCSEL ora VERA_CTRL sta VERA_CTRL // *VERA_DC_HSTART = hstart lda.z hstart sta VERA_DC_HSTART // *VERA_DC_HSTOP = hstop lda.z hstop sta VERA_DC_HSTOP // *VERA_DC_VSTART = vstart lda.z vstart sta VERA_DC_VSTART // *VERA_DC_VSTOP = vstop lda.z vstop sta VERA_DC_VSTOP // *VERA_CTRL &= ~VERA_DCSEL // Show color raster bars in the border lda #VERA_DCSEL^$ff and VERA_CTRL sta VERA_CTRL ldx #0 __b2: // for(char l=0;l!=230;l++) cpx #$e6 bne __b3 // if(--cnt==0) dec.z cnt lda.z cnt bne __b1 // cnt = 2 lda #2 sta.z cnt // if(hstart<=320/4) lda.z hstart cmp #$140/4+1 bcs __b1 // hstart++; inc.z hstart // hstop--; dec.z hstop // vstart++; inc.z vstart // vstop--; dec.z vstop __b1: // memset(BARS, 0, sizeof(BARS)) // Animate the bars jsr memset // char idx = sin_idx-- lda.z sin_idx sta.z idx dec.z sin_idx ldx #0 __b13: // for(char b=0;b<8;b++) cpx #8 bcc __b14 // *VERA_ISR = VERA_LINE // Reset the LINE interrupt lda #VERA_LINE sta VERA_ISR // } jmp $e049 __b14: // char * bar = BARS + SIN[idx] ldy.z idx lda SIN,y clc adc #<BARS sta.z bar lda #>BARS adc #0 sta.z bar+1 ldy #0 __b16: // for(char i=0;i<sizeof(BAR);i++) cpy #$20*SIZEOF_CHAR bcc __b17 // idx += 13 lda #$d clc adc.z idx sta.z idx // for(char b=0;b<8;b++) inx jmp __b13 __b17: // bar[i] = BAR[i] lda BAR,y sta (bar),y // for(char i=0;i<sizeof(BAR);i++) iny jmp __b16 __b3: // *VERA_DC_BORDER = BARS[l] lda BARS,x sta VERA_DC_BORDER lda #0 __b5: // for(char i=0;i<24;i++) cmp #$18 bcc __b6 // *VERA_DC_BORDER = 0 // Wait exactly long enough to go to the next raster line lda #0 sta VERA_DC_BORDER __b8: // for(char i=0;i<23;i++) cmp #$17 bcc __b9 // asm // Wait exactly long enough to go to the next raster line nop nop // for(char l=0;l!=230;l++) inx jmp __b2 __b9: // for(char i=0;i<23;i++) inc jmp __b8 __b6: // for(char i=0;i<24;i++) inc jmp __b5 } main: { // asm sei // *KERNEL_IRQ = &irq_line lda #<irq_line sta KERNEL_IRQ lda #>irq_line sta KERNEL_IRQ+1 // *VERA_IEN = VERA_LINE lda #VERA_LINE sta VERA_IEN // *VERA_IRQLINE_L = 5 lda #5 sta VERA_IRQLINE_L // asm cli __b1: jmp __b1 } // Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str. // void * memset(void *str, char c, unsigned int num) memset: { .const num = $e6*SIZEOF_CHAR .const c = 0 .label str = BARS .label end = str+num .label dst = 2 lda #<str sta.z dst lda #>str sta.z dst+1 __b1: // for(char* dst = str; dst!=end; dst++) lda.z dst+1 cmp #>end bne __b2 lda.z dst cmp #<end bne __b2 // } rts __b2: // *dst = c lda #c ldy #0 sta (dst),y // for(char* dst = str; dst!=end; dst++) inc.z dst bne !+ inc.z dst+1 !: jmp __b1 } .segment Data .align $100 SIN: .fill 256, 99+99*sin(i*2*PI/256) .align $100 BARS: .fill $e6, 0 .align $100 BAR: .byte $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $1a, $1b, $1c, $1d, $1e, $1f, $1f, $1e, $1d, $1c, $1b, $1a, $19, $18, $17, $16, $15, $14, $13, $12, $11, $10
23.134752
171
0.588903
8aa31d160c1801f247f038ae3fcdb58140c449c3
1,039
asm
Assembly
libsrc/_DEVELOPMENT/math/integer/small/l_small_divu_64_64x8.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/math/integer/small/l_small_divu_64_64x8.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/math/integer/small/l_small_divu_64_64x8.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; 2016 aralbrec SECTION code_clib SECTION code_math PUBLIC l_small_divu_64_64x8 PUBLIC l0_small_divu_64_64x8 EXTERN error_llmc, error_divide_by_zero_mc l_small_divu_64_64x8: ; unsigned division of a 64-bit number ; by an 8-bit number ; ; enter : dehl'dehl = 64-bit dividend ; c = 8-bit divisor ; ; exit : success ; ; dehl'dehl = 64-bit quotient ; a = remainder ; carry reset ; ; divide by zero ; ; dehl'dehl = ULLONG_MAX ; (dividend is lost) ; carry set, errno = EDOM ; ; uses : af, b, de, hl, de', hl' ld a,c or a jr z, divide_by_zero l0_small_divu_64_64x8: xor a ld b,64 loop_11: add hl,hl rl e rl d exx adc hl,hl rl e rl d exx rla jr c, loop_02 cp c jr c, loop_03 loop_02: sub c inc l loop_03: djnz loop_11 or a ret divide_by_zero: call error_llmc jp error_divide_by_zero_mc
13.671053
43
0.555342
5e586cf9a8d440f37d3ca53023b0fa6153a62496
659
asm
Assembly
oeis/102/A102370.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/102/A102370.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/102/A102370.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A102370: "Sloping binary numbers": write numbers in binary under each other (right-justified), read diagonals in upward direction, convert to decimal. ; Submitted by Christian Krause ; 0,3,6,5,4,15,10,9,8,11,14,13,28,23,18,17,16,19,22,21,20,31,26,25,24,27,30,61,44,39,34,33,32,35,38,37,36,47,42,41,40,43,46,45,60,55,50,49,48,51,54,53,52,63,58,57,56,59,126,93,76,71,66,65,64,67,70,69,68,79,74,73,72,75,78,77,92,87,82,81,80,83,86,85,84,95,90,89,88,91,94,125,108,103,98,97,96,99,102,101 add $0,1 mov $1,$0 mov $2,$0 mov $4,1 lpb $2 mul $4,2 mov $3,$4 mov $5,$0 add $0,1 mod $5,$4 cmp $5,0 mul $3,$5 add $1,$3 div $2,2 lpe mov $0,$1 sub $0,1
29.954545
300
0.649469
c5b4688b2e3e8b4ddf027cc1f70fb0b039041469
57,166
asm
Assembly
grep.asm
Tookerton21/Xv6_OS
ed9ab1648952b2f62e60db2ca8e6aa42e69bd340
[ "Xnet", "X11" ]
null
null
null
grep.asm
Tookerton21/Xv6_OS
ed9ab1648952b2f62e60db2ca8e6aa42e69bd340
[ "Xnet", "X11" ]
null
null
null
grep.asm
Tookerton21/Xv6_OS
ed9ab1648952b2f62e60db2ca8e6aa42e69bd340
[ "Xnet", "X11" ]
null
null
null
_grep: file format elf32-i386 Disassembly of section .text: 00000000 <grep>: char buf[1024]; int match(char*, char*); void grep(char *pattern, int fd) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 18 sub $0x18,%esp int n, m; char *p, *q; m = 0; 6: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ d: e9 b6 00 00 00 jmp c8 <grep+0xc8> m += n; 12: 8b 45 ec mov -0x14(%ebp),%eax 15: 01 45 f4 add %eax,-0xc(%ebp) buf[m] = '\0'; 18: 8b 45 f4 mov -0xc(%ebp),%eax 1b: 05 80 0e 00 00 add $0xe80,%eax 20: c6 00 00 movb $0x0,(%eax) p = buf; 23: c7 45 f0 80 0e 00 00 movl $0xe80,-0x10(%ebp) while((q = strchr(p, '\n')) != 0){ 2a: eb 4a jmp 76 <grep+0x76> *q = 0; 2c: 8b 45 e8 mov -0x18(%ebp),%eax 2f: c6 00 00 movb $0x0,(%eax) if(match(pattern, p)){ 32: 83 ec 08 sub $0x8,%esp 35: ff 75 f0 pushl -0x10(%ebp) 38: ff 75 08 pushl 0x8(%ebp) 3b: e8 9a 01 00 00 call 1da <match> 40: 83 c4 10 add $0x10,%esp 43: 85 c0 test %eax,%eax 45: 74 26 je 6d <grep+0x6d> *q = '\n'; 47: 8b 45 e8 mov -0x18(%ebp),%eax 4a: c6 00 0a movb $0xa,(%eax) write(1, p, q+1 - p); 4d: 8b 45 e8 mov -0x18(%ebp),%eax 50: 83 c0 01 add $0x1,%eax 53: 89 c2 mov %eax,%edx 55: 8b 45 f0 mov -0x10(%ebp),%eax 58: 29 c2 sub %eax,%edx 5a: 89 d0 mov %edx,%eax 5c: 83 ec 04 sub $0x4,%esp 5f: 50 push %eax 60: ff 75 f0 pushl -0x10(%ebp) 63: 6a 01 push $0x1 65: e8 88 05 00 00 call 5f2 <write> 6a: 83 c4 10 add $0x10,%esp } p = q+1; 6d: 8b 45 e8 mov -0x18(%ebp),%eax 70: 83 c0 01 add $0x1,%eax 73: 89 45 f0 mov %eax,-0x10(%ebp) m = 0; while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ m += n; buf[m] = '\0'; p = buf; while((q = strchr(p, '\n')) != 0){ 76: 83 ec 08 sub $0x8,%esp 79: 6a 0a push $0xa 7b: ff 75 f0 pushl -0x10(%ebp) 7e: e8 89 03 00 00 call 40c <strchr> 83: 83 c4 10 add $0x10,%esp 86: 89 45 e8 mov %eax,-0x18(%ebp) 89: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 8d: 75 9d jne 2c <grep+0x2c> *q = '\n'; write(1, p, q+1 - p); } p = q+1; } if(p == buf) 8f: 81 7d f0 80 0e 00 00 cmpl $0xe80,-0x10(%ebp) 96: 75 07 jne 9f <grep+0x9f> m = 0; 98: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) if(m > 0){ 9f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) a3: 7e 23 jle c8 <grep+0xc8> m -= p - buf; a5: 8b 45 f0 mov -0x10(%ebp),%eax a8: ba 80 0e 00 00 mov $0xe80,%edx ad: 29 d0 sub %edx,%eax af: 29 45 f4 sub %eax,-0xc(%ebp) memmove(buf, p, m); b2: 83 ec 04 sub $0x4,%esp b5: ff 75 f4 pushl -0xc(%ebp) b8: ff 75 f0 pushl -0x10(%ebp) bb: 68 80 0e 00 00 push $0xe80 c0: e8 c8 04 00 00 call 58d <memmove> c5: 83 c4 10 add $0x10,%esp { int n, m; char *p, *q; m = 0; while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ c8: 8b 45 f4 mov -0xc(%ebp),%eax cb: ba ff 03 00 00 mov $0x3ff,%edx d0: 29 c2 sub %eax,%edx d2: 89 d0 mov %edx,%eax d4: 89 c2 mov %eax,%edx d6: 8b 45 f4 mov -0xc(%ebp),%eax d9: 05 80 0e 00 00 add $0xe80,%eax de: 83 ec 04 sub $0x4,%esp e1: 52 push %edx e2: 50 push %eax e3: ff 75 0c pushl 0xc(%ebp) e6: e8 ff 04 00 00 call 5ea <read> eb: 83 c4 10 add $0x10,%esp ee: 89 45 ec mov %eax,-0x14(%ebp) f1: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) f5: 0f 8f 17 ff ff ff jg 12 <grep+0x12> if(m > 0){ m -= p - buf; memmove(buf, p, m); } } } fb: 90 nop fc: c9 leave fd: c3 ret 000000fe <main>: int main(int argc, char *argv[]) { fe: 8d 4c 24 04 lea 0x4(%esp),%ecx 102: 83 e4 f0 and $0xfffffff0,%esp 105: ff 71 fc pushl -0x4(%ecx) 108: 55 push %ebp 109: 89 e5 mov %esp,%ebp 10b: 53 push %ebx 10c: 51 push %ecx 10d: 83 ec 10 sub $0x10,%esp 110: 89 cb mov %ecx,%ebx int fd, i; char *pattern; if(argc <= 1){ 112: 83 3b 01 cmpl $0x1,(%ebx) 115: 7f 17 jg 12e <main+0x30> printf(2, "usage: grep pattern [file ...]\n"); 117: 83 ec 08 sub $0x8,%esp 11a: 68 40 0b 00 00 push $0xb40 11f: 6a 02 push $0x2 121: e8 63 06 00 00 call 789 <printf> 126: 83 c4 10 add $0x10,%esp exit(); 129: e8 a4 04 00 00 call 5d2 <exit> } pattern = argv[1]; 12e: 8b 43 04 mov 0x4(%ebx),%eax 131: 8b 40 04 mov 0x4(%eax),%eax 134: 89 45 f0 mov %eax,-0x10(%ebp) if(argc <= 2){ 137: 83 3b 02 cmpl $0x2,(%ebx) 13a: 7f 15 jg 151 <main+0x53> grep(pattern, 0); 13c: 83 ec 08 sub $0x8,%esp 13f: 6a 00 push $0x0 141: ff 75 f0 pushl -0x10(%ebp) 144: e8 b7 fe ff ff call 0 <grep> 149: 83 c4 10 add $0x10,%esp exit(); 14c: e8 81 04 00 00 call 5d2 <exit> } for(i = 2; i < argc; i++){ 151: c7 45 f4 02 00 00 00 movl $0x2,-0xc(%ebp) 158: eb 74 jmp 1ce <main+0xd0> if((fd = open(argv[i], 0)) < 0){ 15a: 8b 45 f4 mov -0xc(%ebp),%eax 15d: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 164: 8b 43 04 mov 0x4(%ebx),%eax 167: 01 d0 add %edx,%eax 169: 8b 00 mov (%eax),%eax 16b: 83 ec 08 sub $0x8,%esp 16e: 6a 00 push $0x0 170: 50 push %eax 171: e8 9c 04 00 00 call 612 <open> 176: 83 c4 10 add $0x10,%esp 179: 89 45 ec mov %eax,-0x14(%ebp) 17c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 180: 79 29 jns 1ab <main+0xad> printf(1, "grep: cannot open %s\n", argv[i]); 182: 8b 45 f4 mov -0xc(%ebp),%eax 185: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 18c: 8b 43 04 mov 0x4(%ebx),%eax 18f: 01 d0 add %edx,%eax 191: 8b 00 mov (%eax),%eax 193: 83 ec 04 sub $0x4,%esp 196: 50 push %eax 197: 68 60 0b 00 00 push $0xb60 19c: 6a 01 push $0x1 19e: e8 e6 05 00 00 call 789 <printf> 1a3: 83 c4 10 add $0x10,%esp exit(); 1a6: e8 27 04 00 00 call 5d2 <exit> } grep(pattern, fd); 1ab: 83 ec 08 sub $0x8,%esp 1ae: ff 75 ec pushl -0x14(%ebp) 1b1: ff 75 f0 pushl -0x10(%ebp) 1b4: e8 47 fe ff ff call 0 <grep> 1b9: 83 c4 10 add $0x10,%esp close(fd); 1bc: 83 ec 0c sub $0xc,%esp 1bf: ff 75 ec pushl -0x14(%ebp) 1c2: e8 33 04 00 00 call 5fa <close> 1c7: 83 c4 10 add $0x10,%esp if(argc <= 2){ grep(pattern, 0); exit(); } for(i = 2; i < argc; i++){ 1ca: 83 45 f4 01 addl $0x1,-0xc(%ebp) 1ce: 8b 45 f4 mov -0xc(%ebp),%eax 1d1: 3b 03 cmp (%ebx),%eax 1d3: 7c 85 jl 15a <main+0x5c> exit(); } grep(pattern, fd); close(fd); } exit(); 1d5: e8 f8 03 00 00 call 5d2 <exit> 000001da <match>: int matchhere(char*, char*); int matchstar(int, char*, char*); int match(char *re, char *text) { 1da: 55 push %ebp 1db: 89 e5 mov %esp,%ebp 1dd: 83 ec 08 sub $0x8,%esp if(re[0] == '^') 1e0: 8b 45 08 mov 0x8(%ebp),%eax 1e3: 0f b6 00 movzbl (%eax),%eax 1e6: 3c 5e cmp $0x5e,%al 1e8: 75 17 jne 201 <match+0x27> return matchhere(re+1, text); 1ea: 8b 45 08 mov 0x8(%ebp),%eax 1ed: 83 c0 01 add $0x1,%eax 1f0: 83 ec 08 sub $0x8,%esp 1f3: ff 75 0c pushl 0xc(%ebp) 1f6: 50 push %eax 1f7: e8 38 00 00 00 call 234 <matchhere> 1fc: 83 c4 10 add $0x10,%esp 1ff: eb 31 jmp 232 <match+0x58> do{ // must look at empty string if(matchhere(re, text)) 201: 83 ec 08 sub $0x8,%esp 204: ff 75 0c pushl 0xc(%ebp) 207: ff 75 08 pushl 0x8(%ebp) 20a: e8 25 00 00 00 call 234 <matchhere> 20f: 83 c4 10 add $0x10,%esp 212: 85 c0 test %eax,%eax 214: 74 07 je 21d <match+0x43> return 1; 216: b8 01 00 00 00 mov $0x1,%eax 21b: eb 15 jmp 232 <match+0x58> }while(*text++ != '\0'); 21d: 8b 45 0c mov 0xc(%ebp),%eax 220: 8d 50 01 lea 0x1(%eax),%edx 223: 89 55 0c mov %edx,0xc(%ebp) 226: 0f b6 00 movzbl (%eax),%eax 229: 84 c0 test %al,%al 22b: 75 d4 jne 201 <match+0x27> return 0; 22d: b8 00 00 00 00 mov $0x0,%eax } 232: c9 leave 233: c3 ret 00000234 <matchhere>: // matchhere: search for re at beginning of text int matchhere(char *re, char *text) { 234: 55 push %ebp 235: 89 e5 mov %esp,%ebp 237: 83 ec 08 sub $0x8,%esp if(re[0] == '\0') 23a: 8b 45 08 mov 0x8(%ebp),%eax 23d: 0f b6 00 movzbl (%eax),%eax 240: 84 c0 test %al,%al 242: 75 0a jne 24e <matchhere+0x1a> return 1; 244: b8 01 00 00 00 mov $0x1,%eax 249: e9 99 00 00 00 jmp 2e7 <matchhere+0xb3> if(re[1] == '*') 24e: 8b 45 08 mov 0x8(%ebp),%eax 251: 83 c0 01 add $0x1,%eax 254: 0f b6 00 movzbl (%eax),%eax 257: 3c 2a cmp $0x2a,%al 259: 75 21 jne 27c <matchhere+0x48> return matchstar(re[0], re+2, text); 25b: 8b 45 08 mov 0x8(%ebp),%eax 25e: 8d 50 02 lea 0x2(%eax),%edx 261: 8b 45 08 mov 0x8(%ebp),%eax 264: 0f b6 00 movzbl (%eax),%eax 267: 0f be c0 movsbl %al,%eax 26a: 83 ec 04 sub $0x4,%esp 26d: ff 75 0c pushl 0xc(%ebp) 270: 52 push %edx 271: 50 push %eax 272: e8 72 00 00 00 call 2e9 <matchstar> 277: 83 c4 10 add $0x10,%esp 27a: eb 6b jmp 2e7 <matchhere+0xb3> if(re[0] == '$' && re[1] == '\0') 27c: 8b 45 08 mov 0x8(%ebp),%eax 27f: 0f b6 00 movzbl (%eax),%eax 282: 3c 24 cmp $0x24,%al 284: 75 1d jne 2a3 <matchhere+0x6f> 286: 8b 45 08 mov 0x8(%ebp),%eax 289: 83 c0 01 add $0x1,%eax 28c: 0f b6 00 movzbl (%eax),%eax 28f: 84 c0 test %al,%al 291: 75 10 jne 2a3 <matchhere+0x6f> return *text == '\0'; 293: 8b 45 0c mov 0xc(%ebp),%eax 296: 0f b6 00 movzbl (%eax),%eax 299: 84 c0 test %al,%al 29b: 0f 94 c0 sete %al 29e: 0f b6 c0 movzbl %al,%eax 2a1: eb 44 jmp 2e7 <matchhere+0xb3> if(*text!='\0' && (re[0]=='.' || re[0]==*text)) 2a3: 8b 45 0c mov 0xc(%ebp),%eax 2a6: 0f b6 00 movzbl (%eax),%eax 2a9: 84 c0 test %al,%al 2ab: 74 35 je 2e2 <matchhere+0xae> 2ad: 8b 45 08 mov 0x8(%ebp),%eax 2b0: 0f b6 00 movzbl (%eax),%eax 2b3: 3c 2e cmp $0x2e,%al 2b5: 74 10 je 2c7 <matchhere+0x93> 2b7: 8b 45 08 mov 0x8(%ebp),%eax 2ba: 0f b6 10 movzbl (%eax),%edx 2bd: 8b 45 0c mov 0xc(%ebp),%eax 2c0: 0f b6 00 movzbl (%eax),%eax 2c3: 38 c2 cmp %al,%dl 2c5: 75 1b jne 2e2 <matchhere+0xae> return matchhere(re+1, text+1); 2c7: 8b 45 0c mov 0xc(%ebp),%eax 2ca: 8d 50 01 lea 0x1(%eax),%edx 2cd: 8b 45 08 mov 0x8(%ebp),%eax 2d0: 83 c0 01 add $0x1,%eax 2d3: 83 ec 08 sub $0x8,%esp 2d6: 52 push %edx 2d7: 50 push %eax 2d8: e8 57 ff ff ff call 234 <matchhere> 2dd: 83 c4 10 add $0x10,%esp 2e0: eb 05 jmp 2e7 <matchhere+0xb3> return 0; 2e2: b8 00 00 00 00 mov $0x0,%eax } 2e7: c9 leave 2e8: c3 ret 000002e9 <matchstar>: // matchstar: search for c*re at beginning of text int matchstar(int c, char *re, char *text) { 2e9: 55 push %ebp 2ea: 89 e5 mov %esp,%ebp 2ec: 83 ec 08 sub $0x8,%esp do{ // a * matches zero or more instances if(matchhere(re, text)) 2ef: 83 ec 08 sub $0x8,%esp 2f2: ff 75 10 pushl 0x10(%ebp) 2f5: ff 75 0c pushl 0xc(%ebp) 2f8: e8 37 ff ff ff call 234 <matchhere> 2fd: 83 c4 10 add $0x10,%esp 300: 85 c0 test %eax,%eax 302: 74 07 je 30b <matchstar+0x22> return 1; 304: b8 01 00 00 00 mov $0x1,%eax 309: eb 29 jmp 334 <matchstar+0x4b> }while(*text!='\0' && (*text++==c || c=='.')); 30b: 8b 45 10 mov 0x10(%ebp),%eax 30e: 0f b6 00 movzbl (%eax),%eax 311: 84 c0 test %al,%al 313: 74 1a je 32f <matchstar+0x46> 315: 8b 45 10 mov 0x10(%ebp),%eax 318: 8d 50 01 lea 0x1(%eax),%edx 31b: 89 55 10 mov %edx,0x10(%ebp) 31e: 0f b6 00 movzbl (%eax),%eax 321: 0f be c0 movsbl %al,%eax 324: 3b 45 08 cmp 0x8(%ebp),%eax 327: 74 c6 je 2ef <matchstar+0x6> 329: 83 7d 08 2e cmpl $0x2e,0x8(%ebp) 32d: 74 c0 je 2ef <matchstar+0x6> return 0; 32f: b8 00 00 00 00 mov $0x0,%eax } 334: c9 leave 335: c3 ret 00000336 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 336: 55 push %ebp 337: 89 e5 mov %esp,%ebp 339: 57 push %edi 33a: 53 push %ebx asm volatile("cld; rep stosb" : 33b: 8b 4d 08 mov 0x8(%ebp),%ecx 33e: 8b 55 10 mov 0x10(%ebp),%edx 341: 8b 45 0c mov 0xc(%ebp),%eax 344: 89 cb mov %ecx,%ebx 346: 89 df mov %ebx,%edi 348: 89 d1 mov %edx,%ecx 34a: fc cld 34b: f3 aa rep stos %al,%es:(%edi) 34d: 89 ca mov %ecx,%edx 34f: 89 fb mov %edi,%ebx 351: 89 5d 08 mov %ebx,0x8(%ebp) 354: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 357: 90 nop 358: 5b pop %ebx 359: 5f pop %edi 35a: 5d pop %ebp 35b: c3 ret 0000035c <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 35c: 55 push %ebp 35d: 89 e5 mov %esp,%ebp 35f: 83 ec 10 sub $0x10,%esp char *os; os = s; 362: 8b 45 08 mov 0x8(%ebp),%eax 365: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 368: 90 nop 369: 8b 45 08 mov 0x8(%ebp),%eax 36c: 8d 50 01 lea 0x1(%eax),%edx 36f: 89 55 08 mov %edx,0x8(%ebp) 372: 8b 55 0c mov 0xc(%ebp),%edx 375: 8d 4a 01 lea 0x1(%edx),%ecx 378: 89 4d 0c mov %ecx,0xc(%ebp) 37b: 0f b6 12 movzbl (%edx),%edx 37e: 88 10 mov %dl,(%eax) 380: 0f b6 00 movzbl (%eax),%eax 383: 84 c0 test %al,%al 385: 75 e2 jne 369 <strcpy+0xd> ; return os; 387: 8b 45 fc mov -0x4(%ebp),%eax } 38a: c9 leave 38b: c3 ret 0000038c <strcmp>: int strcmp(const char *p, const char *q) { 38c: 55 push %ebp 38d: 89 e5 mov %esp,%ebp while(*p && *p == *q) 38f: eb 08 jmp 399 <strcmp+0xd> p++, q++; 391: 83 45 08 01 addl $0x1,0x8(%ebp) 395: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 399: 8b 45 08 mov 0x8(%ebp),%eax 39c: 0f b6 00 movzbl (%eax),%eax 39f: 84 c0 test %al,%al 3a1: 74 10 je 3b3 <strcmp+0x27> 3a3: 8b 45 08 mov 0x8(%ebp),%eax 3a6: 0f b6 10 movzbl (%eax),%edx 3a9: 8b 45 0c mov 0xc(%ebp),%eax 3ac: 0f b6 00 movzbl (%eax),%eax 3af: 38 c2 cmp %al,%dl 3b1: 74 de je 391 <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 3b3: 8b 45 08 mov 0x8(%ebp),%eax 3b6: 0f b6 00 movzbl (%eax),%eax 3b9: 0f b6 d0 movzbl %al,%edx 3bc: 8b 45 0c mov 0xc(%ebp),%eax 3bf: 0f b6 00 movzbl (%eax),%eax 3c2: 0f b6 c0 movzbl %al,%eax 3c5: 29 c2 sub %eax,%edx 3c7: 89 d0 mov %edx,%eax } 3c9: 5d pop %ebp 3ca: c3 ret 000003cb <strlen>: uint strlen(char *s) { 3cb: 55 push %ebp 3cc: 89 e5 mov %esp,%ebp 3ce: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 3d1: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 3d8: eb 04 jmp 3de <strlen+0x13> 3da: 83 45 fc 01 addl $0x1,-0x4(%ebp) 3de: 8b 55 fc mov -0x4(%ebp),%edx 3e1: 8b 45 08 mov 0x8(%ebp),%eax 3e4: 01 d0 add %edx,%eax 3e6: 0f b6 00 movzbl (%eax),%eax 3e9: 84 c0 test %al,%al 3eb: 75 ed jne 3da <strlen+0xf> ; return n; 3ed: 8b 45 fc mov -0x4(%ebp),%eax } 3f0: c9 leave 3f1: c3 ret 000003f2 <memset>: void* memset(void *dst, int c, uint n) { 3f2: 55 push %ebp 3f3: 89 e5 mov %esp,%ebp stosb(dst, c, n); 3f5: 8b 45 10 mov 0x10(%ebp),%eax 3f8: 50 push %eax 3f9: ff 75 0c pushl 0xc(%ebp) 3fc: ff 75 08 pushl 0x8(%ebp) 3ff: e8 32 ff ff ff call 336 <stosb> 404: 83 c4 0c add $0xc,%esp return dst; 407: 8b 45 08 mov 0x8(%ebp),%eax } 40a: c9 leave 40b: c3 ret 0000040c <strchr>: char* strchr(const char *s, char c) { 40c: 55 push %ebp 40d: 89 e5 mov %esp,%ebp 40f: 83 ec 04 sub $0x4,%esp 412: 8b 45 0c mov 0xc(%ebp),%eax 415: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 418: eb 14 jmp 42e <strchr+0x22> if(*s == c) 41a: 8b 45 08 mov 0x8(%ebp),%eax 41d: 0f b6 00 movzbl (%eax),%eax 420: 3a 45 fc cmp -0x4(%ebp),%al 423: 75 05 jne 42a <strchr+0x1e> return (char*)s; 425: 8b 45 08 mov 0x8(%ebp),%eax 428: eb 13 jmp 43d <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 42a: 83 45 08 01 addl $0x1,0x8(%ebp) 42e: 8b 45 08 mov 0x8(%ebp),%eax 431: 0f b6 00 movzbl (%eax),%eax 434: 84 c0 test %al,%al 436: 75 e2 jne 41a <strchr+0xe> if(*s == c) return (char*)s; return 0; 438: b8 00 00 00 00 mov $0x0,%eax } 43d: c9 leave 43e: c3 ret 0000043f <gets>: char* gets(char *buf, int max) { 43f: 55 push %ebp 440: 89 e5 mov %esp,%ebp 442: 83 ec 18 sub $0x18,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 445: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 44c: eb 42 jmp 490 <gets+0x51> cc = read(0, &c, 1); 44e: 83 ec 04 sub $0x4,%esp 451: 6a 01 push $0x1 453: 8d 45 ef lea -0x11(%ebp),%eax 456: 50 push %eax 457: 6a 00 push $0x0 459: e8 8c 01 00 00 call 5ea <read> 45e: 83 c4 10 add $0x10,%esp 461: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 464: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 468: 7e 33 jle 49d <gets+0x5e> break; buf[i++] = c; 46a: 8b 45 f4 mov -0xc(%ebp),%eax 46d: 8d 50 01 lea 0x1(%eax),%edx 470: 89 55 f4 mov %edx,-0xc(%ebp) 473: 89 c2 mov %eax,%edx 475: 8b 45 08 mov 0x8(%ebp),%eax 478: 01 c2 add %eax,%edx 47a: 0f b6 45 ef movzbl -0x11(%ebp),%eax 47e: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 480: 0f b6 45 ef movzbl -0x11(%ebp),%eax 484: 3c 0a cmp $0xa,%al 486: 74 16 je 49e <gets+0x5f> 488: 0f b6 45 ef movzbl -0x11(%ebp),%eax 48c: 3c 0d cmp $0xd,%al 48e: 74 0e je 49e <gets+0x5f> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 490: 8b 45 f4 mov -0xc(%ebp),%eax 493: 83 c0 01 add $0x1,%eax 496: 3b 45 0c cmp 0xc(%ebp),%eax 499: 7c b3 jl 44e <gets+0xf> 49b: eb 01 jmp 49e <gets+0x5f> cc = read(0, &c, 1); if(cc < 1) break; 49d: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 49e: 8b 55 f4 mov -0xc(%ebp),%edx 4a1: 8b 45 08 mov 0x8(%ebp),%eax 4a4: 01 d0 add %edx,%eax 4a6: c6 00 00 movb $0x0,(%eax) return buf; 4a9: 8b 45 08 mov 0x8(%ebp),%eax } 4ac: c9 leave 4ad: c3 ret 000004ae <stat>: int stat(char *n, struct stat *st) { 4ae: 55 push %ebp 4af: 89 e5 mov %esp,%ebp 4b1: 83 ec 18 sub $0x18,%esp int fd; int r; fd = open(n, O_RDONLY); 4b4: 83 ec 08 sub $0x8,%esp 4b7: 6a 00 push $0x0 4b9: ff 75 08 pushl 0x8(%ebp) 4bc: e8 51 01 00 00 call 612 <open> 4c1: 83 c4 10 add $0x10,%esp 4c4: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 4c7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 4cb: 79 07 jns 4d4 <stat+0x26> return -1; 4cd: b8 ff ff ff ff mov $0xffffffff,%eax 4d2: eb 25 jmp 4f9 <stat+0x4b> r = fstat(fd, st); 4d4: 83 ec 08 sub $0x8,%esp 4d7: ff 75 0c pushl 0xc(%ebp) 4da: ff 75 f4 pushl -0xc(%ebp) 4dd: e8 48 01 00 00 call 62a <fstat> 4e2: 83 c4 10 add $0x10,%esp 4e5: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 4e8: 83 ec 0c sub $0xc,%esp 4eb: ff 75 f4 pushl -0xc(%ebp) 4ee: e8 07 01 00 00 call 5fa <close> 4f3: 83 c4 10 add $0x10,%esp return r; 4f6: 8b 45 f0 mov -0x10(%ebp),%eax } 4f9: c9 leave 4fa: c3 ret 000004fb <atoi>: // new atoi added 4/22/17 to be able to handle negative numbers int atoi(const char *s) { 4fb: 55 push %ebp 4fc: 89 e5 mov %esp,%ebp 4fe: 83 ec 10 sub $0x10,%esp int n, sign; n=0; 501: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while(*s==' ')s++;//Remove leading spaces 508: eb 04 jmp 50e <atoi+0x13> 50a: 83 45 08 01 addl $0x1,0x8(%ebp) 50e: 8b 45 08 mov 0x8(%ebp),%eax 511: 0f b6 00 movzbl (%eax),%eax 514: 3c 20 cmp $0x20,%al 516: 74 f2 je 50a <atoi+0xf> sign =(*s=='-')?-1 : 1; 518: 8b 45 08 mov 0x8(%ebp),%eax 51b: 0f b6 00 movzbl (%eax),%eax 51e: 3c 2d cmp $0x2d,%al 520: 75 07 jne 529 <atoi+0x2e> 522: b8 ff ff ff ff mov $0xffffffff,%eax 527: eb 05 jmp 52e <atoi+0x33> 529: b8 01 00 00 00 mov $0x1,%eax 52e: 89 45 f8 mov %eax,-0x8(%ebp) if(*s=='+' || *s=='-') 531: 8b 45 08 mov 0x8(%ebp),%eax 534: 0f b6 00 movzbl (%eax),%eax 537: 3c 2b cmp $0x2b,%al 539: 74 0a je 545 <atoi+0x4a> 53b: 8b 45 08 mov 0x8(%ebp),%eax 53e: 0f b6 00 movzbl (%eax),%eax 541: 3c 2d cmp $0x2d,%al 543: 75 2b jne 570 <atoi+0x75> s++; 545: 83 45 08 01 addl $0x1,0x8(%ebp) while('0' <= *s&&*s<='9') 549: eb 25 jmp 570 <atoi+0x75> n = n*10 + *s++ - '0'; 54b: 8b 55 fc mov -0x4(%ebp),%edx 54e: 89 d0 mov %edx,%eax 550: c1 e0 02 shl $0x2,%eax 553: 01 d0 add %edx,%eax 555: 01 c0 add %eax,%eax 557: 89 c1 mov %eax,%ecx 559: 8b 45 08 mov 0x8(%ebp),%eax 55c: 8d 50 01 lea 0x1(%eax),%edx 55f: 89 55 08 mov %edx,0x8(%ebp) 562: 0f b6 00 movzbl (%eax),%eax 565: 0f be c0 movsbl %al,%eax 568: 01 c8 add %ecx,%eax 56a: 83 e8 30 sub $0x30,%eax 56d: 89 45 fc mov %eax,-0x4(%ebp) n=0; while(*s==' ')s++;//Remove leading spaces sign =(*s=='-')?-1 : 1; if(*s=='+' || *s=='-') s++; while('0' <= *s&&*s<='9') 570: 8b 45 08 mov 0x8(%ebp),%eax 573: 0f b6 00 movzbl (%eax),%eax 576: 3c 2f cmp $0x2f,%al 578: 7e 0a jle 584 <atoi+0x89> 57a: 8b 45 08 mov 0x8(%ebp),%eax 57d: 0f b6 00 movzbl (%eax),%eax 580: 3c 39 cmp $0x39,%al 582: 7e c7 jle 54b <atoi+0x50> n = n*10 + *s++ - '0'; return sign*n; 584: 8b 45 f8 mov -0x8(%ebp),%eax 587: 0f af 45 fc imul -0x4(%ebp),%eax } 58b: c9 leave 58c: c3 ret 0000058d <memmove>: return n; } */ void* memmove(void *vdst, void *vsrc, int n) { 58d: 55 push %ebp 58e: 89 e5 mov %esp,%ebp 590: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 593: 8b 45 08 mov 0x8(%ebp),%eax 596: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 599: 8b 45 0c mov 0xc(%ebp),%eax 59c: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 59f: eb 17 jmp 5b8 <memmove+0x2b> *dst++ = *src++; 5a1: 8b 45 fc mov -0x4(%ebp),%eax 5a4: 8d 50 01 lea 0x1(%eax),%edx 5a7: 89 55 fc mov %edx,-0x4(%ebp) 5aa: 8b 55 f8 mov -0x8(%ebp),%edx 5ad: 8d 4a 01 lea 0x1(%edx),%ecx 5b0: 89 4d f8 mov %ecx,-0x8(%ebp) 5b3: 0f b6 12 movzbl (%edx),%edx 5b6: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 5b8: 8b 45 10 mov 0x10(%ebp),%eax 5bb: 8d 50 ff lea -0x1(%eax),%edx 5be: 89 55 10 mov %edx,0x10(%ebp) 5c1: 85 c0 test %eax,%eax 5c3: 7f dc jg 5a1 <memmove+0x14> *dst++ = *src++; return vdst; 5c5: 8b 45 08 mov 0x8(%ebp),%eax } 5c8: c9 leave 5c9: c3 ret 000005ca <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 5ca: b8 01 00 00 00 mov $0x1,%eax 5cf: cd 40 int $0x40 5d1: c3 ret 000005d2 <exit>: SYSCALL(exit) 5d2: b8 02 00 00 00 mov $0x2,%eax 5d7: cd 40 int $0x40 5d9: c3 ret 000005da <wait>: SYSCALL(wait) 5da: b8 03 00 00 00 mov $0x3,%eax 5df: cd 40 int $0x40 5e1: c3 ret 000005e2 <pipe>: SYSCALL(pipe) 5e2: b8 04 00 00 00 mov $0x4,%eax 5e7: cd 40 int $0x40 5e9: c3 ret 000005ea <read>: SYSCALL(read) 5ea: b8 05 00 00 00 mov $0x5,%eax 5ef: cd 40 int $0x40 5f1: c3 ret 000005f2 <write>: SYSCALL(write) 5f2: b8 10 00 00 00 mov $0x10,%eax 5f7: cd 40 int $0x40 5f9: c3 ret 000005fa <close>: SYSCALL(close) 5fa: b8 15 00 00 00 mov $0x15,%eax 5ff: cd 40 int $0x40 601: c3 ret 00000602 <kill>: SYSCALL(kill) 602: b8 06 00 00 00 mov $0x6,%eax 607: cd 40 int $0x40 609: c3 ret 0000060a <exec>: SYSCALL(exec) 60a: b8 07 00 00 00 mov $0x7,%eax 60f: cd 40 int $0x40 611: c3 ret 00000612 <open>: SYSCALL(open) 612: b8 0f 00 00 00 mov $0xf,%eax 617: cd 40 int $0x40 619: c3 ret 0000061a <mknod>: SYSCALL(mknod) 61a: b8 11 00 00 00 mov $0x11,%eax 61f: cd 40 int $0x40 621: c3 ret 00000622 <unlink>: SYSCALL(unlink) 622: b8 12 00 00 00 mov $0x12,%eax 627: cd 40 int $0x40 629: c3 ret 0000062a <fstat>: SYSCALL(fstat) 62a: b8 08 00 00 00 mov $0x8,%eax 62f: cd 40 int $0x40 631: c3 ret 00000632 <link>: SYSCALL(link) 632: b8 13 00 00 00 mov $0x13,%eax 637: cd 40 int $0x40 639: c3 ret 0000063a <mkdir>: SYSCALL(mkdir) 63a: b8 14 00 00 00 mov $0x14,%eax 63f: cd 40 int $0x40 641: c3 ret 00000642 <chdir>: SYSCALL(chdir) 642: b8 09 00 00 00 mov $0x9,%eax 647: cd 40 int $0x40 649: c3 ret 0000064a <dup>: SYSCALL(dup) 64a: b8 0a 00 00 00 mov $0xa,%eax 64f: cd 40 int $0x40 651: c3 ret 00000652 <getpid>: SYSCALL(getpid) 652: b8 0b 00 00 00 mov $0xb,%eax 657: cd 40 int $0x40 659: c3 ret 0000065a <sbrk>: SYSCALL(sbrk) 65a: b8 0c 00 00 00 mov $0xc,%eax 65f: cd 40 int $0x40 661: c3 ret 00000662 <sleep>: SYSCALL(sleep) 662: b8 0d 00 00 00 mov $0xd,%eax 667: cd 40 int $0x40 669: c3 ret 0000066a <uptime>: SYSCALL(uptime) 66a: b8 0e 00 00 00 mov $0xe,%eax 66f: cd 40 int $0x40 671: c3 ret 00000672 <halt>: SYSCALL(halt) 672: b8 16 00 00 00 mov $0x16,%eax 677: cd 40 int $0x40 679: c3 ret 0000067a <date>: //Project additions SYSCALL(date) 67a: b8 17 00 00 00 mov $0x17,%eax 67f: cd 40 int $0x40 681: c3 ret 00000682 <getuid>: SYSCALL(getuid) 682: b8 18 00 00 00 mov $0x18,%eax 687: cd 40 int $0x40 689: c3 ret 0000068a <getgid>: SYSCALL(getgid) 68a: b8 19 00 00 00 mov $0x19,%eax 68f: cd 40 int $0x40 691: c3 ret 00000692 <getppid>: SYSCALL(getppid) 692: b8 1a 00 00 00 mov $0x1a,%eax 697: cd 40 int $0x40 699: c3 ret 0000069a <setuid>: SYSCALL(setuid) 69a: b8 1b 00 00 00 mov $0x1b,%eax 69f: cd 40 int $0x40 6a1: c3 ret 000006a2 <setgid>: SYSCALL(setgid) 6a2: b8 1c 00 00 00 mov $0x1c,%eax 6a7: cd 40 int $0x40 6a9: c3 ret 000006aa <getprocs>: SYSCALL(getprocs) 6aa: b8 1d 00 00 00 mov $0x1d,%eax 6af: cd 40 int $0x40 6b1: c3 ret 000006b2 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 6b2: 55 push %ebp 6b3: 89 e5 mov %esp,%ebp 6b5: 83 ec 18 sub $0x18,%esp 6b8: 8b 45 0c mov 0xc(%ebp),%eax 6bb: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 6be: 83 ec 04 sub $0x4,%esp 6c1: 6a 01 push $0x1 6c3: 8d 45 f4 lea -0xc(%ebp),%eax 6c6: 50 push %eax 6c7: ff 75 08 pushl 0x8(%ebp) 6ca: e8 23 ff ff ff call 5f2 <write> 6cf: 83 c4 10 add $0x10,%esp } 6d2: 90 nop 6d3: c9 leave 6d4: c3 ret 000006d5 <printint>: static void printint(int fd, int xx, int base, int sgn) { 6d5: 55 push %ebp 6d6: 89 e5 mov %esp,%ebp 6d8: 53 push %ebx 6d9: 83 ec 24 sub $0x24,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 6dc: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 6e3: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 6e7: 74 17 je 700 <printint+0x2b> 6e9: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 6ed: 79 11 jns 700 <printint+0x2b> neg = 1; 6ef: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 6f6: 8b 45 0c mov 0xc(%ebp),%eax 6f9: f7 d8 neg %eax 6fb: 89 45 ec mov %eax,-0x14(%ebp) 6fe: eb 06 jmp 706 <printint+0x31> } else { x = xx; 700: 8b 45 0c mov 0xc(%ebp),%eax 703: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 706: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 70d: 8b 4d f4 mov -0xc(%ebp),%ecx 710: 8d 41 01 lea 0x1(%ecx),%eax 713: 89 45 f4 mov %eax,-0xc(%ebp) 716: 8b 5d 10 mov 0x10(%ebp),%ebx 719: 8b 45 ec mov -0x14(%ebp),%eax 71c: ba 00 00 00 00 mov $0x0,%edx 721: f7 f3 div %ebx 723: 89 d0 mov %edx,%eax 725: 0f b6 80 4c 0e 00 00 movzbl 0xe4c(%eax),%eax 72c: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 730: 8b 5d 10 mov 0x10(%ebp),%ebx 733: 8b 45 ec mov -0x14(%ebp),%eax 736: ba 00 00 00 00 mov $0x0,%edx 73b: f7 f3 div %ebx 73d: 89 45 ec mov %eax,-0x14(%ebp) 740: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 744: 75 c7 jne 70d <printint+0x38> if(neg) 746: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 74a: 74 2d je 779 <printint+0xa4> buf[i++] = '-'; 74c: 8b 45 f4 mov -0xc(%ebp),%eax 74f: 8d 50 01 lea 0x1(%eax),%edx 752: 89 55 f4 mov %edx,-0xc(%ebp) 755: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 75a: eb 1d jmp 779 <printint+0xa4> putc(fd, buf[i]); 75c: 8d 55 dc lea -0x24(%ebp),%edx 75f: 8b 45 f4 mov -0xc(%ebp),%eax 762: 01 d0 add %edx,%eax 764: 0f b6 00 movzbl (%eax),%eax 767: 0f be c0 movsbl %al,%eax 76a: 83 ec 08 sub $0x8,%esp 76d: 50 push %eax 76e: ff 75 08 pushl 0x8(%ebp) 771: e8 3c ff ff ff call 6b2 <putc> 776: 83 c4 10 add $0x10,%esp buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 779: 83 6d f4 01 subl $0x1,-0xc(%ebp) 77d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 781: 79 d9 jns 75c <printint+0x87> putc(fd, buf[i]); } 783: 90 nop 784: 8b 5d fc mov -0x4(%ebp),%ebx 787: c9 leave 788: c3 ret 00000789 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 789: 55 push %ebp 78a: 89 e5 mov %esp,%ebp 78c: 83 ec 28 sub $0x28,%esp char *s; int c, i, state; uint *ap; state = 0; 78f: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 796: 8d 45 0c lea 0xc(%ebp),%eax 799: 83 c0 04 add $0x4,%eax 79c: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 79f: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 7a6: e9 59 01 00 00 jmp 904 <printf+0x17b> c = fmt[i] & 0xff; 7ab: 8b 55 0c mov 0xc(%ebp),%edx 7ae: 8b 45 f0 mov -0x10(%ebp),%eax 7b1: 01 d0 add %edx,%eax 7b3: 0f b6 00 movzbl (%eax),%eax 7b6: 0f be c0 movsbl %al,%eax 7b9: 25 ff 00 00 00 and $0xff,%eax 7be: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 7c1: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 7c5: 75 2c jne 7f3 <printf+0x6a> if(c == '%'){ 7c7: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 7cb: 75 0c jne 7d9 <printf+0x50> state = '%'; 7cd: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 7d4: e9 27 01 00 00 jmp 900 <printf+0x177> } else { putc(fd, c); 7d9: 8b 45 e4 mov -0x1c(%ebp),%eax 7dc: 0f be c0 movsbl %al,%eax 7df: 83 ec 08 sub $0x8,%esp 7e2: 50 push %eax 7e3: ff 75 08 pushl 0x8(%ebp) 7e6: e8 c7 fe ff ff call 6b2 <putc> 7eb: 83 c4 10 add $0x10,%esp 7ee: e9 0d 01 00 00 jmp 900 <printf+0x177> } } else if(state == '%'){ 7f3: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 7f7: 0f 85 03 01 00 00 jne 900 <printf+0x177> if(c == 'd'){ 7fd: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 801: 75 1e jne 821 <printf+0x98> printint(fd, *ap, 10, 1); 803: 8b 45 e8 mov -0x18(%ebp),%eax 806: 8b 00 mov (%eax),%eax 808: 6a 01 push $0x1 80a: 6a 0a push $0xa 80c: 50 push %eax 80d: ff 75 08 pushl 0x8(%ebp) 810: e8 c0 fe ff ff call 6d5 <printint> 815: 83 c4 10 add $0x10,%esp ap++; 818: 83 45 e8 04 addl $0x4,-0x18(%ebp) 81c: e9 d8 00 00 00 jmp 8f9 <printf+0x170> } else if(c == 'x' || c == 'p'){ 821: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 825: 74 06 je 82d <printf+0xa4> 827: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 82b: 75 1e jne 84b <printf+0xc2> printint(fd, *ap, 16, 0); 82d: 8b 45 e8 mov -0x18(%ebp),%eax 830: 8b 00 mov (%eax),%eax 832: 6a 00 push $0x0 834: 6a 10 push $0x10 836: 50 push %eax 837: ff 75 08 pushl 0x8(%ebp) 83a: e8 96 fe ff ff call 6d5 <printint> 83f: 83 c4 10 add $0x10,%esp ap++; 842: 83 45 e8 04 addl $0x4,-0x18(%ebp) 846: e9 ae 00 00 00 jmp 8f9 <printf+0x170> } else if(c == 's'){ 84b: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 84f: 75 43 jne 894 <printf+0x10b> s = (char*)*ap; 851: 8b 45 e8 mov -0x18(%ebp),%eax 854: 8b 00 mov (%eax),%eax 856: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 859: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 85d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 861: 75 25 jne 888 <printf+0xff> s = "(null)"; 863: c7 45 f4 76 0b 00 00 movl $0xb76,-0xc(%ebp) while(*s != 0){ 86a: eb 1c jmp 888 <printf+0xff> putc(fd, *s); 86c: 8b 45 f4 mov -0xc(%ebp),%eax 86f: 0f b6 00 movzbl (%eax),%eax 872: 0f be c0 movsbl %al,%eax 875: 83 ec 08 sub $0x8,%esp 878: 50 push %eax 879: ff 75 08 pushl 0x8(%ebp) 87c: e8 31 fe ff ff call 6b2 <putc> 881: 83 c4 10 add $0x10,%esp s++; 884: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 888: 8b 45 f4 mov -0xc(%ebp),%eax 88b: 0f b6 00 movzbl (%eax),%eax 88e: 84 c0 test %al,%al 890: 75 da jne 86c <printf+0xe3> 892: eb 65 jmp 8f9 <printf+0x170> putc(fd, *s); s++; } } else if(c == 'c'){ 894: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 898: 75 1d jne 8b7 <printf+0x12e> putc(fd, *ap); 89a: 8b 45 e8 mov -0x18(%ebp),%eax 89d: 8b 00 mov (%eax),%eax 89f: 0f be c0 movsbl %al,%eax 8a2: 83 ec 08 sub $0x8,%esp 8a5: 50 push %eax 8a6: ff 75 08 pushl 0x8(%ebp) 8a9: e8 04 fe ff ff call 6b2 <putc> 8ae: 83 c4 10 add $0x10,%esp ap++; 8b1: 83 45 e8 04 addl $0x4,-0x18(%ebp) 8b5: eb 42 jmp 8f9 <printf+0x170> } else if(c == '%'){ 8b7: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 8bb: 75 17 jne 8d4 <printf+0x14b> putc(fd, c); 8bd: 8b 45 e4 mov -0x1c(%ebp),%eax 8c0: 0f be c0 movsbl %al,%eax 8c3: 83 ec 08 sub $0x8,%esp 8c6: 50 push %eax 8c7: ff 75 08 pushl 0x8(%ebp) 8ca: e8 e3 fd ff ff call 6b2 <putc> 8cf: 83 c4 10 add $0x10,%esp 8d2: eb 25 jmp 8f9 <printf+0x170> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 8d4: 83 ec 08 sub $0x8,%esp 8d7: 6a 25 push $0x25 8d9: ff 75 08 pushl 0x8(%ebp) 8dc: e8 d1 fd ff ff call 6b2 <putc> 8e1: 83 c4 10 add $0x10,%esp putc(fd, c); 8e4: 8b 45 e4 mov -0x1c(%ebp),%eax 8e7: 0f be c0 movsbl %al,%eax 8ea: 83 ec 08 sub $0x8,%esp 8ed: 50 push %eax 8ee: ff 75 08 pushl 0x8(%ebp) 8f1: e8 bc fd ff ff call 6b2 <putc> 8f6: 83 c4 10 add $0x10,%esp } state = 0; 8f9: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 900: 83 45 f0 01 addl $0x1,-0x10(%ebp) 904: 8b 55 0c mov 0xc(%ebp),%edx 907: 8b 45 f0 mov -0x10(%ebp),%eax 90a: 01 d0 add %edx,%eax 90c: 0f b6 00 movzbl (%eax),%eax 90f: 84 c0 test %al,%al 911: 0f 85 94 fe ff ff jne 7ab <printf+0x22> putc(fd, c); } state = 0; } } } 917: 90 nop 918: c9 leave 919: c3 ret 0000091a <free>: static Header base; static Header *freep; void free(void *ap) { 91a: 55 push %ebp 91b: 89 e5 mov %esp,%ebp 91d: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 920: 8b 45 08 mov 0x8(%ebp),%eax 923: 83 e8 08 sub $0x8,%eax 926: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 929: a1 68 0e 00 00 mov 0xe68,%eax 92e: 89 45 fc mov %eax,-0x4(%ebp) 931: eb 24 jmp 957 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 933: 8b 45 fc mov -0x4(%ebp),%eax 936: 8b 00 mov (%eax),%eax 938: 3b 45 fc cmp -0x4(%ebp),%eax 93b: 77 12 ja 94f <free+0x35> 93d: 8b 45 f8 mov -0x8(%ebp),%eax 940: 3b 45 fc cmp -0x4(%ebp),%eax 943: 77 24 ja 969 <free+0x4f> 945: 8b 45 fc mov -0x4(%ebp),%eax 948: 8b 00 mov (%eax),%eax 94a: 3b 45 f8 cmp -0x8(%ebp),%eax 94d: 77 1a ja 969 <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 94f: 8b 45 fc mov -0x4(%ebp),%eax 952: 8b 00 mov (%eax),%eax 954: 89 45 fc mov %eax,-0x4(%ebp) 957: 8b 45 f8 mov -0x8(%ebp),%eax 95a: 3b 45 fc cmp -0x4(%ebp),%eax 95d: 76 d4 jbe 933 <free+0x19> 95f: 8b 45 fc mov -0x4(%ebp),%eax 962: 8b 00 mov (%eax),%eax 964: 3b 45 f8 cmp -0x8(%ebp),%eax 967: 76 ca jbe 933 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 969: 8b 45 f8 mov -0x8(%ebp),%eax 96c: 8b 40 04 mov 0x4(%eax),%eax 96f: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 976: 8b 45 f8 mov -0x8(%ebp),%eax 979: 01 c2 add %eax,%edx 97b: 8b 45 fc mov -0x4(%ebp),%eax 97e: 8b 00 mov (%eax),%eax 980: 39 c2 cmp %eax,%edx 982: 75 24 jne 9a8 <free+0x8e> bp->s.size += p->s.ptr->s.size; 984: 8b 45 f8 mov -0x8(%ebp),%eax 987: 8b 50 04 mov 0x4(%eax),%edx 98a: 8b 45 fc mov -0x4(%ebp),%eax 98d: 8b 00 mov (%eax),%eax 98f: 8b 40 04 mov 0x4(%eax),%eax 992: 01 c2 add %eax,%edx 994: 8b 45 f8 mov -0x8(%ebp),%eax 997: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 99a: 8b 45 fc mov -0x4(%ebp),%eax 99d: 8b 00 mov (%eax),%eax 99f: 8b 10 mov (%eax),%edx 9a1: 8b 45 f8 mov -0x8(%ebp),%eax 9a4: 89 10 mov %edx,(%eax) 9a6: eb 0a jmp 9b2 <free+0x98> } else bp->s.ptr = p->s.ptr; 9a8: 8b 45 fc mov -0x4(%ebp),%eax 9ab: 8b 10 mov (%eax),%edx 9ad: 8b 45 f8 mov -0x8(%ebp),%eax 9b0: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 9b2: 8b 45 fc mov -0x4(%ebp),%eax 9b5: 8b 40 04 mov 0x4(%eax),%eax 9b8: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 9bf: 8b 45 fc mov -0x4(%ebp),%eax 9c2: 01 d0 add %edx,%eax 9c4: 3b 45 f8 cmp -0x8(%ebp),%eax 9c7: 75 20 jne 9e9 <free+0xcf> p->s.size += bp->s.size; 9c9: 8b 45 fc mov -0x4(%ebp),%eax 9cc: 8b 50 04 mov 0x4(%eax),%edx 9cf: 8b 45 f8 mov -0x8(%ebp),%eax 9d2: 8b 40 04 mov 0x4(%eax),%eax 9d5: 01 c2 add %eax,%edx 9d7: 8b 45 fc mov -0x4(%ebp),%eax 9da: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 9dd: 8b 45 f8 mov -0x8(%ebp),%eax 9e0: 8b 10 mov (%eax),%edx 9e2: 8b 45 fc mov -0x4(%ebp),%eax 9e5: 89 10 mov %edx,(%eax) 9e7: eb 08 jmp 9f1 <free+0xd7> } else p->s.ptr = bp; 9e9: 8b 45 fc mov -0x4(%ebp),%eax 9ec: 8b 55 f8 mov -0x8(%ebp),%edx 9ef: 89 10 mov %edx,(%eax) freep = p; 9f1: 8b 45 fc mov -0x4(%ebp),%eax 9f4: a3 68 0e 00 00 mov %eax,0xe68 } 9f9: 90 nop 9fa: c9 leave 9fb: c3 ret 000009fc <morecore>: static Header* morecore(uint nu) { 9fc: 55 push %ebp 9fd: 89 e5 mov %esp,%ebp 9ff: 83 ec 18 sub $0x18,%esp char *p; Header *hp; if(nu < 4096) a02: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) a09: 77 07 ja a12 <morecore+0x16> nu = 4096; a0b: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); a12: 8b 45 08 mov 0x8(%ebp),%eax a15: c1 e0 03 shl $0x3,%eax a18: 83 ec 0c sub $0xc,%esp a1b: 50 push %eax a1c: e8 39 fc ff ff call 65a <sbrk> a21: 83 c4 10 add $0x10,%esp a24: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) a27: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) a2b: 75 07 jne a34 <morecore+0x38> return 0; a2d: b8 00 00 00 00 mov $0x0,%eax a32: eb 26 jmp a5a <morecore+0x5e> hp = (Header*)p; a34: 8b 45 f4 mov -0xc(%ebp),%eax a37: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; a3a: 8b 45 f0 mov -0x10(%ebp),%eax a3d: 8b 55 08 mov 0x8(%ebp),%edx a40: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); a43: 8b 45 f0 mov -0x10(%ebp),%eax a46: 83 c0 08 add $0x8,%eax a49: 83 ec 0c sub $0xc,%esp a4c: 50 push %eax a4d: e8 c8 fe ff ff call 91a <free> a52: 83 c4 10 add $0x10,%esp return freep; a55: a1 68 0e 00 00 mov 0xe68,%eax } a5a: c9 leave a5b: c3 ret 00000a5c <malloc>: void* malloc(uint nbytes) { a5c: 55 push %ebp a5d: 89 e5 mov %esp,%ebp a5f: 83 ec 18 sub $0x18,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; a62: 8b 45 08 mov 0x8(%ebp),%eax a65: 83 c0 07 add $0x7,%eax a68: c1 e8 03 shr $0x3,%eax a6b: 83 c0 01 add $0x1,%eax a6e: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ a71: a1 68 0e 00 00 mov 0xe68,%eax a76: 89 45 f0 mov %eax,-0x10(%ebp) a79: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) a7d: 75 23 jne aa2 <malloc+0x46> base.s.ptr = freep = prevp = &base; a7f: c7 45 f0 60 0e 00 00 movl $0xe60,-0x10(%ebp) a86: 8b 45 f0 mov -0x10(%ebp),%eax a89: a3 68 0e 00 00 mov %eax,0xe68 a8e: a1 68 0e 00 00 mov 0xe68,%eax a93: a3 60 0e 00 00 mov %eax,0xe60 base.s.size = 0; a98: c7 05 64 0e 00 00 00 movl $0x0,0xe64 a9f: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ aa2: 8b 45 f0 mov -0x10(%ebp),%eax aa5: 8b 00 mov (%eax),%eax aa7: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ aaa: 8b 45 f4 mov -0xc(%ebp),%eax aad: 8b 40 04 mov 0x4(%eax),%eax ab0: 3b 45 ec cmp -0x14(%ebp),%eax ab3: 72 4d jb b02 <malloc+0xa6> if(p->s.size == nunits) ab5: 8b 45 f4 mov -0xc(%ebp),%eax ab8: 8b 40 04 mov 0x4(%eax),%eax abb: 3b 45 ec cmp -0x14(%ebp),%eax abe: 75 0c jne acc <malloc+0x70> prevp->s.ptr = p->s.ptr; ac0: 8b 45 f4 mov -0xc(%ebp),%eax ac3: 8b 10 mov (%eax),%edx ac5: 8b 45 f0 mov -0x10(%ebp),%eax ac8: 89 10 mov %edx,(%eax) aca: eb 26 jmp af2 <malloc+0x96> else { p->s.size -= nunits; acc: 8b 45 f4 mov -0xc(%ebp),%eax acf: 8b 40 04 mov 0x4(%eax),%eax ad2: 2b 45 ec sub -0x14(%ebp),%eax ad5: 89 c2 mov %eax,%edx ad7: 8b 45 f4 mov -0xc(%ebp),%eax ada: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; add: 8b 45 f4 mov -0xc(%ebp),%eax ae0: 8b 40 04 mov 0x4(%eax),%eax ae3: c1 e0 03 shl $0x3,%eax ae6: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; ae9: 8b 45 f4 mov -0xc(%ebp),%eax aec: 8b 55 ec mov -0x14(%ebp),%edx aef: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; af2: 8b 45 f0 mov -0x10(%ebp),%eax af5: a3 68 0e 00 00 mov %eax,0xe68 return (void*)(p + 1); afa: 8b 45 f4 mov -0xc(%ebp),%eax afd: 83 c0 08 add $0x8,%eax b00: eb 3b jmp b3d <malloc+0xe1> } if(p == freep) b02: a1 68 0e 00 00 mov 0xe68,%eax b07: 39 45 f4 cmp %eax,-0xc(%ebp) b0a: 75 1e jne b2a <malloc+0xce> if((p = morecore(nunits)) == 0) b0c: 83 ec 0c sub $0xc,%esp b0f: ff 75 ec pushl -0x14(%ebp) b12: e8 e5 fe ff ff call 9fc <morecore> b17: 83 c4 10 add $0x10,%esp b1a: 89 45 f4 mov %eax,-0xc(%ebp) b1d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) b21: 75 07 jne b2a <malloc+0xce> return 0; b23: b8 00 00 00 00 mov $0x0,%eax b28: eb 13 jmp b3d <malloc+0xe1> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ b2a: 8b 45 f4 mov -0xc(%ebp),%eax b2d: 89 45 f0 mov %eax,-0x10(%ebp) b30: 8b 45 f4 mov -0xc(%ebp),%eax b33: 8b 00 mov (%eax),%eax b35: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } b38: e9 6d ff ff ff jmp aaa <malloc+0x4e> } b3d: c9 leave b3e: c3 ret
35.028186
63
0.423836
512005be8b5d0b3a284ce22254e49f4c0ad7815c
561
asm
Assembly
oeis/313/A313778.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/313/A313778.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/313/A313778.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A313778: Coordination sequence Gal.6.203.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. ; Submitted by Simon Strandgaard ; 1,5,10,15,21,26,30,34,39,45,50,55,60,65,70,75,81,86,90,94,99,105,110,115,120,125,130,135,141,146,150,154,159,165,170,175,180,185,190,195 seq $0,315768 ; Coordination sequence Gal.6.628.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. mul $0,6 add $0,3 div $0,7
62.333333
182
0.752228
f72e800b2c700b1ab59b99e9bf7b068e6bc7c80a
13,665
asm
Assembly
crd2consl/crd2consl.asm
s390guy/simh_tests
545ca36d735f1136594c14ccabc8f5020a9d75e8
[ "MIT" ]
1
2021-12-01T01:32:22.000Z
2021-12-01T01:32:22.000Z
crd2consl/crd2consl.asm
s390guy/simh_tests
545ca36d735f1136594c14ccabc8f5020a9d75e8
[ "MIT" ]
null
null
null
crd2consl/crd2consl.asm
s390guy/simh_tests
545ca36d735f1136594c14ccabc8f5020a9d75e8
[ "MIT" ]
null
null
null
* Copyright 2021 Harold Grovesteen * * MIT License: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. TITLE 'CRD2CONSL - SEND CARD CONTENTS TO CONSOLE' * Program Description: * * CRD2CONSL is a bare-metal program. It requires input/output commands to * the IPL card stream to read a card's contents and then send the card's * contents to the consolde device. * * The program is executed by means of an IPL from a card deck containing as * the last card the one that is sent to the console. The card contains * EBCDIC data and is part of the IPL deck. * * Target Architecture: S/360 * * Devices Used: * 10C - IPL card reader * 01F - Console device * * Program Register Usage: * * R0 Base register for access to the ASA. Required by DSECT usage * R1 Device Channel and Unit Address for I/O instructions * R11 Contains zero for STATUS clearing (zero from CPU reset). * R12 The program base register * R15 Subroutine return register * * Disabled Wait State PSW's address field values used by the program: * X'000000' - Successful execution of the program * X'000008' - Unexpected Restart interruption occurred. Old Restart PSW at * address X'8' * X'000018' - Unexpected External interruption occurred. Old External PSW at * address X'18' * X'000020' - Unexpected Supervisor interruption occurred. Old Supervisor * PSW at address X'20' * X'000028' - Unexpected Program interruption occurred. Old Program PSW at * address X'28' * X'000030' - Unexpected Machine Check interruption occurred. Old Machine * Check PSW at address X'30' * X'000038' - Unexpected Input/Output interruption occurred. Old Input/Output * PSW at address X'38' * X'010004' - Console Device X'01F' or channel not operational * X'010008' - Console Device X'01F' or channel busy * X'01000C' - Console Device X'01F' or channel had a problem. See CSW. * X'010010' - Unexpected interruption from some other device. See ASA X'BA' * X'010014' - Console channel error occurred * X'010018' - Console device did not complete the I/O without a problem * X'020004' - Reader Device X'00C' or channel not operational * X'020008' - Reader Device X'00C' or channel busy * X'02000C' - Reader Device X'00C' or channel had a problem. See CSW. * X'020010' - Not used * X'020014' - Reader channel error occurred * X'020018' - Reader device did not complete the I/O without a problem EJECT * See all object data and macro generated model statements in the listing PRINT DATA,GEN SPACE 1 * Inform the SATK macros of the architecture being targeted. Inferred from * the ASMA -t command-line argument. ARCHLVL * Ensure interrupt traps are loaded by iplasma.py before program execution * begins. This macro will create the memory region that will also contain * the IPL PSW. The region name defaults to ASAREGN. iplasma.py knows how * to deal with this situation. ASASECT ASALOAD ASAIPL IA=PGMSTART Define the bare-metal program's IPL PSW SPACE 2 * * The Bare-Metal Hello World Program * SPACE 1 PGMSECT START X'2000',CRD2CSL Start a second region for the program itself * This results in CRD2CSL.bin being created in the list directed IPL directory USING ASA,0 Give me instruction access to the ASA CSECT PGMSTART BALR 12,0 Establish my base register USING *,12 Tell the assembler SPACE 1 LH 1,2 Get the card reader device address (stored by IPL) * Do this before bytes 2 and 3 are overlayed by the restart trap PSW. SPACE 1 * Ensure program is not re-entered by a Hercules console initiated restart. * Address 0 changed from its absolute storage role (IPL PSW) to its real * storage role (Restart New PSW) after the IPL. * Change from the IPL PSW at address 0 to Restart New PSW trap MVC RSTNPSW,PGMRS SPACE 3 * Most systems pass control to the CPU following receipt of CE and DE from * the IPL device. On some systems, the transfer occurs upon receipt of * CE allowing the device to later supply the DE. The following code is * used to effect the same wait for DE that usually happens by the hardware * executing the IPL function. IPLWAIT TIO 0(1) Request the IPL device status BC B'0001',RNOAVL If CC=3, device unavailable. Tell someone. * IF CC=2 or 1, busy or CSW stored, wait until the device is available. * The assumption is that the CSW contains the DE that the program is waiting * to see. The program does not really care about the received status. * It is just looking for the IPL device to be available. BC B'0110',IPLWAIT * CC=0, available, allows the program to continue. SPACE 1 * Note: For systems the do NOT transfer control to the CPU until DE IS * received, the above sequence will return CC=0 on the first TIO and proceed * into the program as it would normally. SPACE 3 * Read a card from the IPL device * No need to validate that the IPL device is present. The fact that this * program got loaded and is executing proves the reader device is present and * working. MVC CAW(4),RCCWADDR Identify the IPL device CCW to be executed SIO 0(1) Request the reader channel program to start, did it? BC B'0001',RNOAVL ..No, CC=3 don't know why, but tell someone. BC B'0010',RBUSY ..No, CC=2 console device or channel is busy BC B'0100',RCSW ..No, CC=1 CSW stored in ASA at X'40' * Reader device is now sending the card's contents (CC=0) * Wait for an I/O interruption RDRWAIT BAL 15,DOWAIT WAIT FOR I/O interrupt SPACE 1 * I/O results can now be checked. * Yes, check the CSW conditions to determine if the console I/O worked OC STATUS,CSW+4 Accummulate Device and Channel status CLI STATUS+1,X'00' Did the channel have, a problem? BNE RCHLERR ..Yes, end with a reader channel error TM STATUS,X'F3' Did the unit encounter a problem? BNZ RUNTERR ..No, end with a unit error TM STATUS,X'0C' Did both channel and unit end? BNO RDRWAIT Wait again for both to be done * CARD HAS BEEN SUCCESSFULLY READ! SPACE 3 * Determine if the console device, subchannel and channel are ready for use. LH 1,CONDEV Set up I/O device address in I/O instruction register TIO 0(1) Determine if the console is there BC B'0001',DEVNOAVL ..No, CC=3 might have a different config address BC B'0010',DEVBUSY ..No, CC=2 console device or channel is busy BC B'0100',DEVCSW ..No, CC=1 CSW stored in ASA at X'40' * Console device is available (CC=0)! SPACE 1 * Prepare for I/O to console STH 11,STATUS Clear status for console I/O operation MVC CAW(4),CCWADDR Identify in ASA where first CCW resides SPACE 1 * Send the Hello World message to the console SIO 0(1) Request console channel program to start, did it? BC B'0001',DEVNOAVL ..No, CC=3 don't know why, but tell someone. BC B'0010',DEVBUSY ..No, CC=2 console device or channel is busy BC B'0100',DEVCSW ..No, CC=1 CSW stored in ASA at X'40' * Console device is now receiving the card contents (CC=0) SPACE 1 * Wait for an I/O interruption CONWAIT BAL 15,DOWAIT SPACE 1 * I/O results can now be checked. * Yes, check the CSW conditions to determine if the console I/O worked OC STATUS,CSW+4 Accummulate Device and Channel status CLI STATUS+1,X'00' Did the channel have, a problem? BNE CHNLERR ..Yes, end with a channel error TM STATUS,X'F3' Did the unit encounter a problem? BNZ UNITERR ..No, end with a unit error TM STATUS,X'0C' Did both channel and unit end? BNO CONWAIT Wait again for both to be done * Both channel and unit have ended SPACE 1 * HURRAY! CARD CONTENTS HAVE BEEN SENT TO THE CONSOLE! LPSW DONE Normal program termination SPACE 3 * * I/O WAIT SUBROUTINE * DOWAIT MVC IONPSW(8),CONT Set up continuation PSW for after I/O interrupt LPSW WAIT Wait for I/O interruption and CSW from channel IODONE EQU * The bare-metal program continues here after I/O MVC IONPSW(8),IOTRAP Restore I/O trap PSW * Did the interruption come from the expected device? CH 1,IOOPSW+2 Is the interrupt from the expected device? BER 15 ..Yes, return to caller B DEVUNKN ..No, end program with an error SPACE 3 * End the bare-metal program with an error indicated in PSW DEVNOAVL LPSW NODEV Code 004 End console device is not available DEVBUSY LPSW BUSYDEV Code 008 End because device is busy (no wait) DEVCSW LPSW CSWSTR Code 00C End because CSW stored in ASA DEVUNKN LPSW NOTCON Code 010 End unexpected device caused I/O interruption CHNLERR LPSW CHERROR Code 014 End because console channel error occurred UNITERR LPSW DVERROR Code 018 End because console device error occurred RNOAVL LPSW RNODEV Code 004 End reader device is not available RBUSY LPSW RBUSYDEV Code 008 End because reader device is busy (no wait) RCSW LPSW RCSWSTR Code 00C End because CSW stored in ASA for reader *RUNKN LPSW RNOTCON Code 010 End unexpected device caused I/O interruption RCHLERR LPSW RCHERROR Code 014 End because reader channel error occurred RUNTERR LPSW RDVERROR Code 018 End because reader device error occurred SPACE 1 * I/O related information CCWADDR DC A(CONCCW) Address of first CCW to be executed by console device. RCCWADDR DC A(RDRCCW) Address of first CCW to be executed by reader device. CONDEV DC XL2'001F' Console device address STATUS DC XL2'0000' Used to accumulate unit and channel status SPACE 1 * CCW used by the program to write the card contents to the console CONCCW CCW0 X'09',RIOAREA,0,L'RIOAREA Write card to console with CR * CCW0 X'03',0,0,1 ..then a NOP. * If the preceding NOP CCW command is enabled, then the CONCCW must set * command chaining in the flag byte, setting the third operand to X'40' SPACE 1 * CCW used to read the card from the IPL device stream on X'00C' RDRCCW CCW X'02',RIOAREA,0,L'RIOAREA Read the card into memory * CCW0 X'03',0,0,1 ..then a NOP. * If the preceding NOP CCW command is enabled, then the RDRCW must set * command chaining in the flag byte, setting the third operand to X'40' SPACE 1 * PSW's used by the bare-metal program PGMRS DWAIT CODE=008 Restart New PSW trap. Points to Restart Old PSW WAIT PSW360 X'F8',0,2,0,0 Causes CPU to wait for I/O interruption CONT PSW360 0,0,0,0,IODONE Causes the CPU to continue after waiting IOTRAP PSW360 0,0,2,0,X'38' I/O trap New PSW (restored after I/O) SPACE 1 * PSW's terminating program execution DONE DWAITEND Successful execution of the program NODEV DWAIT PGM=01,CMP=0,CODE=004 Console device not available BUSYDEV DWAIT PGM=01,CMP=0,CODE=008 Console device busy CSWSTR DWAIT PGM=01,CMP=0,CODE=00C CSW stored in ASA NOTCON DWAIT PGM=01,CMP=0,CODE=010 Unexpected interruption from other device CHERROR DWAIT PGM=01,CMP=0,CODE=014 Console channel error occurred DVERROR DWAIT PGM=01,CMP=0,CODE=018 Console device error occurred RNODEV DWAIT PGM=02,CMP=0,CODE=004 Reader device not available RBUSYDEV DWAIT PGM=02,CMP=0,CODE=008 Reader device busy RCSWSTR DWAIT PGM=02,CMP=0,CODE=00C CSW stored in ASA *RNOTCON DWAIT PGM=02,CMP=0,CODE=010 Unexpected interruption from other device RCHERROR DWAIT PGM=02,CMP=0,CODE=014 Reader channel error occurred RDVERROR DWAIT PGM=02,CMP=0,CODE=018 Reader device error occurred SPACE 3 * No constants should be placed below this area. Base register not needed * because this area is only referenced by CCW's RIOAREA DS 0CL80 * Note: the 0 ensures no space is reserved in IPL deck for this area. SPACE 3 * * Hardware Assigned Storage Locations * SPACE 1 * This DSECT allows symbolic access to these locations. The DSECT created is * named ASA. ASA ASAREA DSECT=YES END
51.958175
81
0.68723
0ac6e7bb3d515be8f1d37c2103f54f4b4fe038fb
382
asm
Assembly
oeis/246/A246146.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/246/A246146.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/246/A246146.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A246146: Limiting block extension of A010060 (Thue-Morse sequence) with first term as initial block. ; 0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0 add $0,180 lpb $0 sub $0,1 sub $1,$0 add $0,1 div $0,2 lpe mov $0,$1 mod $0,2 add $0,2 mod $0,2
25.466667
173
0.581152
f8efa029234348b0453513352a4e4ef983257edb
1,090
asm
Assembly
micro/assembler/sub_test.asm
andrewparlane/fiuba6633_lab_de_sistemas_digitales
909b33d640315f38220d268f113fc2ab8fa5e322
[ "MIT" ]
null
null
null
micro/assembler/sub_test.asm
andrewparlane/fiuba6633_lab_de_sistemas_digitales
909b33d640315f38220d268f113fc2ab8fa5e322
[ "MIT" ]
null
null
null
micro/assembler/sub_test.asm
andrewparlane/fiuba6633_lab_de_sistemas_digitales
909b33d640315f38220d268f113fc2ab8fa5e322
[ "MIT" ]
null
null
null
# ---------------------------------------------------------------------- # Test_name: sub_test # ---------------------------------------------------------------------- # # RAM memory will be structured in the following manner: # # +---------+----------+ # | Address | Variable | # +---------+----------+ # | RAM[00] | A | # | RAM[01] | B | # | RAM[02] | Y | # +---------+----------+ # # Where: # - Y = A - B # # # ROM Memory will be loaded with the following program: # ---------------------------------------------------------------------- $begin: LOAD A,0; # Load A operand SUB A,1; # ALU Operation to be tested. STORE A,2; # Save result LOAD A,0; # Load A operand ADDI A,1; # Add +1 to A operand STORE A,0; # Save A operand JZ $incb; # Jump to increase B operand if A operand is 0 JUMP $begin; # Start again the operation $incb: LOAD A,1; # Load B operand ADDI A,1; # Add +1 to B operand STORE A,1; # Save B operand JZ $end; # Go to end JUMP $begin; # Start again the operation $end: JUMP $end; # End, Finish test
26.585366
72
0.431193
c18a95064a8e7b93bacb8d725fecf4dfcbdbe291
228
asm
Assembly
wof/lcs/base/1F8.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/1F8.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
null
null
null
wof/lcs/base/1F8.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 012A70 clr.b ($1f8,A5) [base+1DC] 012A74 clr.b ($200,A5) 012B0E bne $12b30 01A610 dbra D1, $1a60e copyright zengfr site:http://github.com/zengfr/romhack
25.333333
54
0.692982
67d8b2c0ec8fdae8a4677ed22b1d2422be8ad89b
502
asm
Assembly
oeis/097/A097075.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/097/A097075.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/097/A097075.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A097075: Expansion of (1-x-x^2)/(1-x-3*x^2-x^3). ; Submitted by Jon Maiga ; 1,0,2,3,9,20,50,119,289,696,1682,4059,9801,23660,57122,137903,332929,803760,1940450,4684659,11309769,27304196,65918162,159140519,384199201,927538920,2239277042,5406093003,13051463049,31509019100,76069501250 mov $2,$0 mov $4,2 lpb $4 mov $0,$2 sub $4,1 add $0,$4 trn $0,1 seq $0,133654 ; a(n) = 2*A000129(n) - 1. div $0,4 add $0,1 mov $5,$4 mul $5,$0 add $3,$5 lpe min $2,1 mul $2,$0 mov $0,$3 sub $0,$2
21.826087
208
0.653386
a00904b5f0f8baff56953c73492c8a9399892b56
9,238
asm
Assembly
src/game_of_life_graphics.asm
Kippiii/Assembly-Game-Of-Life
45c1d85a16855ad22264a1a437f6d01553a9bb9e
[ "Unlicense" ]
null
null
null
src/game_of_life_graphics.asm
Kippiii/Assembly-Game-Of-Life
45c1d85a16855ad22264a1a437f6d01553a9bb9e
[ "Unlicense" ]
null
null
null
src/game_of_life_graphics.asm
Kippiii/Assembly-Game-Of-Life
45c1d85a16855ad22264a1a437f6d01553a9bb9e
[ "Unlicense" ]
null
null
null
; main PROC for Game of Life ; prompts user for input ; displays current board ; IDEAS ; Nicer cursor? ; Random boards include Irvine32.inc include backend.inc .data MAXIMUM_HEIGHT BYTE 255 MAXIMUM_WIDTH BYTE 255 carriage_X_pos BYTE 0 carriage_Y_pos BYTE 0 prev_map DWORD ? world_map DWORD ? board_size DWORD ? current_key_stroke BYTE ?, 0 array_position WORD 0 hHeap DWORD ? WELCOME_PROMPT BYTE "<-> John Conway's Game of Life <->", 0AH, 0DH, 0 MAIN_MENU BYTE "<->.......Controls......<->", 0AH, 0DH, 0 PROMPT_1 BYTE "w Shift carriage up.....<->", 0AH, 0DH, 0 PROMPT_2 BYTE "a Shift carriage left...<->", 0AH, 0DH, 0 PROMPT_3 BYTE "s Shift carriage down...<->", 0AH, 0DH, 0 PROMPT_4 BYTE "d Shift carriage right..<->", 0AH, 0DH, 0 PROMPT_5 BYTE "q Quit Game.............<->", 0AH, 0DH, 0 PROMPT_6 BYTE "p Toggle pause/continue.<->", 0AH, 0DH, 0 PROMPT_7 BYTE "f Step one frame........<->", 0AH, 0DH, 0 PROMPT_8 BYTE "x Flip Cell.............<->", 0AH, 0DH, 0 PROMPT_9 BYTE "c Clear all cells.......<->", 0AH, 0DH, 0 PROMPT_10 BYTE "r Randomize the grid....<->", 0AH, 0DH, 0 BOTTOM_FRAME BYTE "<->.....................<->", 0AH, 0DH, 0 P_CHAR BYTE "p", 0 F_CHAR BYTE "f", 0 Q_CHAR BYTE "q", 0 X_CHAR BYTE "x", 0 W_CHAR BYTE "w", 0 A_CHAR BYTE "a", 0 S_CHAR BYTE "s", 0 D_CHAR BYTE "d", 0 C_CHAR BYTE "c", 0 R_CHAR BYTE "r", 0 SPACE_CHAR BYTE " ", 0 LEAVING_SET_CELL BYTE "LEAVING set_cell", 0 .code display_WELCOME PROC ; INPUT: NONE mov EDX, OFFSET WELCOME_PROMPT call WriteString ; Print WELCOME_PROMPT call WaitMsg ; Stop program, Print "Press any key to continue..." call Clrscr ret ; OUTPUT: NONE display_WELCOME ENDP .code display_MAIN_MENU PROC ; INPUT: NONE mov EDX, OFFSET MAIN_MENU call WriteString ; Print MAIN_MENU mov EDX, OFFSET PROMPT_1 call WriteString ; Print PROMPT_1 mov EDX, OFFSET PROMPT_2 call WriteString ; Print PROMPT_2 mov EDX, OFFSET PROMPT_3 call WriteString ; Print PROMPT_3 mov EDX, OFFSET PROMPT_4 call WriteString ; Print PROMPT_4 mov EDX, OFFSET PROMPT_5 call WriteString ; Print PROMPT_5 mov EDX, OFFSET PROMPT_6 call WriteString ; Print PROMPT_6 mov EDX, OFFSET PROMPT_7 call WriteString ; Print PROMPT_7 mov EDX, OFFSET PROMPT_8 call WriteString ; Print PROMPT_8 mov EDX, OFFSET PROMPT_9 call WriteString ; Print PROMPT_9 mov EDX, OFFSET PROMPT_10 call WriteString ; Print PROMPT_10 mov EDX, OFFSET BOTTOM_FRAME call WriteString ; Print BOTTOM_FRAME call WaitMsg call Clrscr ret ; OUTPUT: NONE display_MAIN_MENU ENDP .code set_cell PROC ; INPUT: NONE mov EAX, 0 mov AL, carriage_Y_pos mul MAXIMUM_WIDTH mov BX, 0 mov BL, carriage_X_pos add AX, BX mov ESI, world_map add ESI, EAX xor BYTE PTR [ESI], 1 ret ; OUTPUT: NONE set_cell ENDP .code initialize_world_map PROC ; INPUT: NONE call Randomize mov ESI, 0 mov ECX, board_size L1: mov EDI, world_map add EDI, ESI mov AL, BYTE PTR [EDI] mov EAX, 2d ; generate random integers call RandomRange ; 0 or 1 in EAX mov BYTE PTR [EDI], BYTE PTR AL ; store in the array add ESI, 1 ; next array position loop L1 ret ; OUTPUT: NONE initialize_world_map ENDP .code display_board PROC ; INPUT: NONE and edx, 0 ; Set the values for Gotoxy at the origin, DL, DH call Gotoxy mov esi, 0 ; Start counter mov ecx, board_size ; Maximum loops cld L1: ; Only updating when the value has been updating mov edi, world_map add edi, esi mov al, byte ptr [edi] mov edi, prev_map add edi, esi cmp al, byte ptr [edi] jz CONTINUE_L1 mov eax, esi mov bl, MAXIMUM_WIDTH div bl mov dl, ah mov dh, al call Gotoxy FIRST_RUN: mov edi, world_map add edi, esi mov al, BYTE PTR [edi] cmp al, 1 jz PRINT_X_CHAR_LABEL jnz PRINT_SPACE_CHAR_LABEL CONTINUE_L1: add ESI, 1 cmp ECX, 1 jz RET_LABEL loop L1 PRINT_X_CHAR_LABEL: mov EAX, black + (white * 16) call SetTextColor mov EDX, OFFSET SPACE_CHAR call WriteString jmp CONTINUE_L1 PRINT_SPACE_CHAR_LABEL: mov EAX, white + (black * 16) call SetTextColor mov EDX, OFFSET SPACE_CHAR call WriteString jmp CONTINUE_L1 RET_LABEL: mov DL, carriage_X_pos mov DH, carriage_Y_pos call Gotoxy push world_map push prev_map push board_size call copy_array ret ; OUTPUT: NONE display_board ENDP ; MAIN PROGRAM game_of_life_main PROC ; Initializing the heap TODO (Handle errors?) invoke GetProcessHeap mov hHeap, eax ; get board measurements call GetMaxXY mov MAXIMUM_HEIGHT, AL mov MAXIMUM_WIDTH, DL mov eax, 0 mov al, MAXIMUM_HEIGHT mul MAXIMUM_WIDTH mov board_size, eax invoke HeapAlloc, hHeap, HEAP_ZERO_MEMORY, board_size mov world_map, eax invoke HeapAlloc, hHeap, HEAP_ZERO_MEMORY, board_size mov prev_map, eax mov esi, prev_map mov ecx, board_size PREV_ARR_MAP: mov byte ptr [esi], 2 inc esi loop PREV_ARR_MAP ; display WELCOME_PROMPT call display_WELCOME ; display MAIN_MENU call display_MAIN_MENU mov DL, carriage_X_pos mov DH, carriage_Y_pos call Gotoxy ; while user doesnt press "q" MAIN_LABEL: mov EAX, white + (blue * 16) call SetTextColor call Clrscr call display_board jmp PAUSE_LABEL INPUT_LABEL: mov ESI, world_map mov EAX, 0 mov AL, MAXIMUM_HEIGHT mov EBX, 0 mov BL, MAXIMUM_WIDTH push ESI push EAX push EBX call update_board call display_board mov EAX, 50 call Delay call ReadKey ; Get keyboard input jz INPUT_LABEL ; If no input was given, repeat INPUT_LABEL mov current_key_stroke, AL ; current_key_stroke = ReadKey() ; check if p mov AL, P_CHAR cmp AL, current_key_stroke jz PAUSE_LABEL ; if current_key_stroke == 'p' ; check if q mov AL, Q_CHAR cmp AL, current_key_stroke jz EXIT_LABEL ; if current_key_stroke == 'q' ; check if w, a, s, OR d jnz INPUT_LABEL ; if no match to p, f, q, w, a, s, d, jump to INPUT_LABEL PAUSE_LABEL: mov EAX, 10 call Delay call ReadKey ; Get keyboard input jz PAUSE_LABEL ; If no input was given, repeat PAUSE_LABEL mov current_key_stroke, AL ; current_key_stroke = ReadKey() mov AL, Q_CHAR cmp AL, current_key_stroke ; if current_key_stroke == 'q' jz EXIT_LABEL mov AL, P_CHAR cmp AL, current_key_stroke ; if current_key_stroke == 'p' jz INPUT_LABEL mov AL, F_CHAR cmp AL, current_key_stroke ; if current_key_stroke == 'f' jz FRAME_LABEL mov AL, X_CHAR cmp AL, current_key_stroke ; if current_key_stroke == 'x' jz CALL_SET_CELL_LABEL mov AL, W_CHAR cmp AL, current_key_stroke ; if current_key_stroke == 'w' jz MOVE_CELL_UP_LABEL mov AL, A_CHAR cmp AL, current_key_stroke ; if current_key_stroke == 'a' jz MOVE_CELL_LEFT_LABEL mov AL, S_CHAR cmp AL, current_key_stroke ; if current_key_stroke == 's' jz MOVE_CELL_DOWN_LABEL mov AL, D_CHAR cmp AL, current_key_stroke ; if current_key_stroke == 'd' jz MOVE_CELL_RIGHT_LABEL mov AL, C_CHAR cmp AL, current_key_stroke ; if current_key_stroke == 'c' jz CLEAR_MAP mov AL, R_CHAR cmp AL, current_key_stroke ; if current_key_stroke == 'r' jz RANDOM_MAP jmp PAUSE_LABEL MOVE_CELL_UP_LABEL: cmp carriage_Y_pos, 0 je PAUSE_LABEL sub carriage_Y_pos, 1 mov DL, carriage_X_pos mov DH, carriage_Y_pos call Gotoxy jmp PAUSE_LABEL MOVE_CELL_LEFT_LABEL: cmp carriage_X_pos, 0 je PAUSE_LABEL sub carriage_X_pos, 1 mov DL, carriage_X_pos mov DH, carriage_Y_pos call Gotoxy jmp PAUSE_LABEL MOVE_CELL_DOWN_LABEL: mov AL, MAXIMUM_HEIGHT sub AL, 1 cmp carriage_Y_pos, AL je PAUSE_LABEL add carriage_Y_pos, 1 mov DL, carriage_X_pos mov DH, carriage_Y_pos call Gotoxy jmp PAUSE_LABEL MOVE_CELL_RIGHT_LABEL: mov AL, MAXIMUM_WIDTH sub AL, 1 cmp carriage_X_pos, AL je PAUSE_LABEL add carriage_X_pos, 1 mov DL, carriage_X_pos mov DH, carriage_Y_pos call Gotoxy jmp PAUSE_LABEL CALL_SET_CELL_LABEL: call set_cell call display_board jmp PAUSE_LABEL FRAME_LABEL: mov ESI, world_map mov EAX, 0 mov AL, MAXIMUM_HEIGHT mov EBX, 0 mov BL, MAXIMUM_WIDTH push ESI push EAX push EBX call update_board call display_board mov DL, carriage_X_pos mov DH, carriage_Y_pos call Gotoxy jmp PAUSE_LABEL CLEAR_MAP: mov ecx, board_size mov esi, world_map CLEAR_MAP_LOOP: mov byte ptr [esi], 0 inc esi loop CLEAR_MAP_LOOP call display_board jmp PAUSE_LABEL RANDOM_MAP: call initialize_world_map ; initialize a random board call display_board jmp PAUSE_LABEL EXIT_LABEL: INVOKE HeapFree, hHeap, 0, world_map exit game_of_life_main ENDP END game_of_life_main
22.153477
152
0.666703
f4294ea9bf5123d636a3145fc7e1ae75a65ea05f
381
asm
Assembly
libsrc/_DEVELOPMENT/sound/sn76489/c/sccz80/PSGSFXPlayLoop_callee.asm
ahjelm/z88dk
c4de367f39a76b41f6390ceeab77737e148178fa
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/sound/sn76489/c/sccz80/PSGSFXPlayLoop_callee.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/sound/sn76489/c/sccz80/PSGSFXPlayLoop_callee.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; void PSGSFXPlayLoop(void *sfx,unsigned char channels) SECTION code_clib SECTION code_PSGlib PUBLIC PSGSFXPlayLoop_callee EXTERN asm_PSGlib_SFXPlayLoop PSGSFXPlayLoop_callee: pop af pop bc pop de push af jp asm_PSGlib_SFXPlayLoop ; SDCC bridge for Classic IF __CLASSIC PUBLIC _PSGSFXPlayLoop_callee defc _PSGSFXPlayLoop_callee = PSGSFXPlayLoop_callee ENDIF
15.24
55
0.816273
761b5ecd9784a325fd60dff471b254339fabd126
453
asm
Assembly
oeis/296/A296081.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/296/A296081.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/296/A296081.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A296081: a(n) = gcd(tau(n)-1, sigma(n)-1), where tau = A000005 and sigma = A000203. ; Submitted by Christian Krause ; 0,1,1,2,1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,3,5,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,3,2,1,1,1,1,7,1,7,1,1,1,1,1,1,1,6,1,1,1,5,1,1,1,1,1,1,1,1,1,1,1,1,4,1,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,5,5,8 add $0,1 mov $2,$0 lpb $0 add $1,$4 mov $3,$2 dif $3,$0 sub $0,1 cmp $3,$2 cmp $3,0 add $4,$3 lpe gcd $1,$4 mov $0,$1
25.166667
201
0.534216
57a8c7a10f61f1e915362fc3dc12e408e7aef965
1,085
asm
Assembly
chap18/ex33/double_div_26.asm
JamesType/optimization-manual
61cdcebb16e0768a6ab7e85ed535e64e9d8cc31a
[ "0BSD" ]
374
2021-06-08T10:42:01.000Z
2022-03-29T14:21:45.000Z
chap18/ex33/double_div_26.asm
JamesType/optimization-manual
61cdcebb16e0768a6ab7e85ed535e64e9d8cc31a
[ "0BSD" ]
1
2021-06-11T20:24:02.000Z
2021-06-11T20:24:02.000Z
chap18/ex33/double_div_26.asm
JamesType/optimization-manual
61cdcebb16e0768a6ab7e85ed535e64e9d8cc31a
[ "0BSD" ]
39
2021-06-08T11:25:29.000Z
2022-03-05T05:14:17.000Z
; ; Copyright (C) 2021 by Intel Corporation ; ; Permission to use, copy, modify, and/or distribute this software for any ; purpose with or without fee is hereby granted. ; ; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH ; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY ; AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, ; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM ; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ; OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. ; ; .globl double_div_26 ; void double_div_26(double *a, double *b, double *out); ; On entry: ; rcx = a ; rdx = b ; r8 = out .code double_div_26 PROC public vmovupd zmm0, [rcx] vmovupd zmm1, [rdx] vrcp14pd zmm2, zmm1 vmulpd zmm3, zmm0, zmm2 vmovapd zmm4, zmm0 vfnmadd231pd zmm4, zmm3, zmm1 vfmadd231pd zmm3, zmm4, zmm2 vmovupd [r8], zmm3 vzeroupper ret double_div_26 ENDP end
24.111111
79
0.737327
75ada34c4e5bb2790373e03a113a8e68c333ca7c
720
asm
Assembly
sse/main.asm
DaveAxiom/simd
8140b8e12bf4f9cb24b7601b98b44525b8ba9e72
[ "MIT" ]
2
2020-07-09T04:06:17.000Z
2021-08-07T17:40:46.000Z
sse/main.asm
DaveAxiom/simd
8140b8e12bf4f9cb24b7601b98b44525b8ba9e72
[ "MIT" ]
1
2020-10-05T12:23:51.000Z
2020-10-05T12:23:51.000Z
sse/main.asm
DaveAxiom/simd
8140b8e12bf4f9cb24b7601b98b44525b8ba9e72
[ "MIT" ]
1
2020-10-02T00:26:40.000Z
2020-10-02T00:26:40.000Z
%define SYS_EXIT 60 segment .data src: db 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15 shift: db 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13 cap: db 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25 cap0: db 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26 segment .text global _start rot13_16b: movaps xmm0, [rax] movaps xmm1, [shift] paddb xmm0, xmm1 movaps xmm2, xmm0 movaps xmm1, [cap] pcmpgtb xmm0, xmm1 movaps xmm1, [cap0] pand xmm0, xmm1 psubb xmm2, xmm0 movaps [rax], xmm2 ret _start: mov rax, src call rot13_16b call rot13_16b mov rax, SYS_EXIT mov rdi, 0 syscall ret
18.947368
73
0.572222
fb674e1a1c9afb2ea3af6183edf20073e2ce64ac
195
asm
Assembly
gfx/pokemon/sentret/anim.asm
pokeachromicdevs/pokeoctober
db74bb68bbfceac07eec6d64674bc24fd4c0b67f
[ "blessing" ]
1
2021-07-05T23:48:37.000Z
2021-07-05T23:48:37.000Z
gfx/pokemon/sentret/anim.asm
AtmaBuster/pokeoctober
12652b84eb2df1a0ed2f654a0ffcfb78202e515f
[ "blessing" ]
1
2020-12-16T01:11:20.000Z
2020-12-16T22:53:56.000Z
gfx/pokemon/sentret/anim.asm
AtmaBuster/pokeoctober
12652b84eb2df1a0ed2f654a0ffcfb78202e515f
[ "blessing" ]
1
2021-07-05T23:33:22.000Z
2021-07-05T23:33:22.000Z
frame 0, 15 frame 1, 15 frame 2, 15 frame 1, 15 frame 2, 15 frame 1, 15 frame 3, 7 frame 1, 7 frame 3, 7 frame 1, 7 frame 3, 7 frame 0, 15 endanim
15
15
0.502564
1f7755ab598ce970f2d484b806c28e8bbd3e9930
2,636
asm
Assembly
sys.asm
lybrown/edfries-chess-xasm
81d716492c7276bffa815caa4077f046f092d89a
[ "MIT" ]
1
2021-08-12T08:52:52.000Z
2021-08-12T08:52:52.000Z
sys.asm
lybrown/edfries-chess-xasm
81d716492c7276bffa815caa4077f046f092d89a
[ "MIT" ]
null
null
null
sys.asm
lybrown/edfries-chess-xasm
81d716492c7276bffa815caa4077f046f092d89a
[ "MIT" ]
null
null
null
; SCREEN ROWCRS equ $54 COLCRS equ $55 TEMP1 equ $312+1 ;TEMP LOCATIONS ; IOCB OFFSETS IOCB equ $340 ;I/O CONTROL BLOCKS ICHID equ $340 ;HANDLER INDEX ($FF = FREE) ICDNO equ $341 ;DEVICE NUMBER (DRIVE NUMBER) ICCOM equ $342 ;COMMAND CODE ICSTA equ $343 ;STATUS ICBAL equ $344 ;BUFFER ADDRESS ICBAH equ $345 ; ... ICPTL equ $346 ;PUT BYTE ROUTINE ADDRESS - 1 ICPTH equ $347 ; ... ICBLL equ $348 ;BUFFER LENGTH ICBLH equ $349 ; ... ICAX1 equ $34A ;AUXILLARY INFO ICAX2 equ $34B ; ... ICSPR equ $34C ;4 SPARE BYTES ; JUMP VECTOR TABLE DISKIV equ $E450 ;DISK INITIALIZATION DSKINV equ $E453 ;DISK INTERFACE CIOV equ $E456 ;CIO ROUTINE SIOV equ $E459 ;SIO ROUTINE SETVBV equ $E45C ;SET VERTICAL BLANK VECTORS SYSVBV equ $E45F ;SYSTEM VERTICAL BLANK ROUTINE XITVBV equ $E462 ;EXIT VERTICAL BLANK ROUTINE SIOINV equ $E465 ;SIO INIT SENDEV equ $E468 ;SEND ENABLE ROUTINE INTINV equ $E46B ;INTERRUPT HANDLER INIT CIOINV equ $E46E ;CIO INIT BLKBDV equ $E471 ;BLACKBOARD MODE WARMSV equ $E474 ;WARM START ENTRY POINT COLDSV equ $E477 ;COLD START ENTRY POINT RBLOKV equ $E47A ;CASSETTE READ BLOCK VECTOR CSOPIV equ $E47D ;CASSETTE OPEN VECTOR DSOPIV equ $E480 ;CASSETTE OPEN FOR INPUT VECTOR ; COMMAND CODES FOR IOCB OPEN equ $03 ;OPEN FOR INPUT/OUTPUT GETREC equ $05 ;GET RECORD (TEXT) GETCHR equ $07 ;GET CHARACTER(S) PUTREC equ $09 ;PUT RECORD (TEXT) PUTCHR equ $0B ;PUT CHARACTER(S) CLOSE equ $0C ;CLOSE DEVICE STATIS equ $0D ;STATUS REQUEST SPECIL equ $0E ;SPECIAL ENTRY COMMANDS ; AUX1 VALUES FOR OPEN APPEND equ $01 ;OPEN FOR APPEND DIRECT equ $02 ;OPEN FOR DIRECTORY ACCESS OPNIN equ $04 ;OPEN FOR INPUT OPNOT equ $08 ;OPEN FOR OUTPUT OPNINO equ [OPNIN|OPNOT] ;OPEN FOR INPUT/OUTPUT MXDMOD equ $10 ;OPEN FOR MIXED MODE INSCLR equ $20 ;OPEN WITHOUT CLEARING SCREEN
40.553846
65
0.502276
9d25fbb6d979cbaf26cd495924726880fca6841d
387
asm
Assembly
programs/oeis/047/A047599.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/047/A047599.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/047/A047599.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A047599: Numbers that are congruent to {0, 3, 4, 5} mod 8. ; 0,3,4,5,8,11,12,13,16,19,20,21,24,27,28,29,32,35,36,37,40,43,44,45,48,51,52,53,56,59,60,61,64,67,68,69,72,75,76,77,80,83,84,85,88,91,92,93,96,99,100,101,104,107,108,109,112,115,116,117,120,123,124 add $0,7 mov $1,$0 div $1,4 mul $1,2 mov $2,$0 lpb $2,1 mov $3,$0 add $3,2 mov $0,$3 sub $2,4 lpe add $1,$0 sub $1,13
22.764706
198
0.614987
1fcc712012fb0238c0e9b515833df948f4b76a83
748
asm
Assembly
base/atari/putchar.asm
zbyti/Mad-Pascal
546cae9724828f93047080109488be7d0d07d47e
[ "MIT" ]
7
2020-05-02T15:37:57.000Z
2021-02-17T01:59:41.000Z
base/atari/putchar.asm
michalkolodziejski/Mad-Pascal
0a7a1e2f379e50b0a23878b0d881ff3407269ed6
[ "MIT" ]
14
2020-05-03T02:02:35.000Z
2020-08-10T08:41:19.000Z
base/atari/putchar.asm
michalkolodziejski/Mad-Pascal
0a7a1e2f379e50b0a23878b0d881ff3407269ed6
[ "MIT" ]
5
2020-06-02T18:34:14.000Z
2020-07-09T18:13:44.000Z
; unit GRAPH: InitGraph, PutPixel, LineTo ; unit S2: SetGraphMode /* PUT CHAR Procedura wyprowadza znak na ekran na pozycji X/Y kursora okreslonej przez zmienne odpowiednio COLCRS ($55-$56) i ROWCRS ($54). Zaklada sie, ze obowiazuja przy tym domyslne ustawienia OS-u, to jest ekran jest w trybie Graphics 0, a kanal IOCB 0 jest otwarty dla edytora ekranowego. Wyprowadzenie znaku polega na zaladowaniu jego kodu ATASCII do akumulatora i wykonaniu rozkazu JSR PUTCHR. */ .proc @putchar (.byte a) .reg vbxe bit * ; jsr vbxe_cmap ldx #$00 ; $60 -> S2: chn equ *-1 .ifdef MAIN.CRT.TextAttr ora MAIN.CRT.TextAttr .endif main tay lda icputb+1,x pha lda icputb,x pha tya rts .endp
19.684211
97
0.684492
d3ac540def68d91aaff88dab8bd58061dff2eb7b
223
asm
Assembly
Assembler/AssemblyCode/NOT.asm
KPU-RISC/KPU
9f85c322e1b8489eef31f0696799e0c6c7273c0e
[ "MIT" ]
8
2017-04-16T16:53:03.000Z
2021-09-14T22:29:28.000Z
Assembler/AssemblyCode/TTL/NOT.asm
KPU-RISC/KPU
9f85c322e1b8489eef31f0696799e0c6c7273c0e
[ "MIT" ]
null
null
null
Assembler/AssemblyCode/TTL/NOT.asm
KPU-RISC/KPU
9f85c322e1b8489eef31f0696799e0c6c7273c0e
[ "MIT" ]
null
null
null
; Write register D to the Output Port MOV D, 11110000b MOV E, 00001111b NOT D NOT D SHR D NOT E NOT E SHL E NOT D NOT D SHR D NOT E NOT E SHL E NOT D NOT D SHR D NOT E NOT E SHL E NOT D NOT D SHR D NOT E NOT E SHL E
6.371429
37
0.67713
6c48a7c6898bacfc2853935b4027acb2dce936c3
526
asm
Assembly
src/asm/define_music.asm
h1romas4/z88dk-msx-template
8667669ba30f343c59f5ba394ac8be899cc8a8e6
[ "MIT" ]
5
2021-09-06T15:25:33.000Z
2022-03-24T06:38:12.000Z
src/asm/define_music.asm
h1romas4/z88dk-msx-template
8667669ba30f343c59f5ba394ac8be899cc8a8e6
[ "MIT" ]
null
null
null
src/asm/define_music.asm
h1romas4/z88dk-msx-template
8667669ba30f343c59f5ba394ac8be899cc8a8e6
[ "MIT" ]
null
null
null
; license:MIT License ; copyright-holders:Hiromasa Tanaka ; rodata_user ; https://github.com/z88dk/z88dk/blob/master/doc/overview.md#a-quick-note-for-asm-code ; rodata_user if for constant data ; kept in rom if program is in rom SECTION rodata_user PUBLIC _music_title, _music_main, _music_game_over, _sound_extend, _sound_get include "../resources/music_title.asm" include "../resources/music_main.asm" include "../resources/music_game_over.asm" include "../resources/sound_extend.asm" include "../resources/sound_get.asm"
32.875
86
0.790875
b1fa223bb51f0b628f775f515ebb0de3a7e5fc29
13,807
asm
Assembly
2001-fall/mp4/mp4.asm
ece291/machine-problems
5f91f9f2ddceb7cda1e14c2973d83023a42d9929
[ "RSA-MD" ]
3
2016-07-16T04:33:49.000Z
2021-07-13T16:18:17.000Z
2001-fall/mp4/mp4.asm
ece291/machine-problems
5f91f9f2ddceb7cda1e14c2973d83023a42d9929
[ "RSA-MD" ]
null
null
null
2001-fall/mp4/mp4.asm
ece291/machine-problems
5f91f9f2ddceb7cda1e14c2973d83023a42d9929
[ "RSA-MD" ]
null
null
null
; ECE 291 Fall 2001 MP4 ; -- Paint291 -- ; ; Completed By: ; Your Name ; ; Josh Potts ; Guest Author - Ryan Chmiel ; University of Illinois Urbana Champaign ; Dept. of Electrical & Computer Engineering ; ; Ver 1.0 %include "lib291.inc" %include "libmp4.inc" BITS 32 GLOBAL _main ; Define functions and variables used by main() EXTERN _LoadPNG _LoadPNG_arglen EQU 18 ; Define Contstants DOWNARROW EQU 80 RIGHTARROW EQU 77 LEFTARROW EQU 75 UPARROW EQU 72 CANVAS_X EQU 20 CANVAS_Y EQU 20 NUM_MENU_ITEMS EQU 11 BKSP EQU 8 ESC EQU 1 ENTERKEY EQU 13 SPACE EQU 57 LSHIFT EQU 42 RSHIFT EQU 54 SECTION .bss _GraphicsMode resw 1 ; Graphics mode # _kbINT resb 1 ; Keyboard interrupt # _kbIRQ resb 1 ; Keyboard IRQ _kbPort resw 1 ; Keyboard port _MouseSeg resw 1 ; real mode segment for MouseCallback _MouseOff resw 1 ; real mode offset for MouseCallback _MouseX resw 1 ; X coordinate position of mouse on screen _MouseY resw 1 ; Y coordinate position of mouse on screen _ScreenOff resd 1 ; Screen image offset _CanvasOff resd 1 ; Canvas image offset _OverlayOff resd 1 ; Overlay image offset _FontOff resd 1 ; Font image offset _MenuOff resd 1 ; Menu image offset _TitleOff resd 1 ; Title Bar image offset _MPFlags resb 1 ; program flags ; Bit 0 - Exit program ; Bit 1 - Left mouse button (LMB) status: set if down, cleared if up ; Bit 2 - Change in LMB status: set if button status ; moves from pressed->released or vice-versa ; Bit 3 - Right shift key status: set if down, cleared if up ; Bit 4 - Left shift key status: set if down, cleared if up ; Bit 5 - Key other than shift was pressed ; Bit 6 - Not Used Anymore ; Bit 7 - Status of chosen color: set if obtained with user input, ; cleared if obtained with eyedrop (you do not have to deal ; with this - the library code uses it) _MenuItem resb 1 ; selected menu item ; line algorithm variables _x resw 1 _y resw 1 _dx resw 1 _dy resw 1 _lineerror resw 1 _xhorizinc resw 1 _xdiaginc resw 1 _yvertinc resw 1 _ydiaginc resw 1 _errordiaginc resw 1 _errornodiaginc resw 1 ; circle algorithm variables _radius resw 1 _circleerror resw 1 _xdist resw 1 _ydist resw 1 ; flood fill variables _PointQueue resd 1 _QueueHead resd 1 _QueueTail resd 1 _key resb 1 SECTION .data ; Required image files _FontFN db 'font.png',0 _MenuFN db 'menu.png',0 _TitleFN db 'title.png',0 ; Defined color values _CurrentColor dd 0ffff0000h ; current color _ColorBlue dd 0ff0033ffh _ColorWhite dd 0ffffffffh _ColorBlack dd 0ff000000h _ColorHalfBlack dd 0cc000000h _buffer db ' ','$' _ColorString1 db 'Enter numerical values for','$' _ColorString2 db 'each channel (ARGB), and','$' _ColorString3 db 'separate each number by a','$' _ColorString4 db 'space (ex. 127 255 255 0).','$' _QwertyNames db 0 ; filler db 0,'1','2','3','4','5','6','7','8','9','0','-','=',BKSP db 0, 'q','w','e','r','t','y','u','i','o','p','[',']',ENTERKEY db 0,'a','s','d','f','g','h','j','k','l',';',"'","`" db 0,'\','z','x','c','v','b','n','m',",",'.','/',0,'*' db 0, ' ', 0, 0,0,0,0,0,0,0,0,0,0 ; F1-F10 db 0,0 ; numlock, scroll lock db 0, 0, 0, '-' db 0, 0, 0, '+' db 0, 0, 0, 0 db 0, 0; sysrq _QwertyNames_end resb 0 _QwertyShift db 0 ; filler db 0,'!','@','#','$','%','^','&','*','(',')','_','+',BKSP db 0, 'Q','W','E','R','T','Y','U','I','O','P','{','}',ENTERKEY db 0,'A','S','D','F','G','H','J','K','L',':','"','~' db 0,'|','Z','X','C','V','B','N','M',"<",'>','?',0,'*' db 0, ' ', 0, 0,0,0,0,0,0,0,0,0,0 ; F1-F10 db 0,0 ; numlock, scroll lock db 0, 0, 0, '-' db 0, 0, 0, '+' db 0, 0, 0, 0 db 0, 0; sysrq _QwertyShift_end resb 0 _TextInputString times 80 db 0,'$' _ColorInputString times 15 db 0,'$' _RoundingFactor dd 000800080h, 00000080h SECTION .text _main call _LibInit ; Allocate Screen Image buffer invoke _AllocMem, dword 640*480*4 cmp eax, -1 je near .memerror mov [_ScreenOff], eax ; Allocate Canvas Image buffer invoke _AllocMem, dword 480*400*4 cmp eax, -1 je near .memerror mov [_CanvasOff], eax ; Allocate Overlay Image buffer invoke _AllocMem, dword 480*400*4 cmp eax, -1 je near .memerror mov [_OverlayOff], eax ; Allocate Font Image buffer invoke _AllocMem, dword 2048*16*4 cmp eax, -1 je near .memerror mov [_FontOff], eax ; Allocate Menu Image buffer invoke _AllocMem, dword 400*100*4 cmp eax, -1 je near .memerror mov [_MenuOff], eax ; Allocate Title Bar Image buffer invoke _AllocMem, dword 640*20*4 cmp eax, -1 je near .memerror mov [_TitleOff], eax ; Allocate Point Queue invoke _AllocMem, dword 480*400*4*40 cmp eax, -1 je near .memerror mov [_PointQueue], eax ; Load image files invoke _LoadPNG, dword _FontFN, ds, dword [_FontOff], dword 0, dword 0 invoke _LoadPNG, dword _MenuFN, ds, dword [_MenuOff], dword 0, dword 0 invoke _LoadPNG, dword _TitleFN, ds, dword [_TitleOff], dword 0, dword 0 ; Graphics init invoke _InitGraphics, dword _kbINT, dword _kbIRQ, dword _kbPort test eax, eax jnz near .graphicserror ; Find graphics mode: 640x480x32, allow driver-emulated modes invoke _FindGraphicsMode, word 640, word 480, word 32, dword 1 mov [_GraphicsMode], ax ; Keyboard/Mouse init call _InstallKeyboard test eax, eax jnz near .keyboarderror invoke _SetGraphicsMode, word [_GraphicsMode] test eax, eax jnz .setgraphicserror call _InstallMouse test eax, eax jnz .mouseerror ; Show mouse cursor mov dword [DPMI_EAX], 01h mov bx, 33h call DPMI_Int call _MP4Main ; Shutdown and cleanup .mouseerror call _RemoveMouse .setgraphicserror call _UnsetGraphicsMode .keyboarderror call _RemoveKeyboard .graphicserror call _ExitGraphics .memerror call _MP4LibExit call _LibExit ret ;-------------------------------------------------------------- ;-- Replace Library Calls with your Code! -- ;-- Do not forget to add Function Headers -- ;-------------------------------------------------------------- ;-------------------------------------------------------------- ;-- PointInBox() -- ;-------------------------------------------------------------- proc _PointInBox .X arg 2 .Y arg 2 .BoxULCornerX arg 2 .BoxULCornerY arg 2 .BoxLRCornerX arg 2 .BoxLRCornerY arg 2 invoke _libPointInBox, word [ebp+.X], word [ebp+.Y], word [ebp+.BoxULCornerX], word [ebp+.BoxULCornerY], word [ebp+.BoxLRCornerX], word [ebp+.BoxLRCornerY] ret endproc _PointInBox_arglen EQU 12 ;-------------------------------------------------------------- ;-- GetPixel() -- ;-------------------------------------------------------------- proc _GetPixel .DestOff arg 4 .DestWidth arg 2 .DestHeight arg 2 .X arg 2 .Y arg 2 invoke _libGetPixel, dword [ebp+.DestOff], word [ebp+.DestWidth], word [ebp+.DestHeight], word [ebp+.X], word [ebp+.Y] ret endproc _GetPixel_arglen EQU 12 ;-------------------------------------------------------------- ;-- DrawPixel() -- ;-------------------------------------------------------------- proc _DrawPixel .DestOff arg 4 .DestWidth arg 2 .DestHeight arg 2 .X arg 2 .Y arg 2 .Color arg 4 invoke _libDrawPixel, dword [ebp+.DestOff], word [ebp+.DestWidth], word [ebp+.DestHeight], word [ebp+.X], word [ebp+.Y], dword [ebp+.Color] ret endproc _DrawPixel_arglen EQU 16 ;-------------------------------------------------------------- ;-- DrawLine() -- ;-------------------------------------------------------------- proc _DrawLine .DestOff arg 4 .DestWidth arg 2 .DestHeight arg 2 .X1 arg 2 .Y1 arg 2 .X2 arg 2 .Y2 arg 2 .Color arg 4 invoke _libDrawLine, dword [ebp+.DestOff], word [ebp+.DestWidth], word [ebp+.DestHeight], word [ebp+.X1], word [ebp+.Y1], word [ebp+.X2], word [ebp+.Y2], dword [ebp+.Color] ret endproc _DrawLine_arglen EQU 20 ;-------------------------------------------------------------- ;-- DrawRect() -- ;-------------------------------------------------------------- proc _DrawRect .DestOff arg 4 .DestWidth arg 2 .DestHeight arg 2 .X1 arg 2 .Y1 arg 2 .X2 arg 2 .Y2 arg 2 .Color arg 4 .FillRectFlag arg 4 invoke _libDrawRect, dword [ebp+.DestOff], word [ebp+.DestWidth], word [ebp+.DestHeight], word [ebp+.X1], word [ebp+.Y1], word [ebp+.X2], word [ebp+.Y2], dword [ebp+.Color], dword [ebp+.FillRectFlag] ret endproc _DrawRect_arglen EQU 24 ;-------------------------------------------------------------- ;-- DrawCircle() -- ;-------------------------------------------------------------- proc _DrawCircle .DestOff arg 4 .DestWidth arg 2 .DestHeight arg 2 .X arg 2 .Y arg 2 .Radius arg 2 .Color arg 4 .FillCircleFlag arg 4 invoke _libDrawCircle, dword [ebp+.DestOff], word [ebp+.DestWidth], word [ebp+.DestHeight], word [ebp+.X], word [ebp+.Y], word [ebp+.Radius], dword [ebp+.Color], dword [ebp+.FillCircleFlag] ret endproc _DrawCircle_arglen EQU 22 ;-------------------------------------------------------------- ;-- DrawText() -- ;-------------------------------------------------------------- proc _DrawText .StringOff arg 4 .DestOff arg 4 .DestWidth arg 2 .DestHeight arg 2 .X arg 2 .Y arg 2 .Color arg 4 invoke _libDrawText, dword [ebp+.StringOff], dword [ebp+.DestOff], word [ebp+.DestWidth], word [ebp+.DestHeight], word [ebp+.X], word [ebp+.Y], dword [ebp+.Color] ret endproc _DrawText_arglen EQU 20 ;-------------------------------------------------------------- ;-- ClearBuffer() -- ;-------------------------------------------------------------- proc _ClearBuffer .DestOff arg 4 .DestWidth arg 2 .DestHeight arg 2 .Color arg 4 invoke _libClearBuffer, dword [ebp+.DestOff], word [ebp+.DestWidth], word [ebp+.DestHeight], dword [ebp+.Color] ret endproc _ClearBuffer_arglen EQU 12 ;-------------------------------------------------------------- ;-- CopyBuffer() -- ;-------------------------------------------------------------- proc _CopyBuffer .SrcOff arg 4 .SrcWidth arg 2 .SrcHeight arg 2 .DestOff arg 4 .DestWidth arg 2 .DestHeight arg 2 .X arg 2 .Y arg 2 invoke _libCopyBuffer, dword [ebp+.SrcOff], word [ebp+.SrcWidth], word [ebp+.SrcHeight], dword [ebp+.DestOff], word [ebp+.DestWidth], word [ebp+.DestHeight], word [ebp+.X], word [ebp+.Y] ret endproc _CopyBuffer_arglen EQU 20 ;-------------------------------------------------------------- ;-- ComposeBuffers() -- ;-------------------------------------------------------------- proc _ComposeBuffers .SrcOff arg 4 .SrcWidth arg 2 .SrcHeight arg 2 .DestOff arg 4 .DestWidth arg 2 .DestHeight arg 2 .X arg 2 .Y arg 2 invoke _libComposeBuffers, dword [ebp+.SrcOff], word [ebp+.SrcWidth], word [ebp+.SrcHeight], dword [ebp+.DestOff], word [ebp+.DestWidth], word [ebp+.DestHeight], word [ebp+.X], word [ebp+.Y] ret endproc _ComposeBuffers_arglen EQU 20 ;-------------------------------------------------------------- ;-- BlurBuffer() -- ;-------------------------------------------------------------- proc _BlurBuffer .SrcOff arg 4 .DestOff arg 4 .DestWidth arg 2 .DestHeight arg 2 invoke _libBlurBuffer, dword [ebp+.SrcOff], dword [ebp+.DestOff], word [ebp+.DestWidth], word [ebp+.DestHeight] ret endproc _BlurBuffer_arglen EQU 12 ;-------------------------------------------------------------- ;-- FloodFill() -- ;-------------------------------------------------------------- proc _FloodFill .DestOff arg 4 .DestWidth arg 2 .DestHeight arg 2 .X arg 2 .Y arg 2 .Color arg 4 .ComposeFlag arg 4 invoke _libFloodFill, dword [ebp+.DestOff], word [ebp+.DestWidth], word [ebp+.DestHeight], word [ebp+.X], word [ebp+.Y], dword [ebp+.Color], dword [ebp+.ComposeFlag] ret endproc _FloodFill_arglen EQU 20 ;-------------------------------------------------------------- ;-- InstallKeyboard() -- ;-------------------------------------------------------------- _InstallKeyboard call _libInstallKeyboard ret ;-------------------------------------------------------------- ;-- RemoveKeyboard() -- ;-------------------------------------------------------------- _RemoveKeyboard call _libRemoveKeyboard ret ;-------------------------------------------------------------- ;-- KeyboardISR() -- ;-------------------------------------------------------------- _KeyboardISR call _libKeyboardISR ret _KeyboardISR_end ;-------------------------------------------------------------- ;-- InstallMouse() -- ;-------------------------------------------------------------- _InstallMouse call _libInstallMouse ret ;-------------------------------------------------------------- ;-- RemoveMouse() -- ;-------------------------------------------------------------- _RemoveMouse call _libRemoveMouse ret ;-------------------------------------------------------------- ;-- MouseCallback() -- ;-------------------------------------------------------------- proc _MouseCallback .DPMIRegsPtr arg 4 invoke _libMouseCallback, dword [ebp+.DPMIRegsPtr] ret endproc _MouseCallback_end _MouseCallback_arglen EQU 4
26.001883
200
0.52372
af9f1c6db7a11c385cb38a878d3339adc633b565
241
asm
Assembly
ffight/lcs/boss/9A.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
ffight/lcs/boss/9A.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
null
null
null
ffight/lcs/boss/9A.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 03DB86 move.b #$1, ($95,A6) [boss+9A, boss+9C] 03DD02 move.l A0, ($9a,A6) [boss+4] 03DD06 bra $40b46 [boss+9A, boss+9C] copyright zengfr site:http://github.com/zengfr/romhack
30.125
54
0.688797
9ca186f3f118ea2b7ce949d9bcb364e08d61823a
8,681
asm
Assembly
asm/msvc/ax.asm
awesie/aes_dust
34706d884921fcaedd84f3b517e82bca1ef8962b
[ "Unlicense" ]
46
2018-10-01T12:14:08.000Z
2021-11-17T02:58:34.000Z
asm/msvc/ax.asm
awesie/aes_dust
34706d884921fcaedd84f3b517e82bca1ef8962b
[ "Unlicense" ]
1
2020-11-17T17:47:35.000Z
2020-11-17T17:47:35.000Z
asm/msvc/ax.asm
awesie/aes_dust
34706d884921fcaedd84f3b517e82bca1ef8962b
[ "Unlicense" ]
20
2019-01-25T01:18:27.000Z
2021-05-07T10:32:04.000Z
; ; This is free and unencumbered software released into the public domain. ; ; Anyone is free to copy, modify, publish, use, compile, sell, or ; distribute this software, either in source code form or as a compiled ; binary, for any purpose, commercial or non-commercial, and by any ; means. ; In jurisdictions that recognize copyright laws, the author or authors ; of this software dedicate any and all copyright interest in the ; software to the public domain. We make this dedication for the benefit ; of the public at large and to the detriment of our heirs and ; successors. We intend this dedication to be an overt act of ; relinquishment in perpetuity of all present and future rights to this ; software under copyright law. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ; IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR ; OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ; ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; ; For more information, please refer to <http://unlicense.org/> ; ; ----------------------------------------------- ; AES-128 Encryption in x86 assembly ; ; size: 188 bytes for ECB, 255 for CTR ; ; global calls use cdecl convention ; ; ----------------------------------------------- bits 32 %ifndef BIN global _aes_ecb_asm global aes_ecb_asm %endif ; ***************************** ; void aes_ecb_asm(void *s); ; ***************************** _aes_ecb_asm: aes_ecb_asm: pusha xor ecx, ecx ; ecx = 0 mul ecx ; eax = 0, edx = 0 inc eax ; c = 1 mov cl, 4 pusha ; alloca(32) ; F(8)x[i]=((W*)s)[i] mov esi, [esp+64+4] ; esi = s mov edi, esp pusha add ecx, ecx ; copy state + master key to stack rep movsd popa ; ***************************** ; Multiplication over GF(2**8) ; ***************************** call $+21 ; save address push ecx ; save ecx mov cl, 4 ; 4 bytes add al, al ; al <<= 1 jnc $+4 ; xor al, 27 ; ror eax, 8 ; rotate for next byte loop $-9 ; pop ecx ; restore ecx ret pop ebp enc_main: ; ***************************** ; AddRoundKey, AddRoundConstant, ExpandRoundKey ; ***************************** ; w=k[3]; F(4)w=(w&-256)|S(w),w=R(w,8),((W*)s)[i]=x[i]^k[i]; ; w=R(w,8)^c;F(4)w=k[i]^=w; pusha xchg eax, edx xchg esi, edi mov eax, [esi+16+12] ; w=R(k[3],8) ror eax, 8 xor_key: mov ebx, [esi+16] ; t=k[i] xor [esi], ebx ; x[i]^=t movsd ; s[i]=x[i] ; w=(w&-256)|S(w) call S ; al=S(al) ror eax, 8 ; w=R(w,8) loop xor_key ; w=R(w,8)^c xor eax, edx ; w^=c ; F(4)w=k[i]^=w mov cl, 4 exp_key: xor [esi], eax ; k[i]^=w lodsd ; w=k[i] loop exp_key popa ; **************************** ; if(c==108) break; cmp al, 108 jne upd_con popa popa ret upd_con: call ebp ; *************************** ; ShiftRows and SubBytes ; *************************** ; F(16)((u8*)x)[w]=S(((u8*)s)[i]), w=(w-3)&15; pusha shift_rows: lodsb ; al = S(s[i]) call S mov [edi+edx], al sub edx, 3 and edx, 15 jnz shift_rows popa ; ***************************** ; if(c!=108){ cmp al, 108 je enc_main ; ***************************** ; MixColumns ; ***************************** ; F(4)w=x[i],x[i]=R(w,8)^R(w,16)^R(w,24)^M(R(w, 8)^w); pusha mix_cols: mov eax, [edi] ; w = x[i] mov edx, eax ; t = R(w, 8) ror edx, 8 ; xor eax, edx ; w ^= t call ebp ; xor eax, edx ror edx, 8 xor eax, edx ror edx, 8 xor eax, edx stosd loop mix_cols popa jmp enc_main ; ***************************** ; B SubByte(B x) ; ***************************** S: %ifndef DYNAMIC push ebx call init_sbox db 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5 db 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76 db 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0 db 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0 db 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc db 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15 db 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a db 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75 db 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0 db 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84 db 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b db 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf db 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85 db 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8 db 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5 db 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2 db 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17 db 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73 db 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88 db 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb db 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c db 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79 db 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9 db 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08 db 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6 db 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a db 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e db 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e db 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94 db 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf db 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68 db 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 init_sbox: pop ebx xlatb pop ebx %else pusha test al, al ; if(x){ jz sb_l6 xchg eax, edx mov cl, -1 ; i=255 ; for(c=i=0,y=1;--i;y=(!c&&y==x)?c=1:y,y^=M(y)) sb_l0: mov al, 1 ; y=1 sb_l1: test ah, ah ; !c jnz sb_l2 cmp al, dl ; y!=x setz ah jz sb_l0 sb_l2: mov dh, al ; y^=M(y) call ebp ; xor al, dh loop sb_l1 ; --i ; F(4)x^=y=(y<<1)|(y>>7); mov dl, al ; dl=y mov cl, 4 ; i=4 sb_l5: rol dl, 1 ; y=R(y,1) xor al, dl ; x^=y loop sb_l5 ; i-- sb_l6: xor al, 99 ; return x^99 mov [esp+28], al popa %endif ret %ifdef CTR global aes_ctr global _aes_ctr ; void aes_ctr(W len, B *ctr, B *in, B *key) _aes_ctr: aes_ctr: pusha lea esi,[esp+32+4] lodsd xchg eax, ecx ; ecx = len lodsd xchg eax, ebp ; ebp = ctr lodsd xchg eax, edx ; edx = in lodsd xchg esi, eax ; esi = key pusha ; alloca(32) ; copy master key to local buffer ; F(16)t[i+16]=key[i] lea edi, [esp+16] ; edi = &t[16] movsd movsd movsd movsd aes_l0: xor eax, eax jecxz aes_l3 ; while(len){ ; copy counter+nonce to local buffer ; F(16)t[i]=ctr[i] mov edi, esp ; edi = t mov esi, ebp ; esi = ctr push edi movsd movsd movsd movsd ; encrypt t call aes_ecb_asm ; E(t) pop edi aes_l1: ; xor plaintext with ciphertext ; r=len>16?16:len ; F(r)in[i]^=t[i] mov bl, [edi+eax] ; xor [edx], bl ; *in++^=t[i] inc edx ; inc eax ; i++ cmp al, 16 ; loopne aes_l1 ; while(i!=16 && --ecx!=0) ; update counter xchg eax, ecx ; mov cl, 16 aes_l2: inc byte[ebp+ecx-1] ; loopz aes_l2 ; while(++c[i]==0 && --ecx!=0) xchg eax, ecx jmp aes_l0 aes_l3: popa popa ret %endif
29.327703
73
0.478401
5da987fae3e5ebcef8b516a52a85165c469c7bbe
1,357
asm
Assembly
libsrc/zx81/tape/tape_load_block_callee.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
null
null
null
libsrc/zx81/tape/tape_load_block_callee.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
null
null
null
libsrc/zx81/tape/tape_load_block_callee.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
1
2019-12-03T23:57:48.000Z
2019-12-03T23:57:48.000Z
; ; Tape load routine ; ; ; int __CALLEE__ tape_load_block_callee(void *addr, size_t len, unsigned char type) ; ; ; $Id: tape_load_block_callee.asm,v 1.6 2015/08/11 07:16:36 stefano Exp $ ; PUBLIC tape_load_block_callee PUBLIC ASMDISP_TAPE_LOAD_BLOCK_CALLEE EXTERN zx_fast EXTERN zx_slow ; Very simple header, only check the 'type' byte in a Spectrum-ish way. ; For design reasons, we test a whole word.. ;----- .header defw 0 ; LEN defw 0 ; LOC .header2 defw 0 ; file type (2 bytes) ;----- EXTERN musamy_load .tape_load_block_callee pop de pop bc ld a,c pop bc pop hl push de .asmentry LD (header+2),hl ; LOC LD (header),bc ; LEN ld e,a .ld_retry push de ld hl,rethere push hl LD HL,header PUSH HL LD BC,2 ; file type len PUSH BC LD HL,header2 PUSH HL call zx_fast ;LD L,40h ; VERIFY MODE LD L,0 ; LOAD MODE jp musamy_load .rethere push hl call zx_slow IF FORlambda call $1C28 ; BREAK-1 on Lambda ELSE call $f46 ; BREAK-1 on ZX81 ENDIF pop hl pop de ret nc ; if BREAK is pressed, return; timeout error code is valid for BREAK too ld a,3 cp l ; timeout ? jr z,ld_retry xor a or l ret nz ; other errors ld a,(header2) cp e ret z ; all OK ld l,4 ; file type error ret DEFC ASMDISP_TAPE_LOAD_BLOCK_CALLEE = # asmentry - tape_load_block_callee
14.43617
88
0.675018
676e0978ab335d8f1859aa7f48a8138e79620249
1,076
asm
Assembly
programs/oeis/060/A060264.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/060/A060264.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/060/A060264.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A060264: First prime after 2n. ; 2,3,5,7,11,11,13,17,17,19,23,23,29,29,29,31,37,37,37,41,41,43,47,47,53,53,53,59,59,59,61,67,67,67,71,71,73,79,79,79,83,83,89,89,89,97,97,97,97,101,101,103,107,107,109,113,113,127,127,127,127,127,127,127,131,131,137,137,137,139,149,149,149,149,149,151,157,157,157,163,163,163,167,167,173,173,173,179,179,179,181,191,191,191,191,191,193,197,197,199,211,211,211,211,211,211,223,223,223,223,223,223,227,227,229,233,233,239,239,239,241,251,251,251,251,251,257,257,257,263,263,263,269,269,269,271,277,277,277,281,281,283,293,293,293,293,293,307,307,307,307,307,307,307,311,311,313,317,317,331,331,331,331,331,331,331,337,337,337,347,347,347,347,347,349,353,353,359,359,359,367,367,367,367,373,373,373,379,379,379,383,383,389,389,389,397,397,397,397,401,401,409,409,409,409,419,419,419,419,419,421,431,431,431,431,431,433,439,439,439,443,443,449,449,449,457,457,457,457,461,461,463,467,467,479,479,479,479,479,479,487,487,487,487,491,491,499,499,499,499 mul $0,2 cal $0,151800 ; Least prime > n (version 2 of the "next prime" function). mov $1,$0
153.714286
948
0.726766
16f16ba03179ef64e96ec11c8ed6ddf70e4e73aa
420
asm
Assembly
programs/oeis/159/A159721.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/159/A159721.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/159/A159721.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A159721: Number of permutations of 3 indistinguishable copies of 1..n arranged in a circle with exactly 1 local maximum. ; 6,36,192,960,4608,21504,98304,442368,1966080,8650752,37748736,163577856,704643072,3019898880,12884901888,54760833024,231928233984,979252543488,4123168604160,17317308137472,72567767433216,303465209266176,1266637395197952,5277655813324800 mov $1,$0 add $1,2 mov $2,4 pow $2,$0 mul $1,$2 mul $1,3
42
238
0.811905
af42318f112a2de87c03243b68c2f0f99a93c224
4,826
asm
Assembly
10a-interrupts/boot.asm
starsheriff/train-os
218f446fd0a6be12e7f51664631a17d00dca94de
[ "Apache-2.0" ]
3
2019-10-23T06:21:45.000Z
2022-01-25T13:00:02.000Z
10a-interrupts/boot.asm
starsheriff/train-os
218f446fd0a6be12e7f51664631a17d00dca94de
[ "Apache-2.0" ]
null
null
null
10a-interrupts/boot.asm
starsheriff/train-os
218f446fd0a6be12e7f51664631a17d00dca94de
[ "Apache-2.0" ]
null
null
null
; boot.asm ; The label start is our entry point. We have to make it ; public so that the linker can use it. global start extern c_start extern init_idt extern print_interrupt global flush_idt ; we are still in 32-bit protected mode so we have to use ; 32-bit wide instructions bits 32 ; PTE_PRESENT equ 1 << 7 ; Flags for _large_ p2 aka. PDE page table entries PDE_PRESENT equ 1 << 0 PDE_WRITABLE equ 1 << 1 PDE_LARGE equ 1 << 7 ; number of entries in IDT_ENTRIES equ 32 ; GDT Flags start: ; Set stack pointer mov esp, stack_top ; Switching to long mode ; ; Step 1: Disable paging ; ; to disable paging set `CR0.PG` to `0`. mov eax, cr0 and eax, ~(1 << 31) mov cr0, eax ; Step 2: Enable Physical Address Extension mov eax, cr4 or eax, (1 << 5) mov cr4, eax ; Step 3: Set `cr3` register mov eax, p4_table mov cr3, eax ; Step 4: Set the p2[1] entry to point to the _second_ 2 MiB frame mov eax, (0x20_0000 | PDE_PRESENT | PDE_WRITABLE | PDE_LARGE) mov [p2_table + 8], eax ; point the 0th entry to the first frame ; TODO: explain mov eax, (0x00_0000 | PDE_PRESENT | PDE_WRITABLE | PDE_LARGE) mov [p2_table], eax ; Step 5: Set the 0th entry of p3 to point to our p2 table mov eax, p2_table ; load the address of the p2 table or eax, (PDE_PRESENT | PDE_WRITABLE) mov [p3_table], eax ; Step 6: Set the 0th entry of p4 to point to our p3 table mov eax, p3_table or eax, (PDE_PRESENT | PDE_WRITABLE) mov [p4_table], eax ; Step 7: Set EFER.LME to 1 to enable the long mode mov ecx, 0xC0000080 rdmsr or eax, 1 << 8 wrmsr ; Step 8: enable paging mov eax, cr0 or eax, 1 << 31 mov cr0, eax ; Now we set up the IDT ; Step 9: Disable Interrupts lgdt [gdt64.pointer] ; Step 11: Enable Interrupts ; cli ; disable interrupts jmp gdt64.code:longstart section .text bits 64 longstart: mov rsp, stack_top ; not sure if we have to reload the lgdt once we are in 64-bit mode. lgdt [gdt64.pointer] ; load the interrupt descriptor table register. This allows the cpu to find the ; interrupt descriptor table (IDT). lidt [idt.idtr] ; call populate_idt ; asm code call init_idt ; c code ;mov word [0xb8000], 0x0e4f ; 'O', yellow on black ;mov word [0xb8002], 0x0e4b ; 'K', yellow on black ; sti ; immediately clear interupts to avoid reboots ; cli ; uncomment the next line and you will have a page fault ;mov eax, [0xFF_FFFF] call c_start ; dummy handler that does _nothing_ global idt_handler idt_handler: ; jmp $ call print_interrupt iretq global disable_interrupts disable_interrupts: cli ret global trigger_interrupt trigger_interrupt: int 0x03 ret ; *************************************** IDT ********************* FLAG_INTERRUPT equ 0xe FLAG_R0 equ (0 << 5) ;Rings 0 - 3 FLAG_P equ (1 << 7) CODE_SEL equ 0x08 GLOBAL populate_idt populate_idt: mov eax, idt mov ebx, idt_handler ; or ebx, (VIRT_BASE & 0xFFFFFFFF) idt_init_one: ; /* Target Low (word) */ mov ecx, ebx mov word [eax], cx add eax, 2 ; /* Code Selector (word) */ mov word[eax], CODE_SEL add eax, 2 ; /* IST (byte) */ mov byte[eax], 0 add eax, 1 ; /* Flags (byte) */ mov byte[eax], (FLAG_P|FLAG_R0|FLAG_INTERRUPT) add eax, 1 ; /* Target High (word) */ shr ecx, 16 mov word[eax], cx add eax, 2 ; /* Long Mode Target High 32 */ shr ecx, 16 mov dword[eax], ecx ;(idt_handler >> 32) add eax, 4 mov dword[eax], 0 add eax, 4 cmp eax, idt.idtend jl idt_init_one ; lidt[IDTR] ret flush_idt: ; changed from +8 to +16, that did the trick! mov rax, [rsp+16] lidt[rax] ret section .bss ; must be page aligned align 4096 p4_table: resb 4096 p3_table: resb 4096 p2_table: resb 4096 stack_bottom: resb 4096 stack_top: section .rodata gdt64: dq 0 .code: equ $ - gdt64 dq (1 << 43) | (1 << 44) | (1 << 47) | (1 << 53) .pointer: dw $ - gdt64 - 1 ; length of the gdt64 table dq gdt64 ; address of the gdt64 table section .data ; bits 64 ; ; the IDT table contains 256 64-bit entries. ; Hence, we reserve 256 double quad words (64-bit) entries. ; ; The IDT must be 16-bit aligned. align 16 ; global idt idt: times IDT_ENTRIES dq 0 ; a double quad per entry times IDT_ENTRIES dq 0 ; a double quad per entry ; Figure 4-8 shows the format of the `IDTR` in long-mode. The format is identical to the ; format in protected mode, except the size of the base address. .idtr: dw $ - idt - 1 ; two bytes (word), declaring the size of the IDT in bytes dq idt ; 64-bit (double quad word) base address of the idt .idtend:
20.891775
88
0.636345

This repo contains (up to) 30k samples of 21 languages (top 20 languages by StackOverflow survey, html/css was splited).

'javascript', 'html', 'css', 'python', 'sql', 'typescript', 'shell', 'java', 'c-sharp', 'cpp', 'c', 'php', 'powershell', 'go', 'rust', 'kotlin', 'lua', 'dart', 'assembly', 'ruby', 'swift'

Downloads last month
31
Edit dataset card